Repository: jcoppieters/cody Branch: master Commit: 0e10677068a2 Files: 319 Total size: 3.1 MB Directory structure: gitextract_3aeu67e9/ ├── .gitignore ├── .npmignore ├── Contributing.md ├── History.md ├── LICENSE.md ├── README.md ├── apps/ │ ├── Application.js │ ├── Dynamic.js │ └── Static.js ├── bin/ │ ├── create_site.js │ └── remove_site ├── controllers/ │ ├── ContactController.js │ ├── Controller.js │ ├── DashboardController.js │ ├── EmailController.js │ ├── FileController.js │ ├── FormController.js │ ├── FormDataController.js │ ├── ImageController.js │ ├── LoginController.js │ ├── PageController.js │ ├── StylesController.js │ ├── SystemController.js │ ├── TemplateController.js │ ├── TreeController.js │ └── UserController.js ├── doc/ │ ├── Context.txt │ ├── empty/ │ │ ├── controllers/ │ │ │ └── YourController.js │ │ ├── empty.sql │ │ ├── index.js │ │ ├── locales/ │ │ │ ├── en.json │ │ │ └── zh-CN.json │ │ ├── static/ │ │ │ ├── css/ │ │ │ │ └── front.css │ │ │ └── js/ │ │ │ └── script.js │ │ └── views/ │ │ ├── content.ejs │ │ ├── footer.ejs │ │ ├── header.ejs │ │ ├── index.ejs │ │ ├── intros.ejs │ │ ├── menu-left.ejs │ │ ├── menu-top.ejs │ │ └── page.ejs │ ├── hosting_sqlbased/ │ │ ├── codymaster.sql │ │ └── index.js │ └── todo.txt ├── index.js ├── makeWebApp.js ├── models/ │ ├── Atom.js │ ├── Content.js │ ├── Context.js │ ├── Item.js │ ├── Meta.js │ ├── Model.js │ ├── Page.js │ ├── Path.js │ ├── Template.js │ ├── User.js │ └── Website.js ├── package.json ├── startWebApp.js ├── startserver.js ├── static/ │ ├── css/ │ │ ├── cody.css │ │ └── ui-lightness/ │ │ └── jquery-ui-1.10.1.css │ └── js/ │ ├── atom-tree.js │ ├── lib/ │ │ ├── html5shiv.js │ │ ├── jquery-1.9.1.js │ │ ├── jquery-ui-1.10.1.js │ │ ├── jquery.jstree.js │ │ ├── jquery.validate.js │ │ ├── localization/ │ │ │ ├── jquery.ui.datepicker-de.js │ │ │ ├── jquery.ui.datepicker-en.js │ │ │ ├── jquery.ui.datepicker-es.js │ │ │ ├── jquery.ui.datepicker-fr.js │ │ │ ├── jquery.ui.datepicker-nl.js │ │ │ ├── messages_de.js │ │ │ ├── messages_en.js │ │ │ ├── messages_es.js │ │ │ ├── messages_fr.js │ │ │ └── messages_nl.js │ │ └── themes/ │ │ ├── apple/ │ │ │ └── style.css │ │ ├── classic/ │ │ │ └── style.css │ │ └── default/ │ │ └── style.css │ ├── pages-editor.js │ ├── script.js │ └── tinymce/ │ ├── jquery.tinymce.js │ ├── langs/ │ │ └── en.js │ ├── license.txt │ ├── plugins/ │ │ ├── advhr/ │ │ │ ├── css/ │ │ │ │ └── advhr.css │ │ │ ├── editor_plugin.js │ │ │ ├── editor_plugin_src.js │ │ │ ├── js/ │ │ │ │ └── rule.js │ │ │ ├── langs/ │ │ │ │ └── en_dlg.js │ │ │ └── rule.htm │ │ ├── advimage/ │ │ │ ├── css/ │ │ │ │ └── advimage.css │ │ │ ├── editor_plugin.js │ │ │ ├── editor_plugin_src.js │ │ │ ├── image.htm │ │ │ ├── js/ │ │ │ │ └── image.js │ │ │ └── langs/ │ │ │ └── en_dlg.js │ │ ├── advlink/ │ │ │ ├── css/ │ │ │ │ └── advlink.css │ │ │ ├── editor_plugin.js │ │ │ ├── editor_plugin_src.js │ │ │ ├── js/ │ │ │ │ └── advlink.js │ │ │ ├── langs/ │ │ │ │ └── en_dlg.js │ │ │ └── link.htm │ │ ├── advlist/ │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── autolink/ │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── autoresize/ │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── autosave/ │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── bbcode/ │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── contextmenu/ │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── directionality/ │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── emotions/ │ │ │ ├── editor_plugin.js │ │ │ ├── editor_plugin_src.js │ │ │ ├── emotions.htm │ │ │ ├── js/ │ │ │ │ └── emotions.js │ │ │ └── langs/ │ │ │ └── en_dlg.js │ │ ├── example/ │ │ │ ├── dialog.htm │ │ │ ├── editor_plugin.js │ │ │ ├── editor_plugin_src.js │ │ │ ├── js/ │ │ │ │ └── dialog.js │ │ │ └── langs/ │ │ │ ├── en.js │ │ │ └── en_dlg.js │ │ ├── example_dependency/ │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── fullpage/ │ │ │ ├── css/ │ │ │ │ └── fullpage.css │ │ │ ├── editor_plugin.js │ │ │ ├── editor_plugin_src.js │ │ │ ├── fullpage.htm │ │ │ ├── js/ │ │ │ │ └── fullpage.js │ │ │ └── langs/ │ │ │ └── en_dlg.js │ │ ├── fullscreen/ │ │ │ ├── editor_plugin.js │ │ │ ├── editor_plugin_src.js │ │ │ └── fullscreen.htm │ │ ├── iespell/ │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── inlinepopups/ │ │ │ ├── editor_plugin.js │ │ │ ├── editor_plugin_src.js │ │ │ ├── skins/ │ │ │ │ └── clearlooks2/ │ │ │ │ └── window.css │ │ │ └── template.htm │ │ ├── insertdatetime/ │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── layer/ │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── legacyoutput/ │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── lists/ │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── media/ │ │ │ ├── css/ │ │ │ │ └── media.css │ │ │ ├── editor_plugin.js │ │ │ ├── editor_plugin_src.js │ │ │ ├── js/ │ │ │ │ ├── embed.js │ │ │ │ └── media.js │ │ │ ├── langs/ │ │ │ │ └── en_dlg.js │ │ │ ├── media.htm │ │ │ └── moxieplayer.swf │ │ ├── nonbreaking/ │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── noneditable/ │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── pagebreak/ │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── paste/ │ │ │ ├── editor_plugin.js │ │ │ ├── editor_plugin_src.js │ │ │ ├── js/ │ │ │ │ ├── pastetext.js │ │ │ │ └── pasteword.js │ │ │ ├── langs/ │ │ │ │ └── en_dlg.js │ │ │ ├── pastetext.htm │ │ │ └── pasteword.htm │ │ ├── preview/ │ │ │ ├── editor_plugin.js │ │ │ ├── editor_plugin_src.js │ │ │ ├── example.html │ │ │ ├── jscripts/ │ │ │ │ └── embed.js │ │ │ └── preview.html │ │ ├── print/ │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── save/ │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── searchreplace/ │ │ │ ├── css/ │ │ │ │ └── searchreplace.css │ │ │ ├── editor_plugin.js │ │ │ ├── editor_plugin_src.js │ │ │ ├── js/ │ │ │ │ └── searchreplace.js │ │ │ ├── langs/ │ │ │ │ └── en_dlg.js │ │ │ └── searchreplace.htm │ │ ├── spellchecker/ │ │ │ ├── css/ │ │ │ │ └── content.css │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── style/ │ │ │ ├── css/ │ │ │ │ └── props.css │ │ │ ├── editor_plugin.js │ │ │ ├── editor_plugin_src.js │ │ │ ├── js/ │ │ │ │ └── props.js │ │ │ ├── langs/ │ │ │ │ └── en_dlg.js │ │ │ ├── props.htm │ │ │ └── readme.txt │ │ ├── tabfocus/ │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── table/ │ │ │ ├── cell.htm │ │ │ ├── css/ │ │ │ │ ├── cell.css │ │ │ │ ├── row.css │ │ │ │ └── table.css │ │ │ ├── editor_plugin.js │ │ │ ├── editor_plugin_src.js │ │ │ ├── js/ │ │ │ │ ├── cell.js │ │ │ │ ├── merge_cells.js │ │ │ │ ├── row.js │ │ │ │ └── table.js │ │ │ ├── langs/ │ │ │ │ └── en_dlg.js │ │ │ ├── merge_cells.htm │ │ │ ├── row.htm │ │ │ └── table.htm │ │ ├── template/ │ │ │ ├── blank.htm │ │ │ ├── css/ │ │ │ │ └── template.css │ │ │ ├── editor_plugin.js │ │ │ ├── editor_plugin_src.js │ │ │ ├── js/ │ │ │ │ └── template.js │ │ │ ├── langs/ │ │ │ │ └── en_dlg.js │ │ │ └── template.htm │ │ ├── visualblocks/ │ │ │ ├── css/ │ │ │ │ └── visualblocks.css │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── visualchars/ │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ ├── wordcount/ │ │ │ ├── editor_plugin.js │ │ │ └── editor_plugin_src.js │ │ └── xhtmlxtras/ │ │ ├── abbr.htm │ │ ├── acronym.htm │ │ ├── attributes.htm │ │ ├── cite.htm │ │ ├── css/ │ │ │ ├── attributes.css │ │ │ └── popup.css │ │ ├── del.htm │ │ ├── editor_plugin.js │ │ ├── editor_plugin_src.js │ │ ├── ins.htm │ │ ├── js/ │ │ │ ├── abbr.js │ │ │ ├── acronym.js │ │ │ ├── attributes.js │ │ │ ├── cite.js │ │ │ ├── del.js │ │ │ ├── element_common.js │ │ │ └── ins.js │ │ └── langs/ │ │ └── en_dlg.js │ ├── themes/ │ │ ├── advanced/ │ │ │ ├── about.htm │ │ │ ├── anchor.htm │ │ │ ├── charmap.htm │ │ │ ├── color_picker.htm │ │ │ ├── editor_template.js │ │ │ ├── editor_template_src.js │ │ │ ├── image.htm │ │ │ ├── js/ │ │ │ │ ├── about.js │ │ │ │ ├── anchor.js │ │ │ │ ├── charmap.js │ │ │ │ ├── color_picker.js │ │ │ │ ├── image.js │ │ │ │ ├── link.js │ │ │ │ └── source_editor.js │ │ │ ├── langs/ │ │ │ │ ├── en.js │ │ │ │ └── en_dlg.js │ │ │ ├── link.htm │ │ │ ├── shortcuts.htm │ │ │ ├── skins/ │ │ │ │ ├── default/ │ │ │ │ │ ├── content.css │ │ │ │ │ ├── dialog.css │ │ │ │ │ └── ui.css │ │ │ │ ├── highcontrast/ │ │ │ │ │ ├── content.css │ │ │ │ │ ├── dialog.css │ │ │ │ │ └── ui.css │ │ │ │ └── o2k7/ │ │ │ │ ├── content.css │ │ │ │ ├── dialog.css │ │ │ │ ├── ui.css │ │ │ │ ├── ui_black.css │ │ │ │ └── ui_silver.css │ │ │ └── source_editor.htm │ │ └── simple/ │ │ ├── editor_template.js │ │ ├── editor_template_src.js │ │ ├── langs/ │ │ │ └── en.js │ │ └── skins/ │ │ ├── default/ │ │ │ ├── content.css │ │ │ └── ui.css │ │ └── o2k7/ │ │ ├── content.css │ │ └── ui.css │ ├── tiny_mce.js │ ├── tiny_mce_popup.js │ ├── tiny_mce_src.js │ └── utils/ │ ├── editable_selects.js │ ├── form_utils.js │ ├── mctabs.js │ └── validate.js ├── testing/ │ └── testdynamic.js └── views/ ├── cms/ │ ├── comments-ajax.ejs │ ├── comments.ejs │ ├── contacts.ejs │ ├── content-type.ejs │ ├── dashboard.ejs │ ├── files-ajax.ejs │ ├── files.ejs │ ├── footer.ejs │ ├── forms-ajax.ejs │ ├── forms-data.ejs │ ├── forms-list.ejs │ ├── forms.ejs │ ├── header.ejs │ ├── images-ajax.ejs │ ├── images.ejs │ ├── navigation.ejs │ ├── pages-ajax.ejs │ ├── pages.ejs │ ├── styles.ejs │ ├── system.ejs │ ├── templates.ejs │ ├── top.ejs │ └── users.ejs ├── front/ │ └── index.ejs └── login.ejs ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ # # Project Exclude # .idea/ tests/ node_modules/ /doc/todo-jc.txt # # OS generated files # .DS_Store .DS_Store? ._* .Spotlight-V100 .Trashes ehthumbs.db Thumbs.db *.log ================================================ FILE: .npmignore ================================================ archive bok codyweb jsconf stef stoerhuus ================================================ FILE: Contributing.md ================================================ Contributing ============ We are happy to accept your pull requests. If you do, make sure you clearly explain what and why you changed/added something so we can easily review it. * Sadly enough we have no tests yet, but they will be coming soon. * Make sure your code is linted and follow the general code style: * "" for strings * 2 whitespace indentation * named functions as much as possible * semi-colons! * name your captured this "self" Guide to making a pull request can be found here: A shortened version goes as follows: I assume you have git command-line installed, if not install from [here](http://git-scm.com/downloads). 1) **Fork** this repository by clicking the "Fork" in the upper corner of this page, or by visiting this link: https://github.com/jcoppieters/cody/fork 2) **Clone** your forked repository (probably called linksgo2011/cody) on your local computer ([guide to cloning](https://github.com/jcoppieters/cody/compare/)) ```` $ git clone https://github.com/jcoppieters/cody.git ```` 3) Make a new branch with a name that conveys your change (e.g. "added-unicorns") ```` $ git checkout -b feature_branch_name ```` 4) Make the changes you want to make on the files of the local repository. 5) **Commit** the changes. In your local repository do: ```` $ git add . -A $ git commit -a -m "explain the changes you made. (e.g. I added unicorns)" ```` 6) **Push** the changes to your forked repository on github. In your local repository do: ```` $ git push -u origin feature_branch_name ```` 6) Submit a **Pull Request** by going to your repository on github and clicking the green arrows at the left top, or by visiting this link: https://github.com/jcoppieters/cody/compare/. Choose your new branch to pull to the jcoppieters/master branch. I hope this helps to get you started, if you got any question/problem along the way just shoot! All the best. ================================================ FILE: History.md ================================================ # History ## 4.0.1..8 - 08/05/2025 - JC * Use url prefix everywhere (also in the back-office !) * fix forgotten password2 use * don't use: xxx.url, use: xxx.getURL() * better pool connection parameters for mysql * change all the <% include xxx %> into <%- include("xxx") %> * ## 4.0.0 - 06/05/2025 - JC * Changed mysql to mysql2 library for mysql 8.x * WARNING: if you use the mysql password function, change to password2 and add this function to your database: ``` CREATE FUNCTION PASSWORD2(s VARCHAR(50)) RETURNS VARCHAR(50) DETERMINISTIC RETURN CONCAT('*', UPPER(SHA1(UNHEX(SHA1(s))))); ``` * Upgrades of vulnerabilities: * Updating ejs to 3.1.10, which is a SemVer major change. * Updating nodemailer to 7.0.2, which is a SemVer major change. * Updating multer to 1.4.5-lts.2, which is a SemVer major change. ## 3.4.5 - 11/05/2015 - TC * Added mysql 5.7+ support for population script * Fixed index.ejs, content.ejs and page.ejs for node 6+ ## 3.4 - 25/08/2015 - TC * Merged the pull request (i18n) of linksgo into the master branch. Chinese is now supported for the Cody interface and more languages can be added. ## 3.3.19 - 03/06/2015 - JC * Added IP and path logging for the 3 app's. (starts with "LOG --A--", S and D for resp. Application, Static and Dynamic content requests) ## 3.3.17 - 20/05/2015 * Added an example controller to the empty site, removes the bug where the controller directory isn't tracked by git. ## 3.3.10 - 10/04/2015 * better setup, small corrections. ## 3.3.5 - 29/03/2015 * changed the directory structure to more reflect the hosting setup * changes create script and you now have a startupscript in your cody-dev directory per project > The user is no longer required to change the index.js afer scaffolding. ## 3.3.14 - 28/03/2015 * Added ContactController ## 3.3.5 - 20/01/2015 * Allow custom config file that overwrites the default config by supplying it on command-line with -c, by andretw. [Pull request](https://github.com/jcoppieters/cody/pull/17) ## 3.3.4 - 02/01/2015 * Security: prevent from loading static files outside of the public folder scope. [Issue](https://github.com/jcoppieters/cody/issues/16) ## 3.3.2 - 06/11/2014 * The scaffolding is now written in node, run with: $node ./node_modules/cody/bin/create_script ## 3.2.0 - 22/10/2014 * cccs -> create_script * create_script now generates a config.json file that contains all the necessary configuration variables. They can be changed manually in the file or they can be overriden by setting the respective environment variables. ```bash $ dbuser=mydbuser dbpassword=mydbpassword port=8080 node index ``` ================================================ FILE: LICENSE.md ================================================ The MIT License (MIT) Copyright (c) 2015 Johan Coppieters - Howest. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # Cody CMS A Javascript Content Management System running on Node.js We finally took upon the task, we are happy to announce the transition to Express 4 is now done! (dixit Slawo) See http://www.cody-cms.com for more info and examples on http://github.com/jcoppieters/cody-samples You can now use npm to install Cody thanks to Jonas. ## Features * Node.js CMS * Easy-to-use graphical interface + wysiwyg (what you see is what you get) editor that allows non-programmers to manage the site's *content*, *users*, *files*, *forms* and *images*. * Tree structured GUI to manage the structure of the site and the editable content by using templates and drag-and-drop. * Works seamless with your existing node.js code. ## Getting Started By following these steps you will be running your own CMS system in no time. If any of the steps do not work for you, please report this as an issue on this github repository and we will look into it as soon as possible! * Install [nodejs](http://nodejs.org/download/) and [mysql](http://dev.mysql.com/downloads/mysql/) * Create a new directory for your cms and navigate to it (in unix): ```bash $ mkdir codydev $ cd codydev ``` * Install cody and its dependencies ```bash $ npm install cody ``` * Set up a new web site using the guided scaffolding ```bash $ node ./node_modules/cody/bin/create_site Creating cody web tree in current directory 1) Enter sitename: mysite Note: also using my site as database name. Note: by default the mysql root user has no password so you can just hit enter, if you forgot the root password see http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html 2) Enter root password for mysql so we can create a new database and user: 3) Enter site database user: mysitename 4) Enter site database password: mysitepassword 5) Enter hostname for site: mysite.local (or localhost) Site mysite has been prepared. Please create DNS entries, or add to /etc/hosts: 127.0.0.1 mysite.local Also check index.js and config.json to fine-tune extra parameters, encryption key, ... Start your site using: forever start mysite.js or node mysite.js ``` * Add a DNS entry for given hostname, e.g. ```bash $ sudo bash -c 'echo 127.0.0.1 mysite.local >> /etc/hosts' ``` * Run the server ```bash $ node mysite.js ``` or if you want to automatically restart the server on changes ```bash $ forever start mysite.js ``` * Go to "http://mysite.local:3001" to see your current site and go to "http://mysite.local:3001/en/dashboard" to see the CMS of the site. the default users are: 'super', 'admin', 'test' and 'user' which all have password 'empty' you can ofcourse use "http://localhost:3001" too. ## Configuration The create_site scaffolding creates a config.json file in the root of your project directory. This configuration can be adjust in the following three ways, listed in order of overwriting order (e.g. values of 2 will overwrite those of 1, etc.): 1. Manually adjust the values in the config.json file 2. Create your own config file and supply it at command-line with the -c option (since v3.2.5, thanks to [andretw](https://github.com/jcoppieters/cody/pull/17)) ```bash $ node index.js -c my_overwriting_config.json ``` 3. Provide environment variables ```bash $ dbuser=dbuser dbpassword=dbpassword port=8080 node index.js ``` Careful, all three cases need a server restart before they take effect! Have a look at the generated config.json file to see which configuration variables you can use. ## Troubleshooting ##### I get "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)" when running the scaffold script > Your mysql server is not started. * On Mac OS: go to "System Preferences" -> "Mysql" -> "Start" * On any unix machine: ```$ mysqld &``` ##### After "5) Enter hostname for site" it prompts for "Enter password:" > You entered the incorrect password for your root user of the mysql database. Try to figure out the correct password or reset it: http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html ## Contributors * Johan Coppieters * Jonas Maes * Tim Coppieters * Dieter * Laurens * Jelle * devoidfury * Andretw * You? We are always happy to review and accept your issues/pull requests! ## License Copyright (c) 2012-2025 Johan Coppieters. See the LICENSE.md file for license rights and limitations. This project is licensed under the terms of the MIT license. Johan Coppieters, Jonas Maes - Tim Coppieters, VUB. ================================================ FILE: apps/Application.js ================================================ // // Johan Coppieters - jan 2013 - jWorks // // var mysql = require('mysql2'); // JM: assuming Application is always require()'d directly by cody/index.js since ../../index.js is ugly. // maybe replace in all other files as well. var cody = module.parent.exports; console.log("loading " + module.id); function Application(config) { this.templates = {}; // hashmap with (id - template) this.items = {}; // hashmap with (id - item) this.pages = []; // array with all pages this.urls = {}; // hashmap with (urls - page) this.atoms = {}; // hashmap with (id - atom) this.languages = []; // array with all languages this.domains = []; // array with all (user) domains this.controllers = {}; // hashmap with (name - constructor) this.testing = config.testing || config.testing || false; this.logging = config.logging || config.logging || true; this.defaultlanguage = config.defaultlanguage || config.defaultlanguage || Application.kDefaultLanguage; Application.kDefaultLanguage = this.defaultlanguage; //TODO: don't we have to return errors if some of these are missing ? this.name = config.name || "cody"; this.prefix = config.prefix || ""; this.version = config.version || "v1.0"; this.datapath = config.datapath || "./data"; this.dbuser = config.dbuser || "cody"; // allowing empty password, thanks linksgo2011 & ticup (changed also in template startup file: doc/empty/index.js) this.dbpassword = (typeof config.dbpassword === "undefined") ? "ydoc" : config.dbpassword; this.dbhost = config.dbhost || "localhost"; this.dbport = config.dbport || 3306; this.db = config.db || "cody"; this.smtp = config.smtp || "smtp.telenet.be"; this.smtpoptions = config.smtpoptions; // see https://github.com/andris9/Nodemailer this.mailFrom = config.mailFrom || "info@cody-cms.org"; this.dumpStructures = config.dumpstructures || true; if (this.logging) { console.log(this); } } module.exports = Application; // Constants Application.kDefaultLanguage = "en"; // Atom roots Application.kImageRoot = 1; Application.kFileRoot = 2; Application.kFormRoot = 3; // Content root id's Application.kNoPage = -1; Application.kHomePage = 1; Application.kLoginPage = 2; Application.kOrphansPage = 3; Application.kFooterPage = 4; Application.kDashboardPage = 9; Application.kGlobalPage = 99; Application.prototype.init = function( done ) { var self = this; self.getConnection(); self.addControllers(); // daisy chained loading of all CMS elements: // languages, templates, atoms, items, pages with content,... self.fetchStructures( done ); }; Application.prototype.addController = function(name, controller) { var self = this; self.controllers[name] = controller; }; Application.prototype.addControllers = function() { var self = this; var path = require('path') // add all controllers in the controller directory of cody // JM: module.parent = the invoking cody; its parent is the running // web app's module (user code). // note that path.resolve confuses the filename at the end of the // module path with a directory, so we need extra .. to refer to // the directory it is in. require("fs").readdirSync(path.resolve(module.parent.filename, '..', 'controllers/')).forEach(function(file) { var ctl = require(path.resolve(module.parent.filename, '..', 'controllers', file)); self.addController(ctl.name, ctl); }); // add alias 'ContentController' of 'Controller' self.addController("ContentController", self.controllers["controller"]); }; Application.prototype.err = function(p1, p2, res) { var self = this; console.log("*** error ***"); self.log(p1, p2); if (typeof res !== "undefined") { res.writeHead(404, { "Content-Type": "text/plain" }); res.write("404 Not Found\n"); res.end(); } }; Application.prototype.log = function(p1, p2) { var self = this; if (self.logging) { if (typeof p1 === "undefined" && typeof p2 === "undefined") { console.log("Application -> "); console.log(this); } else if (typeof p2 === "undefined") { console.log(" - " + p1); } else { console.log(p1 + " -> " + p2); } } }; Application.prototype.getDataPath = function() { return this.datapath; }; /////////////// // Utilities // /////////////// Application.endOfTime = function() { return new Date(2100,12,31,23,59,59); }; Application.findFirst = function(theList) { var first = undefined; for (var f in theList) { if (theList.hasOwnProperty(f)) { first = theList[f]; break; } } return first; }; // Daisy chain operators // - list should be an array // - iterator is a function that should call the passed function when done // if it passes an error to the function the loop ends here // - finished is a function that is called when everything is done with no parameter // or that is called when the first error occurs // // Example: // var list = [1, 2, 3, 4, 5]; // var sum = 0; // Application.each(list, function(done) { // sum += this; // done(); // pass an error is something went wrong // // }, function(err) { // // do something with the err if any... // console.log("sum = " + sum); // // }); Application.each = function(list, iterator, finished) { var nr = list.length; function one(current) { if (current >= nr) { finished(); } else { iterator.call(list[current], function(err) { if (err) { finished(err); } one(current+1); }); } } one(0); }; // Daisy chain functions // - functionList is a list of functions to be executed // - each function is executed, with a callback function to be called at the end // - if this callback is passed an error, the execution is terminated // and the finish function will be called with this error // - the finish function is called at the end with no error if everything went well // // Example: // var anObject = { nr: 0 }; // var aList = [ [anObject, function(done) { this.nr++; done(); }], // [anObject, function(done) { this.nr += 2; done(); }] ]; // var nr = 0; // Application.doList(flist, function(err) { // console.log("error ? " + err + ", total = " + anObject.nr); // }); // Application.doList = function(functionList, finished) { var nr = functionList.length; function one(current) { if (current >= nr) { if (typeof finished === "function") { finished(); } } else { var entry = functionList[current]; entry[1].call( entry[0], function(err) { if (err) { if (typeof finished === "function") { finished(err); } } one(current+1); }); } } one(0); }; ////////////////// // Page serving // ////////////////// Application.prototype.servePage = function(req, res) { var self = this; var url = (self.prefix) ? req._parsedUrl.pathname.substring(self.prefix.length+1) : req._parsedUrl.pathname; var path = new cody.Path(url, self.defaultlanguage); var ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress || req.socket.remoteAddress || req.connection.socket.remoteAddress; console.log("--LOG--A--|" + ip + "|" + new Date() + "|" + req.headers['host'] + "|" + req._parsedUrl.pathname); self.log("servePage - path -> " + path.link); var aContext = self.buildContext( path, req, res ); if (typeof aContext !== "undefined") { self.handToController(aContext); } }; Application.prototype.buildContext = function (path, req, res) { var self = this; // get the page var page = self.findPage(path); if (typeof page === "undefined") { self.err("servePage", "No page found for path = " + path.pagelink, res); return undefined; } self.log("buildContext -> page", page.language + "/" + page.itemId + " - " + page.title); // build a context var context = new cody.Context(path, page, self, req, res); console.log("servePage - params -> "); console.log(context.params); console.log("servePage - session -> "); console.log(context.session); if (typeof req.files !== "undefined") { console.log("servePage - files -> "); console.log(req.files); } return context; }; Application.prototype.handToController = function(context) { var self = this; // make a controller and send it 'doRequest' self.log("handToController", context.page.item.template.controllerName); var controller = context.page.getController(context); if (typeof controller === "undefined") { self.err("handToController", "No controller found for " + context.page.item.template.controllerName); return; } // check if authentication is required for this action // and if so and not yet done: store this action and perform login first if (controller.needsLogin()) { if (controller.isLoggedIn()) { self.log("Application - check login", "already logged in"); if (! controller.isAllowed(context.page)) { controller.close(); self.notAllowed(context); return; } } else { self.log("Application - check login", "needs login, redirect/remember"); controller.close(); self.logInFirst(context); return; } } controller.doRequest( function(fn, header) { // callback function should always be called by doRequest // render with the specified or the template in the context (controller may have changed it) // if no render template present ( == "") either // -- assume the controller performed res.writeHead() / .write() / .end() -- ajax req? // -- another controller has taken over if (typeof fn === "object") { controller.gen(fn, header); } else { if (typeof fn !== "undefined") { context.fn = fn; } self.log("Application.handToController -> finished -> render view", (context.fn==="") ? "** none **" : context.fn); self.renderView( context ); } controller.close(); }); }; Application.prototype.renderView = function( context ) { var self = this; var path = require("path"); if (context.fn === "") { return; } // cody views can be used by starting the pathname with "-/" var i = context.fn.indexOf("-/"); // default root path for rendering in Express = [project]/views/ // JM: module.parent = the invoking cody; its parent is the running // web app's module (user code). // note that path.resolve confuses the filename at the end of the // module path with a directory, so we need extra .. to refer to // the directory it is in. var viewfile = (i === 0) ? path.resolve(module.parent.filename, "..", "views", context.fn.substring(2)) : path.resolve(module.parent.parent.filename, "..", "..", self.name, "views", context.fn); self.log("Application.renderView", viewfile); context.res.render(viewfile, context); }; // internal redirect = delegate Application.prototype.delegate = function(context, redirectTo) { var self = this; // either [language]/itemlink or itemlink var newURL = (redirectTo.indexOf("/") != 2) ? context.page.language + "/" + redirectTo : redirectTo; var aPath = new cody.Path(newURL, self.defaultlanguage); var aContext = self.buildContext( aPath, context.req, context.res ); self.handToController(aContext); }; Application.prototype.logInFirst = function(context) { // copy minimal version of the context to our session context.req.session.pendingContext = context.getMini(); this.delegate(context, "login"); }; Application.prototype.notAllowed = function(context) { this.delegate(context, "notallowed"); }; ///////////////// // SQL support // ///////////////// // // Shouldn't we use a connection pool instead of a single connection? // // const pool = mysql.createPool({ // host: 'localhost', // user: 'root', // database: 'test', // waitForConnections: true, // connectionLimit: 5, // queueLimit: 0 // }) // const users = await pool.query('SELECT * FROM users'); // // Advise from chatGPT: // • Reconnects on dropped connections via .on('error') // • Keeps the TCP socket alive with enableKeepAlive // • Prevents idle disconnects via ping() every 30s // • Avoids multiple setInterval() timers // • Fails fast during startup if the DB is unreachable, letting PM2 restart // Application.prototype.getConnection = function() { var self = this; function connectToDatabase() { return mysql.createConnection({ host: self.dbhost, port: self.dbport, user: self.dbuser, password: self.dbpassword, database: self.db, multipleStatements: true, supportBigNumbers: true, ssl: undefined, connectTimeout: undefined, // connection pool settings // connectionLimit: 16, waitForConnections: true, queueLimit: 50, // this keeps the tcp socket alive keepAliveInitialDelay: 10000, enableKeepAlive: true }); } if ((!self.connection) || (self.connection.state === 'disconnected')) { self.log("Application", "Make new Connection"); self.connection = connectToDatabase(); // reconnect on disconnect self.connection.on('error', err => { console.error('MySQL error', err); if (err.code === 'PROTOCOL_CONNECTION_LOST') { console.log('Reconnecting after connection lost: ', err); self.connection = connectToDatabase(); } }); // this keeps the connection alive (not the OS socket) self._intervalTimer = self._intervalTimer || setInterval(() => { self.connection.ping(err => { if (err) { console.error('Reconnecting after MySQL ping error: ', err); self.connection = connectToDatabase(); } }); }, 30000); } else { self.log("Application.getConnection", "Returning existing connection"); } if (!self.connection) { // PM2 will restart the app if this happens throw(new Error("Fatal error: No database connection")); } return self.connection; }; Application.prototype.returnConnection = function( connection ) { // Do nothing: we only have 1 connection and we don't close it in between requests... }; /////////////////////////////////////////// // Fetch all structured data into memory // /////////////////////////////////////////// Application.prototype.fetchStructures = function( done ) { var self = this; Application.doList([ [self, Application.prototype.fetchLanguages], [self, Application.prototype.fetchAtoms], [self, Application.prototype.fetchTemplates], [self, Application.prototype.fetchItems], [self, Application.prototype.fetchPages], [self, Application.prototype.fetchDomains] ], function(err){ if (err) { self.log("fetchStructures", "!! some of our loading functions failed !!"); } else { self.log("fetchStructures", "finished loading the database structures"); if (self.dumpStructures) { self.dump(); } if (typeof done === "function") { done (); } } }); }; /////////////// // Languages // /////////////// Application.prototype.fetchLanguages = function(done) { var self = this; cody.Page.loadLanguages(self.connection, function(result) { for (var i in result) { if (result.hasOwnProperty(i)) { self.languages.push(result[i]); if (typeof self.defaultlanguage === "undefined") self.defaultlanguage = result[i].id; } } self.log("Application.fetchLanguages", "fetched " + result.length + " languages"); // next step done(); }); }; Application.prototype.getLanguages = function() { return this.languages; }; Application.prototype.isDefaultLanguage = function(language) { return language === this.defaultlanguage; }; /////////// //Atoms // /////////// Application.prototype.getAtom = function(id) { return this.atoms[id]; }; Application.prototype.addAtom = function(atom) { var self = this; self.atoms[atom.id] = atom; atom.app = self; }; Application.prototype.hasAtomChildren = function(parent) { var self = this; for (var i = 0; i < self.atoms.length; i++) { if (self.atoms[i].parent === parent.id) { return true; } } return false; }; Application.prototype.getAtomChildren = function(parent) { var self = this; var list = []; for (var i in self.atoms) { var anAtom = self.atoms[i]; if (parent.isChild(anAtom)) { list.push(anAtom); } } list.sort( function(a, b) { return a.sortorder - b.sortorder; }); return list; }; Application.prototype.fetchAtoms = function(done) { var self = this; //fetch all atoms cody.Atom.loadAtoms(self.connection, function(result) { self.atoms = {}; for (var i = 0; i < result.length; i++) { self.addAtom(new cody.Atom(result[i])); } self.log("Application.fetchAtoms", "fetched " + result.length + " atoms"); // next step done(); }); }; /////////////// // Templates // /////////////// Application.prototype.getTemplate = function(templateId) { return this.templates[templateId]; }; Application.prototype.fetchTemplates = function(done) { var self = this; cody.Template.loadTemplates(self.connection, function(result) { self.templates = {}; for (var i = 0; i < result.length; i++) { // make an Template object of our data var O = new cody.Template(result[i], self.controllers); // store under its id self.templates[O.id] = O; } self.log("Application.fetchTemplates", "fetched " + result.length + " templates"); // next step done(); }); }; Application.prototype.templateUsed = function(templateId) { var found = false; for (var it in this.items) { if (this.items[it].templateId == templateId) { return true; } } return false; }; Application.prototype.deleteTemplate = function(templateId) { var self = this; var aTemplate = self.templates[templateId]; if (typeof aTemplate !== "undefined") { delete self.templates[templateId]; } return aTemplate; }; /////////// // Items // /////////// Application.prototype.getItem = function(itemId) { return this.items[itemId]; }; Application.prototype.attachItemChildren = function() { var self = this; // loop through all items and attach their parent for (var i in self.items) { // let the page itself pick from the list self.items[i].pickParent(self.items); } }; Application.prototype.addItem = function(anItem) { var self = this; self.items[anItem.id] = anItem; anItem.pickParent(self.items); self.log("Application.addItem", "added " + anItem.id + " / " + anItem.name); }; Application.prototype.fetchItems = function(done) { var self = this; cody.Item.loadItems(self.connection, function(result) { // make hashtable on item id self.items = {}; for (var i = 0; i < result.length; i++) { // make an Item object of our data var O = new cody.Item(result[i], self); // store under its id self.items[O.id] = O; } self.attachItemChildren(); self.log("Application.fetchItems", "fetched " + result.length + " items"); // console.log(self.items); // next step done(); }); }; /////////// // Pages // /////////// Application.prototype.getPage = function(languageOrLink, itemId) { var self = this; var link = languageOrLink; if (typeof itemId !== "undefined") { link += "/"+itemId; } return self.urls[link]; }; Application.prototype.findPage = function(path) { var self = this; // hash based on only language/domain // if only language is specified (can be the defaultlanguage), serve the welcome/home page var aPage = self.urls[path.pagelink + ((path.domain === "") ? "welcome" : "")]; // if page not found -> serve the language/notfound page if (typeof aPage === "undefined") { console.log("Application.findPage - not found -> " + path.pagelink + ", trying -> " + path.language + "/notfound"); aPage = self.urls[path.language + "/notfound"]; } if (typeof aPage !== "undefined") { aPage = aPage.getDisplay(); } return aPage; }; Application.prototype.genRoots = function() { var self = this; // loop through all pages and lookup its 'toplevel' (root) for (var i in self.pages) { self.pages[i].addRoot(); } }; Application.prototype.attachChildrenToPages = function() { var self = this; // loop through all pages and attach their children for (var i in self.pages) { // let the page itself pick from the list self.pages[i].addChildren(self.pages); } }; Application.prototype.buildSitemap = function() { var self = this; self.attachChildrenToPages(); self.genRoots(); }; Application.prototype.addPage = function(page) { var self = this; page.addTo(self); self.buildSitemap(); }; Application.prototype.fetchPages = function(done) { var self = this; cody.Page.loadPages(self.connection, function(result) { self.pages = []; self.urls = {}; Application.each(result, function(nextOne) { var onePage = new cody.Page(this, self); self.log("Application.fetchPages", onePage.title); onePage.addTo(self); onePage.loadContent(self, nextOne); }, function(err) { self.buildSitemap(); self.log("Application.fetchPages", "fetched " + result.length + " pages"); // next step done(); }); }); }; Application.prototype.deletePagesForItem = function( itemId, finish ) { var self = this; // delete the pages in every language from the url hashmap for (var i in self.languages) { var lan = self.languages[i].id; var P = self.getPage(lan, itemId); delete self.urls[lan+"/"+itemId]; if (P.link !== "") { delete self.urls[lan+"/"+P.link]; } } // delete the page from the pages array // by rebuilding the array while omitting the pages var newList = []; for (var p in self.pages) { if (self.pages[p].itemId != itemId) { newList.push(self.pages[p]); } } self.pages = newList; // rebuild the tree structure self.buildSitemap(); finish(); }; Application.prototype.dump = function() { var self = this; var cnt = 0; function printPage(lan, id) { var p = self.getPage(lan, id); if (p) { console.log(" " + p.shortString()); } else { console.log(" ** missing page **"); } } function printLevel(r, nr) { var tab = ""; for (var i=0; i malicious path: " + uri); generate404(self.response); return; } // check if this file exists fs.exists(filename, function (exists) { if (!exists) { console.log("Dynamic.serve -> file not found: " + filename); generate404(self.response); return; } fs.readFile(filename, "binary", function (err, file) { if (err) { console.log("Dynamic.serve -> error reading: " + filename + " - " + err); self.response.writeHead(500, { "Content-Type": "text/plain" }); self.response.write(err + "\n"); self.response.end(); return; } var type = mime.lookup(filename); console.log("Dynamic.serve -> reading: " + filename + " - " + file.length + " bytes as " + type); self.response.writeHead(200, { "Content-Type": type, "Cache-Control": "public, max-age=" + maxCacheAge }); self.response.write(file, "binary"); self.response.end(); }); }); }; ================================================ FILE: apps/Static.js ================================================ // // Johan Coppieters - jan 2013 - jWorks // // console.log("loading " + module.id); var libpath = require("path"), http = require("http"), fs = require("fs"), url = require("url"), mime = require("mime"); var path = "."; var cache = {}, nrCache = 0, maxCache = 1, //1 is good for developement -> 30 seems to be reasonable for small websites. maxCacheAge = 86400; function Static(req, res, appFolder, prefix) { this.request = req; this.response = res; this.appFolder = appFolder; this.prefix = prefix || ""; //TODO: we need to have a cache per application // - the cody static cache should be high (100?) // - other application could be very small (10? 20?) //if (typeof cacheSize !== "undefined") { // cache[appFolder].maxCache = cacheSize; //} } module.exports = Static; Static.prototype.dump = function () { this.response.writeHead(200, { "Content-Type": "text/plain" }); this.response.write("Cache dump\n----------\n"); var cnt = 0; for (var c in cache) { if (cache.hasOwnProperty(c)) { this.response.write(c + ": " + cache[c].length + " bytes\n"); cnt += cache[c].length; } } this.response.write("---------------------------\n"); this.response.write("Total bytes cached: " + cnt + " bytes\n"); this.response.write("---------------------------\n"); this.response.end(); }; Static.prototype.addCache = function (filename, file) { if (nrCache >= maxCache) { // should be sorted on number of uses var nr = Math.floor(Math.random() * maxCache) + 1; for (var c in cache) { if (cache.hasOwnProperty(c)) { nr--; if (nr === 0) { delete cache[c]; nrCache--; // console.log("static -> deleted from cache: " + c); break; } } } } cache[filename] = file; nrCache++; // console.log("Static -> added to cache: " + filename); }; Static.prototype.tryCache = function (filename) { var file = cache[filename]; if (file) { // add 1 to nr of uses var type = mime.lookup(filename); console.log("Static.serve -> cache hit: " + filename + " - " + file.length + " bytes as " + type); this.response.writeHead(200, { "Content-Type": type, "Cache-Control": "public, max-age=" + maxCacheAge // thanks Aselbie }); this.response.write(file, "binary"); this.response.end(); return true; } return false; }; Static.prototype.serve = function () { var self = this; var uri = url.parse(self.request.url).pathname; // remove prefix if (self.prefix && (uri.indexOf("/"+self.prefix) === 0)) { uri = uri.substring(self.prefix.length+1); } var ip = self.request.headers['x-forwarded-for'] || self.request.connection.remoteAddress || self.request.socket.remoteAddress || self.request.connection.socket.remoteAddress; console.log("--LOG--S--|" + ip + "|" + new Date() + "|" + self.request.headers['host'] + "|" + self.request._parsedUrl.pathname); var filename; // JM: module.parent = the invoking cody; its parent is the running // web app's module (user code). // note that path.resolve confuses the filename at the end of the // module path with a directory, so we need extra .. to refer to // the directory it is in. if (self.appFolder != "") { filename = libpath.resolve(module.parent.parent.filename, "..", "..", self.appFolder, uri.substring(1)); } else { //JM: requested a file from cody's static files. //the first part of the uri must be "/cody" (or actually we compare with //the current cody module's package's directory name). if(uri.indexOf("/" + libpath.basename(libpath.resolve(module.parent.filename, "..")) + "/") == 0) { filename = libpath.resolve(module.parent.filename, "..", uri.substring(libpath.basename(libpath.resolve(module.parent.filename, "..")).length + 2)); } else { console.log("Invalid URI: " + uri); return; } } // should be moved to a SystemController if (filename === "static/_") { this.dump(); return; } // try serving from cache if (self.tryCache(filename)) { return; } // check if this file exists fs.exists(filename, function (exists) { if (!exists) { console.log("Static.server -> file not found: " + filename); self.response.writeHead(404, { "Content-Type": "text/plain" }); self.response.write("404 Not Found\n"); self.response.end(); return; } if (fs.statSync(filename).isDirectory()) { filename += '/index.html'; } fs.readFile(filename, "binary", function (err, file) { if (err) { console.log("Static.serve -> error reading: " + filename + " - " + err); self.response.writeHead(500, { "Content-Type": "text/plain" }); self.response.write(err + "\n"); self.response.end(); return; } var type = mime.lookup(filename); console.log("Static.serve -> sending: " + filename + " - " + file.length + " bytes as " + type); self.response.writeHead(200, { "Content-Type": type, "Cache-Control": "public, max-age=" + maxCacheAge }); self.response.write(file, "binary"); self.response.end(); self.addCache(filename, file); }); }); }; ================================================ FILE: bin/create_site.js ================================================ // Tim & Jonas V1.0 -- running from within the cody project directory // // Johan: v1.1 -- using path, creating a startup file in the root dir of cody projects, ... // this resembles the hosting setup. var readline = require("readline"); var util = require("util"); var fs = require("fs"); var mysql = require("mysql2"); var path = require("path"); var rootwd = process.cwd(); var codywd = rootwd + "/node_modules/cody"; // https://gist.github.com/tkihira/3014700 var mkdir = function (dir) { // making directory without exception if exists try { fs.mkdirSync(dir, 0755); } catch (e) { if (e.code !== "EEXIST") { throw e; } } }; var copyDir = function (src, dest) { mkdir(dest); var files = fs.readdirSync(src); var i; for (i = 0; i < files.length; i++) { var current = fs.lstatSync(path.join(src, files[i])); if(current.isDirectory()) { copyDir(path.join(src, files[i]), path.join(dest, files[i])); } else if(current.isSymbolicLink()) { var symlink = fs.readlinkSync(path.join(src, files[i])); fs.symlinkSync(symlink, path.join(dest, files[i])); } else { copy(path.join(src, files[i]), path.join(dest, files[i])); } } }; var copy = function (src, dest) { var oldFile = fs.createReadStream(src); var newFile = fs.createWriteStream(dest); oldFile.pipe(newFile); }; /** * Look ma, it's cp -R. * @param {string} src The path to the thing to copy. * @param {string} dest The path to the new copy. */ var copyRecursiveSync = function(src, dest) { // console.log(src + " -> " + dest); var exists = fs.existsSync(src); var stats = exists && fs.statSync(src); var isDirectory = exists && stats.isDirectory(); if (fs.existsSync(dest)) return; if (exists && isDirectory) { console.log("mkdir " + dest); fs.mkdirSync(dest); fs.readdirSync(src).forEach(function(childItemName) { copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName)); }); } else { fs.linkSync(src, dest); } }; var rl = readline.createInterface({ input: process.stdin, output: process.stdout }); console.log("\nCreating project in ", rootwd + "/"); rl.question("\n1) Enter projectname: ", function (sitename) { console.log("Note: also using " + sitename + " as database name."); console.log("Note: by default the mysql root user has no password so you can just hit enter, if you forgot the root password http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html"); rl.question("\n2) Enter root password for mysql so we can create a new database and user: ", function (dbrootpw) { rl.question("\n3) Enter site database user: ", function (dbuser) { rl.question("\n4) Enter site database password: ", function (dbpass) { rl.question("\n5) Enter dbhost for db: ", function (dbhost) { rl.question("\n6) Enter hostname for site: ", function (hostname) { var con = mysql.createConnection({ host: dbhost, user: dbuser, password: dbpass, multipleStatements: true }); rl.question("\n7) Enter a location for storing documents: ", function (datadir) { console.log("dbhost is "+dbhost); con.connect(); con.query("create database " + sitename + " default charset utf8", function (err) { if (err) console.log(err); con.query("grant all on " + sitename + ".* to '" + dbuser + "'@'%' identified by '" + dbpass + "'", function (err) { if (err) console.log(err); con.query("grant all on " + sitename + ".* to '" + dbuser +"'@'"+ dbhost + " identified by '" + dbpass + "'", function (err) { if (err) console.log(err); con.end(); con = mysql.createConnection({ host: dbhost, user: dbuser, database: sitename, password: dbpass, multipleStatements: true }); console.log("dbhost is "+dbhost); con.connect(); mkdir(path.join(rootwd, sitename)); fs.readdirSync(codywd + "/doc/empty").forEach(function (src) { copyRecursiveSync(path.join(codywd,"doc","empty", src), path.join(rootwd, sitename , src)); }); fs.readFile(path.join(rootwd, sitename, "empty.sql"), function (err, initstatements) { if (err) throw err; con.query(initstatements.toString(), function (err) { if (err) throw err; fs.writeFileSync(path.join(rootwd, sitename, "config.json"), JSON.stringify( { name: sitename, mailFrom: "info@"+hostname, hostnames:"localhost,"+hostname, db: sitename, dbuser: dbuser, dbpassword: dbpass, dbhost: dbhost, smtp: "smtpmailer."+hostname, version: "V0.1", defaultlanguage: "en", datapath: "/usr/local/data/"+sitename, port: 3001 })); //copy(path.join(rootwd, sitename, "index.js"), path.join(rootwd, sitename+".js")); //fs.unlinkSync(path.join(rootwd, sitename, "index.js")); mkdir(datadir); mkdir(path.join(datadir,sitename)); console.log("created "+datadir+"/"+sitename+"/"); mkdir(path.join(datadir,sitename,"images")); console.log("created "+datadir+"/"+sitename+"/images"); mkdir(path.join(datadir,sitename,"files")); console.log("created "+datadir+"/"+sitename+"/files"); console.log("---") console.log("Site '" + sitename + "' has been prepared.\n") console.log("Please create DNS entries, or add to /etc/hosts:"); console.log("127.0.0.1 " + hostname); console.log("Also check index.js and config.json to fine-tune extra parameters, encryption key, ..."); console.log("---") console.log("Start your site using:"); console.log("$ forever start " + sitename + ".js"); console.log(" or"); console.log("$ node " + sitename + ".js"); console.log("-"); console.log("surf to http://localhost:3001"); console.log(" or manage your site at"); console.log("http://localhost:3001/en/dashboard"); console.log(" for mysql8 users:"); console.log("CREATE FUNCTION PASSWORD2(s VARCHAR(50))\n RETURNS VARCHAR(50) DETERMINISTIC\n RETURN CONCAT('*', UPPER(SHA1(UNHEX(SHA1(s)))));"); con.end(); rl.close(); }); }); }); }); }); }); }); }); }); }); }); }); ================================================ FILE: bin/remove_site ================================================ #!/bin/bash # this is rubbish... "Creating tree... dropping the database..." # we should look at the config.json # and remove the used directories (asking confirmation for each one) # and drop the database in the config file exit realpkgroot="${PWD}/node_modules/cody" echo Creating cody web tree in current directory echo -n "1) Enter sitename: " read sitename echo -n "2) Enter site database user: " read dbuser echo "Note: the mysql root password is empty by default (just press enter)" echo -n "3) Enter mysql root password: " read dbrootpw read -n "Are you sure you want to delete ${sitename}? [y/n]" read proceed if [proceed]; then mysql --user=root "--password=$dbrootpw" -e "drop database $sitename" mysql --user=root "--password=$dbrootpw" -e "drop user $dbuser" echo "Site '$sitename' database has been removed." fi ================================================ FILE: controllers/ContactController.js ================================================ // // Johan Coppieters - first integration into cody code base 29/03/2015 // // alpha 1: uses Model, CRUD operations are working // planned: // - alpha 2: dynamic tags, add tag // - alpha 3: send mail // - alpha 4: copy from data.data (JSON) -> contacts, JSON.rest -> contacts.data // beta 1: add template to "empty" // // /* SQL tables drop table tags; create table tags ( id char(16) not null primary key, name varchar(63) ); insert into tags values ('jsconf', 'jsconf.be'), ('stage', 'Stage'), ('cody', 'Cody'), ('ITmgrs', 'ICT Mgrs'); drop table contacts; create table contacts ( id int(11) not null primary key auto_increment, company varchar(127) default '', name varchar(127) default '', title varchar(32) default '', street varchar(127) default '', zipcity varchar(127) default '', country varchar(64) default '', email varchar(127) default '', phone varchar(32) default '', phone2 varchar(32) default '', origin varchar(32) default '', tags varchar(255) default '', active char(1) default 'Y', note varchar(2048) default '', nomail char(1) default 'N', data text ); */ console.log("loading " + module.id); var cody = require("cody/index.js"); function ContactController(context) { console.log("ContactController.constructor -> page(" + context.page.itemId + ") = " + context.page.title + ", request = " + context.request); // make a contact model and attach to controller var myModel = new cody.Model(this, { tableName: "contacts", id: {name: "id", def: 0}, cols: [ {name: "name", label: "Name", def: "", list: true, sort: "asc", q: "like"}, {name: "company",label: "Company", def: "", list: true, q: "like" }, {name: "title", label: "Title", def: "", list: false}, {name: "street", label: "Street", def: "", list: false}, {name: "zipcity",label: "Zip City", def: "", list: false}, {name: "country",label: "Country", def: "", list: false}, {name: "tags", label: "Tags", def: "", list: false, q: "like"}, {name: "email", label: "Email", def: "", list: true, q: "like"}, {name: "data", label: "JSON Data", def: "{}",list: false}, {name: "phone", label: "Phone 1", def: "", list: true}, {name: "phone2", label: "Phone 2", def: "", list: true, hide: true}, {name: "origin", label: "Origin", def: "", list: false}, {name: "note", label: "Note", def: "", list: false}, {name: "active", label: "Active", def: "Y", list: true, hide: true}, {name: "nomail", label: "Allows Mail", def: "Y", list: true, hide: true}] }); this.model.addRef("tags", "select id, name from tags order by name"); this.model.addRef("atoms", "select id, name from atoms where parent = 3 order by name"); context.model = myModel; // init inherited controller cody.Controller.call(this, context); } ContactController.prototype = Object.create( cody.Controller.prototype ); module.exports = ContactController; ContactController.prototype.doRequest = function( finish ) { var self = this; self.getDetailData(); if (this.doCrudRequest(finish)) { // handled by std controller } else if (this.isRequest("sendmail")) { self.doMails(function() { self.model.doList( finish ); }); } else if (this.isRequest("testmail")) { self.doTestMail(function() { self.model.doList( finish ); }); } else if (this.isRequest("import")) { self.doImportFormData(self.context.atom, self.context.status, function() { self.model.doList( finish ); }); } else { cody.Controller.prototype.doRequest.call(self, finish); } }; ContactController.prototype.getDetailData = function() { var self = this; // search params self.context.q_name = self.updateSession("q_name", ""); self.context.q_company = self.updateSession("q_company", ""); self.context.q_tags = self.updateSession("q_tags", ""); self.context.q_email = self.updateSession("q_email", ""); // current status and form id self.context.status = self.updateSession("status", "N"); self.context.atom = self.updateSession("atom", 0); // get mail data self.context.subject = this.updateSession("subject", ""); self.context.content = this.updateSession("content", ""); self.context.testmail = this.updateSession("testmail", ""); self.context.testname = this.updateSession("testname", ""); self.context.tagCheckboxes = function(name, selected) { var html = ""; var nr = 0; for (var iT in this.tags) { var tag = this.tags[iT]; html += '=0) + ' />'; nr++; } return html; } }; ContactController.prototype.doImportFormData = function (atomId, status, finished) { // formdata sits in the "data" table, having // id, atom, data(json), status(N/T/D/A), created, modified // // we'll copy the "created" date, put the name of the atom in "source" // we set the active = 'Y', nomail = 'N' // from the JSON data we'll try to extract: name, company(cie), title, tags, email, phone(phone1,telephone), phone2 // note(remark), street, zipcity(city), country // we'll store the rest of the JSON string in the "data" field. function ffield(obj, nameArr) { var val = ""; nameArr.forEach(function(el) { if (typeof obj[el] !== "undefined") { if (val === "") val = obj[el]; delete obj[el]; // side effect... delete the field } var El = el.charAt(0).toUpperCase() + el.slice(1); if (typeof obj[El] !== "undefined") { if (val === "") val = obj[El]; delete obj[El]; // side effect... delete the field } }); return val; } var self = this; var atom = self.app.getAtom(atomId); var tags = self.getParam("tags"); if (Array.isArray(tags)) tags = tags.join(","); self.query("select data, status, created from data where atom = ? and status = ?", [atomId, status], function(err, results) { if (err) { console.log("error selecting data with status="+ status + " and atom=" + atomId + " -> " + err); self.feedBack(false, "Error fetching data from the forms"); finished(); } else { console.log("importing " + results.length + " records."); cody.Application.each(results, function(done) { console.log("using data: " + this.data); var json = JSON.parse(this.data); var arr = [ffield(json, ["cie", "company"]), ffield(json, ["name"]), ffield(json, ["title"]), ffield(json, ["street"]), ffield(json, ["zipcity", "zipCity", "city"]), ffield(json, ["country"]), ffield(json, ["mail", "email"]), ffield(json, ["phone", "telephone", "phone1", "mobile", "gsm"]), ffield(json, ["phone2", "home"]), atom.name, tags, "Y", ffield(json, ["note","remark"]), "N", JSON.stringify(json)]; console.log(arr); self.query("insert into contacts " + "(company, name, title, street, zipcity, country, email, phone, phone2, origin, tags, active, note, nomail, data) " + "values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", arr, done); }, function(err) { if (err) { console.log("error inserting data -> " + err); self.feedBack(false, "Error inserting data"); } else { self.feedBack(true, results.length + " records added"); } finished(); }); for (var iRec in results) { var rec = results[iRec]; } } }); } ContactController.prototype.doTestMail = function (finished) { var pSubject = this.getParam("subject", "testing"); var pName = this.getParam("testname", "testname"); var email = this.getParam("testmail", "testing@cody-cms.org"); var pFrom = this.app.mailFrom; var pText = this.getParam("content","cody-cms.org testing"); //self.sendMail (pFrom, C.email, pSubject, pText); console.log ("mailto: from=" + pFrom + ", to=" + pName + " - " + email + " - " + pSubject + " - " + pText); } ContactController.prototype.doMails = function (finished) { this.sendTargetMails(finished, this.getParam("q_tags", ""), this.app.mailFrom, this.getParam("subject", "testing"), this.getParam("content","cody-cms.org testing")); } ContactController.prototype.sendTargetMails = function (finished, tags, pFrom, pSubject, pText) { var self = this; var p = ""; var ps = []; if (Array.isArray(tags)) { for(var it in tags) { p = p + ((it == 0) ? "where " : " or ") + "tags like ?"; ps.push("%"+tags[it]+"%"); } } console.log("Sending email from " + pFrom + " to contacts with tags: " + tags + " -> " + p); self.query("select * from contacts " + p, ps, function(err, result) { if (err) { console.log("error selecting contacts with tags "+ tags + " -> " + err); } else { for (var iC in result) { var C = result[iC]; //self.sendMail (pFrom, C.email, pSubject, pText); console.log ("mailto: from=" + pFrom + ", to=" + C.name + " - " + C.email + " - " + pSubject + " - " + pText); } } finished(); }); }; ================================================ FILE: controllers/Controller.js ================================================ // // Johan Coppieters - jan 2013 - jWorks // // console.log("loading " + module.id); var mysql = require("mysql2"); var nodemailer = require("nodemailer"); var cody = require("../index.js"); function Controller(context) { // only called for using my methods if (typeof context === "undefined") { return; } if (context.page) { console.log("Controller.constructor -> page(" + context.page.itemId + ") = " + context.page.title + ", request = " + context.request); this.addParamsToContext(context); } this.context = context; context.controller = this; this.app = context.app; this.connection = (this.app) ? this.app.getConnection() : undefined; // console.log(this.context); } module.exports = Controller; Controller.prototype.close = function() { this.closeConnection(); }; // // core handler // Controller.prototype.doRequest = function( finish ) { console.log("Controller.doRequest -> request = " + this.getRequest()); //console.log(this.context); // if you don't want any rendering to be done: // pass an empty string (or set this.context.fn to empty) if (! this.hasSubmittedForm(finish)) { finish(); } }; Controller.prototype.doCrudRequest = function( finish ) { var self = this; if (typeof self.model === "undefined") return false; if (self.isRequest("") || this.isRequest("list")) { self.model.doList( finish ); } else if (self.isRequest("save")) { self.model.scrapeFrom(self); self.model.doSave( function() { self.nextRequest("list", finish); }); } else if (self.isRequest("delete")) { self.model.doDelete( this.getId(), function() { self.nextRequest("list", finish); }); } else if (this.isRequest("edit")) { self.model.doGet( this.getId(), finish); } else if (this.isRequest("new")) { self.model.doGet( NaN, finish ); } else { return false; } return true; }; Controller.prototype.isRequest = function(theString) { return (this.getRequest(true) === (theString || "").toUpperCase()); }; Controller.prototype.setRequest = function(theString) { if (this.context) { this.context.request = theString; } }; Controller.prototype.getRequest = function(upper) { var req = (this.context && this.context.request) || ""; if (Array.isArray(req)) req = req.at(-1) || ""; return (upper) ? req.toUpperCase() : req; }; Controller.prototype.getId = function(defaultValue) { // if there is a model connected to this controller, use the attributes of model.id var idname = (typeof this.model !== "undefined") ? this.model.id.name : "id"; if (defaultValue === undefined) defaultValue = (typeof this.model !== "undefined") ? this.model.id.def : -1; var x = this.context.getParam(idname); x = (typeof x === "undefined") ? NaN : parseInt(x, 10); if (isNaN(x)) { x = this.context.path.id; x = (x === undefined) ? NaN : parseInt(x, 10); } return isNaN(x) ? defaultValue : x; }; // // ask another controller to handle the current (changed) request // = internal redirect ( <-> this.redirect ) // Controller.prototype.delegate = function(link) { this.close(); this.app.delegate(this.context, link); }; // // Ask same controller/page to handle another request // prevents post requests from being re-executed // = external redirect // Controller.prototype.nextRequest = function(err, request, finish) { var self = this; // if only 2 parameters, assume that no "err" was passed. if (typeof finish === "undefined") { finish = request; request = err; err = null; } if (err) { // don't do the redirect... let's hope the current view is going to display the error // change the view to error.ejs ?? self.feedback(false, err); finish(); } else { self.redirect("/" + this.context.page.getURL() + "/" + request, finish); } }; // real redirect handled by the server // = external redirect ( <-> this.delegate ) Controller.prototype.redirect = function(url, finish) { this.context.res.redirect(url); if (typeof finish === "function") finish(""); }; // // User login stuff -- most of the time proxied to the context object // Controller.prototype.needsLogin = function() { return (this.context) && (this.context.page) && (this.context.page.needsLogin()); }; Controller.prototype.isLoggedIn = function() { return (this.context) && (this.context.isLoggedIn()); }; Controller.prototype.getLogin = function() { return (this.context) ? (this.context.getLogin()) : new cody.User({}); }; Controller.prototype.setLogin = function(theUser) { if (this.context) { this.context.setLogin(theUser); } }; Controller.prototype.getLoginId = function() { var login = this.getLogin(); return (login) ? login.id : undefined; }; Controller.prototype.getLoginLevel = function() { var login = this.getLogin(); return (login) ? login.level : 0; }; Controller.prototype.isAllowed = function( theItemOrPage ) { var aUserDomain = this.getLogin().getDomain(); var anItemDomain = theItemOrPage.getAllowedDomains(); console.log("Controller.isAllowed: user = '" + aUserDomain + "', item/page(" + theItemOrPage.getId() + ") = '" + anItemDomain + "'"); // no userdomain -> not allowed if (aUserDomain === "") { return false; } // user has all rights or belongs to cody admin if ((aUserDomain === "*") || (aUserDomain === "cody")) { return true; } // item can be edited by any domain or no specific domains are set up if ((anItemDomain === "*") || (anItemDomain === "")) { return true; } // there is a user domain and the item has 1 of more domain // loop through them all and check to see if there is a correspondence var aList = anItemDomain.split(","); for (var x in aList) { if (aList[x]===aUserDomain) { return true; } } return false; }; // // Form handling // Controller.prototype.hasSubmittedForm = function(finish) { var self = this; // check if a form was submitted (request = send, form-atom = atom.id) var atomId = self.getParam("form-atom", 0); if ((self.isRequest("send")) && (atomId != 0)) { var anAtom = this.app.getAtom(atomId); console.log("Controller.doRequest: submitted form = " + atomId + " -> " + anAtom.name); // construct a meta data object var form = cody.FormController.makeMeta(anAtom, self.page); // have the meta object read the values from the submitted params form.readValuesFrom(self.context.params, false); if (form.ok) { // signal if everything was ok and no form is needed again self.context.submitted = true; // save the values in a database form.saveValues(self, "N", finish); self.alertFormOwner(anAtom, form); } else { // store the meta object + it's values for re-displaying if (typeof self.context.errorForms === "undefined") { self.context.errorForms = {}; } // to be used instead of an empty form self.context.errorForms[atomId] = form; finish(); } return true; } return false; }; Controller.prototype.alertFormOwner = function(atom, form) { var self = this; var lan = self.context.page.language; var formDesc = JSON.parse(atom.note); if ((typeof formDesc.alert != "undefined") && (formDesc.alert != "")) { var mail = "Dear webmaster,\n\nA user of the app: '" + atom.app.name + "' submitted a form: '" + formDesc.labels[lan] + "' with values:\n\n"; for (var iE in form.objects) { var element = form.objects[iE]; if (typeof element.options.choices !== "undefined") { mail += element.labels[lan] + ": " + element.options.choices[lan][element.value] + "\n"; } else { mail += element.labels[lan] + ": " + element.value + "\n"; } } mail += "\n\nYour website.\n"; self.sendMail(self.app.mailFrom, formDesc.alert, "Message from " + atom.app.name, mail); } }; Controller.prototype.sendMail = function (pFrom, pTo, pSubject, pText, pHtml, finished) { // for the moment we don't wait for the smtp transfer to be completed // so we can't generate error feedback to the user, perhaps make a version with a callback too? var self = this; // swap params if (typeof pHtml === "function") { finished = pHtml; pHtml = undefined; } console.log("Sending email from " + pFrom + " to " + pTo); var mailOptions = { from: pFrom, // sender address to: pTo, // list of receivers subject: pSubject // Subject line }; var hasText = (typeof pText !== "undefined") && (pText) && (pText !== ""); if (hasText) { mailOptions.text = pText; } if ((typeof pHtml !== "undefined") && (pHtml) && (pHtml !== "")) { mailOptions.html = pHtml; } // create transport options -- smtp defaults var options = { host: self.context.app.smtp, secureConnection: false, port: 25 }; // if the smtp-options are defined in the config, use these instead of the older 'separate'/'default' style if (typeof self.app.smtpoptions != "undefined") { options = self.app.smtpoptions; } // allow the authentication params to be defined separately if (typeof self.app.smtpauth != "undefined") { options.auth = self.app.smtpauth; } console.log(" connecting to " + options.host); var smtpTransport = nodemailer.createTransport(options); smtpTransport.sendMail(mailOptions, function (error, info) { if (error) { console.log("Error sending mail: " + error); } else { console.log("Message sent: " + info.response); } if (typeof finished === "function") finished(); }); }; // // Session handling // Controller.prototype.fromSession = function(paramName, defaultValue) { return this.context.fromSession(paramName, defaultValue); }; Controller.prototype.toSession = function(paramName, value) { this.context.toSession(paramName, value); }; Controller.prototype.updateSession = function(paramName, defaultValue) { var value = this.getParam(paramName, this.context.fromSession(paramName, defaultValue)); this.context.toSession(paramName, value); return value; }; // // Parameter handling // Controller.prototype.getParam = function(paramName, defaultValue) { return this.context.getParam(paramName, defaultValue); }; Controller.prototype.getDate = function(paramName, defaultValue) { var x = this.context.getParam(paramName); return this.context.makeDate(x, defaultValue); }; Controller.prototype.makeDate = function(value, defaultValue) { return this.context.makeDate(value, defaultValue); } Controller.prototype.getInt = function(paramName, defaultValue) { var x = this.context.getParam(paramName); return this.makeInt(x, defaultValue); }; Controller.prototype.makeInt = function(value, defaultValue) { return this.context.makeInt(value, defaultValue); } Controller.prototype.getNum = function(paramName, defaultValue, precision) { var x = this.context.getParam(paramName); return this.makeNum(x, defaultValue, precision); }; Controller.prototype.makeNum = function(value, defaultValue, precision) { return this.context.makeNum(value, defaultValue); } Controller.prototype.getUNum = function(paramName, defaultValue) { var anId = this.context.getParam(paramName); if ((typeof anId === "undefined") || (anId === "")) { return (typeof defaultValue === "undefined") ? 0 : defaultValue; } else { var i = anId.indexOf("_"); if (i >= 0) { return parseInt(anId.substring(i+1), 10); } else { return parseInt(anId, 10); } } }; // // Query stuff // Controller.prototype.query = function(sql, params, callback) { // callback = function(error, results) this.connection.query(sql, params, callback); }; Controller.prototype.escape = function(v){ return this.connection.escape(v); } Controller.prototype.closeConnection = function() { // console.log("Controller -> done with database connection"); if (this.connection) { this.app.returnConnection(this.connection); this.connection = undefined; } }; // General utilities Controller.prototype.addParamsToContext = function( context ) { //TODO: what if there are more than 1 content settings blocks attached? var content = context.page.content; for (var iC in content) { if ((content.hasOwnProperty(iC)) && (content[iC].kind === "P")) { context.settings = JSON.parse(content[iC].data); } } } // // Output & feedback utilities // Controller.prototype.render = function( theContent ) { this.app.log("Controller", "ERROR ** attempt to render a content with kind = '" + theContent.kind + "' and no renders provided"); return ""; }; Controller.prototype.gen = function( theContent, theHeader ) { if (typeof theHeader === "undefined") { this.context.res.writeHead(200, { "Content-Type": "application/json" }); } else { this.context.res.writeHead(200, theHeader); } if (typeof theContent !== "string") { this.context.res.write(JSON.stringify(theContent)); } else { this.context.res.write(theContent); } this.context.res.end(); }; Controller.prototype.feedBack = function(success, message) { this.context.status = (success) ? "success" : "error"; this.context.message = message; this.context.xmessage = message; this.context.success = success; }; Controller.prototype.feedback = Controller.prototype.feedBack; ================================================ FILE: controllers/DashboardController.js ================================================ // // Johan Coppieters - may 2013 - cody // // console.log("loading " + module.id); var cody = require("../index.js"); function DashboardController(context) { console.log("DashboardController.constructor -> page(" + context.page.itemId + ") = " + context.page.title + ", request = " + context.request); // init inherited controller cody.Controller.call(this, context); } DashboardController.prototype = Object.create( cody.Controller.prototype ); module.exports = DashboardController; DashboardController.prototype.doRequest = function( finish ) { var self = this; finish(); }; ================================================ FILE: controllers/EmailController.js ================================================ // // Laurens Ramandt - june 2013 - cody // // // this class abstracts nodemailer, just in case we would switch from nodemailer to something else // npm install nodemailer required var nodemailer = require("nodemailer"); var cody = require("./../index.js"); function EmailController (context) { console.log("EmailController construct"); cody.Controller.call(this, context); } EmailController.sendEmail = function (pFrom, pTo, pSubject, pText) { console.log("Sending email from " + pFrom + " to " + pTo); var mailOptions = { from: pFrom, // sender address to: pTo, // list of receivers subject: pSubject, // Subject line html: pText // HTML body }; //TODO: for production, modify this to use /usr/bin/sendmail var smtpTransport = nodemailer.createTransport("SMTP", { host: "smtp.scarlet.be", //change this to match your server secureConnection: false, port: 25/*, auth: { user: "user@domain.com", pass: "password" } */ }); smtpTransport.sendMail(mailOptions, function (error, response) { if (error) { console.log("Error sending mail: " + error); } else { console.log("Message sent: " + response.message); } }); }; EmailController.prototype = Object.create( cody.Controller.prototype ); module.exports = EmailController; ================================================ FILE: controllers/FileController.js ================================================ // // Johan Coppieters - jan 2013 - jWorks // // var mysql = require("mysql2"); var cody = require('../index.js'); console.log("loading " + module.id); function FileController(context) { console.log("FileController.constructor -> page(" + context.page.itemId + ") = " + context.page.title + ", request = " + context.request); // init inherited controller cody.TreeController.call(this, context); } FileController.prototype = Object.create( cody.TreeController.prototype ); module.exports = FileController; FileController.prototype.doRequest = function( finish ) { var self = this; if (self.isRequest("xxx")) { // needed ? finish(""); } else { cody.TreeController.prototype.doRequest.call(self, finish); } }; FileController.prototype.getRoot = function() { return cody.Application.kFileRoot; }; FileController.prototype.getType = function(theNode) { return ((theNode.extention === "xxx") || (theNode.extention === "")) ? "folder" : "file"; }; FileController.prototype.getObject = function(id) { return this.app.getAtom(id); }; FileController.prototype.getFolder = function() { return "/files"; }; /* Overridden - Action functions */ ================================================ FILE: controllers/FormController.js ================================================ // // Johan Coppieters - jan 2013 - jWorks // // var mysql = require("mysql2"); var cody = require('../index.js'); console.log("loading " + module.id); FormController.makeMeta = function( atom ) { var elements = (atom) ? atom.getChildren() : []; var arr = []; for (var iE in elements) { arr.push(elements[iE].note); } var form = new cody.Meta(); form.metaId = atom.id; form.addList(arr); return form; }; FormController.makeFormInfo = function( atom, page ) { var formInfo = (atom && atom.note && (atom.note.length > 2)) ? JSON.parse(atom.note) : {}; if (typeof formInfo.url === "undefined") { formInfo.url = page.getURL(page.language); } return formInfo; }; FormController.menuList = function( atoms, current ) { var root = atoms[cody.Application.kFormRoot]; var options = ""; var currId = (current) ? current.id : 0; var aList = root.getChildren(); for (var x in aList) { options += ""; } // console.log("current = " + currId + ", menuPopup -> " + options); return options; }; function FormController(context) { console.log("FormController.constructor -> page(" + context.page.itemId + ") = " + context.page.title + ", request = " + context.request); // init inherited controller cody.TreeController.call(this, context); } FormController.prototype = Object.create( cody.TreeController.prototype ); module.exports = FormController; FormController.prototype.doRequest = function( finish ) { var self = this; cody.TreeController.prototype.doRequest.call(self, finish); }; FormController.prototype.getRoot = function() { return cody.Application.kFormRoot; }; FormController.prototype.getType = function(theNode) { return ((theNode.extention === "xxx") || (theNode.extention === "")) ? "form" : "item"; }; FormController.prototype.getObject = function(id) { return this.app.getAtom(id); }; FormController.prototype.getFolder = function() { return "/forms"; }; /* Overridden - Action functions */ FormController.prototype.emptyLabels = function(isForm) { var self = this; var labels = {}; for (var iL in self.app.languages) { labels[self.app.languages[iL].id] = (isForm) ? "Send" : self.context.atom.name; } if (isForm) { labels["nl"] = "Verstuur"; labels["fr"] = "Envoyer"; labels["de"] = "Versenden"; } return labels; }; FormController.prototype.isMultiple = function( aGenerator ) { return ((aGenerator === cody.Meta.Generator.checkboxinput) || (aGenerator === cody.Meta.Generator.selectinput) || (aGenerator === cody.Meta.Generator.radioinput)); }; // overridden function for forms FormController.prototype.fetchNode = function( theNode, finish ) { var self = this; cody.TreeController.prototype.fetchNode.call(this, theNode, function() { var isForm = (self.context.atom.extention === ""); console.log("FormController.FetchNode: node = " + theNode + " -> " + self.context.atom.name + " / " + self.context.atom.extention); // get the definitions from the "note" field in the atoms var obj = { name: self.context.atom.name, options: {}, labels: self.emptyLabels((self.context.atom.extention === "")), generator: 1 }; // add email alert address for forms. if (isForm) { obj.alert = ""; } try { var tryObj = JSON.parse(self.context.atom.note); if ((typeof tryObj !== "undefined") && (tryObj)) { obj = tryObj; } } catch(e) { } self.context.object = obj; if (isForm) { // a form, nothing more needed. finish(); } else { // an item if (typeof obj.options === "undefined") { obj.options = {}; } // the options below are shown in 2 fields called min/max if (obj.generator == cody.Meta.Generator.textareainput) { obj.min = (typeof obj.options.cols === "undefined") ? "" : obj.options.cols; obj.max = (typeof obj.options.rows === "undefined") ? "" : obj.options.rows; } else { obj.min = (typeof obj.options.minimum === "undefined") ? "" : obj.options.minimum; obj.max = (typeof obj.options.maximum === "undefined") ? "" : obj.options.maximum; } if (self.isMultiple(obj.generator)){ if (typeof obj.options.choices !== "undefined") { for (var iC in obj.options.choices) { var C = obj.options.choices[iC]; var X = ""; for (var iL in C) { X += iL + "|" + C[iL] + "\n"; } obj.options.choices[iC] = X.slice(0, -1); } } } finish(); } }); }; // overridden function for forms // // Read all meta definitions from the posted form // 1) decide what reader should be taken, based on the "generator" // + some parameters (phone, number, email, date, date3) // 2) read labels // 3) read choices (for checkboxes, radio's, popup's) // 4) read specific options (required, default value, ...) // // Finally store in an atom/object FormController.prototype.saveInfo = function( nodeId, finish ) { var self = this; console.log("FormController.saveInfo: node = " + nodeId ); var anObject = this.getObject(cody.TreeController.toId(nodeId)); if (typeof anObject !== "undefined") { // read the basics for an atom and for an form/item anObject.scrapeFrom(this); var obj = { name: anObject.name, labels: {} }; // read the labels in all languages for (var iL in self.app.languages) { var L = self.app.languages[iL].id; obj.labels[L] = this.getParam("label-"+L, ""); } // We use the extension field in the atom table to make the difference between forms and form-items. if (anObject.extention === "") { // form obj.alert = self.getParam("alert", ""); self.context.shownode = anObject.id; self.context.opennode = anObject.id; } else { // item self.context.shownode = anObject.parentId; self.context.opennode = anObject.parentId; // next (long) section fills in the correct values for "generator" and "options" // depending on the user's choice of the different parameters (required, validation, generator, min/max, ...) var aGenerator = parseInt(self.getParam("generator", cody.Meta.Generator.textinput), 10); obj.generator = aGenerator; obj.options = {}; obj.reader = cody.Meta.Reader.string; var defV = this.getParam("default", ""); if (defV !== "") { obj.options.default = defV; } if ((this.getParam("required", "N") === "Y") && (aGenerator !== cody.Meta.Generator.checkboxinput)) { obj.options.required = true; } // add validation text or number var validation = this.getParam("validation", "X"); if ((aGenerator === cody.Meta.Generator.textinput) || (aGenerator === cody.Meta.Generator.textareainput)) { if (validation === "E") { obj.options.email = true; obj.reader = cody.Meta.Reader.email; } else if (validation === "P") { obj.options.phone = true; obj.reader = cody.Meta.Reader.phone; } } else if (aGenerator === cody.Meta.Generator.numberinput) { obj.options.number = true; if (validation === "I") { obj.reader = cody.Meta.Reader.integer; } else { // === "N" obj.reader = cody.Meta.Reader.number; } } // add min/max or cols/rows var aMin = self.getParam("min", ""); var aMax = self.getParam("max", ""); if (aGenerator === cody.Meta.Generator.textareainput) { if (aMin !== "") { obj.options.cols = aMin; } if (aMax !== "") { obj.options.rows = aMax; } } else if ((aGenerator === cody.Meta.Generator.numberinput) || (aGenerator === cody.Meta.Generator.textinput)) { if (aMin !== "") { obj.options.minimum = aMin; } if (aMax !== "") { obj.options.maximum = aMax; } } // add choices in all languages // there is one field (choice-[language]) for every language // one choice per line and possibly in the format "[id]|[label]" // the user can enter his list without "[id]|", we will add it on next edit if (this.isMultiple(aGenerator)){ if (aGenerator === cody.Meta.Generator.checkbox) { obj.reader = cody.Meta.Reader.multiple; } obj.options.choices = {}; for (var iL in self.app.languages) { var L = self.app.languages[iL].id; obj.options.choices[L] = {}; var arr = self.getParam("choice-"+L, "").replace("\r", "").split("\n"); if (arr[0].indexOf("|") > 0) { // user has given keys value pairs for (var i in arr) { var cInx = arr[i].indexOf("|"); var cID = arr[i].substring(0, cInx); obj.options.choices[L][cID] = arr[i].substring(cInx+1); } } else { // no keys, only choices, we'll label them 0, 1, 2 ,... for (var i in arr) { obj.options.choices[L][i] = arr[i]; } } } } // Date readers (1 field or 3 fields) if (aGenerator === cody.Meta.Generator.dateinput) { obj.reader = cody.Meta.Reader.date; } else if (aGenerator === cody.Meta.Generator.date3input) { obj.reader = cody.Meta.Reader.date3; } } console.log("show / open -> " + self.context.shownode + " / " + self.context.opennode); var str = JSON.stringify(obj); console.log("Generated Meta: " + str); anObject.note = str; anObject.doUpdate(self, finish); } else { this.feedBack(false, "failed to save the data"); finish(); } }; ================================================ FILE: controllers/FormDataController.js ================================================ // // Johan Coppieters - sept 2013 - cody // // console.log("loading " + module.id); var cody = require("../index.js"); function FormDataController(context) { // init inherited controller and add all instance variables cody.Controller.call(this, context); } FormDataController.prototype = Object.create( cody.Controller.prototype ); module.exports = FormDataController; FormDataController.prototype.doRequest = function( finish ) { var self = this; if (self.isRequest("")) { self.setRequest("list"); } var id = this.getParam("id", 0); var meta = this.getParam("meta", 0); console.log("FormDataController.constructor -> id = " + id + ", meta = " + meta + ", request = " + self.context.request); if (self.isRequest("save")) { self.saveData(id, meta, function() { self.context.fn = "-/cms/forms-list.ejs"; self.listData(finish); }); } else if (self.isRequest("delete")) { self.deleteData(id, function() { self.context.fn = "-/cms/forms-list.ejs"; self.listData(finish); }); } else if (self.isRequest("list")) { self.context.fn = "-/cms/forms-list.ejs"; self.listData(finish); } else if (this.isRequest("edit")) { self.context.fn = "-/cms/forms-data.ejs"; self.editData(meta, id, finish); } else if (this.isRequest("sendmail")) { self.context.fn = "-/cms/forms-list.ejs"; self.sendAllMail(finish); } else if (this.isRequest("testmail")) { self.context.fn = "-/cms/forms-list.ejs"; self.sendTestMail(finish); } else { cody.Controller.prototype.doRequest.call(self, finish); } }; FormDataController.prototype.getDetailData = function() { var self = this; // current status and form id self.context.form_show = self.updateSession("form_show", "N"); self.context.form_meta = self.updateSession("form_meta", 0); // get mail data self.context.subject = this.updateSession("subject", ""); self.context.content = this.updateSession("content", ""); self.context.testmail = this.updateSession("testmail", ""); self.context.testname = this.updateSession("testname", ""); }; FormDataController.prototype.personalize = function(text, params) { // write generic replace... who??? if (typeof params.Name != "undefined") text = text.replace("[name]", params.Name).replace("[Name]", params.Name); if (typeof params.name != "undefined") text = text.replace("[name]", params.name).replace("[Name]", params.name); return text; } FormDataController.prototype.sendAllMail = function(finish) { var self = this; var nr = 0; // fetch list & detail data self.listData(function() { // loop over self.content.data and send mails... cody.Application.each(self.context.data, function(done) { var body = self.personalize(self.context.content, this.data); // allow "email", "Email", "Mail" or "mail" in the formdata. var email = (typeof this.data.Email != "undefined") ? this.data.Email : (typeof this.data.email != "undefined") ? this.data.email : (typeof this.data.Mail != "undefined") ? this.data.Mail : (typeof this.data.mail != "undefined") ? this.data.mail : ""; if (email !== "") { self.sendMail(self.app.mailFrom, email, self.context.subject, body, function() { nr++; done(); }); } else { done(); } }, function(err) { if (err) console.log("something went wrong: " + err); console.log("Sent " + nr + " mails"); self.feedBack(true, "Sent " + nr + " mails"); finish(); }); }); }; FormDataController.prototype.sendTestMail = function(finish) { var self = this; // fetch list & detail data self.listData(function() { var body = self.personalize(self.context.content, {name: self.context.testname}); self.sendMail(self.app.mailFrom, self.context.testmail, self.context.subject, body); finish(); }); }; FormDataController.prototype.listData = function(finish) { var self = this; // allow users to come back to the list view and still see the same self.getDetailData(); console.log("FormDataController.listData -> meta = " + self.context.form_meta + ", status = " + self.context.form_show); self.query("select id, atom, data,status,created, modified from data " + "where (atom = ? or ? = 0) and (status = ? or ? = 'X') order by atom, created desc", [self.context.form_meta, self.context.form_meta, self.context.form_show, self.context.form_show], function(error, result) { if (error) { console.log("FormDataController.listData -> error " + error); } self.context.data = []; for (var i = 0; i < result.length; i++) { self.context.data[i] = cody.Meta.getData(result[i]); } finish(); }); }; FormDataController.prototype.saveData = function(id, meta, finish) { var self = this; var atom = self.app.getAtom(meta); var meta = cody.FormController.makeMeta(atom); meta.objectId = self.getParam("id", 0); meta.readValuesFrom(self.context.params, false); meta.saveValues(self, self.getParam("status", "N"), finish); }; FormDataController.prototype.deleteData = function(id, finish) { var self = this; self.query("delete from data where id = ?", [id], function(error, result) { if (error) { console.log("FormDataController.deleteData -> error " + error); self.feedBack(false, "Error deleting data [" + error + "]"); } finish(); }); }; FormDataController.prototype.editData = function(meta, id, finish) { var self = this; var atom = self.app.getAtom(meta); var meta = cody.FormController.makeMeta(atom); meta.readValues(self, id, function(error, data) { if (error) { console.log("FormDataController.editData -> error " + error); self.gen("NOK,Can not read the data from the database", { "Content-Type": "application/html" }); return; } console.log(data); self.context.meta = meta; self.context.data = data; finish(); }); }; ================================================ FILE: controllers/ImageController.js ================================================ // // Johan Coppieters - jan 2013 - jWorks // // var mysql = require("mysql2"); var cody = require('../index.js'); console.log("loading " + module.id); function ImageController(context) { console.log("ImageController.constructor -> page(" + context.page.itemId + ") = " + context.page.title + ", request = " + context.request); // init inherited controller cody.TreeController.call(this, context); } ImageController.prototype = Object.create( cody.TreeController.prototype ); module.exports = ImageController; ImageController.prototype.doRequest = function( finish ) { var self = this; //self.context.fn = "-/cms/images.ejs"; if (self.isRequest("imagelist")) { self.getImageList(); finish(""); } else { cody.TreeController.prototype.doRequest.call(self, finish); } }; ImageController.prototype.getRoot = function() { return cody.Application.kImageRoot; }; ImageController.prototype.getType = function(theNode) { return ((theNode.extention === "xxx") || (theNode.extention === "")) ? "folder" : "image"; }; ImageController.prototype.getObject = function(id) { return this.app.getAtom(id); }; ImageController.prototype.getFolder = function() { return "/images"; }; /* Overridden - Action functions */ /* specific functions */ ImageController.prototype.getImageList = function() { console.log("Received ImageController - getImageList"); this.gen("var tinyMCEImageList = " + this.getArray( this.getRoot() ) + ";", {"Content-type": "application/javascript"}); //TODO: add headers: "pragma": "no-cache", "expires": "0" ? }; ================================================ FILE: controllers/LoginController.js ================================================ // // Johan Coppieters - mar 2013 - cody // // console.log("loading " + module.id); var mysql = require("mysql2"); var cody = require("./../index.js"); function LoginController(context) { console.log("LoginController.constructor -> page(" + context.page.itemId + ") = " + context.page.title + ", request = " + context.request); // view to be used for getting the username/password this.loginView = "-/login.ejs"; // URL used when user logs in and no specific page/action was requested before this.loggedInUrl = "/" + (context.page.language || context.app.defaultlanguage) + "/dashboard"; // URL used when the user request a log out. this.loggedOutUrl = "/" + (context.page.language || context.app.defaultlanguage); // use this view for the admin operations this.adminView = "-/cms/users.ejs"; // init inherited controller cody.Controller.call(this, context); } LoginController.prototype = Object.create( cody.Controller.prototype ); module.exports = LoginController; // Used to be: LoginController.prototype = new cody.Controller(); // Object.create() is an excellent choice for creating an object without going through its constructor LoginController.prototype.doRequest = function( finish ) { var self = this; self.context.fn = this.adminView; if (self.isRequest("")) { // request for displaying the login screen finish( self.loginView ); } else if (self.isRequest("login")) { // request for trying to log in with the given parameters self.tryLogin( finish ); } else if (self.isRequest("logout")) { // clear login data from the session self.setLogin({}); // redirect internally var anApp = self.app; var aPath = new cody.Path("/" + self.loggedOutUrl, self.app.defaultlanguage); var aContext = anApp.buildContext( aPath, self.context.req, self.context.res ); anApp.handToController(aContext); } else { finish(); } return undefined; }; LoginController.prototype.markLogin = function( theUserName, theLogin, locked, finish ) { // override this one if you want to log the login (= ! isActive() -> failed) // don't forget to call "finish"... console.log("LoginController.markLogin -> " + (theLogin.isActive() ? "Successfully log in for: " : locked ? "User locked: " : "Login failed for: ") + theUserName); finish(); }; LoginController.prototype.tryLogin = function( finish ) { var self = this; var aUserName = self.getParam("username"); var locked = false; // remove login from context and session -> there is no way back... self.setLogin({}); cody.User.getUser(self, aUserName, this.getParam("password"), function (aUser) { console.log("login rec: " + aUserName + " - " + aUser.id + " - " + aUser.badlogins + " - " + aUser.maxbadlogins); if (aUser && (aUser.badlogins >= aUser.maxbadlogins)) { aUser.active = false; locked = true; } self.markLogin(aUserName, aUser, locked, function() { if (aUser.isActive()) { self.feedBack(true, "login-successful"); // remember the user in the context and session self.setLogin(aUser); aUser.clearBadLogins(self, function() { self.continueRequest( finish ); }); } else { // failed to login, go back to the same screen self.feedBack(false, locked ? "login-locked" : "login-failed"); cody.User.addBadLogin(self, aUserName, function() { finish(self.loginView); }); } }); }); }; LoginController.prototype.continueRequest = function(finish) { var self = this; var anApp = self.app; //check for pending request from before the login request var aSession = self.context.session; if (aSession && aSession.pendingContext) { console.log("LoginController.tryLogin -> found pending session after login"); /* we could have Express handle this too, but still some research to do request({ url: req.host + req.path, headers: req.headers, body: req.body }, function(err, remoteResponse, remoteBody) { if (err) { return res.status(500).end('Error'); } res.writeHead(...); // copy all headers from remoteResponse res.end(remoteBody); }); */ // hand off control to pending controller and adapt our context, remove pending request self.context.copyFromMini(aSession.pendingContext); delete aSession.pendingContext; anApp.handToController(self.context); } else { // no pending request, send to "logged in" page console.log("LoginController.tryLogin -> found no pending session after login -> go to 'logged-in page'"); // perhaps "loggedInUrl" in login request or take default of this controller. var url = self.getParam("loggedInUrl", self.loggedInUrl); // used to be internal redirect, now we just let the browser handle everything. self.redirect(url); finish(""); } }; ================================================ FILE: controllers/PageController.js ================================================ // // Johan Coppieters - jan 2013 - jWorks // // var mysql = require("mysql2"); var cody = require('../index.js'); console.log("loading " + module.id); /* One off object for making roots for Pages and Dashboard */ function Root(controller, id, name) { var myRoot = controller.getObject(id); var myChildren = myRoot.getChildren(); this.getId = function() { return id; }; this.getName = function() { return name; }; this.hasChildren = function() { return (myChildren.length > 0); }; this.getChildren = function() { return myChildren; }; } /* Actual PageController */ function PageController(context) { console.log("PageController.constructor -> page(" + context.page.itemId + ") = " + context.page.title + ", request = " + context.request); // init inherited controller cody.TreeController.call(this, context); } PageController.prototype = Object.create( cody.TreeController.prototype ); // needed? PageController.prototype.constructor = PageController; module.exports = PageController; PageController.prototype.doRequest = function( finish ) { var self = this; self.context.opennode = "0"; self.context.shownode = "0"; if (self.isRequest("realdelete")) { self.realDelete( self.getParam("node"), function whenDone(result) { if (result.status !== "OK") { self.feedBack(false, "Something went wrong during delete."); } finish(); }); } else if (self.isRequest("savecontent")) { self.saveContent( self.getParam("node"), self.getParam("id"), finish); } else if (self.isRequest("addcontent")) { self.addContent( self.getParam("node"), self.getParam("kind"), function(newId) { finish( { status: "OK", id: newId } ); }); } else if (self.isRequest("deletecontent")) { self.deleteContent( self.getParam("node"), self.getParam("id"), function() { finish( { status: "OK" } ); }); } else if (self.isRequest("adjust")) { self.adjustContent( self.getParam("node"), function whenDone(result) { // get all info and data on this node finish( { status: "OK" } ); }); } else if (self.isRequest("SaveX")) { var nodeId = self.getParam("node"); self.saveInfo( nodeId, function() { self.addContent(nodeId , self.getParam("kind"), function(newId) { self.context.opennode = cody.TreeController.toId(nodeId); self.context.shownode = cody.TreeController.toId(nodeId); finish(); }); }); } else { self.context.shownode = cody.TreeController.toId(this.getParam("shownode", "")); self.context.opennode = cody.TreeController.toId(this.getParam("opennode", "")); // super.doRequest cody.TreeController.prototype.doRequest.call(self, finish); } }; /* Overridden - Config functions */ PageController.prototype.getRoot = function() { return cody.Application.kHomePage; }; PageController.prototype.getType = function(theNode) { return (theNode.item.showcontent === cody.Item.kContent) ? "html" : ""; }; PageController.prototype.getFolder = function() { return ""; }; PageController.prototype.getObject = function(id) { var language = this.context.page.language; return this.app.getPage(language, id); }; /* PageController utilities */ PageController.prototype.respace = function( parent, finish ) { var self = this; // Find all children, any page of the item will do, they all have the same children in any language var aPage = this.getObject(parent.id); var nr = 0; cody.Application.each(aPage.children, function respaceOnePage(done) { var aChildPage = this; nr += 10; // console.log("PageController.Respace: checking '" + aChildPage.item.name + "' now = " + aChildPage.item.sortorder + " to " + nr); if (aChildPage.item.sortorder !== nr) { aChildPage.item.sortorder = nr; aChildPage.item.doUpdate(self, function() { done(); }); } else { done(); } }, function whenDone(err) { if (err) { console.log("PageController - respace: error = " + err); } if (typeof finish === "function") { finish(); } }); }; /* Overridden - Action functions */ PageController.prototype.addObject = function( title, refNode, type, kind, finish ) { var self = this; var show = this.getParam("showcontent", "Y"); console.log("Received PageController - addObject, refnode = " + refNode + ", type = " + type + ", kind = " + kind+ ", show = " + show); var refNodeId = cody.TreeController.toId(refNode); var orderNr, aParent; // fetch the user id var userId = this.getLoginId(); // fetch the parent and sortorder if (type === "inside") { orderNr = 5; aParent = self.app.getItem(refNodeId); } else { // after -> is always at the end -> we never get this !! (worked with previous version of jsTree) var refItem = self.app.getItem(refNodeId); orderNr = refItem.sortorder + 10; aParent = refItem.parent; } // can we make modifications to this parent node if (! self.isAllowed(aParent)) { finish( { status: "NAL" } ); return; } // make the item var basis = cody.Item.addDefaults({name: title, user: userId, sortorder: orderNr, template: kind, showcontent: show}, aParent); var anItem = new cody.Item(basis, self.app); try { anItem.doUpdate(self, function() { // we need the id of the new item, so use the callback self.app.addItem(anItem); // make the page in all languages var langs = self.app.getLanguages(); cody.Application.each( langs, function makePageForLanguage(done) { // iterator over all languages basis = cody.Page.addDefaults({language: this.id}, anItem); var aPage = new cody.Page(basis, self.app); aPage.doUpdate(self, function() { self.app.addPage(aPage); aPage.adjustContent(self, done); }, true); }, function whenDone(err) { // terminator if (err) { finish( { status: "NOK", error: err } ); } else { finish( { status: "OK", node: "id_" + anItem.id } ); } }); }); } catch (e) { console.log("PageController.AddPage: Failed to create the Item or Page objects."); console.log(e); finish( { status: "NOK", error: e } ); } }; PageController.prototype.moveObject = function( nodeId, refNode, type, finish ) { var self = this; // type = "before" / "after" or "last" / "inside" console.log("Received PageController - moveObject, refnode = " + refNode + ", node = " + nodeId + ", type = " + type); var orderNr; var aParent; // fetch the parent and insertion point if ((type === "inside") || (type === "last")) { aParent = self.app.getItem(cody.TreeController.toId(refNode)); orderNr = 9999; } else { var refItem = self.app.getItem(cody.TreeController.toId(refNode)); aParent = self.app.getItem(refItem.parentId); orderNr = refItem.sortorder + ((type === "before") ? -5 : +5); } // fetch the node to be moved var anItem = self.app.getItem(cody.TreeController.toId(nodeId)); var curParent = self.app.getItem(anItem.parentId); // check the new target parent if (! self.isAllowed(aParent)) { finish( { status: "NAL" } ); return; } // check the current parent if (! self.isAllowed(curParent)) { finish( { status: "NAL" } ); return; } // position in the tree anItem.parentId = aParent.id; // console.log("PageController.MovePage: old order = " + anItem.sortorder + " (of " + anItem.id + "), new order = " + orderNr); anItem.sortorder = orderNr; try { // anItem.doUpdate(self); -> done in respace too, so no need to call it here self.app.buildSitemap(); self.respace(aParent, function whenDone() { finish( { status: "OK" } ); }); } catch (e) { console.log("PageController.MovePage: Failed to update the Item object."); console.log(e); finish( { status: "NOK", error: e.toString() } ); } }; PageController.prototype.renameObject = function( title, nodeId, finish ) { var self = this; console.log("Received PageController - renameObject, node = " + nodeId + ", title = " + title); var aPage = self.getObject( cody.TreeController.toId(nodeId) ); if (aPage) { if (! self.isAllowed(aPage)) { finish( { status: "NAL" } ); return; } aPage.title = title; try { aPage.doUpdate(self, function() { // change all names for pages from this item that still have the defaultName // (the item was probably just created) var langs = self.app.getLanguages(); cody.Application.each( langs, function forEachLanguage(next) { anotherPage = self.app.getPage(this.id, aPage.itemId); if (anotherPage.title === cody.Item.kDefaultName) { anotherPage.title = title; anotherPage.doUpdate(self, next); } else { next(); } }, function whenDone(err) { // perhaps overkill but for (sortorder == alphabetical) the order of pages can change self.app.buildSitemap(); // rename the item if it iss the page of the default language (although item names are not shown) // it's nice for debugging the database if ((self.app.isDefaultLanguage(aPage.language)) || (aPage.item.name === cody.Item.kDefaultName)) { aPage.item.name = title; aPage.item.doUpdate(self, function() { finish( { status: "OK" } ); }); } else { finish( { status: "OK" } ); } }); }); } catch (e) { console.log("PageController.RenameObject: Failed to update the Page or Item object."); finish( {status: "NOK", error: e } ); } } else { finish( {status: "NOK", error: "page not found" } ); } }; PageController.prototype.realDelete = function( node, finish ) { var self = this; console.log("Received PageController - realdelete, node = " + node); //request to delete a node from the tree var aPage = self.getObject( cody.TreeController.toId(node) ); var anItem = aPage.item; // if possible, show this node after the delete self.context.shownode = anItem.parentId; if (! self.isAllowed(anItem)) { finish( { status: "NAL" } ); return; } if (aPage.hasChildren()) { finish( { status: "NOE" } ); return; } try { anItem.doDelete(self, function() { finish( { status: "OK" } ); }); } catch(e) { console.log("PageController.RealDelete: Failed to delete the Page object -- " + e); finish( { status: "NOK", error: e } ); } }; PageController.prototype.deleteObject = function( nodeId, finish ) { var self = this; // for pages, this function only de-activates the item console.log("Received PageController - deleteObject, node = " + nodeId); try { var aPage = self.getObject( cody.TreeController.toId(nodeId) ); if (! self.isAllowed(aPage)) { finish( { status: "NAL" } ); return; } aPage.doDeactivate(self, function() { finish( { status: "OK" } ); }); } catch (e) { console.log("PageController.DeletePage: Failed to delete the Page object -- " + e); finish( { status: "NOK", error: e } ); } }; PageController.prototype.fetchNode = function( theNode, finish ) { var self = this; var aPage = self.getObject( cody.TreeController.toId(theNode) ); if (! self.isAllowed(aPage)) { this.gen("NAL,User is not allowed to edit this page with id = " + theNode, { "Content-Type": "application/html" }); return; } // just switch the page in our current context and we're done ?? self.context.page = aPage; //TODO: get all the (main) content blocks connected to this page // for the moment they are all there from startup // but then -> question? how do I get rid of all the (main) blocks -- and keep the (intro) blocks // actually: "when" do I do this? console.log("PageController.FetchNode: node = " + theNode + " + language = " + aPage.language + " => " + self.context.page.item.id); finish(); }; PageController.prototype.saveInfo = function( nodeId, finish ) { var self = this; var aPage = self.getObject( cody.TreeController.toId(nodeId) ); var anItem = aPage.item; anItem.scrapeFrom(self); anItem.doUpdate(self, function() { aPage.scrapeFrom(self); aPage.doUpdate(self, function() { aPage.updateContent(self, function() { // sortBy attributes can be changed self.app.buildSitemap(); // signal node to be selected in the tree view self.context.shownode = anItem.id; finish(); }); }); }); }; /* Controller specific, called from template */ PageController.prototype.getDashboardTree = function() { return this.getTree( new Root(this, cody.Application.kDashboardPage, "Dashboard") ); }; PageController.prototype.getOrphansTree = function() { return this.getTree( new Root(this, cody.Application.kOrphansPage, "Pages") ); }; /* content stuff */ PageController.prototype.saveContent = function(thePage, theId, finish) { var self = this; var aPage = self.getObject( cody.TreeController.toId(thePage) ); var aContentId = cody.TreeController.toId(theId); console.log("Received PageController - saveContent, pageId = " + thePage + ", contentId = " + aContentId); try { if (! self.isAllowed(aPage)) { finish( { status: "NAL" } ); return; } var aContent; if (aContentId !== 0) { aContent = aPage.getContent(aContentId); } else { aContent = new cody.Content({}, self.app); aContent.attachTo(aPage, aPage.item.id, aPage.language); } aContent.scrapeFrom(self); aContent.doUpdate(self, (aContentId === 0), function(err) { if (err) { finish( { status: "NOK", error: err } ); } else { finish( { status: "OK" } ); } }); } catch (e) { console.log(e); console.log("PageController.SaveData: failed to save the content of page " + thePage + " with id = " + theId); finish( { status: "NOK", error: e } ); } }; PageController.prototype.adjustContent = function( theNode, finish ) { var self = this; console.log("PageController.adjustContent: add correct Content for " + theNode + ""); var aPage = self.getObject( cody.TreeController.toId(theNode) ); aPage.adjustContent( self, function() { self.context.fetchnode = "id_" + aPage.itemId; finish(); }); }; PageController.prototype.addContent = function( theNode, theKind, finish ) { var self = this; console.log("PageController.addContent: " + theKind + ", for " + theNode + ""); var aPage = self.getObject( cody.TreeController.toId(theNode) ); aPage.addContent( self, theKind, function(newId) { finish(newId); }); }; PageController.prototype.deleteContent = function( theNode, theId, finish ) { var self = this; console.log("PageController.deleteContent: delete content " + theId + ", for " + theNode + ""); var aPage = self.getObject( cody.TreeController.toId(theNode) ); aPage.deleteContentById(self, cody.TreeController.toId(theId), function() { finish(); }); }; ================================================ FILE: controllers/StylesController.js ================================================ console.log("loading " + module.id); var mysql = require("mysql2"); var cody = require("./../index.js"); var fs = require("fs"); var path = require("path"); var util = require("util"); module.exports = StylesController; function StylesController(context) { var self = this; console.log("StylesController.constructor"); this.formView = "-/cms/styles.ejs"; // init inherited controller cody.Controller.call(self, context); } StylesController.prototype = Object.create( cody.Controller.prototype ); StylesController.prototype.doRequest = function( finish ) { var self = this; self.context.fn = this.formView; var startupPath = path.dirname(require.main.filename); var projectPath = path.join(startupPath, self.context.app.name); var staticPath = path.join(projectPath, "static"); var customCSSPath = path.join(staticPath, "css", "user.css"); var imagesPath = path.join(staticPath, "images"); var ff=imagesPath+""; fs.readFile(customCSSPath, 'utf8', function (err,data) { if (err) { data = ""; } self.context.css = data; if (self.isRequest("")) { finish( self.formView ); } else if (self.isRequest("newlogo")) { self.feedBack(true, "logo-updated"); var uploadedFiles = self.context.req.files; if(uploadedFiles.logoFile === undefined){ self.feedBack(false, "logo-none-selected"); } else{ var file = uploadedFiles.logoFile; if(new Array("image/png").indexOf(file.type) < 0){ //TODO: add other formats but convert them self.feedBack(false, "logo-unsupported-format"); }else{ var destinationPath = path.join(imagesPath, "logoMC.png"); ins = fs.createReadStream(file.path); ous = fs.createWriteStream(destinationPath); util.pump(ins, ous, function(err) { if(err) { next(err); } else { res.redirect('/en/styles'); } }); self.feedBack(true, "logo-updated"); } } finish( self.formView ); } else if (self.isRequest("newcss")) { var css = self.getParam("css"); fs.writeFile(customCSSPath, css, function(err) { if(err) { self.feedBack(false, "css-update-failed"); } else { self.feedBack(true, "css-updated"); } self.context.css = css; finish( self.formView ); }); } else { finish(); } }); return null; //cody.TreeController.prototype.doRequest.call(self, finish); }; ================================================ FILE: controllers/SystemController.js ================================================ console.log("loading " + module.id); var mysql = require("mysql2"); var cody = require("./../index.js"); var fs = require("fs"); var path = require("path"); var util = require("util"); var mysql = require("mysql2"); module.exports = SystemController; function SystemController(context) { var self = this; console.log("SystemController.constructor -> page(" + context.page.itemId + ") = " + context.page.title + ", request = " + context.request); // init inherited controller cody.Controller.call(self, context); } SystemController.prototype = Object.create( cody.Controller.prototype ); //fetch config values from database SystemController.prototype.doRequest = function( finish ) { var self = this; self.context.fn = "-/cms/system.ejs"; if (self.isRequest("reload")) { self.app.init(function() { self.feedback(true, "System reloaded."); finish(); }); } else if (self.isRequest("Save")) { self.query("UPDATE cody.websites SET hostname=? WHERE id=?", [this.getParam("hostname"), this.getParam("id")], function (err2, results2) { self.doList(function() { self.app.init(function() { self.feedback(true, "Parameters saved and system reloaded."); finish(); }); }); }); } else if (self.isRequest("Hosting")) { self.doList(finish); } else { finish(); } }; SystemController.prototype.doList = function(finish) { var self = this; var hostname = self.context.req.headers.host; if (hostname.indexOf(":") >= 0) { hostname = (hostname.split(":"))[0]; } var hostnameA = self.escape("%," + hostname); var hostnameB = self.escape(hostname + ",%"); hostname = self.escape(hostname); self.query("SELECT * FROM cody.websites WHERE hostname=" + hostname + " OR hostname LIKE " + hostnameA + " OR hostname LIKE " + hostnameB, function (err, results) { if (err) throw err; if (results.length > 0) { var result = results[0]; self.context.config = result; finish(self.formView); } }); }; ================================================ FILE: controllers/TemplateController.js ================================================ // // Johan Coppieters - may 2013 - cody // // console.log("loading " + module.id); var mysql = require("mysql2"); var cody = require("../index.js"); function TemplateController(context) { console.log("TemplateController.constructor -> page(" + context.page.itemId + ") = " + context.page.title + ", request = " + context.request); // init inherited controller cody.Controller.call(this, context); } TemplateController.prototype = Object.create( cody.Controller.prototype ); module.exports = TemplateController; TemplateController.prototype.doRequest = function( finish ) { var self = this; var thisId = this.getInt("id", -1); // request for displaying the login screen if (self.isRequest("") || this.isRequest("list")) { self.doList( finish ); } else if (self.isRequest("save")) { self.doSave( thisId, function() { self.setRequest("list"); self.doList( finish ); }); } else if (self.isRequest("duplicate")) { self.doDuplicate( thisId, function(newId) { self.doGet( newId, finish); }); } else if (self.isRequest("delete")) { self.doDelete( thisId, function() { self.setRequest("list"); self.doList( finish ); }); } else if (this.isRequest("edit")) { self.doGet( thisId, finish); } else if (this.isRequest("new")) { self.doGet( NaN, finish ); } else if (self.isRequest("addcontent")) { self.doAddContent( thisId, self.getParam("content", "S"), function() { self.doGet( thisId, finish); }); } else if (self.isRequest("delcontent")) { self.doDelContent( thisId, self.getParam("content", 0), function() { self.doGet( thisId, finish); }); } else { finish(); } return undefined; }; TemplateController.prototype.doDelete = function( theId, finish ) { var self = this; if (self.app.templateUsed(theId)) { self.feedBack(false, "Failed to delete the template, it is still in use by some pages"); finish(); return; } var aTemplate = this.app.deleteTemplate(theId); if (typeof aTemplate !== "undefined") { aTemplate.doDelete(self, function() { aTemplate.deleteAllContent(self, function() { self.feedBack(true, "Successfully deleted the template and its content"); finish(); }); }); } else { self.feedBack(false, "Failed to delete the template, it was not found"); finish(); } }; TemplateController.prototype.doSave = function( theId, finish ) { var self = this; var aTemplate = self.app.getTemplate(theId); if (typeof aTemplate === "undefined") { aTemplate = new cody.Template({id: 0}, self.app.controllers); } aTemplate.scrapeFrom(self); aTemplate.doUpdate(self, function() { aTemplate.updateContent(self, function() { self.feedBack(true, "Successfully saved the template and its content"); finish(); }); }); }; TemplateController.prototype.doDuplicate = function( theId, finish ) { var self = this; var aTemplate = self.app.getTemplate(theId); var newTemplate = new cody.Template(aTemplate, self.app.controllers); newTemplate.id = 0; // mark as new newTemplate.scrapeFrom(self); if (newTemplate.name === aTemplate.name) { newTemplate.name = newTemplate.name + " copy"; } // create the template in the database newTemplate.doUpdate(self, function() { // duplicate content blocks newTemplate.copyContentFrom(self, theId, function() { self.feedBack(true, "Successfully duplicated the template"); finish(newTemplate.id); }); }); }; TemplateController.prototype.doGet = function(id, finish) { var self = this; var aTemplate; // get or make the template object if ((typeof id === "undefined") || isNaN(id) || (id === 0)) { aTemplate = new cody.Template({id: 0}, self.app.controllers); // store it in the context for our view self.context.template = aTemplate; // terminate -> new template is ready for editing finish(); } else { aTemplate = self.app.getTemplate(id); // store it in the context for our view self.context.template = aTemplate; // attach all its content objects aTemplate.fetchContent(self.app, id, finish); } }; TemplateController.prototype.doList = function(finish) { var self = this; self.context.templates = self.app.templates; finish(); }; /////////////////// // Content Stuff // /////////////////// TemplateController.prototype.doAddContent = function( theId, kind, finish ) { var self = this; var aTemplate = self.app.getTemplate(theId); aTemplate.addContent(self, theId, kind, function() { self.feedBack(true, "Successfully added content to the template"); finish(); }); }; TemplateController.prototype.doDelContent = function( theId, theContent, finish ) { var self = this; var aTemplate = self.app.getTemplate(theId); aTemplate.deleteContent(self, theContent, function() { self.feedBack(true, "Successfully deleted content to the template"); finish(); }); }; ================================================ FILE: controllers/TreeController.js ================================================ // // Johan Coppieters - mar 2013 - cody // // console.log("loading " + module.id); var mysql = require("mysql2"); var fs = require("fs"); var cody = require('../index.js'); function TreeController(context) { console.log("TreeController.constructor -> page(" + context.page.itemId + ") = " + context.page.title + ", request = " + context.request); // init inherited controller cody.Controller.call(this, context); context.shownode = this.getRoot(); } TreeController.prototype = Object.create( cody.Controller.prototype ); module.exports = TreeController; TreeController.prototype.getFilePath = function() { return this.context.dynamic + this.getFolder(); }; // Next 4 should be overridden TreeController.prototype.getRoot = function() { throw new Error("TreeController.getRoot should be overridden - return an id"); }; TreeController.prototype.getType = function(theNode) { throw new Error("TreeController.getType should be overridden - return a string (image, folder, ...) to be used by the Atom tree to display the nodes"); }; TreeController.prototype.getObject = function(id) { throw new Error("TreeController.getObject should be overridden - return an Atom with the specified id"); }; TreeController.prototype.getFolder = function() { throw new Error("TreeController.getFolder should be overridden - return a string / subpath in which the documents can be found"); }; /* required protocol for nodes: Node.prototype.getAllowedDomains = function() { return ""; } Node.prototype.hasChildren = function() { return false; } Node.prototype.isActive = function() { return true; } Node.prototype.isVisible = function() { return true; } Node.prototype.getChildren = function() { return []; } Node.prototype.getSortOrder = function() {} Node.prototype.setSortOrder = function(nr) {} Node.prototype.setName = function(name) {} Node.prototype.getName = function() {} Node.prototype.getId = function() {} Node.prototype.scrapeFrom = function(controller) {} Node.prototype.doUpdate = function(controller, finish) {} Node.prototype.doDelete = function(controller, finish) {} */ TreeController.toId = function(theNode) { if ((typeof theNode === "undefined") || (theNode === "")) { return 0; } else if (theNode.indexOf("id_") === 0) { return parseInt(theNode.substring(3), 10); } else { return parseInt(theNode, 10); } }; TreeController.prototype.doRequest = function( finish ) { var self = this; if (self.isRequest("insert")) { // a new node was inserted in the tree self.addObject( self.getParam("name"), self.getParam("refnode"), self.getParam("type"), self.getParam("kind"), finish ); } else if (self.isRequest("move")) { // a node was being moved around in the tree this.moveObject( self.getParam("node"), self.getParam("refnode"), self.getParam("type"), finish); } else if (self.isRequest("rename")) { // a node has been renamed in the tree this.renameObject( self.getParam("name"), self.getParam("node"), finish); } else if (self.isRequest("realdelete")) { // request to really delete a node from the tree this.realDeleteObject( self.getParam("node"), finish); } else if (self.isRequest("delete")) { // request to mark a node as "deleted" / "inactive" in the tree this.deleteObject( self.getParam("node"), finish); } else if (self.isRequest("select")) { // generate a input/type=select this.gen( this.getList() ); finish(""); } else if (self.isRequest("menu")) { // generate a ul/li tree for menus this.gen( this.getMenu(), { "Content-Type": "application/html" } ); finish(""); } else if (self.isRequest("getnode")) { // get all info and data on this node this.fetchNode( self.getParam("node"), function() { finish( self.context.fn.replace(".ejs", "-ajax.ejs") ); }); } else if (self.isRequest("save")) { // save all info on this node (done by a submit, so we need to redraw the screen, too bad) this.saveInfo( self.getParam("node"), finish ); } else { // no specific request, just draw the tree... finish(); } }; //display the complete tree to be used in a array with id / filename. TreeController.prototype.getArray = function( theRoot ) { var self = this; var imagePath = self.getFilePath(); var aRoot = self.getObject((typeof theRoot === "undefined") ? this.getRoot() : theRoot); function dashes(cnt) { var s = ""; for (var i=0; i 0) { aTree += ", "; } aTree += "[\"" + dashes(level) + " " + p.getName() + "\",\"" + imagePath + "/" + p.getFileName() + "\"]"; var rest = renderArray(p, level+1); if (rest.length > 0) { aTree += "," + rest; } } } return aTree; } return "[" + renderArray( aRoot, 0 ) + "]"; }; //display the complete tree to be used in a select/menu. TreeController.prototype.getMenu = function( theRoot ) { var self = this; var aRoot = (typeof theRoot === "object") ? theRoot : self.getObject((typeof theRoot === "undefined") ? self.getRoot() : theRoot); function renderTree( theNode ) { var aTree = ""; var aList = theNode.getChildren(); for (var x in aList) { var p = aList[x]; if (p.isVisible()) { aTree += "
  • " + p.getName() + "" + renderTree(p) + "
  • "; } } return (aTree.length === 0) ? "" : ""; } return renderTree( aRoot ); }; //display the complete tree to be used in a select/menu. TreeController.prototype.getList = function( theRoot ) { var self = this; var aRoot = (typeof theRoot === "object") ? theRoot : self.getObject((typeof theRoot === "undefined") ? self.getRoot() : theRoot); function renderTree( theNode ) { var aTree = ""; var aList = theNode.getChildren(); for (var x in aList) { var p = aList[x]; if (p.isVisible()) { aTree += "
  • " + p.getName() + renderTree(p) + "
  • "; } } return (aTree.length === 0) ? "" : ""; } return renderTree( aRoot ); }; // The complete tree for the admin part of the essen TreeController.prototype.getTree = function( theRoot ) { var self = this; var aRoot = (typeof theRoot === "number") ? self.app.getAtom(theRoot) : (typeof theRoot === "object") ? theRoot : self.getObject((typeof theRoot === "undefined") ? self.getRoot() : theRoot); function renderTree( theNode, open, descend ) { var aTree = ""; if (typeof theNode != "undefined") { var aList = theNode.getChildren(); for (var x in aList) { var p = aList[x]; var name = (p.isActive()) ? p.getName() : "("+p.getName()+")"; var classes = (open ? "open " : "") + (p.isVisible() ? "" : "invisible ") + (p.isActive() ? "" : "deleted"); aTree += "
  • " + name + ""; if (descend > 0) { aTree += renderTree(p, false, descend-1); } aTree += "
  • "; } } if (aTree.length === 0) { return ""; } else { return ""; } } return renderTree( aRoot, false, 99 ); }; TreeController.prototype.saveInfo = function( nodeId, finish ) { var self = this; console.log("FormController.saveInfo: node = " + nodeId ); var anObject = this.getObject(TreeController.toId(nodeId)); if (typeof anObject !== "undefined") { self.context.shownode = anObject.parentId; anObject.scrapeFrom(this); var F = self.context.req.files; if ((typeof F !== "undefined") && (typeof F.fileToUpload !== "undefined")) { F = F.fileToUpload; if (F.size !== 0) { // find the name of the file var dot = F.name.lastIndexOf("."); anObject.setExtention(F.name.substring(dot+1)); var oldNote = anObject.getNote() || ""; if (oldNote === "") { anObject.setNote(F.name.substring(0, dot)); } var newPath = anObject.getPathName(self); // move the tmp file to our own datastore console.log("TreeController.saveInfo: moving file from " + F.path + " to " + newPath); fs.rename(F.path, newPath, function(err) { if (err) { console.log(err); this.feedBack(false, "unable to rename uploaded file to " + newPath); } else { anObject.doUpdate(self, finish); } }); } else { // just delete the tmp file if it's empty fs.unlink(F.path, function() { anObject.doUpdate(self, finish); }); } } else { console.log("TreeController.saveInfo: no file attached."); anObject.doUpdate(self, finish); } } else { this.feedBack(false, "failed to save the data"); finish(); } }; TreeController.prototype.addObject = function( title, refNode, type, kind, finish ) { var self = this; console.log("Received TreeController - addObject, refnode = " + refNode + ", title = " + title + ", type = " + type + ", kind = " + kind); var refNodeId = TreeController.toId(refNode); var orderNr, aParent; var ext = (kind === "folder") ? "xxx" : (kind === "form") ? "" : "---"; // fetch the parent and sortorder if (type === "inside") { orderNr = 5; aParent = self.app.getAtom(refNodeId); } else { // after -> is always at the end -> we never get this !! (worked with previous version of jsTree) var refItem = self.app.getAtom(refNodeId); orderNr = refItem.sortorder + 10; aParent = refItem.parent; } var basis = cody.Atom.addDefaults({name: title, sortorder: orderNr, extention: ext}, aParent); var anAtom = new cody.Atom(basis); anAtom.pickParent(self.app.atoms); // console.log(anAtom); anAtom.doUpdate(self, function() { self.app.addAtom(anAtom); finish( { status: "OK", node: "id_" + anAtom.id } ); }); }; TreeController.prototype.moveObject = function( nodeId, refNode, type, finish ) { var self = this; // type = "before" / "after" or "last" / "inside" console.log("Received TreeController - moveObject, refnode = " + refNode + ", node = " + nodeId + ", type = " + type); var orderNr; var aParent; // fetch the parent and insertion point if ((type === "inside") || (type === "last")) { aParent = self.app.getAtom(cody.TreeController.toId(refNode)); orderNr = 9999; } else { var refItem = self.app.getAtom(cody.TreeController.toId(refNode)); aParent = self.app.getAtom(refItem.parentId); orderNr = refItem.sortorder + ((type === "before") ? -5 : +5); } // fetch the node to be moved var anItem = self.app.getAtom(cody.TreeController.toId(nodeId)); var curParent = self.app.getAtom(anItem.parentId); // position in the tree anItem.parentId = aParent.id; //console.log("TreeController.MovePage: old order = " + anItem.sortorder + " (of " + anItem.id + "), new order = " + orderNr + ", in parent = " + anItem.parentId); anItem.sortorder = orderNr; try { self.respace(aParent, function whenDone() { finish( { status: "OK" } ); }); } catch (e) { console.log("TreeController.MoveItem: Failed to update the Item object."); console.log(e); finish( { status: "NOK", error: e.toString() } ); } }; TreeController.prototype.renameObject = function( title, nodeId, finish ) { var self = this; console.log("Received TreeController - rename, node = " + nodeId + ", title = " + title); var anObject = this.getObject(TreeController.toId(nodeId)); if (typeof anObject !== "undefined") { try { anObject.setName(title); anObject.doUpdate(self, function() { self.context.shownode = anObject.id; finish( { status: "OK" } ); }); } catch (e) { console.log("TreeController.RenameObject: Failed to update the object - " + e); finish( { status: "NOK", error: e.toString() } ); } } else { finish( { status: "NOK"} ); } }; TreeController.prototype.deleteObject = function( nodeId, finish ) { var self = this; var anObject = self.getObject(TreeController.toId(nodeId)); if (self.app.hasAtomChildren(anObject)) { finish({ status: "NOE", error: "not empty"}); } else { self.context.shownode = anObject.parentId; anObject.doDelete(self, function(err) { if (err) { finish({status: "NOK", error: err.toString()}); } else { finish({status: "OK"}); } }); } }; TreeController.prototype.realDeleteObject = function( nodeId, finish ) { var self = this; this.deleteObject( nodeId, function(msg) { if (msg.status === "NOE") { self.feedBack(false, "There are still elements below this item"); finish(); } else if (msg.status === "NOK") { self.feedBack(false, "Error deleting this item: " + msg.error); finish(); } else { self.feedBack(true, "Item successfully deleted"); finish(); } }); }; TreeController.prototype.makeSelect = function( type ) { }; TreeController.prototype.fetchNode = function( nodeId, finish ) { console.log("TreeController.FetchNode: nodeId = " + nodeId); this.context.atom = this.getObject(TreeController.toId(nodeId)); if (! this.context.atom) { this.gen("NOK,Could not find the requested atom with id = " + nodeId, { "Content-Type": "application/html" }); } else { finish(); } }; TreeController.prototype.respace = function( parent, finish ) { var self = this; var aList = parent.getChildren(); var nr = 0; cody.Application.each(aList, function respaceOnePage(done) { var aChild = this; nr += 10; //console.log("TreeController.Respace: checking '" + aChild.name + "' now = " + aChild.sortorder + " to " + nr); if (aChild.getSortOrder() !== nr) { aChild.setSortOrder(nr); aChild.doUpdate(self, function() { done(); }); } else { done(); } }, function whenDone(err) { if (err) { console.log("TreeController - respace: error = " + err); } if (typeof finish === "function") { finish(); } }); }; ================================================ FILE: controllers/UserController.js ================================================ // // Johan Coppieters - mar 2013 - cody // // console.log("loading " + module.id); var mysql = require("mysql2"); var cody = require("./../index.js"); function UserController(context) { console.log("UserController.constructor -> page(" + context.page.itemId + ") = " + context.page.title + ", request = " + context.request); // init inherited controller cody.Controller.call(this, context); } UserController.prototype = Object.create( cody.Controller.prototype ); module.exports = UserController; UserController.prototype.doRequest = function( finish ) { var self = this; if (self.isRequest("") || this.isRequest("list")) { self.doList( finish ); } else if (self.isRequest("save")) { self.doSave( this.getId(), function() { self.nextRequest("list", finish); }); } else if (self.isRequest("delete")) { self.doDelete( this.getId(), function() { self.nextRequest("list", finish); }); } else if (this.isRequest("edit")) { self.doGet( this.getId(), finish); } else if (this.isRequest("new")) { self.doGet(NaN, finish); } else { cody.Controller.prototype.doRequest.call(this, finish); } }; UserController.prototype.doDelete = function( theId, finish ) { var self = this; cody.User.deleteUser(self, theId, function(isOK) { if (isOK) { self.feedBack(true, "Successfully deleted the user"); } else { self.feedBack(false, "Failed to delete the user"); } finish(); }); }; UserController.prototype.doSave = function( theId, finish ) { var self = this; cody.User.getUser( self, theId, function(aUser) { aUser.scrapeFrom(self); aUser.doUpdate(self, function() { if (aUser.id === self.getLoginId()) { self.setLogin(aUser); } self.feedBack(true, "Successfully saved the user"); finish(); }); }); }; UserController.prototype.doGet = function(id, finish) { var self = this; self.doGetRefs( function() { if (isNaN(id) || (id <= 0)) { self.context.user = new cody.User({id: 0}); finish(); } else { cody.User.getUser( self, id, function(record) { self.context.user = record; finish(); }); } }); }; UserController.prototype.doGetRefs = function(finish) { var self = this; cody.User.getDomains( self, function(list) { // also update the list which is kept in the Application object self.app.storeDomains(list); self.context.domains = self.app.domains; cody.User.getLevels( self, self.getLoginLevel(), function(list) { self.context.levels = list; finish(); }); }); }; UserController.prototype.doList = function(finish) { var self = this; cody.User.getUsers(self, self.getLoginLevel(), function(list) { self.context.users = list; self.doGetRefs(finish); }); }; ================================================ FILE: doc/Context.txt ================================================ // // Johan Coppieters - jan 2013 - Cody // // // // Context // // Created by Application in buildContext as results of servePage for every request, // containing all the context info for that request. // // Accessible // - through the controller of the request // - used as global scope while rendering a view // so all its properties are accessible as globals for the view rendered for that request. // // Additionally provides some helpers (formatting/utitlities), thus accessible by the views. // // Instance variables // // from the constructor" function Context(path, page, app, req, res) { this.version = [ string ] // copied from incoming Application object this.page = page; this.app = app; this.req = req; this.res = res; this.path = path; this.params = [ hashmap ] // sum of url params + if available all posted values this.request = [ string ] // this.status = [ string ] // "success", "failed" this.message = [ string ] // corresponding message this.host = [ string ] // copied from: req.headers.host = name for the (virtual) host this.dateFormat = [ string ]; // "dd-mm-yyyy" / "yyyy-mm-dd" / "dmm-dd-yyyy" this.min = [ string ] // "" / ".min" to be used when including scripts minified of not this.static = [ string ]; // path to all static content, example: in a view: <%= static %>/aLayout.css this.dynamic = [ string ]; // path to all dynamic content, example: in a view: <%= dynamic %>/images/123.jpg this.cstatic = [ string ]; // path to all static content of the framework, example: in a view: <%= cstatic %>/icons/P.png this.strings = [ hashmap ] // all content of the page "[language]/strings", typically to be used as application wide multi language labels this.fn = [ string ] // the name of the view file of the current page, if nothing specified: "index.ejs"; this.session [ session object ] // copied from the request-object, if available this session also contains the login user-object this.cody = [ cody module ] // making the complete cody lib accessible to your controller and/or views -------------------------------------------------------------------------------------------------------------------- Context.prototype.render = function(params) // // Render content queried by name or kind. // // params: // // { kind: String, // not_kind: String, // name: String, // not_name: String, // intro: Y/N, Show intro part? // page: Page } Optional Page to get the content from instead of current -------------------------------------------------------------------------------------------------------------------- // // login stuff // Context.prototype.setLogin = function(login) { this.session.login = login; this.login = new cody.User(login); }; Context.prototype.isLoggedIn = function() { return (this.login) && (typeof this.login !== "undefined") && (this.login.active === "Y"); }; Context.prototype.getLogin = function() { return this.login || new cody.User({}); }; -------------------------------------------------------------------------------------------------------------------- // // General utilities // Context.prototype.getValueByIndex = function(object, index) { var nr = 0; for (var iO in object) { if (nr === index) { return object[iO]; } nr++; } return undefined; } Context.prototype.getKeyByIndex = function(object, index) { var nr = 0; for (var iO in object) { if (nr === index) { return iO; } nr++; } return undefined; } -------------------------------------------------------------------------------------------------------------------- Context.prototype.val = function(value) { return (typeof value === "undefined") ? "" : value; }; Context.prototype.getUnique = function() { return new Date().getTime(); }; -------------------------------------------------------------------------------------------------------------------- rendering widgets -------------------------------------------------------------------------------------------------------------------- // returns 'checked' if true, for option lists. Context.prototype.checked = function( bool ) { return (bool) ? 'checked' : ''; }; // // Creates html options from a given list // // 1. optionList([String], String) // Creates an option for each string and marks theId as string. // 2. optionList([Object], String, String, String) // Creates an option for each object, using theIdName and theNameName properties // of each object to set the id and html resp. // Context.prototype.optionList = function(theList, theId, theIdName, theNameName) { var x = ""; var first = cody.Application.findFirst(theList); if (typeof first === "string") { for (var j=0; j < theList.length; j++) { var S = theList[j]; x += "\n"; } } else { var idName = theIdName || "id"; var nameName = theNameName || "name"; for (var i in theList) { if (theList.hasOwnProperty(i)) { var O = theList[i]; x += "\n"; } } } return x; }; // // optionListF([Any], String, (Any) -> String, (Any) -> String) -> String // // Uses two functions that take an element from the list as argument and return // an id/name to create the options. Marks the option that has the id theId as "selected". // Context.prototype.optionListF = function (theList, theId, getId, getName) { var options = ""; theList.forEach(function (item) { var id = getId(item); console.log(id); var name = getName(item); options += "\n"; }); return options; }; Context.prototype.find = function(theList, theId, theIdName) { var idName = theIdName || "id"; for (var i=0; i < theList.length; i++) { var R = theList[i]; if (R[idName] == theId) { return R; } } return {}; }; // // Session handlers // Context.prototype.fromSession = function(paramName, defaultValue) { var x = this.session[paramName]; return (typeof x === "undefined") ? defaultValue : x; }; Context.prototype.toSession = function(paramName, value) { this.session[paramName] = value; }; // // Request Parameter handlers // Context.prototype.getParam = function(paramName, defaultValue) { var x = this.params[paramName]; return (typeof x === "undefined") ? defaultValue : x; }; Context.prototype.setParam = function(paramName, value) { this.params[paramName] = value; }; function two(n) // Adds a leading "0" when the number < 10. Context.prototype.formatTime = function(aDate) // returns the time formated as "HH:MM:SS" Context.prototype.formatShortTime = function(aDate) // returns the time formated as "HH:MM" // // format depending on the dateFormat field of this context // Context.prototype.formatDate = function(aDate) { Context.prototype.makeDate = function(value, defaultValue) { Context.prototype.makeInt = function(value, defaultValue) { Context.prototype.makeNum = function(value, defaultValue, precision) { ================================================ FILE: doc/empty/controllers/YourController.js ================================================ console.log("loading " + module.id); var cody = require("cody"); function YourController(context) { // init inherited Controller cody.Controller.call(this, context); } YourController.prototype = Object.create(cody.Controller.prototype); YourController.prototype.doRequest = function( finish ) { var self = this; // 1) do the necessary model operations // 2) return a result: // // a) render the attached view of this controller finish(); // b) render the view with given path: // finish('views/yourview.ejs') // c) if you don't want any rendering to be done: // pass an empty string (or set this.context.fn to empty) // finish('') // d) return json: // finish({foo: 'bar'}); // e) you can let the super controller handle the request // cody.Controller.prototype.doRequest.call(self, finish); // more... }; module.exports = YourController; ================================================ FILE: doc/empty/empty.sql ================================================ SET sql_mode = 'STRICT_TRANS_TABLES'; CREATE FUNCTION PASSWORD2(s VARCHAR(50)) RETURNS VARCHAR(50) DETERMINISTIC RETURN CONCAT('*', UPPER(SHA1(UNHEX(SHA1(s))))); DROP TABLE IF EXISTS `atoms`; CREATE TABLE `atoms` ( `id` int(11) NOT NULL AUTO_INCREMENT, `parent` int(11) NOT NULL DEFAULT '0', `sortorder` int(11) DEFAULT '0', `name` varchar(64) NOT NULL DEFAULT '', `note` varchar(4096) DEFAULT NULL, `extention` varchar(4) DEFAULT '', `created` datetime DEFAULT '0000-00-00 00:00:00', `updated` datetime DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) ) AUTO_INCREMENT=200 DEFAULT CHARSET=utf8; LOCK TABLES `atoms` WRITE; INSERT INTO `atoms` VALUES (1,0,10,'Images','','','2012-01-01 00:00:00','2013-11-02 18:28:10'), (2,0,20,'Files','','','2012-07-09 14:18:36','2012-07-09 14:18:36'), (3,0,20,'Forms','','','2012-07-09 14:18:36','2012-07-09 14:18:36'), (4,0,10,'Layout','','','2010-01-01 00:00:00','2010-01-01 00:00:00'), (11,4,10,'Logo','ourlogo','png','2010-01-01 00:00:00','2013-11-02 18:15:35'), (12,4,10,'Header','','---','2010-01-01 00:00:00','2010-01-01 00:00:00'), (13,4,10,'Footer','','---','2010-01-01 00:00:00','2010-01-01 00:00:00'), (21,1,10,'General','','','2012-08-15 18:55:51','2014-09-03 10:24:30'), (32,3,5,'Contact Formulier','{\"name\":\"Contact Formulier\",\"labels\":{\"en\":\"Send\",\"it\":\"Send\"},\"alert\":\"nobody@mysite.com\"}','','2013-09-07 22:03:12','2014-09-03 10:26:15'), (33,32,10,'name','{\"name\":\"name\",\"labels\":{\"en\":\"Name\",\"it\":\"Name\"},\"generator\":1,\"options\":{\"required\":true},\"reader\":1}','---','2013-09-07 22:32:45','2014-09-03 10:27:20'), (35,32,30,'question','{\"name\":\"question\",\"labels\":{\"en\":\"Question\",\"it\":\"Question\"},\"generator\":2,\"options\":{\"required\":true,\"cols\":\"60\",\"rows\":\"6\"},\"reader\":1}','---','2013-09-08 11:24:14','2014-09-03 10:27:10'), (36,32,20,'e-mail address','{\"name\":\"e-mail address\",\"labels\":{\"en\":\"Email Address\",\"it\":\"Email Address\"},\"generator\":1,\"options\":{\"required\":true,\"email\":true},\"reader\":2}','---','2013-09-08 15:59:32','2014-09-03 10:26:57'), (37,2,20,'A File','My PDF - 23 mei 2013','pdf','2013-09-08 16:04:49','2014-09-03 10:28:39'), (40,1,5,'Photos','','xxx','2013-09-09 15:41:08','2014-09-03 10:24:24'), (41,40,5,'Photo1','Screen Shot 2013-09-09 at 15.40.35','jpg','2013-09-09 15:41:18','2014-09-03 10:24:39'), (42,40,5,'Photo2','Screen Shot 2013-09-09 at 15.42.56','JPG','2013-09-09 15:43:48','2014-09-03 10:24:48'), (43,21,10,'Image1','image','jpg','2013-09-09 16:01:56','2014-09-03 10:25:04'), (44,2,10,'Official Documents','','xxx','2013-09-09 16:03:05','2014-09-03 10:25:29'), (45,44,5,'Founded','Founded on april 1rst 1984','pdf','2013-09-09 16:03:16','2014-09-03 10:29:45'), (49,21,20,'Image2','ourimage','jpg','2013-09-30 20:23:34','2014-09-03 10:25:08'), (50,21,30,'Image3','diversity','jpg','2013-09-30 20:26:34','2014-09-03 10:25:12'); UNLOCK TABLES; DROP TABLE IF EXISTS `content`; CREATE TABLE `content` ( `id` int(11) NOT NULL AUTO_INCREMENT, `item` int(11) NOT NULL DEFAULT '0', `language` varchar(2) NOT NULL DEFAULT 'nl', `sortorder` int(11) DEFAULT '0', `intro` char(1) NOT NULL DEFAULT 'N', `kind` char(1) NOT NULL DEFAULT 'T', `atom` int(11) DEFAULT '0', `name` varchar(32) NOT NULL DEFAULT '', `data` text NOT NULL, PRIMARY KEY (`id`), KEY `item` (`item`,`language`) ) AUTO_INCREMENT=200 DEFAULT CHARSET=utf8; LOCK TABLES `content` WRITE; INSERT INTO `content` VALUES (1,97,'nl',10,'N','T',0,'','

    Cody draagt zorg voor uw privacy. Lees deze Privacyverklaring om meer te weten te komen over de manier waarop persoonsgegevens worden ingezameld en verwerkt op deze website. In dit geval handelt Cody Howest daarbij steeds in overeenstemming met de bepalingen van de Belgische privacywet (Wet van 8 december 1992 tot bescherming van de persoonlijke levenssfeer ten opzichte van de verwerking van persoonsgegevens). De persoonlijke gegevens beperken zich enkel tot uw e-mailadres.

    \n

    Verantwoordelijke

    \n

    De verantwoordelijke voor de verwerking is Cody Howest; Rijselstraat 5, 8000 Brugge.

    \n

    Kennisname

    \n

    U kan van deze persoonsgegevens kennis nemen door een aanvraag te richten aan Cody Howest(brief, fax of e-mail) en ze, indien nodig, doen verbeteren of verwijderen. Indien u niet gecontacteerd wenst te worden in het kader van email marketing, zullen uw gegevens op uw verzoek kosteloos uit de betrokken lijsten worden

    \n

    Cookies

    \n

    Wij gebruiken cookies om uw toekomstig bezoek aan onze site vlotter te laten verlopen. Een cookie is een klein stukje tekst dat op uw harde schijf wordt geplaatst. Cookies worden veel gebruikt om een hoger functionaliteit, en dus betere dienst, aan de bezoekers te kunnen aanbieden. [U kan het gebruik van cookies uitschakelen, al leidt dit er wel toe dat effecten opsommen die ten gevolge van het uitschakelen van cookies worden veroorzaakt.]

    \n

    Veiligheid

    \n

    Cody Howest verbindt zich ertoe om al de gepaste technische en organisatorische maatregelen te treffen om uw persoonsgegevens te beschermen tegen vernietiging, verlies, onbedoelde wijziging, beschadiging of openbaarmaking.

    \n

    Toestemming

    \n

    Door u akkoord te verklaren met deze voorwaarden en condities geeft u ook uw toestemming voor de verwerking van uw persoonsgegevens voor de doeleinden zoals hierboven beschreven.

    '), (2,98,'nl',10,'N','T',0,'','

    Door gebruik te maken van deze website verklaart u zich akkoord met onderstaande voorwaarden en condities.

    \n

    1. Website

    \n

    De eigenaar van deze website is 
    Cody Howest,
    Rijselstraat 5
    8000, Brugge, 
    België
    Tel: 32(0)50 xx, 
    E-mail: info@howest.be 
    ON: xx

    \n

    Als u niet akkoord gaat met onderstaande voorwaarden wordt u verzocht de website te verlaten. Cody behoudt zich het recht voor deze voorwaarden periodisch aan te passen waarna de leden op de hoogte zullen worden gebracht van deze wijzigingen. Wanneer u na deze kennisgeving de website blijft gebruiken verklaart u zich akkoord met de doorgevoerde wijzigingen. Cody Howest  kan eventueel andere diensten aanbieden aan de gebruikers van deze site. In dat geval zullen de geldende voorwaarden apart worden medegedeeld.

    \n

    2. Toegankelijkheid

    \n

    Cody Howest  probeert zo goed als mogelijk de website 24 uur per dag toegankelijk te houden, nochtans kan het gebeuren dat de website ontoegankelijk is voor een korte periode omwille van onderhoudswerken, aanpassingen of technische redenen.

    \n

    3. Verantwoordelijkheid

    \n

    Cody Howest weerlegt elke verantwoordelijkheid met betrekking tot deze website en de aangeboden informatie. Cody Howest  verzekert niet dat de informatie op deze website correct, compleet of actueel is. Alle informatie, producten en diensten op deze website kunnen fouten bevatten. De gebruiker wordt verzocht hiermee rekening te houden.

    \n

    '), (7,1,'nl',10,'Y','S',0,'phone','0491-797204'), (9,1,'nl',20,'Y','S',0,'address','Rijselstraat 1'), (12,1,'nl',30,'N','S',0,'footer.first','info@mysite.com'), (13,1,'nl',40,'N','S',0,'footer.second','Algemene voorwaarden'), (14,1,'nl',50,'N','S',0,'footer.third',''), (15,1,'nl',60,'N','S',0,'Google Analytics code','UA-xxxxxxx-4'), (19,105,'nl',10,'N','T',0,'Text','

    Lorem Ipsum - 105

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (20,105,'nl',30,'N','T',0,'Text','

    Lorem Ipsum - 105

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (23,106,'nl',30,'N','M',32,'Form',''), (24,106,'nl',20,'N','T',0,'Text','

    Lorem Ipsum - 106

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (29,147,'nl',20,'N','I',0,'Image',''), (30,150,'nl',10,'N','T',0,'Text','

    Lorem Ipsum - 150

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (32,151,'nl',10,'N','T',0,'Text','

    Lorem Ipsum - 151

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (35,148,'nl',10,'Y','T',0,'Text','

    Lorem Ipsum - 148

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (36,148,'nl',30,'N','S',0,'String',''), (37,148,'nl',20,'Y','I',41,'Image',''), (38,105,'nl',20,'N','F',45,'File',''), (40,149,'nl',20,'Y','I',42,'Image',''), (41,149,'nl',10,'Y','T',0,'Text','

    Lorem Ipsum - 149

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (42,150,'nl',20,'N','F',37,'File',''), (43,150,'nl',30,'N','I',43,'Image',''), (45,147,'nl',10,'N','B',0,'Block','www.mysite.com/[page]'), (46,152,'nl',10,'N','B',0,'Block','www.mysite.com/[page]'), (48,153,'nl',10,'N','T',0,'Text','

    Lorem Ipsum - 153

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (49,106,'nl',10,'Y','T',0,'Text','

    Lorem Ipsum - 106

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (51,155,'nl',10,'N','T',0,'Text','

    Lorem Ipsum - 155

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (52,149,'nl',30,'N','S',0,'String',''), (53,148,'nl',40,'N','B',0,'Block','www.mysite.com/[page]'), (54,149,'nl',40,'N','B',0,'Block','www.mysite.com/[page]'), (55,103,'nl',20,'N','B',0,'Block','www.mysite.com/[page]'), (56,155,'nl',20,'N','B',0,'Block','https://www.facebook.com/mysite'), (57,103,'nl',10,'N','T',0,'Text','

    Lorem Ipsum - 103

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (58,156,'nl',10,'N','T',0,'Text','

    Lorem Ipsum - 156

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (59,157,'nl',10,'N','T',0,'Text','

    Lorem Ipsum - 157

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (60,97,'en',10,'N','T',0,'','

    Cody draagt zorg voor uw privacy. Lees deze Privacyverklaring om meer te weten te komen over de manier waarop persoonsgegevens worden ingezameld en verwerkt op deze website. In dit geval handelt Cody Howest daarbij steeds in overeenstemming met de bepalingen van de Belgische privacywet (Wet van 8 december 1992 tot bescherming van de persoonlijke levenssfeer ten opzichte van de verwerking van persoonsgegevens). De persoonlijke gegevens beperken zich enkel tot uw e-mailadres.

    \n

    Verantwoordelijke

    \n

    De verantwoordelijke voor de verwerking is Cody Howest; Rijselstraat 5, 8000 Brugge.

    \n

    Kennisname

    \n

    U kan van deze persoonsgegevens kennis nemen door een aanvraag te richten aan Cody Howest(brief, fax of e-mail) en ze, indien nodig, doen verbeteren of verwijderen. Indien u niet gecontacteerd wenst te worden in het kader van email marketing, zullen uw gegevens op uw verzoek kosteloos uit de betrokken lijsten worden

    \n

    Cookies

    \n

    Wij gebruiken cookies om uw toekomstig bezoek aan onze site vlotter te laten verlopen. Een cookie is een klein stukje tekst dat op uw harde schijf wordt geplaatst. Cookies worden veel gebruikt om een hoger functionaliteit, en dus betere dienst, aan de bezoekers te kunnen aanbieden. [U kan het gebruik van cookies uitschakelen, al leidt dit er wel toe dat effecten opsommen die ten gevolge van het uitschakelen van cookies worden veroorzaakt.]

    \n

    Veiligheid

    \n

    Cody Howest verbindt zich ertoe om al de gepaste technische en organisatorische maatregelen te treffen om uw persoonsgegevens te beschermen tegen vernietiging, verlies, onbedoelde wijziging, beschadiging of openbaarmaking.

    \n

    Toestemming

    \n

    Door u akkoord te verklaren met deze voorwaarden en condities geeft u ook uw toestemming voor de verwerking van uw persoonsgegevens voor de doeleinden zoals hierboven beschreven.

    '), (61,98,'en',10,'N','T',0,'','

    Door gebruik te maken van deze website verklaart u zich akkoord met onderstaande voorwaarden en condities.

    \n

    1. Website

    \n

    De eigenaar van deze website is 
    Cody Howest,
    Rijselstraat 5
    8000, Brugge, 
    België
    Tel: 32(0)50 xx, 
    E-mail: info@howest.be 
    ON: xx

    \n

    Als u niet akkoord gaat met onderstaande voorwaarden wordt u verzocht de website te verlaten. Cody behoudt zich het recht voor deze voorwaarden periodisch aan te passen waarna de leden op de hoogte zullen worden gebracht van deze wijzigingen. Wanneer u na deze kennisgeving de website blijft gebruiken verklaart u zich akkoord met de doorgevoerde wijzigingen. Cody Howest  kan eventueel andere diensten aanbieden aan de gebruikers van deze site. In dat geval zullen de geldende voorwaarden apart worden medegedeeld.

    \n

    2. Toegankelijkheid

    \n

    Cody Howest  probeert zo goed als mogelijk de website 24 uur per dag toegankelijk te houden, nochtans kan het gebeuren dat de website ontoegankelijk is voor een korte periode omwille van onderhoudswerken, aanpassingen of technische redenen.

    \n

    3. Verantwoordelijkheid

    \n

    Cody Howest weerlegt elke verantwoordelijkheid met betrekking tot deze website en de aangeboden informatie. Cody Howest  verzekert niet dat de informatie op deze website correct, compleet of actueel is. Alle informatie, producten en diensten op deze website kunnen fouten bevatten. De gebruiker wordt verzocht hiermee rekening te houden.

    \n

    '), (83,106,'en',20,'N','T',0,'Text','

    Lorem Ipsum - 106

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (88,147,'en',20,'N','I',0,'Image',''), (89,150,'en',10,'N','T',0,'Text','

    Lorem Ipsum - 150

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (108,106,'en',10,'Y','T',0,'Text','

    Lorem Ipsum - 106

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (74,1,'en',60,'N','S',0,'Google Analytics code','UA-xxxxxxx-4'), (79,105,'en',30,'N','T',0,'Text','

    Lorem Ipsum - 105

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (66,1,'en',10,'Y','S',0,'phone','0491-797204'), (68,1,'en',20,'Y','S',0,'address','Rijselstraat 1'), (71,1,'en',30,'N','S',0,'footer.first','info@mysite.com'), (72,1,'en',40,'N','S',0,'footer.second','Algemene voorwaarden'), (73,1,'en',50,'N','S',0,'footer.third',''), (78,105,'en',10,'N','T',0,'Text','

    Lorem Ipsum - 105

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (82,106,'en',30,'N','M',32,'Form',''), (91,151,'en',10,'N','T',0,'Text','

    Lorem Ipsum - 151

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (94,148,'en',10,'Y','T',0,'Text','

    Lorem Ipsum - 148

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (95,148,'en',30,'N','S',0,'String',''), (96,148,'en',20,'Y','I',41,'Image',''), (97,105,'en',20,'N','F',45,'File',''), (99,149,'en',20,'Y','I',42,'Image',''), (100,149,'en',10,'Y','T',0,'Text','

    Lorem Ipsum - 149

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (101,150,'en',20,'N','F',37,'File',''), (102,150,'en',30,'N','I',43,'Image',''), (104,147,'en',10,'N','B',0,'Block','www.mysite.com/[page]'), (105,152,'en',10,'N','B',0,'Block','www.mysite.com/[page]'), (107,153,'en',10,'N','T',0,'Text','

    Lorem Ipsum - 153

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (110,155,'en',10,'N','T',0,'Text','

    Lorem Ipsum - 155

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (111,149,'en',30,'N','S',0,'String',''), (112,148,'en',40,'N','B',0,'Block','www.mysite.com/[page]'), (113,149,'en',40,'N','B',0,'Block','www.mysite.com/[page]'), (114,103,'en',20,'N','B',0,'Block','www.mysite.com/[page]'), (115,155,'en',20,'N','B',0,'Block','https://www.facebook.com/mysite'), (116,103,'en',10,'N','T',0,'Text','

    Lorem Ipsum - 103

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (118,157,'en',10,'N','T',0,'Text','

    Lorem Ipsum - 157

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'), (117,156,'en',10,'N','T',0,'Text','

    Lorem Ipsum - 156

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.'); UNLOCK TABLES; DROP TABLE IF EXISTS `data`; CREATE TABLE `data` ( `id` int(11) NOT NULL AUTO_INCREMENT, `atom` int(11) NOT NULL DEFAULT '0', `data` text, `status` char(1) NOT NULL DEFAULT 'S', `created` datetime NOT NULL, `modified` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) AUTO_INCREMENT=200 DEFAULT CHARSET=utf8; LOCK TABLES `data` WRITE; INSERT INTO `data` VALUES (1,32,'{\"Titel\":\"\",\"Naam\":\"ikke\",\"e-mail adres\":\"steve.jobs@apple.com\",\"vraag\":\"Ik heb geen vragen!\"}','S','2013-09-10 19:09:39',NULL); UNLOCK TABLES; DROP TABLE IF EXISTS `domains`; CREATE TABLE `domains` ( `id` varchar(32) NOT NULL DEFAULT '', `name` varchar(32) DEFAULT '?' ) DEFAULT CHARSET=utf8; LOCK TABLES `domains` WRITE; INSERT INTO `domains` VALUES ('admin','Admin'), ('cms','CMS Users'), ('user','Users'); UNLOCK TABLES; DROP TABLE IF EXISTS `items`; CREATE TABLE `items` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(32) NOT NULL DEFAULT '', `parent` int(11) NOT NULL DEFAULT '0', `user` int(11) DEFAULT '0', `template` int(11) NOT NULL DEFAULT '1', `orderby` char(1) DEFAULT 'A', `sortorder` int(11) DEFAULT '0', `dated` date DEFAULT '0000-00-00', `validfrom` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `validto` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `showcontent` char(1) DEFAULT 'Y', `needslogin` char(1) DEFAULT 'N', `defaultrequest` varchar(32) DEFAULT '', `alloweddomains` varchar(128) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `parent_idx` (`parent`) ) AUTO_INCREMENT=200 DEFAULT CHARSET=utf8; LOCK TABLES `items` WRITE; INSERT INTO `items` VALUES (1,'Website',-1,1,100,'M',100,'2010-01-01','2010-01-01 00:00:00','2100-01-01 00:00:00','S',NULL,'list',''), (2,'Login',3,1,2,'A',99,'2010-01-01','2010-01-01 00:00:00','2100-01-01 00:00:00','Y','N','',''), (3,'Pages',-1,1,100,'M',0,'2010-01-01','2010-01-01 00:00:00','2100-01-01 00:00:00','Y','Y','',''), (4,'Footer',-1,1,100,'M',0,'2010-01-01','2010-01-01 00:00:00','2100-01-01 00:00:00','Y','Y','',''), (9,'Dashboard',-1,1,9,'M',0,'2010-01-01','2010-01-01 00:00:00','2100-01-01 00:00:00','Y','Y','',''), (10,'CMS',9,1,2,'M',10,'2010-01-01','2010-01-01 00:00:00','2100-01-01 00:00:00','S','Y','',''), (11,'Structure',10,1,11,'A',10,'2010-01-01','2010-01-01 00:00:00','2100-01-01 00:00:00','Y','Y','',''), (12,'Images',10,1,12,'A',20,'2010-01-01','2010-01-01 00:00:00','2100-01-01 00:00:00','Y','Y','',''), (13,'Files',10,1,13,'A',30,'2010-01-01','2010-01-01 00:00:00','2100-01-01 00:00:00','Y','Y','',''), (14,'Forms',10,1,14,'A',40,'2010-01-01','2010-01-01 00:00:00','2100-01-01 00:00:00','Y','Y','',''), (15,'Users',10,1,15,'A',50,'2010-01-01','2010-01-01 00:00:00','2100-01-01 00:00:00','Y','Y','list',''), (16,'Templates',10,1,16,'A',60,'2010-01-01','2010-01-01 00:00:00','2100-01-01 00:00:00','Y','Y','list',''), (20,'Management',9,1,2,'M',10,'2010-01-01','2010-01-01 00:00:00','2100-01-01 00:00:00','S','Y','',''), (21,'Forms',20,1,18,'A',10,'2010-01-01','2010-01-01 00:00:00','2100-01-01 00:00:00','Y','Y','',''), (22,'Comments',20,1,19,'A',10,'2010-01-01','2010-01-01 00:00:00','2100-01-01 00:00:00','Y','Y','',''), (97,'Privacy Verklaring',4,1,100,'A',0,'2010-01-01','2010-01-01 00:00:00','2100-01-01 00:00:00','Y','N','',''), (98,'Disclaimer',4,1,100,'A',0,'2010-01-01','2010-01-01 00:00:00','2100-01-01 00:00:00','Y','N','',''), (99,'Global',3,1,100,'A',0,'2010-01-01','2010-01-01 00:00:00','2100-01-01 00:00:00','Y','N','',''), (102,'Map1',1,1,100,'M',40,'2013-07-11','2013-07-11 00:00:00','2101-01-31 00:00:00','S',NULL,'list',''), (103,'Page1',1,1,100,'A',20,'2013-07-11','2013-07-11 00:00:00','2101-01-31 00:00:00','Y',NULL,'list',''), (153,'page3 in map',102,1,100,'M',30,'2013-09-09','2013-09-09 00:00:00','2101-01-31 00:00:00','Y',NULL,'list',''), (105,'page2 in map',102,1,100,'A',20,'2013-07-11','2013-07-11 00:00:00','2101-01-31 00:00:00','Y',NULL,'list',''), (106,'Contact Us',1,1,100,'A',70,'2013-09-07','2013-09-07 00:00:00','2101-01-31 00:00:00','Y',NULL,'list',''), (147,'Intros',1,1,103,'M',60,'2013-09-08','2013-09-08 00:00:00','2101-01-31 00:00:00','Y',NULL,'list',''), (148,'subpage 1',147,1,100,'M',10,'2013-09-08','2013-09-08 00:00:00','2101-01-31 00:00:00','Y',NULL,'list',''), (149,'subpage 2',147,1,100,'M',20,'2013-09-08','2013-09-08 00:00:00','2101-01-31 00:00:00','Y',NULL,'list',''), (150,'page1 in map',102,1,100,'A',10,'2013-09-08','2013-09-08 00:00:00','2101-01-31 00:00:00','Y',NULL,'list',''), (151,'Page2',1,1,100,'M',30,'2013-09-08','2013-09-08 00:00:00','2101-01-31 00:00:00','Y',NULL,'list',''), (152,'News',1,1,100,'D',10,'2013-09-08','2013-09-08 00:00:00','2101-01-31 00:00:00','S',NULL,'list',''), (154,'11 sept 13',152,1,100,'M',5,'2013-09-11','2013-09-11 00:00:00','2101-01-31 00:00:00','Y',NULL,'list',''), (155,'28 sept 13',152,1,100,'M',5,'2013-09-28','2013-09-30 00:00:00','2101-01-31 00:00:00','Y',NULL,'list',''), (156,'02 nov 13',152,1,100,'D',5,'2013-11-02','2013-11-02 00:00:00','2101-01-31 00:00:00','Y',NULL,'list',''), (157,'New item',152,1,100,'D',5,'2013-12-06','2013-12-06 00:00:00','2101-01-31 00:00:00','Y',NULL,'list',''); UNLOCK TABLES; DROP TABLE IF EXISTS `languages`; CREATE TABLE `languages` ( `id` varchar(4) NOT NULL DEFAULT '', `name` varchar(32) DEFAULT '', `sortorder` int(11) DEFAULT NULL, PRIMARY KEY (`id`) ) DEFAULT CHARSET=utf8; LOCK TABLES `languages` WRITE; INSERT INTO `languages` VALUES ('en','English',1), ('nl','Nederlands',2); UNLOCK TABLES; DROP TABLE IF EXISTS `levels`; CREATE TABLE `levels` ( `id` int(11) DEFAULT NULL, `name` varchar(32) DEFAULT NULL ) DEFAULT CHARSET=utf8; LOCK TABLES `levels` WRITE; INSERT INTO `levels` VALUES (2,'user'), (50,'admin'), (99,'super'); UNLOCK TABLES; DROP TABLE IF EXISTS `pages`; CREATE TABLE `pages` ( `item` int(11) NOT NULL DEFAULT '0', `language` varchar(2) NOT NULL DEFAULT '', `title` varchar(255) DEFAULT NULL, `link` varchar(255) DEFAULT NULL, `active` char(1) DEFAULT 'Y', `keywords` varchar(255) DEFAULT '', `description` varchar(255) DEFAULT '', `created` datetime DEFAULT '0000-00-00 00:00:00', `updated` datetime DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`item`,`language`) ) DEFAULT CHARSET=utf8; LOCK TABLES `pages` WRITE; INSERT INTO `pages` VALUES (1,'nl','Your site','welcome','Y','','','2010-01-01 00:00:00','2014-09-03 11:08:24'), (2,'nl','Login','login','Y','','','2010-01-01 00:00:00','2010-01-01 00:00:00'), (3,'nl','Pages','','Y','','','2010-01-01 00:00:00','2010-01-01 00:00:00'), (4,'nl','Footer','','Y','','','2010-01-01 00:00:00','2010-01-01 00:00:00'), (9,'nl','Dashboard','dashboard','Y','','','2010-01-01 00:00:00','2010-01-01 00:00:00'), (10,'nl','Website CMS','cms','Y','','','2010-01-01 00:00:00','2010-01-01 00:00:00'), (11,'nl','Structure','pages','Y','','','2010-01-01 00:00:00','2010-01-01 00:00:00'), (12,'nl','Images','images','Y','','','2010-01-01 00:00:00','2010-01-01 00:00:00'), (13,'nl','Files','files','Y','','','2010-01-01 00:00:00','2010-01-01 00:00:00'), (14,'nl','Forms','forms','Y','','','2010-01-01 00:00:00','2010-01-01 00:00:00'), (15,'nl','Users','users','Y','','','2010-01-01 00:00:00','2010-01-01 00:00:00'), (16,'nl','Templates','templates','Y','','','2010-01-01 00:00:00','2010-01-01 00:00:00'), (20,'nl','Management','admin','Y','','','2010-01-01 00:00:00','2010-01-01 00:00:00'), (21,'nl','Forms','data','Y','','','2010-01-01 00:00:00','2010-01-01 00:00:00'), (22,'nl','Comments','comments','Y','','','2010-01-01 00:00:00','2010-01-01 00:00:00'), (97,'nl','Privacy Verklaring','privacy','Y','','','2010-01-01 00:00:00','2013-03-19 09:30:30'), (98,'nl','Disclaimer','disclaimer','Y','','','2010-01-01 00:00:00','2012-08-20 17:09:50'), (99,'nl','Global','global','Y','','','2010-01-01 00:00:00','2012-08-15 22:02:59'), (152,'nl','News','nieuws','Y','','','2013-09-08 16:41:58','2013-09-30 19:52:12'), (151,'nl','Page2','pagina2','Y','','','2013-09-08 16:40:07','2013-12-08 17:16:01'), (150,'nl','page1 in map','','Y','','','2013-09-08 16:31:22','2013-09-09 16:04:31'), (149,'nl','subpage 2','','Y','','','2013-09-08 16:25:44','2013-10-21 17:01:56'), (148,'nl','subpage 1','','Y','','','2013-09-08 16:25:28','2013-10-21 17:01:46'), (147,'nl','Intros','','Y','','','2013-09-08 16:23:37','2013-09-09 16:15:59'), (102,'nl','Map1','officiele_documenten','Y','','','2013-07-11 16:00:40','2013-09-09 15:15:14'), (103,'nl','Page1','thepage','Y','','','2013-07-11 16:00:47','2013-11-02 18:21:46'), (153,'nl','page3 in map','voorwaarden','Y','','','2013-09-09 15:14:51','2013-09-30 20:18:53'), (105,'nl','page2 in map','Statuten','Y','','','2013-07-11 16:40:43','2013-09-09 16:03:57'), (106,'nl','Contact Us','contact','Y','','','2013-09-07 21:19:10','2013-09-10 19:10:21'), (154,'nl','11 sept 13','11sep2013','Y','','','2013-09-30 19:41:31','2013-10-01 22:43:01'), (155,'nl','28 sept 13','28sep2013','Y','','','2013-09-30 19:43:20','2013-10-20 23:30:55'), (156,'nl','02 nov 13','02nov2013','Y','','','2013-11-02 17:59:36','2013-11-02 18:34:12'), (157,'nl','11 dec 13','','Y','','','2013-12-06 22:04:00','2013-12-06 22:11:13'), (1,'en','Empty Site','welcome','Y','','','2010-01-01 00:00:00','2014-09-03 11:08:14'), (2,'en','Login','login','Y','','','2010-01-01 00:00:00','2010-01-01 00:00:00'), (3,'en','Pages','','Y','','','2010-01-01 00:00:00','2010-01-01 00:00:00'), (4,'en','Footer','','Y','','','2010-01-01 00:00:00','2010-01-01 00:00:00'), (9,'en','Dashboard','dashboard','Y','','','2010-01-01 00:00:00','2010-01-01 00:00:00'), (10,'en','Website CMS','cms','Y','','','2010-01-01 00:00:00','2010-01-01 00:00:00'), (11,'en','Structure','pages','Y','','','2010-01-01 00:00:00','2014-09-03 10:21:49'), (12,'en','Images','images','Y','','','2010-01-01 00:00:00','2014-09-03 10:21:53'), (13,'en','Files','files','Y','','','2010-01-01 00:00:00','2014-09-03 10:21:57'), (14,'en','Forms','forms','Y','','','2010-01-01 00:00:00','2014-09-03 10:22:01'), (15,'en','Users','users','Y','','','2010-01-01 00:00:00','2014-09-03 10:22:05'), (16,'en','Templates','templates','Y','','','2010-01-01 00:00:00','2014-09-03 10:22:10'), /* (17,'en','System','system','Y','','','2010-01-01 00:00:00','2014-09-03 10:22:16'), */ (20,'en','Management','admin','Y','','','2010-01-01 00:00:00','2014-09-03 10:22:35'), (21,'en','Forms','data','Y','','','2010-01-01 00:00:00','2014-09-03 10:22:39'), (22,'en','Comments','comments','Y','','','2010-01-01 00:00:00','2014-09-03 10:22:45'), (97,'en','Privacy Declaration','privacy','Y','','','2010-01-01 00:00:00','2013-03-19 09:30:30'), (98,'en','Disclaimer','disclaimer','Y','','','2010-01-01 00:00:00','2012-08-20 17:09:50'), (99,'en','Global','global','Y','','','2010-01-01 00:00:00','2012-08-15 22:02:59'), (152,'en','News','news','Y','','','2013-09-08 16:41:58','2014-09-03 10:22:50'), (151,'en','Page2','page2','Y','','','2013-09-08 16:40:07','2014-09-03 10:23:07'), (150,'en','page1 in map','','Y','','','2013-09-08 16:31:22','2014-09-03 10:24:07'), (149,'en','subpage 2','','Y','','','2013-09-08 16:25:44','2014-09-03 10:23:37'), (148,'en','subpage 1','','Y','','','2013-09-08 16:25:28','2014-09-03 10:23:33'), (147,'en','Intros','','Y','','','2013-09-08 16:23:37','2014-09-03 10:23:18'), (102,'en','Map1','officiele_documenten','Y','','','2013-07-11 16:00:40','2014-09-03 10:23:12'), (103,'en','Page1','page1','Y','','','2013-07-11 16:00:47','2014-09-03 10:23:01'), (153,'en','page3 in map','conditions','Y','','','2013-09-09 15:14:51','2014-09-03 10:24:01'), (105,'en','page2 in map','stats','Y','','','2013-07-11 16:40:43','2014-09-03 10:23:54'), (106,'en','Contact Us','contact','Y','','','2013-09-07 21:19:10','2014-09-03 10:23:22'), (154,'en','11 sept 13','11sep2013','Y','','','2013-09-30 19:41:31','2013-10-01 22:43:01'), (155,'en','28 sept 13','28sep2013','Y','','','2013-09-30 19:43:20','2013-10-20 23:30:55'), (156,'en','02 nov 13','02nov2013','Y','','','2013-11-02 17:59:36','2013-11-02 18:34:12'), (157,'en','11 dec 13','','Y','','','2013-12-06 22:04:00','2013-12-06 22:11:13'); UNLOCK TABLES; DROP TABLE IF EXISTS `templates`; CREATE TABLE `templates` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(64) DEFAULT '', `description` varchar(127) DEFAULT '', `controller` varchar(64) DEFAULT '', `fn` varchar(128) DEFAULT '', `allowedtemplates` varchar(255) DEFAULT '', `maxnumber` int(11) DEFAULT '99999', `system` char(1) DEFAULT 'N', `defaultchild` int(11) DEFAULT '0', PRIMARY KEY (`id`) ) AUTO_INCREMENT=200 DEFAULT CHARSET=utf8; LOCK TABLES `templates` WRITE; INSERT INTO `templates` VALUES (2,'Login','','LoginController','-/login.ejs','',0,'Y',0), (9,'Dashboard','','DashboardController','-/cms/dashboard.ejs','',0,'Y',0), (11,'CMS-Page','','PageController','-/cms/pages.ejs','',0,'Y',0), (12,'CMS-Images','','ImageController','-/cms/images.ejs','',0,'Y',0), (13,'CMS-Files','','FileController','-/cms/files.ejs','',0,'Y',0), (14,'CMS-Forms','','FormController','-/cms/forms.ejs','',0,'Y',0), (15,'CMS-Users','','UserController','-/cms/users.ejs','',0,'Y',0), (16,'CMS-Templates','','TemplateController','-/cms/templates.ejs','',0,'Y',0), (18,'Admin-Forms','Incoming data from forms','FormDataController','-/cms/forms-list.ejs','',0,'Y',0), (19,'Admin-Comments','View approve, edit or trash comments','Controller','-/cms/comments.ejs','',0,'Y',0), (100,'Content','','Controller','index.ejs','',999,'N',100), (103,'With intros','Displays also all intro content of the pages below','Controller','intros.ejs','',0,'N',0), (106,'CMS-Styles','','StylesController','-/cms/styles.ejs','',0,'Y',0); UNLOCK TABLES; DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(128) NOT NULL DEFAULT '-', `name` varchar(128) NOT NULL DEFAULT '-', `password` char(64) DEFAULT NULL, `domain` varchar(32) NOT NULL DEFAULT '', `level` int(11) NOT NULL DEFAULT '0', `badlogins` int(11) NOT NULL DEFAULT '0', `maxbadlogins` int(11) NOT NULL DEFAULT '999', `active` char(1) NOT NULL DEFAULT 'Y', `email` varchar(128) NOT NULL DEFAULT '', `note` varchar(255) NOT NULL DEFAULT '', `nomail` char(1) NOT NULL DEFAULT 'N', `sortorder` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `username_idx` (`username`,`active`) ) AUTO_INCREMENT=200 DEFAULT CHARSET=utf8; LOCK TABLES `users` WRITE; INSERT INTO `users` VALUES (1,'super','rWorks Super',password2("empty"),'rWorks',99,0,99,'Y','info@mysite.com','','N',0), (2,'admin','rWorks Admin',password2("empty"),'rWorks',50,0,99,'Y','info@mysite.com','','N',0), (3,'test','rWorks Test',password2("empty"),'rWorks',2,0,99,'Y','info@mysite.com','','N',0), (11,'user','Mr. Owner User',password2("empty"),'users', 50,0,99,'Y','info@mysite.com','','N',10); UNLOCK TABLES; ================================================ FILE: doc/empty/index.js ================================================ /** * Created by johan on 25/03/15. */ // // Johan Coppieters - jan 2013 - Cody CMS // // empty website for Cody CMS // // var cody = require("cody"); var express = cody.express; var fs = cody.fs; var path = require("path"); cody.server = express(); var bodyParser = cody.bodyParser; var expressSession = cody.expressSession; var multer = cody.multer; var sitename = __filename.split(path.sep).pop().split(".")[0]; // add i18n var i18n = cody.i18n; i18n.configure({ locales:['zh-cn', 'en'], directory: __dirname + '/locales', defaultLocale: 'en' }); cody.server.use(i18n.init); // use the new 4.x middleware cody.server.use(bodyParser.json()); cody.server.use(expressSession({secret: 'a secret', cookie: { maxAge: 60*60*1000 }})); cody.server.use(bodyParser.urlencoded({ extended: true })); cody.server.use(multer().any); // startup a routing for all static content of cody (images, javascript, css) cody.server.get("/cody/static/*", function (req, res) { var fileserver = new cody.Static(req, res, ""); fileserver.serve(); }); // setup the config. // Order of importance: // 1. config.json >> 2. -c command line config >> 3. environment values // 1a. load default config cody.config = require(path.join(__dirname, sitename, "config.json")); cody.config.controllers = cody.config.controllers || []; // 1b. require controllers var cpath = path.join(__dirname, sitename, "controllers"); var ctrls = fs.readdirSync(cpath); ctrls.forEach(function (ctrl) { var cname = ctrl.substr(0, ctrl.indexOf(".")); console.log("Loaded controller: " + cname); cody.config.controllers[cname] = require(path.join(cpath, cname)); }); // 2. if -c exists, overwrite customized config values if(process.argv.indexOf("-c") != -1){ var extraConfigFilePath = process.argv[process.argv.indexOf("-c") + 1]; var obj = JSON.parse(fs.readFileSync(extraConfigFilePath, 'utf8')); Object.keys(cody.config).forEach(function (name) { cody.config[name] = (typeof obj[name] === "undefined") ? cody.config[name] : obj[name]; }); } // 3. overwrite environment variable values Object.keys(cody.config).forEach(function (name) { cody.config[name] = (typeof process.env[name] === "undefined") ? cody.config[name] : process.env[name]; }); // start the web app with all collected params cody.startWebApp(cody.server, cody.config, function() { console.log("Loaded " + sitename + " web app with config:"); console.log(cody.config); var portNr = cody.config.port || 3001; cody.server.listen(portNr); console.log("Listening on port " + portNr); if (typeof cody.config.https != "undefined") { const options = { key: fs.readFileSync('ws.key').toString(), cert: fs.readFileSync('ws.crt').toString() }; var httpsServer = require('https'); httpsServer.createServer(options, cody.server).listen(cody.config.https, function () { console.log("Listening https on port: " + cody.config.https); }); } }); if (!process.stderr.isTTY) { process.on('uncaughtException', function (err) { console.error('Uncaught exception : ' + err.stack); }); } ================================================ FILE: doc/empty/locales/en.json ================================================ { } ================================================ FILE: doc/empty/locales/zh-CN.json ================================================ { "__v": "简体中文语言包", "Username": "用户名", "Password": "密码", "Log on": "登陆", "Login": "登陆", "Logout": "退出", "Dashboard": "控制面板", "Help": "登陆", "Account": "个人中心", "Sign out": "退出", "Before you can access this requested page you first need to login.": "该页面需要登陆才能访问", "Wrong username of password, please try again.": "用户名或密码错误,请重试。", "Your username is blocked, please take contact with your site builder.": "你的用户名被锁定,请联系站长", "OK": "确认", "Cancel": "取消", "Add": "添加", "Rename": "重命名", "Delete": "删除", "Edit": "编辑", "login-successful": "登陆成功", "Add a web page": "添加新页面", "Show": "显示方式", "Own content": "独立页面", "Content of first subitem": "列表页", "Add new page": "添加新页面", "page": "页面", "Page Title": "页面标题", "View Page": "查看页面", "View": "查看", "Content": "内容", "SEO": "SEO", "Options": "选项", "Main": "主要", "Keywords": "关键词", "Description": "描述", "Active": "活动", "Date": "日期", "Valid": "验证", "to": "to", "Save": "保存", "Intro": "介绍", "Add Content": "添加内容", "Link": "链接", "Needs login": "需要登陆", "Valid from": "验证表单", "Order sublevels": "排序", "Allowed Domains": "权限范围", "add a group": "添加组", "Last Modified": "最后修改", "Add Rich text": "添加富文本", "Add plain": "添加简述", "Add image": "添加图片", "Add file": "添加文件", "Add user form": "添加用户表单", "Add facebook like": "添加 facebook like", "Add facebook share": "添加 facebook share", "Add page params": "添加页面变量", "New content block": "添加内容元素", "Move": "移动", "Add Folder": "添加文件夹", "Add Image": "添加图片", "Images": "图片", "Layout": "布局", "Website": "网站", "Pages": "页面", "Name": "名称", "Info": "信息", "Note": "备注", "Extension": "拓展名", "Image": "图片文件", "Preview": "预览", "Created": "创建时间", "The item has been deleted.": "元素已经被删除", "Add File": "添加文件", "Extention": "拓展名", "Current": "当前文件", "Change": "修改", "Add Form": "添加表单", "Add Item": "添加元素", "Warn email": "警告邮件", "Button": "按钮", "Type": "类型", "Default value": "默认值", "Min / Length": "最小 / 长度", "Max / Lines": "最大 / 行数", "Required": "是否必须", "Validation": "验证", "No": "否", "Email": "邮件", "Phone": "电话", "Whole number": "仅限整数", "Allow decimals": "允许小数", "Label": "标签", "Choices": "选择", "Naam": "Naam", "Domain": "访问区域", "Level": "等级", "Group": "用户组", "Choose an existing group or type a new one": "选择一个存在的组或者创建一个", "Bad logins": "错误登陆次数", "Max allowed": "最大次数", "Allows Mail": "启用邮件", "Leave empty if you don't want to change your password.": "不想修改密码可以留空", "New": "新建", "System": "系统", "Controller": "控制器", "Render": "渲染路径", "Yes": "是", "Render file": "渲染文件", "Default child": "默认子文件", "No children": "无子文件", "Allowed children": "允许子文件", "Duplicate": "重复" } ================================================ FILE: doc/empty/static/css/front.css ================================================ /* ============================================================================= HTML5 Boilerplate CSS: h5bp.com/css ========================================================================== */ article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; } audio, canvas, video { display: inline-block; *display: inline; *zoom: 1; } audio:not([controls]) { display: none; } [hidden] { display: none; } html { font-size: 100%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; } html, button, input, select, textarea { font-family: sans-serif; color: #222; } body { margin: 0; font-size: 18px; line-height: 1.4; color: #7e7979; font-family: UbuntuLight, Helvetica, Arial, sans-serif; text-shadow: 0 1px 0 #fff; } a { color: #86ca79; } /* a:visited { color: #86ca79; } */ a:hover { color: #7e7979; } a:focus { outline: thin dotted; } a:hover, a:active { outline: 0; } abbr[title] { border-bottom: 1px dotted; } b, strong { font-weight: normal; } em { font-style: normal; color: #86ca79; } blockquote { margin: 1em 40px; } dfn { font-style: italic; } hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; } ins { background: #ff9; color: #000; text-decoration: none; } mark { background: #ff0; color: #000; font-style: italic; font-weight: bold; } pre, code, kbd, samp { font-family: monospace, serif; _font-family: 'courier new', monospace; font-size: 1em; } pre { white-space: pre; white-space: pre-wrap; word-wrap: break-word; } q { quotes: none; } q:before, q:after { content: ""; content: none; } small { font-size: 85%; } sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } sup { top: -0.5em; } sub { bottom: -0.25em; } ul, ol { margin: 1em 0; padding: 0; } dd { margin: 0 0 0 40px; } nav ul, nav ol { list-style: none; list-style-image: none; margin: 0; padding: 0; } img { border: 0; -ms-interpolation-mode: bicubic; vertical-align: middle; } svg:not(:root) { overflow: hidden; } figure { margin: 0; } form { margin: 0; } fieldset { border: 0; margin: 0; padding: 0; } label { cursor: pointer; } legend { border: 0; *margin-left: -7px; padding: 0; white-space: normal; } button, input, select, textarea { font-size: 100%; margin: 0; vertical-align: baseline; *vertical-align: middle; } button, input { line-height: normal; } button, input[type="button"], input[type="reset"], input[type="submit"] { cursor: pointer; -webkit-appearance: button; *overflow: visible; } button[disabled], input[disabled] { cursor: default; } input[type="checkbox"], input[type="radio"] { box-sizing: border-box; padding: 0; *width: 13px; *height: 13px; } input[type="search"] { -webkit-appearance: textfield; -moz-box-sizing: content-box; -webkit-box-sizing: content-box; box-sizing: content-box; } input[type="search"]::-webkit-search-decoration, input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; } button::-moz-focus-inner, input::-moz-focus-inner { border: 0; padding: 0; } textarea { overflow: auto; vertical-align: top; resize: vertical; } input:valid, textarea:valid { } input:invalid, textarea:invalid { background-color: #f0dddd; } table { border-collapse: collapse; border-spacing: 0; } td { vertical-align: top; } .chromeframe { margin: 0.2em 0; background: #ccc; color: black; padding: 0.2em 0; } /* ===== Primary Styles ======================================================== Author: Johan Coppieters Design: Jelle Cayman ========================================================================== */ p.notification { clear: both; margin: 5px 0 5px 0; padding: 10px 10px 10px 36px; border: 1px solid; background-position: 10px 11px !important; background-repeat: no-repeat !important; } p.success { border-color: #9adf8f; background: #d5ffce url(../images/icon_tick_circle.png); color: #556652; } p.error { border-color: #df8f8f; background: #ffcece url(../images/icon_cross_circle.png); color: #665252; } nav a { text-decoration: none; padding-bottom: 3px; } nav a:hover, nav a.active { border-bottom: solid 2px darkgrey} /* ===== header ============================================================= */ header { margin: 15px; padding-bottom: 15px; border-bottom: solid 1px lightgrey; } header > div, header > nav { display: inline-block; vertical-align: bottom } header > div { font-size: 12px; padding-left: 30px; margin-bottom: 3px } header > nav { padding: 40px 20px 0 20px } header > nav li { display: inline-block; padding: 0 10px 0 10px; border-left: solid 1px lightgrey } header > nav li:first-child { border-left: none } header > #lanNav { float: right; padding: 20px 4px 0 0 } header > #lanNav a { color: red; font-size: 12px } header > #lanNav span.id { display: inline; text-transform: uppercase } header > #lanNav span.name { display: none } header > #contactData { float: right;clear: both; margin-top: 20px;margin-right: 15px; } /* ===== content ============================================================= */ .content { margin: 15px; min-height: 350px } div.noNav { border-left: none; min-width: 790px; width: inherit } .main { display: inline-block; width: 790px; vertical-align: top; margin: 0; border-left: solid 1px lightgrey; padding-left: 10px; } .main h1 { margin-top: 5px } @media (max-width: 810px) { div.noNav { border-left: none; min-width: inherit; width: inherit } } .main form {margin: 0px; border: solid 1px #c0c0c0; padding: 10px; } .main form #action_buttons { border-top: solid 1px #c0c0c0; padding: 10px 0 0 213px; } .main form fieldset { border: none; padding: 0; margin: 0 } .main form fieldset > div { margin: 10px 0 15px 0 } .main form fieldset > div > label { display: inline-block; width:200px; text-align: right; padding: 0 13px 0 0; font-weight: bold } .main form fieldset > div > input[type=text], .main form fieldset > div > textarea { width: 400px } .main form fieldset > div > input[type=text].number { width: 70px } .main form fieldset > div > div { display: inline-block; } .main form fieldset > div > div > label { display: inline-block; margin: 0 20px 0 7px } .main form fieldset > div > div > input { vertical-align: baseline; } .main form fieldset > div > label.error { text-align: left; padding: 0 0 0 213px; color: red; display: block; width: inherit } .main form fieldset > div > input.error, .main form fieldset > div > textarea.error { border: 1px solid red } @media (max-width: 685px) { .main form fieldset > div > label { text-align: left; display: block } .main form #action_buttons { border-top: solid 1px #c0c0c0; padding: 10px 0 0 0; } } /* ===== left menu =========================================================== */ div.content nav { display: inline-block; width: 180px; vertical-align: top; margin-top: 10px } div.content nav li { margin-bottom: 10px } /* ===== footer ============================================================= */ footer { padding-top: 10px; border-top: solid 1px lightgrey; margin: 15px } footer span { display: block; font-size: 12px } footer .first { float: left; margin-left: 0px } footer .third { margin: 0px auto; width: 50%; text-align: center } footer .second { float: right; margin-right: 0px } /* ============================================================================= Non-Semantic Helper Classes ========================================================================== */ .ir { display: block; border: 0; text-indent: -999em; overflow: hidden; background-color: transparent; background-repeat: no-repeat; text-align: left; direction: ltr; *line-height: 0; } .ir br { display: none; } .hidden { display: none !important; visibility: hidden; } .visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; } .visuallyhidden.focusable:active, .visuallyhidden.focusable:focus { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; } .invisible { visibility: hidden; } .clearfix:before, .clearfix:after { content: ""; display: table; } .clearfix:after { clear: both; } .clearfix { *zoom: 1; } /* ============================================================================= Print Styles ========================================================================== */ @media print { * { background: transparent !important; color: black !important; box-shadow:none !important; text-shadow: none !important; filter:none !important; -ms-filter: none !important; } /* Black prints faster: h5bp.com/s */ a, a:visited { text-decoration: underline; } a[href]:after { content: " (" attr(href) ")"; } abbr[title]:after { content: " (" attr(title) ")"; } .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; } /* Don't show links for images, or javascript/internal links */ pre, blockquote { border: 1px solid #999; page-break-inside: avoid; } thead { display: table-header-group; } /* h5bp.com/t */ tr, img { page-break-inside: avoid; } img { max-width: 100% !important; } @page { margin: 0.5cm; } p, h2, h3 { orphans: 3; widows: 3; } h2, h3 { page-break-after: avoid; } } ================================================ FILE: doc/empty/static/js/script.js ================================================ $(document).ready(function() { }); ================================================ FILE: doc/empty/views/content.ejs ================================================ <%- include("header.ejs") %>
    <%- include("menu-top.ejs") %>
    <% var theChildren = []; %> <%- include("menu-left.ejs") %>

    <%= page.title %>

    <%- render({intro: 'N'}) %>
    <%- include("footer.ejs") %>
    ================================================ FILE: doc/empty/views/footer.ejs ================================================
    <% var first = page.root.getContent('footer.first'); %> <% var second = page.root.getContent('footer.second'); %> <% var third = page.root.getContent('footer.third'); %> <% if (first && (typeof first !== "undefined")) { %> <%- first.render() %> <% } %> <% if (second && (typeof second !== "undefined")) { %> <%- second.render() %> <% } %> <% if (third && (typeof third !== "undefined")) { %> <%- third.render() %> <% } %>
    ================================================ FILE: doc/empty/views/header.ejs ================================================ <%=page.title%> | <%= (page.parent != page.root) ? (page.parent.title + ' | ') : '' %> <%= page.root.title %> <% var analytics = page.root.getContent("Google Analytics code"); %> <% if (typeof analytics !== "undefined") { %> <% } %> ================================================ FILE: doc/empty/views/index.ejs ================================================ <%- include("header.ejs") %>
    <%- include("menu-top.ejs") %>
    <% var theChildren = []; %> <%- include("menu-left.ejs") %>

    <%= page.title %>

    <%- render() %>
    <%- include("footer.ejs") %>
    ================================================ FILE: doc/empty/views/intros.ejs ================================================ <%- include("header.ejs") %> <%- include("menu-top %>
    <% var theChildren = (page.item.parentId == 1) ? page.children : page.parent.children; %>

    <%= page.title %>

    <%- render() %>
    <% for (var icp in page.children) { var CP = page.children[icp]; %> <% } %>
    <%- include("footer.ejs") %> ================================================ FILE: doc/empty/views/menu-left.ejs ================================================ <% var theChildren = (page.item.parentId == 1) ? page.children : page.parent.children; %> <% if (theChildren.length > 0) { %> <% } %> ================================================ FILE: doc/empty/views/menu-top.ejs ================================================
    <% var pp = page.root.getContent('phone'); %> <% var aa = page.root.getContent('address'); %> <% if (pp || aa) { %>
    <% if (typeof pp !== "undefined") { %>
    <%= pp.render() %>
    <% } %> <% if (typeof aa !== "undefined") { %>
    <%= aa.render() %>
    <% } %>
    <% } %>
    ================================================ FILE: doc/empty/views/page.ejs ================================================ <%- include("header.ejs") %>
    <%- include("menu-top.ejs") %>
    <% var theChildren = []; %> <%- include("menu-left.ejs") %>

    <%= page.title %>

    <%- render() %>
    <%- include("footer.ejs") %>
    ================================================ FILE: doc/hosting_sqlbased/codymaster.sql ================================================ set names utf8; /*!40101 SET NAMES utf8 */; CREATE DATABASE cody DEFAULT CHARSET=utf8; USE cody; grant all privileges on cody.* to 'cody'@'localhost'; grant all privileges on cody.* to 'cody'@'%'; SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; -- -- Databank: `cody` -- -- -------------------------------------------------------- -- -- Tabelstructuur voor tabel `websites` -- CREATE TABLE IF NOT EXISTS `websites` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(100) NOT NULL, `version` char(100) NOT NULL, `defaultlanguage` varchar(2) NOT NULL, `dbuser` varchar(100) NOT NULL, `dbpassword` varchar(100) NOT NULL, `dbhost` varchar(100) NOT NULL, `datapath` varchar(200) NOT NULL, `db` varchar(100) NOT NULL, `active` char(1) NOT NULL, `ownerconfirmed` char(1) NOT NULL, `hostname` varchar(100) NOT NULL PRIMARY KEY (`id`) ) DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ; create unique index nameIndex on cody.websites(name); ================================================ FILE: doc/hosting_sqlbased/index.js ================================================ // // Johan Coppieters - jan 2013 - jWorks // // var express = require('express'); var fs = require('fs'); var mysql = require("mysql2"); var ejs = require('ejs'); var cody = require('./cody'); cody.server = express(); // startup a routing for all static content of cody (images, javascript, css) cody.server.get("/cody/static/*", function (req, res) { var fileserver = new cody.Static(req, res, ""); fileserver.serve(); }); // startup all the web applications cody.bootstrap = function () { // startup all the web applications var connection = mysql.createConnection({ host: "localhost", user: "cody", password: "ydoc", database: "cody" }); connection.connect(); connection.query("SELECT * FROM websites WHERE active='Y' AND ownerconfirmed='Y' ORDER BY id", function(err, rows, fields) { if(err) throw err; cody.Application.each(rows, function(next){ var row = this; cody.startWebApp(cody.server, { "name": row.name, "mailFrom": "info@cody-cms.org", "smtp": "smtpmailer.howest.be", "version": row.version, "defaultlanguage": row.defaultlanguage, "hostnames" : row.hostname, "dbuser": row.dbuser, "dbpassword": row.dbpassword, "dbhost": row.dbhost, "datapath": row.datapath, "db": row.db, "controllers": require("./" + row.name + "/controllers/") }, next); }, function() { console.log("Loaded all apps...."); connection.end(); cody.server.listen(3000); console.log('Listening on port ' + cody.server.get('port')); }); }); if (!process.stderr.isTTY) { process.on('uncaughtException', function (err) { console.error('Uncaught exception : ' + err.stack); }); } }; cody.bootstrap(); ================================================ FILE: doc/todo.txt ================================================ - model/User.js aanpassen om Model.js te gebruiken. tevens ook nog bug in usercontroller na "save", iets met redirect mis - Diverse models die aangemaakt worden in een Controller (bvb. PhotoController) naar een apart bestand verhuizen (bvb: models/Photo.js) - daily backups !! [ done -> dropbox voor .sql en data.tgz / github voor code ] - in loginController std functionaliteit om nieuw password op te sturen - github [ done ] - readme - contrib - licence - stop/start/restart Cody moet degelijk script worden om in /etc/init.d te zetten voorbeelden genoeg aldaar te vinden. -> er staat er nu eentje op de linux machine van mvm, maar die doet het precies niet ?? - redirect / to /nl or /en [ done ] - delete content from page fails ... ?? [ fixed on 23/06/2013, a > where it should have been a >= ] - new folder in "Images" -> "Choose file" ?? [ fixed 21/06/2013 ] - sending mails from javascript [ done ] - "Images" (met id = 1) was weg bij Stoerhuus ?? Delete van toplevel? [done 2013/11/02 - hasAtomChildren had fout in Application ] - templates - add "note" om bij "add content" bij elke template een beetje uitleg te geven over de template ook in add-content kiezer deze tekst tonen. [ done 24/06/2013 ] - implement "allowedTemplates" (page controller + template editing) and MaxNumber - duplicate template [ done 22/06 ] - lijst van automatisch toegevoegde benoemde content items (negative atoms met naam) [ done 22/06/2013 ] opgelet: PageController nakijken dat naam overgenomen wordt van gepredefinieerde atoms. [ done 22/06/2013 ] - gekoppelde form -> data aan pagina hangen / kunnen afbeelden - passwords niet meer als plain text stockeren [ done ] - maken dat ook /nl als /nl/ aanvaard wordt [ done ] evenals / [ done ] - unit testing - bvb: controller.getParam, Id, Num, Int: allerlei waarden in params steken en er terug uithalen Hosting on cody-web: - de server parameters (uit cody.websites) editeerbaar maken in de backoffice wel de naam read-only houden. - een uitbreiding te maken op de website van cody inclusief registratie e.d. - daarna: uploaden van css en logo in backoffice. ook header en footer image ? - virtual host selectie -> app [ done ] Yanic: [ done door Johan: 15/09/2013 ] - definitie van meta data object, inclusief editing features (lengte, radio/checkbox, popup, etc) controller voor in back office + template + bewaren in SQL met zeker id + name. - gegeven de id van zo'n meta object een fieldset genereren (geen form) deze kan dan in een webpagina getoond worden of gebruikt worden om meta data van een pagina te editeren. - bij het krijgen van een meta data id + (bestaande - or lege) data + param's object -> json string of object teruggeven dat kan bewaard worden of fouten teruggeven indien data niet voldoet aan de meta definitie. - Projects todo - Grader / Grades (Howest) - Dr / Agenda Site omzetten van Java -> Cody - BOK [ ±done: Dieter, nog probleem met items uit vorige maand die 1 dag fout getoond worden ] - Verlanglijstje / mobile version -> Cody - Empty sites uitbreiden met templates van Jill ================================================ FILE: index.js ================================================ global.__base = __dirname + '/'; module.exports.Application = require("./apps/Application.js"); module.exports.Model = require("./models/Model.js"); module.exports.Atom = require("./models/Atom.js"); module.exports.Item = require("./models/Item.js"); module.exports.Page = require("./models/Page.js"); module.exports.Meta = require("./models/Meta.js"); module.exports.Content = require("./models/Content.js"); module.exports.Template = require("./models/Template.js"); module.exports.User = require("./models/User.js"); module.exports.Path = require("./models/Path.js"); module.exports.Context = require("./models/Context.js"); module.exports.Controller = require("./controllers/Controller.js"); module.exports.ContentController = module.exports.Controller; module.exports.LoginController = require("./controllers/LoginController.js"); module.exports.UserController = require("./controllers/UserController.js"); // module.exports.ContactController = require("./controllers/ContactController.js"); module.exports.DashboardController = require("./controllers/DashboardController.js"); module.exports.TreeController = require("./controllers/TreeController.js"); module.exports.PageController = require("./controllers/PageController.js"); module.exports.ImageController = require("./controllers/ImageController.js"); module.exports.FileController = require("./controllers/FileController.js"); module.exports.FormController = require("./controllers/FormController.js"); module.exports.StylesController = require("./controllers/StylesController.js"); module.exports.SystemController = require("./controllers/SystemController.js"); module.exports.TemplateController = require("./controllers/TemplateController.js"); module.exports.Static = require("./apps/Static.js"); module.exports.Dynamic = require("./apps/Dynamic.js"); module.exports.startWebApp = require("./startWebApp.js"); module.exports.makeWebApp = require("./makeWebApp.js"); // module.exports.unitTests = require("./tests/"); module.exports.express = require("express"); module.exports.mysql = require("mysql2"); module.exports.fs = require("fs"); module.exports.ejs = require("ejs"); module.exports.bodyParser = require("body-parser"); module.exports.expressSession = require("express-session"); module.exports.multer = require("multer"); module.exports.i18n = require("i18n"); ================================================ FILE: makeWebApp.js ================================================ console.log("loading " + module.id); var cody = require("cody"); var express = require("express"); var path = require("path"); var fs = require("fs"); /* usage: makeWebApp(pathname, sitedir, done); makeWebApp(pathname, sitedir, alternateConfigFile, done); // done = function(app) {} // app = {host: [names], app: express, http: integer, https: integer, certificate: pathto } // to test on localhost: app.app.listen(app.http); // for production see startServer.js */ module.exports = function (pathname, sitename, configfn, done) { // make configfn optional if ((done === undefined) && (typeof configfn === "function")) { done = configfn; configfn = undefined; } var siteServer = express(); // setup the config. // Order of importance: // 1. config.json >> 2. -c command line config >> 3. environment values >> 4. minimal requirements // 1a. load default config & and keep in cody object var config = require(path.join(pathname, sitename, configfn || "config.json")); cody.config = config; // 1b. require controllers config.controllers = config.controllers || []; var cpath = path.join(pathname, sitename, "controllers"); var ctrls = fs.readdirSync(cpath); ctrls.forEach(function (ctrl) { var cname = ctrl.substr(0, ctrl.indexOf(".")); console.log("Loaded controller: " + cname); config.controllers[cname] = require(path.join(cpath, cname)); }); // 2. if -c exists, overwrite customized config values if(process.argv.indexOf("-c") != -1){ var extraConfigFilePath = process.argv[process.argv.indexOf("-c") + 1]; var obj = JSON.parse(fs.readFileSync(extraConfigFilePath, 'utf8')); Object.keys(config).forEach(function (name) { config[name] = (typeof obj[name] === "undefined") ? config[name] : obj[name]; }); } // 3. overwrite environment variable values Object.keys(config).forEach(function (name) { config[name] = (typeof process.env[name] === "undefined") ? config[name] : process.env[name]; }); // 4. minimal requirements if (typeof config.name === "undefined") { console.log("startWebApp - missing name from config options"); return false; } config.db = config.db || config.name; config.version = config.version || "v1.0"; config.controllers = config.controllers || []; config.datapath = config.datapath || "."; // previous versions of cody used "port" instead of "http" as portnumber parameter for http listens if ((typeof config.http === "undefined") && (config.port != -1)) config.http = config.port; // 5. make the cody app console.log("\n======= making " + config.name + " ======="); var app = new cody.Application(config); for (var iC in config.controllers) { if (config.controllers.hasOwnProperty(iC)) { var C = config.controllers[iC]; console.log("Adding controller: " + iC + " - " + C.constructor.name); app.addController(iC, C); } } app.init(function () { if ((typeof config.hostnames === "undefined") || (config.hostnames === "")) { console.log("Could not start app " + config.name + ": no vhost data"); return false; } // add i18n var i18n = require("i18n"); i18n.configure({ locales:['zh-cn', 'en'], directory: __dirname + '/locales', defaultLocale: 'en' }); siteServer.use(i18n.init); // use the new 4.x middleware var bodyParser = require("body-parser"); var expressSession = require("express-session"); var multer = require("multer"); siteServer.use(bodyParser.json()); siteServer.use(bodyParser.urlencoded({ extended: true })); siteServer.use(expressSession({secret: 'a secret', cookie: { maxAge: 60*60*1000 }, resave: false, saveUninitialized: false})); siteServer.use(multer().any()); // startup a routing for all static content of cody (images, javascript, css) siteServer.get("/cody/static/*", function (req, res) { var fileserver = new cody.Static(req, res, ""); fileserver.serve(); }); function doLanguage(lan) { console.log("setup " + lan.name + " as /" + lan.id); // mysite.com/en/page siteServer.all("/" + lan.id + "/*", function (req, res) { app.servePage(req, res); }); // mysite.com/nl siteServer.all("/" + lan.id, function (req, res) { console.log("------------------------------------------------------------------- " + new Date() + "--"); console.log("-- redirecting to " + "/" + lan.id + "/"); res.redirect("/" + lan.id + "/"); // app.servePage(req, res); }); } for (var iL in app.languages) { doLanguage(app.languages[iL]); } // no language -> mysite.com siteServer.all("/", function (req, res) { console.log("------------------------------------------------------------------- " + new Date() + "--"); console.log("-- redirecting to " + "/" + app.defaultlanguage + "/"); res.redirect("/" + app.defaultlanguage + "/"); //app.servePage(req, res); }); // mysite.com/static/file-path siteServer.get("/static/*", function (req, res) { var fileserver = new cody.Static(req, res, config.name); fileserver.serve(); }); // mysite.com/data/[category]file-id.extension (standard "files" and "images") siteServer.get("/data/*", function (req, res) { var fileserver = new cody.Dynamic(req, res, app.getDataPath()); fileserver.serve(); }); if (typeof done === "function") { done({ host: config.hostnames.split(","), app: siteServer, http: config.http, https: config.https, certificate: path.join(pathname, config.certificate) }); } }); }; ================================================ FILE: models/Atom.js ================================================ // // Johan Coppieters - jan 2013 - Cody // // console.log("loading " + module.id); var fs = require("fs"); //!! basis objects (passed to Atom constructor or created with addDefaults have a parent that is an integer) //Objects created with the contructor Atom have a parent and parentId that are integers //only after "pickParent" become the parent instance variable a real (Atom) object function Atom(basis) { // copy from basis for (var a in basis) { if (basis.hasOwnProperty(a)) { this[a] = basis[a]; } } this.parentId = this.parent; this.parent = undefined; } module.exports = Atom; Atom.kDefaultName = "New item"; Atom.addDefaults = function(basis, parent) { if (typeof parent === "undefined") { parent = {}; } basis.name = basis.name || Atom.kDefaultName; basis.parent = basis.parent || parent.id; basis.note = basis.note || ""; basis.extention = basis.extention || ""; basis.sortorder = basis.sortorder || 9999; basis.created = basis.created || new Date(); basis.updated = basis.updated || new Date(); return basis; }; Atom.prototype.pickParent = function(atomList) { this.parent = atomList[this.parentId]; }; Atom.loadAtoms = function(connection, store) { connection.query('select * from atoms', [], function(err, result) { store(result); }); }; /* required protocol for nodes: */ Atom.prototype.getAllowedGroups = function() { return "*"; }; Atom.prototype.hasChildren = function() { return this.app.hasAtomChildren(this); }; Atom.prototype.isActive = function() { return true; }; Atom.prototype.isVisible = function() { return true; }; Atom.prototype.getChildren = function() { return this.app.getAtomChildren(this); }; Atom.prototype.getSortOrder = function() { return this.sortorder; }; Atom.prototype.setSortOrder = function(nr) { this.sortorder = nr; }; Atom.prototype.getNote = function() { return this.note; }; Atom.prototype.setNote = function(note) { this.note = note; }; Atom.prototype.setName = function(name) { this.name = name; }; Atom.prototype.getName = function() { return this.name; }; Atom.prototype.setExtention = function(extention) { this.extention = extention.toLowerCase(); }; Atom.prototype.getExtention = function() { return this.extention; }; Atom.prototype.getFileName = function() { return this.id + "." + this.extention; }; Atom.prototype.getPathName = function(controller) { return controller.app.getDataPath() + controller.getFolder() + "/" + this.id + "." + this.extention; }; Atom.prototype.getId = function() { return this.id; }; /* Atom specific */ Atom.prototype.isChild = function(anAtom) { return anAtom.parentId == this.id; }; Atom.prototype.scrapeFrom = function(controller) { // update all item info from the controller // JC: 26/03/2015 -- added default param "", otherwise extention would be undefined for forms // and if the caller was a FormController, it would assume it was an form element, not a form itself. this.name = controller.getParam("name", ""); this.extention = controller.getParam("extention", ""); this.note = controller.getParam("note", ""); }; Atom.prototype.doUpdate = function(controller, finish) { var self = this; var values = [self.name, self.parentId, self.sortorder, self.note, self.extention]; // new or existing record? if ((typeof self.id === "undefined") || (self.id === 0)) { console.log("Atom.doUpdate -> insert atom " + self.name); values.push(controller.getLoginId()); controller.query("insert into atoms (name, parent, sortorder, note, extention, updated, created) " + "values (?, ?, ?, ?, ?, now(), now())", values, function(err, result) { if (err) { console.log("Atom.doUpdate -> erroring inserting atom: " + self.name); console.log(err); } else { self.id = result.insertId; console.log("Atom.doUpdate -> inserted atom: " + self.id); if (typeof finish === "function") { finish(); } } }); } else { console.log("Atom.doUpdate -> update atom " + self.id + " - " + self.name); values.push(self.id); controller.query("update atoms set name = ?, parent = ?, sortorder = ?, note = ?, extention = ?, updated = now() " + "where id = ?", values, function(err) { if (err) { console.log("Atom.doUpdate -> erroring updating atom: " + self.id); console.log(err); } else { console.log("Atom.doUpdate -> updated atom: " + self.id); if (typeof finish === "function") { finish(); } } }); } }; Atom.prototype.doDelete = function(controller, finish) { var self = this; console.log("Atom.doDelete -> delete atom " + self.id + " - " + self.name); controller.query("delete from atoms where id = ?", [ self.id ], function() { delete controller.app.atoms[self.id]; console.log("Atom.doUpdate -> deleted atom: " + self.id); if ((self.extention === "---") || (self.extention === "xxx") || (self.extention === "")) { console.log("Atom.doDelete -> no file attached"); if (typeof finish === "function") { finish(); } } else { fs.unlink(self.getPathName(controller), function(err) { console.log("Atom.doDelete -> file deleted (" + err + ")"); if (typeof finish === "function") { finish(err); } }); } }); }; ================================================ FILE: models/Content.js ================================================ // // Johan Coppieters - may 2013 - cody // // console.log("loading " + module.id); var cody = require("../index.js"); function Content(basis, app) { // copy from basis for (var a in basis) { if (basis.hasOwnProperty(a)) { this[a] = basis[a]; } } this.intro = this.intro || "N"; this.name = this.name || ""; this.data = this.data || ""; this.kind = this.kind || "T"; this.sortorder = this.sortorder || 10; this.atom = this.atom || 0; this.prefix = app.prefix || ""; this.getAtom(this.atom, app); } module.exports = Content; Content.kindName = function(theKind) { return (theKind === "I") ? "Image" : (theKind === "T") ? "Text" : (theKind === "M") ? "Form" : (theKind === "P") ? "Params" : (theKind === "S") ? "String" : (theKind === "F") ? "File" : "Block"; }; Content.prototype.attachTo = function(obj, itemId, language) { this.page = obj; this.language = language; this.itemId = itemId; } Content.prototype.getAtom = function(atomId, app) { this.atomId = atomId; this.atom = (atomId > 0) ? app.getAtom(atomId) : undefined; }; Content.prototype.contentLength = function() { return (this.data) ? this.data.length : 0; }; Content.prototype.isIntro = function() { return (this.intro === "Y"); }; Content.prototype.renderText = function(controller) { return this.data; }; Content.prototype.renderParams = function(controller) { // these values should already be in the current context return ""; } Content.prototype.renderForm = function(controller) { var form; if ((typeof controller.context.errorForms !== "undefined") && (typeof controller.context.errorForms[this.atomId] !== "undefined")) { // check if we have a stored form, filled with values and errors... form = controller.context.errorForms[this.atomId]; } else { form = cody.FormController.makeMeta(this.atom); } var formInfo = cody.FormController.makeFormInfo(this.atom, controller.context.page); return form.html(this.language, formInfo); }; Content.prototype.renderFacebook = function(controller) { var url = this.data.replace("[page]", controller.context.page.getURL(this.language)); if (url === "") url = controller.context.page.getURL(this.language); if (url.indexOf("http") < 0) { url = "http://" + url; } return '
    ' + '
    ' + ''; }; Content.prototype.renderShare = function(controller) { var url = this.data.replace("[page]", controller.context.page.getURL(this.language)); if (url === "") url = controller.context.page.getURL(this.language); if (url.indexOf("http") < 0) { url = "http://" + url; } return '
    ' + '
    ' + ''; }; Content.prototype.renderImage = function(controller) { if (this.atom && (typeof this.atom != "undefined")) { return ""; } else { return ""; } }; Content.prototype.renderFile = function(controller) { if (this.atom && (typeof this.atom != "undefined")) { return "" + "" + this.atom.note + ""; } else { return ""; } }; Content.prototype.render = function(controller) { if (this.kind === "T") { return this.renderText(controller); } else if (this.kind === "S") { return this.renderText(controller); } else if (this.kind === "M") { return this.renderForm(controller); } else if (this.kind === "B") { return this.renderFacebook(controller); } else if (this.kind === "H") { return this.renderShare(controller); } else if (this.kind === "I") { return this.renderImage(controller); } else if (this.kind === "F") { return this.renderFile(controller); } else if (this.kind === "P") { return this.renderParams(controller); } else { return controller.render(this); } }; Content.prototype.scrapeFrom = function(controller) { this.name = controller.getParam("name", ""); this.intro = controller.getParam("intro", "N"); this.atom = controller.getParam("atom", 0); this.getAtom(this.atom, controller.app); this.data = controller.getParam("data", ""); this.kind = controller.getParam("kind", "T"); this.sortorder = controller.getParam("sortorder", 10); }; Content.prototype.scrapeFromWithId = function(controller) { this.name = controller.getParam("name_"+this.id, this.name); this.intro = controller.getParam("intro_"+this.id, "N"); this.atom = controller.getParam("atom_"+this.id, 0); this.getAtom(this.atom, controller.app); this.data = controller.getParam("data_"+this.id, ""); this.kind = controller.getParam("kind_"+this.id, "T"); this.sortorder = controller.getParam("sortorder_"+this.id, 10); }; Content.prototype.doDelete = function(controller, finish) { var self = this; controller.query("delete from content where id = ?", [self.id], function(err, result){ if (err) { console.log("Content.doDelete -> error deleting content, id = " + self.id + " of " + self.language + "/" + self.itemId); console.log(err); } else { console.log("Content.doDelete -> deleted content, id = " + this.id + " of " + self.language + "/" + self.itemId); } if (typeof finish === "function") { finish(); } }); }; Content.prototype.doUpdate = function(controller, isNew, finish) { var self = this; var values = [self.itemId, self.language, self.sortorder, self.intro, self.kind , self.atomId, self.name, self.data]; // new or existing record? if (isNew) { // console.log("Content.doUpdate -> insert content " + self.name); controller.query("insert into content (item, language, sortorder, intro, kind , atom, name, data) " + "values (?, ?, ?, ?, ?, ?, ?, ?)", values, function(err, result) { if (err) { console.log("Content.doUpdate -> error inserting content for: " + self.language + "/" + self.itemId); console.log(err); } else { self.id = result.insertId; console.log("Content.doUpdate -> inserted content: " + self.id + ", order: " + self.sortorder + ", for: " + self.language + "/" + self.itemId); if (typeof finish === "function") { finish(); } } }); } else { //console.log("Content.doUpdate -> update content: " + self.id + ", for: " + self.itemId + " - " + self.kind); values.push(this.id); controller.query("update content set item=?, language=?, sortorder=?, intro=?, kind=? , atom=?, name=?, data=? " + " where id = ?", values, function(err) { if (err) { console.log("Content.doUpdate -> error updating content: " + self.id + ", for: " + self.language + "/" + self.itemId); console.log(err); } else { console.log("Content.doUpdate -> updated content: " + self.id + ", order: " + self.sortorder + ", for: " + self.language + "/" + self.itemId); self.updated = new Date(); if (typeof finish === "function") { finish(); } } }); } }; ================================================ FILE: models/Context.js ================================================ // // Johan Coppieters - jan 2013 - Cody // // console.log("loading " + module.id); var cody = require("../index.js"); // // Context // // Created by Application in buildContext as results of servePage for every request, // containing all the context info for that request. // // Accessible through the controller of the request. // All its properties are accessible as globals for the view rendered for that request. // // Additionally provides some helpers (formatting/utitlities), thus accessible by the views. function Context(path, page, app, req, res) { this.version = (app) ? app.version : "v0.0"; this.page = page; this.app = app; this.req = req; this.res = res; this.path = path; // copy query params and body params into this.params and .param this.params = {}; for(var q in req.query) { if (Object.prototype.hasOwnProperty.call(req.query, q)) { this.params[q] = req.query[q]; } } for(var b in req.body) { if (Object.prototype.hasOwnProperty.call(req.body, b)) { this.params[b] = req.body[b]; } } this.request = this.params.request || path.request || page.item.defaultrequest || ""; this.status = "success"; this.message = ""; this.host = req.headers.host; this.dateFormat = "dd-mm-yyyy"; this.min = ""; // ".min" this.static = (app.prefix) ? "/" + app.prefix + "/static" : "/static"; this.dynamic = (app.prefix) ? "/" + app.prefix + "/data" : "/data"; this.cstatic = "/cody/static"; this.gPrefix = (app.prefix) ? "/" + app.prefix : ""; var stringPage = app.getPage(page.language, "strings"); this.strings = []; this.addStrings(stringPage); this.fn = (page) ? page.getView() : "index.ejs"; this.session = req.session; this.setLogin((typeof this.session === "undefined") ? {} : this.session.login); // make global cody lib available this.cody = cody; } module.exports = Context; // // mini contexts for saving in between login requests // Context.prototype.getMini = function() { var mini = {}; mini.params = {}; for(var x in this.params) { if (Object.prototype.hasOwnProperty(this.params, x)) { mini.params[x] = this.params[x]; } } //mini.params = this.params; mini.path = this.path; mini.request = this.request; mini.context = this.context; mini.static = this.static; mini.dynamic = this.dynamic; mini.fn = this.fn; return mini; }; Context.prototype.copyFromMini = function(mini) { this.params = {}; for(var x in mini.params) { if (Object.prototype.hasOwnProperty(mini.params, x)) { this.params[x] = mini.params[x]; } } this.path = mini.path; this.request = mini.request; this.context = mini.context; this.static = mini.static; this.dynamic = mini.dynamic; this.fn = mini.fn; this.page = this.app.findPage(this.path); }; // // Strings - translations - etc... // Context.prototype.addStrings = function(page, kind) { var self = this; if (typeof page !== "undefined") { page.content.forEach( function (C) { if ((typeof kind === "undefined") || (kind === C.kind)) { self.strings[C.name] = C.data; } }); } }; // // Render content queried by name or kind. // // { kind: String, // not_kind: String, // name: String, // not_name: String, // intro: Y/N, Show intro part? // page: Page } Optional Page to get the content from instead of current Context.prototype.render = function(params) { var html = ""; var content = this.page.content; if (typeof params === "undefined") { params = {}; } if (typeof params.page !== "undefined") { content = params.page.content; } if (typeof content === "undefined") { return ""; } for (var ic in content) { var C = content[ic]; if (params.name && (C.name != params.name)) continue; if (params.not_name && (C.name == params.not_name)) continue; if (params.kind && (C.kind != params.kind)) continue; if (params.not_kind && (C.kind == params.not_kind)) continue; if (params.intro && (C.intro != params.intro)) continue; html += C.render(this.controller); } return html; }; // // login stuff // Context.prototype.setLogin = function(login) { if (typeof this.session !== "undefined") this.session.login = login; this.login = new cody.User(login); }; Context.prototype.isLoggedIn = function() { return (this.login) && (typeof this.login !== "undefined") && (this.login.active === "Y"); }; Context.prototype.getLogin = function() { return this.login || new cody.User({}); }; // // General utilities // Context.prototype.getValueByIndex = function(object, index) { var nr = 0; for (var iO in object) { if (nr === index) { return object[iO]; } nr++; } return undefined; } Context.prototype.getKeyByIndex = function(object, index) { var nr = 0; for (var iO in object) { if (nr === index) { return iO; } nr++; } return undefined; } Context.prototype.val = function(value) { return (typeof value === "undefined") ? "" : value; }; Context.prototype.getUnique = function() { return new Date().getTime(); }; // returns 'checked' if true, for option lists. Context.prototype.checked = function( bool ) { return (bool) ? 'checked' : ''; }; // // Creates html options from a given list // // 1. optionList([String], String) // Creates an option for each string and marks theId as string. // 2. optionList([Object], String, String, String) // Creates an option for each object, using theIdName and theNameName properties // of each object to set the id and html resp. // Context.prototype.optionList = function(theList, theId, theIdName, theNameName) { var x = ""; var first = cody.Application.findFirst(theList); if (typeof first === "string") { for (var j=0; j < theList.length; j++) { var S = theList[j]; x += "\n"; } } else { var idName = theIdName || "id"; var nameName = theNameName || "name"; for (var i in theList) { if (theList.hasOwnProperty(i)) { var O = theList[i]; x += "\n"; } } } return x; }; // // optionListF([Any], String, (Any) -> String, (Any) -> String) -> String // // Uses two functions that take an element from the list as argument and return // an id/name to create the options. Marks the option that has the id theId as "selected". // Context.prototype.optionListF = function (theList, theId, getId, getName) { var options = ""; theList.forEach(function (item) { var id = getId(item); console.log(id); var name = getName(item); options += "\n"; }); return options; }; Context.prototype.find = function(theList, theId, theIdName) { var idName = theIdName || "id"; for (var i=0; i < theList.length; i++) { var R = theList[i]; if (R[idName] == theId) { return R; } } return {}; }; // // Session handlers // Context.prototype.fromSession = function(paramName, defaultValue) { var x = this.session[paramName]; return (typeof x === "undefined") ? defaultValue : x; }; Context.prototype.toSession = function(paramName, value) { this.session[paramName] = value; }; // // Request Parameter handlers // Context.prototype.getParam = function(paramName, defaultValue) { var x = this.params[paramName]; if (typeof defaultValue === "boolean") { x = (x === "true") || (x === "Y") || (x === "1") || (x === 1); }; if (typeof defaultValue === "number") { if ((typeof x === "undefined") || (x === "")) return defaultValue; var tmp = parseFloat(x); x = (tmp % 1 === 0) ? parseInt(x) : tmp; }; if ((typeof defaultValue !== "undefined") && (defaultValue instanceof Date)) { x = this.makeDate(x, defaultValue); } return (typeof x === "undefined") ? defaultValue : x; }; Context.prototype.setParam = function(paramName, value) { this.params[paramName] = value; }; // Adds a leading "0" when the number < 10. function two(n) { return (n < 10) ? ("0" + n) : n; } Context.prototype.formatTime = function(aDate) { return two(aDate.getHours()) + ":" + two(aDate.getMinutes()) + ":" + two(aDate.getSeconds()); }; Context.prototype.formatShortTime = function(aDate) { return two(aDate.getHours()) + ":" + two(aDate.getMinutes()); }; // should look at the current locale of the user page // for now we depend on the dateFormat field of this context Context.prototype.formatDate = function(aDate) { if ((typeof aDate === "undefined") || (!aDate)) { console.log("formatDate called without date parameter..."); aDate = new Date(); } if (this.dateFormat === "dd-mm-yyyy") { return two(aDate.getDate()) + "-" + two(aDate.getMonth()+1) + "-" + aDate.getFullYear(); } else if (this.dateFormat === "mm-dd-yyyy") { return two(aDate.getMonth()+1) + "-" + two(aDate.getDate()) + "-" + aDate.getFullYear(); } else { // "yyyy-mm-dd" return aDate.getFullYear() + "-" + two(aDate.getMonth()+1) + "-" + two(aDate.getDate()); } }; Context.prototype.makeDate = function(value, defaultValue) { if (typeof value === "undefined") { return defaultValue; } var parts = (value.indexOf("-") > 0) ? value.split("-") : value.split("/"); if (this.dateFormat === "dd-mm-yyyy") { return (parts.length < 3) ? defaultValue : new Date(parts[2], parseInt(parts[1], 10)-1, parts[0]); } else if (this.dateFormat === "mm-dd-yyyy") { return (parts.length < 3) ? defaultValue : new Date(parts[2], parseInt(parts[0], 10)-1, parts[1]); } else { // "yyyy-mm-dd" return (parts.length < 3) ? defaultValue : new Date(parts[0], parseInt(parts[1], 10)-1, parts[0]); } } Context.prototype.makeInt = function(value, defaultValue) { if (typeof value !== "number") { value = parseInt(value, 10); } return isNaN(value) ? defaultValue : value; } Context.prototype.makeNum = function(value, defaultValue, precision) { if (typeof value !== "number") { value = parseFloat(value); } if (isNaN(value)) { value = defaultValue; } if (typeof precision !== "undefined") { value = value.toFixed(precision); } return value; } ================================================ FILE: models/Item.js ================================================ // // Johan Coppieters - jan 2013 - jWorks // // console.log("loading " + module.id); var cody = require('./../index.js'); //!! basis objects (passed to Item constructor or created with addDefaults have a parent that is an integer) //Objects created with the contructor Item have a parent and parentId that are integers //only after "pickParent" become the parent instance variable a real (Item) object function Item(basis, app) { // copy from basis for (var a in basis) { if (basis.hasOwnProperty(a)) { this[a] = basis[a]; } } // replace 'template' by the real object and add 'templateId' this.templateId = this.template; this.template = app.getTemplate(this.templateId); if (typeof this.template === "undefined") { app.err("Item.constructor", "did not find a template with id = " + this.templateId + " for item " + this.id + " / " + this.name); } // add a 'parentId' for consistency // this.parent will be replaced once all items are created in 'pickParent' this.parentId = this.parent; } module.exports = Item; Item.addDefaults = function(basis, parent) { if (typeof parent === "undefined") { parent = {}; } basis.name = basis.name || Item.kDefaultName; basis.parent = basis.parent || parent.id; basis.user = basis.user || parent.user; basis.sortorder = basis.sortorder || 9999; basis.orderby = basis.orderby || parent.orderby; basis.dated = basis.dated || new Date(); basis.validfrom = basis.validfrom || new Date(); basis.validto = basis.validto || cody.Application.endOfTime(); basis.template = basis.template || parent.template.defaultchild; basis.showcontent = basis.showcontent || Item.kContent; basis.needslogin = basis.needslogin || parent.needslogin; basis.defaultrequest = basis.defaultrequest || "list"; basis.alloweddomains = basis.alloweddomains || parent.alloweddomains; return basis; }; Item.orderbyList = [ { id: 'M', name: 'Manual'}, { id: 'A', name: 'Alphabetical'}, { id: 'D', name: 'Chronological'} ]; Item.showcontentList = [ { id: 'Y', name: 'Content'}, { id: 'S', name: 'First subitem'}, { id: 'N', name: 'All subitems'}, { id: 'D', name: 'Don\'t show subitems'}, { id: 'L', name: 'Lightbox (not yet implemented)'} ]; Item.prototype.pickParent = function(itemList) { this.parent = itemList[this.parentId]; }; Item.loadItems = function(connection, store) { connection.query('select * from items', [], function(err, result) { if (err) { console.log(err); throw(new Error("Item.loadItems failed with sql errors")); } store(result); }); }; // values for orderby Item.kManual = 'M'; Item.kAlphabetical = 'A'; Item.kDate = 'D'; // values for showcontent Item.kContent = 'Y'; Item.kNothing = 'N'; Item.kSubItem = 'S'; Item.kNoSubitems = 'D'; Item.kLightBox = 'L'; Item.kDefaultName = 'New item'; Item.prototype.getId = function() { return this.id; }; Item.prototype.getAllowedDomains = function() { return this.alloweddomains; }; Item.prototype.needsLogin = function() { return (this.needslogin) && (this.needslogin === "Y"); }; Item.prototype.setTemplate = function(templateId, controller) { this.templateId = templateId; if (typeof controller !== "undefined") { this.template = controller.app.getTemplate(templateId); if (typeof this.template === "undefined") { controller.feedBack("Couldn't find the template with id = " + templateId + " for item " + this.id + " / " + this.name); } } }; Item.prototype.scrapeFrom = function(controller) { // update all item info from the controller this.dated = controller.getDate("dated"); this.validfrom = controller.getDate("validfrom"); this.validto = controller.getDate("validto"); this.needslogin = controller.getParam("needslogin"); this.showcontent = controller.getParam("showcontent"); this.alloweddomains = controller.getParam("alloweddomains"); this.setTemplate(controller.getParam("template"), controller); this.orderby = controller.getParam("orderby"); this.defaultrequest = controller.getParam("defaultrequest", this.defaultrequest || "list"); // user is only filled at creation time }; Item.prototype.doUpdate = function(controller, finish) { var self = this; var values = [self.name, self.parentId, self.user, self.templateId, self.orderby, self.sortorder, self.dated, self.validfrom, self.validto, self.showcontent, self.needslogin, self.defaultrequest, self.alloweddomains]; // new or existing record? if ((typeof self.id === "undefined") || (self.id === 0)) { //console.log("Item.doUpdate -> insert item " + self.name); controller.query("insert into items (name, parent, user, template, orderby, sortorder, " + " dated, validfrom, validto, showcontent, needslogin, " + " defaultrequest, alloweddomains) " + "values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", values, function(err, result) { if (err) { console.log("Item.doUpdate -> erroring inserting item: " + self.name); console.log(err); } else { self.id = result.insertId; console.log("Item.doUpdate -> inserted item: " + self.id); if (typeof finish === "function") { finish(); } } }); } else { //console.log("Item.doUpdate -> update item " + self.id + " - " + self.name); values.push(self.id); controller.query("update items set name = ?, parent = ?, user = ?, template = ?, orderby = ?, sortorder = ?, " + " dated = ?, validfrom = ?, validto = ?, showcontent = ?, needslogin = ?, " + " defaultrequest = ?, alloweddomains = ? " + "where id = ?", values, function(err) { if (err) { console.log("Item.doUpdate -> erroring updating item: " + self.id); console.log(err); } else { console.log("Item.doUpdate -> updated item: " + self.id); if (typeof finish === "function") { finish(); } } }); } }; Item.prototype.doDelete = function(controller, finish) { var self = this; controller.query("delete from items where id = ?", [ self.id ], function() { delete controller.app.items[self.id]; console.log("Item.doDelete -> deleted item: " + self.id); controller.query("delete from pages where item = ?", [ self.id ], function(err) { if (err) { console.log("Item.doDelete -> erroring deleting all pages from item: " + self.id); console.log(err); } else { controller.app.deletePagesForItem(self.id, function() { console.log("Item.doDelete -> deleted all pages from item: " + self.id); controller.query("delete from content where item=?", [ self.id ], function(err) { if (err) { console.log(err); } else { console.log("Item.doDelete -> deleted all content of item: " + self.id); if (typeof finish === "function") { finish(); } } }); }); } }); }); }; ================================================ FILE: models/Meta.js ================================================ // // Johan Coppieters - aug 2013 - cody // // console.log("loading " + module.id); function Meta(plainObject) { this.objects = []; this.names = {}; this.ok = true; this.metaId = 0; this.objectId = 0; if (typeof plainObject !== "undefined") { this.setDefinition(plainObject); } } Meta.Reader = {}; Meta.Reader.readers = []; Meta.Reader.debug = true; Meta.Generator = {}; Meta.Generator.generators = []; Meta.Messages = {}; Meta.Messages.messages = {}; module.exports = Meta; Meta.getData = function(result) { return { id: result.id, atom: result.atom, data: ((typeof result.data === "undefined") || (result.data.length < 2)) ? {} : JSON.parse(result.data), status: result.status, statusname: (result.status === "N") ? "New" : (result.status === "T") ? "To do" : "Done", created: result.created, modified: result.modified }; }; /* Standard Readers Meta.Reader.number Meta.Reader.string Meta.Reader.email Meta.Reader.date Meta.Reader.date3 Meta.Reader.multiple Meta.Reader.phone Meta.Reader.integer */ /********************************/ /* Localized Message management */ /********************************/ Meta.Messages.kOK = 0; Meta.Messages.kTooSmall = 1; Meta.Messages.kTooBig = 2; Meta.Messages.kRequired = 3; Meta.Messages.kNoNumber = 4; Meta.Messages.kTooLong = 5; Meta.Messages.kTooShort = 6; Meta.Messages.kInvalidEmail = 7; Meta.Messages.kInvalidPhone = 8; //TODO: load from json Meta.Messages.addStdMessages = function() { this.addMessage("nl", Meta.Messages.kOK, "OK"); this.addMessage("nl", Meta.Messages.kTooSmall, "Te klein"); this.addMessage("nl", Meta.Messages.kTooBig, "Te groot"); this.addMessage("nl", Meta.Messages.kRequired, "Verplicht veld"); this.addMessage("nl", Meta.Messages.kNoNumber, "Geen getal"); this.addMessage("nl", Meta.Messages.kTooLong, "Te lang"); this.addMessage("nl", Meta.Messages.kTooShort, "Te kort"); this.addMessage("nl", Meta.Messages.kInvalidEmail, "Geen geldig email adres"); this.addMessage("nl", Meta.Messages.kInvalidPhone, "Geen geldig telefoon nummer"); this.addMessage("en", Meta.Messages.kOK, "OK"); this.addMessage("en", Meta.Messages.kTooSmall, "Too small"); this.addMessage("en", Meta.Messages.kTooBig, "Too big"); this.addMessage("en", Meta.Messages.kRequired, "Required value"); this.addMessage("en", Meta.Messages.kNoNumber, "No number"); this.addMessage("en", Meta.Messages.kTooLong, "Too long"); this.addMessage("en", Meta.Messages.kTooShort, "Too Short"); this.addMessage("en", Meta.Messages.kInvalidEmail, "Invalid email address"); this.addMessage("en", Meta.Messages.kInvalidPhone, "Invalid phone number"); this.addMessage("fr", Meta.Messages.kOK, "OK"); this.addMessage("fr", Meta.Messages.kTooSmall, "Trop petit"); this.addMessage("fr", Meta.Messages.kTooBig, "Trop grand"); this.addMessage("fr", Meta.Messages.kRequired, "Valeur obligatoir"); this.addMessage("fr", Meta.Messages.kNoNumber, "Pas de numéro"); this.addMessage("fr", Meta.Messages.kTooLong, "Trop longue"); this.addMessage("fr", Meta.Messages.kTooShort, "Trop court"); this.addMessage("fr", Meta.Messages.kInvalidEmail, "Adresse email invalide"); this.addMessage("fr", Meta.Messages.kInvalidPhone, "Numéro de téléphone incorrect"); this.addMessage("de", Meta.Messages.kOK, "OK"); this.addMessage("de", Meta.Messages.kTooSmall, "Zu klein"); this.addMessage("de", Meta.Messages.kTooBig, "Zu groß"); this.addMessage("de", Meta.Messages.kRequired, "Pflichtfeld"); this.addMessage("de", Meta.Messages.kNoNumber, "keine Nummer"); this.addMessage("de", Meta.Messages.kTooLong, "Zu lange"); this.addMessage("de", Meta.Messages.kTooShort, "Zu kurz"); this.addMessage("de", Meta.Messages.kInvalidEmail, "Ungültige E-Mail-Adresse"); this.addMessage("de", Meta.Messages.kInvalidPhone, "Ungültige Telefonnummer"); }; Meta.Messages.addMessage = function(language, messageId, messageString) { // key/value pair add(language, key, value) if (typeof Meta.Messages.messages[language] === "undefined") { Meta.Messages.messages[language] = {}; } Meta.Messages.messages[language][messageId] = messageString; } Meta.Messages.getMessage = function(language, messageId) { return ((typeof Meta.Messages.messages[language] !== "undefined") && (typeof Meta.Messages.messages[language][messageId] !== "undefined")) ? Meta.Messages.messages[language][messageId] : ("undefined error: " + messageId); } Meta.Messages.addStdMessages(); /******************************/ /* Meta definition management */ /******************************/ Meta.prototype.add = function( params ) { // params = {name, options, generator, labels} // accept strings and objects if ((typeof params === "string") && (params.indexOf("{") >= 0)) { params = JSON.parse(params); } // clone object var object = {}; for (var oi in params) { object[oi] = params[oi]; } // generate unique id and add to params this.names[object.name] = this.objects.length; object.id = this.objects.length; // add value if not already in it object.value = this.getValue(object); // remember in our objects array this.objects.push(object); }; Meta.prototype.addList = function( arr ) { for (var iA in arr) { this.add(arr[iA]); } } Meta.prototype.setDefinition = function( plainObject ) { this.objects = plainObject.objects; this.names = plainObject.names; this.metaId = plainObject.metaId; } Meta.prototype.saveDefinition = function( controller, done ) { var data = JSON.stringify( this ); if (this.metaId === 0) { // insert new record in "meta" } else { // update definition in "meta" } if (typeof done === "function") { done(); } }; Meta.prototype.readDefinition = function( controller, id, done ) { // read from database in table "meta" and "add" to ourselfs this.metaId = id; // get meta from the database and inject var data = "{}"; this.setDefinition( JSON.parse(data) ); if (typeof done === "function") { done(); } }; /***************************/ /* Object value management */ /***************************/ Meta.prototype.values = function() { var values = {}; for (var iO in this.objects) { var O = this.objects[iO]; values[O.name] = O.value; } return values; }; Meta.prototype.setValues = function(values) { for (var iO in this.objects) { var O = this.objects[iO]; O.value = values[O.name]; } } Meta.prototype.errors = function(lang) { if (typeof lang === "undefined") { lang = "en"; } var errs = []; for (var iO in this.objects) { var O = this.objects[iO]; if (typeof O.error !== "undefined") { errs.push({name: O.name, label: O.labels[lang], error: O.error, value: O.value, errstr: Meta.Messages.getMessage(lang, O.error)}); } } return errs; }; Meta.prototype.isOk = function() { return this.ok; }; Meta.prototype.reset = function() { this.ok = true; for (var iO in this.objects) { var O = this.objects[iO]; delete O.error; delete O.value; O.value = this.getValue(O); } }; Meta.prototype.getValue = function(object) { return (typeof object.value !== "undefined") ? object.value : ((typeof object.options === "undefined") ? undefined : ((object.options.default === "now") ? new Date() : object.options.default)); }; Meta.prototype.readValuesFrom = function( params, correct ) { this.reset(); for (var iO in this.objects) { var O = this.objects[iO]; var raw = params[O.name]; var native = Meta.Reader.readers[O.reader](raw, O, params, correct); if (typeof O.error !== "undefined") { this.ok = false; } O.value = native; if (Meta.Reader.debug) { console.log("readValuesFrom: " + O.name + " -> " + raw + " -> " + native + ", error = " + O.error); } } }; Meta.prototype.saveValues = function( controller, status, done ) { var self = this; var values = self.values(); var data = JSON.stringify(values); if ((typeof this.objectId === "undefined") || (this.objectId === 0)) { controller.query("insert into data (atom, data, created, modified, status) values (?, ?, now(), null, 'N')", [self.metaId, data], function(error, results){ self.objectId = results.insertId; done(); }); } else { controller.query("update data set data = ?, modified = now(), status = ? where id = ?", [data, status, self.objectId], done); } }; Meta.prototype.readValues = function( controller, id, done ) { var self = this; this.objectId = id; controller.query("select id, atom, data, status, created, modified from data where id = ?", [id], function(error, result) { if (error || (result.length != 1)) { console.log("Meta.readValues -> error :" + error); done(error, undefined); return; } var data = Meta.getData(result[0]); if (data.atom == self.metaId) { self.setValues( data.data ); } else { console.log("Meta.readValues -> error: *** incompatible data type ***"); done(new Error("Can not read incompatible data from the database"), undefined); return; } done(undefined, data); }); }; /********************/ /* Reader functions */ /********************/ Meta.Reader.makeReader = function(func) { Meta.Reader.readers.push(func); return Meta.Reader.readers.length-1; } Meta.Reader.number = Meta.Reader.makeReader(function(value, object, others, correct) { // check undefined / required if (typeof value === "undefined") { if (object.options.required) { object.error = Meta.Messages.kRequired; return (correct) ? undefined : ""; } else { return (typeof object.options.default === "undefined") ? ((correct) ? undefined : "") : object.options.default; } } // real integer stuff var f = parseFloat(value, 10); if (isNaN(f)) { object.error = Meta.Messages.kNoNumber; return (correct) ? undefined : value; } else if (object.options.maximum && f > object.options.maximum) { object.error = Meta.Messages.kTooBig; return (correct) ? undefined : value; } else if (object.options.minimum && f < object.options.minimum) { object.error = Meta.Messages.kTooSmall; return (correct) ? undefined : value; } return f; }); Meta.Reader.string = Meta.Reader.makeReader(function(value, object, others, correct) { // check undefined / required if (typeof value === "undefined") { if (object.options.required) { object.error = Meta.Messages.kRequired; return (correct) ? undefined : ""; } else { return (typeof object.options.default === "undefined") ? ((correct) ? undefined : "") : object.options.default; } } // real string stuff if (object.options.maximum && (value.length > object.options.maximum)) { object.error = Meta.Messages.kTooLong; return (correct) ? undefined : value; } else if (object.options.minimum && (value.length < object.options.minimum)) { object.error = Meta.Messages.kTooShort; return (correct) ? undefined : value; } return value; }); Meta.Reader.email = Meta.Reader.makeReader(function(value, object, others, correct) { value = Meta.Reader.readers[Meta.Reader.string](value, object); if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) { return value; } else { object.error = Meta.Messages.kInvalidEmail; return (correct) ? undefined : value; } }) Meta.Reader.date = Meta.Reader.makeReader(function(value, object, others, correct) { // allow "now" as value and defaultvalue if (value === "now") { console.log("*** value=now ***"); return new Date(); } var defD = (object.options.default === "now") ? new Date() : ((correct) ? object.options.default : ""); if (typeof value === "undefined") { if (object.options.required) { object.error = Meta.Messages.kRequired; return (correct) ? undefined : ""; } else { return defD } } //TODO: read from 1 field, use context.makeDate(object.value, object.options.default) var parts = (value.indexOf("-") > 0) ? value.split("-") : value.split("/"); return (parts.length < 3) ? ((correct) ? defD : value) : new Date(parts[2], ParseInt(parts[1])-1, parts[0]); }); Meta.Reader.date3 = Meta.Reader.makeReader(function(value, object, others, correct) { var yyyy = others[object.name + "_yyyy"], mm = others[object.name + "_mm"], dd = others[object.name + "_dd"]; if ((typeof yyyy === "undefined") || (typeof yyyy === "undefined") || (typeof yyyy === "undefined")) { return undefined; } return new Date(yyyy, parseInt(mm)-1, dd); }); Meta.Reader.multiple = Meta.Reader.makeReader(function(value, object, others, correct) { var vals = []; for (var first in object.options.choices) { break; } for (var i in object.options.choices[first]) { var val = others[object.name + "_" + i]; if (typeof val !== "undefined") { vals.push(val); } } return vals.join("|"); }); Meta.Reader.phone = Meta.Reader.makeReader(function(value, object, others, correct) { // check undefined / required var stripped = (typeof value === "undefined") ? "" : value.replace(/[\(\)\.\-\ ]/g, ''); if ((typeof value === "undefined") || (stripped === "")) { if (object.options.required) { object.error = Meta.Messages.kRequired; return (correct) ? undefined : ""; } else { return (typeof object.options.default === "undefined") ? ((correct) ? undefined : "") : object.options.default; } } if ((! (/^[0-9]+$/.test(stripped))) || (stripped.length < 6)) { object.error = Meta.Messages.kInvalidPhone; return (correct) ? undefined : value; } return value; }); Meta.Reader.integer = Meta.Reader.makeReader(function(value, object, others, correct) { // check undefined / required if (typeof value === "undefined") { if (object.options.required) { object.error = Meta.Messages.kRequired; return (correct) ? undefined : ""; } else { return (typeof object.options.default === "undefined") ? ((correct) ? undefined : "") : object.options.default; } } // real integer stuff var i = parseInt(value, 10); if (isNaN(i)) { object.error = Meta.Messages.kNoNumber; return (correct) ? undefined : value; } else if (object.options.maximum && i > object.options.maximum) { object.error = Meta.Messages.kTooBig; return (correct) ? undefined : value; } else if (object.options.minimum && i < object.options.minimum) { object.error = Meta.Messages.kTooSmall; return (correct) ? undefined : value; } return i; }); /********************/ /* Generator Stuff */ /********************/ Meta.prototype.html = function( lang, formInfo ) { if (typeof lang === "undefined") lang = "en"; var html = ""; for (var iO in this.objects) { var O = this.objects[iO]; if (typeof Meta.Generator.generators[O.generator] === "function") { html += Meta.Generator.generators[O.generator](lang, O); } } var buttonName = (typeof formInfo.labels === "undefined") ? "Send" : formInfo.labels[lang]; return "
    " + " " + " " + "
    " + html + "
    " + "
    " + " " + ((typeof formInfo.extraButtons !== "undefined") ? formInfo.extraButtons : "") + "
    " + "
    "; // + script voor submitter ? }; /**************************/ /* Meta.Generator Helpers */ /**************************/ function getClasses(object, extraClass) { var x = ""; if (object.options.required) { x = " class='required"; } if (object.options.date) { x += (x==="") ? " class='date" : " date"; } if (object.options.email) { x += (x==="") ? " class='email" : " email"; } if (object.options.number) { x += (x==="") ? " class='number" : " number"; } if ((typeof extraClass !== "undefined") && (extraClass !== "")) { x += ((x==="") ? " class='" : " ") + extraClass; } if (typeof object.error !== "undefined") { x += (x==="") ? " class='error" : " error"; } // end the class string if (x !== "") { x += "'"; } return x; } function getAttributes(object) { var x = ""; if (typeof object.options.width !== "undefined") { x += " size='" + object.options.width + "'"; } if (typeof object.options.maxlength !== "undefined") { x += " maxlength='" + object.options.maxlength + "'"; } if (typeof object.options.cols !== "undefined") { x += " cols='" + object.options.cols + "'"; } if (typeof object.options.rows !== "undefined") { x += " rows='" + object.options.rows + "'"; } return x; } function getErrors(lang, object) { if (typeof object.error === "undefined") { return ""; } return ""; } function validLang(lang) { return (typeof lang === "undefined") ? "en" : lang; } function getVal(object) { return (typeof object.value === "undefined") ? "" : (" value='" + object.value + "'") } function getTVal(object) { return (typeof object.value === "undefined") ? "" : object.value; } function isIn(val, values) { for (var i in values) if (val == values[i]) return true; return false; } function two(n) { return (n < 10) ? ("0" + n) : n; } /* HTML generators helpers */ function getRadios(lang, object, cls) { var s = ""; for (var i in object.options.choices[lang]) { var C = object.options.choices[lang][i]; s += ""; } return s; } function getOptions(lang, object) { var s = ""; for (var i in object.options.choices[lang]) { var C = object.options.choices[lang][i]; s += ""; } return s; } function getChecks(lang, object) { var s = ""; var values = (typeof object.value === "undefined") ? [] : object.value.split("|"); for (var i in object.options.choices[lang]) { var C = object.options.choices[lang][i]; s += "" + ""; } return s; } /**************************/ /* Actual HTML generators */ /**************************/ Meta.Generator.makeGenerator = function(func) { Meta.Generator.generators.push(func); return Meta.Generator.generators.length - 1; } Meta.Generator.numberinput = Meta.Generator.makeGenerator(function(lang, object) { lang = validLang(lang); var cls = getClasses(object); var val = getVal(object); var err = getErrors(lang, object); return "
    " + "" + err + "
    \n"; }); Meta.Generator.textinput = Meta.Generator.makeGenerator(function(lang, object) { lang = validLang(lang); var attr = getAttributes(object); var cls = getClasses(object); var val = getVal(object); var err = getErrors(lang, object); return "
    " + "" + err + "
    \n"; }); Meta.Generator.textareainput = Meta.Generator.makeGenerator(function(lang, object) { lang = validLang(lang); var attr = getAttributes(object); var cls = getClasses(object); var val = getTVal(object); var err = getErrors(lang, object); return "
    " + "" + err + "
    \n"; }); Meta.Generator.radioinput = Meta.Generator.makeGenerator(function(lang, object) { lang = validLang(lang); var cls = getClasses(object); var err = getErrors(lang, object); return "
    " + "
    " + getRadios(lang, object, cls) + "
    " + err + "
    \n"; }); Meta.Generator.selectinput = Meta.Generator.makeGenerator(function(lang, object) { lang = validLang(lang); var cls = getClasses(object); var err = getErrors(lang, object); return "
    " + "" + err + "
    \n"; }); Meta.Generator.checkboxinput = Meta.Generator.makeGenerator(function(lang, object) { lang = validLang(lang); var val = getVal(object); var cls = getClasses(object); var err = getErrors(lang, object); return "
    " + "
    " + getChecks(lang, object, cls) + "
    " + err + "
    \n"; }); Meta.Generator.dateinput = Meta.Generator.makeGenerator(function(lang, object) { lang = validLang(lang); var attr = getAttributes(object); // force a date class object.options.date = true; var cls = getClasses(object); //TODO: use formatDate from context to get localisation right var val = ""; if ((typeof object.value === "object")) { val = " value='" + two(object.value.getDate()) + "-" + two(object.value.getMonth()+1) + "-" + object.value.getFullYear() + "'"; } var err = getErrors(lang, object); return "
    " + "" + err + "
    \n"; }); Meta.Generator.date3input = Meta.Generator.makeGenerator(function(lang, object) { lang = validLang(lang); var cls_dd = getClasses(object, "date_dd number"); var cls_mm = getClasses(object, "date_mm number"); var cls_yyyy = getClasses(object, "date_yyyy number"); var val_dd = "", val_mm = "", val_yyyy = ""; if ((typeof object.value === "object")) { val_dd = " value='" + two(object.value.getDate()) + "'"; val_mm = " value='" + two(object.value.getMonth()+1) + "'"; val_yyyy = " value='" + object.value.getFullYear() + "'"; } var err = getErrors(lang, object); return "
    " + "" + "" + "" + "
    " + err + "
    \n"; }); /******************/ /* Demo + testing */ /******************/ /* sample Meta descriptors */ Meta.color = { maximum: 255, minimum: 0, required: true, default: 127 }; Meta.positive = { minimum: 0, required: true, default: 0 }; function demo() { var X = new Meta(); // {name, options, generator, labels} X.add({ name: "width", options: Meta.positive, reader: Meta.Reader.integer, generator: Meta.Generator.numberinput, labels: {"en": "Width", "nl": "Breedte"} }); X.add({ name: "height", options: { default: 10, number: true, size: 10 }, reader: Meta.Reader.integer, generator: Meta.Generator.numberinput, labels: {"en": "Height", "nl": "Hoogte"} }); X.add({ name: "publish", options: { size: 10 }, reader: Meta.Reader.date, generator: Meta.Generator.dateinput, labels: {"en": "Publish on", "nl": "publiceer op"} }); X.add({ name: "saved", options: { size: 10, default: "now" }, reader: Meta.Reader.date, generator: Meta.Generator.dateinput, labels: {"en": "saved on", "nl": "bewaard op"} }); X.add({ name: "born", options: { required: true }, reader: Meta.Reader.date3, generator: Meta.Generator.date3input, labels: {"en": "Born", "nl": "Geboren"} }); X.add({ name: "note", options: { cols: 50, rows: 5 }, reader: Meta.Reader.string, generator: Meta.Generator.textareainput, labels: {"en": "Note", "nl": "Nota"} }); X.add({ name: "red", options: Meta.color, reader: Meta.Reader.integer, generator: Meta.Generator.numberinput, labels: {"en": "Red", "nl": "Rood"} }); X.add({ name: "green", options: Meta.color, reader: Meta.Reader.integer, generator: Meta.Generator.numberinput, labels: {"en": "Green", "nl": "Groen"} }); X.add({ name: "blue", options: Meta.color, reader: Meta.Reader.integer, generator: Meta.Generator.numberinput, labels: {"en": "Blue", "nl": "Blauw"} }); X.add({ name: "email", options: { email: true, required: true, size: 50, maxlength: 100 }, reader: Meta.Reader.email, generator: Meta.Generator.textinput, labels: {"en": "email address", "nl": "imeel"} }); var choices = {}; choices["nl"] = { 'M': 'Man', 'F': 'Vrouw'}; choices["en"] = { 'M': 'Male', 'F': 'Female'}; X.add({ name: "sex", options: { choices: choices, required: true }, reader: Meta.Reader.string, generator: Meta.Generator.radioinput, labels: {"en": "Sex", "nl": "Geslacht"} }); X.add({name: "sexy", options: { choices: choices }, reader: Meta.Reader.string, generator: Meta.Generator.selectinput, labels: {"en": "Sexje", "nl": "Geslachtje"} }); X.add({name: "phony", options: { required: true }, reader: Meta.Reader.phone, generator: Meta.Generator.textinput, labels: {"en": "Phone", "nl": "telefoon"} }); var food = {}; food["nl"] = { 'O': 'Ontbijt', 'L': 'Middageten', 'D': 'Avondmaal'}; food["en"] = { 'B': 'Breakfast', 'L': 'Lunch', 'D': 'Dinner'}; X.add({name: "food", options: { choices: food }, reader: Meta.Reader.multiple, generator: Meta.Generator.checkboxinput, labels: {"en": "Food", "nl": "Eten"} }); // add some custom meta definition, including error custom message Meta.Messages.kBadName = 1001; Meta.Messages.addMessage("nl", Meta.Messages.kBadName, "Slechte name"); Meta.Messages.addMessage("en", Meta.Messages.kBadName, "Bad name"); X.add({ name: "name", options: {}, reader: Meta.Reader.makeReader(function nameReader(value, object) { if ((typeof value != undefined) && (value.indexOf("Cody") > 0)) { return "Cody is a good name"; } else { object.error = Meta.Messages.kBadName; return "Super Cody"; } }), generator: Meta.Generator.textinput, labels: { "en": "Best CMS", "nl": "Beste CMS ooit"} }); var JJ = JSON.stringify(X); console.log("save meta = "); console.log(JJ); var X = new Meta(JSON.parse(JJ)); var P = {"width": "10", "red": "122", "blue": "333", "name": "nobody", "sex": "F", "born_dd": "30", "born_mm": "4", "born_yyyy": "1962"}; console.log("Params = ");console.log(P); X.readValuesFrom(P, false); console.log("Values original = ");console.log(X.values()); X.reset(); X.readValuesFrom(P, true); console.log("Values corrected = ");console.log(X.values()); console.log("Errors = ");console.log(X.errors()); console.log("HTML = ");console.log(X.html()); P = {"width": "10", "phony": "050W335066", "red": "111", "green": "121", "blue": "222", "name": "Cody CMS", "sex": "F", "sexy": "F", "food_L": "L", "food_D": "D", "email": "johan577@mac.com"}; X.reset(); console.log("HTML empty = "); console.log(X.html("nl")); X.reset(); X.readValuesFrom(P, true); console.log("Params = ");console.log(P); console.log("Values = ");console.log(X.values()); console.log("Errors = ");console.log(X.errors("nl")); console.log("NL - HTML with values = ");console.log(X.html("nl")); console.log("EN - HTML with values = ");console.log(X.html("en")); } if (module.id === ".") { demo(); } ================================================ FILE: models/Model.js ================================================ // // Johan Coppieters - apr 2014 - Cody - beta 1 // // beta 2: added "label" and "hide" in cols. // added loopLabelList (for iterating over the cols) // // planned: beta 3: remove console.log's // var cody = require("../index.js"); console.log("loading " + module.id); function Model(theController, options) { if (theController != null) { this.controller = theController; theController.model = this; } this.tableName = options.tableName; this.id = options.id || {name: "id", def: 0}; // cols: array with objects containing meta data and values // {name: "username", def: "", list: true, sort: "asc", q: "like"} // // name=..., def=default value, list=appears with doList is called, sort..., // like=when there are q.name params use this operator this.cols = options.cols; // refs: array with objects containing per reference table // - (name, query) to be fetched and set upon "doGet" or // - (name, array) to be set upon "doGet" // this.refs = options.refs || []; } module.exports = Model; /* Example: User model var aUser = new cody.Model(this, { tableName: "patients", id: {name: "id", def: 0}, cols: [ {name: "name", def: "", list: true, sort: "asc"}, {name: "firstname", def: "", list: true, sort: "asc"}, {name: "street", label: "Street", def: "", list: true}, {name: "town", label: "Town", def: "", list: true}, {name: "tel1", label: "Phone 1", def: "", list: true}, {name: "tel2", label: "Phone 2", def: "", list: true}, {name: "active", label: "Active", def: "Y", list: true, hide: true}, {name: "email", label: "Email", def: "", list: true}] }); */ Model.prototype.addRef = function(name, list) { this.refs.push({name: name, list: list}); }; Model.prototype.getId = function() { return (typeof this.id.val !== "undefined") ? this.id.val : this.id.def; }; Model.prototype.getString = function() { var n = this.cols.reduce(function(prev, curr) { return prev + ((curr.name === "name") ? curr.val : ""); }, ""); return n + " [" + this.id.name + "=" + this.id.val + "]"; }; Model.prototype.getEmpty = function() { var r = {}; r[this.id.name] = this.id.def; return r; }; Model.prototype.getNameList = function() { return this.cols .map(function(ele) { return ele.name; }) .join(", "); }; Model.prototype.getUpdateList = function() { return this.cols .map(function(ele) { return ele.name + "=?"; }) .join(", "); }; Model.prototype.getListList = function() { return this.cols .filter(function(ele) { return ele.list; }) .map(function(ele) { return ele.name; }) .join(", "); }; Model.prototype.loopLabelList = function(render) { this.cols .filter(function(ele) { return ele.list && ! ele.hide; }) .forEach(function(ele) { render(ele.label); }); } Model.prototype.getOrderBy = function() { return this.cols .filter(function(ele) { return ele.sort; }) .map(function(ele) { return ele.name + " " + ele.sort; }) .join(", "); }; Model.prototype.getWhere = function() { var wl = this.cols .filter(function(ele) { return ele.q; }) .map(function(ele) { return ele.name+" "+ele.q+" ?"; }) .join(" and "); return (wl.length === 0) ? "" : " where " + wl; }; Model.prototype.makeInsert = function() { var qs = this.cols.map(function(ele) { return "?"; }).join(","); return "insert into " + this.tableName + " (" + this.getNameList() + ") " + " values (" + qs + ")"; }; Model.prototype.makeUpdate = function() { return "update " + this.tableName + " set " + this.getUpdateList() + " where " + this.id.name + " = ?"; }; Model.prototype.makeSelect = function() { return "select " + this.id.name + "," + this.getNameList() + " from " + this.tableName + " where " + this.id.name + " = ?"; }; Model.prototype.makeDelete = function() { return "delete from " + this.tableName + " where " + this.id.name + " = ?"; }; Model.prototype.makeList = function() { return "select " + this.id.name + "," + this.getListList() + " from " + this.tableName + this.getWhere() + " order by " + this.getOrderBy(); }; Model.prototype.scrapeFrom = function() { var self = this; self.cols.forEach(function(ele) { ele.val = self.controller.getParam(ele.name, ele.def); if (Array.isArray(ele.val)) ele.val = ele.val.join(","); console.log("scraped: " + ele.name + " = " + ele.val); }); self.id.val = self.controller.getParam(self.id.name, self.id.def); console.log("scraped: " + self.getString()); }; Model.prototype.doDelete = function( theId, finish ) { var self = this; self.controller.query(self.makeDelete(), [theId], function(err, result) { if (err) { self.controller.feedBack(false, "Failed to delete the record " + theId + " from " + self.tableName); } else { self.controller.feedBack(true, "Successfully deleted a record " + theId + " from " + self.tableName); } finish(); }); }; Model.prototype.doSave = function( finish ) { var self = this; var values = self.cols.map(function(ele) { return ele.val; }); if (self.id.val === self.id.def) { // no id -> a new record -> insert console.log("query: " + self.makeInsert() + " <- " + values); self.controller.query(self.makeInsert(), values, function(err, result){ if (err) { console.log("error inserting into " + self.tableName + " -> " + err); self.controller.feedBack(true, "Error inserting a record in " + self.tableName); } else { self.id.val = result.insertId; console.log("generated id -> " + self.getString()); self.controller.feedBack(true, "Successfully a record in " + self.tableName); } finish(); }); } else { // an existing record -> update // add the id to the end of the list values.push(self.id.val); console.log("query: " + self.makeUpdate() + " <- " + values); self.controller.query(self.makeUpdate(), values, function(err, result){ if (err) { console.log("error updating " + self.tableName + ", record = " + self.getString() + " -> " + err); self.controller.feedBack(true, "Error updating the record = " + self.getString() + " in " + self.tableName); } else { self.controller.feedBack(true, "Successfully updated the record = " + self.getString() + " in " + self.tableName); } finish(); }); } }; Model.prototype.doGetRefs = function(finish) { var self = this; cody.Application.each(self.refs, function(done) { if (typeof this.list === "String") { // "list" is a string containing a query self.controller.query(this.list, [], function(err, results) { self.controller.context[this.name] = results; done(); }); } else { // "list" is an array containing the values self.controller.context[this.name] = this.list; done(); } }, finish); }; Model.prototype.doGet = function(theId, finish) { var self = this; self.doGetRefs( function() { if ((theId === undefined) || isNaN(theId) || (theId === self.id.def)) { self.controller.context.record = self.getEmpty(); self.id.val = self.id.def; finish(); } else { console.log("query: " + self.makeSelect() + " <- " + theId); self.controller.query(self.makeSelect(), [theId], function(err, result) { if (result.length > 0) { self.controller.context.record = result[0]; self.id.val = theId; } else { self.controller.context.record = self.getEmpty(); self.id.val = 0; } finish(); }); } }); }; Model.prototype.doList = function(finish) { var self = this; // get search params // - into "record" for reference in the template // - and into "q" for the query. var record = {}; var q = []; self.cols.forEach(function(ele) { console.log("dolist -> " + ele.name + " / " + ele.q); if (ele.q !== undefined) { // if this column has a q option set in the model ("like", "=", "<", ...) var val = self.controller.getParam("q."+ele.name, ele.def); // if the returned value is an array, we've got a multiple select form element // convert the returned array in a comma separated list if (Array.isArray(val)) { val = val.join("%"); } // remember the value in the "record" element, // perhaps it is displayed in the search result list record[ele.name] = val; // for "like"s we add % before and after, others should match exactly q.push((ele.q === "like") ? ("%" + val + "%") : val); } }); self.controller.context.record = record; console.log("made search params: " + q.join("|")); // fetch the list console.log("list records: " + q.join("|") + " -> " + self.makeList()); self.controller.query(self.makeList(), q, function(err, result) { if (err) { console.log("error searching for records " + self.tableName + ", search params = " + q.join("|") + " -> " + err); console.log("error searching, while using: " + self.makeList()); self.controller.feedBack(true, "Error searching for records in " + self.tableName); } else { self.controller.context.records = result; } self.doGetRefs(finish); }); }; ================================================ FILE: models/Page.js ================================================ // // Johan Coppieters - jan 2013 - jWorks // // console.log("loading " + module.id); var cody = require("./../index.js"); function Page(basis, app) { // copy from basis for (var a in basis) { if (basis.hasOwnProperty(a)) { this[a] = basis[a]; } } if (typeof this.item !== "undefined") { // replace 'item' (an id) by the real object and add 'itemId' this.itemId = this.item; this.item = app.getItem(this.itemId); if (typeof this.item === "undefined") { app.err("Application.fetchPages", "did not find item for page " + this.itemId + " / " + this.title); } } this.prefix = app.prefix; } module.exports = Page; Page.addDefaults = function(basis, item) { if (typeof item === "undefined") { item = {}; } basis.item = basis.item || item.id; basis.language = basis.language || cody.Application.kDefaultLanguage; basis.title = basis.title || item.name || cody.Item.kDefaultName; basis.created = basis.created || new Date(); basis.updated = basis.updated || new Date(); basis.link = basis.link || ""; basis.keywords = basis.keywords || ""; basis.description = basis.description || ""; basis.active = basis.active || "Y"; basis.content = basis.content || []; return basis; }; Page.loadPages = function(connection, store) { connection.query('select * from pages', [], function(err, result) { if (err) { console.log(err); throw(new Error("Page.loadPages failed with sql errors")); } store(result); }); }; Page.loadLanguages = function(connection, store) { connection.query('select * from languages order by sortorder', [], function(err, result) { if (err) { console.log(err); throw(new Error("Page.loadLanguages failed with sql errors")); } store(result); }); }; Page.prototype.addTo = function(app) { // add to the list of all pages app.pages.push(this); // build url with its unique id (no check needed) and store in the hashmap this.url = this.language + "/" + this.itemId; app.urls[this.url] = this; if (! this.setLink(this.link, app, true) ) { throw new Error("Application.fetchPages - double link: " + this.url); } }; Page.prototype.setLink = function(link, app, isNew) { // if we have a user defined link, store it in the url field as well in the app's url hashmap // delete the current link from the app's hashmap if (isNew !== true) { if ((typeof this.link !== "undefined") && (this.link !== "")) { delete app.urls[this.language + "/" + this.link]; } } if (link !== '') { // check if this link is not already used if (isNew === true) { if (app.urls[this.language + "/" + link]) { console.log("Page.setLink -> " + this.language + "/" + link + " already used"); return false; } } // replace the page its url by something better (than "language/id") var url = this.language + "/" + link; app.urls[url] = this; this.url = url; } this.link = link; return true; }; Page.prototype.addRoot = function() { var self = this; function goUp(aPage) { //console.log("goUp: " + aPage.item.id + " -> " + aPage.item.parentId); if (aPage.parent && (aPage.parent.item.parentId > 0)) { goUp(aPage.parent); } else { self.top = aPage; self.root = aPage.parent; //console.log("goUp: assigned for " + self.item.id + " -> top = " +self.top.item.id // ", root: " + ((self.root) ? self.root.item.id : "no root")); } } //console.log("AddRoot: " + this.itemId); goUp(this); }; Page.prototype.addChildren = function(list) { // loop through all pages and find pages having my parent id and language this.children = []; for (var i = 0; i < list.length; i++) { if ((list[i].item.parentId === this.itemId) && (list[i].language === this.language)) { // parent and language match -> add to my children this.children.push(list[i]); // this is done more than once... better solution? list[i].parent = this; } } if (this.children.length > 1) { this.sortChildren(this.item.orderby); // console.log("Page.addChildren -> sorted children of " + this.title + " -> " + this.item.orderby); // for(var i in this.children) console.log(" " + this.children[i].item.sortorder + ". " + this.children[i].title); } }; Page.prototype.sortChildren = function(order) { var kEqual = 0; // kBefore = -1, kAfter = 1; this.children.sort( function(a, b) { if (a === b) { return kEqual; } if (order === cody.Item.kAlphabetical) { return a.title.localeCompare(b.title); } if (order === cody.Item.kDate) { return b.item.dated.getTime() - a.item.dated.getTime(); } if (order === cody.Item.kManual) { return a.item.sortorder - b.item.sortorder; } console.log("Page.sortChildren -> We should't be here... orderby = " + order); return kEqual; }); }; Page.prototype.getController = function(context) { return (typeof this.item.template === "undefined") ? new Controller(context) : this.item.template.getController(context); }; Page.prototype.getView = function() { return (typeof this.item.template === "undefined") ? "index.ejs" : this.item.template.getView(); }; Page.prototype.getDisplay = function() { // check if this page is marked as: "show first subitem" if ((this.item.showcontent === cody.Item.kSubItem) && (this.children.length > 0)) { return this.children[0].getDisplay(); } else { return this; } }; Page.prototype.getLink = function() { // to be used for making URL when changing languages... /[language]/getLink() return (this.link != "") ? this.link : this.item.id; }; Page.prototype.getURL = function(language) { var prefix = this.prefix ? "/" + this.prefix : ""; // if the language is different from this page its language, // we actually return the url of another page (with the same item) if (typeof language !== "undefined") { return prefix + language + "/" + this.getLink(); } else { return prefix + this.url; } }; Page.prototype.shortString = function() { return this.title + " ("+ this.item.id + "/" + this.item.parentId + "), order = " + this.item.orderby + ", content = " + this.nrContent() + ", size = " + this.contentLength() + " bytes"; }; Page.prototype.needsLogin = function() { return (this.item) && (this.item.needslogin === "Y"); }; // // Tree interface requirements // Page.prototype.getAllowedDomains = function() { return this.item.getAllowedDomains(); }; Page.prototype.hasChildren = function() { return (this.children.length > 0); }; Page.prototype.isActive = function() { return (this.active === 'Y'); }; Page.prototype.isVisible = function() { var now = new Date(); return (this.active === 'Y') && (this.item.validfrom <= now) && (this.item.validto >= now); }; Page.prototype.hasBelow = function(p) { if (this === p) return true; for (var iP in this.children) { if (this.children[iP].hasBelow(p)) return true; } return false; } Page.prototype.getChildren = function() { return this.children; }; Page.prototype.getSortOrder = function() { return this.item.sortorder; }; Page.prototype.setSortOrder = function(nr) { this.item.sortorder = nr; }; Page.prototype.getName = function() { return this.title; }; Page.prototype.setName = function(name) { this.title = name; }; Page.prototype.getId = function() { return this.item.id; }; Page.prototype.getKind = function(kind) { var result = []; for (var ic in this.content) { if (this.content[ic].kind === kind) { result.push(this.content[ic]); } } return result; }; /* Page utilities */ Page.prototype.scrapeFrom = function(controller) { var self = this; // get all page info from the controller self.title = controller.getParam("title", self.title); self.active = controller.getParam("active", "N"); self.keywords = controller.getParam("keywords", ""); self.description = controller.getParam("description", ""); self.setLink(controller.getParam("link"), controller.app, false); // missing: updated (automatically on doUpdate), created (invariable), language (invariable) }; Page.prototype.doUpdate = function(controller, next, isNew) { var self = this; var values = [self.title, self.link, self.active, self.keywords, self.description, self.itemId, self.language]; // new or existing record? if (isNew) { // console.log("Page.doUpdate -> insert page " + self.title); controller.query("insert into pages (title, link, active, keywords, description , updated, created, item, language) " + "values (?, ?, ?, ?, ?, now(), now(), ?, ?)", values, function(err, result) { if (err) { console.log("Page.doUpdate -> error inserting page: " + self.language + "/" + self.itemId); console.log(err); } else { console.log("Page.doUpdate -> inserted page: " + self.language + "/" + self.itemId); self.created = self.updated = new Date(); } if (typeof next === "function") { next(); } }); } else { // console.log("Page.doUpdate -> update page " + self.itemId + " - " + self.title); controller.query("update pages set title = ?, link = ?, active = ?, keywords = ?, description = ?, updated = now() " + " where item = ? and language = ?", values, function(err) { if (err) { console.log("Page.doUpdate -> error updating page: " + self.language + "/" + self.itemId); console.log(err); } else { console.log("Page.doUpdate -> updated page: " + self.language + "/" + self.itemId); self.updated = new Date(); } if (typeof next === "function") { next(); } }); } }; Page.prototype.doDelete = function(controller, next) { var self = this; // should NOT be used !! console.log("ERROR: should not be used -- delete page " + self.language + "/" + this.item.id + " - " + this.title); controller.query("delete from pages where item = ? and language = ?", [self.itemId, self.language], function(err) { if (err) { console.log(err); } else { console.log("Page.doDelete -> deleted page: " + self.language + "/" + self.itemId); } if (typeof next === "function") { next(); } }); }; Page.prototype.doDeactivate = function(controller, next) { var self = this; console.log("Page.doDeactivate -> deactive page " + self.language + "/" + self.itemId + " - " + self.title); this.active = 'N'; controller.query("update pages set active = 'N' where item = ? and language = ?", [self.itemId, self.language], function(err) { if (err) { console.log(err); } else { console.log("Page.doDeactivate -> deactived page: " + self.language + "/" + self.itemId); } if (typeof next === "function") { next(); } }); }; /* Content stuff */ Page.prototype.render = function(params) { console.log("ERROR ** this seems to be so wrong??"); return this.content.render(params); } Page.prototype.getContent = function(id) { var i = -1; if (typeof id === "string") { i = this.getContentByName(id); } else { i = this.getContentIndex(id); } if (i >= 0) { return this.content[i]; } return undefined; }; Page.prototype.getContentByName = function(name) { for (var ic = 0; ic < this.content.length; ic++) { if (this.content[ic].name === name) { return ic; } } return -1; }; Page.prototype.getContentIndex = function(id) { for (var ic = 0; ic < this.content.length; ic++) { if (this.content[ic].id == id) { return ic; } } return -1; }; Page.prototype.nrContent = function() { return (typeof this.content !== "undefined") ? 0 : this.content.length; }; Page.prototype.contentLength = function() { if (typeof this.content === "undefined") { return 0; } var total = 0; this.content.forEach( function (c) { total += c.contentLength(); }); return total; }; Page.prototype.sortContent = function() { this.content.sort( function(a, b) { if (a.intro === b.intro) { return (a.sortorder - b.sortorder); } else if (a.intro === 'Y') { return -1; } else { return 1; } }); }; Page.prototype.loadContent = function(app, next) { this.fetchContent(app, this.language, this.itemId, next); }; Page.prototype.deleteContentById = function( controller, theId, next ) { var self = this; var i = self.getContentIndex(theId); if (i >= 0) { controller.query("delete from content where id=?", [theId], function(err) { if (err) { console.log(err); } else { self.content.splice(i, 1); console.log("Page.deleteContentById -> deleted content " + theId + ", on: " + i + ", of: " + self.language + "/" + self.itemId); } if (typeof next === "function") { next(); } }); } else { console.log("Page.deleteContentById: " + theId + " not found on " + self.language + "/" + self.itemId); if (typeof next === "function") { next(); } } }; Page.prototype.deleteContent = function( controller, next ) { var self = this; controller.query("delete from content where item=? and language=?", [self.itemId, self.language], function(err) { if (err) { console.log(err); } else { self.content = []; console.log("Page.deleteContent -> deleted all content of: " + self.language + "/" + self.itemId); if (typeof next === "function") { next(); } } }); }; Page.prototype.fetchContent = function( app, language, itemId, next ) { var self = this; var nrC = 1; var nrI = 1; app.connection.query( "select * from content where item = ? and language = ? order by intro desc, sortorder asc", [itemId, language], function(err, result) { if (err) { console.log(err); throw(new Error("Page.fetchContent failed with sql errors")); } self.content = []; console.log("Page.fetchContent, found " + result.length + " content blocks"); for (var i = 0; i < result.length; i++) { self.content[i] = new cody.Content(result[i], app); self.content[i].attachTo(self, itemId, language); if (self.content[i].name === "") { if (self.content[i].isIntro()) { self.content[i].name = ("Intro"+nrI); nrI++; } else { self.content[i].name = ("Content"+nrC); nrC++; } } console.log(" " + self.content[i].name + " = " + self.content[i].data.length + " bytes"); } if (typeof next === "function") { next(); } }); }; Page.prototype.updateContent = function( controller, finish ) { var self = this; cody.Application.each(self.content, function(next) { var aContent = this; aContent.scrapeFromWithId(controller); aContent.doUpdate(controller, false, next); }, function(err){ self.sortContent(); finish(); }); }; Page.prototype.adjustContent = function( controller, finish ) { var self = this; console.log("Page.adjustContent: add correct Content for " + self.itemId + " on template: " + (-1 * self.item.templateId)); var dummy = new Page({}, controller.app); dummy.fetchContent( controller.app, "*", -1 * self.item.templateId, function() { // used to be self.language instead of * // but then I decided that templates were language independent cody.Application.each(dummy.content, function(next) { var aContent = this; // only attach when no content block with this name exists if (self.getContent(aContent.name) === undefined) { self.content.push(aContent); aContent.attachTo(self, self.itemId, self.language); aContent.doUpdate(controller, true, next); } else { next(); } }, function(err){ self.sortContent(); finish(); }); }); }; Page.prototype.addContent = function( controller, theKind, finish ) { var self = this; console.log("Page.addContent: add " + theKind + " content for " + self.itemId); var aName = cody.Content.kindName(theKind); var aContent = new cody.Content({kind: theKind, name: aName}, controller.app); aContent.attachTo(self, self.itemId, self.language); self.content.push( aContent ); aContent.doUpdate(controller, true, function() { console.log("Page.addContent: added content id = " + aContent.id); finish(aContent.id); }); }; ================================================ FILE: models/Path.js ================================================ function Path( path, deflanguage ) { // eliminate leading "/" if(path.indexOf("/") === 0){ path = path.substring(1); } this.language = deflanguage; this.domain = ""; this.request = ""; this.id = ""; this.path = path; // language var i = path.indexOf("/"); if (i > 0 ) { this.language = path.substring(0, i); // domain or page link without the language path = path.substring(i+1); i = path.indexOf("/"); if (i <= 0) { this.domain = path; } else { this.domain = path.substring(0, i); // subdomain or request path = path.substring(i + 1); i = path.indexOf("/"); if (i <= 0) { this.request = path; } else { this.request = path.substring(0, i); // id path = path.substring(i + 1); i = path.indexOf("/"); this.id = (i > 0) ? path.substring(0, i) : path; } } } this.pagelink = this.language + "/" + this.domain; this.link = "/" + this.pagelink; // console.log(this); } module.exports = Path; ================================================ FILE: models/Template.js ================================================ // // Johan Coppieters - jan 2013 - jWorks // // var cody = require('./../index.js'); console.log("loading " + module.id); function Template(basis, controllers) { // copy from basis for (var a in basis) { if (basis.hasOwnProperty(a)) { this[a] = basis[a]; } } if (typeof basis.controller === "string") { this.findController(basis.controller, controllers); } this.fn = this.fn || "index.ejs"; this.allowedtemplates = this.allowedtemplates || this.id; //TODO: not yet implemented !! this.maxnumber = (isNaN(this.maxnumber)) ? 999 : this.maxnumber; //TODO: not yet implemented !! this.system = this.system || "N"; this.defaultchild = this.defaultchild || this.id ; this.description = this.description || ""; this.content = []; } module.exports = Template; Template.prototype.findController = function(aControllerName, controllers) { // find controller based on its name this.controllerName = aControllerName; this.controller = controllers[aControllerName]; if (typeof this.controller === "undefined") { console.log("Template.findController -> controllerName = " + aControllerName + " not found"); // if no controller found -> attach standard Controller this.controller = controllers['Controller']; } }; Template.loadTemplates = function(connection, store) { connection.query('select * from templates', [], function(err, result) { if (err) { console.log(err); throw(new Error("Template.loadTemplates failed with sql errors")); } store(result); }); }; Template.prototype.getController = function(context) { return new this.controller(context); }; Template.prototype.getView = function() { return this.fn; }; Template.prototype.scrapeFrom = function(controller) { this.name = controller.getParam("name", this.username); var aControllerName = controller.getParam("controller", this.controller); this.findController(aControllerName, controller.app.controllers); this.fn = controller.getParam("fn", this.fn); this.allowedtemplates = controller.getParam("allowedtemplates", this.allowedtemplates); this.maxnumber = controller.getParam("maxnumber", this.maxnumber || 9999); this.system = controller.getParam("system", this.system || "N"); this.defaultchild = controller.getParam("defaultchild", this.defaultchild); this.description = controller.getParam("description", this.description); }; Template.prototype.doDelete = function(controller, done) { var self = this; controller.query("delete from templates where id = ?", [self.id], done); }; Template.prototype.doUpdate = function(controller, finish) { var self = this; var values = [self.name, self.description, self.controllerName, self.fn, self.allowedtemplates, self.maxnumber, self.system, self.defaultchild]; // new or existing record if ((typeof self.id === "undefined") || (self.id === 0)) { console.log("insert template " + this.name); controller.query("insert into templates (name, description, controller, fn, allowedtemplates, maxnumber, system, defaultchild) " + "values (?, ?, ?, ?, ?, ?, ?, ?)", values, function(err, result) { if (err) { console.log(err); throw(new Error("Template.doUpdate/insert failed with sql errors")); } else { self.id = result.insertId; controller.app.templates[self.id] = self; console.log("inserted new template: " + self.id); if (typeof finish === "function") { finish(); } } }); } else { console.log("update template " + self.id + " - " + this.name); values.push(self.id); controller.query("update templates set name = ?, description = ?, controller = ?, fn = ?, " + " allowedtemplates = ?, maxnumber = ?, system = ?, defaultchild = ? " + "where id = ?", values, function(err) { if (err) { console.log(err); throw(new Error("Template.doUpdate/update failed with sql errors")); } else { controller.app.templates[self.id] = self; console.log("updated template: " + self.id); if (typeof finish === "function") { finish(); } } }); } }; // Content Stuff // Template.prototype.fetchContent = function(app, id, finish) { var self = this; // apply a page method to a template... sorry guys... cody.Page.prototype.fetchContent.call(self, app, "*", -1 * id, finish); }; Template.prototype.sortContent = function() { this.content.sort( function(a, b) { if (a.intro === b.intro) { return (a.sortorder - b.sortorder); } else if (a.intro === 'Y') { return -1; } else { return 1; } }); }; Template.prototype.updateContent = function( controller, finish ) { var self = this; cody.Application.each(self.content, function(next) { var aContent = this; aContent.scrapeFromWithId(controller); aContent.doUpdate(controller, false, next); }, function(err){ self.sortContent(); finish(); }); }; Template.prototype.addContent = function( controller, theId, theKind, finish ) { var self = this; var name = "New " + cody.Content.kindName(theKind); controller.query("insert into content (item,language,sortorder,intro,kind,atom,name,data) values (?, '*', 999, 'N', ?, 0, ?, '')", [-1 * theId, theKind, name], function(err) { // before template content was language independent the query was: // insert into content (item,language,sortorder,intro,kind,atom,name,data) select ?, id, 999, 'N', ?, 0, 'New Block', '' from languages console.log("inserted content with " + (-1 * theId) + " of kind " + theKind + ", error = ["+err+"]"); finish(); }); }; Template.prototype.copyContentFrom = function( controller, fromTemplate, finish ) { var self = this; controller.query("insert into content select 0,?,language,sortorder,intro,kind,atom,name,data from content a where a.item = ?", [-1 * self.id, -1 * fromTemplate], finish); }; Template.prototype.deleteAllContent = function( controller, finish ) { var self = this; controller.query("delete from content where item = ?", [-1 * self.id], finish); }; Template.prototype.deleteContent = function( controller, theContent, finish ) { var self = this; controller.query("delete from content where id = ?", [theContent], finish); }; ================================================ FILE: models/User.js ================================================ // // Johan Coppieters - mar 2013 - cody // // console.log("loading " + module.id); var cody = require("./../index.js"); function User(basis) { // copy from basis for (var a in basis) { if (basis.hasOwnProperty(a)) { this[a] = basis[a]; } } this.id = this.id || 0; this.maxbadlogins = this.maxbadlogins || 999; this.badlogins = this.badlogins || 0; this.level = this.level || 0; this.active = this.active || "N"; this.nomail = this.nomail || "N"; this.note = this.note || ""; this.sortorder = this.sortorder || 10; } module.exports = User; // // Class stuff // User.sqlGetUserByPw = "select * from users where username = ? and password = password2(?)"; User.sqlGetUserById = "select * from users where id = ?"; User.sqlDeleteUser = "delete from users where id = ?"; User.sqlGetUserList = "select * from users where level <= ? order by name"; User.sqlGetDomainList = "select distinct domain from users order by 1"; User.sqlAddBadLogin = "update users set badlogins = badlogins + 1 where username = ?"; User.sqlClearBadLogins = "update users set badlogins = 0 where username = ?"; User.sqlGetDomainList = "select distinct domain from users order by domain"; User.sqlGetLevelList = "select id, name from levels where id <= ? order by id"; User.getUsers = function(controller, level, store) { controller.query(User.sqlGetUserList, [level], function(err, result) { if (err) { console.log(err); throw(new Error("User.getUsers failed with sql errors")); } store(result); }); }; User.getDomains = function(controller, store) { controller.query(User.sqlGetDomainList, [], function(err, result) { if (err) { console.log(err); throw(new Error("User.getDomains failed with sql errors")); } store(result); }); }; User.getLevels = function(controller, level, store) { controller.query(User.sqlGetLevelList, [level], function(err, result) { if (err) { console.log(err); throw(new Error("User.getLevels failed with sql errors")); } store(result); }); }; User.getUser = function() { // either: // getUser(controller, username, password, store) // or // getUser(controller, id, store) var controller = arguments[0]; var store; if (arguments.length === 4) { store = arguments[3]; controller.query(User.sqlGetUserByPw, [arguments[1], arguments[2]], function(error, results) { if (error) { console.log(error); throw(new Error("User.getUser failed with sql errors")); } store(new User(results[0])); }); } else if (arguments.length === 3) { store = arguments[2]; controller.query(User.sqlGetUserById, [arguments[1]], function(error, results) { if (error) { console.log(error); throw(new Error("User.getUser failed with sql errors")); } store(new User(results[0])); }); } }; User.deleteUser = function(controller, id, finish) { controller.query(User.sqlDeleteUser, [id], function(error, results) { if (error) { console.log("User.deleteUser: error during delete of user with id = " + id); console.log(error); } else { console.log("deleted user id = " + id); } finish(typeof error === "undefined"); }); }; // // instance methods // User.prototype.getDomain = function() { return this.domain || ""; }; User.prototype.getLevel = function() { return this.level || 0; }; User.prototype.getId = function() { return this.id || 0; }; User.prototype.getSortOrder = function() { return this.sortorder || 10; }; User.prototype.getEmail = function() { return this.email || ""; }; User.prototype.isActive = function() { return (this.active) ? (this.active === "Y") : false; }; User.prototype.scrapeFrom = function(controller) { this.username = controller.getParam("username", this.username); this.password = controller.getParam("password", ""); this.name = controller.getParam("name", this.name); this.domain = controller.getParam("domain", this.domain); this.level = controller.getInt("level", this.level); this.email = controller.getParam("email", this.email); this.note = controller.getParam("note", this.note); this.nomail = controller.getParam("nomail", this.nomail); this.badlogins = controller.getParam("badlogins", this.badlogins); this.maxbadlogins = controller.getParam("maxbadlogins", this.maxbadlogins); this.active = controller.getParam("active", this.active); this.sortorder = controller.getParam("sortorder", this.sortorder); }; // not on prototype, no user object exists User.addBadLogin = function(controller, theUserName, finish) { controller.query(User.sqlAddBadLogin, [theUserName], finish); }; User.prototype.clearBadLogins = function(controller, finish) { var self = this; if (self.badlogins > 0) { controller.query(User.sqlClearBadLogins, [self.username], function(err, result) { if (err) { console.log(err); throw(new Error("User.clearBadLogins failed with sql errors")); } console.log("Cleared bad logins"); finish(); }); } else { // no need to access the database if there are no badLogins finish(); } }; User.prototype.doUpdate = function(controller, finish) { var self = this; var values = [self.username, self.name, self.domain, self.level, self.badlogins, self.maxbadlogins, self.active, self.email, self.note, self.nomail, self.sortorder]; // new or existing record if ((typeof self.id === "undefined") || (self.id === 0)) { console.log("insert user " + this.username); values.push(self.password); controller.query("insert into users (username, name, domain, level, badlogins, maxbadlogins, " + "active, email, note, nomail, sortorder, password) " + "values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, password2(?))", values, function(err, result) { if (err) { console.log(err); throw(new Error("User.doUpdate/insert failed with sql errors")); } else { self.id = result.insertId; console.log("inserted user: " + self.id); if (typeof finish === "function") { finish(); } } }); } else { console.log("update user " + self.id + " - " + this.username); values.push(self.id); controller.query("update users set username = ?, name = ?, domain = ?, level = ?, " + " badlogins = ?, maxbadlogins = ?, active = ?, email = ?, note = ?, nomail = ?, sortorder = ? " + "where id = ?", values, function(err) { if (err) { console.log(err); throw(new Error("User.doUpdate/update failed with sql errors")); } else { console.log("updated user: " + self.id); if (self.password != "") { controller.query("update users set password = password2(?) where id = ?", [self.password, self.id], function() { if (err) { console.log(err); throw(new Error("User.doUpdate/update PW failed with sql errors")); } console.log("updated password of " + self.id); if (typeof finish === "function") { finish(); } }); } else if (typeof finish === "function") { finish(); } } }); } }; User.prototype.doDelete = function(controller, finish) { var self = this; controller.query(User.sqlDeleteUser, [self.id], function(isOK) { if (typeof finish === "function") { finish(isOK); } }); }; User.emailExists = function (controller, email, finish) { controller.query("SELECT * FROM users WHERE email = ?", [email], function (err, rows) { if (err) return finish(err); finish(undefined, rows.length > 0); }); }; User.getByEmail = function (controller, email, finish) { controller.query("SELECT * FROM users WHERE email = ?", [email], function (err, rows) { if (err) return finish(err); if (rows.length > 0) { return finish(undefined, new User(rows[0])); } return finish(undefined, new User()); }); }; ================================================ FILE: models/Website.js ================================================ // // Johan Coppieters - may 2013 - cody // // console.log("loading " + module.id); var cody = require("../index.js"); ================================================ FILE: package.json ================================================ { "author": { "name": "Howest" }, "name": "cody", "description": "Cody CMS", "version": "4.0.15", "license": "MIT", "repository": { "type": "git", "url": "git+ssh://git@github.com/jcoppieters/cody.git" }, "scripts": { "pre-publish": "echo 'Update version in package.json & npm i -> package-lock.json; git commit / publish; git tag vx.y.z;'", "do-publish": "npm publish; git push; git push --tags", "upublish": "npm unpublish cody@4.0.14" }, "main": "./index", "keywords": [ "cody", "cms", "howest" ], "dependencies": { "body-parser": "^1.6.7", "ejs": "^3.1.10", "express": "4.x", "express-session": "1.x", "i18n": "^0.5.0", "mime": "1.x", "multer": "^1.4.5-lts.2", "mysql2": "^3.14.1", "nodemailer": "^7.0.2", "vhost": "2.x" }, "engines": { "node": "*" }, "readme": "Cody CMS\n\nFor documentation see: \n- https://github.com/jcoppieters/cody and/or \n- http://www.cody-cms.org\n\nContact us at johan.coppieters@howest.be\n\nThe Cody team.\n", "readmeFilename": "README.md" } ================================================ FILE: startWebApp.js ================================================ console.log("loading " + module.id); var cody = require("./index.js"); var express = require("express"); var vhost = require("vhost"); function startWebApp(mainServer, config, done) { console.log(" use: makeWebApp(pathname, sitedir, done);"); console.log(" done = function(app) {} "); console.log(" app = {host: [names], app: express, http: integer, https: integer, certificate: pathto }"); if (typeof config.name === "undefined") { console.log("startWebApp - missing name from config options"); return false; } console.log("\n======= starting " + config.name + " ======="); config.db = config.db || config.name; config.version = config.version || "v1.0"; config.controllers = config.controllers || []; config.datapath = config.datapath || "."; var app = new cody.Application(config); for (var iC in config.controllers) { if (config.controllers.hasOwnProperty(iC)) { var C = config.controllers[iC]; console.log("Adding controller: " + iC + " - " + C.constructor.name); app.addController(iC, C); } } app.init(function () { if ((config.hostnames !== undefined) && (config.hostnames !== "")) { var siteServer = express(); var prefix = config.prefix ? "/"+config.prefix : ""; for (var iL in app.languages) { // mysite.com/en/page siteServer.all(prefix + "/" + app.languages[iL].id + "/*", function (req, res) { app.servePage(req, res); }); // mysite.com/nl siteServer.all(prefix + "/" + app.languages[iL].id, function (req, res) { console.log("------------------------------------------------------------------- " + new Date() + "--"); console.log("-- redirecting to " + app.prefix + "/" + app.languages[iL].id + "/"); res.redirect(prefix + "/" + app.languages[iL].id + "/"); }); } // no language -> mysite.com siteServer.all(prefix + "/", function (req, res) { console.log("------------------------------------------------------------------- " + new Date() + "--"); console.log("-- redirecting to " + app.prefix + "/" + app.defaultlanguage + "/"); res.redirect(prefix + "/" + app.defaultlanguage + "/"); }); // mysite.com/static/file-path siteServer.get(prefix + "/static/*", function (req, res) { var fileserver = new cody.Static(req, res, config.name, app.prefix); fileserver.serve(); }); // mysite.com/data/[category]file-id.extension (standard "files" and "images") siteServer.get(prefix + "/data/*", function (req, res) { var fileserver = new cody.Dynamic(req, res, app.getDataPath(), app.prefix); fileserver.serve(); }); // mysite.com,www.mysite.com,mysite.be,... var hosts = config.hostnames.split(","); for (var iH in hosts) { mainServer.use(vhost(hosts[iH].trim(), siteServer)); console.log("======= started " + config.name + " on " + hosts[iH] + " =======\n"); } } else { console.log("Could not start app " + config.name + ": no vhost data"); } if (typeof done === "function") { done(); } }); } module.exports = startWebApp; ================================================ FILE: startserver.js ================================================ "use strict"; /** * Created by johan on 27/04/16. * * Should be in a directory 1 level up. */ var express = require("express"); var vhost = require("vhost"); var tls = require("tls"); var fs = require("fs"); // pass your own objects/apps or use cody.makeWebApp to generate them // apps should be an application object or an array of, each application object // should have // app [express application] // host [ string or array of strings ] // should have at least 1 of the 2 below // http [ portnumber for the http services ] // https [ portnumber for the https services ] // should have -if https port is specified- // certificate [ filename without extention of the key-pair ] /* startserver({ app: testApp, https: 443, host: "localhost", certificate: "mykey" }); or startserver([{...}, {...}]); or host: ["localhost", "www.mysite.com", ...] Cody production example: ------------------------ var cody = require("cody"); cody.makeWebApp(__dirname, "mysite", function(app) { console.log("Loaded mysite web app with config:", cody.config); startServer(app); }); // for multi site hosting, collect all app's in an array // and when all set up, pass the array to startServer. Cody development startup: ------------------------- var cody = require("cody"); cody.makeWebApp(__dirname, "mysite", "config-devel.json", function(app) { console.log("loaded mysite"); app.app.listen(app.http, function() { console.log("mysite listening on " + this.address().port); }); } */ // global express app, wrapping all other apps var exp; // global object containing for each domain the certificates var sites; // collected ports -> example = { 80: false, 443: true } var ports = {}; module.exports = function( apps ) { // make our global express app and an empty site list exp = express(); sites = []; if (apps instanceof Array) { for (let app of apps) { startApp(app); } } else { startApp(apps); } // get at least one listener var http = false; var https = false; for (let port in ports) { if (!ports[port]) http = true; if (ports[port]) https = true; } if (!http && !https) { http = true; ports[3000] = false; } console.log("==> ports:", ports); ////////// // http // ////////// if (http) { var httpFactory = require('http'); var httpServer = httpFactory.createServer(exp); // http ports are "false" for (let port in ports) if (! ports[port]) httpServer.listen(port, function () { console.log("Listening for http on port: " + this.address().port); }); } /////////// // https // /////////// if (https) { var secureOpts = { SNICallback: function (domain, cb) { if (typeof sites[domain] === "undefined") { cb(new Error("domain not found"), null); console.log("Error: domain not found: " + domain); } else { cb(null, sites[domain]); } } /* left out the default keys: key: fs.readFileSync('....key').toString(), cert: fs.readFileSync('....crt').toString() */ }; var httpsFactory = require('https'); var httpsServer = httpsFactory.createServer(secureOpts, exp); // https ports are "true" for (let port in ports) if (ports[port]) httpsServer.listen(port, function () { console.log("Listening https on port: " + this.address().port); console.log(" with certificates: ", sites); }); } }; function startApp( application ) { // collect extra portnumbers if (application.http && (typeof ports[application.http] === "undefined")) ports[application.http] = false; if (application.https && (typeof ports[application.https] === "undefined")) ports[application.https] = true; var certContext; // if the application has a certificate, create a tls credential context of it if ((application.certificate) && (application.certificate.length > 0)) { certContext = tls.createSecureContext({ key: fs.readFileSync(application.certificate + '.key').toString(), cert: fs.readFileSync(application.certificate + '.crt').toString() }).context; } // start the application for each (virtual) host if (application.host instanceof Array) { for (let host of application.host) { startHost( host, application.app, certContext ); } } else { startHost( application.host, application.app, certContext ); } } function startHost( host, app, certContext ) { console.log("added host " + host); exp.use(vhost(host, app)); if (certContext) { // if we have a credential context, add it to our hashmap console.log("added certificates for " + host); sites[host] = certContext; } } ================================================ FILE: static/css/cody.css ================================================ /* reset ------------------------------------------------------------------*/ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; vertical-align: baseline; background: transparent; } body { line-height: 1; } ol, ul { list-style: none; } blockquote, q { quotes: none; } blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; } /* remember to define focus styles! */ :focus { outline: 0; } /* remember to highlight inserts somehow! */ ins { text-decoration: none; } del { text-decoration: line-through; } /* tables still need 'cellspacing="0"' in the markup */ table { border-collapse: collapse; border-spacing: 0; } /* general Bkgnd: F4F4F4 Black: #333334 Grey: #9d9d9c Blue: #4d94cc Yellow: #fcc14e - as background color Yellow 40%: #fee6b8 - as highlighting Yellow text: #f3ad25 - as font color ------------------------------------------------------------------*/ body { background-color: #F4F4F4; color: #333334; font-family:"Trebuchet MS", Arial, Verdana; font-size: 12px; } h1 { margin: 0 0 15px; font-size: 14px; font-weight: bold; color: #414141; } h2 { margin: 0 0 15px; font-size: 12px; font-weight: bold; color: #414141; } h3 { margin: 2px 0 15px 0; font-size: 16px; font-weight: bold; color: #0D7FC6; } h4 {} h5 {} ul, ol { margin: 0 0 14px 0; } p, form { margin: 0 0 14px 0; } p { margin: 0 0 2px; padding: 0; font-size: 13px; color: #666; line-height: 15px; } a { color: #333334; text-decoration: none } a:hover { color: #333334; text-decoration: underline } a:visited { color: #333334 } input, textarea, select { font-size: 11px; font-family: Arial, sans-serif; color: #4F535C; margin-left: 0 } strong { font-weight: bold; color: #b63d94; } em { font-style: italic; } sup { font-size: 8px; vertical-align: super; } sub { font-size: 8px; vertical-align: sub; } .img_left { float: left; margin: 0 10px 10px 0; } .img_right { float: right; margin: 0 0 10px 10px; } .clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } .clearfix { display: inline-block; } /* Hide from IE Mac \*/ .clearfix { display: block; } /* End hide from IE Mac */ .odd { background-color: #f0f0f0; } .hidden { display: none; } .warning { clear: both; padding: 5px 10px; background: #fef9f9; border: 1px solid #f00; color: #f00; text-align: left; } body p.notification { margin-left: 2px; margin-right: 2px } /*-----------------------------------*/ p.notification { clear: both; margin: 5px 0 5px 0; padding: 10px 10px 10px 36px; border: 1px solid; background-position: 10px 11px !important; background-repeat: no-repeat !important; } p.success { border-color: #9adf8f; background: #d5ffce url(../images/icon_tick_circle.png); color: #556652; } p.error { border-color: #df8f8f; background: #ffcece url(../images/icon_cross_circle.png); color: #665252; } /*-----------------------------------*/ .ui-datepicker-trigger { vertical-align: top; margin-top: 2px; margin-left: 4px; } /* Page layout ------------------------------------------------------------------*/ body > section { width: 1000px; margin: 0 auto; } body > section > div { clear: both; margin: 10px 2px 0 2px } /* Top navigation ------------------------------------------------------------------*/ header { width: 100% } header > img { display: inline-block; border: none; margin: 7px 10px 7px 2px; vertical-align: top; height: 58px } header > span#breadcrumb { display: inline-block; font-size: 14px; font-weight: bold; margin: 32px 10px 10px 200px; vertical-align: top; color: #333334 } header > span#breadcrumb a { text-decoration: none; color: #4d94cc } header > span#breadcrumb a:visited { text-decoration: none } header > span#breadcrumb a:hover { text-decoration: underline } header > section { display: block; float: right; margin: 30px 4px 10px 10px; vertical-align: top; font-size: 14px; font-weight: bold } header > section > a { margin-left: 16px; } header > nav { clear: both; background-color: #333334; height: 24px; padding: 15px; margin: 0 2px 0 2px; } header > nav ul {} header > nav li { display: inline-block; margin: 6px 12px 4px 8px } header > nav a { color: white; font-size: 16px; font-weight: bold } header > nav a:hover { color: white; text-decoration: underline; } header > nav a:visited { color: white; } header > nav a.active { color: #f3ad25 } /* footer ------------------------------------------------------------------*/ footer { clear: both; width: 1000px; margin: 15px auto 0 auto; } footer #copyright { width: 400px; text-align: left; display: inline-block; margin-left: 2px; } footer #version { float: right; width: 200px; text-align: right; margin-right: 2px } /* dashboard layout ------------------------------------------------------------------*/ #dashboard nav { clear: both } #dashboard nav > section { vertical-align: top; background-color: white; border: 1px solid #CFCFCF; display: inline-block; width: 190px; padding: 8px ; margin: 12px 14px 5px 1px; box-shadow: 2px 2px 5px lightgrey; -moz-box-shadow: 2px 2px 5px lightgrey; -webkit-box-shadow: 2px 2px 5px lightgrey} #dashboard nav > section ul { list-style-type: circle; } #dashboard nav > section li { margin: 8px 2px 8px 22px; font-size: 14px } /* tree edit layout ------------------------------------------------------------------*/ #left_nav { width: 343px; display: inline-block; margin-top: 7px } #right_cont { display: inline-block; width: 645px; margin-top: 7px; vertical-align: top; box-shadow: 2px 2px 5px lightgrey; -moz-box-shadow: 2px 2px 5px lightgrey; -webkit-box-shadow: 2px 2px 5px lightgrey } /* tree manager ------------------------------------------------------------------*/ #tree { width: 322px; background: white; border: solid 1px #CFCFCF; margin: 0px 0 0 2px; box-shadow: 2px 2px 5px lightgrey; -moz-box-shadow: 2px 2px 5px lightgrey; -webkit-box-shadow: 2px 2px 5px lightgrey } body#images #tree, body#files #tree, body#forms #tree { margin-top: 10px } #tree.jstree li.deleted a { color: #BBB; } #tree.jstree > ul { margin: 0 0 8px 5px } #tree.jstree > ul > li { margin-top: 8px } #tree.jstree li.invisible a { color: #999; } #tree.jstree a.jstree-clicked { background: #fcc14e } #tree.jstree .jstree-hovered { background: #fee6b8; border: solid 1px #fee6b8 } #tree.jstree a { height: 18px; width: 90%; padding: 4px 2px 0 1px; border: solid 1px white } #tree.jstree a.jstree-hovered { padding: 4px 2px 0 1px } #tree.jstree li[rel=root] > a { font-size: 13px; color: #4d94cc; font-weight: bold } #tree.jstree li[rel=root] > a.jstree-clicked { border: solid 1px #fcc14e } /* item/page/content editor with "#right_cont" ------------------------------------------------------------------*/ label.kind { display: inline-block; width: 13px; height: 16px; text-align: center; vertical-align: top; border: 3px solid lightgrey; padding: 1px 4px 4px 6px; font-size: 16px; color: lightgrey; font-weight: bolder; } #block_selector { } #block_selector #stringlist { display: inline-block; margin: 22px 0px 0px 15px } #block_selector #stringlist a { margin: 0 } #block_selector div { margin: 12px } #block_selector img { vertical-align: top; } #block_selector a { color: #333334; font-weight: bolder; font-size: 13px; display: inline-block; vertical-align: top; margin: 7px 0 0 12px } #block_selector a:visited { color: #333334; } #block_selector a:hover { color: #4d94cc; } #template_selector { } #template_selector label { margin: 0 32px 0 4px; color: #333334; font-weight: bolder; font-size: 13px } #template_selector label:last-of-type { margin-right: 0 } #template_selector h3 { margin-top: 20px } #template_selector h3:first-child { margin-top: 10px } #template_selector > div { margin: 5px 0 7px 0 } #template_selector img { padding-top: 2px; vertical-align: top } #template_selector article { display: inline-block; width: 230px; vertical-align: top } #template_selector article a { margin: 5px 0px 0px 10px; color: #333334; font-weight: bolder; font-size: 13px; height: 19px; display: inline-block; vertical-align:top } #template_selector article a:visited { color: #333334; } #template_selector article a:hover { color: #4d94cc; } #template_selector article span { display: block; margin: 0px 0 2px 10px; padding: 0; font-size: 12px; color: #666;} #left_nav #ltabs { margin-top: 10px; padding: 0 } #left_nav #ltabs .ui-widget-header { border: none; background: none; background-color: #F4F4F4 } #left_nav #ltabs li.ui-state-default a, li.ui-state-default a:visited { color: #333334; cursor: pointer } #left_nav #ltabs li.ui-state-active a, li.ui-state-active a:visited { color: #f3ad25; cursor: pointer } #left_nav #ltabs li { border-color: #cccccc; } #content_div { border: 1px solid #ccc; background-color: rgb(240, 240, 238);} #content_div #content_buttons { margin: 5px; text-align: center; } #content_div { border: 1px solid #ccc; background-color: rgb(240, 240, 238);} #content_div textarea { width: 798px; } #content_div tr.mceLast { display: none } #content_data { background: white; border: solid 1px #cfcfcf; margin: 2px 0 0 2px } #content_data form { } #content_data section { margin: 10px; } #content_data section > div { margin: 10px 5px 5px 8px; } #content_data section button { margin-top: -1px; height: 25px } #content_data > div { margin: 10px 5px 5px 8px; border: 1px solid #cfcfcf; } #content_data input { font-size: 13px; height: 19px; line-height: 22px } #content_data label { font-size: 13px; height: 19px; line-height: 22px; margin-bottom: 4px; color: #4d94cc; font-weight: bolder; } #content_data #preview { max-width: 440px; box-shadow: 4px 4px 7px lightgrey; border: solid 1px darkgrey; -moz-box-shadow: 4px 4px 7px lightgrey; -webkit-box-shadow: 4px 4px 7px lightgrey; } #content_data label[for=title] { display: block; text-align: left; float: none; } #content_data #tabs { margin: 5px 17px 5px 14px; border-radius: 0; } body#images #content_data #tabs, body#files #content_data #tabs, body#forms #content_data #tabs { margin-top: 16px } #content_data #tabs > div { padding: 5px 5px 5px 5px; margin: 0px 0 0 2px; border: solid 1px #cfcfcf } #content_data #tabs .ui-widget-header { border: none; background: none; background-color: #F4F4F4 } #content_data #tabs.ui-widget-content { background: none; background-color: white } #content_data #tabs li.ui-state-default a, li.ui-state-default a:visited { color: #333334 } #content_data #tabs li.ui-state-active a, li.ui-state-active a:visited { color: #f3ad25 } #content_data #tabs li { border-color: #cccccc; } #content_data #content {} #content_data #content #contentButtons { border: none; margin: 5px 0 5px 0; padding-left: 0px } #content_data #content article { border: solid 1px #cfcfcf; margin: 5px 2px 18px 2px; padding: 5px; width: 575px; height: 55px; border-radius: 3px; -moz-border-radius: 5px; border-radius: 5px; box-shadow: 2px 2px 5px lightgrey; -moz-box-shadow: 2px 2px 5px lightgrey; -webkit-box-shadow: 2px 2px 5px lightgrey; background-color: white } #content_data #content h4 { margin: 10px 0 10px 3px; color: #4d94cc } #content_data #content article > img { display: inline-block; box-shadow: 1px 1px 5px grey; margin: 16px 0 0 8px; vertical-align: top } #content_data #content article > div.actions { display: inline-block; vertical-align:top; margin-top: 14px; float: right } #content_data #content article > div.actions > span { display: inline-block; margin-left: 5px; background-image: url(ui-lightness/images/ui-icons_ef8c08_256x240.png) } #content_data #content article > div > h5 { display: inline-block; width: 340px; margin: 2px 0 2px 8px; font-size: 12px } #content_data #content article > div.input { vertical-align:top; display: inline-block; width: 410px } #content_data #content article > div.input > textarea { display: inline-block; width: 400px; overflow: hidden; height: 30px; border-color: #cfcfcf; margin-left: 8px } #content_data #content article > div.input > select { display: inline-block; margin: 20px 0 0 8px } #content_data #content article > div.inputE { vertical-align:top; display: inline-block; width: 340px } #content_data #content article > div.inputE > ul { z-index: 999; position: relative } #content_data #content article > div.inputE .ui-menu { width: 150px } #content_data #content article > div.inputE > img { vertical-align: top; box-shadow: 1px 1px 5px grey; height: 50px; margin: 2px 0 0 8px; } #content_data #content article > div.inputE > img.icon { box-shadow: none; height: 16px; margin: 20px 0 0 8px; } #content_data #content article > div.inputE > span { margin: 22px 0 0 6px; overflow: hidden; display: inline-block; width: 200px } #content_data #content article > div.inputE > p { margin: 6px 0 0 8px; display: inline-block; width: 330px; overflow: hidden; height: 45px } #content_data #seo { } #content_data #seo div { margin: 10px 0 10px 4px } #content_data #seo label { width: 80px; vertical-align: top; display: inline-block } #content_data #seo input { width: 300px; vertical-align: top; display: inline-block } #content_data #seo textarea { width: 390px; vertical-align: top; display: inline-block } #content_data #seo span { font-size: 13px; margin-top: 5px; display: inline-block } #content_data #options { } #content_data #options div { margin: 10px 0 10px 4px } #content_data #options label { margin-left: 16px; width: 80px; vertical-align: top; display: inline-block; text-align: right } #content_data #options label:first-child { margin: 0; width: 115px; text-align: left } #content_data #options label[for=validto] { width: 18px } #content_data #options input[type=text] { width: 300px; vertical-align: top; display: inline-block } #content_data #options textarea { border: solid 1px #c0c0c0; width: 300px; } #content_data #options input[type=text].dater { width: 90px; } #content_data #options input[type=checkbox] { margin-top: 0px } #content_data #options span { font-size: 13px; margin-top: 5px; display: inline-block } #content_data #options label { width: 80px; vertical-align: top; display: inline-block } #content_data #options p { display: inline-block; } #content_data #options .filelink { display: inline-block; vertical-align: top; margin-top: 5px } #content_data #options div.radios { margin: 0; display: inline-block } #content_data #options div.radios label { width: inherit; display: inline-block; margin: 0 20px 0 0 } #content_data #options div.radios input[type=radio] { margin-top: 1px; } #content_data #options div label.language { color: #f3ad25 } #content_data #action_buttons { margin: 15px 17px 5px 15px } #content_data #action_buttons span#last_modif { margin:10px 2px 0 0 ; float: right; display: inline-block } /* back office tables + edit forms ------------------------------------------------------------------*/ #records { border-collapse:collapse; text-align: left; margin: 8px 0px 2px 0px; width: 100%; box-shadow: 2px 2px 5px lightgrey; -moz-box-shadow: 2px 2px 5px lightgrey; -webkit-box-shadow: 2px 2px 5px lightgrey } #records th { background-color: #99defd; border: solid 1px #cfcfcf; padding: 6px; } #records td { background-color: white; border: solid 1px #cfcfcf; padding: 6px 4px 10px 6px } #records .right { text-align: right } #records .center { text-align: center } #records td a, #records td a:visited { color: #333334; } #records td a:hover { color: #4d94cc; } #records td.edit span { background-position: -64px -112px; background-image: url(ui-lightness/images/ui-icons_ef8c08_256x240.png); width: 16px; height: 16px; display: inline-block; vertical-align: bottom; margin: 0px 4px -1px 0; } #record { background-color: white; border: solid 1px #cfcfcf; padding: 8px; box-shadow: 2px 2px 5px lightgrey; -moz-box-shadow: 2px 2px 5px lightgrey; -webkit-box-shadow: 2px 2px 5px lightgrey } #record label:first-child { width: 100px; margin-left: 0 } #record label { width: 80px; vertical-align: top; display: inline-block; color: #4d94cc; font-weight: bolder; text-align: left; margin: 5px 0 0 20px } #record label.choice { width: inherit; margin-left: 2px; margin-right: 10px; color: inherit; font-weight: normal } #record textarea { width: 300px; height: 24px; vertical-align: top; display: inline-block; border-color: #cfcfcf } #record input[type=text] { width: 300px; vertical-align: top; display: inline-block } #record input.number { width: 20px; } #record input#domain { width: 100px } #record select#domains { width: inherit } #record fieldset > div { margin: 10px } #record #action_buttons { margin: 15px 11px 0px 11px; border-top: solid 1px #cfcfcf; padding: 11px 0 6px 0;} #record fieldset div > span { margin-top: 5px; margin-left: 3px; display: inline-block } #record label.error { color: red; width: inherit } /* Templates ------------------------------------------------------------------*/ #templates fieldset { vertical-align: top; display: inline-block } #templates fieldset#left { width: 470px; border-right: solid 1px #cfcfcf; margin-right: 20px; } #templates fieldset#right { width: 480px } #templates fieldset#right > div.actions { margin: 15px 11px 0px 0px; border-top: solid 1px #cfcfcf; padding: 11px 0px 6px 0px } #templates fieldset#right > div h4 { margin: 12px 0px 6px 0 } #templates fieldset#right article * { vertical-align: top } #templates fieldset#right article span.mover { display: inline-block; margin: 6px 0 0 5px; background-image: url(ui-lightness/images/ui-icons_ef8c08_256x240.png) } #templates fieldset#right article input { margin: 6px 12px 0 6px; width: 270px } #templates fieldset#right article img { margin-top: 2px } /* login - NOT OK ------------------------------------------------------------------*/ nav h1#logintitle { color: white } #login h1 { width: 505px; margin: 0; padding: 170px 295px 10px 0; color: #fff; text-align: right; font-size: 24px; } #logon { width: 300px; padding: 7px 295px 30px 50px; text-align: right; } #logon fieldset { float: none; width: 255px; } #logon fieldset div { padding-bottom: 5px; } #logon .action_buttons { margin-left: 120px; text-align: left } #logon .action_buttons input { width: 69px; height: 24px; border: 0; color: #fff; font-size: 13px; font-weight: bold; font-family: Verdana, Arial, sans-serif; cursor: pointer; } /* Data from forms ------------------------------------------------------------------*/ #data table { width: 100% } #data table th { font-weight: bold; text-align: left; padding: 6px 6px 4px 6px } #data table td { font-weight: normal; text-align: left; padding: 4px 6px 4px 6px } #data table tr:nth-child(even) { background-color: #e9e9e9 } #data table tr:hover td { background-color: lightgrey; cursor: pointer; } #data table td.date { width: 70px } #data table td.status { width: 35px } #data #record label { margin-top: 1px; } #data form#formdata { margin: 0px; border: solid 1px #c0c0c0; padding: 10px } #data form#formdata #action_buttons { border-top: solid 1px #c0c0c0; padding: 10px 0 0 156px; } #data form#formdata #action_buttons button { margin-right: 10px } #data form#formdata fieldset { border: none; padding: 0; margin: 0 } #data form#formdata fieldset > div { margin: 10px 0 15px 0 } #data form#formdata fieldset > div > label { display: inline-block; width: 160px; text-align: right; padding: 0 13px 0 0; font-weight: bold; vertical-align: top; line-height: 24px } #data form#formdata fieldset > div > label.error { text-align: left; padding: 0 0 0 213px; color: red; display: block; width: inherit } #data form#formdata fieldset > div > input.error, #data form#formdata fieldset > div > textarea.error { border: 1px solid red } #data form#formdata fieldset > div > input[type=text], #data form#formdata fieldset > div > textarea { width: 400px } #data form#formdata fieldset > div > input[type=text].number { width: 70px } #data form#formdata fieldset > div > div { display: inline-block; } #data form#formdata fieldset > div > div > label { display: inline-block; margin: 0 20px 0 7px; vertical-align: top; color: black; line-height: 24px } #data form#formdata fieldset > div > div > input { vertical-align: baseline; } #data form#formdata fieldset strong { color: black } #data form#formdata fieldset div#info { margin-top: -10px } #data form#formdata fieldset div#info div { padding-top: 6px } ================================================ FILE: static/css/ui-lightness/jquery-ui-1.10.1.css ================================================ /*! jQuery UI - v1.10.1 - 2013-03-04 * http://jqueryui.com * Includes: jquery.ui.core.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS%2CTahoma%2CVerdana%2CArial%2Csans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=gloss_wave&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=highlight_soft&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=glass&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=glass&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=highlight_soft&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=diagonals_thick&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=diagonals_thick&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=flat&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px * Copyright (c) 2013 jQuery Foundation and other contributors Licensed MIT */ /* Layout helpers ----------------------------------*/ .ui-helper-hidden { display: none; } .ui-helper-hidden-accessible { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; } .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } .ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; border-collapse: collapse; } .ui-helper-clearfix:after { clear: both; } .ui-helper-clearfix { min-height: 0; /* support: IE7 */ } .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } .ui-front { z-index: 100; } /* Interaction Cues ----------------------------------*/ .ui-state-disabled { cursor: default !important; } /* Icons ----------------------------------*/ /* states and images */ .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } /* Misc visuals ----------------------------------*/ /* Overlays */ .ui-widget-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; } .ui-resizable { position: relative; } .ui-resizable-handle { position: absolute; font-size: 0.1px; display: block; } .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px; } .ui-selectable-helper { position: absolute; z-index: 100; border: 1px dotted black; } .ui-accordion .ui-accordion-header { display: block; cursor: pointer; position: relative; margin-top: 2px; padding: .5em .5em .5em .7em; min-height: 0; /* support: IE7 */ } .ui-accordion .ui-accordion-icons { padding-left: 2.2em; } .ui-accordion .ui-accordion-noicons { padding-left: .7em; } .ui-accordion .ui-accordion-icons .ui-accordion-icons { padding-left: 2.2em; } .ui-accordion .ui-accordion-header .ui-accordion-header-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; overflow: auto; } .ui-autocomplete { position: absolute; top: 0; left: 0; cursor: default; } .ui-button { display: inline-block; position: relative; padding: 0; line-height: normal; margin-right: .1em; cursor: pointer; vertical-align: middle; text-align: center; overflow: visible; /* removes extra width in IE */ } .ui-button, .ui-button:link, .ui-button:visited, .ui-button:hover, .ui-button:active { text-decoration: none; } /* to make room for the icon, a width needs to be set here */ .ui-button-icon-only { width: 2.2em; } /* button elements seem to need a little more width */ button.ui-button-icon-only { width: 2.4em; } .ui-button-icons-only { width: 3.4em; } button.ui-button-icons-only { width: 3.7em; } /* button text element */ .ui-button .ui-button-text { display: block; line-height: normal; } .ui-button-text-only .ui-button-text { padding: .4em 1em; } .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } .ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } .ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } .ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } /* no icon support for input elements, provide padding by default */ input.ui-button { padding: .4em 1em; } /* button icon element(s) */ .ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } .ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; } .ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } /* button sets */ .ui-buttonset { margin-right: 7px; } .ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; } /* workarounds */ /* reset extra padding in Firefox, see h5bp.com/l */ input.ui-button::-moz-focus-inner, button.ui-button::-moz-focus-inner { border: 0; padding: 0; } .ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; } .ui-datepicker .ui-datepicker-header { position: relative; padding: .2em 0; } .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position: absolute; top: 2px; width: 1.8em; height: 1.8em; } .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } .ui-datepicker .ui-datepicker-prev { left: 2px; } .ui-datepicker .ui-datepicker-next { right: 2px; } .ui-datepicker .ui-datepicker-prev-hover { left: 1px; } .ui-datepicker .ui-datepicker-next-hover { right: 1px; } .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } .ui-datepicker .ui-datepicker-title select { font-size: 1em; margin: 1px 0; } .ui-datepicker select.ui-datepicker-month-year { width: 100%; } .ui-datepicker select.ui-datepicker-month, .ui-datepicker select.ui-datepicker-year { width: 49%; } .ui-datepicker table { width: 100%; font-size: .9em; border-collapse: collapse; margin: 0 0 .4em; } .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } .ui-datepicker td { border: 0; padding: 1px; } .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding: 0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width: auto; overflow: visible; } .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float: left; } /* with multiple calendars */ .ui-datepicker.ui-datepicker-multi { width: auto; } .ui-datepicker-multi .ui-datepicker-group { float: left; } .ui-datepicker-multi .ui-datepicker-group table { width: 95%; margin: 0 auto .4em; } .ui-datepicker-multi-2 .ui-datepicker-group { width: 50%; } .ui-datepicker-multi-3 .ui-datepicker-group { width: 33.3%; } .ui-datepicker-multi-4 .ui-datepicker-group { width: 25%; } .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header, .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width: 0; } .ui-datepicker-multi .ui-datepicker-buttonpane { clear: left; } .ui-datepicker-row-break { clear: both; width: 100%; font-size: 0; } /* RTL support */ .ui-datepicker-rtl { direction: rtl; } .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } .ui-datepicker-rtl .ui-datepicker-buttonpane { clear: right; } .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current, .ui-datepicker-rtl .ui-datepicker-group { float: right; } .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header, .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width: 0; border-left-width: 1px; } .ui-dialog { position: absolute; top: 0; left: 0; padding: .2em; outline: 0; } .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; } .ui-dialog .ui-dialog-title { float: left; margin: .1em 0; white-space: nowrap; width: 90%; overflow: hidden; text-overflow: ellipsis; } .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 21px; margin: -10px 0 0 0; padding: 1px; height: 20px; } .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; } .ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin-top: .5em; padding: .3em 1em .5em .4em; } .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } .ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } .ui-dialog .ui-resizable-se { width: 12px; height: 12px; right: -5px; bottom: -5px; background-position: 16px 16px; } .ui-draggable .ui-dialog-titlebar { cursor: move; } .ui-menu { list-style: none; padding: 2px; margin: 0; display: block; outline: none; } .ui-menu .ui-menu { margin-top: -3px; position: absolute; } .ui-menu .ui-menu-item { margin: 0; padding: 0; width: 100%; } .ui-menu .ui-menu-divider { margin: 5px -2px 5px -2px; height: 0; font-size: 0; line-height: 0; border-width: 1px 0 0 0; } .ui-menu .ui-menu-item a { text-decoration: none; display: block; padding: 2px .4em; line-height: 1.5; min-height: 0; /* support: IE7 */ font-weight: normal; } .ui-menu .ui-menu-item a.ui-state-focus, .ui-menu .ui-menu-item a.ui-state-active { font-weight: normal; margin: -1px; } .ui-menu .ui-state-disabled { font-weight: normal; margin: .4em 0 .2em; line-height: 1.5; } .ui-menu .ui-state-disabled a { cursor: default; } /* icon support */ .ui-menu-icons { position: relative; } .ui-menu-icons .ui-menu-item a { position: relative; padding-left: 2em; } /* left-aligned */ .ui-menu .ui-icon { position: absolute; top: .2em; left: .2em; } /* right-aligned */ .ui-menu .ui-menu-icon { position: static; float: right; } .ui-progressbar { height: 2em; text-align: left; overflow: hidden; } .ui-progressbar .ui-progressbar-value { margin: -1px; height: 100%; } .ui-progressbar .ui-progressbar-overlay { background: url("images/animated-overlay.gif"); height: 100%; filter: alpha(opacity=25); opacity: 0.25; } .ui-progressbar-indeterminate .ui-progressbar-value { background-image: none; } .ui-slider { position: relative; text-align: left; } .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } /* For IE8 - See #6727 */ .ui-slider.ui-state-disabled .ui-slider-handle, .ui-slider.ui-state-disabled .ui-slider-range { filter: inherit; } .ui-slider-horizontal { height: .8em; } .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } .ui-slider-horizontal .ui-slider-range-min { left: 0; } .ui-slider-horizontal .ui-slider-range-max { right: 0; } .ui-slider-vertical { width: .8em; height: 100px; } .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } .ui-slider-vertical .ui-slider-range-min { bottom: 0; } .ui-slider-vertical .ui-slider-range-max { top: 0; } .ui-spinner { position: relative; display: inline-block; overflow: hidden; padding: 0; vertical-align: middle; } .ui-spinner-input { border: none; background: none; color: inherit; padding: 0; margin: .2em 0; vertical-align: middle; margin-left: .4em; margin-right: 22px; } .ui-spinner-button { width: 16px; height: 50%; font-size: .5em; padding: 0; margin: 0; text-align: center; position: absolute; cursor: default; display: block; overflow: hidden; right: 0; } /* more specificity required here to overide default borders */ .ui-spinner a.ui-spinner-button { border-top: none; border-bottom: none; border-right: none; } /* vertical centre icon */ .ui-spinner .ui-icon { position: absolute; margin-top: -8px; top: 50%; left: 0; } .ui-spinner-up { top: 0; } .ui-spinner-down { bottom: 0; } /* TR overrides */ .ui-spinner .ui-icon-triangle-1-s { /* need to fix icons sprite */ background-position: -65px -16px; } .ui-tabs { position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ padding: .2em; } .ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } .ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 0; margin: 1px .2em 0 0; border-bottom: 0; padding: 0; white-space: nowrap; } .ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } .ui-tabs .ui-tabs-nav li.ui-tabs-active { margin-bottom: -1px; padding-bottom: 1px; } .ui-tabs .ui-tabs-nav li.ui-tabs-active a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-tabs-loading a { cursor: text; } .ui-tabs .ui-tabs-nav li a, /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ .ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active a { cursor: pointer; } .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } .ui-tooltip { padding: 8px; position: absolute; z-index: 9999; max-width: 300px; -webkit-box-shadow: 0 0 5px #aaa; box-shadow: 0 0 5px #aaa; } body .ui-tooltip { border-width: 2px; } /* Component containers ----------------------------------*/ .ui-widget { font-family: Trebuchet MS,Tahoma,Verdana,Arial,sans-serif; font-size: 1.1em; } .ui-widget .ui-widget { font-size: 1em; } .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS,Tahoma,Verdana,Arial,sans-serif; font-size: 1em; } .ui-widget-content { border: 1px solid #dddddd; background: #eeeeee url(images/ui-bg_highlight-soft_100_eeeeee_1x100.png) 50% top repeat-x; color: #333333; } .ui-widget-content a { color: #333333; } .ui-widget-header { border: 1px solid #e78f08; background: #f6a828 url(images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; } .ui-widget-header a { color: #ffffff; } /* Interaction states ----------------------------------*/ .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 url(images/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1c94c4; } .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; } .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #fbcb09; background: #fdf5ce url(images/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #c77405; } .ui-state-hover a, .ui-state-hover a:hover, .ui-state-hover a:link, .ui-state-hover a:visited { color: #c77405; text-decoration: none; } .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #fbd850; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #eb8f00; } .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; text-decoration: none; } /* Interaction Cues ----------------------------------*/ .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight { border: 1px solid #fed22f; background: #ffe45c url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; } .ui-state-highlight a, .ui-widget-content .ui-state-highlight a, .ui-widget-header .ui-state-highlight a { color: #363636; } .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error { border: 1px solid #cd0a0a; background: #b81900 url(images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; } .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; } .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; } .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } .ui-state-disabled .ui-icon { filter:Alpha(Opacity=35); /* For IE8 - See #6059 */ } /* Icons ----------------------------------*/ /* states and images */ .ui-icon { width: 16px; height: 16px; background-position: 16px 16px; } .ui-icon, .ui-widget-content .ui-icon { background-image: url(images/ui-icons_222222_256x240.png); } .ui-widget-header .ui-icon { background-image: url(images/ui-icons_ffffff_256x240.png); } .ui-state-default .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); } .ui-state-hover .ui-icon, .ui-state-focus .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); } .ui-state-active .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); } .ui-state-highlight .ui-icon { background-image: url(images/ui-icons_228ef1_256x240.png); } .ui-state-error .ui-icon, .ui-state-error-text .ui-icon { background-image: url(images/ui-icons_ffd27a_256x240.png); } /* positioning */ .ui-icon-carat-1-n { background-position: 0 0; } .ui-icon-carat-1-ne { background-position: -16px 0; } .ui-icon-carat-1-e { background-position: -32px 0; } .ui-icon-carat-1-se { background-position: -48px 0; } .ui-icon-carat-1-s { background-position: -64px 0; } .ui-icon-carat-1-sw { background-position: -80px 0; } .ui-icon-carat-1-w { background-position: -96px 0; } .ui-icon-carat-1-nw { background-position: -112px 0; } .ui-icon-carat-2-n-s { background-position: -128px 0; } .ui-icon-carat-2-e-w { background-position: -144px 0; } .ui-icon-triangle-1-n { background-position: 0 -16px; } .ui-icon-triangle-1-ne { background-position: -16px -16px; } .ui-icon-triangle-1-e { background-position: -32px -16px; } .ui-icon-triangle-1-se { background-position: -48px -16px; } .ui-icon-triangle-1-s { background-position: -64px -16px; } .ui-icon-triangle-1-sw { background-position: -80px -16px; } .ui-icon-triangle-1-w { background-position: -96px -16px; } .ui-icon-triangle-1-nw { background-position: -112px -16px; } .ui-icon-triangle-2-n-s { background-position: -128px -16px; } .ui-icon-triangle-2-e-w { background-position: -144px -16px; } .ui-icon-arrow-1-n { background-position: 0 -32px; } .ui-icon-arrow-1-ne { background-position: -16px -32px; } .ui-icon-arrow-1-e { background-position: -32px -32px; } .ui-icon-arrow-1-se { background-position: -48px -32px; } .ui-icon-arrow-1-s { background-position: -64px -32px; } .ui-icon-arrow-1-sw { background-position: -80px -32px; } .ui-icon-arrow-1-w { background-position: -96px -32px; } .ui-icon-arrow-1-nw { background-position: -112px -32px; } .ui-icon-arrow-2-n-s { background-position: -128px -32px; } .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } .ui-icon-arrow-2-e-w { background-position: -160px -32px; } .ui-icon-arrow-2-se-nw { background-position: -176px -32px; } .ui-icon-arrowstop-1-n { background-position: -192px -32px; } .ui-icon-arrowstop-1-e { background-position: -208px -32px; } .ui-icon-arrowstop-1-s { background-position: -224px -32px; } .ui-icon-arrowstop-1-w { background-position: -240px -32px; } .ui-icon-arrowthick-1-n { background-position: 0 -48px; } .ui-icon-arrowthick-1-ne { background-position: -16px -48px; } .ui-icon-arrowthick-1-e { background-position: -32px -48px; } .ui-icon-arrowthick-1-se { background-position: -48px -48px; } .ui-icon-arrowthick-1-s { background-position: -64px -48px; } .ui-icon-arrowthick-1-sw { background-position: -80px -48px; } .ui-icon-arrowthick-1-w { background-position: -96px -48px; } .ui-icon-arrowthick-1-nw { background-position: -112px -48px; } .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } .ui-icon-arrowreturn-1-w { background-position: -64px -64px; } .ui-icon-arrowreturn-1-n { background-position: -80px -64px; } .ui-icon-arrowreturn-1-e { background-position: -96px -64px; } .ui-icon-arrowreturn-1-s { background-position: -112px -64px; } .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } .ui-icon-arrow-4 { background-position: 0 -80px; } .ui-icon-arrow-4-diag { background-position: -16px -80px; } .ui-icon-extlink { background-position: -32px -80px; } .ui-icon-newwin { background-position: -48px -80px; } .ui-icon-refresh { background-position: -64px -80px; } .ui-icon-shuffle { background-position: -80px -80px; } .ui-icon-transfer-e-w { background-position: -96px -80px; } .ui-icon-transferthick-e-w { background-position: -112px -80px; } .ui-icon-folder-collapsed { background-position: 0 -96px; } .ui-icon-folder-open { background-position: -16px -96px; } .ui-icon-document { background-position: -32px -96px; } .ui-icon-document-b { background-position: -48px -96px; } .ui-icon-note { background-position: -64px -96px; } .ui-icon-mail-closed { background-position: -80px -96px; } .ui-icon-mail-open { background-position: -96px -96px; } .ui-icon-suitcase { background-position: -112px -96px; } .ui-icon-comment { background-position: -128px -96px; } .ui-icon-person { background-position: -144px -96px; } .ui-icon-print { background-position: -160px -96px; } .ui-icon-trash { background-position: -176px -96px; } .ui-icon-locked { background-position: -192px -96px; } .ui-icon-unlocked { background-position: -208px -96px; } .ui-icon-bookmark { background-position: -224px -96px; } .ui-icon-tag { background-position: -240px -96px; } .ui-icon-home { background-position: 0 -112px; } .ui-icon-flag { background-position: -16px -112px; } .ui-icon-calendar { background-position: -32px -112px; } .ui-icon-cart { background-position: -48px -112px; } .ui-icon-pencil { background-position: -64px -112px; } .ui-icon-clock { background-position: -80px -112px; } .ui-icon-disk { background-position: -96px -112px; } .ui-icon-calculator { background-position: -112px -112px; } .ui-icon-zoomin { background-position: -128px -112px; } .ui-icon-zoomout { background-position: -144px -112px; } .ui-icon-search { background-position: -160px -112px; } .ui-icon-wrench { background-position: -176px -112px; } .ui-icon-gear { background-position: -192px -112px; } .ui-icon-heart { background-position: -208px -112px; } .ui-icon-star { background-position: -224px -112px; } .ui-icon-link { background-position: -240px -112px; } .ui-icon-cancel { background-position: 0 -128px; } .ui-icon-plus { background-position: -16px -128px; } .ui-icon-plusthick { background-position: -32px -128px; } .ui-icon-minus { background-position: -48px -128px; } .ui-icon-minusthick { background-position: -64px -128px; } .ui-icon-close { background-position: -80px -128px; } .ui-icon-closethick { background-position: -96px -128px; } .ui-icon-key { background-position: -112px -128px; } .ui-icon-lightbulb { background-position: -128px -128px; } .ui-icon-scissors { background-position: -144px -128px; } .ui-icon-clipboard { background-position: -160px -128px; } .ui-icon-copy { background-position: -176px -128px; } .ui-icon-contact { background-position: -192px -128px; } .ui-icon-image { background-position: -208px -128px; } .ui-icon-video { background-position: -224px -128px; } .ui-icon-script { background-position: -240px -128px; } .ui-icon-alert { background-position: 0 -144px; } .ui-icon-info { background-position: -16px -144px; } .ui-icon-notice { background-position: -32px -144px; } .ui-icon-help { background-position: -48px -144px; } .ui-icon-check { background-position: -64px -144px; } .ui-icon-bullet { background-position: -80px -144px; } .ui-icon-radio-on { background-position: -96px -144px; } .ui-icon-radio-off { background-position: -112px -144px; } .ui-icon-pin-w { background-position: -128px -144px; } .ui-icon-pin-s { background-position: -144px -144px; } .ui-icon-play { background-position: 0 -160px; } .ui-icon-pause { background-position: -16px -160px; } .ui-icon-seek-next { background-position: -32px -160px; } .ui-icon-seek-prev { background-position: -48px -160px; } .ui-icon-seek-end { background-position: -64px -160px; } .ui-icon-seek-start { background-position: -80px -160px; } /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ .ui-icon-seek-first { background-position: -80px -160px; } .ui-icon-stop { background-position: -96px -160px; } .ui-icon-eject { background-position: -112px -160px; } .ui-icon-volume-off { background-position: -128px -160px; } .ui-icon-volume-on { background-position: -144px -160px; } .ui-icon-power { background-position: 0 -176px; } .ui-icon-signal-diag { background-position: -16px -176px; } .ui-icon-signal { background-position: -32px -176px; } .ui-icon-battery-0 { background-position: -48px -176px; } .ui-icon-battery-1 { background-position: -64px -176px; } .ui-icon-battery-2 { background-position: -80px -176px; } .ui-icon-battery-3 { background-position: -96px -176px; } .ui-icon-circle-plus { background-position: 0 -192px; } .ui-icon-circle-minus { background-position: -16px -192px; } .ui-icon-circle-close { background-position: -32px -192px; } .ui-icon-circle-triangle-e { background-position: -48px -192px; } .ui-icon-circle-triangle-s { background-position: -64px -192px; } .ui-icon-circle-triangle-w { background-position: -80px -192px; } .ui-icon-circle-triangle-n { background-position: -96px -192px; } .ui-icon-circle-arrow-e { background-position: -112px -192px; } .ui-icon-circle-arrow-s { background-position: -128px -192px; } .ui-icon-circle-arrow-w { background-position: -144px -192px; } .ui-icon-circle-arrow-n { background-position: -160px -192px; } .ui-icon-circle-zoomin { background-position: -176px -192px; } .ui-icon-circle-zoomout { background-position: -192px -192px; } .ui-icon-circle-check { background-position: -208px -192px; } .ui-icon-circlesmall-plus { background-position: 0 -208px; } .ui-icon-circlesmall-minus { background-position: -16px -208px; } .ui-icon-circlesmall-close { background-position: -32px -208px; } .ui-icon-squaresmall-plus { background-position: -48px -208px; } .ui-icon-squaresmall-minus { background-position: -64px -208px; } .ui-icon-squaresmall-close { background-position: -80px -208px; } .ui-icon-grip-dotted-vertical { background-position: 0 -224px; } .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } .ui-icon-grip-solid-vertical { background-position: -32px -224px; } .ui-icon-grip-solid-horizontal { background-position: -48px -224px; } .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } .ui-icon-grip-diagonal-se { background-position: -80px -224px; } /* Misc visuals ----------------------------------*/ /* Corner radius */ .ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { border-top-left-radius: 4px; } .ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { border-top-right-radius: 4px; } .ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { border-bottom-left-radius: 4px; } .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { border-bottom-right-radius: 4px; } /* Overlays */ .ui-widget-overlay { background: #666666 url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .5; filter: Alpha(Opacity=50); } .ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .2; filter: Alpha(Opacity=20); border-radius: 5px; } ================================================ FILE: static/js/atom-tree.js ================================================ //Johan Coppieters //- mar 2011 - rWorks //- mar 2013 - cody /////////////////////// //tree functions // /////////////////////// function jAtomTree(theRoot, theInitialNode, theLanguage, theService, theImages) { // theRoot: is prefilled by the calling template (0, 1, ...) -- used for "don't close root" // theInitialNode: select this node and open the tree up to there // theLanguage: current language of the cms // theService: is prefilled by the calling template (images, files, forms, ...) */ // theImages: location of the static images of the cms if (theInitialNode == "0") { theInitialNode = theRoot; } this.currentNode = "id_"+theInitialNode; this.openNode = "0"; this.pleaseOpen = undefined; this.rootId = "id_"+theRoot; this.nextType = ""; this.warnUser = function(message) { $('#right_cont').html("

    " + message + "

    "); }; this.getCurrentNode = function() { return this.currentNode; }; this.getOpenNode = function() { return this.openNode; }; this.getNode = function(id) { var self = this; if (id != self.rootId) { $.ajax({ type: "GET", url: gPrefix + "/" + theLanguage + "/"+theService, data: "request=getnode&node=" + id, success: function(msg){ if (msg.substring(0,3) === "NOK") { self.warnUser("Got error from server: " + msg); } else if (msg.substring(0,3) === "NAL") { self.warnUser("You are not allowed to edit this node, sorry."); } else { $("#right_cont").html(msg).show(); self.initNode(id); } } }); } }; this.initNode = function(id) { var self = this; self.currentNode = id; self.openNode = id; $("#doRealDelete").button({ icons: { primary: "ui-icon-trash"}, text: true}).click( function() { self.doRealDelete(); } ); $("#doSave").button({ icons: { primary: "ui-icon-check"}, text: true}).click( function() { self.doSave(); } ); } this.doSave = function() { $("form#onepage #request").val("save"); $("form#onepage").submit(); }; this.doRealDelete = function() { $("form#onepage #request").val("realdelete"); $("form#onepage").submit(); }; this.doAdjust = function() { $("form#onepage #request").val("adjust"); $("form#onepage").submit(); }; this.doAdd = function() { var self = this; var t = $("#tree").jstree("get_selected"); if (t) { $("#tree").jstree("create", t, "inside"); } else { self.warnUser("Please select an item first"); } }; this.doAddFolder = function() { var self = this; var t = $("#tree").jstree("get_selected"); self.nextType = "folder"; if (t) { $("#tree").jstree("create", t, "inside", { attr: { rel : "folder" } }); } else { self.warnUser("Please select an item first"); } }; this.doAddImage = function () { var self = this; var t = $("#tree").jstree("get_selected"); self.nextType = "image"; if (t) { $("#tree").jstree("create", t, "inside", ({ attr: { rel : "image" } })); } else { self.WarnUser("Please select an item first"); } }; this.doAddFile = function () { var self = this; var t = $("#tree").jstree("get_selected"); self.nextType = "file"; if (t) { $("#tree").jstree("create", t, "inside", ({ attr: { rel : "file" } })); } else { self.WarnUser("Please select an item first"); } }; this.doRename = function() { var self = this; var t = $("#tree").jstree("get_selected"); if (t) { $("#tree").jstree("rename", undefined); // renames current selection } else { self.warnUser("Please select an item to rename first"); } }; this.doDelete = function() { var self = this; var t = $("#tree").jstree("get_selected"); if (t) { $("#tree").jstree("remove", t); } else { self.warnUser("Please select an item to delete first"); } }; this.doEdit = function(aNode) { var self = this; var t = $("#tree").jstree("get_selected"); if (aNode) { self.getNode(aNode); } else if (t) { self.getNode(t.attr("id")); } else { self.warnUser("Please select an item to edit first"); } }; this.init = function () { var self = this; // not all buttons exist for every atom tree user $("#doAdd").button({ icons: { primary: "ui-icon-plus"}, text: true}).click(function() { self.doAdd(); }); $("#doAddFolder").button({ icons: { primary: "ui-icon-plus"}, text: true}).click(function() { self.doAddFolder(); }); $("#doAddImage").button({ icons: { primary: "ui-icon-plus"}, text: true}).click(function() { self.doAddImage(); }); $("#doAddFile").button({ icons: { primary: "ui-icon-plus"}, text: true}).click(function() { self.doAddFile(); }); $("#doRename").button({ icons: { primary: "ui-icon-pencil"}, text: true}).click(function() { self.doRename(); }); $("#doDelete").button({ icons: { primary: "ui-icon-trash"}, text: true}).click(function() { self.doDelete(); }); $("#doEdit").button({ icons: { primary: "ui-icon-wrench"}, text: true}).click(function() { self.doEdit(); }); $("#tree") .bind("before.jstree", function(e, data) { var aNode = data.args[0]; var nodeId = (typeof aNode === "object") ? $(aNode).attr("id") : "id_xx"; if (data.func === "delete_node") { if (theService === "pages") { // we don't actually do deletes for webpages, just mark the node as inactive in the database and rename it in the tree $.getJSON("./"+theService, {request: 'delete', node: nodeId}, function(msg){ if (msg.status === "OK") { aNode.addClass("deleted"); aNode = aNode.find("a:first"); var icn = aNode.children("ins").clone(); // rename generates a callback and we don't want an update in the database // data.inst.set_text ( aNode , text ) jsTree.rename(aNode, "(" + aNode.text() + ")"); var aName = data.inst.get_text(aNode); if (aName.charAt(0) !== '(') { aNode.text("(" + aName + ")").prepend(icn); } self.getNode(nodeId); } if (msg.status === "NOK") { console.log(msg); self.warnUser("The deletion of this item failed.
    server status: " + msg.status); } if (msg.status === "NAL") { self.warnUser("You are not allowed to delete this item, sorry."); } }); e.stopImmediatePropagation(); return false; } else { $.getJSON("./"+theService, {request: 'delete', node: nodeId}, function(msg){ if (msg.status === "NAL") { self.warnUser("You are not allowed to delete this item, sorry."); $.jstree.rollback(data.rlbk); } else if (msg.status === "OK") { self.warnUser("The item has been deleted."); } else { console.log(msg); self.warnUser("The deletion of this item failed.
    server status: " + msg.status); $.jstree.rollback(data.rlbk); } }); } } else if (data.func === "close_node") { //console.log("Tree - close: " + nodeId); //console.log(aNode); // don't allow closing the root node if (nodeId === self.rootId) { // console.log("Tree - close: not allowed to close root node = " + nodeId); e.stopImmediatePropagation(); return false; } } else if (data.func === "rename_node") { //console.log("Tree - Before: rename_node, please-open = " + self.pleaseOpen); if (self.pleaseOpen !== undefined) { // we're only here after a create_node, set the name and open the item for editing $.getJSON("./"+theService, {request: 'rename', name: data.args[1], node: self.pleaseOpen}, function(msg){ if (msg.status === "OK") { self.doEdit(self.pleaseOpen); self.pleaseOpen = undefined; } }); } } }) .bind("delete.jstree", function (e, data) { var aNode = data.rslt.obj; var nodeId = aNode.attr("id"); // console.log("Tree - Delete: " + nodeId); }) .bind("rename.jstree", function (e, data) { var aNode = data.rslt.obj, text = data.rslt.new_name; var nodeId = aNode.attr("id"); //console.log("Tree - Rename: " + nodeId + " -> " + text); $.getJSON("./"+theService, {request: 'rename', name: text, node: nodeId}, function(msg){ if (msg.status === "NAL") { self.warnUser("You are not allowed to rename this item, sorry."); $.jstree.rollback(data.rlbk); } else if (msg.status !== "OK") { console.log(msg); self.warnUser("The rename of this item failed.
    server status: " + msg.status); $.jstree.rollback(data.rlbk); } }); }) .bind("move_node.jstree", function (e, data) { var aNode = data.rslt.o, refNode = data.rslt.r, type = data.rslt.p; var nodeId = aNode.attr("id"), refNodeId = refNode.attr("id"); //console.log("Tree - Move: " + aNode.text() + " " + type + " " + refNode.text()); // Allow only one dummy node "website" as toplevel if ((refNodeId === "id_0") && ((type === "before") || (type === "after"))) { self.warnUser("Can't move this element."); $.jstree.rollback(data.rlbk); } else { // type = "before", "after" or "inside" $.getJSON("./"+theService, {request: 'move', refnode: refNodeId, type: type, node: nodeId}, function(msg) { if (msg.status === "NAL") { self.warnUser("You are not allowed to move this item, sorry."); $.jstree.rollback(data.rlbk); } else if (msg.status !== "OK") { console.log(msg); self.warnUser("The move of this item failed.
    server status: " + msg.status); $.jstree.rollback(data.rlbk); } }); } }) .bind("select_node.jstree", function (e, data) { // console.log("Tree - select"); var nodeId = $(data.args[0]).parent().attr("id"); if (self.currentNode === nodeId) { self.doEdit(); } else if (typeof nodeId !== "undefined") { self.currentNode = nodeId; } }) .bind("deselect_node.jstree", function (e, data) { // console.log("Tree - deselect"); self.currentNode = ""; }) .bind("create_node.jstree", function(e, data) { var title = data.args[2].data[0], aNode = data.rslt.obj; var type = data.args[1] || "inside"; // insert type = before, after, inside, first, last var refNode = (type === "inside") ? data.args[0] : data.args[1]; var refNodeId = refNode.attr("id"); var show = $("#template_selector input[name=showcontent]:checked").val(); $.getJSON("./"+theService, {request: 'insert', refnode: refNodeId, type: type, name: title, kind: self.nextType, extention: 'xxx', showcontent: show}, function(msg){ if (msg.status === "NAL") { self.warnUser("You are not allowed to create and item here, sorry"); $.jstree.rollback(data.rlbk); } else if (msg.status === "NOK") { console.log(msg); self.warnUser("Creation of a new item failed.
    server status: " + msg.status); $.jstree.rollback(data.rlbk); } else { // remember this node, it will go into "rename" mode now, so after rename -> open it up for editing //console.log("create - setting node id to " + msg.node); self.pleaseOpen = msg.node; aNode.attr("id", msg.node); self.warnUser("Please choose a name for your item and press the 'enter'-key."); } }); }) .jstree({ plugins : [ "themes", "html_data", "ui", "crrm", "dnd", "types" ], core : { initially_open : ['id_' + theInitialNode], strings: { new_node: "New item" } }, themes : { theme: "classic" // alternatives: "default", "classic" or false (= no theme), not good: "apple" (alternating rows), }, ui: { select_limit: 1, "initially_select" : ['id_' + theInitialNode] }, types: { types: { "root" : { deletable: false, renameable: false, draggable: false, clickable: true }, "item" : { valid_children : "none", creatable: false, icon : { image : theImages + "/extentions/ele.gif" } }, "form" : { valid_children : "item", creatable: false, icon : { image : theImages + "/extentions/frm.gif" } }, "image" : { valid_children : "none", creatable: false, icon : { image : theImages + "/extentions/jpg.png" } }, "html" : { valid_children : [ "html", "file", "image", "folder" ], creatable: false, icon : { image : theImages + "/extentions/html.png" } }, "file" : { valid_children : "none", creatable: false, icon : { image : theImages + "/extentions/file.png" } }, "folder" : { valid_children : [ "html", "file", "image", "folder" ], icon : { image : theImages + "/extentions/folder.png" } } } } }); }; } ================================================ FILE: static/js/lib/html5shiv.js ================================================ /** * @preserve HTML5 Shiv v3.6.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed */ ;(function(window, document) { /*jshint evil:true */ /** version */ var version = '3.6.2'; /** Preset options */ var options = window.html5 || {}; /** Used to skip problem elements */ var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i; /** Not all elements can be cloned in IE **/ var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i; /** Detect whether the browser supports default html5 styles */ var supportsHtml5Styles; /** Name of the expando, to work with multiple documents or to re-shiv one document */ var expando = '_html5shiv'; /** The id for the the documents expando */ var expanID = 0; /** Cached data for each document */ var expandoData = {}; /** Detect whether the browser supports unknown elements */ var supportsUnknownElements; (function() { try { var a = document.createElement('a'); a.innerHTML = ''; //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles supportsHtml5Styles = ('hidden' in a); supportsUnknownElements = a.childNodes.length == 1 || (function() { // assign a false positive if unable to shiv (document.createElement)('a'); var frag = document.createDocumentFragment(); return ( typeof frag.cloneNode == 'undefined' || typeof frag.createDocumentFragment == 'undefined' || typeof frag.createElement == 'undefined' ); }()); } catch(e) { // assign a false positive if detection fails => unable to shiv supportsHtml5Styles = true; supportsUnknownElements = true; } }()); /*--------------------------------------------------------------------------*/ /** * Creates a style sheet with the given CSS text and adds it to the document. * @private * @param {Document} ownerDocument The document. * @param {String} cssText The CSS text. * @returns {StyleSheet} The style element. */ function addStyleSheet(ownerDocument, cssText) { var p = ownerDocument.createElement('p'), parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement; p.innerHTML = 'x'; return parent.insertBefore(p.lastChild, parent.firstChild); } /** * Returns the value of `html5.elements` as an array. * @private * @returns {Array} An array of shived element node names. */ function getElements() { var elements = html5.elements; return typeof elements == 'string' ? elements.split(' ') : elements; } /** * Returns the data associated to the given document * @private * @param {Document} ownerDocument The document. * @returns {Object} An object of data. */ function getExpandoData(ownerDocument) { var data = expandoData[ownerDocument[expando]]; if (!data) { data = {}; expanID++; ownerDocument[expando] = expanID; expandoData[expanID] = data; } return data; } /** * returns a shived element for the given nodeName and document * @memberOf html5 * @param {String} nodeName name of the element * @param {Document} ownerDocument The context document. * @returns {Object} The shived element. */ function createElement(nodeName, ownerDocument, data){ if (!ownerDocument) { ownerDocument = document; } if(supportsUnknownElements){ return ownerDocument.createElement(nodeName); } if (!data) { data = getExpandoData(ownerDocument); } var node; if (data.cache[nodeName]) { node = data.cache[nodeName].cloneNode(); } else if (saveClones.test(nodeName)) { node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode(); } else { node = data.createElem(nodeName); } // Avoid adding some elements to fragments in IE < 9 because // * Attributes like `name` or `type` cannot be set/changed once an element // is inserted into a document/fragment // * Link elements with `src` attributes that are inaccessible, as with // a 403 response, will cause the tab/window to crash // * Script elements appended to fragments will execute when their `src` // or `text` property is set return node.canHaveChildren && !reSkip.test(nodeName) ? data.frag.appendChild(node) : node; } /** * returns a shived DocumentFragment for the given document * @memberOf html5 * @param {Document} ownerDocument The context document. * @returns {Object} The shived DocumentFragment. */ function createDocumentFragment(ownerDocument, data){ if (!ownerDocument) { ownerDocument = document; } if(supportsUnknownElements){ return ownerDocument.createDocumentFragment(); } data = data || getExpandoData(ownerDocument); var clone = data.frag.cloneNode(), i = 0, elems = getElements(), l = elems.length; for(;i type pairs class2type = {}, // List of deleted data cache ids, so we can reuse them core_deletedIds = [], core_version = "1.9.1", // Save a reference to some core methods core_concat = core_deletedIds.concat, core_push = core_deletedIds.push, core_slice = core_deletedIds.slice, core_indexOf = core_deletedIds.indexOf, core_toString = class2type.toString, core_hasOwn = class2type.hasOwnProperty, core_trim = core_version.trim, // Define a local copy of jQuery jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init( selector, context, rootjQuery ); }, // Used for matching numbers core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, // Used for splitting on whitespace core_rnotwhite = /\S+/g, // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, // A simple way to check for HTML strings // Prioritize #id over to avoid XSS via location.hash (#9521) // Strict HTML recognition (#11290: must start with <) rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/, // Match a standalone tag rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, // JSON RegExp rvalidchars = /^[\],:{}\s]*$/, rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, // Matches dashed string for camelizing rmsPrefix = /^-ms-/, rdashAlpha = /-([\da-z])/gi, // Used by jQuery.camelCase as callback to replace() fcamelCase = function( all, letter ) { return letter.toUpperCase(); }, // The ready event handler completed = function( event ) { // readyState === "complete" is good enough for us to call the dom ready in oldIE if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { detach(); jQuery.ready(); } }, // Clean-up method for dom ready events detach = function() { if ( document.addEventListener ) { document.removeEventListener( "DOMContentLoaded", completed, false ); window.removeEventListener( "load", completed, false ); } else { document.detachEvent( "onreadystatechange", completed ); window.detachEvent( "onload", completed ); } }; jQuery.fn = jQuery.prototype = { // The current version of jQuery being used jquery: core_version, constructor: jQuery, init: function( selector, context, rootjQuery ) { var match, elem; // HANDLE: $(""), $(null), $(undefined), $(false) if ( !selector ) { return this; } // Handle HTML strings if ( typeof selector === "string" ) { if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { // Assume that strings that start and end with <> are HTML and skip the regex check match = [ null, selector, null ]; } else { match = rquickExpr.exec( selector ); } // Match html or make sure no context is specified for #id if ( match && (match[1] || !context) ) { // HANDLE: $(html) -> $(array) if ( match[1] ) { context = context instanceof jQuery ? context[0] : context; // scripts is true for back-compat jQuery.merge( this, jQuery.parseHTML( match[1], context && context.nodeType ? context.ownerDocument || context : document, true ) ); // HANDLE: $(html, props) if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { for ( match in context ) { // Properties of context are called as methods if possible if ( jQuery.isFunction( this[ match ] ) ) { this[ match ]( context[ match ] ); // ...and otherwise set as attributes } else { this.attr( match, context[ match ] ); } } } return this; // HANDLE: $(#id) } else { elem = document.getElementById( match[2] ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE and Opera return items // by name instead of ID if ( elem.id !== match[2] ) { return rootjQuery.find( selector ); } // Otherwise, we inject the element directly into the jQuery object this.length = 1; this[0] = elem; } this.context = document; this.selector = selector; return this; } // HANDLE: $(expr, $(...)) } else if ( !context || context.jquery ) { return ( context || rootjQuery ).find( selector ); // HANDLE: $(expr, context) // (which is just equivalent to: $(context).find(expr) } else { return this.constructor( context ).find( selector ); } // HANDLE: $(DOMElement) } else if ( selector.nodeType ) { this.context = this[0] = selector; this.length = 1; return this; // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) { return rootjQuery.ready( selector ); } if ( selector.selector !== undefined ) { this.selector = selector.selector; this.context = selector.context; } return jQuery.makeArray( selector, this ); }, // Start with an empty selector selector: "", // The default length of a jQuery object is 0 length: 0, // The number of elements contained in the matched element set size: function() { return this.length; }, toArray: function() { return core_slice.call( this ); }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { return num == null ? // Return a 'clean' array this.toArray() : // Return just the object ( num < 0 ? this[ this.length + num ] : this[ num ] ); }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems ) { // Build a new jQuery matched element set var ret = jQuery.merge( this.constructor(), elems ); // Add the old object onto the stack (as a reference) ret.prevObject = this; ret.context = this.context; // Return the newly-formed element set return ret; }, // Execute a callback for every element in the matched set. // (You can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { return jQuery.each( this, callback, args ); }, ready: function( fn ) { // Add the callback jQuery.ready.promise().done( fn ); return this; }, slice: function() { return this.pushStack( core_slice.apply( this, arguments ) ); }, first: function() { return this.eq( 0 ); }, last: function() { return this.eq( -1 ); }, eq: function( i ) { var len = this.length, j = +i + ( i < 0 ? len : 0 ); return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); }, map: function( callback ) { return this.pushStack( jQuery.map(this, function( elem, i ) { return callback.call( elem, i, elem ); })); }, end: function() { return this.prevObject || this.constructor(null); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: core_push, sort: [].sort, splice: [].splice }; // Give the init function the jQuery prototype for later instantiation jQuery.fn.init.prototype = jQuery.fn; jQuery.extend = jQuery.fn.extend = function() { var src, copyIsArray, copy, name, options, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; target = arguments[1] || {}; // skip the boolean and the target i = 2; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jQuery.isFunction(target) ) { target = {}; } // extend jQuery itself if only one argument is passed if ( length === i ) { target = this; --i; } for ( ; i < length; i++ ) { // Only deal with non-null/undefined values if ( (options = arguments[ i ]) != null ) { // Extend the base object for ( name in options ) { src = target[ name ]; copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) { continue; } // Recurse if we're merging plain objects or arrays if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { if ( copyIsArray ) { copyIsArray = false; clone = src && jQuery.isArray(src) ? src : []; } else { clone = src && jQuery.isPlainObject(src) ? src : {}; } // Never move original objects, clone them target[ name ] = jQuery.extend( deep, clone, copy ); // Don't bring in undefined values } else if ( copy !== undefined ) { target[ name ] = copy; } } } } // Return the modified object return target; }; jQuery.extend({ noConflict: function( deep ) { if ( window.$ === jQuery ) { window.$ = _$; } if ( deep && window.jQuery === jQuery ) { window.jQuery = _jQuery; } return jQuery; }, // Is the DOM ready to be used? Set to true once it occurs. isReady: false, // A counter to track how many items to wait for before // the ready event fires. See #6781 readyWait: 1, // Hold (or release) the ready event holdReady: function( hold ) { if ( hold ) { jQuery.readyWait++; } else { jQuery.ready( true ); } }, // Handle when the DOM is ready ready: function( wait ) { // Abort if there are pending holds or we're already ready if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { return; } // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). if ( !document.body ) { return setTimeout( jQuery.ready ); } // Remember that the DOM is ready jQuery.isReady = true; // If a normal DOM Ready event fired, decrement, and wait if need be if ( wait !== true && --jQuery.readyWait > 0 ) { return; } // If there are functions bound, to execute readyList.resolveWith( document, [ jQuery ] ); // Trigger any bound ready events if ( jQuery.fn.trigger ) { jQuery( document ).trigger("ready").off("ready"); } }, // See test/unit/core.js for details concerning isFunction. // Since version 1.3, DOM methods and functions like alert // aren't supported. They return false on IE (#2968). isFunction: function( obj ) { return jQuery.type(obj) === "function"; }, isArray: Array.isArray || function( obj ) { return jQuery.type(obj) === "array"; }, isWindow: function( obj ) { return obj != null && obj == obj.window; }, isNumeric: function( obj ) { return !isNaN( parseFloat(obj) ) && isFinite( obj ); }, type: function( obj ) { if ( obj == null ) { return String( obj ); } return typeof obj === "object" || typeof obj === "function" ? class2type[ core_toString.call(obj) ] || "object" : typeof obj; }, isPlainObject: function( obj ) { // Must be an Object. // Because of IE, we also have to check the presence of the constructor property. // Make sure that DOM nodes and window objects don't pass through, as well if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { return false; } try { // Not own constructor property must be Object if ( obj.constructor && !core_hasOwn.call(obj, "constructor") && !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { return false; } } catch ( e ) { // IE8,9 Will throw exceptions on certain host objects #9897 return false; } // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. var key; for ( key in obj ) {} return key === undefined || core_hasOwn.call( obj, key ); }, isEmptyObject: function( obj ) { var name; for ( name in obj ) { return false; } return true; }, error: function( msg ) { throw new Error( msg ); }, // data: string of html // context (optional): If specified, the fragment will be created in this context, defaults to document // keepScripts (optional): If true, will include scripts passed in the html string parseHTML: function( data, context, keepScripts ) { if ( !data || typeof data !== "string" ) { return null; } if ( typeof context === "boolean" ) { keepScripts = context; context = false; } context = context || document; var parsed = rsingleTag.exec( data ), scripts = !keepScripts && []; // Single tag if ( parsed ) { return [ context.createElement( parsed[1] ) ]; } parsed = jQuery.buildFragment( [ data ], context, scripts ); if ( scripts ) { jQuery( scripts ).remove(); } return jQuery.merge( [], parsed.childNodes ); }, parseJSON: function( data ) { // Attempt to parse using the native JSON parser first if ( window.JSON && window.JSON.parse ) { return window.JSON.parse( data ); } if ( data === null ) { return data; } if ( typeof data === "string" ) { // Make sure leading/trailing whitespace is removed (IE can't handle it) data = jQuery.trim( data ); if ( data ) { // Make sure the incoming data is actual JSON // Logic borrowed from http://json.org/json2.js if ( rvalidchars.test( data.replace( rvalidescape, "@" ) .replace( rvalidtokens, "]" ) .replace( rvalidbraces, "")) ) { return ( new Function( "return " + data ) )(); } } } jQuery.error( "Invalid JSON: " + data ); }, // Cross-browser xml parsing parseXML: function( data ) { var xml, tmp; if ( !data || typeof data !== "string" ) { return null; } try { if ( window.DOMParser ) { // Standard tmp = new DOMParser(); xml = tmp.parseFromString( data , "text/xml" ); } else { // IE xml = new ActiveXObject( "Microsoft.XMLDOM" ); xml.async = "false"; xml.loadXML( data ); } } catch( e ) { xml = undefined; } if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { jQuery.error( "Invalid XML: " + data ); } return xml; }, noop: function() {}, // Evaluates a script in a global context // Workarounds based on findings by Jim Driscoll // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context globalEval: function( data ) { if ( data && jQuery.trim( data ) ) { // We use execScript on Internet Explorer // We use an anonymous function so that context is window // rather than jQuery in Firefox ( window.execScript || function( data ) { window[ "eval" ].call( window, data ); } )( data ); } }, // Convert dashed to camelCase; used by the css and data modules // Microsoft forgot to hump their vendor prefix (#9572) camelCase: function( string ) { return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); }, nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); }, // args is for internal usage only each: function( obj, callback, args ) { var value, i = 0, length = obj.length, isArray = isArraylike( obj ); if ( args ) { if ( isArray ) { for ( ; i < length; i++ ) { value = callback.apply( obj[ i ], args ); if ( value === false ) { break; } } } else { for ( i in obj ) { value = callback.apply( obj[ i ], args ); if ( value === false ) { break; } } } // A special, fast, case for the most common use of each } else { if ( isArray ) { for ( ; i < length; i++ ) { value = callback.call( obj[ i ], i, obj[ i ] ); if ( value === false ) { break; } } } else { for ( i in obj ) { value = callback.call( obj[ i ], i, obj[ i ] ); if ( value === false ) { break; } } } } return obj; }, // Use native String.trim function wherever possible trim: core_trim && !core_trim.call("\uFEFF\xA0") ? function( text ) { return text == null ? "" : core_trim.call( text ); } : // Otherwise use our own trimming functionality function( text ) { return text == null ? "" : ( text + "" ).replace( rtrim, "" ); }, // results is for internal usage only makeArray: function( arr, results ) { var ret = results || []; if ( arr != null ) { if ( isArraylike( Object(arr) ) ) { jQuery.merge( ret, typeof arr === "string" ? [ arr ] : arr ); } else { core_push.call( ret, arr ); } } return ret; }, inArray: function( elem, arr, i ) { var len; if ( arr ) { if ( core_indexOf ) { return core_indexOf.call( arr, elem, i ); } len = arr.length; i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; for ( ; i < len; i++ ) { // Skip accessing in sparse arrays if ( i in arr && arr[ i ] === elem ) { return i; } } } return -1; }, merge: function( first, second ) { var l = second.length, i = first.length, j = 0; if ( typeof l === "number" ) { for ( ; j < l; j++ ) { first[ i++ ] = second[ j ]; } } else { while ( second[j] !== undefined ) { first[ i++ ] = second[ j++ ]; } } first.length = i; return first; }, grep: function( elems, callback, inv ) { var retVal, ret = [], i = 0, length = elems.length; inv = !!inv; // Go through the array, only saving the items // that pass the validator function for ( ; i < length; i++ ) { retVal = !!callback( elems[ i ], i ); if ( inv !== retVal ) { ret.push( elems[ i ] ); } } return ret; }, // arg is for internal usage only map: function( elems, callback, arg ) { var value, i = 0, length = elems.length, isArray = isArraylike( elems ), ret = []; // Go through the array, translating each of the items to their if ( isArray ) { for ( ; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret[ ret.length ] = value; } } // Go through every key on the object, } else { for ( i in elems ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret[ ret.length ] = value; } } } // Flatten any nested arrays return core_concat.apply( [], ret ); }, // A global GUID counter for objects guid: 1, // Bind a function to a context, optionally partially applying any // arguments. proxy: function( fn, context ) { var args, proxy, tmp; if ( typeof context === "string" ) { tmp = fn[ context ]; context = fn; fn = tmp; } // Quick check to determine if target is callable, in the spec // this throws a TypeError, but we will just return undefined. if ( !jQuery.isFunction( fn ) ) { return undefined; } // Simulated bind args = core_slice.call( arguments, 2 ); proxy = function() { return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); }; // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || jQuery.guid++; return proxy; }, // Multifunctional method to get and set values of a collection // The value/s can optionally be executed if it's a function access: function( elems, fn, key, value, chainable, emptyGet, raw ) { var i = 0, length = elems.length, bulk = key == null; // Sets many values if ( jQuery.type( key ) === "object" ) { chainable = true; for ( i in key ) { jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); } // Sets one value } else if ( value !== undefined ) { chainable = true; if ( !jQuery.isFunction( value ) ) { raw = true; } if ( bulk ) { // Bulk operations run against the entire set if ( raw ) { fn.call( elems, value ); fn = null; // ...except when executing function values } else { bulk = fn; fn = function( elem, key, value ) { return bulk.call( jQuery( elem ), value ); }; } } if ( fn ) { for ( ; i < length; i++ ) { fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); } } } return chainable ? elems : // Gets bulk ? fn.call( elems ) : length ? fn( elems[0], key ) : emptyGet; }, now: function() { return ( new Date() ).getTime(); } }); jQuery.ready.promise = function( obj ) { if ( !readyList ) { readyList = jQuery.Deferred(); // Catch cases where $(document).ready() is called after the browser event has already occurred. // we once tried to use readyState "interactive" here, but it caused issues like the one // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 if ( document.readyState === "complete" ) { // Handle it asynchronously to allow scripts the opportunity to delay ready setTimeout( jQuery.ready ); // Standards-based browsers support DOMContentLoaded } else if ( document.addEventListener ) { // Use the handy event callback document.addEventListener( "DOMContentLoaded", completed, false ); // A fallback to window.onload, that will always work window.addEventListener( "load", completed, false ); // If IE event model is used } else { // Ensure firing before onload, maybe late but safe also for iframes document.attachEvent( "onreadystatechange", completed ); // A fallback to window.onload, that will always work window.attachEvent( "onload", completed ); // If IE and not a frame // continually check to see if the document is ready var top = false; try { top = window.frameElement == null && document.documentElement; } catch(e) {} if ( top && top.doScroll ) { (function doScrollCheck() { if ( !jQuery.isReady ) { try { // Use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ top.doScroll("left"); } catch(e) { return setTimeout( doScrollCheck, 50 ); } // detach all dom ready events detach(); // and execute any waiting functions jQuery.ready(); } })(); } } } return readyList.promise( obj ); }; // Populate the class2type map jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { class2type[ "[object " + name + "]" ] = name.toLowerCase(); }); function isArraylike( obj ) { var length = obj.length, type = jQuery.type( obj ); if ( jQuery.isWindow( obj ) ) { return false; } if ( obj.nodeType === 1 && length ) { return true; } return type === "array" || type !== "function" && ( length === 0 || typeof length === "number" && length > 0 && ( length - 1 ) in obj ); } // All jQuery objects should point back to these rootjQuery = jQuery(document); // String to Object options format cache var optionsCache = {}; // Convert String-formatted options into Object-formatted ones and store in cache function createOptions( options ) { var object = optionsCache[ options ] = {}; jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { object[ flag ] = true; }); return object; } /* * Create a callback list using the following parameters: * * options: an optional list of space-separated options that will change how * the callback list behaves or a more traditional option object * * By default a callback list will act like an event callback list and can be * "fired" multiple times. * * Possible options: * * once: will ensure the callback list can only be fired once (like a Deferred) * * memory: will keep track of previous values and will call any callback added * after the list has been fired right away with the latest "memorized" * values (like a Deferred) * * unique: will ensure a callback can only be added once (no duplicate in the list) * * stopOnFalse: interrupt callings when a callback returns false * */ jQuery.Callbacks = function( options ) { // Convert options from String-formatted to Object-formatted if needed // (we check in cache first) options = typeof options === "string" ? ( optionsCache[ options ] || createOptions( options ) ) : jQuery.extend( {}, options ); var // Flag to know if list is currently firing firing, // Last fire value (for non-forgettable lists) memory, // Flag to know if list was already fired fired, // End of the loop when firing firingLength, // Index of currently firing callback (modified by remove if needed) firingIndex, // First callback to fire (used internally by add and fireWith) firingStart, // Actual callback list list = [], // Stack of fire calls for repeatable lists stack = !options.once && [], // Fire callbacks fire = function( data ) { memory = options.memory && data; fired = true; firingIndex = firingStart || 0; firingStart = 0; firingLength = list.length; firing = true; for ( ; list && firingIndex < firingLength; firingIndex++ ) { if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { memory = false; // To prevent further calls using add break; } } firing = false; if ( list ) { if ( stack ) { if ( stack.length ) { fire( stack.shift() ); } } else if ( memory ) { list = []; } else { self.disable(); } } }, // Actual Callbacks object self = { // Add a callback or a collection of callbacks to the list add: function() { if ( list ) { // First, we save the current length var start = list.length; (function add( args ) { jQuery.each( args, function( _, arg ) { var type = jQuery.type( arg ); if ( type === "function" ) { if ( !options.unique || !self.has( arg ) ) { list.push( arg ); } } else if ( arg && arg.length && type !== "string" ) { // Inspect recursively add( arg ); } }); })( arguments ); // Do we need to add the callbacks to the // current firing batch? if ( firing ) { firingLength = list.length; // With memory, if we're not firing then // we should call right away } else if ( memory ) { firingStart = start; fire( memory ); } } return this; }, // Remove a callback from the list remove: function() { if ( list ) { jQuery.each( arguments, function( _, arg ) { var index; while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { list.splice( index, 1 ); // Handle firing indexes if ( firing ) { if ( index <= firingLength ) { firingLength--; } if ( index <= firingIndex ) { firingIndex--; } } } }); } return this; }, // Check if a given callback is in the list. // If no argument is given, return whether or not list has callbacks attached. has: function( fn ) { return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); }, // Remove all callbacks from the list empty: function() { list = []; return this; }, // Have the list do nothing anymore disable: function() { list = stack = memory = undefined; return this; }, // Is it disabled? disabled: function() { return !list; }, // Lock the list in its current state lock: function() { stack = undefined; if ( !memory ) { self.disable(); } return this; }, // Is it locked? locked: function() { return !stack; }, // Call all callbacks with the given context and arguments fireWith: function( context, args ) { args = args || []; args = [ context, args.slice ? args.slice() : args ]; if ( list && ( !fired || stack ) ) { if ( firing ) { stack.push( args ); } else { fire( args ); } } return this; }, // Call all the callbacks with the given arguments fire: function() { self.fireWith( this, arguments ); return this; }, // To know if the callbacks have already been called at least once fired: function() { return !!fired; } }; return self; }; jQuery.extend({ Deferred: function( func ) { var tuples = [ // action, add listener, listener list, final state [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], [ "notify", "progress", jQuery.Callbacks("memory") ] ], state = "pending", promise = { state: function() { return state; }, always: function() { deferred.done( arguments ).fail( arguments ); return this; }, then: function( /* fnDone, fnFail, fnProgress */ ) { var fns = arguments; return jQuery.Deferred(function( newDefer ) { jQuery.each( tuples, function( i, tuple ) { var action = tuple[ 0 ], fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; // deferred[ done | fail | progress ] for forwarding actions to newDefer deferred[ tuple[1] ](function() { var returned = fn && fn.apply( this, arguments ); if ( returned && jQuery.isFunction( returned.promise ) ) { returned.promise() .done( newDefer.resolve ) .fail( newDefer.reject ) .progress( newDefer.notify ); } else { newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); } }); }); fns = null; }).promise(); }, // Get a promise for this deferred // If obj is provided, the promise aspect is added to the object promise: function( obj ) { return obj != null ? jQuery.extend( obj, promise ) : promise; } }, deferred = {}; // Keep pipe for back-compat promise.pipe = promise.then; // Add list-specific methods jQuery.each( tuples, function( i, tuple ) { var list = tuple[ 2 ], stateString = tuple[ 3 ]; // promise[ done | fail | progress ] = list.add promise[ tuple[1] ] = list.add; // Handle state if ( stateString ) { list.add(function() { // state = [ resolved | rejected ] state = stateString; // [ reject_list | resolve_list ].disable; progress_list.lock }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); } // deferred[ resolve | reject | notify ] deferred[ tuple[0] ] = function() { deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); return this; }; deferred[ tuple[0] + "With" ] = list.fireWith; }); // Make the deferred a promise promise.promise( deferred ); // Call given func if any if ( func ) { func.call( deferred, deferred ); } // All done! return deferred; }, // Deferred helper when: function( subordinate /* , ..., subordinateN */ ) { var i = 0, resolveValues = core_slice.call( arguments ), length = resolveValues.length, // the count of uncompleted subordinates remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, // the master Deferred. If resolveValues consist of only a single Deferred, just use that. deferred = remaining === 1 ? subordinate : jQuery.Deferred(), // Update function for both resolve and progress values updateFunc = function( i, contexts, values ) { return function( value ) { contexts[ i ] = this; values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; if( values === progressValues ) { deferred.notifyWith( contexts, values ); } else if ( !( --remaining ) ) { deferred.resolveWith( contexts, values ); } }; }, progressValues, progressContexts, resolveContexts; // add listeners to Deferred subordinates; treat others as resolved if ( length > 1 ) { progressValues = new Array( length ); progressContexts = new Array( length ); resolveContexts = new Array( length ); for ( ; i < length; i++ ) { if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { resolveValues[ i ].promise() .done( updateFunc( i, resolveContexts, resolveValues ) ) .fail( deferred.reject ) .progress( updateFunc( i, progressContexts, progressValues ) ); } else { --remaining; } } } // if we're not waiting on anything, resolve the master if ( !remaining ) { deferred.resolveWith( resolveContexts, resolveValues ); } return deferred.promise(); } }); jQuery.support = (function() { var support, all, a, input, select, fragment, opt, eventName, isSupported, i, div = document.createElement("div"); // Setup div.setAttribute( "className", "t" ); div.innerHTML = "
    a"; // Support tests won't run in some limited or non-browser environments all = div.getElementsByTagName("*"); a = div.getElementsByTagName("a")[ 0 ]; if ( !all || !a || !all.length ) { return {}; } // First batch of tests select = document.createElement("select"); opt = select.appendChild( document.createElement("option") ); input = div.getElementsByTagName("input")[ 0 ]; a.style.cssText = "top:1px;float:left;opacity:.5"; support = { // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) getSetAttribute: div.className !== "t", // IE strips leading whitespace when .innerHTML is used leadingWhitespace: div.firstChild.nodeType === 3, // Make sure that tbody elements aren't automatically inserted // IE will insert them into empty tables tbody: !div.getElementsByTagName("tbody").length, // Make sure that link elements get serialized correctly by innerHTML // This requires a wrapper element in IE htmlSerialize: !!div.getElementsByTagName("link").length, // Get the style information from getAttribute // (IE uses .cssText instead) style: /top/.test( a.getAttribute("style") ), // Make sure that URLs aren't manipulated // (IE normalizes it by default) hrefNormalized: a.getAttribute("href") === "/a", // Make sure that element opacity exists // (IE uses filter instead) // Use a regex to work around a WebKit issue. See #5145 opacity: /^0.5/.test( a.style.opacity ), // Verify style float existence // (IE uses styleFloat instead of cssFloat) cssFloat: !!a.style.cssFloat, // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) checkOn: !!input.value, // Make sure that a selected-by-default option has a working selected property. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) optSelected: opt.selected, // Tests for enctype support on a form (#6743) enctype: !!document.createElement("form").enctype, // Makes sure cloning an html5 element does not cause problems // Where outerHTML is undefined, this still works html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode boxModel: document.compatMode === "CSS1Compat", // Will be defined later deleteExpando: true, noCloneEvent: true, inlineBlockNeedsLayout: false, shrinkWrapBlocks: false, reliableMarginRight: true, boxSizingReliable: true, pixelPosition: false }; // Make sure checked status is properly cloned input.checked = true; support.noCloneChecked = input.cloneNode( true ).checked; // Make sure that the options inside disabled selects aren't marked as disabled // (WebKit marks them as disabled) select.disabled = true; support.optDisabled = !opt.disabled; // Support: IE<9 try { delete div.test; } catch( e ) { support.deleteExpando = false; } // Check if we can trust getAttribute("value") input = document.createElement("input"); input.setAttribute( "value", "" ); support.input = input.getAttribute( "value" ) === ""; // Check if an input maintains its value after becoming a radio input.value = "t"; input.setAttribute( "type", "radio" ); support.radioValue = input.value === "t"; // #11217 - WebKit loses check when the name is after the checked attribute input.setAttribute( "checked", "t" ); input.setAttribute( "name", "t" ); fragment = document.createDocumentFragment(); fragment.appendChild( input ); // Check if a disconnected checkbox will retain its checked // value of true after appended to the DOM (IE6/7) support.appendChecked = input.checked; // WebKit doesn't clone checked state correctly in fragments support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; // Support: IE<9 // Opera does not clone events (and typeof div.attachEvent === undefined). // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() if ( div.attachEvent ) { div.attachEvent( "onclick", function() { support.noCloneEvent = false; }); div.cloneNode( true ).click(); } // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event) // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php for ( i in { submit: true, change: true, focusin: true }) { div.setAttribute( eventName = "on" + i, "t" ); support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false; } div.style.backgroundClip = "content-box"; div.cloneNode( true ).style.backgroundClip = ""; support.clearCloneStyle = div.style.backgroundClip === "content-box"; // Run tests that need a body at doc ready jQuery(function() { var container, marginDiv, tds, divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", body = document.getElementsByTagName("body")[0]; if ( !body ) { // Return for frameset docs that don't have a body return; } container = document.createElement("div"); container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; body.appendChild( container ).appendChild( div ); // Support: IE8 // Check if table cells still have offsetWidth/Height when they are set // to display:none and there are still other visible table cells in a // table row; if so, offsetWidth/Height are not reliable for use when // determining if an element has been hidden directly using // display:none (it is still safe to use offsets if a parent element is // hidden; don safety goggles and see bug #4512 for more information). div.innerHTML = "
    t
    "; tds = div.getElementsByTagName("td"); tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; isSupported = ( tds[ 0 ].offsetHeight === 0 ); tds[ 0 ].style.display = ""; tds[ 1 ].style.display = "none"; // Support: IE8 // Check if empty table cells still have offsetWidth/Height support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); // Check box-sizing and margin behavior div.innerHTML = ""; div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; support.boxSizing = ( div.offsetWidth === 4 ); support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); // Use window.getComputedStyle because jsdom on node.js will break without it. if ( window.getComputedStyle ) { support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; // Check if div with explicit width and no margin-right incorrectly // gets computed margin-right based on width of container. (#3333) // Fails in WebKit before Feb 2011 nightlies // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right marginDiv = div.appendChild( document.createElement("div") ); marginDiv.style.cssText = div.style.cssText = divReset; marginDiv.style.marginRight = marginDiv.style.width = "0"; div.style.width = "1px"; support.reliableMarginRight = !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); } if ( typeof div.style.zoom !== core_strundefined ) { // Support: IE<8 // Check if natively block-level elements act like inline-block // elements when setting their display to 'inline' and giving // them layout div.innerHTML = ""; div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); // Support: IE6 // Check if elements with layout shrink-wrap their children div.style.display = "block"; div.innerHTML = "
    "; div.firstChild.style.width = "5px"; support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); if ( support.inlineBlockNeedsLayout ) { // Prevent IE 6 from affecting layout for positioned elements #11048 // Prevent IE from shrinking the body in IE 7 mode #12869 // Support: IE<8 body.style.zoom = 1; } } body.removeChild( container ); // Null elements to avoid leaks in IE container = div = tds = marginDiv = null; }); // Null elements to avoid leaks in IE all = select = fragment = opt = a = input = null; return support; })(); var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, rmultiDash = /([A-Z])/g; function internalData( elem, name, data, pvt /* Internal Use Only */ ){ if ( !jQuery.acceptData( elem ) ) { return; } var thisCache, ret, internalKey = jQuery.expando, getByName = typeof name === "string", // We have to handle DOM nodes and JS objects differently because IE6-7 // can't GC object references properly across the DOM-JS boundary isNode = elem.nodeType, // Only DOM nodes need the global jQuery cache; JS object data is // attached directly to the object so GC can occur automatically cache = isNode ? jQuery.cache : elem, // Only defining an ID for JS objects if its cache already exists allows // the code to shortcut on the same path as a DOM node with no cache id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; // Avoid doing any more work than we need to when trying to get data on an // object that has no data at all if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { return; } if ( !id ) { // Only DOM nodes need a new unique ID for each element since their data // ends up in the global cache if ( isNode ) { elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++; } else { id = internalKey; } } if ( !cache[ id ] ) { cache[ id ] = {}; // Avoids exposing jQuery metadata on plain JS objects when the object // is serialized using JSON.stringify if ( !isNode ) { cache[ id ].toJSON = jQuery.noop; } } // An object can be passed to jQuery.data instead of a key/value pair; this gets // shallow copied over onto the existing cache if ( typeof name === "object" || typeof name === "function" ) { if ( pvt ) { cache[ id ] = jQuery.extend( cache[ id ], name ); } else { cache[ id ].data = jQuery.extend( cache[ id ].data, name ); } } thisCache = cache[ id ]; // jQuery data() is stored in a separate object inside the object's internal data // cache in order to avoid key collisions between internal data and user-defined // data. if ( !pvt ) { if ( !thisCache.data ) { thisCache.data = {}; } thisCache = thisCache.data; } if ( data !== undefined ) { thisCache[ jQuery.camelCase( name ) ] = data; } // Check for both converted-to-camel and non-converted data property names // If a data property was specified if ( getByName ) { // First Try to find as-is property data ret = thisCache[ name ]; // Test for null|undefined property data if ( ret == null ) { // Try to find the camelCased property ret = thisCache[ jQuery.camelCase( name ) ]; } } else { ret = thisCache; } return ret; } function internalRemoveData( elem, name, pvt ) { if ( !jQuery.acceptData( elem ) ) { return; } var i, l, thisCache, isNode = elem.nodeType, // See jQuery.data for more information cache = isNode ? jQuery.cache : elem, id = isNode ? elem[ jQuery.expando ] : jQuery.expando; // If there is already no cache entry for this object, there is no // purpose in continuing if ( !cache[ id ] ) { return; } if ( name ) { thisCache = pvt ? cache[ id ] : cache[ id ].data; if ( thisCache ) { // Support array or space separated string names for data keys if ( !jQuery.isArray( name ) ) { // try the string as a key before any manipulation if ( name in thisCache ) { name = [ name ]; } else { // split the camel cased version by spaces unless a key with the spaces exists name = jQuery.camelCase( name ); if ( name in thisCache ) { name = [ name ]; } else { name = name.split(" "); } } } else { // If "name" is an array of keys... // When data is initially created, via ("key", "val") signature, // keys will be converted to camelCase. // Since there is no way to tell _how_ a key was added, remove // both plain key and camelCase key. #12786 // This will only penalize the array argument path. name = name.concat( jQuery.map( name, jQuery.camelCase ) ); } for ( i = 0, l = name.length; i < l; i++ ) { delete thisCache[ name[i] ]; } // If there is no data left in the cache, we want to continue // and let the cache object itself get destroyed if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { return; } } } // See jQuery.data for more information if ( !pvt ) { delete cache[ id ].data; // Don't destroy the parent cache unless the internal data object // had been the only thing left in it if ( !isEmptyDataObject( cache[ id ] ) ) { return; } } // Destroy the cache if ( isNode ) { jQuery.cleanData( [ elem ], true ); // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) } else if ( jQuery.support.deleteExpando || cache != cache.window ) { delete cache[ id ]; // When all else fails, null } else { cache[ id ] = null; } } jQuery.extend({ cache: {}, // Unique for each copy of jQuery on the page // Non-digits removed to match rinlinejQuery expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ), // The following elements throw uncatchable exceptions if you // attempt to add expando properties to them. noData: { "embed": true, // Ban all objects except for Flash (which handle expandos) "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", "applet": true }, hasData: function( elem ) { elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; return !!elem && !isEmptyDataObject( elem ); }, data: function( elem, name, data ) { return internalData( elem, name, data ); }, removeData: function( elem, name ) { return internalRemoveData( elem, name ); }, // For internal use only. _data: function( elem, name, data ) { return internalData( elem, name, data, true ); }, _removeData: function( elem, name ) { return internalRemoveData( elem, name, true ); }, // A method for determining if a DOM node can handle the data expando acceptData: function( elem ) { // Do not set data on non-element because it will not be cleared (#8335). if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) { return false; } var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; // nodes accept data unless otherwise specified; rejection can be conditional return !noData || noData !== true && elem.getAttribute("classid") === noData; } }); jQuery.fn.extend({ data: function( key, value ) { var attrs, name, elem = this[0], i = 0, data = null; // Gets all values if ( key === undefined ) { if ( this.length ) { data = jQuery.data( elem ); if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { attrs = elem.attributes; for ( ; i < attrs.length; i++ ) { name = attrs[i].name; if ( !name.indexOf( "data-" ) ) { name = jQuery.camelCase( name.slice(5) ); dataAttr( elem, name, data[ name ] ); } } jQuery._data( elem, "parsedAttrs", true ); } } return data; } // Sets multiple values if ( typeof key === "object" ) { return this.each(function() { jQuery.data( this, key ); }); } return jQuery.access( this, function( value ) { if ( value === undefined ) { // Try to fetch any internally stored data first return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null; } this.each(function() { jQuery.data( this, key, value ); }); }, null, value, arguments.length > 1, null, true ); }, removeData: function( key ) { return this.each(function() { jQuery.removeData( this, key ); }); } }); function dataAttr( elem, key, data ) { // If nothing was found internally, try to fetch any // data from the HTML5 data-* attribute if ( data === undefined && elem.nodeType === 1 ) { var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); data = elem.getAttribute( name ); if ( typeof data === "string" ) { try { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : // Only convert to a number if it doesn't change the string +data + "" === data ? +data : rbrace.test( data ) ? jQuery.parseJSON( data ) : data; } catch( e ) {} // Make sure we set the data so it isn't changed later jQuery.data( elem, key, data ); } else { data = undefined; } } return data; } // checks a cache object for emptiness function isEmptyDataObject( obj ) { var name; for ( name in obj ) { // if the public data object is empty, the private is still empty if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { continue; } if ( name !== "toJSON" ) { return false; } } return true; } jQuery.extend({ queue: function( elem, type, data ) { var queue; if ( elem ) { type = ( type || "fx" ) + "queue"; queue = jQuery._data( elem, type ); // Speed up dequeue by getting out quickly if this is just a lookup if ( data ) { if ( !queue || jQuery.isArray(data) ) { queue = jQuery._data( elem, type, jQuery.makeArray(data) ); } else { queue.push( data ); } } return queue || []; } }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jQuery.queue( elem, type ), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks( elem, type ), next = function() { jQuery.dequeue( elem, type ); }; // If the fx queue is dequeued, always remove the progress sentinel if ( fn === "inprogress" ) { fn = queue.shift(); startLength--; } hooks.cur = fn; if ( fn ) { // Add a progress sentinel to prevent the fx queue from being // automatically dequeued if ( type === "fx" ) { queue.unshift( "inprogress" ); } // clear up the last queue stop function delete hooks.stop; fn.call( elem, next, hooks ); } if ( !startLength && hooks ) { hooks.empty.fire(); } }, // not intended for public consumption - generates a queueHooks object, or returns the current one _queueHooks: function( elem, type ) { var key = type + "queueHooks"; return jQuery._data( elem, key ) || jQuery._data( elem, key, { empty: jQuery.Callbacks("once memory").add(function() { jQuery._removeData( elem, type + "queue" ); jQuery._removeData( elem, key ); }) }); } }); jQuery.fn.extend({ queue: function( type, data ) { var setter = 2; if ( typeof type !== "string" ) { data = type; type = "fx"; setter--; } if ( arguments.length < setter ) { return jQuery.queue( this[0], type ); } return data === undefined ? this : this.each(function() { var queue = jQuery.queue( this, type, data ); // ensure a hooks for this queue jQuery._queueHooks( this, type ); if ( type === "fx" && queue[0] !== "inprogress" ) { jQuery.dequeue( this, type ); } }); }, dequeue: function( type ) { return this.each(function() { jQuery.dequeue( this, type ); }); }, // Based off of the plugin by Clint Helfers, with permission. // http://blindsignals.com/index.php/2009/07/jquery-delay/ delay: function( time, type ) { time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; type = type || "fx"; return this.queue( type, function( next, hooks ) { var timeout = setTimeout( next, time ); hooks.stop = function() { clearTimeout( timeout ); }; }); }, clearQueue: function( type ) { return this.queue( type || "fx", [] ); }, // Get a promise resolved when queues of a certain type // are emptied (fx is the type by default) promise: function( type, obj ) { var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function() { if ( !( --count ) ) { defer.resolveWith( elements, [ elements ] ); } }; if ( typeof type !== "string" ) { obj = type; type = undefined; } type = type || "fx"; while( i-- ) { tmp = jQuery._data( elements[ i ], type + "queueHooks" ); if ( tmp && tmp.empty ) { count++; tmp.empty.add( resolve ); } } resolve(); return defer.promise( obj ); } }); var nodeHook, boolHook, rclass = /[\t\r\n]/g, rreturn = /\r/g, rfocusable = /^(?:input|select|textarea|button|object)$/i, rclickable = /^(?:a|area)$/i, rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i, ruseDefault = /^(?:checked|selected)$/i, getSetAttribute = jQuery.support.getSetAttribute, getSetInput = jQuery.support.input; jQuery.fn.extend({ attr: function( name, value ) { return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); }, removeAttr: function( name ) { return this.each(function() { jQuery.removeAttr( this, name ); }); }, prop: function( name, value ) { return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); }, removeProp: function( name ) { name = jQuery.propFix[ name ] || name; return this.each(function() { // try/catch handles cases where IE balks (such as removing a property on window) try { this[ name ] = undefined; delete this[ name ]; } catch( e ) {} }); }, addClass: function( value ) { var classes, elem, cur, clazz, j, i = 0, len = this.length, proceed = typeof value === "string" && value; if ( jQuery.isFunction( value ) ) { return this.each(function( j ) { jQuery( this ).addClass( value.call( this, j, this.className ) ); }); } if ( proceed ) { // The disjunction here is for better compressibility (see removeClass) classes = ( value || "" ).match( core_rnotwhite ) || []; for ( ; i < len; i++ ) { elem = this[ i ]; cur = elem.nodeType === 1 && ( elem.className ? ( " " + elem.className + " " ).replace( rclass, " " ) : " " ); if ( cur ) { j = 0; while ( (clazz = classes[j++]) ) { if ( cur.indexOf( " " + clazz + " " ) < 0 ) { cur += clazz + " "; } } elem.className = jQuery.trim( cur ); } } } return this; }, removeClass: function( value ) { var classes, elem, cur, clazz, j, i = 0, len = this.length, proceed = arguments.length === 0 || typeof value === "string" && value; if ( jQuery.isFunction( value ) ) { return this.each(function( j ) { jQuery( this ).removeClass( value.call( this, j, this.className ) ); }); } if ( proceed ) { classes = ( value || "" ).match( core_rnotwhite ) || []; for ( ; i < len; i++ ) { elem = this[ i ]; // This expression is here for better compressibility (see addClass) cur = elem.nodeType === 1 && ( elem.className ? ( " " + elem.className + " " ).replace( rclass, " " ) : "" ); if ( cur ) { j = 0; while ( (clazz = classes[j++]) ) { // Remove *all* instances while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { cur = cur.replace( " " + clazz + " ", " " ); } } elem.className = value ? jQuery.trim( cur ) : ""; } } } return this; }, toggleClass: function( value, stateVal ) { var type = typeof value, isBool = typeof stateVal === "boolean"; if ( jQuery.isFunction( value ) ) { return this.each(function( i ) { jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); }); } return this.each(function() { if ( type === "string" ) { // toggle individual class names var className, i = 0, self = jQuery( this ), state = stateVal, classNames = value.match( core_rnotwhite ) || []; while ( (className = classNames[ i++ ]) ) { // check each className given, space separated list state = isBool ? state : !self.hasClass( className ); self[ state ? "addClass" : "removeClass" ]( className ); } // Toggle whole class name } else if ( type === core_strundefined || type === "boolean" ) { if ( this.className ) { // store className if set jQuery._data( this, "__className__", this.className ); } // If the element has a class name or if we're passed "false", // then remove the whole classname (if there was one, the above saved it). // Otherwise bring back whatever was previously saved (if anything), // falling back to the empty string if nothing was stored. this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; } }); }, hasClass: function( selector ) { var className = " " + selector + " ", i = 0, l = this.length; for ( ; i < l; i++ ) { if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { return true; } } return false; }, val: function( value ) { var ret, hooks, isFunction, elem = this[0]; if ( !arguments.length ) { if ( elem ) { hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { return ret; } ret = elem.value; return typeof ret === "string" ? // handle most common string cases ret.replace(rreturn, "") : // handle cases where value is null/undef or number ret == null ? "" : ret; } return; } isFunction = jQuery.isFunction( value ); return this.each(function( i ) { var val, self = jQuery(this); if ( this.nodeType !== 1 ) { return; } if ( isFunction ) { val = value.call( this, i, self.val() ); } else { val = value; } // Treat null/undefined as ""; convert numbers to string if ( val == null ) { val = ""; } else if ( typeof val === "number" ) { val += ""; } else if ( jQuery.isArray( val ) ) { val = jQuery.map(val, function ( value ) { return value == null ? "" : value + ""; }); } hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; // If set returns undefined, fall back to normal setting if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { this.value = val; } }); } }); jQuery.extend({ valHooks: { option: { get: function( elem ) { // attributes.value is undefined in Blackberry 4.7 but // uses .value. See #6932 var val = elem.attributes.value; return !val || val.specified ? elem.value : elem.text; } }, select: { get: function( elem ) { var value, option, options = elem.options, index = elem.selectedIndex, one = elem.type === "select-one" || index < 0, values = one ? null : [], max = one ? index + 1 : options.length, i = index < 0 ? max : one ? index : 0; // Loop through all the selected options for ( ; i < max; i++ ) { option = options[ i ]; // oldIE doesn't update selected after form reset (#2551) if ( ( option.selected || i === index ) && // Don't return options that are disabled or in a disabled optgroup ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { // Get the specific value for the option value = jQuery( option ).val(); // We don't need an array for one selects if ( one ) { return value; } // Multi-Selects return an array values.push( value ); } } return values; }, set: function( elem, value ) { var values = jQuery.makeArray( value ); jQuery(elem).find("option").each(function() { this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; }); if ( !values.length ) { elem.selectedIndex = -1; } return values; } } }, attr: function( elem, name, value ) { var hooks, notxml, ret, nType = elem.nodeType; // don't get/set attributes on text, comment and attribute nodes if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return; } // Fallback to prop when attributes are not supported if ( typeof elem.getAttribute === core_strundefined ) { return jQuery.prop( elem, name, value ); } notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); // All attributes are lowercase // Grab necessary hook if one is defined if ( notxml ) { name = name.toLowerCase(); hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); } if ( value !== undefined ) { if ( value === null ) { jQuery.removeAttr( elem, name ); } else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { elem.setAttribute( name, value + "" ); return value; } } else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { return ret; } else { // In IE9+, Flash objects don't have .getAttribute (#12945) // Support: IE9+ if ( typeof elem.getAttribute !== core_strundefined ) { ret = elem.getAttribute( name ); } // Non-existent attributes return null, we normalize to undefined return ret == null ? undefined : ret; } }, removeAttr: function( elem, value ) { var name, propName, i = 0, attrNames = value && value.match( core_rnotwhite ); if ( attrNames && elem.nodeType === 1 ) { while ( (name = attrNames[i++]) ) { propName = jQuery.propFix[ name ] || name; // Boolean attributes get special treatment (#10870) if ( rboolean.test( name ) ) { // Set corresponding property to false for boolean attributes // Also clear defaultChecked/defaultSelected (if appropriate) for IE<8 if ( !getSetAttribute && ruseDefault.test( name ) ) { elem[ jQuery.camelCase( "default-" + name ) ] = elem[ propName ] = false; } else { elem[ propName ] = false; } // See #9699 for explanation of this approach (setting first, then removal) } else { jQuery.attr( elem, name, "" ); } elem.removeAttribute( getSetAttribute ? name : propName ); } } }, attrHooks: { type: { set: function( elem, value ) { if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { // Setting the type on a radio button after the value resets the value in IE6-9 // Reset value to default in case type is set after value during creation var val = elem.value; elem.setAttribute( "type", value ); if ( val ) { elem.value = val; } return value; } } } }, propFix: { tabindex: "tabIndex", readonly: "readOnly", "for": "htmlFor", "class": "className", maxlength: "maxLength", cellspacing: "cellSpacing", cellpadding: "cellPadding", rowspan: "rowSpan", colspan: "colSpan", usemap: "useMap", frameborder: "frameBorder", contenteditable: "contentEditable" }, prop: function( elem, name, value ) { var ret, hooks, notxml, nType = elem.nodeType; // don't get/set properties on text, comment and attribute nodes if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return; } notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); if ( notxml ) { // Fix name and attach hooks name = jQuery.propFix[ name ] || name; hooks = jQuery.propHooks[ name ]; } if ( value !== undefined ) { if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { return ( elem[ name ] = value ); } } else { if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { return ret; } else { return elem[ name ]; } } }, propHooks: { tabIndex: { get: function( elem ) { // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ var attributeNode = elem.getAttributeNode("tabindex"); return attributeNode && attributeNode.specified ? parseInt( attributeNode.value, 10 ) : rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? 0 : undefined; } } } }); // Hook for boolean attributes boolHook = { get: function( elem, name ) { var // Use .prop to determine if this attribute is understood as boolean prop = jQuery.prop( elem, name ), // Fetch it accordingly attr = typeof prop === "boolean" && elem.getAttribute( name ), detail = typeof prop === "boolean" ? getSetInput && getSetAttribute ? attr != null : // oldIE fabricates an empty string for missing boolean attributes // and conflates checked/selected into attroperties ruseDefault.test( name ) ? elem[ jQuery.camelCase( "default-" + name ) ] : !!attr : // fetch an attribute node for properties not recognized as boolean elem.getAttributeNode( name ); return detail && detail.value !== false ? name.toLowerCase() : undefined; }, set: function( elem, value, name ) { if ( value === false ) { // Remove boolean attributes when set to false jQuery.removeAttr( elem, name ); } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { // IE<8 needs the *property* name elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); // Use defaultChecked and defaultSelected for oldIE } else { elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; } return name; } }; // fix oldIE value attroperty if ( !getSetInput || !getSetAttribute ) { jQuery.attrHooks.value = { get: function( elem, name ) { var ret = elem.getAttributeNode( name ); return jQuery.nodeName( elem, "input" ) ? // Ignore the value *property* by using defaultValue elem.defaultValue : ret && ret.specified ? ret.value : undefined; }, set: function( elem, value, name ) { if ( jQuery.nodeName( elem, "input" ) ) { // Does not return so that setAttribute is also used elem.defaultValue = value; } else { // Use nodeHook if defined (#1954); otherwise setAttribute is fine return nodeHook && nodeHook.set( elem, value, name ); } } }; } // IE6/7 do not support getting/setting some attributes with get/setAttribute if ( !getSetAttribute ) { // Use this for any attribute in IE6/7 // This fixes almost every IE6/7 issue nodeHook = jQuery.valHooks.button = { get: function( elem, name ) { var ret = elem.getAttributeNode( name ); return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ? ret.value : undefined; }, set: function( elem, value, name ) { // Set the existing or create a new attribute node var ret = elem.getAttributeNode( name ); if ( !ret ) { elem.setAttributeNode( (ret = elem.ownerDocument.createAttribute( name )) ); } ret.value = value += ""; // Break association with cloned elements by also using setAttribute (#9646) return name === "value" || value === elem.getAttribute( name ) ? value : undefined; } }; // Set contenteditable to false on removals(#10429) // Setting to empty string throws an error as an invalid value jQuery.attrHooks.contenteditable = { get: nodeHook.get, set: function( elem, value, name ) { nodeHook.set( elem, value === "" ? false : value, name ); } }; // Set width and height to auto instead of 0 on empty string( Bug #8150 ) // This is for removals jQuery.each([ "width", "height" ], function( i, name ) { jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { set: function( elem, value ) { if ( value === "" ) { elem.setAttribute( name, "auto" ); return value; } } }); }); } // Some attributes require a special call on IE // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx if ( !jQuery.support.hrefNormalized ) { jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { get: function( elem ) { var ret = elem.getAttribute( name, 2 ); return ret == null ? undefined : ret; } }); }); // href/src property should get the full normalized URL (#10299/#12915) jQuery.each([ "href", "src" ], function( i, name ) { jQuery.propHooks[ name ] = { get: function( elem ) { return elem.getAttribute( name, 4 ); } }; }); } if ( !jQuery.support.style ) { jQuery.attrHooks.style = { get: function( elem ) { // Return undefined in the case of empty string // Note: IE uppercases css property names, but if we were to .toLowerCase() // .cssText, that would destroy case senstitivity in URL's, like in "background" return elem.style.cssText || undefined; }, set: function( elem, value ) { return ( elem.style.cssText = value + "" ); } }; } // Safari mis-reports the default selected property of an option // Accessing the parent's selectedIndex property fixes it if ( !jQuery.support.optSelected ) { jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { get: function( elem ) { var parent = elem.parentNode; if ( parent ) { parent.selectedIndex; // Make sure that it also works with optgroups, see #5701 if ( parent.parentNode ) { parent.parentNode.selectedIndex; } } return null; } }); } // IE6/7 call enctype encoding if ( !jQuery.support.enctype ) { jQuery.propFix.enctype = "encoding"; } // Radios and checkboxes getter/setter if ( !jQuery.support.checkOn ) { jQuery.each([ "radio", "checkbox" ], function() { jQuery.valHooks[ this ] = { get: function( elem ) { // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified return elem.getAttribute("value") === null ? "on" : elem.value; } }; }); } jQuery.each([ "radio", "checkbox" ], function() { jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { set: function( elem, value ) { if ( jQuery.isArray( value ) ) { return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); } } }); }); var rformElems = /^(?:input|select|textarea)$/i, rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|contextmenu)|click/, rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; function returnTrue() { return true; } function returnFalse() { return false; } /* * Helper functions for managing events -- not part of the public interface. * Props to Dean Edwards' addEvent library for many of the ideas. */ jQuery.event = { global: {}, add: function( elem, types, handler, data, selector ) { var tmp, events, t, handleObjIn, special, eventHandle, handleObj, handlers, type, namespaces, origType, elemData = jQuery._data( elem ); // Don't attach events to noData or text/comment nodes (but allow plain objects) if ( !elemData ) { return; } // Caller can pass in an object of custom data in lieu of the handler if ( handler.handler ) { handleObjIn = handler; handler = handleObjIn.handler; selector = handleObjIn.selector; } // Make sure that the handler has a unique ID, used to find/remove it later if ( !handler.guid ) { handler.guid = jQuery.guid++; } // Init the element's event structure and main handler, if this is the first if ( !(events = elemData.events) ) { events = elemData.events = {}; } if ( !(eventHandle = elemData.handle) ) { eventHandle = elemData.handle = function( e ) { // Discard the second event of a jQuery.event.trigger() and // when an event is called after a page has unloaded return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ? jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : undefined; }; // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events eventHandle.elem = elem; } // Handle multiple events separated by a space // jQuery(...).bind("mouseover mouseout", fn); types = ( types || "" ).match( core_rnotwhite ) || [""]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[t] ) || []; type = origType = tmp[1]; namespaces = ( tmp[2] || "" ).split( "." ).sort(); // If event changes its type, use the special event handlers for the changed type special = jQuery.event.special[ type ] || {}; // If selector defined, determine special event api type, otherwise given type type = ( selector ? special.delegateType : special.bindType ) || type; // Update special based on newly reset type special = jQuery.event.special[ type ] || {}; // handleObj is passed to all event handlers handleObj = jQuery.extend({ type: type, origType: origType, data: data, handler: handler, guid: handler.guid, selector: selector, needsContext: selector && jQuery.expr.match.needsContext.test( selector ), namespace: namespaces.join(".") }, handleObjIn ); // Init the event handler queue if we're the first if ( !(handlers = events[ type ]) ) { handlers = events[ type ] = []; handlers.delegateCount = 0; // Only use addEventListener/attachEvent if the special events handler returns false if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { // Bind the global event handler to the element if ( elem.addEventListener ) { elem.addEventListener( type, eventHandle, false ); } else if ( elem.attachEvent ) { elem.attachEvent( "on" + type, eventHandle ); } } } if ( special.add ) { special.add.call( elem, handleObj ); if ( !handleObj.handler.guid ) { handleObj.handler.guid = handler.guid; } } // Add to the element's handler list, delegates in front if ( selector ) { handlers.splice( handlers.delegateCount++, 0, handleObj ); } else { handlers.push( handleObj ); } // Keep track of which events have ever been used, for event optimization jQuery.event.global[ type ] = true; } // Nullify elem to prevent memory leaks in IE elem = null; }, // Detach an event or set of events from an element remove: function( elem, types, handler, selector, mappedTypes ) { var j, handleObj, tmp, origCount, t, events, special, handlers, type, namespaces, origType, elemData = jQuery.hasData( elem ) && jQuery._data( elem ); if ( !elemData || !(events = elemData.events) ) { return; } // Once for each type.namespace in types; type may be omitted types = ( types || "" ).match( core_rnotwhite ) || [""]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[t] ) || []; type = origType = tmp[1]; namespaces = ( tmp[2] || "" ).split( "." ).sort(); // Unbind all events (on this namespace, if provided) for the element if ( !type ) { for ( type in events ) { jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); } continue; } special = jQuery.event.special[ type ] || {}; type = ( selector ? special.delegateType : special.bindType ) || type; handlers = events[ type ] || []; tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); // Remove matching events origCount = j = handlers.length; while ( j-- ) { handleObj = handlers[ j ]; if ( ( mappedTypes || origType === handleObj.origType ) && ( !handler || handler.guid === handleObj.guid ) && ( !tmp || tmp.test( handleObj.namespace ) ) && ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { handlers.splice( j, 1 ); if ( handleObj.selector ) { handlers.delegateCount--; } if ( special.remove ) { special.remove.call( elem, handleObj ); } } } // Remove generic event handler if we removed something and no more handlers exist // (avoids potential for endless recursion during removal of special event handlers) if ( origCount && !handlers.length ) { if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { jQuery.removeEvent( elem, type, elemData.handle ); } delete events[ type ]; } } // Remove the expando if it's no longer used if ( jQuery.isEmptyObject( events ) ) { delete elemData.handle; // removeData also checks for emptiness and clears the expando if empty // so use it instead of delete jQuery._removeData( elem, "events" ); } }, trigger: function( event, data, elem, onlyHandlers ) { var handle, ontype, cur, bubbleType, special, tmp, i, eventPath = [ elem || document ], type = core_hasOwn.call( event, "type" ) ? event.type : event, namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; cur = tmp = elem = elem || document; // Don't do events on text and comment nodes if ( elem.nodeType === 3 || elem.nodeType === 8 ) { return; } // focus/blur morphs to focusin/out; ensure we're not firing them right now if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { return; } if ( type.indexOf(".") >= 0 ) { // Namespaced trigger; create a regexp to match event type in handle() namespaces = type.split("."); type = namespaces.shift(); namespaces.sort(); } ontype = type.indexOf(":") < 0 && "on" + type; // Caller can pass in a jQuery.Event object, Object, or just an event type string event = event[ jQuery.expando ] ? event : new jQuery.Event( type, typeof event === "object" && event ); event.isTrigger = true; event.namespace = namespaces.join("."); event.namespace_re = event.namespace ? new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : null; // Clean up the event in case it is being reused event.result = undefined; if ( !event.target ) { event.target = elem; } // Clone any incoming data and prepend the event, creating the handler arg list data = data == null ? [ event ] : jQuery.makeArray( data, [ event ] ); // Allow special events to draw outside the lines special = jQuery.event.special[ type ] || {}; if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { return; } // Determine event propagation path in advance, per W3C events spec (#9951) // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { bubbleType = special.delegateType || type; if ( !rfocusMorph.test( bubbleType + type ) ) { cur = cur.parentNode; } for ( ; cur; cur = cur.parentNode ) { eventPath.push( cur ); tmp = cur; } // Only add window if we got to document (e.g., not plain obj or detached DOM) if ( tmp === (elem.ownerDocument || document) ) { eventPath.push( tmp.defaultView || tmp.parentWindow || window ); } } // Fire handlers on the event path i = 0; while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { event.type = i > 1 ? bubbleType : special.bindType || type; // jQuery handler handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); if ( handle ) { handle.apply( cur, data ); } // Native handler handle = ontype && cur[ ontype ]; if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { event.preventDefault(); } } event.type = type; // If nobody prevented the default action, do it now if ( !onlyHandlers && !event.isDefaultPrevented() ) { if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { // Call a native DOM method on the target with the same name name as the event. // Can't use an .isFunction() check here because IE6/7 fails that test. // Don't do default actions on window, that's where global variables be (#6170) if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { // Don't re-trigger an onFOO event when we call its FOO() method tmp = elem[ ontype ]; if ( tmp ) { elem[ ontype ] = null; } // Prevent re-triggering of the same event, since we already bubbled it above jQuery.event.triggered = type; try { elem[ type ](); } catch ( e ) { // IE<9 dies on focus/blur to hidden element (#1486,#12518) // only reproducible on winXP IE8 native, not IE9 in IE8 mode } jQuery.event.triggered = undefined; if ( tmp ) { elem[ ontype ] = tmp; } } } } return event.result; }, dispatch: function( event ) { // Make a writable jQuery.Event from the native event object event = jQuery.event.fix( event ); var i, ret, handleObj, matched, j, handlerQueue = [], args = core_slice.call( arguments ), handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], special = jQuery.event.special[ event.type ] || {}; // Use the fix-ed jQuery.Event rather than the (read-only) native event args[0] = event; event.delegateTarget = this; // Call the preDispatch hook for the mapped type, and let it bail if desired if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { return; } // Determine handlers handlerQueue = jQuery.event.handlers.call( this, event, handlers ); // Run delegates first; they may want to stop propagation beneath us i = 0; while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { event.currentTarget = matched.elem; j = 0; while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { // Triggered event must either 1) have no namespace, or // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { event.handleObj = handleObj; event.data = handleObj.data; ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) .apply( matched.elem, args ); if ( ret !== undefined ) { if ( (event.result = ret) === false ) { event.preventDefault(); event.stopPropagation(); } } } } } // Call the postDispatch hook for the mapped type if ( special.postDispatch ) { special.postDispatch.call( this, event ); } return event.result; }, handlers: function( event, handlers ) { var sel, handleObj, matches, i, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target; // Find delegate handlers // Black-hole SVG instance trees (#13180) // Avoid non-left-click bubbling in Firefox (#3861) if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { for ( ; cur != this; cur = cur.parentNode || this ) { // Don't check non-elements (#13208) // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { matches = []; for ( i = 0; i < delegateCount; i++ ) { handleObj = handlers[ i ]; // Don't conflict with Object.prototype properties (#13203) sel = handleObj.selector + " "; if ( matches[ sel ] === undefined ) { matches[ sel ] = handleObj.needsContext ? jQuery( sel, this ).index( cur ) >= 0 : jQuery.find( sel, this, null, [ cur ] ).length; } if ( matches[ sel ] ) { matches.push( handleObj ); } } if ( matches.length ) { handlerQueue.push({ elem: cur, handlers: matches }); } } } } // Add the remaining (directly-bound) handlers if ( delegateCount < handlers.length ) { handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); } return handlerQueue; }, fix: function( event ) { if ( event[ jQuery.expando ] ) { return event; } // Create a writable copy of the event object and normalize some properties var i, prop, copy, type = event.type, originalEvent = event, fixHook = this.fixHooks[ type ]; if ( !fixHook ) { this.fixHooks[ type ] = fixHook = rmouseEvent.test( type ) ? this.mouseHooks : rkeyEvent.test( type ) ? this.keyHooks : {}; } copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; event = new jQuery.Event( originalEvent ); i = copy.length; while ( i-- ) { prop = copy[ i ]; event[ prop ] = originalEvent[ prop ]; } // Support: IE<9 // Fix target property (#1925) if ( !event.target ) { event.target = originalEvent.srcElement || document; } // Support: Chrome 23+, Safari? // Target should not be a text node (#504, #13143) if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; } // Support: IE<9 // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) event.metaKey = !!event.metaKey; return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; }, // Includes some event props shared by KeyEvent and MouseEvent props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), fixHooks: {}, keyHooks: { props: "char charCode key keyCode".split(" "), filter: function( event, original ) { // Add which for key events if ( event.which == null ) { event.which = original.charCode != null ? original.charCode : original.keyCode; } return event; } }, mouseHooks: { props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), filter: function( event, original ) { var body, eventDoc, doc, button = original.button, fromElement = original.fromElement; // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && original.clientX != null ) { eventDoc = event.target.ownerDocument || document; doc = eventDoc.documentElement; body = eventDoc.body; event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); } // Add relatedTarget, if necessary if ( !event.relatedTarget && fromElement ) { event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; } // Add which for click: 1 === left; 2 === middle; 3 === right // Note: button is not normalized, so don't use it if ( !event.which && button !== undefined ) { event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); } return event; } }, special: { load: { // Prevent triggered image.load events from bubbling to window.load noBubble: true }, click: { // For checkbox, fire native event so checked state will be right trigger: function() { if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { this.click(); return false; } } }, focus: { // Fire native event if possible so blur/focus sequence is correct trigger: function() { if ( this !== document.activeElement && this.focus ) { try { this.focus(); return false; } catch ( e ) { // Support: IE<9 // If we error on focus to hidden element (#1486, #12518), // let .trigger() run the handlers } } }, delegateType: "focusin" }, blur: { trigger: function() { if ( this === document.activeElement && this.blur ) { this.blur(); return false; } }, delegateType: "focusout" }, beforeunload: { postDispatch: function( event ) { // Even when returnValue equals to undefined Firefox will still show alert if ( event.result !== undefined ) { event.originalEvent.returnValue = event.result; } } } }, simulate: function( type, elem, event, bubble ) { // Piggyback on a donor event to simulate a different one. // Fake originalEvent to avoid donor's stopPropagation, but if the // simulated event prevents default then we do the same on the donor. var e = jQuery.extend( new jQuery.Event(), event, { type: type, isSimulated: true, originalEvent: {} } ); if ( bubble ) { jQuery.event.trigger( e, null, elem ); } else { jQuery.event.dispatch.call( elem, e ); } if ( e.isDefaultPrevented() ) { event.preventDefault(); } } }; jQuery.removeEvent = document.removeEventListener ? function( elem, type, handle ) { if ( elem.removeEventListener ) { elem.removeEventListener( type, handle, false ); } } : function( elem, type, handle ) { var name = "on" + type; if ( elem.detachEvent ) { // #8545, #7054, preventing memory leaks for custom events in IE6-8 // detachEvent needed property on element, by name of that event, to properly expose it to GC if ( typeof elem[ name ] === core_strundefined ) { elem[ name ] = null; } elem.detachEvent( name, handle ); } }; jQuery.Event = function( src, props ) { // Allow instantiation without the 'new' keyword if ( !(this instanceof jQuery.Event) ) { return new jQuery.Event( src, props ); } // Event object if ( src && src.type ) { this.originalEvent = src; this.type = src.type; // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; // Event type } else { this.type = src; } // Put explicitly provided properties onto the event object if ( props ) { jQuery.extend( this, props ); } // Create a timestamp if incoming event doesn't have one this.timeStamp = src && src.timeStamp || jQuery.now(); // Mark it as fixed this[ jQuery.expando ] = true; }; // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse, preventDefault: function() { var e = this.originalEvent; this.isDefaultPrevented = returnTrue; if ( !e ) { return; } // If preventDefault exists, run it on the original event if ( e.preventDefault ) { e.preventDefault(); // Support: IE // Otherwise set the returnValue property of the original event to false } else { e.returnValue = false; } }, stopPropagation: function() { var e = this.originalEvent; this.isPropagationStopped = returnTrue; if ( !e ) { return; } // If stopPropagation exists, run it on the original event if ( e.stopPropagation ) { e.stopPropagation(); } // Support: IE // Set the cancelBubble property of the original event to true e.cancelBubble = true; }, stopImmediatePropagation: function() { this.isImmediatePropagationStopped = returnTrue; this.stopPropagation(); } }; // Create mouseenter/leave events using mouseover/out and event-time checks jQuery.each({ mouseenter: "mouseover", mouseleave: "mouseout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { delegateType: fix, bindType: fix, handle: function( event ) { var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj; // For mousenter/leave call the handler if related is outside the target. // NB: No relatedTarget if the mouse left/entered the browser window if ( !related || (related !== target && !jQuery.contains( target, related )) ) { event.type = handleObj.origType; ret = handleObj.handler.apply( this, arguments ); event.type = fix; } return ret; } }; }); // IE submit delegation if ( !jQuery.support.submitBubbles ) { jQuery.event.special.submit = { setup: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Lazy-add a submit handler when a descendant form may potentially be submitted jQuery.event.add( this, "click._submit keypress._submit", function( e ) { // Node name check avoids a VML-related crash in IE (#9807) var elem = e.target, form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; if ( form && !jQuery._data( form, "submitBubbles" ) ) { jQuery.event.add( form, "submit._submit", function( event ) { event._submit_bubble = true; }); jQuery._data( form, "submitBubbles", true ); } }); // return undefined since we don't need an event listener }, postDispatch: function( event ) { // If form was submitted by the user, bubble the event up the tree if ( event._submit_bubble ) { delete event._submit_bubble; if ( this.parentNode && !event.isTrigger ) { jQuery.event.simulate( "submit", this.parentNode, event, true ); } } }, teardown: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Remove delegated handlers; cleanData eventually reaps submit handlers attached above jQuery.event.remove( this, "._submit" ); } }; } // IE change delegation and checkbox/radio fix if ( !jQuery.support.changeBubbles ) { jQuery.event.special.change = { setup: function() { if ( rformElems.test( this.nodeName ) ) { // IE doesn't fire change on a check/radio until blur; trigger it on click // after a propertychange. Eat the blur-change in special.change.handle. // This still fires onchange a second time for check/radio after blur. if ( this.type === "checkbox" || this.type === "radio" ) { jQuery.event.add( this, "propertychange._change", function( event ) { if ( event.originalEvent.propertyName === "checked" ) { this._just_changed = true; } }); jQuery.event.add( this, "click._change", function( event ) { if ( this._just_changed && !event.isTrigger ) { this._just_changed = false; } // Allow triggered, simulated change events (#11500) jQuery.event.simulate( "change", this, event, true ); }); } return false; } // Delegated event; lazy-add a change handler on descendant inputs jQuery.event.add( this, "beforeactivate._change", function( e ) { var elem = e.target; if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { jQuery.event.add( elem, "change._change", function( event ) { if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { jQuery.event.simulate( "change", this.parentNode, event, true ); } }); jQuery._data( elem, "changeBubbles", true ); } }); }, handle: function( event ) { var elem = event.target; // Swallow native change events from checkbox/radio, we already triggered them above if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { return event.handleObj.handler.apply( this, arguments ); } }, teardown: function() { jQuery.event.remove( this, "._change" ); return !rformElems.test( this.nodeName ); } }; } // Create "bubbling" focus and blur events if ( !jQuery.support.focusinBubbles ) { jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { // Attach a single capturing handler while someone wants focusin/focusout var attaches = 0, handler = function( event ) { jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); }; jQuery.event.special[ fix ] = { setup: function() { if ( attaches++ === 0 ) { document.addEventListener( orig, handler, true ); } }, teardown: function() { if ( --attaches === 0 ) { document.removeEventListener( orig, handler, true ); } } }; }); } jQuery.fn.extend({ on: function( types, selector, data, fn, /*INTERNAL*/ one ) { var type, origFn; // Types can be a map of types/handlers if ( typeof types === "object" ) { // ( types-Object, selector, data ) if ( typeof selector !== "string" ) { // ( types-Object, data ) data = data || selector; selector = undefined; } for ( type in types ) { this.on( type, selector, data, types[ type ], one ); } return this; } if ( data == null && fn == null ) { // ( types, fn ) fn = selector; data = selector = undefined; } else if ( fn == null ) { if ( typeof selector === "string" ) { // ( types, selector, fn ) fn = data; data = undefined; } else { // ( types, data, fn ) fn = data; data = selector; selector = undefined; } } if ( fn === false ) { fn = returnFalse; } else if ( !fn ) { return this; } if ( one === 1 ) { origFn = fn; fn = function( event ) { // Can use an empty set, since event contains the info jQuery().off( event ); return origFn.apply( this, arguments ); }; // Use same guid so caller can remove using origFn fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); } return this.each( function() { jQuery.event.add( this, types, fn, data, selector ); }); }, one: function( types, selector, data, fn ) { return this.on( types, selector, data, fn, 1 ); }, off: function( types, selector, fn ) { var handleObj, type; if ( types && types.preventDefault && types.handleObj ) { // ( event ) dispatched jQuery.Event handleObj = types.handleObj; jQuery( types.delegateTarget ).off( handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler ); return this; } if ( typeof types === "object" ) { // ( types-object [, selector] ) for ( type in types ) { this.off( type, selector, types[ type ] ); } return this; } if ( selector === false || typeof selector === "function" ) { // ( types [, fn] ) fn = selector; selector = undefined; } if ( fn === false ) { fn = returnFalse; } return this.each(function() { jQuery.event.remove( this, types, fn, selector ); }); }, bind: function( types, data, fn ) { return this.on( types, null, data, fn ); }, unbind: function( types, fn ) { return this.off( types, null, fn ); }, delegate: function( selector, types, data, fn ) { return this.on( types, selector, data, fn ); }, undelegate: function( selector, types, fn ) { // ( namespace ) or ( selector, types [, fn] ) return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); }, trigger: function( type, data ) { return this.each(function() { jQuery.event.trigger( type, data, this ); }); }, triggerHandler: function( type, data ) { var elem = this[0]; if ( elem ) { return jQuery.event.trigger( type, data, elem, true ); } } }); /*! * Sizzle CSS Selector Engine * Copyright 2012 jQuery Foundation and other contributors * Released under the MIT license * http://sizzlejs.com/ */ (function( window, undefined ) { var i, cachedruns, Expr, getText, isXML, compile, hasDuplicate, outermostContext, // Local document vars setDocument, document, docElem, documentIsXML, rbuggyQSA, rbuggyMatches, matches, contains, sortOrder, // Instance-specific data expando = "sizzle" + -(new Date()), preferredDoc = window.document, support = {}, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), // General-purpose constants strundefined = typeof undefined, MAX_NEGATIVE = 1 << 31, // Array methods arr = [], pop = arr.pop, push = arr.push, slice = arr.slice, // Use a stripped-down indexOf if we can't use a native one indexOf = arr.indexOf || function( elem ) { var i = 0, len = this.length; for ( ; i < len; i++ ) { if ( this[i] === elem ) { return i; } } return -1; }, // Regular expressions // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace whitespace = "[\\x20\\t\\r\\n\\f]", // http://www.w3.org/TR/css3-syntax/#characters characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", // Loosely modeled on CSS identifier characters // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier identifier = characterEncoding.replace( "w", "w#" ), // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors operators = "([*^$|!~]?=)", attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", // Prefer arguments quoted, // then not containing pseudos/brackets, // then attribute selectors/non-parenthetical expressions, // then anything else // These preferences are here to reduce the number of selectors // needing tokenize in the PSEUDO preFilter pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), rpseudo = new RegExp( pseudos ), ridentifier = new RegExp( "^" + identifier + "$" ), matchExpr = { "ID": new RegExp( "^#(" + characterEncoding + ")" ), "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), "ATTR": new RegExp( "^" + attributes ), "PSEUDO": new RegExp( "^" + pseudos ), "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), // For use in libraries implementing .is() // We use this for POS matching in `select` "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) }, rsibling = /[\x20\t\r\n\f]*[+~]/, rnative = /^[^{]+\{\s*\[native code/, // Easily-parseable/retrievable ID or TAG or CLASS selectors rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rescape = /'|\\/g, rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g, funescape = function( _, escaped ) { var high = "0x" + escaped - 0x10000; // NaN means non-codepoint return high !== high ? escaped : // BMP codepoint high < 0 ? String.fromCharCode( high + 0x10000 ) : // Supplemental Plane codepoint (surrogate pair) String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); }; // Use a stripped-down slice if we can't use a native one try { slice.call( preferredDoc.documentElement.childNodes, 0 )[0].nodeType; } catch ( e ) { slice = function( i ) { var elem, results = []; while ( (elem = this[i++]) ) { results.push( elem ); } return results; }; } /** * For feature detection * @param {Function} fn The function to test for native support */ function isNative( fn ) { return rnative.test( fn + "" ); } /** * Create key-value caches of limited size * @returns {Function(string, Object)} Returns the Object data after storing it on itself with * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) * deleting the oldest entry */ function createCache() { var cache, keys = []; return (cache = function( key, value ) { // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) if ( keys.push( key += " " ) > Expr.cacheLength ) { // Only keep the most recent entries delete cache[ keys.shift() ]; } return (cache[ key ] = value); }); } /** * Mark a function for special use by Sizzle * @param {Function} fn The function to mark */ function markFunction( fn ) { fn[ expando ] = true; return fn; } /** * Support testing using an element * @param {Function} fn Passed the created div and expects a boolean result */ function assert( fn ) { var div = document.createElement("div"); try { return fn( div ); } catch (e) { return false; } finally { // release memory in IE div = null; } } function Sizzle( selector, context, results, seed ) { var match, elem, m, nodeType, // QSA vars i, groups, old, nid, newContext, newSelector; if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { setDocument( context ); } context = context || document; results = results || []; if ( !selector || typeof selector !== "string" ) { return results; } if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { return []; } if ( !documentIsXML && !seed ) { // Shortcuts if ( (match = rquickExpr.exec( selector )) ) { // Speed-up: Sizzle("#ID") if ( (m = match[1]) ) { if ( nodeType === 9 ) { elem = context.getElementById( m ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE, Opera, and Webkit return items // by name instead of ID if ( elem.id === m ) { results.push( elem ); return results; } } else { return results; } } else { // Context is not a document if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && contains( context, elem ) && elem.id === m ) { results.push( elem ); return results; } } // Speed-up: Sizzle("TAG") } else if ( match[2] ) { push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); return results; // Speed-up: Sizzle(".CLASS") } else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) { push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); return results; } } // QSA path if ( support.qsa && !rbuggyQSA.test(selector) ) { old = true; nid = expando; newContext = context; newSelector = nodeType === 9 && selector; // qSA works strangely on Element-rooted queries // We can work around this by specifying an extra ID on the root // and working up from there (Thanks to Andrew Dupont for the technique) // IE 8 doesn't work on object elements if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { groups = tokenize( selector ); if ( (old = context.getAttribute("id")) ) { nid = old.replace( rescape, "\\$&" ); } else { context.setAttribute( "id", nid ); } nid = "[id='" + nid + "'] "; i = groups.length; while ( i-- ) { groups[i] = nid + toSelector( groups[i] ); } newContext = rsibling.test( selector ) && context.parentNode || context; newSelector = groups.join(","); } if ( newSelector ) { try { push.apply( results, slice.call( newContext.querySelectorAll( newSelector ), 0 ) ); return results; } catch(qsaError) { } finally { if ( !old ) { context.removeAttribute("id"); } } } } } // All others return select( selector.replace( rtrim, "$1" ), context, results, seed ); } /** * Detect xml * @param {Element|Object} elem An element or a document */ isXML = Sizzle.isXML = function( elem ) { // documentElement is verified for cases where it doesn't yet exist // (such as loading iframes in IE - #4833) var documentElement = elem && (elem.ownerDocument || elem).documentElement; return documentElement ? documentElement.nodeName !== "HTML" : false; }; /** * Sets document-related variables once based on the current document * @param {Element|Object} [doc] An element or document object to use to set the document * @returns {Object} Returns the current document */ setDocument = Sizzle.setDocument = function( node ) { var doc = node ? node.ownerDocument || node : preferredDoc; // If no document and documentElement is available, return if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { return document; } // Set our document document = doc; docElem = doc.documentElement; // Support tests documentIsXML = isXML( doc ); // Check if getElementsByTagName("*") returns only elements support.tagNameNoComments = assert(function( div ) { div.appendChild( doc.createComment("") ); return !div.getElementsByTagName("*").length; }); // Check if attributes should be retrieved by attribute nodes support.attributes = assert(function( div ) { div.innerHTML = ""; var type = typeof div.lastChild.getAttribute("multiple"); // IE8 returns a string for some attributes even when not present return type !== "boolean" && type !== "string"; }); // Check if getElementsByClassName can be trusted support.getByClassName = assert(function( div ) { // Opera can't find a second classname (in 9.6) div.innerHTML = ""; if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { return false; } // Safari 3.2 caches class attributes and doesn't catch changes div.lastChild.className = "e"; return div.getElementsByClassName("e").length === 2; }); // Check if getElementById returns elements by name // Check if getElementsByName privileges form controls or returns elements by ID support.getByName = assert(function( div ) { // Inject content div.id = expando + 0; div.innerHTML = "
    "; docElem.insertBefore( div, docElem.firstChild ); // Test var pass = doc.getElementsByName && // buggy browsers will return fewer than the correct 2 doc.getElementsByName( expando ).length === 2 + // buggy browsers will return more than the correct 0 doc.getElementsByName( expando + 0 ).length; support.getIdNotName = !doc.getElementById( expando ); // Cleanup docElem.removeChild( div ); return pass; }); // IE6/7 return modified attributes Expr.attrHandle = assert(function( div ) { div.innerHTML = ""; return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && div.firstChild.getAttribute("href") === "#"; }) ? {} : { "href": function( elem ) { return elem.getAttribute( "href", 2 ); }, "type": function( elem ) { return elem.getAttribute("type"); } }; // ID find and filter if ( support.getIdNotName ) { Expr.find["ID"] = function( id, context ) { if ( typeof context.getElementById !== strundefined && !documentIsXML ) { var m = context.getElementById( id ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 return m && m.parentNode ? [m] : []; } }; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { return elem.getAttribute("id") === attrId; }; }; } else { Expr.find["ID"] = function( id, context ) { if ( typeof context.getElementById !== strundefined && !documentIsXML ) { var m = context.getElementById( id ); return m ? m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? [m] : undefined : []; } }; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); return node && node.value === attrId; }; }; } // Tag Expr.find["TAG"] = support.tagNameNoComments ? function( tag, context ) { if ( typeof context.getElementsByTagName !== strundefined ) { return context.getElementsByTagName( tag ); } } : function( tag, context ) { var elem, tmp = [], i = 0, results = context.getElementsByTagName( tag ); // Filter out possible comments if ( tag === "*" ) { while ( (elem = results[i++]) ) { if ( elem.nodeType === 1 ) { tmp.push( elem ); } } return tmp; } return results; }; // Name Expr.find["NAME"] = support.getByName && function( tag, context ) { if ( typeof context.getElementsByName !== strundefined ) { return context.getElementsByName( name ); } }; // Class Expr.find["CLASS"] = support.getByClassName && function( className, context ) { if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) { return context.getElementsByClassName( className ); } }; // QSA and matchesSelector support // matchesSelector(:active) reports false when true (IE9/Opera 11.5) rbuggyMatches = []; // qSa(:focus) reports false when true (Chrome 21), // no need to also add to buggyMatches since matches checks buggyQSA // A support test would require too much code (would include document ready) rbuggyQSA = [ ":focus" ]; if ( (support.qsa = isNative(doc.querySelectorAll)) ) { // Build QSA regex // Regex strategy adopted from Diego Perini assert(function( div ) { // Select is set to empty string on purpose // This is to test IE's treatment of not explictly // setting a boolean content attribute, // since its presence should be enough // http://bugs.jquery.com/ticket/12359 div.innerHTML = ""; // IE8 - Some boolean attributes are not treated correctly if ( !div.querySelectorAll("[selected]").length ) { rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); } // Webkit/Opera - :checked should return selected option elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked // IE8 throws error here and will not see later tests if ( !div.querySelectorAll(":checked").length ) { rbuggyQSA.push(":checked"); } }); assert(function( div ) { // Opera 10-12/IE8 - ^= $= *= and empty values // Should not select anything div.innerHTML = ""; if ( div.querySelectorAll("[i^='']").length ) { rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); } // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) // IE8 throws error here and will not see later tests if ( !div.querySelectorAll(":enabled").length ) { rbuggyQSA.push( ":enabled", ":disabled" ); } // Opera 10-11 does not throw on post-comma invalid pseudos div.querySelectorAll("*,:x"); rbuggyQSA.push(",.*:"); }); } if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector || docElem.mozMatchesSelector || docElem.webkitMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector) )) ) { assert(function( div ) { // Check to see if it's possible to do matchesSelector // on a disconnected node (IE 9) support.disconnectedMatch = matches.call( div, "div" ); // This should fail with an exception // Gecko does not error, returns false instead matches.call( div, "[s!='']:x" ); rbuggyMatches.push( "!=", pseudos ); }); } rbuggyQSA = new RegExp( rbuggyQSA.join("|") ); rbuggyMatches = new RegExp( rbuggyMatches.join("|") ); // Element contains another // Purposefully does not implement inclusive descendent // As in, an element does not contain itself contains = isNative(docElem.contains) || docElem.compareDocumentPosition ? function( a, b ) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; return a === bup || !!( bup && bup.nodeType === 1 && ( adown.contains ? adown.contains( bup ) : a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 )); } : function( a, b ) { if ( b ) { while ( (b = b.parentNode) ) { if ( b === a ) { return true; } } } return false; }; // Document order sorting sortOrder = docElem.compareDocumentPosition ? function( a, b ) { var compare; if ( a === b ) { hasDuplicate = true; return 0; } if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) { if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) { if ( a === doc || contains( preferredDoc, a ) ) { return -1; } if ( b === doc || contains( preferredDoc, b ) ) { return 1; } return 0; } return compare & 4 ? -1 : 1; } return a.compareDocumentPosition ? -1 : 1; } : function( a, b ) { var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [ a ], bp = [ b ]; // Exit early if the nodes are identical if ( a === b ) { hasDuplicate = true; return 0; // Parentless nodes are either documents or disconnected } else if ( !aup || !bup ) { return a === doc ? -1 : b === doc ? 1 : aup ? -1 : bup ? 1 : 0; // If the nodes are siblings, we can do a quick check } else if ( aup === bup ) { return siblingCheck( a, b ); } // Otherwise we need full lists of their ancestors for comparison cur = a; while ( (cur = cur.parentNode) ) { ap.unshift( cur ); } cur = b; while ( (cur = cur.parentNode) ) { bp.unshift( cur ); } // Walk down the tree looking for a discrepancy while ( ap[i] === bp[i] ) { i++; } return i ? // Do a sibling check if the nodes have a common ancestor siblingCheck( ap[i], bp[i] ) : // Otherwise nodes in our document sort first ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0; }; // Always assume the presence of duplicates if sort doesn't // pass them to our comparison function (as in Google Chrome). hasDuplicate = false; [0, 0].sort( sortOrder ); support.detectDuplicates = hasDuplicate; return document; }; Sizzle.matches = function( expr, elements ) { return Sizzle( expr, null, null, elements ); }; Sizzle.matchesSelector = function( elem, expr ) { // Set document vars if needed if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } // Make sure that attribute selectors are quoted expr = expr.replace( rattributeQuotes, "='$1']" ); // rbuggyQSA always contains :focus, so no need for an existence check if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) { try { var ret = matches.call( elem, expr ); // IE 9's matchesSelector returns false on disconnected nodes if ( ret || support.disconnectedMatch || // As well, disconnected nodes are said to be in a document // fragment in IE 9 elem.document && elem.document.nodeType !== 11 ) { return ret; } } catch(e) {} } return Sizzle( expr, document, null, [elem] ).length > 0; }; Sizzle.contains = function( context, elem ) { // Set document vars if needed if ( ( context.ownerDocument || context ) !== document ) { setDocument( context ); } return contains( context, elem ); }; Sizzle.attr = function( elem, name ) { var val; // Set document vars if needed if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } if ( !documentIsXML ) { name = name.toLowerCase(); } if ( (val = Expr.attrHandle[ name ]) ) { return val( elem ); } if ( documentIsXML || support.attributes ) { return elem.getAttribute( name ); } return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ? name : val && val.specified ? val.value : null; }; Sizzle.error = function( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); }; // Document sorting and removing duplicates Sizzle.uniqueSort = function( results ) { var elem, duplicates = [], i = 1, j = 0; // Unless we *know* we can detect duplicates, assume their presence hasDuplicate = !support.detectDuplicates; results.sort( sortOrder ); if ( hasDuplicate ) { for ( ; (elem = results[i]); i++ ) { if ( elem === results[ i - 1 ] ) { j = duplicates.push( i ); } } while ( j-- ) { results.splice( duplicates[ j ], 1 ); } } return results; }; function siblingCheck( a, b ) { var cur = b && a, diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE ); // Use IE sourceIndex if available on both nodes if ( diff ) { return diff; } // Check if b follows a if ( cur ) { while ( (cur = cur.nextSibling) ) { if ( cur === b ) { return -1; } } } return a ? 1 : -1; } // Returns a function to use in pseudos for input types function createInputPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === type; }; } // Returns a function to use in pseudos for buttons function createButtonPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && elem.type === type; }; } // Returns a function to use in pseudos for positionals function createPositionalPseudo( fn ) { return markFunction(function( argument ) { argument = +argument; return markFunction(function( seed, matches ) { var j, matchIndexes = fn( [], seed.length, argument ), i = matchIndexes.length; // Match elements found at the specified indexes while ( i-- ) { if ( seed[ (j = matchIndexes[i]) ] ) { seed[j] = !(matches[j] = seed[j]); } } }); }); } /** * Utility function for retrieving the text value of an array of DOM nodes * @param {Array|Element} elem */ getText = Sizzle.getText = function( elem ) { var node, ret = "", i = 0, nodeType = elem.nodeType; if ( !nodeType ) { // If no nodeType, this is expected to be an array for ( ; (node = elem[i]); i++ ) { // Do not traverse comment nodes ret += getText( node ); } } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { // Use textContent for elements // innerText usage removed for consistency of new lines (see #11153) if ( typeof elem.textContent === "string" ) { return elem.textContent; } else { // Traverse its children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { ret += getText( elem ); } } } else if ( nodeType === 3 || nodeType === 4 ) { return elem.nodeValue; } // Do not include comment or processing instruction nodes return ret; }; Expr = Sizzle.selectors = { // Can be adjusted by the user cacheLength: 50, createPseudo: markFunction, match: matchExpr, find: {}, relative: { ">": { dir: "parentNode", first: true }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: true }, "~": { dir: "previousSibling" } }, preFilter: { "ATTR": function( match ) { match[1] = match[1].replace( runescape, funescape ); // Move the given value to match[3] whether quoted or unquoted match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); if ( match[2] === "~=" ) { match[3] = " " + match[3] + " "; } return match.slice( 0, 4 ); }, "CHILD": function( match ) { /* matches from matchExpr["CHILD"] 1 type (only|nth|...) 2 what (child|of-type) 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 4 xn-component of xn+y argument ([+-]?\d*n|) 5 sign of xn-component 6 x of xn-component 7 sign of y-component 8 y of y-component */ match[1] = match[1].toLowerCase(); if ( match[1].slice( 0, 3 ) === "nth" ) { // nth-* requires argument if ( !match[3] ) { Sizzle.error( match[0] ); } // numeric x and y parameters for Expr.filter.CHILD // remember that false/true cast respectively to 0/1 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); // other types prohibit arguments } else if ( match[3] ) { Sizzle.error( match[0] ); } return match; }, "PSEUDO": function( match ) { var excess, unquoted = !match[5] && match[2]; if ( matchExpr["CHILD"].test( match[0] ) ) { return null; } // Accept quoted arguments as-is if ( match[4] ) { match[2] = match[4]; // Strip excess characters from unquoted arguments } else if ( unquoted && rpseudo.test( unquoted ) && // Get excess from tokenize (recursively) (excess = tokenize( unquoted, true )) && // advance to the next closing parenthesis (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { // excess is a negative index match[0] = match[0].slice( 0, excess ); match[2] = unquoted.slice( 0, excess ); } // Return only captures needed by the pseudo filter method (type and argument) return match.slice( 0, 3 ); } }, filter: { "TAG": function( nodeName ) { if ( nodeName === "*" ) { return function() { return true; }; } nodeName = nodeName.replace( runescape, funescape ).toLowerCase(); return function( elem ) { return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; }; }, "CLASS": function( className ) { var pattern = classCache[ className + " " ]; return pattern || (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && classCache( className, function( elem ) { return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); }); }, "ATTR": function( name, operator, check ) { return function( elem ) { var result = Sizzle.attr( elem, name ); if ( result == null ) { return operator === "!="; } if ( !operator ) { return true; } result += ""; return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf( check ) === 0 : operator === "*=" ? check && result.indexOf( check ) > -1 : operator === "$=" ? check && result.slice( -check.length ) === check : operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : false; }; }, "CHILD": function( type, what, argument, first, last ) { var simple = type.slice( 0, 3 ) !== "nth", forward = type.slice( -4 ) !== "last", ofType = what === "of-type"; return first === 1 && last === 0 ? // Shortcut for :nth-*(n) function( elem ) { return !!elem.parentNode; } : function( elem, context, xml ) { var cache, outerCache, node, diff, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType; if ( parent ) { // :(first|last|only)-(child|of-type) if ( simple ) { while ( dir ) { node = elem; while ( (node = node[ dir ]) ) { if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { return false; } } // Reverse direction for :only-* (if we haven't yet done so) start = dir = type === "only" && !start && "nextSibling"; } return true; } start = [ forward ? parent.firstChild : parent.lastChild ]; // non-xml :nth-child(...) stores cache data on `parent` if ( forward && useCache ) { // Seek `elem` from a previously-cached index outerCache = parent[ expando ] || (parent[ expando ] = {}); cache = outerCache[ type ] || []; nodeIndex = cache[0] === dirruns && cache[1]; diff = cache[0] === dirruns && cache[2]; node = nodeIndex && parent.childNodes[ nodeIndex ]; while ( (node = ++nodeIndex && node && node[ dir ] || // Fallback to seeking `elem` from the start (diff = nodeIndex = 0) || start.pop()) ) { // When found, cache indexes on `parent` and break if ( node.nodeType === 1 && ++diff && node === elem ) { outerCache[ type ] = [ dirruns, nodeIndex, diff ]; break; } } // Use previously-cached element index if available } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { diff = cache[1]; // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) } else { // Use the same loop as above to seek `elem` from the start while ( (node = ++nodeIndex && node && node[ dir ] || (diff = nodeIndex = 0) || start.pop()) ) { if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { // Cache the index of each encountered element if ( useCache ) { (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; } if ( node === elem ) { break; } } } } // Incorporate the offset, then check against cycle size diff -= last; return diff === first || ( diff % first === 0 && diff / first >= 0 ); } }; }, "PSEUDO": function( pseudo, argument ) { // pseudo-class names are case-insensitive // http://www.w3.org/TR/selectors/#pseudo-classes // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters // Remember that setFilters inherits from pseudos var args, fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || Sizzle.error( "unsupported pseudo: " + pseudo ); // The user may use createPseudo to indicate that // arguments are needed to create the filter function // just as Sizzle does if ( fn[ expando ] ) { return fn( argument ); } // But maintain support for old signatures if ( fn.length > 1 ) { args = [ pseudo, pseudo, "", argument ]; return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? markFunction(function( seed, matches ) { var idx, matched = fn( seed, argument ), i = matched.length; while ( i-- ) { idx = indexOf.call( seed, matched[i] ); seed[ idx ] = !( matches[ idx ] = matched[i] ); } }) : function( elem ) { return fn( elem, 0, args ); }; } return fn; } }, pseudos: { // Potentially complex pseudos "not": markFunction(function( selector ) { // Trim the selector passed to compile // to avoid treating leading and trailing // spaces as combinators var input = [], results = [], matcher = compile( selector.replace( rtrim, "$1" ) ); return matcher[ expando ] ? markFunction(function( seed, matches, context, xml ) { var elem, unmatched = matcher( seed, null, xml, [] ), i = seed.length; // Match elements unmatched by `matcher` while ( i-- ) { if ( (elem = unmatched[i]) ) { seed[i] = !(matches[i] = elem); } } }) : function( elem, context, xml ) { input[0] = elem; matcher( input, null, xml, results ); return !results.pop(); }; }), "has": markFunction(function( selector ) { return function( elem ) { return Sizzle( selector, elem ).length > 0; }; }), "contains": markFunction(function( text ) { return function( elem ) { return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; }; }), // "Whether an element is represented by a :lang() selector // is based solely on the element's language value // being equal to the identifier C, // or beginning with the identifier C immediately followed by "-". // The matching of C against the element's language value is performed case-insensitively. // The identifier C does not have to be a valid language name." // http://www.w3.org/TR/selectors/#lang-pseudo "lang": markFunction( function( lang ) { // lang value must be a valid identifider if ( !ridentifier.test(lang || "") ) { Sizzle.error( "unsupported lang: " + lang ); } lang = lang.replace( runescape, funescape ).toLowerCase(); return function( elem ) { var elemLang; do { if ( (elemLang = documentIsXML ? elem.getAttribute("xml:lang") || elem.getAttribute("lang") : elem.lang) ) { elemLang = elemLang.toLowerCase(); return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; } } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); return false; }; }), // Miscellaneous "target": function( elem ) { var hash = window.location && window.location.hash; return hash && hash.slice( 1 ) === elem.id; }, "root": function( elem ) { return elem === docElem; }, "focus": function( elem ) { return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); }, // Boolean properties "enabled": function( elem ) { return elem.disabled === false; }, "disabled": function( elem ) { return elem.disabled === true; }, "checked": function( elem ) { // In CSS3, :checked should return both checked and selected elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked var nodeName = elem.nodeName.toLowerCase(); return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); }, "selected": function( elem ) { // Accessing this property makes selected-by-default // options in Safari work properly if ( elem.parentNode ) { elem.parentNode.selectedIndex; } return elem.selected === true; }, // Contents "empty": function( elem ) { // http://www.w3.org/TR/selectors/#empty-pseudo // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), // not comment, processing instructions, or others // Thanks to Diego Perini for the nodeName shortcut // Greater than "@" means alpha characters (specifically not starting with "#" or "?") for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { return false; } } return true; }, "parent": function( elem ) { return !Expr.pseudos["empty"]( elem ); }, // Element/input types "header": function( elem ) { return rheader.test( elem.nodeName ); }, "input": function( elem ) { return rinputs.test( elem.nodeName ); }, "button": function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === "button" || name === "button"; }, "text": function( elem ) { var attr; // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // use getAttribute instead to test this case return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); }, // Position-in-collection "first": createPositionalPseudo(function() { return [ 0 ]; }), "last": createPositionalPseudo(function( matchIndexes, length ) { return [ length - 1 ]; }), "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { return [ argument < 0 ? argument + length : argument ]; }), "even": createPositionalPseudo(function( matchIndexes, length ) { var i = 0; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "odd": createPositionalPseudo(function( matchIndexes, length ) { var i = 1; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; --i >= 0; ) { matchIndexes.push( i ); } return matchIndexes; }), "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; ++i < length; ) { matchIndexes.push( i ); } return matchIndexes; }) } }; // Add button/input type pseudos for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { Expr.pseudos[ i ] = createInputPseudo( i ); } for ( i in { submit: true, reset: true } ) { Expr.pseudos[ i ] = createButtonPseudo( i ); } function tokenize( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ selector + " " ]; if ( cached ) { return parseOnly ? 0 : cached.slice( 0 ); } soFar = selector; groups = []; preFilters = Expr.preFilter; while ( soFar ) { // Comma and first run if ( !matched || (match = rcomma.exec( soFar )) ) { if ( match ) { // Don't consume trailing commas as valid soFar = soFar.slice( match[0].length ) || soFar; } groups.push( tokens = [] ); } matched = false; // Combinators if ( (match = rcombinators.exec( soFar )) ) { matched = match.shift(); tokens.push( { value: matched, // Cast descendant combinators to space type: match[0].replace( rtrim, " " ) } ); soFar = soFar.slice( matched.length ); } // Filters for ( type in Expr.filter ) { if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || (match = preFilters[ type ]( match ))) ) { matched = match.shift(); tokens.push( { value: matched, type: type, matches: match } ); soFar = soFar.slice( matched.length ); } } if ( !matched ) { break; } } // Return the length of the invalid excess // if we're just parsing // Otherwise, throw an error or return tokens return parseOnly ? soFar.length : soFar ? Sizzle.error( selector ) : // Cache the tokens tokenCache( selector, groups ).slice( 0 ); } function toSelector( tokens ) { var i = 0, len = tokens.length, selector = ""; for ( ; i < len; i++ ) { selector += tokens[i].value; } return selector; } function addCombinator( matcher, combinator, base ) { var dir = combinator.dir, checkNonElements = base && dir === "parentNode", doneName = done++; return combinator.first ? // Check against closest ancestor/preceding element function( elem, context, xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { return matcher( elem, context, xml ); } } } : // Check against all ancestor/preceding elements function( elem, context, xml ) { var data, cache, outerCache, dirkey = dirruns + " " + doneName; // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching if ( xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { if ( matcher( elem, context, xml ) ) { return true; } } } } else { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { outerCache = elem[ expando ] || (elem[ expando ] = {}); if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { if ( (data = cache[1]) === true || data === cachedruns ) { return data === true; } } else { cache = outerCache[ dir ] = [ dirkey ]; cache[1] = matcher( elem, context, xml ) || cachedruns; if ( cache[1] === true ) { return true; } } } } } }; } function elementMatcher( matchers ) { return matchers.length > 1 ? function( elem, context, xml ) { var i = matchers.length; while ( i-- ) { if ( !matchers[i]( elem, context, xml ) ) { return false; } } return true; } : matchers[0]; } function condense( unmatched, map, filter, context, xml ) { var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null; for ( ; i < len; i++ ) { if ( (elem = unmatched[i]) ) { if ( !filter || filter( elem, context, xml ) ) { newUnmatched.push( elem ); if ( mapped ) { map.push( i ); } } } } return newUnmatched; } function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { if ( postFilter && !postFilter[ expando ] ) { postFilter = setMatcher( postFilter ); } if ( postFinder && !postFinder[ expando ] ) { postFinder = setMatcher( postFinder, postSelector ); } return markFunction(function( seed, results, context, xml ) { var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, // Get initial elements from seed or context elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), // Prefilter to get matcher input, preserving a map for seed-results synchronization matcherIn = preFilter && ( seed || !selector ) ? condense( elems, preMap, preFilter, context, xml ) : elems, matcherOut = matcher ? // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, postFinder || ( seed ? preFilter : preexisting || postFilter ) ? // ...intermediate processing is necessary [] : // ...otherwise use results directly results : matcherIn; // Find primary matches if ( matcher ) { matcher( matcherIn, matcherOut, context, xml ); } // Apply postFilter if ( postFilter ) { temp = condense( matcherOut, postMap ); postFilter( temp, [], context, xml ); // Un-match failing elements by moving them back to matcherIn i = temp.length; while ( i-- ) { if ( (elem = temp[i]) ) { matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); } } } if ( seed ) { if ( postFinder || preFilter ) { if ( postFinder ) { // Get the final matcherOut by condensing this intermediate into postFinder contexts temp = []; i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) ) { // Restore matcherIn since elem is not yet a final match temp.push( (matcherIn[i] = elem) ); } } postFinder( null, (matcherOut = []), temp, xml ); } // Move matched elements from seed to results to keep them synchronized i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) && (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { seed[temp] = !(results[temp] = elem); } } } // Add elements to results, through postFinder if defined } else { matcherOut = condense( matcherOut === results ? matcherOut.splice( preexisting, matcherOut.length ) : matcherOut ); if ( postFinder ) { postFinder( null, results, matcherOut, xml ); } else { push.apply( results, matcherOut ); } } }); } function matcherFromTokens( tokens ) { var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[ tokens[0].type ], implicitRelative = leadingRelative || Expr.relative[" "], i = leadingRelative ? 1 : 0, // The foundational matcher ensures that elements are reachable from top-level context(s) matchContext = addCombinator( function( elem ) { return elem === checkContext; }, implicitRelative, true ), matchAnyContext = addCombinator( function( elem ) { return indexOf.call( checkContext, elem ) > -1; }, implicitRelative, true ), matchers = [ function( elem, context, xml ) { return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( (checkContext = context).nodeType ? matchContext( elem, context, xml ) : matchAnyContext( elem, context, xml ) ); } ]; for ( ; i < len; i++ ) { if ( (matcher = Expr.relative[ tokens[i].type ]) ) { matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; } else { matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); // Return special upon seeing a positional matcher if ( matcher[ expando ] ) { // Find the next relative operator (if any) for proper handling j = ++i; for ( ; j < len; j++ ) { if ( Expr.relative[ tokens[j].type ] ) { break; } } return setMatcher( i > 1 && elementMatcher( matchers ), i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ), matcher, i < j && matcherFromTokens( tokens.slice( i, j ) ), j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), j < len && toSelector( tokens ) ); } matchers.push( matcher ); } } return elementMatcher( matchers ); } function matcherFromGroupMatchers( elementMatchers, setMatchers ) { // A counter to specify which element is currently being matched var matcherCachedRuns = 0, bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function( seed, context, xml, results, expandContext ) { var elem, j, matcher, setMatched = [], matchedCount = 0, i = "0", unmatched = seed && [], outermost = expandContext != null, contextBackup = outermostContext, // We must always have either seed elements or context elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), // Use integer dirruns iff this is the outermost matcher dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1); if ( outermost ) { outermostContext = context !== document && context; cachedruns = matcherCachedRuns; } // Add elements passing elementMatchers directly to results // Keep `i` a string if there are no elements so `matchedCount` will be "00" below for ( ; (elem = elems[i]) != null; i++ ) { if ( byElement && elem ) { j = 0; while ( (matcher = elementMatchers[j++]) ) { if ( matcher( elem, context, xml ) ) { results.push( elem ); break; } } if ( outermost ) { dirruns = dirrunsUnique; cachedruns = ++matcherCachedRuns; } } // Track unmatched elements for set filters if ( bySet ) { // They will have gone through all possible matchers if ( (elem = !matcher && elem) ) { matchedCount--; } // Lengthen the array for every element, matched or not if ( seed ) { unmatched.push( elem ); } } } // Apply set filters to unmatched elements matchedCount += i; if ( bySet && i !== matchedCount ) { j = 0; while ( (matcher = setMatchers[j++]) ) { matcher( unmatched, setMatched, context, xml ); } if ( seed ) { // Reintegrate element matches to eliminate the need for sorting if ( matchedCount > 0 ) { while ( i-- ) { if ( !(unmatched[i] || setMatched[i]) ) { setMatched[i] = pop.call( results ); } } } // Discard index placeholder values to get only actual matches setMatched = condense( setMatched ); } // Add matches to results push.apply( results, setMatched ); // Seedless set matches succeeding multiple successful matchers stipulate sorting if ( outermost && !seed && setMatched.length > 0 && ( matchedCount + setMatchers.length ) > 1 ) { Sizzle.uniqueSort( results ); } } // Override manipulation of globals by nested matchers if ( outermost ) { dirruns = dirrunsUnique; outermostContext = contextBackup; } return unmatched; }; return bySet ? markFunction( superMatcher ) : superMatcher; } compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { var i, setMatchers = [], elementMatchers = [], cached = compilerCache[ selector + " " ]; if ( !cached ) { // Generate a function of recursive functions that can be used to check each element if ( !group ) { group = tokenize( selector ); } i = group.length; while ( i-- ) { cached = matcherFromTokens( group[i] ); if ( cached[ expando ] ) { setMatchers.push( cached ); } else { elementMatchers.push( cached ); } } // Cache the compiled function cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); } return cached; }; function multipleContexts( selector, contexts, results ) { var i = 0, len = contexts.length; for ( ; i < len; i++ ) { Sizzle( selector, contexts[i], results ); } return results; } function select( selector, context, results, seed ) { var i, tokens, token, type, find, match = tokenize( selector ); if ( !seed ) { // Try to minimize operations if there is only one group if ( match.length === 1 ) { // Take a shortcut and set the context if the root selector is an ID tokens = match[0] = match[0].slice( 0 ); if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && !documentIsXML && Expr.relative[ tokens[1].type ] ) { context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0]; if ( !context ) { return results; } selector = selector.slice( tokens.shift().value.length ); } // Fetch a seed set for right-to-left matching i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; while ( i-- ) { token = tokens[i]; // Abort if we hit a combinator if ( Expr.relative[ (type = token.type) ] ) { break; } if ( (find = Expr.find[ type ]) ) { // Search, expanding context for leading sibling combinators if ( (seed = find( token.matches[0].replace( runescape, funescape ), rsibling.test( tokens[0].type ) && context.parentNode || context )) ) { // If seed is empty or no tokens remain, we can return early tokens.splice( i, 1 ); selector = seed.length && toSelector( tokens ); if ( !selector ) { push.apply( results, slice.call( seed, 0 ) ); return results; } break; } } } } } // Compile and execute a filtering function // Provide `match` to avoid retokenization if we modified the selector above compile( selector, match )( seed, context, documentIsXML, results, rsibling.test( selector ) ); return results; } // Deprecated Expr.pseudos["nth"] = Expr.pseudos["eq"]; // Easy API for creating new setFilters function setFilters() {} Expr.filters = setFilters.prototype = Expr.pseudos; Expr.setFilters = new setFilters(); // Initialize with the default document setDocument(); // Override sizzle attribute retrieval Sizzle.attr = jQuery.attr; jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.pseudos; jQuery.unique = Sizzle.uniqueSort; jQuery.text = Sizzle.getText; jQuery.isXMLDoc = Sizzle.isXML; jQuery.contains = Sizzle.contains; })( window ); var runtil = /Until$/, rparentsprev = /^(?:parents|prev(?:Until|All))/, isSimple = /^.[^:#\[\.,]*$/, rneedsContext = jQuery.expr.match.needsContext, // methods guaranteed to produce a unique set when starting from a unique set guaranteedUnique = { children: true, contents: true, next: true, prev: true }; jQuery.fn.extend({ find: function( selector ) { var i, ret, self, len = this.length; if ( typeof selector !== "string" ) { self = this; return this.pushStack( jQuery( selector ).filter(function() { for ( i = 0; i < len; i++ ) { if ( jQuery.contains( self[ i ], this ) ) { return true; } } }) ); } ret = []; for ( i = 0; i < len; i++ ) { jQuery.find( selector, this[ i ], ret ); } // Needed because $( selector, context ) becomes $( context ).find( selector ) ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); ret.selector = ( this.selector ? this.selector + " " : "" ) + selector; return ret; }, has: function( target ) { var i, targets = jQuery( target, this ), len = targets.length; return this.filter(function() { for ( i = 0; i < len; i++ ) { if ( jQuery.contains( this, targets[i] ) ) { return true; } } }); }, not: function( selector ) { return this.pushStack( winnow(this, selector, false) ); }, filter: function( selector ) { return this.pushStack( winnow(this, selector, true) ); }, is: function( selector ) { return !!selector && ( typeof selector === "string" ? // If this is a positional/relative selector, check membership in the returned set // so $("p:first").is("p:last") won't return true for a doc with two "p". rneedsContext.test( selector ) ? jQuery( selector, this.context ).index( this[0] ) >= 0 : jQuery.filter( selector, this ).length > 0 : this.filter( selector ).length > 0 ); }, closest: function( selectors, context ) { var cur, i = 0, l = this.length, ret = [], pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? jQuery( selectors, context || this.context ) : 0; for ( ; i < l; i++ ) { cur = this[i]; while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { ret.push( cur ); break; } cur = cur.parentNode; } } return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret ); }, // Determine the position of an element within // the matched set of elements index: function( elem ) { // No argument, return index in parent if ( !elem ) { return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; } // index in selector if ( typeof elem === "string" ) { return jQuery.inArray( this[0], jQuery( elem ) ); } // Locate the position of the desired element return jQuery.inArray( // If it receives a jQuery object, the first element is used elem.jquery ? elem[0] : elem, this ); }, add: function( selector, context ) { var set = typeof selector === "string" ? jQuery( selector, context ) : jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), all = jQuery.merge( this.get(), set ); return this.pushStack( jQuery.unique(all) ); }, addBack: function( selector ) { return this.add( selector == null ? this.prevObject : this.prevObject.filter(selector) ); } }); jQuery.fn.andSelf = jQuery.fn.addBack; function sibling( cur, dir ) { do { cur = cur[ dir ]; } while ( cur && cur.nodeType !== 1 ); return cur; } jQuery.each({ parent: function( elem ) { var parent = elem.parentNode; return parent && parent.nodeType !== 11 ? parent : null; }, parents: function( elem ) { return jQuery.dir( elem, "parentNode" ); }, parentsUntil: function( elem, i, until ) { return jQuery.dir( elem, "parentNode", until ); }, next: function( elem ) { return sibling( elem, "nextSibling" ); }, prev: function( elem ) { return sibling( elem, "previousSibling" ); }, nextAll: function( elem ) { return jQuery.dir( elem, "nextSibling" ); }, prevAll: function( elem ) { return jQuery.dir( elem, "previousSibling" ); }, nextUntil: function( elem, i, until ) { return jQuery.dir( elem, "nextSibling", until ); }, prevUntil: function( elem, i, until ) { return jQuery.dir( elem, "previousSibling", until ); }, siblings: function( elem ) { return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); }, children: function( elem ) { return jQuery.sibling( elem.firstChild ); }, contents: function( elem ) { return jQuery.nodeName( elem, "iframe" ) ? elem.contentDocument || elem.contentWindow.document : jQuery.merge( [], elem.childNodes ); } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { var ret = jQuery.map( this, fn, until ); if ( !runtil.test( name ) ) { selector = until; } if ( selector && typeof selector === "string" ) { ret = jQuery.filter( selector, ret ); } ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; if ( this.length > 1 && rparentsprev.test( name ) ) { ret = ret.reverse(); } return this.pushStack( ret ); }; }); jQuery.extend({ filter: function( expr, elems, not ) { if ( not ) { expr = ":not(" + expr + ")"; } return elems.length === 1 ? jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : jQuery.find.matches(expr, elems); }, dir: function( elem, dir, until ) { var matched = [], cur = elem[ dir ]; while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { if ( cur.nodeType === 1 ) { matched.push( cur ); } cur = cur[dir]; } return matched; }, sibling: function( n, elem ) { var r = []; for ( ; n; n = n.nextSibling ) { if ( n.nodeType === 1 && n !== elem ) { r.push( n ); } } return r; } }); // Implement the identical functionality for filter and not function winnow( elements, qualifier, keep ) { // Can't pass null or undefined to indexOf in Firefox 4 // Set to 0 to skip string check qualifier = qualifier || 0; if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep(elements, function( elem, i ) { var retVal = !!qualifier.call( elem, i, elem ); return retVal === keep; }); } else if ( qualifier.nodeType ) { return jQuery.grep(elements, function( elem ) { return ( elem === qualifier ) === keep; }); } else if ( typeof qualifier === "string" ) { var filtered = jQuery.grep(elements, function( elem ) { return elem.nodeType === 1; }); if ( isSimple.test( qualifier ) ) { return jQuery.filter(qualifier, filtered, !keep); } else { qualifier = jQuery.filter( qualifier, filtered ); } } return jQuery.grep(elements, function( elem ) { return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; }); } function createSafeFragment( document ) { var list = nodeNames.split( "|" ), safeFrag = document.createDocumentFragment(); if ( safeFrag.createElement ) { while ( list.length ) { safeFrag.createElement( list.pop() ); } } return safeFrag; } var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), rleadingWhitespace = /^\s+/, rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, rtagName = /<([\w:]+)/, rtbody = /\s*$/g, // We have to close these tags to support XHTML (#13200) wrapMap = { option: [ 1, "" ], legend: [ 1, "
    ", "
    " ], area: [ 1, "", "" ], param: [ 1, "", "" ], thead: [ 1, "", "
    " ], tr: [ 2, "", "
    " ], col: [ 2, "", "
    " ], td: [ 3, "", "
    " ], // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, // unless wrapped in a div with non-breaking characters in front of it. _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
    ", "
    " ] }, safeFragment = createSafeFragment( document ), fragmentDiv = safeFragment.appendChild( document.createElement("div") ); wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; jQuery.fn.extend({ text: function( value ) { return jQuery.access( this, function( value ) { return value === undefined ? jQuery.text( this ) : this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); }, null, value, arguments.length ); }, wrapAll: function( html ) { if ( jQuery.isFunction( html ) ) { return this.each(function(i) { jQuery(this).wrapAll( html.call(this, i) ); }); } if ( this[0] ) { // The elements to wrap the target around var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); if ( this[0].parentNode ) { wrap.insertBefore( this[0] ); } wrap.map(function() { var elem = this; while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { elem = elem.firstChild; } return elem; }).append( this ); } return this; }, wrapInner: function( html ) { if ( jQuery.isFunction( html ) ) { return this.each(function(i) { jQuery(this).wrapInner( html.call(this, i) ); }); } return this.each(function() { var self = jQuery( this ), contents = self.contents(); if ( contents.length ) { contents.wrapAll( html ); } else { self.append( html ); } }); }, wrap: function( html ) { var isFunction = jQuery.isFunction( html ); return this.each(function(i) { jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); }); }, unwrap: function() { return this.parent().each(function() { if ( !jQuery.nodeName( this, "body" ) ) { jQuery( this ).replaceWith( this.childNodes ); } }).end(); }, append: function() { return this.domManip(arguments, true, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { this.appendChild( elem ); } }); }, prepend: function() { return this.domManip(arguments, true, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { this.insertBefore( elem, this.firstChild ); } }); }, before: function() { return this.domManip( arguments, false, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this ); } }); }, after: function() { return this.domManip( arguments, false, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this.nextSibling ); } }); }, // keepData is for internal use only--do not document remove: function( selector, keepData ) { var elem, i = 0; for ( ; (elem = this[i]) != null; i++ ) { if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) { if ( !keepData && elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem ) ); } if ( elem.parentNode ) { if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { setGlobalEval( getAll( elem, "script" ) ); } elem.parentNode.removeChild( elem ); } } } return this; }, empty: function() { var elem, i = 0; for ( ; (elem = this[i]) != null; i++ ) { // Remove element nodes and prevent memory leaks if ( elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem, false ) ); } // Remove any remaining nodes while ( elem.firstChild ) { elem.removeChild( elem.firstChild ); } // If this is a select, ensure that it displays empty (#12336) // Support: IE<9 if ( elem.options && jQuery.nodeName( elem, "select" ) ) { elem.options.length = 0; } } return this; }, clone: function( dataAndEvents, deepDataAndEvents ) { dataAndEvents = dataAndEvents == null ? false : dataAndEvents; deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; return this.map( function () { return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); }); }, html: function( value ) { return jQuery.access( this, function( value ) { var elem = this[0] || {}, i = 0, l = this.length; if ( value === undefined ) { return elem.nodeType === 1 ? elem.innerHTML.replace( rinlinejQuery, "" ) : undefined; } // See if we can take a shortcut and just use innerHTML if ( typeof value === "string" && !rnoInnerhtml.test( value ) && ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { value = value.replace( rxhtmlTag, "<$1>" ); try { for (; i < l; i++ ) { // Remove element nodes and prevent memory leaks elem = this[i] || {}; if ( elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem, false ) ); elem.innerHTML = value; } } elem = 0; // If using innerHTML throws an exception, use the fallback method } catch(e) {} } if ( elem ) { this.empty().append( value ); } }, null, value, arguments.length ); }, replaceWith: function( value ) { var isFunc = jQuery.isFunction( value ); // Make sure that the elements are removed from the DOM before they are inserted // this can help fix replacing a parent with child elements if ( !isFunc && typeof value !== "string" ) { value = jQuery( value ).not( this ).detach(); } return this.domManip( [ value ], true, function( elem ) { var next = this.nextSibling, parent = this.parentNode; if ( parent ) { jQuery( this ).remove(); parent.insertBefore( elem, next ); } }); }, detach: function( selector ) { return this.remove( selector, true ); }, domManip: function( args, table, callback ) { // Flatten any nested arrays args = core_concat.apply( [], args ); var first, node, hasScripts, scripts, doc, fragment, i = 0, l = this.length, set = this, iNoClone = l - 1, value = args[0], isFunction = jQuery.isFunction( value ); // We can't cloneNode fragments that contain checked, in WebKit if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { return this.each(function( index ) { var self = set.eq( index ); if ( isFunction ) { args[0] = value.call( this, index, table ? self.html() : undefined ); } self.domManip( args, table, callback ); }); } if ( l ) { fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); first = fragment.firstChild; if ( fragment.childNodes.length === 1 ) { fragment = first; } if ( first ) { table = table && jQuery.nodeName( first, "tr" ); scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); hasScripts = scripts.length; // Use the original fragment for the last item instead of the first because it can end up // being emptied incorrectly in certain situations (#8070). for ( ; i < l; i++ ) { node = fragment; if ( i !== iNoClone ) { node = jQuery.clone( node, true, true ); // Keep references to cloned scripts for later restoration if ( hasScripts ) { jQuery.merge( scripts, getAll( node, "script" ) ); } } callback.call( table && jQuery.nodeName( this[i], "table" ) ? findOrAppend( this[i], "tbody" ) : this[i], node, i ); } if ( hasScripts ) { doc = scripts[ scripts.length - 1 ].ownerDocument; // Reenable scripts jQuery.map( scripts, restoreScript ); // Evaluate executable scripts on first document insertion for ( i = 0; i < hasScripts; i++ ) { node = scripts[ i ]; if ( rscriptType.test( node.type || "" ) && !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { if ( node.src ) { // Hope ajax is available... jQuery.ajax({ url: node.src, type: "GET", dataType: "script", async: false, global: false, "throws": true }); } else { jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); } } } } // Fix #11809: Avoid leaking memory fragment = first = null; } } return this; } }); function findOrAppend( elem, tag ) { return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); } // Replace/restore the type attribute of script elements for safe DOM manipulation function disableScript( elem ) { var attr = elem.getAttributeNode("type"); elem.type = ( attr && attr.specified ) + "/" + elem.type; return elem; } function restoreScript( elem ) { var match = rscriptTypeMasked.exec( elem.type ); if ( match ) { elem.type = match[1]; } else { elem.removeAttribute("type"); } return elem; } // Mark scripts as having already been evaluated function setGlobalEval( elems, refElements ) { var elem, i = 0; for ( ; (elem = elems[i]) != null; i++ ) { jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); } } function cloneCopyEvent( src, dest ) { if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { return; } var type, i, l, oldData = jQuery._data( src ), curData = jQuery._data( dest, oldData ), events = oldData.events; if ( events ) { delete curData.handle; curData.events = {}; for ( type in events ) { for ( i = 0, l = events[ type ].length; i < l; i++ ) { jQuery.event.add( dest, type, events[ type ][ i ] ); } } } // make the cloned public data object a copy from the original if ( curData.data ) { curData.data = jQuery.extend( {}, curData.data ); } } function fixCloneNodeIssues( src, dest ) { var nodeName, e, data; // We do not need to do anything for non-Elements if ( dest.nodeType !== 1 ) { return; } nodeName = dest.nodeName.toLowerCase(); // IE6-8 copies events bound via attachEvent when using cloneNode. if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) { data = jQuery._data( dest ); for ( e in data.events ) { jQuery.removeEvent( dest, e, data.handle ); } // Event data gets referenced instead of copied if the expando gets copied too dest.removeAttribute( jQuery.expando ); } // IE blanks contents when cloning scripts, and tries to evaluate newly-set text if ( nodeName === "script" && dest.text !== src.text ) { disableScript( dest ).text = src.text; restoreScript( dest ); // IE6-10 improperly clones children of object elements using classid. // IE10 throws NoModificationAllowedError if parent is null, #12132. } else if ( nodeName === "object" ) { if ( dest.parentNode ) { dest.outerHTML = src.outerHTML; } // This path appears unavoidable for IE9. When cloning an object // element in IE9, the outerHTML strategy above is not sufficient. // If the src has innerHTML and the destination does not, // copy the src.innerHTML into the dest.innerHTML. #10324 if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { dest.innerHTML = src.innerHTML; } } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { // IE6-8 fails to persist the checked state of a cloned checkbox // or radio button. Worse, IE6-7 fail to give the cloned element // a checked appearance if the defaultChecked value isn't also set dest.defaultChecked = dest.checked = src.checked; // IE6-7 get confused and end up setting the value of a cloned // checkbox/radio button to an empty string instead of "on" if ( dest.value !== src.value ) { dest.value = src.value; } // IE6-8 fails to return the selected option to the default selected // state when cloning options } else if ( nodeName === "option" ) { dest.defaultSelected = dest.selected = src.defaultSelected; // IE6-8 fails to set the defaultValue to the correct value when // cloning other types of input fields } else if ( nodeName === "input" || nodeName === "textarea" ) { dest.defaultValue = src.defaultValue; } } jQuery.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function( name, original ) { jQuery.fn[ name ] = function( selector ) { var elems, i = 0, ret = [], insert = jQuery( selector ), last = insert.length - 1; for ( ; i <= last; i++ ) { elems = i === last ? this : this.clone(true); jQuery( insert[i] )[ original ]( elems ); // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() core_push.apply( ret, elems.get() ); } return this.pushStack( ret ); }; }); function getAll( context, tag ) { var elems, elem, i = 0, found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) : typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) : undefined; if ( !found ) { for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { if ( !tag || jQuery.nodeName( elem, tag ) ) { found.push( elem ); } else { jQuery.merge( found, getAll( elem, tag ) ); } } } return tag === undefined || tag && jQuery.nodeName( context, tag ) ? jQuery.merge( [ context ], found ) : found; } // Used in buildFragment, fixes the defaultChecked property function fixDefaultChecked( elem ) { if ( manipulation_rcheckableType.test( elem.type ) ) { elem.defaultChecked = elem.checked; } } jQuery.extend({ clone: function( elem, dataAndEvents, deepDataAndEvents ) { var destElements, node, clone, i, srcElements, inPage = jQuery.contains( elem.ownerDocument, elem ); if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { clone = elem.cloneNode( true ); // IE<=8 does not properly clone detached, unknown element nodes } else { fragmentDiv.innerHTML = elem.outerHTML; fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); } if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 destElements = getAll( clone ); srcElements = getAll( elem ); // Fix all IE cloning issues for ( i = 0; (node = srcElements[i]) != null; ++i ) { // Ensure that the destination node is not null; Fixes #9587 if ( destElements[i] ) { fixCloneNodeIssues( node, destElements[i] ); } } } // Copy the events from the original to the clone if ( dataAndEvents ) { if ( deepDataAndEvents ) { srcElements = srcElements || getAll( elem ); destElements = destElements || getAll( clone ); for ( i = 0; (node = srcElements[i]) != null; i++ ) { cloneCopyEvent( node, destElements[i] ); } } else { cloneCopyEvent( elem, clone ); } } // Preserve script evaluation history destElements = getAll( clone, "script" ); if ( destElements.length > 0 ) { setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); } destElements = srcElements = node = null; // Return the cloned set return clone; }, buildFragment: function( elems, context, scripts, selection ) { var j, elem, contains, tmp, tag, tbody, wrap, l = elems.length, // Ensure a safe fragment safe = createSafeFragment( context ), nodes = [], i = 0; for ( ; i < l; i++ ) { elem = elems[ i ]; if ( elem || elem === 0 ) { // Add nodes directly if ( jQuery.type( elem ) === "object" ) { jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); // Convert non-html into a text node } else if ( !rhtml.test( elem ) ) { nodes.push( context.createTextNode( elem ) ); // Convert html into DOM nodes } else { tmp = tmp || safe.appendChild( context.createElement("div") ); // Deserialize a standard representation tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); wrap = wrapMap[ tag ] || wrapMap._default; tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[2]; // Descend through wrappers to the right content j = wrap[0]; while ( j-- ) { tmp = tmp.lastChild; } // Manually add leading whitespace removed by IE if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); } // Remove IE's autoinserted from table fragments if ( !jQuery.support.tbody ) { // String was a , *may* have spurious elem = tag === "table" && !rtbody.test( elem ) ? tmp.firstChild : // String was a bare or wrap[1] === "
    " && !rtbody.test( elem ) ? tmp : 0; j = elem && elem.childNodes.length; while ( j-- ) { if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { elem.removeChild( tbody ); } } } jQuery.merge( nodes, tmp.childNodes ); // Fix #12392 for WebKit and IE > 9 tmp.textContent = ""; // Fix #12392 for oldIE while ( tmp.firstChild ) { tmp.removeChild( tmp.firstChild ); } // Remember the top-level container for proper cleanup tmp = safe.lastChild; } } } // Fix #11356: Clear elements from fragment if ( tmp ) { safe.removeChild( tmp ); } // Reset defaultChecked for any radios and checkboxes // about to be appended to the DOM in IE 6/7 (#8060) if ( !jQuery.support.appendChecked ) { jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); } i = 0; while ( (elem = nodes[ i++ ]) ) { // #4087 - If origin and destination elements are the same, and this is // that element, do not do anything if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { continue; } contains = jQuery.contains( elem.ownerDocument, elem ); // Append to fragment tmp = getAll( safe.appendChild( elem ), "script" ); // Preserve script evaluation history if ( contains ) { setGlobalEval( tmp ); } // Capture executables if ( scripts ) { j = 0; while ( (elem = tmp[ j++ ]) ) { if ( rscriptType.test( elem.type || "" ) ) { scripts.push( elem ); } } } } tmp = null; return safe; }, cleanData: function( elems, /* internal */ acceptData ) { var elem, type, id, data, i = 0, internalKey = jQuery.expando, cache = jQuery.cache, deleteExpando = jQuery.support.deleteExpando, special = jQuery.event.special; for ( ; (elem = elems[i]) != null; i++ ) { if ( acceptData || jQuery.acceptData( elem ) ) { id = elem[ internalKey ]; data = id && cache[ id ]; if ( data ) { if ( data.events ) { for ( type in data.events ) { if ( special[ type ] ) { jQuery.event.remove( elem, type ); // This is a shortcut to avoid jQuery.event.remove's overhead } else { jQuery.removeEvent( elem, type, data.handle ); } } } // Remove cache only if it was not already removed by jQuery.event.remove if ( cache[ id ] ) { delete cache[ id ]; // IE does not allow us to delete expando properties from nodes, // nor does it have a removeAttribute function on Document nodes; // we must handle all of these cases if ( deleteExpando ) { delete elem[ internalKey ]; } else if ( typeof elem.removeAttribute !== core_strundefined ) { elem.removeAttribute( internalKey ); } else { elem[ internalKey ] = null; } core_deletedIds.push( id ); } } } } } }); var iframe, getStyles, curCSS, ralpha = /alpha\([^)]*\)/i, ropacity = /opacity\s*=\s*([^)]*)/, rposition = /^(top|right|bottom|left)$/, // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display rdisplayswap = /^(none|table(?!-c[ea]).+)/, rmargin = /^margin/, rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ), elemdisplay = { BODY: "block" }, cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssNormalTransform = { letterSpacing: 0, fontWeight: 400 }, cssExpand = [ "Top", "Right", "Bottom", "Left" ], cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; // return a css property mapped to a potentially vendor prefixed property function vendorPropName( style, name ) { // shortcut for names that are not vendor prefixed if ( name in style ) { return name; } // check for vendor prefixed names var capName = name.charAt(0).toUpperCase() + name.slice(1), origName = name, i = cssPrefixes.length; while ( i-- ) { name = cssPrefixes[ i ] + capName; if ( name in style ) { return name; } } return origName; } function isHidden( elem, el ) { // isHidden might be called from jQuery#filter function; // in that case, element will be second argument elem = el || elem; return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); } function showHide( elements, show ) { var display, elem, hidden, values = [], index = 0, length = elements.length; for ( ; index < length; index++ ) { elem = elements[ index ]; if ( !elem.style ) { continue; } values[ index ] = jQuery._data( elem, "olddisplay" ); display = elem.style.display; if ( show ) { // Reset the inline display of this element to learn if it is // being hidden by cascaded rules or not if ( !values[ index ] && display === "none" ) { elem.style.display = ""; } // Set elements which have been overridden with display: none // in a stylesheet to whatever the default browser style is // for such an element if ( elem.style.display === "" && isHidden( elem ) ) { values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); } } else { if ( !values[ index ] ) { hidden = isHidden( elem ); if ( display && display !== "none" || !hidden ) { jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); } } } } // Set the display of most of the elements in a second loop // to avoid the constant reflow for ( index = 0; index < length; index++ ) { elem = elements[ index ]; if ( !elem.style ) { continue; } if ( !show || elem.style.display === "none" || elem.style.display === "" ) { elem.style.display = show ? values[ index ] || "" : "none"; } } return elements; } jQuery.fn.extend({ css: function( name, value ) { return jQuery.access( this, function( elem, name, value ) { var len, styles, map = {}, i = 0; if ( jQuery.isArray( name ) ) { styles = getStyles( elem ); len = name.length; for ( ; i < len; i++ ) { map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); } return map; } return value !== undefined ? jQuery.style( elem, name, value ) : jQuery.css( elem, name ); }, name, value, arguments.length > 1 ); }, show: function() { return showHide( this, true ); }, hide: function() { return showHide( this ); }, toggle: function( state ) { var bool = typeof state === "boolean"; return this.each(function() { if ( bool ? state : isHidden( this ) ) { jQuery( this ).show(); } else { jQuery( this ).hide(); } }); } }); jQuery.extend({ // Add in style property hooks for overriding the default // behavior of getting and setting a style property cssHooks: { opacity: { get: function( elem, computed ) { if ( computed ) { // We should always get a number back from opacity var ret = curCSS( elem, "opacity" ); return ret === "" ? "1" : ret; } } } }, // Exclude the following css properties to add px cssNumber: { "columnCount": true, "fillOpacity": true, "fontWeight": true, "lineHeight": true, "opacity": true, "orphans": true, "widows": true, "zIndex": true, "zoom": true }, // Add in properties whose names you wish to fix before // setting or getting the value cssProps: { // normalize float css property "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" }, // Get and set the style property on a DOM Node style: function( elem, name, value, extra ) { // Don't set styles on text and comment nodes if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { return; } // Make sure that we're working with the right name var ret, type, hooks, origName = jQuery.camelCase( name ), style = elem.style; name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); // gets hook for the prefixed version // followed by the unprefixed version hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; // Check if we're setting a value if ( value !== undefined ) { type = typeof value; // convert relative number strings (+= or -=) to relative numbers. #7345 if ( type === "string" && (ret = rrelNum.exec( value )) ) { value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); // Fixes bug #9237 type = "number"; } // Make sure that NaN and null values aren't set. See: #7116 if ( value == null || type === "number" && isNaN( value ) ) { return; } // If a number was passed in, add 'px' to the (except for certain CSS properties) if ( type === "number" && !jQuery.cssNumber[ origName ] ) { value += "px"; } // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, // but it would mean to define eight (for every problematic property) identical functions if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { style[ name ] = "inherit"; } // If a hook was provided, use that value, otherwise just set the specified value if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { // Wrapped to prevent IE from throwing errors when 'invalid' values are provided // Fixes bug #5509 try { style[ name ] = value; } catch(e) {} } } else { // If a hook was provided get the non-computed value from there if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { return ret; } // Otherwise just get the value from the style object return style[ name ]; } }, css: function( elem, name, extra, styles ) { var num, val, hooks, origName = jQuery.camelCase( name ); // Make sure that we're working with the right name name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); // gets hook for the prefixed version // followed by the unprefixed version hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; // If a hook was provided get the computed value from there if ( hooks && "get" in hooks ) { val = hooks.get( elem, true, extra ); } // Otherwise, if a way to get the computed value exists, use that if ( val === undefined ) { val = curCSS( elem, name, styles ); } //convert "normal" to computed value if ( val === "normal" && name in cssNormalTransform ) { val = cssNormalTransform[ name ]; } // Return, converting to number if forced or a qualifier was provided and val looks numeric if ( extra === "" || extra ) { num = parseFloat( val ); return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; } return val; }, // A method for quickly swapping in/out CSS properties to get correct calculations swap: function( elem, options, callback, args ) { var ret, name, old = {}; // Remember the old values, and insert the new ones for ( name in options ) { old[ name ] = elem.style[ name ]; elem.style[ name ] = options[ name ]; } ret = callback.apply( elem, args || [] ); // Revert the old values for ( name in options ) { elem.style[ name ] = old[ name ]; } return ret; } }); // NOTE: we've included the "window" in window.getComputedStyle // because jsdom on node.js will break without it. if ( window.getComputedStyle ) { getStyles = function( elem ) { return window.getComputedStyle( elem, null ); }; curCSS = function( elem, name, _computed ) { var width, minWidth, maxWidth, computed = _computed || getStyles( elem ), // getPropertyValue is only needed for .css('filter') in IE9, see #12537 ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined, style = elem.style; if ( computed ) { if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { ret = jQuery.style( elem, name ); } // A tribute to the "awesome hack by Dean Edwards" // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { // Remember the original values width = style.width; minWidth = style.minWidth; maxWidth = style.maxWidth; // Put in the new values to get a computed value out style.minWidth = style.maxWidth = style.width = ret; ret = computed.width; // Revert the changed values style.width = width; style.minWidth = minWidth; style.maxWidth = maxWidth; } } return ret; }; } else if ( document.documentElement.currentStyle ) { getStyles = function( elem ) { return elem.currentStyle; }; curCSS = function( elem, name, _computed ) { var left, rs, rsLeft, computed = _computed || getStyles( elem ), ret = computed ? computed[ name ] : undefined, style = elem.style; // Avoid setting ret to empty string here // so we don't default to auto if ( ret == null && style && style[ name ] ) { ret = style[ name ]; } // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 // If we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels // but not position css attributes, as those are proportional to the parent element instead // and we can't measure the parent instead because it might trigger a "stacking dolls" problem if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { // Remember the original values left = style.left; rs = elem.runtimeStyle; rsLeft = rs && rs.left; // Put in the new values to get a computed value out if ( rsLeft ) { rs.left = elem.currentStyle.left; } style.left = name === "fontSize" ? "1em" : ret; ret = style.pixelLeft + "px"; // Revert the changed values style.left = left; if ( rsLeft ) { rs.left = rsLeft; } } return ret === "" ? "auto" : ret; }; } function setPositiveNumber( elem, value, subtract ) { var matches = rnumsplit.exec( value ); return matches ? // Guard against undefined "subtract", e.g., when used as in cssHooks Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : value; } function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { var i = extra === ( isBorderBox ? "border" : "content" ) ? // If we already have the right measurement, avoid augmentation 4 : // Otherwise initialize for horizontal or vertical properties name === "width" ? 1 : 0, val = 0; for ( ; i < 4; i += 2 ) { // both box models exclude margin, so add it if we want it if ( extra === "margin" ) { val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); } if ( isBorderBox ) { // border-box includes padding, so remove it if we want content if ( extra === "content" ) { val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); } // at this point, extra isn't border nor margin, so remove border if ( extra !== "margin" ) { val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); } } else { // at this point, extra isn't content, so add padding val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); // at this point, extra isn't content nor padding, so add border if ( extra !== "padding" ) { val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); } } } return val; } function getWidthOrHeight( elem, name, extra ) { // Start with offset property, which is equivalent to the border-box value var valueIsBorderBox = true, val = name === "width" ? elem.offsetWidth : elem.offsetHeight, styles = getStyles( elem ), isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; // some non-html elements return undefined for offsetWidth, so check for null/undefined // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 if ( val <= 0 || val == null ) { // Fall back to computed then uncomputed css if necessary val = curCSS( elem, name, styles ); if ( val < 0 || val == null ) { val = elem.style[ name ]; } // Computed unit is not pixels. Stop here and return. if ( rnumnonpx.test(val) ) { return val; } // we need the check for style in case a browser which returns unreliable values // for getComputedStyle silently falls back to the reliable elem.style valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); // Normalize "", auto, and prepare for extra val = parseFloat( val ) || 0; } // use the active box-sizing model to add/subtract irrelevant styles return ( val + augmentWidthOrHeight( elem, name, extra || ( isBorderBox ? "border" : "content" ), valueIsBorderBox, styles ) ) + "px"; } // Try to determine the default display value of an element function css_defaultDisplay( nodeName ) { var doc = document, display = elemdisplay[ nodeName ]; if ( !display ) { display = actualDisplay( nodeName, doc ); // If the simple way fails, read from inside an iframe if ( display === "none" || !display ) { // Use the already-created iframe if possible iframe = ( iframe || jQuery("'; ifr = document.getElementById('iframe'); doc = ifr.contentWindow.document; // Force absolute CSS urls css = [ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css")]; css = css.concat(tinymce.explode(ed.settings.content_css) || []); tinymce.each(css, function(u) { cssHTML += ''; }); // Write content into iframe doc.open(); doc.write('' + cssHTML + ''); doc.close(); doc.designMode = 'on'; this.resize(); window.setTimeout(function() { ifr.contentWindow.focus(); }, 10); }, insert : function() { var h = document.getElementById('iframe').contentWindow.document.body.innerHTML; tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h, wordContent : true}); tinyMCEPopup.close(); }, resize : function() { var vp = tinyMCEPopup.dom.getViewPort(window), el; el = document.getElementById('iframe'); if (el) { el.style.width = (vp.w - 20) + 'px'; el.style.height = (vp.h - 90) + 'px'; } } }; tinyMCEPopup.onInit.add(PasteWordDialog.init, PasteWordDialog); ================================================ FILE: static/js/tinymce/plugins/paste/langs/en_dlg.js ================================================ tinyMCE.addI18n('en.paste_dlg',{"word_title":"Use Ctrl+V on your keyboard to paste the text into the window.","text_linebreaks":"Keep Linebreaks","text_title":"Use Ctrl+V on your keyboard to paste the text into the window."}); ================================================ FILE: static/js/tinymce/plugins/paste/pastetext.htm ================================================ {#paste.paste_text_desc}
    {#paste.paste_text_desc}

    {#paste_dlg.text_title}
    ================================================ FILE: static/js/tinymce/plugins/paste/pasteword.htm ================================================ {#paste.paste_word_desc}
    {#paste.paste_word_desc}
    {#paste_dlg.word_title}
    ================================================ FILE: static/js/tinymce/plugins/preview/editor_plugin.js ================================================ (function(){tinymce.create("tinymce.plugins.Preview",{init:function(a,b){var d=this,c=tinymce.explode(a.settings.content_css);d.editor=a;tinymce.each(c,function(f,e){c[e]=a.documentBaseURI.toAbsolute(f)});a.addCommand("mcePreview",function(){a.windowManager.open({file:a.getParam("plugin_preview_pageurl",b+"/preview.html"),width:parseInt(a.getParam("plugin_preview_width","550")),height:parseInt(a.getParam("plugin_preview_height","600")),resizable:"yes",scrollbars:"yes",popup_css:c?c.join(","):a.baseURI.toAbsolute("themes/"+a.settings.theme+"/skins/"+a.settings.skin+"/content.css"),inline:a.getParam("plugin_preview_inline",1)},{base:a.documentBaseURI.getURI()})});a.addButton("preview",{title:"preview.preview_desc",cmd:"mcePreview"})},getInfo:function(){return{longname:"Preview",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/preview",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("preview",tinymce.plugins.Preview)})(); ================================================ FILE: static/js/tinymce/plugins/preview/editor_plugin_src.js ================================================ /** * editor_plugin_src.js * * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ (function() { tinymce.create('tinymce.plugins.Preview', { init : function(ed, url) { var t = this, css = tinymce.explode(ed.settings.content_css); t.editor = ed; // Force absolute CSS urls tinymce.each(css, function(u, k) { css[k] = ed.documentBaseURI.toAbsolute(u); }); ed.addCommand('mcePreview', function() { ed.windowManager.open({ file : ed.getParam("plugin_preview_pageurl", url + "/preview.html"), width : parseInt(ed.getParam("plugin_preview_width", "550")), height : parseInt(ed.getParam("plugin_preview_height", "600")), resizable : "yes", scrollbars : "yes", popup_css : css ? css.join(',') : ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css"), inline : ed.getParam("plugin_preview_inline", 1) }, { base : ed.documentBaseURI.getURI() }); }); ed.addButton('preview', {title : 'preview.preview_desc', cmd : 'mcePreview'}); }, getInfo : function() { return { longname : 'Preview', author : 'Moxiecode Systems AB', authorurl : 'http://tinymce.moxiecode.com', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/preview', version : tinymce.majorVersion + "." + tinymce.minorVersion }; } }); // Register plugin tinymce.PluginManager.add('preview', tinymce.plugins.Preview); })(); ================================================ FILE: static/js/tinymce/plugins/preview/example.html ================================================ Example of a custom preview page Editor contents:
    ================================================ FILE: static/js/tinymce/plugins/preview/jscripts/embed.js ================================================ /** * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose. */ function writeFlash(p) { writeEmbed( 'D27CDB6E-AE6D-11cf-96B8-444553540000', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', 'application/x-shockwave-flash', p ); } function writeShockWave(p) { writeEmbed( '166B1BCA-3F9C-11CF-8075-444553540000', 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0', 'application/x-director', p ); } function writeQuickTime(p) { writeEmbed( '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B', 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0', 'video/quicktime', p ); } function writeRealMedia(p) { writeEmbed( 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', 'audio/x-pn-realaudio-plugin', p ); } function writeWindowsMedia(p) { p.url = p.src; writeEmbed( '6BF52A52-394A-11D3-B153-00C04F79FAA6', 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701', 'application/x-mplayer2', p ); } function writeEmbed(cls, cb, mt, p) { var h = '', n; h += ''; h += ' {#preview.preview_desc} ================================================ FILE: static/js/tinymce/plugins/print/editor_plugin.js ================================================ (function(){tinymce.create("tinymce.plugins.Print",{init:function(a,b){a.addCommand("mcePrint",function(){a.getWin().print()});a.addButton("print",{title:"print.print_desc",cmd:"mcePrint"})},getInfo:function(){return{longname:"Print",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/print",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("print",tinymce.plugins.Print)})(); ================================================ FILE: static/js/tinymce/plugins/print/editor_plugin_src.js ================================================ /** * editor_plugin_src.js * * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ (function() { tinymce.create('tinymce.plugins.Print', { init : function(ed, url) { ed.addCommand('mcePrint', function() { ed.getWin().print(); }); ed.addButton('print', {title : 'print.print_desc', cmd : 'mcePrint'}); }, getInfo : function() { return { longname : 'Print', author : 'Moxiecode Systems AB', authorurl : 'http://tinymce.moxiecode.com', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/print', version : tinymce.majorVersion + "." + tinymce.minorVersion }; } }); // Register plugin tinymce.PluginManager.add('print', tinymce.plugins.Print); })(); ================================================ FILE: static/js/tinymce/plugins/save/editor_plugin.js ================================================ (function(){tinymce.create("tinymce.plugins.Save",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceSave",c._save,c);a.addCommand("mceCancel",c._cancel,c);a.addButton("save",{title:"save.save_desc",cmd:"mceSave"});a.addButton("cancel",{title:"save.cancel_desc",cmd:"mceCancel"});a.onNodeChange.add(c._nodeChange,c);a.addShortcut("ctrl+s",a.getLang("save.save_desc"),"mceSave")},getInfo:function(){return{longname:"Save",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/save",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(b,a,c){var b=this.editor;if(b.getParam("save_enablewhendirty")){a.setDisabled("save",!b.isDirty());a.setDisabled("cancel",!b.isDirty())}},_save:function(){var c=this.editor,a,e,d,b;a=tinymce.DOM.get(c.id).form||tinymce.DOM.getParent(c.id,"form");if(c.getParam("save_enablewhendirty")&&!c.isDirty()){return}tinyMCE.triggerSave();if(e=c.getParam("save_onsavecallback")){if(c.execCallback("save_onsavecallback",c)){c.startContent=tinymce.trim(c.getContent({format:"raw"}));c.nodeChanged()}return}if(a){c.isNotDirty=true;if(a.onsubmit==null||a.onsubmit()!=false){a.submit()}c.nodeChanged()}else{c.windowManager.alert("Error: No form element found.")}},_cancel:function(){var a=this.editor,c,b=tinymce.trim(a.startContent);if(c=a.getParam("save_oncancelcallback")){a.execCallback("save_oncancelcallback",a);return}a.setContent(b);a.undoManager.clear();a.nodeChanged()}});tinymce.PluginManager.add("save",tinymce.plugins.Save)})(); ================================================ FILE: static/js/tinymce/plugins/save/editor_plugin_src.js ================================================ /** * editor_plugin_src.js * * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ (function() { tinymce.create('tinymce.plugins.Save', { init : function(ed, url) { var t = this; t.editor = ed; // Register commands ed.addCommand('mceSave', t._save, t); ed.addCommand('mceCancel', t._cancel, t); // Register buttons ed.addButton('save', {title : 'save.save_desc', cmd : 'mceSave'}); ed.addButton('cancel', {title : 'save.cancel_desc', cmd : 'mceCancel'}); ed.onNodeChange.add(t._nodeChange, t); ed.addShortcut('ctrl+s', ed.getLang('save.save_desc'), 'mceSave'); }, getInfo : function() { return { longname : 'Save', author : 'Moxiecode Systems AB', authorurl : 'http://tinymce.moxiecode.com', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/save', version : tinymce.majorVersion + "." + tinymce.minorVersion }; }, // Private methods _nodeChange : function(ed, cm, n) { var ed = this.editor; if (ed.getParam('save_enablewhendirty')) { cm.setDisabled('save', !ed.isDirty()); cm.setDisabled('cancel', !ed.isDirty()); } }, // Private methods _save : function() { var ed = this.editor, formObj, os, i, elementId; formObj = tinymce.DOM.get(ed.id).form || tinymce.DOM.getParent(ed.id, 'form'); if (ed.getParam("save_enablewhendirty") && !ed.isDirty()) return; tinyMCE.triggerSave(); // Use callback instead if (os = ed.getParam("save_onsavecallback")) { if (ed.execCallback('save_onsavecallback', ed)) { ed.startContent = tinymce.trim(ed.getContent({format : 'raw'})); ed.nodeChanged(); } return; } if (formObj) { ed.isNotDirty = true; if (formObj.onsubmit == null || formObj.onsubmit() != false) formObj.submit(); ed.nodeChanged(); } else ed.windowManager.alert("Error: No form element found."); }, _cancel : function() { var ed = this.editor, os, h = tinymce.trim(ed.startContent); // Use callback instead if (os = ed.getParam("save_oncancelcallback")) { ed.execCallback('save_oncancelcallback', ed); return; } ed.setContent(h); ed.undoManager.clear(); ed.nodeChanged(); } }); // Register plugin tinymce.PluginManager.add('save', tinymce.plugins.Save); })(); ================================================ FILE: static/js/tinymce/plugins/searchreplace/css/searchreplace.css ================================================ .panel_wrapper {height:85px;} .panel_wrapper div.current {height:85px;} /* IE */ * html .panel_wrapper {height:100px;} * html .panel_wrapper div.current {height:100px;} ================================================ FILE: static/js/tinymce/plugins/searchreplace/editor_plugin.js ================================================ (function(){tinymce.create("tinymce.plugins.SearchReplacePlugin",{init:function(a,c){function b(d){window.focus();a.windowManager.open({file:c+"/searchreplace.htm",width:420+parseInt(a.getLang("searchreplace.delta_width",0)),height:170+parseInt(a.getLang("searchreplace.delta_height",0)),inline:1,auto_focus:0},{mode:d,search_string:a.selection.getContent({format:"text"}),plugin_url:c})}a.addCommand("mceSearch",function(){b("search")});a.addCommand("mceReplace",function(){b("replace")});a.addButton("search",{title:"searchreplace.search_desc",cmd:"mceSearch"});a.addButton("replace",{title:"searchreplace.replace_desc",cmd:"mceReplace"});a.addShortcut("ctrl+f","searchreplace.search_desc","mceSearch")},getInfo:function(){return{longname:"Search/Replace",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("searchreplace",tinymce.plugins.SearchReplacePlugin)})(); ================================================ FILE: static/js/tinymce/plugins/searchreplace/editor_plugin_src.js ================================================ /** * editor_plugin_src.js * * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ (function() { tinymce.create('tinymce.plugins.SearchReplacePlugin', { init : function(ed, url) { function open(m) { // Keep IE from writing out the f/r character to the editor // instance while initializing a new dialog. See: #3131190 window.focus(); ed.windowManager.open({ file : url + '/searchreplace.htm', width : 420 + parseInt(ed.getLang('searchreplace.delta_width', 0)), height : 170 + parseInt(ed.getLang('searchreplace.delta_height', 0)), inline : 1, auto_focus : 0 }, { mode : m, search_string : ed.selection.getContent({format : 'text'}), plugin_url : url }); }; // Register commands ed.addCommand('mceSearch', function() { open('search'); }); ed.addCommand('mceReplace', function() { open('replace'); }); // Register buttons ed.addButton('search', {title : 'searchreplace.search_desc', cmd : 'mceSearch'}); ed.addButton('replace', {title : 'searchreplace.replace_desc', cmd : 'mceReplace'}); ed.addShortcut('ctrl+f', 'searchreplace.search_desc', 'mceSearch'); }, getInfo : function() { return { longname : 'Search/Replace', author : 'Moxiecode Systems AB', authorurl : 'http://tinymce.moxiecode.com', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace', version : tinymce.majorVersion + "." + tinymce.minorVersion }; } }); // Register plugin tinymce.PluginManager.add('searchreplace', tinymce.plugins.SearchReplacePlugin); })(); ================================================ FILE: static/js/tinymce/plugins/searchreplace/js/searchreplace.js ================================================ tinyMCEPopup.requireLangPack(); var SearchReplaceDialog = { init : function(ed) { var t = this, f = document.forms[0], m = tinyMCEPopup.getWindowArg("mode"); t.switchMode(m); f[m + '_panel_searchstring'].value = tinyMCEPopup.getWindowArg("search_string"); // Focus input field f[m + '_panel_searchstring'].focus(); mcTabs.onChange.add(function(tab_id, panel_id) { t.switchMode(tab_id.substring(0, tab_id.indexOf('_'))); }); }, switchMode : function(m) { var f, lm = this.lastMode; if (lm != m) { f = document.forms[0]; if (lm) { f[m + '_panel_searchstring'].value = f[lm + '_panel_searchstring'].value; f[m + '_panel_backwardsu'].checked = f[lm + '_panel_backwardsu'].checked; f[m + '_panel_backwardsd'].checked = f[lm + '_panel_backwardsd'].checked; f[m + '_panel_casesensitivebox'].checked = f[lm + '_panel_casesensitivebox'].checked; } mcTabs.displayTab(m + '_tab', m + '_panel'); document.getElementById("replaceBtn").style.display = (m == "replace") ? "inline" : "none"; document.getElementById("replaceAllBtn").style.display = (m == "replace") ? "inline" : "none"; this.lastMode = m; } }, searchNext : function(a) { var ed = tinyMCEPopup.editor, se = ed.selection, r = se.getRng(), f, m = this.lastMode, s, b, fl = 0, w = ed.getWin(), wm = ed.windowManager, fo = 0; // Get input f = document.forms[0]; s = f[m + '_panel_searchstring'].value; b = f[m + '_panel_backwardsu'].checked; ca = f[m + '_panel_casesensitivebox'].checked; rs = f['replace_panel_replacestring'].value; if (tinymce.isIE) { r = ed.getDoc().selection.createRange(); } if (s == '') return; function fix() { // Correct Firefox graphics glitches // TODO: Verify if this is actually needed any more, maybe it was for very old FF versions? r = se.getRng().cloneRange(); ed.getDoc().execCommand('SelectAll', false, null); se.setRng(r); }; function replace() { ed.selection.setContent(rs); // Needs to be duplicated due to selection bug in IE }; // IE flags if (ca) fl = fl | 4; switch (a) { case 'all': // Move caret to beginning of text ed.execCommand('SelectAll'); ed.selection.collapse(true); if (tinymce.isIE) { ed.focus(); r = ed.getDoc().selection.createRange(); while (r.findText(s, b ? -1 : 1, fl)) { r.scrollIntoView(); r.select(); replace(); fo = 1; if (b) { r.moveEnd("character", -(rs.length)); // Otherwise will loop forever } } tinyMCEPopup.storeSelection(); } else { while (w.find(s, ca, b, false, false, false, false)) { replace(); fo = 1; } } if (fo) tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.allreplaced')); else tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound')); return; case 'current': if (!ed.selection.isCollapsed()) replace(); break; } se.collapse(b); r = se.getRng(); // Whats the point if (!s) return; if (tinymce.isIE) { ed.focus(); r = ed.getDoc().selection.createRange(); if (r.findText(s, b ? -1 : 1, fl)) { r.scrollIntoView(); r.select(); } else tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound')); tinyMCEPopup.storeSelection(); } else { if (!w.find(s, ca, b, false, false, false, false)) tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound')); else fix(); } } }; tinyMCEPopup.onInit.add(SearchReplaceDialog.init, SearchReplaceDialog); ================================================ FILE: static/js/tinymce/plugins/searchreplace/langs/en_dlg.js ================================================ tinyMCE.addI18n('en.searchreplace_dlg',{findwhat:"Find What",replacewith:"Replace with",direction:"Direction",up:"Up",down:"Down",mcase:"Match Case",findnext:"Find Next",allreplaced:"All occurrences of the search string were replaced.","searchnext_desc":"Find Again",notfound:"The search has been completed. The search string could not be found.","search_title":"Find","replace_title":"Find/Replace",replaceall:"Replace All",replace:"Replace"}); ================================================ FILE: static/js/tinymce/plugins/searchreplace/searchreplace.htm ================================================ {#searchreplace_dlg.replace_title}
    ================================================ FILE: static/js/tinymce/plugins/spellchecker/css/content.css ================================================ .mceItemHiddenSpellWord {background:url(../img/wline.gif) repeat-x bottom left; cursor:default;} ================================================ FILE: static/js/tinymce/plugins/spellchecker/editor_plugin.js ================================================ (function(){var a=tinymce.util.JSONRequest,c=tinymce.each,b=tinymce.DOM;tinymce.create("tinymce.plugins.SpellcheckerPlugin",{getInfo:function(){return{longname:"Spellchecker",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker",version:tinymce.majorVersion+"."+tinymce.minorVersion}},init:function(e,f){var g=this,d;g.url=f;g.editor=e;g.rpcUrl=e.getParam("spellchecker_rpc_url","{backend}");if(g.rpcUrl=="{backend}"){if(tinymce.isIE){return}g.hasSupport=true;e.onContextMenu.addToTop(function(h,i){if(g.active){return false}})}e.addCommand("mceSpellCheck",function(){if(g.rpcUrl=="{backend}"){g.editor.getBody().spellcheck=g.active=!g.active;return}if(!g.active){e.setProgressState(1);g._sendRPC("checkWords",[g.selectedLang,g._getWords()],function(h){if(h.length>0){g.active=1;g._markWords(h);e.setProgressState(0);e.nodeChanged()}else{e.setProgressState(0);if(e.getParam("spellchecker_report_no_misspellings",true)){e.windowManager.alert("spellchecker.no_mpell")}}})}else{g._done()}});if(e.settings.content_css!==false){e.contentCSS.push(f+"/css/content.css")}e.onClick.add(g._showMenu,g);e.onContextMenu.add(g._showMenu,g);e.onBeforeGetContent.add(function(){if(g.active){g._removeWords()}});e.onNodeChange.add(function(i,h){h.setActive("spellchecker",g.active)});e.onSetContent.add(function(){g._done()});e.onBeforeGetContent.add(function(){g._done()});e.onBeforeExecCommand.add(function(h,i){if(i=="mceFullScreen"){g._done()}});g.languages={};c(e.getParam("spellchecker_languages","+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv","hash"),function(i,h){if(h.indexOf("+")===0){h=h.substring(1);g.selectedLang=i}g.languages[h]=i})},createControl:function(h,d){var f=this,g,e=f.editor;if(h=="spellchecker"){if(f.rpcUrl=="{backend}"){if(f.hasSupport){g=d.createButton(h,{title:"spellchecker.desc",cmd:"mceSpellCheck",scope:f})}return g}g=d.createSplitButton(h,{title:"spellchecker.desc",cmd:"mceSpellCheck",scope:f});g.onRenderMenu.add(function(j,i){i.add({title:"spellchecker.langs","class":"mceMenuItemTitle"}).setDisabled(1);c(f.languages,function(n,m){var p={icon:1},l;p.onclick=function(){if(n==f.selectedLang){return}l.setSelected(1);f.selectedItem.setSelected(0);f.selectedItem=l;f.selectedLang=n};p.title=m;l=i.add(p);l.setSelected(n==f.selectedLang);if(n==f.selectedLang){f.selectedItem=l}})});return g}},_walk:function(i,g){var h=this.editor.getDoc(),e;if(h.createTreeWalker){e=h.createTreeWalker(i,NodeFilter.SHOW_TEXT,null,false);while((i=e.nextNode())!=null){g.call(this,i)}}else{tinymce.walk(i,g,"childNodes")}},_getSeparators:function(){var e="",d,f=this.editor.getParam("spellchecker_word_separator_chars",'\\s!"#$%&()*+,-./:;<=>?@[]^_{|}\u201d\u201c');for(d=0;d$2");while((s=p.indexOf(""))!=-1){o=p.substring(0,s);if(o.length){r=j.createTextNode(g.decode(o));q.appendChild(r)}p=p.substring(s+10);s=p.indexOf("");o=p.substring(0,s);p=p.substring(s+11);q.appendChild(g.create("span",{"class":"mceItemHiddenSpellWord"},o))}if(p.length){r=j.createTextNode(g.decode(p));q.appendChild(r)}}else{q.innerHTML=p.replace(f,'$1$2')}g.replace(q,t)}});i.setRng(d)},_showMenu:function(h,j){var i=this,h=i.editor,d=i._menu,l,k=h.dom,g=k.getViewPort(h.getWin()),f=j.target;j=0;if(!d){d=h.controlManager.createDropMenu("spellcheckermenu",{"class":"mceNoIcons"});i._menu=d}if(k.hasClass(f,"mceItemHiddenSpellWord")){d.removeAll();d.add({title:"spellchecker.wait","class":"mceMenuItemTitle"}).setDisabled(1);i._sendRPC("getSuggestions",[i.selectedLang,k.decode(f.innerHTML)],function(m){var e;d.removeAll();if(m.length>0){d.add({title:"spellchecker.sug","class":"mceMenuItemTitle"}).setDisabled(1);c(m,function(n){d.add({title:n,onclick:function(){k.replace(h.getDoc().createTextNode(n),f);i._checkDone()}})});d.addSeparator()}else{d.add({title:"spellchecker.no_sug","class":"mceMenuItemTitle"}).setDisabled(1)}if(h.getParam("show_ignore_words",true)){e=i.editor.getParam("spellchecker_enable_ignore_rpc","");d.add({title:"spellchecker.ignore_word",onclick:function(){var n=f.innerHTML;k.remove(f,1);i._checkDone();if(e){h.setProgressState(1);i._sendRPC("ignoreWord",[i.selectedLang,n],function(o){h.setProgressState(0)})}}});d.add({title:"spellchecker.ignore_words",onclick:function(){var n=f.innerHTML;i._removeWords(k.decode(n));i._checkDone();if(e){h.setProgressState(1);i._sendRPC("ignoreWords",[i.selectedLang,n],function(o){h.setProgressState(0)})}}})}if(i.editor.getParam("spellchecker_enable_learn_rpc")){d.add({title:"spellchecker.learn_word",onclick:function(){var n=f.innerHTML;k.remove(f,1);i._checkDone();h.setProgressState(1);i._sendRPC("learnWord",[i.selectedLang,n],function(o){h.setProgressState(0)})}})}d.update()});l=b.getPos(h.getContentAreaContainer());d.settings.offset_x=l.x;d.settings.offset_y=l.y;h.selection.select(f);l=k.getPos(f);d.showMenu(l.x,l.y+f.offsetHeight-g.y);return tinymce.dom.Event.cancel(j)}else{d.hideMenu()}},_checkDone:function(){var e=this,d=e.editor,g=d.dom,f;c(g.select("span"),function(h){if(h&&g.hasClass(h,"mceItemHiddenSpellWord")){f=true;return false}});if(!f){e._done()}},_done:function(){var d=this,e=d.active;if(d.active){d.active=0;d._removeWords();if(d._menu){d._menu.hideMenu()}if(e){d.editor.nodeChanged()}}},_sendRPC:function(e,g,d){var f=this;a.sendRPC({url:f.rpcUrl,method:e,params:g,success:d,error:function(i,h){f.editor.setProgressState(0);f.editor.windowManager.alert(i.errstr||("Error response: "+h.responseText))}})}});tinymce.PluginManager.add("spellchecker",tinymce.plugins.SpellcheckerPlugin)})(); ================================================ FILE: static/js/tinymce/plugins/spellchecker/editor_plugin_src.js ================================================ /** * editor_plugin_src.js * * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ (function() { var JSONRequest = tinymce.util.JSONRequest, each = tinymce.each, DOM = tinymce.DOM; tinymce.create('tinymce.plugins.SpellcheckerPlugin', { getInfo : function() { return { longname : 'Spellchecker', author : 'Moxiecode Systems AB', authorurl : 'http://tinymce.moxiecode.com', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker', version : tinymce.majorVersion + "." + tinymce.minorVersion }; }, init : function(ed, url) { var t = this, cm; t.url = url; t.editor = ed; t.rpcUrl = ed.getParam("spellchecker_rpc_url", "{backend}"); if (t.rpcUrl == '{backend}') { // Sniff if the browser supports native spellchecking (Don't know of a better way) if (tinymce.isIE) return; t.hasSupport = true; // Disable the context menu when spellchecking is active ed.onContextMenu.addToTop(function(ed, e) { if (t.active) return false; }); } // Register commands ed.addCommand('mceSpellCheck', function() { if (t.rpcUrl == '{backend}') { // Enable/disable native spellchecker t.editor.getBody().spellcheck = t.active = !t.active; return; } if (!t.active) { ed.setProgressState(1); t._sendRPC('checkWords', [t.selectedLang, t._getWords()], function(r) { if (r.length > 0) { t.active = 1; t._markWords(r); ed.setProgressState(0); ed.nodeChanged(); } else { ed.setProgressState(0); if (ed.getParam('spellchecker_report_no_misspellings', true)) ed.windowManager.alert('spellchecker.no_mpell'); } }); } else t._done(); }); if (ed.settings.content_css !== false) ed.contentCSS.push(url + '/css/content.css'); ed.onClick.add(t._showMenu, t); ed.onContextMenu.add(t._showMenu, t); ed.onBeforeGetContent.add(function() { if (t.active) t._removeWords(); }); ed.onNodeChange.add(function(ed, cm) { cm.setActive('spellchecker', t.active); }); ed.onSetContent.add(function() { t._done(); }); ed.onBeforeGetContent.add(function() { t._done(); }); ed.onBeforeExecCommand.add(function(ed, cmd) { if (cmd == 'mceFullScreen') t._done(); }); // Find selected language t.languages = {}; each(ed.getParam('spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv', 'hash'), function(v, k) { if (k.indexOf('+') === 0) { k = k.substring(1); t.selectedLang = v; } t.languages[k] = v; }); }, createControl : function(n, cm) { var t = this, c, ed = t.editor; if (n == 'spellchecker') { // Use basic button if we use the native spellchecker if (t.rpcUrl == '{backend}') { // Create simple toggle button if we have native support if (t.hasSupport) c = cm.createButton(n, {title : 'spellchecker.desc', cmd : 'mceSpellCheck', scope : t}); return c; } c = cm.createSplitButton(n, {title : 'spellchecker.desc', cmd : 'mceSpellCheck', scope : t}); c.onRenderMenu.add(function(c, m) { m.add({title : 'spellchecker.langs', 'class' : 'mceMenuItemTitle'}).setDisabled(1); each(t.languages, function(v, k) { var o = {icon : 1}, mi; o.onclick = function() { if (v == t.selectedLang) { return; } mi.setSelected(1); t.selectedItem.setSelected(0); t.selectedItem = mi; t.selectedLang = v; }; o.title = k; mi = m.add(o); mi.setSelected(v == t.selectedLang); if (v == t.selectedLang) t.selectedItem = mi; }) }); return c; } }, // Internal functions _walk : function(n, f) { var d = this.editor.getDoc(), w; if (d.createTreeWalker) { w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false); while ((n = w.nextNode()) != null) f.call(this, n); } else tinymce.walk(n, f, 'childNodes'); }, _getSeparators : function() { var re = '', i, str = this.editor.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}\u201d\u201c'); // Build word separator regexp for (i=0; i elements content is broken after spellchecking. // Bug #1408: Preceding whitespace characters are removed // @TODO: I'm not sure that both are still issues on IE9. if (tinymce.isIE) { // Enclose mispelled words with temporal tag v = v.replace(rx, '$1$2'); // Loop over the content finding mispelled words while ((pos = v.indexOf('')) != -1) { // Add text node for the content before the word txt = v.substring(0, pos); if (txt.length) { node = doc.createTextNode(dom.decode(txt)); elem.appendChild(node); } v = v.substring(pos+10); pos = v.indexOf(''); txt = v.substring(0, pos); v = v.substring(pos+11); // Add span element for the word elem.appendChild(dom.create('span', {'class' : 'mceItemHiddenSpellWord'}, txt)); } // Add text node for the rest of the content if (v.length) { node = doc.createTextNode(dom.decode(v)); elem.appendChild(node); } } else { // Other browsers preserve whitespace characters on innerHTML usage elem.innerHTML = v.replace(rx, '$1$2'); } // Finally, replace the node with the container dom.replace(elem, n); } }); se.setRng(r); }, _showMenu : function(ed, e) { var t = this, ed = t.editor, m = t._menu, p1, dom = ed.dom, vp = dom.getViewPort(ed.getWin()), wordSpan = e.target; e = 0; // Fixes IE memory leak if (!m) { m = ed.controlManager.createDropMenu('spellcheckermenu', {'class' : 'mceNoIcons'}); t._menu = m; } if (dom.hasClass(wordSpan, 'mceItemHiddenSpellWord')) { m.removeAll(); m.add({title : 'spellchecker.wait', 'class' : 'mceMenuItemTitle'}).setDisabled(1); t._sendRPC('getSuggestions', [t.selectedLang, dom.decode(wordSpan.innerHTML)], function(r) { var ignoreRpc; m.removeAll(); if (r.length > 0) { m.add({title : 'spellchecker.sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1); each(r, function(v) { m.add({title : v, onclick : function() { dom.replace(ed.getDoc().createTextNode(v), wordSpan); t._checkDone(); }}); }); m.addSeparator(); } else m.add({title : 'spellchecker.no_sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1); if (ed.getParam('show_ignore_words', true)) { ignoreRpc = t.editor.getParam("spellchecker_enable_ignore_rpc", ''); m.add({ title : 'spellchecker.ignore_word', onclick : function() { var word = wordSpan.innerHTML; dom.remove(wordSpan, 1); t._checkDone(); // tell the server if we need to if (ignoreRpc) { ed.setProgressState(1); t._sendRPC('ignoreWord', [t.selectedLang, word], function(r) { ed.setProgressState(0); }); } } }); m.add({ title : 'spellchecker.ignore_words', onclick : function() { var word = wordSpan.innerHTML; t._removeWords(dom.decode(word)); t._checkDone(); // tell the server if we need to if (ignoreRpc) { ed.setProgressState(1); t._sendRPC('ignoreWords', [t.selectedLang, word], function(r) { ed.setProgressState(0); }); } } }); } if (t.editor.getParam("spellchecker_enable_learn_rpc")) { m.add({ title : 'spellchecker.learn_word', onclick : function() { var word = wordSpan.innerHTML; dom.remove(wordSpan, 1); t._checkDone(); ed.setProgressState(1); t._sendRPC('learnWord', [t.selectedLang, word], function(r) { ed.setProgressState(0); }); } }); } m.update(); }); p1 = DOM.getPos(ed.getContentAreaContainer()); m.settings.offset_x = p1.x; m.settings.offset_y = p1.y; ed.selection.select(wordSpan); p1 = dom.getPos(wordSpan); m.showMenu(p1.x, p1.y + wordSpan.offsetHeight - vp.y); return tinymce.dom.Event.cancel(e); } else m.hideMenu(); }, _checkDone : function() { var t = this, ed = t.editor, dom = ed.dom, o; each(dom.select('span'), function(n) { if (n && dom.hasClass(n, 'mceItemHiddenSpellWord')) { o = true; return false; } }); if (!o) t._done(); }, _done : function() { var t = this, la = t.active; if (t.active) { t.active = 0; t._removeWords(); if (t._menu) t._menu.hideMenu(); if (la) t.editor.nodeChanged(); } }, _sendRPC : function(m, p, cb) { var t = this; JSONRequest.sendRPC({ url : t.rpcUrl, method : m, params : p, success : cb, error : function(e, x) { t.editor.setProgressState(0); t.editor.windowManager.alert(e.errstr || ('Error response: ' + x.responseText)); } }); } }); // Register plugin tinymce.PluginManager.add('spellchecker', tinymce.plugins.SpellcheckerPlugin); })(); ================================================ FILE: static/js/tinymce/plugins/style/css/props.css ================================================ #text_font {width:250px;} #text_size {width:70px;} .mceAddSelectValue {background:#DDD;} select, #block_text_indent, #box_width, #box_height, #box_padding_top, #box_padding_right, #box_padding_bottom, #box_padding_left {width:70px;} #box_margin_top, #box_margin_right, #box_margin_bottom, #box_margin_left, #positioning_width, #positioning_height, #positioning_zindex {width:70px;} #positioning_placement_top, #positioning_placement_right, #positioning_placement_bottom, #positioning_placement_left {width:70px;} #positioning_clip_top, #positioning_clip_right, #positioning_clip_bottom, #positioning_clip_left {width:70px;} .panel_toggle_insert_span {padding-top:10px;} .panel_wrapper div.current {padding-top:10px;height:230px;} .delim {border-left:1px solid gray;} .tdelim {border-bottom:1px solid gray;} #block_display {width:145px;} #list_type {width:115px;} .disabled {background:#EEE;} ================================================ FILE: static/js/tinymce/plugins/style/editor_plugin.js ================================================ (function(){tinymce.create("tinymce.plugins.StylePlugin",{init:function(a,b){a.addCommand("mceStyleProps",function(){var c=false;var f=a.selection.getSelectedBlocks();var d=[];if(f.length===1){d.push(a.selection.getNode().style.cssText)}else{tinymce.each(f,function(g){d.push(a.dom.getAttrib(g,"style"))});c=true}a.windowManager.open({file:b+"/props.htm",width:480+parseInt(a.getLang("style.delta_width",0)),height:340+parseInt(a.getLang("style.delta_height",0)),inline:1},{applyStyleToBlocks:c,plugin_url:b,styles:d})});a.addCommand("mceSetElementStyle",function(d,c){if(e=a.selection.getNode()){a.dom.setAttrib(e,"style",c);a.execCommand("mceRepaint")}});a.onNodeChange.add(function(d,c,f){c.setDisabled("styleprops",f.nodeName==="BODY")});a.addButton("styleprops",{title:"style.desc",cmd:"mceStyleProps"})},getInfo:function(){return{longname:"Style",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("style",tinymce.plugins.StylePlugin)})(); ================================================ FILE: static/js/tinymce/plugins/style/editor_plugin_src.js ================================================ /** * editor_plugin_src.js * * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ (function() { tinymce.create('tinymce.plugins.StylePlugin', { init : function(ed, url) { // Register commands ed.addCommand('mceStyleProps', function() { var applyStyleToBlocks = false; var blocks = ed.selection.getSelectedBlocks(); var styles = []; if (blocks.length === 1) { styles.push(ed.selection.getNode().style.cssText); } else { tinymce.each(blocks, function(block) { styles.push(ed.dom.getAttrib(block, 'style')); }); applyStyleToBlocks = true; } ed.windowManager.open({ file : url + '/props.htm', width : 480 + parseInt(ed.getLang('style.delta_width', 0)), height : 340 + parseInt(ed.getLang('style.delta_height', 0)), inline : 1 }, { applyStyleToBlocks : applyStyleToBlocks, plugin_url : url, styles : styles }); }); ed.addCommand('mceSetElementStyle', function(ui, v) { if (e = ed.selection.getNode()) { ed.dom.setAttrib(e, 'style', v); ed.execCommand('mceRepaint'); } }); ed.onNodeChange.add(function(ed, cm, n) { cm.setDisabled('styleprops', n.nodeName === 'BODY'); }); // Register buttons ed.addButton('styleprops', {title : 'style.desc', cmd : 'mceStyleProps'}); }, getInfo : function() { return { longname : 'Style', author : 'Moxiecode Systems AB', authorurl : 'http://tinymce.moxiecode.com', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style', version : tinymce.majorVersion + "." + tinymce.minorVersion }; } }); // Register plugin tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin); })(); ================================================ FILE: static/js/tinymce/plugins/style/js/props.js ================================================ tinyMCEPopup.requireLangPack(); var defaultFonts = "" + "Arial, Helvetica, sans-serif=Arial, Helvetica, sans-serif;" + "Times New Roman, Times, serif=Times New Roman, Times, serif;" + "Courier New, Courier, mono=Courier New, Courier, mono;" + "Times New Roman, Times, serif=Times New Roman, Times, serif;" + "Georgia, Times New Roman, Times, serif=Georgia, Times New Roman, Times, serif;" + "Verdana, Arial, Helvetica, sans-serif=Verdana, Arial, Helvetica, sans-serif;" + "Geneva, Arial, Helvetica, sans-serif=Geneva, Arial, Helvetica, sans-serif"; var defaultSizes = "9;10;12;14;16;18;24;xx-small;x-small;small;medium;large;x-large;xx-large;smaller;larger"; var defaultMeasurement = "+pixels=px;points=pt;inches=in;centimetres=cm;millimetres=mm;picas=pc;ems=em;exs=ex;%"; var defaultSpacingMeasurement = "pixels=px;points=pt;inches=in;centimetres=cm;millimetres=mm;picas=pc;+ems=em;exs=ex;%"; var defaultIndentMeasurement = "pixels=px;+points=pt;inches=in;centimetres=cm;millimetres=mm;picas=pc;ems=em;exs=ex;%"; var defaultWeight = "normal;bold;bolder;lighter;100;200;300;400;500;600;700;800;900"; var defaultTextStyle = "normal;italic;oblique"; var defaultVariant = "normal;small-caps"; var defaultLineHeight = "normal"; var defaultAttachment = "fixed;scroll"; var defaultRepeat = "no-repeat;repeat;repeat-x;repeat-y"; var defaultPosH = "left;center;right"; var defaultPosV = "top;center;bottom"; var defaultVAlign = "baseline;sub;super;top;text-top;middle;bottom;text-bottom"; var defaultDisplay = "inline;block;list-item;run-in;compact;marker;table;inline-table;table-row-group;table-header-group;table-footer-group;table-row;table-column-group;table-column;table-cell;table-caption;none"; var defaultBorderStyle = "none;solid;dashed;dotted;double;groove;ridge;inset;outset"; var defaultBorderWidth = "thin;medium;thick"; var defaultListType = "disc;circle;square;decimal;lower-roman;upper-roman;lower-alpha;upper-alpha;none"; function aggregateStyles(allStyles) { var mergedStyles = {}; tinymce.each(allStyles, function(style) { if (style !== '') { var parsedStyles = tinyMCEPopup.editor.dom.parseStyle(style); for (var name in parsedStyles) { if (parsedStyles.hasOwnProperty(name)) { if (mergedStyles[name] === undefined) { mergedStyles[name] = parsedStyles[name]; } else if (name === 'text-decoration') { if (mergedStyles[name].indexOf(parsedStyles[name]) === -1) { mergedStyles[name] = mergedStyles[name] +' '+ parsedStyles[name]; } } } } } }); return mergedStyles; } var applyActionIsInsert; var existingStyles; function init(ed) { var ce = document.getElementById('container'), h; existingStyles = aggregateStyles(tinyMCEPopup.getWindowArg('styles')); ce.style.cssText = tinyMCEPopup.editor.dom.serializeStyle(existingStyles); applyActionIsInsert = ed.getParam("edit_css_style_insert_span", false); document.getElementById('toggle_insert_span').checked = applyActionIsInsert; h = getBrowserHTML('background_image_browser','background_image','image','advimage'); document.getElementById("background_image_browser").innerHTML = h; document.getElementById('text_color_pickcontainer').innerHTML = getColorPickerHTML('text_color_pick','text_color'); document.getElementById('background_color_pickcontainer').innerHTML = getColorPickerHTML('background_color_pick','background_color'); document.getElementById('border_color_top_pickcontainer').innerHTML = getColorPickerHTML('border_color_top_pick','border_color_top'); document.getElementById('border_color_right_pickcontainer').innerHTML = getColorPickerHTML('border_color_right_pick','border_color_right'); document.getElementById('border_color_bottom_pickcontainer').innerHTML = getColorPickerHTML('border_color_bottom_pick','border_color_bottom'); document.getElementById('border_color_left_pickcontainer').innerHTML = getColorPickerHTML('border_color_left_pick','border_color_left'); fillSelect(0, 'text_font', 'style_font', defaultFonts, ';', true); fillSelect(0, 'text_size', 'style_font_size', defaultSizes, ';', true); fillSelect(0, 'text_size_measurement', 'style_font_size_measurement', defaultMeasurement, ';', true); fillSelect(0, 'text_case', 'style_text_case', "capitalize;uppercase;lowercase", ';', true); fillSelect(0, 'text_weight', 'style_font_weight', defaultWeight, ';', true); fillSelect(0, 'text_style', 'style_font_style', defaultTextStyle, ';', true); fillSelect(0, 'text_variant', 'style_font_variant', defaultVariant, ';', true); fillSelect(0, 'text_lineheight', 'style_font_line_height', defaultLineHeight, ';', true); fillSelect(0, 'text_lineheight_measurement', 'style_font_line_height_measurement', defaultMeasurement, ';', true); fillSelect(0, 'background_attachment', 'style_background_attachment', defaultAttachment, ';', true); fillSelect(0, 'background_repeat', 'style_background_repeat', defaultRepeat, ';', true); fillSelect(0, 'background_hpos_measurement', 'style_background_hpos_measurement', defaultMeasurement, ';', true); fillSelect(0, 'background_vpos_measurement', 'style_background_vpos_measurement', defaultMeasurement, ';', true); fillSelect(0, 'background_hpos', 'style_background_hpos', defaultPosH, ';', true); fillSelect(0, 'background_vpos', 'style_background_vpos', defaultPosV, ';', true); fillSelect(0, 'block_wordspacing', 'style_wordspacing', 'normal', ';', true); fillSelect(0, 'block_wordspacing_measurement', 'style_wordspacing_measurement', defaultSpacingMeasurement, ';', true); fillSelect(0, 'block_letterspacing', 'style_letterspacing', 'normal', ';', true); fillSelect(0, 'block_letterspacing_measurement', 'style_letterspacing_measurement', defaultSpacingMeasurement, ';', true); fillSelect(0, 'block_vertical_alignment', 'style_vertical_alignment', defaultVAlign, ';', true); fillSelect(0, 'block_text_align', 'style_text_align', "left;right;center;justify", ';', true); fillSelect(0, 'block_whitespace', 'style_whitespace', "normal;pre;nowrap", ';', true); fillSelect(0, 'block_display', 'style_display', defaultDisplay, ';', true); fillSelect(0, 'block_text_indent_measurement', 'style_text_indent_measurement', defaultIndentMeasurement, ';', true); fillSelect(0, 'box_width_measurement', 'style_box_width_measurement', defaultMeasurement, ';', true); fillSelect(0, 'box_height_measurement', 'style_box_height_measurement', defaultMeasurement, ';', true); fillSelect(0, 'box_float', 'style_float', 'left;right;none', ';', true); fillSelect(0, 'box_clear', 'style_clear', 'left;right;both;none', ';', true); fillSelect(0, 'box_padding_left_measurement', 'style_padding_left_measurement', defaultMeasurement, ';', true); fillSelect(0, 'box_padding_top_measurement', 'style_padding_top_measurement', defaultMeasurement, ';', true); fillSelect(0, 'box_padding_bottom_measurement', 'style_padding_bottom_measurement', defaultMeasurement, ';', true); fillSelect(0, 'box_padding_right_measurement', 'style_padding_right_measurement', defaultMeasurement, ';', true); fillSelect(0, 'box_margin_left_measurement', 'style_margin_left_measurement', defaultMeasurement, ';', true); fillSelect(0, 'box_margin_top_measurement', 'style_margin_top_measurement', defaultMeasurement, ';', true); fillSelect(0, 'box_margin_bottom_measurement', 'style_margin_bottom_measurement', defaultMeasurement, ';', true); fillSelect(0, 'box_margin_right_measurement', 'style_margin_right_measurement', defaultMeasurement, ';', true); fillSelect(0, 'border_style_top', 'style_border_style_top', defaultBorderStyle, ';', true); fillSelect(0, 'border_style_right', 'style_border_style_right', defaultBorderStyle, ';', true); fillSelect(0, 'border_style_bottom', 'style_border_style_bottom', defaultBorderStyle, ';', true); fillSelect(0, 'border_style_left', 'style_border_style_left', defaultBorderStyle, ';', true); fillSelect(0, 'border_width_top', 'style_border_width_top', defaultBorderWidth, ';', true); fillSelect(0, 'border_width_right', 'style_border_width_right', defaultBorderWidth, ';', true); fillSelect(0, 'border_width_bottom', 'style_border_width_bottom', defaultBorderWidth, ';', true); fillSelect(0, 'border_width_left', 'style_border_width_left', defaultBorderWidth, ';', true); fillSelect(0, 'border_width_top_measurement', 'style_border_width_top_measurement', defaultMeasurement, ';', true); fillSelect(0, 'border_width_right_measurement', 'style_border_width_right_measurement', defaultMeasurement, ';', true); fillSelect(0, 'border_width_bottom_measurement', 'style_border_width_bottom_measurement', defaultMeasurement, ';', true); fillSelect(0, 'border_width_left_measurement', 'style_border_width_left_measurement', defaultMeasurement, ';', true); fillSelect(0, 'list_type', 'style_list_type', defaultListType, ';', true); fillSelect(0, 'list_position', 'style_list_position', "inside;outside", ';', true); fillSelect(0, 'positioning_type', 'style_positioning_type', "absolute;relative;static", ';', true); fillSelect(0, 'positioning_visibility', 'style_positioning_visibility', "inherit;visible;hidden", ';', true); fillSelect(0, 'positioning_width_measurement', 'style_positioning_width_measurement', defaultMeasurement, ';', true); fillSelect(0, 'positioning_height_measurement', 'style_positioning_height_measurement', defaultMeasurement, ';', true); fillSelect(0, 'positioning_overflow', 'style_positioning_overflow', "visible;hidden;scroll;auto", ';', true); fillSelect(0, 'positioning_placement_top_measurement', 'style_positioning_placement_top_measurement', defaultMeasurement, ';', true); fillSelect(0, 'positioning_placement_right_measurement', 'style_positioning_placement_right_measurement', defaultMeasurement, ';', true); fillSelect(0, 'positioning_placement_bottom_measurement', 'style_positioning_placement_bottom_measurement', defaultMeasurement, ';', true); fillSelect(0, 'positioning_placement_left_measurement', 'style_positioning_placement_left_measurement', defaultMeasurement, ';', true); fillSelect(0, 'positioning_clip_top_measurement', 'style_positioning_clip_top_measurement', defaultMeasurement, ';', true); fillSelect(0, 'positioning_clip_right_measurement', 'style_positioning_clip_right_measurement', defaultMeasurement, ';', true); fillSelect(0, 'positioning_clip_bottom_measurement', 'style_positioning_clip_bottom_measurement', defaultMeasurement, ';', true); fillSelect(0, 'positioning_clip_left_measurement', 'style_positioning_clip_left_measurement', defaultMeasurement, ';', true); TinyMCE_EditableSelects.init(); setupFormData(); showDisabledControls(); } function setupFormData() { var ce = document.getElementById('container'), f = document.forms[0], s, b, i; // Setup text fields selectByValue(f, 'text_font', ce.style.fontFamily, true, true); selectByValue(f, 'text_size', getNum(ce.style.fontSize), true, true); selectByValue(f, 'text_size_measurement', getMeasurement(ce.style.fontSize)); selectByValue(f, 'text_weight', ce.style.fontWeight, true, true); selectByValue(f, 'text_style', ce.style.fontStyle, true, true); selectByValue(f, 'text_lineheight', getNum(ce.style.lineHeight), true, true); selectByValue(f, 'text_lineheight_measurement', getMeasurement(ce.style.lineHeight)); selectByValue(f, 'text_case', ce.style.textTransform, true, true); selectByValue(f, 'text_variant', ce.style.fontVariant, true, true); f.text_color.value = tinyMCEPopup.editor.dom.toHex(ce.style.color); updateColor('text_color_pick', 'text_color'); f.text_underline.checked = inStr(ce.style.textDecoration, 'underline'); f.text_overline.checked = inStr(ce.style.textDecoration, 'overline'); f.text_linethrough.checked = inStr(ce.style.textDecoration, 'line-through'); f.text_blink.checked = inStr(ce.style.textDecoration, 'blink'); f.text_none.checked = inStr(ce.style.textDecoration, 'none'); updateTextDecorations(); // Setup background fields f.background_color.value = tinyMCEPopup.editor.dom.toHex(ce.style.backgroundColor); updateColor('background_color_pick', 'background_color'); f.background_image.value = ce.style.backgroundImage.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); selectByValue(f, 'background_repeat', ce.style.backgroundRepeat, true, true); selectByValue(f, 'background_attachment', ce.style.backgroundAttachment, true, true); selectByValue(f, 'background_hpos', getNum(getVal(ce.style.backgroundPosition, 0)), true, true); selectByValue(f, 'background_hpos_measurement', getMeasurement(getVal(ce.style.backgroundPosition, 0))); selectByValue(f, 'background_vpos', getNum(getVal(ce.style.backgroundPosition, 1)), true, true); selectByValue(f, 'background_vpos_measurement', getMeasurement(getVal(ce.style.backgroundPosition, 1))); // Setup block fields selectByValue(f, 'block_wordspacing', getNum(ce.style.wordSpacing), true, true); selectByValue(f, 'block_wordspacing_measurement', getMeasurement(ce.style.wordSpacing)); selectByValue(f, 'block_letterspacing', getNum(ce.style.letterSpacing), true, true); selectByValue(f, 'block_letterspacing_measurement', getMeasurement(ce.style.letterSpacing)); selectByValue(f, 'block_vertical_alignment', ce.style.verticalAlign, true, true); selectByValue(f, 'block_text_align', ce.style.textAlign, true, true); f.block_text_indent.value = getNum(ce.style.textIndent); selectByValue(f, 'block_text_indent_measurement', getMeasurement(ce.style.textIndent)); selectByValue(f, 'block_whitespace', ce.style.whiteSpace, true, true); selectByValue(f, 'block_display', ce.style.display, true, true); // Setup box fields f.box_width.value = getNum(ce.style.width); selectByValue(f, 'box_width_measurement', getMeasurement(ce.style.width)); f.box_height.value = getNum(ce.style.height); selectByValue(f, 'box_height_measurement', getMeasurement(ce.style.height)); selectByValue(f, 'box_float', ce.style.cssFloat || ce.style.styleFloat, true, true); selectByValue(f, 'box_clear', ce.style.clear, true, true); setupBox(f, ce, 'box_padding', 'padding', ''); setupBox(f, ce, 'box_margin', 'margin', ''); // Setup border fields setupBox(f, ce, 'border_style', 'border', 'Style'); setupBox(f, ce, 'border_width', 'border', 'Width'); setupBox(f, ce, 'border_color', 'border', 'Color'); updateColor('border_color_top_pick', 'border_color_top'); updateColor('border_color_right_pick', 'border_color_right'); updateColor('border_color_bottom_pick', 'border_color_bottom'); updateColor('border_color_left_pick', 'border_color_left'); f.elements.border_color_top.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_top.value); f.elements.border_color_right.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_right.value); f.elements.border_color_bottom.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_bottom.value); f.elements.border_color_left.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_left.value); // Setup list fields selectByValue(f, 'list_type', ce.style.listStyleType, true, true); selectByValue(f, 'list_position', ce.style.listStylePosition, true, true); f.list_bullet_image.value = ce.style.listStyleImage.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); // Setup box fields selectByValue(f, 'positioning_type', ce.style.position, true, true); selectByValue(f, 'positioning_visibility', ce.style.visibility, true, true); selectByValue(f, 'positioning_overflow', ce.style.overflow, true, true); f.positioning_zindex.value = ce.style.zIndex ? ce.style.zIndex : ""; f.positioning_width.value = getNum(ce.style.width); selectByValue(f, 'positioning_width_measurement', getMeasurement(ce.style.width)); f.positioning_height.value = getNum(ce.style.height); selectByValue(f, 'positioning_height_measurement', getMeasurement(ce.style.height)); setupBox(f, ce, 'positioning_placement', '', '', ['top', 'right', 'bottom', 'left']); s = ce.style.clip.replace(new RegExp("rect\\('?([^']*)'?\\)", 'gi'), "$1"); s = s.replace(/,/g, ' '); if (!hasEqualValues([getVal(s, 0), getVal(s, 1), getVal(s, 2), getVal(s, 3)])) { f.positioning_clip_top.value = getNum(getVal(s, 0)); selectByValue(f, 'positioning_clip_top_measurement', getMeasurement(getVal(s, 0))); f.positioning_clip_right.value = getNum(getVal(s, 1)); selectByValue(f, 'positioning_clip_right_measurement', getMeasurement(getVal(s, 1))); f.positioning_clip_bottom.value = getNum(getVal(s, 2)); selectByValue(f, 'positioning_clip_bottom_measurement', getMeasurement(getVal(s, 2))); f.positioning_clip_left.value = getNum(getVal(s, 3)); selectByValue(f, 'positioning_clip_left_measurement', getMeasurement(getVal(s, 3))); } else { f.positioning_clip_top.value = getNum(getVal(s, 0)); selectByValue(f, 'positioning_clip_top_measurement', getMeasurement(getVal(s, 0))); f.positioning_clip_right.value = f.positioning_clip_bottom.value = f.positioning_clip_left.value; } // setupBox(f, ce, '', 'border', 'Color'); } function getMeasurement(s) { return s.replace(/^([0-9.]+)(.*)$/, "$2"); } function getNum(s) { if (new RegExp('^(?:[0-9.]+)(?:[a-z%]+)$', 'gi').test(s)) return s.replace(/[^0-9.]/g, ''); return s; } function inStr(s, n) { return new RegExp(n, 'gi').test(s); } function getVal(s, i) { var a = s.split(' '); if (a.length > 1) return a[i]; return ""; } function setValue(f, n, v) { if (f.elements[n].type == "text") f.elements[n].value = v; else selectByValue(f, n, v, true, true); } function setupBox(f, ce, fp, pr, sf, b) { if (typeof(b) == "undefined") b = ['Top', 'Right', 'Bottom', 'Left']; if (isSame(ce, pr, sf, b)) { f.elements[fp + "_same"].checked = true; setValue(f, fp + "_top", getNum(ce.style[pr + b[0] + sf])); f.elements[fp + "_top"].disabled = false; f.elements[fp + "_right"].value = ""; f.elements[fp + "_right"].disabled = true; f.elements[fp + "_bottom"].value = ""; f.elements[fp + "_bottom"].disabled = true; f.elements[fp + "_left"].value = ""; f.elements[fp + "_left"].disabled = true; if (f.elements[fp + "_top_measurement"]) { selectByValue(f, fp + '_top_measurement', getMeasurement(ce.style[pr + b[0] + sf])); f.elements[fp + "_left_measurement"].disabled = true; f.elements[fp + "_bottom_measurement"].disabled = true; f.elements[fp + "_right_measurement"].disabled = true; } } else { f.elements[fp + "_same"].checked = false; setValue(f, fp + "_top", getNum(ce.style[pr + b[0] + sf])); f.elements[fp + "_top"].disabled = false; setValue(f, fp + "_right", getNum(ce.style[pr + b[1] + sf])); f.elements[fp + "_right"].disabled = false; setValue(f, fp + "_bottom", getNum(ce.style[pr + b[2] + sf])); f.elements[fp + "_bottom"].disabled = false; setValue(f, fp + "_left", getNum(ce.style[pr + b[3] + sf])); f.elements[fp + "_left"].disabled = false; if (f.elements[fp + "_top_measurement"]) { selectByValue(f, fp + '_top_measurement', getMeasurement(ce.style[pr + b[0] + sf])); selectByValue(f, fp + '_right_measurement', getMeasurement(ce.style[pr + b[1] + sf])); selectByValue(f, fp + '_bottom_measurement', getMeasurement(ce.style[pr + b[2] + sf])); selectByValue(f, fp + '_left_measurement', getMeasurement(ce.style[pr + b[3] + sf])); f.elements[fp + "_left_measurement"].disabled = false; f.elements[fp + "_bottom_measurement"].disabled = false; f.elements[fp + "_right_measurement"].disabled = false; } } } function isSame(e, pr, sf, b) { var a = [], i, x; if (typeof(b) == "undefined") b = ['Top', 'Right', 'Bottom', 'Left']; if (typeof(sf) == "undefined" || sf == null) sf = ""; a[0] = e.style[pr + b[0] + sf]; a[1] = e.style[pr + b[1] + sf]; a[2] = e.style[pr + b[2] + sf]; a[3] = e.style[pr + b[3] + sf]; for (i=0; i 0 ? s.substring(1) : s; if (f.text_none.checked) s = "none"; ce.style.textDecoration = s; // Build background styles ce.style.backgroundColor = f.background_color.value; ce.style.backgroundImage = f.background_image.value != "" ? "url(" + f.background_image.value + ")" : ""; ce.style.backgroundRepeat = f.background_repeat.value; ce.style.backgroundAttachment = f.background_attachment.value; if (f.background_hpos.value != "") { s = ""; s += f.background_hpos.value + (isNum(f.background_hpos.value) ? f.background_hpos_measurement.value : "") + " "; s += f.background_vpos.value + (isNum(f.background_vpos.value) ? f.background_vpos_measurement.value : ""); ce.style.backgroundPosition = s; } // Build block styles ce.style.wordSpacing = f.block_wordspacing.value + (isNum(f.block_wordspacing.value) ? f.block_wordspacing_measurement.value : ""); ce.style.letterSpacing = f.block_letterspacing.value + (isNum(f.block_letterspacing.value) ? f.block_letterspacing_measurement.value : ""); ce.style.verticalAlign = f.block_vertical_alignment.value; ce.style.textAlign = f.block_text_align.value; ce.style.textIndent = f.block_text_indent.value + (isNum(f.block_text_indent.value) ? f.block_text_indent_measurement.value : ""); ce.style.whiteSpace = f.block_whitespace.value; ce.style.display = f.block_display.value; // Build box styles ce.style.width = f.box_width.value + (isNum(f.box_width.value) ? f.box_width_measurement.value : ""); ce.style.height = f.box_height.value + (isNum(f.box_height.value) ? f.box_height_measurement.value : ""); ce.style.styleFloat = f.box_float.value; ce.style.cssFloat = f.box_float.value; ce.style.clear = f.box_clear.value; if (!f.box_padding_same.checked) { ce.style.paddingTop = f.box_padding_top.value + (isNum(f.box_padding_top.value) ? f.box_padding_top_measurement.value : ""); ce.style.paddingRight = f.box_padding_right.value + (isNum(f.box_padding_right.value) ? f.box_padding_right_measurement.value : ""); ce.style.paddingBottom = f.box_padding_bottom.value + (isNum(f.box_padding_bottom.value) ? f.box_padding_bottom_measurement.value : ""); ce.style.paddingLeft = f.box_padding_left.value + (isNum(f.box_padding_left.value) ? f.box_padding_left_measurement.value : ""); } else ce.style.padding = f.box_padding_top.value + (isNum(f.box_padding_top.value) ? f.box_padding_top_measurement.value : ""); if (!f.box_margin_same.checked) { ce.style.marginTop = f.box_margin_top.value + (isNum(f.box_margin_top.value) ? f.box_margin_top_measurement.value : ""); ce.style.marginRight = f.box_margin_right.value + (isNum(f.box_margin_right.value) ? f.box_margin_right_measurement.value : ""); ce.style.marginBottom = f.box_margin_bottom.value + (isNum(f.box_margin_bottom.value) ? f.box_margin_bottom_measurement.value : ""); ce.style.marginLeft = f.box_margin_left.value + (isNum(f.box_margin_left.value) ? f.box_margin_left_measurement.value : ""); } else ce.style.margin = f.box_margin_top.value + (isNum(f.box_margin_top.value) ? f.box_margin_top_measurement.value : ""); // Build border styles if (!f.border_style_same.checked) { ce.style.borderTopStyle = f.border_style_top.value; ce.style.borderRightStyle = f.border_style_right.value; ce.style.borderBottomStyle = f.border_style_bottom.value; ce.style.borderLeftStyle = f.border_style_left.value; } else ce.style.borderStyle = f.border_style_top.value; if (!f.border_width_same.checked) { ce.style.borderTopWidth = f.border_width_top.value + (isNum(f.border_width_top.value) ? f.border_width_top_measurement.value : ""); ce.style.borderRightWidth = f.border_width_right.value + (isNum(f.border_width_right.value) ? f.border_width_right_measurement.value : ""); ce.style.borderBottomWidth = f.border_width_bottom.value + (isNum(f.border_width_bottom.value) ? f.border_width_bottom_measurement.value : ""); ce.style.borderLeftWidth = f.border_width_left.value + (isNum(f.border_width_left.value) ? f.border_width_left_measurement.value : ""); } else ce.style.borderWidth = f.border_width_top.value + (isNum(f.border_width_top.value) ? f.border_width_top_measurement.value : ""); if (!f.border_color_same.checked) { ce.style.borderTopColor = f.border_color_top.value; ce.style.borderRightColor = f.border_color_right.value; ce.style.borderBottomColor = f.border_color_bottom.value; ce.style.borderLeftColor = f.border_color_left.value; } else ce.style.borderColor = f.border_color_top.value; // Build list styles ce.style.listStyleType = f.list_type.value; ce.style.listStylePosition = f.list_position.value; ce.style.listStyleImage = f.list_bullet_image.value != "" ? "url(" + f.list_bullet_image.value + ")" : ""; // Build positioning styles ce.style.position = f.positioning_type.value; ce.style.visibility = f.positioning_visibility.value; if (ce.style.width == "") ce.style.width = f.positioning_width.value + (isNum(f.positioning_width.value) ? f.positioning_width_measurement.value : ""); if (ce.style.height == "") ce.style.height = f.positioning_height.value + (isNum(f.positioning_height.value) ? f.positioning_height_measurement.value : ""); ce.style.zIndex = f.positioning_zindex.value; ce.style.overflow = f.positioning_overflow.value; if (!f.positioning_placement_same.checked) { ce.style.top = f.positioning_placement_top.value + (isNum(f.positioning_placement_top.value) ? f.positioning_placement_top_measurement.value : ""); ce.style.right = f.positioning_placement_right.value + (isNum(f.positioning_placement_right.value) ? f.positioning_placement_right_measurement.value : ""); ce.style.bottom = f.positioning_placement_bottom.value + (isNum(f.positioning_placement_bottom.value) ? f.positioning_placement_bottom_measurement.value : ""); ce.style.left = f.positioning_placement_left.value + (isNum(f.positioning_placement_left.value) ? f.positioning_placement_left_measurement.value : ""); } else { s = f.positioning_placement_top.value + (isNum(f.positioning_placement_top.value) ? f.positioning_placement_top_measurement.value : ""); ce.style.top = s; ce.style.right = s; ce.style.bottom = s; ce.style.left = s; } if (!f.positioning_clip_same.checked) { s = "rect("; s += (isNum(f.positioning_clip_top.value) ? f.positioning_clip_top.value + f.positioning_clip_top_measurement.value : "auto") + " "; s += (isNum(f.positioning_clip_right.value) ? f.positioning_clip_right.value + f.positioning_clip_right_measurement.value : "auto") + " "; s += (isNum(f.positioning_clip_bottom.value) ? f.positioning_clip_bottom.value + f.positioning_clip_bottom_measurement.value : "auto") + " "; s += (isNum(f.positioning_clip_left.value) ? f.positioning_clip_left.value + f.positioning_clip_left_measurement.value : "auto"); s += ")"; if (s != "rect(auto auto auto auto)") ce.style.clip = s; } else { s = "rect("; t = isNum(f.positioning_clip_top.value) ? f.positioning_clip_top.value + f.positioning_clip_top_measurement.value : "auto"; s += t + " "; s += t + " "; s += t + " "; s += t + ")"; if (s != "rect(auto auto auto auto)") ce.style.clip = s; } ce.style.cssText = ce.style.cssText; } function isNum(s) { return new RegExp('[0-9]+', 'g').test(s); } function showDisabledControls() { var f = document.forms, i, a; for (i=0; i 1) { addSelectValue(f, s, p[0], p[1]); if (se) selectByValue(f, s, p[1]); } else { addSelectValue(f, s, p[0], p[0]); if (se) selectByValue(f, s, p[0]); } } } function toggleSame(ce, pre) { var el = document.forms[0].elements, i; if (ce.checked) { el[pre + "_top"].disabled = false; el[pre + "_right"].disabled = true; el[pre + "_bottom"].disabled = true; el[pre + "_left"].disabled = true; if (el[pre + "_top_measurement"]) { el[pre + "_top_measurement"].disabled = false; el[pre + "_right_measurement"].disabled = true; el[pre + "_bottom_measurement"].disabled = true; el[pre + "_left_measurement"].disabled = true; } } else { el[pre + "_top"].disabled = false; el[pre + "_right"].disabled = false; el[pre + "_bottom"].disabled = false; el[pre + "_left"].disabled = false; if (el[pre + "_top_measurement"]) { el[pre + "_top_measurement"].disabled = false; el[pre + "_right_measurement"].disabled = false; el[pre + "_bottom_measurement"].disabled = false; el[pre + "_left_measurement"].disabled = false; } } showDisabledControls(); } function synch(fr, to) { var f = document.forms[0]; f.elements[to].value = f.elements[fr].value; if (f.elements[fr + "_measurement"]) selectByValue(f, to + "_measurement", f.elements[fr + "_measurement"].value); } function updateTextDecorations(){ var el = document.forms[0].elements; var textDecorations = ["text_underline", "text_overline", "text_linethrough", "text_blink"]; var noneChecked = el["text_none"].checked; tinymce.each(textDecorations, function(id) { el[id].disabled = noneChecked; if (noneChecked) { el[id].checked = false; } }); } tinyMCEPopup.onInit.add(init); ================================================ FILE: static/js/tinymce/plugins/style/langs/en_dlg.js ================================================ tinyMCE.addI18n('en.style_dlg',{"text_lineheight":"Line Height","text_variant":"Variant","text_style":"Style","text_weight":"Weight","text_size":"Size","text_font":"Font","text_props":"Text","positioning_tab":"Positioning","list_tab":"List","border_tab":"Border","box_tab":"Box","block_tab":"Block","background_tab":"Background","text_tab":"Text",apply:"Apply",toggle_insert_span:"Insert span at selection",title:"Edit CSS Style",clip:"Clip",placement:"Placement",overflow:"Overflow",zindex:"Z-index",visibility:"Visibility","positioning_type":"Type",position:"Position","bullet_image":"Bullet Image","list_type":"Type",color:"Color",height:"Height",width:"Width",style:"Style",margin:"Margin",left:"Left",bottom:"Bottom",right:"Right",top:"Top",same:"Same for All",padding:"Padding","box_clear":"Clear","box_float":"Float","box_height":"Height","box_width":"Width","block_display":"Display","block_whitespace":"Whitespace","block_text_indent":"Text Indent","block_text_align":"Text Align","block_vertical_alignment":"Vertical Alignment","block_letterspacing":"Letter Spacing","block_wordspacing":"Word Spacing","background_vpos":"Vertical Position","background_hpos":"Horizontal Position","background_attachment":"Attachment","background_repeat":"Repeat","background_image":"Background Image","background_color":"Background Color","text_none":"None","text_blink":"Blink","text_case":"Case","text_striketrough":"Strikethrough","text_underline":"Underline","text_overline":"Overline","text_decoration":"Decoration","text_color":"Color",text:"Text",background:"Background",block:"Block",box:"Box",border:"Border",list:"List"}); ================================================ FILE: static/js/tinymce/plugins/style/props.htm ================================================ {#style_dlg.title}
    {#style_dlg.text}
     
     
     
    {#style_dlg.text_decoration}
    {#style_dlg.background}
     
     
     
     
    {#style_dlg.block}
     
     
     
    {#style_dlg.box}
     
       
     
       
    {#style_dlg.padding}
     
     
     
     
     
    {#style_dlg.margin}
     
     
     
     
     

    {#style_dlg.border}
        {#style_dlg.style}   {#style_dlg.width}   {#style_dlg.color}
           
    {#style_dlg.top}    
     
     
     
    {#style_dlg.right}    
     
     
     
    {#style_dlg.bottom}    
     
     
     
    {#style_dlg.left}    
     
     
     
    {#style_dlg.list}
    {#style_dlg.position}
       
     
       
     
       
    {#style_dlg.placement}
     
    {#style_dlg.top}
     
    {#style_dlg.right}
     
    {#style_dlg.bottom}
     
    {#style_dlg.left}
     
    {#style_dlg.clip}
     
    {#style_dlg.top}
     
    {#style_dlg.right}
     
    {#style_dlg.bottom}
     
    {#style_dlg.left}
     

    ================================================ FILE: static/js/tinymce/plugins/style/readme.txt ================================================ Edit CSS Style plug-in notes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Unlike WYSIWYG editor functionality that operates only on the selected text, typically by inserting new HTML elements with the specified styles. This plug-in operates on the HTML blocks surrounding the selected text. No new HTML elements are created. This plug-in only operates on the surrounding blocks and not the nearest parent node. This means that if a block encapsulates a node, e.g

    text

    , then only the styles in the block are recognized, not those in the span. When selecting text that includes multiple blocks at the same level (peers), this plug-in accumulates the specified styles in all of the surrounding blocks and populates the dialogue checkboxes accordingly. There is no differentiation between styles set in all the blocks versus styles set in some of the blocks. When the [Update] or [Apply] buttons are pressed, the styles selected in the checkboxes are applied to all blocks that surround the selected text. ================================================ FILE: static/js/tinymce/plugins/tabfocus/editor_plugin.js ================================================ (function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.explode;tinymce.create("tinymce.plugins.TabFocusPlugin",{init:function(f,g){function e(i,j){if(j.keyCode===9){return a.cancel(j)}}function h(l,p){var j,m,o,n,k;function q(t){n=c.select(":input:enabled,*[tabindex]:not(iframe)");function s(v){return v.nodeName==="BODY"||(v.type!="hidden"&&!(v.style.display=="none")&&!(v.style.visibility=="hidden")&&s(v.parentNode))}function i(v){return v.attributes.tabIndex.specified||v.nodeName=="INPUT"||v.nodeName=="TEXTAREA"}function u(){return tinymce.isIE6||tinymce.isIE7}function r(v){return((!u()||i(v)))&&v.getAttribute("tabindex")!="-1"&&s(v)}d(n,function(w,v){if(w.id==l.id){j=v;return false}});if(t>0){for(m=j+1;m=0;m--){if(r(n[m])){return n[m]}}}return null}if(p.keyCode===9){k=b(l.getParam("tab_focus",l.getParam("tabfocus_elements",":prev,:next")));if(k.length==1){k[1]=k[0];k[0]=":prev"}if(p.shiftKey){if(k[0]==":prev"){n=q(-1)}else{n=c.get(k[0])}}else{if(k[1]==":next"){n=q(1)}else{n=c.get(k[1])}}if(n){if(n.id&&(l=tinymce.get(n.id||n.name))){l.focus()}else{window.setTimeout(function(){if(!tinymce.isWebKit){window.focus()}n.focus()},10)}return a.cancel(p)}}}f.onKeyUp.add(e);if(tinymce.isGecko){f.onKeyPress.add(h);f.onKeyDown.add(e)}else{f.onKeyDown.add(h)}},getInfo:function(){return{longname:"Tabfocus",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("tabfocus",tinymce.plugins.TabFocusPlugin)})(); ================================================ FILE: static/js/tinymce/plugins/tabfocus/editor_plugin_src.js ================================================ /** * editor_plugin_src.js * * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ (function() { var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, explode = tinymce.explode; tinymce.create('tinymce.plugins.TabFocusPlugin', { init : function(ed, url) { function tabCancel(ed, e) { if (e.keyCode === 9) return Event.cancel(e); } function tabHandler(ed, e) { var x, i, f, el, v; function find(d) { el = DOM.select(':input:enabled,*[tabindex]:not(iframe)'); function canSelectRecursive(e) { return e.nodeName==="BODY" || (e.type != 'hidden' && !(e.style.display == "none") && !(e.style.visibility == "hidden") && canSelectRecursive(e.parentNode)); } function canSelectInOldIe(el) { return el.attributes["tabIndex"].specified || el.nodeName == "INPUT" || el.nodeName == "TEXTAREA"; } function isOldIe() { return tinymce.isIE6 || tinymce.isIE7; } function canSelect(el) { return ((!isOldIe() || canSelectInOldIe(el))) && el.getAttribute("tabindex") != '-1' && canSelectRecursive(el); } each(el, function(e, i) { if (e.id == ed.id) { x = i; return false; } }); if (d > 0) { for (i = x + 1; i < el.length; i++) { if (canSelect(el[i])) return el[i]; } } else { for (i = x - 1; i >= 0; i--) { if (canSelect(el[i])) return el[i]; } } return null; } if (e.keyCode === 9) { v = explode(ed.getParam('tab_focus', ed.getParam('tabfocus_elements', ':prev,:next'))); if (v.length == 1) { v[1] = v[0]; v[0] = ':prev'; } // Find element to focus if (e.shiftKey) { if (v[0] == ':prev') el = find(-1); else el = DOM.get(v[0]); } else { if (v[1] == ':next') el = find(1); else el = DOM.get(v[1]); } if (el) { if (el.id && (ed = tinymce.get(el.id || el.name))) ed.focus(); else window.setTimeout(function() { if (!tinymce.isWebKit) window.focus(); el.focus(); }, 10); return Event.cancel(e); } } } ed.onKeyUp.add(tabCancel); if (tinymce.isGecko) { ed.onKeyPress.add(tabHandler); ed.onKeyDown.add(tabCancel); } else ed.onKeyDown.add(tabHandler); }, getInfo : function() { return { longname : 'Tabfocus', author : 'Moxiecode Systems AB', authorurl : 'http://tinymce.moxiecode.com', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus', version : tinymce.majorVersion + "." + tinymce.minorVersion }; } }); // Register plugin tinymce.PluginManager.add('tabfocus', tinymce.plugins.TabFocusPlugin); })(); ================================================ FILE: static/js/tinymce/plugins/table/cell.htm ================================================ {#table_dlg.cell_title}
    {#table_dlg.general_props}
    {#table_dlg.advanced_props}
     
     
     
    ================================================ FILE: static/js/tinymce/plugins/table/css/cell.css ================================================ /* CSS file for cell dialog in the table plugin */ .panel_wrapper div.current { height: 200px; } .advfield { width: 200px; } #action { margin-bottom: 3px; } #class { width: 150px; } ================================================ FILE: static/js/tinymce/plugins/table/css/row.css ================================================ /* CSS file for row dialog in the table plugin */ .panel_wrapper div.current { height: 200px; } .advfield { width: 200px; } #action { margin-bottom: 3px; } #rowtype,#align,#valign,#class,#height { width: 150px; } #height { width: 50px; } .col2 { padding-left: 20px; } ================================================ FILE: static/js/tinymce/plugins/table/css/table.css ================================================ /* CSS file for table dialog in the table plugin */ .panel_wrapper div.current { height: 245px; } .advfield { width: 200px; } #class { width: 150px; } ================================================ FILE: static/js/tinymce/plugins/table/editor_plugin.js ================================================ (function(d){var e=d.each;function c(g,h){var j=h.ownerDocument,f=j.createRange(),k;f.setStartBefore(h);f.setEnd(g.endContainer,g.endOffset);k=j.createElement("body");k.appendChild(f.cloneContents());return k.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length==0}function a(g,f){return parseInt(g.getAttribute(f)||1)}function b(H,G,K){var g,L,D,o;t();o=G.getParent(K.getStart(),"th,td");if(o){L=F(o);D=I();o=z(L.x,L.y)}function A(N,M){N=N.cloneNode(M);N.removeAttribute("id");return N}function t(){var M=0;g=[];e(["thead","tbody","tfoot"],function(N){var O=G.select("> "+N+" tr",H);e(O,function(P,Q){Q+=M;e(G.select("> td, > th",P),function(W,R){var S,T,U,V;if(g[Q]){while(g[Q][R]){R++}}U=a(W,"rowspan");V=a(W,"colspan");for(T=Q;T'}return false}},"childNodes");M=A(M,false);s(M,"rowSpan",1);s(M,"colSpan",1);if(N){M.appendChild(N)}else{if(!d.isIE){M.innerHTML='
    '}}return M}function q(){var M=G.createRng();e(G.select("tr",H),function(N){if(N.cells.length==0){G.remove(N)}});if(G.select("tr",H).length==0){M.setStartAfter(H);M.setEndAfter(H);K.setRng(M);G.remove(H);return}e(G.select("thead,tbody,tfoot",H),function(N){if(N.rows.length==0){G.remove(N)}});t();row=g[Math.min(g.length-1,L.y)];if(row){K.select(row[Math.min(row.length-1,L.x)].elm,true);K.collapse(true)}}function u(S,Q,U,R){var P,N,M,O,T;P=g[Q][S].elm.parentNode;for(M=1;M<=U;M++){P=G.getNext(P,"tr");if(P){for(N=S;N>=0;N--){T=g[Q+M][N].elm;if(T.parentNode==P){for(O=1;O<=R;O++){G.insertAfter(f(T),T)}break}}if(N==-1){for(O=1;O<=R;O++){P.insertBefore(f(P.cells[0]),P.cells[0])}}}}}function C(){e(g,function(M,N){e(M,function(P,O){var S,R,T,Q;if(j(P)){P=P.elm;S=a(P,"colspan");R=a(P,"rowspan");if(S>1||R>1){s(P,"rowSpan",1);s(P,"colSpan",1);for(Q=0;Q1){s(S,"rowSpan",O+1);continue}}else{if(M>0&&g[M-1][R]){V=g[M-1][R].elm;O=a(V,"rowSpan");if(O>1){s(V,"rowSpan",O+1);continue}}}N=f(S);s(N,"colSpan",S.colSpan);U.appendChild(N);P=S}}if(U.hasChildNodes()){if(!Q){G.insertAfter(U,T)}else{T.parentNode.insertBefore(U,T)}}}function h(N){var O,M;e(g,function(P,Q){e(P,function(S,R){if(j(S)){O=R;if(N){return false}}});if(N){return !O}});e(g,function(S,T){var P,Q,R;if(!S[O]){return}P=S[O].elm;if(P!=M){R=a(P,"colspan");Q=a(P,"rowspan");if(R==1){if(!N){G.insertAfter(f(P),P);u(O,T,Q-1,R)}else{P.parentNode.insertBefore(f(P),P);u(O,T,Q-1,R)}}else{s(P,"colSpan",P.colSpan+1)}M=P}})}function n(){var M=[];e(g,function(N,O){e(N,function(Q,P){if(j(Q)&&d.inArray(M,P)===-1){e(g,function(T){var R=T[P].elm,S;S=a(R,"colSpan");if(S>1){s(R,"colSpan",S-1)}else{G.remove(R)}});M.push(P)}})});q()}function m(){var N;function M(Q){var P,R,O;P=G.getNext(Q,"tr");e(Q.cells,function(S){var T=a(S,"rowSpan");if(T>1){s(S,"rowSpan",T-1);R=F(S);u(R.x,R.y,1,1)}});R=F(Q.cells[0]);e(g[R.y],function(S){var T;S=S.elm;if(S!=O){T=a(S,"rowSpan");if(T<=1){G.remove(S)}else{s(S,"rowSpan",T-1)}O=S}})}N=k();e(N.reverse(),function(O){M(O)});q()}function E(){var M=k();G.remove(M);q();return M}function J(){var M=k();e(M,function(O,N){M[N]=A(O,true)});return M}function B(O,N){if(!O){return}var P=k(),M=P[N?0:P.length-1],Q=M.cells.length;e(g,function(S){var R;Q=0;e(S,function(U,T){if(U.real){Q+=U.colspan}if(U.elm.parentNode==M){R=1}});if(R){return false}});if(!N){O.reverse()}e(O,function(T){var S=T.cells.length,R;for(i=0;iN){N=R}if(Q>M){M=Q}if(S.real){U=S.colspan-1;T=S.rowspan-1;if(U){if(R+U>N){N=R+U}}if(T){if(Q+T>M){M=Q+T}}}}})});return{x:N,y:M}}function v(S){var P,O,U,T,N,M,Q,R;D=F(S);if(L&&D){P=Math.min(L.x,D.x);O=Math.min(L.y,D.y);U=Math.max(L.x,D.x);T=Math.max(L.y,D.y);N=U;M=T;for(y=O;y<=M;y++){S=g[y][P];if(!S.real){if(P-(S.colspan-1)N){N=x+Q}}if(R){if(y+R>M){M=y+R}}}}}G.removeClass(G.select("td.mceSelected,th.mceSelected"),"mceSelected");for(y=O;y<=M;y++){for(x=P;x<=N;x++){if(g[y][x]){G.addClass(g[y][x].elm,"mceSelected")}}}}}d.extend(this,{deleteTable:r,split:C,merge:p,insertRow:l,insertCol:h,deleteCols:n,deleteRows:m,cutRows:E,copyRows:J,pasteRows:B,getPos:F,setStartCell:w,setEndCell:v})}d.create("tinymce.plugins.TablePlugin",{init:function(g,h){var f,m,j=true;function l(p){var o=g.selection,n=g.dom.getParent(p||o.getNode(),"table");if(n){return new b(n,g.dom,o)}}function k(){g.getBody().style.webkitUserSelect="";if(j){g.dom.removeClass(g.dom.select("td.mceSelected,th.mceSelected"),"mceSelected");j=false}}e([["table","table.desc","mceInsertTable",true],["delete_table","table.del","mceTableDelete"],["delete_col","table.delete_col_desc","mceTableDeleteCol"],["delete_row","table.delete_row_desc","mceTableDeleteRow"],["col_after","table.col_after_desc","mceTableInsertColAfter"],["col_before","table.col_before_desc","mceTableInsertColBefore"],["row_after","table.row_after_desc","mceTableInsertRowAfter"],["row_before","table.row_before_desc","mceTableInsertRowBefore"],["row_props","table.row_desc","mceTableRowProps",true],["cell_props","table.cell_desc","mceTableCellProps",true],["split_cells","table.split_cells_desc","mceTableSplitCells",true],["merge_cells","table.merge_cells_desc","mceTableMergeCells",true]],function(n){g.addButton(n[0],{title:n[1],cmd:n[2],ui:n[3]})});if(!d.isIE){g.onClick.add(function(n,o){o=o.target;if(o.nodeName==="TABLE"){n.selection.select(o);n.nodeChanged()}})}g.onPreProcess.add(function(o,p){var n,q,r,t=o.dom,s;n=t.select("table",p.node);q=n.length;while(q--){r=n[q];t.setAttrib(r,"data-mce-style","");if((s=t.getAttrib(r,"width"))){t.setStyle(r,"width",s);t.setAttrib(r,"width","")}if((s=t.getAttrib(r,"height"))){t.setStyle(r,"height",s);t.setAttrib(r,"height","")}}});g.onNodeChange.add(function(q,o,s){var r;s=q.selection.getStart();r=q.dom.getParent(s,"td,th,caption");o.setActive("table",s.nodeName==="TABLE"||!!r);if(r&&r.nodeName==="CAPTION"){r=0}o.setDisabled("delete_table",!r);o.setDisabled("delete_col",!r);o.setDisabled("delete_table",!r);o.setDisabled("delete_row",!r);o.setDisabled("col_after",!r);o.setDisabled("col_before",!r);o.setDisabled("row_after",!r);o.setDisabled("row_before",!r);o.setDisabled("row_props",!r);o.setDisabled("cell_props",!r);o.setDisabled("split_cells",!r);o.setDisabled("merge_cells",!r)});g.onInit.add(function(r){var p,t,q=r.dom,u;f=r.windowManager;r.onMouseDown.add(function(w,z){if(z.button!=2){k();t=q.getParent(z.target,"td,th");p=q.getParent(t,"table")}});q.bind(r.getDoc(),"mouseover",function(C){var A,z,B=C.target;if(t&&(u||B!=t)&&(B.nodeName=="TD"||B.nodeName=="TH")){z=q.getParent(B,"table");if(z==p){if(!u){u=l(z);u.setStartCell(t);r.getBody().style.webkitUserSelect="none"}u.setEndCell(B);j=true}A=r.selection.getSel();try{if(A.removeAllRanges){A.removeAllRanges()}else{A.empty()}}catch(w){}C.preventDefault()}});r.onMouseUp.add(function(F,G){var z,B=F.selection,H,I=B.getSel(),w,C,A,E;if(t){if(u){F.getBody().style.webkitUserSelect=""}function D(J,L){var K=new d.dom.TreeWalker(J,J);do{if(J.nodeType==3&&d.trim(J.nodeValue).length!=0){if(L){z.setStart(J,0)}else{z.setEnd(J,J.nodeValue.length)}return}if(J.nodeName=="BR"){if(L){z.setStartBefore(J)}else{z.setEndBefore(J)}return}}while(J=(L?K.next():K.prev()))}H=q.select("td.mceSelected,th.mceSelected");if(H.length>0){z=q.createRng();C=H[0];E=H[H.length-1];z.setStartBefore(C);z.setEndAfter(C);D(C,1);w=new d.dom.TreeWalker(C,q.getParent(H[0],"table"));do{if(C.nodeName=="TD"||C.nodeName=="TH"){if(!q.hasClass(C,"mceSelected")){break}A=C}}while(C=w.next());D(A);B.setRng(z)}F.nodeChanged();t=u=p=null}});r.onKeyUp.add(function(w,z){k()});r.onKeyDown.add(function(w,z){n(w)});r.onMouseDown.add(function(w,z){if(z.button!=2){n(w)}});function o(D,z,A,F){var B=3,G=D.dom.getParent(z.startContainer,"TABLE"),C,w,E;if(G){C=G.parentNode}w=z.startContainer.nodeType==B&&z.startOffset==0&&z.endOffset==0&&F&&(A.nodeName=="TR"||A==C);E=(A.nodeName=="TD"||A.nodeName=="TH")&&!F;return w||E}function n(A){if(!d.isWebKit){return}var z=A.selection.getRng();var C=A.selection.getNode();var B=A.dom.getParent(z.startContainer,"TD,TH");if(!o(A,z,C,B)){return}if(!B){B=C}var w=B.lastChild;while(w.lastChild){w=w.lastChild}z.setEnd(w,w.nodeValue.length);A.selection.setRng(z)}r.plugins.table.fixTableCellSelection=n;if(r&&r.plugins.contextmenu){r.plugins.contextmenu.onContextMenu.add(function(A,w,C){var D,B=r.selection,z=B.getNode()||r.getBody();if(r.dom.getParent(C,"td")||r.dom.getParent(C,"th")||r.dom.select("td.mceSelected,th.mceSelected").length){w.removeAll();if(z.nodeName=="A"&&!r.dom.getAttrib(z,"name")){w.add({title:"advanced.link_desc",icon:"link",cmd:r.plugins.advlink?"mceAdvLink":"mceLink",ui:true});w.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});w.addSeparator()}if(z.nodeName=="IMG"&&z.className.indexOf("mceItem")==-1){w.add({title:"advanced.image_desc",icon:"image",cmd:r.plugins.advimage?"mceAdvImage":"mceImage",ui:true});w.addSeparator()}w.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",value:{action:"insert"}});w.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable"});w.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete"});w.addSeparator();D=w.addMenu({title:"table.cell"});D.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps"});D.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells"});D.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells"});D=w.addMenu({title:"table.row"});D.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps"});D.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});D.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});D.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});D.addSeparator();D.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});D.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});D.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"}).setDisabled(!m);D.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"}).setDisabled(!m);D=w.addMenu({title:"table.col"});D.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});D.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});D.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{w.add({title:"table.desc",icon:"table",cmd:"mceInsertTable"})}})}if(d.isWebKit){function v(C,N){var L=d.VK;var Q=N.keyCode;function O(Y,U,S){var T=Y?"previousSibling":"nextSibling";var Z=C.dom.getParent(U,"tr");var X=Z[T];if(X){z(C,U,X,Y);d.dom.Event.cancel(S);return true}else{var aa=C.dom.getParent(Z,"table");var W=Z.parentNode;var R=W.nodeName.toLowerCase();if(R==="tbody"||R===(Y?"tfoot":"thead")){var V=w(Y,aa,W,"tbody");if(V!==null){return K(Y,V,U,S)}}return M(Y,Z,T,aa,S)}}function w(V,T,U,X){var S=C.dom.select(">"+X,T);var R=S.indexOf(U);if(V&&R===0||!V&&R===S.length-1){return B(V,T)}else{if(R===-1){var W=U.tagName.toLowerCase()==="thead"?0:S.length-1;return S[W]}else{return S[R+(V?-1:1)]}}}function B(U,T){var S=U?"thead":"tfoot";var R=C.dom.select(">"+S,T);return R.length!==0?R[0]:null}function K(V,T,S,U){var R=J(T,V);R&&z(C,S,R,V);d.dom.Event.cancel(U);return true}function M(Y,U,R,X,W){var S=X[R];if(S){F(S);return true}else{var V=C.dom.getParent(X,"td,th");if(V){return O(Y,V,W)}else{var T=J(U,!Y);F(T);return d.dom.Event.cancel(W)}}}function J(S,R){var T=S&&S[R?"lastChild":"firstChild"];return T&&T.nodeName==="BR"?C.dom.getParent(T,"td,th"):T}function F(R){C.selection.setCursorLocation(R,0)}function A(){return Q==L.UP||Q==L.DOWN}function D(R){var T=R.selection.getNode();var S=R.dom.getParent(T,"tr");return S!==null}function P(S){var R=0;var T=S;while(T.previousSibling){T=T.previousSibling;R=R+a(T,"colspan")}return R}function E(T,R){var U=0;var S=0;e(T.children,function(V,W){U=U+a(V,"colspan");S=W;if(U>R){return false}});return S}function z(T,W,Y,V){var X=P(T.dom.getParent(W,"td,th"));var S=E(Y,X);var R=Y.childNodes[S];var U=J(R,V);F(U||R)}function H(R){var T=C.selection.getNode();var U=C.dom.getParent(T,"td,th");var S=C.dom.getParent(R,"td,th");return U&&U!==S&&I(U,S)}function I(S,R){return C.dom.getParent(S,"TABLE")===C.dom.getParent(R,"TABLE")}if(A()&&D(C)){var G=C.selection.getNode();setTimeout(function(){if(H(G)){O(!N.shiftKey&&Q===L.UP,G,N)}},0)}}r.onKeyDown.add(v)}function s(){var w;for(w=r.getBody().lastChild;w&&w.nodeType==3&&!w.nodeValue.length;w=w.previousSibling){}if(w&&w.nodeName=="TABLE"){if(r.settings.forced_root_block){r.dom.add(r.getBody(),r.settings.forced_root_block,null,d.isIE?" ":'
    ')}else{r.dom.add(r.getBody(),"br",{"data-mce-bogus":"1"})}}}if(d.isGecko){r.onKeyDown.add(function(z,B){var w,A,C=z.dom;if(B.keyCode==37||B.keyCode==38){w=z.selection.getRng();A=C.getParent(w.startContainer,"table");if(A&&z.getBody().firstChild==A){if(c(w,A)){w=C.createRng();w.setStartBefore(A);w.setEndBefore(A);z.selection.setRng(w);B.preventDefault()}}}})}r.onKeyUp.add(s);r.onSetContent.add(s);r.onVisualAid.add(s);r.onPreProcess.add(function(w,A){var z=A.node.lastChild;if(z&&(z.nodeName=="BR"||(z.childNodes.length==1&&(z.firstChild.nodeName=="BR"||z.firstChild.nodeValue=="\u00a0")))&&z.previousSibling&&z.previousSibling.nodeName=="TABLE"){w.dom.remove(z)}});s();r.startContent=r.getContent({format:"raw"})});e({mceTableSplitCells:function(n){n.split()},mceTableMergeCells:function(o){var p,q,n;n=g.dom.getParent(g.selection.getNode(),"th,td");if(n){p=n.rowSpan;q=n.colSpan}if(!g.dom.select("td.mceSelected,th.mceSelected").length){f.open({url:h+"/merge_cells.htm",width:240+parseInt(g.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(g.getLang("table.merge_cells_delta_height",0)),inline:1},{rows:p,cols:q,onaction:function(r){o.merge(n,r.cols,r.rows)},plugin_url:h})}else{o.merge()}},mceTableInsertRowBefore:function(n){n.insertRow(true)},mceTableInsertRowAfter:function(n){n.insertRow()},mceTableInsertColBefore:function(n){n.insertCol(true)},mceTableInsertColAfter:function(n){n.insertCol()},mceTableDeleteCol:function(n){n.deleteCols()},mceTableDeleteRow:function(n){n.deleteRows()},mceTableCutRow:function(n){m=n.cutRows()},mceTableCopyRow:function(n){m=n.copyRows()},mceTablePasteRowBefore:function(n){n.pasteRows(m,true)},mceTablePasteRowAfter:function(n){n.pasteRows(m)},mceTableDelete:function(n){n.deleteTable()}},function(o,n){g.addCommand(n,function(){var p=l();if(p){o(p);g.execCommand("mceRepaint");k()}})});e({mceInsertTable:function(n){f.open({url:h+"/table.htm",width:400+parseInt(g.getLang("table.table_delta_width",0)),height:320+parseInt(g.getLang("table.table_delta_height",0)),inline:1},{plugin_url:h,action:n?n.action:0})},mceTableRowProps:function(){f.open({url:h+"/row.htm",width:400+parseInt(g.getLang("table.rowprops_delta_width",0)),height:295+parseInt(g.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:h})},mceTableCellProps:function(){f.open({url:h+"/cell.htm",width:400+parseInt(g.getLang("table.cellprops_delta_width",0)),height:295+parseInt(g.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:h})}},function(o,n){g.addCommand(n,function(p,q){o(q)})})}});d.PluginManager.add("table",d.plugins.TablePlugin)})(tinymce); ================================================ FILE: static/js/tinymce/plugins/table/editor_plugin_src.js ================================================ /** * editor_plugin_src.js * * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ (function(tinymce) { var each = tinymce.each; // Checks if the selection/caret is at the start of the specified block element function isAtStart(rng, par) { var doc = par.ownerDocument, rng2 = doc.createRange(), elm; rng2.setStartBefore(par); rng2.setEnd(rng.endContainer, rng.endOffset); elm = doc.createElement('body'); elm.appendChild(rng2.cloneContents()); // Check for text characters of other elements that should be treated as content return elm.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi, '-').replace(/<[^>]+>/g, '').length == 0; }; function getSpanVal(td, name) { return parseInt(td.getAttribute(name) || 1); } /** * Table Grid class. */ function TableGrid(table, dom, selection) { var grid, startPos, endPos, selectedCell; buildGrid(); selectedCell = dom.getParent(selection.getStart(), 'th,td'); if (selectedCell) { startPos = getPos(selectedCell); endPos = findEndPos(); selectedCell = getCell(startPos.x, startPos.y); } function cloneNode(node, children) { node = node.cloneNode(children); node.removeAttribute('id'); return node; } function buildGrid() { var startY = 0; grid = []; each(['thead', 'tbody', 'tfoot'], function(part) { var rows = dom.select('> ' + part + ' tr', table); each(rows, function(tr, y) { y += startY; each(dom.select('> td, > th', tr), function(td, x) { var x2, y2, rowspan, colspan; // Skip over existing cells produced by rowspan if (grid[y]) { while (grid[y][x]) x++; } // Get col/rowspan from cell rowspan = getSpanVal(td, 'rowspan'); colspan = getSpanVal(td, 'colspan'); // Fill out rowspan/colspan right and down for (y2 = y; y2 < y + rowspan; y2++) { if (!grid[y2]) grid[y2] = []; for (x2 = x; x2 < x + colspan; x2++) { grid[y2][x2] = { part : part, real : y2 == y && x2 == x, elm : td, rowspan : rowspan, colspan : colspan }; } } }); }); startY += rows.length; }); }; function getCell(x, y) { var row; row = grid[y]; if (row) return row[x]; }; function setSpanVal(td, name, val) { if (td) { val = parseInt(val); if (val === 1) td.removeAttribute(name, 1); else td.setAttribute(name, val, 1); } } function isCellSelected(cell) { return cell && (dom.hasClass(cell.elm, 'mceSelected') || cell == selectedCell); }; function getSelectedRows() { var rows = []; each(table.rows, function(row) { each(row.cells, function(cell) { if (dom.hasClass(cell, 'mceSelected') || cell == selectedCell.elm) { rows.push(row); return false; } }); }); return rows; }; function deleteTable() { var rng = dom.createRng(); rng.setStartAfter(table); rng.setEndAfter(table); selection.setRng(rng); dom.remove(table); }; function cloneCell(cell) { var formatNode; // Clone formats tinymce.walk(cell, function(node) { var curNode; if (node.nodeType == 3) { each(dom.getParents(node.parentNode, null, cell).reverse(), function(node) { node = cloneNode(node, false); if (!formatNode) formatNode = curNode = node; else if (curNode) curNode.appendChild(node); curNode = node; }); // Add something to the inner node if (curNode) curNode.innerHTML = tinymce.isIE ? ' ' : '
    '; return false; } }, 'childNodes'); cell = cloneNode(cell, false); setSpanVal(cell, 'rowSpan', 1); setSpanVal(cell, 'colSpan', 1); if (formatNode) { cell.appendChild(formatNode); } else { if (!tinymce.isIE) cell.innerHTML = '
    '; } return cell; }; function cleanup() { var rng = dom.createRng(); // Empty rows each(dom.select('tr', table), function(tr) { if (tr.cells.length == 0) dom.remove(tr); }); // Empty table if (dom.select('tr', table).length == 0) { rng.setStartAfter(table); rng.setEndAfter(table); selection.setRng(rng); dom.remove(table); return; } // Empty header/body/footer each(dom.select('thead,tbody,tfoot', table), function(part) { if (part.rows.length == 0) dom.remove(part); }); // Restore selection to start position if it still exists buildGrid(); // Restore the selection to the closest table position row = grid[Math.min(grid.length - 1, startPos.y)]; if (row) { selection.select(row[Math.min(row.length - 1, startPos.x)].elm, true); selection.collapse(true); } }; function fillLeftDown(x, y, rows, cols) { var tr, x2, r, c, cell; tr = grid[y][x].elm.parentNode; for (r = 1; r <= rows; r++) { tr = dom.getNext(tr, 'tr'); if (tr) { // Loop left to find real cell for (x2 = x; x2 >= 0; x2--) { cell = grid[y + r][x2].elm; if (cell.parentNode == tr) { // Append clones after for (c = 1; c <= cols; c++) dom.insertAfter(cloneCell(cell), cell); break; } } if (x2 == -1) { // Insert nodes before first cell for (c = 1; c <= cols; c++) tr.insertBefore(cloneCell(tr.cells[0]), tr.cells[0]); } } } }; function split() { each(grid, function(row, y) { each(row, function(cell, x) { var colSpan, rowSpan, newCell, i; if (isCellSelected(cell)) { cell = cell.elm; colSpan = getSpanVal(cell, 'colspan'); rowSpan = getSpanVal(cell, 'rowspan'); if (colSpan > 1 || rowSpan > 1) { setSpanVal(cell, 'rowSpan', 1); setSpanVal(cell, 'colSpan', 1); // Insert cells right for (i = 0; i < colSpan - 1; i++) dom.insertAfter(cloneCell(cell), cell); fillLeftDown(x, y, rowSpan - 1, colSpan); } } }); }); }; function merge(cell, cols, rows) { var startX, startY, endX, endY, x, y, startCell, endCell, cell, children, count; // Use specified cell and cols/rows if (cell) { pos = getPos(cell); startX = pos.x; startY = pos.y; endX = startX + (cols - 1); endY = startY + (rows - 1); } else { startPos = endPos = null; // Calculate start/end pos by checking for selected cells in grid works better with context menu each(grid, function(row, y) { each(row, function(cell, x) { if (isCellSelected(cell)) { if (!startPos) { startPos = {x: x, y: y}; } endPos = {x: x, y: y}; } }); }); // Use selection startX = startPos.x; startY = startPos.y; endX = endPos.x; endY = endPos.y; } // Find start/end cells startCell = getCell(startX, startY); endCell = getCell(endX, endY); // Check if the cells exists and if they are of the same part for example tbody = tbody if (startCell && endCell && startCell.part == endCell.part) { // Split and rebuild grid split(); buildGrid(); // Set row/col span to start cell startCell = getCell(startX, startY).elm; setSpanVal(startCell, 'colSpan', (endX - startX) + 1); setSpanVal(startCell, 'rowSpan', (endY - startY) + 1); // Remove other cells and add it's contents to the start cell for (y = startY; y <= endY; y++) { for (x = startX; x <= endX; x++) { if (!grid[y] || !grid[y][x]) continue; cell = grid[y][x].elm; if (cell != startCell) { // Move children to startCell children = tinymce.grep(cell.childNodes); each(children, function(node) { startCell.appendChild(node); }); // Remove bogus nodes if there is children in the target cell if (children.length) { children = tinymce.grep(startCell.childNodes); count = 0; each(children, function(node) { if (node.nodeName == 'BR' && dom.getAttrib(node, 'data-mce-bogus') && count++ < children.length - 1) startCell.removeChild(node); }); } // Remove cell dom.remove(cell); } } } // Remove empty rows etc and restore caret location cleanup(); } }; function insertRow(before) { var posY, cell, lastCell, x, rowElm, newRow, newCell, otherCell, rowSpan; // Find first/last row each(grid, function(row, y) { each(row, function(cell, x) { if (isCellSelected(cell)) { cell = cell.elm; rowElm = cell.parentNode; newRow = cloneNode(rowElm, false); posY = y; if (before) return false; } }); if (before) return !posY; }); for (x = 0; x < grid[0].length; x++) { // Cell not found could be because of an invalid table structure if (!grid[posY][x]) continue; cell = grid[posY][x].elm; if (cell != lastCell) { if (!before) { rowSpan = getSpanVal(cell, 'rowspan'); if (rowSpan > 1) { setSpanVal(cell, 'rowSpan', rowSpan + 1); continue; } } else { // Check if cell above can be expanded if (posY > 0 && grid[posY - 1][x]) { otherCell = grid[posY - 1][x].elm; rowSpan = getSpanVal(otherCell, 'rowSpan'); if (rowSpan > 1) { setSpanVal(otherCell, 'rowSpan', rowSpan + 1); continue; } } } // Insert new cell into new row newCell = cloneCell(cell); setSpanVal(newCell, 'colSpan', cell.colSpan); newRow.appendChild(newCell); lastCell = cell; } } if (newRow.hasChildNodes()) { if (!before) dom.insertAfter(newRow, rowElm); else rowElm.parentNode.insertBefore(newRow, rowElm); } }; function insertCol(before) { var posX, lastCell; // Find first/last column each(grid, function(row, y) { each(row, function(cell, x) { if (isCellSelected(cell)) { posX = x; if (before) return false; } }); if (before) return !posX; }); each(grid, function(row, y) { var cell, rowSpan, colSpan; if (!row[posX]) return; cell = row[posX].elm; if (cell != lastCell) { colSpan = getSpanVal(cell, 'colspan'); rowSpan = getSpanVal(cell, 'rowspan'); if (colSpan == 1) { if (!before) { dom.insertAfter(cloneCell(cell), cell); fillLeftDown(posX, y, rowSpan - 1, colSpan); } else { cell.parentNode.insertBefore(cloneCell(cell), cell); fillLeftDown(posX, y, rowSpan - 1, colSpan); } } else setSpanVal(cell, 'colSpan', cell.colSpan + 1); lastCell = cell; } }); }; function deleteCols() { var cols = []; // Get selected column indexes each(grid, function(row, y) { each(row, function(cell, x) { if (isCellSelected(cell) && tinymce.inArray(cols, x) === -1) { each(grid, function(row) { var cell = row[x].elm, colSpan; colSpan = getSpanVal(cell, 'colSpan'); if (colSpan > 1) setSpanVal(cell, 'colSpan', colSpan - 1); else dom.remove(cell); }); cols.push(x); } }); }); cleanup(); }; function deleteRows() { var rows; function deleteRow(tr) { var nextTr, pos, lastCell; nextTr = dom.getNext(tr, 'tr'); // Move down row spanned cells each(tr.cells, function(cell) { var rowSpan = getSpanVal(cell, 'rowSpan'); if (rowSpan > 1) { setSpanVal(cell, 'rowSpan', rowSpan - 1); pos = getPos(cell); fillLeftDown(pos.x, pos.y, 1, 1); } }); // Delete cells pos = getPos(tr.cells[0]); each(grid[pos.y], function(cell) { var rowSpan; cell = cell.elm; if (cell != lastCell) { rowSpan = getSpanVal(cell, 'rowSpan'); if (rowSpan <= 1) dom.remove(cell); else setSpanVal(cell, 'rowSpan', rowSpan - 1); lastCell = cell; } }); }; // Get selected rows and move selection out of scope rows = getSelectedRows(); // Delete all selected rows each(rows.reverse(), function(tr) { deleteRow(tr); }); cleanup(); }; function cutRows() { var rows = getSelectedRows(); dom.remove(rows); cleanup(); return rows; }; function copyRows() { var rows = getSelectedRows(); each(rows, function(row, i) { rows[i] = cloneNode(row, true); }); return rows; }; function pasteRows(rows, before) { // If we don't have any rows in the clipboard, return immediately if(!rows) return; var selectedRows = getSelectedRows(), targetRow = selectedRows[before ? 0 : selectedRows.length - 1], targetCellCount = targetRow.cells.length; // Calc target cell count each(grid, function(row) { var match; targetCellCount = 0; each(row, function(cell, x) { if (cell.real) targetCellCount += cell.colspan; if (cell.elm.parentNode == targetRow) match = 1; }); if (match) return false; }); if (!before) rows.reverse(); each(rows, function(row) { var cellCount = row.cells.length, cell; // Remove col/rowspans for (i = 0; i < cellCount; i++) { cell = row.cells[i]; setSpanVal(cell, 'colSpan', 1); setSpanVal(cell, 'rowSpan', 1); } // Needs more cells for (i = cellCount; i < targetCellCount; i++) row.appendChild(cloneCell(row.cells[cellCount - 1])); // Needs less cells for (i = targetCellCount; i < cellCount; i++) dom.remove(row.cells[i]); // Add before/after if (before) targetRow.parentNode.insertBefore(row, targetRow); else dom.insertAfter(row, targetRow); }); // Remove current selection dom.removeClass(dom.select('td.mceSelected,th.mceSelected'), 'mceSelected'); }; function getPos(target) { var pos; each(grid, function(row, y) { each(row, function(cell, x) { if (cell.elm == target) { pos = {x : x, y : y}; return false; } }); return !pos; }); return pos; }; function setStartCell(cell) { startPos = getPos(cell); }; function findEndPos() { var pos, maxX, maxY; maxX = maxY = 0; each(grid, function(row, y) { each(row, function(cell, x) { var colSpan, rowSpan; if (isCellSelected(cell)) { cell = grid[y][x]; if (x > maxX) maxX = x; if (y > maxY) maxY = y; if (cell.real) { colSpan = cell.colspan - 1; rowSpan = cell.rowspan - 1; if (colSpan) { if (x + colSpan > maxX) maxX = x + colSpan; } if (rowSpan) { if (y + rowSpan > maxY) maxY = y + rowSpan; } } } }); }); return {x : maxX, y : maxY}; }; function setEndCell(cell) { var startX, startY, endX, endY, maxX, maxY, colSpan, rowSpan; endPos = getPos(cell); if (startPos && endPos) { // Get start/end positions startX = Math.min(startPos.x, endPos.x); startY = Math.min(startPos.y, endPos.y); endX = Math.max(startPos.x, endPos.x); endY = Math.max(startPos.y, endPos.y); // Expand end positon to include spans maxX = endX; maxY = endY; // Expand startX for (y = startY; y <= maxY; y++) { cell = grid[y][startX]; if (!cell.real) { if (startX - (cell.colspan - 1) < startX) startX -= cell.colspan - 1; } } // Expand startY for (x = startX; x <= maxX; x++) { cell = grid[startY][x]; if (!cell.real) { if (startY - (cell.rowspan - 1) < startY) startY -= cell.rowspan - 1; } } // Find max X, Y for (y = startY; y <= endY; y++) { for (x = startX; x <= endX; x++) { cell = grid[y][x]; if (cell.real) { colSpan = cell.colspan - 1; rowSpan = cell.rowspan - 1; if (colSpan) { if (x + colSpan > maxX) maxX = x + colSpan; } if (rowSpan) { if (y + rowSpan > maxY) maxY = y + rowSpan; } } } } // Remove current selection dom.removeClass(dom.select('td.mceSelected,th.mceSelected'), 'mceSelected'); // Add new selection for (y = startY; y <= maxY; y++) { for (x = startX; x <= maxX; x++) { if (grid[y][x]) dom.addClass(grid[y][x].elm, 'mceSelected'); } } } }; // Expose to public tinymce.extend(this, { deleteTable : deleteTable, split : split, merge : merge, insertRow : insertRow, insertCol : insertCol, deleteCols : deleteCols, deleteRows : deleteRows, cutRows : cutRows, copyRows : copyRows, pasteRows : pasteRows, getPos : getPos, setStartCell : setStartCell, setEndCell : setEndCell }); }; tinymce.create('tinymce.plugins.TablePlugin', { init : function(ed, url) { var winMan, clipboardRows, hasCellSelection = true; // Might be selected cells on reload function createTableGrid(node) { var selection = ed.selection, tblElm = ed.dom.getParent(node || selection.getNode(), 'table'); if (tblElm) return new TableGrid(tblElm, ed.dom, selection); }; function cleanup() { // Restore selection possibilities ed.getBody().style.webkitUserSelect = ''; if (hasCellSelection) { ed.dom.removeClass(ed.dom.select('td.mceSelected,th.mceSelected'), 'mceSelected'); hasCellSelection = false; } }; // Register buttons each([ ['table', 'table.desc', 'mceInsertTable', true], ['delete_table', 'table.del', 'mceTableDelete'], ['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'], ['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'], ['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'], ['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'], ['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'], ['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'], ['row_props', 'table.row_desc', 'mceTableRowProps', true], ['cell_props', 'table.cell_desc', 'mceTableCellProps', true], ['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true], ['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true] ], function(c) { ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]}); }); // Select whole table is a table border is clicked if (!tinymce.isIE) { ed.onClick.add(function(ed, e) { e = e.target; if (e.nodeName === 'TABLE') { ed.selection.select(e); ed.nodeChanged(); } }); } ed.onPreProcess.add(function(ed, args) { var nodes, i, node, dom = ed.dom, value; nodes = dom.select('table', args.node); i = nodes.length; while (i--) { node = nodes[i]; dom.setAttrib(node, 'data-mce-style', ''); if ((value = dom.getAttrib(node, 'width'))) { dom.setStyle(node, 'width', value); dom.setAttrib(node, 'width', ''); } if ((value = dom.getAttrib(node, 'height'))) { dom.setStyle(node, 'height', value); dom.setAttrib(node, 'height', ''); } } }); // Handle node change updates ed.onNodeChange.add(function(ed, cm, n) { var p; n = ed.selection.getStart(); p = ed.dom.getParent(n, 'td,th,caption'); cm.setActive('table', n.nodeName === 'TABLE' || !!p); // Disable table tools if we are in caption if (p && p.nodeName === 'CAPTION') p = 0; cm.setDisabled('delete_table', !p); cm.setDisabled('delete_col', !p); cm.setDisabled('delete_table', !p); cm.setDisabled('delete_row', !p); cm.setDisabled('col_after', !p); cm.setDisabled('col_before', !p); cm.setDisabled('row_after', !p); cm.setDisabled('row_before', !p); cm.setDisabled('row_props', !p); cm.setDisabled('cell_props', !p); cm.setDisabled('split_cells', !p); cm.setDisabled('merge_cells', !p); }); ed.onInit.add(function(ed) { var startTable, startCell, dom = ed.dom, tableGrid; winMan = ed.windowManager; // Add cell selection logic ed.onMouseDown.add(function(ed, e) { if (e.button != 2) { cleanup(); startCell = dom.getParent(e.target, 'td,th'); startTable = dom.getParent(startCell, 'table'); } }); dom.bind(ed.getDoc(), 'mouseover', function(e) { var sel, table, target = e.target; if (startCell && (tableGrid || target != startCell) && (target.nodeName == 'TD' || target.nodeName == 'TH')) { table = dom.getParent(target, 'table'); if (table == startTable) { if (!tableGrid) { tableGrid = createTableGrid(table); tableGrid.setStartCell(startCell); ed.getBody().style.webkitUserSelect = 'none'; } tableGrid.setEndCell(target); hasCellSelection = true; } // Remove current selection sel = ed.selection.getSel(); try { if (sel.removeAllRanges) sel.removeAllRanges(); else sel.empty(); } catch (ex) { // IE9 might throw errors here } e.preventDefault(); } }); ed.onMouseUp.add(function(ed, e) { var rng, sel = ed.selection, selectedCells, nativeSel = sel.getSel(), walker, node, lastNode, endNode; // Move selection to startCell if (startCell) { if (tableGrid) ed.getBody().style.webkitUserSelect = ''; function setPoint(node, start) { var walker = new tinymce.dom.TreeWalker(node, node); do { // Text node if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length != 0) { if (start) rng.setStart(node, 0); else rng.setEnd(node, node.nodeValue.length); return; } // BR element if (node.nodeName == 'BR') { if (start) rng.setStartBefore(node); else rng.setEndBefore(node); return; } } while (node = (start ? walker.next() : walker.prev())); } // Try to expand text selection as much as we can only Gecko supports cell selection selectedCells = dom.select('td.mceSelected,th.mceSelected'); if (selectedCells.length > 0) { rng = dom.createRng(); node = selectedCells[0]; endNode = selectedCells[selectedCells.length - 1]; rng.setStartBefore(node); rng.setEndAfter(node); setPoint(node, 1); walker = new tinymce.dom.TreeWalker(node, dom.getParent(selectedCells[0], 'table')); do { if (node.nodeName == 'TD' || node.nodeName == 'TH') { if (!dom.hasClass(node, 'mceSelected')) break; lastNode = node; } } while (node = walker.next()); setPoint(lastNode); sel.setRng(rng); } ed.nodeChanged(); startCell = tableGrid = startTable = null; } }); ed.onKeyUp.add(function(ed, e) { cleanup(); }); ed.onKeyDown.add(function (ed, e) { fixTableCellSelection(ed); }); ed.onMouseDown.add(function (ed, e) { if (e.button != 2) { fixTableCellSelection(ed); } }); function tableCellSelected(ed, rng, n, currentCell) { // The decision of when a table cell is selected is somewhat involved. The fact that this code is // required is actually a pointer to the root cause of this bug. A cell is selected when the start // and end offsets are 0, the start container is a text, and the selection node is either a TR (most cases) // or the parent of the table (in the case of the selection containing the last cell of a table). var TEXT_NODE = 3, table = ed.dom.getParent(rng.startContainer, 'TABLE'), tableParent, allOfCellSelected, tableCellSelection; if (table) tableParent = table.parentNode; allOfCellSelected =rng.startContainer.nodeType == TEXT_NODE && rng.startOffset == 0 && rng.endOffset == 0 && currentCell && (n.nodeName=="TR" || n==tableParent); tableCellSelection = (n.nodeName=="TD"||n.nodeName=="TH")&& !currentCell; return allOfCellSelected || tableCellSelection; // return false; } // this nasty hack is here to work around some WebKit selection bugs. function fixTableCellSelection(ed) { if (!tinymce.isWebKit) return; var rng = ed.selection.getRng(); var n = ed.selection.getNode(); var currentCell = ed.dom.getParent(rng.startContainer, 'TD,TH'); if (!tableCellSelected(ed, rng, n, currentCell)) return; if (!currentCell) { currentCell=n; } // Get the very last node inside the table cell var end = currentCell.lastChild; while (end.lastChild) end = end.lastChild; // Select the entire table cell. Nothing outside of the table cell should be selected. rng.setEnd(end, end.nodeValue.length); ed.selection.setRng(rng); } ed.plugins.table.fixTableCellSelection=fixTableCellSelection; // Add context menu if (ed && ed.plugins.contextmenu) { ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) { var sm, se = ed.selection, el = se.getNode() || ed.getBody(); if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th') || ed.dom.select('td.mceSelected,th.mceSelected').length) { m.removeAll(); if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) { m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true}); m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'}); m.addSeparator(); } if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) { m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true}); m.addSeparator(); } m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', value : {action : 'insert'}}); m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable'}); m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete'}); m.addSeparator(); // Cell menu sm = m.addMenu({title : 'table.cell'}); sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps'}); sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells'}); sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells'}); // Row menu sm = m.addMenu({title : 'table.row'}); sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps'}); sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'}); sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'}); sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'}); sm.addSeparator(); sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'}); sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'}); sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'}).setDisabled(!clipboardRows); sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'}).setDisabled(!clipboardRows); // Column menu sm = m.addMenu({title : 'table.col'}); sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'}); sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'}); sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'}); } else m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable'}); }); } // Fix to allow navigating up and down in a table in WebKit browsers. if (tinymce.isWebKit) { function moveSelection(ed, e) { var VK = tinymce.VK; var key = e.keyCode; function handle(upBool, sourceNode, event) { var siblingDirection = upBool ? 'previousSibling' : 'nextSibling'; var currentRow = ed.dom.getParent(sourceNode, 'tr'); var siblingRow = currentRow[siblingDirection]; if (siblingRow) { moveCursorToRow(ed, sourceNode, siblingRow, upBool); tinymce.dom.Event.cancel(event); return true; } else { var tableNode = ed.dom.getParent(currentRow, 'table'); var middleNode = currentRow.parentNode; var parentNodeName = middleNode.nodeName.toLowerCase(); if (parentNodeName === 'tbody' || parentNodeName === (upBool ? 'tfoot' : 'thead')) { var targetParent = getTargetParent(upBool, tableNode, middleNode, 'tbody'); if (targetParent !== null) { return moveToRowInTarget(upBool, targetParent, sourceNode, event); } } return escapeTable(upBool, currentRow, siblingDirection, tableNode, event); } } function getTargetParent(upBool, topNode, secondNode, nodeName) { var tbodies = ed.dom.select('>' + nodeName, topNode); var position = tbodies.indexOf(secondNode); if (upBool && position === 0 || !upBool && position === tbodies.length - 1) { return getFirstHeadOrFoot(upBool, topNode); } else if (position === -1) { var topOrBottom = secondNode.tagName.toLowerCase() === 'thead' ? 0 : tbodies.length - 1; return tbodies[topOrBottom]; } else { return tbodies[position + (upBool ? -1 : 1)]; } } function getFirstHeadOrFoot(upBool, parent) { var tagName = upBool ? 'thead' : 'tfoot'; var headOrFoot = ed.dom.select('>' + tagName, parent); return headOrFoot.length !== 0 ? headOrFoot[0] : null; } function moveToRowInTarget(upBool, targetParent, sourceNode, event) { var targetRow = getChildForDirection(targetParent, upBool); targetRow && moveCursorToRow(ed, sourceNode, targetRow, upBool); tinymce.dom.Event.cancel(event); return true; } function escapeTable(upBool, currentRow, siblingDirection, table, event) { var tableSibling = table[siblingDirection]; if (tableSibling) { moveCursorToStartOfElement(tableSibling); return true; } else { var parentCell = ed.dom.getParent(table, 'td,th'); if (parentCell) { return handle(upBool, parentCell, event); } else { var backUpSibling = getChildForDirection(currentRow, !upBool); moveCursorToStartOfElement(backUpSibling); return tinymce.dom.Event.cancel(event); } } } function getChildForDirection(parent, up) { var child = parent && parent[up ? 'lastChild' : 'firstChild']; // BR is not a valid table child to return in this case we return the table cell return child && child.nodeName === 'BR' ? ed.dom.getParent(child, 'td,th') : child; } function moveCursorToStartOfElement(n) { ed.selection.setCursorLocation(n, 0); } function isVerticalMovement() { return key == VK.UP || key == VK.DOWN; } function isInTable(ed) { var node = ed.selection.getNode(); var currentRow = ed.dom.getParent(node, 'tr'); return currentRow !== null; } function columnIndex(column) { var colIndex = 0; var c = column; while (c.previousSibling) { c = c.previousSibling; colIndex = colIndex + getSpanVal(c, "colspan"); } return colIndex; } function findColumn(rowElement, columnIndex) { var c = 0; var r = 0; each(rowElement.children, function(cell, i) { c = c + getSpanVal(cell, "colspan"); r = i; if (c > columnIndex) return false; }); return r; } function moveCursorToRow(ed, node, row, upBool) { var srcColumnIndex = columnIndex(ed.dom.getParent(node, 'td,th')); var tgtColumnIndex = findColumn(row, srcColumnIndex); var tgtNode = row.childNodes[tgtColumnIndex]; var rowCellTarget = getChildForDirection(tgtNode, upBool); moveCursorToStartOfElement(rowCellTarget || tgtNode); } function shouldFixCaret(preBrowserNode) { var newNode = ed.selection.getNode(); var newParent = ed.dom.getParent(newNode, 'td,th'); var oldParent = ed.dom.getParent(preBrowserNode, 'td,th'); return newParent && newParent !== oldParent && checkSameParentTable(newParent, oldParent) } function checkSameParentTable(nodeOne, NodeTwo) { return ed.dom.getParent(nodeOne, 'TABLE') === ed.dom.getParent(NodeTwo, 'TABLE'); } if (isVerticalMovement() && isInTable(ed)) { var preBrowserNode = ed.selection.getNode(); setTimeout(function() { if (shouldFixCaret(preBrowserNode)) { handle(!e.shiftKey && key === VK.UP, preBrowserNode, e); } }, 0); } } ed.onKeyDown.add(moveSelection); } // Fixes an issue on Gecko where it's impossible to place the caret behind a table // This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled function fixTableCaretPos() { var last; // Skip empty text nodes form the end for (last = ed.getBody().lastChild; last && last.nodeType == 3 && !last.nodeValue.length; last = last.previousSibling) ; if (last && last.nodeName == 'TABLE') { if (ed.settings.forced_root_block) ed.dom.add(ed.getBody(), ed.settings.forced_root_block, null, tinymce.isIE ? ' ' : '
    '); else ed.dom.add(ed.getBody(), 'br', {'data-mce-bogus': '1'}); } }; // Fixes an bug where it's impossible to place the caret before a table in Gecko // this fix solves it by detecting when the caret is at the beginning of such a table // and then manually moves the caret infront of the table if (tinymce.isGecko) { ed.onKeyDown.add(function(ed, e) { var rng, table, dom = ed.dom; // On gecko it's not possible to place the caret before a table if (e.keyCode == 37 || e.keyCode == 38) { rng = ed.selection.getRng(); table = dom.getParent(rng.startContainer, 'table'); if (table && ed.getBody().firstChild == table) { if (isAtStart(rng, table)) { rng = dom.createRng(); rng.setStartBefore(table); rng.setEndBefore(table); ed.selection.setRng(rng); e.preventDefault(); } } } }); } ed.onKeyUp.add(fixTableCaretPos); ed.onSetContent.add(fixTableCaretPos); ed.onVisualAid.add(fixTableCaretPos); ed.onPreProcess.add(function(ed, o) { var last = o.node.lastChild; if (last && (last.nodeName == "BR" || (last.childNodes.length == 1 && (last.firstChild.nodeName == 'BR' || last.firstChild.nodeValue == '\u00a0'))) && last.previousSibling && last.previousSibling.nodeName == "TABLE") { ed.dom.remove(last); } }); /** * Fixes bug in Gecko where shift-enter in table cell does not place caret on new line * * Removed: Since the new enter logic seems to fix this one. */ /* if (tinymce.isGecko) { ed.onKeyDown.add(function(ed, e) { if (e.keyCode === tinymce.VK.ENTER && e.shiftKey) { var node = ed.selection.getRng().startContainer; var tableCell = dom.getParent(node, 'td,th'); if (tableCell) { var zeroSizedNbsp = ed.getDoc().createTextNode("\uFEFF"); dom.insertAfter(zeroSizedNbsp, node); } } }); } */ fixTableCaretPos(); ed.startContent = ed.getContent({format : 'raw'}); }); // Register action commands each({ mceTableSplitCells : function(grid) { grid.split(); }, mceTableMergeCells : function(grid) { var rowSpan, colSpan, cell; cell = ed.dom.getParent(ed.selection.getNode(), 'th,td'); if (cell) { rowSpan = cell.rowSpan; colSpan = cell.colSpan; } if (!ed.dom.select('td.mceSelected,th.mceSelected').length) { winMan.open({ url : url + '/merge_cells.htm', width : 240 + parseInt(ed.getLang('table.merge_cells_delta_width', 0)), height : 110 + parseInt(ed.getLang('table.merge_cells_delta_height', 0)), inline : 1 }, { rows : rowSpan, cols : colSpan, onaction : function(data) { grid.merge(cell, data.cols, data.rows); }, plugin_url : url }); } else grid.merge(); }, mceTableInsertRowBefore : function(grid) { grid.insertRow(true); }, mceTableInsertRowAfter : function(grid) { grid.insertRow(); }, mceTableInsertColBefore : function(grid) { grid.insertCol(true); }, mceTableInsertColAfter : function(grid) { grid.insertCol(); }, mceTableDeleteCol : function(grid) { grid.deleteCols(); }, mceTableDeleteRow : function(grid) { grid.deleteRows(); }, mceTableCutRow : function(grid) { clipboardRows = grid.cutRows(); }, mceTableCopyRow : function(grid) { clipboardRows = grid.copyRows(); }, mceTablePasteRowBefore : function(grid) { grid.pasteRows(clipboardRows, true); }, mceTablePasteRowAfter : function(grid) { grid.pasteRows(clipboardRows); }, mceTableDelete : function(grid) { grid.deleteTable(); } }, function(func, name) { ed.addCommand(name, function() { var grid = createTableGrid(); if (grid) { func(grid); ed.execCommand('mceRepaint'); cleanup(); } }); }); // Register dialog commands each({ mceInsertTable : function(val) { winMan.open({ url : url + '/table.htm', width : 400 + parseInt(ed.getLang('table.table_delta_width', 0)), height : 320 + parseInt(ed.getLang('table.table_delta_height', 0)), inline : 1 }, { plugin_url : url, action : val ? val.action : 0 }); }, mceTableRowProps : function() { winMan.open({ url : url + '/row.htm', width : 400 + parseInt(ed.getLang('table.rowprops_delta_width', 0)), height : 295 + parseInt(ed.getLang('table.rowprops_delta_height', 0)), inline : 1 }, { plugin_url : url }); }, mceTableCellProps : function() { winMan.open({ url : url + '/cell.htm', width : 400 + parseInt(ed.getLang('table.cellprops_delta_width', 0)), height : 295 + parseInt(ed.getLang('table.cellprops_delta_height', 0)), inline : 1 }, { plugin_url : url }); } }, function(func, name) { ed.addCommand(name, function(ui, val) { func(val); }); }); } }); // Register plugin tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin); })(tinymce); ================================================ FILE: static/js/tinymce/plugins/table/js/cell.js ================================================ tinyMCEPopup.requireLangPack(); var ed; function init() { ed = tinyMCEPopup.editor; tinyMCEPopup.resizeToInnerSize(); document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table'); document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor'); document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor') var inst = ed; var tdElm = ed.dom.getParent(ed.selection.getStart(), "td,th"); var formObj = document.forms[0]; var st = ed.dom.parseStyle(ed.dom.getAttrib(tdElm, "style")); // Get table cell data var celltype = tdElm.nodeName.toLowerCase(); var align = ed.dom.getAttrib(tdElm, 'align'); var valign = ed.dom.getAttrib(tdElm, 'valign'); var width = trimSize(getStyle(tdElm, 'width', 'width')); var height = trimSize(getStyle(tdElm, 'height', 'height')); var bordercolor = convertRGBToHex(getStyle(tdElm, 'bordercolor', 'borderLeftColor')); var bgcolor = convertRGBToHex(getStyle(tdElm, 'bgcolor', 'backgroundColor')); var className = ed.dom.getAttrib(tdElm, 'class'); var backgroundimage = getStyle(tdElm, 'background', 'backgroundImage').replace(new RegExp("url\\(['\"]?([^'\"]*)['\"]?\\)", 'gi'), "$1"); var id = ed.dom.getAttrib(tdElm, 'id'); var lang = ed.dom.getAttrib(tdElm, 'lang'); var dir = ed.dom.getAttrib(tdElm, 'dir'); var scope = ed.dom.getAttrib(tdElm, 'scope'); // Setup form addClassesToList('class', 'table_cell_styles'); TinyMCE_EditableSelects.init(); if (!ed.dom.hasClass(tdElm, 'mceSelected')) { formObj.bordercolor.value = bordercolor; formObj.bgcolor.value = bgcolor; formObj.backgroundimage.value = backgroundimage; formObj.width.value = width; formObj.height.value = height; formObj.id.value = id; formObj.lang.value = lang; formObj.style.value = ed.dom.serializeStyle(st); selectByValue(formObj, 'align', align); selectByValue(formObj, 'valign', valign); selectByValue(formObj, 'class', className, true, true); selectByValue(formObj, 'celltype', celltype); selectByValue(formObj, 'dir', dir); selectByValue(formObj, 'scope', scope); // Resize some elements if (isVisible('backgroundimagebrowser')) document.getElementById('backgroundimage').style.width = '180px'; updateColor('bordercolor_pick', 'bordercolor'); updateColor('bgcolor_pick', 'bgcolor'); } else tinyMCEPopup.dom.hide('action'); } function updateAction() { var el, inst = ed, tdElm, trElm, tableElm, formObj = document.forms[0]; if (!AutoValidator.validate(formObj)) { tinyMCEPopup.alert(AutoValidator.getErrorMessages(formObj).join('. ') + '.'); return false; } tinyMCEPopup.restoreSelection(); el = ed.selection.getStart(); tdElm = ed.dom.getParent(el, "td,th"); trElm = ed.dom.getParent(el, "tr"); tableElm = ed.dom.getParent(el, "table"); // Cell is selected if (ed.dom.hasClass(tdElm, 'mceSelected')) { // Update all selected sells tinymce.each(ed.dom.select('td.mceSelected,th.mceSelected'), function(td) { updateCell(td); }); ed.addVisual(); ed.nodeChanged(); inst.execCommand('mceEndUndoLevel'); tinyMCEPopup.close(); return; } switch (getSelectValue(formObj, 'action')) { case "cell": var celltype = getSelectValue(formObj, 'celltype'); var scope = getSelectValue(formObj, 'scope'); function doUpdate(s) { if (s) { updateCell(tdElm); ed.addVisual(); ed.nodeChanged(); inst.execCommand('mceEndUndoLevel'); tinyMCEPopup.close(); } }; if (ed.getParam("accessibility_warnings", 1)) { if (celltype == "th" && scope == "") tinyMCEPopup.confirm(ed.getLang('table_dlg.missing_scope', '', true), doUpdate); else doUpdate(1); return; } updateCell(tdElm); break; case "row": var cell = trElm.firstChild; if (cell.nodeName != "TD" && cell.nodeName != "TH") cell = nextCell(cell); do { cell = updateCell(cell, true); } while ((cell = nextCell(cell)) != null); break; case "col": var curr, col = 0, cell = trElm.firstChild, rows = tableElm.getElementsByTagName("tr"); if (cell.nodeName != "TD" && cell.nodeName != "TH") cell = nextCell(cell); do { if (cell == tdElm) break; col += cell.getAttribute("colspan")?cell.getAttribute("colspan"):1; } while ((cell = nextCell(cell)) != null); for (var i=0; i 0) { tinymce.each(tableElm.rows, function(tr) { var i; for (i = 0; i < tr.cells.length; i++) { if (dom.hasClass(tr.cells[i], 'mceSelected')) { updateRow(tr, true); return; } } }); inst.addVisual(); inst.nodeChanged(); inst.execCommand('mceEndUndoLevel'); tinyMCEPopup.close(); return; } switch (action) { case "row": updateRow(trElm); break; case "all": var rows = tableElm.getElementsByTagName("tr"); for (var i=0; i colLimit) { tinyMCEPopup.alert(inst.getLang('table_dlg.col_limit').replace(/\{\$cols\}/g, colLimit)); return false; } else if (rowLimit && rows > rowLimit) { tinyMCEPopup.alert(inst.getLang('table_dlg.row_limit').replace(/\{\$rows\}/g, rowLimit)); return false; } else if (cellLimit && cols * rows > cellLimit) { tinyMCEPopup.alert(inst.getLang('table_dlg.cell_limit').replace(/\{\$cells\}/g, cellLimit)); return false; } // Update table if (action == "update") { dom.setAttrib(elm, 'cellPadding', cellpadding, true); dom.setAttrib(elm, 'cellSpacing', cellspacing, true); if (!isCssSize(border)) { dom.setAttrib(elm, 'border', border); } else { dom.setAttrib(elm, 'border', ''); } if (border == '') { dom.setStyle(elm, 'border-width', ''); dom.setStyle(elm, 'border', ''); dom.setAttrib(elm, 'border', ''); } dom.setAttrib(elm, 'align', align); dom.setAttrib(elm, 'frame', frame); dom.setAttrib(elm, 'rules', rules); dom.setAttrib(elm, 'class', className); dom.setAttrib(elm, 'style', style); dom.setAttrib(elm, 'id', id); dom.setAttrib(elm, 'summary', summary); dom.setAttrib(elm, 'dir', dir); dom.setAttrib(elm, 'lang', lang); capEl = inst.dom.select('caption', elm)[0]; if (capEl && !caption) capEl.parentNode.removeChild(capEl); if (!capEl && caption) { capEl = elm.ownerDocument.createElement('caption'); if (!tinymce.isIE) capEl.innerHTML = '
    '; elm.insertBefore(capEl, elm.firstChild); } if (width && inst.settings.inline_styles) { dom.setStyle(elm, 'width', width); dom.setAttrib(elm, 'width', ''); } else { dom.setAttrib(elm, 'width', width, true); dom.setStyle(elm, 'width', ''); } // Remove these since they are not valid XHTML dom.setAttrib(elm, 'borderColor', ''); dom.setAttrib(elm, 'bgColor', ''); dom.setAttrib(elm, 'background', ''); if (height && inst.settings.inline_styles) { dom.setStyle(elm, 'height', height); dom.setAttrib(elm, 'height', ''); } else { dom.setAttrib(elm, 'height', height, true); dom.setStyle(elm, 'height', ''); } if (background != '') elm.style.backgroundImage = "url('" + background + "')"; else elm.style.backgroundImage = ''; /* if (tinyMCEPopup.getParam("inline_styles")) { if (width != '') elm.style.width = getCSSSize(width); }*/ if (bordercolor != "") { elm.style.borderColor = bordercolor; elm.style.borderStyle = elm.style.borderStyle == "" ? "solid" : elm.style.borderStyle; elm.style.borderWidth = cssSize(border); } else elm.style.borderColor = ''; elm.style.backgroundColor = bgcolor; elm.style.height = getCSSSize(height); inst.addVisual(); // Fix for stange MSIE align bug //elm.outerHTML = elm.outerHTML; inst.nodeChanged(); inst.execCommand('mceEndUndoLevel', false, {}, {skip_undo: true}); // Repaint if dimensions changed if (formObj.width.value != orgTableWidth || formObj.height.value != orgTableHeight) inst.execCommand('mceRepaint'); tinyMCEPopup.close(); return true; } // Create new table html += ''); tinymce.each('h1,h2,h3,h4,h5,h6,p'.split(','), function(n) { if (patt) patt += ','; patt += n + ' ._mce_marker'; }); tinymce.each(inst.dom.select(patt), function(n) { inst.dom.split(inst.dom.getParent(n, 'h1,h2,h3,h4,h5,h6,p'), n); }); dom.setOuterHTML(dom.select('br._mce_marker')[0], html); } else inst.execCommand('mceInsertContent', false, html); tinymce.each(dom.select('table[data-mce-new]'), function(node) { var tdorth = dom.select('td,th', node); // Fixes a bug in IE where the caret cannot be placed after the table if the table is at the end of the document if (tinymce.isIE && node.nextSibling == null) { if (inst.settings.forced_root_block) dom.insertAfter(dom.create(inst.settings.forced_root_block), node); else dom.insertAfter(dom.create('br', {'data-mce-bogus': '1'}), node); } try { // IE9 might fail to do this selection inst.selection.setCursorLocation(tdorth[0], 0); } catch (ex) { // Ignore } dom.setAttrib(node, 'data-mce-new', ''); }); inst.addVisual(); inst.execCommand('mceEndUndoLevel', false, {}, {skip_undo: true}); tinyMCEPopup.close(); } function makeAttrib(attrib, value) { var formObj = document.forms[0]; var valueElm = formObj.elements[attrib]; if (typeof(value) == "undefined" || value == null) { value = ""; if (valueElm) value = valueElm.value; } if (value == "") return ""; // XML encode it value = value.replace(/&/g, '&'); value = value.replace(/\"/g, '"'); value = value.replace(//g, '>'); return ' ' + attrib + '="' + value + '"'; } function init() { tinyMCEPopup.resizeToInnerSize(); document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table'); document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table'); document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor'); document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor'); var cols = 2, rows = 2, border = tinyMCEPopup.getParam('table_default_border', '0'), cellpadding = tinyMCEPopup.getParam('table_default_cellpadding', ''), cellspacing = tinyMCEPopup.getParam('table_default_cellspacing', ''); var align = "", width = "", height = "", bordercolor = "", bgcolor = "", className = ""; var id = "", summary = "", style = "", dir = "", lang = "", background = "", bgcolor = "", bordercolor = "", rules = "", frame = ""; var inst = tinyMCEPopup.editor, dom = inst.dom; var formObj = document.forms[0]; var elm = dom.getParent(inst.selection.getNode(), "table"); // Hide advanced fields that isn't available in the schema tinymce.each("summary id rules dir style frame".split(" "), function(name) { var tr = tinyMCEPopup.dom.getParent(name, "tr") || tinyMCEPopup.dom.getParent("t" + name, "tr"); if (tr && !tinyMCEPopup.editor.schema.isValid("table", name)) { tr.style.display = 'none'; } }); action = tinyMCEPopup.getWindowArg('action'); if (!action) action = elm ? "update" : "insert"; if (elm && action != "insert") { var rowsAr = elm.rows; var cols = 0; for (var i=0; i cols) cols = rowsAr[i].cells.length; cols = cols; rows = rowsAr.length; st = dom.parseStyle(dom.getAttrib(elm, "style")); border = trimSize(getStyle(elm, 'border', 'borderWidth')); cellpadding = dom.getAttrib(elm, 'cellpadding', ""); cellspacing = dom.getAttrib(elm, 'cellspacing', ""); width = trimSize(getStyle(elm, 'width', 'width')); height = trimSize(getStyle(elm, 'height', 'height')); bordercolor = convertRGBToHex(getStyle(elm, 'bordercolor', 'borderLeftColor')); bgcolor = convertRGBToHex(getStyle(elm, 'bgcolor', 'backgroundColor')); align = dom.getAttrib(elm, 'align', align); frame = dom.getAttrib(elm, 'frame'); rules = dom.getAttrib(elm, 'rules'); className = tinymce.trim(dom.getAttrib(elm, 'class').replace(/mceItem.+/g, '')); id = dom.getAttrib(elm, 'id'); summary = dom.getAttrib(elm, 'summary'); style = dom.serializeStyle(st); dir = dom.getAttrib(elm, 'dir'); lang = dom.getAttrib(elm, 'lang'); background = getStyle(elm, 'background', 'backgroundImage').replace(new RegExp("url\\(['\"]?([^'\"]*)['\"]?\\)", 'gi'), "$1"); formObj.caption.checked = elm.getElementsByTagName('caption').length > 0; orgTableWidth = width; orgTableHeight = height; action = "update"; formObj.insert.value = inst.getLang('update'); } addClassesToList('class', "table_styles"); TinyMCE_EditableSelects.init(); // Update form selectByValue(formObj, 'align', align); selectByValue(formObj, 'tframe', frame); selectByValue(formObj, 'rules', rules); selectByValue(formObj, 'class', className, true, true); formObj.cols.value = cols; formObj.rows.value = rows; formObj.border.value = border; formObj.cellpadding.value = cellpadding; formObj.cellspacing.value = cellspacing; formObj.width.value = width; formObj.height.value = height; formObj.bordercolor.value = bordercolor; formObj.bgcolor.value = bgcolor; formObj.id.value = id; formObj.summary.value = summary; formObj.style.value = style; formObj.dir.value = dir; formObj.lang.value = lang; formObj.backgroundimage.value = background; updateColor('bordercolor_pick', 'bordercolor'); updateColor('bgcolor_pick', 'bgcolor'); // Resize some elements if (isVisible('backgroundimagebrowser')) document.getElementById('backgroundimage').style.width = '180px'; // Disable some fields in update mode if (action == "update") { formObj.cols.disabled = true; formObj.rows.disabled = true; } } function changedSize() { var formObj = document.forms[0]; var st = dom.parseStyle(formObj.style.value); /* var width = formObj.width.value; if (width != "") st['width'] = tinyMCEPopup.getParam("inline_styles") ? getCSSSize(width) : ""; else st['width'] = "";*/ var height = formObj.height.value; if (height != "") st['height'] = getCSSSize(height); else st['height'] = ""; formObj.style.value = dom.serializeStyle(st); } function isCssSize(value) { return /^[0-9.]+(%|in|cm|mm|em|ex|pt|pc|px)$/.test(value); } function cssSize(value, def) { value = tinymce.trim(value || def); if (!isCssSize(value)) { return parseInt(value, 10) + 'px'; } return value; } function changedBackgroundImage() { var formObj = document.forms[0]; var st = dom.parseStyle(formObj.style.value); st['background-image'] = "url('" + formObj.backgroundimage.value + "')"; formObj.style.value = dom.serializeStyle(st); } function changedBorder() { var formObj = document.forms[0]; var st = dom.parseStyle(formObj.style.value); // Update border width if the element has a color if (formObj.border.value != "" && (isCssSize(formObj.border.value) || formObj.bordercolor.value != "")) st['border-width'] = cssSize(formObj.border.value); else { if (!formObj.border.value) { st['border'] = ''; st['border-width'] = ''; } } formObj.style.value = dom.serializeStyle(st); } function changedColor() { var formObj = document.forms[0]; var st = dom.parseStyle(formObj.style.value); st['background-color'] = formObj.bgcolor.value; if (formObj.bordercolor.value != "") { st['border-color'] = formObj.bordercolor.value; // Add border-width if it's missing if (!st['border-width']) st['border-width'] = cssSize(formObj.border.value, 1); } formObj.style.value = dom.serializeStyle(st); } function changedStyle() { var formObj = document.forms[0]; var st = dom.parseStyle(formObj.style.value); if (st['background-image']) formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\(['\"]?([^'\"]*)['\"]?\\)", 'gi'), "$1"); else formObj.backgroundimage.value = ''; if (st['width']) formObj.width.value = trimSize(st['width']); if (st['height']) formObj.height.value = trimSize(st['height']); if (st['background-color']) { formObj.bgcolor.value = st['background-color']; updateColor('bgcolor_pick','bgcolor'); } if (st['border-color']) { formObj.bordercolor.value = st['border-color']; updateColor('bordercolor_pick','bordercolor'); } } tinyMCEPopup.onInit.add(init); ================================================ FILE: static/js/tinymce/plugins/table/langs/en_dlg.js ================================================ tinyMCE.addI18n('en.table_dlg',{"rules_border":"border","rules_box":"box","rules_vsides":"vsides","rules_rhs":"rhs","rules_lhs":"lhs","rules_hsides":"hsides","rules_below":"below","rules_above":"above","rules_void":"void",rules:"Rules","frame_all":"all","frame_cols":"cols","frame_rows":"rows","frame_groups":"groups","frame_none":"none",frame:"Frame",caption:"Table Caption","missing_scope":"Are you sure you want to continue without specifying a scope for this table header cell. Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.","cell_limit":"You\'ve exceeded the maximum number of cells of {$cells}.","row_limit":"You\'ve exceeded the maximum number of rows of {$rows}.","col_limit":"You\'ve exceeded the maximum number of columns of {$cols}.",colgroup:"Col Group",rowgroup:"Row Group",scope:"Scope",tfoot:"Footer",tbody:"Body",thead:"Header","row_all":"Update All Rows in Table","row_even":"Update Even Rows in Table","row_odd":"Update Odd Rows in Table","row_row":"Update Current Row","cell_all":"Update All Cells in Table","cell_row":"Update All Cells in Row","cell_cell":"Update Current Cell",th:"Header",td:"Data",summary:"Summary",bgimage:"Background Image",rtl:"Right to Left",ltr:"Left to Right",mime:"Target MIME Type",langcode:"Language Code",langdir:"Language Direction",style:"Style",id:"ID","merge_cells_title":"Merge Table Cells",bgcolor:"Background Color",bordercolor:"Border Color","align_bottom":"Bottom","align_top":"Top",valign:"Vertical Alignment","cell_type":"Cell Type","cell_title":"Table Cell Properties","row_title":"Table Row Properties","align_middle":"Center","align_right":"Right","align_left":"Left","align_default":"Default",align:"Alignment",border:"Border",cellpadding:"Cell Padding",cellspacing:"Cell Spacing",rows:"Rows",cols:"Columns",height:"Height",width:"Width",title:"Insert/Edit Table",rowtype:"Row Type","advanced_props":"Advanced Properties","general_props":"General Properties","advanced_tab":"Advanced","general_tab":"General","cell_col":"Update all cells in column"}); ================================================ FILE: static/js/tinymce/plugins/table/merge_cells.htm ================================================ {#table_dlg.merge_cells_title}
    {#table_dlg.merge_cells_title}
    :
    :
    ================================================ FILE: static/js/tinymce/plugins/table/row.htm ================================================ {#table_dlg.row_title}
    {#table_dlg.general_props}
    {#table_dlg.advanced_props}
     
     
    ================================================ FILE: static/js/tinymce/plugins/table/table.htm ================================================ {#table_dlg.title}
    {#table_dlg.general_props}
    {#table_dlg.advanced_props}
     
     
     
    ================================================ FILE: static/js/tinymce/plugins/template/blank.htm ================================================ blank_page ================================================ FILE: static/js/tinymce/plugins/template/css/template.css ================================================ #frmbody { padding: 10px; background-color: #FFF; border: 1px solid #CCC; } .frmRow { margin-bottom: 10px; } #templatesrc { border: none; width: 320px; height: 240px; } .title { padding-bottom: 5px; } .mceActionPanel { padding-top: 5px; } ================================================ FILE: static/js/tinymce/plugins/template/editor_plugin.js ================================================ (function(){var a=tinymce.each;tinymce.create("tinymce.plugins.TemplatePlugin",{init:function(b,c){var d=this;d.editor=b;b.addCommand("mceTemplate",function(e){b.windowManager.open({file:c+"/template.htm",width:b.getParam("template_popup_width",750),height:b.getParam("template_popup_height",600),inline:1},{plugin_url:c})});b.addCommand("mceInsertTemplate",d._insertTemplate,d);b.addButton("template",{title:"template.desc",cmd:"mceTemplate"});b.onPreProcess.add(function(e,g){var f=e.dom;a(f.select("div",g.node),function(h){if(f.hasClass(h,"mceTmpl")){a(f.select("*",h),function(i){if(f.hasClass(i,e.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))){i.innerHTML=d._getDateTime(new Date(),e.getParam("template_mdate_format",e.getLang("template.mdate_format")))}});d._replaceVals(h)}})})},getInfo:function(){return{longname:"Template plugin",author:"Moxiecode Systems AB",authorurl:"http://www.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/template",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_insertTemplate:function(i,j){var k=this,g=k.editor,f,c,d=g.dom,b=g.selection.getContent();f=j.content;a(k.editor.getParam("template_replace_values"),function(l,h){if(typeof(l)!="function"){f=f.replace(new RegExp("\\{\\$"+h+"\\}","g"),l)}});c=d.create("div",null,f);n=d.select(".mceTmpl",c);if(n&&n.length>0){c=d.create("div",null);c.appendChild(n[0].cloneNode(true))}function e(l,h){return new RegExp("\\b"+h+"\\b","g").test(l.className)}a(d.select("*",c),function(h){if(e(h,g.getParam("template_cdate_classes","cdate").replace(/\s+/g,"|"))){h.innerHTML=k._getDateTime(new Date(),g.getParam("template_cdate_format",g.getLang("template.cdate_format")))}if(e(h,g.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))){h.innerHTML=k._getDateTime(new Date(),g.getParam("template_mdate_format",g.getLang("template.mdate_format")))}if(e(h,g.getParam("template_selected_content_classes","selcontent").replace(/\s+/g,"|"))){h.innerHTML=b}});k._replaceVals(c);g.execCommand("mceInsertContent",false,c.innerHTML);g.addVisual()},_replaceVals:function(c){var d=this.editor.dom,b=this.editor.getParam("template_replace_values");a(d.select("*",c),function(f){a(b,function(g,e){if(d.hasClass(f,e)){if(typeof(b[e])=="function"){b[e](f)}}})})},_getDateTime:function(e,b){if(!b){return""}function c(g,d){var f;g=""+g;if(g.length 0) { el = dom.create('div', null); el.appendChild(n[0].cloneNode(true)); } function hasClass(n, c) { return new RegExp('\\b' + c + '\\b', 'g').test(n.className); }; each(dom.select('*', el), function(n) { // Replace cdate if (hasClass(n, ed.getParam('template_cdate_classes', 'cdate').replace(/\s+/g, '|'))) n.innerHTML = t._getDateTime(new Date(), ed.getParam("template_cdate_format", ed.getLang("template.cdate_format"))); // Replace mdate if (hasClass(n, ed.getParam('template_mdate_classes', 'mdate').replace(/\s+/g, '|'))) n.innerHTML = t._getDateTime(new Date(), ed.getParam("template_mdate_format", ed.getLang("template.mdate_format"))); // Replace selection if (hasClass(n, ed.getParam('template_selected_content_classes', 'selcontent').replace(/\s+/g, '|'))) n.innerHTML = sel; }); t._replaceVals(el); ed.execCommand('mceInsertContent', false, el.innerHTML); ed.addVisual(); }, _replaceVals : function(e) { var dom = this.editor.dom, vl = this.editor.getParam('template_replace_values'); each(dom.select('*', e), function(e) { each(vl, function(v, k) { if (dom.hasClass(e, k)) { if (typeof(vl[k]) == 'function') vl[k](e); } }); }); }, _getDateTime : function(d, fmt) { if (!fmt) return ""; function addZeros(value, len) { var i; value = "" + value; if (value.length < len) { for (i=0; i<(len-value.length); i++) value = "0" + value; } return value; } fmt = fmt.replace("%D", "%m/%d/%y"); fmt = fmt.replace("%r", "%I:%M:%S %p"); fmt = fmt.replace("%Y", "" + d.getFullYear()); fmt = fmt.replace("%y", "" + d.getYear()); fmt = fmt.replace("%m", addZeros(d.getMonth()+1, 2)); fmt = fmt.replace("%d", addZeros(d.getDate(), 2)); fmt = fmt.replace("%H", "" + addZeros(d.getHours(), 2)); fmt = fmt.replace("%M", "" + addZeros(d.getMinutes(), 2)); fmt = fmt.replace("%S", "" + addZeros(d.getSeconds(), 2)); fmt = fmt.replace("%I", "" + ((d.getHours() + 11) % 12 + 1)); fmt = fmt.replace("%p", "" + (d.getHours() < 12 ? "AM" : "PM")); fmt = fmt.replace("%B", "" + this.editor.getLang("template_months_long").split(',')[d.getMonth()]); fmt = fmt.replace("%b", "" + this.editor.getLang("template_months_short").split(',')[d.getMonth()]); fmt = fmt.replace("%A", "" + this.editor.getLang("template_day_long").split(',')[d.getDay()]); fmt = fmt.replace("%a", "" + this.editor.getLang("template_day_short").split(',')[d.getDay()]); fmt = fmt.replace("%%", "%"); return fmt; } }); // Register plugin tinymce.PluginManager.add('template', tinymce.plugins.TemplatePlugin); })(); ================================================ FILE: static/js/tinymce/plugins/template/js/template.js ================================================ tinyMCEPopup.requireLangPack(); var TemplateDialog = { preInit : function() { var url = tinyMCEPopup.getParam("template_external_list_url"); if (url != null) document.write(''); }, init : function() { var ed = tinyMCEPopup.editor, tsrc, sel, x, u; tsrc = ed.getParam("template_templates", false); sel = document.getElementById('tpath'); // Setup external template list if (!tsrc && typeof(tinyMCETemplateList) != 'undefined') { for (x=0, tsrc = []; x'); }); }, selectTemplate : function(u, ti) { var d = window.frames['templatesrc'].document, x, tsrc = this.tsrc; if (!u) return; d.body.innerHTML = this.templateHTML = this.getFileContents(u); for (x=0; x {#template_dlg.title}
    {#template_dlg.desc}
    {#template_dlg.preview}
    ================================================ FILE: static/js/tinymce/plugins/visualblocks/css/visualblocks.css ================================================ p, h1, h2, h3, h4, h5, h6, hgroup, aside, div, section, article, blockquote, address, pre, figure {display: block; padding-top: 10px; border: 1px dashed #BBB; background: transparent no-repeat} p, h1, h2, h3, h4, h5, h6, hgroup, aside, div, section, article, address, pre, figure {margin-left: 3px} section, article, address, hgroup, aside, figure {margin: 0 0 1em 3px} p {background-image: url(data:image/gif;base64,R0lGODlhCQAJAJEAAAAAAP///7u7u////yH5BAEAAAMALAAAAAAJAAkAAAIQnG+CqCN/mlyvsRUpThG6AgA7)} h1 {background-image: url(data:image/gif;base64,R0lGODlhDQAKAIABALu7u////yH5BAEAAAEALAAAAAANAAoAAAIXjI8GybGu1JuxHoAfRNRW3TWXyF2YiRUAOw==)} h2 {background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8Hybbx4oOuqgTynJd6bGlWg3DkJzoaUAAAOw==)} h3 {background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIZjI8Hybbx4oOuqgTynJf2Ln2NOHpQpmhAAQA7)} h4 {background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxInR0zqeAdhtJlXwV1oCll2HaWgAAOw==)} h5 {background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxIoiuwjane4iq5GlW05GgIkIZUAAAOw==)} h6 {background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxIoiuwjan04jep1iZ1XRlAo5bVgAAOw==)} div {background-image: url(data:image/gif;base64,R0lGODlhEgAKAIABALu7u////yH5BAEAAAEALAAAAAASAAoAAAIfjI9poI0cgDywrhuxfbrzDEbQM2Ei5aRjmoySW4pAAQA7)} section {background-image: url(data:image/gif;base64,R0lGODlhKAAKAIABALu7u////yH5BAEAAAEALAAAAAAoAAoAAAI5jI+pywcNY3sBWHdNrplytD2ellDeSVbp+GmWqaDqDMepc8t17Y4vBsK5hDyJMcI6KkuYU+jpjLoKADs=)} article {background-image: url(data:image/gif;base64,R0lGODlhKgAKAIABALu7u////yH5BAEAAAEALAAAAAAqAAoAAAI6jI+pywkNY3wG0GBvrsd2tXGYSGnfiF7ikpXemTpOiJScasYoDJJrjsG9gkCJ0ag6KhmaIe3pjDYBBQA7)} blockquote {background-image: url(data:image/gif;base64,R0lGODlhPgAKAIABALu7u////yH5BAEAAAEALAAAAAA+AAoAAAJPjI+py+0Knpz0xQDyuUhvfoGgIX5iSKZYgq5uNL5q69asZ8s5rrf0yZmpNkJZzFesBTu8TOlDVAabUyatguVhWduud3EyiUk45xhTTgMBBQA7)} address {background-image: url(data:image/gif;base64,R0lGODlhLQAKAIABALu7u////yH5BAEAAAEALAAAAAAtAAoAAAI/jI+pywwNozSP1gDyyZcjb3UaRpXkWaXmZW4OqKLhBmLs+K263DkJK7OJeifh7FicKD9A1/IpGdKkyFpNmCkAADs=)} pre {background-image: url(data:image/gif;base64,R0lGODlhFQAKAIABALu7uwAAACH5BAEAAAEALAAAAAAVAAoAAAIjjI+ZoN0cgDwSmnpz1NCueYERhnibZVKLNnbOq8IvKpJtVQAAOw==)} hgroup {background-image: url(data:image/gif;base64,R0lGODlhJwAKAIABALu7uwAAACH5BAEAAAEALAAAAAAnAAoAAAI3jI+pywYNI3uB0gpsRtt5fFnfNZaVSYJil4Wo03Hv6Z62uOCgiXH1kZIIJ8NiIxRrAZNMZAtQAAA7)} aside {background-image: url(data:image/gif;base64,R0lGODlhHgAKAIABAKqqqv///yH5BAEAAAEALAAAAAAeAAoAAAItjI+pG8APjZOTzgtqy7I3f1yehmQcFY4WKZbqByutmW4aHUd6vfcVbgudgpYCADs=)} figure {background-image: url(data:image/gif;base64,R0lGODlhJAAKAIAAALu7u////yH5BAEAAAEALAAAAAAkAAoAAAI0jI+py+2fwAHUSFvD3RlvG4HIp4nX5JFSpnZUJ6LlrM52OE7uSWosBHScgkSZj7dDKnWAAgA7)} figcaption {border: 1px dashed #BBB} ================================================ FILE: static/js/tinymce/plugins/visualblocks/editor_plugin.js ================================================ (function(){tinymce.create("tinymce.plugins.VisualBlocks",{init:function(a,b){var c;if(!window.NodeList){return}a.addCommand("mceVisualBlocks",function(){var e=a.dom,d;if(!c){c=e.uniqueId();d=e.create("link",{id:c,rel:"stylesheet",href:b+"/css/visualblocks.css"});a.getDoc().getElementsByTagName("head")[0].appendChild(d)}else{d=e.get(c);d.disabled=!d.disabled}a.controlManager.setActive("visualblocks",!d.disabled)});a.addButton("visualblocks",{title:"visualblocks.desc",cmd:"mceVisualBlocks"});a.onInit.add(function(){if(a.settings.visualblocks_default_state){a.execCommand("mceVisualBlocks",false,null,{skip_focus:true})}})},getInfo:function(){return{longname:"Visual blocks",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualblocks",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("visualblocks",tinymce.plugins.VisualBlocks)})(); ================================================ FILE: static/js/tinymce/plugins/visualblocks/editor_plugin_src.js ================================================ /** * editor_plugin_src.js * * Copyright 2012, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ (function() { tinymce.create('tinymce.plugins.VisualBlocks', { init : function(ed, url) { var cssId; // We don't support older browsers like IE6/7 and they don't provide prototypes for DOM objects if (!window.NodeList) { return; } ed.addCommand('mceVisualBlocks', function() { var dom = ed.dom, linkElm; if (!cssId) { cssId = dom.uniqueId(); linkElm = dom.create('link', { id: cssId, rel : 'stylesheet', href : url + '/css/visualblocks.css' }); ed.getDoc().getElementsByTagName('head')[0].appendChild(linkElm); } else { linkElm = dom.get(cssId); linkElm.disabled = !linkElm.disabled; } ed.controlManager.setActive('visualblocks', !linkElm.disabled); }); ed.addButton('visualblocks', {title : 'visualblocks.desc', cmd : 'mceVisualBlocks'}); ed.onInit.add(function() { if (ed.settings.visualblocks_default_state) { ed.execCommand('mceVisualBlocks', false, null, {skip_focus : true}); } }); }, getInfo : function() { return { longname : 'Visual blocks', author : 'Moxiecode Systems AB', authorurl : 'http://tinymce.moxiecode.com', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualblocks', version : tinymce.majorVersion + "." + tinymce.minorVersion }; } }); // Register plugin tinymce.PluginManager.add('visualblocks', tinymce.plugins.VisualBlocks); })(); ================================================ FILE: static/js/tinymce/plugins/visualchars/editor_plugin.js ================================================ (function(){tinymce.create("tinymce.plugins.VisualChars",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceVisualChars",c._toggleVisualChars,c);a.addButton("visualchars",{title:"visualchars.desc",cmd:"mceVisualChars"});a.onBeforeGetContent.add(function(d,e){if(c.state&&e.format!="raw"&&!e.draft){c.state=true;c._toggleVisualChars(false)}})},getInfo:function(){return{longname:"Visual characters",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualchars",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_toggleVisualChars:function(m){var p=this,k=p.editor,a,g,j,n=k.getDoc(),o=k.getBody(),l,q=k.selection,e,c,f;p.state=!p.state;k.controlManager.setActive("visualchars",p.state);if(m){f=q.getBookmark()}if(p.state){a=[];tinymce.walk(o,function(b){if(b.nodeType==3&&b.nodeValue&&b.nodeValue.indexOf("\u00a0")!=-1){a.push(b)}},"childNodes");for(g=0;g$1');c=k.dom.create("div",null,l);while(node=c.lastChild){k.dom.insertAfter(node,a[g])}k.dom.remove(a[g])}}else{a=k.dom.select("span.mceItemNbsp",o);for(g=a.length-1;g>=0;g--){k.dom.remove(a[g],1)}}q.moveToBookmark(f)}});tinymce.PluginManager.add("visualchars",tinymce.plugins.VisualChars)})(); ================================================ FILE: static/js/tinymce/plugins/visualchars/editor_plugin_src.js ================================================ /** * editor_plugin_src.js * * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ (function() { tinymce.create('tinymce.plugins.VisualChars', { init : function(ed, url) { var t = this; t.editor = ed; // Register commands ed.addCommand('mceVisualChars', t._toggleVisualChars, t); // Register buttons ed.addButton('visualchars', {title : 'visualchars.desc', cmd : 'mceVisualChars'}); ed.onBeforeGetContent.add(function(ed, o) { if (t.state && o.format != 'raw' && !o.draft) { t.state = true; t._toggleVisualChars(false); } }); }, getInfo : function() { return { longname : 'Visual characters', author : 'Moxiecode Systems AB', authorurl : 'http://tinymce.moxiecode.com', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualchars', version : tinymce.majorVersion + "." + tinymce.minorVersion }; }, // Private methods _toggleVisualChars : function(bookmark) { var t = this, ed = t.editor, nl, i, h, d = ed.getDoc(), b = ed.getBody(), nv, s = ed.selection, bo, div, bm; t.state = !t.state; ed.controlManager.setActive('visualchars', t.state); if (bookmark) bm = s.getBookmark(); if (t.state) { nl = []; tinymce.walk(b, function(n) { if (n.nodeType == 3 && n.nodeValue && n.nodeValue.indexOf('\u00a0') != -1) nl.push(n); }, 'childNodes'); for (i = 0; i < nl.length; i++) { nv = nl[i].nodeValue; nv = nv.replace(/(\u00a0)/g, '$1'); div = ed.dom.create('div', null, nv); while (node = div.lastChild) ed.dom.insertAfter(node, nl[i]); ed.dom.remove(nl[i]); } } else { nl = ed.dom.select('span.mceItemNbsp', b); for (i = nl.length - 1; i >= 0; i--) ed.dom.remove(nl[i], 1); } s.moveToBookmark(bm); } }); // Register plugin tinymce.PluginManager.add('visualchars', tinymce.plugins.VisualChars); })(); ================================================ FILE: static/js/tinymce/plugins/wordcount/editor_plugin.js ================================================ (function(){tinymce.create("tinymce.plugins.WordCount",{block:0,id:null,countre:null,cleanre:null,init:function(c,d){var e=this,f=0,g=tinymce.VK;e.countre=c.getParam("wordcount_countregex",/[\w\u2019\'-]+/g);e.cleanre=c.getParam("wordcount_cleanregex",/[0-9.(),;:!?%#$?\'\"_+=\\\/-]*/g);e.update_rate=c.getParam("wordcount_update_rate",2000);e.update_on_delete=c.getParam("wordcount_update_on_delete",false);e.id=c.id+"-word-count";c.onPostRender.add(function(i,h){var j,k;k=i.getParam("wordcount_target_id");if(!k){j=tinymce.DOM.get(i.id+"_path_row");if(j){tinymce.DOM.add(j.parentNode,"div",{style:"float: right"},i.getLang("wordcount.words","Words: ")+'0')}}else{tinymce.DOM.add(k,"span",{},'0')}});c.onInit.add(function(h){h.selection.onSetContent.add(function(){e._count(h)});e._count(h)});c.onSetContent.add(function(h){e._count(h)});function b(h){return h!==f&&(h===g.ENTER||f===g.SPACEBAR||a(f))}function a(h){return h===g.DELETE||h===g.BACKSPACE}c.onKeyUp.add(function(h,i){if(b(i.keyCode)||e.update_on_delete&&a(i.keyCode)){e._count(h)}f=i.keyCode})},_getCount:function(c){var a=0;var b=c.getContent({format:"raw"});if(b){b=b.replace(/\.\.\./g," ");b=b.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," ");b=b.replace(/(\w+)(&.+?;)+(\w+)/,"$1$3").replace(/&.+?;/g," ");b=b.replace(this.cleanre,"");var d=b.match(this.countre);if(d){a=d.length}}return a},_count:function(a){var b=this;if(b.block){return}b.block=1;setTimeout(function(){if(!a.destroyed){var c=b._getCount(a);tinymce.DOM.setHTML(b.id,c.toString());setTimeout(function(){b.block=0},b.update_rate)}},1)},getInfo:function(){return{longname:"Word Count plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("wordcount",tinymce.plugins.WordCount)})(); ================================================ FILE: static/js/tinymce/plugins/wordcount/editor_plugin_src.js ================================================ /** * editor_plugin_src.js * * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ (function() { tinymce.create('tinymce.plugins.WordCount', { block : 0, id : null, countre : null, cleanre : null, init : function(ed, url) { var t = this, last = 0, VK = tinymce.VK; t.countre = ed.getParam('wordcount_countregex', /[\w\u2019\'-]+/g); // u2019 == ’ t.cleanre = ed.getParam('wordcount_cleanregex', /[0-9.(),;:!?%#$?\'\"_+=\\\/-]*/g); t.update_rate = ed.getParam('wordcount_update_rate', 2000); t.update_on_delete = ed.getParam('wordcount_update_on_delete', false); t.id = ed.id + '-word-count'; ed.onPostRender.add(function(ed, cm) { var row, id; // Add it to the specified id or the theme advanced path id = ed.getParam('wordcount_target_id'); if (!id) { row = tinymce.DOM.get(ed.id + '_path_row'); if (row) tinymce.DOM.add(row.parentNode, 'div', {'style': 'float: right'}, ed.getLang('wordcount.words', 'Words: ') + '0'); } else { tinymce.DOM.add(id, 'span', {}, '0'); } }); ed.onInit.add(function(ed) { ed.selection.onSetContent.add(function() { t._count(ed); }); t._count(ed); }); ed.onSetContent.add(function(ed) { t._count(ed); }); function checkKeys(key) { return key !== last && (key === VK.ENTER || last === VK.SPACEBAR || checkDelOrBksp(last)); } function checkDelOrBksp(key) { return key === VK.DELETE || key === VK.BACKSPACE; } ed.onKeyUp.add(function(ed, e) { if (checkKeys(e.keyCode) || t.update_on_delete && checkDelOrBksp(e.keyCode)) { t._count(ed); } last = e.keyCode; }); }, _getCount : function(ed) { var tc = 0; var tx = ed.getContent({ format: 'raw' }); if (tx) { tx = tx.replace(/\.\.\./g, ' '); // convert ellipses to spaces tx = tx.replace(/<.[^<>]*?>/g, ' ').replace(/ | /gi, ' '); // remove html tags and space chars // deal with html entities tx = tx.replace(/(\w+)(&.+?;)+(\w+)/, "$1$3").replace(/&.+?;/g, ' '); tx = tx.replace(this.cleanre, ''); // remove numbers and punctuation var wordArray = tx.match(this.countre); if (wordArray) { tc = wordArray.length; } } return tc; }, _count : function(ed) { var t = this; // Keep multiple calls from happening at the same time if (t.block) return; t.block = 1; setTimeout(function() { if (!ed.destroyed) { var tc = t._getCount(ed); tinymce.DOM.setHTML(t.id, tc.toString()); setTimeout(function() {t.block = 0;}, t.update_rate); } }, 1); }, getInfo: function() { return { longname : 'Word Count plugin', author : 'Moxiecode Systems AB', authorurl : 'http://tinymce.moxiecode.com', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount', version : tinymce.majorVersion + "." + tinymce.minorVersion }; } }); tinymce.PluginManager.add('wordcount', tinymce.plugins.WordCount); })(); ================================================ FILE: static/js/tinymce/plugins/xhtmlxtras/abbr.htm ================================================ {#xhtmlxtras_dlg.title_abbr_element}
    {#xhtmlxtras_dlg.fieldset_attrib_tab}
    :
    :
    :
    :
    :
    :
    {#xhtmlxtras_dlg.fieldset_events_tab}
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    ================================================ FILE: static/js/tinymce/plugins/xhtmlxtras/acronym.htm ================================================ {#xhtmlxtras_dlg.title_acronym_element}
    {#xhtmlxtras_dlg.fieldset_attrib_tab}
    :
    :
    :
    :
    :
    :
    {#xhtmlxtras_dlg.fieldset_events_tab}
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    ================================================ FILE: static/js/tinymce/plugins/xhtmlxtras/attributes.htm ================================================ {#xhtmlxtras_dlg.attribs_title}
    {#xhtmlxtras_dlg.attribute_attrib_tab}
    :
    :
    :
    :
    :
    {#xhtmlxtras_dlg.attribute_events_tab}
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    ================================================ FILE: static/js/tinymce/plugins/xhtmlxtras/cite.htm ================================================ {#xhtmlxtras_dlg.title_cite_element}
    {#xhtmlxtras_dlg.fieldset_attrib_tab}
    :
    :
    :
    :
    :
    :
    {#xhtmlxtras_dlg.fieldset_events_tab}
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    ================================================ FILE: static/js/tinymce/plugins/xhtmlxtras/css/attributes.css ================================================ .panel_wrapper div.current { height: 290px; } #id, #style, #title, #dir, #hreflang, #lang, #classlist, #tabindex, #accesskey { width: 200px; } #events_panel input { width: 200px; } ================================================ FILE: static/js/tinymce/plugins/xhtmlxtras/css/popup.css ================================================ input.field, select.field {width:200px;} input.picker {width:179px; margin-left: 5px;} input.disabled {border-color:#F2F2F2;} img.picker {vertical-align:text-bottom; cursor:pointer;} h1 {padding: 0 0 5px 0;} .panel_wrapper div.current {height:160px;} #xhtmlxtrasdel .panel_wrapper div.current, #xhtmlxtrasins .panel_wrapper div.current {height: 230px;} a.browse span {display:block; width:20px; height:20px; background:url('../../../themes/advanced/img/icons.gif') -140px -20px;} #datetime {width:180px;} ================================================ FILE: static/js/tinymce/plugins/xhtmlxtras/del.htm ================================================ {#xhtmlxtras_dlg.title_del_element}
    {#xhtmlxtras_dlg.fieldset_general_tab}
    :
    :
    {#xhtmlxtras_dlg.fieldset_attrib_tab}
    :
    :
    :
    :
    :
    :
    {#xhtmlxtras_dlg.fieldset_events_tab}
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    ================================================ FILE: static/js/tinymce/plugins/xhtmlxtras/editor_plugin.js ================================================ (function(){tinymce.create("tinymce.plugins.XHTMLXtrasPlugin",{init:function(a,b){a.addCommand("mceCite",function(){a.windowManager.open({file:b+"/cite.htm",width:350+parseInt(a.getLang("xhtmlxtras.cite_delta_width",0)),height:250+parseInt(a.getLang("xhtmlxtras.cite_delta_height",0)),inline:1},{plugin_url:b})});a.addCommand("mceAcronym",function(){a.windowManager.open({file:b+"/acronym.htm",width:350+parseInt(a.getLang("xhtmlxtras.acronym_delta_width",0)),height:250+parseInt(a.getLang("xhtmlxtras.acronym_delta_height",0)),inline:1},{plugin_url:b})});a.addCommand("mceAbbr",function(){a.windowManager.open({file:b+"/abbr.htm",width:350+parseInt(a.getLang("xhtmlxtras.abbr_delta_width",0)),height:250+parseInt(a.getLang("xhtmlxtras.abbr_delta_height",0)),inline:1},{plugin_url:b})});a.addCommand("mceDel",function(){a.windowManager.open({file:b+"/del.htm",width:340+parseInt(a.getLang("xhtmlxtras.del_delta_width",0)),height:310+parseInt(a.getLang("xhtmlxtras.del_delta_height",0)),inline:1},{plugin_url:b})});a.addCommand("mceIns",function(){a.windowManager.open({file:b+"/ins.htm",width:340+parseInt(a.getLang("xhtmlxtras.ins_delta_width",0)),height:310+parseInt(a.getLang("xhtmlxtras.ins_delta_height",0)),inline:1},{plugin_url:b})});a.addCommand("mceAttributes",function(){a.windowManager.open({file:b+"/attributes.htm",width:380+parseInt(a.getLang("xhtmlxtras.attr_delta_width",0)),height:370+parseInt(a.getLang("xhtmlxtras.attr_delta_height",0)),inline:1},{plugin_url:b})});a.addButton("cite",{title:"xhtmlxtras.cite_desc",cmd:"mceCite"});a.addButton("acronym",{title:"xhtmlxtras.acronym_desc",cmd:"mceAcronym"});a.addButton("abbr",{title:"xhtmlxtras.abbr_desc",cmd:"mceAbbr"});a.addButton("del",{title:"xhtmlxtras.del_desc",cmd:"mceDel"});a.addButton("ins",{title:"xhtmlxtras.ins_desc",cmd:"mceIns"});a.addButton("attribs",{title:"xhtmlxtras.attribs_desc",cmd:"mceAttributes"});a.onNodeChange.add(function(d,c,f,e){f=d.dom.getParent(f,"CITE,ACRONYM,ABBR,DEL,INS");c.setDisabled("cite",e);c.setDisabled("acronym",e);c.setDisabled("abbr",e);c.setDisabled("del",e);c.setDisabled("ins",e);c.setDisabled("attribs",f&&f.nodeName=="BODY");c.setActive("cite",0);c.setActive("acronym",0);c.setActive("abbr",0);c.setActive("del",0);c.setActive("ins",0);if(f){do{c.setDisabled(f.nodeName.toLowerCase(),0);c.setActive(f.nodeName.toLowerCase(),1)}while(f=f.parentNode)}});a.onPreInit.add(function(){a.dom.create("abbr")})},getInfo:function(){return{longname:"XHTML Xtras Plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("xhtmlxtras",tinymce.plugins.XHTMLXtrasPlugin)})(); ================================================ FILE: static/js/tinymce/plugins/xhtmlxtras/editor_plugin_src.js ================================================ /** * editor_plugin_src.js * * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ (function() { tinymce.create('tinymce.plugins.XHTMLXtrasPlugin', { init : function(ed, url) { // Register commands ed.addCommand('mceCite', function() { ed.windowManager.open({ file : url + '/cite.htm', width : 350 + parseInt(ed.getLang('xhtmlxtras.cite_delta_width', 0)), height : 250 + parseInt(ed.getLang('xhtmlxtras.cite_delta_height', 0)), inline : 1 }, { plugin_url : url }); }); ed.addCommand('mceAcronym', function() { ed.windowManager.open({ file : url + '/acronym.htm', width : 350 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)), height : 250 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_height', 0)), inline : 1 }, { plugin_url : url }); }); ed.addCommand('mceAbbr', function() { ed.windowManager.open({ file : url + '/abbr.htm', width : 350 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)), height : 250 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_height', 0)), inline : 1 }, { plugin_url : url }); }); ed.addCommand('mceDel', function() { ed.windowManager.open({ file : url + '/del.htm', width : 340 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)), height : 310 + parseInt(ed.getLang('xhtmlxtras.del_delta_height', 0)), inline : 1 }, { plugin_url : url }); }); ed.addCommand('mceIns', function() { ed.windowManager.open({ file : url + '/ins.htm', width : 340 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)), height : 310 + parseInt(ed.getLang('xhtmlxtras.ins_delta_height', 0)), inline : 1 }, { plugin_url : url }); }); ed.addCommand('mceAttributes', function() { ed.windowManager.open({ file : url + '/attributes.htm', width : 380 + parseInt(ed.getLang('xhtmlxtras.attr_delta_width', 0)), height : 370 + parseInt(ed.getLang('xhtmlxtras.attr_delta_height', 0)), inline : 1 }, { plugin_url : url }); }); // Register buttons ed.addButton('cite', {title : 'xhtmlxtras.cite_desc', cmd : 'mceCite'}); ed.addButton('acronym', {title : 'xhtmlxtras.acronym_desc', cmd : 'mceAcronym'}); ed.addButton('abbr', {title : 'xhtmlxtras.abbr_desc', cmd : 'mceAbbr'}); ed.addButton('del', {title : 'xhtmlxtras.del_desc', cmd : 'mceDel'}); ed.addButton('ins', {title : 'xhtmlxtras.ins_desc', cmd : 'mceIns'}); ed.addButton('attribs', {title : 'xhtmlxtras.attribs_desc', cmd : 'mceAttributes'}); ed.onNodeChange.add(function(ed, cm, n, co) { n = ed.dom.getParent(n, 'CITE,ACRONYM,ABBR,DEL,INS'); cm.setDisabled('cite', co); cm.setDisabled('acronym', co); cm.setDisabled('abbr', co); cm.setDisabled('del', co); cm.setDisabled('ins', co); cm.setDisabled('attribs', n && n.nodeName == 'BODY'); cm.setActive('cite', 0); cm.setActive('acronym', 0); cm.setActive('abbr', 0); cm.setActive('del', 0); cm.setActive('ins', 0); // Activate all if (n) { do { cm.setDisabled(n.nodeName.toLowerCase(), 0); cm.setActive(n.nodeName.toLowerCase(), 1); } while (n = n.parentNode); } }); ed.onPreInit.add(function() { // Fixed IE issue where it can't handle these elements correctly ed.dom.create('abbr'); }); }, getInfo : function() { return { longname : 'XHTML Xtras Plugin', author : 'Moxiecode Systems AB', authorurl : 'http://tinymce.moxiecode.com', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras', version : tinymce.majorVersion + "." + tinymce.minorVersion }; } }); // Register plugin tinymce.PluginManager.add('xhtmlxtras', tinymce.plugins.XHTMLXtrasPlugin); })(); ================================================ FILE: static/js/tinymce/plugins/xhtmlxtras/ins.htm ================================================ {#xhtmlxtras_dlg.title_ins_element}
    {#xhtmlxtras_dlg.fieldset_general_tab}
    :
    :
    {#xhtmlxtras_dlg.fieldset_attrib_tab}
    :
    :
    :
    :
    :
    :
    {#xhtmlxtras_dlg.fieldset_events_tab}
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    ================================================ FILE: static/js/tinymce/plugins/xhtmlxtras/js/abbr.js ================================================ /** * abbr.js * * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ function init() { SXE.initElementDialog('abbr'); if (SXE.currentAction == "update") { SXE.showRemoveButton(); } } function insertAbbr() { SXE.insertElement('abbr'); tinyMCEPopup.close(); } function removeAbbr() { SXE.removeElement('abbr'); tinyMCEPopup.close(); } tinyMCEPopup.onInit.add(init); ================================================ FILE: static/js/tinymce/plugins/xhtmlxtras/js/acronym.js ================================================ /** * acronym.js * * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ function init() { SXE.initElementDialog('acronym'); if (SXE.currentAction == "update") { SXE.showRemoveButton(); } } function insertAcronym() { SXE.insertElement('acronym'); tinyMCEPopup.close(); } function removeAcronym() { SXE.removeElement('acronym'); tinyMCEPopup.close(); } tinyMCEPopup.onInit.add(init); ================================================ FILE: static/js/tinymce/plugins/xhtmlxtras/js/attributes.js ================================================ /** * attributes.js * * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ function init() { tinyMCEPopup.resizeToInnerSize(); var inst = tinyMCEPopup.editor; var dom = inst.dom; var elm = inst.selection.getNode(); var f = document.forms[0]; var onclick = dom.getAttrib(elm, 'onclick'); setFormValue('title', dom.getAttrib(elm, 'title')); setFormValue('id', dom.getAttrib(elm, 'id')); setFormValue('style', dom.getAttrib(elm, "style")); setFormValue('dir', dom.getAttrib(elm, 'dir')); setFormValue('lang', dom.getAttrib(elm, 'lang')); setFormValue('tabindex', dom.getAttrib(elm, 'tabindex', typeof(elm.tabindex) != "undefined" ? elm.tabindex : "")); setFormValue('accesskey', dom.getAttrib(elm, 'accesskey', typeof(elm.accesskey) != "undefined" ? elm.accesskey : "")); setFormValue('onfocus', dom.getAttrib(elm, 'onfocus')); setFormValue('onblur', dom.getAttrib(elm, 'onblur')); setFormValue('onclick', onclick); setFormValue('ondblclick', dom.getAttrib(elm, 'ondblclick')); setFormValue('onmousedown', dom.getAttrib(elm, 'onmousedown')); setFormValue('onmouseup', dom.getAttrib(elm, 'onmouseup')); setFormValue('onmouseover', dom.getAttrib(elm, 'onmouseover')); setFormValue('onmousemove', dom.getAttrib(elm, 'onmousemove')); setFormValue('onmouseout', dom.getAttrib(elm, 'onmouseout')); setFormValue('onkeypress', dom.getAttrib(elm, 'onkeypress')); setFormValue('onkeydown', dom.getAttrib(elm, 'onkeydown')); setFormValue('onkeyup', dom.getAttrib(elm, 'onkeyup')); className = dom.getAttrib(elm, 'class'); addClassesToList('classlist', 'advlink_styles'); selectByValue(f, 'classlist', className, true); TinyMCE_EditableSelects.init(); } function setFormValue(name, value) { if(value && document.forms[0].elements[name]){ document.forms[0].elements[name].value = value; } } function insertAction() { var inst = tinyMCEPopup.editor; var elm = inst.selection.getNode(); setAllAttribs(elm); tinyMCEPopup.execCommand("mceEndUndoLevel"); tinyMCEPopup.close(); } function setAttrib(elm, attrib, value) { var formObj = document.forms[0]; var valueElm = formObj.elements[attrib.toLowerCase()]; var inst = tinyMCEPopup.editor; var dom = inst.dom; if (typeof(value) == "undefined" || value == null) { value = ""; if (valueElm) value = valueElm.value; } dom.setAttrib(elm, attrib.toLowerCase(), value); } function setAllAttribs(elm) { var f = document.forms[0]; setAttrib(elm, 'title'); setAttrib(elm, 'id'); setAttrib(elm, 'style'); setAttrib(elm, 'class', getSelectValue(f, 'classlist')); setAttrib(elm, 'dir'); setAttrib(elm, 'lang'); setAttrib(elm, 'tabindex'); setAttrib(elm, 'accesskey'); setAttrib(elm, 'onfocus'); setAttrib(elm, 'onblur'); setAttrib(elm, 'onclick'); setAttrib(elm, 'ondblclick'); setAttrib(elm, 'onmousedown'); setAttrib(elm, 'onmouseup'); setAttrib(elm, 'onmouseover'); setAttrib(elm, 'onmousemove'); setAttrib(elm, 'onmouseout'); setAttrib(elm, 'onkeypress'); setAttrib(elm, 'onkeydown'); setAttrib(elm, 'onkeyup'); // Refresh in old MSIE // if (tinyMCE.isMSIE5) // elm.outerHTML = elm.outerHTML; } function insertAttribute() { tinyMCEPopup.close(); } tinyMCEPopup.onInit.add(init); tinyMCEPopup.requireLangPack(); ================================================ FILE: static/js/tinymce/plugins/xhtmlxtras/js/cite.js ================================================ /** * cite.js * * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ function init() { SXE.initElementDialog('cite'); if (SXE.currentAction == "update") { SXE.showRemoveButton(); } } function insertCite() { SXE.insertElement('cite'); tinyMCEPopup.close(); } function removeCite() { SXE.removeElement('cite'); tinyMCEPopup.close(); } tinyMCEPopup.onInit.add(init); ================================================ FILE: static/js/tinymce/plugins/xhtmlxtras/js/del.js ================================================ /** * del.js * * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ function init() { SXE.initElementDialog('del'); if (SXE.currentAction == "update") { setFormValue('datetime', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'datetime')); setFormValue('cite', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'cite')); SXE.showRemoveButton(); } } function setElementAttribs(elm) { setAllCommonAttribs(elm); setAttrib(elm, 'datetime'); setAttrib(elm, 'cite'); elm.removeAttribute('data-mce-new'); } function insertDel() { var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'DEL'); if (elm == null) { var s = SXE.inst.selection.getContent(); if(s.length > 0) { insertInlineElement('del'); var elementArray = SXE.inst.dom.select('del[data-mce-new]'); for (var i=0; i 0) { tagName = element_name; insertInlineElement(element_name); var elementArray = tinymce.grep(SXE.inst.dom.select(element_name)); for (var i=0; i -1) ? true : false; } SXE.removeClass = function(elm,cl) { if(elm.className == null || elm.className == "" || !SXE.containsClass(elm,cl)) { return true; } var classNames = elm.className.split(" "); var newClassNames = ""; for (var x = 0, cnl = classNames.length; x < cnl; x++) { if (classNames[x] != cl) { newClassNames += (classNames[x] + " "); } } elm.className = newClassNames.substring(0,newClassNames.length-1); //removes extra space at the end } SXE.addClass = function(elm,cl) { if(!SXE.containsClass(elm,cl)) elm.className ? elm.className += " " + cl : elm.className = cl; return true; } function insertInlineElement(en) { var ed = tinyMCEPopup.editor, dom = ed.dom; ed.getDoc().execCommand('FontName', false, 'mceinline'); tinymce.each(dom.select('span,font'), function(n) { if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline') dom.replace(dom.create(en, {'data-mce-new' : 1}), n, 1); }); } ================================================ FILE: static/js/tinymce/plugins/xhtmlxtras/js/ins.js ================================================ /** * ins.js * * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ function init() { SXE.initElementDialog('ins'); if (SXE.currentAction == "update") { setFormValue('datetime', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'datetime')); setFormValue('cite', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'cite')); SXE.showRemoveButton(); } } function setElementAttribs(elm) { setAllCommonAttribs(elm); setAttrib(elm, 'datetime'); setAttrib(elm, 'cite'); elm.removeAttribute('data-mce-new'); } function insertIns() { var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'INS'); if (elm == null) { var s = SXE.inst.selection.getContent(); if(s.length > 0) { insertInlineElement('ins'); var elementArray = SXE.inst.dom.select('ins[data-mce-new]'); for (var i=0; i {#advanced_dlg.about_title}

    {#advanced_dlg.about_title}

    Version: ()

    TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under LGPL by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.

    Copyright © 2003-2008, Moxiecode Systems AB, All rights reserved.

    For more information about this software visit the TinyMCE website.

    Got Moxie?

    {#advanced_dlg.about_loaded}

     

    ================================================ FILE: static/js/tinymce/themes/advanced/anchor.htm ================================================ {#advanced_dlg.anchor_title}
    {#advanced_dlg.anchor_title}
    ================================================ FILE: static/js/tinymce/themes/advanced/charmap.htm ================================================ {#advanced_dlg.charmap_title}
     
     
     
     
     
    {#advanced_dlg.charmap_usage}
    ================================================ FILE: static/js/tinymce/themes/advanced/color_picker.htm ================================================ {#advanced_dlg.colorpicker_title}
    {#advanced_dlg.colorpicker_picker_title}

    {#advanced_dlg.colorpicker_palette_title}

    {#advanced_dlg.colorpicker_named_title}

    {#advanced_dlg.colorpicker_name}
    ================================================ FILE: static/js/tinymce/themes/advanced/editor_template.js ================================================ (function(h){var i=h.DOM,g=h.dom.Event,c=h.extend,f=h.each,a=h.util.Cookie,e,d=h.explode;function b(p,m){var k,l,o=p.dom,j="",n,r;previewStyles=p.settings.preview_styles;if(previewStyles===false){return""}if(!previewStyles){previewStyles="font-family font-size font-weight text-decoration text-transform color background-color"}function q(s){return s.replace(/%(\w+)/g,"")}k=m.block||m.inline||"span";l=o.create(k);f(m.styles,function(t,s){t=q(t);if(t){o.setStyle(l,s,t)}});f(m.attributes,function(t,s){t=q(t);if(t){o.setAttrib(l,s,t)}});f(m.classes,function(s){s=q(s);if(!o.hasClass(l,s)){o.addClass(l,s)}});o.setStyles(l,{position:"absolute",left:-65535});p.getBody().appendChild(l);n=o.getStyle(p.getBody(),"fontSize",true);n=/px$/.test(n)?parseInt(n,10):0;f(previewStyles.split(" "),function(s){var t=o.getStyle(l,s,true);if(s=="background-color"&&/transparent|rgba\s*\([^)]+,\s*0\)/.test(t)){t=o.getStyle(p.getBody(),s,true);if(o.toHex(t).toLowerCase()=="#ffffff"){return}}if(s=="font-size"){if(/em|%$/.test(t)){if(n===0){return}t=parseFloat(t,10)/(/%$/.test(t)?100:1);t=(t*n)+"px"}}j+=s+":"+t+";"});o.remove(l);return j}h.ThemeManager.requireLangPack("advanced");h.create("tinymce.themes.AdvancedTheme",{sizes:[8,10,12,14,18,24,36],controls:{bold:["bold_desc","Bold"],italic:["italic_desc","Italic"],underline:["underline_desc","Underline"],strikethrough:["striketrough_desc","Strikethrough"],justifyleft:["justifyleft_desc","JustifyLeft"],justifycenter:["justifycenter_desc","JustifyCenter"],justifyright:["justifyright_desc","JustifyRight"],justifyfull:["justifyfull_desc","JustifyFull"],bullist:["bullist_desc","InsertUnorderedList"],numlist:["numlist_desc","InsertOrderedList"],outdent:["outdent_desc","Outdent"],indent:["indent_desc","Indent"],cut:["cut_desc","Cut"],copy:["copy_desc","Copy"],paste:["paste_desc","Paste"],undo:["undo_desc","Undo"],redo:["redo_desc","Redo"],link:["link_desc","mceLink"],unlink:["unlink_desc","unlink"],image:["image_desc","mceImage"],cleanup:["cleanup_desc","mceCleanup"],help:["help_desc","mceHelp"],code:["code_desc","mceCodeEditor"],hr:["hr_desc","InsertHorizontalRule"],removeformat:["removeformat_desc","RemoveFormat"],sub:["sub_desc","subscript"],sup:["sup_desc","superscript"],forecolor:["forecolor_desc","ForeColor"],forecolorpicker:["forecolor_desc","mceForeColor"],backcolor:["backcolor_desc","HiliteColor"],backcolorpicker:["backcolor_desc","mceBackColor"],charmap:["charmap_desc","mceCharMap"],visualaid:["visualaid_desc","mceToggleVisualAid"],anchor:["anchor_desc","mceInsertAnchor"],newdocument:["newdocument_desc","mceNewDocument"],blockquote:["blockquote_desc","mceBlockQuote"]},stateControls:["bold","italic","underline","strikethrough","bullist","numlist","justifyleft","justifycenter","justifyright","justifyfull","sub","sup","blockquote"],init:function(k,l){var m=this,n,j,p;m.editor=k;m.url=l;m.onResolveName=new h.util.Dispatcher(this);n=k.settings;k.forcedHighContrastMode=k.settings.detect_highcontrast&&m._isHighContrast();k.settings.skin=k.forcedHighContrastMode?"highcontrast":k.settings.skin;if(!n.theme_advanced_buttons1){n=c({theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap"},n)}m.settings=n=c({theme_advanced_path:true,theme_advanced_toolbar_location:"top",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"left",theme_advanced_statusbar_location:"bottom",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1,theme_advanced_font_sizes:"1,2,3,4,5,6,7",theme_advanced_font_selector:"span",theme_advanced_show_current_color:0,readonly:k.settings.readonly},n);if(!n.font_size_style_values){n.font_size_style_values="8pt,10pt,12pt,14pt,18pt,24pt,36pt"}if(h.is(n.theme_advanced_font_sizes,"string")){n.font_size_style_values=h.explode(n.font_size_style_values);n.font_size_classes=h.explode(n.font_size_classes||"");p={};k.settings.theme_advanced_font_sizes=n.theme_advanced_font_sizes;f(k.getParam("theme_advanced_font_sizes","","hash"),function(r,q){var o;if(q==r&&r>=1&&r<=7){q=r+" ("+m.sizes[r-1]+"pt)";o=n.font_size_classes[r-1];r=n.font_size_style_values[r-1]||(m.sizes[r-1]+"pt")}if(/^\s*\./.test(r)){o=r.replace(/\./g,"")}p[q]=o?{"class":o}:{fontSize:r}});n.theme_advanced_font_sizes=p}if((j=n.theme_advanced_path_location)&&j!="none"){n.theme_advanced_statusbar_location=n.theme_advanced_path_location}if(n.theme_advanced_statusbar_location=="none"){n.theme_advanced_statusbar_location=0}if(k.settings.content_css!==false){k.contentCSS.push(k.baseURI.toAbsolute(l+"/skins/"+k.settings.skin+"/content.css"))}k.onInit.add(function(){if(!k.settings.readonly){k.onNodeChange.add(m._nodeChanged,m);k.onKeyUp.add(m._updateUndoStatus,m);k.onMouseUp.add(m._updateUndoStatus,m);k.dom.bind(k.dom.getRoot(),"dragend",function(){m._updateUndoStatus(k)})}});k.onSetProgressState.add(function(r,o,s){var t,u=r.id,q;if(o){m.progressTimer=setTimeout(function(){t=r.getContainer();t=t.insertBefore(i.create("DIV",{style:"position:relative"}),t.firstChild);q=i.get(r.id+"_tbl");i.add(t,"div",{id:u+"_blocker","class":"mceBlocker",style:{width:q.clientWidth+2,height:q.clientHeight+2}});i.add(t,"div",{id:u+"_progress","class":"mceProgress",style:{left:q.clientWidth/2,top:q.clientHeight/2}})},s||0)}else{i.remove(u+"_blocker");i.remove(u+"_progress");clearTimeout(m.progressTimer)}});i.loadCSS(n.editor_css?k.documentBaseURI.toAbsolute(n.editor_css):l+"/skins/"+k.settings.skin+"/ui.css");if(n.skin_variant){i.loadCSS(l+"/skins/"+k.settings.skin+"/ui_"+n.skin_variant+".css")}},_isHighContrast:function(){var j,k=i.add(i.getRoot(),"div",{style:"background-color: rgb(171,239,86);"});j=(i.getStyle(k,"background-color",true)+"").toLowerCase().replace(/ /g,"");i.remove(k);return j!="rgb(171,239,86)"&&j!="#abef56"},createControl:function(m,j){var k,l;if(l=j.createControl(m)){return l}switch(m){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu()}if((k=this.controls[m])){return j.createButton(m,{title:"advanced."+k[0],cmd:k[1],ui:k[2],value:k[3]})}},execCommand:function(l,k,m){var j=this["_"+l];if(j){j.call(this,k,m);return true}return false},_importClasses:function(l){var j=this.editor,k=j.controlManager.get("styleselect");if(k.getLength()==0){f(j.dom.getClasses(),function(q,m){var p="style_"+m,n;n={inline:"span",attributes:{"class":q["class"]},selector:"*"};j.formatter.register(p,n);k.add(q["class"],p,{style:function(){return b(j,n)}})})}},_createStyleSelect:function(o){var l=this,j=l.editor,k=j.controlManager,m;m=k.createListBox("styleselect",{title:"advanced.style_select",onselect:function(q){var r,n=[],p;f(m.items,function(s){n.push(s.value)});j.focus();j.undoManager.add();r=j.formatter.matchAll(n);h.each(r,function(s){if(!q||s==q){if(s){j.formatter.remove(s)}p=true}});if(!p){j.formatter.apply(q)}j.undoManager.add();j.nodeChanged();return false}});j.onPreInit.add(function(){var p=0,n=j.getParam("style_formats");if(n){f(n,function(q){var r,s=0;f(q,function(){s++});if(s>1){r=q.name=q.name||"style_"+(p++);j.formatter.register(r,q);m.add(q.title,r,{style:function(){return b(j,q)}})}else{m.add(q.title)}})}else{f(j.getParam("theme_advanced_styles","","hash"),function(t,s){var r,q;if(t){r="style_"+(p++);q={inline:"span",classes:t,selector:"*"};j.formatter.register(r,q);m.add(l.editor.translate(s),r,{style:function(){return b(j,q)}})}})}});if(m.getLength()==0){m.onPostRender.add(function(p,q){if(!m.NativeListBox){g.add(q.id+"_text","focus",l._importClasses,l);g.add(q.id+"_text","mousedown",l._importClasses,l);g.add(q.id+"_open","focus",l._importClasses,l);g.add(q.id+"_open","mousedown",l._importClasses,l)}else{g.add(q.id,"focus",l._importClasses,l)}})}return m},_createFontSelect:function(){var l,k=this,j=k.editor;l=j.controlManager.createListBox("fontselect",{title:"advanced.fontdefault",onselect:function(m){var n=l.items[l.selectedIndex];if(!m&&n){j.execCommand("FontName",false,n.value);return}j.execCommand("FontName",false,m);l.select(function(o){return m==o});if(n&&n.value==m){l.select(null)}return false}});if(l){f(j.getParam("theme_advanced_fonts",k.settings.theme_advanced_fonts,"hash"),function(n,m){l.add(j.translate(m),n,{style:n.indexOf("dings")==-1?"font-family:"+n:""})})}return l},_createFontSizeSelect:function(){var m=this,k=m.editor,n,l=0,j=[];n=k.controlManager.createListBox("fontsizeselect",{title:"advanced.font_size",onselect:function(o){var p=n.items[n.selectedIndex];if(!o&&p){p=p.value;if(p["class"]){k.formatter.toggle("fontsize_class",{value:p["class"]});k.undoManager.add();k.nodeChanged()}else{k.execCommand("FontSize",false,p.fontSize)}return}if(o["class"]){k.focus();k.undoManager.add();k.formatter.toggle("fontsize_class",{value:o["class"]});k.undoManager.add();k.nodeChanged()}else{k.execCommand("FontSize",false,o.fontSize)}n.select(function(q){return o==q});if(p&&(p.value.fontSize==o.fontSize||p.value["class"]&&p.value["class"]==o["class"])){n.select(null)}return false}});if(n){f(m.settings.theme_advanced_font_sizes,function(p,o){var q=p.fontSize;if(q>=1&&q<=7){q=m.sizes[parseInt(q)-1]+"pt"}n.add(o,p,{style:"font-size:"+q,"class":"mceFontSize"+(l++)+(" "+(p["class"]||""))})})}return n},_createBlockFormats:function(){var l,j={p:"advanced.paragraph",address:"advanced.address",pre:"advanced.pre",h1:"advanced.h1",h2:"advanced.h2",h3:"advanced.h3",h4:"advanced.h4",h5:"advanced.h5",h6:"advanced.h6",div:"advanced.div",blockquote:"advanced.blockquote",code:"advanced.code",dt:"advanced.dt",dd:"advanced.dd",samp:"advanced.samp"},k=this;l=k.editor.controlManager.createListBox("formatselect",{title:"advanced.block",onselect:function(m){k.editor.execCommand("FormatBlock",false,m);return false}});if(l){f(k.editor.getParam("theme_advanced_blockformats",k.settings.theme_advanced_blockformats,"hash"),function(n,m){l.add(k.editor.translate(m!=n?m:j[n]),n,{"class":"mce_formatPreview mce_"+n,style:function(){return b(k.editor,{block:n})}})})}return l},_createForeColorMenu:function(){var n,k=this,l=k.settings,m={},j;if(l.theme_advanced_more_colors){m.more_colors_func=function(){k._mceColorPicker(0,{color:n.value,func:function(o){n.setColor(o)}})}}if(j=l.theme_advanced_text_colors){m.colors=j}if(l.theme_advanced_default_foreground_color){m.default_color=l.theme_advanced_default_foreground_color}m.title="advanced.forecolor_desc";m.cmd="ForeColor";m.scope=this;n=k.editor.controlManager.createColorSplitButton("forecolor",m);return n},_createBackColorMenu:function(){var n,k=this,l=k.settings,m={},j;if(l.theme_advanced_more_colors){m.more_colors_func=function(){k._mceColorPicker(0,{color:n.value,func:function(o){n.setColor(o)}})}}if(j=l.theme_advanced_background_colors){m.colors=j}if(l.theme_advanced_default_background_color){m.default_color=l.theme_advanced_default_background_color}m.title="advanced.backcolor_desc";m.cmd="HiliteColor";m.scope=this;n=k.editor.controlManager.createColorSplitButton("backcolor",m);return n},renderUI:function(l){var q,m,r,w=this,u=w.editor,x=w.settings,v,k,j;if(u.settings){u.settings.aria_label=x.aria_label+u.getLang("advanced.help_shortcut")}q=k=i.create("span",{role:"application","aria-labelledby":u.id+"_voice",id:u.id+"_parent","class":"mceEditor "+u.settings.skin+"Skin"+(x.skin_variant?" "+u.settings.skin+"Skin"+w._ufirst(x.skin_variant):"")+(u.settings.directionality=="rtl"?" mceRtl":"")});i.add(q,"span",{"class":"mceVoiceLabel",style:"display:none;",id:u.id+"_voice"},x.aria_label);if(!i.boxModel){q=i.add(q,"div",{"class":"mceOldBoxModel"})}q=v=i.add(q,"table",{role:"presentation",id:u.id+"_tbl","class":"mceLayout",cellSpacing:0,cellPadding:0});q=r=i.add(q,"tbody");switch((x.theme_advanced_layout_manager||"").toLowerCase()){case"rowlayout":m=w._rowLayout(x,r,l);break;case"customlayout":m=u.execCallback("theme_advanced_custom_layout",x,r,l,k);break;default:m=w._simpleLayout(x,r,l,k)}q=l.targetNode;j=v.rows;i.addClass(j[0],"mceFirst");i.addClass(j[j.length-1],"mceLast");f(i.select("tr",r),function(o){i.addClass(o.firstChild,"mceFirst");i.addClass(o.childNodes[o.childNodes.length-1],"mceLast")});if(i.get(x.theme_advanced_toolbar_container)){i.get(x.theme_advanced_toolbar_container).appendChild(k)}else{i.insertAfter(k,q)}g.add(u.id+"_path_row","click",function(n){n=n.target;if(n.nodeName=="A"){w._sel(n.className.replace(/^.*mcePath_([0-9]+).*$/,"$1"));return false}});if(!u.getParam("accessibility_focus")){g.add(i.add(k,"a",{href:"#"},""),"focus",function(){tinyMCE.get(u.id).focus()})}if(x.theme_advanced_toolbar_location=="external"){l.deltaHeight=0}w.deltaHeight=l.deltaHeight;l.targetNode=null;u.onKeyDown.add(function(p,n){var s=121,o=122;if(n.altKey){if(n.keyCode===s){if(h.isWebKit){window.focus()}w.toolbarGroup.focus();return g.cancel(n)}else{if(n.keyCode===o){i.get(p.id+"_path_row").focus();return g.cancel(n)}}}});u.addShortcut("alt+0","","mceShortcuts",w);return{iframeContainer:m,editorContainer:u.id+"_parent",sizeContainer:v,deltaHeight:l.deltaHeight}},getInfo:function(){return{longname:"Advanced theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:h.majorVersion+"."+h.minorVersion}},resizeBy:function(j,k){var l=i.get(this.editor.id+"_ifr");this.resizeTo(l.clientWidth+j,l.clientHeight+k)},resizeTo:function(j,n,l){var k=this.editor,m=this.settings,o=i.get(k.id+"_tbl"),p=i.get(k.id+"_ifr");j=Math.max(m.theme_advanced_resizing_min_width||100,j);n=Math.max(m.theme_advanced_resizing_min_height||100,n);j=Math.min(m.theme_advanced_resizing_max_width||65535,j);n=Math.min(m.theme_advanced_resizing_max_height||65535,n);i.setStyle(o,"height","");i.setStyle(p,"height",n);if(m.theme_advanced_resize_horizontal){i.setStyle(o,"width","");i.setStyle(p,"width",j);if(j"));i.setHTML(l,r.join(""))},_addStatusBar:function(p,k){var l,w=this,q=w.editor,x=w.settings,j,u,v,m;l=i.add(p,"tr");l=m=i.add(l,"td",{"class":"mceStatusbar"});l=i.add(l,"div",{id:q.id+"_path_row",role:"group","aria-labelledby":q.id+"_path_voice"});if(x.theme_advanced_path){i.add(l,"span",{id:q.id+"_path_voice"},q.translate("advanced.path"));i.add(l,"span",{},": ")}else{i.add(l,"span",{}," ")}if(x.theme_advanced_resizing){i.add(m,"a",{id:q.id+"_resize",href:"javascript:;",onclick:"return false;","class":"mceResize",tabIndex:"-1"});if(x.theme_advanced_resizing_use_cookie){q.onPostRender.add(function(){var n=a.getHash("TinyMCE_"+q.id+"_size"),r=i.get(q.id+"_tbl");if(!n){return}w.resizeTo(n.cw,n.ch)})}q.onPostRender.add(function(){g.add(q.id+"_resize","click",function(n){n.preventDefault()});g.add(q.id+"_resize","mousedown",function(E){var t,r,s,o,D,A,B,G,n,F,y;function z(H){H.preventDefault();n=B+(H.screenX-D);F=G+(H.screenY-A);w.resizeTo(n,F)}function C(H){g.remove(i.doc,"mousemove",t);g.remove(q.getDoc(),"mousemove",r);g.remove(i.doc,"mouseup",s);g.remove(q.getDoc(),"mouseup",o);n=B+(H.screenX-D);F=G+(H.screenY-A);w.resizeTo(n,F,true);q.nodeChanged()}E.preventDefault();D=E.screenX;A=E.screenY;y=i.get(w.editor.id+"_ifr");B=n=y.clientWidth;G=F=y.clientHeight;t=g.add(i.doc,"mousemove",z);r=g.add(q.getDoc(),"mousemove",z);s=g.add(i.doc,"mouseup",C);o=g.add(q.getDoc(),"mouseup",C)})})}k.deltaHeight-=21;l=p=null},_updateUndoStatus:function(k){var j=k.controlManager,l=k.undoManager;j.setDisabled("undo",!l.hasUndo()&&!l.typing);j.setDisabled("redo",!l.hasRedo())},_nodeChanged:function(o,u,E,r,F){var z=this,D,G=0,y,H,A=z.settings,x,l,w,C,m,k,j;h.each(z.stateControls,function(n){u.setActive(n,o.queryCommandState(z.controls[n][1]))});function q(p){var s,n=F.parents,t=p;if(typeof(p)=="string"){t=function(v){return v.nodeName==p}}for(s=0;s0){H.mark(p)}})}if(H=u.get("formatselect")){D=q(o.dom.isBlock);if(D){H.select(D.nodeName.toLowerCase())}}q(function(p){if(p.nodeName==="SPAN"){if(!x&&p.className){x=p.className}}if(o.dom.is(p,A.theme_advanced_font_selector)){if(!l&&p.style.fontSize){l=p.style.fontSize}if(!w&&p.style.fontFamily){w=p.style.fontFamily.replace(/[\"\']+/g,"").replace(/^([^,]+).*/,"$1").toLowerCase()}if(!C&&p.style.color){C=p.style.color}if(!m&&p.style.backgroundColor){m=p.style.backgroundColor}}return false});if(H=u.get("fontselect")){H.select(function(n){return n.replace(/^([^,]+).*/,"$1").toLowerCase()==w})}if(H=u.get("fontsizeselect")){if(A.theme_advanced_runtime_fontsize&&!l&&!x){l=o.dom.getStyle(E,"fontSize",true)}H.select(function(n){if(n.fontSize&&n.fontSize===l){return true}if(n["class"]&&n["class"]===x){return true}})}if(A.theme_advanced_show_current_color){function B(p,n){if(H=u.get(p)){if(!n){n=H.settings.default_color}if(n!==H.value){H.displayColor(n)}}}B("forecolor",C);B("backcolor",m)}if(A.theme_advanced_show_current_color){function B(p,n){if(H=u.get(p)){if(!n){n=H.settings.default_color}if(n!==H.value){H.displayColor(n)}}}B("forecolor",C);B("backcolor",m)}if(A.theme_advanced_path&&A.theme_advanced_statusbar_location){D=i.get(o.id+"_path")||i.add(o.id+"_path_row","span",{id:o.id+"_path"});if(z.statusKeyboardNavigation){z.statusKeyboardNavigation.destroy();z.statusKeyboardNavigation=null}i.setHTML(D,"");q(function(I){var p=I.nodeName.toLowerCase(),s,v,t="";if(I.nodeType!=1||p==="br"||I.getAttribute("data-mce-bogus")||i.hasClass(I,"mceItemHidden")||i.hasClass(I,"mceItemRemoved")){return}if(h.isIE&&I.scopeName!=="HTML"&&I.scopeName){p=I.scopeName+":"+p}p=p.replace(/mce\:/g,"");switch(p){case"b":p="strong";break;case"i":p="em";break;case"img":if(y=i.getAttrib(I,"src")){t+="src: "+y+" "}break;case"a":if(y=i.getAttrib(I,"name")){t+="name: "+y+" ";p+="#"+y}if(y=i.getAttrib(I,"href")){t+="href: "+y+" "}break;case"font":if(y=i.getAttrib(I,"face")){t+="font: "+y+" "}if(y=i.getAttrib(I,"size")){t+="size: "+y+" "}if(y=i.getAttrib(I,"color")){t+="color: "+y+" "}break;case"span":if(y=i.getAttrib(I,"style")){t+="style: "+y+" "}break}if(y=i.getAttrib(I,"id")){t+="id: "+y+" "}if(y=I.className){y=y.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g,"");if(y){t+="class: "+y+" ";if(o.dom.isBlock(I)||p=="img"||p=="span"){p+="."+y}}}p=p.replace(/(html:)/g,"");p={name:p,node:I,title:t};z.onResolveName.dispatch(z,p);t=p.title;p=p.name;v=i.create("a",{href:"javascript:;",role:"button",onmousedown:"return false;",title:t,"class":"mcePath_"+(G++)},p);if(D.hasChildNodes()){D.insertBefore(i.create("span",{"aria-hidden":"true"},"\u00a0\u00bb "),D.firstChild);D.insertBefore(v,D.firstChild)}else{D.appendChild(v)}},o.getBody());if(i.select("a",D).length>0){z.statusKeyboardNavigation=new h.ui.KeyboardNavigation({root:o.id+"_path_row",items:i.select("a",D),excludeFromTabOrder:true,onCancel:function(){o.focus()}},i)}}},_sel:function(j){this.editor.execCommand("mceSelectNodeDepth",false,j)},_mceInsertAnchor:function(l,k){var j=this.editor;j.windowManager.open({url:this.url+"/anchor.htm",width:320+parseInt(j.getLang("advanced.anchor_delta_width",0)),height:90+parseInt(j.getLang("advanced.anchor_delta_height",0)),inline:true},{theme_url:this.url})},_mceCharMap:function(){var j=this.editor;j.windowManager.open({url:this.url+"/charmap.htm",width:550+parseInt(j.getLang("advanced.charmap_delta_width",0)),height:265+parseInt(j.getLang("advanced.charmap_delta_height",0)),inline:true},{theme_url:this.url})},_mceHelp:function(){var j=this.editor;j.windowManager.open({url:this.url+"/about.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceShortcuts:function(){var j=this.editor;j.windowManager.open({url:this.url+"/shortcuts.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceColorPicker:function(l,k){var j=this.editor;k=k||{};j.windowManager.open({url:this.url+"/color_picker.htm",width:375+parseInt(j.getLang("advanced.colorpicker_delta_width",0)),height:250+parseInt(j.getLang("advanced.colorpicker_delta_height",0)),close_previous:false,inline:true},{input_color:k.color,func:k.func,theme_url:this.url})},_mceCodeEditor:function(k,l){var j=this.editor;j.windowManager.open({url:this.url+"/source_editor.htm",width:parseInt(j.getParam("theme_advanced_source_editor_width",720)),height:parseInt(j.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url})},_mceImage:function(k,l){var j=this.editor;if(j.dom.getAttrib(j.selection.getNode(),"class","").indexOf("mceItem")!=-1){return}j.windowManager.open({url:this.url+"/image.htm",width:355+parseInt(j.getLang("advanced.image_delta_width",0)),height:275+parseInt(j.getLang("advanced.image_delta_height",0)),inline:true},{theme_url:this.url})},_mceLink:function(k,l){var j=this.editor;j.windowManager.open({url:this.url+"/link.htm",width:310+parseInt(j.getLang("advanced.link_delta_width",0)),height:200+parseInt(j.getLang("advanced.link_delta_height",0)),inline:true},{theme_url:this.url})},_mceNewDocument:function(){var j=this.editor;j.windowManager.confirm("advanced.newdocument",function(k){if(k){j.execCommand("mceSetContent",false,"")}})},_mceForeColor:function(){var j=this;this._mceColorPicker(0,{color:j.fgColor,func:function(k){j.fgColor=k;j.editor.execCommand("ForeColor",false,k)}})},_mceBackColor:function(){var j=this;this._mceColorPicker(0,{color:j.bgColor,func:function(k){j.bgColor=k;j.editor.execCommand("HiliteColor",false,k)}})},_ufirst:function(j){return j.substring(0,1).toUpperCase()+j.substring(1)}});h.ThemeManager.add("advanced",h.themes.AdvancedTheme)}(tinymce)); ================================================ FILE: static/js/tinymce/themes/advanced/editor_template_src.js ================================================ /** * editor_template_src.js * * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ (function(tinymce) { var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode; // Generates a preview for a format function getPreviewCss(ed, fmt) { var name, previewElm, dom = ed.dom, previewCss = '', parentFontSize, previewStylesName; previewStyles = ed.settings.preview_styles; // No preview forced if (previewStyles === false) return ''; // Default preview if (!previewStyles) previewStyles = 'font-family font-size font-weight text-decoration text-transform color background-color'; // Removes any variables since these can't be previewed function removeVars(val) { return val.replace(/%(\w+)/g, ''); }; // Create block/inline element to use for preview name = fmt.block || fmt.inline || 'span'; previewElm = dom.create(name); // Add format styles to preview element each(fmt.styles, function(value, name) { value = removeVars(value); if (value) dom.setStyle(previewElm, name, value); }); // Add attributes to preview element each(fmt.attributes, function(value, name) { value = removeVars(value); if (value) dom.setAttrib(previewElm, name, value); }); // Add classes to preview element each(fmt.classes, function(value) { value = removeVars(value); if (!dom.hasClass(previewElm, value)) dom.addClass(previewElm, value); }); // Add the previewElm outside the visual area dom.setStyles(previewElm, {position: 'absolute', left: -0xFFFF}); ed.getBody().appendChild(previewElm); // Get parent container font size so we can compute px values out of em/% for older IE:s parentFontSize = dom.getStyle(ed.getBody(), 'fontSize', true); parentFontSize = /px$/.test(parentFontSize) ? parseInt(parentFontSize, 10) : 0; each(previewStyles.split(' '), function(name) { var value = dom.getStyle(previewElm, name, true); // If background is transparent then check if the body has a background color we can use if (name == 'background-color' && /transparent|rgba\s*\([^)]+,\s*0\)/.test(value)) { value = dom.getStyle(ed.getBody(), name, true); // Ignore white since it's the default color, not the nicest fix if (dom.toHex(value).toLowerCase() == '#ffffff') { return; } } // Old IE won't calculate the font size so we need to do that manually if (name == 'font-size') { if (/em|%$/.test(value)) { if (parentFontSize === 0) { return; } // Convert font size from em/% to px value = parseFloat(value, 10) / (/%$/.test(value) ? 100 : 1); value = (value * parentFontSize) + 'px'; } } previewCss += name + ':' + value + ';'; }); dom.remove(previewElm); return previewCss; }; // Tell it to load theme specific language pack(s) tinymce.ThemeManager.requireLangPack('advanced'); tinymce.create('tinymce.themes.AdvancedTheme', { sizes : [8, 10, 12, 14, 18, 24, 36], // Control name lookup, format: title, command controls : { bold : ['bold_desc', 'Bold'], italic : ['italic_desc', 'Italic'], underline : ['underline_desc', 'Underline'], strikethrough : ['striketrough_desc', 'Strikethrough'], justifyleft : ['justifyleft_desc', 'JustifyLeft'], justifycenter : ['justifycenter_desc', 'JustifyCenter'], justifyright : ['justifyright_desc', 'JustifyRight'], justifyfull : ['justifyfull_desc', 'JustifyFull'], bullist : ['bullist_desc', 'InsertUnorderedList'], numlist : ['numlist_desc', 'InsertOrderedList'], outdent : ['outdent_desc', 'Outdent'], indent : ['indent_desc', 'Indent'], cut : ['cut_desc', 'Cut'], copy : ['copy_desc', 'Copy'], paste : ['paste_desc', 'Paste'], undo : ['undo_desc', 'Undo'], redo : ['redo_desc', 'Redo'], link : ['link_desc', 'mceLink'], unlink : ['unlink_desc', 'unlink'], image : ['image_desc', 'mceImage'], cleanup : ['cleanup_desc', 'mceCleanup'], help : ['help_desc', 'mceHelp'], code : ['code_desc', 'mceCodeEditor'], hr : ['hr_desc', 'InsertHorizontalRule'], removeformat : ['removeformat_desc', 'RemoveFormat'], sub : ['sub_desc', 'subscript'], sup : ['sup_desc', 'superscript'], forecolor : ['forecolor_desc', 'ForeColor'], forecolorpicker : ['forecolor_desc', 'mceForeColor'], backcolor : ['backcolor_desc', 'HiliteColor'], backcolorpicker : ['backcolor_desc', 'mceBackColor'], charmap : ['charmap_desc', 'mceCharMap'], visualaid : ['visualaid_desc', 'mceToggleVisualAid'], anchor : ['anchor_desc', 'mceInsertAnchor'], newdocument : ['newdocument_desc', 'mceNewDocument'], blockquote : ['blockquote_desc', 'mceBlockQuote'] }, stateControls : ['bold', 'italic', 'underline', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'sub', 'sup', 'blockquote'], init : function(ed, url) { var t = this, s, v, o; t.editor = ed; t.url = url; t.onResolveName = new tinymce.util.Dispatcher(this); s = ed.settings; ed.forcedHighContrastMode = ed.settings.detect_highcontrast && t._isHighContrast(); ed.settings.skin = ed.forcedHighContrastMode ? 'highcontrast' : ed.settings.skin; // Setup default buttons if (!s.theme_advanced_buttons1) { s = extend({ theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect", theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code", theme_advanced_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap" }, s); } // Default settings t.settings = s = extend({ theme_advanced_path : true, theme_advanced_toolbar_location : 'top', theme_advanced_blockformats : "p,address,pre,h1,h2,h3,h4,h5,h6", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats", theme_advanced_more_colors : 1, theme_advanced_row_height : 23, theme_advanced_resize_horizontal : 1, theme_advanced_resizing_use_cookie : 1, theme_advanced_font_sizes : "1,2,3,4,5,6,7", theme_advanced_font_selector : "span", theme_advanced_show_current_color: 0, readonly : ed.settings.readonly }, s); // Setup default font_size_style_values if (!s.font_size_style_values) s.font_size_style_values = "8pt,10pt,12pt,14pt,18pt,24pt,36pt"; if (tinymce.is(s.theme_advanced_font_sizes, 'string')) { s.font_size_style_values = tinymce.explode(s.font_size_style_values); s.font_size_classes = tinymce.explode(s.font_size_classes || ''); // Parse string value o = {}; ed.settings.theme_advanced_font_sizes = s.theme_advanced_font_sizes; each(ed.getParam('theme_advanced_font_sizes', '', 'hash'), function(v, k) { var cl; if (k == v && v >= 1 && v <= 7) { k = v + ' (' + t.sizes[v - 1] + 'pt)'; cl = s.font_size_classes[v - 1]; v = s.font_size_style_values[v - 1] || (t.sizes[v - 1] + 'pt'); } if (/^\s*\./.test(v)) cl = v.replace(/\./g, ''); o[k] = cl ? {'class' : cl} : {fontSize : v}; }); s.theme_advanced_font_sizes = o; } if ((v = s.theme_advanced_path_location) && v != 'none') s.theme_advanced_statusbar_location = s.theme_advanced_path_location; if (s.theme_advanced_statusbar_location == 'none') s.theme_advanced_statusbar_location = 0; if (ed.settings.content_css !== false) ed.contentCSS.push(ed.baseURI.toAbsolute(url + "/skins/" + ed.settings.skin + "/content.css")); // Init editor ed.onInit.add(function() { if (!ed.settings.readonly) { ed.onNodeChange.add(t._nodeChanged, t); ed.onKeyUp.add(t._updateUndoStatus, t); ed.onMouseUp.add(t._updateUndoStatus, t); ed.dom.bind(ed.dom.getRoot(), 'dragend', function() { t._updateUndoStatus(ed); }); } }); ed.onSetProgressState.add(function(ed, b, ti) { var co, id = ed.id, tb; if (b) { t.progressTimer = setTimeout(function() { co = ed.getContainer(); co = co.insertBefore(DOM.create('DIV', {style : 'position:relative'}), co.firstChild); tb = DOM.get(ed.id + '_tbl'); DOM.add(co, 'div', {id : id + '_blocker', 'class' : 'mceBlocker', style : {width : tb.clientWidth + 2, height : tb.clientHeight + 2}}); DOM.add(co, 'div', {id : id + '_progress', 'class' : 'mceProgress', style : {left : tb.clientWidth / 2, top : tb.clientHeight / 2}}); }, ti || 0); } else { DOM.remove(id + '_blocker'); DOM.remove(id + '_progress'); clearTimeout(t.progressTimer); } }); DOM.loadCSS(s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : url + "/skins/" + ed.settings.skin + "/ui.css"); if (s.skin_variant) DOM.loadCSS(url + "/skins/" + ed.settings.skin + "/ui_" + s.skin_variant + ".css"); }, _isHighContrast : function() { var actualColor, div = DOM.add(DOM.getRoot(), 'div', {'style': 'background-color: rgb(171,239,86);'}); actualColor = (DOM.getStyle(div, 'background-color', true) + '').toLowerCase().replace(/ /g, ''); DOM.remove(div); return actualColor != 'rgb(171,239,86)' && actualColor != '#abef56'; }, createControl : function(n, cf) { var cd, c; if (c = cf.createControl(n)) return c; switch (n) { case "styleselect": return this._createStyleSelect(); case "formatselect": return this._createBlockFormats(); case "fontselect": return this._createFontSelect(); case "fontsizeselect": return this._createFontSizeSelect(); case "forecolor": return this._createForeColorMenu(); case "backcolor": return this._createBackColorMenu(); } if ((cd = this.controls[n])) return cf.createButton(n, {title : "advanced." + cd[0], cmd : cd[1], ui : cd[2], value : cd[3]}); }, execCommand : function(cmd, ui, val) { var f = this['_' + cmd]; if (f) { f.call(this, ui, val); return true; } return false; }, _importClasses : function(e) { var ed = this.editor, ctrl = ed.controlManager.get('styleselect'); if (ctrl.getLength() == 0) { each(ed.dom.getClasses(), function(o, idx) { var name = 'style_' + idx, fmt; fmt = { inline : 'span', attributes : {'class' : o['class']}, selector : '*' }; ed.formatter.register(name, fmt); ctrl.add(o['class'], name, { style: function() { return getPreviewCss(ed, fmt); } }); }); } }, _createStyleSelect : function(n) { var t = this, ed = t.editor, ctrlMan = ed.controlManager, ctrl; // Setup style select box ctrl = ctrlMan.createListBox('styleselect', { title : 'advanced.style_select', onselect : function(name) { var matches, formatNames = [], removedFormat; each(ctrl.items, function(item) { formatNames.push(item.value); }); ed.focus(); ed.undoManager.add(); // Toggle off the current format(s) matches = ed.formatter.matchAll(formatNames); tinymce.each(matches, function(match) { if (!name || match == name) { if (match) ed.formatter.remove(match); removedFormat = true; } }); if (!removedFormat) ed.formatter.apply(name); ed.undoManager.add(); ed.nodeChanged(); return false; // No auto select } }); // Handle specified format ed.onPreInit.add(function() { var counter = 0, formats = ed.getParam('style_formats'); if (formats) { each(formats, function(fmt) { var name, keys = 0; each(fmt, function() {keys++;}); if (keys > 1) { name = fmt.name = fmt.name || 'style_' + (counter++); ed.formatter.register(name, fmt); ctrl.add(fmt.title, name, { style: function() { return getPreviewCss(ed, fmt); } }); } else ctrl.add(fmt.title); }); } else { each(ed.getParam('theme_advanced_styles', '', 'hash'), function(val, key) { var name, fmt; if (val) { name = 'style_' + (counter++); fmt = { inline : 'span', classes : val, selector : '*' }; ed.formatter.register(name, fmt); ctrl.add(t.editor.translate(key), name, { style: function() { return getPreviewCss(ed, fmt); } }); } }); } }); // Auto import classes if the ctrl box is empty if (ctrl.getLength() == 0) { ctrl.onPostRender.add(function(ed, n) { if (!ctrl.NativeListBox) { Event.add(n.id + '_text', 'focus', t._importClasses, t); Event.add(n.id + '_text', 'mousedown', t._importClasses, t); Event.add(n.id + '_open', 'focus', t._importClasses, t); Event.add(n.id + '_open', 'mousedown', t._importClasses, t); } else Event.add(n.id, 'focus', t._importClasses, t); }); } return ctrl; }, _createFontSelect : function() { var c, t = this, ed = t.editor; c = ed.controlManager.createListBox('fontselect', { title : 'advanced.fontdefault', onselect : function(v) { var cur = c.items[c.selectedIndex]; if (!v && cur) { ed.execCommand('FontName', false, cur.value); return; } ed.execCommand('FontName', false, v); // Fake selection, execCommand will fire a nodeChange and update the selection c.select(function(sv) { return v == sv; }); if (cur && cur.value == v) { c.select(null); } return false; // No auto select } }); if (c) { each(ed.getParam('theme_advanced_fonts', t.settings.theme_advanced_fonts, 'hash'), function(v, k) { c.add(ed.translate(k), v, {style : v.indexOf('dings') == -1 ? 'font-family:' + v : ''}); }); } return c; }, _createFontSizeSelect : function() { var t = this, ed = t.editor, c, i = 0, cl = []; c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', onselect : function(v) { var cur = c.items[c.selectedIndex]; if (!v && cur) { cur = cur.value; if (cur['class']) { ed.formatter.toggle('fontsize_class', {value : cur['class']}); ed.undoManager.add(); ed.nodeChanged(); } else { ed.execCommand('FontSize', false, cur.fontSize); } return; } if (v['class']) { ed.focus(); ed.undoManager.add(); ed.formatter.toggle('fontsize_class', {value : v['class']}); ed.undoManager.add(); ed.nodeChanged(); } else ed.execCommand('FontSize', false, v.fontSize); // Fake selection, execCommand will fire a nodeChange and update the selection c.select(function(sv) { return v == sv; }); if (cur && (cur.value.fontSize == v.fontSize || cur.value['class'] && cur.value['class'] == v['class'])) { c.select(null); } return false; // No auto select }}); if (c) { each(t.settings.theme_advanced_font_sizes, function(v, k) { var fz = v.fontSize; if (fz >= 1 && fz <= 7) fz = t.sizes[parseInt(fz) - 1] + 'pt'; c.add(k, v, {'style' : 'font-size:' + fz, 'class' : 'mceFontSize' + (i++) + (' ' + (v['class'] || ''))}); }); } return c; }, _createBlockFormats : function() { var c, fmts = { p : 'advanced.paragraph', address : 'advanced.address', pre : 'advanced.pre', h1 : 'advanced.h1', h2 : 'advanced.h2', h3 : 'advanced.h3', h4 : 'advanced.h4', h5 : 'advanced.h5', h6 : 'advanced.h6', div : 'advanced.div', blockquote : 'advanced.blockquote', code : 'advanced.code', dt : 'advanced.dt', dd : 'advanced.dd', samp : 'advanced.samp' }, t = this; c = t.editor.controlManager.createListBox('formatselect', {title : 'advanced.block', onselect : function(v) { t.editor.execCommand('FormatBlock', false, v); return false; }}); if (c) { each(t.editor.getParam('theme_advanced_blockformats', t.settings.theme_advanced_blockformats, 'hash'), function(v, k) { c.add(t.editor.translate(k != v ? k : fmts[v]), v, {'class' : 'mce_formatPreview mce_' + v, style: function() { return getPreviewCss(t.editor, {block: v}); }}); }); } return c; }, _createForeColorMenu : function() { var c, t = this, s = t.settings, o = {}, v; if (s.theme_advanced_more_colors) { o.more_colors_func = function() { t._mceColorPicker(0, { color : c.value, func : function(co) { c.setColor(co); } }); }; } if (v = s.theme_advanced_text_colors) o.colors = v; if (s.theme_advanced_default_foreground_color) o.default_color = s.theme_advanced_default_foreground_color; o.title = 'advanced.forecolor_desc'; o.cmd = 'ForeColor'; o.scope = this; c = t.editor.controlManager.createColorSplitButton('forecolor', o); return c; }, _createBackColorMenu : function() { var c, t = this, s = t.settings, o = {}, v; if (s.theme_advanced_more_colors) { o.more_colors_func = function() { t._mceColorPicker(0, { color : c.value, func : function(co) { c.setColor(co); } }); }; } if (v = s.theme_advanced_background_colors) o.colors = v; if (s.theme_advanced_default_background_color) o.default_color = s.theme_advanced_default_background_color; o.title = 'advanced.backcolor_desc'; o.cmd = 'HiliteColor'; o.scope = this; c = t.editor.controlManager.createColorSplitButton('backcolor', o); return c; }, renderUI : function(o) { var n, ic, tb, t = this, ed = t.editor, s = t.settings, sc, p, nl; if (ed.settings) { ed.settings.aria_label = s.aria_label + ed.getLang('advanced.help_shortcut'); } // TODO: ACC Should have an aria-describedby attribute which is user-configurable to describe what this field is actually for. // Maybe actually inherit it from the original textara? n = p = DOM.create('span', {role : 'application', 'aria-labelledby' : ed.id + '_voice', id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin' + (s.skin_variant ? ' ' + ed.settings.skin + 'Skin' + t._ufirst(s.skin_variant) : '') + (ed.settings.directionality == "rtl" ? ' mceRtl' : '')}); DOM.add(n, 'span', {'class': 'mceVoiceLabel', 'style': 'display:none;', id: ed.id + '_voice'}, s.aria_label); if (!DOM.boxModel) n = DOM.add(n, 'div', {'class' : 'mceOldBoxModel'}); n = sc = DOM.add(n, 'table', {role : "presentation", id : ed.id + '_tbl', 'class' : 'mceLayout', cellSpacing : 0, cellPadding : 0}); n = tb = DOM.add(n, 'tbody'); switch ((s.theme_advanced_layout_manager || '').toLowerCase()) { case "rowlayout": ic = t._rowLayout(s, tb, o); break; case "customlayout": ic = ed.execCallback("theme_advanced_custom_layout", s, tb, o, p); break; default: ic = t._simpleLayout(s, tb, o, p); } n = o.targetNode; // Add classes to first and last TRs nl = sc.rows; DOM.addClass(nl[0], 'mceFirst'); DOM.addClass(nl[nl.length - 1], 'mceLast'); // Add classes to first and last TDs each(DOM.select('tr', tb), function(n) { DOM.addClass(n.firstChild, 'mceFirst'); DOM.addClass(n.childNodes[n.childNodes.length - 1], 'mceLast'); }); if (DOM.get(s.theme_advanced_toolbar_container)) DOM.get(s.theme_advanced_toolbar_container).appendChild(p); else DOM.insertAfter(p, n); Event.add(ed.id + '_path_row', 'click', function(e) { e = e.target; if (e.nodeName == 'A') { t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/, '$1')); return false; } }); /* if (DOM.get(ed.id + '_path_row')) { Event.add(ed.id + '_tbl', 'mouseover', function(e) { var re; e = e.target; if (e.nodeName == 'SPAN' && DOM.hasClass(e.parentNode, 'mceButton')) { re = DOM.get(ed.id + '_path_row'); t.lastPath = re.innerHTML; DOM.setHTML(re, e.parentNode.title); } }); Event.add(ed.id + '_tbl', 'mouseout', function(e) { if (t.lastPath) { DOM.setHTML(ed.id + '_path_row', t.lastPath); t.lastPath = 0; } }); } */ if (!ed.getParam('accessibility_focus')) Event.add(DOM.add(p, 'a', {href : '#'}, ''), 'focus', function() {tinyMCE.get(ed.id).focus();}); if (s.theme_advanced_toolbar_location == 'external') o.deltaHeight = 0; t.deltaHeight = o.deltaHeight; o.targetNode = null; ed.onKeyDown.add(function(ed, evt) { var DOM_VK_F10 = 121, DOM_VK_F11 = 122; if (evt.altKey) { if (evt.keyCode === DOM_VK_F10) { // Make sure focus is given to toolbar in Safari. // We can't do this in IE as it prevents giving focus to toolbar when editor is in a frame if (tinymce.isWebKit) { window.focus(); } t.toolbarGroup.focus(); return Event.cancel(evt); } else if (evt.keyCode === DOM_VK_F11) { DOM.get(ed.id + '_path_row').focus(); return Event.cancel(evt); } } }); // alt+0 is the UK recommended shortcut for accessing the list of access controls. ed.addShortcut('alt+0', '', 'mceShortcuts', t); return { iframeContainer : ic, editorContainer : ed.id + '_parent', sizeContainer : sc, deltaHeight : o.deltaHeight }; }, getInfo : function() { return { longname : 'Advanced theme', author : 'Moxiecode Systems AB', authorurl : 'http://tinymce.moxiecode.com', version : tinymce.majorVersion + "." + tinymce.minorVersion } }, resizeBy : function(dw, dh) { var e = DOM.get(this.editor.id + '_ifr'); this.resizeTo(e.clientWidth + dw, e.clientHeight + dh); }, resizeTo : function(w, h, store) { var ed = this.editor, s = this.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr'); // Boundery fix box w = Math.max(s.theme_advanced_resizing_min_width || 100, w); h = Math.max(s.theme_advanced_resizing_min_height || 100, h); w = Math.min(s.theme_advanced_resizing_max_width || 0xFFFF, w); h = Math.min(s.theme_advanced_resizing_max_height || 0xFFFF, h); // Resize iframe and container DOM.setStyle(e, 'height', ''); DOM.setStyle(ifr, 'height', h); if (s.theme_advanced_resize_horizontal) { DOM.setStyle(e, 'width', ''); DOM.setStyle(ifr, 'width', w); // Make sure that the size is never smaller than the over all ui if (w < e.clientWidth) { w = e.clientWidth; DOM.setStyle(ifr, 'width', e.clientWidth); } } // Store away the size if (store && s.theme_advanced_resizing_use_cookie) { Cookie.setHash("TinyMCE_" + ed.id + "_size", { cw : w, ch : h }); } }, destroy : function() { var id = this.editor.id; Event.clear(id + '_resize'); Event.clear(id + '_path_row'); Event.clear(id + '_external_close'); }, // Internal functions _simpleLayout : function(s, tb, o, p) { var t = this, ed = t.editor, lo = s.theme_advanced_toolbar_location, sl = s.theme_advanced_statusbar_location, n, ic, etb, c; if (s.readonly) { n = DOM.add(tb, 'tr'); n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'}); return ic; } // Create toolbar container at top if (lo == 'top') t._addToolbars(tb, o); // Create external toolbar if (lo == 'external') { n = c = DOM.create('div', {style : 'position:relative'}); n = DOM.add(n, 'div', {id : ed.id + '_external', 'class' : 'mceExternalToolbar'}); DOM.add(n, 'a', {id : ed.id + '_external_close', href : 'javascript:;', 'class' : 'mceExternalClose'}); n = DOM.add(n, 'table', {id : ed.id + '_tblext', cellSpacing : 0, cellPadding : 0}); etb = DOM.add(n, 'tbody'); if (p.firstChild.className == 'mceOldBoxModel') p.firstChild.appendChild(c); else p.insertBefore(c, p.firstChild); t._addToolbars(etb, o); ed.onMouseUp.add(function() { var e = DOM.get(ed.id + '_external'); DOM.show(e); DOM.hide(lastExtID); var f = Event.add(ed.id + '_external_close', 'click', function() { DOM.hide(ed.id + '_external'); Event.remove(ed.id + '_external_close', 'click', f); return false; }); DOM.show(e); DOM.setStyle(e, 'top', 0 - DOM.getRect(ed.id + '_tblext').h - 1); // Fixes IE rendering bug DOM.hide(e); DOM.show(e); e.style.filter = ''; lastExtID = ed.id + '_external'; e = null; }); } if (sl == 'top') t._addStatusBar(tb, o); // Create iframe container if (!s.theme_advanced_toolbar_container) { n = DOM.add(tb, 'tr'); n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'}); } // Create toolbar container at bottom if (lo == 'bottom') t._addToolbars(tb, o); if (sl == 'bottom') t._addStatusBar(tb, o); return ic; }, _rowLayout : function(s, tb, o) { var t = this, ed = t.editor, dc, da, cf = ed.controlManager, n, ic, to, a; dc = s.theme_advanced_containers_default_class || ''; da = s.theme_advanced_containers_default_align || 'center'; each(explode(s.theme_advanced_containers || ''), function(c, i) { var v = s['theme_advanced_container_' + c] || ''; switch (c.toLowerCase()) { case 'mceeditor': n = DOM.add(tb, 'tr'); n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'}); break; case 'mceelementpath': t._addStatusBar(tb, o); break; default: a = (s['theme_advanced_container_' + c + '_align'] || da).toLowerCase(); a = 'mce' + t._ufirst(a); n = DOM.add(DOM.add(tb, 'tr'), 'td', { 'class' : 'mceToolbar ' + (s['theme_advanced_container_' + c + '_class'] || dc) + ' ' + a || da }); to = cf.createToolbar("toolbar" + i); t._addControls(v, to); DOM.setHTML(n, to.renderHTML()); o.deltaHeight -= s.theme_advanced_row_height; } }); return ic; }, _addControls : function(v, tb) { var t = this, s = t.settings, di, cf = t.editor.controlManager; if (s.theme_advanced_disable && !t._disabled) { di = {}; each(explode(s.theme_advanced_disable), function(v) { di[v] = 1; }); t._disabled = di; } else di = t._disabled; each(explode(v), function(n) { var c; if (di && di[n]) return; // Compatiblity with 2.x if (n == 'tablecontrols') { each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"], function(n) { n = t.createControl(n, cf); if (n) tb.add(n); }); return; } c = t.createControl(n, cf); if (c) tb.add(c); }); }, _addToolbars : function(c, o) { var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [], a, toolbarGroup, toolbarsExist = false; toolbarGroup = cf.createToolbarGroup('toolbargroup', { 'name': ed.getLang('advanced.toolbar'), 'tab_focus_toolbar':ed.getParam('theme_advanced_tab_focus_toolbar') }); t.toolbarGroup = toolbarGroup; a = s.theme_advanced_toolbar_align.toLowerCase(); a = 'mce' + t._ufirst(a); n = DOM.add(DOM.add(c, 'tr', {role: 'presentation'}), 'td', {'class' : 'mceToolbar ' + a, "role":"toolbar"}); // Create toolbar and add the controls for (i=1; (v = s['theme_advanced_buttons' + i]); i++) { toolbarsExist = true; tb = cf.createToolbar("toolbar" + i, {'class' : 'mceToolbarRow' + i}); if (s['theme_advanced_buttons' + i + '_add']) v += ',' + s['theme_advanced_buttons' + i + '_add']; if (s['theme_advanced_buttons' + i + '_add_before']) v = s['theme_advanced_buttons' + i + '_add_before'] + ',' + v; t._addControls(v, tb); toolbarGroup.add(tb); o.deltaHeight -= s.theme_advanced_row_height; } // Handle case when there are no toolbar buttons and ensure editor height is adjusted accordingly if (!toolbarsExist) o.deltaHeight -= s.theme_advanced_row_height; h.push(toolbarGroup.renderHTML()); h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("advanced.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();'}, '')); DOM.setHTML(n, h.join('')); }, _addStatusBar : function(tb, o) { var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td; n = DOM.add(tb, 'tr'); n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'}); n = DOM.add(n, 'div', {id : ed.id + '_path_row', 'role': 'group', 'aria-labelledby': ed.id + '_path_voice'}); if (s.theme_advanced_path) { DOM.add(n, 'span', {id: ed.id + '_path_voice'}, ed.translate('advanced.path')); DOM.add(n, 'span', {}, ': '); } else { DOM.add(n, 'span', {}, ' '); } if (s.theme_advanced_resizing) { DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize', tabIndex:"-1"}); if (s.theme_advanced_resizing_use_cookie) { ed.onPostRender.add(function() { var o = Cookie.getHash("TinyMCE_" + ed.id + "_size"), c = DOM.get(ed.id + '_tbl'); if (!o) return; t.resizeTo(o.cw, o.ch); }); } ed.onPostRender.add(function() { Event.add(ed.id + '_resize', 'click', function(e) { e.preventDefault(); }); Event.add(ed.id + '_resize', 'mousedown', function(e) { var mouseMoveHandler1, mouseMoveHandler2, mouseUpHandler1, mouseUpHandler2, startX, startY, startWidth, startHeight, width, height, ifrElm; function resizeOnMove(e) { e.preventDefault(); width = startWidth + (e.screenX - startX); height = startHeight + (e.screenY - startY); t.resizeTo(width, height); }; function endResize(e) { // Stop listening Event.remove(DOM.doc, 'mousemove', mouseMoveHandler1); Event.remove(ed.getDoc(), 'mousemove', mouseMoveHandler2); Event.remove(DOM.doc, 'mouseup', mouseUpHandler1); Event.remove(ed.getDoc(), 'mouseup', mouseUpHandler2); width = startWidth + (e.screenX - startX); height = startHeight + (e.screenY - startY); t.resizeTo(width, height, true); ed.nodeChanged(); }; e.preventDefault(); // Get the current rect size startX = e.screenX; startY = e.screenY; ifrElm = DOM.get(t.editor.id + '_ifr'); startWidth = width = ifrElm.clientWidth; startHeight = height = ifrElm.clientHeight; // Register envent handlers mouseMoveHandler1 = Event.add(DOM.doc, 'mousemove', resizeOnMove); mouseMoveHandler2 = Event.add(ed.getDoc(), 'mousemove', resizeOnMove); mouseUpHandler1 = Event.add(DOM.doc, 'mouseup', endResize); mouseUpHandler2 = Event.add(ed.getDoc(), 'mouseup', endResize); }); }); } o.deltaHeight -= 21; n = tb = null; }, _updateUndoStatus : function(ed) { var cm = ed.controlManager, um = ed.undoManager; cm.setDisabled('undo', !um.hasUndo() && !um.typing); cm.setDisabled('redo', !um.hasRedo()); }, _nodeChanged : function(ed, cm, n, co, ob) { var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn, fc, bc, formatNames, matches; tinymce.each(t.stateControls, function(c) { cm.setActive(c, ed.queryCommandState(t.controls[c][1])); }); function getParent(name) { var i, parents = ob.parents, func = name; if (typeof(name) == 'string') { func = function(node) { return node.nodeName == name; }; } for (i = 0; i < parents.length; i++) { if (func(parents[i])) return parents[i]; } }; cm.setActive('visualaid', ed.hasVisual); t._updateUndoStatus(ed); cm.setDisabled('outdent', !ed.queryCommandState('Outdent')); p = getParent('A'); if (c = cm.get('link')) { c.setDisabled((!p && co) || (p && !p.href)); c.setActive(!!p && (!p.name && !p.id)); } if (c = cm.get('unlink')) { c.setDisabled(!p && co); c.setActive(!!p && !p.name && !p.id); } if (c = cm.get('anchor')) { c.setActive(!co && !!p && (p.name || (p.id && !p.href))); } p = getParent('IMG'); if (c = cm.get('image')) c.setActive(!co && !!p && n.className.indexOf('mceItem') == -1); if (c = cm.get('styleselect')) { t._importClasses(); formatNames = []; each(c.items, function(item) { formatNames.push(item.value); }); matches = ed.formatter.matchAll(formatNames); c.select(matches[0]); tinymce.each(matches, function(match, index) { if (index > 0) { c.mark(match); } }); } if (c = cm.get('formatselect')) { p = getParent(ed.dom.isBlock); if (p) c.select(p.nodeName.toLowerCase()); } // Find out current fontSize, fontFamily and fontClass getParent(function(n) { if (n.nodeName === 'SPAN') { if (!cl && n.className) cl = n.className; } if (ed.dom.is(n, s.theme_advanced_font_selector)) { if (!fz && n.style.fontSize) fz = n.style.fontSize; if (!fn && n.style.fontFamily) fn = n.style.fontFamily.replace(/[\"\']+/g, '').replace(/^([^,]+).*/, '$1').toLowerCase(); if (!fc && n.style.color) fc = n.style.color; if (!bc && n.style.backgroundColor) bc = n.style.backgroundColor; } return false; }); if (c = cm.get('fontselect')) { c.select(function(v) { return v.replace(/^([^,]+).*/, '$1').toLowerCase() == fn; }); } // Select font size if (c = cm.get('fontsizeselect')) { // Use computed style if (s.theme_advanced_runtime_fontsize && !fz && !cl) fz = ed.dom.getStyle(n, 'fontSize', true); c.select(function(v) { if (v.fontSize && v.fontSize === fz) return true; if (v['class'] && v['class'] === cl) return true; }); } if (s.theme_advanced_show_current_color) { function updateColor(controlId, color) { if (c = cm.get(controlId)) { if (!color) color = c.settings.default_color; if (color !== c.value) { c.displayColor(color); } } } updateColor('forecolor', fc); updateColor('backcolor', bc); } if (s.theme_advanced_show_current_color) { function updateColor(controlId, color) { if (c = cm.get(controlId)) { if (!color) color = c.settings.default_color; if (color !== c.value) { c.displayColor(color); } } }; updateColor('forecolor', fc); updateColor('backcolor', bc); } if (s.theme_advanced_path && s.theme_advanced_statusbar_location) { p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'}); if (t.statusKeyboardNavigation) { t.statusKeyboardNavigation.destroy(); t.statusKeyboardNavigation = null; } DOM.setHTML(p, ''); getParent(function(n) { var na = n.nodeName.toLowerCase(), u, pi, ti = ''; // Ignore non element and bogus/hidden elements if (n.nodeType != 1 || na === 'br' || n.getAttribute('data-mce-bogus') || DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved')) return; // Handle prefix if (tinymce.isIE && n.scopeName !== 'HTML' && n.scopeName) na = n.scopeName + ':' + na; // Remove internal prefix na = na.replace(/mce\:/g, ''); // Handle node name switch (na) { case 'b': na = 'strong'; break; case 'i': na = 'em'; break; case 'img': if (v = DOM.getAttrib(n, 'src')) ti += 'src: ' + v + ' '; break; case 'a': if (v = DOM.getAttrib(n, 'name')) { ti += 'name: ' + v + ' '; na += '#' + v; } if (v = DOM.getAttrib(n, 'href')) ti += 'href: ' + v + ' '; break; case 'font': if (v = DOM.getAttrib(n, 'face')) ti += 'font: ' + v + ' '; if (v = DOM.getAttrib(n, 'size')) ti += 'size: ' + v + ' '; if (v = DOM.getAttrib(n, 'color')) ti += 'color: ' + v + ' '; break; case 'span': if (v = DOM.getAttrib(n, 'style')) ti += 'style: ' + v + ' '; break; } if (v = DOM.getAttrib(n, 'id')) ti += 'id: ' + v + ' '; if (v = n.className) { v = v.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g, ''); if (v) { ti += 'class: ' + v + ' '; if (ed.dom.isBlock(n) || na == 'img' || na == 'span') na += '.' + v; } } na = na.replace(/(html:)/g, ''); na = {name : na, node : n, title : ti}; t.onResolveName.dispatch(t, na); ti = na.title; na = na.name; //u = "javascript:tinymce.EditorManager.get('" + ed.id + "').theme._sel('" + (de++) + "');"; pi = DOM.create('a', {'href' : "javascript:;", role: 'button', onmousedown : "return false;", title : ti, 'class' : 'mcePath_' + (de++)}, na); if (p.hasChildNodes()) { p.insertBefore(DOM.create('span', {'aria-hidden': 'true'}, '\u00a0\u00bb '), p.firstChild); p.insertBefore(pi, p.firstChild); } else p.appendChild(pi); }, ed.getBody()); if (DOM.select('a', p).length > 0) { t.statusKeyboardNavigation = new tinymce.ui.KeyboardNavigation({ root: ed.id + "_path_row", items: DOM.select('a', p), excludeFromTabOrder: true, onCancel: function() { ed.focus(); } }, DOM); } } }, // Commands gets called by execCommand _sel : function(v) { this.editor.execCommand('mceSelectNodeDepth', false, v); }, _mceInsertAnchor : function(ui, v) { var ed = this.editor; ed.windowManager.open({ url : this.url + '/anchor.htm', width : 320 + parseInt(ed.getLang('advanced.anchor_delta_width', 0)), height : 90 + parseInt(ed.getLang('advanced.anchor_delta_height', 0)), inline : true }, { theme_url : this.url }); }, _mceCharMap : function() { var ed = this.editor; ed.windowManager.open({ url : this.url + '/charmap.htm', width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)), height : 265 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)), inline : true }, { theme_url : this.url }); }, _mceHelp : function() { var ed = this.editor; ed.windowManager.open({ url : this.url + '/about.htm', width : 480, height : 380, inline : true }, { theme_url : this.url }); }, _mceShortcuts : function() { var ed = this.editor; ed.windowManager.open({ url: this.url + '/shortcuts.htm', width: 480, height: 380, inline: true }, { theme_url: this.url }); }, _mceColorPicker : function(u, v) { var ed = this.editor; v = v || {}; ed.windowManager.open({ url : this.url + '/color_picker.htm', width : 375 + parseInt(ed.getLang('advanced.colorpicker_delta_width', 0)), height : 250 + parseInt(ed.getLang('advanced.colorpicker_delta_height', 0)), close_previous : false, inline : true }, { input_color : v.color, func : v.func, theme_url : this.url }); }, _mceCodeEditor : function(ui, val) { var ed = this.editor; ed.windowManager.open({ url : this.url + '/source_editor.htm', width : parseInt(ed.getParam("theme_advanced_source_editor_width", 720)), height : parseInt(ed.getParam("theme_advanced_source_editor_height", 580)), inline : true, resizable : true, maximizable : true }, { theme_url : this.url }); }, _mceImage : function(ui, val) { var ed = this.editor; // Internal image object like a flash placeholder if (ed.dom.getAttrib(ed.selection.getNode(), 'class', '').indexOf('mceItem') != -1) return; ed.windowManager.open({ url : this.url + '/image.htm', width : 355 + parseInt(ed.getLang('advanced.image_delta_width', 0)), height : 275 + parseInt(ed.getLang('advanced.image_delta_height', 0)), inline : true }, { theme_url : this.url }); }, _mceLink : function(ui, val) { var ed = this.editor; ed.windowManager.open({ url : this.url + '/link.htm', width : 310 + parseInt(ed.getLang('advanced.link_delta_width', 0)), height : 200 + parseInt(ed.getLang('advanced.link_delta_height', 0)), inline : true }, { theme_url : this.url }); }, _mceNewDocument : function() { var ed = this.editor; ed.windowManager.confirm('advanced.newdocument', function(s) { if (s) ed.execCommand('mceSetContent', false, ''); }); }, _mceForeColor : function() { var t = this; this._mceColorPicker(0, { color: t.fgColor, func : function(co) { t.fgColor = co; t.editor.execCommand('ForeColor', false, co); } }); }, _mceBackColor : function() { var t = this; this._mceColorPicker(0, { color: t.bgColor, func : function(co) { t.bgColor = co; t.editor.execCommand('HiliteColor', false, co); } }); }, _ufirst : function(s) { return s.substring(0, 1).toUpperCase() + s.substring(1); } }); tinymce.ThemeManager.add('advanced', tinymce.themes.AdvancedTheme); }(tinymce)); ================================================ FILE: static/js/tinymce/themes/advanced/image.htm ================================================ {#advanced_dlg.image_title}
     
    x
    ================================================ FILE: static/js/tinymce/themes/advanced/js/about.js ================================================ tinyMCEPopup.requireLangPack(); function init() { var ed, tcont; tinyMCEPopup.resizeToInnerSize(); ed = tinyMCEPopup.editor; // Give FF some time window.setTimeout(insertHelpIFrame, 10); tcont = document.getElementById('plugintablecontainer'); document.getElementById('plugins_tab').style.display = 'none'; var html = ""; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; tinymce.each(ed.plugins, function(p, n) { var info; if (!p.getInfo) return; html += ''; info = p.getInfo(); if (info.infourl != null && info.infourl != '') html += ''; else html += ''; if (info.authorurl != null && info.authorurl != '') html += ''; else html += ''; html += ''; html += ''; document.getElementById('plugins_tab').style.display = ''; }); html += ''; html += '
    ' + ed.getLang('advanced_dlg.about_plugin') + '' + ed.getLang('advanced_dlg.about_author') + '' + ed.getLang('advanced_dlg.about_version') + '
    ' + info.longname + '' + info.longname + '' + info.author + '' + info.author + '' + info.version + '
    '; tcont.innerHTML = html; tinyMCEPopup.dom.get('version').innerHTML = tinymce.majorVersion + "." + tinymce.minorVersion; tinyMCEPopup.dom.get('date').innerHTML = tinymce.releaseDate; } function insertHelpIFrame() { var html; if (tinyMCEPopup.getParam('docs_url')) { html = ''; document.getElementById('iframecontainer').innerHTML = html; document.getElementById('help_tab').style.display = 'block'; document.getElementById('help_tab').setAttribute("aria-hidden", "false"); } } tinyMCEPopup.onInit.add(init); ================================================ FILE: static/js/tinymce/themes/advanced/js/anchor.js ================================================ tinyMCEPopup.requireLangPack(); var AnchorDialog = { init : function(ed) { var action, elm, f = document.forms[0]; this.editor = ed; elm = ed.dom.getParent(ed.selection.getNode(), 'A'); v = ed.dom.getAttrib(elm, 'name') || ed.dom.getAttrib(elm, 'id'); if (v) { this.action = 'update'; f.anchorName.value = v; } f.insert.value = ed.getLang(elm ? 'update' : 'insert'); }, update : function() { var ed = this.editor, elm, name = document.forms[0].anchorName.value, attribName; if (!name || !/^[a-z][a-z0-9\-\_:\.]*$/i.test(name)) { tinyMCEPopup.alert('advanced_dlg.anchor_invalid'); return; } tinyMCEPopup.restoreSelection(); if (this.action != 'update') ed.selection.collapse(1); var aRule = ed.schema.getElementRule('a'); if (!aRule || aRule.attributes.name) { attribName = 'name'; } else { attribName = 'id'; } elm = ed.dom.getParent(ed.selection.getNode(), 'A'); if (elm) { elm.setAttribute(attribName, name); elm[attribName] = name; ed.undoManager.add(); } else { // create with zero-sized nbsp so that in Webkit where anchor is on last line by itself caret cannot be placed after it var attrs = {'class' : 'mceItemAnchor'}; attrs[attribName] = name; ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', attrs, '\uFEFF')); ed.nodeChanged(); } tinyMCEPopup.close(); } }; tinyMCEPopup.onInit.add(AnchorDialog.init, AnchorDialog); ================================================ FILE: static/js/tinymce/themes/advanced/js/charmap.js ================================================ /** * charmap.js * * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ tinyMCEPopup.requireLangPack(); var charmap = [ [' ', ' ', true, 'no-break space'], ['&', '&', true, 'ampersand'], ['"', '"', true, 'quotation mark'], // finance ['¢', '¢', true, 'cent sign'], ['€', '€', true, 'euro sign'], ['£', '£', true, 'pound sign'], ['¥', '¥', true, 'yen sign'], // signs ['©', '©', true, 'copyright sign'], ['®', '®', true, 'registered sign'], ['™', '™', true, 'trade mark sign'], ['‰', '‰', true, 'per mille sign'], ['µ', 'µ', true, 'micro sign'], ['·', '·', true, 'middle dot'], ['•', '•', true, 'bullet'], ['…', '…', true, 'three dot leader'], ['′', '′', true, 'minutes / feet'], ['″', '″', true, 'seconds / inches'], ['§', '§', true, 'section sign'], ['¶', '¶', true, 'paragraph sign'], ['ß', 'ß', true, 'sharp s / ess-zed'], // quotations ['‹', '‹', true, 'single left-pointing angle quotation mark'], ['›', '›', true, 'single right-pointing angle quotation mark'], ['«', '«', true, 'left pointing guillemet'], ['»', '»', true, 'right pointing guillemet'], ['‘', '‘', true, 'left single quotation mark'], ['’', '’', true, 'right single quotation mark'], ['“', '“', true, 'left double quotation mark'], ['”', '”', true, 'right double quotation mark'], ['‚', '‚', true, 'single low-9 quotation mark'], ['„', '„', true, 'double low-9 quotation mark'], ['<', '<', true, 'less-than sign'], ['>', '>', true, 'greater-than sign'], ['≤', '≤', true, 'less-than or equal to'], ['≥', '≥', true, 'greater-than or equal to'], ['–', '–', true, 'en dash'], ['—', '—', true, 'em dash'], ['¯', '¯', true, 'macron'], ['‾', '‾', true, 'overline'], ['¤', '¤', true, 'currency sign'], ['¦', '¦', true, 'broken bar'], ['¨', '¨', true, 'diaeresis'], ['¡', '¡', true, 'inverted exclamation mark'], ['¿', '¿', true, 'turned question mark'], ['ˆ', 'ˆ', true, 'circumflex accent'], ['˜', '˜', true, 'small tilde'], ['°', '°', true, 'degree sign'], ['−', '−', true, 'minus sign'], ['±', '±', true, 'plus-minus sign'], ['÷', '÷', true, 'division sign'], ['⁄', '⁄', true, 'fraction slash'], ['×', '×', true, 'multiplication sign'], ['¹', '¹', true, 'superscript one'], ['²', '²', true, 'superscript two'], ['³', '³', true, 'superscript three'], ['¼', '¼', true, 'fraction one quarter'], ['½', '½', true, 'fraction one half'], ['¾', '¾', true, 'fraction three quarters'], // math / logical ['ƒ', 'ƒ', true, 'function / florin'], ['∫', '∫', true, 'integral'], ['∑', '∑', true, 'n-ary sumation'], ['∞', '∞', true, 'infinity'], ['√', '√', true, 'square root'], ['∼', '∼', false,'similar to'], ['≅', '≅', false,'approximately equal to'], ['≈', '≈', true, 'almost equal to'], ['≠', '≠', true, 'not equal to'], ['≡', '≡', true, 'identical to'], ['∈', '∈', false,'element of'], ['∉', '∉', false,'not an element of'], ['∋', '∋', false,'contains as member'], ['∏', '∏', true, 'n-ary product'], ['∧', '∧', false,'logical and'], ['∨', '∨', false,'logical or'], ['¬', '¬', true, 'not sign'], ['∩', '∩', true, 'intersection'], ['∪', '∪', false,'union'], ['∂', '∂', true, 'partial differential'], ['∀', '∀', false,'for all'], ['∃', '∃', false,'there exists'], ['∅', '∅', false,'diameter'], ['∇', '∇', false,'backward difference'], ['∗', '∗', false,'asterisk operator'], ['∝', '∝', false,'proportional to'], ['∠', '∠', false,'angle'], // undefined ['´', '´', true, 'acute accent'], ['¸', '¸', true, 'cedilla'], ['ª', 'ª', true, 'feminine ordinal indicator'], ['º', 'º', true, 'masculine ordinal indicator'], ['†', '†', true, 'dagger'], ['‡', '‡', true, 'double dagger'], // alphabetical special chars ['À', 'À', true, 'A - grave'], ['Á', 'Á', true, 'A - acute'], ['Â', 'Â', true, 'A - circumflex'], ['Ã', 'Ã', true, 'A - tilde'], ['Ä', 'Ä', true, 'A - diaeresis'], ['Å', 'Å', true, 'A - ring above'], ['Æ', 'Æ', true, 'ligature AE'], ['Ç', 'Ç', true, 'C - cedilla'], ['È', 'È', true, 'E - grave'], ['É', 'É', true, 'E - acute'], ['Ê', 'Ê', true, 'E - circumflex'], ['Ë', 'Ë', true, 'E - diaeresis'], ['Ì', 'Ì', true, 'I - grave'], ['Í', 'Í', true, 'I - acute'], ['Î', 'Î', true, 'I - circumflex'], ['Ï', 'Ï', true, 'I - diaeresis'], ['Ð', 'Ð', true, 'ETH'], ['Ñ', 'Ñ', true, 'N - tilde'], ['Ò', 'Ò', true, 'O - grave'], ['Ó', 'Ó', true, 'O - acute'], ['Ô', 'Ô', true, 'O - circumflex'], ['Õ', 'Õ', true, 'O - tilde'], ['Ö', 'Ö', true, 'O - diaeresis'], ['Ø', 'Ø', true, 'O - slash'], ['Œ', 'Œ', true, 'ligature OE'], ['Š', 'Š', true, 'S - caron'], ['Ù', 'Ù', true, 'U - grave'], ['Ú', 'Ú', true, 'U - acute'], ['Û', 'Û', true, 'U - circumflex'], ['Ü', 'Ü', true, 'U - diaeresis'], ['Ý', 'Ý', true, 'Y - acute'], ['Ÿ', 'Ÿ', true, 'Y - diaeresis'], ['Þ', 'Þ', true, 'THORN'], ['à', 'à', true, 'a - grave'], ['á', 'á', true, 'a - acute'], ['â', 'â', true, 'a - circumflex'], ['ã', 'ã', true, 'a - tilde'], ['ä', 'ä', true, 'a - diaeresis'], ['å', 'å', true, 'a - ring above'], ['æ', 'æ', true, 'ligature ae'], ['ç', 'ç', true, 'c - cedilla'], ['è', 'è', true, 'e - grave'], ['é', 'é', true, 'e - acute'], ['ê', 'ê', true, 'e - circumflex'], ['ë', 'ë', true, 'e - diaeresis'], ['ì', 'ì', true, 'i - grave'], ['í', 'í', true, 'i - acute'], ['î', 'î', true, 'i - circumflex'], ['ï', 'ï', true, 'i - diaeresis'], ['ð', 'ð', true, 'eth'], ['ñ', 'ñ', true, 'n - tilde'], ['ò', 'ò', true, 'o - grave'], ['ó', 'ó', true, 'o - acute'], ['ô', 'ô', true, 'o - circumflex'], ['õ', 'õ', true, 'o - tilde'], ['ö', 'ö', true, 'o - diaeresis'], ['ø', 'ø', true, 'o slash'], ['œ', 'œ', true, 'ligature oe'], ['š', 'š', true, 's - caron'], ['ù', 'ù', true, 'u - grave'], ['ú', 'ú', true, 'u - acute'], ['û', 'û', true, 'u - circumflex'], ['ü', 'ü', true, 'u - diaeresis'], ['ý', 'ý', true, 'y - acute'], ['þ', 'þ', true, 'thorn'], ['ÿ', 'ÿ', true, 'y - diaeresis'], ['Α', 'Α', true, 'Alpha'], ['Β', 'Β', true, 'Beta'], ['Γ', 'Γ', true, 'Gamma'], ['Δ', 'Δ', true, 'Delta'], ['Ε', 'Ε', true, 'Epsilon'], ['Ζ', 'Ζ', true, 'Zeta'], ['Η', 'Η', true, 'Eta'], ['Θ', 'Θ', true, 'Theta'], ['Ι', 'Ι', true, 'Iota'], ['Κ', 'Κ', true, 'Kappa'], ['Λ', 'Λ', true, 'Lambda'], ['Μ', 'Μ', true, 'Mu'], ['Ν', 'Ν', true, 'Nu'], ['Ξ', 'Ξ', true, 'Xi'], ['Ο', 'Ο', true, 'Omicron'], ['Π', 'Π', true, 'Pi'], ['Ρ', 'Ρ', true, 'Rho'], ['Σ', 'Σ', true, 'Sigma'], ['Τ', 'Τ', true, 'Tau'], ['Υ', 'Υ', true, 'Upsilon'], ['Φ', 'Φ', true, 'Phi'], ['Χ', 'Χ', true, 'Chi'], ['Ψ', 'Ψ', true, 'Psi'], ['Ω', 'Ω', true, 'Omega'], ['α', 'α', true, 'alpha'], ['β', 'β', true, 'beta'], ['γ', 'γ', true, 'gamma'], ['δ', 'δ', true, 'delta'], ['ε', 'ε', true, 'epsilon'], ['ζ', 'ζ', true, 'zeta'], ['η', 'η', true, 'eta'], ['θ', 'θ', true, 'theta'], ['ι', 'ι', true, 'iota'], ['κ', 'κ', true, 'kappa'], ['λ', 'λ', true, 'lambda'], ['μ', 'μ', true, 'mu'], ['ν', 'ν', true, 'nu'], ['ξ', 'ξ', true, 'xi'], ['ο', 'ο', true, 'omicron'], ['π', 'π', true, 'pi'], ['ρ', 'ρ', true, 'rho'], ['ς', 'ς', true, 'final sigma'], ['σ', 'σ', true, 'sigma'], ['τ', 'τ', true, 'tau'], ['υ', 'υ', true, 'upsilon'], ['φ', 'φ', true, 'phi'], ['χ', 'χ', true, 'chi'], ['ψ', 'ψ', true, 'psi'], ['ω', 'ω', true, 'omega'], // symbols ['ℵ', 'ℵ', false,'alef symbol'], ['ϖ', 'ϖ', false,'pi symbol'], ['ℜ', 'ℜ', false,'real part symbol'], ['ϑ','ϑ', false,'theta symbol'], ['ϒ', 'ϒ', false,'upsilon - hook symbol'], ['℘', '℘', false,'Weierstrass p'], ['ℑ', 'ℑ', false,'imaginary part'], // arrows ['←', '←', true, 'leftwards arrow'], ['↑', '↑', true, 'upwards arrow'], ['→', '→', true, 'rightwards arrow'], ['↓', '↓', true, 'downwards arrow'], ['↔', '↔', true, 'left right arrow'], ['↵', '↵', false,'carriage return'], ['⇐', '⇐', false,'leftwards double arrow'], ['⇑', '⇑', false,'upwards double arrow'], ['⇒', '⇒', false,'rightwards double arrow'], ['⇓', '⇓', false,'downwards double arrow'], ['⇔', '⇔', false,'left right double arrow'], ['∴', '∴', false,'therefore'], ['⊂', '⊂', false,'subset of'], ['⊃', '⊃', false,'superset of'], ['⊄', '⊄', false,'not a subset of'], ['⊆', '⊆', false,'subset of or equal to'], ['⊇', '⊇', false,'superset of or equal to'], ['⊕', '⊕', false,'circled plus'], ['⊗', '⊗', false,'circled times'], ['⊥', '⊥', false,'perpendicular'], ['⋅', '⋅', false,'dot operator'], ['⌈', '⌈', false,'left ceiling'], ['⌉', '⌉', false,'right ceiling'], ['⌊', '⌊', false,'left floor'], ['⌋', '⌋', false,'right floor'], ['⟨', '〈', false,'left-pointing angle bracket'], ['⟩', '〉', false,'right-pointing angle bracket'], ['◊', '◊', true, 'lozenge'], ['♠', '♠', true, 'black spade suit'], ['♣', '♣', true, 'black club suit'], ['♥', '♥', true, 'black heart suit'], ['♦', '♦', true, 'black diamond suit'], [' ', ' ', false,'en space'], [' ', ' ', false,'em space'], [' ', ' ', false,'thin space'], ['‌', '‌', false,'zero width non-joiner'], ['‍', '‍', false,'zero width joiner'], ['‎', '‎', false,'left-to-right mark'], ['‏', '‏', false,'right-to-left mark'], ['­', '­', false,'soft hyphen'] ]; tinyMCEPopup.onInit.add(function() { tinyMCEPopup.dom.setHTML('charmapView', renderCharMapHTML()); addKeyboardNavigation(); }); function addKeyboardNavigation(){ var tableElm, cells, settings; cells = tinyMCEPopup.dom.select("a.charmaplink", "charmapgroup"); settings ={ root: "charmapgroup", items: cells }; cells[0].tabindex=0; tinyMCEPopup.dom.addClass(cells[0], "mceFocus"); if (tinymce.isGecko) { cells[0].focus(); } else { setTimeout(function(){ cells[0].focus(); }, 100); } tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', settings, tinyMCEPopup.dom); } function renderCharMapHTML() { var charsPerRow = 20, tdWidth=20, tdHeight=20, i; var html = '
    '+ ''; var cols=-1; for (i=0; i' + '' + charmap[i][1] + ''; if ((cols+1) % charsPerRow == 0) html += ''; } } if (cols % charsPerRow > 0) { var padd = charsPerRow - (cols % charsPerRow); for (var i=0; i '; } html += '
    '; html = html.replace(/<\/tr>/g, ''); return html; } function insertChar(chr) { tinyMCEPopup.execCommand('mceInsertContent', false, '&#' + chr + ';'); // Refocus in window if (tinyMCEPopup.isWindow) window.focus(); tinyMCEPopup.editor.focus(); tinyMCEPopup.close(); } function previewChar(codeA, codeB, codeN) { var elmA = document.getElementById('codeA'); var elmB = document.getElementById('codeB'); var elmV = document.getElementById('codeV'); var elmN = document.getElementById('codeN'); if (codeA=='#160;') { elmV.innerHTML = '__'; } else { elmV.innerHTML = '&' + codeA; } elmB.innerHTML = '&' + codeA; elmA.innerHTML = '&' + codeB; elmN.innerHTML = codeN; } ================================================ FILE: static/js/tinymce/themes/advanced/js/color_picker.js ================================================ tinyMCEPopup.requireLangPack(); var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false; var colors = [ "#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033", "#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099", "#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff", "#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033", "#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399", "#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff", "#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333", "#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399", "#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff", "#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633", "#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699", "#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff", "#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633", "#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999", "#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff", "#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933", "#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999", "#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff", "#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33", "#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99", "#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff", "#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33", "#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99", "#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff", "#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33", "#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99", "#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff" ]; var named = { '#F0F8FF':'Alice Blue','#FAEBD7':'Antique White','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige', '#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'Blanched Almond','#0000FF':'Blue','#8A2BE2':'Blue Violet','#A52A2A':'Brown', '#DEB887':'Burly Wood','#5F9EA0':'Cadet Blue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'Cornflower Blue', '#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'Dark Blue','#008B8B':'Dark Cyan','#B8860B':'Dark Golden Rod', '#A9A9A9':'Dark Gray','#A9A9A9':'Dark Grey','#006400':'Dark Green','#BDB76B':'Dark Khaki','#8B008B':'Dark Magenta','#556B2F':'Dark Olive Green', '#FF8C00':'Darkorange','#9932CC':'Dark Orchid','#8B0000':'Dark Red','#E9967A':'Dark Salmon','#8FBC8F':'Dark Sea Green','#483D8B':'Dark Slate Blue', '#2F4F4F':'Dark Slate Gray','#2F4F4F':'Dark Slate Grey','#00CED1':'Dark Turquoise','#9400D3':'Dark Violet','#FF1493':'Deep Pink','#00BFFF':'Deep Sky Blue', '#696969':'Dim Gray','#696969':'Dim Grey','#1E90FF':'Dodger Blue','#B22222':'Fire Brick','#FFFAF0':'Floral White','#228B22':'Forest Green', '#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'Ghost White','#FFD700':'Gold','#DAA520':'Golden Rod','#808080':'Gray','#808080':'Grey', '#008000':'Green','#ADFF2F':'Green Yellow','#F0FFF0':'Honey Dew','#FF69B4':'Hot Pink','#CD5C5C':'Indian Red','#4B0082':'Indigo','#FFFFF0':'Ivory', '#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'Lavender Blush','#7CFC00':'Lawn Green','#FFFACD':'Lemon Chiffon','#ADD8E6':'Light Blue', '#F08080':'Light Coral','#E0FFFF':'Light Cyan','#FAFAD2':'Light Golden Rod Yellow','#D3D3D3':'Light Gray','#D3D3D3':'Light Grey','#90EE90':'Light Green', '#FFB6C1':'Light Pink','#FFA07A':'Light Salmon','#20B2AA':'Light Sea Green','#87CEFA':'Light Sky Blue','#778899':'Light Slate Gray','#778899':'Light Slate Grey', '#B0C4DE':'Light Steel Blue','#FFFFE0':'Light Yellow','#00FF00':'Lime','#32CD32':'Lime Green','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon', '#66CDAA':'Medium Aqua Marine','#0000CD':'Medium Blue','#BA55D3':'Medium Orchid','#9370D8':'Medium Purple','#3CB371':'Medium Sea Green','#7B68EE':'Medium Slate Blue', '#00FA9A':'Medium Spring Green','#48D1CC':'Medium Turquoise','#C71585':'Medium Violet Red','#191970':'Midnight Blue','#F5FFFA':'Mint Cream','#FFE4E1':'Misty Rose','#FFE4B5':'Moccasin', '#FFDEAD':'Navajo White','#000080':'Navy','#FDF5E6':'Old Lace','#808000':'Olive','#6B8E23':'Olive Drab','#FFA500':'Orange','#FF4500':'Orange Red','#DA70D6':'Orchid', '#EEE8AA':'Pale Golden Rod','#98FB98':'Pale Green','#AFEEEE':'Pale Turquoise','#D87093':'Pale Violet Red','#FFEFD5':'Papaya Whip','#FFDAB9':'Peach Puff', '#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'Powder Blue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'Rosy Brown','#4169E1':'Royal Blue', '#8B4513':'Saddle Brown','#FA8072':'Salmon','#F4A460':'Sandy Brown','#2E8B57':'Sea Green','#FFF5EE':'Sea Shell','#A0522D':'Sienna','#C0C0C0':'Silver', '#87CEEB':'Sky Blue','#6A5ACD':'Slate Blue','#708090':'Slate Gray','#708090':'Slate Grey','#FFFAFA':'Snow','#00FF7F':'Spring Green', '#4682B4':'Steel Blue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet', '#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'White Smoke','#FFFF00':'Yellow','#9ACD32':'Yellow Green' }; var namedLookup = {}; function init() { var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color')), key, value; tinyMCEPopup.resizeToInnerSize(); generatePicker(); generateWebColors(); generateNamedColors(); if (inputColor) { changeFinalColor(inputColor); col = convertHexToRGB(inputColor); if (col) updateLight(col.r, col.g, col.b); } for (key in named) { value = named[key]; namedLookup[value.replace(/\s+/, '').toLowerCase()] = key.replace(/#/, '').toLowerCase(); } } function toHexColor(color) { var matches, red, green, blue, toInt = parseInt; function hex(value) { value = parseInt(value).toString(16); return value.length > 1 ? value : '0' + value; // Padd with leading zero }; color = tinymce.trim(color); color = color.replace(/^[#]/, '').toLowerCase(); // remove leading '#' color = namedLookup[color] || color; matches = /^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/.exec(color); if (matches) { red = toInt(matches[1]); green = toInt(matches[2]); blue = toInt(matches[3]); } else { matches = /^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/.exec(color); if (matches) { red = toInt(matches[1], 16); green = toInt(matches[2], 16); blue = toInt(matches[3], 16); } else { matches = /^([0-9a-f])([0-9a-f])([0-9a-f])$/.exec(color); if (matches) { red = toInt(matches[1] + matches[1], 16); green = toInt(matches[2] + matches[2], 16); blue = toInt(matches[3] + matches[3], 16); } else { return ''; } } } return '#' + hex(red) + hex(green) + hex(blue); } function insertAction() { var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func'); var hexColor = toHexColor(color); if (hexColor === '') { var text = tinyMCEPopup.editor.getLang('advanced_dlg.invalid_color_value'); tinyMCEPopup.alert(text + ': ' + color); } else { tinyMCEPopup.restoreSelection(); if (f) f(hexColor); tinyMCEPopup.close(); } } function showColor(color, name) { if (name) document.getElementById("colorname").innerHTML = name; document.getElementById("preview").style.backgroundColor = color; document.getElementById("color").value = color.toUpperCase(); } function convertRGBToHex(col) { var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi"); if (!col) return col; var rgb = col.replace(re, "$1,$2,$3").split(','); if (rgb.length == 3) { r = parseInt(rgb[0]).toString(16); g = parseInt(rgb[1]).toString(16); b = parseInt(rgb[2]).toString(16); r = r.length == 1 ? '0' + r : r; g = g.length == 1 ? '0' + g : g; b = b.length == 1 ? '0' + b : b; return "#" + r + g + b; } return col; } function convertHexToRGB(col) { if (col.indexOf('#') != -1) { col = col.replace(new RegExp('[^0-9A-F]', 'gi'), ''); r = parseInt(col.substring(0, 2), 16); g = parseInt(col.substring(2, 4), 16); b = parseInt(col.substring(4, 6), 16); return {r : r, g : g, b : b}; } return null; } function generatePicker() { var el = document.getElementById('light'), h = '', i; for (i = 0; i < detail; i++){ h += '
    '; } el.innerHTML = h; } function generateWebColors() { var el = document.getElementById('webcolors'), h = '', i; if (el.className == 'generated') return; // TODO: VoiceOver doesn't seem to support legend as a label referenced by labelledby. h += ''; el.innerHTML = h; el.className = 'generated'; paintCanvas(el); enableKeyboardNavigation(el.firstChild); } function paintCanvas(el) { tinyMCEPopup.getWin().tinymce.each(tinyMCEPopup.dom.select('canvas.mceColorSwatch', el), function(canvas) { var context; if (canvas.getContext && (context = canvas.getContext("2d"))) { context.fillStyle = canvas.getAttribute('data-color'); context.fillRect(0, 0, 10, 10); } }); } function generateNamedColors() { var el = document.getElementById('namedcolors'), h = '', n, v, i = 0; if (el.className == 'generated') return; for (n in named) { v = named[n]; h += ''; if (tinyMCEPopup.editor.forcedHighContrastMode) { h += ''; } h += ''; h += ''; i++; } el.innerHTML = h; el.className = 'generated'; paintCanvas(el); enableKeyboardNavigation(el); } function enableKeyboardNavigation(el) { tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', { root: el, items: tinyMCEPopup.dom.select('a', el) }, tinyMCEPopup.dom); } function dechex(n) { return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16); } function computeColor(e) { var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB, pos = tinyMCEPopup.dom.getPos(e.target); x = e.offsetX ? e.offsetX : (e.target ? e.clientX - pos.x : 0); y = e.offsetY ? e.offsetY : (e.target ? e.clientY - pos.y : 0); partWidth = document.getElementById('colors').width / 6; partDetail = detail / 2; imHeight = document.getElementById('colors').height; r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255; g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255 + (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth); b = (x >= 2*partWidth)*(x < 3*partWidth)*(-2*255 + x * 255 / partWidth) + (x >= 3*partWidth)*(x < 5*partWidth)*255 + (x >= 5*partWidth)*(x < 6*partWidth)*(6*255 - x * 255 / partWidth); coef = (imHeight - y) / imHeight; r = 128 + (r - 128) * coef; g = 128 + (g - 128) * coef; b = 128 + (b - 128) * coef; changeFinalColor('#' + dechex(r) + dechex(g) + dechex(b)); updateLight(r, g, b); } function updateLight(r, g, b) { var i, partDetail = detail / 2, finalCoef, finalR, finalG, finalB, color; for (i=0; i=0) && (i'); }, init : function() { var f = document.forms[0], ed = tinyMCEPopup.editor; // Setup browse button document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image'); if (isVisible('srcbrowser')) document.getElementById('src').style.width = '180px'; e = ed.selection.getNode(); this.fillFileList('image_list', tinyMCEPopup.getParam('external_image_list', 'tinyMCEImageList')); if (e.nodeName == 'IMG') { f.src.value = ed.dom.getAttrib(e, 'src'); f.alt.value = ed.dom.getAttrib(e, 'alt'); f.border.value = this.getAttrib(e, 'border'); f.vspace.value = this.getAttrib(e, 'vspace'); f.hspace.value = this.getAttrib(e, 'hspace'); f.width.value = ed.dom.getAttrib(e, 'width'); f.height.value = ed.dom.getAttrib(e, 'height'); f.insert.value = ed.getLang('update'); this.styleVal = ed.dom.getAttrib(e, 'style'); selectByValue(f, 'image_list', f.src.value); selectByValue(f, 'align', this.getAttrib(e, 'align')); this.updateStyle(); } }, fillFileList : function(id, l) { var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; l = typeof(l) === 'function' ? l() : window[l]; if (l && l.length > 0) { lst.options[lst.options.length] = new Option('', ''); tinymce.each(l, function(o) { lst.options[lst.options.length] = new Option(o[0], o[1]); }); } else dom.remove(dom.getParent(id, 'tr')); }, update : function() { var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, args = {}, el; tinyMCEPopup.restoreSelection(); if (f.src.value === '') { if (ed.selection.getNode().nodeName == 'IMG') { ed.dom.remove(ed.selection.getNode()); ed.execCommand('mceRepaint'); } tinyMCEPopup.close(); return; } if (!ed.settings.inline_styles) { args = tinymce.extend(args, { vspace : nl.vspace.value, hspace : nl.hspace.value, border : nl.border.value, align : getSelectValue(f, 'align') }); } else args.style = this.styleVal; tinymce.extend(args, { src : f.src.value.replace(/ /g, '%20'), alt : f.alt.value, width : f.width.value, height : f.height.value }); el = ed.selection.getNode(); if (el && el.nodeName == 'IMG') { ed.dom.setAttribs(el, args); tinyMCEPopup.editor.execCommand('mceRepaint'); tinyMCEPopup.editor.focus(); } else { tinymce.each(args, function(value, name) { if (value === "") { delete args[name]; } }); ed.execCommand('mceInsertContent', false, tinyMCEPopup.editor.dom.createHTML('img', args), {skip_undo : 1}); ed.undoManager.add(); } tinyMCEPopup.close(); }, updateStyle : function() { var dom = tinyMCEPopup.dom, st = {}, v, f = document.forms[0]; if (tinyMCEPopup.editor.settings.inline_styles) { tinymce.each(tinyMCEPopup.dom.parseStyle(this.styleVal), function(value, key) { st[key] = value; }); // Handle align v = getSelectValue(f, 'align'); if (v) { if (v == 'left' || v == 'right') { st['float'] = v; delete st['vertical-align']; } else { st['vertical-align'] = v; delete st['float']; } } else { delete st['float']; delete st['vertical-align']; } // Handle border v = f.border.value; if (v || v == '0') { if (v == '0') st['border'] = '0'; else st['border'] = v + 'px solid black'; } else delete st['border']; // Handle hspace v = f.hspace.value; if (v) { delete st['margin']; st['margin-left'] = v + 'px'; st['margin-right'] = v + 'px'; } else { delete st['margin-left']; delete st['margin-right']; } // Handle vspace v = f.vspace.value; if (v) { delete st['margin']; st['margin-top'] = v + 'px'; st['margin-bottom'] = v + 'px'; } else { delete st['margin-top']; delete st['margin-bottom']; } // Merge st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st), 'img'); this.styleVal = dom.serializeStyle(st, 'img'); } }, getAttrib : function(e, at) { var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2; if (ed.settings.inline_styles) { switch (at) { case 'align': if (v = dom.getStyle(e, 'float')) return v; if (v = dom.getStyle(e, 'vertical-align')) return v; break; case 'hspace': v = dom.getStyle(e, 'margin-left') v2 = dom.getStyle(e, 'margin-right'); if (v && v == v2) return parseInt(v.replace(/[^0-9]/g, '')); break; case 'vspace': v = dom.getStyle(e, 'margin-top') v2 = dom.getStyle(e, 'margin-bottom'); if (v && v == v2) return parseInt(v.replace(/[^0-9]/g, '')); break; case 'border': v = 0; tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) { sv = dom.getStyle(e, 'border-' + sv + '-width'); // False or not the same as prev if (!sv || (sv != v && v !== 0)) { v = 0; return false; } if (sv) v = sv; }); if (v) return parseInt(v.replace(/[^0-9]/g, '')); break; } } if (v = dom.getAttrib(e, at)) return v; return ''; }, resetImageData : function() { var f = document.forms[0]; f.width.value = f.height.value = ""; }, updateImageData : function() { var f = document.forms[0], t = ImageDialog; if (f.width.value == "") f.width.value = t.preloadImg.width; if (f.height.value == "") f.height.value = t.preloadImg.height; }, getImageData : function() { var f = document.forms[0]; this.preloadImg = new Image(); this.preloadImg.onload = this.updateImageData; this.preloadImg.onerror = this.resetImageData; this.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.src.value); } }; ImageDialog.preInit(); tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog); ================================================ FILE: static/js/tinymce/themes/advanced/js/link.js ================================================ tinyMCEPopup.requireLangPack(); var LinkDialog = { preInit : function() { var url; if (url = tinyMCEPopup.getParam("external_link_list_url")) document.write(''); }, init : function() { var f = document.forms[0], ed = tinyMCEPopup.editor; // Setup browse button document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser', 'href', 'file', 'theme_advanced_link'); if (isVisible('hrefbrowser')) document.getElementById('href').style.width = '180px'; this.fillClassList('class_list'); this.fillFileList('link_list', 'tinyMCELinkList'); this.fillTargetList('target_list'); if (e = ed.dom.getParent(ed.selection.getNode(), 'A')) { f.href.value = ed.dom.getAttrib(e, 'href'); f.linktitle.value = ed.dom.getAttrib(e, 'title'); f.insert.value = ed.getLang('update'); selectByValue(f, 'link_list', f.href.value); selectByValue(f, 'target_list', ed.dom.getAttrib(e, 'target')); selectByValue(f, 'class_list', ed.dom.getAttrib(e, 'class')); } }, update : function() { var f = document.forms[0], ed = tinyMCEPopup.editor, e, b, href = f.href.value.replace(/ /g, '%20'); tinyMCEPopup.restoreSelection(); e = ed.dom.getParent(ed.selection.getNode(), 'A'); // Remove element if there is no href if (!f.href.value) { if (e) { b = ed.selection.getBookmark(); ed.dom.remove(e, 1); ed.selection.moveToBookmark(b); tinyMCEPopup.execCommand("mceEndUndoLevel"); tinyMCEPopup.close(); return; } } // Create new anchor elements if (e == null) { ed.getDoc().execCommand("unlink", false, null); tinyMCEPopup.execCommand("mceInsertLink", false, "#mce_temp_url#", {skip_undo : 1}); tinymce.each(ed.dom.select("a"), function(n) { if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') { e = n; ed.dom.setAttribs(e, { href : href, title : f.linktitle.value, target : f.target_list ? getSelectValue(f, "target_list") : null, 'class' : f.class_list ? getSelectValue(f, "class_list") : null }); } }); } else { ed.dom.setAttribs(e, { href : href, title : f.linktitle.value }); if (f.target_list) { ed.dom.setAttrib(e, 'target', getSelectValue(f, "target_list")); } if (f.class_list) { ed.dom.setAttrib(e, 'class', getSelectValue(f, "class_list")); } } // Don't move caret if selection was image if (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') { ed.focus(); ed.selection.select(e); ed.selection.collapse(0); tinyMCEPopup.storeSelection(); } tinyMCEPopup.execCommand("mceEndUndoLevel"); tinyMCEPopup.close(); }, checkPrefix : function(n) { if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email'))) n.value = 'mailto:' + n.value; if (/^\s*www\./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external'))) n.value = 'http://' + n.value; }, fillFileList : function(id, l) { var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; l = window[l]; if (l && l.length > 0) { lst.options[lst.options.length] = new Option('', ''); tinymce.each(l, function(o) { lst.options[lst.options.length] = new Option(o[0], o[1]); }); } else dom.remove(dom.getParent(id, 'tr')); }, fillClassList : function(id) { var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; if (v = tinyMCEPopup.getParam('theme_advanced_styles')) { cl = []; tinymce.each(v.split(';'), function(v) { var p = v.split('='); cl.push({'title' : p[0], 'class' : p[1]}); }); } else cl = tinyMCEPopup.editor.dom.getClasses(); if (cl.length > 0) { lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); tinymce.each(cl, function(o) { lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']); }); } else dom.remove(dom.getParent(id, 'tr')); }, fillTargetList : function(id) { var dom = tinyMCEPopup.dom, lst = dom.get(id), v; lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_same'), '_self'); lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_blank'), '_blank'); if (v = tinyMCEPopup.getParam('theme_advanced_link_targets')) { tinymce.each(v.split(','), function(v) { v = v.split('='); lst.options[lst.options.length] = new Option(v[0], v[1]); }); } } }; LinkDialog.preInit(); tinyMCEPopup.onInit.add(LinkDialog.init, LinkDialog); ================================================ FILE: static/js/tinymce/themes/advanced/js/source_editor.js ================================================ tinyMCEPopup.requireLangPack(); tinyMCEPopup.onInit.add(onLoadInit); function saveContent() { tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value, {source_view : true}); tinyMCEPopup.close(); } function onLoadInit() { tinyMCEPopup.resizeToInnerSize(); // Remove Gecko spellchecking if (tinymce.isGecko) document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck"); document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true}); if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) { turnWrapOn(); document.getElementById('wraped').checked = true; } resizeInputs(); } function setWrap(val) { var v, n, s = document.getElementById('htmlSource'); s.wrap = val; if (!tinymce.isIE) { v = s.value; n = s.cloneNode(false); n.setAttribute("wrap", val); s.parentNode.replaceChild(n, s); n.value = v; } } function setWhiteSpaceCss(value) { var el = document.getElementById('htmlSource'); tinymce.DOM.setStyle(el, 'white-space', value); } function turnWrapOff() { if (tinymce.isWebKit) { setWhiteSpaceCss('pre'); } else { setWrap('off'); } } function turnWrapOn() { if (tinymce.isWebKit) { setWhiteSpaceCss('pre-wrap'); } else { setWrap('soft'); } } function toggleWordWrap(elm) { if (elm.checked) { turnWrapOn(); } else { turnWrapOff(); } } function resizeInputs() { var vp = tinyMCEPopup.dom.getViewPort(window), el; el = document.getElementById('htmlSource'); if (el) { el.style.width = (vp.w - 20) + 'px'; el.style.height = (vp.h - 65) + 'px'; } } ================================================ FILE: static/js/tinymce/themes/advanced/langs/en.js ================================================ tinyMCE.addI18n('en.advanced',{"underline_desc":"Underline (Ctrl+U)","italic_desc":"Italic (Ctrl+I)","bold_desc":"Bold (Ctrl+B)",dd:"Definition Description",dt:"Definition Term ",samp:"Code Sample",code:"Code",blockquote:"Block Quote",h6:"Heading 6",h5:"Heading 5",h4:"Heading 4",h3:"Heading 3",h2:"Heading 2",h1:"Heading 1",pre:"Preformatted",address:"Address",div:"DIV",paragraph:"Paragraph",block:"Format",fontdefault:"Font Family","font_size":"Font Size","style_select":"Styles","anchor_delta_height":"","anchor_delta_width":"","charmap_delta_height":"","charmap_delta_width":"","colorpicker_delta_height":"","colorpicker_delta_width":"","link_delta_height":"","link_delta_width":"","image_delta_height":"","image_delta_width":"","more_colors":"More Colors...","toolbar_focus":"Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X",newdocument:"Are you sure you want clear all contents?",path:"Path","clipboard_msg":"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?","blockquote_desc":"Block Quote","help_desc":"Help","newdocument_desc":"New Document","image_props_desc":"Image Properties","paste_desc":"Paste (Ctrl+V)","copy_desc":"Copy (Ctrl+C)","cut_desc":"Cut (Ctrl+X)","anchor_desc":"Insert/Edit Anchor","visualaid_desc":"show/Hide Guidelines/Invisible Elements","charmap_desc":"Insert Special Character","backcolor_desc":"Select Background Color","forecolor_desc":"Select Text Color","custom1_desc":"Your Custom Description Here","removeformat_desc":"Remove Formatting","hr_desc":"Insert Horizontal Line","sup_desc":"Superscript","sub_desc":"Subscript","code_desc":"Edit HTML Source","cleanup_desc":"Cleanup Messy Code","image_desc":"Insert/Edit Image","unlink_desc":"Unlink","link_desc":"Insert/Edit Link","redo_desc":"Redo (Ctrl+Y)","undo_desc":"Undo (Ctrl+Z)","indent_desc":"Increase Indent","outdent_desc":"Decrease Indent","numlist_desc":"Insert/Remove Numbered List","bullist_desc":"Insert/Remove Bulleted List","justifyfull_desc":"Align Full","justifyright_desc":"Align Right","justifycenter_desc":"Align Center","justifyleft_desc":"Align Left","striketrough_desc":"Strikethrough","help_shortcut":"Press ALT-F10 for toolbar. Press ALT-0 for help","rich_text_area":"Rich Text Area","shortcuts_desc":"Accessability Help",toolbar:"Toolbar"}); ================================================ FILE: static/js/tinymce/themes/advanced/langs/en_dlg.js ================================================ tinyMCE.addI18n('en.advanced_dlg', {"link_list":"Link List","link_is_external":"The URL you entered seems to be an external link. Do you want to add the required http:// prefix?","link_is_email":"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?","link_titlefield":"Title","link_target_blank":"Open Link in a New Window","link_target_same":"Open Link in the Same Window","link_target":"Target","link_url":"Link URL","link_title":"Insert/Edit Link","image_align_right":"Right","image_align_left":"Left","image_align_textbottom":"Text Bottom","image_align_texttop":"Text Top","image_align_bottom":"Bottom","image_align_middle":"Middle","image_align_top":"Top","image_align_baseline":"Baseline","image_align":"Alignment","image_hspace":"Horizontal Space","image_vspace":"Vertical Space","image_dimensions":"Dimensions","image_alt":"Image Description","image_list":"Image List","image_border":"Border","image_src":"Image URL","image_title":"Insert/Edit Image","charmap_title":"Select Special Character", "charmap_usage":"Use left and right arrows to navigate.","colorpicker_name":"Name:","colorpicker_color":"Color:","colorpicker_named_title":"Named Colors","colorpicker_named_tab":"Named","colorpicker_palette_title":"Palette Colors","colorpicker_palette_tab":"Palette","colorpicker_picker_title":"Color Picker","colorpicker_picker_tab":"Picker","colorpicker_title":"Select a Color","code_wordwrap":"Word Wrap","code_title":"HTML Source Editor","anchor_name":"Anchor Name","anchor_title":"Insert/Edit Anchor","about_loaded":"Loaded Plugins","about_version":"Version","about_author":"Author","about_plugin":"Plugin","about_plugins":"Plugins","about_license":"License","about_help":"Help","about_general":"About","about_title":"About TinyMCE","anchor_invalid":"Please specify a valid anchor name.","accessibility_help":"Accessibility Help","accessibility_usage_title":"General Usage","invalid_color_value":"Invalid color value","":""}); ================================================ FILE: static/js/tinymce/themes/advanced/link.htm ================================================ {#advanced_dlg.link_title}
     
    ================================================ FILE: static/js/tinymce/themes/advanced/shortcuts.htm ================================================ {#advanced_dlg.accessibility_help}

    {#advanced_dlg.accessibility_usage_title}

    Toolbars

    Press ALT-F10 to move focus to the toolbars. Navigate through the buttons using the arrow keys. Press enter to activate a button and return focus to the editor. Press escape to return focus to the editor without performing any actions.

    Status Bar

    To access the editor status bar, press ALT-F11. Use the left and right arrow keys to navigate between elements in the path. Press enter or space to select an element. Press escape to return focus to the editor without changing the selection.

    Context Menu

    Press shift-F10 to activate the context menu. Use the up and down arrow keys to move between menu items. To open sub-menus press the right arrow key. To close submenus press the left arrow key. Press escape to close the context menu.

    Keyboard Shortcuts

    Keystroke Function
    Control-BBold
    Control-IItalic
    Control-ZUndo
    Control-YRedo
    ================================================ FILE: static/js/tinymce/themes/advanced/skins/default/content.css ================================================ body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;} body {background:#FFF;} body.mceForceColors {background:#FFF; color:#000;} body.mceBrowserDefaults {background:transparent; color:inherit; font-size:inherit; font-family:inherit;} h1 {font-size: 2em} h2 {font-size: 1.5em} h3 {font-size: 1.17em} h4 {font-size: 1em} h5 {font-size: .83em} h6 {font-size: .75em} .mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;} a.mceItemAnchor {display:inline-block; -webkit-user-select:all; -webkit-user-modify:read-only; -moz-user-select:all; -moz-user-modify:read-only; width:11px !important; height:11px !important; background:url(img/items.gif) no-repeat center center} span.mceItemNbsp {background: #DDD} td.mceSelected, th.mceSelected {background-color:#3399ff !important} img {border:0;} table, img, hr, .mceItemAnchor {cursor:default} table td, table th {cursor:text} ins {border-bottom:1px solid green; text-decoration: none; color:green} del {color:red; text-decoration:line-through} cite {border-bottom:1px dashed blue} acronym {border-bottom:1px dotted #CCC; cursor:help} abbr {border-bottom:1px dashed #CCC; cursor:help} /* IE */ * html body { scrollbar-3dlight-color:#F0F0EE; scrollbar-arrow-color:#676662; scrollbar-base-color:#F0F0EE; scrollbar-darkshadow-color:#DDD; scrollbar-face-color:#E0E0DD; scrollbar-highlight-color:#F0F0EE; scrollbar-shadow-color:#F0F0EE; scrollbar-track-color:#F5F5F5; } img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px} font[face=mceinline] {font-family:inherit !important} *[contentEditable]:focus {outline:0} .mceItemMedia {border:1px dotted #cc0000; background-position:center; background-repeat:no-repeat; background-color:#ffffcc} .mceItemShockWave {background-image:url(../../img/shockwave.gif)} .mceItemFlash {background-image:url(../../img/flash.gif)} .mceItemQuickTime {background-image:url(../../img/quicktime.gif)} .mceItemWindowsMedia {background-image:url(../../img/windowsmedia.gif)} .mceItemRealMedia {background-image:url(../../img/realmedia.gif)} .mceItemVideo {background-image:url(../../img/video.gif)} .mceItemAudio {background-image:url(../../img/video.gif)} .mceItemEmbeddedAudio {background-image:url(../../img/video.gif)} .mceItemIframe {background-image:url(../../img/iframe.gif)} .mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../../img/pagebreak.gif) no-repeat center top;} ================================================ FILE: static/js/tinymce/themes/advanced/skins/default/dialog.css ================================================ /* Generic */ body { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; scrollbar-3dlight-color:#F0F0EE; scrollbar-arrow-color:#676662; scrollbar-base-color:#F0F0EE; scrollbar-darkshadow-color:#DDDDDD; scrollbar-face-color:#E0E0DD; scrollbar-highlight-color:#F0F0EE; scrollbar-shadow-color:#F0F0EE; scrollbar-track-color:#F5F5F5; background:#F0F0EE; padding:0; margin:8px 8px 0 8px; } html {background:#F0F0EE;} td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} textarea {resize:none;outline:none;} a:link, a:visited {color:black;} a:hover {color:#2B6FB6;} .nowrap {white-space: nowrap} /* Forms */ fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;} legend {color:#2B6FB6; font-weight:bold;} label.msg {display:none;} label.invalid {color:#EE0000; display:inline;} input.invalid {border:1px solid #EE0000;} input {background:#FFF; border:1px solid #CCC;} input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} input, select, textarea {border:1px solid #808080;} input.radio {border:1px none #000000; background:transparent; vertical-align:middle;} input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;} .input_noborder {border:0;} /* Buttons */ #insert, #cancel, input.button, .updateButton { border:0; margin:0; padding:0; font-weight:bold; width:94px; height:26px; background:url(img/buttons.png) 0 -26px; cursor:pointer; padding-bottom:2px; float:left; } #insert {background:url(img/buttons.png) 0 -52px} #cancel {background:url(img/buttons.png) 0 0; float:right} /* Browse */ a.pickcolor, a.browse {text-decoration:none} a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;} .mceOldBoxModel a.browse span {width:22px; height:20px;} a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;} a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} a.browse:hover span.disabled {border:1px solid white; background-color:transparent;} a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;} .mceOldBoxModel a.pickcolor span {width:21px; height:17px;} a.pickcolor:hover span {background-color:#B2BBD0;} a.pickcolor:hover span.disabled {} /* Charmap */ table.charmap {border:1px solid #AAA; text-align:center} td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;} #charmap a {display:block; color:#000; text-decoration:none; border:0} #charmap a:hover {background:#CCC;color:#2B6FB6} #charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center} #charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center} /* Source */ .wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;} .mceActionPanel {margin-top:5px;} /* Tabs classes */ .tabs {width:100%; height:18px; line-height:normal; background:url(img/tabs.gif) repeat-x 0 -72px;} .tabs ul {margin:0; padding:0; list-style:none;} .tabs li {float:left; background:url(img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;} .tabs li.current {background:url(img/tabs.gif) no-repeat 0 -18px; margin-right:2px;} .tabs span {float:left; display:block; background:url(img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;} .tabs .current span {background:url(img/tabs.gif) no-repeat right -54px;} .tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;} .tabs a:link, .tabs a:visited, .tabs a:hover {color:black;} /* Panels */ .panel_wrapper div.panel {display:none;} .panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;} .panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;} /* Columns */ .column {float:left;} .properties {width:100%;} .properties .column1 {} .properties .column2 {text-align:left;} /* Titles */ h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;} h3 {font-size:14px;} .title {font-size:12px; font-weight:bold; color:#2B6FB6;} /* Dialog specific */ #link .panel_wrapper, #link div.current {height:125px;} #image .panel_wrapper, #image div.current {height:200px;} #plugintable thead {font-weight:bold; background:#DDD;} #plugintable, #about #plugintable td {border:1px solid #919B9C;} #plugintable {width:96%; margin-top:10px;} #pluginscontainer {height:290px; overflow:auto;} #colorpicker #preview {display:inline-block; padding-left:40px; height:14px; border:1px solid black; margin-left:5px; margin-right: 5px} #colorpicker #previewblock {position: relative; top: -3px; padding-left:5px; padding-top: 0px; display:inline} #colorpicker #preview_wrapper { text-align:center; padding-top:4px; white-space: nowrap} #colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;} #colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;} #colorpicker #light div {overflow:hidden;} #colorpicker .panel_wrapper div.current {height:175px;} #colorpicker #namedcolors {width:150px;} #colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;} #colorpicker #colornamecontainer {margin-top:5px;} #colorpicker #picker_panel fieldset {margin:auto;width:325px;} ================================================ FILE: static/js/tinymce/themes/advanced/skins/default/ui.css ================================================ /* Reset */ .defaultSkin table, .defaultSkin tbody, .defaultSkin a, .defaultSkin img, .defaultSkin tr, .defaultSkin div, .defaultSkin td, .defaultSkin iframe, .defaultSkin span, .defaultSkin *, .defaultSkin .mceText {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate; text-align:left} .defaultSkin a:hover, .defaultSkin a:link, .defaultSkin a:visited, .defaultSkin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000} .defaultSkin table td {vertical-align:middle} /* Containers */ .defaultSkin table {direction:ltr;background:transparent} .defaultSkin iframe {display:block;} .defaultSkin .mceToolbar {height:26px} .defaultSkin .mceLeft {text-align:left} .defaultSkin .mceRight {text-align:right} /* External */ .defaultSkin .mceExternalToolbar {position:absolute; border:1px solid #CCC; border-bottom:0; display:none;} .defaultSkin .mceExternalToolbar td.mceToolbar {padding-right:13px;} .defaultSkin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0} /* Layout */ .defaultSkin table.mceLayout {border:0; border-left:1px solid #CCC; border-right:1px solid #CCC} .defaultSkin table.mceLayout tr.mceFirst td {border-top:1px solid #CCC} .defaultSkin table.mceLayout tr.mceLast td {border-bottom:1px solid #CCC} .defaultSkin table.mceToolbar, .defaultSkin tr.mceFirst .mceToolbar tr td, .defaultSkin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0;} .defaultSkin td.mceToolbar {background:#F0F0EE; padding-top:1px; vertical-align:top} .defaultSkin .mceIframeContainer {border-top:1px solid #CCC; border-bottom:1px solid #CCC} .defaultSkin .mceStatusbar {background:#F0F0EE; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; display:block; height:20px} .defaultSkin .mceStatusbar div {float:left; margin:2px} .defaultSkin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize; outline:0} .defaultSkin .mceStatusbar a:hover {text-decoration:underline} .defaultSkin table.mceToolbar {margin-left:3px} .defaultSkin span.mceIcon, .defaultSkin img.mceIcon {display:block; width:20px; height:20px} .defaultSkin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px} .defaultSkin td.mceCenter {text-align:center;} .defaultSkin td.mceCenter table {margin:0 auto; text-align:left;} .defaultSkin td.mceRight table {margin:0 0 0 auto;} /* Button */ .defaultSkin .mceButton {display:block; border:1px solid #F0F0EE; width:20px; height:20px; margin-right:1px} .defaultSkin a.mceButtonEnabled:hover {border:1px solid #0A246A; background-color:#B2BBD0} .defaultSkin a.mceButtonActive, .defaultSkin a.mceButtonSelected {border:1px solid #0A246A; background-color:#C2CBE0} .defaultSkin .mceButtonDisabled .mceIcon {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} .defaultSkin .mceButtonLabeled {width:auto} .defaultSkin .mceButtonLabeled span.mceIcon {float:left} .defaultSkin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica} .defaultSkin .mceButtonDisabled .mceButtonLabel {color:#888} /* Separator */ .defaultSkin .mceSeparator {display:block; background:url(../../img/icons.gif) -180px 0; width:2px; height:20px; margin:2px 2px 0 4px} /* ListBox */ .defaultSkin .mceListBox, .defaultSkin .mceListBox a {display:block} .defaultSkin .mceListBox .mceText {padding-left:4px; width:70px; text-align:left; border:1px solid #CCC; border-right:0; background:#FFF; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden} .defaultSkin .mceListBox .mceOpen {width:9px; height:20px; background:url(../../img/icons.gif) -741px 0; margin-right:2px; border:1px solid #CCC;} .defaultSkin table.mceListBoxEnabled:hover .mceText, .defaultSkin .mceListBoxHover .mceText, .defaultSkin .mceListBoxSelected .mceText {border:1px solid #A2ABC0; border-right:0; background:#FFF} .defaultSkin table.mceListBoxEnabled:hover .mceOpen, .defaultSkin .mceListBoxHover .mceOpen, .defaultSkin .mceListBoxSelected .mceOpen {background-color:#FFF; border:1px solid #A2ABC0} .defaultSkin .mceListBoxDisabled a.mceText {color:gray; background-color:transparent;} .defaultSkin .mceListBoxMenu {overflow:auto; overflow-x:hidden} .defaultSkin .mceOldBoxModel .mceListBox .mceText {height:22px} .defaultSkin .mceOldBoxModel .mceListBox .mceOpen {width:11px; height:22px;} .defaultSkin select.mceNativeListBox {font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:7pt; background:#F0F0EE; border:1px solid gray; margin-right:2px;} /* SplitButton */ .defaultSkin .mceSplitButton {width:32px; height:20px; direction:ltr} .defaultSkin .mceSplitButton a, .defaultSkin .mceSplitButton span {height:20px; display:block} .defaultSkin .mceSplitButton a.mceAction {width:20px; border:1px solid #F0F0EE; border-right:0;} .defaultSkin .mceSplitButton span.mceAction {width:20px; background-image:url(../../img/icons.gif);} .defaultSkin .mceSplitButton a.mceOpen {width:9px; background:url(../../img/icons.gif) -741px 0; border:1px solid #F0F0EE;} .defaultSkin .mceSplitButton span.mceOpen {display:none} .defaultSkin table.mceSplitButtonEnabled:hover a.mceAction, .defaultSkin .mceSplitButtonHover a.mceAction, .defaultSkin .mceSplitButtonSelected a.mceAction {border:1px solid #0A246A; border-right:0; background-color:#B2BBD0} .defaultSkin table.mceSplitButtonEnabled:hover a.mceOpen, .defaultSkin .mceSplitButtonHover a.mceOpen, .defaultSkin .mceSplitButtonSelected a.mceOpen {background-color:#B2BBD0; border:1px solid #0A246A;} .defaultSkin .mceSplitButtonDisabled .mceAction, .defaultSkin .mceSplitButtonDisabled a.mceOpen {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} .defaultSkin .mceSplitButtonActive a.mceAction {border:1px solid #0A246A; background-color:#C2CBE0} .defaultSkin .mceSplitButtonActive a.mceOpen {border-left:0;} /* ColorSplitButton */ .defaultSkin div.mceColorSplitMenu table {background:#FFF; border:1px solid gray} .defaultSkin .mceColorSplitMenu td {padding:2px} .defaultSkin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden; border:1px solid #808080} .defaultSkin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px} .defaultSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF} .defaultSkin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2} .defaultSkin a.mceMoreColors:hover {border:1px solid #0A246A} .defaultSkin .mceColorPreview {margin-left:2px; width:16px; height:4px; overflow:hidden; background:#9a9b9a} .defaultSkin .mce_forecolor span.mceAction, .defaultSkin .mce_backcolor span.mceAction {overflow:hidden; height:16px} /* Menu */ .defaultSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #D4D0C8; direction:ltr} .defaultSkin .mceNoIcons span.mceIcon {width:0;} .defaultSkin .mceNoIcons a .mceText {padding-left:10px} .defaultSkin .mceMenu table {background:#FFF} .defaultSkin .mceMenu a, .defaultSkin .mceMenu span, .defaultSkin .mceMenu {display:block} .defaultSkin .mceMenu td {height:20px} .defaultSkin .mceMenu a {position:relative;padding:3px 0 4px 0} .defaultSkin .mceMenu .mceText {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block} .defaultSkin .mceMenu span.mceText, .defaultSkin .mceMenu .mcePreview {font-size:11px} .defaultSkin .mceMenu pre.mceText {font-family:Monospace} .defaultSkin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:22px;} .defaultSkin .mceMenu .mceMenuItemEnabled a:hover, .defaultSkin .mceMenu .mceMenuItemActive {background-color:#dbecf3} .defaultSkin td.mceMenuItemSeparator {background:#DDD; height:1px} .defaultSkin .mceMenuItemTitle a {border:0; background:#EEE; border-bottom:1px solid #DDD} .defaultSkin .mceMenuItemTitle span.mceText {color:#000; font-weight:bold; padding-left:4px} .defaultSkin .mceMenuItemDisabled .mceText {color:#888} .defaultSkin .mceMenuItemSelected .mceIcon {background:url(img/menu_check.gif)} .defaultSkin .mceNoIcons .mceMenuItemSelected a {background:url(img/menu_arrow.gif) no-repeat -6px center} .defaultSkin .mceMenu span.mceMenuLine {display:none} .defaultSkin .mceMenuItemSub a {background:url(img/menu_arrow.gif) no-repeat top right;} .defaultSkin .mceMenuItem td, .defaultSkin .mceMenuItem th {line-height: normal} /* Progress,Resize */ .defaultSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50); background:#FFF} .defaultSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px} /* Rtl */ .mceRtl .mceListBox .mceText {text-align: right; padding: 0 4px 0 0} .mceRtl .mceMenuItem .mceText {text-align: right} /* Formats */ .defaultSkin .mce_formatPreview a {font-size:10px} .defaultSkin .mce_p span.mceText {} .defaultSkin .mce_address span.mceText {font-style:italic} .defaultSkin .mce_pre span.mceText {font-family:monospace} .defaultSkin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em} .defaultSkin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em} .defaultSkin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em} .defaultSkin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em} .defaultSkin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em} .defaultSkin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em} /* Theme */ .defaultSkin span.mce_bold {background-position:0 0} .defaultSkin span.mce_italic {background-position:-60px 0} .defaultSkin span.mce_underline {background-position:-140px 0} .defaultSkin span.mce_strikethrough {background-position:-120px 0} .defaultSkin span.mce_undo {background-position:-160px 0} .defaultSkin span.mce_redo {background-position:-100px 0} .defaultSkin span.mce_cleanup {background-position:-40px 0} .defaultSkin span.mce_bullist {background-position:-20px 0} .defaultSkin span.mce_numlist {background-position:-80px 0} .defaultSkin span.mce_justifyleft {background-position:-460px 0} .defaultSkin span.mce_justifyright {background-position:-480px 0} .defaultSkin span.mce_justifycenter {background-position:-420px 0} .defaultSkin span.mce_justifyfull {background-position:-440px 0} .defaultSkin span.mce_anchor {background-position:-200px 0} .defaultSkin span.mce_indent {background-position:-400px 0} .defaultSkin span.mce_outdent {background-position:-540px 0} .defaultSkin span.mce_link {background-position:-500px 0} .defaultSkin span.mce_unlink {background-position:-640px 0} .defaultSkin span.mce_sub {background-position:-600px 0} .defaultSkin span.mce_sup {background-position:-620px 0} .defaultSkin span.mce_removeformat {background-position:-580px 0} .defaultSkin span.mce_newdocument {background-position:-520px 0} .defaultSkin span.mce_image {background-position:-380px 0} .defaultSkin span.mce_help {background-position:-340px 0} .defaultSkin span.mce_code {background-position:-260px 0} .defaultSkin span.mce_hr {background-position:-360px 0} .defaultSkin span.mce_visualaid {background-position:-660px 0} .defaultSkin span.mce_charmap {background-position:-240px 0} .defaultSkin span.mce_paste {background-position:-560px 0} .defaultSkin span.mce_copy {background-position:-700px 0} .defaultSkin span.mce_cut {background-position:-680px 0} .defaultSkin span.mce_blockquote {background-position:-220px 0} .defaultSkin .mce_forecolor span.mceAction {background-position:-720px 0} .defaultSkin .mce_backcolor span.mceAction {background-position:-760px 0} .defaultSkin span.mce_forecolorpicker {background-position:-720px 0} .defaultSkin span.mce_backcolorpicker {background-position:-760px 0} /* Plugins */ .defaultSkin span.mce_advhr {background-position:-0px -20px} .defaultSkin span.mce_ltr {background-position:-20px -20px} .defaultSkin span.mce_rtl {background-position:-40px -20px} .defaultSkin span.mce_emotions {background-position:-60px -20px} .defaultSkin span.mce_fullpage {background-position:-80px -20px} .defaultSkin span.mce_fullscreen {background-position:-100px -20px} .defaultSkin span.mce_iespell {background-position:-120px -20px} .defaultSkin span.mce_insertdate {background-position:-140px -20px} .defaultSkin span.mce_inserttime {background-position:-160px -20px} .defaultSkin span.mce_absolute {background-position:-180px -20px} .defaultSkin span.mce_backward {background-position:-200px -20px} .defaultSkin span.mce_forward {background-position:-220px -20px} .defaultSkin span.mce_insert_layer {background-position:-240px -20px} .defaultSkin span.mce_insertlayer {background-position:-260px -20px} .defaultSkin span.mce_movebackward {background-position:-280px -20px} .defaultSkin span.mce_moveforward {background-position:-300px -20px} .defaultSkin span.mce_media {background-position:-320px -20px} .defaultSkin span.mce_nonbreaking {background-position:-340px -20px} .defaultSkin span.mce_pastetext {background-position:-360px -20px} .defaultSkin span.mce_pasteword {background-position:-380px -20px} .defaultSkin span.mce_selectall {background-position:-400px -20px} .defaultSkin span.mce_preview {background-position:-420px -20px} .defaultSkin span.mce_print {background-position:-440px -20px} .defaultSkin span.mce_cancel {background-position:-460px -20px} .defaultSkin span.mce_save {background-position:-480px -20px} .defaultSkin span.mce_replace {background-position:-500px -20px} .defaultSkin span.mce_search {background-position:-520px -20px} .defaultSkin span.mce_styleprops {background-position:-560px -20px} .defaultSkin span.mce_table {background-position:-580px -20px} .defaultSkin span.mce_cell_props {background-position:-600px -20px} .defaultSkin span.mce_delete_table {background-position:-620px -20px} .defaultSkin span.mce_delete_col {background-position:-640px -20px} .defaultSkin span.mce_delete_row {background-position:-660px -20px} .defaultSkin span.mce_col_after {background-position:-680px -20px} .defaultSkin span.mce_col_before {background-position:-700px -20px} .defaultSkin span.mce_row_after {background-position:-720px -20px} .defaultSkin span.mce_row_before {background-position:-740px -20px} .defaultSkin span.mce_merge_cells {background-position:-760px -20px} .defaultSkin span.mce_table_props {background-position:-980px -20px} .defaultSkin span.mce_row_props {background-position:-780px -20px} .defaultSkin span.mce_split_cells {background-position:-800px -20px} .defaultSkin span.mce_template {background-position:-820px -20px} .defaultSkin span.mce_visualchars {background-position:-840px -20px} .defaultSkin span.mce_abbr {background-position:-860px -20px} .defaultSkin span.mce_acronym {background-position:-880px -20px} .defaultSkin span.mce_attribs {background-position:-900px -20px} .defaultSkin span.mce_cite {background-position:-920px -20px} .defaultSkin span.mce_del {background-position:-940px -20px} .defaultSkin span.mce_ins {background-position:-960px -20px} .defaultSkin span.mce_pagebreak {background-position:0 -40px} .defaultSkin span.mce_restoredraft {background-position:-20px -40px} .defaultSkin span.mce_spellchecker {background-position:-540px -20px} .defaultSkin span.mce_visualblocks {background-position: -40px -40px} ================================================ FILE: static/js/tinymce/themes/advanced/skins/highcontrast/content.css ================================================ body, td, pre { margin:8px;} body.mceForceColors {background:#FFF; color:#000;} h1 {font-size: 2em} h2 {font-size: 1.5em} h3 {font-size: 1.17em} h4 {font-size: 1em} h5 {font-size: .83em} h6 {font-size: .75em} .mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;} a.mceItemAnchor {display:inline-block; width:11px !important; height:11px !important; background:url(../default/img/items.gif) no-repeat 0 0;} span.mceItemNbsp {background: #DDD} td.mceSelected, th.mceSelected {background-color:#3399ff !important} img {border:0;} table, img, hr, .mceItemAnchor {cursor:default} table td, table th {cursor:text} ins {border-bottom:1px solid green; text-decoration: none; color:green} del {color:red; text-decoration:line-through} cite {border-bottom:1px dashed blue} acronym {border-bottom:1px dotted #CCC; cursor:help} abbr {border-bottom:1px dashed #CCC; cursor:help} img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px} font[face=mceinline] {font-family:inherit !important} *[contentEditable]:focus {outline:0} ================================================ FILE: static/js/tinymce/themes/advanced/skins/highcontrast/dialog.css ================================================ /* Generic */ body { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; background:#F0F0EE; color: black; padding:0; margin:8px 8px 0 8px; } html {background:#F0F0EE; color:#000;} td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} textarea {resize:none;outline:none;} a:link, a:visited {color:black;background-color:transparent;} a:hover {color:#2B6FB6;background-color:transparent;} .nowrap {white-space: nowrap} /* Forms */ fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;} legend {color:#2B6FB6; font-weight:bold;} label.msg {display:none;} label.invalid {color:#EE0000; display:inline;background-color:transparent;} input.invalid {border:1px solid #EE0000;background-color:transparent;} input {background:#FFF; border:1px solid #CCC;color:black;} input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} input, select, textarea {border:1px solid #808080;} input.radio {border:1px none #000000; background:transparent; vertical-align:middle;} input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;} .input_noborder {border:0;} /* Buttons */ #insert, #cancel, input.button, .updateButton { font-weight:bold; width:94px; height:23px; cursor:pointer; padding-bottom:2px; float:left; } #cancel {float:right} /* Browse */ a.pickcolor, a.browse {text-decoration:none} a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;} .mceOldBoxModel a.browse span {width:22px; height:20px;} a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;} a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} a.browse:hover span.disabled {border:1px solid white; background-color:transparent;} a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;} .mceOldBoxModel a.pickcolor span {width:21px; height:17px;} a.pickcolor:hover span {background-color:#B2BBD0;} a.pickcolor:hover span.disabled {} /* Charmap */ table.charmap {border:1px solid #AAA; text-align:center} td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;} #charmap a {display:block; color:#000; text-decoration:none; border:0} #charmap a:hover {background:#CCC;color:#2B6FB6} #charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center} #charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center} /* Source */ .wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;} .mceActionPanel {margin-top:5px;} /* Tabs classes */ .tabs {width:100%; height:18px; line-height:normal;} .tabs ul {margin:0; padding:0; list-style:none;} .tabs li {float:left; border: 1px solid black; border-bottom:0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block; cursor:pointer;} .tabs li.current {font-weight: bold; margin-right:2px;} .tabs span {float:left; display:block; padding:0px 10px 0 0;} .tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;} .tabs a:link, .tabs a:visited, .tabs a:hover {color:black;} /* Panels */ .panel_wrapper div.panel {display:none;} .panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;} .panel_wrapper {border:1px solid #919B9C; padding:10px; padding-top:5px; clear:both; background:white;} /* Columns */ .column {float:left;} .properties {width:100%;} .properties .column1 {} .properties .column2 {text-align:left;} /* Titles */ h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;} h3 {font-size:14px;} .title {font-size:12px; font-weight:bold; color:#2B6FB6;} /* Dialog specific */ #link .panel_wrapper, #link div.current {height:125px;} #image .panel_wrapper, #image div.current {height:200px;} #plugintable thead {font-weight:bold; background:#DDD;} #plugintable, #about #plugintable td {border:1px solid #919B9C;} #plugintable {width:96%; margin-top:10px;} #pluginscontainer {height:290px; overflow:auto;} #colorpicker #preview {display:inline-block; padding-left:40px; height:14px; border:1px solid black; margin-left:5px; margin-right: 5px} #colorpicker #previewblock {position: relative; top: -3px; padding-left:5px; padding-top: 0px; display:inline} #colorpicker #preview_wrapper { text-align:center; padding-top:4px; white-space: nowrap} #colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;} #colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;} #colorpicker #light div {overflow:hidden;} #colorpicker .panel_wrapper div.current {height:175px;} #colorpicker #namedcolors {width:150px;} #colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;} #colorpicker #colornamecontainer {margin-top:5px;} ================================================ FILE: static/js/tinymce/themes/advanced/skins/highcontrast/ui.css ================================================ /* Reset */ .highcontrastSkin table, .highcontrastSkin tbody, .highcontrastSkin a, .highcontrastSkin img, .highcontrastSkin tr, .highcontrastSkin div, .highcontrastSkin td, .highcontrastSkin iframe, .highcontrastSkin span, .highcontrastSkin *, .highcontrastSkin .mceText {border:0; margin:0; padding:0; vertical-align:baseline; border-collapse:separate;} .highcontrastSkin a:hover, .highcontrastSkin a:link, .highcontrastSkin a:visited, .highcontrastSkin a:active {text-decoration:none; font-weight:normal; cursor:default;} .highcontrastSkin table td {vertical-align:middle} .highcontrastSkin .mceIconOnly {display: block !important;} /* External */ .highcontrastSkin .mceExternalToolbar {position:absolute; border:1px solid; border-bottom:0; display:none; background-color: white;} .highcontrastSkin .mceExternalToolbar td.mceToolbar {padding-right:13px;} .highcontrastSkin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px;} /* Layout */ .highcontrastSkin table.mceLayout {border: 1px solid;} .highcontrastSkin .mceIframeContainer {border-top:1px solid; border-bottom:1px solid} .highcontrastSkin .mceStatusbar a:hover {text-decoration:underline} .highcontrastSkin .mceStatusbar {display:block; line-height:1.5em; overflow:visible;} .highcontrastSkin .mceStatusbar div {float:left} .highcontrastSkin .mceStatusbar a.mceResize {display:block; float:right; width:20px; height:20px; cursor:se-resize; outline:0} .highcontrastSkin .mceToolbar td { display: inline-block; float: left;} .highcontrastSkin .mceToolbar tr { display: block;} .highcontrastSkin .mceToolbar table { display: block; } /* Button */ .highcontrastSkin .mceButton { display:block; margin: 2px; padding: 5px 10px;border: 1px solid; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; -ms-border-radius: 3px; height: 2em;} .highcontrastSkin .mceButton .mceVoiceLabel { height: 100%; vertical-align: center; line-height: 2em} .highcontrastSkin .mceButtonDisabled .mceVoiceLabel { opacity:0.6; -ms-filter:'alpha(opacity=60)'; filter:alpha(opacity=60);} .highcontrastSkin .mceButtonActive, .highcontrastSkin .mceButton:focus, .highcontrastSkin .mceButton:active { border: 5px solid; padding: 1px 6px;-webkit-focus-ring-color:none;outline:none;} /* Separator */ .highcontrastSkin .mceSeparator {display:block; width:16px; height:26px;} /* ListBox */ .highcontrastSkin .mceListBox { display: block; margin:2px;-webkit-focus-ring-color:none;outline:none;} .highcontrastSkin .mceListBox .mceText {padding: 5px 6px; line-height: 2em; width: 15ex; overflow: hidden;} .highcontrastSkin .mceListBoxDisabled .mceText { opacity:0.6; -ms-filter:'alpha(opacity=60)'; filter:alpha(opacity=60);} .highcontrastSkin .mceListBox a.mceText { padding: 5px 10px; display: block; height: 2em; line-height: 2em; border: 1px solid; border-right: 0; border-radius: 3px 0px 0px 3px; -moz-border-radius: 3px 0px 0px 3px; -webkit-border-radius: 3px 0px 0px 3px; -ms-border-radius: 3px 0px 0px 3px;} .highcontrastSkin .mceListBox a.mceOpen { padding: 5px 4px; display: block; height: 2em; line-height: 2em; border: 1px solid; border-left: 0; border-radius: 0px 3px 3px 0px; -moz-border-radius: 0px 3px 3px 0px; -webkit-border-radius: 0px 3px 3px 0px; -ms-border-radius: 0px 3px 3px 0px;} .highcontrastSkin .mceListBox:focus a.mceText, .highcontrastSkin .mceListBox:active a.mceText { border-width: 5px; padding: 1px 10px 1px 6px;} .highcontrastSkin .mceListBox:focus a.mceOpen, .highcontrastSkin .mceListBox:active a.mceOpen { border-width: 5px; padding: 1px 0px 1px 4px;} .highcontrastSkin .mceListBoxMenu {overflow-y:auto} /* SplitButton */ .highcontrastSkin .mceSplitButtonDisabled .mceAction {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} .highcontrastSkin .mceSplitButton { border-collapse: collapse; margin: 2px; height: 2em; line-height: 2em;-webkit-focus-ring-color:none;outline:none;} .highcontrastSkin .mceSplitButton td { display: table-cell; float: none; margin: 0; padding: 0; height: 2em;} .highcontrastSkin .mceSplitButton tr { display: table-row; } .highcontrastSkin table.mceSplitButton { display: table; } .highcontrastSkin .mceSplitButton a.mceAction { padding: 5px 10px; display: block; height: 2em; line-height: 2em; overflow: hidden; border: 1px solid; border-right: 0; border-radius: 3px 0px 0px 3px; -moz-border-radius: 3px 0px 0px 3px; -webkit-border-radius: 3px 0px 0px 3px; -ms-border-radius: 3px 0px 0px 3px;} .highcontrastSkin .mceSplitButton a.mceOpen { padding: 5px 4px; display: block; height: 2em; line-height: 2em; border: 1px solid; border-radius: 0px 3px 3px 0px; -moz-border-radius: 0px 3px 3px 0px; -webkit-border-radius: 0px 3px 3px 0px; -ms-border-radius: 0px 3px 3px 0px;} .highcontrastSkin .mceSplitButton .mceVoiceLabel { height: 2em; vertical-align: center; line-height: 2em; } .highcontrastSkin .mceSplitButton:focus a.mceAction, .highcontrastSkin .mceSplitButton:active a.mceAction { border-width: 5px; border-right-width: 1px; padding: 1px 10px 1px 6px;-webkit-focus-ring-color:none;outline:none;} .highcontrastSkin .mceSplitButton:focus a.mceOpen, .highcontrastSkin .mceSplitButton:active a.mceOpen { border-width: 5px; border-left-width: 1px; padding: 1px 0px 1px 4px;-webkit-focus-ring-color:none;outline:none;} /* Menu */ .highcontrastSkin .mceNoIcons span.mceIcon {width:0;} .highcontrastSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid; direction:ltr} .highcontrastSkin .mceMenu table {background:white; color: black} .highcontrastSkin .mceNoIcons a .mceText {padding-left:10px} .highcontrastSkin .mceMenu a, .highcontrastSkin .mceMenu span, .highcontrastSkin .mceMenu {display:block;background:white; color: black} .highcontrastSkin .mceMenu td {height:2em} .highcontrastSkin .mceMenu a {position:relative;padding:3px 0 4px 0; display: block;} .highcontrastSkin .mceMenu .mceText {position:relative; display:block; cursor:default; margin:0; padding:0 25px 0 25px;} .highcontrastSkin .mceMenu pre.mceText {font-family:Monospace} .highcontrastSkin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:26px;} .highcontrastSkin td.mceMenuItemSeparator {border-top:1px solid; height:1px} .highcontrastSkin .mceMenuItemTitle a {border:0; border-bottom:1px solid} .highcontrastSkin .mceMenuItemTitle span.mceText {font-weight:bold; padding-left:4px} .highcontrastSkin .mceNoIcons .mceMenuItemSelected span.mceText:before {content: "\2713\A0";} .highcontrastSkin .mceMenu span.mceMenuLine {display:none} .highcontrastSkin .mceMenuItemSub a .mceText:after {content: "\A0\25B8"} .highcontrastSkin .mceMenuItem td, .highcontrastSkin .mceMenuItem th {line-height: normal} /* ColorSplitButton */ .highcontrastSkin div.mceColorSplitMenu table {background:#FFF; border:1px solid; color: #000} .highcontrastSkin .mceColorSplitMenu td {padding:2px} .highcontrastSkin .mceColorSplitMenu a {display:block; width:16px; height:16px; overflow:hidden; color:#000; margin: 0; padding: 0;} .highcontrastSkin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px} .highcontrastSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF} .highcontrastSkin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid; background-color:#B6BDD2} .highcontrastSkin a.mceMoreColors:hover {border:1px solid #0A246A; color: #000;} .highcontrastSkin .mceColorPreview {display:none;} .highcontrastSkin .mce_forecolor span.mceAction, .highcontrastSkin .mce_backcolor span.mceAction {height:17px;overflow:hidden} /* Progress,Resize */ .highcontrastSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=50); background:#FFF} .highcontrastSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px} /* Rtl */ .mceRtl .mceListBox .mceText {text-align: right; padding: 0 4px 0 0} .mceRtl .mceMenuItem .mceText {text-align: right} /* Formats */ .highcontrastSkin .mce_p span.mceText {} .highcontrastSkin .mce_address span.mceText {font-style:italic} .highcontrastSkin .mce_pre span.mceText {font-family:monospace} .highcontrastSkin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em} .highcontrastSkin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em} .highcontrastSkin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em} .highcontrastSkin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em} .highcontrastSkin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em} .highcontrastSkin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em} ================================================ FILE: static/js/tinymce/themes/advanced/skins/o2k7/content.css ================================================ body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;} body {background:#FFF;} body.mceForceColors {background:#FFF; color:#000;} h1 {font-size: 2em} h2 {font-size: 1.5em} h3 {font-size: 1.17em} h4 {font-size: 1em} h5 {font-size: .83em} h6 {font-size: .75em} .mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;} a.mceItemAnchor {display:inline-block; width:11px !important; height:11px !important; background:url(../default/img/items.gif) no-repeat 0 0;} span.mceItemNbsp {background: #DDD} td.mceSelected, th.mceSelected {background-color:#3399ff !important} img {border:0;} table, img, hr, .mceItemAnchor {cursor:default} table td, table th {cursor:text} ins {border-bottom:1px solid green; text-decoration: none; color:green} del {color:red; text-decoration:line-through} cite {border-bottom:1px dashed blue} acronym {border-bottom:1px dotted #CCC; cursor:help} abbr {border-bottom:1px dashed #CCC; cursor:help} /* IE */ * html body { scrollbar-3dlight-color:#F0F0EE; scrollbar-arrow-color:#676662; scrollbar-base-color:#F0F0EE; scrollbar-darkshadow-color:#DDD; scrollbar-face-color:#E0E0DD; scrollbar-highlight-color:#F0F0EE; scrollbar-shadow-color:#F0F0EE; scrollbar-track-color:#F5F5F5; } img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px} font[face=mceinline] {font-family:inherit !important} *[contentEditable]:focus {outline:0} .mceItemMedia {border:1px dotted #cc0000; background-position:center; background-repeat:no-repeat; background-color:#ffffcc} .mceItemShockWave {background-image:url(../../img/shockwave.gif)} .mceItemFlash {background-image:url(../../img/flash.gif)} .mceItemQuickTime {background-image:url(../../img/quicktime.gif)} .mceItemWindowsMedia {background-image:url(../../img/windowsmedia.gif)} .mceItemRealMedia {background-image:url(../../img/realmedia.gif)} .mceItemVideo {background-image:url(../../img/video.gif)} .mceItemAudio {background-image:url(../../img/video.gif)} .mceItemIframe {background-image:url(../../img/iframe.gif)} .mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../../img/pagebreak.gif) no-repeat center top;} ================================================ FILE: static/js/tinymce/themes/advanced/skins/o2k7/dialog.css ================================================ /* Generic */ body { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; scrollbar-3dlight-color:#F0F0EE; scrollbar-arrow-color:#676662; scrollbar-base-color:#F0F0EE; scrollbar-darkshadow-color:#DDDDDD; scrollbar-face-color:#E0E0DD; scrollbar-highlight-color:#F0F0EE; scrollbar-shadow-color:#F0F0EE; scrollbar-track-color:#F5F5F5; background:#F0F0EE; padding:0; margin:8px 8px 0 8px; } html {background:#F0F0EE;} td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} textarea {resize:none;outline:none;} a:link, a:visited {color:black;} a:hover {color:#2B6FB6;} .nowrap {white-space: nowrap} /* Forms */ fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;} legend {color:#2B6FB6; font-weight:bold;} label.msg {display:none;} label.invalid {color:#EE0000; display:inline;} input.invalid {border:1px solid #EE0000;} input {background:#FFF; border:1px solid #CCC;} input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} input, select, textarea {border:1px solid #808080;} input.radio {border:1px none #000000; background:transparent; vertical-align:middle;} input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;} .input_noborder {border:0;} /* Buttons */ #insert, #cancel, input.button, .updateButton { border:0; margin:0; padding:0; font-weight:bold; width:94px; height:26px; background:url(../default/img/buttons.png) 0 -26px; cursor:pointer; padding-bottom:2px; float:left; } #insert {background:url(../default/img/buttons.png) 0 -52px} #cancel {background:url(../default/img/buttons.png) 0 0; float:right} /* Browse */ a.pickcolor, a.browse {text-decoration:none} a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;} .mceOldBoxModel a.browse span {width:22px; height:20px;} a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;} a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} a.browse:hover span.disabled {border:1px solid white; background-color:transparent;} a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;} .mceOldBoxModel a.pickcolor span {width:21px; height:17px;} a.pickcolor:hover span {background-color:#B2BBD0;} a.pickcolor:hover span.disabled {} /* Charmap */ table.charmap {border:1px solid #AAA; text-align:center} td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;} #charmap a {display:block; color:#000; text-decoration:none; border:0} #charmap a:hover {background:#CCC;color:#2B6FB6} #charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center} #charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center} /* Source */ .wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;} .mceActionPanel {margin-top:5px;} /* Tabs classes */ .tabs {width:100%; height:18px; line-height:normal; background:url(../default/img/tabs.gif) repeat-x 0 -72px;} .tabs ul {margin:0; padding:0; list-style:none;} .tabs li {float:left; background:url(../default/img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;} .tabs li.current {background:url(../default/img/tabs.gif) no-repeat 0 -18px; margin-right:2px;} .tabs span {float:left; display:block; background:url(../default/img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;} .tabs .current span {background:url(../default/img/tabs.gif) no-repeat right -54px;} .tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;} .tabs a:link, .tabs a:visited, .tabs a:hover {color:black;} /* Panels */ .panel_wrapper div.panel {display:none;} .panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;} .panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;} /* Columns */ .column {float:left;} .properties {width:100%;} .properties .column1 {} .properties .column2 {text-align:left;} /* Titles */ h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;} h3 {font-size:14px;} .title {font-size:12px; font-weight:bold; color:#2B6FB6;} /* Dialog specific */ #link .panel_wrapper, #link div.current {height:125px;} #image .panel_wrapper, #image div.current {height:200px;} #plugintable thead {font-weight:bold; background:#DDD;} #plugintable, #about #plugintable td {border:1px solid #919B9C;} #plugintable {width:96%; margin-top:10px;} #pluginscontainer {height:290px; overflow:auto;} #colorpicker #preview {display:inline-block; padding-left:40px; height:14px; border:1px solid black; margin-left:5px; margin-right: 5px} #colorpicker #previewblock {position: relative; top: -3px; padding-left:5px; padding-top: 0px; display:inline} #colorpicker #preview_wrapper { text-align:center; padding-top:4px; white-space: nowrap} #colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;} #colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;} #colorpicker #light div {overflow:hidden;} #colorpicker .panel_wrapper div.current {height:175px;} #colorpicker #namedcolors {width:150px;} #colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;} #colorpicker #colornamecontainer {margin-top:5px;} #colorpicker #picker_panel fieldset {margin:auto;width:325px;} ================================================ FILE: static/js/tinymce/themes/advanced/skins/o2k7/ui.css ================================================ /* Reset */ .o2k7Skin table, .o2k7Skin tbody, .o2k7Skin a, .o2k7Skin img, .o2k7Skin tr, .o2k7Skin div, .o2k7Skin td, .o2k7Skin iframe, .o2k7Skin span, .o2k7Skin *, .o2k7Skin .mceText {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate; text-align:left} .o2k7Skin a:hover, .o2k7Skin a:link, .o2k7Skin a:visited, .o2k7Skin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000} .o2k7Skin table td {vertical-align:middle} /* Containers */ .o2k7Skin table {background:transparent} .o2k7Skin iframe {display:block;} .o2k7Skin .mceToolbar {height:26px} /* External */ .o2k7Skin .mceExternalToolbar {position:absolute; border:1px solid #ABC6DD; border-bottom:0; display:none} .o2k7Skin .mceExternalToolbar td.mceToolbar {padding-right:13px;} .o2k7Skin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0} /* Layout */ .o2k7Skin table.mceLayout {border:0; border-left:1px solid #ABC6DD; border-right:1px solid #ABC6DD} .o2k7Skin table.mceLayout tr.mceFirst td {border-top:1px solid #ABC6DD} .o2k7Skin table.mceLayout tr.mceLast td {border-bottom:1px solid #ABC6DD} .o2k7Skin table.mceToolbar, .o2k7Skin tr.mceFirst .mceToolbar tr td, .o2k7Skin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0} .o2k7Skin .mceIframeContainer {border-top:1px solid #ABC6DD; border-bottom:1px solid #ABC6DD} .o2k7Skin td.mceToolbar{background:#E5EFFD} .o2k7Skin .mceStatusbar {background:#E5EFFD; display:block; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; height:20px} .o2k7Skin .mceStatusbar div {float:left; padding:2px} .o2k7Skin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize; outline:0} .o2k7Skin .mceStatusbar a:hover {text-decoration:underline} .o2k7Skin table.mceToolbar {margin-left:3px} .o2k7Skin .mceToolbar .mceToolbarStart span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px; margin-left:3px;} .o2k7Skin .mceToolbar td.mceFirst span {margin:0} .o2k7Skin .mceToolbar .mceToolbarEnd span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px} .o2k7Skin .mceToolbar .mceToolbarEndListBox span, .o2k7Skin .mceToolbar .mceToolbarStartListBox span {display:none} .o2k7Skin span.mceIcon, .o2k7Skin img.mceIcon {display:block; width:20px; height:20px} .o2k7Skin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px} .o2k7Skin td.mceCenter {text-align:center;} .o2k7Skin td.mceCenter table {margin:0 auto; text-align:left;} .o2k7Skin td.mceRight table {margin:0 0 0 auto;} /* Button */ .o2k7Skin .mceButton {display:block; background:url(img/button_bg.png); width:22px; height:22px} .o2k7Skin a.mceButton span, .o2k7Skin a.mceButton img {margin-left:1px} .o2k7Skin .mceOldBoxModel a.mceButton span, .o2k7Skin .mceOldBoxModel a.mceButton img {margin:0 0 0 1px} .o2k7Skin a.mceButtonEnabled:hover {background-color:#B2BBD0; background-position:0 -22px} .o2k7Skin a.mceButtonActive, .o2k7Skin a.mceButtonSelected {background-position:0 -44px} .o2k7Skin .mceButtonDisabled .mceIcon {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} .o2k7Skin .mceButtonLabeled {width:auto} .o2k7Skin .mceButtonLabeled span.mceIcon {float:left} .o2k7Skin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica} .o2k7Skin .mceButtonDisabled .mceButtonLabel {color:#888} /* Separator */ .o2k7Skin .mceSeparator {display:block; background:url(img/button_bg.png) -22px 0; width:5px; height:22px} /* ListBox */ .o2k7Skin .mceListBox {padding-left: 3px} .o2k7Skin .mceListBox, .o2k7Skin .mceListBox a {display:block} .o2k7Skin .mceListBox .mceText {padding-left:4px; text-align:left; width:70px; border:1px solid #b3c7e1; border-right:0; background:#eaf2fb; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden} .o2k7Skin .mceListBox .mceOpen {width:14px; height:22px; background:url(img/button_bg.png) -66px 0} .o2k7Skin table.mceListBoxEnabled:hover .mceText, .o2k7Skin .mceListBoxHover .mceText, .o2k7Skin .mceListBoxSelected .mceText {background:#FFF} .o2k7Skin table.mceListBoxEnabled:hover .mceOpen, .o2k7Skin .mceListBoxHover .mceOpen, .o2k7Skin .mceListBoxSelected .mceOpen {background-position:-66px -22px} .o2k7Skin .mceListBoxDisabled .mceText {color:gray} .o2k7Skin .mceListBoxMenu {overflow:auto; overflow-x:hidden; margin-left:3px} .o2k7Skin .mceOldBoxModel .mceListBox .mceText {height:22px} .o2k7Skin select.mceListBox {font-family:Tahoma,Verdana,Arial,Helvetica; font-size:12px; border:1px solid #b3c7e1; background:#FFF;} /* SplitButton */ .o2k7Skin .mceSplitButton, .o2k7Skin .mceSplitButton a, .o2k7Skin .mceSplitButton span {display:block; height:22px; direction:ltr} .o2k7Skin .mceSplitButton {background:url(img/button_bg.png)} .o2k7Skin .mceSplitButton a.mceAction {width:22px} .o2k7Skin .mceSplitButton span.mceAction {width:22px; background-image:url(../../img/icons.gif)} .o2k7Skin .mceSplitButton a.mceOpen {width:10px; background:url(img/button_bg.png) -44px 0} .o2k7Skin .mceSplitButton span.mceOpen {display:none} .o2k7Skin table.mceSplitButtonEnabled:hover a.mceAction, .o2k7Skin .mceSplitButtonHover a.mceAction, .o2k7Skin .mceSplitButtonSelected {background:url(img/button_bg.png) 0 -22px} .o2k7Skin table.mceSplitButtonEnabled:hover a.mceOpen, .o2k7Skin .mceSplitButtonHover a.mceOpen, .o2k7Skin .mceSplitButtonSelected a.mceOpen {background-position:-44px -44px} .o2k7Skin .mceSplitButtonDisabled .mceAction {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} .o2k7Skin .mceSplitButtonActive {background-position:0 -44px} /* ColorSplitButton */ .o2k7Skin div.mceColorSplitMenu table {background:#FFF; border:1px solid gray} .o2k7Skin .mceColorSplitMenu td {padding:2px} .o2k7Skin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden; border:1px solid #808080} .o2k7Skin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px} .o2k7Skin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF} .o2k7Skin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2} .o2k7Skin a.mceMoreColors:hover {border:1px solid #0A246A} .o2k7Skin .mceColorPreview {margin-left:2px; width:16px; height:4px; overflow:hidden; background:#9a9b9a;overflow:hidden} .o2k7Skin .mce_forecolor span.mceAction, .o2k7Skin .mce_backcolor span.mceAction {height:15px;overflow:hidden} /* Menu */ .o2k7Skin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #ABC6DD; direction:ltr} .o2k7Skin .mceNoIcons span.mceIcon {width:0;} .o2k7Skin .mceNoIcons a .mceText {padding-left:10px} .o2k7Skin .mceMenu table {background:#FFF} .o2k7Skin .mceMenu a, .o2k7Skin .mceMenu span, .o2k7Skin .mceMenu {display:block} .o2k7Skin .mceMenu td {height:20px} .o2k7Skin .mceMenu a {position:relative;padding:3px 0 4px 0} .o2k7Skin .mceMenu .mceText {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block} .o2k7Skin .mceMenu span.mceText, .o2k7Skin .mceMenu .mcePreview {font-size:11px} .o2k7Skin .mceMenu pre.mceText {font-family:Monospace} .o2k7Skin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:22px;} .o2k7Skin .mceMenu .mceMenuItemEnabled a:hover, .o2k7Skin .mceMenu .mceMenuItemActive {background-color:#dbecf3} .o2k7Skin td.mceMenuItemSeparator {background:#DDD; height:1px} .o2k7Skin .mceMenuItemTitle a {border:0; background:#E5EFFD; border-bottom:1px solid #ABC6DD} .o2k7Skin .mceMenuItemTitle span.mceText {color:#000; font-weight:bold; padding-left:4px} .o2k7Skin .mceMenuItemDisabled .mceText {color:#888} .o2k7Skin .mceMenuItemSelected .mceIcon {background:url(../default/img/menu_check.gif)} .o2k7Skin .mceNoIcons .mceMenuItemSelected a {background:url(../default/img/menu_arrow.gif) no-repeat -6px center} .o2k7Skin .mceMenu span.mceMenuLine {display:none} .o2k7Skin .mceMenuItemSub a {background:url(../default/img/menu_arrow.gif) no-repeat top right;} .o2k7Skin .mceMenuItem td, .o2k7Skin .mceMenuItem th {line-height: normal} /* Progress,Resize */ .o2k7Skin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=50); background:#FFF} .o2k7Skin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px} /* Rtl */ .mceRtl .mceListBox .mceText {text-align: right; padding: 0 4px 0 0} .mceRtl .mceMenuItem .mceText {text-align: right} /* Formats */ .o2k7Skin .mce_formatPreview a {font-size:10px} .o2k7Skin .mce_p span.mceText {} .o2k7Skin .mce_address span.mceText {font-style:italic} .o2k7Skin .mce_pre span.mceText {font-family:monospace} .o2k7Skin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em} .o2k7Skin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em} .o2k7Skin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em} .o2k7Skin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em} .o2k7Skin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em} .o2k7Skin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em} /* Theme */ .o2k7Skin span.mce_bold {background-position:0 0} .o2k7Skin span.mce_italic {background-position:-60px 0} .o2k7Skin span.mce_underline {background-position:-140px 0} .o2k7Skin span.mce_strikethrough {background-position:-120px 0} .o2k7Skin span.mce_undo {background-position:-160px 0} .o2k7Skin span.mce_redo {background-position:-100px 0} .o2k7Skin span.mce_cleanup {background-position:-40px 0} .o2k7Skin span.mce_bullist {background-position:-20px 0} .o2k7Skin span.mce_numlist {background-position:-80px 0} .o2k7Skin span.mce_justifyleft {background-position:-460px 0} .o2k7Skin span.mce_justifyright {background-position:-480px 0} .o2k7Skin span.mce_justifycenter {background-position:-420px 0} .o2k7Skin span.mce_justifyfull {background-position:-440px 0} .o2k7Skin span.mce_anchor {background-position:-200px 0} .o2k7Skin span.mce_indent {background-position:-400px 0} .o2k7Skin span.mce_outdent {background-position:-540px 0} .o2k7Skin span.mce_link {background-position:-500px 0} .o2k7Skin span.mce_unlink {background-position:-640px 0} .o2k7Skin span.mce_sub {background-position:-600px 0} .o2k7Skin span.mce_sup {background-position:-620px 0} .o2k7Skin span.mce_removeformat {background-position:-580px 0} .o2k7Skin span.mce_newdocument {background-position:-520px 0} .o2k7Skin span.mce_image {background-position:-380px 0} .o2k7Skin span.mce_help {background-position:-340px 0} .o2k7Skin span.mce_code {background-position:-260px 0} .o2k7Skin span.mce_hr {background-position:-360px 0} .o2k7Skin span.mce_visualaid {background-position:-660px 0} .o2k7Skin span.mce_charmap {background-position:-240px 0} .o2k7Skin span.mce_paste {background-position:-560px 0} .o2k7Skin span.mce_copy {background-position:-700px 0} .o2k7Skin span.mce_cut {background-position:-680px 0} .o2k7Skin span.mce_blockquote {background-position:-220px 0} .o2k7Skin .mce_forecolor span.mceAction {background-position:-720px 0} .o2k7Skin .mce_backcolor span.mceAction {background-position:-760px 0} .o2k7Skin span.mce_forecolorpicker {background-position:-720px 0} .o2k7Skin span.mce_backcolorpicker {background-position:-760px 0} /* Plugins */ .o2k7Skin span.mce_advhr {background-position:-0px -20px} .o2k7Skin span.mce_ltr {background-position:-20px -20px} .o2k7Skin span.mce_rtl {background-position:-40px -20px} .o2k7Skin span.mce_emotions {background-position:-60px -20px} .o2k7Skin span.mce_fullpage {background-position:-80px -20px} .o2k7Skin span.mce_fullscreen {background-position:-100px -20px} .o2k7Skin span.mce_iespell {background-position:-120px -20px} .o2k7Skin span.mce_insertdate {background-position:-140px -20px} .o2k7Skin span.mce_inserttime {background-position:-160px -20px} .o2k7Skin span.mce_absolute {background-position:-180px -20px} .o2k7Skin span.mce_backward {background-position:-200px -20px} .o2k7Skin span.mce_forward {background-position:-220px -20px} .o2k7Skin span.mce_insert_layer {background-position:-240px -20px} .o2k7Skin span.mce_insertlayer {background-position:-260px -20px} .o2k7Skin span.mce_movebackward {background-position:-280px -20px} .o2k7Skin span.mce_moveforward {background-position:-300px -20px} .o2k7Skin span.mce_media {background-position:-320px -20px} .o2k7Skin span.mce_nonbreaking {background-position:-340px -20px} .o2k7Skin span.mce_pastetext {background-position:-360px -20px} .o2k7Skin span.mce_pasteword {background-position:-380px -20px} .o2k7Skin span.mce_selectall {background-position:-400px -20px} .o2k7Skin span.mce_preview {background-position:-420px -20px} .o2k7Skin span.mce_print {background-position:-440px -20px} .o2k7Skin span.mce_cancel {background-position:-460px -20px} .o2k7Skin span.mce_save {background-position:-480px -20px} .o2k7Skin span.mce_replace {background-position:-500px -20px} .o2k7Skin span.mce_search {background-position:-520px -20px} .o2k7Skin span.mce_styleprops {background-position:-560px -20px} .o2k7Skin span.mce_table {background-position:-580px -20px} .o2k7Skin span.mce_cell_props {background-position:-600px -20px} .o2k7Skin span.mce_delete_table {background-position:-620px -20px} .o2k7Skin span.mce_delete_col {background-position:-640px -20px} .o2k7Skin span.mce_delete_row {background-position:-660px -20px} .o2k7Skin span.mce_col_after {background-position:-680px -20px} .o2k7Skin span.mce_col_before {background-position:-700px -20px} .o2k7Skin span.mce_row_after {background-position:-720px -20px} .o2k7Skin span.mce_row_before {background-position:-740px -20px} .o2k7Skin span.mce_merge_cells {background-position:-760px -20px} .o2k7Skin span.mce_table_props {background-position:-980px -20px} .o2k7Skin span.mce_row_props {background-position:-780px -20px} .o2k7Skin span.mce_split_cells {background-position:-800px -20px} .o2k7Skin span.mce_template {background-position:-820px -20px} .o2k7Skin span.mce_visualchars {background-position:-840px -20px} .o2k7Skin span.mce_abbr {background-position:-860px -20px} .o2k7Skin span.mce_acronym {background-position:-880px -20px} .o2k7Skin span.mce_attribs {background-position:-900px -20px} .o2k7Skin span.mce_cite {background-position:-920px -20px} .o2k7Skin span.mce_del {background-position:-940px -20px} .o2k7Skin span.mce_ins {background-position:-960px -20px} .o2k7Skin span.mce_pagebreak {background-position:0 -40px} .o2k7Skin span.mce_restoredraft {background-position:-20px -40px} .o2k7Skin span.mce_spellchecker {background-position:-540px -20px} .o2k7Skin span.mce_visualblocks {background-position: -40px -40px} ================================================ FILE: static/js/tinymce/themes/advanced/skins/o2k7/ui_black.css ================================================ /* Black */ .o2k7SkinBlack .mceToolbar .mceToolbarStart span, .o2k7SkinBlack .mceToolbar .mceToolbarEnd span, .o2k7SkinBlack .mceButton, .o2k7SkinBlack .mceSplitButton, .o2k7SkinBlack .mceSeparator, .o2k7SkinBlack .mceSplitButton a.mceOpen, .o2k7SkinBlack .mceListBox a.mceOpen {background-image:url(img/button_bg_black.png)} .o2k7SkinBlack td.mceToolbar, .o2k7SkinBlack td.mceStatusbar, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack .mceMenuItemTitle span.mceText, .o2k7SkinBlack .mceStatusbar div, .o2k7SkinBlack .mceStatusbar span, .o2k7SkinBlack .mceStatusbar a {background:#535353; color:#FFF} .o2k7SkinBlack table.mceListBoxEnabled .mceText, o2k7SkinBlack .mceListBox .mceText {background:#FFF; border:1px solid #CBCFD4; border-bottom-color:#989FA9; border-right:0} .o2k7SkinBlack table.mceListBoxEnabled:hover .mceText, .o2k7SkinBlack .mceListBoxHover .mceText, .o2k7SkinBlack .mceListBoxSelected .mceText {background:#FFF; border:1px solid #FFBD69; border-right:0} .o2k7SkinBlack .mceExternalToolbar, .o2k7SkinBlack .mceListBox .mceText, .o2k7SkinBlack div.mceMenu, .o2k7SkinBlack table.mceLayout, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack table.mceLayout tr.mceFirst td, .o2k7SkinBlack table.mceLayout, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack table.mceLayout tr.mceLast td, .o2k7SkinBlack .mceIframeContainer {border-color: #535353;} .o2k7SkinBlack table.mceSplitButtonEnabled:hover a.mceAction, .o2k7SkinBlack .mceSplitButtonHover a.mceAction, .o2k7SkinBlack .mceSplitButtonSelected {background-image:url(img/button_bg_black.png)} .o2k7SkinBlack .mceMenu .mceMenuItemEnabled a:hover, .o2k7SkinBlack .mceMenu .mceMenuItemActive {background-color:#FFE7A1} ================================================ FILE: static/js/tinymce/themes/advanced/skins/o2k7/ui_silver.css ================================================ /* Silver */ .o2k7SkinSilver .mceToolbar .mceToolbarStart span, .o2k7SkinSilver .mceButton, .o2k7SkinSilver .mceSplitButton, .o2k7SkinSilver .mceSeparator, .o2k7SkinSilver .mceSplitButton a.mceOpen, .o2k7SkinSilver .mceListBox a.mceOpen {background-image:url(img/button_bg_silver.png)} .o2k7SkinSilver td.mceToolbar, .o2k7SkinSilver td.mceStatusbar, .o2k7SkinSilver .mceMenuItemTitle a {background:#eee} .o2k7SkinSilver .mceListBox .mceText {background:#FFF} .o2k7SkinSilver .mceExternalToolbar, .o2k7SkinSilver .mceListBox .mceText, .o2k7SkinSilver div.mceMenu, .o2k7SkinSilver table.mceLayout, .o2k7SkinSilver .mceMenuItemTitle a, .o2k7SkinSilver table.mceLayout tr.mceFirst td, .o2k7SkinSilver table.mceLayout, .o2k7SkinSilver .mceMenuItemTitle a, .o2k7SkinSilver table.mceLayout tr.mceLast td, .o2k7SkinSilver .mceIframeContainer {border-color: #bbb} ================================================ FILE: static/js/tinymce/themes/advanced/source_editor.htm ================================================ {#advanced_dlg.code_title}

    ================================================ FILE: static/js/tinymce/themes/simple/editor_template.js ================================================ (function(){var a=tinymce.DOM;tinymce.ThemeManager.requireLangPack("simple");tinymce.create("tinymce.themes.SimpleTheme",{init:function(c,d){var e=this,b=["Bold","Italic","Underline","Strikethrough","InsertUnorderedList","InsertOrderedList"],f=c.settings;e.editor=c;c.contentCSS.push(d+"/skins/"+f.skin+"/content.css");c.onInit.add(function(){c.onNodeChange.add(function(h,g){tinymce.each(b,function(i){g.get(i.toLowerCase()).setActive(h.queryCommandState(i))})})});a.loadCSS((f.editor_css?c.documentBaseURI.toAbsolute(f.editor_css):"")||d+"/skins/"+f.skin+"/ui.css")},renderUI:function(h){var e=this,i=h.targetNode,b,c,d=e.editor,f=d.controlManager,g;i=a.insertAfter(a.create("span",{id:d.id+"_container","class":"mceEditor "+d.settings.skin+"SimpleSkin"}),i);i=g=a.add(i,"table",{cellPadding:0,cellSpacing:0,"class":"mceLayout"});i=c=a.add(i,"tbody");i=a.add(c,"tr");i=b=a.add(a.add(i,"td"),"div",{"class":"mceIframeContainer"});i=a.add(a.add(c,"tr",{"class":"last"}),"td",{"class":"mceToolbar mceLast",align:"center"});c=e.toolbar=f.createToolbar("tools1");c.add(f.createButton("bold",{title:"simple.bold_desc",cmd:"Bold"}));c.add(f.createButton("italic",{title:"simple.italic_desc",cmd:"Italic"}));c.add(f.createButton("underline",{title:"simple.underline_desc",cmd:"Underline"}));c.add(f.createButton("strikethrough",{title:"simple.striketrough_desc",cmd:"Strikethrough"}));c.add(f.createSeparator());c.add(f.createButton("undo",{title:"simple.undo_desc",cmd:"Undo"}));c.add(f.createButton("redo",{title:"simple.redo_desc",cmd:"Redo"}));c.add(f.createSeparator());c.add(f.createButton("cleanup",{title:"simple.cleanup_desc",cmd:"mceCleanup"}));c.add(f.createSeparator());c.add(f.createButton("insertunorderedlist",{title:"simple.bullist_desc",cmd:"InsertUnorderedList"}));c.add(f.createButton("insertorderedlist",{title:"simple.numlist_desc",cmd:"InsertOrderedList"}));c.renderTo(i);return{iframeContainer:b,editorContainer:d.id+"_container",sizeContainer:g,deltaHeight:-20}},getInfo:function(){return{longname:"Simple theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.ThemeManager.add("simple",tinymce.themes.SimpleTheme)})(); ================================================ FILE: static/js/tinymce/themes/simple/editor_template_src.js ================================================ /** * editor_template_src.js * * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ (function() { var DOM = tinymce.DOM; // Tell it to load theme specific language pack(s) tinymce.ThemeManager.requireLangPack('simple'); tinymce.create('tinymce.themes.SimpleTheme', { init : function(ed, url) { var t = this, states = ['Bold', 'Italic', 'Underline', 'Strikethrough', 'InsertUnorderedList', 'InsertOrderedList'], s = ed.settings; t.editor = ed; ed.contentCSS.push(url + "/skins/" + s.skin + "/content.css"); ed.onInit.add(function() { ed.onNodeChange.add(function(ed, cm) { tinymce.each(states, function(c) { cm.get(c.toLowerCase()).setActive(ed.queryCommandState(c)); }); }); }); DOM.loadCSS((s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : '') || url + "/skins/" + s.skin + "/ui.css"); }, renderUI : function(o) { var t = this, n = o.targetNode, ic, tb, ed = t.editor, cf = ed.controlManager, sc; n = DOM.insertAfter(DOM.create('span', {id : ed.id + '_container', 'class' : 'mceEditor ' + ed.settings.skin + 'SimpleSkin'}), n); n = sc = DOM.add(n, 'table', {cellPadding : 0, cellSpacing : 0, 'class' : 'mceLayout'}); n = tb = DOM.add(n, 'tbody'); // Create iframe container n = DOM.add(tb, 'tr'); n = ic = DOM.add(DOM.add(n, 'td'), 'div', {'class' : 'mceIframeContainer'}); // Create toolbar container n = DOM.add(DOM.add(tb, 'tr', {'class' : 'last'}), 'td', {'class' : 'mceToolbar mceLast', align : 'center'}); // Create toolbar tb = t.toolbar = cf.createToolbar("tools1"); tb.add(cf.createButton('bold', {title : 'simple.bold_desc', cmd : 'Bold'})); tb.add(cf.createButton('italic', {title : 'simple.italic_desc', cmd : 'Italic'})); tb.add(cf.createButton('underline', {title : 'simple.underline_desc', cmd : 'Underline'})); tb.add(cf.createButton('strikethrough', {title : 'simple.striketrough_desc', cmd : 'Strikethrough'})); tb.add(cf.createSeparator()); tb.add(cf.createButton('undo', {title : 'simple.undo_desc', cmd : 'Undo'})); tb.add(cf.createButton('redo', {title : 'simple.redo_desc', cmd : 'Redo'})); tb.add(cf.createSeparator()); tb.add(cf.createButton('cleanup', {title : 'simple.cleanup_desc', cmd : 'mceCleanup'})); tb.add(cf.createSeparator()); tb.add(cf.createButton('insertunorderedlist', {title : 'simple.bullist_desc', cmd : 'InsertUnorderedList'})); tb.add(cf.createButton('insertorderedlist', {title : 'simple.numlist_desc', cmd : 'InsertOrderedList'})); tb.renderTo(n); return { iframeContainer : ic, editorContainer : ed.id + '_container', sizeContainer : sc, deltaHeight : -20 }; }, getInfo : function() { return { longname : 'Simple theme', author : 'Moxiecode Systems AB', authorurl : 'http://tinymce.moxiecode.com', version : tinymce.majorVersion + "." + tinymce.minorVersion } } }); tinymce.ThemeManager.add('simple', tinymce.themes.SimpleTheme); })(); ================================================ FILE: static/js/tinymce/themes/simple/langs/en.js ================================================ tinyMCE.addI18n('en.simple',{"cleanup_desc":"Cleanup Messy Code","redo_desc":"Redo (Ctrl+Y)","undo_desc":"Undo (Ctrl+Z)","numlist_desc":"Insert/Remove Numbered List","bullist_desc":"Insert/Remove Bulleted List","striketrough_desc":"Strikethrough","underline_desc":"Underline (Ctrl+U)","italic_desc":"Italic (Ctrl+I)","bold_desc":"Bold (Ctrl+B)"}); ================================================ FILE: static/js/tinymce/themes/simple/skins/default/content.css ================================================ body, td, pre { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; } body { background-color: #FFFFFF; } .mceVisualAid { border: 1px dashed #BBBBBB; } /* MSIE specific */ * html body { scrollbar-3dlight-color: #F0F0EE; scrollbar-arrow-color: #676662; scrollbar-base-color: #F0F0EE; scrollbar-darkshadow-color: #DDDDDD; scrollbar-face-color: #E0E0DD; scrollbar-highlight-color: #F0F0EE; scrollbar-shadow-color: #F0F0EE; scrollbar-track-color: #F5F5F5; } ================================================ FILE: static/js/tinymce/themes/simple/skins/default/ui.css ================================================ /* Reset */ .defaultSimpleSkin table, .defaultSimpleSkin tbody, .defaultSimpleSkin a, .defaultSimpleSkin img, .defaultSimpleSkin tr, .defaultSimpleSkin div, .defaultSimpleSkin td, .defaultSimpleSkin iframe, .defaultSimpleSkin span, .defaultSimpleSkin * {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000} /* Containers */ .defaultSimpleSkin {position:relative} .defaultSimpleSkin table.mceLayout {background:#F0F0EE; border:1px solid #CCC;} .defaultSimpleSkin iframe {display:block; background:#FFF; border-bottom:1px solid #CCC;} .defaultSimpleSkin .mceToolbar {height:24px;} /* Layout */ .defaultSimpleSkin span.mceIcon, .defaultSimpleSkin img.mceIcon {display:block; width:20px; height:20px} .defaultSimpleSkin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px} /* Button */ .defaultSimpleSkin .mceButton {display:block; border:1px solid #F0F0EE; width:20px; height:20px} .defaultSimpleSkin a.mceButtonEnabled:hover {border:1px solid #0A246A; background-color:#B2BBD0} .defaultSimpleSkin a.mceButtonActive {border:1px solid #0A246A; background-color:#C2CBE0} .defaultSimpleSkin .mceButtonDisabled span {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} /* Separator */ .defaultSimpleSkin .mceSeparator {display:block; background:url(../../img/icons.gif) -180px 0; width:2px; height:20px; margin:0 2px 0 4px} /* Theme */ .defaultSimpleSkin span.mce_bold {background-position:0 0} .defaultSimpleSkin span.mce_italic {background-position:-60px 0} .defaultSimpleSkin span.mce_underline {background-position:-140px 0} .defaultSimpleSkin span.mce_strikethrough {background-position:-120px 0} .defaultSimpleSkin span.mce_undo {background-position:-160px 0} .defaultSimpleSkin span.mce_redo {background-position:-100px 0} .defaultSimpleSkin span.mce_cleanup {background-position:-40px 0} .defaultSimpleSkin span.mce_insertunorderedlist {background-position:-20px 0} .defaultSimpleSkin span.mce_insertorderedlist {background-position:-80px 0} ================================================ FILE: static/js/tinymce/themes/simple/skins/o2k7/content.css ================================================ body, td, pre {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} body {background: #FFF;} .mceVisualAid {border: 1px dashed #BBB;} /* IE */ * html body { scrollbar-3dlight-color: #F0F0EE; scrollbar-arrow-color: #676662; scrollbar-base-color: #F0F0EE; scrollbar-darkshadow-color: #DDDDDD; scrollbar-face-color: #E0E0DD; scrollbar-highlight-color: #F0F0EE; scrollbar-shadow-color: #F0F0EE; scrollbar-track-color: #F5F5F5; } ================================================ FILE: static/js/tinymce/themes/simple/skins/o2k7/ui.css ================================================ /* Reset */ .o2k7SimpleSkin table, .o2k7SimpleSkin tbody, .o2k7SimpleSkin a, .o2k7SimpleSkin img, .o2k7SimpleSkin tr, .o2k7SimpleSkin div, .o2k7SimpleSkin td, .o2k7SimpleSkin iframe, .o2k7SimpleSkin span, .o2k7SimpleSkin * {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000} /* Containers */ .o2k7SimpleSkin {position:relative} .o2k7SimpleSkin table.mceLayout {background:#E5EFFD; border:1px solid #ABC6DD;} .o2k7SimpleSkin iframe {display:block; background:#FFF; border-bottom:1px solid #ABC6DD;} .o2k7SimpleSkin .mceToolbar {height:26px;} /* Layout */ .o2k7SimpleSkin .mceToolbar .mceToolbarStart span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px; } .o2k7SimpleSkin .mceToolbar .mceToolbarEnd span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px} .o2k7SimpleSkin span.mceIcon, .o2k7SimpleSkin img.mceIcon {display:block; width:20px; height:20px} .o2k7SimpleSkin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px} /* Button */ .o2k7SimpleSkin .mceButton {display:block; background:url(img/button_bg.png); width:22px; height:22px} .o2k7SimpleSkin a.mceButton span, .o2k7SimpleSkin a.mceButton img {margin:1px 0 0 1px} .o2k7SimpleSkin a.mceButtonEnabled:hover {background-color:#B2BBD0; background-position:0 -22px} .o2k7SimpleSkin a.mceButtonActive {background-position:0 -44px} .o2k7SimpleSkin .mceButtonDisabled span {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)} /* Separator */ .o2k7SimpleSkin .mceSeparator {display:block; background:url(img/button_bg.png) -22px 0; width:5px; height:22px} /* Theme */ .o2k7SimpleSkin span.mce_bold {background-position:0 0} .o2k7SimpleSkin span.mce_italic {background-position:-60px 0} .o2k7SimpleSkin span.mce_underline {background-position:-140px 0} .o2k7SimpleSkin span.mce_strikethrough {background-position:-120px 0} .o2k7SimpleSkin span.mce_undo {background-position:-160px 0} .o2k7SimpleSkin span.mce_redo {background-position:-100px 0} .o2k7SimpleSkin span.mce_cleanup {background-position:-40px 0} .o2k7SimpleSkin span.mce_insertunorderedlist {background-position:-20px 0} .o2k7SimpleSkin span.mce_insertorderedlist {background-position:-80px 0} ================================================ FILE: static/js/tinymce/tiny_mce.js ================================================ (function(e){var a=/^\s*|\s*$/g,b,d="B".replace(/A(.)|B/,"$1")==="$1";var c={majorVersion:"3",minorVersion:"5.8",releaseDate:"2012-11-20",_init:function(){var s=this,q=document,o=navigator,g=o.userAgent,m,f,l,k,j,r;s.isOpera=e.opera&&opera.buildNumber;s.isWebKit=/WebKit/.test(g);s.isIE=!s.isWebKit&&!s.isOpera&&(/MSIE/gi).test(g)&&(/Explorer/gi).test(o.appName);s.isIE6=s.isIE&&/MSIE [56]/.test(g);s.isIE7=s.isIE&&/MSIE [7]/.test(g);s.isIE8=s.isIE&&/MSIE [8]/.test(g);s.isIE9=s.isIE&&/MSIE [9]/.test(g);s.isGecko=!s.isWebKit&&/Gecko/.test(g);s.isMac=g.indexOf("Mac")!=-1;s.isAir=/adobeair/i.test(g);s.isIDevice=/(iPad|iPhone)/.test(g);s.isIOS5=s.isIDevice&&g.match(/AppleWebKit\/(\d*)/)[1]>=534;if(e.tinyMCEPreInit){s.suffix=tinyMCEPreInit.suffix;s.baseURL=tinyMCEPreInit.base;s.query=tinyMCEPreInit.query;return}s.suffix="";f=q.getElementsByTagName("base");for(m=0;m0?b:[f.scope]);if(e===false){break}}a.inDispatch=false;return e}});(function(){var a=tinymce.each;tinymce.create("tinymce.util.URI",{URI:function(e,g){var f=this,i,d,c,h;e=tinymce.trim(e);g=f.settings=g||{};if(/^([\w\-]+):([^\/]{2})/i.test(e)||/^\s*#/.test(e)){f.source=e;return}if(e.indexOf("/")===0&&e.indexOf("//")!==0){e=(g.base_uri?g.base_uri.protocol||"http":"http")+"://mce_host"+e}if(!/^[\w\-]*:?\/\//.test(e)){h=g.base_uri?g.base_uri.path:new tinymce.util.URI(location.href).directory;e=((g.base_uri&&g.base_uri.protocol)||"http")+"://mce_host"+f.toAbsPath(h,e)}e=e.replace(/@@/g,"(mce_at)");e=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);a(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(b,j){var k=e[j];if(k){k=k.replace(/\(mce_at\)/g,"@@")}f[b]=k});c=g.base_uri;if(c){if(!f.protocol){f.protocol=c.protocol}if(!f.userInfo){f.userInfo=c.userInfo}if(!f.port&&f.host==="mce_host"){f.port=c.port}if(!f.host||f.host==="mce_host"){f.host=c.host}f.source=""}},setPath:function(c){var b=this;c=/^(.*?)\/?(\w+)?$/.exec(c);b.path=c[0];b.directory=c[1];b.file=c[2];b.source="";b.getURI()},toRelative:function(b){var d=this,f;if(b==="./"){return b}b=new tinymce.util.URI(b,{base_uri:d});if((b.host!="mce_host"&&d.host!=b.host&&b.host)||d.port!=b.port||d.protocol!=b.protocol){return b.getURI()}var c=d.getURI(),e=b.getURI();if(c==e||(c.charAt(c.length-1)=="/"&&c.substr(0,c.length-1)==e)){return c}f=d.toRelPath(d.path,b.path);if(b.query){f+="?"+b.query}if(b.anchor){f+="#"+b.anchor}return f},toAbsolute:function(b,c){b=new tinymce.util.URI(b,{base_uri:this});return b.getURI(this.host==b.host&&this.protocol==b.protocol?c:0)},toRelPath:function(g,h){var c,f=0,d="",e,b;g=g.substring(0,g.lastIndexOf("/"));g=g.split("/");c=h.split("/");if(g.length>=c.length){for(e=0,b=g.length;e=c.length||g[e]!=c[e]){f=e+1;break}}}if(g.length=g.length||g[e]!=c[e]){f=e+1;break}}}if(f===1){return h}for(e=0,b=g.length-(f-1);e=0;c--){if(f[c].length===0||f[c]==="."){continue}if(f[c]===".."){b++;continue}if(b>0){b--;continue}h.push(f[c])}c=e.length-b;if(c<=0){g=h.reverse().join("/")}else{g=e.slice(0,c).join("/")+"/"+h.reverse().join("/")}if(g.indexOf("/")!==0){g="/"+g}if(d&&g.lastIndexOf("/")!==g.length-1){g+=d}return g},getURI:function(d){var c,b=this;if(!b.source||d){c="";if(!d){if(b.protocol){c+=b.protocol+"://"}if(b.userInfo){c+=b.userInfo+"@"}if(b.host){c+=b.host}if(b.port){c+=":"+b.port}}if(b.path){c+=b.path}if(b.query){c+="?"+b.query}if(b.anchor){c+="#"+b.anchor}b.source=c}return b.source}})})();(function(){var a=tinymce.each;tinymce.create("static tinymce.util.Cookie",{getHash:function(d){var b=this.get(d),c;if(b){a(b.split("&"),function(e){e=e.split("=");c=c||{};c[unescape(e[0])]=unescape(e[1])})}return c},setHash:function(j,b,g,f,i,c){var h="";a(b,function(e,d){h+=(!h?"":"&")+escape(d)+"="+escape(e)});this.set(j,h,g,f,i,c)},get:function(i){var h=document.cookie,g,f=i+"=",d;if(!h){return}d=h.indexOf("; "+f);if(d==-1){d=h.indexOf(f);if(d!==0){return null}}else{d+=2}g=h.indexOf(";",d);if(g==-1){g=h.length}return unescape(h.substring(d+f.length,g))},set:function(i,b,g,f,h,c){document.cookie=i+"="+escape(b)+((g)?"; expires="+g.toGMTString():"")+((f)?"; path="+escape(f):"")+((h)?"; domain="+h:"")+((c)?"; secure":"")},remove:function(c,e,d){var b=new Date();b.setTime(b.getTime()-1000);this.set(c,"",b,e,d)}})})();(function(){function serialize(o,quote){var i,v,t,name;quote=quote||'"';if(o==null){return"null"}t=typeof o;if(t=="string"){v="\bb\tt\nn\ff\rr\"\"''\\\\";return quote+o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g,function(a,b){if(quote==='"'&&a==="'"){return a}i=v.indexOf(b);if(i+1){return"\\"+v.charAt(i+1)}a=b.charCodeAt().toString(16);return"\\u"+"0000".substring(a.length)+a})+quote}if(t=="object"){if(o.hasOwnProperty&&Object.prototype.toString.call(o)==="[object Array]"){for(i=0,v="[";i0?",":"")+serialize(o[i],quote)}return v+"]"}v="{";for(name in o){if(o.hasOwnProperty(name)){v+=typeof o[name]!="function"?(v.length>1?","+quote:quote)+name+quote+":"+serialize(o[name],quote):""}}return v+"}"}return""+o}tinymce.util.JSON={serialize:serialize,parse:function(s){try{return eval("("+s+")")}catch(ex){}}}})();tinymce.create("static tinymce.util.XHR",{send:function(g){var a,e,b=window,h=0;function f(){if(!g.async||a.readyState==4||h++>10000){if(g.success&&h<10000&&a.status==200){g.success.call(g.success_scope,""+a.responseText,a,g)}else{if(g.error){g.error.call(g.error_scope,h>10000?"TIMED_OUT":"GENERAL",a,g)}}a=null}else{b.setTimeout(f,10)}}g.scope=g.scope||this;g.success_scope=g.success_scope||g.scope;g.error_scope=g.error_scope||g.scope;g.async=g.async===false?false:true;g.data=g.data||"";function d(i){a=0;try{a=new ActiveXObject(i)}catch(c){}return a}a=b.XMLHttpRequest?new XMLHttpRequest():d("Microsoft.XMLHTTP")||d("Msxml2.XMLHTTP");if(a){if(a.overrideMimeType){a.overrideMimeType(g.content_type)}a.open(g.type||(g.data?"POST":"GET"),g.url,g.async);if(g.content_type){a.setRequestHeader("Content-Type",g.content_type)}a.setRequestHeader("X-Requested-With","XMLHttpRequest");a.send(g.data);if(!g.async){return f()}e=b.setTimeout(f,10)}}});(function(){var c=tinymce.extend,b=tinymce.util.JSON,a=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(d){this.settings=c({},d);this.count=0},send:function(f){var e=f.error,d=f.success;f=c(this.settings,f);f.success=function(h,g){h=b.parse(h);if(typeof(h)=="undefined"){h={error:"JSON Parse error."}}if(h.error){e.call(f.error_scope||f.scope,h.error,g)}else{d.call(f.success_scope||f.scope,h.result)}};f.error=function(h,g){if(e){e.call(f.error_scope||f.scope,h,g)}};f.data=b.serialize({id:f.id||"c"+(this.count++),method:f.method,params:f.params});f.content_type="application/json";a.send(f)},"static":{sendRPC:function(d){return new tinymce.util.JSONRequest().send(d)}}})}());(function(a){a.VK={BACKSPACE:8,DELETE:46,DOWN:40,ENTER:13,LEFT:37,RIGHT:39,SPACEBAR:32,TAB:9,UP:38,modifierPressed:function(b){return b.shiftKey||b.ctrlKey||b.altKey},metaKeyPressed:function(b){return a.isMac?b.metaKey:b.ctrlKey&&!b.altKey}}})(tinymce);tinymce.util.Quirks=function(a){var j=tinymce.VK,f=j.BACKSPACE,k=j.DELETE,e=a.dom,l=a.selection,H=a.settings,v=a.parser,o=a.serializer,E=tinymce.each;function A(N,M){try{a.getDoc().execCommand(N,false,M)}catch(L){}}function n(){var L=a.getDoc().documentMode;return L?L:6}function z(L){return L.isDefaultPrevented()}function J(){function L(O){var M,Q,N,P;M=l.getRng();Q=e.getParent(M.startContainer,e.isBlock);if(O){Q=e.getNext(Q,e.isBlock)}if(Q){N=Q.firstChild;while(N&&N.nodeType==3&&N.nodeValue.length===0){N=N.nextSibling}if(N&&N.nodeName==="SPAN"){P=N.cloneNode(false)}}E(e.select("span",Q),function(R){R.setAttribute("data-mce-mark","1")});a.getDoc().execCommand(O?"ForwardDelete":"Delete",false,null);Q=e.getParent(M.startContainer,e.isBlock);E(e.select("span",Q),function(R){var S=l.getBookmark();if(P){e.replace(P.cloneNode(false),R,true)}else{if(!R.getAttribute("data-mce-mark")){e.remove(R,true)}else{R.removeAttribute("data-mce-mark")}}l.moveToBookmark(S)})}a.onKeyDown.add(function(M,O){var N;N=O.keyCode==k;if(!z(O)&&(N||O.keyCode==f)&&!j.modifierPressed(O)){O.preventDefault();L(N)}});a.addCommand("Delete",function(){L()})}function q(){function L(O){var N=e.create("body");var P=O.cloneContents();N.appendChild(P);return l.serializer.serialize(N,{format:"html"})}function M(N){var P=L(N);var Q=e.createRng();Q.selectNode(a.getBody());var O=L(Q);return P===O}a.onKeyDown.add(function(O,Q){var P=Q.keyCode,N;if(!z(Q)&&(P==k||P==f)){N=O.selection.isCollapsed();if(N&&!e.isEmpty(O.getBody())){return}if(tinymce.isIE&&!N){return}if(!N&&!M(O.selection.getRng())){return}O.setContent("");O.selection.setCursorLocation(O.getBody(),0);O.nodeChanged()}})}function I(){a.onKeyDown.add(function(L,M){if(!z(M)&&M.keyCode==65&&j.metaKeyPressed(M)){M.preventDefault();L.execCommand("SelectAll")}})}function K(){if(!a.settings.content_editable){e.bind(a.getDoc(),"focusin",function(L){l.setRng(l.getRng())});e.bind(a.getDoc(),"mousedown",function(L){if(L.target==a.getDoc().documentElement){a.getWin().focus();l.setRng(l.getRng())}})}}function B(){a.onKeyDown.add(function(L,O){if(!z(O)&&O.keyCode===f){if(l.isCollapsed()&&l.getRng(true).startOffset===0){var N=l.getNode();var M=N.previousSibling;if(M&&M.nodeName&&M.nodeName.toLowerCase()==="hr"){e.remove(M);tinymce.dom.Event.cancel(O)}}}})}function y(){if(!Range.prototype.getClientRects){a.onMouseDown.add(function(M,N){if(!z(N)&&N.target.nodeName==="HTML"){var L=M.getBody();L.blur();setTimeout(function(){L.focus()},0)}})}}function h(){a.onClick.add(function(L,M){M=M.target;if(/^(IMG|HR)$/.test(M.nodeName)){l.getSel().setBaseAndExtent(M,0,M,1)}if(M.nodeName=="A"&&e.hasClass(M,"mceItemAnchor")){l.select(M)}L.nodeChanged()})}function c(){function M(){var O=e.getAttribs(l.getStart().cloneNode(false));return function(){var P=l.getStart();if(P!==a.getBody()){e.setAttrib(P,"style",null);E(O,function(Q){P.setAttributeNode(Q.cloneNode(true))})}}}function L(){return !l.isCollapsed()&&e.getParent(l.getStart(),e.isBlock)!=e.getParent(l.getEnd(),e.isBlock)}function N(O,P){P.preventDefault();return false}a.onKeyPress.add(function(O,Q){var P;if(!z(Q)&&(Q.keyCode==8||Q.keyCode==46)&&L()){P=M();O.getDoc().execCommand("delete",false,null);P();Q.preventDefault();return false}});e.bind(a.getDoc(),"cut",function(P){var O;if(!z(P)&&L()){O=M();a.onKeyUp.addToTop(N);setTimeout(function(){O();a.onKeyUp.remove(N)},0)}})}function b(){var M,L;e.bind(a.getDoc(),"selectionchange",function(){if(L){clearTimeout(L);L=0}L=window.setTimeout(function(){var N=l.getRng();if(!M||!tinymce.dom.RangeUtils.compareRanges(N,M)){a.nodeChanged();M=N}},50)})}function x(){document.body.setAttribute("role","application")}function t(){a.onKeyDown.add(function(L,N){if(!z(N)&&N.keyCode===f){if(l.isCollapsed()&&l.getRng(true).startOffset===0){var M=l.getNode().previousSibling;if(M&&M.nodeName&&M.nodeName.toLowerCase()==="table"){return tinymce.dom.Event.cancel(N)}}}})}function C(){if(n()>7){return}A("RespectVisibilityInDesign",true);a.contentStyles.push(".mceHideBrInPre pre br {display: none}");e.addClass(a.getBody(),"mceHideBrInPre");v.addNodeFilter("pre",function(L,N){var O=L.length,Q,M,R,P;while(O--){Q=L[O].getAll("br");M=Q.length;while(M--){R=Q[M];P=R.prev;if(P&&P.type===3&&P.value.charAt(P.value-1)!="\n"){P.value+="\n"}else{R.parent.insert(new tinymce.html.Node("#text",3),R,true).value="\n"}}}});o.addNodeFilter("pre",function(L,N){var O=L.length,Q,M,R,P;while(O--){Q=L[O].getAll("br");M=Q.length;while(M--){R=Q[M];P=R.prev;if(P&&P.type==3){P.value=P.value.replace(/\r?\n$/,"")}}}})}function g(){e.bind(a.getBody(),"mouseup",function(N){var M,L=l.getNode();if(L.nodeName=="IMG"){if(M=e.getStyle(L,"width")){e.setAttrib(L,"width",M.replace(/[^0-9%]+/g,""));e.setStyle(L,"width","")}if(M=e.getStyle(L,"height")){e.setAttrib(L,"height",M.replace(/[^0-9%]+/g,""));e.setStyle(L,"height","")}}})}function d(){a.onKeyDown.add(function(R,S){var Q,L,M,O,P,T,N;Q=S.keyCode==k;if(!z(S)&&(Q||S.keyCode==f)&&!j.modifierPressed(S)){L=l.getRng();M=L.startContainer;O=L.startOffset;N=L.collapsed;if(M.nodeType==3&&M.nodeValue.length>0&&((O===0&&!N)||(N&&O===(Q?0:1)))){nonEmptyElements=R.schema.getNonEmptyElements();S.preventDefault();P=e.create("br",{id:"__tmp"});M.parentNode.insertBefore(P,M);R.getDoc().execCommand(Q?"ForwardDelete":"Delete",false,null);M=l.getRng().startContainer;T=M.previousSibling;if(T&&T.nodeType==1&&!e.isBlock(T)&&e.isEmpty(T)&&!nonEmptyElements[T.nodeName.toLowerCase()]){e.remove(T)}e.remove("__tmp")}}})}function G(){a.onKeyDown.add(function(P,Q){var N,M,R,L,O;if(z(Q)||Q.keyCode!=j.BACKSPACE){return}N=l.getRng();M=N.startContainer;R=N.startOffset;L=e.getRoot();O=M;if(!N.collapsed||R!==0){return}while(O&&O.parentNode&&O.parentNode.firstChild==O&&O.parentNode!=L){O=O.parentNode}if(O.tagName==="BLOCKQUOTE"){P.formatter.toggle("blockquote",null,O);N=e.createRng();N.setStart(M,0);N.setEnd(M,0);l.setRng(N)}})}function F(){function L(){a._refreshContentEditable();A("StyleWithCSS",false);A("enableInlineTableEditing",false);if(!H.object_resizing){A("enableObjectResizing",false)}}if(!H.readonly){a.onBeforeExecCommand.add(L);a.onMouseDown.add(L)}}function s(){function L(M,N){E(e.select("a"),function(Q){var O=Q.parentNode,P=e.getRoot();if(O.lastChild===Q){while(O&&!e.isBlock(O)){if(O.parentNode.lastChild!==O||O===P){return}O=O.parentNode}e.add(O,"br",{"data-mce-bogus":1})}})}a.onExecCommand.add(function(M,N){if(N==="CreateLink"){L(M)}});a.onSetContent.add(l.onSetContent.add(L))}function m(){if(H.forced_root_block){a.onInit.add(function(){A("DefaultParagraphSeparator",H.forced_root_block)})}}function p(){function L(N,M){if(!N||!M.initial){a.execCommand("mceRepaint")}}a.onUndo.add(L);a.onRedo.add(L);a.onSetContent.add(L)}function i(){a.onKeyDown.add(function(M,N){var L;if(!z(N)&&N.keyCode==f){L=M.getDoc().selection.createRange();if(L&&L.item){N.preventDefault();M.undoManager.beforeChange();e.remove(L.item(0));M.undoManager.add()}}})}function r(){var L;if(n()>=10){L="";E("p div h1 h2 h3 h4 h5 h6".split(" "),function(M,N){L+=(N>0?",":"")+M+":empty"});a.contentStyles.push(L+"{padding-right: 1px !important}")}}function u(){var N,M,ad,L,Y,ab,Z,ac,O,P,aa,W,V,X=document,T=a.getDoc();if(!H.object_resizing||H.webkit_fake_resize===false){return}A("enableObjectResizing",false);aa={n:[0.5,0,0,-1],e:[1,0.5,1,0],s:[0.5,1,0,1],w:[0,0.5,-1,0],nw:[0,0,-1,-1],ne:[1,0,1,-1],se:[1,1,1,1],sw:[0,1,-1,1]};function R(ah){var ag,af;ag=ah.screenX-ab;af=ah.screenY-Z;W=ag*Y[2]+ac;V=af*Y[3]+O;W=W<5?5:W;V=V<5?5:V;if(j.modifierPressed(ah)||(ad.nodeName=="IMG"&&Y[2]*Y[3]!==0)){W=Math.round(V/P);V=Math.round(W*P)}e.setStyles(L,{width:W,height:V});if(Y[2]<0&&L.clientWidth<=W){e.setStyle(L,"left",N+(ac-W))}if(Y[3]<0&&L.clientHeight<=V){e.setStyle(L,"top",M+(O-V))}}function ae(){function af(ag,ah){if(ah){if(ad.style[ag]||!a.schema.isValid(ad.nodeName.toLowerCase(),ag)){e.setStyle(ad,ag,ah)}else{e.setAttrib(ad,ag,ah)}}}af("width",W);af("height",V);e.unbind(T,"mousemove",R);e.unbind(T,"mouseup",ae);if(X!=T){e.unbind(X,"mousemove",R);e.unbind(X,"mouseup",ae)}e.remove(L);Q(ad)}function Q(ai){var ag,ah,af;S();ag=e.getPos(ai);N=ag.x;M=ag.y;ah=ai.offsetWidth;af=ai.offsetHeight;if(ad!=ai){ad=ai;W=V=0}E(aa,function(al,aj){var ak;ak=e.get("mceResizeHandle"+aj);if(!ak){ak=e.add(T.documentElement,"div",{id:"mceResizeHandle"+aj,"class":"mceResizeHandle",style:"cursor:"+aj+"-resize; margin:0; padding:0"});e.bind(ak,"mousedown",function(am){am.preventDefault();ae();ab=am.screenX;Z=am.screenY;ac=ad.clientWidth;O=ad.clientHeight;P=O/ac;Y=al;L=ad.cloneNode(true);e.addClass(L,"mceClonedResizable");e.setStyles(L,{left:N,top:M,margin:0});T.documentElement.appendChild(L);e.bind(T,"mousemove",R);e.bind(T,"mouseup",ae);if(X!=T){e.bind(X,"mousemove",R);e.bind(X,"mouseup",ae)}})}else{e.show(ak)}e.setStyles(ak,{left:(ah*al[0]+N)-(ak.offsetWidth/2),top:(af*al[1]+M)-(ak.offsetHeight/2)})});if(!tinymce.isOpera&&ad.nodeName=="IMG"){ad.setAttribute("data-mce-selected","1")}}function S(){if(ad){ad.removeAttribute("data-mce-selected")}for(var af in aa){e.hide("mceResizeHandle"+af)}}a.contentStyles.push(".mceResizeHandle {position: absolute;border: 1px solid black;background: #FFF;width: 5px;height: 5px;z-index: 10000}.mceResizeHandle:hover {background: #000}img[data-mce-selected] {outline: 1px solid black}img.mceClonedResizable, table.mceClonedResizable {position: absolute;outline: 1px dashed black;opacity: .5;z-index: 10000}");function U(){var af=e.getParent(l.getNode(),"table,img");E(e.select("img[data-mce-selected]"),function(ag){ag.removeAttribute("data-mce-selected")});if(af){Q(af)}else{S()}}a.onNodeChange.add(U);e.bind(T,"selectionchange",U);a.serializer.addAttributeFilter("data-mce-selected",function(af,ag){var ah=af.length;while(ah--){af[ah].attr(ag,null)}})}function D(){if(n()<9){v.addNodeFilter("noscript",function(L){var M=L.length,N,O;while(M--){N=L[M];O=N.firstChild;if(O){N.attr("data-mce-innertext",O.value)}}});o.addNodeFilter("noscript",function(L){var M=L.length,N,P,O;while(M--){N=L[M];P=L[M].firstChild;if(P){P.value=tinymce.html.Entities.decode(P.value)}else{O=N.attributes.map["data-mce-innertext"];if(O){N.attr("data-mce-innertext",null);P=new tinymce.html.Node("#text",3);P.value=O;P.raw=true;N.append(P)}}}})}}t();G();q();if(tinymce.isWebKit){d();J();K();h();m();if(tinymce.isIDevice){b()}else{u();I()}}if(tinymce.isIE){B();x();C();g();i();r();D()}if(tinymce.isGecko){B();y();c();F();s();p()}if(tinymce.isOpera){u()}};(function(j){var a,g,d,k=/[&<>\"\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,b=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,f=/[<>&\"\']/g,c=/&(#x|#)?([\w]+);/g,i={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"};g={'"':""","'":"'","<":"<",">":">","&":"&"};d={"<":"<",">":">","&":"&",""":'"',"'":"'"};function h(l){var m;m=document.createElement("div");m.innerHTML=l;return m.textContent||m.innerText||l}function e(m,p){var n,o,l,q={};if(m){m=m.split(",");p=p||10;for(n=0;n1){return"&#"+(((n.charCodeAt(0)-55296)*1024)+(n.charCodeAt(1)-56320)+65536)+";"}return g[n]||"&#"+n.charCodeAt(0)+";"})},encodeNamed:function(n,l,m){m=m||a;return n.replace(l?k:b,function(o){return g[o]||m[o]||o})},getEncodeFunc:function(l,o){var p=j.html.Entities;o=e(o)||a;function m(r,q){return r.replace(q?k:b,function(s){return g[s]||o[s]||"&#"+s.charCodeAt(0)+";"||s})}function n(r,q){return p.encodeNamed(r,q,o)}l=j.makeMap(l.replace(/\+/g,","));if(l.named&&l.numeric){return m}if(l.named){if(o){return n}return p.encodeNamed}if(l.numeric){return p.encodeNumeric}return p.encodeRaw},decode:function(l){return l.replace(c,function(n,m,o){if(m){o=parseInt(o,m.length===2?16:10);if(o>65535){o-=65536;return String.fromCharCode(55296+(o>>10),56320+(o&1023))}else{return i[o]||String.fromCharCode(o)}}return d[n]||a[n]||h(n)})}}})(tinymce);tinymce.html.Styles=function(d,f){var k=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,h=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,b=/\s*([^:]+):\s*([^;]+);?/g,l=/\s+$/,m=/rgb/,e,g,a={},j;d=d||{};j="\\\" \\' \\; \\: ; : \uFEFF".split(" ");for(g=0;g1?r:"0"+r}return"#"+o(q)+o(p)+o(i)}return{toHex:function(i){return i.replace(k,c)},parse:function(s){var z={},q,n,x,r,v=d.url_converter,y=d.url_converter_scope||this;function p(D,G){var F,C,B,E;F=z[D+"-top"+G];if(!F){return}C=z[D+"-right"+G];if(F!=C){return}B=z[D+"-bottom"+G];if(C!=B){return}E=z[D+"-left"+G];if(B!=E){return}z[D+G]=E;delete z[D+"-top"+G];delete z[D+"-right"+G];delete z[D+"-bottom"+G];delete z[D+"-left"+G]}function u(C){var D=z[C],B;if(!D||D.indexOf(" ")<0){return}D=D.split(" ");B=D.length;while(B--){if(D[B]!==D[0]){return false}}z[C]=D[0];return true}function A(D,C,B,E){if(!u(C)){return}if(!u(B)){return}if(!u(E)){return}z[D]=z[C]+" "+z[B]+" "+z[E];delete z[C];delete z[B];delete z[E]}function t(B){r=true;return a[B]}function i(C,B){if(r){C=C.replace(/\uFEFF[0-9]/g,function(D){return a[D]})}if(!B){C=C.replace(/\\([\'\";:])/g,"$1")}return C}function o(C,B,F,E,G,D){G=G||D;if(G){G=i(G);return"'"+G.replace(/\'/g,"\\'")+"'"}B=i(B||F||E);if(v){B=v.call(y,B,"style")}return"url('"+B.replace(/\'/g,"\\'")+"')"}if(s){s=s.replace(/\\[\"\';:\uFEFF]/g,t).replace(/\"[^\"]+\"|\'[^\']+\'/g,function(B){return B.replace(/[;:]/g,t)});while(q=b.exec(s)){n=q[1].replace(l,"").toLowerCase();x=q[2].replace(l,"");if(n&&x.length>0){if(n==="font-weight"&&x==="700"){x="bold"}else{if(n==="color"||n==="background-color"){x=x.toLowerCase()}}x=x.replace(k,c);x=x.replace(h,o);z[n]=r?i(x,true):x}b.lastIndex=q.index+q[0].length}p("border","");p("border","-width");p("border","-color");p("border","-style");p("padding","");p("margin","");A("border","border-width","border-style","border-color");if(z.border==="medium none"){delete z.border}}return z},serialize:function(p,r){var o="",n,q;function i(t){var x,u,s,v;x=f.styles[t];if(x){for(u=0,s=x.length;u0){o+=(o.length>0?" ":"")+t+": "+v+";"}}}}if(r&&f&&f.styles){i("*");i(r)}else{for(n in p){q=p[n];if(q!==e&&q.length>0){o+=(o.length>0?" ":"")+n+": "+q+";"}}}return o}}};(function(f){var a={},e=f.makeMap,g=f.each;function d(j,i){return j.split(i||",")}function h(m,l){var j,k={};function i(n){return n.replace(/[A-Z]+/g,function(o){return i(m[o])})}for(j in m){if(m.hasOwnProperty(j)){m[j]=i(m[j])}}i(l).replace(/#/g,"#text").replace(/(\w+)\[([^\]]+)\]\[([^\]]*)\]/g,function(q,o,n,p){n=d(n,"|");k[o]={attributes:e(n),attributesOrder:n,children:e(p,"|",{"#comment":{}})}});return k}function b(){var i=a.html5;if(!i){i=a.html5=h({A:"id|accesskey|class|dir|draggable|item|hidden|itemprop|role|spellcheck|style|subject|title|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup",B:"#|a|abbr|area|audio|b|bdo|br|button|canvas|cite|code|command|datalist|del|dfn|em|embed|i|iframe|img|input|ins|kbd|keygen|label|link|map|mark|meta|meter|noscript|object|output|progress|q|ruby|samp|script|select|small|span|strong|sub|sup|svg|textarea|time|var|video|wbr",C:"#|a|abbr|area|address|article|aside|audio|b|bdo|blockquote|br|button|canvas|cite|code|command|datalist|del|details|dfn|dialog|div|dl|em|embed|fieldset|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|i|iframe|img|input|ins|kbd|keygen|label|link|map|mark|menu|meta|meter|nav|noscript|ol|object|output|p|pre|progress|q|ruby|samp|script|section|select|small|span|strong|style|sub|sup|svg|table|textarea|time|ul|var|video"},"html[A|manifest][body|head]head[A][base|command|link|meta|noscript|script|style|title]title[A][#]base[A|href|target][]link[A|href|rel|media|type|sizes][]meta[A|http-equiv|name|content|charset][]style[A|type|media|scoped][#]script[A|charset|type|src|defer|async][#]noscript[A][C]body[A][C]section[A][C]nav[A][C]article[A][C]aside[A][C]h1[A][B]h2[A][B]h3[A][B]h4[A][B]h5[A][B]h6[A][B]hgroup[A][h1|h2|h3|h4|h5|h6]header[A][C]footer[A][C]address[A][C]p[A][B]br[A][]pre[A][B]dialog[A][dd|dt]blockquote[A|cite][C]ol[A|start|reversed][li]ul[A][li]li[A|value][C]dl[A][dd|dt]dt[A][B]dd[A][C]a[A|href|target|ping|rel|media|type][B]em[A][B]strong[A][B]small[A][B]cite[A][B]q[A|cite][B]dfn[A][B]abbr[A][B]code[A][B]var[A][B]samp[A][B]kbd[A][B]sub[A][B]sup[A][B]i[A][B]b[A][B]mark[A][B]progress[A|value|max][B]meter[A|value|min|max|low|high|optimum][B]time[A|datetime][B]ruby[A][B|rt|rp]rt[A][B]rp[A][B]bdo[A][B]span[A][B]ins[A|cite|datetime][B]del[A|cite|datetime][B]figure[A][C|legend|figcaption]figcaption[A][C]img[A|alt|src|height|width|usemap|ismap][]iframe[A|name|src|height|width|sandbox|seamless][]embed[A|src|height|width|type][]object[A|data|type|height|width|usemap|name|form|classid][param]param[A|name|value][]details[A|open][C|legend]command[A|type|label|icon|disabled|checked|radiogroup][]menu[A|type|label][C|li]legend[A][C|B]div[A][C]source[A|src|type|media][]audio[A|src|autobuffer|autoplay|loop|controls][source]video[A|src|autobuffer|autoplay|loop|controls|width|height|poster][source]hr[A][]form[A|accept-charset|action|autocomplete|enctype|method|name|novalidate|target][C]fieldset[A|disabled|form|name][C|legend]label[A|form|for][B]input[A|type|accept|alt|autocomplete|autofocus|checked|disabled|form|formaction|formenctype|formmethod|formnovalidate|formtarget|height|list|max|maxlength|min|multiple|pattern|placeholder|readonly|required|size|src|step|width|files|value|name][]button[A|autofocus|disabled|form|formaction|formenctype|formmethod|formnovalidate|formtarget|name|value|type][B]select[A|autofocus|disabled|form|multiple|name|size][option|optgroup]datalist[A][B|option]optgroup[A|disabled|label][option]option[A|disabled|selected|label|value][]textarea[A|autofocus|disabled|form|maxlength|name|placeholder|readonly|required|rows|cols|wrap][]keygen[A|autofocus|challenge|disabled|form|keytype|name][]output[A|for|form|name][B]canvas[A|width|height][]map[A|name][B|C]area[A|shape|coords|href|alt|target|media|rel|ping|type][]mathml[A][]svg[A][]table[A|border][caption|colgroup|thead|tfoot|tbody|tr]caption[A][C]colgroup[A|span][col]col[A|span][]thead[A][tr]tfoot[A][tr]tbody[A][tr]tr[A][th|td]th[A|headers|rowspan|colspan|scope][B]td[A|headers|rowspan|colspan][C]wbr[A][]")}return i}function c(){var i=a.html4;if(!i){i=a.html4=h({Z:"H|K|N|O|P",Y:"X|form|R|Q",ZG:"E|span|width|align|char|charoff|valign",X:"p|T|div|U|W|isindex|fieldset|table",ZF:"E|align|char|charoff|valign",W:"pre|hr|blockquote|address|center|noframes",ZE:"abbr|axis|headers|scope|rowspan|colspan|align|char|charoff|valign|nowrap|bgcolor|width|height",ZD:"[E][S]",U:"ul|ol|dl|menu|dir",ZC:"p|Y|div|U|W|table|br|span|bdo|object|applet|img|map|K|N|Q",T:"h1|h2|h3|h4|h5|h6",ZB:"X|S|Q",S:"R|P",ZA:"a|G|J|M|O|P",R:"a|H|K|N|O",Q:"noscript|P",P:"ins|del|script",O:"input|select|textarea|label|button",N:"M|L",M:"em|strong|dfn|code|q|samp|kbd|var|cite|abbr|acronym",L:"sub|sup",K:"J|I",J:"tt|i|b|u|s|strike",I:"big|small|font|basefont",H:"G|F",G:"br|span|bdo",F:"object|applet|img|map|iframe",E:"A|B|C",D:"accesskey|tabindex|onfocus|onblur",C:"onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup",B:"lang|xml:lang|dir",A:"id|class|style|title"},"script[id|charset|type|language|src|defer|xml:space][]style[B|id|type|media|title|xml:space][]object[E|declare|classid|codebase|data|type|codetype|archive|standby|width|height|usemap|name|tabindex|align|border|hspace|vspace][#|param|Y]param[id|name|value|valuetype|type][]p[E|align][#|S]a[E|D|charset|type|name|href|hreflang|rel|rev|shape|coords|target][#|Z]br[A|clear][]span[E][#|S]bdo[A|C|B][#|S]applet[A|codebase|archive|code|object|alt|name|width|height|align|hspace|vspace][#|param|Y]h1[E|align][#|S]img[E|src|alt|name|longdesc|width|height|usemap|ismap|align|border|hspace|vspace][]map[B|C|A|name][X|form|Q|area]h2[E|align][#|S]iframe[A|longdesc|name|src|frameborder|marginwidth|marginheight|scrolling|align|width|height][#|Y]h3[E|align][#|S]tt[E][#|S]i[E][#|S]b[E][#|S]u[E][#|S]s[E][#|S]strike[E][#|S]big[E][#|S]small[E][#|S]font[A|B|size|color|face][#|S]basefont[id|size|color|face][]em[E][#|S]strong[E][#|S]dfn[E][#|S]code[E][#|S]q[E|cite][#|S]samp[E][#|S]kbd[E][#|S]var[E][#|S]cite[E][#|S]abbr[E][#|S]acronym[E][#|S]sub[E][#|S]sup[E][#|S]input[E|D|type|name|value|checked|disabled|readonly|size|maxlength|src|alt|usemap|onselect|onchange|accept|align][]select[E|name|size|multiple|disabled|tabindex|onfocus|onblur|onchange][optgroup|option]optgroup[E|disabled|label][option]option[E|selected|disabled|label|value][]textarea[E|D|name|rows|cols|disabled|readonly|onselect|onchange][]label[E|for|accesskey|onfocus|onblur][#|S]button[E|D|name|value|type|disabled][#|p|T|div|U|W|table|G|object|applet|img|map|K|N|Q]h4[E|align][#|S]ins[E|cite|datetime][#|Y]h5[E|align][#|S]del[E|cite|datetime][#|Y]h6[E|align][#|S]div[E|align][#|Y]ul[E|type|compact][li]li[E|type|value][#|Y]ol[E|type|compact|start][li]dl[E|compact][dt|dd]dt[E][#|S]dd[E][#|Y]menu[E|compact][li]dir[E|compact][li]pre[E|width|xml:space][#|ZA]hr[E|align|noshade|size|width][]blockquote[E|cite][#|Y]address[E][#|S|p]center[E][#|Y]noframes[E][#|Y]isindex[A|B|prompt][]fieldset[E][#|legend|Y]legend[E|accesskey|align][#|S]table[E|summary|width|border|frame|rules|cellspacing|cellpadding|align|bgcolor][caption|col|colgroup|thead|tfoot|tbody|tr]caption[E|align][#|S]col[ZG][]colgroup[ZG][col]thead[ZF][tr]tr[ZF|bgcolor][th|td]th[E|ZE][#|Y]form[E|action|method|name|enctype|onsubmit|onreset|accept|accept-charset|target][#|X|R|Q]noscript[E][#|Y]td[E|ZE][#|Y]tfoot[ZF][tr]tbody[ZF][tr]area[E|D|shape|coords|href|nohref|alt|target][]base[id|href|target][]body[E|onload|onunload|background|bgcolor|text|link|vlink|alink][#|Y]")}return i}f.html.Schema=function(A){var u=this,s={},k={},j=[],D,y;var o,q,z,r,v,n,p={};function m(F,E,H){var G=A[F];if(!G){G=a[F];if(!G){G=e(E," ",e(E.toUpperCase()," "));G=f.extend(G,H);a[F]=G}}else{G=e(G,",",e(G.toUpperCase()," "))}return G}A=A||{};y=A.schema=="html5"?b():c();if(A.verify_html===false){A.valid_elements="*[*]"}if(A.valid_styles){D={};g(A.valid_styles,function(F,E){D[E]=f.explode(F)})}o=m("whitespace_elements","pre script noscript style textarea");q=m("self_closing_elements","colgroup dd dt li option p td tfoot th thead tr");z=m("short_ended_elements","area base basefont br col frame hr img input isindex link meta param embed source wbr");r=m("boolean_attributes","checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls");n=m("non_empty_elements","td th iframe video audio object",z);textBlockElementsMap=m("text_block_elements","h1 h2 h3 h4 h5 h6 p div address pre form blockquote center dir fieldset header footer article section hgroup aside nav figure");v=m("block_elements","hr table tbody thead tfoot th tr td li ol ul caption dl dt dd noscript menu isindex samp option datalist select optgroup",textBlockElementsMap);function i(E){return new RegExp("^"+E.replace(/([?+*])/g,".$1")+"$")}function C(L){var K,G,Z,V,aa,F,I,U,X,Q,Y,ac,O,J,W,E,S,H,ab,ad,P,T,N=/^([#+\-])?([^\[\/]+)(?:\/([^\[]+))?(?:\[([^\]]+)\])?$/,R=/^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/,M=/[*?+]/;if(L){L=d(L);if(s["@"]){S=s["@"].attributes;H=s["@"].attributesOrder}for(K=0,G=L.length;K=0){for(U=A.length-1;U>=V;U--){T=A[U];if(T.valid){n.end(T.name)}}A.length=V}}function p(U,T,Y,X,W){var Z,V;T=T.toLowerCase();Y=T in H?T:j(Y||X||W||"");if(v&&!z&&T.indexOf("data-")!==0){Z=P[T];if(!Z&&F){V=F.length;while(V--){Z=F[V];if(Z.pattern.test(T)){break}}if(V===-1){Z=null}}if(!Z){return}if(Z.validValues&&!(Y in Z.validValues)){return}}N.map[T]=Y;N.push({name:T,value:Y})}l=new RegExp("<(?:(?:!--([\\w\\W]*?)-->)|(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|(?:!DOCTYPE([\\w\\W]*?)>)|(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|(?:\\/([^>]+)>)|(?:([A-Za-z0-9\\-\\:\\.]+)((?:\\s+[^\"'>]+(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>]*))*|\\/|\\s+)>))","g");D=/([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:[^\"])*)\")|(?:\'((?:[^\'])*)\')|([^>\s]+)))?/g;K={script:/<\/script[^>]*>/gi,style:/<\/style[^>]*>/gi,noscript:/<\/noscript[^>]*>/gi};M=e.getShortEndedElements();J=c.self_closing_elements||e.getSelfClosingElements();H=e.getBoolAttrs();v=c.validate;s=c.remove_internals;y=c.fix_self_closing;q=a.isIE;o=/^:/;while(g=l.exec(E)){if(G0&&A[A.length-1].name===I){u(I)}if(!v||(m=e.getElementRule(I))){k=true;if(v){P=m.attributes;F=m.attributePatterns}if(R=g[8]){z=R.indexOf("data-mce-type")!==-1;if(z&&s){k=false}N=[];N.map={};R.replace(D,p)}else{N=[];N.map={}}if(v&&!z){S=m.attributesRequired;L=m.attributesDefault;f=m.attributesForced;if(f){Q=f.length;while(Q--){t=f[Q];r=t.name;h=t.value;if(h==="{$uid}"){h="mce_"+x++}N.map[r]=h;N.push({name:r,value:h})}}if(L){Q=L.length;while(Q--){t=L[Q];r=t.name;if(!(r in N.map)){h=t.value;if(h==="{$uid}"){h="mce_"+x++}N.map[r]=h;N.push({name:r,value:h})}}}if(S){Q=S.length;while(Q--){if(S[Q] in N.map){break}}if(Q===-1){k=false}}if(N.map["data-mce-bogus"]){k=false}}if(k){n.start(I,N,O)}}else{k=false}if(B=K[I]){B.lastIndex=G=g.index+g[0].length;if(g=B.exec(E)){if(k){C=E.substr(G,g.index-G)}G=g.index+g[0].length}else{C=E.substr(G);G=E.length}if(k&&C.length>0){n.text(C,true)}if(k){n.end(I)}l.lastIndex=G;continue}if(!O){if(!R||R.indexOf("/")!=R.length-1){A.push({name:I,valid:k})}else{if(k){n.end(I)}}}}else{if(I=g[1]){n.comment(I)}else{if(I=g[2]){n.cdata(I)}else{if(I=g[3]){n.doctype(I)}else{if(I=g[4]){n.pi(I,g[5])}}}}}}G=g.index+g[0].length}if(G=0;Q--){I=A[Q];if(I.valid){n.end(I.name)}}}}})(tinymce);(function(d){var c=/^[ \t\r\n]*$/,e={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11};function a(k,l,j){var i,h,f=j?"lastChild":"firstChild",g=j?"prev":"next";if(k[f]){return k[f]}if(k!==l){i=k[g];if(i){return i}for(h=k.parent;h&&h!==l;h=h.parent){i=h[g];if(i){return i}}}}function b(f,g){this.name=f;this.type=g;if(g===1){this.attributes=[];this.attributes.map={}}}d.extend(b.prototype,{replace:function(g){var f=this;if(g.parent){g.remove()}f.insert(g,f);f.remove();return f},attr:function(h,l){var f=this,g,j,k;if(typeof h!=="string"){for(j in h){f.attr(j,h[j])}return f}if(g=f.attributes){if(l!==k){if(l===null){if(h in g.map){delete g.map[h];j=g.length;while(j--){if(g[j].name===h){g=g.splice(j,1);return f}}}return f}if(h in g.map){j=g.length;while(j--){if(g[j].name===h){g[j].value=l;break}}}else{g.push({name:h,value:l})}g.map[h]=l;return f}else{return g.map[h]}}},clone:function(){var g=this,n=new b(g.name,g.type),h,f,m,j,k;if(m=g.attributes){k=[];k.map={};for(h=0,f=m.length;h1){x.reverse();A=o=f.filterNode(x[0].clone());for(u=0;u0){Q.value=l;Q=Q.prev}else{O=Q.prev;Q.remove();Q=O}}}function H(O){var P,l={};for(P in O){if(P!=="li"&&P!="p"){l[P]=O[P]}}return l}n=new b.html.SaxParser({validate:z,self_closing_elements:H(h.getSelfClosingElements()),cdata:function(l){B.append(K("#cdata",4)).value=l},text:function(P,l){var O;if(!L){P=P.replace(k," ");if(B.lastChild&&o[B.lastChild.name]){P=P.replace(E,"")}}if(P.length!==0){O=K("#text",3);O.raw=!!l;B.append(O).value=P}},comment:function(l){B.append(K("#comment",8)).value=l},pi:function(l,O){B.append(K(l,7)).value=O;I(B)},doctype:function(O){var l;l=B.append(K("#doctype",10));l.value=O;I(B)},start:function(l,W,P){var U,R,Q,O,S,X,V,T;Q=z?h.getElementRule(l):{};if(Q){U=K(Q.outputName||l,1);U.attributes=W;U.shortEnded=P;B.append(U);T=p[B.name];if(T&&p[U.name]&&!T[U.name]){M.push(U)}R=d.length;while(R--){S=d[R].name;if(S in W.map){F=c[S];if(F){F.push(U)}else{c[S]=[U]}}}if(o[l]){I(U)}if(!P){B=U}if(!L&&s[l]){L=true}}},end:function(l){var S,P,R,O,Q;P=z?h.getElementRule(l):{};if(P){if(o[l]){if(!L){S=B.firstChild;if(S&&S.type===3){R=S.value.replace(E,"");if(R.length>0){S.value=R;S=S.next}else{O=S.next;S.remove();S=O}while(S&&S.type===3){R=S.value;O=S.next;if(R.length===0||y.test(R)){S.remove();S=O}S=O}}S=B.lastChild;if(S&&S.type===3){R=S.value.replace(t,"");if(R.length>0){S.value=R;S=S.prev}else{O=S.prev;S.remove();S=O}while(S&&S.type===3){R=S.value;O=S.prev;if(R.length===0||y.test(R)){S.remove();S=O}S=O}}}}if(L&&s[l]){L=false}if(P.removeEmpty||P.paddEmpty){if(B.isEmpty(u)){if(P.paddEmpty){B.empty().append(new a("#text","3")).value="\u00a0"}else{if(!B.attributes.map.name&&!B.attributes.map.id){Q=B.parent;B.empty().remove();B=Q;return}}}}B=B.parent}}},h);J=B=new a(m.context||g.root_name,11);n.parse(v);if(z&&M.length){if(!m.context){j(M)}else{m.invalid=true}}if(q&&J.name=="body"){G()}if(!m.invalid){for(N in i){F=e[N];A=i[N];x=A.length;while(x--){if(!A[x].parent){A.splice(x,1)}}for(D=0,C=F.length;D0){o=c[c.length-1];if(o.length>0&&o!=="\n"){c.push("\n")}}c.push("<",m);if(k){for(n=0,j=k.length;n0){o=c[c.length-1];if(o.length>0&&o!=="\n"){c.push("\n")}}},end:function(h){var i;c.push("");if(a&&d[h]&&c.length>0){i=c[c.length-1];if(i.length>0&&i!=="\n"){c.push("\n")}}},text:function(i,h){if(i.length>0){c[c.length]=h?i:f(i)}},cdata:function(h){c.push("")},comment:function(h){c.push("")},pi:function(h,i){if(i){c.push("")}else{c.push("")}if(a){c.push("\n")}},doctype:function(h){c.push("",a?"\n":"")},reset:function(){c.length=0},getContent:function(){return c.join("").replace(/\n$/,"")}}};(function(a){a.html.Serializer=function(c,d){var b=this,e=new a.html.Writer(c);c=c||{};c.validate="validate" in c?c.validate:true;b.schema=d=d||new a.html.Schema();b.writer=e;b.serialize=function(h){var g,i;i=c.validate;g={3:function(k,j){e.text(k.value,k.raw)},8:function(j){e.comment(j.value)},7:function(j){e.pi(j.name,j.value)},10:function(j){e.doctype(j.value)},4:function(j){e.cdata(j.value)},11:function(j){if((j=j.firstChild)){do{f(j)}while(j=j.next)}}};e.reset();function f(k){var t=g[k.type],j,o,s,r,p,u,n,m,q;if(!t){j=k.name;o=k.shortEnded;s=k.attributes;if(i&&s&&s.length>1){u=[];u.map={};q=d.getElementRule(k.name);for(n=0,m=q.attributesOrder.length;n=8;k.boxModel=!e.isIE||o.compatMode=="CSS1Compat"||k.stdMode;k.hasOuterHTML="outerHTML" in o.createElement("a");k.settings=l=e.extend({keep_values:false,hex_colors:1},l);k.schema=l.schema;k.styles=new e.html.Styles({url_converter:l.url_converter,url_converter_scope:l.url_converter_scope},l.schema);if(e.isIE6){try{o.execCommand("BackgroundImageCache",false,true)}catch(m){k.cssFlicker=true}}k.fixDoc(o);k.events=l.ownEvents?new e.dom.EventUtils(l.proxy):e.dom.Event;e.addUnload(k.destroy,k);n=l.schema?l.schema.getBlockElements():{};k.isBlock=function(q){if(!q){return false}var p=q.nodeType;if(p){return !!(p===1&&n[q.nodeName])}return !!n[q]}},fixDoc:function(k){var j=this.settings,i;if(b&&j.schema){("abbr article aside audio canvas details figcaption figure footer header hgroup mark menu meter nav output progress section summary time video").replace(/\w+/g,function(l){k.createElement(l)});for(i in j.schema.getCustomElements()){k.createElement(i)}}},clone:function(k,i){var j=this,m,l;if(!b||k.nodeType!==1||i){return k.cloneNode(i)}l=j.doc;if(!i){m=l.createElement(k.nodeName);g(j.getAttribs(k),function(n){j.setAttrib(m,n.nodeName,j.getAttrib(k,n.nodeName))});return m}return m.firstChild},getRoot:function(){var i=this,j=i.settings;return(j&&i.get(j.root_element))||i.doc.body},getViewPort:function(j){var k,i;j=!j?this.win:j;k=j.document;i=this.boxModel?k.documentElement:k.body;return{x:j.pageXOffset||i.scrollLeft,y:j.pageYOffset||i.scrollTop,w:j.innerWidth||i.clientWidth,h:j.innerHeight||i.clientHeight}},getRect:function(l){var k,i=this,j;l=i.get(l);k=i.getPos(l);j=i.getSize(l);return{x:k.x,y:k.y,w:j.w,h:j.h}},getSize:function(l){var j=this,i,k;l=j.get(l);i=j.getStyle(l,"width");k=j.getStyle(l,"height");if(i.indexOf("px")===-1){i=0}if(k.indexOf("px")===-1){k=0}return{w:parseInt(i,10)||l.offsetWidth||l.clientWidth,h:parseInt(k,10)||l.offsetHeight||l.clientHeight}},getParent:function(k,j,i){return this.getParents(k,j,i,false)},getParents:function(s,m,k,q){var j=this,i,l=j.settings,p=[];s=j.get(s);q=q===undefined;if(l.strict_root){k=k||j.getRoot()}if(d(m,"string")){i=m;if(m==="*"){m=function(o){return o.nodeType==1}}else{m=function(o){return j.is(o,i)}}}while(s){if(s==k||!s.nodeType||s.nodeType===9){break}if(!m||m(s)){if(q){p.push(s)}else{return s}}s=s.parentNode}return q?p:null},get:function(i){var j;if(i&&this.doc&&typeof(i)=="string"){j=i;i=this.doc.getElementById(i);if(i&&i.id!==j){return this.doc.getElementsByName(j)[1]}}return i},getNext:function(j,i){return this._findSib(j,i,"nextSibling")},getPrev:function(j,i){return this._findSib(j,i,"previousSibling")},add:function(l,o,i,k,m){var j=this;return this.run(l,function(r){var q,n;q=d(o,"string")?j.doc.createElement(o):o;j.setAttribs(q,i);if(k){if(k.nodeType){q.appendChild(k)}else{j.setHTML(q,k)}}return !m?r.appendChild(q):q})},create:function(k,i,j){return this.add(this.doc.createElement(k),k,i,j,1)},createHTML:function(q,i,m){var p="",l=this,j;p+="<"+q;for(j in i){if(i.hasOwnProperty(j)){p+=" "+j+'="'+l.encode(i[j])+'"'}}if(typeof(m)!="undefined"){return p+">"+m+""}return p+" />"},remove:function(i,j){return this.run(i,function(l){var m,k=l.parentNode;if(!k){return null}if(j){while(m=l.firstChild){if(!e.isIE||m.nodeType!==3||m.nodeValue){k.insertBefore(m,l)}else{l.removeChild(m)}}}return k.removeChild(l)})},setStyle:function(l,i,j){var k=this;return k.run(l,function(o){var n,m;n=o.style;i=i.replace(/-(\D)/g,function(q,p){return p.toUpperCase()});if(k.pixelStyles.test(i)&&(e.is(j,"number")||/^[\-0-9\.]+$/.test(j))){j+="px"}switch(i){case"opacity":if(b){n.filter=j===""?"":"alpha(opacity="+(j*100)+")";if(!l.currentStyle||!l.currentStyle.hasLayout){n.display="inline-block"}}n[i]=n["-moz-opacity"]=n["-khtml-opacity"]=j||"";break;case"float":b?n.styleFloat=j:n.cssFloat=j;break;default:n[i]=j||""}if(k.settings.update_styles){k.setAttrib(o,"data-mce-style")}})},getStyle:function(l,i,k){l=this.get(l);if(!l){return}if(this.doc.defaultView&&k){i=i.replace(/[A-Z]/g,function(m){return"-"+m});try{return this.doc.defaultView.getComputedStyle(l,null).getPropertyValue(i)}catch(j){return null}}i=i.replace(/-(\D)/g,function(n,m){return m.toUpperCase()});if(i=="float"){i=b?"styleFloat":"cssFloat"}if(l.currentStyle&&k){return l.currentStyle[i]}return l.style?l.style[i]:undefined},setStyles:function(l,m){var j=this,k=j.settings,i;i=k.update_styles;k.update_styles=0;g(m,function(o,p){j.setStyle(l,p,o)});k.update_styles=i;if(k.update_styles){j.setAttrib(l,k.cssText)}},removeAllAttribs:function(i){return this.run(i,function(l){var k,j=l.attributes;for(k=j.length-1;k>=0;k--){l.removeAttributeNode(j.item(k))}})},setAttrib:function(k,l,i){var j=this;if(!k||!l){return}if(j.settings.strict){l=l.toLowerCase()}return this.run(k,function(p){var o=j.settings;var m=p.getAttribute(l);if(i!==null){switch(l){case"style":if(!d(i,"string")){g(i,function(q,r){j.setStyle(p,r,q)});return}if(o.keep_values){if(i&&!j._isRes(i)){p.setAttribute("data-mce-style",i,2)}else{p.removeAttribute("data-mce-style",2)}}p.style.cssText=i;break;case"class":p.className=i||"";break;case"src":case"href":if(o.keep_values){if(o.url_converter){i=o.url_converter.call(o.url_converter_scope||j,i,l,p)}j.setAttrib(p,"data-mce-"+l,i,2)}break;case"shape":p.setAttribute("data-mce-style",i);break}}if(d(i)&&i!==null&&i.length!==0){p.setAttribute(l,""+i,2)}else{p.removeAttribute(l,2)}if(tinyMCE.activeEditor&&m!=i){var n=tinyMCE.activeEditor;n.onSetAttrib.dispatch(n,p,l,i)}})},setAttribs:function(j,k){var i=this;return this.run(j,function(l){g(k,function(m,o){i.setAttrib(l,o,m)})})},getAttrib:function(m,o,k){var i,j=this,l;m=j.get(m);if(!m||m.nodeType!==1){return k===l?false:k}if(!d(k)){k=""}if(/^(src|href|style|coords|shape)$/.test(o)){i=m.getAttribute("data-mce-"+o);if(i){return i}}if(b&&j.props[o]){i=m[j.props[o]];i=i&&i.nodeValue?i.nodeValue:i}if(!i){i=m.getAttribute(o,2)}if(/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(o)){if(m[j.props[o]]===true&&i===""){return o}return i?o:""}if(m.nodeName==="FORM"&&m.getAttributeNode(o)){return m.getAttributeNode(o).nodeValue}if(o==="style"){i=i||m.style.cssText;if(i){i=j.serializeStyle(j.parseStyle(i),m.nodeName);if(j.settings.keep_values&&!j._isRes(i)){m.setAttribute("data-mce-style",i)}}}if(f&&o==="class"&&i){i=i.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(b){switch(o){case"rowspan":case"colspan":if(i===1){i=""}break;case"size":if(i==="+0"||i===20||i===0){i=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(i===0){i=""}break;case"hspace":if(i===-1){i=""}break;case"maxlength":case"tabindex":if(i===32768||i===2147483647||i==="32768"){i=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(i===65535){return o}return k;case"shape":i=i.toLowerCase();break;default:if(o.indexOf("on")===0&&i){i=e._replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1",""+i)}}}return(i!==l&&i!==null&&i!=="")?""+i:k},getPos:function(q,l){var j=this,i=0,p=0,m,o=j.doc,k;q=j.get(q);l=l||o.body;if(q){if(q.getBoundingClientRect){q=q.getBoundingClientRect();m=j.boxModel?o.documentElement:o.body;i=q.left+(o.documentElement.scrollLeft||o.body.scrollLeft)-m.clientTop;p=q.top+(o.documentElement.scrollTop||o.body.scrollTop)-m.clientLeft;return{x:i,y:p}}k=q;while(k&&k!=l&&k.nodeType){i+=k.offsetLeft||0;p+=k.offsetTop||0;k=k.offsetParent}k=q.parentNode;while(k&&k!=l&&k.nodeType){i-=k.scrollLeft||0;p-=k.scrollTop||0;k=k.parentNode}}return{x:i,y:p}},parseStyle:function(i){return this.styles.parse(i)},serializeStyle:function(j,i){return this.styles.serialize(j,i)},addStyle:function(j){var k=this.doc,i;styleElm=k.getElementById("mceDefaultStyles");if(!styleElm){styleElm=k.createElement("style"),styleElm.id="mceDefaultStyles";styleElm.type="text/css";i=k.getElementsByTagName("head")[0];if(i.firstChild){i.insertBefore(styleElm,i.firstChild)}else{i.appendChild(styleElm)}}if(styleElm.styleSheet){styleElm.styleSheet.cssText+=j}else{styleElm.appendChild(k.createTextNode(j))}},loadCSS:function(i){var k=this,l=k.doc,j;if(!i){i=""}j=l.getElementsByTagName("head")[0];g(i.split(","),function(m){var n;if(k.files[m]){return}k.files[m]=true;n=k.create("link",{rel:"stylesheet",href:e._addVer(m)});if(b&&l.documentMode&&l.recalc){n.onload=function(){if(l.recalc){l.recalc()}n.onload=null}}j.appendChild(n)})},addClass:function(i,j){return this.run(i,function(k){var l;if(!j){return 0}if(this.hasClass(k,j)){return k.className}l=this.removeClass(k,j);return k.className=(l!=""?(l+" "):"")+j})},removeClass:function(k,l){var i=this,j;return i.run(k,function(n){var m;if(i.hasClass(n,l)){if(!j){j=new RegExp("(^|\\s+)"+l+"(\\s+|$)","g")}m=n.className.replace(j," ");m=e.trim(m!=" "?m:"");n.className=m;if(!m){n.removeAttribute("class");n.removeAttribute("className")}return m}return n.className})},hasClass:function(j,i){j=this.get(j);if(!j||!i){return false}return(" "+j.className+" ").indexOf(" "+i+" ")!==-1},show:function(i){return this.setStyle(i,"display","block")},hide:function(i){return this.setStyle(i,"display","none")},isHidden:function(i){i=this.get(i);return !i||i.style.display=="none"||this.getStyle(i,"display")=="none"},uniqueId:function(i){return(!i?"mce_":i)+(this.counter++)},setHTML:function(k,j){var i=this;return i.run(k,function(m){if(b){while(m.firstChild){m.removeChild(m.firstChild)}try{m.innerHTML="
    "+j;m.removeChild(m.firstChild)}catch(l){var n=i.create("div");n.innerHTML="
    "+j;g(e.grep(n.childNodes),function(p,o){if(o&&m.canHaveHTML){m.appendChild(p)}})}}else{m.innerHTML=j}return j})},getOuterHTML:function(k){var j,i=this;k=i.get(k);if(!k){return null}if(k.nodeType===1&&i.hasOuterHTML){return k.outerHTML}j=(k.ownerDocument||i.doc).createElement("body");j.appendChild(k.cloneNode(true));return j.innerHTML},setOuterHTML:function(l,j,m){var i=this;function k(p,o,r){var s,q;q=r.createElement("body");q.innerHTML=o;s=q.lastChild;while(s){i.insertAfter(s.cloneNode(true),p);s=s.previousSibling}i.remove(p)}return this.run(l,function(o){o=i.get(o);if(o.nodeType==1){m=m||o.ownerDocument||i.doc;if(b){try{if(b&&o.nodeType==1){o.outerHTML=j}else{k(o,j,m)}}catch(n){k(o,j,m)}}else{k(o,j,m)}}})},decode:h.decode,encode:h.encodeAllRaw,insertAfter:function(i,j){j=this.get(j);return this.run(i,function(l){var k,m;k=j.parentNode;m=j.nextSibling;if(m){k.insertBefore(l,m)}else{k.appendChild(l)}return l})},replace:function(m,l,i){var j=this;if(d(l,"array")){m=m.cloneNode(true)}return j.run(l,function(k){if(i){g(e.grep(k.childNodes),function(n){m.appendChild(n)})}return k.parentNode.replaceChild(m,k)})},rename:function(l,i){var k=this,j;if(l.nodeName!=i.toUpperCase()){j=k.create(i);g(k.getAttribs(l),function(m){k.setAttrib(j,m.nodeName,k.getAttrib(l,m.nodeName))});k.replace(j,l,1)}return j||l},findCommonAncestor:function(k,i){var l=k,j;while(l){j=i;while(j&&l!=j){j=j.parentNode}if(l==j){break}l=l.parentNode}if(!l&&k.ownerDocument){return k.ownerDocument.documentElement}return l},toHex:function(i){var k=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(i);function j(l){l=parseInt(l,10).toString(16);return l.length>1?l:"0"+l}if(k){i="#"+j(k[1])+j(k[2])+j(k[3]);return i}return i},getClasses:function(){var n=this,j=[],m,o={},p=n.settings.class_filter,l;if(n.classes){return n.classes}function q(i){g(i.imports,function(s){q(s)});g(i.cssRules||i.rules,function(s){switch(s.type||1){case 1:if(s.selectorText){g(s.selectorText.split(","),function(r){r=r.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(r)||!/\.[\w\-]+$/.test(r)){return}l=r;r=e._replace(/.*\.([a-z0-9_\-]+).*/i,"$1",r);if(p&&!(r=p(r,l))){return}if(!o[r]){j.push({"class":r});o[r]=1}})}break;case 3:q(s.styleSheet);break}})}try{g(n.doc.styleSheets,q)}catch(k){}if(j.length>0){n.classes=j}return j},run:function(l,k,j){var i=this,m;if(i.doc&&typeof(l)==="string"){l=i.get(l)}if(!l){return false}j=j||this;if(!l.nodeType&&(l.length||l.length===0)){m=[];g(l,function(o,n){if(o){if(typeof(o)=="string"){o=i.doc.getElementById(o)}m.push(k.call(j,o,n))}});return m}return k.call(j,l)},getAttribs:function(j){var i;j=this.get(j);if(!j){return[]}if(b){i=[];if(j.nodeName=="OBJECT"){return j.attributes}if(j.nodeName==="OPTION"&&this.getAttrib(j,"selected")){i.push({specified:1,nodeName:"selected"})}j.cloneNode(false).outerHTML.replace(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi,"").replace(/[\w:\-]+/gi,function(k){i.push({specified:1,nodeName:k})});return i}return j.attributes},isEmpty:function(m,k){var r=this,o,n,q,j,l,p=0;m=m.firstChild;if(m){j=new e.dom.TreeWalker(m,m.parentNode);k=k||r.schema?r.schema.getNonEmptyElements():null;do{q=m.nodeType;if(q===1){if(m.getAttribute("data-mce-bogus")){continue}l=m.nodeName.toLowerCase();if(k&&k[l]){if(l==="br"){p++;continue}return false}n=r.getAttribs(m);o=m.attributes.length;while(o--){l=m.attributes[o].nodeName;if(l==="name"||l==="data-mce-bookmark"){return false}}}if(q==8){return false}if((q===3&&!a.test(m.nodeValue))){return false}}while(m=j.next())}return p<=1},destroy:function(j){var i=this;i.win=i.doc=i.root=i.events=i.frag=null;if(!j){e.removeUnload(i.destroy)}},createRng:function(){var i=this.doc;return i.createRange?i.createRange():new e.dom.Range(this)},nodeIndex:function(m,n){var i=0,k,l,j;if(m){for(k=m.nodeType,m=m.previousSibling,l=m;m;m=m.previousSibling){j=m.nodeType;if(n&&j==3){if(j==k||!m.nodeValue.length){continue}}i++;k=j}}return i},split:function(m,l,p){var q=this,i=q.createRng(),n,k,o;function j(v){var t,s=v.childNodes,u=v.nodeType;function x(A){var z=A.previousSibling&&A.previousSibling.nodeName=="SPAN";var y=A.nextSibling&&A.nextSibling.nodeName=="SPAN";return z&&y}if(u==1&&v.getAttribute("data-mce-type")=="bookmark"){return}for(t=s.length-1;t>=0;t--){j(s[t])}if(u!=9){if(u==3&&v.nodeValue.length>0){var r=e.trim(v.nodeValue).length;if(!q.isBlock(v.parentNode)||r>0||r===0&&x(v)){return}}else{if(u==1){s=v.childNodes;if(s.length==1&&s[0]&&s[0].nodeType==1&&s[0].getAttribute("data-mce-type")=="bookmark"){v.parentNode.insertBefore(s[0],v)}if(s.length||/^(br|hr|input|img)$/i.test(v.nodeName)){return}}}q.remove(v)}return v}if(m&&l){i.setStart(m.parentNode,q.nodeIndex(m));i.setEnd(l.parentNode,q.nodeIndex(l));n=i.extractContents();i=q.createRng();i.setStart(l.parentNode,q.nodeIndex(l)+1);i.setEnd(m.parentNode,q.nodeIndex(m)+1);k=i.extractContents();o=m.parentNode;o.insertBefore(j(n),m);if(p){o.replaceChild(p,l)}else{o.insertBefore(l,m)}o.insertBefore(j(k),m);q.remove(m);return p||l}},bind:function(l,i,k,j){return this.events.add(l,i,k,j||this)},unbind:function(k,i,j){return this.events.remove(k,i,j)},fire:function(k,j,i){return this.events.fire(k,j,i)},getContentEditable:function(j){var i;if(j.nodeType!=1){return null}i=j.getAttribute("data-mce-contenteditable");if(i&&i!=="inherit"){return i}return j.contentEditable!=="inherit"?j.contentEditable:null},_findSib:function(l,i,j){var k=this,m=i;if(l){if(d(m,"string")){m=function(n){return k.is(n,i)}}for(l=l[j];l;l=l[j]){if(m(l)){return l}}}return null},_isRes:function(i){return/^(top|left|bottom|right|width|height)/i.test(i)||/;\s*(top|left|bottom|right|width|height)/i.test(i)}});e.DOM=new e.dom.DOMUtils(document,{process_html:0})})(tinymce);(function(a){function b(c){var O=this,e=c.doc,U=0,F=1,j=2,E=true,S=false,W="startOffset",h="startContainer",Q="endContainer",A="endOffset",k=tinymce.extend,n=c.nodeIndex;k(O,{startContainer:e,startOffset:0,endContainer:e,endOffset:0,collapsed:E,commonAncestorContainer:e,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3,setStart:q,setEnd:s,setStartBefore:g,setStartAfter:J,setEndBefore:K,setEndAfter:u,collapse:B,selectNode:y,selectNodeContents:G,compareBoundaryPoints:v,deleteContents:p,extractContents:I,cloneContents:d,insertNode:D,surroundContents:N,cloneRange:L,toStringIE:T});function x(){return e.createDocumentFragment()}function q(X,t){C(E,X,t)}function s(X,t){C(S,X,t)}function g(t){q(t.parentNode,n(t))}function J(t){q(t.parentNode,n(t)+1)}function K(t){s(t.parentNode,n(t))}function u(t){s(t.parentNode,n(t)+1)}function B(t){if(t){O[Q]=O[h];O[A]=O[W]}else{O[h]=O[Q];O[W]=O[A]}O.collapsed=E}function y(t){g(t);u(t)}function G(t){q(t,0);s(t,t.nodeType===1?t.childNodes.length:t.nodeValue.length)}function v(aa,t){var ad=O[h],Y=O[W],ac=O[Q],X=O[A],ab=t.startContainer,af=t.startOffset,Z=t.endContainer,ae=t.endOffset;if(aa===0){return H(ad,Y,ab,af)}if(aa===1){return H(ac,X,ab,af)}if(aa===2){return H(ac,X,Z,ae)}if(aa===3){return H(ad,Y,Z,ae)}}function p(){l(j)}function I(){return l(U)}function d(){return l(F)}function D(aa){var X=this[h],t=this[W],Z,Y;if((X.nodeType===3||X.nodeType===4)&&X.nodeValue){if(!t){X.parentNode.insertBefore(aa,X)}else{if(t>=X.nodeValue.length){c.insertAfter(aa,X)}else{Z=X.splitText(t);X.parentNode.insertBefore(aa,Z)}}}else{if(X.childNodes.length>0){Y=X.childNodes[t]}if(Y){X.insertBefore(aa,Y)}else{X.appendChild(aa)}}}function N(X){var t=O.extractContents();O.insertNode(X);X.appendChild(t);O.selectNode(X)}function L(){return k(new b(c),{startContainer:O[h],startOffset:O[W],endContainer:O[Q],endOffset:O[A],collapsed:O.collapsed,commonAncestorContainer:O.commonAncestorContainer})}function P(t,X){var Y;if(t.nodeType==3){return t}if(X<0){return t}Y=t.firstChild;while(Y&&X>0){--X;Y=Y.nextSibling}if(Y){return Y}return t}function m(){return(O[h]==O[Q]&&O[W]==O[A])}function H(Z,ab,X,aa){var ac,Y,t,ad,af,ae;if(Z==X){if(ab==aa){return 0}if(ab0){O.collapse(X)}}else{O.collapse(X)}O.collapsed=m();O.commonAncestorContainer=c.findCommonAncestor(O[h],O[Q])}function l(ad){var ac,Z=0,af=0,X,ab,Y,aa,t,ae;if(O[h]==O[Q]){return f(ad)}for(ac=O[Q],X=ac.parentNode;X;ac=X,X=X.parentNode){if(X==O[h]){return r(ac,ad)}++Z}for(ac=O[h],X=ac.parentNode;X;ac=X,X=X.parentNode){if(X==O[Q]){return V(ac,ad)}++af}ab=af-Z;Y=O[h];while(ab>0){Y=Y.parentNode;ab--}aa=O[Q];while(ab<0){aa=aa.parentNode;ab++}for(t=Y.parentNode,ae=aa.parentNode;t!=ae;t=t.parentNode,ae=ae.parentNode){Y=t;aa=ae}return o(Y,aa,ad)}function f(ac){var ae,af,t,Y,Z,ad,aa,X,ab;if(ac!=j){ae=x()}if(O[W]==O[A]){return ae}if(O[h].nodeType==3){af=O[h].nodeValue;t=af.substring(O[W],O[A]);if(ac!=F){Y=O[h];X=O[W];ab=O[A]-O[W];if(X===0&&ab>=Y.nodeValue.length-1){Y.parentNode.removeChild(Y)}else{Y.deleteData(X,ab)}O.collapse(E)}if(ac==j){return}if(t.length>0){ae.appendChild(e.createTextNode(t))}return ae}Y=P(O[h],O[W]);Z=O[A]-O[W];while(Y&&Z>0){ad=Y.nextSibling;aa=z(Y,ac);if(ae){ae.appendChild(aa)}--Z;Y=ad}if(ac!=F){O.collapse(E)}return ae}function r(ad,aa){var ac,ab,X,t,Z,Y;if(aa!=j){ac=x()}ab=i(ad,aa);if(ac){ac.appendChild(ab)}X=n(ad);t=X-O[W];if(t<=0){if(aa!=F){O.setEndBefore(ad);O.collapse(S)}return ac}ab=ad.previousSibling;while(t>0){Z=ab.previousSibling;Y=z(ab,aa);if(ac){ac.insertBefore(Y,ac.firstChild)}--t;ab=Z}if(aa!=F){O.setEndBefore(ad);O.collapse(S)}return ac}function V(ab,aa){var ad,X,ac,t,Z,Y;if(aa!=j){ad=x()}ac=R(ab,aa);if(ad){ad.appendChild(ac)}X=n(ab);++X;t=O[A]-X;ac=ab.nextSibling;while(ac&&t>0){Z=ac.nextSibling;Y=z(ac,aa);if(ad){ad.appendChild(Y)}--t;ac=Z}if(aa!=F){O.setStartAfter(ab);O.collapse(E)}return ad}function o(ab,t,ae){var Y,ag,aa,ac,ad,X,af,Z;if(ae!=j){ag=x()}Y=R(ab,ae);if(ag){ag.appendChild(Y)}aa=ab.parentNode;ac=n(ab);ad=n(t);++ac;X=ad-ac;af=ab.nextSibling;while(X>0){Z=af.nextSibling;Y=z(af,ae);if(ag){ag.appendChild(Y)}af=Z;--X}Y=i(t,ae);if(ag){ag.appendChild(Y)}if(ae!=F){O.setStartAfter(ab);O.collapse(E)}return ag}function i(ac,ad){var Y=P(O[Q],O[A]-1),ae,ab,aa,t,X,Z=Y!=O[Q];if(Y==ac){return M(Y,Z,S,ad)}ae=Y.parentNode;ab=M(ae,S,S,ad);while(ae){while(Y){aa=Y.previousSibling;t=M(Y,Z,S,ad);if(ad!=j){ab.insertBefore(t,ab.firstChild)}Z=E;Y=aa}if(ae==ac){return ab}Y=ae.previousSibling;ae=ae.parentNode;X=M(ae,S,S,ad);if(ad!=j){X.appendChild(ab)}ab=X}}function R(ac,ad){var Z=P(O[h],O[W]),aa=Z!=O[h],ae,ab,Y,t,X;if(Z==ac){return M(Z,aa,E,ad)}ae=Z.parentNode;ab=M(ae,S,E,ad);while(ae){while(Z){Y=Z.nextSibling;t=M(Z,aa,E,ad);if(ad!=j){ab.appendChild(t)}aa=E;Z=Y}if(ae==ac){return ab}Z=ae.nextSibling;ae=ae.parentNode;X=M(ae,S,E,ad);if(ad!=j){X.appendChild(ab)}ab=X}}function M(t,aa,ad,ae){var Z,Y,ab,X,ac;if(aa){return z(t,ae)}if(t.nodeType==3){Z=t.nodeValue;if(ad){X=O[W];Y=Z.substring(X);ab=Z.substring(0,X)}else{X=O[A];Y=Z.substring(0,X);ab=Z.substring(X)}if(ae!=F){t.nodeValue=ab}if(ae==j){return}ac=c.clone(t,S);ac.nodeValue=Y;return ac}if(ae==j){return}return c.clone(t,S)}function z(X,t){if(t!=j){return t==F?c.clone(X,E):X}X.parentNode.removeChild(X)}function T(){return c.create("body",null,d()).outerText}return O}a.Range=b;b.prototype.toString=function(){return this.toStringIE()}})(tinymce.dom);(function(){function a(d){var b=this,h=d.dom,c=true,f=false;function e(i,j){var k,t=0,q,n,m,l,o,r,p=-1,s;k=i.duplicate();k.collapse(j);s=k.parentElement();if(s.ownerDocument!==d.dom.doc){return}while(s.contentEditable==="false"){s=s.parentNode}if(!s.hasChildNodes()){return{node:s,inside:1}}m=s.children;q=m.length-1;while(t<=q){r=Math.floor((t+q)/2);l=m[r];k.moveToElementText(l);p=k.compareEndPoints(j?"StartToStart":"EndToEnd",i);if(p>0){q=r-1}else{if(p<0){t=r+1}else{return{node:l}}}}if(p<0){if(!l){k.moveToElementText(s);k.collapse(true);l=s;n=true}else{k.collapse(false)}o=0;while(k.compareEndPoints(j?"StartToStart":"StartToEnd",i)!==0){if(k.move("character",1)===0||s!=k.parentElement()){break}o++}}else{k.collapse(true);o=0;while(k.compareEndPoints(j?"StartToStart":"StartToEnd",i)!==0){if(k.move("character",-1)===0||s!=k.parentElement()){break}o++}}return{node:l,position:p,offset:o,inside:n}}function g(){var i=d.getRng(),r=h.createRng(),l,k,p,q,m,j;l=i.item?i.item(0):i.parentElement();if(l.ownerDocument!=h.doc){return r}k=d.isCollapsed();if(i.item){r.setStart(l.parentNode,h.nodeIndex(l));r.setEnd(r.startContainer,r.startOffset+1);return r}function o(A){var u=e(i,A),s,y,z=0,x,v,t;s=u.node;y=u.offset;if(u.inside&&!s.hasChildNodes()){r[A?"setStart":"setEnd"](s,0);return}if(y===v){r[A?"setStartBefore":"setEndAfter"](s);return}if(u.position<0){x=u.inside?s.firstChild:s.nextSibling;if(!x){r[A?"setStartAfter":"setEndAfter"](s);return}if(!y){if(x.nodeType==3){r[A?"setStart":"setEnd"](x,0)}else{r[A?"setStartBefore":"setEndBefore"](x)}return}while(x){t=x.nodeValue;z+=t.length;if(z>=y){s=x;z-=y;z=t.length-z;break}x=x.nextSibling}}else{x=s.previousSibling;if(!x){return r[A?"setStartBefore":"setEndBefore"](s)}if(!y){if(s.nodeType==3){r[A?"setStart":"setEnd"](x,s.nodeValue.length)}else{r[A?"setStartAfter":"setEndAfter"](x)}return}while(x){z+=x.nodeValue.length;if(z>=y){s=x;z-=y;break}x=x.previousSibling}}r[A?"setStart":"setEnd"](s,z)}try{o(true);if(!k){o()}}catch(n){if(n.number==-2147024809){m=b.getBookmark(2);p=i.duplicate();p.collapse(true);l=p.parentElement();if(!k){p=i.duplicate();p.collapse(false);q=p.parentElement();q.innerHTML=q.innerHTML}l.innerHTML=l.innerHTML;b.moveToBookmark(m);i=d.getRng();o(true);if(!k){o()}}else{throw n}}return r}this.getBookmark=function(m){var j=d.getRng(),o,i,l={};function n(u){var t,p,s,r,q=[];t=u.parentNode;p=h.getRoot().parentNode;while(t!=p&&t.nodeType!==9){s=t.children;r=s.length;while(r--){if(u===s[r]){q.push(r);break}}u=t;t=t.parentNode}return q}function k(q){var p;p=e(j,q);if(p){return{position:p.position,offset:p.offset,indexes:n(p.node),inside:p.inside}}}if(m===2){if(!j.item){l.start=k(true);if(!d.isCollapsed()){l.end=k()}}else{l.start={ctrl:true,indexes:n(j.item(0))}}}return l};this.moveToBookmark=function(k){var j,i=h.doc.body;function m(o){var r,q,n,p;r=h.getRoot();for(q=o.length-1;q>=0;q--){p=r.children;n=o[q];if(n<=p.length-1){r=p[n]}}return r}function l(r){var n=k[r?"start":"end"],q,p,o;if(n){q=n.position>0;p=i.createTextRange();p.moveToElementText(m(n.indexes));offset=n.offset;if(offset!==o){p.collapse(n.inside||q);p.moveStart("character",q?-offset:offset)}else{p.collapse(r)}j.setEndPoint(r?"StartToStart":"EndToStart",p);if(r){j.collapse(true)}}}if(k.start){if(k.start.ctrl){j=i.createControlRange();j.addElement(m(k.start.indexes));j.select()}else{j=i.createTextRange();l(true);l();j.select()}}};this.addRange=function(i){var n,l,k,p,v,q,t,s=d.dom.doc,m=s.body,r,u;function j(C){var y,B,x,A,z;x=h.create("a");y=C?k:v;B=C?p:q;A=n.duplicate();if(y==s||y==s.documentElement){y=m;B=0}if(y.nodeType==3){y.parentNode.insertBefore(x,y);A.moveToElementText(x);A.moveStart("character",B);h.remove(x);n.setEndPoint(C?"StartToStart":"EndToEnd",A)}else{z=y.childNodes;if(z.length){if(B>=z.length){h.insertAfter(x,z[z.length-1])}else{y.insertBefore(x,z[B])}A.moveToElementText(x)}else{if(y.canHaveHTML){y.innerHTML="\uFEFF";x=y.firstChild;A.moveToElementText(x);A.collapse(f)}}n.setEndPoint(C?"StartToStart":"EndToEnd",A);h.remove(x)}}k=i.startContainer;p=i.startOffset;v=i.endContainer;q=i.endOffset;n=m.createTextRange();if(k==v&&k.nodeType==1){if(p==q&&!k.hasChildNodes()){if(k.canHaveHTML){t=k.previousSibling;if(t&&!t.hasChildNodes()&&h.isBlock(t)){t.innerHTML="\uFEFF"}else{t=null}k.innerHTML="\uFEFF\uFEFF";n.moveToElementText(k.lastChild);n.select();h.doc.selection.clear();k.innerHTML="";if(t){t.innerHTML=""}return}else{p=h.nodeIndex(k);k=k.parentNode}}if(p==q-1){try{u=k.childNodes[p];l=m.createControlRange();l.addElement(u);l.select();r=d.getRng();if(r.item&&u===r.item(0)){return}}catch(o){}}}j(true);j();n.select()};this.getRangeAt=g}tinymce.dom.TridentSelection=a})();(function(a){a.dom.Element=function(f,d){var b=this,e,c;b.settings=d=d||{};b.id=f;b.dom=e=d.dom||a.DOM;if(!a.isIE){c=e.get(b.id)}a.each(("getPos,getRect,getParent,add,setStyle,getStyle,setStyles,setAttrib,setAttribs,getAttrib,addClass,removeClass,hasClass,getOuterHTML,setOuterHTML,remove,show,hide,isHidden,setHTML,get").split(/,/),function(g){b[g]=function(){var h=[f],j;for(j=0;j"+(i.item?i.item(0).outerHTML:i.htmlText);m.removeChild(m.firstChild)}else{m.innerHTML=i.toString()}}if(/^\s/.test(m.innerHTML)){j=" "}if(/\s+$/.test(m.innerHTML)){l=" "}h.getInner=true;h.content=g.isCollapsed()?"":j+g.serializer.serialize(m,h)+l;g.onGetContent.dispatch(g,h);return h.content},setContent:function(h,j){var o=this,g=o.getRng(),k,l=o.win.document,n,m;j=j||{format:"html"};j.set=true;h=j.content=h;if(!j.no_events){o.onBeforeSetContent.dispatch(o,j)}h=j.content;if(g.insertNode){h+='_';if(g.startContainer==l&&g.endContainer==l){l.body.innerHTML=h}else{g.deleteContents();if(l.body.childNodes.length===0){l.body.innerHTML=h}else{if(g.createContextualFragment){g.insertNode(g.createContextualFragment(h))}else{n=l.createDocumentFragment();m=l.createElement("div");n.appendChild(m);m.outerHTML=h;g.insertNode(n)}}}k=o.dom.get("__caret");g=l.createRange();g.setStartBefore(k);g.setEndBefore(k);o.setRng(g);o.dom.remove("__caret");try{o.setRng(g)}catch(i){}}else{if(g.item){l.execCommand("Delete",false,null);g=o.getRng()}if(/^\s+/.test(h)){g.pasteHTML('_'+h);o.dom.remove("__mce_tmp")}else{g.pasteHTML(h)}}if(!j.no_events){o.onSetContent.dispatch(o,j)}},getStart:function(){var i=this,h=i.getRng(),j,g,l,k;if(h.duplicate||h.item){if(h.item){return h.item(0)}l=h.duplicate();l.collapse(1);j=l.parentElement();if(j.ownerDocument!==i.dom.doc){j=i.dom.getRoot()}g=k=h.parentElement();while(k=k.parentNode){if(k==j){j=g;break}}return j}else{j=h.startContainer;if(j.nodeType==1&&j.hasChildNodes()){j=j.childNodes[Math.min(j.childNodes.length-1,h.startOffset)]}if(j&&j.nodeType==3){return j.parentNode}return j}},getEnd:function(){var h=this,g=h.getRng(),j,i;if(g.duplicate||g.item){if(g.item){return g.item(0)}g=g.duplicate();g.collapse(0);j=g.parentElement();if(j.ownerDocument!==h.dom.doc){j=h.dom.getRoot()}if(j&&j.nodeName=="BODY"){return j.lastChild||j}return j}else{j=g.endContainer;i=g.endOffset;if(j.nodeType==1&&j.hasChildNodes()){j=j.childNodes[i>0?i-1:i]}if(j&&j.nodeType==3){return j.parentNode}return j}},getBookmark:function(s,v){var y=this,n=y.dom,h,k,j,o,i,p,q,m="\uFEFF",x;function g(z,A){var t=0;e(n.select(z),function(C,B){if(C==A){t=B}});return t}function u(t){function z(E){var A,D,C,B=E?"start":"end";A=t[B+"Container"];D=t[B+"Offset"];if(A.nodeType==1&&A.nodeName=="TR"){C=A.childNodes;A=C[Math.min(E?D:D-1,C.length-1)];if(A){D=E?0:A.childNodes.length;t["set"+(E?"Start":"End")](A,D)}}}z(true);z();return t}function l(){var z=y.getRng(true),t=n.getRoot(),A={};function B(E,J){var D=E[J?"startContainer":"endContainer"],I=E[J?"startOffset":"endOffset"],C=[],F,H,G=0;if(D.nodeType==3){if(v){for(F=D.previousSibling;F&&F.nodeType==3;F=F.previousSibling){I+=F.nodeValue.length}}C.push(I)}else{H=D.childNodes;if(I>=H.length&&H.length){G=1;I=Math.max(0,H.length-1)}C.push(y.dom.nodeIndex(H[I],v)+G)}for(;D&&D!=t;D=D.parentNode){C.push(y.dom.nodeIndex(D,v))}return C}A.start=B(z,true);if(!y.isCollapsed()){A.end=B(z)}return A}if(s==2){if(y.tridentSel){return y.tridentSel.getBookmark(s)}return l()}if(s){return{rng:y.getRng()}}h=y.getRng();j=n.uniqueId();o=tinyMCE.activeEditor.selection.isCollapsed();x="overflow:hidden;line-height:0px";if(h.duplicate||h.item){if(!h.item){k=h.duplicate();try{h.collapse();h.pasteHTML(''+m+"");if(!o){k.collapse(false);h.moveToElementText(k.parentElement());if(h.compareEndPoints("StartToEnd",k)===0){k.move("character",-1)}k.pasteHTML(''+m+"")}}catch(r){return null}}else{p=h.item(0);i=p.nodeName;return{name:i,index:g(i,p)}}}else{p=y.getNode();i=p.nodeName;if(i=="IMG"){return{name:i,index:g(i,p)}}k=u(h.cloneRange());if(!o){k.collapse(false);k.insertNode(n.create("span",{"data-mce-type":"bookmark",id:j+"_end",style:x},m))}h=u(h);h.collapse(true);h.insertNode(n.create("span",{"data-mce-type":"bookmark",id:j+"_start",style:x},m))}y.moveToBookmark({id:j,keep:1});return{id:j}},moveToBookmark:function(o){var s=this,m=s.dom,j,i,g,r,k,u,p,q;function h(A){var t=o[A?"start":"end"],x,y,z,v;if(t){z=t[0];for(y=r,x=t.length-1;x>=1;x--){v=y.childNodes;if(t[x]>v.length-1){return}y=v[t[x]]}if(y.nodeType===3){z=Math.min(t[0],y.nodeValue.length)}if(y.nodeType===1){z=Math.min(t[0],y.childNodes.length)}if(A){g.setStart(y,z)}else{g.setEnd(y,z)}}return true}function l(B){var v=m.get(o.id+"_"+B),A,t,y,z,x=o.keep;if(v){A=v.parentNode;if(B=="start"){if(!x){t=m.nodeIndex(v)}else{A=v.firstChild;t=1}k=u=A;p=q=t}else{if(!x){t=m.nodeIndex(v)}else{A=v.firstChild;t=1}u=A;q=t}if(!x){z=v.previousSibling;y=v.nextSibling;e(d.grep(v.childNodes),function(C){if(C.nodeType==3){C.nodeValue=C.nodeValue.replace(/\uFEFF/g,"")}});while(v=m.get(o.id+"_"+B)){m.remove(v,1)}if(z&&y&&z.nodeType==y.nodeType&&z.nodeType==3&&!d.isOpera){t=z.nodeValue.length;z.appendData(y.nodeValue);m.remove(y);if(B=="start"){k=u=z;p=q=t}else{u=z;q=t}}}}}function n(t){if(m.isBlock(t)&&!t.innerHTML&&!b){t.innerHTML='
    '}return t}if(o){if(o.start){g=m.createRng();r=m.getRoot();if(s.tridentSel){return s.tridentSel.moveToBookmark(o)}if(h(true)&&h()){s.setRng(g)}}else{if(o.id){l("start");l("end");if(k){g=m.createRng();g.setStart(n(k),p);g.setEnd(n(u),q);s.setRng(g)}}else{if(o.name){s.select(m.select(o.name)[o.index])}else{if(o.rng){s.setRng(o.rng)}}}}}},select:function(l,k){var j=this,m=j.dom,h=m.createRng(),g;function i(n,p){var o=new a(n,n);do{if(n.nodeType==3&&d.trim(n.nodeValue).length!==0){if(p){h.setStart(n,0)}else{h.setEnd(n,n.nodeValue.length)}return}if(n.nodeName=="BR"){if(p){h.setStartBefore(n)}else{h.setEndBefore(n)}return}}while(n=(p?o.next():o.prev()))}if(l){g=m.nodeIndex(l);h.setStart(l.parentNode,g);h.setEnd(l.parentNode,g+1);if(k){i(l,1);i(l)}j.setRng(h)}return l},isCollapsed:function(){var g=this,i=g.getRng(),h=g.getSel();if(!i||i.item){return false}if(i.compareEndPoints){return i.compareEndPoints("StartToEnd",i)===0}return !h||i.collapsed},collapse:function(g){var i=this,h=i.getRng(),j;if(h.item){j=h.item(0);h=i.win.document.body.createTextRange();h.moveToElementText(j)}h.collapse(!!g);i.setRng(h)},getSel:function(){var h=this,g=this.win;return g.getSelection?g.getSelection():g.document.selection},getRng:function(m){var h=this,j,g,l,k=h.win.document;if(m&&h.tridentSel){return h.tridentSel.getRangeAt(0)}try{if(j=h.getSel()){g=j.rangeCount>0?j.getRangeAt(0):(j.createRange?j.createRange():k.createRange())}}catch(i){}if(d.isIE&&g&&g.setStart&&k.selection.createRange().item){l=k.selection.createRange().item(0);g=k.createRange();g.setStartBefore(l);g.setEndAfter(l)}if(!g){g=k.createRange?k.createRange():k.body.createTextRange()}if(g.setStart&&g.startContainer.nodeType===9&&g.collapsed){l=h.dom.getRoot();g.setStart(l,0);g.setEnd(l,0)}if(h.selectedRange&&h.explicitRange){if(g.compareBoundaryPoints(g.START_TO_START,h.selectedRange)===0&&g.compareBoundaryPoints(g.END_TO_END,h.selectedRange)===0){g=h.explicitRange}else{h.selectedRange=null;h.explicitRange=null}}return g},setRng:function(k,g){var j,i=this;if(!i.tridentSel){j=i.getSel();if(j){i.explicitRange=k;try{j.removeAllRanges()}catch(h){}j.addRange(k);if(g===false&&j.extend){j.collapse(k.endContainer,k.endOffset);j.extend(k.startContainer,k.startOffset)}i.selectedRange=j.rangeCount>0?j.getRangeAt(0):null}}else{if(k.cloneRange){try{i.tridentSel.addRange(k);return}catch(h){}}try{k.select()}catch(h){}}},setNode:function(h){var g=this;g.setContent(g.dom.getOuterHTML(h));return h},getNode:function(){var i=this,h=i.getRng(),j=i.getSel(),m,l=h.startContainer,g=h.endContainer;function k(q,o){var p=q;while(q&&q.nodeType===3&&q.length===0){q=o?q.nextSibling:q.previousSibling}return q||p}if(!h){return i.dom.getRoot()}if(h.setStart){m=h.commonAncestorContainer;if(!h.collapsed){if(h.startContainer==h.endContainer){if(h.endOffset-h.startOffset<2){if(h.startContainer.hasChildNodes()){m=h.startContainer.childNodes[h.startOffset]}}}if(l.nodeType===3&&g.nodeType===3){if(l.length===h.startOffset){l=k(l.nextSibling,true)}else{l=l.parentNode}if(h.endOffset===0){g=k(g.previousSibling,false)}else{g=g.parentNode}if(l&&l===g){return l}}}if(m&&m.nodeType==3){return m.parentNode}return m}return h.item?h.item(0):h.parentElement()},getSelectedBlocks:function(p,h){var o=this,k=o.dom,m,l,i,j=[];m=k.getParent(p||o.getStart(),k.isBlock);l=k.getParent(h||o.getEnd(),k.isBlock);if(m){j.push(m)}if(m&&l&&m!=l){i=m;var g=new a(m,k.getRoot());while((i=g.next())&&i!=l){if(k.isBlock(i)){j.push(i)}}}if(l&&m!=l){j.push(l)}return j},isForward:function(){var i=this.dom,g=this.getSel(),j,h;if(!g||g.anchorNode==null||g.focusNode==null){return true}j=i.createRng();j.setStart(g.anchorNode,g.anchorOffset);j.collapse(true);h=i.createRng();h.setStart(g.focusNode,g.focusOffset);h.collapse(true);return j.compareBoundaryPoints(j.START_TO_START,h)<=0},normalize:function(){var h=this,g,m,l,j,i;function k(p){var o,r,n,s=h.dom,u=s.getRoot(),q,t,v;function y(z,A){var B=new a(z,s.getParent(z.parentNode,s.isBlock)||u);while(z=B[A?"prev":"next"]()){if(z.nodeName==="BR"){return true}}}function x(B,z){var C,A;z=z||o;C=new a(z,s.getParent(z.parentNode,s.isBlock)||u);while(q=C[B?"prev":"next"]()){if(q.nodeType===3&&q.nodeValue.length>0){o=q;r=B?q.nodeValue.length:0;m=true;return}if(s.isBlock(q)||t[q.nodeName.toLowerCase()]){return}A=q}if(l&&A){o=A;m=true;r=0}}o=g[(p?"start":"end")+"Container"];r=g[(p?"start":"end")+"Offset"];t=s.schema.getNonEmptyElements();if(o.nodeType===9){o=s.getRoot();r=0}if(o===u){if(p){q=o.childNodes[r>0?r-1:0];if(q){v=q.nodeName.toLowerCase();if(t[q.nodeName]||q.nodeName=="TABLE"){return}}}if(o.hasChildNodes()){o=o.childNodes[Math.min(!p&&r>0?r-1:r,o.childNodes.length-1)];r=0;if(o.hasChildNodes()&&!/TABLE/.test(o.nodeName)){q=o;n=new a(o,u);do{if(q.nodeType===3&&q.nodeValue.length>0){r=p?0:q.nodeValue.length;o=q;m=true;break}if(t[q.nodeName.toLowerCase()]){r=s.nodeIndex(q);o=q.parentNode;if(q.nodeName=="IMG"&&!p){r++}m=true;break}}while(q=(p?n.next():n.prev()))}}}if(l){if(o.nodeType===3&&r===0){x(true)}if(o.nodeType===1){q=o.childNodes[r];if(q&&q.nodeName==="BR"&&!y(q)&&!y(q,true)){x(true,o.childNodes[r])}}}if(p&&!l&&o.nodeType===3&&r===o.nodeValue.length){x(false)}if(m){g["set"+(p?"Start":"End")](o,r)}}if(d.isIE){return}g=h.getRng();l=g.collapsed;k(true);if(!l){k()}if(m){if(l){g.collapse(true)}h.setRng(g,h.isForward())}},selectorChanged:function(g,j){var h=this,i;if(!h.selectorChangedData){h.selectorChangedData={};i={};h.editor.onNodeChange.addToTop(function(l,k,o){var p=h.dom,m=p.getParents(o,null,p.getRoot()),n={};e(h.selectorChangedData,function(r,q){e(m,function(s){if(p.is(s,q)){if(!i[q]){e(r,function(t){t(true,{node:s,selector:q,parents:m})});i[q]=r}n[q]=r;return false}})});e(i,function(r,q){if(!n[q]){delete i[q];e(r,function(s){s(false,{node:o,selector:q,parents:m})})}})})}if(!h.selectorChangedData[g]){h.selectorChangedData[g]=[]}h.selectorChangedData[g].push(j);return h},scrollIntoView:function(k){var j,h,g=this,i=g.dom;h=i.getViewPort(g.editor.getWin());j=i.getPos(k).y;if(jh.y+h.h){g.editor.getWin().scrollTo(0,j0){p.setEndPoint("StartToStart",o)}else{p.setEndPoint("EndToEnd",o)}p.select()}}else{l()}}function l(){var p=n.selection.createRange();if(o&&!p.item&&p.compareEndPoints("StartToEnd",p)===0){o.select()}h.unbind(n,"mouseup",l);h.unbind(n,"mousemove",m);o=k=0}n.documentElement.unselectable=true;h.bind(n,["mousedown","contextmenu"],function(p){if(p.target.nodeName==="HTML"){if(k){l()}g=n.documentElement;if(g.scrollHeight>g.clientHeight){return}k=1;o=j(p.x,p.y);if(o){h.bind(n,"mouseup",l);h.bind(n,"mousemove",m);h.win.focus();o.select()}}})}})})(tinymce);(function(a){a.dom.Serializer=function(e,i,f){var h,b,d=a.isIE,g=a.each,c;if(!e.apply_source_formatting){e.indent=false}i=i||a.DOM;f=f||new a.html.Schema(e);e.entity_encoding=e.entity_encoding||"named";e.remove_trailing_brs="remove_trailing_brs" in e?e.remove_trailing_brs:true;h=new a.util.Dispatcher(self);b=new a.util.Dispatcher(self);c=new a.html.DomParser(e,f);c.addAttributeFilter("src,href,style",function(k,j){var o=k.length,l,q,n="data-mce-"+j,p=e.url_converter,r=e.url_converter_scope,m;while(o--){l=k[o];q=l.attributes.map[n];if(q!==m){l.attr(j,q.length>0?q:null);l.attr(n,null)}else{q=l.attributes.map[j];if(j==="style"){q=i.serializeStyle(i.parseStyle(q),l.name)}else{if(p){q=p.call(r,q,j,l.name)}}l.attr(j,q.length>0?q:null)}}});c.addAttributeFilter("class",function(j,k){var l=j.length,m,n;while(l--){m=j[l];n=m.attr("class").replace(/(?:^|\s)mce(Item\w+|Selected)(?!\S)/g,"");m.attr("class",n.length>0?n:null)}});c.addAttributeFilter("data-mce-type",function(j,l,k){var m=j.length,n;while(m--){n=j[m];if(n.attributes.map["data-mce-type"]==="bookmark"&&!k.cleanup){n.remove()}}});c.addAttributeFilter("data-mce-expando",function(j,l,k){var m=j.length;while(m--){j[m].attr(l,null)}});c.addNodeFilter("noscript",function(j){var k=j.length,l;while(k--){l=j[k].firstChild;if(l){l.value=a.html.Entities.decode(l.value)}}});c.addNodeFilter("script,style",function(k,l){var m=k.length,n,o;function j(p){return p.replace(/()/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*(()?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"")}while(m--){n=k[m];o=n.firstChild?n.firstChild.value:"";if(l==="script"){n.attr("type",(n.attr("type")||"text/javascript").replace(/^mce\-/,""));if(o.length>0){n.firstChild.value="// "}}else{if(o.length>0){n.firstChild.value=""}}}});c.addNodeFilter("#comment",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.value.indexOf("[CDATA[")===0){m.name="#cdata";m.type=4;m.value=m.value.replace(/^\[CDATA\[|\]\]$/g,"")}else{if(m.value.indexOf("mce:protected ")===0){m.name="#text";m.type=3;m.raw=true;m.value=unescape(m.value).substr(14)}}}});c.addNodeFilter("xml:namespace,input",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.type===7){m.remove()}else{if(m.type===1){if(k==="input"&&!("type" in m.attributes.map)){m.attr("type","text")}}}}});if(e.fix_list_elements){c.addNodeFilter("ul,ol",function(k,l){var m=k.length,n,j;while(m--){n=k[m];j=n.parent;if(j.name==="ul"||j.name==="ol"){if(n.prev&&n.prev.name==="li"){n.prev.append(n)}}}})}c.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style",function(j,k){var l=j.length;while(l--){j[l].attr(k,null)}});return{schema:f,addNodeFilter:c.addNodeFilter,addAttributeFilter:c.addAttributeFilter,onPreProcess:h,onPostProcess:b,serialize:function(o,m){var l,p,k,j,n;if(d&&i.select("script,style,select,map").length>0){n=o.innerHTML;o=o.cloneNode(false);i.setHTML(o,n)}else{o=o.cloneNode(true)}l=o.ownerDocument.implementation;if(l.createHTMLDocument){p=l.createHTMLDocument("");g(o.nodeName=="BODY"?o.childNodes:[o],function(q){p.body.appendChild(p.importNode(q,true))});if(o.nodeName!="BODY"){o=p.body.firstChild}else{o=p.body}k=i.doc;i.doc=p}m=m||{};m.format=m.format||"html";if(!m.no_events){m.node=o;h.dispatch(self,m)}j=new a.html.Serializer(e,f);m.content=j.serialize(c.parse(a.trim(m.getInner?o.innerHTML:i.getOuterHTML(o)),m));if(!m.cleanup){m.content=m.content.replace(/\uFEFF/g,"")}if(!m.no_events){b.dispatch(self,m)}if(k){i.doc=k}m.node=null;return m.content},addRules:function(j){f.addValidElements(j)},setRules:function(j){f.setValidElements(j)}}}})(tinymce);(function(a){a.dom.ScriptLoader=function(h){var c=0,k=1,i=2,l={},j=[],e={},d=[],g=0,f;function b(m,v){var x=this,q=a.DOM,s,o,r,n;function p(){q.remove(n);if(s){s.onreadystatechange=s.onload=s=null}v()}function u(){if(typeof(console)!=="undefined"&&console.log){console.log("Failed to load: "+m)}}n=q.uniqueId();if(a.isIE6){o=new a.util.URI(m);r=location;if(o.host==r.hostname&&o.port==r.port&&(o.protocol+":")==r.protocol&&o.protocol.toLowerCase()!="file"){a.util.XHR.send({url:a._addVer(o.getURI()),success:function(y){var t=q.create("script",{type:"text/javascript"});t.text=y;document.getElementsByTagName("head")[0].appendChild(t);q.remove(t);p()},error:u});return}}s=document.createElement("script");s.id=n;s.type="text/javascript";s.src=a._addVer(m);if(!a.isIE){s.onload=p}s.onerror=u;if(!a.isOpera){s.onreadystatechange=function(){var t=s.readyState;if(t=="complete"||t=="loaded"){p()}}}(document.getElementsByTagName("head")[0]||document.body).appendChild(s)}this.isDone=function(m){return l[m]==i};this.markDone=function(m){l[m]=i};this.add=this.load=function(m,q,n){var o,p=l[m];if(p==f){j.push(m);l[m]=c}if(q){if(!e[m]){e[m]=[]}e[m].push({func:q,scope:n||this})}};this.loadQueue=function(n,m){this.loadScripts(j,n,m)};this.loadScripts=function(m,q,p){var o;function n(r){a.each(e[r],function(s){s.func.call(s.scope)});e[r]=f}d.push({func:q,scope:p||this});o=function(){var r=a.grep(m);m.length=0;a.each(r,function(s){if(l[s]==i){n(s);return}if(l[s]!=k){l[s]=k;g++;b(s,function(){l[s]=i;g--;n(s);o()})}});if(!g){a.each(d,function(s){s.func.call(s.scope)});d.length=0}};o()}};a.ScriptLoader=new a.dom.ScriptLoader()})(tinymce);(function(a){a.dom.RangeUtils=function(c){var b="\uFEFF";this.walk=function(d,s){var i=d.startContainer,l=d.startOffset,t=d.endContainer,m=d.endOffset,j,g,o,h,r,q,e;e=c.select("td.mceSelected,th.mceSelected");if(e.length>0){a.each(e,function(u){s([u])});return}function f(u){var v;v=u[0];if(v.nodeType===3&&v===i&&l>=v.nodeValue.length){u.splice(0,1)}v=u[u.length-1];if(m===0&&u.length>0&&v===t&&v.nodeType===3){u.splice(u.length-1,1)}return u}function p(x,v,u){var y=[];for(;x&&x!=u;x=x[v]){y.push(x)}return y}function n(v,u){do{if(v.parentNode==u){return v}v=v.parentNode}while(v)}function k(x,v,y){var u=y?"nextSibling":"previousSibling";for(h=x,r=h.parentNode;h&&h!=v;h=r){r=h.parentNode;q=p(h==x?h:h[u],u);if(q.length){if(!y){q.reverse()}s(f(q))}}}if(i.nodeType==1&&i.hasChildNodes()){i=i.childNodes[l]}if(t.nodeType==1&&t.hasChildNodes()){t=t.childNodes[Math.min(m-1,t.childNodes.length-1)]}if(i==t){return s(f([i]))}j=c.findCommonAncestor(i,t);for(h=i;h;h=h.parentNode){if(h===t){return k(i,j,true)}if(h===j){break}}for(h=t;h;h=h.parentNode){if(h===i){return k(t,j)}if(h===j){break}}g=n(i,j)||i;o=n(t,j)||t;k(i,g,true);q=p(g==i?g:g.nextSibling,"nextSibling",o==t?o.nextSibling:o);if(q.length){s(f(q))}k(t,o)};this.split=function(e){var h=e.startContainer,d=e.startOffset,i=e.endContainer,g=e.endOffset;function f(j,k){return j.splitText(k)}if(h==i&&h.nodeType==3){if(d>0&&dd){g=g-d;h=i=f(i,g).previousSibling;g=i.nodeValue.length;d=0}else{g=0}}}else{if(h.nodeType==3&&d>0&&d0&&g=m.length){r=0}}t=m[r];f.setAttrib(g,"tabindex","-1");f.setAttrib(t.id,"tabindex","0");f.get(t.id).focus();if(e.actOnFocus){e.onAction(t.id)}if(s){a.cancel(s)}};p=function(z){var v=37,u=39,y=38,A=40,r=27,t=14,s=13,x=32;switch(z.keyCode){case v:if(i){q.moveFocus(-1)}break;case u:if(i){q.moveFocus(1)}break;case y:if(o){q.moveFocus(-1)}break;case A:if(o){q.moveFocus(1)}break;case r:if(e.onCancel){e.onCancel();a.cancel(z)}break;case t:case s:case x:if(e.onAction){e.onAction(g);a.cancel(z)}break}};c(m,function(t,r){var s,u;if(!t.id){t.id=f.uniqueId("_mce_item_")}u=f.get(t.id);if(l){f.bind(u,"blur",h);s="-1"}else{s=(r===0?"0":"-1")}u.setAttribute("tabindex",s);f.bind(u,"focus",k)});if(m[0]){g=m[0].id}f.setAttrib(n,"tabindex","-1");var j=f.get(n);f.bind(j,"focus",d);f.bind(j,"keydown",p)}})})(tinymce);(function(c){var b=c.DOM,a=c.is;c.create("tinymce.ui.Control",{Control:function(f,e,d){this.id=f;this.settings=e=e||{};this.rendered=false;this.onRender=new c.util.Dispatcher(this);this.classPrefix="";this.scope=e.scope||this;this.disabled=0;this.active=0;this.editor=d},setAriaProperty:function(f,e){var d=b.get(this.id+"_aria")||b.get(this.id);if(d){b.setAttrib(d,"aria-"+f,!!e)}},focus:function(){b.get(this.id).focus()},setDisabled:function(d){if(d!=this.disabled){this.setAriaProperty("disabled",d);this.setState("Disabled",d);this.setState("Enabled",!d);this.disabled=d}},isDisabled:function(){return this.disabled},setActive:function(d){if(d!=this.active){this.setState("Active",d);this.active=d;this.setAriaProperty("pressed",d)}},isActive:function(){return this.active},setState:function(f,d){var e=b.get(this.id);f=this.classPrefix+f;if(d){b.addClass(e,f)}else{b.removeClass(e,f)}},isRendered:function(){return this.rendered},renderHTML:function(){},renderTo:function(d){b.setHTML(d,this.renderHTML())},postRender:function(){var e=this,d;if(a(e.disabled)){d=e.disabled;e.disabled=-1;e.setDisabled(d)}if(a(e.active)){d=e.active;e.active=-1;e.setActive(d)}},remove:function(){b.remove(this.id);this.destroy()},destroy:function(){c.dom.Event.clear(this.id)}})})(tinymce);tinymce.create("tinymce.ui.Container:tinymce.ui.Control",{Container:function(c,b,a){this.parent(c,b,a);this.controls=[];this.lookup={}},add:function(a){this.lookup[a.id]=a;this.controls.push(a);return a},get:function(a){return this.lookup[a]}});tinymce.create("tinymce.ui.Separator:tinymce.ui.Control",{Separator:function(b,a){this.parent(b,a);this.classPrefix="mceSeparator";this.setDisabled(true)},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix,role:"separator","aria-orientation":"vertical",tabindex:"-1"})}});(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.MenuItem:tinymce.ui.Control",{MenuItem:function(g,f){this.parent(g,f);this.classPrefix="mceMenuItem"},setSelected:function(f){this.setState("Selected",f);this.setAriaProperty("checked",!!f);this.selected=f},isSelected:function(){return this.selected},postRender:function(){var f=this;f.parent();if(c(f.selected)){f.setSelected(f.selected)}}})})(tinymce);(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.Menu:tinymce.ui.MenuItem",{Menu:function(h,g){var f=this;f.parent(h,g);f.items={};f.collapsed=false;f.menuCount=0;f.onAddItem=new d.util.Dispatcher(this)},expand:function(g){var f=this;if(g){a(f,function(h){if(h.expand){h.expand()}},"items",f)}f.collapsed=false},collapse:function(g){var f=this;if(g){a(f,function(h){if(h.collapse){h.collapse()}},"items",f)}f.collapsed=true},isCollapsed:function(){return this.collapsed},add:function(f){if(!f.settings){f=new d.ui.MenuItem(f.id||b.uniqueId(),f)}this.onAddItem.dispatch(this,f);return this.items[f.id]=f},addSeparator:function(){return this.add({separator:true})},addMenu:function(f){if(!f.collapse){f=this.createMenu(f)}this.menuCount++;return this.add(f)},hasMenus:function(){return this.menuCount!==0},remove:function(f){delete this.items[f.id]},removeAll:function(){var f=this;a(f,function(g){if(g.removeAll){g.removeAll()}else{g.remove()}g.destroy()},"items",f);f.items={}},createMenu:function(g){var f=new d.ui.Menu(g.id||b.uniqueId(),g);f.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return f}})})(tinymce);(function(e){var d=e.is,c=e.DOM,f=e.each,a=e.dom.Event,b=e.dom.Element;e.create("tinymce.ui.DropMenu:tinymce.ui.Menu",{DropMenu:function(h,g){g=g||{};g.container=g.container||c.doc.body;g.offset_x=g.offset_x||0;g.offset_y=g.offset_y||0;g.vp_offset_x=g.vp_offset_x||0;g.vp_offset_y=g.vp_offset_y||0;if(d(g.icons)&&!g.icons){g["class"]+=" mceNoIcons"}this.parent(h,g);this.onShowMenu=new e.util.Dispatcher(this);this.onHideMenu=new e.util.Dispatcher(this);this.classPrefix="mceMenu"},createMenu:function(j){var h=this,i=h.settings,g;j.container=j.container||i.container;j.parent=h;j.constrain=j.constrain||i.constrain;j["class"]=j["class"]||i["class"];j.vp_offset_x=j.vp_offset_x||i.vp_offset_x;j.vp_offset_y=j.vp_offset_y||i.vp_offset_y;j.keyboard_focus=i.keyboard_focus;g=new e.ui.DropMenu(j.id||c.uniqueId(),j);g.onAddItem.add(h.onAddItem.dispatch,h.onAddItem);return g},focus:function(){var g=this;if(g.keyboardNav){g.keyboardNav.focus()}},update:function(){var i=this,j=i.settings,g=c.get("menu_"+i.id+"_tbl"),l=c.get("menu_"+i.id+"_co"),h,k;h=j.max_width?Math.min(g.offsetWidth,j.max_width):g.offsetWidth;k=j.max_height?Math.min(g.offsetHeight,j.max_height):g.offsetHeight;if(!c.boxModel){i.element.setStyles({width:h+2,height:k+2})}else{i.element.setStyles({width:h,height:k})}if(j.max_width){c.setStyle(l,"width",h)}if(j.max_height){c.setStyle(l,"height",k);if(g.clientHeightv){p=r?r-u:Math.max(0,(v-A.vp_offset_x)-u)}if((n+A.vp_offset_y+l)>q){n=Math.max(0,(q-A.vp_offset_y)-l)}}c.setStyles(o,{left:p,top:n});z.element.update();z.isMenuVisible=1;z.mouseClickFunc=a.add(o,"click",function(s){var h;s=s.target;if(s&&(s=c.getParent(s,"tr"))&&!c.hasClass(s,m+"ItemSub")){h=z.items[s.id];if(h.isDisabled()){return}k=z;while(k){if(k.hideMenu){k.hideMenu()}k=k.settings.parent}if(h.settings.onclick){h.settings.onclick(s)}return false}});if(z.hasMenus()){z.mouseOverFunc=a.add(o,"mouseover",function(x){var h,t,s;x=x.target;if(x&&(x=c.getParent(x,"tr"))){h=z.items[x.id];if(z.lastMenu){z.lastMenu.collapse(1)}if(h.isDisabled()){return}if(x&&c.hasClass(x,m+"ItemSub")){t=c.getRect(x);h.showMenu((t.x+t.w-i),t.y-i,t.x);z.lastMenu=h;c.addClass(c.get(h.id).firstChild,m+"ItemActive")}}})}a.add(o,"keydown",z._keyHandler,z);z.onShowMenu.dispatch(z);if(A.keyboard_focus){z._setupKeyboardNav()}},hideMenu:function(j){var g=this,i=c.get("menu_"+g.id),h;if(!g.isMenuVisible){return}if(g.keyboardNav){g.keyboardNav.destroy()}a.remove(i,"mouseover",g.mouseOverFunc);a.remove(i,"click",g.mouseClickFunc);a.remove(i,"keydown",g._keyHandler);c.hide(i);g.isMenuVisible=0;if(!j){g.collapse(1)}if(g.element){g.element.hide()}if(h=c.get(g.id)){c.removeClass(h.firstChild,g.classPrefix+"ItemActive")}g.onHideMenu.dispatch(g)},add:function(i){var g=this,h;i=g.parent(i);if(g.isRendered&&(h=c.get("menu_"+g.id))){g._add(c.select("tbody",h)[0],i)}return i},collapse:function(g){this.parent(g);this.hideMenu(1)},remove:function(g){c.remove(g.id);this.destroy();return this.parent(g)},destroy:function(){var g=this,h=c.get("menu_"+g.id);if(g.keyboardNav){g.keyboardNav.destroy()}a.remove(h,"mouseover",g.mouseOverFunc);a.remove(c.select("a",h),"focus",g.mouseOverFunc);a.remove(h,"click",g.mouseClickFunc);a.remove(h,"keydown",g._keyHandler);if(g.element){g.element.remove()}c.remove(h)},renderNode:function(){var i=this,j=i.settings,l,h,k,g;g=c.create("div",{role:"listbox",id:"menu_"+i.id,"class":j["class"],style:"position:absolute;left:0;top:0;z-index:200000;outline:0"});if(i.settings.parent){c.setAttrib(g,"aria-parent","menu_"+i.settings.parent.id)}k=c.add(g,"div",{role:"presentation",id:"menu_"+i.id+"_co","class":i.classPrefix+(j["class"]?" "+j["class"]:"")});i.element=new b("menu_"+i.id,{blocker:1,container:j.container});if(j.menu_line){c.add(k,"span",{"class":i.classPrefix+"Line"})}l=c.add(k,"table",{role:"presentation",id:"menu_"+i.id+"_tbl",border:0,cellPadding:0,cellSpacing:0});h=c.add(l,"tbody");f(i.items,function(m){i._add(h,m)});i.rendered=true;return g},_setupKeyboardNav:function(){var i,h,g=this;i=c.get("menu_"+g.id);h=c.select("a[role=option]","menu_"+g.id);h.splice(0,0,i);g.keyboardNav=new e.ui.KeyboardNavigation({root:"menu_"+g.id,items:h,onCancel:function(){g.hideMenu()},enableUpDown:true});i.focus()},_keyHandler:function(g){var h=this,i;switch(g.keyCode){case 37:if(h.settings.parent){h.hideMenu();h.settings.parent.focus();a.cancel(g)}break;case 39:if(h.mouseOverFunc){h.mouseOverFunc(g)}break}},_add:function(j,h){var i,q=h.settings,p,l,k,m=this.classPrefix,g;if(q.separator){l=c.add(j,"tr",{id:h.id,"class":m+"ItemSeparator"});c.add(l,"td",{"class":m+"ItemSeparator"});if(i=l.previousSibling){c.addClass(i,"mceLast")}return}i=l=c.add(j,"tr",{id:h.id,"class":m+"Item "+m+"ItemEnabled"});i=k=c.add(i,q.titleItem?"th":"td");i=p=c.add(i,"a",{id:h.id+"_aria",role:q.titleItem?"presentation":"option",href:"javascript:;",onclick:"return false;",onmousedown:"return false;"});if(q.parent){c.setAttrib(p,"aria-haspopup","true");c.setAttrib(p,"aria-owns","menu_"+h.id)}c.addClass(k,q["class"]);g=c.add(i,"span",{"class":"mceIcon"+(q.icon?" mce_"+q.icon:"")});if(q.icon_src){c.add(g,"img",{src:q.icon_src})}i=c.add(i,q.element||"span",{"class":"mceText",title:h.settings.title},h.settings.title);if(h.settings.style){if(typeof h.settings.style=="function"){h.settings.style=h.settings.style()}c.setAttrib(i,"style",h.settings.style)}if(j.childNodes.length==1){c.addClass(l,"mceFirst")}if((i=l.previousSibling)&&c.hasClass(i,m+"ItemSeparator")){c.addClass(l,"mceFirst")}if(h.collapse){c.addClass(l,m+"ItemSub")}if(i=l.previousSibling){c.removeClass(i,"mceLast")}c.addClass(l,"mceLast")}})})(tinymce);(function(b){var a=b.DOM;b.create("tinymce.ui.Button:tinymce.ui.Control",{Button:function(e,d,c){this.parent(e,d,c);this.classPrefix="mceButton"},renderHTML:function(){var f=this.classPrefix,e=this.settings,d,c;c=a.encode(e.label||"");d='';if(e.image&&!(this.editor&&this.editor.forcedHighContrastMode)){d+=''+a.encode(e.title)+''+(c?''+c+"":"")}else{d+=''+(c?''+c+"":"")}d+='";d+="";return d},postRender:function(){var d=this,e=d.settings,c;if(b.isIE&&d.editor){b.dom.Event.add(d.id,"mousedown",function(f){var g=d.editor.selection.getNode().nodeName;c=g==="IMG"?d.editor.selection.getBookmark():null})}b.dom.Event.add(d.id,"click",function(f){if(!d.isDisabled()){if(b.isIE&&d.editor&&c!==null){d.editor.selection.moveToBookmark(c)}return e.onclick.call(e.scope,f)}});b.dom.Event.add(d.id,"keyup",function(f){if(!d.isDisabled()&&f.keyCode==b.VK.SPACEBAR){return e.onclick.call(e.scope,f)}})}})})(tinymce);(function(e){var d=e.DOM,b=e.dom.Event,f=e.each,a=e.util.Dispatcher,c;e.create("tinymce.ui.ListBox:tinymce.ui.Control",{ListBox:function(j,i,g){var h=this;h.parent(j,i,g);h.items=[];h.onChange=new a(h);h.onPostRender=new a(h);h.onAdd=new a(h);h.onRenderMenu=new e.util.Dispatcher(this);h.classPrefix="mceListBox";h.marked={}},select:function(h){var g=this,j,i;g.marked={};if(h==c){return g.selectByIndex(-1)}if(h&&typeof(h)=="function"){i=h}else{i=function(k){return k==h}}if(h!=g.selectedValue){f(g.items,function(l,k){if(i(l.value)){j=1;g.selectByIndex(k);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(g){var i=this,j,k,h;i.marked={};if(g!=i.selectedIndex){j=d.get(i.id+"_text");h=d.get(i.id+"_voiceDesc");k=i.items[g];if(k){i.selectedValue=k.value;i.selectedIndex=g;d.setHTML(j,d.encode(k.title));d.setHTML(h,i.settings.title+" - "+k.title);d.removeClass(j,"mceTitle");d.setAttrib(i.id,"aria-valuenow",k.title)}else{d.setHTML(j,d.encode(i.settings.title));d.setHTML(h,d.encode(i.settings.title));d.addClass(j,"mceTitle");i.selectedValue=i.selectedIndex=null;d.setAttrib(i.id,"aria-valuenow",i.settings.title)}j=0}},mark:function(g){this.marked[g]=true},add:function(j,g,i){var h=this;i=i||{};i=e.extend(i,{title:j,value:g});h.items.push(i);h.onAdd.dispatch(h,i)},getLength:function(){return this.items.length},renderHTML:function(){var j="",g=this,i=g.settings,k=g.classPrefix;j='';j+="";j+="";j+="";return j},showMenu:function(){var h=this,j,i=d.get(this.id),g;if(h.isDisabled()||h.items.length===0){return}if(h.menu&&h.menu.isMenuVisible){return h.hideMenu()}if(!h.isMenuRendered){h.renderMenu();h.isMenuRendered=true}j=d.getPos(i);g=h.menu;g.settings.offset_x=j.x;g.settings.offset_y=j.y;g.settings.keyboard_focus=!e.isOpera;f(h.items,function(k){if(g.items[k.id]){g.items[k.id].setSelected(0)}});f(h.items,function(k){if(g.items[k.id]&&h.marked[k.value]){g.items[k.id].setSelected(1)}if(k.value===h.selectedValue){g.items[k.id].setSelected(1)}});g.showMenu(0,i.clientHeight);b.add(d.doc,"mousedown",h.hideMenu,h);d.addClass(h.id,h.classPrefix+"Selected")},hideMenu:function(h){var g=this;if(g.menu&&g.menu.isMenuVisible){d.removeClass(g.id,g.classPrefix+"Selected");if(h&&h.type=="mousedown"&&(h.target.id==g.id+"_text"||h.target.id==g.id+"_open")){return}if(!h||!d.getParent(h.target,".mceMenu")){d.removeClass(g.id,g.classPrefix+"Selected");b.remove(d.doc,"mousedown",g.hideMenu,g);g.menu.hideMenu()}}},renderMenu:function(){var h=this,g;g=h.settings.control_manager.createDropMenu(h.id+"_menu",{menu_line:1,"class":h.classPrefix+"Menu mceNoIcons",max_width:250,max_height:150});g.onHideMenu.add(function(){h.hideMenu();h.focus()});g.add({title:h.settings.title,"class":"mceMenuItemTitle",onclick:function(){if(h.settings.onselect("")!==false){h.select("")}}});f(h.items,function(i){if(i.value===c){g.add({title:i.title,role:"option","class":"mceMenuItemTitle",onclick:function(){if(h.settings.onselect("")!==false){h.select("")}}})}else{i.id=d.uniqueId();i.role="option";i.onclick=function(){if(h.settings.onselect(i.value)!==false){h.select(i.value)}};g.add(i)}});h.onRenderMenu.dispatch(h,g);h.menu=g},postRender:function(){var g=this,h=g.classPrefix;b.add(g.id,"click",g.showMenu,g);b.add(g.id,"keydown",function(i){if(i.keyCode==32){g.showMenu(i);b.cancel(i)}});b.add(g.id,"focus",function(){if(!g._focused){g.keyDownHandler=b.add(g.id,"keydown",function(i){if(i.keyCode==40){g.showMenu();b.cancel(i)}});g.keyPressHandler=b.add(g.id,"keypress",function(j){var i;if(j.keyCode==13){i=g.selectedValue;g.selectedValue=null;b.cancel(j);g.settings.onselect(i)}})}g._focused=1});b.add(g.id,"blur",function(){b.remove(g.id,"keydown",g.keyDownHandler);b.remove(g.id,"keypress",g.keyPressHandler);g._focused=0});if(e.isIE6||!d.boxModel){b.add(g.id,"mouseover",function(){if(!d.hasClass(g.id,h+"Disabled")){d.addClass(g.id,h+"Hover")}});b.add(g.id,"mouseout",function(){if(!d.hasClass(g.id,h+"Disabled")){d.removeClass(g.id,h+"Hover")}})}g.onPostRender.dispatch(g,d.get(g.id))},destroy:function(){this.parent();b.clear(this.id+"_text");b.clear(this.id+"_open")}})})(tinymce);(function(e){var d=e.DOM,b=e.dom.Event,f=e.each,a=e.util.Dispatcher,c;e.create("tinymce.ui.NativeListBox:tinymce.ui.ListBox",{NativeListBox:function(h,g){this.parent(h,g);this.classPrefix="mceNativeListBox"},setDisabled:function(g){d.get(this.id).disabled=g;this.setAriaProperty("disabled",g)},isDisabled:function(){return d.get(this.id).disabled},select:function(h){var g=this,j,i;if(h==c){return g.selectByIndex(-1)}if(h&&typeof(h)=="function"){i=h}else{i=function(k){return k==h}}if(h!=g.selectedValue){f(g.items,function(l,k){if(i(l.value)){j=1;g.selectByIndex(k);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(g){d.get(this.id).selectedIndex=g+1;this.selectedValue=this.items[g]?this.items[g].value:null},add:function(k,h,g){var j,i=this;g=g||{};g.value=h;if(i.isRendered()){d.add(d.get(this.id),"option",g,k)}j={title:k,value:h,attribs:g};i.items.push(j);i.onAdd.dispatch(i,j)},getLength:function(){return this.items.length},renderHTML:function(){var i,g=this;i=d.createHTML("option",{value:""},"-- "+g.settings.title+" --");f(g.items,function(h){i+=d.createHTML("option",{value:h.value},h.title)});i=d.createHTML("select",{id:g.id,"class":"mceNativeListBox","aria-labelledby":g.id+"_aria"},i);i+=d.createHTML("span",{id:g.id+"_aria",style:"display: none"},g.settings.title);return i},postRender:function(){var h=this,i,j=true;h.rendered=true;function g(l){var k=h.items[l.target.selectedIndex-1];if(k&&(k=k.value)){h.onChange.dispatch(h,k);if(h.settings.onselect){h.settings.onselect(k)}}}b.add(h.id,"change",g);b.add(h.id,"keydown",function(l){var k;b.remove(h.id,"change",i);j=false;k=b.add(h.id,"blur",function(){if(j){return}j=true;b.add(h.id,"change",g);b.remove(h.id,"blur",k)});if(e.isWebKit&&(l.keyCode==37||l.keyCode==39)){return b.prevent(l)}if(l.keyCode==13||l.keyCode==32){g(l);return b.cancel(l)}});h.onPostRender.dispatch(h,d.get(h.id))}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.MenuButton:tinymce.ui.Button",{MenuButton:function(g,f,e){this.parent(g,f,e);this.onRenderMenu=new c.util.Dispatcher(this);f.menu_container=f.menu_container||b.doc.body},showMenu:function(){var g=this,j,i,h=b.get(g.id),f;if(g.isDisabled()){return}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}if(g.isMenuVisible){return g.hideMenu()}j=b.getPos(g.settings.menu_container);i=b.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.vp_offset_x=i.x;f.settings.vp_offset_y=i.y;f.settings.keyboard_focus=g._focused;f.showMenu(0,h.firstChild.clientHeight);a.add(b.doc,"mousedown",g.hideMenu,g);g.setState("Selected",1);g.isMenuVisible=1},renderMenu:function(){var f=this,e;e=f.settings.control_manager.createDropMenu(f.id+"_menu",{menu_line:1,"class":this.classPrefix+"Menu",icons:f.settings.icons});e.onHideMenu.add(function(){f.hideMenu();f.focus()});f.onRenderMenu.dispatch(f,e);f.menu=e},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&b.getParent(g.target,function(h){return h.id===f.id||h.id===f.id+"_open"})){return}if(!g||!b.getParent(g.target,".mceMenu")){f.setState("Selected",0);a.remove(b.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}f.isMenuVisible=0},postRender:function(){var e=this,f=e.settings;a.add(e.id,"click",function(){if(!e.isDisabled()){if(f.onclick){f.onclick(e.value)}e.showMenu()}})}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.SplitButton:tinymce.ui.MenuButton",{SplitButton:function(g,f,e){this.parent(g,f,e);this.classPrefix="mceSplitButton"},renderHTML:function(){var i,f=this,g=f.settings,e;i="";if(g.image){e=b.createHTML("img ",{src:g.image,role:"presentation","class":"mceAction "+g["class"]})}else{e=b.createHTML("span",{"class":"mceAction "+g["class"]},"")}e+=b.createHTML("span",{"class":"mceVoiceLabel mceIconOnly",id:f.id+"_voice",style:"display:none;"},g.title);i+=""+b.createHTML("a",{role:"button",id:f.id+"_action",tabindex:"-1",href:"javascript:;","class":"mceAction "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"";e=b.createHTML("span",{"class":"mceOpen "+g["class"]},'');i+=""+b.createHTML("a",{role:"button",id:f.id+"_open",tabindex:"-1",href:"javascript:;","class":"mceOpen "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"";i+="";i=b.createHTML("table",{role:"presentation","class":"mceSplitButton mceSplitButtonEnabled "+g["class"],cellpadding:"0",cellspacing:"0",title:g.title},i);return b.createHTML("div",{id:f.id,role:"button",tabindex:"0","aria-labelledby":f.id+"_voice","aria-haspopup":"true"},i)},postRender:function(){var e=this,g=e.settings,f;if(g.onclick){f=function(h){if(!e.isDisabled()){g.onclick(e.value);a.cancel(h)}};a.add(e.id+"_action","click",f);a.add(e.id,["click","keydown"],function(h){var k=32,m=14,i=13,j=38,l=40;if((h.keyCode===32||h.keyCode===13||h.keyCode===14)&&!h.altKey&&!h.ctrlKey&&!h.metaKey){f();a.cancel(h)}else{if(h.type==="click"||h.keyCode===l){e.showMenu();a.cancel(h)}}})}a.add(e.id+"_open","click",function(h){e.showMenu();a.cancel(h)});a.add([e.id,e.id+"_open"],"focus",function(){e._focused=1});a.add([e.id,e.id+"_open"],"blur",function(){e._focused=0});if(c.isIE6||!b.boxModel){a.add(e.id,"mouseover",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.addClass(e.id,"mceSplitButtonHover")}});a.add(e.id,"mouseout",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.removeClass(e.id,"mceSplitButtonHover")}})}},destroy:function(){this.parent();a.clear(this.id+"_action");a.clear(this.id+"_open");a.clear(this.id)}})})(tinymce);(function(d){var c=d.DOM,a=d.dom.Event,b=d.is,e=d.each;d.create("tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton",{ColorSplitButton:function(i,h,f){var g=this;g.parent(i,h,f);g.settings=h=d.extend({colors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",grid_width:8,default_color:"#888888"},g.settings);g.onShowMenu=new d.util.Dispatcher(g);g.onHideMenu=new d.util.Dispatcher(g);g.value=h.default_color},showMenu:function(){var f=this,g,j,i,h;if(f.isDisabled()){return}if(!f.isMenuRendered){f.renderMenu();f.isMenuRendered=true}if(f.isMenuVisible){return f.hideMenu()}i=c.get(f.id);c.show(f.id+"_menu");c.addClass(i,"mceSplitButtonSelected");h=c.getPos(i);c.setStyles(f.id+"_menu",{left:h.x,top:h.y+i.firstChild.clientHeight,zIndex:200000});i=0;a.add(c.doc,"mousedown",f.hideMenu,f);f.onShowMenu.dispatch(f);if(f._focused){f._keyHandler=a.add(f.id+"_menu","keydown",function(k){if(k.keyCode==27){f.hideMenu()}});c.select("a",f.id+"_menu")[0].focus()}f.keyboardNav=new d.ui.KeyboardNavigation({root:f.id+"_menu",items:c.select("a",f.id+"_menu"),onCancel:function(){f.hideMenu();f.focus()}});f.keyboardNav.focus();f.isMenuVisible=1},hideMenu:function(g){var f=this;if(f.isMenuVisible){if(g&&g.type=="mousedown"&&c.getParent(g.target,function(h){return h.id===f.id+"_open"})){return}if(!g||!c.getParent(g.target,".mceSplitButtonMenu")){c.removeClass(f.id,"mceSplitButtonSelected");a.remove(c.doc,"mousedown",f.hideMenu,f);a.remove(f.id+"_menu","keydown",f._keyHandler);c.hide(f.id+"_menu")}f.isMenuVisible=0;f.onHideMenu.dispatch();f.keyboardNav.destroy()}},renderMenu:function(){var p=this,h,k=0,q=p.settings,g,j,l,o,f;o=c.add(q.menu_container,"div",{role:"listbox",id:p.id+"_menu","class":q.menu_class+" "+q["class"],style:"position:absolute;left:0;top:-1000px;"});h=c.add(o,"div",{"class":q["class"]+" mceSplitButtonMenu"});c.add(h,"span",{"class":"mceMenuLine"});g=c.add(h,"table",{role:"presentation","class":"mceColorSplitMenu"});j=c.add(g,"tbody");k=0;e(b(q.colors,"array")?q.colors:q.colors.split(","),function(m){m=m.replace(/^#/,"");if(!k--){l=c.add(j,"tr");k=q.grid_width-1}g=c.add(l,"td");var i={href:"javascript:;",style:{backgroundColor:"#"+m},title:p.editor.getLang("colors."+m,m),"data-mce-color":"#"+m};if(!d.isIE){i.role="option"}g=c.add(g,"a",i);if(p.editor.forcedHighContrastMode){g=c.add(g,"canvas",{width:16,height:16,"aria-hidden":"true"});if(g.getContext&&(f=g.getContext("2d"))){f.fillStyle="#"+m;f.fillRect(0,0,16,16)}else{c.remove(g)}}});if(q.more_colors_func){g=c.add(j,"tr");g=c.add(g,"td",{colspan:q.grid_width,"class":"mceMoreColors"});g=c.add(g,"a",{role:"option",id:p.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},q.more_colors_title);a.add(g,"click",function(i){q.more_colors_func.call(q.more_colors_scope||this);return a.cancel(i)})}c.addClass(h,"mceColorSplitMenu");a.add(p.id+"_menu","mousedown",function(i){return a.cancel(i)});a.add(p.id+"_menu","click",function(i){var m;i=c.getParent(i.target,"a",j);if(i&&i.nodeName.toLowerCase()=="a"&&(m=i.getAttribute("data-mce-color"))){p.setColor(m)}return false});return o},setColor:function(f){this.displayColor(f);this.hideMenu();this.settings.onselect(f)},displayColor:function(g){var f=this;c.setStyle(f.id+"_preview","backgroundColor",g);f.value=g},postRender:function(){var f=this,g=f.id;f.parent();c.add(g+"_action","div",{id:g+"_preview","class":"mceColorPreview"});c.setStyle(f.id+"_preview","backgroundColor",f.value)},destroy:function(){var f=this;f.parent();a.clear(f.id+"_menu");a.clear(f.id+"_more");c.remove(f.id+"_menu");if(f.keyboardNav){f.keyboardNav.destroy()}}})})(tinymce);(function(b){var d=b.DOM,c=b.each,a=b.dom.Event;b.create("tinymce.ui.ToolbarGroup:tinymce.ui.Container",{renderHTML:function(){var f=this,i=[],e=f.controls,j=b.each,g=f.settings;i.push('
    ');i.push("");i.push('");j(e,function(h){i.push(h.renderHTML())});i.push("");i.push("
    ");return i.join("")},focus:function(){var e=this;d.get(e.id).focus()},postRender:function(){var f=this,e=[];c(f.controls,function(g){c(g.controls,function(h){if(h.id){e.push(h)}})});f.keyNav=new b.ui.KeyboardNavigation({root:f.id,items:e,onCancel:function(){if(b.isWebKit){d.get(f.editor.id+"_ifr").focus()}f.editor.focus()},excludeFromTabOrder:!f.settings.tab_focus_toolbar})},destroy:function(){var e=this;e.parent();e.keyNav.destroy();a.clear(e.id)}})})(tinymce);(function(a){var c=a.DOM,b=a.each;a.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var m=this,f="",j,k,n=m.settings,e,d,g,l;l=m.controls;for(e=0;e"))}if(d&&k.ListBox){if(d.Button||d.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarEnd"},c.createHTML("span",null,""))}}if(c.stdMode){f+=''+k.renderHTML()+""}else{f+=""+k.renderHTML()+""}if(g&&k.ListBox){if(g.Button||g.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarStart"},c.createHTML("span",null,""))}}}j="mceToolbarEnd";if(k.Button){j+=" mceToolbarEndButton"}else{if(k.SplitButton){j+=" mceToolbarEndSplitButton"}else{if(k.ListBox){j+=" mceToolbarEndListBox"}}}f+=c.createHTML("td",{"class":j},c.createHTML("span",null,""));return c.createHTML("table",{id:m.id,"class":"mceToolbar"+(n["class"]?" "+n["class"]:""),cellpadding:"0",cellspacing:"0",align:m.settings.align||"",role:"presentation",tabindex:"-1"},""+f+"")}})})(tinymce);(function(b){var a=b.util.Dispatcher,c=b.each;b.create("tinymce.AddOnManager",{AddOnManager:function(){var d=this;d.items=[];d.urls={};d.lookup={};d.onAdd=new a(d)},get:function(d){if(this.lookup[d]){return this.lookup[d].instance}else{return undefined}},dependencies:function(e){var d;if(this.lookup[e]){d=this.lookup[e].dependencies}return d||[]},requireLangPack:function(e){var d=b.settings;if(d&&d.language&&d.language_load!==false){b.ScriptLoader.add(this.urls[e]+"/langs/"+d.language+".js")}},add:function(f,e,d){this.items.push(e);this.lookup[f]={instance:e,dependencies:d};this.onAdd.dispatch(this,f,e);return e},createUrl:function(d,e){if(typeof e==="object"){return e}else{return{prefix:d.prefix,resource:e,suffix:d.suffix}}},addComponents:function(f,d){var e=this.urls[f];b.each(d,function(g){b.ScriptLoader.add(e+"/"+g)})},load:function(j,f,d,h){var g=this,e=f;function i(){var k=g.dependencies(j);b.each(k,function(m){var l=g.createUrl(f,m);g.load(l.resource,l,undefined,undefined)});if(d){if(h){d.call(h)}else{d.call(b.ScriptLoader)}}}if(g.urls[j]){return}if(typeof f==="object"){e=f.prefix+f.resource+f.suffix}if(e.indexOf("/")!==0&&e.indexOf("://")==-1){e=b.baseURL+"/"+e}g.urls[j]=e.substring(0,e.lastIndexOf("/"));if(g.lookup[j]){i()}else{b.ScriptLoader.add(e,i,h)}}});b.PluginManager=new b.AddOnManager();b.ThemeManager=new b.AddOnManager()}(tinymce));(function(j){var g=j.each,d=j.extend,k=j.DOM,i=j.dom.Event,f=j.ThemeManager,b=j.PluginManager,e=j.explode,h=j.util.Dispatcher,a,c=0;j.documentBaseURL=window.location.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,"");if(!/[\/\\]$/.test(j.documentBaseURL)){j.documentBaseURL+="/"}j.baseURL=new j.util.URI(j.documentBaseURL).toAbsolute(j.baseURL);j.baseURI=new j.util.URI(j.baseURL);j.onBeforeUnload=new h(j);i.add(window,"beforeunload",function(l){j.onBeforeUnload.dispatch(j,l)});j.onAddEditor=new h(j);j.onRemoveEditor=new h(j);j.EditorManager=d(j,{editors:[],i18n:{},activeEditor:null,init:function(x){var v=this,o,n=j.ScriptLoader,u,l=[],r;function q(t){var s=t.id;if(!s){s=t.name;if(s&&!k.get(s)){s=t.name}else{s=k.uniqueId()}t.setAttribute("id",s)}return s}function m(z,A,t){var y=z[A];if(!y){return}if(j.is(y,"string")){t=y.replace(/\.\w+$/,"");t=t?j.resolve(t):0;y=j.resolve(y)}return y.apply(t||this,Array.prototype.slice.call(arguments,2))}function p(t,s){return s.constructor===RegExp?s.test(t.className):k.hasClass(t,s)}v.settings=x;i.bind(window,"ready",function(){var s,t;m(x,"onpageload");switch(x.mode){case"exact":s=x.elements||"";if(s.length>0){g(e(s),function(y){if(k.get(y)){r=new j.Editor(y,x);l.push(r);r.render(1)}else{g(document.forms,function(z){g(z.elements,function(A){if(A.name===y){y="mce_editor_"+c++;k.setAttrib(A,"id",y);r=new j.Editor(y,x);l.push(r);r.render(1)}})})}})}break;case"textareas":case"specific_textareas":g(k.select("textarea"),function(y){if(x.editor_deselector&&p(y,x.editor_deselector)){return}if(!x.editor_selector||p(y,x.editor_selector)){r=new j.Editor(q(y),x);l.push(r);r.render(1)}});break;default:if(x.types){g(x.types,function(y){g(k.select(y.selector),function(A){var z=new j.Editor(q(A),j.extend({},x,y));l.push(z);z.render(1)})})}else{if(x.selector){g(k.select(x.selector),function(z){var y=new j.Editor(q(z),x);l.push(y);y.render(1)})}}}if(x.oninit){s=t=0;g(l,function(y){t++;if(!y.initialized){y.onInit.add(function(){s++;if(s==t){m(x,"oninit")}})}else{s++}if(s==t){m(x,"oninit")}})}})},get:function(l){if(l===a){return this.editors}if(!this.editors.hasOwnProperty(l)){return a}return this.editors[l]},getInstanceById:function(l){return this.get(l)},add:function(m){var l=this,n=l.editors;n[m.id]=m;n.push(m);l._setActive(m);l.onAddEditor.dispatch(l,m);if(j.adapter){j.adapter.patchEditor(m)}return m},remove:function(n){var m=this,l,o=m.editors;if(!o[n.id]){return null}delete o[n.id];for(l=0;l':"",visual:n,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",font_size_legacy_values:"xx-small,small,medium,large,x-large,xx-large,300%",apply_source_formatting:n,directionality:"ltr",forced_root_block:"p",hidden_input:n,padd_empty_editor:n,render_ui:n,indentation:"30px",fix_table_elements:n,inline_styles:n,convert_fonts_to_spans:n,indent:"simple",indent_before:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist",validate:n,entity_encoding:"named",url_converter:m.convertURL,url_converter_scope:m,ie7_compat:n},o);m.id=m.editorId=p;m.isNotDirty=false;m.plugins={};m.documentBaseURI=new k.util.URI(o.document_base_url||k.documentBaseURL,{base_uri:tinyMCE.baseURI});m.baseURI=k.baseURI;m.contentCSS=[];m.contentStyles=[];m.setupEvents();m.execCommands={};m.queryStateCommands={};m.queryValueCommands={};m.execCallback("setup",m)},render:function(o){var p=this,q=p.settings,r=p.id,m=k.ScriptLoader;if(!j.domLoaded){j.add(window,"ready",function(){p.render()});return}tinyMCE.settings=q;if(!p.getElement()){return}if(k.isIDevice&&!k.isIOS5){return}if(!/TEXTAREA|INPUT/i.test(p.getElement().nodeName)&&q.hidden_input&&l.getParent(r,"form")){l.insertAfter(l.create("input",{type:"hidden",name:r}),r)}if(!q.content_editable){p.orgVisibility=p.getElement().style.visibility;p.getElement().style.visibility="hidden"}if(k.WindowManager){p.windowManager=new k.WindowManager(p)}if(q.encoding=="xml"){p.onGetContent.add(function(s,t){if(t.save){t.content=l.encode(t.content)}})}if(q.add_form_submit_trigger){p.onSubmit.addToTop(function(){if(p.initialized){p.save();p.isNotDirty=1}})}if(q.add_unload_trigger){p._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(p.initialized&&!p.destroyed&&!p.isHidden()){p.save({format:"raw",no_events:true})}})}k.addUnload(p.destroy,p);if(q.submit_patch){p.onBeforeRenderUI.add(function(){var s=p.getElement().form;if(!s){return}if(s._mceOldSubmit){return}if(!s.submit.nodeType&&!s.submit.length){p.formElement=s;s._mceOldSubmit=s.submit;s.submit=function(){k.triggerSave();p.isNotDirty=1;return p.formElement._mceOldSubmit(p.formElement)}}s=null})}function n(){if(q.language&&q.language_load!==false){m.add(k.baseURL+"/langs/"+q.language+".js")}if(q.theme&&typeof q.theme!="function"&&q.theme.charAt(0)!="-"&&!h.urls[q.theme]){h.load(q.theme,"themes/"+q.theme+"/editor_template"+k.suffix+".js")}i(g(q.plugins),function(t){if(t&&!c.urls[t]){if(t.charAt(0)=="-"){t=t.substr(1,t.length);var s=c.dependencies(t);i(s,function(v){var u={prefix:"plugins/",resource:v,suffix:"/editor_plugin"+k.suffix+".js"};v=c.createUrl(u,v);c.load(v.resource,v)})}else{if(t=="safari"){return}c.load(t,{prefix:"plugins/",resource:t,suffix:"/editor_plugin"+k.suffix+".js"})}}});m.loadQueue(function(){if(!p.removed){p.init()}})}n()},init:function(){var q,G=this,H=G.settings,D,y,z,C=G.getElement(),p,m,E,v,B,F,x,r=[];k.add(G);H.aria_label=H.aria_label||l.getAttrib(C,"aria-label",G.getLang("aria.rich_text_area"));if(H.theme){if(typeof H.theme!="function"){H.theme=H.theme.replace(/-/,"");p=h.get(H.theme);G.theme=new p();if(G.theme.init){G.theme.init(G,h.urls[H.theme]||k.documentBaseURL.replace(/\/$/,""))}}else{G.theme=H.theme}}function A(s){var t=c.get(s),o=c.urls[s]||k.documentBaseURL.replace(/\/$/,""),n;if(t&&k.inArray(r,s)===-1){i(c.dependencies(s),function(u){A(u)});n=new t(G,o);G.plugins[s]=n;if(n.init){n.init(G,o);r.push(s)}}}i(g(H.plugins.replace(/\-/g,"")),A);if(H.popup_css!==false){if(H.popup_css){H.popup_css=G.documentBaseURI.toAbsolute(H.popup_css)}else{H.popup_css=G.baseURI.toAbsolute("themes/"+H.theme+"/skins/"+H.skin+"/dialog.css")}}if(H.popup_css_add){H.popup_css+=","+G.documentBaseURI.toAbsolute(H.popup_css_add)}G.controlManager=new k.ControlManager(G);G.onBeforeRenderUI.dispatch(G,G.controlManager);if(H.render_ui&&G.theme){G.orgDisplay=C.style.display;if(typeof H.theme!="function"){D=H.width||C.style.width||C.offsetWidth;y=H.height||C.style.height||C.offsetHeight;z=H.min_height||100;F=/^[0-9\.]+(|px)$/i;if(F.test(""+D)){D=Math.max(parseInt(D,10)+(p.deltaWidth||0),100)}if(F.test(""+y)){y=Math.max(parseInt(y,10)+(p.deltaHeight||0),z)}p=G.theme.renderUI({targetNode:C,width:D,height:y,deltaWidth:H.delta_width,deltaHeight:H.delta_height});l.setStyles(p.sizeContainer||p.editorContainer,{width:D,height:y});y=(p.iframeHeight||y)+(typeof(y)=="number"?(p.deltaHeight||0):"");if(y';if(H.document_base_url!=k.documentBaseURL){G.iframeHTML+=''}if(k.isIE8){if(H.ie7_compat){G.iframeHTML+=''}else{G.iframeHTML+=''}}G.iframeHTML+='';for(x=0;x'}G.contentCSS=[];v=H.body_id||"tinymce";if(v.indexOf("=")!=-1){v=G.getParam("body_id","","hash");v=v[G.id]||v}B=H.body_class||"";if(B.indexOf("=")!=-1){B=G.getParam("body_class","","hash");B=B[G.id]||""}G.iframeHTML+='
    ";if(k.relaxedDomain&&(b||(k.isOpera&&parseFloat(opera.version())<11))){E='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+G.id+'");document.write(ed.iframeHTML);document.close();ed.initContentBody();})()'}q=l.add(p.iframeContainer,"iframe",{id:G.id+"_ifr",src:E||'javascript:""',frameBorder:"0",allowTransparency:"true",title:H.aria_label,style:{width:"100%",height:y,display:"block"}});G.contentAreaContainer=p.iframeContainer;if(p.editorContainer){l.get(p.editorContainer).style.display=G.orgDisplay}C.style.visibility=G.orgVisibility;l.get(G.id).style.display="none";l.setAttrib(G.id,"aria-hidden",true);if(!k.relaxedDomain||!E){G.initContentBody()}C=q=p=null},initContentBody:function(){var n=this,p=n.settings,q=l.get(n.id),r=n.getDoc(),o,m,s;if((!b||!k.relaxedDomain)&&!p.content_editable){r.open();r.write(n.iframeHTML);r.close();if(k.relaxedDomain){r.domain=k.relaxedDomain}}if(p.content_editable){l.addClass(q,"mceContentBody");n.contentDocument=r=p.content_document||document;n.contentWindow=p.content_window||window;n.bodyElement=q;p.content_document=p.content_window=null}m=n.getBody();m.disabled=true;if(!p.readonly){m.contentEditable=n.getParam("content_editable_state",true)}m.disabled=false;n.schema=new k.html.Schema(p);n.dom=new k.dom.DOMUtils(r,{keep_values:true,url_converter:n.convertURL,url_converter_scope:n,hex_colors:p.force_hex_style_colors,class_filter:p.class_filter,update_styles:true,root_element:p.content_editable?n.id:null,schema:n.schema});n.parser=new k.html.DomParser(p,n.schema);n.parser.addAttributeFilter("src,href,style",function(t,u){var v=t.length,y,A=n.dom,z,x;while(v--){y=t[v];z=y.attr(u);x="data-mce-"+u;if(!y.attributes.map[x]){if(u==="style"){y.attr(x,A.serializeStyle(A.parseStyle(z),y.name))}else{y.attr(x,n.convertURL(z,u,y.name))}}}});n.parser.addNodeFilter("script",function(t,u){var v=t.length,x;while(v--){x=t[v];x.attr("type","mce-"+(x.attr("type")||"text/javascript"))}});n.parser.addNodeFilter("#cdata",function(t,u){var v=t.length,x;while(v--){x=t[v];x.type=8;x.name="#comment";x.value="[CDATA["+x.value+"]]"}});n.parser.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",function(u,v){var x=u.length,y,t=n.schema.getNonEmptyElements();while(x--){y=u[x];if(y.isEmpty(t)){y.empty().append(new k.html.Node("br",1)).shortEnded=true}}});n.serializer=new k.dom.Serializer(p,n.dom,n.schema);n.selection=new k.dom.Selection(n.dom,n.getWin(),n.serializer,n);n.formatter=new k.Formatter(n);n.undoManager=new k.UndoManager(n);n.forceBlocks=new k.ForceBlocks(n);n.enterKey=new k.EnterKey(n);n.editorCommands=new k.EditorCommands(n);n.onExecCommand.add(function(t,u){if(!/^(FontName|FontSize)$/.test(u)){n.nodeChanged()}});n.serializer.onPreProcess.add(function(t,u){return n.onPreProcess.dispatch(n,u,t)});n.serializer.onPostProcess.add(function(t,u){return n.onPostProcess.dispatch(n,u,t)});n.onPreInit.dispatch(n);if(!p.browser_spellcheck&&!p.gecko_spellcheck){r.body.spellcheck=false}if(!p.readonly){n.bindNativeEvents()}n.controlManager.onPostRender.dispatch(n,n.controlManager);n.onPostRender.dispatch(n);n.quirks=k.util.Quirks(n);if(p.directionality){m.dir=p.directionality}if(p.nowrap){m.style.whiteSpace="nowrap"}if(p.protect){n.onBeforeSetContent.add(function(t,u){i(p.protect,function(v){u.content=u.content.replace(v,function(x){return""})})})}n.onSetContent.add(function(){n.addVisual(n.getBody())});if(p.padd_empty_editor){n.onPostProcess.add(function(t,u){u.content=u.content.replace(/^(]*>( | |\s|\u00a0|)<\/p>[\r\n]*|
    [\r\n]*)$/,"")})}n.load({initial:true,format:"html"});n.startContent=n.getContent({format:"raw"});n.initialized=true;n.onInit.dispatch(n);n.execCallback("setupcontent_callback",n.id,m,r);n.execCallback("init_instance_callback",n);n.focus(true);n.nodeChanged({initial:true});if(n.contentStyles.length>0){s="";i(n.contentStyles,function(t){s+=t+"\r\n"});n.dom.addStyle(s)}i(n.contentCSS,function(t){n.dom.loadCSS(t)});if(p.auto_focus){setTimeout(function(){var t=k.get(p.auto_focus);t.selection.select(t.getBody(),1);t.selection.collapse(1);t.getBody().focus();t.getWin().focus()},100)}q=r=m=null},focus:function(p){var o,u=this,t=u.selection,q=u.settings.content_editable,n,r,s=u.getDoc(),m;if(!p){if(u.lastIERng){t.setRng(u.lastIERng)}n=t.getRng();if(n.item){r=n.item(0)}u._refreshContentEditable();if(!q){u.getWin().focus()}if(k.isGecko||q){m=u.getBody();if(m.setActive){m.setActive()}else{m.focus()}if(q){t.normalize()}}if(r&&r.ownerDocument==s){n=s.body.createControlRange();n.addElement(r);n.select()}}if(k.activeEditor!=u){if((o=k.activeEditor)!=null){o.onDeactivate.dispatch(o,u)}u.onActivate.dispatch(u,o)}k._setActive(u)},execCallback:function(q){var m=this,p=m.settings[q],o;if(!p){return}if(m.callbackLookup&&(o=m.callbackLookup[q])){p=o.func;o=o.scope}if(d(p,"string")){o=p.replace(/\.\w+$/,"");o=o?k.resolve(o):0;p=k.resolve(p);m.callbackLookup=m.callbackLookup||{};m.callbackLookup[q]={func:p,scope:o}}return p.apply(o||m,Array.prototype.slice.call(arguments,1))},translate:function(m){var o=this.settings.language||"en",n=k.i18n;if(!m){return""}return n[o+"."+m]||m.replace(/\{\#([^\}]+)\}/g,function(q,p){return n[o+"."+p]||"{#"+p+"}"})},getLang:function(o,m){return k.i18n[(this.settings.language||"en")+"."+o]||(d(m)?m:"{#"+o+"}")},getParam:function(t,q,m){var r=k.trim,p=d(this.settings[t])?this.settings[t]:q,s;if(m==="hash"){s={};if(d(p,"string")){i(p.indexOf("=")>0?p.split(/[;,](?![^=;,]*(?:[;,]|$))/):p.split(","),function(n){n=n.split("=");if(n.length>1){s[r(n[0])]=r(n[1])}else{s[r(n[0])]=r(n)}})}else{s=p}return s}return p},nodeChanged:function(q){var m=this,n=m.selection,p;if(m.initialized){q=q||{};p=n.getStart()||m.getBody();p=b&&p.ownerDocument!=m.getDoc()?m.getBody():p;q.parents=[];m.dom.getParent(p,function(o){if(o.nodeName=="BODY"){return true}q.parents.push(o)});m.onNodeChange.dispatch(m,q?q.controlManager||m.controlManager:m.controlManager,p,n.isCollapsed(),q)}},addButton:function(n,o){var m=this;m.buttons=m.buttons||{};m.buttons[n]=o},addCommand:function(m,o,n){this.execCommands[m]={func:o,scope:n||this}},addQueryStateHandler:function(m,o,n){this.queryStateCommands[m]={func:o,scope:n||this}},addQueryValueHandler:function(m,o,n){this.queryValueCommands[m]={func:o,scope:n||this}},addShortcut:function(o,q,m,p){var n=this,r;if(n.settings.custom_shortcuts===false){return false}n.shortcuts=n.shortcuts||{};if(d(m,"string")){r=m;m=function(){n.execCommand(r,false,null)}}if(d(m,"object")){r=m;m=function(){n.execCommand(r[0],r[1],r[2])}}i(g(o),function(s){var t={func:m,scope:p||this,desc:n.translate(q),alt:false,ctrl:false,shift:false};i(g(s,"+"),function(u){switch(u){case"alt":case"ctrl":case"shift":t[u]=true;break;default:t.charCode=u.charCodeAt(0);t.keyCode=u.toUpperCase().charCodeAt(0)}});n.shortcuts[(t.ctrl?"ctrl":"")+","+(t.alt?"alt":"")+","+(t.shift?"shift":"")+","+t.keyCode]=t});return true},execCommand:function(u,r,x,m){var p=this,q=0,v,n;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(u)&&(!m||!m.skip_focus)){p.focus()}m=f({},m);p.onBeforeExecCommand.dispatch(p,u,r,x,m);if(m.terminate){return false}if(p.execCallback("execcommand_callback",p.id,p.selection.getNode(),u,r,x)){p.onExecCommand.dispatch(p,u,r,x,m);return true}if(v=p.execCommands[u]){n=v.func.call(v.scope,r,x);if(n!==true){p.onExecCommand.dispatch(p,u,r,x,m);return n}}i(p.plugins,function(o){if(o.execCommand&&o.execCommand(u,r,x)){p.onExecCommand.dispatch(p,u,r,x,m);q=1;return false}});if(q){return true}if(p.theme&&p.theme.execCommand&&p.theme.execCommand(u,r,x)){p.onExecCommand.dispatch(p,u,r,x,m);return true}if(p.editorCommands.execCommand(u,r,x)){p.onExecCommand.dispatch(p,u,r,x,m);return true}p.getDoc().execCommand(u,r,x);p.onExecCommand.dispatch(p,u,r,x,m)},queryCommandState:function(q){var n=this,r,p;if(n._isHidden()){return}if(r=n.queryStateCommands[q]){p=r.func.call(r.scope);if(p!==true){return p}}r=n.editorCommands.queryCommandState(q);if(r!==-1){return r}try{return this.getDoc().queryCommandState(q)}catch(m){}},queryCommandValue:function(r){var n=this,q,p;if(n._isHidden()){return}if(q=n.queryValueCommands[r]){p=q.func.call(q.scope);if(p!==true){return p}}q=n.editorCommands.queryCommandValue(r);if(d(q)){return q}try{return this.getDoc().queryCommandValue(r)}catch(m){}},show:function(){var m=this;l.show(m.getContainer());l.hide(m.id);m.load()},hide:function(){var m=this,n=m.getDoc();if(b&&n){n.execCommand("SelectAll")}m.save();l.hide(m.getContainer());l.setStyle(m.id,"display",m.orgDisplay)},isHidden:function(){return !l.isHidden(this.id)},setProgressState:function(m,n,p){this.onSetProgressState.dispatch(this,m,n,p);return m},load:function(q){var m=this,p=m.getElement(),n;if(p){q=q||{};q.load=true;n=m.setContent(d(p.value)?p.value:p.innerHTML,q);q.element=p;if(!q.no_events){m.onLoadContent.dispatch(m,q)}q.element=p=null;return n}},save:function(r){var m=this,q=m.getElement(),n,p;if(!q||!m.initialized){return}r=r||{};r.save=true;r.element=q;n=r.content=m.getContent(r);if(!r.no_events){m.onSaveContent.dispatch(m,r)}n=r.content;if(!/TEXTAREA|INPUT/i.test(q.nodeName)){q.innerHTML=n;if(p=l.getParent(m.id,"form")){i(p.elements,function(o){if(o.name==m.id){o.value=n;return false}})}}else{q.value=n}r.element=q=null;return n},setContent:function(r,p){var o=this,n,m=o.getBody(),q;p=p||{};p.format=p.format||"html";p.set=true;p.content=r;if(!p.no_events){o.onBeforeSetContent.dispatch(o,p)}r=p.content;if(!k.isIE&&(r.length===0||/^\s+$/.test(r))){q=o.settings.forced_root_block;if(q){r="<"+q+'>
    "}else{r='
    '}m.innerHTML=r;o.selection.select(m,true);o.selection.collapse(true);return}if(p.format!=="raw"){r=new k.html.Serializer({},o.schema).serialize(o.parser.parse(r))}p.content=k.trim(r);o.dom.setHTML(m,p.content);if(!p.no_events){o.onSetContent.dispatch(o,p)}if(!o.settings.content_editable||document.activeElement===o.getBody()){o.selection.normalize()}return p.content},getContent:function(o){var n=this,p,m=n.getBody();o=o||{};o.format=o.format||"html";o.get=true;o.getInner=true;if(!o.no_events){n.onBeforeGetContent.dispatch(n,o)}if(o.format=="raw"){p=m.innerHTML}else{if(o.format=="text"){p=m.innerText||m.textContent}else{p=n.serializer.serialize(m,o)}}if(o.format!="text"){o.content=k.trim(p)}else{o.content=p}if(!o.no_events){n.onGetContent.dispatch(n,o)}return o.content},isDirty:function(){var m=this;return k.trim(m.startContent)!=k.trim(m.getContent({format:"raw",no_events:1}))&&!m.isNotDirty},getContainer:function(){var m=this;if(!m.container){m.container=l.get(m.editorContainer||m.id+"_parent")}return m.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return l.get(this.settings.content_element||this.id)},getWin:function(){var m=this,n;if(!m.contentWindow){n=l.get(m.id+"_ifr");if(n){m.contentWindow=n.contentWindow}}return m.contentWindow},getDoc:function(){var m=this,n;if(!m.contentDocument){n=m.getWin();if(n){m.contentDocument=n.document}}return m.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(o,n,q){var m=this,p=m.settings;if(p.urlconverter_callback){return m.execCallback("urlconverter_callback",o,q,true,n)}if(!p.convert_urls||(q&&q.nodeName=="LINK")||o.indexOf("file:")===0){return o}if(p.relative_urls){return m.documentBaseURI.toRelative(o)}o=m.documentBaseURI.toAbsolute(o,p.remove_script_host);return o},addVisual:function(q){var n=this,o=n.settings,p=n.dom,m;q=q||n.getBody();if(!d(n.hasVisual)){n.hasVisual=o.visual}i(p.select("table,a",q),function(s){var r;switch(s.nodeName){case"TABLE":m=o.visual_table_class||"mceItemTable";r=p.getAttrib(s,"border");if(!r||r=="0"){if(n.hasVisual){p.addClass(s,m)}else{p.removeClass(s,m)}}return;case"A":if(!p.getAttrib(s,"href",false)){r=p.getAttrib(s,"name")||s.id;m="mceItemAnchor";if(r){if(n.hasVisual){p.addClass(s,m)}else{p.removeClass(s,m)}}}return}});n.onVisualAid.dispatch(n,q,n.hasVisual)},remove:function(){var m=this,o=m.getContainer(),n=m.getDoc();if(!m.removed){m.removed=1;if(b&&n){n.execCommand("SelectAll")}m.save();l.setStyle(m.id,"display",m.orgDisplay);if(!m.settings.content_editable){j.unbind(m.getWin());j.unbind(m.getDoc())}j.unbind(m.getBody());j.clear(o);m.execCallback("remove_instance_callback",m);m.onRemove.dispatch(m);m.onExecCommand.listeners=[];k.remove(m);l.remove(o)}},destroy:function(n){var m=this;if(m.destroyed){return}if(a){j.unbind(m.getDoc());j.unbind(m.getWin());j.unbind(m.getBody())}if(!n){k.removeUnload(m.destroy);tinyMCE.onBeforeUnload.remove(m._beforeUnload);if(m.theme&&m.theme.destroy){m.theme.destroy()}m.controlManager.destroy();m.selection.destroy();m.dom.destroy()}if(m.formElement){m.formElement.submit=m.formElement._mceOldSubmit;m.formElement._mceOldSubmit=null}m.contentAreaContainer=m.formElement=m.container=m.settings.content_element=m.bodyElement=m.contentDocument=m.contentWindow=null;if(m.selection){m.selection=m.selection.win=m.selection.dom=m.selection.dom.doc=null}m.destroyed=1},_refreshContentEditable:function(){var n=this,m,o;if(n._isHidden()){m=n.getBody();o=m.parentNode;o.removeChild(m);o.appendChild(m);m.focus()}},_isHidden:function(){var m;if(!a){return 0}m=this.selection.getSel();return(!m||!m.rangeCount||m.rangeCount===0)}})})(tinymce);(function(a){var b=a.each;a.Editor.prototype.setupEvents=function(){var c=this,d=c.settings;b(["onPreInit","onBeforeRenderUI","onPostRender","onLoad","onInit","onRemove","onActivate","onDeactivate","onClick","onEvent","onMouseUp","onMouseDown","onDblClick","onKeyDown","onKeyUp","onKeyPress","onContextMenu","onSubmit","onReset","onPaste","onPreProcess","onPostProcess","onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent","onLoadContent","onSaveContent","onNodeChange","onChange","onBeforeExecCommand","onExecCommand","onUndo","onRedo","onVisualAid","onSetProgressState","onSetAttrib"],function(e){c[e]=new a.util.Dispatcher(c)});if(d.cleanup_callback){c.onBeforeSetContent.add(function(e,f){f.content=e.execCallback("cleanup_callback","insert_to_editor",f.content,f)});c.onPreProcess.add(function(e,f){if(f.set){e.execCallback("cleanup_callback","insert_to_editor_dom",f.node,f)}if(f.get){e.execCallback("cleanup_callback","get_from_editor_dom",f.node,f)}});c.onPostProcess.add(function(e,f){if(f.set){f.content=e.execCallback("cleanup_callback","insert_to_editor",f.content,f)}if(f.get){f.content=e.execCallback("cleanup_callback","get_from_editor",f.content,f)}})}if(d.save_callback){c.onGetContent.add(function(e,f){if(f.save){f.content=e.execCallback("save_callback",e.id,f.content,e.getBody())}})}if(d.handle_event_callback){c.onEvent.add(function(f,g,h){if(c.execCallback("handle_event_callback",g,f,h)===false){g.preventDefault();g.stopPropagation()}})}if(d.handle_node_change_callback){c.onNodeChange.add(function(f,e,g){f.execCallback("handle_node_change_callback",f.id,g,-1,-1,true,f.selection.isCollapsed())})}if(d.save_callback){c.onSaveContent.add(function(e,g){var f=e.execCallback("save_callback",e.id,g.content,e.getBody());if(f){g.content=f}})}if(d.onchange_callback){c.onChange.add(function(f,e){f.execCallback("onchange_callback",f,e)})}};a.Editor.prototype.bindNativeEvents=function(){var l=this,f,d=l.settings,e=l.dom,h;h={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"};function c(i,m){var n=i.type;if(l.removed){return}if(l.onEvent.dispatch(l,i,m)!==false){l[h[i.fakeType||i.type]].dispatch(l,i,m)}}function j(i){l.focus(true)}function k(i,m){if(m.keyCode!=65||!a.VK.metaKeyPressed(m)){l.selection.normalize()}l.nodeChanged()}b(h,function(m,n){var i=d.content_editable?l.getBody():l.getDoc();switch(n){case"contextmenu":e.bind(i,n,c);break;case"paste":e.bind(l.getBody(),n,c);break;case"submit":case"reset":e.bind(l.getElement().form||a.DOM.getParent(l.id,"form"),n,c);break;default:e.bind(i,n,c)}});e.bind(d.content_editable?l.getBody():(a.isGecko?l.getDoc():l.getWin()),"focus",function(i){l.focus(true)});if(d.content_editable&&a.isOpera){e.bind(l.getBody(),"click",j);e.bind(l.getBody(),"keydown",j)}l.onMouseUp.add(k);l.onKeyUp.add(function(i,n){var m=n.keyCode;if((m>=33&&m<=36)||(m>=37&&m<=40)||m==13||m==45||m==46||m==8||(a.isMac&&(m==91||m==93))||n.ctrlKey){k(i,n)}});l.onReset.add(function(){l.setContent(l.startContent,{format:"raw"})});function g(m,i){if(m.altKey||m.ctrlKey||m.metaKey){b(l.shortcuts,function(n){var o=a.isMac?m.metaKey:m.ctrlKey;if(n.ctrl!=o||n.alt!=m.altKey||n.shift!=m.shiftKey){return}if(m.keyCode==n.keyCode||(m.charCode&&m.charCode==n.charCode)){m.preventDefault();if(i){n.func.call(n.scope)}return true}})}}l.onKeyUp.add(function(i,m){g(m)});l.onKeyPress.add(function(i,m){g(m)});l.onKeyDown.add(function(i,m){g(m,true)});if(a.isOpera){l.onClick.add(function(i,m){m.preventDefault()})}}})(tinymce);(function(d){var e=d.each,b,a=true,c=false;d.EditorCommands=function(n){var m=n.dom,p=n.selection,j={state:{},exec:{},value:{}},k=n.settings,q=n.formatter,o;function r(z,y,x){var v;z=z.toLowerCase();if(v=j.exec[z]){v(z,y,x);return a}return c}function l(x){var v;x=x.toLowerCase();if(v=j.state[x]){return v(x)}return -1}function h(x){var v;x=x.toLowerCase();if(v=j.value[x]){return v(x)}return c}function u(v,x){x=x||"exec";e(v,function(z,y){e(y.toLowerCase().split(","),function(A){j[x][A]=z})})}d.extend(this,{execCommand:r,queryCommandState:l,queryCommandValue:h,addCommands:u});function f(y,x,v){if(x===b){x=c}if(v===b){v=null}return n.getDoc().execCommand(y,x,v)}function t(v){return q.match(v)}function s(v,x){q.toggle(v,x?{value:x}:b)}function i(v){o=p.getBookmark(v)}function g(){p.moveToBookmark(o)}u({"mceResetDesignMode,mceBeginUndoLevel":function(){},"mceEndUndoLevel,mceAddUndoLevel":function(){n.undoManager.add()},"Cut,Copy,Paste":function(z){var y=n.getDoc(),v;try{f(z)}catch(x){v=a}if(v||!y.queryCommandSupported(z)){if(d.isGecko){n.windowManager.confirm(n.getLang("clipboard_msg"),function(A){if(A){open("http://www.mozilla.org/editor/midasdemo/securityprefs.html","_blank")}})}else{n.windowManager.alert(n.getLang("clipboard_no_support"))}}},unlink:function(v){if(p.isCollapsed()){p.select(p.getNode())}f(v);p.collapse(c)},"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(v){var x=v.substring(7);e("left,center,right,full".split(","),function(y){if(x!=y){q.remove("align"+y)}});s("align"+x);r("mceRepaint")},"InsertUnorderedList,InsertOrderedList":function(y){var v,x;f(y);v=m.getParent(p.getNode(),"ol,ul");if(v){x=v.parentNode;if(/^(H[1-6]|P|ADDRESS|PRE)$/.test(x.nodeName)){i();m.split(x,v);g()}}},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(v){s(v)},"ForeColor,HiliteColor,FontName":function(y,x,v){s(y,v)},FontSize:function(z,y,x){var v,A;if(x>=1&&x<=7){A=d.explode(k.font_size_style_values);v=d.explode(k.font_size_classes);if(v){x=v[x-1]||x}else{x=A[x-1]||x}}s(z,x)},RemoveFormat:function(v){q.remove(v)},mceBlockQuote:function(v){s("blockquote")},FormatBlock:function(y,x,v){return s(v||"p")},mceCleanup:function(){var v=p.getBookmark();n.setContent(n.getContent({cleanup:a}),{cleanup:a});p.moveToBookmark(v)},mceRemoveNode:function(z,y,x){var v=x||p.getNode();if(v!=n.getBody()){i();n.dom.remove(v,a);g()}},mceSelectNodeDepth:function(z,y,x){var v=0;m.getParent(p.getNode(),function(A){if(A.nodeType==1&&v++==x){p.select(A);return c}},n.getBody())},mceSelectNode:function(y,x,v){p.select(v)},mceInsertContent:function(B,I,K){var y,J,E,z,F,G,D,C,L,x,A,M,v,H;y=n.parser;J=new d.html.Serializer({},n.schema);v='\uFEFF';G={content:K,format:"html"};p.onBeforeSetContent.dispatch(p,G);K=G.content;if(K.indexOf("{$caret}")==-1){K+="{$caret}"}K=K.replace(/\{\$caret\}/,v);if(!p.isCollapsed()){n.getDoc().execCommand("Delete",false,null)}E=p.getNode();G={context:E.nodeName.toLowerCase()};F=y.parse(K,G);A=F.lastChild;if(A.attr("id")=="mce_marker"){D=A;for(A=A.prev;A;A=A.walk(true)){if(A.type==3||!m.isBlock(A.name)){A.parent.insert(D,A,A.name==="br");break}}}if(!G.invalid){K=J.serialize(F);A=E.firstChild;M=E.lastChild;if(!A||(A===M&&A.nodeName==="BR")){m.setHTML(E,K)}else{p.setContent(K)}}else{p.setContent(v);E=p.getNode();z=n.getBody();if(E.nodeType==9){E=A=z}else{A=E}while(A!==z){E=A;A=A.parentNode}K=E==z?z.innerHTML:m.getOuterHTML(E);K=J.serialize(y.parse(K.replace(//i,function(){return J.serialize(F)})));if(E==z){m.setHTML(z,K)}else{m.setOuterHTML(E,K)}}D=m.get("mce_marker");C=m.getRect(D);L=m.getViewPort(n.getWin());if((C.y+C.h>L.y+L.h||C.yL.x+L.w||C.x")},mceToggleVisualAid:function(){n.hasVisual=!n.hasVisual;n.addVisual()},mceReplaceContent:function(y,x,v){n.execCommand("mceInsertContent",false,v.replace(/\{\$selection\}/g,p.getContent({format:"text"})))},mceInsertLink:function(z,y,x){var v;if(typeof(x)=="string"){x={href:x}}v=m.getParent(p.getNode(),"a");x.href=x.href.replace(" ","%20");if(!v||!x.href){q.remove("link")}if(x.href){q.apply("link",x,v)}},selectAll:function(){var x=m.getRoot(),v=m.createRng();if(p.getRng().setStart){v.setStart(x,0);v.setEnd(x,x.childNodes.length);p.setRng(v)}else{f("SelectAll")}}});u({"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(z){var x="align"+z.substring(7);var v=p.isCollapsed()?[m.getParent(p.getNode(),m.isBlock)]:p.getSelectedBlocks();var y=d.map(v,function(A){return !!q.matchNode(A,x)});return d.inArray(y,a)!==-1},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(v){return t(v)},mceBlockQuote:function(){return t("blockquote")},Outdent:function(){var v;if(k.inline_styles){if((v=m.getParent(p.getStart(),m.isBlock))&&parseInt(v.style.paddingLeft)>0){return a}if((v=m.getParent(p.getEnd(),m.isBlock))&&parseInt(v.style.paddingLeft)>0){return a}}return l("InsertUnorderedList")||l("InsertOrderedList")||(!k.inline_styles&&!!m.getParent(p.getNode(),"BLOCKQUOTE"))},"InsertUnorderedList,InsertOrderedList":function(x){var v=m.getParent(p.getNode(),"ul,ol");return v&&(x==="insertunorderedlist"&&v.tagName==="UL"||x==="insertorderedlist"&&v.tagName==="OL")}},"state");u({"FontSize,FontName":function(y){var x=0,v;if(v=m.getParent(p.getNode(),"span")){if(y=="fontsize"){x=v.style.fontSize}else{x=v.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()}}return x}},"value");u({Undo:function(){n.undoManager.undo()},Redo:function(){n.undoManager.redo()}})}})(tinymce);(function(b){var a=b.util.Dispatcher;b.UndoManager=function(h){var l,i=0,e=[],g,k,j,f;function c(){return b.trim(h.getContent({format:"raw",no_events:1}).replace(/]+data-mce-bogus[^>]+>[\u200B\uFEFF]+<\/span>/g,""))}function d(){l.typing=false;l.add()}onBeforeAdd=new a(l);k=new a(l);j=new a(l);f=new a(l);k.add(function(m,n){if(m.hasUndo()){return h.onChange.dispatch(h,n,m)}});j.add(function(m,n){return h.onUndo.dispatch(h,n,m)});f.add(function(m,n){return h.onRedo.dispatch(h,n,m)});h.onInit.add(function(){l.add()});h.onBeforeExecCommand.add(function(m,p,o,q,n){if(p!="Undo"&&p!="Redo"&&p!="mceRepaint"&&(!n||!n.skip_undo)){l.beforeChange()}});h.onExecCommand.add(function(m,p,o,q,n){if(p!="Undo"&&p!="Redo"&&p!="mceRepaint"&&(!n||!n.skip_undo)){l.add()}});h.onSaveContent.add(d);h.dom.bind(h.dom.getRoot(),"dragend",d);h.dom.bind(h.getBody(),"focusout",function(m){if(!h.removed&&l.typing){d()}});h.onKeyUp.add(function(m,o){var n=o.keyCode;if((n>=33&&n<=36)||(n>=37&&n<=40)||n==45||n==13||o.ctrlKey){d()}});h.onKeyDown.add(function(m,o){var n=o.keyCode;if((n>=33&&n<=36)||(n>=37&&n<=40)||n==45){if(l.typing){d()}return}if((n<16||n>20)&&n!=224&&n!=91&&!l.typing){l.beforeChange();l.typing=true;l.add()}});h.onMouseDown.add(function(m,n){if(l.typing){d()}});h.addShortcut("ctrl+z","undo_desc","Undo");h.addShortcut("ctrl+y","redo_desc","Redo");l={data:e,typing:false,onBeforeAdd:onBeforeAdd,onAdd:k,onUndo:j,onRedo:f,beforeChange:function(){g=h.selection.getBookmark(2,true)},add:function(p){var m,n=h.settings,o;p=p||{};p.content=c();l.onBeforeAdd.dispatch(l,p);o=e[i];if(o&&o.content==p.content){return null}if(e[i]){e[i].beforeBookmark=g}if(n.custom_undo_redo_levels){if(e.length>n.custom_undo_redo_levels){for(m=0;m0){n=e[--i];h.setContent(n.content,{format:"raw"});h.selection.moveToBookmark(n.beforeBookmark);l.onUndo.dispatch(l,n)}return n},redo:function(){var m;if(i0||this.typing},hasRedo:function(){return i0){g.moveEnd("character",q)}g.select()}catch(n){}}}c.nodeChanged()}}if(b.forced_root_block){c.onKeyUp.add(f);c.onNodeChange.add(f)}};(function(c){var b=c.DOM,a=c.dom.Event,d=c.each,e=c.extend;c.create("tinymce.ControlManager",{ControlManager:function(f,j){var h=this,g;j=j||{};h.editor=f;h.controls={};h.onAdd=new c.util.Dispatcher(h);h.onPostRender=new c.util.Dispatcher(h);h.prefix=j.prefix||f.id+"_";h._cls={};h.onPostRender.add(function(){d(h.controls,function(i){i.postRender()})})},get:function(f){return this.controls[this.prefix+f]||this.controls[f]},setActive:function(h,f){var g=null;if(g=this.get(h)){g.setActive(f)}return g},setDisabled:function(h,f){var g=null;if(g=this.get(h)){g.setDisabled(f)}return g},add:function(g){var f=this;if(g){f.controls[g.id]=g;f.onAdd.dispatch(g,f)}return g},createControl:function(j){var o,k,g,h=this,m=h.editor,n,f;if(!h.controlFactories){h.controlFactories=[];d(m.plugins,function(i){if(i.createControl){h.controlFactories.push(i)}})}n=h.controlFactories;for(k=0,g=n.length;k1||ag==ay||ag.tagName=="BR"){return ag}}}var aq=aa.selection.getRng();var av=aq.startContainer;var ap=aq.endContainer;if(av!=ap&&aq.endOffset===0){var au=ar(av,ap);var at=au.nodeType==3?au.length:au.childNodes.length;aq.setEnd(au,at)}return aq}function ad(at,ay,aw,av,aq){var ap=[],ar=-1,ax,aA=-1,au=-1,az;T(at.childNodes,function(aC,aB){if(aC.nodeName==="UL"||aC.nodeName==="OL"){ar=aB;ax=aC;return false}});T(at.childNodes,function(aC,aB){if(aC.nodeName==="SPAN"&&c.getAttrib(aC,"data-mce-type")=="bookmark"){if(aC.id==ay.id+"_start"){aA=aB}else{if(aC.id==ay.id+"_end"){au=aB}}}});if(ar<=0||(aAar)){T(a.grep(at.childNodes),aq);return 0}else{az=c.clone(aw,X);T(a.grep(at.childNodes),function(aC,aB){if((aAar&&aB>ar)){ap.push(aC);aC.parentNode.removeChild(aC)}});if(aAar){at.insertBefore(az,ax.nextSibling)}}av.push(az);T(ap,function(aB){az.appendChild(aB)});return az}}function an(aq,at,aw){var ap=[],av,ar,au=true;av=am.inline||am.block;ar=c.create(av);ab(ar);N.walk(aq,function(ax){var ay;function az(aA){var aF,aD,aB,aC,aE;aE=au;aF=aA.nodeName.toLowerCase();aD=aA.parentNode.nodeName.toLowerCase();if(aA.nodeType===1&&x(aA)){aE=au;au=x(aA)==="true";aC=true}if(g(aF,"br")){ay=0;if(am.block){c.remove(aA)}return}if(am.wrapper&&y(aA,ae,al)){ay=0;return}if(au&&!aC&&am.block&&!am.wrapper&&I(aF)){aA=c.rename(aA,av);ab(aA);ap.push(aA);ay=0;return}if(am.selector){T(ah,function(aG){if("collapsed" in aG&&aG.collapsed!==ai){return}if(c.is(aA,aG.selector)&&!b(aA)){ab(aA,aG);aB=true}});if(!am.inline||aB){ay=0;return}}if(au&&!aC&&d(av,aF)&&d(aD,av)&&!(!aw&&aA.nodeType===3&&aA.nodeValue.length===1&&aA.nodeValue.charCodeAt(0)===65279)&&!b(aA)){if(!ay){ay=c.clone(ar,X);aA.parentNode.insertBefore(ay,aA);ap.push(ay)}ay.appendChild(aA)}else{if(aF=="li"&&at){ay=ad(aA,at,ar,ap,az)}else{ay=0;T(a.grep(aA.childNodes),az);if(aC){au=aE}ay=0}}}T(ax,az)});if(am.wrap_links===false){T(ap,function(ax){function ay(aC){var aB,aA,az;if(aC.nodeName==="A"){aA=c.clone(ar,X);ap.push(aA);az=a.grep(aC.childNodes);for(aB=0;aB1||!H(az))&&ax===0){c.remove(az,1);return}if(am.inline||am.wrapper){if(!am.exact&&ax===1){az=ay(az)}T(ah,function(aB){T(c.select(aB.inline,az),function(aD){var aC;if(aB.wrap_links===false){aC=aD.parentNode;do{if(aC.nodeName==="A"){return}}while(aC=aC.parentNode)}Z(aB,al,aD,aB.exact?aD:null)})});if(y(az.parentNode,ae,al)){c.remove(az,1);az=0;return C}if(am.merge_with_parents){c.getParent(az.parentNode,function(aB){if(y(aB,ae,al)){c.remove(az,1);az=0;return C}})}if(az&&am.merge_siblings!==false){az=u(E(az),az);az=u(az,E(az,C))}}})}if(am){if(ag){if(ag.nodeType){ac=c.createRng();ac.setStartBefore(ag);ac.setEndAfter(ag);an(p(ac,ah),null,true)}else{an(ag,null,true)}}else{if(!ai||!am.inline||c.select("td.mceSelected,th.mceSelected").length){var ao=aa.selection.getNode();if(!m&&ah[0].defaultBlock&&!c.getParent(ao,c.isBlock)){Y(ah[0].defaultBlock)}aa.selection.setRng(af());ak=r.getBookmark();an(p(r.getRng(C),ah),ak);if(am.styles&&(am.styles.color||am.styles.textDecoration)){a.walk(ao,L,"childNodes");L(ao)}r.moveToBookmark(ak);R(r.getRng(C));aa.nodeChanged()}else{U("apply",ae,al)}}}}function B(ad,am,af){var ag=V(ad),ao=ag[0],ak,aj,ac,al=true;function ae(av){var au,at,ar,aq,ax,aw;if(av.nodeType===3){return}if(av.nodeType===1&&x(av)){ax=al;al=x(av)==="true";aw=true}au=a.grep(av.childNodes);if(al&&!aw){for(at=0,ar=ag.length;at=0;ac--){ab=ah[ac].selector;if(!ab){return C}for(ag=ad.length-1;ag>=0;ag--){if(c.is(ad[ag],ab)){return C}}}}return X}function J(ab,ae,ac){var ad;if(!P){P={};ad={};aa.onNodeChange.addToTop(function(ag,af,ai){var ah=n(ai),aj={};T(P,function(ak,al){T(ah,function(am){if(y(am,al,{},ak.similar)){if(!ad[al]){T(ak,function(an){an(true,{node:am,format:al,parents:ah})});ad[al]=ak}aj[al]=ak;return false}})});T(ad,function(ak,al){if(!aj[al]){delete ad[al];T(ak,function(am){am(false,{node:ai,format:al,parents:ah})})}})})}T(ab.split(","),function(af){if(!P[af]){P[af]=[];P[af].similar=ac}P[af].push(ae)});return this}a.extend(this,{get:V,register:l,apply:Y,remove:B,toggle:F,match:k,matchAll:v,matchNode:y,canApply:z,formatChanged:J});j();W();function h(ab,ac){if(g(ab,ac.inline)){return C}if(g(ab,ac.block)){return C}if(ac.selector){return c.is(ab,ac.selector)}}function g(ac,ab){ac=ac||"";ab=ab||"";ac=""+(ac.nodeName||ac);ab=""+(ab.nodeName||ab);return ac.toLowerCase()==ab.toLowerCase()}function O(ac,ab){var ad=c.getStyle(ac,ab);if(ab=="color"||ab=="backgroundColor"){ad=c.toHex(ad)}if(ab=="fontWeight"&&ad==700){ad="bold"}return""+ad}function q(ab,ac){if(typeof(ab)!="string"){ab=ab(ac)}else{if(ac){ab=ab.replace(/%(\w+)/g,function(ae,ad){return ac[ad]||ae})}}return ab}function f(ab){return ab&&ab.nodeType===3&&/^([\t \r\n]+|)$/.test(ab.nodeValue)}function S(ad,ac,ab){var ae=c.create(ac,ab);ad.parentNode.insertBefore(ae,ad);ae.appendChild(ad);return ae}function p(ab,am,ae){var ap,an,ah,al,ad=ab.startContainer,ai=ab.startOffset,ar=ab.endContainer,ak=ab.endOffset;function ao(aA){var au,ax,az,aw,av,at;au=ax=aA?ad:ar;av=aA?"previousSibling":"nextSibling";at=c.getRoot();function ay(aB){return aB.nodeName=="BR"&&aB.getAttribute("data-mce-bogus")&&!aB.nextSibling}if(au.nodeType==3&&!f(au)){if(aA?ai>0:akan?an:ai];if(ad.nodeType==3){ai=0}}if(ar.nodeType==1&&ar.hasChildNodes()){an=ar.childNodes.length-1;ar=ar.childNodes[ak>an?an:ak-1];if(ar.nodeType==3){ak=ar.nodeValue.length}}function aq(au){var at=au;while(at){if(at.nodeType===1&&x(at)){return x(at)==="false"?at:au}at=at.parentNode}return au}function aj(au,ay,aA){var ax,av,az,at;function aw(aC,aE){var aF,aB,aD=aC.nodeValue;if(typeof(aE)=="undefined"){aE=aA?aD.length:0}if(aA){aF=aD.lastIndexOf(" ",aE);aB=aD.lastIndexOf("\u00a0",aE);aF=aF>aB?aF:aB;if(aF!==-1&&!ae){aF++}}else{aF=aD.indexOf(" ",aE);aB=aD.indexOf("\u00a0",aE);aF=aF!==-1&&(aB===-1||aF0&&ah.node.nodeType===3&&ah.node.nodeValue.charAt(ah.offset-1)===" "){if(ah.offset>1){ar=ah.node;ar.splitText(ah.offset-1)}}}}if(am[0].inline||am[0].block_expand){if(!am[0].inline||(ad.nodeType!=3||ai===0)){ad=ao(true)}if(!am[0].inline||(ar.nodeType!=3||ak===ar.nodeValue.length)){ar=ao()}}if(am[0].selector&&am[0].expand!==X&&!am[0].inline){ad=af(ad,"previousSibling");ar=af(ar,"nextSibling")}if(am[0].block||am[0].selector){ad=ac(ad,"previousSibling");ar=ac(ar,"nextSibling");if(am[0].block){if(!H(ad)){ad=ao(true)}if(!H(ar)){ar=ao()}}}if(ad.nodeType==1){ai=s(ad);ad=ad.parentNode}if(ar.nodeType==1){ak=s(ar)+1;ar=ar.parentNode}return{startContainer:ad,startOffset:ai,endContainer:ar,endOffset:ak}}function Z(ah,ag,ae,ab){var ad,ac,af;if(!h(ae,ah)){return X}if(ah.remove!="all"){T(ah.styles,function(aj,ai){aj=q(aj,ag);if(typeof(ai)==="number"){ai=aj;ab=0}if(!ab||g(O(ab,ai),aj)){c.setStyle(ae,ai,"")}af=1});if(af&&c.getAttrib(ae,"style")==""){ae.removeAttribute("style");ae.removeAttribute("data-mce-style")}T(ah.attributes,function(ak,ai){var aj;ak=q(ak,ag);if(typeof(ai)==="number"){ai=ak;ab=0}if(!ab||g(c.getAttrib(ab,ai),ak)){if(ai=="class"){ak=c.getAttrib(ae,ai);if(ak){aj="";T(ak.split(/\s+/),function(al){if(/mce\w+/.test(al)){aj+=(aj?" ":"")+al}});if(aj){c.setAttrib(ae,ai,aj);return}}}if(ai=="class"){ae.removeAttribute("className")}if(e.test(ai)){ae.removeAttribute("data-mce-"+ai)}ae.removeAttribute(ai)}});T(ah.classes,function(ai){ai=q(ai,ag);if(!ab||c.hasClass(ab,ai)){c.removeClass(ae,ai)}});ac=c.getAttribs(ae);for(ad=0;adad?ad:af]}if(ab.nodeType===3&&ag&&af>=ab.nodeValue.length){ab=new t(ab,aa.getBody()).next()||ab}if(ab.nodeType===3&&!ag&&af===0){ab=new t(ab,aa.getBody()).prev()||ab}return ab}function U(ak,ab,ai){var al="_mce_caret",ac=aa.settings.caret_debug;function ad(ap){var ao=c.create("span",{id:al,"data-mce-bogus":true,style:ac?"color:red":""});if(ap){ao.appendChild(aa.getDoc().createTextNode(G))}return ao}function aj(ap,ao){while(ap){if((ap.nodeType===3&&ap.nodeValue!==G)||ap.childNodes.length>1){return false}if(ao&&ap.nodeType===1){ao.push(ap)}ap=ap.firstChild}return true}function ag(ao){while(ao){if(ao.id===al){return ao}ao=ao.parentNode}}function af(ao){var ap;if(ao){ap=new t(ao,ao);for(ao=ap.current();ao;ao=ap.next()){if(ao.nodeType===3){return ao}}}}function ae(aq,ap){var ar,ao;if(!aq){aq=ag(r.getStart());if(!aq){while(aq=c.get(al)){ae(aq,false)}}}else{ao=r.getRng(true);if(aj(aq)){if(ap!==false){ao.setStartBefore(aq);ao.setEndBefore(aq)}c.remove(aq)}else{ar=af(aq);if(ar.nodeValue.charAt(0)===G){ar=ar.deleteData(0,1)}c.remove(aq,1)}r.setRng(ao)}}function ah(){var aq,ao,av,au,ar,ap,at;aq=r.getRng(true);au=aq.startOffset;ap=aq.startContainer;at=ap.nodeValue;ao=ag(r.getStart());if(ao){av=af(ao)}if(at&&au>0&&au=0;at--){aq.appendChild(c.clone(ax[at],false));aq=aq.firstChild}aq.appendChild(c.doc.createTextNode(G));aq=aq.firstChild;c.insertAfter(aw,ay);r.setCursorLocation(aq,1)}}function an(){var ap,ao,aq;ao=ag(r.getStart());if(ao&&!c.isEmpty(ao)){a.walk(ao,function(ar){if(ar.nodeType==1&&ar.id!==al&&!c.isEmpty(ar)){c.setAttrib(ar,"data-mce-bogus",null)}},"childNodes")}}if(!self._hasCaretEvents){aa.onBeforeGetContent.addToTop(function(){var ao=[],ap;if(aj(ag(r.getStart()),ao)){ap=ao.length;while(ap--){c.setAttrib(ao[ap],"data-mce-bogus","1")}}});a.each("onMouseUp onKeyUp".split(" "),function(ao){aa[ao].addToTop(function(){ae();an()})});aa.onKeyDown.addToTop(function(ao,aq){var ap=aq.keyCode;if(ap==8||ap==37||ap==39){ae(ag(r.getStart()))}an()});r.onSetContent.add(an);self._hasCaretEvents=true}if(ak=="apply"){ah()}else{am()}}function R(ac){var ab=ac.startContainer,ai=ac.startOffset,ae,ah,ag,ad,af;if(ab.nodeType==3&&ai>=ab.nodeValue.length){ai=s(ab);ab=ab.parentNode;ae=true}if(ab.nodeType==1){ad=ab.childNodes;ab=ad[Math.min(ai,ad.length-1)];ah=new t(ab,c.getParent(ab,c.isBlock));if(ai>ad.length-1||ae){ah.next()}for(ag=ah.current();ag;ag=ah.next()){if(ag.nodeType==3&&!f(ag)){af=c.create("a",null,G);ag.parentNode.insertBefore(af,ag);ac.setStart(ag,0);r.setRng(ac);c.remove(af);return}}}}}})(tinymce);tinymce.onAddEditor.add(function(e,a){var d,h,g,c=a.settings;function b(j,i){e.each(i,function(l,k){if(l){g.setStyle(j,k,l)}});g.rename(j,"span")}function f(i,j){g=i.dom;if(c.convert_fonts_to_spans){e.each(g.select("font,u,strike",j.node),function(k){d[k.nodeName.toLowerCase()](a.dom,k)})}}if(c.inline_styles){h=e.explode(c.font_size_legacy_values);d={font:function(j,i){b(i,{backgroundColor:i.style.backgroundColor,color:i.color,fontFamily:i.face,fontSize:h[parseInt(i.size,10)-1]})},u:function(j,i){b(i,{textDecoration:"underline"})},strike:function(j,i){b(i,{textDecoration:"line-through"})}};a.onPreProcess.add(f);a.onSetContent.add(f);a.onInit.add(function(){a.selection.onSetContent.add(f)})}});(function(b){var a=b.dom.TreeWalker;b.EnterKey=function(f){var i=f.dom,e=f.selection,d=f.settings,h=f.undoManager,c=f.schema.getNonEmptyElements();function g(A){var v=e.getRng(true),G,j,z,u,p,M,B,o,k,n,t,J,x,C;function E(N){return N&&i.isBlock(N)&&!/^(TD|TH|CAPTION|FORM)$/.test(N.nodeName)&&!/^(fixed|absolute)/i.test(N.style.position)&&i.getContentEditable(N)!=="true"}function F(O){var N;if(b.isIE&&i.isBlock(O)){N=e.getRng();O.appendChild(i.create("span",null,"\u00a0"));e.select(O);O.lastChild.outerHTML="";e.setRng(N)}}function y(P){var O=P,Q=[],N;while(O=O.firstChild){if(i.isBlock(O)){return}if(O.nodeType==1&&!c[O.nodeName.toLowerCase()]){Q.push(O)}}N=Q.length;while(N--){O=Q[N];if(!O.hasChildNodes()||(O.firstChild==O.lastChild&&O.firstChild.nodeValue==="")){i.remove(O)}else{if(O.nodeName=="A"&&(O.innerText||O.textContent)===" "){i.remove(O)}}}}function m(O){var T,R,N,U,S,Q=O,P;N=i.createRng();if(O.hasChildNodes()){T=new a(O,O);while(R=T.current()){if(R.nodeType==3){N.setStart(R,0);N.setEnd(R,0);break}if(c[R.nodeName.toLowerCase()]){N.setStartBefore(R);N.setEndBefore(R);break}Q=R;R=T.next()}if(!R){N.setStart(Q,0);N.setEnd(Q,0)}}else{if(O.nodeName=="BR"){if(O.nextSibling&&i.isBlock(O.nextSibling)){if(!M||M<9){P=i.create("br");O.parentNode.insertBefore(P,O)}N.setStartBefore(O);N.setEndBefore(O)}else{N.setStartAfter(O);N.setEndAfter(O)}}else{N.setStart(O,0);N.setEnd(O,0)}}e.setRng(N);i.remove(P);S=i.getViewPort(f.getWin());U=i.getPos(O).y;if(US.y+S.h){f.getWin().scrollTo(0,U'}return R}function q(Q){var P,O,N;if(z.nodeType==3&&(Q?u>0:u=z.nodeValue.length){if(!b.isIE&&!D()){P=i.create("br");v.insertNode(P);v.setStartAfter(P);v.setEndAfter(P);O=true}}P=i.create("br");v.insertNode(P);if(b.isIE&&t=="PRE"&&(!M||M<8)){P.parentNode.insertBefore(i.doc.createTextNode("\r"),P)}N=i.create("span",{}," ");P.parentNode.insertBefore(N,P);e.scrollIntoView(N);i.remove(N);if(!O){v.setStartAfter(P);v.setEndAfter(P)}else{v.setStartBefore(P);v.setEndBefore(P)}e.setRng(v);h.add()}function s(N){do{if(N.nodeType===3){N.nodeValue=N.nodeValue.replace(/^[\r\n]+/,"")}N=N.firstChild}while(N)}function K(P){var N=i.getRoot(),O,Q;O=P;while(O!==N&&i.getContentEditable(O)!=="false"){if(i.getContentEditable(O)==="true"){Q=O}O=O.parentNode}return O!==N?Q:N}function I(O){var N;if(!b.isIE){O.normalize();N=O.lastChild;if(!N||(/^(left|right)$/gi.test(i.getStyle(N,"float",true)))){i.add(O,"br")}}}if(!v.collapsed){f.execCommand("Delete");return}if(A.isDefaultPrevented()){return}z=v.startContainer;u=v.startOffset;x=(d.force_p_newlines?"p":"")||d.forced_root_block;x=x?x.toUpperCase():"";M=i.doc.documentMode;B=A.shiftKey;if(z.nodeType==1&&z.hasChildNodes()){C=u>z.childNodes.length-1;z=z.childNodes[Math.min(u,z.childNodes.length-1)]||z;if(C&&z.nodeType==3){u=z.nodeValue.length}else{u=0}}j=K(z);if(!j){return}h.beforeChange();if(!i.isBlock(j)&&j!=i.getRoot()){if(!x||B){L()}return}if((x&&!B)||(!x&&B)){z=l(z,u)}p=i.getParent(z,i.isBlock);n=p?i.getParent(p.parentNode,i.isBlock):null;t=p?p.nodeName.toUpperCase():"";J=n?n.nodeName.toUpperCase():"";if(J=="LI"&&!A.ctrlKey){p=n;t=J}if(t=="LI"){if(!x&&B){L();return}if(i.isEmpty(p)){if(/^(UL|OL|LI)$/.test(n.parentNode.nodeName)){return false}H();return}}if(t=="PRE"&&d.br_in_pre!==false){if(!B){L();return}}else{if((!x&&!B&&t!="LI")||(x&&B)){L();return}}x=x||"P";if(q()){if(/^(H[1-6]|PRE)$/.test(t)&&J!="HGROUP"){o=r(x)}else{o=r()}if(d.end_container_on_empty_block&&E(n)&&i.isEmpty(p)){o=i.split(n,p)}else{i.insertAfter(o,p)}m(o)}else{if(q(true)){o=p.parentNode.insertBefore(r(),p);F(o)}else{G=v.cloneRange();G.setEndAfter(p);k=G.extractContents();s(k);o=k.firstChild;i.insertAfter(k,p);y(o);I(p);m(o)}}i.setAttrib(o,"id","");h.add()}f.onKeyDown.add(function(k,j){if(j.keyCode==13){if(g(j)!==false){j.preventDefault()}}})}})(tinymce); ================================================ FILE: static/js/tinymce/tiny_mce_popup.js ================================================ // Uncomment and change this document.domain value if you are loading the script cross subdomains // document.domain = 'moxiecode.com'; var tinymce=null,tinyMCEPopup,tinyMCE;tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document,{ownEvents:true,proxy:tinyMCEPopup._eventProxy});b.dom.bind(window,"ready",b._onDOMLoaded,b);if(b.features.popup_css!==false){b.dom.loadCSS(b.features.popup_css||b.editor.settings.popup_css)}b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.getWindowArg("mce_window_id");b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return(!window.frameElement&&window.dialogArguments)||opener||parent||top},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var a=this;setTimeout(function(){var b=a.dom.getViewPort(window);a.editor.windowManager.resizeBy(a.getWindowArg("mce_width")-b.w,a.getWindowArg("mce_height")-b.h,a.id||window)},10)},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false&&b.editor.settings.language_load!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('
    <%- include("top.ejs") %> <%- include("navigation.ejs") %>
    <% var form_show = "W"; %>
    Title
    <%= formatDate( new Date() ) %> Naam
    <%- include("footer.ejs") %>
    ================================================ FILE: views/cms/contacts.ejs ================================================ <%- include("header.ejs") %>
    <%- include("top.ejs") %> <%- include("navigation.ejs") %>
    <% if ((typeof records === "undefined") && (typeof record !== "undefined")) { %>
    =0) %> /> =0) %> /> =0) %> />
    /> />
    /> />
    <% if (record.id > 0) { %> <% } %>
    <% } %> <% if (typeof records != "undefined") { %>
    =0) %> /> =0) %> /> =0) %> />
    <% model.loopLabelList( function(label) { %> <% }); %> <% for (var i=0; i < records.length; i++) { var u = records[i]; %> > <% } %>
    <%=label%>
    <%= (u.name==='') ? '--' : u.name %> <%= u.cie %> <%- (u.nomail=='N') ? '' : '(' %><%= u.email %><%- (u.nomail=='N') ? '' : ')' %> <%= u.phone %>
    <% } %> <%- include("footer.ejs") %>
    ================================================ FILE: views/cms/content-type.ejs ================================================ ================================================ FILE: views/cms/dashboard.ejs ================================================ <%- include("header.ejs") %>
    <%- include("top.ejs") %>
    <% if (login) { %> <% } else { %>

    Login first

    <% } %> <%- include("footer.ejs") %>
    ================================================ FILE: views/cms/files-ajax.ejs ================================================

    <%= __("Created")%>: <%= formatDate(atom.created) %> @ <%= formatTime(atom.created) %>
    <%= __("Last Modified")%>: <%= formatDate(atom.updated) %> @ <%= formatTime(atom.updated) %>

    <% if(atom.extention == '') { %> <% } else { %>
    <% if ( ( atom.extention != 'xxx') && ( atom.extention != '---')) { %>
    <% } %> <% if ((atom.extention != 'xxx') && (atom.extention != '') && (atom.extention != '---')) { %>
    <%= atom.getFileName() %>
    <% } %>
    <% } %>
    ================================================ FILE: views/cms/files.ejs ================================================ <%- include("header.ejs") %>
    <%- include("top.ejs") %> <%- include("navigation.ejs") %>

    •  Files <%- controller.getTree() %>
    <%- include("footer.ejs") %>
    ================================================ FILE: views/cms/footer.ejs ================================================

    <%=version %>

    ================================================ FILE: views/cms/forms-ajax.ejs ================================================
    <% if (atom.extention === "") { %>
    <% for (var iL in app.languages) { var L = app.languages[iL]; %>
    <% } %> <% } else { %>
    />
    /> /> />
    /> />
    <% for (var iL in app.languages) { var L = app.languages[iL]; %>
    <% } %> <% } %>
    ================================================ FILE: views/cms/forms-data.ejs ================================================
    > > > >
    Created: <%= formatDate(data.created) %> <%= formatTime(data.created) %> <% if ((typeof data.modified !== "undefined") && (data.modified)) { %> - Modified: <%= formatDate(data.modified) %> <%= formatTime(data.modified) %> <% } %>
    <% var label = {}; label[page.language] = "Save"; %> <% var CancelAndDelete = ""; %> <%- meta.html( page.language, { name: "Edit", options: {}, extraButtons: CancelAndDelete, labels: label }) %>
    ================================================ FILE: views/cms/forms-list.ejs ================================================ <%- include("header.ejs") %>
    <%- include("top.ejs") %> <%- include("navigation.ejs") %>
    <% var curr = -1; for (var i in data) { %> <% if (curr != data[i].atom) { curr = data[i].atom; var thisAtom = app.getAtom(data[i].atom); %> <% } %> <% } %>
    <%= thisAtom.name %>
    <%= formatDate(data[i].created) %> <%= data[i].statusname %> <%= (typeof data[i].data.name !== "undefined") ? data[i].data.name : (typeof data[i].data.Name !== "undefined") ? data[i].data.Name : (typeof data[i].data.naam !== "undefined") ? data[i].data.naam : (typeof data[i].data.Naam !== "undefined") ? data[i].data.Naam : (getKeyByIndex(data[i].data, 0) + ": " + getValueByIndex(data[i].data, 0)) %>
    <%- include("footer.ejs") %>
    ================================================ FILE: views/cms/forms.ejs ================================================ <%- include("header.ejs") %>
    <%- include("top.ejs") %> <%- include("navigation.ejs") %>

    •  Forms <%- controller.getTree() %>
    <%- include("footer.ejs") %>
    ================================================ FILE: views/cms/header.ejs ================================================ cody admin: <%=page.title%> ================================================ FILE: views/cms/images-ajax.ejs ================================================

    <%= __('Created')%>: <%= formatDate(atom.created) %> @ <%= formatTime(atom.created) %>
    <%= __('Last Modified')%> : <%= formatDate(atom.updated) %> @ <%= formatTime(atom.updated) %>

    <% if(atom.extention == '') { %> <% } else { %> <% if (( atom.extention != 'xxx') && ( atom.extention != '---')) { %>
    <% } %>
    <% if (atom.extention != 'xxx') { %>
    <% } %> <% if ((atom.extention != 'xxx') && (atom.extention != '') && (atom.extention != '---')) { %>
    <% } %> <% } %>
    ================================================ FILE: views/cms/images.ejs ================================================ <%- include("header.ejs") %>
    <%- include("top.ejs") %> <%- include("navigation.ejs") %>

    <%- include("footer.ejs") %>
    ================================================ FILE: views/cms/navigation.ejs ================================================ <% if (message !== "") { %>

    <%= __(message) %>

    <% if (status === "success") { %> <% } %> <% } %> ================================================ FILE: views/cms/pages-ajax.ejs ================================================

    <%= __('Intro')%>

    <% var prev = "X"; for (var ic in page.content) { var c = page.content[ic]; if ((prev != c.intro) && (c.intro == "N")) { prev = c.intro; %>

    <%= __('Main')%>

    <% } %>
    <% if (c.kind == "T") { %>
    <%= c.name %>

    <%= __('Move')%>
    <% } else if (c.kind == "M") { %>
    <%= __('Move')%>
    <% } else if (c.kind == "S") { %>
    <%= c.name %>
    <%= __('Move')%>
    <% } else if (c.kind == "B") { %>
    Facebook 'like' - URL (empty = current)
    <%= __('Move')%>Move
    <% } else if (c.kind == "H") { %>
    Facebook 'share' - URL (empty = current)
    <%= __('Move')%>
    <% } else if (c.kind == "F") { %>
    <% if ((typeof c.atom != "undefined") && (c.atomId != 0)) { %> <% if ((c.atom.extention !== "") && (c.atom.extention !== "xxx")) { %> <%= c.atom.name %>.<%= c.atom.extention %> <% } else { %> <%= c.atom.name %> <% } %> <% } else { %> - none - <% } %>
    <%= __('Move')%>
    <% } else if (c.kind == "I") { %>
    <% if (c.atomId != 0) { %> <%=c.atom.name%>.<%=c.atom.extention%> <% } else { %> - none - <% } %>
    <%= __('Move')%>
    <% } else { %>
    <%= c.name %>
    <%= __('Move')%>
    <% } %>
    <% } %> <% if ((prev === "X") || (prev === "Y")) { %>

    <%= __('Main')%>

    <% } %>
    <% if ((login.level >= 99) && (page.link != 'global')) { %> <% } %>
    /<%=page.language%>/ (/<%= page.language %>/<%= page.item.id %>)
    /> <% if (login.level >= 50) { %> /> <% } else { %> <% } %>
    <% if (login && (login.level >= 99)) { %>
    <% } else { %> <% } %>
    <% if (login && (login.level >= 99)) { %> <% } else { %> <% } %>
    <% if (login.level >= 50) { %>
    <% } else { %> <% } %>
    <% if (! page.isActive()) { %> <% } %> <%= __('Last Modified')%>: <%= formatDate(page.updated) %>
    ================================================ FILE: views/cms/pages.ejs ================================================ <%- include("header.ejs") %>
    <%- include("top.ejs") %> <%- include("navigation.ejs") %>
    <% if (opennode != 0) { %> <% var currPage = page; %> <% page = app.getPage(currPage.language, opennode); %> <%- include("pages-ajax.ejs") %> <% page = currPage; %> <% } %>
    <%- include("footer.ejs") %>
    <%- include("content-type.ejs") %>

    <%= __('Show')%>


    <%= __('Add a web page')%>

    <% for (var iT in app.templates) { var T = app.templates[iT]; %> <% if (T.system === "N") { %>
    <% } %> <% } %> <% if (login.level > 50) { %>

    Add a system page

    <% for (var iT in app.templates) { var T = app.templates[iT]; %> <% if (T.system === "Y") { %>
    <% } %> <% } %> <% } %>
    ================================================ FILE: views/cms/styles.ejs ================================================ <%- include("header.ejs") %>
    <%- include("top.ejs") %> <%- include("navigation.ejs") %>
    <% if (message == "logo-updated") { %>

    The logo has been updated.

    <% } %> <% if (message == "logo-unsupported-format") { %>

    The format of the uploaded file is unsupported.

    <% } %> <% if (message == "logo-none-selected") { %>

    No files was selected.

    <% } %>

    Logo changer

    Please select a new logo file (PNG only for now)


    CSS Changer

    <% if (message == "css-updated") { %>

    The CSS has been updated.

    <% } %> <% if (message == "css-update-failed") { %>

    The CSS could not be updated.

    <% } %>
    ================================================ FILE: views/cms/system.ejs ================================================ <%- include("header.ejs") %>
    <%- include("top.ejs") %> <%- include("navigation.ejs") %>
    <% if (typeof config !== "undefined") { %>

    Change System settings (better done in config.json)

    Warning: When changing the hostname, make sure you can still reach your site.
    You can give more than 1 name, separating with comma's. Ex:"old-name.org,new-name.org,www.new-name.org".

    <% } %>
    <%- include("footer.ejs") %>
    ================================================ FILE: views/cms/templates.ejs ================================================ <%- include("header.ejs") %>
    <%- include("top.ejs") %> <%- include("navigation.ejs") %>
    <% if (typeof template != "undefined") { %>
    /> />
    <% if (template.id > 0) { %> <% } %>
    <% } %> <% if (typeof templates != "undefined") { %> <% } %>
    <%- include("footer.ejs") %>
    <% if (typeof template != "undefined") { %> <%- include("content-type.ejs") %> <% } %> ================================================ FILE: views/cms/top.ejs ================================================ <% if (page.parent && isLoggedIn()) { %> <%= __("Dashboard")%> » <%=page.parent.title%> <% } %>
    <%= __("Help")%> <% if (isLoggedIn()) { %> <%= __("Account")%> <%= __("Sign out")%> <% } %>
    ================================================ FILE: views/cms/users.ejs ================================================ <%- include("header.ejs") %>
    <%- include("top.ejs") %> <%- include("navigation.ejs") %>
    <% if (typeof user != "undefined") { %>
    class="required" <% } %> /> <% if (user.id > 0) { %> <%= __("Leave empty if you don't want to change your password.")%> <% } %>
    /> />
    /> />
    <% if (user.id > 0) { %> <% } %>
    <% } %> <% if (typeof users != "undefined") { %> <% } %>
    <%- include("footer.ejs") %>
    ================================================ FILE: views/front/index.ejs ================================================ Unit testing.

    Controller

    <%- context.cody.unitTests.controller(context) %>

    Path

    enzo verder...
    Johan.
    ================================================ FILE: views/login.ejs ================================================ <%- include("./cms/header.ejs") %>
    <%- include("./cms/top.ejs") %> <%- include("./cms/navigation.ejs") %>
    <% if (isLoggedIn()) { %>

    <%=session.login.name%>

    <%= __("Logout")%> <% } else { %>

    <%= __("Before you can access this requested page you first need to login.")%>

    /<%=page.language%>/login" name="logon" id="logon" method="post" class="clearfix">
    <% if (message == "login-failed") { %>

    <%= __("Wrong username of password, please try again.")%>

    <% } else if (message == "login-locked") { %>

    <%= __("Your username is blocked, please take contact with your site builder.")%>

    <% } %>
    " />
    <% } %> <% if (message == "logout") { %>

    You've been logged out.

    <% } %>