Commit 6030289b468d2257b319634de7aafa6ece7c4138

Authored by AntonioTerceiro
1 parent 0563f261

ActionItem64: adding TinyMCE



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@573 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing 425 changed files with 33872 additions and 3 deletions   Show diff stats

Too many changes.

To preserve performance only 100 of 425 files displayed.

app/helpers/application_helper.rb
@@ -198,7 +198,11 @@ module ApplicationHelper @@ -198,7 +198,11 @@ module ApplicationHelper
198 def text_editor(object, method, filter_type_method, options = {}) 198 def text_editor(object, method, filter_type_method, options = {})
199 filter_type = instance_variable_get("@#{object}").send(filter_type_method) 199 filter_type = instance_variable_get("@#{object}").send(filter_type_method)
200 if filter_type == '[No Filter]' || filter_type.blank? 200 if filter_type == '[No Filter]' || filter_type.blank?
201 - fckeditor_textarea(object, method, options.merge({:toolbarSet => 'Simple', :height => '300px'})) 201 + html_class = "tiny_mce_editor"
  202 + if options[:class]
  203 + html_class << " #{options[:class]}"
  204 + end
  205 + text_area(object, method, { :rows => 12, :columns => 72 }.merge(options).merge({:class => html_class}))
202 else 206 else
203 text_area(object, method, { :rows => 12, :columns => 72 }.merge(options)) 207 text_area(object, method, { :rows => 12, :columns => 72 }.merge(options))
204 end 208 end
app/views/layouts/application.rhtml
1 <html> 1 <html>
2 <head> 2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
4 - <%= javascript_include_tag :defaults %> 4 +
  5 + <%= javascript_include_tag 'prototype' %>
  6 + <%= javascript_include_tag 'tiny_mce/tiny_mce.js' %>
  7 + <%= javascript_include_tag 'scriptaculous' %>
  8 + <%= javascript_include_tag 'dragdrop' %>
  9 + <%= javascript_include_tag 'effects' %>
  10 + <%= javascript_include_tag 'noosfero_tiny_mce.js' %>
  11 + <script language="javascript" type="text/javascript">
  12 + tinyMCE.init({
  13 + mode : "textareas",
  14 + theme : "advanced",
  15 + theme_advanced_toolbar_location : "top",
  16 + });
  17 + </script>
  18 +
5 <%= design_all_header_tags %> 19 <%= design_all_header_tags %>
6 <%= javascript_include_tag 'cms' %> 20 <%= javascript_include_tag 'cms' %>
7 <% if params[:controller] == 'cms' %> 21 <% if params[:controller] == 'cms' %>
8 <%= stylesheet_link_tag 'cms' %> 22 <%= stylesheet_link_tag 'cms' %>
9 - <%= javascript_include_tag 'fckeditor/fckeditor.js' %>  
10 <% end %> 23 <% end %>
11 <%= stylesheet_link_tag 'common' %> 24 <%= stylesheet_link_tag 'common' %>
12 25
13 <%= stylesheet_link_tag 'menu' %> 26 <%= stylesheet_link_tag 'menu' %>
14 <%= javascript_include_tag 'menu' %> 27 <%= javascript_include_tag 'menu' %>
  28 +
15 </head> 29 </head>
16 30
17 <body onload='javascript: if (document.forms[0] != null && document.forms[0].elements[0] != null) { document.forms[0].elements[0].focus(); }'> 31 <body onload='javascript: if (document.forms[0] != null && document.forms[0].elements[0] != null) { document.forms[0].elements[0].focus(); }'>
public/javascripts/noosfero_tiny_mce.js 0 → 100644
@@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
  1 +tinyMCE.init({
  2 + theme : "simple",
  3 + editor_selector : "tiny_mce_editor"
  4 +});
public/javascripts/tiny_mce/blank.htm 0 → 100755
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +<html xmlns="http://www.w3.org/1999/xhtml">
  2 +<head>
  3 + <title>blank_page</title>
  4 + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5 +</head>
  6 +<body class="mceContentBody">
  7 +
  8 +</body>
  9 +</html>
public/javascripts/tiny_mce/langs/en.js 0 → 100755
@@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
  1 +// UK lang variables
  2 +
  3 +tinyMCE.addToLang('',{
  4 +bold_desc : 'Bold (Ctrl+B)',
  5 +italic_desc : 'Italic (Ctrl+I)',
  6 +underline_desc : 'Underline (Ctrl+U)',
  7 +striketrough_desc : 'Strikethrough',
  8 +justifyleft_desc : 'Align left',
  9 +justifycenter_desc : 'Align center',
  10 +justifyright_desc : 'Align right',
  11 +justifyfull_desc : 'Align full',
  12 +bullist_desc : 'Unordered list',
  13 +numlist_desc : 'Ordered list',
  14 +outdent_desc : 'Outdent',
  15 +indent_desc : 'Indent',
  16 +undo_desc : 'Undo (Ctrl+Z)',
  17 +redo_desc : 'Redo (Ctrl+Y)',
  18 +link_desc : 'Insert/edit link',
  19 +unlink_desc : 'Unlink',
  20 +image_desc : 'Insert/edit image',
  21 +cleanup_desc : 'Cleanup messy code',
  22 +focus_alert : 'A editor instance must be focused before using this command.',
  23 +edit_confirm : 'Do you want to use the WYSIWYG mode for this textarea?',
  24 +insert_link_title : 'Insert/edit link',
  25 +insert : 'Insert',
  26 +update : 'Update',
  27 +cancel : 'Cancel',
  28 +insert_link_url : 'Link URL',
  29 +insert_link_target : 'Target',
  30 +insert_link_target_same : 'Open link in the same window',
  31 +insert_link_target_blank : 'Open link in a new window',
  32 +insert_image_title : 'Insert/edit image',
  33 +insert_image_src : 'Image URL',
  34 +insert_image_alt : 'Image description',
  35 +help_desc : 'Help',
  36 +bold_img : "bold.gif",
  37 +italic_img : "italic.gif",
  38 +underline_img : "underline.gif",
  39 +clipboard_msg : 'Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?',
  40 +popup_blocked : 'Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.'
  41 +});
public/javascripts/tiny_mce/langs/readme.txt 0 → 100755
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +Beginning with version 2.0.5 the language packs are no
  2 +longer included with the core distribution.
  3 +Language packs can be downloaded from the TinyMCE website:
  4 +http://tinymce.moxiecode.com/download.php
  5 +
  6 +The language pack codes are based on ISO-639-1:
  7 +http://www.loc.gov/standards/iso639-2/englangn.html
  8 +
  9 +Plrease try using entities if possible. Like &aring; etc for non a-z characters.
public/javascripts/tiny_mce/license.txt 0 → 100755
@@ -0,0 +1,504 @@ @@ -0,0 +1,504 @@
  1 + GNU LESSER GENERAL PUBLIC LICENSE
  2 + Version 2.1, February 1999
  3 +
  4 + Copyright (C) 1991, 1999 Free Software Foundation, Inc.
  5 + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  6 + Everyone is permitted to copy and distribute verbatim copies
  7 + of this license document, but changing it is not allowed.
  8 +
  9 +[This is the first released version of the Lesser GPL. It also counts
  10 + as the successor of the GNU Library Public License, version 2, hence
  11 + the version number 2.1.]
  12 +
  13 + Preamble
  14 +
  15 + The licenses for most software are designed to take away your
  16 +freedom to share and change it. By contrast, the GNU General Public
  17 +Licenses are intended to guarantee your freedom to share and change
  18 +free software--to make sure the software is free for all its users.
  19 +
  20 + This license, the Lesser General Public License, applies to some
  21 +specially designated software packages--typically libraries--of the
  22 +Free Software Foundation and other authors who decide to use it. You
  23 +can use it too, but we suggest you first think carefully about whether
  24 +this license or the ordinary General Public License is the better
  25 +strategy to use in any particular case, based on the explanations below.
  26 +
  27 + When we speak of free software, we are referring to freedom of use,
  28 +not price. Our General Public Licenses are designed to make sure that
  29 +you have the freedom to distribute copies of free software (and charge
  30 +for this service if you wish); that you receive source code or can get
  31 +it if you want it; that you can change the software and use pieces of
  32 +it in new free programs; and that you are informed that you can do
  33 +these things.
  34 +
  35 + To protect your rights, we need to make restrictions that forbid
  36 +distributors to deny you these rights or to ask you to surrender these
  37 +rights. These restrictions translate to certain responsibilities for
  38 +you if you distribute copies of the library or if you modify it.
  39 +
  40 + For example, if you distribute copies of the library, whether gratis
  41 +or for a fee, you must give the recipients all the rights that we gave
  42 +you. You must make sure that they, too, receive or can get the source
  43 +code. If you link other code with the library, you must provide
  44 +complete object files to the recipients, so that they can relink them
  45 +with the library after making changes to the library and recompiling
  46 +it. And you must show them these terms so they know their rights.
  47 +
  48 + We protect your rights with a two-step method: (1) we copyright the
  49 +library, and (2) we offer you this license, which gives you legal
  50 +permission to copy, distribute and/or modify the library.
  51 +
  52 + To protect each distributor, we want to make it very clear that
  53 +there is no warranty for the free library. Also, if the library is
  54 +modified by someone else and passed on, the recipients should know
  55 +that what they have is not the original version, so that the original
  56 +author's reputation will not be affected by problems that might be
  57 +introduced by others.
  58 +
  59 + Finally, software patents pose a constant threat to the existence of
  60 +any free program. We wish to make sure that a company cannot
  61 +effectively restrict the users of a free program by obtaining a
  62 +restrictive license from a patent holder. Therefore, we insist that
  63 +any patent license obtained for a version of the library must be
  64 +consistent with the full freedom of use specified in this license.
  65 +
  66 + Most GNU software, including some libraries, is covered by the
  67 +ordinary GNU General Public License. This license, the GNU Lesser
  68 +General Public License, applies to certain designated libraries, and
  69 +is quite different from the ordinary General Public License. We use
  70 +this license for certain libraries in order to permit linking those
  71 +libraries into non-free programs.
  72 +
  73 + When a program is linked with a library, whether statically or using
  74 +a shared library, the combination of the two is legally speaking a
  75 +combined work, a derivative of the original library. The ordinary
  76 +General Public License therefore permits such linking only if the
  77 +entire combination fits its criteria of freedom. The Lesser General
  78 +Public License permits more lax criteria for linking other code with
  79 +the library.
  80 +
  81 + We call this license the "Lesser" General Public License because it
  82 +does Less to protect the user's freedom than the ordinary General
  83 +Public License. It also provides other free software developers Less
  84 +of an advantage over competing non-free programs. These disadvantages
  85 +are the reason we use the ordinary General Public License for many
  86 +libraries. However, the Lesser license provides advantages in certain
  87 +special circumstances.
  88 +
  89 + For example, on rare occasions, there may be a special need to
  90 +encourage the widest possible use of a certain library, so that it becomes
  91 +a de-facto standard. To achieve this, non-free programs must be
  92 +allowed to use the library. A more frequent case is that a free
  93 +library does the same job as widely used non-free libraries. In this
  94 +case, there is little to gain by limiting the free library to free
  95 +software only, so we use the Lesser General Public License.
  96 +
  97 + In other cases, permission to use a particular library in non-free
  98 +programs enables a greater number of people to use a large body of
  99 +free software. For example, permission to use the GNU C Library in
  100 +non-free programs enables many more people to use the whole GNU
  101 +operating system, as well as its variant, the GNU/Linux operating
  102 +system.
  103 +
  104 + Although the Lesser General Public License is Less protective of the
  105 +users' freedom, it does ensure that the user of a program that is
  106 +linked with the Library has the freedom and the wherewithal to run
  107 +that program using a modified version of the Library.
  108 +
  109 + The precise terms and conditions for copying, distribution and
  110 +modification follow. Pay close attention to the difference between a
  111 +"work based on the library" and a "work that uses the library". The
  112 +former contains code derived from the library, whereas the latter must
  113 +be combined with the library in order to run.
  114 +
  115 + GNU LESSER GENERAL PUBLIC LICENSE
  116 + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  117 +
  118 + 0. This License Agreement applies to any software library or other
  119 +program which contains a notice placed by the copyright holder or
  120 +other authorized party saying it may be distributed under the terms of
  121 +this Lesser General Public License (also called "this License").
  122 +Each licensee is addressed as "you".
  123 +
  124 + A "library" means a collection of software functions and/or data
  125 +prepared so as to be conveniently linked with application programs
  126 +(which use some of those functions and data) to form executables.
  127 +
  128 + The "Library", below, refers to any such software library or work
  129 +which has been distributed under these terms. A "work based on the
  130 +Library" means either the Library or any derivative work under
  131 +copyright law: that is to say, a work containing the Library or a
  132 +portion of it, either verbatim or with modifications and/or translated
  133 +straightforwardly into another language. (Hereinafter, translation is
  134 +included without limitation in the term "modification".)
  135 +
  136 + "Source code" for a work means the preferred form of the work for
  137 +making modifications to it. For a library, complete source code means
  138 +all the source code for all modules it contains, plus any associated
  139 +interface definition files, plus the scripts used to control compilation
  140 +and installation of the library.
  141 +
  142 + Activities other than copying, distribution and modification are not
  143 +covered by this License; they are outside its scope. The act of
  144 +running a program using the Library is not restricted, and output from
  145 +such a program is covered only if its contents constitute a work based
  146 +on the Library (independent of the use of the Library in a tool for
  147 +writing it). Whether that is true depends on what the Library does
  148 +and what the program that uses the Library does.
  149 +
  150 + 1. You may copy and distribute verbatim copies of the Library's
  151 +complete source code as you receive it, in any medium, provided that
  152 +you conspicuously and appropriately publish on each copy an
  153 +appropriate copyright notice and disclaimer of warranty; keep intact
  154 +all the notices that refer to this License and to the absence of any
  155 +warranty; and distribute a copy of this License along with the
  156 +Library.
  157 +
  158 + You may charge a fee for the physical act of transferring a copy,
  159 +and you may at your option offer warranty protection in exchange for a
  160 +fee.
  161 +
  162 + 2. You may modify your copy or copies of the Library or any portion
  163 +of it, thus forming a work based on the Library, and copy and
  164 +distribute such modifications or work under the terms of Section 1
  165 +above, provided that you also meet all of these conditions:
  166 +
  167 + a) The modified work must itself be a software library.
  168 +
  169 + b) You must cause the files modified to carry prominent notices
  170 + stating that you changed the files and the date of any change.
  171 +
  172 + c) You must cause the whole of the work to be licensed at no
  173 + charge to all third parties under the terms of this License.
  174 +
  175 + d) If a facility in the modified Library refers to a function or a
  176 + table of data to be supplied by an application program that uses
  177 + the facility, other than as an argument passed when the facility
  178 + is invoked, then you must make a good faith effort to ensure that,
  179 + in the event an application does not supply such function or
  180 + table, the facility still operates, and performs whatever part of
  181 + its purpose remains meaningful.
  182 +
  183 + (For example, a function in a library to compute square roots has
  184 + a purpose that is entirely well-defined independent of the
  185 + application. Therefore, Subsection 2d requires that any
  186 + application-supplied function or table used by this function must
  187 + be optional: if the application does not supply it, the square
  188 + root function must still compute square roots.)
  189 +
  190 +These requirements apply to the modified work as a whole. If
  191 +identifiable sections of that work are not derived from the Library,
  192 +and can be reasonably considered independent and separate works in
  193 +themselves, then this License, and its terms, do not apply to those
  194 +sections when you distribute them as separate works. But when you
  195 +distribute the same sections as part of a whole which is a work based
  196 +on the Library, the distribution of the whole must be on the terms of
  197 +this License, whose permissions for other licensees extend to the
  198 +entire whole, and thus to each and every part regardless of who wrote
  199 +it.
  200 +
  201 +Thus, it is not the intent of this section to claim rights or contest
  202 +your rights to work written entirely by you; rather, the intent is to
  203 +exercise the right to control the distribution of derivative or
  204 +collective works based on the Library.
  205 +
  206 +In addition, mere aggregation of another work not based on the Library
  207 +with the Library (or with a work based on the Library) on a volume of
  208 +a storage or distribution medium does not bring the other work under
  209 +the scope of this License.
  210 +
  211 + 3. You may opt to apply the terms of the ordinary GNU General Public
  212 +License instead of this License to a given copy of the Library. To do
  213 +this, you must alter all the notices that refer to this License, so
  214 +that they refer to the ordinary GNU General Public License, version 2,
  215 +instead of to this License. (If a newer version than version 2 of the
  216 +ordinary GNU General Public License has appeared, then you can specify
  217 +that version instead if you wish.) Do not make any other change in
  218 +these notices.
  219 +
  220 + Once this change is made in a given copy, it is irreversible for
  221 +that copy, so the ordinary GNU General Public License applies to all
  222 +subsequent copies and derivative works made from that copy.
  223 +
  224 + This option is useful when you wish to copy part of the code of
  225 +the Library into a program that is not a library.
  226 +
  227 + 4. You may copy and distribute the Library (or a portion or
  228 +derivative of it, under Section 2) in object code or executable form
  229 +under the terms of Sections 1 and 2 above provided that you accompany
  230 +it with the complete corresponding machine-readable source code, which
  231 +must be distributed under the terms of Sections 1 and 2 above on a
  232 +medium customarily used for software interchange.
  233 +
  234 + If distribution of object code is made by offering access to copy
  235 +from a designated place, then offering equivalent access to copy the
  236 +source code from the same place satisfies the requirement to
  237 +distribute the source code, even though third parties are not
  238 +compelled to copy the source along with the object code.
  239 +
  240 + 5. A program that contains no derivative of any portion of the
  241 +Library, but is designed to work with the Library by being compiled or
  242 +linked with it, is called a "work that uses the Library". Such a
  243 +work, in isolation, is not a derivative work of the Library, and
  244 +therefore falls outside the scope of this License.
  245 +
  246 + However, linking a "work that uses the Library" with the Library
  247 +creates an executable that is a derivative of the Library (because it
  248 +contains portions of the Library), rather than a "work that uses the
  249 +library". The executable is therefore covered by this License.
  250 +Section 6 states terms for distribution of such executables.
  251 +
  252 + When a "work that uses the Library" uses material from a header file
  253 +that is part of the Library, the object code for the work may be a
  254 +derivative work of the Library even though the source code is not.
  255 +Whether this is true is especially significant if the work can be
  256 +linked without the Library, or if the work is itself a library. The
  257 +threshold for this to be true is not precisely defined by law.
  258 +
  259 + If such an object file uses only numerical parameters, data
  260 +structure layouts and accessors, and small macros and small inline
  261 +functions (ten lines or less in length), then the use of the object
  262 +file is unrestricted, regardless of whether it is legally a derivative
  263 +work. (Executables containing this object code plus portions of the
  264 +Library will still fall under Section 6.)
  265 +
  266 + Otherwise, if the work is a derivative of the Library, you may
  267 +distribute the object code for the work under the terms of Section 6.
  268 +Any executables containing that work also fall under Section 6,
  269 +whether or not they are linked directly with the Library itself.
  270 +
  271 + 6. As an exception to the Sections above, you may also combine or
  272 +link a "work that uses the Library" with the Library to produce a
  273 +work containing portions of the Library, and distribute that work
  274 +under terms of your choice, provided that the terms permit
  275 +modification of the work for the customer's own use and reverse
  276 +engineering for debugging such modifications.
  277 +
  278 + You must give prominent notice with each copy of the work that the
  279 +Library is used in it and that the Library and its use are covered by
  280 +this License. You must supply a copy of this License. If the work
  281 +during execution displays copyright notices, you must include the
  282 +copyright notice for the Library among them, as well as a reference
  283 +directing the user to the copy of this License. Also, you must do one
  284 +of these things:
  285 +
  286 + a) Accompany the work with the complete corresponding
  287 + machine-readable source code for the Library including whatever
  288 + changes were used in the work (which must be distributed under
  289 + Sections 1 and 2 above); and, if the work is an executable linked
  290 + with the Library, with the complete machine-readable "work that
  291 + uses the Library", as object code and/or source code, so that the
  292 + user can modify the Library and then relink to produce a modified
  293 + executable containing the modified Library. (It is understood
  294 + that the user who changes the contents of definitions files in the
  295 + Library will not necessarily be able to recompile the application
  296 + to use the modified definitions.)
  297 +
  298 + b) Use a suitable shared library mechanism for linking with the
  299 + Library. A suitable mechanism is one that (1) uses at run time a
  300 + copy of the library already present on the user's computer system,
  301 + rather than copying library functions into the executable, and (2)
  302 + will operate properly with a modified version of the library, if
  303 + the user installs one, as long as the modified version is
  304 + interface-compatible with the version that the work was made with.
  305 +
  306 + c) Accompany the work with a written offer, valid for at
  307 + least three years, to give the same user the materials
  308 + specified in Subsection 6a, above, for a charge no more
  309 + than the cost of performing this distribution.
  310 +
  311 + d) If distribution of the work is made by offering access to copy
  312 + from a designated place, offer equivalent access to copy the above
  313 + specified materials from the same place.
  314 +
  315 + e) Verify that the user has already received a copy of these
  316 + materials or that you have already sent this user a copy.
  317 +
  318 + For an executable, the required form of the "work that uses the
  319 +Library" must include any data and utility programs needed for
  320 +reproducing the executable from it. However, as a special exception,
  321 +the materials to be distributed need not include anything that is
  322 +normally distributed (in either source or binary form) with the major
  323 +components (compiler, kernel, and so on) of the operating system on
  324 +which the executable runs, unless that component itself accompanies
  325 +the executable.
  326 +
  327 + It may happen that this requirement contradicts the license
  328 +restrictions of other proprietary libraries that do not normally
  329 +accompany the operating system. Such a contradiction means you cannot
  330 +use both them and the Library together in an executable that you
  331 +distribute.
  332 +
  333 + 7. You may place library facilities that are a work based on the
  334 +Library side-by-side in a single library together with other library
  335 +facilities not covered by this License, and distribute such a combined
  336 +library, provided that the separate distribution of the work based on
  337 +the Library and of the other library facilities is otherwise
  338 +permitted, and provided that you do these two things:
  339 +
  340 + a) Accompany the combined library with a copy of the same work
  341 + based on the Library, uncombined with any other library
  342 + facilities. This must be distributed under the terms of the
  343 + Sections above.
  344 +
  345 + b) Give prominent notice with the combined library of the fact
  346 + that part of it is a work based on the Library, and explaining
  347 + where to find the accompanying uncombined form of the same work.
  348 +
  349 + 8. You may not copy, modify, sublicense, link with, or distribute
  350 +the Library except as expressly provided under this License. Any
  351 +attempt otherwise to copy, modify, sublicense, link with, or
  352 +distribute the Library is void, and will automatically terminate your
  353 +rights under this License. However, parties who have received copies,
  354 +or rights, from you under this License will not have their licenses
  355 +terminated so long as such parties remain in full compliance.
  356 +
  357 + 9. You are not required to accept this License, since you have not
  358 +signed it. However, nothing else grants you permission to modify or
  359 +distribute the Library or its derivative works. These actions are
  360 +prohibited by law if you do not accept this License. Therefore, by
  361 +modifying or distributing the Library (or any work based on the
  362 +Library), you indicate your acceptance of this License to do so, and
  363 +all its terms and conditions for copying, distributing or modifying
  364 +the Library or works based on it.
  365 +
  366 + 10. Each time you redistribute the Library (or any work based on the
  367 +Library), the recipient automatically receives a license from the
  368 +original licensor to copy, distribute, link with or modify the Library
  369 +subject to these terms and conditions. You may not impose any further
  370 +restrictions on the recipients' exercise of the rights granted herein.
  371 +You are not responsible for enforcing compliance by third parties with
  372 +this License.
  373 +
  374 + 11. If, as a consequence of a court judgment or allegation of patent
  375 +infringement or for any other reason (not limited to patent issues),
  376 +conditions are imposed on you (whether by court order, agreement or
  377 +otherwise) that contradict the conditions of this License, they do not
  378 +excuse you from the conditions of this License. If you cannot
  379 +distribute so as to satisfy simultaneously your obligations under this
  380 +License and any other pertinent obligations, then as a consequence you
  381 +may not distribute the Library at all. For example, if a patent
  382 +license would not permit royalty-free redistribution of the Library by
  383 +all those who receive copies directly or indirectly through you, then
  384 +the only way you could satisfy both it and this License would be to
  385 +refrain entirely from distribution of the Library.
  386 +
  387 +If any portion of this section is held invalid or unenforceable under any
  388 +particular circumstance, the balance of the section is intended to apply,
  389 +and the section as a whole is intended to apply in other circumstances.
  390 +
  391 +It is not the purpose of this section to induce you to infringe any
  392 +patents or other property right claims or to contest validity of any
  393 +such claims; this section has the sole purpose of protecting the
  394 +integrity of the free software distribution system which is
  395 +implemented by public license practices. Many people have made
  396 +generous contributions to the wide range of software distributed
  397 +through that system in reliance on consistent application of that
  398 +system; it is up to the author/donor to decide if he or she is willing
  399 +to distribute software through any other system and a licensee cannot
  400 +impose that choice.
  401 +
  402 +This section is intended to make thoroughly clear what is believed to
  403 +be a consequence of the rest of this License.
  404 +
  405 + 12. If the distribution and/or use of the Library is restricted in
  406 +certain countries either by patents or by copyrighted interfaces, the
  407 +original copyright holder who places the Library under this License may add
  408 +an explicit geographical distribution limitation excluding those countries,
  409 +so that distribution is permitted only in or among countries not thus
  410 +excluded. In such case, this License incorporates the limitation as if
  411 +written in the body of this License.
  412 +
  413 + 13. The Free Software Foundation may publish revised and/or new
  414 +versions of the Lesser General Public License from time to time.
  415 +Such new versions will be similar in spirit to the present version,
  416 +but may differ in detail to address new problems or concerns.
  417 +
  418 +Each version is given a distinguishing version number. If the Library
  419 +specifies a version number of this License which applies to it and
  420 +"any later version", you have the option of following the terms and
  421 +conditions either of that version or of any later version published by
  422 +the Free Software Foundation. If the Library does not specify a
  423 +license version number, you may choose any version ever published by
  424 +the Free Software Foundation.
  425 +
  426 + 14. If you wish to incorporate parts of the Library into other free
  427 +programs whose distribution conditions are incompatible with these,
  428 +write to the author to ask for permission. For software which is
  429 +copyrighted by the Free Software Foundation, write to the Free
  430 +Software Foundation; we sometimes make exceptions for this. Our
  431 +decision will be guided by the two goals of preserving the free status
  432 +of all derivatives of our free software and of promoting the sharing
  433 +and reuse of software generally.
  434 +
  435 + NO WARRANTY
  436 +
  437 + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
  438 +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
  439 +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
  440 +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
  441 +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
  442 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  443 +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
  444 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
  445 +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
  446 +
  447 + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
  448 +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
  449 +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
  450 +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
  451 +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
  452 +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
  453 +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
  454 +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
  455 +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
  456 +DAMAGES.
  457 +
  458 + END OF TERMS AND CONDITIONS
  459 +
  460 + How to Apply These Terms to Your New Libraries
  461 +
  462 + If you develop a new library, and you want it to be of the greatest
  463 +possible use to the public, we recommend making it free software that
  464 +everyone can redistribute and change. You can do so by permitting
  465 +redistribution under these terms (or, alternatively, under the terms of the
  466 +ordinary General Public License).
  467 +
  468 + To apply these terms, attach the following notices to the library. It is
  469 +safest to attach them to the start of each source file to most effectively
  470 +convey the exclusion of warranty; and each file should have at least the
  471 +"copyright" line and a pointer to where the full notice is found.
  472 +
  473 + <one line to give the library's name and a brief idea of what it does.>
  474 + Copyright (C) <year> <name of author>
  475 +
  476 + This library is free software; you can redistribute it and/or
  477 + modify it under the terms of the GNU Lesser General Public
  478 + License as published by the Free Software Foundation; either
  479 + version 2.1 of the License, or (at your option) any later version.
  480 +
  481 + This library is distributed in the hope that it will be useful,
  482 + but WITHOUT ANY WARRANTY; without even the implied warranty of
  483 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  484 + Lesser General Public License for more details.
  485 +
  486 + You should have received a copy of the GNU Lesser General Public
  487 + License along with this library; if not, write to the Free Software
  488 + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  489 +
  490 +Also add information on how to contact you by electronic and paper mail.
  491 +
  492 +You should also get your employer (if you work as a programmer) or your
  493 +school, if any, to sign a "copyright disclaimer" for the library, if
  494 +necessary. Here is a sample; alter the names:
  495 +
  496 + Yoyodyne, Inc., hereby disclaims all copyright interest in the
  497 + library `Frob' (a library for tweaking knobs) written by James Random Hacker.
  498 +
  499 + <signature of Ty Coon>, 1 April 1990
  500 + Ty Coon, President of Vice
  501 +
  502 +That's all there is to it!
  503 +
  504 +
public/javascripts/tiny_mce/plugins/advhr/css/advhr.css 0 → 100755
@@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
  1 +input.radio {
  2 + border: 1px none #000000;
  3 + background-color: transparent;
  4 + vertical-align: middle;
  5 +}
  6 +
  7 +.panel_wrapper div.current {
  8 + height: 80px;
  9 +}
  10 +
  11 +#width {
  12 + width: 50px;
  13 + vertical-align: middle;
  14 +}
  15 +
  16 +#width2 {
  17 + width: 50px;
  18 + vertical-align: middle;
  19 +}
  20 +
  21 +#size {
  22 + width: 100px;
  23 +}
public/javascripts/tiny_mce/plugins/advhr/editor_plugin.js 0 → 100755
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +tinyMCE.importPluginLanguagePack('advhr');var TinyMCE_AdvancedHRPlugin={getInfo:function(){return{longname:'Advanced HR',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},getControlHTML:function(cn){switch(cn){case"advhr":return tinyMCE.getButtonHTML(cn,'lang_insert_advhr_desc','{$pluginurl}/images/advhr.gif','mceAdvancedHr')}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceAdvancedHr":var template=new Array();template['file']='../../plugins/advhr/rule.htm';template['width']=250;template['height']=160;template['width']+=tinyMCE.getLang('lang_advhr_delta_width',0);template['height']+=tinyMCE.getLang('lang_advhr_delta_height',0);var size="",width="",noshade="";if(tinyMCE.selectedElement!=null&&tinyMCE.selectedElement.nodeName.toLowerCase()=="hr"){tinyMCE.hrElement=tinyMCE.selectedElement;if(tinyMCE.hrElement){size=tinyMCE.hrElement.getAttribute('size')?tinyMCE.hrElement.getAttribute('size'):"";width=tinyMCE.hrElement.getAttribute('width')?tinyMCE.hrElement.getAttribute('width'):"";noshade=tinyMCE.hrElement.getAttribute('noshade')?tinyMCE.hrElement.getAttribute('noshade'):""}tinyMCE.openWindow(template,{editor_id:editor_id,size:size,width:width,noshade:noshade,mceDo:'update'})}else{if(tinyMCE.isMSIE){tinyMCE.execInstanceCommand(editor_id,'mceInsertContent',false,'<hr />')}else{tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",size:size,width:width,noshade:noshade,mceDo:'insert'})}}return true}return false},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){if(node==null)return;do{if(node.nodeName=="HR"){tinyMCE.switchClass(editor_id+'_advhr','mceButtonSelected');return true}}while((node=node.parentNode));tinyMCE.switchClass(editor_id+'_advhr','mceButtonNormal');return true}};tinyMCE.addPlugin("advhr",TinyMCE_AdvancedHRPlugin);
0 \ No newline at end of file 2 \ No newline at end of file
public/javascripts/tiny_mce/plugins/advhr/editor_plugin_src.js 0 → 100755
@@ -0,0 +1,90 @@ @@ -0,0 +1,90 @@
  1 +/**
  2 + * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
  3 + *
  4 + * @author Moxiecode
  5 + * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
  6 + */
  7 +
  8 +/* Import plugin specific language pack */
  9 +tinyMCE.importPluginLanguagePack('advhr');
  10 +
  11 +var TinyMCE_AdvancedHRPlugin = {
  12 + getInfo : function() {
  13 + return {
  14 + longname : 'Advanced HR',
  15 + author : 'Moxiecode Systems AB',
  16 + authorurl : 'http://tinymce.moxiecode.com',
  17 + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr',
  18 + version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
  19 + }
  20 + },
  21 +
  22 + getControlHTML : function(cn) {
  23 + switch (cn) {
  24 + case "advhr":
  25 + return tinyMCE.getButtonHTML(cn, 'lang_insert_advhr_desc', '{$pluginurl}/images/advhr.gif', 'mceAdvancedHr');
  26 + }
  27 +
  28 + return "";
  29 + },
  30 +
  31 + /**
  32 + * Executes the mceAdvanceHr command.
  33 + */
  34 + execCommand : function(editor_id, element, command, user_interface, value) {
  35 + // Handle commands
  36 + switch (command) {
  37 + case "mceAdvancedHr":
  38 + var template = new Array();
  39 +
  40 + template['file'] = '../../plugins/advhr/rule.htm'; // Relative to theme
  41 + template['width'] = 250;
  42 + template['height'] = 160;
  43 +
  44 + template['width'] += tinyMCE.getLang('lang_advhr_delta_width', 0);
  45 + template['height'] += tinyMCE.getLang('lang_advhr_delta_height', 0);
  46 +
  47 + var size = "", width = "", noshade = "";
  48 + if (tinyMCE.selectedElement != null && tinyMCE.selectedElement.nodeName.toLowerCase() == "hr") {
  49 + tinyMCE.hrElement = tinyMCE.selectedElement;
  50 +
  51 + if (tinyMCE.hrElement) {
  52 + size = tinyMCE.hrElement.getAttribute('size') ? tinyMCE.hrElement.getAttribute('size') : "";
  53 + width = tinyMCE.hrElement.getAttribute('width') ? tinyMCE.hrElement.getAttribute('width') : "";
  54 + noshade = tinyMCE.hrElement.getAttribute('noshade') ? tinyMCE.hrElement.getAttribute('noshade') : "";
  55 + }
  56 +
  57 + tinyMCE.openWindow(template, {editor_id : editor_id, size : size, width : width, noshade : noshade, mceDo : 'update'});
  58 + } else {
  59 + if (tinyMCE.isMSIE) {
  60 + tinyMCE.execInstanceCommand(editor_id, 'mceInsertContent', false,'<hr />');
  61 + } else {
  62 + tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", size : size, width : width, noshade : noshade, mceDo : 'insert'});
  63 + }
  64 + }
  65 +
  66 + return true;
  67 + }
  68 +
  69 + // Pass to next handler in chain
  70 + return false;
  71 + },
  72 +
  73 + handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
  74 + if (node == null)
  75 + return;
  76 +
  77 + do {
  78 + if (node.nodeName == "HR") {
  79 + tinyMCE.switchClass(editor_id + '_advhr', 'mceButtonSelected');
  80 + return true;
  81 + }
  82 + } while ((node = node.parentNode));
  83 +
  84 + tinyMCE.switchClass(editor_id + '_advhr', 'mceButtonNormal');
  85 +
  86 + return true;
  87 + }
  88 +};
  89 +
  90 +tinyMCE.addPlugin("advhr", TinyMCE_AdvancedHRPlugin);
public/javascripts/tiny_mce/plugins/advhr/images/advhr.gif 0 → 100755

153 Bytes

public/javascripts/tiny_mce/plugins/advhr/jscripts/rule.js 0 → 100755
@@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
  1 +function init() {
  2 + tinyMCEPopup.resizeToInnerSize();
  3 +
  4 + var formObj = document.forms[0];
  5 + formObj.width.value = tinyMCE.getWindowArg('width');
  6 + formObj.size.value = tinyMCE.getWindowArg('size');
  7 + formObj.insert.value = tinyMCE.getLang('lang_' + tinyMCE.getWindowArg('mceDo'),'Insert',true);
  8 + if (tinyMCE.getWindowArg('noshade')) {
  9 + formObj.noshade.checked = true;
  10 + }
  11 + if (tinyMCE.getWindowArg('width').lastIndexOf('%')!=-1) {
  12 + formObj.width2.value = "%";
  13 + formObj.width.value = formObj.width.value.substring(0,formObj.width.value.length-1);
  14 + }
  15 +}
  16 +
  17 +function insertHR() {
  18 + var formObj = document.forms[0];
  19 + var width = formObj.width.value;
  20 + var size = formObj.size.value;
  21 + var html = '<hr';
  22 + if (size!='' && size!=0) {
  23 + html += ' size="' + size + '"';
  24 + }
  25 + if (width!='' && width!=0) {
  26 + html += ' width="' + width;
  27 + if (formObj.width2.value=='%') {
  28 + html += '%';
  29 + }
  30 + html += '"';
  31 + }
  32 + if (formObj.noshade.checked==true) {
  33 + html += ' noshade="noshade"';
  34 + }
  35 + html += ' />';
  36 +
  37 + tinyMCEPopup.execCommand("mceInsertContent", true, html);
  38 + tinyMCEPopup.close();
  39 +}
  40 +
  41 +function cancelAction() {
  42 + tinyMCEPopup.close();
  43 +}
public/javascripts/tiny_mce/plugins/advhr/langs/en.js 0 → 100755
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +// UK lang variables
  2 +
  3 +tinyMCE.addToLang('',{
  4 +insert_advhr_desc : 'Horizontale rule',
  5 +insert_advhr_width : 'Width',
  6 +insert_advhr_size : 'Height',
  7 +insert_advhr_noshade : 'No shadow'
  8 +});
public/javascripts/tiny_mce/plugins/advhr/readme.txt 0 → 100755
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +Check the TinyMCE documentation for details on this plugin.
public/javascripts/tiny_mce/plugins/advhr/rule.htm 0 → 100755
@@ -0,0 +1,61 @@ @@ -0,0 +1,61 @@
  1 +<html xmlns="http://www.w3.org/1999/xhtml">
  2 +<head>
  3 + <title>{$lang_insert_advhr_desc}</title>
  4 + <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
  5 + <script language="javascript" type="text/javascript" src="jscripts/rule.js"></script>
  6 + <script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
  7 + <link href="css/advhr.css" rel="stylesheet" type="text/css" />
  8 + <base target="_self" />
  9 +</head>
  10 +<body onload="tinyMCEPopup.executeOnLoad('init();');">
  11 +<form onsubmit="insertHR();return false;" action="#">
  12 + <div class="tabs">
  13 + <ul>
  14 + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_insert_advhr_desc}</a></span></li>
  15 + </ul>
  16 + </div>
  17 +
  18 + <div class="panel_wrapper">
  19 + <div id="general_panel" class="panel current">
  20 + <table border="0" cellpadding="4" cellspacing="0">
  21 + <tr>
  22 + <td><label for="width">{$lang_insert_advhr_width}</label></td>
  23 + <td nowrap="nowrap">
  24 + <input id="width" name="width" type="text" value="" />
  25 + <select name="width2" id="width2">
  26 + <option value="">px</option>
  27 + <option value="%">%</option>
  28 + </select>
  29 + </td>
  30 + </tr>
  31 + <tr>
  32 + <td><label for="size">{$lang_insert_advhr_size}</label></td>
  33 + <td><select id="size" name="size">
  34 + <option value="">Normal</option>
  35 + <option value="1">1</option>
  36 + <option value="2">2</option>
  37 + <option value="3">3</option>
  38 + <option value="4">4</option>
  39 + <option value="5">5</option>
  40 + </select></td>
  41 + </tr>
  42 + <tr>
  43 + <td><label for="noshade">{$lang_insert_advhr_noshade}</label></td>
  44 + <td><input type="checkbox" name="noshade" id="noshade" class="radio" /></td>
  45 + </tr>
  46 + </table>
  47 + </div>
  48 + </div>
  49 +
  50 + <div class="mceActionPanel">
  51 + <div style="float: left">
  52 + <input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertHR();" />
  53 + </div>
  54 +
  55 + <div style="float: right">
  56 + <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
  57 + </div>
  58 + </div>
  59 +</form>
  60 +</body>
  61 +</html>
public/javascripts/tiny_mce/plugins/advimage/css/advimage.css 0 → 100755
@@ -0,0 +1,66 @@ @@ -0,0 +1,66 @@
  1 +/* CSS file for advimage plugin popup */
  2 +
  3 +.mceImageList {
  4 + width: 280px;
  5 +}
  6 +
  7 +.mceActionPanel {
  8 + margin-top: 7px;
  9 +}
  10 +
  11 +.alignPreview {
  12 + border: 1px solid black;
  13 + width: 140px;
  14 + height: 140px;
  15 + overflow: hidden;
  16 + padding: 5px;
  17 +}
  18 +
  19 +.checkbox {
  20 + border: 0;
  21 +}
  22 +
  23 +.panel_wrapper div.current {
  24 + height: 305px;
  25 +}
  26 +
  27 +#prev {
  28 + margin: 0;
  29 + border: 1px
  30 + solid black;
  31 + width: 99%;
  32 + height: 150px;
  33 + overflow: auto;
  34 +}
  35 +
  36 +#align, #classlist {
  37 + width: 150px;
  38 +}
  39 +
  40 +#width, #height {
  41 + vertical-align: middle;
  42 + width: 50px;
  43 + text-align: center;
  44 +}
  45 +
  46 +#vspace, #hspace, #border {
  47 + vertical-align: middle;
  48 + width: 30px;
  49 + text-align: center;
  50 +}
  51 +
  52 +#classlist {
  53 + width: 180px;
  54 +}
  55 +
  56 +input {
  57 + width: 280px;
  58 +}
  59 +
  60 +#constrain, #onmousemovecheck {
  61 + width: auto;
  62 +}
  63 +
  64 +#id, #dir, #lang, #usemap, #longdesc {
  65 + width: 200px;
  66 +}
public/javascripts/tiny_mce/plugins/advimage/editor_plugin.js 0 → 100755
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +tinyMCE.importPluginLanguagePack('advimage');var TinyMCE_AdvancedImagePlugin={getInfo:function(){return{longname:'Advanced image',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},getControlHTML:function(cn){switch(cn){case"image":return tinyMCE.getButtonHTML(cn,'lang_image_desc','{$themeurl}/images/image.gif','mceAdvImage')}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceAdvImage":var template=new Array();template['file']='../../plugins/advimage/image.htm';template['width']=480;template['height']=380;template['width']+=tinyMCE.getLang('lang_advimage_delta_width',0);template['height']+=tinyMCE.getLang('lang_advimage_delta_height',0);var inst=tinyMCE.getInstanceById(editor_id);var elm=inst.getFocusElement();if(elm!=null&&tinyMCE.getAttrib(elm,'class').indexOf('mceItem')!=-1)return true;tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true}return false},cleanup:function(type,content){switch(type){case"insert_to_editor_dom":var imgs=content.getElementsByTagName("img"),src,i;for(i=0;i<imgs.length;i++){var onmouseover=tinyMCE.cleanupEventStr(tinyMCE.getAttrib(imgs[i],'onmouseover'));var onmouseout=tinyMCE.cleanupEventStr(tinyMCE.getAttrib(imgs[i],'onmouseout'));if((src=this._getImageSrc(onmouseover))!=""){if(tinyMCE.getParam('convert_urls'))src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],src);imgs[i].setAttribute('onmouseover',"this.src='"+src+"';")}if((src=this._getImageSrc(onmouseout))!=""){if(tinyMCE.getParam('convert_urls'))src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],src);imgs[i].setAttribute('onmouseout',"this.src='"+src+"';")}}break;case"get_from_editor_dom":var imgs=content.getElementsByTagName("img");for(var i=0;i<imgs.length;i++){var onmouseover=tinyMCE.cleanupEventStr(tinyMCE.getAttrib(imgs[i],'onmouseover'));var onmouseout=tinyMCE.cleanupEventStr(tinyMCE.getAttrib(imgs[i],'onmouseout'));if((src=this._getImageSrc(onmouseover))!=""){if(tinyMCE.getParam('convert_urls'))src=eval(tinyMCE.settings['urlconverter_callback']+"(src, null, true);");imgs[i].setAttribute('onmouseover',"this.src='"+src+"';")}if((src=this._getImageSrc(onmouseout))!=""){if(tinyMCE.getParam('convert_urls'))src=eval(tinyMCE.settings['urlconverter_callback']+"(src, null, true);");imgs[i].setAttribute('onmouseout',"this.src='"+src+"';")}}break}return content},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){if(node==null)return;do{if(node.nodeName=="IMG"&&tinyMCE.getAttrib(node,'class').indexOf('mceItem')==-1){tinyMCE.switchClass(editor_id+'_advimage','mceButtonSelected');return true}}while((node=node.parentNode));tinyMCE.switchClass(editor_id+'_advimage','mceButtonNormal');return true},_getImageSrc:function(s){var sr,p=-1;if(!s)return"";if((p=s.indexOf('this.src='))!=-1){sr=s.substring(p+10);sr=sr.substring(0,sr.indexOf('\''));return sr}return""}};tinyMCE.addPlugin("advimage",TinyMCE_AdvancedImagePlugin);
0 \ No newline at end of file 2 \ No newline at end of file
public/javascripts/tiny_mce/plugins/advimage/editor_plugin_src.js 0 → 100755
@@ -0,0 +1,148 @@ @@ -0,0 +1,148 @@
  1 +/**
  2 + * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
  3 + *
  4 + * @author Moxiecode
  5 + * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
  6 + */
  7 +
  8 +/* Import plugin specific language pack */
  9 +tinyMCE.importPluginLanguagePack('advimage');
  10 +
  11 +var TinyMCE_AdvancedImagePlugin = {
  12 + getInfo : function() {
  13 + return {
  14 + longname : 'Advanced image',
  15 + author : 'Moxiecode Systems AB',
  16 + authorurl : 'http://tinymce.moxiecode.com',
  17 + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage',
  18 + version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
  19 + };
  20 + },
  21 +
  22 + getControlHTML : function(cn) {
  23 + switch (cn) {
  24 + case "image":
  25 + return tinyMCE.getButtonHTML(cn, 'lang_image_desc', '{$themeurl}/images/image.gif', 'mceAdvImage');
  26 + }
  27 +
  28 + return "";
  29 + },
  30 +
  31 + execCommand : function(editor_id, element, command, user_interface, value) {
  32 + switch (command) {
  33 + case "mceAdvImage":
  34 + var template = new Array();
  35 +
  36 + template['file'] = '../../plugins/advimage/image.htm';
  37 + template['width'] = 480;
  38 + template['height'] = 380;
  39 +
  40 + // Language specific width and height addons
  41 + template['width'] += tinyMCE.getLang('lang_advimage_delta_width', 0);
  42 + template['height'] += tinyMCE.getLang('lang_advimage_delta_height', 0);
  43 +
  44 + var inst = tinyMCE.getInstanceById(editor_id);
  45 + var elm = inst.getFocusElement();
  46 +
  47 + if (elm != null && tinyMCE.getAttrib(elm, 'class').indexOf('mceItem') != -1)
  48 + return true;
  49 +
  50 + tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"});
  51 +
  52 + return true;
  53 + }
  54 +
  55 + return false;
  56 + },
  57 +
  58 + cleanup : function(type, content) {
  59 + switch (type) {
  60 + case "insert_to_editor_dom":
  61 + var imgs = content.getElementsByTagName("img"), src, i;
  62 + for (i=0; i<imgs.length; i++) {
  63 + var onmouseover = tinyMCE.cleanupEventStr(tinyMCE.getAttrib(imgs[i], 'onmouseover'));
  64 + var onmouseout = tinyMCE.cleanupEventStr(tinyMCE.getAttrib(imgs[i], 'onmouseout'));
  65 +
  66 + if ((src = this._getImageSrc(onmouseover)) != "") {
  67 + if (tinyMCE.getParam('convert_urls'))
  68 + src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], src);
  69 +
  70 + imgs[i].setAttribute('onmouseover', "this.src='" + src + "';");
  71 + }
  72 +
  73 + if ((src = this._getImageSrc(onmouseout)) != "") {
  74 + if (tinyMCE.getParam('convert_urls'))
  75 + src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], src);
  76 +
  77 + imgs[i].setAttribute('onmouseout', "this.src='" + src + "';");
  78 + }
  79 + }
  80 + break;
  81 +
  82 + case "get_from_editor_dom":
  83 + var imgs = content.getElementsByTagName("img");
  84 + for (var i=0; i<imgs.length; i++) {
  85 + var onmouseover = tinyMCE.cleanupEventStr(tinyMCE.getAttrib(imgs[i], 'onmouseover'));
  86 + var onmouseout = tinyMCE.cleanupEventStr(tinyMCE.getAttrib(imgs[i], 'onmouseout'));
  87 +
  88 + if ((src = this._getImageSrc(onmouseover)) != "") {
  89 + if (tinyMCE.getParam('convert_urls'))
  90 + src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, null, true);");
  91 +
  92 + imgs[i].setAttribute('onmouseover', "this.src='" + src + "';");
  93 + }
  94 +
  95 + if ((src = this._getImageSrc(onmouseout)) != "") {
  96 + if (tinyMCE.getParam('convert_urls'))
  97 + src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, null, true);");
  98 +
  99 + imgs[i].setAttribute('onmouseout', "this.src='" + src + "';");
  100 + }
  101 + }
  102 + break;
  103 + }
  104 +
  105 + return content;
  106 + },
  107 +
  108 + handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
  109 + if (node == null)
  110 + return;
  111 +
  112 + do {
  113 + if (node.nodeName == "IMG" && tinyMCE.getAttrib(node, 'class').indexOf('mceItem') == -1) {
  114 + tinyMCE.switchClass(editor_id + '_advimage', 'mceButtonSelected');
  115 + return true;
  116 + }
  117 + } while ((node = node.parentNode));
  118 +
  119 + tinyMCE.switchClass(editor_id + '_advimage', 'mceButtonNormal');
  120 +
  121 + return true;
  122 + },
  123 +
  124 + /**
  125 + * Returns the image src from a scripted mouse over image str.
  126 + *
  127 + * @param {string} s String to get real src from.
  128 + * @return Image src from a scripted mouse over image str.
  129 + * @type string
  130 + */
  131 + _getImageSrc : function(s) {
  132 + var sr, p = -1;
  133 +
  134 + if (!s)
  135 + return "";
  136 +
  137 + if ((p = s.indexOf('this.src=')) != -1) {
  138 + sr = s.substring(p + 10);
  139 + sr = sr.substring(0, sr.indexOf('\''));
  140 +
  141 + return sr;
  142 + }
  143 +
  144 + return "";
  145 + }
  146 +};
  147 +
  148 +tinyMCE.addPlugin("advimage", TinyMCE_AdvancedImagePlugin);
public/javascripts/tiny_mce/plugins/advimage/image.htm 0 → 100755
@@ -0,0 +1,241 @@ @@ -0,0 +1,241 @@
  1 +<html xmlns="http://www.w3.org/1999/xhtml">
  2 +<head>
  3 + <title>{$lang_insert_image_title}</title>
  4 + <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
  5 + <script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
  6 + <script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
  7 + <script language="javascript" type="text/javascript" src="../../utils/validate.js"></script>
  8 + <script language="javascript" type="text/javascript" src="jscripts/functions.js"></script>
  9 + <link href="css/advimage.css" rel="stylesheet" type="text/css" />
  10 + <base target="_self" />
  11 +</head>
  12 +<body id="advimage" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
  13 + <form onsubmit="insertAction();return false;" action="#">
  14 + <div class="tabs">
  15 + <ul>
  16 + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_advimage_tab_general}</a></span></li>
  17 + <li id="appearance_tab"><span><a href="javascript:mcTabs.displayTab('appearance_tab','appearance_panel');" onmousedown="return false;">{$lang_advimage_tab_appearance}</a></span></li>
  18 + <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{$lang_advimage_tab_advanced}</a></span></li>
  19 + </ul>
  20 + </div>
  21 +
  22 + <div class="panel_wrapper">
  23 + <div id="general_panel" class="panel current">
  24 + <fieldset>
  25 + <legend>{$lang_advimage_general}</legend>
  26 +
  27 + <table class="properties">
  28 + <tr>
  29 + <td class="column1"><label id="srclabel" for="src">{$lang_insert_image_src}</label></td>
  30 + <td colspan="2"><table border="0" cellspacing="0" cellpadding="0">
  31 + <tr>
  32 + <td><input name="src" type="text" id="src" value="" onchange="showPreviewImage(this.value);" /></td>
  33 + <td id="srcbrowsercontainer">&nbsp;</td>
  34 + </tr>
  35 + </table></td>
  36 + </tr>
  37 + <tr id="imagelistsrcrow">
  38 + <td class="column1"><label for="imagelistsrc">{$lang_image_list}</label></td>
  39 + <td colspan="2" id="imagelistsrccontainer">&nbsp;</td>
  40 + </tr>
  41 + <tr>
  42 + <td class="column1"><label id="altlabel" for="alt">{$lang_insert_image_alt}</label></td>
  43 + <td colspan="2"><input id="alt" name="alt" type="text" value="" /></td>
  44 + </tr>
  45 + <tr>
  46 + <td class="column1"><label id="titlelabel" for="title">{$lang_advimage_title}</label></td>
  47 + <td colspan="2"><input id="title" name="title" type="text" value="" /></td>
  48 + </tr>
  49 + </table>
  50 + </fieldset>
  51 +
  52 + <fieldset>
  53 + <legend>{$lang_advimage_preview}</legend>
  54 + <div id="prev"></div>
  55 + </fieldset>
  56 + </div>
  57 +
  58 + <div id="appearance_panel" class="panel">
  59 + <fieldset>
  60 + <legend>{$lang_advimage_tab_appearance}</legend>
  61 +
  62 + <table border="0" cellpadding="4" cellspacing="0">
  63 + <tr>
  64 + <td class="column1"><label id="alignlabel" for="align">{$lang_insert_image_align}</label></td>
  65 + <td><select id="align" name="align" onchange="changeAppearance();">
  66 + <option value="">{$lang_insert_image_align_default}</option>
  67 + <option value="baseline">{$lang_insert_image_align_baseline}</option>
  68 + <option value="top">{$lang_insert_image_align_top}</option>
  69 + <option value="middle">{$lang_insert_image_align_middle}</option>
  70 + <option value="bottom">{$lang_insert_image_align_bottom}</option>
  71 + <option value="texttop">{$lang_insert_image_align_texttop}</option>
  72 + <option value="absmiddle">{$lang_insert_image_align_absmiddle}</option>
  73 + <option value="absbottom">{$lang_insert_image_align_absbottom}</option>
  74 + <option value="left">{$lang_insert_image_align_left}</option>
  75 + <option value="right">{$lang_insert_image_align_right}</option>
  76 + </select>
  77 + </td>
  78 + <td rowspan="6" valign="top">
  79 + <div class="alignPreview">
  80 + <img id="alignSampleImg" src="images/sample.gif" alt="{$lang_advimage_example_img}" />
  81 + Lorem ipsum, Dolor sit amet, consectetuer adipiscing loreum ipsum edipiscing elit, sed diam
  82 + nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Loreum ipsum
  83 + edipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam
  84 + erat volutpat.
  85 + </div>
  86 + </td>
  87 + </tr>
  88 +
  89 + <tr>
  90 + <td class="column1"><label id="widthlabel" for="width">{$lang_insert_image_dimensions}</label></td>
  91 + <td nowrap="nowrap">
  92 + <input name="width" type="text" id="width" value="" size="5" maxlength="5" class="size" onchange="changeHeight();" /> x
  93 + <input name="height" type="text" id="height" value="" size="5" maxlength="5" class="size" onchange="changeWidth();" /> px
  94 + </td>
  95 + </tr>
  96 +
  97 + <tr>
  98 + <td>&nbsp;</td>
  99 + <td><table border="0" cellpadding="0" cellspacing="0">
  100 + <tr>
  101 + <td><input id="constrain" type="checkbox" name="constrain" class="checkbox" /></td>
  102 + <td><label id="constrainlabel" for="constrain">{$lang_advimage_constrain_proportions}</label></td>
  103 + </tr>
  104 + </table></td>
  105 + </tr>
  106 +
  107 + <tr>
  108 + <td class="column1"><label id="vspacelabel" for="vspace">{$lang_insert_image_vspace}</label></td>
  109 + <td><input name="vspace" type="text" id="vspace" value="" size="3" maxlength="3" class="number" onchange="changeAppearance();updateStyle();" />
  110 + </td>
  111 + </tr>
  112 +
  113 + <tr>
  114 + <td class="column1"><label id="hspacelabel" for="hspace">{$lang_insert_image_hspace}</label></td>
  115 + <td><input name="hspace" type="text" id="hspace" value="" size="3" maxlength="3" class="number" onchange="changeAppearance();updateStyle();" /></td>
  116 + </tr>
  117 +
  118 + <tr>
  119 + <td class="column1"><label id="borderlabel" for="border">{$lang_insert_image_border}</label></td>
  120 + <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" class="number" onchange="changeAppearance();updateStyle();" /></td>
  121 + </tr>
  122 +
  123 + <tr>
  124 + <td><label id="classlabel" for="classlist">{$lang_class_name}</label></td>
  125 + <td colspan="2">
  126 + <select id="classlist" name="classlist">
  127 + <option value="" selected>{$lang_not_set}</option>
  128 + </select>
  129 + </td>
  130 + </tr>
  131 +
  132 + <tr>
  133 + <td class="column1"><label id="stylelabel" for="style">{$lang_advimage_style}</label></td>
  134 + <td colspan="2"><input id="style" name="style" type="text" value="" onchange="styleUpdated();" /></td>
  135 + </tr>
  136 +
  137 + <!-- <tr>
  138 + <td class="column1"><label id="classeslabel" for="classes">{$lang_advimage_classes}</label></td>
  139 + <td colspan="2"><input id="classes" name="classes" type="text" value="" onchange="selectByValue(this.form,'classlist',this.value,true);" /></td>
  140 + </tr> -->
  141 + </table>
  142 + </fieldset>
  143 + </div>
  144 +
  145 + <div id="advanced_panel" class="panel">
  146 + <fieldset>
  147 + <legend>{$lang_advimage_swap_image}</legend>
  148 +
  149 + <input type="checkbox" id="onmousemovecheck" name="onmousemovecheck" class="checkbox" onclick="changeMouseMove();" />
  150 + <label id="onmousemovechecklabel" for="onmousemovecheck">{$lang_advimage_alt_image}</label>
  151 +
  152 + <table border="0" cellpadding="4" cellspacing="0" width="100%">
  153 + <tr>
  154 + <td class="column1"><label id="onmouseoversrclabel" for="onmouseoversrc">{$lang_advimage_mouseover}</label></td>
  155 + <td><table border="0" cellspacing="0" cellpadding="0">
  156 + <tr>
  157 + <td><input id="onmouseoversrc" name="onmouseoversrc" type="text" value="" /></td>
  158 + <td id="onmouseoversrccontainer">&nbsp;</td>
  159 + </tr>
  160 + </table></td>
  161 + </tr>
  162 + <tr id="imagelistoverrow">
  163 + <td class="column1"><label for="imagelistover">{$lang_image_list}</label></td>
  164 + <td id="imagelistovercontainer">&nbsp;</td>
  165 + </tr>
  166 + <tr>
  167 + <td class="column1"><label id="onmouseoutsrclabel" for="onmouseoutsrc">{$lang_advimage_mouseout}</label></td>
  168 + <td class="column2"><table border="0" cellspacing="0" cellpadding="0">
  169 + <tr>
  170 + <td><input id="onmouseoutsrc" name="onmouseoutsrc" type="text" value="" /></td>
  171 + <td id="onmouseoutsrccontainer">&nbsp;</td>
  172 + </tr>
  173 + </table></td>
  174 + </tr>
  175 + <tr id="imagelistoutrow">
  176 + <td class="column1"><label for="imagelistout">{$lang_image_list}</label></td>
  177 + <td id="imagelistoutcontainer">&nbsp;</td>
  178 + </tr>
  179 + </table>
  180 + </fieldset>
  181 +
  182 + <fieldset>
  183 + <legend>{$lang_advimage_misc}</legend>
  184 +
  185 + <table border="0" cellpadding="4" cellspacing="0">
  186 + <tr>
  187 + <td class="column1"><label id="idlabel" for="id">{$lang_advimage_id}</label></td>
  188 + <td><input id="id" name="id" type="text" value="" /></td>
  189 + </tr>
  190 +
  191 + <tr>
  192 + <td class="column1"><label id="dirlabel" for="dir">{$lang_advimage_langdir}</label></td>
  193 + <td>
  194 + <select id="dir" name="dir" onchange="changeAppearance();">
  195 + <option value="">{$lang_not_set}</option>
  196 + <option value="ltr">{$lang_advimage_ltr}</option>
  197 + <option value="rtl">{$lang_advimage_rtl}</option>
  198 + </select>
  199 + </td>
  200 + </tr>
  201 +
  202 + <tr>
  203 + <td class="column1"><label id="langlabel" for="lang">{$lang_advimage_langcode}</label></td>
  204 + <td>
  205 + <input id="lang" name="lang" type="text" value="" />
  206 + </td>
  207 + </tr>
  208 +
  209 + <tr>
  210 + <td class="column1"><label id="usemaplabel" for="usemap">{$lang_advimage_image_map}</label></td>
  211 + <td>
  212 + <input id="usemap" name="usemap" type="text" value="" />
  213 + </td>
  214 + </tr>
  215 +
  216 + <tr>
  217 + <td class="column1"><label id="longdesclabel" for="longdesc">{$lang_advimage_long_desc}</label></td>
  218 + <td><table border="0" cellspacing="0" cellpadding="0">
  219 + <tr>
  220 + <td><input id="longdesc" name="longdesc" type="text" value="" /></td>
  221 + <td id="longdesccontainer">&nbsp;</td>
  222 + </tr>
  223 + </table></td>
  224 + </tr>
  225 + </table>
  226 + </fieldset>
  227 + </div>
  228 + </div>
  229 +
  230 + <div class="mceActionPanel">
  231 + <div style="float: left">
  232 + <input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertAction();" />
  233 + </div>
  234 +
  235 + <div style="float: right">
  236 + <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="cancelAction();" />
  237 + </div>
  238 + </div>
  239 + </form>
  240 +</body>
  241 +</html>
public/javascripts/tiny_mce/plugins/advimage/images/sample.gif 0 → 100755

1.59 KB

public/javascripts/tiny_mce/plugins/advimage/jscripts/functions.js 0 → 100755
@@ -0,0 +1,538 @@ @@ -0,0 +1,538 @@
  1 +/* Functions for the advimage plugin popup */
  2 +
  3 +var preloadImg = null;
  4 +var orgImageWidth, orgImageHeight;
  5 +
  6 +function preinit() {
  7 + // Initialize
  8 + tinyMCE.setWindowArg('mce_windowresize', false);
  9 +
  10 + // Import external list url javascript
  11 + var url = tinyMCE.getParam("external_image_list_url");
  12 + if (url != null) {
  13 + // Fix relative
  14 + if (url.charAt(0) != '/' && url.indexOf('://') == -1)
  15 + url = tinyMCE.documentBasePath + "/" + url;
  16 +
  17 + document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>');
  18 + }
  19 +}
  20 +
  21 +function convertURL(url, node, on_save) {
  22 + return eval("tinyMCEPopup.windowOpener." + tinyMCE.settings['urlconverter_callback'] + "(url, node, on_save);");
  23 +}
  24 +
  25 +function getImageSrc(str) {
  26 + var pos = -1;
  27 +
  28 + if (!str)
  29 + return "";
  30 +
  31 + if ((pos = str.indexOf('this.src=')) != -1) {
  32 + var src = str.substring(pos + 10);
  33 +
  34 + src = src.substring(0, src.indexOf('\''));
  35 +
  36 + if (tinyMCE.getParam('convert_urls'))
  37 + src = convertURL(src, null, true);
  38 +
  39 + return src;
  40 + }
  41 +
  42 + return "";
  43 +}
  44 +
  45 +function init() {
  46 + tinyMCEPopup.resizeToInnerSize();
  47 +
  48 + var formObj = document.forms[0];
  49 + var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
  50 + var elm = inst.getFocusElement();
  51 + var action = "insert";
  52 + var html = "";
  53 +
  54 + // Image list src
  55 + html = getImageListHTML('imagelistsrc','src','onSelectMainImage');
  56 + if (html == "")
  57 + document.getElementById("imagelistsrcrow").style.display = 'none';
  58 + else
  59 + document.getElementById("imagelistsrccontainer").innerHTML = html;
  60 +
  61 + // Image list oversrc
  62 + html = getImageListHTML('imagelistover','onmouseoversrc');
  63 + if (html == "")
  64 + document.getElementById("imagelistoverrow").style.display = 'none';
  65 + else
  66 + document.getElementById("imagelistovercontainer").innerHTML = html;
  67 +
  68 + // Image list outsrc
  69 + html = getImageListHTML('imagelistout','onmouseoutsrc');
  70 + if (html == "")
  71 + document.getElementById("imagelistoutrow").style.display = 'none';
  72 + else
  73 + document.getElementById("imagelistoutcontainer").innerHTML = html;
  74 +
  75 + // Src browser
  76 + html = getBrowserHTML('srcbrowser','src','image','advimage');
  77 + document.getElementById("srcbrowsercontainer").innerHTML = html;
  78 +
  79 + // Over browser
  80 + html = getBrowserHTML('oversrcbrowser','onmouseoversrc','image','advimage');
  81 + document.getElementById("onmouseoversrccontainer").innerHTML = html;
  82 +
  83 + // Out browser
  84 + html = getBrowserHTML('outsrcbrowser','onmouseoutsrc','image','advimage');
  85 + document.getElementById("onmouseoutsrccontainer").innerHTML = html;
  86 +
  87 + // Longdesc browser
  88 + html = getBrowserHTML('longdescbrowser','longdesc','file','advimage');
  89 + document.getElementById("longdesccontainer").innerHTML = html;
  90 +
  91 + // Resize some elements
  92 + if (isVisible('srcbrowser'))
  93 + document.getElementById('src').style.width = '260px';
  94 +
  95 + if (isVisible('oversrcbrowser'))
  96 + document.getElementById('onmouseoversrc').style.width = '260px';
  97 +
  98 + if (isVisible('outsrcbrowser'))
  99 + document.getElementById('onmouseoutsrc').style.width = '260px';
  100 +
  101 + if (isVisible('longdescbrowser'))
  102 + document.getElementById('longdesc').style.width = '180px';
  103 +
  104 + // Check action
  105 + if (elm != null && elm.nodeName == "IMG")
  106 + action = "update";
  107 +
  108 + formObj.insert.value = tinyMCE.getLang('lang_' + action, 'Insert', true);
  109 +
  110 + if (action == "update") {
  111 + var src = tinyMCE.getAttrib(elm, 'src');
  112 + var onmouseoversrc = getImageSrc(tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onmouseover')));
  113 + var onmouseoutsrc = getImageSrc(tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onmouseout')));
  114 +
  115 + src = convertURL(src, elm, true);
  116 +
  117 + // Use mce_src if found
  118 + var mceRealSrc = tinyMCE.getAttrib(elm, 'mce_src');
  119 + if (mceRealSrc != "") {
  120 + src = mceRealSrc;
  121 +
  122 + if (tinyMCE.getParam('convert_urls'))
  123 + src = convertURL(src, elm, true);
  124 + }
  125 +
  126 + if (onmouseoversrc != "" && tinyMCE.getParam('convert_urls'))
  127 + onmouseoversrc = convertURL(onmouseoversrc, elm, true);
  128 +
  129 + if (onmouseoutsrc != "" && tinyMCE.getParam('convert_urls'))
  130 + onmouseoutsrc = convertURL(onmouseoutsrc, elm, true);
  131 +
  132 + // Setup form data
  133 + var style = tinyMCE.parseStyle(tinyMCE.getAttrib(elm, "style"));
  134 +
  135 + // Store away old size
  136 + orgImageWidth = trimSize(getStyle(elm, 'width'))
  137 + orgImageHeight = trimSize(getStyle(elm, 'height'));
  138 +
  139 + formObj.src.value = src;
  140 + formObj.alt.value = tinyMCE.getAttrib(elm, 'alt');
  141 + formObj.title.value = tinyMCE.getAttrib(elm, 'title');
  142 + formObj.border.value = trimSize(getStyle(elm, 'border', 'borderWidth'));
  143 + formObj.vspace.value = tinyMCE.getAttrib(elm, 'vspace');
  144 + formObj.hspace.value = tinyMCE.getAttrib(elm, 'hspace');
  145 + formObj.width.value = orgImageWidth;
  146 + formObj.height.value = orgImageHeight;
  147 + formObj.onmouseoversrc.value = onmouseoversrc;
  148 + formObj.onmouseoutsrc.value = onmouseoutsrc;
  149 + formObj.id.value = tinyMCE.getAttrib(elm, 'id');
  150 + formObj.dir.value = tinyMCE.getAttrib(elm, 'dir');
  151 + formObj.lang.value = tinyMCE.getAttrib(elm, 'lang');
  152 + formObj.longdesc.value = tinyMCE.getAttrib(elm, 'longdesc');
  153 + formObj.usemap.value = tinyMCE.getAttrib(elm, 'usemap');
  154 + formObj.style.value = tinyMCE.serializeStyle(style);
  155 +
  156 + // Select by the values
  157 + if (tinyMCE.isMSIE)
  158 + selectByValue(formObj, 'align', getStyle(elm, 'align', 'styleFloat'));
  159 + else
  160 + selectByValue(formObj, 'align', getStyle(elm, 'align', 'cssFloat'));
  161 +
  162 + addClassesToList('classlist', 'advimage_styles');
  163 +
  164 + selectByValue(formObj, 'classlist', tinyMCE.getAttrib(elm, 'class'));
  165 + selectByValue(formObj, 'imagelistsrc', src);
  166 + selectByValue(formObj, 'imagelistover', onmouseoversrc);
  167 + selectByValue(formObj, 'imagelistout', onmouseoutsrc);
  168 +
  169 + updateStyle();
  170 + showPreviewImage(src, true);
  171 + changeAppearance();
  172 +
  173 + window.focus();
  174 + } else
  175 + addClassesToList('classlist', 'advimage_styles');
  176 +
  177 + // If option enabled default contrain proportions to checked
  178 + if (tinyMCE.getParam("advimage_constrain_proportions", true))
  179 + formObj.constrain.checked = true;
  180 +
  181 + // Check swap image if valid data
  182 + if (formObj.onmouseoversrc.value != "" || formObj.onmouseoutsrc.value != "")
  183 + setSwapImageDisabled(false);
  184 + else
  185 + setSwapImageDisabled(true);
  186 +}
  187 +
  188 +function setSwapImageDisabled(state) {
  189 + var formObj = document.forms[0];
  190 +
  191 + formObj.onmousemovecheck.checked = !state;
  192 +
  193 + setBrowserDisabled('overbrowser', state);
  194 + setBrowserDisabled('outbrowser', state);
  195 +
  196 + if (formObj.imagelistover)
  197 + formObj.imagelistover.disabled = state;
  198 +
  199 + if (formObj.imagelistout)
  200 + formObj.imagelistout.disabled = state;
  201 +
  202 + formObj.onmouseoversrc.disabled = state;
  203 + formObj.onmouseoutsrc.disabled = state;
  204 +}
  205 +
  206 +function setAttrib(elm, attrib, value) {
  207 + var formObj = document.forms[0];
  208 + var valueElm = formObj.elements[attrib];
  209 +
  210 + if (typeof(value) == "undefined" || value == null) {
  211 + value = "";
  212 +
  213 + if (valueElm)
  214 + value = valueElm.value;
  215 + }
  216 +
  217 + if (value != "") {
  218 + elm.setAttribute(attrib, value);
  219 +
  220 + if (attrib == "style")
  221 + attrib = "style.cssText";
  222 +
  223 + if (attrib == "longdesc")
  224 + attrib = "longDesc";
  225 +
  226 + if (attrib == "width") {
  227 + attrib = "style.width";
  228 + value = value + "px";
  229 + value = value.replace(/%px/g, 'px');
  230 + }
  231 +
  232 + if (attrib == "height") {
  233 + attrib = "style.height";
  234 + value = value + "px";
  235 + value = value.replace(/%px/g, 'px');
  236 + }
  237 +
  238 + if (attrib == "class")
  239 + attrib = "className";
  240 +
  241 + eval('elm.' + attrib + "=value;");
  242 + } else {
  243 + if (attrib == 'class')
  244 + elm.className = '';
  245 +
  246 + elm.removeAttribute(attrib);
  247 + }
  248 +}
  249 +
  250 +function makeAttrib(attrib, value) {
  251 + var formObj = document.forms[0];
  252 + var valueElm = formObj.elements[attrib];
  253 +
  254 + if (typeof(value) == "undefined" || value == null) {
  255 + value = "";
  256 +
  257 + if (valueElm)
  258 + value = valueElm.value;
  259 + }
  260 +
  261 + if (value == "")
  262 + return "";
  263 +
  264 + // XML encode it
  265 + value = value.replace(/&/g, '&amp;');
  266 + value = value.replace(/\"/g, '&quot;');
  267 + value = value.replace(/</g, '&lt;');
  268 + value = value.replace(/>/g, '&gt;');
  269 +
  270 + return ' ' + attrib + '="' + value + '"';
  271 +}
  272 +
  273 +function insertAction() {
  274 + var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
  275 + var elm = inst.getFocusElement();
  276 + var formObj = document.forms[0];
  277 + var src = formObj.src.value;
  278 + var onmouseoversrc = formObj.onmouseoversrc.value;
  279 + var onmouseoutsrc = formObj.onmouseoutsrc.value;
  280 +
  281 + if (!AutoValidator.validate(formObj)) {
  282 + alert(tinyMCE.getLang('lang_invalid_data'));
  283 + return false;
  284 + }
  285 +
  286 + if (tinyMCE.getParam("accessibility_warnings")) {
  287 + if (formObj.alt.value == "" && !confirm(tinyMCE.getLang('lang_advimage_missing_alt', '', true)))
  288 + return;
  289 + }
  290 +
  291 + if (onmouseoversrc && onmouseoversrc != "")
  292 + onmouseoversrc = "this.src='" + convertURL(onmouseoversrc, tinyMCE.imgElement) + "';";
  293 +
  294 + if (onmouseoutsrc && onmouseoutsrc != "")
  295 + onmouseoutsrc = "this.src='" + convertURL(onmouseoutsrc, tinyMCE.imgElement) + "';";
  296 +
  297 + if (elm != null && elm.nodeName == "IMG") {
  298 + setAttrib(elm, 'src', convertURL(src, tinyMCE.imgElement));
  299 + setAttrib(elm, 'mce_src', src);
  300 + setAttrib(elm, 'alt');
  301 + setAttrib(elm, 'title');
  302 + setAttrib(elm, 'border');
  303 + setAttrib(elm, 'vspace');
  304 + setAttrib(elm, 'hspace');
  305 + setAttrib(elm, 'width');
  306 + setAttrib(elm, 'height');
  307 + setAttrib(elm, 'onmouseover', onmouseoversrc);
  308 + setAttrib(elm, 'onmouseout', onmouseoutsrc);
  309 + setAttrib(elm, 'id');
  310 + setAttrib(elm, 'dir');
  311 + setAttrib(elm, 'lang');
  312 + setAttrib(elm, 'longdesc');
  313 + setAttrib(elm, 'usemap');
  314 + setAttrib(elm, 'style');
  315 + setAttrib(elm, 'class', getSelectValue(formObj, 'classlist'));
  316 + setAttrib(elm, 'align', getSelectValue(formObj, 'align'));
  317 +
  318 + //tinyMCEPopup.execCommand("mceRepaint");
  319 +
  320 + // Repaint if dimensions changed
  321 + if (formObj.width.value != orgImageWidth || formObj.height.value != orgImageHeight)
  322 + inst.repaint();
  323 +
  324 + // Refresh in old MSIE
  325 + if (tinyMCE.isMSIE5)
  326 + elm.outerHTML = elm.outerHTML;
  327 + } else {
  328 + var html = "<img";
  329 +
  330 + html += makeAttrib('src', convertURL(src, tinyMCE.imgElement));
  331 + html += makeAttrib('mce_src', src);
  332 + html += makeAttrib('alt');
  333 + html += makeAttrib('title');
  334 + html += makeAttrib('border');
  335 + html += makeAttrib('vspace');
  336 + html += makeAttrib('hspace');
  337 + html += makeAttrib('width');
  338 + html += makeAttrib('height');
  339 + html += makeAttrib('onmouseover', onmouseoversrc);
  340 + html += makeAttrib('onmouseout', onmouseoutsrc);
  341 + html += makeAttrib('id');
  342 + html += makeAttrib('dir');
  343 + html += makeAttrib('lang');
  344 + html += makeAttrib('longdesc');
  345 + html += makeAttrib('usemap');
  346 + html += makeAttrib('style');
  347 + html += makeAttrib('class', getSelectValue(formObj, 'classlist'));
  348 + html += makeAttrib('align', getSelectValue(formObj, 'align'));
  349 + html += " />";
  350 +
  351 + tinyMCEPopup.execCommand("mceInsertContent", false, html);
  352 + }
  353 +
  354 + tinyMCE._setEventsEnabled(inst.getBody(), false);
  355 + tinyMCEPopup.close();
  356 +}
  357 +
  358 +function cancelAction() {
  359 + tinyMCEPopup.close();
  360 +}
  361 +
  362 +function changeAppearance() {
  363 + var formObj = document.forms[0];
  364 + var img = document.getElementById('alignSampleImg');
  365 +
  366 + if (img) {
  367 + img.align = formObj.align.value;
  368 + img.border = formObj.border.value;
  369 + img.hspace = formObj.hspace.value;
  370 + img.vspace = formObj.vspace.value;
  371 + }
  372 +}
  373 +
  374 +function changeMouseMove() {
  375 + var formObj = document.forms[0];
  376 +
  377 + setSwapImageDisabled(!formObj.onmousemovecheck.checked);
  378 +}
  379 +
  380 +function updateStyle() {
  381 + var formObj = document.forms[0];
  382 + var st = tinyMCE.parseStyle(formObj.style.value);
  383 +
  384 + if (tinyMCE.getParam('inline_styles', false)) {
  385 + st['width'] = formObj.width.value == '' ? '' : formObj.width.value + "px";
  386 + st['height'] = formObj.height.value == '' ? '' : formObj.height.value + "px";
  387 + st['border-width'] = formObj.border.value == '' ? '' : formObj.border.value + "px";
  388 + st['margin-top'] = formObj.vspace.value == '' ? '' : formObj.vspace.value + "px";
  389 + st['margin-bottom'] = formObj.vspace.value == '' ? '' : formObj.vspace.value + "px";
  390 + st['margin-left'] = formObj.hspace.value == '' ? '' : formObj.hspace.value + "px";
  391 + st['margin-right'] = formObj.hspace.value == '' ? '' : formObj.hspace.value + "px";
  392 + } else {
  393 + st['width'] = st['height'] = st['border-width'] = null;
  394 +
  395 + if (st['margin-top'] == st['margin-bottom'])
  396 + st['margin-top'] = st['margin-bottom'] = null;
  397 +
  398 + if (st['margin-left'] == st['margin-right'])
  399 + st['margin-left'] = st['margin-right'] = null;
  400 + }
  401 +
  402 + formObj.style.value = tinyMCE.serializeStyle(st);
  403 +}
  404 +
  405 +function styleUpdated() {
  406 + var formObj = document.forms[0];
  407 + var st = tinyMCE.parseStyle(formObj.style.value);
  408 +
  409 + if (st['width'])
  410 + formObj.width.value = st['width'].replace('px', '');
  411 +
  412 + if (st['height'])
  413 + formObj.height.value = st['height'].replace('px', '');
  414 +
  415 + if (st['margin-top'] && st['margin-top'] == st['margin-bottom'])
  416 + formObj.vspace.value = st['margin-top'].replace('px', '');
  417 +
  418 + if (st['margin-left'] && st['margin-left'] == st['margin-right'])
  419 + formObj.hspace.value = st['margin-left'].replace('px', '');
  420 +
  421 + if (st['border-width'])
  422 + formObj.border.value = st['border-width'].replace('px', '');
  423 +}
  424 +
  425 +function changeHeight() {
  426 + var formObj = document.forms[0];
  427 +
  428 + if (!formObj.constrain.checked || !preloadImg) {
  429 + updateStyle();
  430 + return;
  431 + }
  432 +
  433 + if (formObj.width.value == "" || formObj.height.value == "")
  434 + return;
  435 +
  436 + var temp = (parseInt(formObj.width.value) / parseInt(preloadImg.width)) * preloadImg.height;
  437 + formObj.height.value = temp.toFixed(0);
  438 + updateStyle();
  439 +}
  440 +
  441 +function changeWidth() {
  442 + var formObj = document.forms[0];
  443 +
  444 + if (!formObj.constrain.checked || !preloadImg) {
  445 + updateStyle();
  446 + return;
  447 + }
  448 +
  449 + if (formObj.width.value == "" || formObj.height.value == "")
  450 + return;
  451 +
  452 + var temp = (parseInt(formObj.height.value) / parseInt(preloadImg.height)) * preloadImg.width;
  453 + formObj.width.value = temp.toFixed(0);
  454 + updateStyle();
  455 +}
  456 +
  457 +function onSelectMainImage(target_form_element, name, value) {
  458 + var formObj = document.forms[0];
  459 +
  460 + formObj.alt.value = name;
  461 + formObj.title.value = name;
  462 +
  463 + resetImageData();
  464 + showPreviewImage(formObj.elements[target_form_element].value, false);
  465 +}
  466 +
  467 +function showPreviewImage(src, start) {
  468 + var formObj = document.forms[0];
  469 +
  470 + selectByValue(document.forms[0], 'imagelistsrc', src);
  471 +
  472 + var elm = document.getElementById('prev');
  473 + var src = src == "" ? src : tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], src);
  474 +
  475 + if (!start && tinyMCE.getParam("advimage_update_dimensions_onchange", true))
  476 + resetImageData();
  477 +
  478 + if (src == "")
  479 + elm.innerHTML = "";
  480 + else
  481 + elm.innerHTML = '<img id="previewImg" src="' + src + '" border="0" onload="updateImageData(' + start + ');" onerror="resetImageData();" />'
  482 +}
  483 +
  484 +function updateImageData(start) {
  485 + var formObj = document.forms[0];
  486 +
  487 + preloadImg = document.getElementById('previewImg');
  488 +
  489 + if (!start && formObj.width.value == "")
  490 + formObj.width.value = preloadImg.width;
  491 +
  492 + if (!start && formObj.height.value == "")
  493 + formObj.height.value = preloadImg.height;
  494 +
  495 + updateStyle();
  496 +}
  497 +
  498 +function resetImageData() {
  499 + var formObj = document.forms[0];
  500 + formObj.width.value = formObj.height.value = "";
  501 +}
  502 +
  503 +function getSelectValue(form_obj, field_name) {
  504 + var elm = form_obj.elements[field_name];
  505 +
  506 + if (elm == null || elm.options == null)
  507 + return "";
  508 +
  509 + return elm.options[elm.selectedIndex].value;
  510 +}
  511 +
  512 +function getImageListHTML(elm_id, target_form_element, onchange_func) {
  513 + if (typeof(tinyMCEImageList) == "undefined" || tinyMCEImageList.length == 0)
  514 + return "";
  515 +
  516 + var html = "";
  517 +
  518 + html += '<select id="' + elm_id + '" name="' + elm_id + '"';
  519 + html += ' class="mceImageList" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target_form_element + '.value=';
  520 + html += 'this.options[this.selectedIndex].value;';
  521 +
  522 + if (typeof(onchange_func) != "undefined")
  523 + html += onchange_func + '(\'' + target_form_element + '\',this.options[this.selectedIndex].text,this.options[this.selectedIndex].value);';
  524 +
  525 + html += '"><option value="">---</option>';
  526 +
  527 + for (var i=0; i<tinyMCEImageList.length; i++)
  528 + html += '<option value="' + tinyMCEImageList[i][1] + '">' + tinyMCEImageList[i][0] + '</option>';
  529 +
  530 + html += '</select>';
  531 +
  532 + return html;
  533 +
  534 + // tinyMCE.debug('-- image list start --', html, '-- image list end --');
  535 +}
  536 +
  537 +// While loading
  538 +preinit();
public/javascripts/tiny_mce/plugins/advimage/langs/en.js 0 → 100755
@@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
  1 +// UK lang variables
  2 +
  3 +tinyMCE.addToLang('advimage',{
  4 +tab_general : 'General',
  5 +tab_appearance : 'Appearance',
  6 +tab_advanced : 'Advanced',
  7 +general : 'General',
  8 +title : 'Title',
  9 +preview : 'Preview',
  10 +constrain_proportions : 'Constrain proportions',
  11 +langdir : 'Language direction',
  12 +langcode : 'Language code',
  13 +long_desc : 'Long description link',
  14 +style : 'Style',
  15 +classes : 'Classes',
  16 +ltr : 'Left to right',
  17 +rtl : 'Right to left',
  18 +id : 'Id',
  19 +image_map : 'Image map',
  20 +swap_image : 'Swap image',
  21 +alt_image : 'Alternative image',
  22 +mouseover : 'for mouse over',
  23 +mouseout : 'for mouse out',
  24 +misc : 'Miscellaneous',
  25 +example_img : 'Appearance&nbsp;preview&nbsp;image',
  26 +missing_alt : 'Are you sure you want to continue without including an Image Description? Without it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images turned off.'
  27 +});
public/javascripts/tiny_mce/plugins/advimage/readme.txt 0 → 100755
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +Check the TinyMCE documentation for details on this plugin.
public/javascripts/tiny_mce/plugins/advlink/css/advlink.css 0 → 100755
@@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
  1 +/* CSS file for advimage plugin popup */
  2 +
  3 +.mceLinkList, .mceAnchorList, #targetlist {
  4 + width: 280px;
  5 +}
  6 +
  7 +.mceActionPanel {
  8 + margin-top: 7px;
  9 +}
  10 +
  11 +.panel_wrapper div.current {
  12 + height: 320px;
  13 +}
  14 +
  15 +#classlist, #title, #href {
  16 + width: 280px;
  17 +}
  18 +
  19 +#popupurl, #popupname {
  20 + width: 200px;
  21 +}
  22 +
  23 +#popupwidth, #popupheight, #popupleft, #popuptop {
  24 + width: 30px;
  25 + vertical-align: middle;
  26 + text-align: center;
  27 +}
  28 +
  29 +#id, #style, #classes, #target, #dir, #hreflang, #lang, #charset, #type, #rel, #rev, #tabindex, #accesskey {
  30 + width: 200px;
  31 +}
  32 +
  33 +#events_panel input {
  34 + width: 200px;
  35 +}
public/javascripts/tiny_mce/plugins/advlink/editor_plugin.js 0 → 100755
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +tinyMCE.importPluginLanguagePack('advlink');var TinyMCE_AdvancedLinkPlugin={getInfo:function(){return{longname:'Advanced link',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},initInstance:function(inst){inst.addShortcut('ctrl','k','lang_advlink_desc','mceAdvLink')},getControlHTML:function(cn){switch(cn){case"link":return tinyMCE.getButtonHTML(cn,'lang_link_desc','{$themeurl}/images/link.gif','mceAdvLink')}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceAdvLink":var inst=tinyMCE.getInstanceById(editor_id),anySelection=false;var focusElm=inst.getFocusElement(),selectedText=inst.selection.getSelectedText();if(tinyMCE.selectedElement)anySelection=(tinyMCE.selectedElement.nodeName.toLowerCase()=="img")||(selectedText&&selectedText.length>0);if(anySelection||(focusElm!=null&&focusElm.nodeName=="A")){tinyMCE.openWindow({file:'../../plugins/advlink/link.htm',width:480+tinyMCE.getLang('lang_advlink_delta_width',0),height:400+tinyMCE.getLang('lang_advlink_delta_height',0)},{editor_id:editor_id,inline:"yes"})}return true}return false},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){if(node==null)return;do{if(node.nodeName=="A"&&tinyMCE.getAttrib(node,'href')!=""){tinyMCE.switchClass(editor_id+'_advlink','mceButtonSelected');return true}}while((node=node.parentNode));if(any_selection){tinyMCE.switchClass(editor_id+'_advlink','mceButtonNormal');return true}tinyMCE.switchClass(editor_id+'_advlink','mceButtonDisabled');return true}};tinyMCE.addPlugin("advlink",TinyMCE_AdvancedLinkPlugin);
0 \ No newline at end of file 2 \ No newline at end of file
public/javascripts/tiny_mce/plugins/advlink/editor_plugin_src.js 0 → 100755
@@ -0,0 +1,83 @@ @@ -0,0 +1,83 @@
  1 +/**
  2 + * $Id: editor_plugin_src.js 268 2007-04-28 15:52:59Z spocke $
  3 + *
  4 + * @author Moxiecode
  5 + * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
  6 + */
  7 +
  8 +/* Import plugin specific language pack */
  9 +tinyMCE.importPluginLanguagePack('advlink');
  10 +
  11 +var TinyMCE_AdvancedLinkPlugin = {
  12 + getInfo : function() {
  13 + return {
  14 + longname : 'Advanced link',
  15 + author : 'Moxiecode Systems AB',
  16 + authorurl : 'http://tinymce.moxiecode.com',
  17 + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',
  18 + version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
  19 + };
  20 + },
  21 +
  22 + initInstance : function(inst) {
  23 + inst.addShortcut('ctrl', 'k', 'lang_advlink_desc', 'mceAdvLink');
  24 + },
  25 +
  26 + getControlHTML : function(cn) {
  27 + switch (cn) {
  28 + case "link":
  29 + return tinyMCE.getButtonHTML(cn, 'lang_link_desc', '{$themeurl}/images/link.gif', 'mceAdvLink');
  30 + }
  31 +
  32 + return "";
  33 + },
  34 +
  35 + execCommand : function(editor_id, element, command, user_interface, value) {
  36 + switch (command) {
  37 + case "mceAdvLink":
  38 + var inst = tinyMCE.getInstanceById(editor_id), anySelection = false;
  39 + var focusElm = inst.getFocusElement(), selectedText = inst.selection.getSelectedText();
  40 +
  41 + if (tinyMCE.selectedElement)
  42 + anySelection = (tinyMCE.selectedElement.nodeName.toLowerCase() == "img") || (selectedText && selectedText.length > 0);
  43 +
  44 + if (anySelection || (focusElm != null && focusElm.nodeName == "A")) {
  45 + tinyMCE.openWindow({
  46 + file : '../../plugins/advlink/link.htm',
  47 + width : 480 + tinyMCE.getLang('lang_advlink_delta_width', 0),
  48 + height : 400 + tinyMCE.getLang('lang_advlink_delta_height', 0)
  49 + }, {
  50 + editor_id : editor_id,
  51 + inline : "yes"
  52 + });
  53 + }
  54 +
  55 + return true;
  56 + }
  57 +
  58 + return false;
  59 + },
  60 +
  61 + handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
  62 + if (node == null)
  63 + return;
  64 +
  65 + do {
  66 + if (node.nodeName == "A" && tinyMCE.getAttrib(node, 'href') != "") {
  67 + tinyMCE.switchClass(editor_id + '_advlink', 'mceButtonSelected');
  68 + return true;
  69 + }
  70 + } while ((node = node.parentNode));
  71 +
  72 + if (any_selection) {
  73 + tinyMCE.switchClass(editor_id + '_advlink', 'mceButtonNormal');
  74 + return true;
  75 + }
  76 +
  77 + tinyMCE.switchClass(editor_id + '_advlink', 'mceButtonDisabled');
  78 +
  79 + return true;
  80 + }
  81 +};
  82 +
  83 +tinyMCE.addPlugin("advlink", TinyMCE_AdvancedLinkPlugin);
public/javascripts/tiny_mce/plugins/advlink/jscripts/functions.js 0 → 100755
@@ -0,0 +1,587 @@ @@ -0,0 +1,587 @@
  1 +/* Functions for the advlink plugin popup */
  2 +
  3 +var templates = {
  4 + "window.open" : "window.open('${url}','${target}','${options}')"
  5 +};
  6 +
  7 +function preinit() {
  8 + // Initialize
  9 + tinyMCE.setWindowArg('mce_windowresize', false);
  10 +
  11 + // Import external list url javascript
  12 + var url = tinyMCE.getParam("external_link_list_url");
  13 + if (url != null) {
  14 + // Fix relative
  15 + if (url.charAt(0) != '/' && url.indexOf('://') == -1)
  16 + url = tinyMCE.documentBasePath + "/" + url;
  17 +
  18 + document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>');
  19 + }
  20 +}
  21 +
  22 +function changeClass() {
  23 + var formObj = document.forms[0];
  24 + formObj.classes.value = getSelectValue(formObj, 'classlist');
  25 +}
  26 +
  27 +function init() {
  28 + tinyMCEPopup.resizeToInnerSize();
  29 +
  30 + var formObj = document.forms[0];
  31 + var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
  32 + var elm = inst.getFocusElement();
  33 + var action = "insert";
  34 + var html;
  35 +
  36 + document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','advlink');
  37 + document.getElementById('popupurlbrowsercontainer').innerHTML = getBrowserHTML('popupurlbrowser','popupurl','file','advlink');
  38 + document.getElementById('linklisthrefcontainer').innerHTML = getLinkListHTML('linklisthref','href');
  39 + document.getElementById('anchorlistcontainer').innerHTML = getAnchorListHTML('anchorlist','href');
  40 + document.getElementById('targetlistcontainer').innerHTML = getTargetListHTML('targetlist','target');
  41 +
  42 + // Link list
  43 + html = getLinkListHTML('linklisthref','href');
  44 + if (html == "")
  45 + document.getElementById("linklisthrefrow").style.display = 'none';
  46 + else
  47 + document.getElementById("linklisthrefcontainer").innerHTML = html;
  48 +
  49 + // Resize some elements
  50 + if (isVisible('hrefbrowser'))
  51 + document.getElementById('href').style.width = '260px';
  52 +
  53 + if (isVisible('popupurlbrowser'))
  54 + document.getElementById('popupurl').style.width = '180px';
  55 +
  56 + elm = tinyMCE.getParentElement(elm, "a");
  57 + if (elm != null && elm.nodeName == "A")
  58 + action = "update";
  59 +
  60 + formObj.insert.value = tinyMCE.getLang('lang_' + action, 'Insert', true);
  61 +
  62 + setPopupControlsDisabled(true);
  63 +
  64 + if (action == "update") {
  65 + var href = tinyMCE.getAttrib(elm, 'href');
  66 +
  67 + href = convertURL(href, elm, true);
  68 +
  69 + // Use mce_href if found
  70 + var mceRealHref = tinyMCE.getAttrib(elm, 'mce_href');
  71 + if (mceRealHref != "") {
  72 + href = mceRealHref;
  73 +
  74 + if (tinyMCE.getParam('convert_urls'))
  75 + href = convertURL(href, elm, true);
  76 + }
  77 +
  78 + var onclick = tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onclick'));
  79 +
  80 + // Setup form data
  81 + setFormValue('href', href);
  82 + setFormValue('title', tinyMCE.getAttrib(elm, 'title'));
  83 + setFormValue('id', tinyMCE.getAttrib(elm, 'id'));
  84 + setFormValue('style', tinyMCE.serializeStyle(tinyMCE.parseStyle(tinyMCE.getAttrib(elm, "style"))));
  85 + setFormValue('rel', tinyMCE.getAttrib(elm, 'rel'));
  86 + setFormValue('rev', tinyMCE.getAttrib(elm, 'rev'));
  87 + setFormValue('charset', tinyMCE.getAttrib(elm, 'charset'));
  88 + setFormValue('hreflang', tinyMCE.getAttrib(elm, 'hreflang'));
  89 + setFormValue('dir', tinyMCE.getAttrib(elm, 'dir'));
  90 + setFormValue('lang', tinyMCE.getAttrib(elm, 'lang'));
  91 + setFormValue('tabindex', tinyMCE.getAttrib(elm, 'tabindex', typeof(elm.tabindex) != "undefined" ? elm.tabindex : ""));
  92 + setFormValue('accesskey', tinyMCE.getAttrib(elm, 'accesskey', typeof(elm.accesskey) != "undefined" ? elm.accesskey : ""));
  93 + setFormValue('type', tinyMCE.getAttrib(elm, 'type'));
  94 + setFormValue('onfocus', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onfocus')));
  95 + setFormValue('onblur', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onblur')));
  96 + setFormValue('onclick', onclick);
  97 + setFormValue('ondblclick', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'ondblclick')));
  98 + setFormValue('onmousedown', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onmousedown')));
  99 + setFormValue('onmouseup', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onmouseup')));
  100 + setFormValue('onmouseover', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onmouseover')));
  101 + setFormValue('onmousemove', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onmousemove')));
  102 + setFormValue('onmouseout', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onmouseout')));
  103 + setFormValue('onkeypress', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onkeypress')));
  104 + setFormValue('onkeydown', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onkeydown')));
  105 + setFormValue('onkeyup', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onkeyup')));
  106 + setFormValue('target', tinyMCE.getAttrib(elm, 'target'));
  107 + setFormValue('classes', tinyMCE.getAttrib(elm, 'class'));
  108 +
  109 + // Parse onclick data
  110 + if (onclick != null && onclick.indexOf('window.open') != -1)
  111 + parseWindowOpen(onclick);
  112 + else
  113 + parseFunction(onclick);
  114 +
  115 + // Select by the values
  116 + selectByValue(formObj, 'dir', tinyMCE.getAttrib(elm, 'dir'));
  117 + selectByValue(formObj, 'rel', tinyMCE.getAttrib(elm, 'rel'));
  118 + selectByValue(formObj, 'rev', tinyMCE.getAttrib(elm, 'rev'));
  119 + selectByValue(formObj, 'linklisthref', href);
  120 +
  121 + if (href.charAt(0) == '#')
  122 + selectByValue(formObj, 'anchorlist', href);
  123 +
  124 + addClassesToList('classlist', 'advlink_styles');
  125 +
  126 + selectByValue(formObj, 'classlist', tinyMCE.getAttrib(elm, 'class'), true);
  127 + selectByValue(formObj, 'targetlist', tinyMCE.getAttrib(elm, 'target'), true);
  128 + } else
  129 + addClassesToList('classlist', 'advlink_styles');
  130 +
  131 + window.focus();
  132 +}
  133 +
  134 +function checkPrefix(n) {
  135 + if (!Validator.isEmpty(n) && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCE.getLang('lang_is_email')))
  136 + n.value = 'mailto:' + n.value;
  137 +
  138 + if (/^\s*www./i.test(n.value) && confirm(tinyMCE.getLang('lang_is_external')))
  139 + n.value = 'http://' + n.value;
  140 +}
  141 +
  142 +function setFormValue(name, value) {
  143 + document.forms[0].elements[name].value = value;
  144 +}
  145 +
  146 +function convertURL(url, node, on_save) {
  147 + return eval("tinyMCEPopup.windowOpener." + tinyMCE.settings['urlconverter_callback'] + "(url, node, on_save);");
  148 +}
  149 +
  150 +function parseWindowOpen(onclick) {
  151 + var formObj = document.forms[0];
  152 +
  153 + // Preprocess center code
  154 + if (onclick.indexOf('return false;') != -1) {
  155 + formObj.popupreturn.checked = true;
  156 + onclick = onclick.replace('return false;', '');
  157 + } else
  158 + formObj.popupreturn.checked = false;
  159 +
  160 + var onClickData = parseLink(onclick);
  161 +
  162 + if (onClickData != null) {
  163 + formObj.ispopup.checked = true;
  164 + setPopupControlsDisabled(false);
  165 +
  166 + var onClickWindowOptions = parseOptions(onClickData['options']);
  167 + var url = onClickData['url'];
  168 +
  169 + if (tinyMCE.getParam('convert_urls'))
  170 + url = convertURL(url, null, true);
  171 +
  172 + formObj.popupname.value = onClickData['target'];
  173 + formObj.popupurl.value = url;
  174 + formObj.popupwidth.value = getOption(onClickWindowOptions, 'width');
  175 + formObj.popupheight.value = getOption(onClickWindowOptions, 'height');
  176 +
  177 + formObj.popupleft.value = getOption(onClickWindowOptions, 'left');
  178 + formObj.popuptop.value = getOption(onClickWindowOptions, 'top');
  179 +
  180 + if (formObj.popupleft.value.indexOf('screen') != -1)
  181 + formObj.popupleft.value = "c";
  182 +
  183 + if (formObj.popuptop.value.indexOf('screen') != -1)
  184 + formObj.popuptop.value = "c";
  185 +
  186 + formObj.popuplocation.checked = getOption(onClickWindowOptions, 'location') == "yes";
  187 + formObj.popupscrollbars.checked = getOption(onClickWindowOptions, 'scrollbars') == "yes";
  188 + formObj.popupmenubar.checked = getOption(onClickWindowOptions, 'menubar') == "yes";
  189 + formObj.popupresizable.checked = getOption(onClickWindowOptions, 'resizable') == "yes";
  190 + formObj.popuptoolbar.checked = getOption(onClickWindowOptions, 'toolbar') == "yes";
  191 + formObj.popupstatus.checked = getOption(onClickWindowOptions, 'status') == "yes";
  192 + formObj.popupdependent.checked = getOption(onClickWindowOptions, 'dependent') == "yes";
  193 +
  194 + buildOnClick();
  195 + }
  196 +}
  197 +
  198 +function parseFunction(onclick) {
  199 + var formObj = document.forms[0];
  200 + var onClickData = parseLink(onclick);
  201 +
  202 + // TODO: Add stuff here
  203 +}
  204 +
  205 +function getOption(opts, name) {
  206 + return typeof(opts[name]) == "undefined" ? "" : opts[name];
  207 +}
  208 +
  209 +function setPopupControlsDisabled(state) {
  210 + var formObj = document.forms[0];
  211 +
  212 + formObj.popupname.disabled = state;
  213 + formObj.popupurl.disabled = state;
  214 + formObj.popupwidth.disabled = state;
  215 + formObj.popupheight.disabled = state;
  216 + formObj.popupleft.disabled = state;
  217 + formObj.popuptop.disabled = state;
  218 + formObj.popuplocation.disabled = state;
  219 + formObj.popupscrollbars.disabled = state;
  220 + formObj.popupmenubar.disabled = state;
  221 + formObj.popupresizable.disabled = state;
  222 + formObj.popuptoolbar.disabled = state;
  223 + formObj.popupstatus.disabled = state;
  224 + formObj.popupreturn.disabled = state;
  225 + formObj.popupdependent.disabled = state;
  226 +
  227 + setBrowserDisabled('popupurlbrowser', state);
  228 +}
  229 +
  230 +function parseLink(link) {
  231 + link = link.replace(new RegExp('&#39;', 'g'), "'");
  232 +
  233 + var fnName = link.replace(new RegExp("\\s*([A-Za-z0-9\.]*)\\s*\\(.*", "gi"), "$1");
  234 +
  235 + // Is function name a template function
  236 + var template = templates[fnName];
  237 + if (template) {
  238 + // Build regexp
  239 + var variableNames = template.match(new RegExp("'?\\$\\{[A-Za-z0-9\.]*\\}'?", "gi"));
  240 + var regExp = "\\s*[A-Za-z0-9\.]*\\s*\\(";
  241 + var replaceStr = "";
  242 + for (var i=0; i<variableNames.length; i++) {
  243 + // Is string value
  244 + if (variableNames[i].indexOf("'${") != -1)
  245 + regExp += "'(.*)'";
  246 + else // Number value
  247 + regExp += "([0-9]*)";
  248 +
  249 + replaceStr += "$" + (i+1);
  250 +
  251 + // Cleanup variable name
  252 + variableNames[i] = variableNames[i].replace(new RegExp("[^A-Za-z0-9]", "gi"), "");
  253 +
  254 + if (i != variableNames.length-1) {
  255 + regExp += "\\s*,\\s*";
  256 + replaceStr += "<delim>";
  257 + } else
  258 + regExp += ".*";
  259 + }
  260 +
  261 + regExp += "\\);?";
  262 +
  263 + // Build variable array
  264 + var variables = new Array();
  265 + variables["_function"] = fnName;
  266 + var variableValues = link.replace(new RegExp(regExp, "gi"), replaceStr).split('<delim>');
  267 + for (var i=0; i<variableNames.length; i++)
  268 + variables[variableNames[i]] = variableValues[i];
  269 +
  270 + return variables;
  271 + }
  272 +
  273 + return null;
  274 +}
  275 +
  276 +function parseOptions(opts) {
  277 + if (opts == null || opts == "")
  278 + return new Array();
  279 +
  280 + // Cleanup the options
  281 + opts = opts.toLowerCase();
  282 + opts = opts.replace(/;/g, ",");
  283 + opts = opts.replace(/[^0-9a-z=,]/g, "");
  284 +
  285 + var optionChunks = opts.split(',');
  286 + var options = new Array();
  287 +
  288 + for (var i=0; i<optionChunks.length; i++) {
  289 + var parts = optionChunks[i].split('=');
  290 +
  291 + if (parts.length == 2)
  292 + options[parts[0]] = parts[1];
  293 + }
  294 +
  295 + return options;
  296 +}
  297 +
  298 +function buildOnClick() {
  299 + var formObj = document.forms[0];
  300 +
  301 + if (!formObj.ispopup.checked) {
  302 + formObj.onclick.value = "";
  303 + return;
  304 + }
  305 +
  306 + var onclick = "window.open('";
  307 + var url = formObj.popupurl.value;
  308 +
  309 + if (tinyMCE.getParam('convert_urls'))
  310 + url = convertURL(url, null, true);
  311 +
  312 + onclick += url + "','";
  313 + onclick += formObj.popupname.value + "','";
  314 +
  315 + if (formObj.popuplocation.checked)
  316 + onclick += "location=yes,";
  317 +
  318 + if (formObj.popupscrollbars.checked)
  319 + onclick += "scrollbars=yes,";
  320 +
  321 + if (formObj.popupmenubar.checked)
  322 + onclick += "menubar=yes,";
  323 +
  324 + if (formObj.popupresizable.checked)
  325 + onclick += "resizable=yes,";
  326 +
  327 + if (formObj.popuptoolbar.checked)
  328 + onclick += "toolbar=yes,";
  329 +
  330 + if (formObj.popupstatus.checked)
  331 + onclick += "status=yes,";
  332 +
  333 + if (formObj.popupdependent.checked)
  334 + onclick += "dependent=yes,";
  335 +
  336 + if (formObj.popupwidth.value != "")
  337 + onclick += "width=" + formObj.popupwidth.value + ",";
  338 +
  339 + if (formObj.popupheight.value != "")
  340 + onclick += "height=" + formObj.popupheight.value + ",";
  341 +
  342 + if (formObj.popupleft.value != "") {
  343 + if (formObj.popupleft.value != "c")
  344 + onclick += "left=" + formObj.popupleft.value + ",";
  345 + else
  346 + onclick += "left='+(screen.availWidth/2-" + (formObj.popupwidth.value/2) + ")+',";
  347 + }
  348 +
  349 + if (formObj.popuptop.value != "") {
  350 + if (formObj.popuptop.value != "c")
  351 + onclick += "top=" + formObj.popuptop.value + ",";
  352 + else
  353 + onclick += "top='+(screen.availHeight/2-" + (formObj.popupheight.value/2) + ")+',";
  354 + }
  355 +
  356 + if (onclick.charAt(onclick.length-1) == ',')
  357 + onclick = onclick.substring(0, onclick.length-1);
  358 +
  359 + onclick += "');";
  360 +
  361 + if (formObj.popupreturn.checked)
  362 + onclick += "return false;";
  363 +
  364 + // tinyMCE.debug(onclick);
  365 +
  366 + formObj.onclick.value = onclick;
  367 +
  368 + if (formObj.href.value == "")
  369 + formObj.href.value = url;
  370 +}
  371 +
  372 +function setAttrib(elm, attrib, value) {
  373 + var formObj = document.forms[0];
  374 + var valueElm = formObj.elements[attrib.toLowerCase()];
  375 +
  376 + if (typeof(value) == "undefined" || value == null) {
  377 + value = "";
  378 +
  379 + if (valueElm)
  380 + value = valueElm.value;
  381 + }
  382 +
  383 + if (value != "") {
  384 + elm.setAttribute(attrib.toLowerCase(), value);
  385 +
  386 + if (attrib == "style")
  387 + attrib = "style.cssText";
  388 +
  389 + if (attrib.substring(0, 2) == 'on')
  390 + value = 'return true;' + value;
  391 +
  392 + if (attrib == "class")
  393 + attrib = "className";
  394 +
  395 + eval('elm.' + attrib + "=value;");
  396 + } else
  397 + elm.removeAttribute(attrib);
  398 +}
  399 +
  400 +function getAnchorListHTML(id, target) {
  401 + var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
  402 + var nodes = inst.getBody().getElementsByTagName("a"), name, i;
  403 + var html = "";
  404 +
  405 + html += '<select id="' + id + '" name="' + id + '" class="mceAnchorList" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target + '.value=';
  406 + html += 'this.options[this.selectedIndex].value;">';
  407 + html += '<option value="">---</option>';
  408 +
  409 + for (i=0; i<nodes.length; i++) {
  410 + if ((name = tinyMCE.getAttrib(nodes[i], "name")) != "")
  411 + html += '<option value="#' + name + '">' + name + '</option>';
  412 + }
  413 +
  414 + html += '</select>';
  415 +
  416 + return html;
  417 +}
  418 +
  419 +function insertAction() {
  420 + var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
  421 + var elm = inst.getFocusElement();
  422 +
  423 + checkPrefix(document.forms[0].href);
  424 +
  425 + elm = tinyMCE.getParentElement(elm, "a");
  426 +
  427 + tinyMCEPopup.execCommand("mceBeginUndoLevel");
  428 +
  429 + // Create new anchor elements
  430 + if (elm == null) {
  431 + if (tinyMCE.isSafari)
  432 + tinyMCEPopup.execCommand("mceInsertContent", false, '<a href="#mce_temp_url#">' + inst.selection.getSelectedHTML() + '</a>');
  433 + else
  434 + tinyMCEPopup.execCommand("createlink", false, "#mce_temp_url#");
  435 +
  436 + var elementArray = tinyMCE.getElementsByAttributeValue(inst.getBody(), "a", "href", "#mce_temp_url#");
  437 + for (var i=0; i<elementArray.length; i++) {
  438 + var elm = elementArray[i];
  439 +
  440 + // Move cursor to end
  441 + try {
  442 + tinyMCE.selectedInstance.selection.collapse(false);
  443 + } catch (ex) {
  444 + // Ignore
  445 + }
  446 +
  447 + // Move cursor behind the new anchor
  448 + // Don't remember why this was needed so it's now removed
  449 + /*
  450 + if (tinyMCE.isGecko) {
  451 + var sp = inst.getDoc().createTextNode(" ");
  452 +
  453 + if (elm.nextSibling)
  454 + elm.parentNode.insertBefore(sp, elm.nextSibling);
  455 + else
  456 + elm.parentNode.appendChild(sp);
  457 +
  458 + // Set range after link
  459 + var rng = inst.getDoc().createRange();
  460 + rng.setStartAfter(elm);
  461 + rng.setEndAfter(elm);
  462 +
  463 + // Update selection
  464 + var sel = inst.getSel();
  465 + sel.removeAllRanges();
  466 + sel.addRange(rng);
  467 + }
  468 + */
  469 +
  470 + setAllAttribs(elm);
  471 + }
  472 + } else
  473 + setAllAttribs(elm);
  474 +
  475 + tinyMCE._setEventsEnabled(inst.getBody(), false);
  476 + tinyMCEPopup.execCommand("mceEndUndoLevel");
  477 + tinyMCEPopup.close();
  478 +}
  479 +
  480 +function setAllAttribs(elm) {
  481 + var formObj = document.forms[0];
  482 + var href = formObj.href.value;
  483 + var target = getSelectValue(formObj, 'targetlist');
  484 +
  485 + // Make anchors absolute
  486 + if (href.charAt(0) != '#' && tinyMCE.getParam('convert_urls'))
  487 + href = convertURL(href, elm);
  488 +
  489 + setAttrib(elm, 'href', href);
  490 + setAttrib(elm, 'mce_href', href);
  491 + setAttrib(elm, 'title');
  492 + setAttrib(elm, 'target', target == '_self' ? '' : target);
  493 + setAttrib(elm, 'id');
  494 + setAttrib(elm, 'style');
  495 + setAttrib(elm, 'class', getSelectValue(formObj, 'classlist'));
  496 + setAttrib(elm, 'rel');
  497 + setAttrib(elm, 'rev');
  498 + setAttrib(elm, 'charset');
  499 + setAttrib(elm, 'hreflang');
  500 + setAttrib(elm, 'dir');
  501 + setAttrib(elm, 'lang');
  502 + setAttrib(elm, 'tabindex');
  503 + setAttrib(elm, 'accesskey');
  504 + setAttrib(elm, 'type');
  505 + setAttrib(elm, 'onfocus');
  506 + setAttrib(elm, 'onblur');
  507 + setAttrib(elm, 'onclick');
  508 + setAttrib(elm, 'ondblclick');
  509 + setAttrib(elm, 'onmousedown');
  510 + setAttrib(elm, 'onmouseup');
  511 + setAttrib(elm, 'onmouseover');
  512 + setAttrib(elm, 'onmousemove');
  513 + setAttrib(elm, 'onmouseout');
  514 + setAttrib(elm, 'onkeypress');
  515 + setAttrib(elm, 'onkeydown');
  516 + setAttrib(elm, 'onkeyup');
  517 +
  518 + // Refresh in old MSIE
  519 + if (tinyMCE.isMSIE5)
  520 + elm.outerHTML = elm.outerHTML;
  521 +}
  522 +
  523 +function getSelectValue(form_obj, field_name) {
  524 + var elm = form_obj.elements[field_name];
  525 +
  526 + if (elm == null || elm.options == null)
  527 + return "";
  528 +
  529 + return elm.options[elm.selectedIndex].value;
  530 +}
  531 +
  532 +function getLinkListHTML(elm_id, target_form_element, onchange_func) {
  533 + if (typeof(tinyMCELinkList) == "undefined" || tinyMCELinkList.length == 0)
  534 + return "";
  535 +
  536 + var html = "";
  537 +
  538 + html += '<select id="' + elm_id + '" name="' + elm_id + '"';
  539 + html += ' class="mceLinkList" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target_form_element + '.value=';
  540 + html += 'this.options[this.selectedIndex].value;';
  541 +
  542 + if (typeof(onchange_func) != "undefined")
  543 + html += onchange_func + '(\'' + target_form_element + '\',this.options[this.selectedIndex].text,this.options[this.selectedIndex].value);';
  544 +
  545 + html += '"><option value="">---</option>';
  546 +
  547 + for (var i=0; i<tinyMCELinkList.length; i++)
  548 + html += '<option value="' + tinyMCELinkList[i][1] + '">' + tinyMCELinkList[i][0] + '</option>';
  549 +
  550 + html += '</select>';
  551 +
  552 + return html;
  553 +
  554 + // tinyMCE.debug('-- image list start --', html, '-- image list end --');
  555 +}
  556 +
  557 +function getTargetListHTML(elm_id, target_form_element) {
  558 + var targets = tinyMCE.getParam('theme_advanced_link_targets', '').split(';');
  559 + var html = '';
  560 +
  561 + html += '<select id="' + elm_id + '" name="' + elm_id + '" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target_form_element + '.value=';
  562 + html += 'this.options[this.selectedIndex].value;">';
  563 +
  564 + html += '<option value="_self">' + tinyMCE.getLang('lang_advlink_target_same') + '</option>';
  565 + html += '<option value="_blank">' + tinyMCE.getLang('lang_advlink_target_blank') + ' (_blank)</option>';
  566 + html += '<option value="_parent">' + tinyMCE.getLang('lang_advlink_target_parent') + ' (_parent)</option>';
  567 + html += '<option value="_top">' + tinyMCE.getLang('lang_advlink_target_top') + ' (_top)</option>';
  568 +
  569 + for (var i=0; i<targets.length; i++) {
  570 + var key, value;
  571 +
  572 + if (targets[i] == "")
  573 + continue;
  574 +
  575 + key = targets[i].split('=')[0];
  576 + value = targets[i].split('=')[1];
  577 +
  578 + html += '<option value="' + key + '">' + value + ' (' + key + ')</option>';
  579 + }
  580 +
  581 + html += '</select>';
  582 +
  583 + return html;
  584 +}
  585 +
  586 +// While loading
  587 +preinit();
public/javascripts/tiny_mce/plugins/advlink/langs/en.js 0 → 100755
@@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
  1 +// UK lang variables
  2 +
  3 +tinyMCE.addToLang('advlink',{
  4 +general_tab : 'General',
  5 +popup_tab : 'Popup',
  6 +events_tab : 'Events',
  7 +advanced_tab : 'Advanced',
  8 +general_props : 'General properties',
  9 +popup_props : 'Popup properties',
  10 +event_props : 'Events',
  11 +advanced_props : 'Advanced properties',
  12 +popup_opts : 'Options',
  13 +anchor_names : 'Anchors',
  14 +target_same : 'Open in this window / frame',
  15 +target_parent : 'Open in parent window / frame',
  16 +target_top : 'Open in top frame (replaces all frames)',
  17 +target_blank : 'Open in new window',
  18 +popup : 'Javascript popup',
  19 +popup_url : 'Popup URL',
  20 +popup_name : 'Window name',
  21 +popup_return : 'Insert \'return false\'',
  22 +popup_scrollbars : 'Show scrollbars',
  23 +popup_statusbar : 'Show status bar',
  24 +popup_toolbar : 'Show toolbars',
  25 +popup_menubar : 'Show menu bar',
  26 +popup_location : 'Show location bar',
  27 +popup_resizable : 'Make window resizable',
  28 +popup_dependent : 'Dependent (Mozilla/Firefox only)',
  29 +popup_size : 'Size',
  30 +popup_position : 'Position (X/Y)',
  31 +id : 'Id',
  32 +style: 'Style',
  33 +classes : 'Classes',
  34 +target_name : 'Target name',
  35 +langdir : 'Language direction',
  36 +target_langcode : 'Target language',
  37 +langcode : 'Language code',
  38 +encoding : 'Target character encoding',
  39 +mime : 'Target MIME type',
  40 +rel : 'Relationship page to target',
  41 +rev : 'Relationship target to page',
  42 +tabindex : 'Tabindex',
  43 +accesskey : 'Accesskey',
  44 +ltr : 'Left to right',
  45 +rtl : 'Right to left'
  46 +});
0 \ No newline at end of file 47 \ No newline at end of file
public/javascripts/tiny_mce/plugins/advlink/link.htm 0 → 100755
@@ -0,0 +1,338 @@ @@ -0,0 +1,338 @@
  1 +<html xmlns="http://www.w3.org/1999/xhtml">
  2 +<head>
  3 + <title>{$lang_insert_link_title}</title>
  4 + <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
  5 + <script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
  6 + <script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
  7 + <script language="javascript" type="text/javascript" src="../../utils/validate.js"></script>
  8 + <script language="javascript" type="text/javascript" src="jscripts/functions.js"></script>
  9 + <link href="css/advlink.css" rel="stylesheet" type="text/css" />
  10 + <base target="_self" />
  11 +</head>
  12 +<body id="advlink" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
  13 + <form onsubmit="insertAction();return false;" action="#">
  14 + <div class="tabs">
  15 + <ul>
  16 + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_advlink_general_tab}</a></span></li>
  17 + <li id="popup_tab"><span><a href="javascript:mcTabs.displayTab('popup_tab','popup_panel');" onmousedown="return false;">{$lang_advlink_popup_tab}</a></span></li>
  18 + <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{$lang_advlink_events_tab}</a></span></li>
  19 + <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{$lang_advlink_advanced_tab}</a></span></li>
  20 + </ul>
  21 + </div>
  22 +
  23 + <div class="panel_wrapper">
  24 + <div id="general_panel" class="panel current">
  25 + <fieldset>
  26 + <legend>{$lang_advlink_general_props}</legend>
  27 +
  28 + <table border="0" cellpadding="4" cellspacing="0">
  29 + <tr>
  30 + <td nowrap="nowrap"><label id="hreflabel" for="href">{$lang_insert_link_url}</label></td>
  31 + <td><table border="0" cellspacing="0" cellpadding="0">
  32 + <tr>
  33 + <td><input id="href" name="href" type="text" value="" onchange="selectByValue(this.form,'linklisthref',this.value);" /></td>
  34 + <td id="hrefbrowsercontainer">&nbsp;</td>
  35 + </tr>
  36 + </table></td>
  37 + </tr>
  38 + <tr id="linklisthrefrow">
  39 + <td class="column1"><label for="linklisthref">{$lang_link_list}</label></td>
  40 + <td colspan="2" id="linklisthrefcontainer">&nbsp;</td>
  41 + </tr>
  42 + <tr>
  43 + <td class="column1"><label for="anchorlist">{$lang_advlink_anchor_names}</label></td>
  44 + <td colspan="2" id="anchorlistcontainer">&nbsp;</td>
  45 + </tr>
  46 + <tr>
  47 + <td><label id="targetlistlabel" for="targetlist">{$lang_insert_link_target}</label></td>
  48 + <td id="targetlistcontainer">&nbsp;</td>
  49 + </tr>
  50 + <tr>
  51 + <td nowrap="nowrap"><label id="titlelabel" for="title">{$lang_theme_insert_link_titlefield}</label></td>
  52 + <td><input id="title" name="title" type="text" value="" /></td>
  53 + </tr>
  54 + <tr>
  55 + <td><label id="classlabel" for="classlist">{$lang_class_name}</label></td>
  56 + <td>
  57 + <select id="classlist" name="classlist" onchange="changeClass();">
  58 + <option value="" selected>{$lang_not_set}</option>
  59 + </select>
  60 + </td>
  61 + </tr>
  62 + </table>
  63 + </fieldset>
  64 + </div>
  65 +
  66 + <div id="popup_panel" class="panel">
  67 + <fieldset>
  68 + <legend>{$lang_advlink_popup_props}</legend>
  69 +
  70 + <input type="checkbox" id="ispopup" name="ispopup" class="radio" onclick="setPopupControlsDisabled(!this.checked);buildOnClick();" />
  71 + <label id="ispopuplabel" for="ispopup">{$lang_advlink_popup}</label>
  72 +
  73 + <table border="0" cellpadding="0" cellspacing="4">
  74 + <tr>
  75 + <td nowrap="nowrap"><label for="popupurl">{$lang_advlink_popup_url}</label>&nbsp;</td>
  76 + <td>
  77 + <table border="0" cellspacing="0" cellpadding="0">
  78 + <tr>
  79 + <td><input type="text" name="popupurl" id="popupurl" value="" onchange="buildOnClick();" /></td>
  80 + <td id="popupurlbrowsercontainer">&nbsp;</td>
  81 + </tr>
  82 + </table>
  83 + </td>
  84 + </tr>
  85 + <tr>
  86 + <td nowrap="nowrap"><label for="popupname">{$lang_advlink_popup_name}</label>&nbsp;</td>
  87 + <td><input type="text" name="popupname" id="popupname" value="" onchange="buildOnClick();" /></td>
  88 + </tr>
  89 + <tr>
  90 + <td nowrap="nowrap"><label>{$lang_advlink_popup_size}</label>&nbsp;</td>
  91 + <td nowrap="nowrap">
  92 + <input type="text" id="popupwidth" name="popupwidth" value="" onchange="buildOnClick();" /> x
  93 + <input type="text" id="popupheight" name="popupheight" value="" onchange="buildOnClick();" /> px
  94 + </td>
  95 + </tr>
  96 + <tr>
  97 + <td nowrap="nowrap" id="labelleft"><label>{$lang_advlink_popup_position}</label>&nbsp;</td>
  98 + <td nowrap="nowrap">
  99 + <input type="text" id="popupleft" name="popupleft" value="" onchange="buildOnClick();" /> /
  100 + <input type="text" id="popuptop" name="popuptop" value="" onchange="buildOnClick();" /> (c /c = center)
  101 + </td>
  102 + </tr>
  103 + </table>
  104 +
  105 + <fieldset>
  106 + <legend>{$lang_advlink_popup_opts}</legend>
  107 +
  108 + <table border="0" cellpadding="0" cellspacing="4">
  109 + <tr>
  110 + <td><input type="checkbox" id="popuplocation" name="popuplocation" class="checkbox" onchange="buildOnClick();" /></td>
  111 + <td nowrap="nowrap"><label id="popuplocationlabel" for="popuplocation">{$lang_advlink_popup_location}</label></td>
  112 + <td><input type="checkbox" id="popupscrollbars" name="popupscrollbars" class="checkbox" onchange="buildOnClick();" /></td>
  113 + <td nowrap="nowrap"><label id="popupscrollbarslabel" for="popupscrollbars">{$lang_advlink_popup_scrollbars}</label></td>
  114 + </tr>
  115 + <tr>
  116 + <td><input type="checkbox" id="popupmenubar" name="popupmenubar" class="checkbox" onchange="buildOnClick();" /></td>
  117 + <td nowrap="nowrap"><label id="popupmenubarlabel" for="popupmenubar">{$lang_advlink_popup_menubar}</label></td>
  118 + <td><input type="checkbox" id="popupresizable" name="popupresizable" class="checkbox" onchange="buildOnClick();" /></td>
  119 + <td nowrap="nowrap"><label id="popupresizablelabel" for="popupresizable">{$lang_advlink_popup_resizable}</label></td>
  120 + </tr>
  121 + <tr>
  122 + <td><input type="checkbox" id="popuptoolbar" name="popuptoolbar" class="checkbox" onchange="buildOnClick();" /></td>
  123 + <td nowrap="nowrap"><label id="popuptoolbarlabel" for="popuptoolbar">{$lang_advlink_popup_toolbar}</label></td>
  124 + <td><input type="checkbox" id="popupdependent" name="popupdependent" class="checkbox" onchange="buildOnClick();" /></td>
  125 + <td nowrap="nowrap"><label id="popupdependentlabel" for="popupdependent">{$lang_advlink_popup_dependent}</label></td>
  126 + </tr>
  127 + <tr>
  128 + <td><input type="checkbox" id="popupstatus" name="popupstatus" class="checkbox" onchange="buildOnClick();" /></td>
  129 + <td nowrap="nowrap"><label id="popupstatuslabel" for="popupstatus">{$lang_advlink_popup_statusbar}</label></td>
  130 + <td><input type="checkbox" id="popupreturn" name="popupreturn" class="checkbox" onchange="buildOnClick();" checked="checked" /></td>
  131 + <td nowrap="nowrap"><label id="popupreturnlabel" for="popupreturn">{$lang_advlink_popup_return}</label></td>
  132 + </tr>
  133 + </table>
  134 + </fieldset>
  135 + </fieldset>
  136 + </div>
  137 +
  138 + <div id="advanced_panel" class="panel">
  139 + <fieldset>
  140 + <legend>{$lang_advlink_advanced_props}</legend>
  141 +
  142 + <table border="0" cellpadding="0" cellspacing="4">
  143 + <tr>
  144 + <td class="column1"><label id="idlabel" for="id">{$lang_advlink_id}</label></td>
  145 + <td><input id="id" name="id" type="text" value="" /></td>
  146 + </tr>
  147 +
  148 + <tr>
  149 + <td><label id="stylelabel" for="style">{$lang_advlink_style}</label></td>
  150 + <td><input type="text" id="style" name="style" value="" /></td>
  151 + </tr>
  152 +
  153 + <tr>
  154 + <td><label id="classeslabel" for="classes">{$lang_advlink_classes}</label></td>
  155 + <td><input type="text" id="classes" name="classes" value="" onchange="selectByValue(this.form,'classlist',this.value,true);" /></td>
  156 + </tr>
  157 +
  158 + <tr>
  159 + <td><label id="targetlabel" for="target">{$lang_advlink_target_name}</label></td>
  160 + <td><input type="text" id="target" name="target" value="" onchange="selectByValue(this.form,'targetlist',this.value,true);" /></td>
  161 + </tr>
  162 +
  163 + <tr>
  164 + <td class="column1"><label id="dirlabel" for="dir">{$lang_advlink_langdir}</label></td>
  165 + <td>
  166 + <select id="dir" name="dir">
  167 + <option value="">{$lang_not_set}</option>
  168 + <option value="ltr">{$lang_advlink_ltr}</option>
  169 + <option value="rtl">{$lang_advlink_rtl}</option>
  170 + </select>
  171 + </td>
  172 + </tr>
  173 +
  174 + <tr>
  175 + <td><label id="hreflanglabel" for="hreflang">{$lang_advlink_target_langcode}</label></td>
  176 + <td><input type="text" id="hreflang" name="hreflang" value="" /></td>
  177 + </tr>
  178 +
  179 + <tr>
  180 + <td class="column1"><label id="langlabel" for="lang">{$lang_advlink_langcode}</label></td>
  181 + <td>
  182 + <input id="lang" name="lang" type="text" value="" />
  183 + </td>
  184 + </tr>
  185 +
  186 + <tr>
  187 + <td><label id="charsetlabel" for="charset">{$lang_advlink_encoding}</label></td>
  188 + <td><input type="text" id="charset" name="charset" value="" /></td>
  189 + </tr>
  190 +
  191 + <tr>
  192 + <td><label id="typelabel" for="type">{$lang_advlink_mime}</label></td>
  193 + <td><input type="text" id="type" name="type" value="" /></td>
  194 + </tr>
  195 +
  196 + <tr>
  197 + <td><label id="rellabel" for="rel">{$lang_advlink_rel}</label></td>
  198 + <td><select id="rel" name="rel">
  199 + <option value="">{$lang_not_set}</option>
  200 + <option value="lightbox">Lightbox</option>
  201 + <option value="alternate">Alternate</option>
  202 + <option value="designates">Designates</option>
  203 + <option value="stylesheet">Stylesheet</option>
  204 + <option value="start">Start</option>
  205 + <option value="next">Next</option>
  206 + <option value="prev">Prev</option>
  207 + <option value="contents">Contents</option>
  208 + <option value="index">Index</option>
  209 + <option value="glossary">Glossary</option>
  210 + <option value="copyright">Copyright</option>
  211 + <option value="chapter">Chapter</option>
  212 + <option value="subsection">Subsection</option>
  213 + <option value="appendix">Appendix</option>
  214 + <option value="help">Help</option>
  215 + <option value="bookmark">Bookmark</option>
  216 + <option value="nofollow">No Follow</option>
  217 + <option value="tag">Tag</option>
  218 + </select>
  219 + </td>
  220 + </tr>
  221 +
  222 + <tr>
  223 + <td><label id="revlabel" for="rev">{$lang_advlink_rev}</label></td>
  224 + <td><select id="rev" name="rev">
  225 + <option value="">{$lang_not_set}</option>
  226 + <option value="alternate">Alternate</option>
  227 + <option value="designates">Designates</option>
  228 + <option value="stylesheet">Stylesheet</option>
  229 + <option value="start">Start</option>
  230 + <option value="next">Next</option>
  231 + <option value="prev">Prev</option>
  232 + <option value="contents">Contents</option>
  233 + <option value="index">Index</option>
  234 + <option value="glossary">Glossary</option>
  235 + <option value="copyright">Copyright</option>
  236 + <option value="chapter">Chapter</option>
  237 + <option value="subsection">Subsection</option>
  238 + <option value="appendix">Appendix</option>
  239 + <option value="help">Help</option>
  240 + <option value="bookmark">Bookmark</option>
  241 + </select>
  242 + </td>
  243 + </tr>
  244 +
  245 + <tr>
  246 + <td><label id="tabindexlabel" for="tabindex">{$lang_advlink_tabindex}</label></td>
  247 + <td><input type="text" id="tabindex" name="tabindex" value="" /></td>
  248 + </tr>
  249 +
  250 + <tr>
  251 + <td><label id="accesskeylabel" for="accesskey">{$lang_advlink_accesskey}</label></td>
  252 + <td><input type="text" id="accesskey" name="accesskey" value="" /></td>
  253 + </tr>
  254 + </table>
  255 + </fieldset>
  256 + </div>
  257 +
  258 + <div id="events_panel" class="panel">
  259 + <fieldset>
  260 + <legend>{$lang_advlink_event_props}</legend>
  261 +
  262 + <table border="0" cellpadding="0" cellspacing="4">
  263 + <tr>
  264 + <td class="column1"><label for="onfocus">onfocus</label></td>
  265 + <td><input id="onfocus" name="onfocus" type="text" value="" /></td>
  266 + </tr>
  267 +
  268 + <tr>
  269 + <td class="column1"><label for="onblur">onblur</label></td>
  270 + <td><input id="onblur" name="onblur" type="text" value="" /></td>
  271 + </tr>
  272 +
  273 + <tr>
  274 + <td class="column1"><label for="onclick">onclick</label></td>
  275 + <td><input id="onclick" name="onclick" type="text" value="" /></td>
  276 + </tr>
  277 +
  278 + <tr>
  279 + <td class="column1"><label for="ondblclick">ondblclick</label></td>
  280 + <td><input id="ondblclick" name="ondblclick" type="text" value="" /></td>
  281 + </tr>
  282 +
  283 + <tr>
  284 + <td class="column1"><label for="onmousedown">onmousedown</label></td>
  285 + <td><input id="onmousedown" name="onmousedown" type="text" value="" /></td>
  286 + </tr>
  287 +
  288 + <tr>
  289 + <td class="column1"><label for="onmouseup">onmouseup</label></td>
  290 + <td><input id="onmouseup" name="onmouseup" type="text" value="" /></td>
  291 + </tr>
  292 +
  293 + <tr>
  294 + <td class="column1"><label for="onmouseover">onmouseover</label></td>
  295 + <td><input id="onmouseover" name="onmouseover" type="text" value="" /></td>
  296 + </tr>
  297 +
  298 + <tr>
  299 + <td class="column1"><label for="onmousemove">onmousemove</label></td>
  300 + <td><input id="onmousemove" name="onmousemove" type="text" value="" /></td>
  301 + </tr>
  302 +
  303 + <tr>
  304 + <td class="column1"><label for="onmouseout">onmouseout</label></td>
  305 + <td><input id="onmouseout" name="onmouseout" type="text" value="" /></td>
  306 + </tr>
  307 +
  308 + <tr>
  309 + <td class="column1"><label for="onkeypress">onkeypress</label></td>
  310 + <td><input id="onkeypress" name="onkeypress" type="text" value="" /></td>
  311 + </tr>
  312 +
  313 + <tr>
  314 + <td class="column1"><label for="onkeydown">onkeydown</label></td>
  315 + <td><input id="onkeydown" name="onkeydown" type="text" value="" /></td>
  316 + </tr>
  317 +
  318 + <tr>
  319 + <td class="column1"><label for="onkeyup">onkeyup</label></td>
  320 + <td><input id="onkeyup" name="onkeyup" type="text" value="" /></td>
  321 + </tr>
  322 + </table>
  323 + </fieldset>
  324 + </div>
  325 + </div>
  326 +
  327 + <div class="mceActionPanel">
  328 + <div style="float: left">
  329 + <input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertAction();" />
  330 + </div>
  331 +
  332 + <div style="float: right">
  333 + <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
  334 + </div>
  335 + </div>
  336 + </form>
  337 +</body>
  338 +</html>
public/javascripts/tiny_mce/plugins/advlink/readme.txt 0 → 100755
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +Check the TinyMCE documentation for details on this plugin.
public/javascripts/tiny_mce/plugins/autosave/editor_plugin.js 0 → 100755
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +tinyMCE.importPluginLanguagePack('autosave');var TinyMCE_AutoSavePlugin={getInfo:function(){return{longname:'Auto save',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},_beforeUnloadHandler:function(){var n,inst,anyDirty=false,msg=tinyMCE.getLang("lang_autosave_unload_msg");if(tinyMCE.getParam("fullscreen_is_enabled"))return;for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;if(inst.isDirty())return msg}return}};window.onbeforeunload=TinyMCE_AutoSavePlugin._beforeUnloadHandler;tinyMCE.addPlugin("autosave",TinyMCE_AutoSavePlugin);
0 \ No newline at end of file 2 \ No newline at end of file
public/javascripts/tiny_mce/plugins/autosave/editor_plugin_src.js 0 → 100755
@@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
  1 +/**
  2 + * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
  3 + *
  4 + * @author Moxiecode
  5 + * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
  6 + */
  7 +
  8 +/* Import plugin specific language pack */
  9 +tinyMCE.importPluginLanguagePack('autosave');
  10 +
  11 +var TinyMCE_AutoSavePlugin = {
  12 + getInfo : function() {
  13 + return {
  14 + longname : 'Auto save',
  15 + author : 'Moxiecode Systems AB',
  16 + authorurl : 'http://tinymce.moxiecode.com',
  17 + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave',
  18 + version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
  19 + };
  20 + },
  21 +
  22 + // Private plugin internal methods
  23 +
  24 + _beforeUnloadHandler : function() {
  25 + var n, inst, anyDirty = false, msg = tinyMCE.getLang("lang_autosave_unload_msg");
  26 +
  27 + if (tinyMCE.getParam("fullscreen_is_enabled"))
  28 + return;
  29 +
  30 + for (n in tinyMCE.instances) {
  31 + inst = tinyMCE.instances[n];
  32 +
  33 + if (!tinyMCE.isInstance(inst))
  34 + continue;
  35 +
  36 + if (inst.isDirty())
  37 + return msg;
  38 + }
  39 +
  40 + return;
  41 + }
  42 +};
  43 +
  44 +window.onbeforeunload = TinyMCE_AutoSavePlugin._beforeUnloadHandler;
  45 +
  46 +tinyMCE.addPlugin("autosave", TinyMCE_AutoSavePlugin);
public/javascripts/tiny_mce/plugins/autosave/langs/en.js 0 → 100755
@@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
  1 +// EN lang variables
  2 +
  3 +tinyMCE.addToLang('',{
  4 +autosave_unload_msg : 'The changes you made will be lost if you navigate away from this page.'
  5 +});
public/javascripts/tiny_mce/plugins/autosave/readme.txt 0 → 100755
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +Check the TinyMCE documentation for details on this plugin.
public/javascripts/tiny_mce/plugins/bbcode/editor_plugin.js 0 → 100755
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +var TinyMCE_BBCodePlugin={getInfo:function(){return{longname:'BBCode Plugin',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},cleanup:function(type,content){var dialect=tinyMCE.getParam('bbcode_dialect','punbb').toLowerCase();switch(type){case"insert_to_editor":content=this['_'+dialect+'_bbcode2html'](content);break;case"get_from_editor":content=this['_'+dialect+'_html2bbcode'](content);break}return content},_punbb_html2bbcode:function(s){s=tinyMCE.trim(s);function rep(re,str){s=s.replace(re,str)};rep(/<a href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url]$1[/url]");rep(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");rep(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");rep(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");rep(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");rep(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]");rep(/<font>(.*?)<\/font>/gi,"$1");rep(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");rep(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]");rep(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]");rep(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]");rep(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]");rep(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]");rep(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]");rep(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]");rep(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]");rep(/<\/(strong|b)>/gi,"[/b]");rep(/<(strong|b)>/gi,"[b]");rep(/<\/(em|i)>/gi,"[/i]");rep(/<(em|i)>/gi,"[i]");rep(/<\/u>/gi,"[/u]");rep(/<u>/gi,"[u]");rep(/<br \/>/gi,"\n");rep(/<br\/>/gi,"\n");rep(/<br>/gi,"\n");rep(/<p>/gi,"");rep(/<\/p>/gi,"\n");rep(/&nbsp;/gi," ");rep(/&quot;/gi,"\"");rep(/&lt;/gi,"<");rep(/&gt;/gi,">");rep(/&amp;/gi,"&");rep(/&undefined;/gi,"'");return s},_punbb_bbcode2html:function(s){s=tinyMCE.trim(s);function rep(re,str){s=s.replace(re,str)};rep(/\n/gi,"<br />");rep(/\[b\]/gi,"<strong>");rep(/\[\/b\]/gi,"</strong>");rep(/\[i\]/gi,"<em>");rep(/\[\/i\]/gi,"</em>");rep(/\[u\]/gi,"<u>");rep(/\[\/u\]/gi,"</u>");rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />");rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<font color=\"$1\">$2</font>");rep(/\[code\](.*?)\[\/code\]/gi,"<span class=\"codeStyle\">$1</span>&nbsp;");rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<span class=\"quoteStyle\">$1</span>&nbsp;");return s}};tinyMCE.addPlugin("bbcode",TinyMCE_BBCodePlugin);
0 \ No newline at end of file 2 \ No newline at end of file
public/javascripts/tiny_mce/plugins/bbcode/editor_plugin_src.js 0 → 100755
@@ -0,0 +1,102 @@ @@ -0,0 +1,102 @@
  1 +var TinyMCE_BBCodePlugin = {
  2 + getInfo : function() {
  3 + return {
  4 + longname : 'BBCode Plugin',
  5 + author : 'Moxiecode Systems AB',
  6 + authorurl : 'http://tinymce.moxiecode.com',
  7 + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode',
  8 + version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
  9 + };
  10 + },
  11 +
  12 + cleanup : function(type, content) {
  13 + var dialect = tinyMCE.getParam('bbcode_dialect', 'punbb').toLowerCase();
  14 +
  15 + switch (type) {
  16 + case "insert_to_editor":
  17 + content = this['_' + dialect + '_bbcode2html'](content);
  18 + break;
  19 +
  20 + case "get_from_editor":
  21 + content = this['_' + dialect + '_html2bbcode'](content);
  22 + break;
  23 + }
  24 +
  25 + return content;
  26 + },
  27 +
  28 + // Private methods
  29 +
  30 + // HTML -> BBCode in PunBB dialect
  31 + _punbb_html2bbcode : function(s) {
  32 + s = tinyMCE.trim(s);
  33 +
  34 + function rep(re, str) {
  35 + s = s.replace(re, str);
  36 + };
  37 +
  38 + // example: <strong> to [b]
  39 + rep(/<a href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url]$1[/url]");
  40 + rep(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");
  41 + rep(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");
  42 + rep(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");
  43 + rep(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");
  44 + rep(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]");
  45 + rep(/<font>(.*?)<\/font>/gi,"$1");
  46 + rep(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");
  47 + rep(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]");
  48 + rep(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]");
  49 + rep(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]");
  50 + rep(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]");
  51 + rep(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]");
  52 + rep(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]");
  53 + rep(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]");
  54 + rep(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]");
  55 + rep(/<\/(strong|b)>/gi,"[/b]");
  56 + rep(/<(strong|b)>/gi,"[b]");
  57 + rep(/<\/(em|i)>/gi,"[/i]");
  58 + rep(/<(em|i)>/gi,"[i]");
  59 + rep(/<\/u>/gi,"[/u]");
  60 + rep(/<u>/gi,"[u]");
  61 + rep(/<br \/>/gi,"\n");
  62 + rep(/<br\/>/gi,"\n");
  63 + rep(/<br>/gi,"\n");
  64 + rep(/<p>/gi,"");
  65 + rep(/<\/p>/gi,"\n");
  66 + rep(/&nbsp;/gi," ");
  67 + rep(/&quot;/gi,"\"");
  68 + rep(/&lt;/gi,"<");
  69 + rep(/&gt;/gi,">");
  70 + rep(/&amp;/gi,"&");
  71 + rep(/&undefined;/gi,"'"); // quickfix
  72 +
  73 + return s;
  74 + },
  75 +
  76 + // BBCode -> HTML from PunBB dialect
  77 + _punbb_bbcode2html : function(s) {
  78 + s = tinyMCE.trim(s);
  79 +
  80 + function rep(re, str) {
  81 + s = s.replace(re, str);
  82 + };
  83 +
  84 + // example: [b] to <strong>
  85 + rep(/\n/gi,"<br />");
  86 + rep(/\[b\]/gi,"<strong>");
  87 + rep(/\[\/b\]/gi,"</strong>");
  88 + rep(/\[i\]/gi,"<em>");
  89 + rep(/\[\/i\]/gi,"</em>");
  90 + rep(/\[u\]/gi,"<u>");
  91 + rep(/\[\/u\]/gi,"</u>");
  92 + rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");
  93 + rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />");
  94 + rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<font color=\"$1\">$2</font>");
  95 + rep(/\[code\](.*?)\[\/code\]/gi,"<span class=\"codeStyle\">$1</span>&nbsp;");
  96 + rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<span class=\"quoteStyle\">$1</span>&nbsp;");
  97 +
  98 + return s;
  99 + }
  100 +};
  101 +
  102 +tinyMCE.addPlugin("bbcode", TinyMCE_BBCodePlugin);
public/javascripts/tiny_mce/plugins/cleanup/editor_plugin.js 0 → 100755
public/javascripts/tiny_mce/plugins/cleanup/editor_plugin_src.js 0 → 100755
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +/**
  2 + * $Id: editor_plugin_src.js 162 2007-01-03 16:16:52Z spocke $
  3 + *
  4 + * Experimental plugin for new Cleanup routine, this logic will be moved into the core ones it's stable enougth.
  5 + *
  6 + * @author Moxiecode
  7 + * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
  8 + */
  9 +
  10 +/* Dummy file since cleanup is now moved to core */
public/javascripts/tiny_mce/plugins/cleanup/readme.txt 0 → 100755
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +Dummy plugin since cleanup is now moved into core.
public/javascripts/tiny_mce/plugins/contextmenu/css/contextmenu.css 0 → 100755
@@ -0,0 +1,74 @@ @@ -0,0 +1,74 @@
  1 +.contextMenuIEPopup {
  2 + padding: 0;
  3 + margin: 0;
  4 + border: 0;
  5 + overflow: hidden;
  6 +}
  7 +
  8 +.contextMenu {
  9 + position: absolute;
  10 + cursor: default;
  11 + z-index: 1000;
  12 + border: 1px solid #D4D0C8;
  13 + background-color: #FFFFFF;
  14 +}
  15 +
  16 +.contextMenuItem, .contextMenuItemOver {
  17 +}
  18 +
  19 +.contextMenuSeparator {
  20 + width: 100%;
  21 + background-color: #D4D0C8;
  22 + border: 0;
  23 +}
  24 +
  25 +.contextMenuImage, .contextMenuItemDisabled {
  26 + border: 0;
  27 +}
  28 +
  29 +.contextMenuIcon {
  30 + background-color: #F0F0EE;
  31 +}
  32 +
  33 +.contextMenuItemOver .contextMenuIcon {
  34 + background-color: #B6BDD2;
  35 +}
  36 +
  37 +.contextMenuIcon {
  38 + background-color: #F0F0EE;
  39 +}
  40 +
  41 +.contextMenuItemDisabled img {
  42 + filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);
  43 + -moz-opacity:0.3;
  44 + opacity: 0.3;
  45 +}
  46 +
  47 +.contextMenuText {
  48 + font-family: Tahoma, Verdana, Arial, Helvetica;
  49 + font-size: 11px;
  50 + line-height: 20px;
  51 +}
  52 +
  53 +.contextMenuItemDisabled {
  54 + color: #AAAAAA;
  55 +}
  56 +
  57 +.contextMenuText a {
  58 + display: block;
  59 + line-height: 20px;
  60 + width: 100%;
  61 + text-decoration: none;
  62 + color: black;
  63 + font-weight: normal;
  64 + margin: 0;
  65 + padding: 0;
  66 +}
  67 +
  68 +.contextMenuText a:hover {
  69 + background-color: #B6BDD2;
  70 + text-decoration: none !important;
  71 + font-weight: normal;
  72 + margin: 0;
  73 + padding: 0;
  74 +}
public/javascripts/tiny_mce/plugins/contextmenu/editor_plugin.js 0 → 100755
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +if(!tinyMCE.settings['contextmenu_skip_plugin_css']){tinyMCE.loadCSS(tinyMCE.baseURL+"/plugins/contextmenu/css/contextmenu.css")}var TinyMCE_ContextMenuPlugin={_contextMenu:null,getInfo:function(){return{longname:'Context menus',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},initInstance:function(inst){if(tinyMCE.isMSIE5_0&&tinyMCE.isOpera)return;TinyMCE_ContextMenuPlugin._contextMenu=new TinyMCE_ContextMenu({commandhandler:"TinyMCE_ContextMenuPlugin._commandHandler",spacer_image:tinyMCE.baseURL+"/plugins/contextmenu/images/spacer.gif"});tinyMCE.addEvent(inst.getDoc(),"click",TinyMCE_ContextMenuPlugin._hideContextMenu);tinyMCE.addEvent(inst.getDoc(),"keypress",TinyMCE_ContextMenuPlugin._hideContextMenu);tinyMCE.addEvent(inst.getDoc(),"keydown",TinyMCE_ContextMenuPlugin._hideContextMenu);tinyMCE.addEvent(document,"click",TinyMCE_ContextMenuPlugin._hideContextMenu);tinyMCE.addEvent(document,"keypress",TinyMCE_ContextMenuPlugin._hideContextMenu);tinyMCE.addEvent(document,"keydown",TinyMCE_ContextMenuPlugin._hideContextMenu);if(tinyMCE.isGecko){tinyMCE.addEvent(inst.getDoc(),"contextmenu",function(e){TinyMCE_ContextMenuPlugin._showContextMenu(tinyMCE.isMSIE?inst.contentWindow.event:e,inst)})}else tinyMCE.addEvent(inst.getDoc(),"contextmenu",TinyMCE_ContextMenuPlugin._onContextMenu)},_onContextMenu:function(e){var elm=tinyMCE.isMSIE?e.srcElement:e.target;var targetInst,body;if((body=tinyMCE.getParentElement(elm,"body"))!=null){for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;if(body==inst.getBody()){targetInst=inst;break}}return TinyMCE_ContextMenuPlugin._showContextMenu(tinyMCE.isMSIE?targetInst.contentWindow.event:e,targetInst)}},_showContextMenu:function(e,inst){if(e.ctrlKey)return true;function getAttrib(elm,name){return elm.getAttribute(name)?elm.getAttribute(name):""}var x,y,elm,contextMenu;var pos=tinyMCE.getAbsPosition(inst.iframeElement);x=tinyMCE.isMSIE?e.screenX:pos.absLeft+(e.pageX-inst.getBody().scrollLeft);y=tinyMCE.isMSIE?e.screenY:pos.absTop+(e.pageY-inst.getBody().scrollTop);elm=tinyMCE.isMSIE?e.srcElement:e.target;contextMenu=this._contextMenu;contextMenu.inst=inst;window.setTimeout(function(){var theme=tinyMCE.getParam("theme");contextMenu.clearAll();var sel=inst.selection.getSelectedText().length!=0||elm.nodeName=="IMG";contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/cut.gif","$lang_cut_desc","Cut","",!sel);contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/copy.gif","$lang_copy_desc","Copy","",!sel);contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/paste.gif","$lang_paste_desc","Paste","",false);if(sel||(elm?(elm.nodeName=='A'&&tinyMCE.getAttrib(elm,'name')=='')||(elm.nodeName=='IMG'):false)){contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/themes/advanced/images/link.gif","$lang_link_desc",inst.hasPlugin("advlink")?"mceAdvLink":"mceLink");contextMenu.addItem(tinyMCE.baseURL+"/themes/advanced/images/unlink.gif","$lang_unlink_desc","unlink","",(elm?(elm.nodeName!='A')&&(elm.nodeName!='IMG'):true))}elm=tinyMCE.getParentElement(elm,"img,table,td"+(inst.hasPlugin("advhr")?',hr':''));if(elm){switch(elm.nodeName){case"IMG":contextMenu.addSeparator();if(tinyMCE.hasPlugin('flash')&&tinyMCE.getAttrib(elm,'class').indexOf('mceItemFlash')!=-1)contextMenu.addItem(tinyMCE.baseURL+"/plugins/flash/images/flash.gif","$lang_flash_props","mceFlash");else if(tinyMCE.hasPlugin('media')&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(elm,'class')))contextMenu.addItem(tinyMCE.baseURL+"/plugins/flash/images/flash.gif","$lang_media_title","mceMedia");else contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/image.gif","$lang_image_props_desc",inst.hasPlugin("advimage")?"mceAdvImage":"mceImage");break;case"HR":contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/advhr/images/advhr.gif","$lang_insert_advhr_desc","mceAdvancedHr");break;case"TABLE":case"TD":if(inst.hasPlugin("table")){var colspan=(elm.nodeName=="TABLE")?"":getAttrib(elm,"colspan");var rowspan=(elm.nodeName=="TABLE")?"":getAttrib(elm,"rowspan");colspan=colspan==""?"1":colspan;rowspan=rowspan==""?"1":rowspan;contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/cut.gif","$lang_table_cut_row_desc","mceTableCutRow");contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/copy.gif","$lang_table_copy_row_desc","mceTableCopyRow");contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/paste.gif","$lang_table_paste_row_before_desc","mceTablePasteRowBefore","",inst.tableRowClipboard==null);contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/paste.gif","$lang_table_paste_row_after_desc","mceTablePasteRowAfter","",inst.tableRowClipboard==null);contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table.gif","$lang_table_desc","mceInsertTable","insert");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table.gif","$lang_table_props_desc","mceInsertTable");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_cell_props.gif","$lang_table_cell_desc","mceTableCellProps");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_delete.gif","$lang_table_del","mceTableDelete");contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_row_props.gif","$lang_table_row_desc","mceTableRowProps");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_insert_row_before.gif","$lang_table_row_before_desc","mceTableInsertRowBefore");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_insert_row_after.gif","$lang_table_row_after_desc","mceTableInsertRowAfter");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_delete_row.gif","$lang_table_delete_row_desc","mceTableDeleteRow");contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_insert_col_before.gif","$lang_table_col_before_desc","mceTableInsertColBefore");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_insert_col_after.gif","$lang_table_col_after_desc","mceTableInsertColAfter");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_delete_col.gif","$lang_table_delete_col_desc","mceTableDeleteCol");contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_split_cells.gif","$lang_table_split_cells_desc","mceTableSplitCells","",(colspan=="1"&&rowspan=="1"));contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_merge_cells.gif","$lang_table_merge_cells_desc","mceTableMergeCells","",false)}break}}else{if(inst.hasPlugin("table")){contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table.gif","$lang_table_desc","mceInsertTable","insert")}}contextMenu.show(x,y)},10);tinyMCE.cancelEvent(e);return false},_hideContextMenu:function(){if(TinyMCE_ContextMenuPlugin._contextMenu)TinyMCE_ContextMenuPlugin._contextMenu.hide()},_commandHandler:function(command,value){var cm=TinyMCE_ContextMenuPlugin._contextMenu;cm.hide();var ui=false;if(command=="mceInsertTable"||command=="mceTableCellProps"||command=="mceTableRowProps"||command=="mceTableMergeCells")ui=true;if(command=="Paste")value=null;if(tinyMCE.getParam("dialog_type")=="modal"&&tinyMCE.isMSIE){window.setTimeout(function(){cm.inst.execCommand(command,ui,value)},100)}else cm.inst.execCommand(command,ui,value)}};tinyMCE.addPlugin("contextmenu",TinyMCE_ContextMenuPlugin);function TinyMCE_ContextMenu(settings){var doc,self=this;function defParam(key,def_val){settings[key]=typeof(settings[key])!="undefined"?settings[key]:def_val}this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.contextMenuDiv=document.createElement("div");this.contextMenuDiv.className="contextMenu";this.contextMenuDiv.setAttribute("class","contextMenu");this.contextMenuDiv.style.display="none";this.contextMenuDiv.style.position='absolute';this.contextMenuDiv.style.zindex=1000;this.contextMenuDiv.style.left='0';this.contextMenuDiv.style.top='0';this.contextMenuDiv.unselectable="on";document.body.appendChild(this.contextMenuDiv);defParam("commandhandler","");defParam("spacer_image","images/spacer.gif");this.items=new Array();this.settings=settings;this.html="";if(tinyMCE.isMSIE&&!tinyMCE.isMSIE5_0&&!tinyMCE.isOpera){this.pop=window.createPopup();doc=this.pop.document;doc.open();doc.write('<html><head><link href="'+tinyMCE.baseURL+'/plugins/contextmenu/css/contextmenu.css" rel="stylesheet" type="text/css" /></head><body unselectable="yes" class="contextMenuIEPopup"></body></html>');doc.close()}};TinyMCE_ContextMenu.prototype={clearAll:function(){this.html="";this.contextMenuDiv.innerHTML=""},addSeparator:function(){this.html+='<tr class="contextMenuItem"><td class="contextMenuIcon"><img src="'+this.settings['spacer_image']+'" width="20" height="1" class="contextMenuImage" /></td><td><img class="contextMenuSeparator" width="1" height="1" src="'+this.settings['spacer_image']+'" /></td></tr>'},addItem:function(icon,title,command,value,disabled){if(title.charAt(0)=='$')title=tinyMCE.getLang(title.substring(1));var onMouseDown='';var html='';if(tinyMCE.isMSIE&&!tinyMCE.isMSIE5_0)onMouseDown='contextMenu.execCommand(\''+command+'\', \''+value+'\');return false;';else onMouseDown=this.settings['commandhandler']+'(\''+command+'\', \''+value+'\');return false;';if(icon=="")icon=this.settings['spacer_image'];if(!disabled)html+='<tr class="contextMenuItem">';else html+='<tr class="contextMenuItemDisabled">';html+='<td class="contextMenuIcon"><img src="'+icon+'" width="20" height="20" class="contextMenuImage" /></td>';html+='<td><div class="contextMenuText">';html+='<a href="javascript:void(0);" onclick="'+onMouseDown+'" onmousedown="return false;">&#160;';html+=title;html+='&#160;</a>';html+='</div></td>';html+='</tr>';this.html+=html},show:function(x,y){var vp,width,height,yo;if(this.html=="")return;var html='';html+='<a href="#"></a><table border="0" cellpadding="0" cellspacing="0">';html+=this.html;html+='</table>';this.contextMenuDiv.innerHTML=html;this.contextMenuDiv.style.display="block";width=this.contextMenuDiv.offsetWidth;height=this.contextMenuDiv.offsetHeight;this.contextMenuDiv.style.display="none";if(tinyMCE.isMSIE&&!tinyMCE.isMSIE5_0&&!tinyMCE.isOpera){this.pop.document.body.innerHTML='<div class="contextMenu">'+html+"</div>";this.pop.document.tinyMCE=tinyMCE;this.pop.document.contextMenu=this;this.pop.show(x,y,width,height)}else{vp=this.getViewPort();yo=tinyMCE.isMSIE5_0?document.body.scrollTop:self.pageYOffset;this.contextMenuDiv.style.left=(x>vp.left+vp.width-width?vp.left+vp.width-width:x)+'px';this.contextMenuDiv.style.top=(y>vp.top+vp.height-height?vp.top+vp.height-height:y)+'px';this.contextMenuDiv.style.display="block"}},getViewPort:function(){return{left:self.pageXOffset||self.document.documentElement.scrollLeft||self.document.body.scrollLeft,top:self.pageYOffset||self.document.documentElement.scrollTop||self.document.body.scrollTop,width:document.documentElement.offsetWidth||document.body.offsetWidth,height:self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}},hide:function(){if(tinyMCE.isMSIE&&!tinyMCE.isMSIE5_0&&!tinyMCE.isOpera)this.pop.hide();else this.contextMenuDiv.style.display="none"},execCommand:function(command,value){eval(this.settings['commandhandler']+"(command, value);")}};
0 \ No newline at end of file 2 \ No newline at end of file
public/javascripts/tiny_mce/plugins/contextmenu/editor_plugin_src.js 0 → 100755
@@ -0,0 +1,360 @@ @@ -0,0 +1,360 @@
  1 +/**
  2 + * $Id: editor_plugin_src.js 264 2007-04-26 20:53:09Z spocke $
  3 + *
  4 + * @author Moxiecode
  5 + * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
  6 + */
  7 +
  8 +/* Import plugin specific language pack */
  9 +if (!tinyMCE.settings['contextmenu_skip_plugin_css']) {
  10 + tinyMCE.loadCSS(tinyMCE.baseURL + "/plugins/contextmenu/css/contextmenu.css");
  11 +}
  12 +
  13 +var TinyMCE_ContextMenuPlugin = {
  14 + // Private fields
  15 + _contextMenu : null,
  16 +
  17 + getInfo : function() {
  18 + return {
  19 + longname : 'Context menus',
  20 + author : 'Moxiecode Systems AB',
  21 + authorurl : 'http://tinymce.moxiecode.com',
  22 + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu',
  23 + version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
  24 + };
  25 + },
  26 +
  27 + initInstance : function(inst) {
  28 + // Is not working on MSIE 5.0 or Opera no contextmenu event
  29 + if (tinyMCE.isMSIE5_0 && tinyMCE.isOpera)
  30 + return;
  31 +
  32 + TinyMCE_ContextMenuPlugin._contextMenu = new TinyMCE_ContextMenu({
  33 + commandhandler : "TinyMCE_ContextMenuPlugin._commandHandler",
  34 + spacer_image : tinyMCE.baseURL + "/plugins/contextmenu/images/spacer.gif"
  35 + });
  36 +
  37 + // Add hide event handles
  38 + tinyMCE.addEvent(inst.getDoc(), "click", TinyMCE_ContextMenuPlugin._hideContextMenu);
  39 + tinyMCE.addEvent(inst.getDoc(), "keypress", TinyMCE_ContextMenuPlugin._hideContextMenu);
  40 + tinyMCE.addEvent(inst.getDoc(), "keydown", TinyMCE_ContextMenuPlugin._hideContextMenu);
  41 + tinyMCE.addEvent(document, "click", TinyMCE_ContextMenuPlugin._hideContextMenu);
  42 + tinyMCE.addEvent(document, "keypress", TinyMCE_ContextMenuPlugin._hideContextMenu);
  43 + tinyMCE.addEvent(document, "keydown", TinyMCE_ContextMenuPlugin._hideContextMenu);
  44 +
  45 + // Attach contextmenu event
  46 + if (tinyMCE.isGecko) {
  47 + tinyMCE.addEvent(inst.getDoc(), "contextmenu", function(e) {TinyMCE_ContextMenuPlugin._showContextMenu(tinyMCE.isMSIE ? inst.contentWindow.event : e, inst);});
  48 + } else
  49 + tinyMCE.addEvent(inst.getDoc(), "contextmenu", TinyMCE_ContextMenuPlugin._onContextMenu);
  50 + },
  51 +
  52 + // Private plugin internal methods
  53 +
  54 + _onContextMenu : function(e) {
  55 + var elm = tinyMCE.isMSIE ? e.srcElement : e.target;
  56 + var targetInst, body;
  57 +
  58 + // Find instance
  59 + if ((body = tinyMCE.getParentElement(elm, "body")) != null) {
  60 + for (var n in tinyMCE.instances) {
  61 + var inst = tinyMCE.instances[n];
  62 + if (!tinyMCE.isInstance(inst))
  63 + continue;
  64 +
  65 + if (body == inst.getBody()) {
  66 + targetInst = inst;
  67 + break;
  68 + }
  69 + }
  70 +
  71 + return TinyMCE_ContextMenuPlugin._showContextMenu(tinyMCE.isMSIE ? targetInst.contentWindow.event : e, targetInst);
  72 + }
  73 + },
  74 +
  75 + _showContextMenu : function(e, inst) {
  76 + if (e.ctrlKey)
  77 + return true;
  78 +
  79 + function getAttrib(elm, name) {
  80 + return elm.getAttribute(name) ? elm.getAttribute(name) : "";
  81 + }
  82 +
  83 + var x, y, elm, contextMenu;
  84 + var pos = tinyMCE.getAbsPosition(inst.iframeElement);
  85 +
  86 + x = tinyMCE.isMSIE ? e.screenX : pos.absLeft + (e.pageX - inst.getBody().scrollLeft);
  87 + y = tinyMCE.isMSIE ? e.screenY : pos.absTop + (e.pageY - inst.getBody().scrollTop);
  88 + elm = tinyMCE.isMSIE ? e.srcElement : e.target;
  89 +
  90 + contextMenu = this._contextMenu;
  91 + contextMenu.inst = inst;
  92 +
  93 + // Mozilla needs some time
  94 + window.setTimeout(function () {
  95 + var theme = tinyMCE.getParam("theme");
  96 +
  97 + contextMenu.clearAll();
  98 + var sel = inst.selection.getSelectedText().length != 0 || elm.nodeName == "IMG";
  99 +
  100 + // Default items
  101 + contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/cut.gif", "$lang_cut_desc", "Cut", "", !sel);
  102 + contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/copy.gif", "$lang_copy_desc", "Copy", "", !sel);
  103 + contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/paste.gif", "$lang_paste_desc", "Paste", "", false);
  104 +
  105 + if (sel || (elm ? (elm.nodeName == 'A' && tinyMCE.getAttrib(elm, 'name') == '') || (elm.nodeName == 'IMG') : false)) {
  106 + contextMenu.addSeparator();
  107 + contextMenu.addItem(tinyMCE.baseURL + "/themes/advanced/images/link.gif", "$lang_link_desc", inst.hasPlugin("advlink") ? "mceAdvLink" : "mceLink");
  108 + contextMenu.addItem(tinyMCE.baseURL + "/themes/advanced/images/unlink.gif", "$lang_unlink_desc", "unlink", "", (elm ? (elm.nodeName != 'A') && (elm.nodeName != 'IMG') : true));
  109 + }
  110 +
  111 + // Get element
  112 + elm = tinyMCE.getParentElement(elm, "img,table,td" + (inst.hasPlugin("advhr") ? ',hr' : ''));
  113 + if (elm) {
  114 + switch (elm.nodeName) {
  115 + case "IMG":
  116 + contextMenu.addSeparator();
  117 +
  118 + // If flash
  119 + if (tinyMCE.hasPlugin('flash') && tinyMCE.getAttrib(elm, 'class').indexOf('mceItemFlash') != -1)
  120 + contextMenu.addItem(tinyMCE.baseURL + "/plugins/flash/images/flash.gif", "$lang_flash_props", "mceFlash");
  121 + else if (tinyMCE.hasPlugin('media') && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(elm, 'class')))
  122 + contextMenu.addItem(tinyMCE.baseURL + "/plugins/flash/images/flash.gif", "$lang_media_title", "mceMedia");
  123 + else
  124 + contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/image.gif", "$lang_image_props_desc", inst.hasPlugin("advimage") ? "mceAdvImage" : "mceImage");
  125 + break;
  126 +
  127 + case "HR":
  128 + contextMenu.addSeparator();
  129 + contextMenu.addItem(tinyMCE.baseURL + "/plugins/advhr/images/advhr.gif", "$lang_insert_advhr_desc", "mceAdvancedHr");
  130 + break;
  131 +
  132 + case "TABLE":
  133 + case "TD":
  134 + // Is table plugin loaded
  135 + if (inst.hasPlugin("table")) {
  136 + var colspan = (elm.nodeName == "TABLE") ? "" : getAttrib(elm, "colspan");
  137 + var rowspan = (elm.nodeName == "TABLE") ? "" : getAttrib(elm, "rowspan");
  138 +
  139 + colspan = colspan == "" ? "1" : colspan;
  140 + rowspan = rowspan == "" ? "1" : rowspan;
  141 +
  142 + contextMenu.addSeparator();
  143 + contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/cut.gif", "$lang_table_cut_row_desc", "mceTableCutRow");
  144 + contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/copy.gif", "$lang_table_copy_row_desc", "mceTableCopyRow");
  145 + contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/paste.gif", "$lang_table_paste_row_before_desc", "mceTablePasteRowBefore", "", inst.tableRowClipboard == null);
  146 + contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/paste.gif", "$lang_table_paste_row_after_desc", "mceTablePasteRowAfter", "", inst.tableRowClipboard == null);
  147 +
  148 + /* contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/justifyleft.gif", "$lang_justifyleft_desc", "JustifyLeft", "", false);
  149 + contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/justifycenter.gif", "$lang_justifycenter_desc", "JustifyCenter", "", false);
  150 + contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/justifyright.gif", "$lang_justifyright_desc", "JustifyRight", "", false);
  151 + contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/justifyfull.gif", "$lang_justifyfull_desc", "JustifyFull", "", false);*/
  152 + contextMenu.addSeparator();
  153 + contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table.gif", "$lang_table_desc", "mceInsertTable", "insert");
  154 + contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table.gif", "$lang_table_props_desc", "mceInsertTable");
  155 + contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_cell_props.gif", "$lang_table_cell_desc", "mceTableCellProps");
  156 + contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_delete.gif", "$lang_table_del", "mceTableDelete");
  157 + contextMenu.addSeparator();
  158 + contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_row_props.gif", "$lang_table_row_desc", "mceTableRowProps");
  159 + contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_insert_row_before.gif", "$lang_table_row_before_desc", "mceTableInsertRowBefore");
  160 + contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_insert_row_after.gif", "$lang_table_row_after_desc", "mceTableInsertRowAfter");
  161 + contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_delete_row.gif", "$lang_table_delete_row_desc", "mceTableDeleteRow");
  162 + contextMenu.addSeparator();
  163 + contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_insert_col_before.gif", "$lang_table_col_before_desc", "mceTableInsertColBefore");
  164 + contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_insert_col_after.gif", "$lang_table_col_after_desc", "mceTableInsertColAfter");
  165 + contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_delete_col.gif", "$lang_table_delete_col_desc", "mceTableDeleteCol");
  166 + contextMenu.addSeparator();
  167 + contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_split_cells.gif", "$lang_table_split_cells_desc", "mceTableSplitCells", "", (colspan == "1" && rowspan == "1"));
  168 + contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_merge_cells.gif", "$lang_table_merge_cells_desc", "mceTableMergeCells", "", false);
  169 + }
  170 + break;
  171 + }
  172 + } else {
  173 + // Add table specific
  174 + if (inst.hasPlugin("table")) {
  175 + contextMenu.addSeparator();
  176 + contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table.gif", "$lang_table_desc", "mceInsertTable", "insert");
  177 + }
  178 + }
  179 +
  180 + contextMenu.show(x, y);
  181 + }, 10);
  182 +
  183 + // Cancel default handeling
  184 + tinyMCE.cancelEvent(e);
  185 + return false;
  186 + },
  187 +
  188 + _hideContextMenu : function() {
  189 + if (TinyMCE_ContextMenuPlugin._contextMenu)
  190 + TinyMCE_ContextMenuPlugin._contextMenu.hide();
  191 + },
  192 +
  193 + _commandHandler : function(command, value) {
  194 + var cm = TinyMCE_ContextMenuPlugin._contextMenu;
  195 +
  196 + cm.hide();
  197 +
  198 + // UI must be true on these
  199 + var ui = false;
  200 + if (command == "mceInsertTable" || command == "mceTableCellProps" || command == "mceTableRowProps" || command == "mceTableMergeCells")
  201 + ui = true;
  202 +
  203 + if (command == "Paste")
  204 + value = null;
  205 +
  206 + if (tinyMCE.getParam("dialog_type") == "modal" && tinyMCE.isMSIE) {
  207 + // Cell properties will generate access denied error is this isn't done?!
  208 + window.setTimeout(function() {
  209 + cm.inst.execCommand(command, ui, value);
  210 + }, 100);
  211 + } else
  212 + cm.inst.execCommand(command, ui, value);
  213 + }
  214 +};
  215 +
  216 +tinyMCE.addPlugin("contextmenu", TinyMCE_ContextMenuPlugin);
  217 +
  218 +// Context menu class
  219 +
  220 +function TinyMCE_ContextMenu(settings) {
  221 + var doc, self = this;
  222 +
  223 + // Default value function
  224 + function defParam(key, def_val) {
  225 + settings[key] = typeof(settings[key]) != "undefined" ? settings[key] : def_val;
  226 + }
  227 +
  228 + this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
  229 +
  230 + // Setup contextmenu div
  231 + this.contextMenuDiv = document.createElement("div");
  232 + this.contextMenuDiv.className = "contextMenu";
  233 + this.contextMenuDiv.setAttribute("class", "contextMenu");
  234 + this.contextMenuDiv.style.display = "none";
  235 + this.contextMenuDiv.style.position = 'absolute';
  236 + this.contextMenuDiv.style.zindex = 1000;
  237 + this.contextMenuDiv.style.left = '0';
  238 + this.contextMenuDiv.style.top = '0';
  239 + this.contextMenuDiv.unselectable = "on";
  240 +
  241 + document.body.appendChild(this.contextMenuDiv);
  242 +
  243 + // Setup default values
  244 + defParam("commandhandler", "");
  245 + defParam("spacer_image", "images/spacer.gif");
  246 +
  247 + this.items = new Array();
  248 + this.settings = settings;
  249 + this.html = "";
  250 +
  251 + // IE Popup
  252 + if (tinyMCE.isMSIE && !tinyMCE.isMSIE5_0 && !tinyMCE.isOpera) {
  253 + this.pop = window.createPopup();
  254 + doc = this.pop.document;
  255 + doc.open();
  256 + doc.write('<html><head><link href="' + tinyMCE.baseURL + '/plugins/contextmenu/css/contextmenu.css" rel="stylesheet" type="text/css" /></head><body unselectable="yes" class="contextMenuIEPopup"></body></html>');
  257 + doc.close();
  258 + }
  259 +};
  260 +
  261 +TinyMCE_ContextMenu.prototype = {
  262 + clearAll : function() {
  263 + this.html = "";
  264 + this.contextMenuDiv.innerHTML = "";
  265 + },
  266 +
  267 + addSeparator : function() {
  268 + this.html += '<tr class="contextMenuItem"><td class="contextMenuIcon"><img src="' + this.settings['spacer_image'] + '" width="20" height="1" class="contextMenuImage" /></td><td><img class="contextMenuSeparator" width="1" height="1" src="' + this.settings['spacer_image'] + '" /></td></tr>';
  269 + },
  270 +
  271 + addItem : function(icon, title, command, value, disabled) {
  272 + if (title.charAt(0) == '$')
  273 + title = tinyMCE.getLang(title.substring(1));
  274 +
  275 + var onMouseDown = '';
  276 + var html = '';
  277 +
  278 + if (tinyMCE.isMSIE && !tinyMCE.isMSIE5_0)
  279 + onMouseDown = 'contextMenu.execCommand(\'' + command + '\', \'' + value + '\');return false;';
  280 + else
  281 + onMouseDown = this.settings['commandhandler'] + '(\'' + command + '\', \'' + value + '\');return false;';
  282 +
  283 + if (icon == "")
  284 + icon = this.settings['spacer_image'];
  285 +
  286 + if (!disabled)
  287 + html += '<tr class="contextMenuItem">';
  288 + else
  289 + html += '<tr class="contextMenuItemDisabled">';
  290 +
  291 + html += '<td class="contextMenuIcon"><img src="' + icon + '" width="20" height="20" class="contextMenuImage" /></td>';
  292 + html += '<td><div class="contextMenuText">';
  293 + html += '<a href="javascript:void(0);" onclick="' + onMouseDown + '" onmousedown="return false;">&#160;';
  294 +
  295 + // Add text
  296 + html += title;
  297 +
  298 + html += '&#160;</a>';
  299 + html += '</div></td>';
  300 + html += '</tr>';
  301 +
  302 + // Add to main
  303 + this.html += html;
  304 + },
  305 +
  306 + show : function(x, y) {
  307 + var vp, width, height, yo;
  308 +
  309 + if (this.html == "")
  310 + return;
  311 +
  312 + var html = '';
  313 +
  314 + html += '<a href="#"></a><table border="0" cellpadding="0" cellspacing="0">';
  315 + html += this.html;
  316 + html += '</table>';
  317 +
  318 + this.contextMenuDiv.innerHTML = html;
  319 +
  320 + // Get dimensions
  321 + this.contextMenuDiv.style.display = "block";
  322 + width = this.contextMenuDiv.offsetWidth;
  323 + height = this.contextMenuDiv.offsetHeight;
  324 + this.contextMenuDiv.style.display = "none";
  325 +
  326 + if (tinyMCE.isMSIE && !tinyMCE.isMSIE5_0 && !tinyMCE.isOpera) {
  327 + // Setup popup and show
  328 + this.pop.document.body.innerHTML = '<div class="contextMenu">' + html + "</div>";
  329 + this.pop.document.tinyMCE = tinyMCE;
  330 + this.pop.document.contextMenu = this;
  331 + this.pop.show(x, y, width, height);
  332 + } else {
  333 + vp = this.getViewPort();
  334 + yo = tinyMCE.isMSIE5_0 ? document.body.scrollTop : self.pageYOffset;
  335 + this.contextMenuDiv.style.left = (x > vp.left + vp.width - width ? vp.left + vp.width - width : x) + 'px';
  336 + this.contextMenuDiv.style.top = (y > vp.top + vp.height - height ? vp.top + vp.height - height : y) + 'px';
  337 + this.contextMenuDiv.style.display = "block";
  338 + }
  339 + },
  340 +
  341 + getViewPort : function() {
  342 + return {
  343 + left : self.pageXOffset || self.document.documentElement.scrollLeft || self.document.body.scrollLeft,
  344 + top: self.pageYOffset || self.document.documentElement.scrollTop || self.document.body.scrollTop,
  345 + width : document.documentElement.offsetWidth || document.body.offsetWidth,
  346 + height : self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
  347 + };
  348 + },
  349 +
  350 + hide : function() {
  351 + if (tinyMCE.isMSIE && !tinyMCE.isMSIE5_0 && !tinyMCE.isOpera)
  352 + this.pop.hide();
  353 + else
  354 + this.contextMenuDiv.style.display = "none";
  355 + },
  356 +
  357 + execCommand : function(command, value) {
  358 + eval(this.settings['commandhandler'] + "(command, value);");
  359 + }
  360 +};
public/javascripts/tiny_mce/plugins/contextmenu/images/spacer.gif 0 → 100755

43 Bytes

public/javascripts/tiny_mce/plugins/contextmenu/readme.txt 0 → 100755
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +Check the TinyMCE documentation for details on this plugin.
public/javascripts/tiny_mce/plugins/devkit/css/devkit.css 0 → 100755
@@ -0,0 +1,117 @@ @@ -0,0 +1,117 @@
  1 +body {
  2 + overflow: hidden;
  3 +}
  4 +
  5 +h1 {
  6 + font-size: 14px;
  7 + margin: 0 0 10px 0;
  8 +}
  9 +
  10 +h2 {
  11 + font-size: 12px;
  12 + margin: 3px 0 3px 0;
  13 +}
  14 +
  15 +h3 {
  16 + font-size: 11px;
  17 + margin: 3px 0 3px 0;
  18 +}
  19 +
  20 +#log {
  21 + font-family: Verdana;
  22 + border: 1px solid gray;
  23 + width: 100%; height: 240px;
  24 + overflow: scroll;
  25 + white-space: nowrap;
  26 +}
  27 +
  28 +#log span {
  29 + display: block;
  30 +}
  31 +
  32 +#log span.msg {
  33 + float: left;
  34 +}
  35 +
  36 +#log span.time {
  37 + float: left;
  38 +}
  39 +
  40 +#log br {
  41 + clear: both;
  42 +}
  43 +
  44 +#logfilter {
  45 + width: 350px;
  46 +}
  47 +
  48 +#logenabled {
  49 + border: 0;
  50 +}
  51 +
  52 +#settings_panel span, #info_panel span, #content_panel span, #command_states_panel span, #undo_redo_panel span {
  53 + display: block;
  54 + margin: 5px 0 5px 0;
  55 +}
  56 +
  57 +div.data {
  58 + width: 100%; height: 240px;
  59 + overflow: scroll;
  60 + border: 1px solid gray;
  61 +}
  62 +
  63 +#misc_panel div.data {
  64 + height: 270px;
  65 +}
  66 +
  67 +.data input {
  68 + width: 265px;
  69 + border: 0;
  70 +}
  71 +
  72 +.data h2 {
  73 + margin-left: 5px;
  74 +}
  75 +
  76 +.data h3 {
  77 + margin-left: 7px;
  78 +}
  79 +
  80 +.data div {
  81 + margin-left: 7px;
  82 +}
  83 +
  84 +.data table {
  85 + margin: 0 0 15px 15px;
  86 +}
  87 +
  88 +.data p {
  89 + margin: 0; padding: 0;
  90 + margin-top: 5px;
  91 + margin-left: 5px;
  92 +}
  93 +
  94 +table, td {
  95 + border: 1px solid gray;
  96 + border-collapse: collapse;
  97 +}
  98 +
  99 +#flip {
  100 + position: absolute;
  101 + left: 295; top: 384px;
  102 +}
  103 +
  104 +.bspec {
  105 + color: gray;
  106 +}
  107 +
  108 +.dep {
  109 + color: #880000;
  110 +}
  111 +
  112 +.col1 {
  113 + width: 265px;
  114 +}
  115 +
  116 +div.undodata {
  117 +}
public/javascripts/tiny_mce/plugins/devkit/css/devkit_ui.css 0 → 100755
@@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
  1 +#devkit {
  2 + position: absolute;
  3 + top: -385px; right: 0;
  4 + width: 640px; height: 390px;
  5 + border: 1px solid black;
  6 + z-index: 10000;
  7 +}
  8 +
  9 +.devkitup {
  10 + top: -385px !important;
  11 +}
  12 +
  13 +.devkitdown {
  14 + top: 0 !important;
  15 +}
public/javascripts/tiny_mce/plugins/devkit/devkit.htm 0 → 100755
@@ -0,0 +1,140 @@ @@ -0,0 +1,140 @@
  1 +<html xmlns="http://www.w3.org/1999/xhtml">
  2 +<head>
  3 + <title>{$lang_devkit_title}</title>
  4 + <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
  5 + <script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
  6 + <script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
  7 + <script language="javascript" type="text/javascript" src="jscripts/devkit.js"></script>
  8 + <script language="javascript" type="text/javascript" src="jscripts/diff.js"></script>
  9 + <link href="css/devkit.css" rel="stylesheet" type="text/css" />
  10 + <base target="_self" />
  11 +</head>
  12 +<body id="devkit" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
  13 + <form action="#">
  14 + <h1>{$lang_devkit_title}</h1>
  15 +
  16 + <div class="tabs">
  17 + <ul>
  18 + <li id="log_tab" class="current"><span><a href="javascript:mcTabs.displayTab('log_tab','log_panel');" onmousedown="return false;">{$lang_devkit_log_tab}</a></span></li>
  19 + <li id="info_tab"><span><a href="javascript:mcTabs.displayTab('info_tab','info_panel');" onmousedown="return false;">{$lang_devkit_info_tab}</a></span></li>
  20 + <li id="settings_tab"><span><a href="javascript:mcTabs.displayTab('settings_tab','settings_panel');" onmousedown="return false;">{$lang_devkit_settings_tab}</a></span></li>
  21 + <li id="content_tab"><span><a href="javascript:mcTabs.displayTab('content_tab','content_panel');" onmousedown="return false;">{$lang_devkit_content_tab}</a></span></li>
  22 + <!-- <li id="command_states_tab"><span><a href="javascript:mcTabs.displayTab('command_states_tab','command_states_panel');" onmousedown="return false;">{$lang_devkit_command_states_tab}</a></span></li> -->
  23 + <li id="undo_redo_tab"><span><a href="javascript:mcTabs.displayTab('undo_redo_tab','undo_redo_panel');" onmousedown="return false;">{$lang_devkit_undo_redo_tab}</a></span></li>
  24 + <li id="misc_tab"><span><a href="javascript:mcTabs.displayTab('misc_tab','misc_panel');" onmousedown="return false;">{$lang_devkit_misc_tab}</a></span></li>
  25 + </ul>
  26 + </div>
  27 +
  28 + <div class="panel_wrapper">
  29 + <div id="log_panel" class="panel current">
  30 + <fieldset>
  31 + <legend>{$lang_devkit_log_tab}</legend>
  32 +
  33 + <div style="float: left">
  34 + <label>{$lang_devkit_filter} </label><input type="text" id="logfilter" name="logfilter" value="" onchange="changeFilter(this.value);" />
  35 + </div>
  36 +
  37 + <div style="float: left">
  38 + <input type="checkbox" id="logenabled" name="logenabled" value="true" checked="checked" onclick="toggleLog(this.checked);" />
  39 + </div>
  40 +
  41 + <div style="float: right">
  42 + <a href="javascript:clearLog();">[{$lang_devkit_clear_log}]</a>
  43 + </div>
  44 +
  45 + <br style="clear: both" />
  46 +
  47 + <div id="log">
  48 + </div>
  49 +
  50 + <input type="checkbox" id="debug_events" name="debug_events" class="checkbox" onclick="toggleDebugEvents(this.checked);" /><label for="debug_events" onclick="toggleDebugEvents(this.form.debug_events.checked);">{$lang_devkit_debug_events}</label>
  51 + </fieldset>
  52 + </div>
  53 +
  54 + <div id="info_panel" class="panel">
  55 + <fieldset>
  56 + <legend>{$lang_devkit_info_tab}</legend>
  57 +
  58 + <span><a href="javascript:renderInfo();">[{$lang_devkit_refresh}]</a></span>
  59 +
  60 + <div id="info" class="data">
  61 + <p>{$lang_devkit_info_help}</p>
  62 + </div>
  63 + </fieldset>
  64 + </div>
  65 +
  66 + <div id="settings_panel" class="panel">
  67 + <fieldset>
  68 + <legend>{$lang_devkit_settings_tab}</legend>
  69 +
  70 + <span><a href="javascript:renderSettings();">[{$lang_devkit_refresh}]</a></span>
  71 +
  72 + <div id="settings" class="data">
  73 + <p>{$lang_devkit_settings_help}</p>
  74 + </div>
  75 + </fieldset>
  76 + </div>
  77 +
  78 + <div id="content_panel" class="panel">
  79 + <fieldset>
  80 + <legend>{$lang_devkit_content_tab}</legend>
  81 +
  82 + <span><a href="javascript:renderContent();">[{$lang_devkit_refresh}]</a></span>
  83 +
  84 + <div id="content" class="data">
  85 + <p>{$lang_devkit_content_help}</p>
  86 + </div>
  87 + </fieldset>
  88 + </div>
  89 +
  90 + <div id="command_states_panel" class="panel">
  91 + <fieldset>
  92 + <legend>{$lang_devkit_command_states_tab}</legend>
  93 +
  94 + <span><a href="javascript:renderCommandStates();">[{$lang_devkit_refresh}]</a></span>
  95 +
  96 + <div id="command_states" class="data">
  97 + <p>{$lang_devkit_command_states_help}</p>
  98 + </div>
  99 + </fieldset>
  100 + </div>
  101 +
  102 + <div id="undo_redo_panel" class="panel">
  103 + <fieldset>
  104 + <legend>{$lang_devkit_undo_redo_tab}</legend>
  105 +
  106 + <span><a href="javascript:renderUndoRedo();">[{$lang_devkit_refresh}]</a></span>
  107 +
  108 + <div id="undo_redo" class="data">
  109 + <p>{$lang_devkit_undo_redo_help}</p>
  110 + </div>
  111 +
  112 + <input type="checkbox" id="undo_diff" name="undo_diff" class="checkbox" /><label for="undo_diff">{$lang_devkit_undo_diff}</label>
  113 + </fieldset>
  114 + </div>
  115 +
  116 + <div id="misc_panel" class="panel">
  117 + <fieldset>
  118 + <legend>{$lang_devkit_misc_tab}</legend>
  119 +
  120 + <div class="data">
  121 + <p>{$lang_devkit_misc_help}</p>
  122 + <hr />
  123 + <p>Selection: <a href="#" onmousedown="return storeSelection();">[Store selection]</a> <a href="#" onmousedown="return restoreSelection();">[Restore selection]</a></p>
  124 + <hr />
  125 + <div><strong>Insert custom HTML content</strong></div>
  126 + <div><textarea id="htmlcont" name="htmlcont" style="width: 90%" rows="5"></textarea></div>
  127 + <div><a href="#" onclick="return tinyMCE.execCommand('mceInsertContent',false,document.getElementById('htmlcont').value);">[Insert content]</a></div>
  128 + <hr />
  129 + <div><strong>Eval JS:</strong></div>
  130 + <div><textarea id="jscont" name="jscont" style="width: 90%" rows="5">tinyMCE.execCommand('Bold',false,null);</textarea></div>
  131 + <div><a href="#" onclick="return parent.window.eval(document.getElementById('jscont').value);">[Evaluate]</a></div>
  132 + </div>
  133 + </fieldset>
  134 + </div>
  135 + </div>
  136 + </form>
  137 +
  138 + <div id="flip"><a href="javascript:toggleFlip();" onmousedown="return false;"><img id="flipbtn" src="images/flip_down.gif" border="0" /></a></div>
  139 +</body>
  140 +</html>
public/javascripts/tiny_mce/plugins/devkit/editor_plugin.js 0 → 100755
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +tinyMCE.importPluginLanguagePack('devkit');var TinyMCE_DevKitPlugin={_logFilter:'\\[(importCSS|execCommand|execInstanceCommand|debug)\\]',_logPadding:'',_startTime:null,_benchMark:false,_winLoaded:false,_isDebugEvents:false,getInfo:function(){return{longname:'Development Kit',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/devkit',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},initInstance:function(inst){this._setup()},_setup:function(){if(this._loaded)return;this._loaded=true;document.___TinyMCE=tinyMCE;this._logFilter=tinyMCE.getParam('devkit_log_filter',this._logFilter);this._benchMark=tinyMCE.getParam('devkit_bench_mark',false);var ifr=document.createElement('iframe');ifr.setAttribute("id","devkit");ifr.setAttribute("frameBorder","0");ifr.setAttribute("src",tinyMCE.baseURL+'/plugins/devkit/devkit.htm');document.body.appendChild(ifr);tinyMCE.importCSS(document,tinyMCE.baseURL+'/plugins/devkit/css/devkit_ui.css')},_start:function(){this._logPadding+='\u00a0';return new Date().getTime()},_end:function(st){if(this._logPadding.length>0)this._logPadding=this._logPadding.substring(0,this._logPadding.length-1);if(this._benchMark)this._log("benchmark","Execution time: "+(new Date().getTime()-st))},_log:function(t){var m,a,i,e=document.getElementById('devkit'),now=new Date().getTime();if(!this._startTime)this._startTime=now;m=(this._logPadding.length>1?this._logPadding:'')+'['+(now-this._startTime)+'] ['+t+'] ';a=this._log.arguments;for(i=1;i<a.length;i++){if(typeof(a[i])=='undefined')continue;if(i>1)m+=', ';m+=a[i]}if(!new RegExp(this._logFilter,'gi').test(m)){if(this._logPadding.length>0)this._logPadding=this._logPadding.substring(0,this._logPadding.length-1);return}if(!this._winLoaded)tinyMCE.log[tinyMCE.log.length]=m;else e.contentWindow.debug(m)},_debugEvents:function(s){var i,ld,inst,n,ev=['CheckboxStateChange','DOMAttrModified','DOMMenuItemActive','DOMMenuItemInactive','DOMMouseScroll','DOMNodeInserted','DOMNodeRemoved','RadioStateChange','blur','broadcast','change','click','close','command','commandupdate','contextmenu','dblclick','dragdrop','dragenter','dragexit','draggesture','dragover','focus','input','keydown','keypress','keyup','load','mousedown','mouseout','mouseover','mouseup','overflow','overflowchanged','popuphidden','popuphiding','popupshowing','popupshown','select','syncfrompreference','synctopreference','underflow','unload','abort','activate','afterprint','afterupdate','beforeactivate','beforecopy','beforecut','beforedeactivate','beforeeditfocus','beforepaste','beforeprint','beforeunload','beforeupdate','bounce','cellchange','controlselect','copy','cut','dataavailable','datasetchanged','datasetcomplete','deactivate','dragend','dragleave','dragstart','drop','error','errorupdate','filterchange','finish','focusin','focusout','help','layoutcomplete','losecapture','mouseenter','mouseleave','mousewheel','move','moveend','movestart','paste','propertychange','readystatechange','reset','resize','resizeend','resizestart','rowenter','rowexit','rowsdelete','rowsinserted','scroll','selectionchange','selectstart','start','stop','submit'];if(TinyMCE_DevKitPlugin._isDebugEvents==s)return;TinyMCE_DevKitPlugin._isDebugEvents=s;for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst)||inst.getDoc()==ld)continue;ld=inst.getDoc();for(i=0;i<ev.length;i++){if(s)tinyMCE.addEvent(ld,ev[i],TinyMCE_DevKitPlugin._debugEvent);else tinyMCE.removeEvent(ld,ev[i],TinyMCE_DevKitPlugin._debugEvent)}}},_debugEvent:function(e){var t;e=e?e:tinyMCE.selectedInstance.getWin().event;t=e.srcElement?e.srcElement:e.target;tinyMCE.debug(e.type,t?t.nodeName:'')},_serialize:function(o){var i,v,s=TinyMCE_DevKitPlugin._serialize;if(o==null)return'null';switch(typeof o){case'string':v='\bb\tt\nn\ff\rr\""\'\'\\\\';return'"'+o.replace(new RegExp('([\u0080-\uFFFF\\x00-\\x1f\\"])','g'),function(a,b){i=v.indexOf(b);if(i+1)return'\\'+v.charAt(i+1);a=b.charCodeAt().toString(16);return'\\u'+'0000'.substring(a.length)+a})+'"';case'object':if(o instanceof Array){for(i=0,v='[';i<o.length;i++)v+=(i>0?',':'')+s(o[i]);return v+']'}v='{';for(i in o)v+=typeof o[i]!='function'?(v.length>1?',"':'"')+i+'":'+s(o[i]):'';return v+'}'}return''+o}};tinyMCE.__debug=tinyMCE.debug;tinyMCE.debug=function(){var a,i,m='',now=new Date().getTime(),start=TinyMCE_DevKitPlugin._startTime;if(!start)TinyMCE_DevKitPlugin._startTime=start=now;a=this.debug.arguments;for(i=0;i<a.length;i++){if(typeof(a[i])=='undefined')continue;if(i>0)m+=', ';m+=a[i]}TinyMCE_DevKitPlugin._log('debug',m)};tinyMCE.dump=function(o){tinyMCE.debug(TinyMCE_DevKitPlugin._serialize(o))};tinyMCE.sleep=function(t){var s=new Date().getTime(),b;while(new Date().getTime()-s<t)b=1};tinyMCE.__execCommand=tinyMCE.execCommand;tinyMCE.execCommand=function(command,user_interface,value){var r,st,dk=TinyMCE_DevKitPlugin;st=dk._start();dk._log('execCommand',command,user_interface,value);r=tinyMCE.__execCommand(command,user_interface,value);dk._end(st);return r};tinyMCE.__execInstanceCommand=tinyMCE.execInstanceCommand;tinyMCE.execInstanceCommand=function(editor_id,command,user_interface,value,focus){var r,st,dk=TinyMCE_DevKitPlugin;st=dk._start();dk._log('execInstanceCommand',editor_id,command,user_interface,value);r=tinyMCE.__execInstanceCommand(editor_id,command,user_interface,value);dk._end(st);return r};TinyMCE_Engine.prototype.__handleEvent=TinyMCE_Engine.prototype.handleEvent;TinyMCE_Engine.prototype.handleEvent=function(e){var r,st,dk=TinyMCE_DevKitPlugin;st=dk._start();dk._log('handleEvent',e.type);r=tinyMCE.__handleEvent(e);dk._end(st);return r};tinyMCE.__importCSS=tinyMCE.importCSS;tinyMCE.importCSS=function(doc,css){var r,st,dk=TinyMCE_DevKitPlugin;st=dk._start();dk._log('importCSS',doc,css);r=tinyMCE.__importCSS(doc,css);dk._end(st);return r};tinyMCE.__triggerNodeChange=tinyMCE.triggerNodeChange;tinyMCE.triggerNodeChange=function(focus,setup_content){var r,st,dk=TinyMCE_DevKitPlugin;st=dk._start();dk._log('triggerNodeChange',focus,setup_content);r=tinyMCE.__triggerNodeChange(focus,setup_content);dk._end(st);return r};tinyMCE.__dispatchCallback=tinyMCE.dispatchCallback;tinyMCE.dispatchCallback=function(i,p,n){var r,st,dk=TinyMCE_DevKitPlugin;st=dk._start();dk._log('dispatchCallback',i,p,n);r=tinyMCE.__dispatchCallback(i,p,n);dk._end(st);return r};tinyMCE.__executeCallback=tinyMCE.executeCallback;tinyMCE.executeCallback=function(i,p,n){var r,st,dk=TinyMCE_DevKitPlugin;st=dk._start();dk._log('executeCallback',i,p,n);r=tinyMCE.__executeCallback(i,p,n);dk._end(st);return r};tinyMCE.__execCommandCallback=tinyMCE.execCommandCallback;tinyMCE.execCommandCallback=function(i,p,n){var r,st,dk=TinyMCE_DevKitPlugin;st=dk._start();dk._log('execCommandCallback',i,p,n);r=tinyMCE.__execCommandCallback(i,p,n);dk._end(st);return r};tinyMCE.addPlugin("devkit",TinyMCE_DevKitPlugin);
0 \ No newline at end of file 2 \ No newline at end of file
public/javascripts/tiny_mce/plugins/devkit/editor_plugin_src.js 0 → 100755
@@ -0,0 +1,325 @@ @@ -0,0 +1,325 @@
  1 +/**
  2 + * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
  3 + *
  4 + * @author Moxiecode
  5 + * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
  6 + */
  7 +
  8 +tinyMCE.importPluginLanguagePack('devkit');
  9 +
  10 +var TinyMCE_DevKitPlugin = {
  11 + _logFilter : '\\[(importCSS|execCommand|execInstanceCommand|debug)\\]',
  12 + _logPadding : '',
  13 + _startTime : null,
  14 + _benchMark : false,
  15 + _winLoaded : false,
  16 + _isDebugEvents : false,
  17 +
  18 + getInfo : function() {
  19 + return {
  20 + longname : 'Development Kit',
  21 + author : 'Moxiecode Systems AB',
  22 + authorurl : 'http://tinymce.moxiecode.com',
  23 + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/devkit',
  24 + version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
  25 + };
  26 + },
  27 +
  28 + initInstance : function(inst) {
  29 + this._setup();
  30 + },
  31 +
  32 + _setup : function() {
  33 + if (this._loaded)
  34 + return;
  35 +
  36 + this._loaded = true;
  37 +
  38 + // Register a document reference for more easy access in the FF DOM inspector
  39 + document.___TinyMCE = tinyMCE;
  40 +
  41 + // Setup devkit by settings
  42 + this._logFilter = tinyMCE.getParam('devkit_log_filter', this._logFilter);
  43 + this._benchMark = tinyMCE.getParam('devkit_bench_mark', false);
  44 +
  45 + var ifr = document.createElement('iframe');
  46 +
  47 + ifr.setAttribute("id", "devkit");
  48 + ifr.setAttribute("frameBorder", "0");
  49 + ifr.setAttribute("src", tinyMCE.baseURL + '/plugins/devkit/devkit.htm');
  50 +
  51 + document.body.appendChild(ifr);
  52 +
  53 + // Workaround for strange IE reload bug
  54 + //if (tinyMCE.isRealIE)
  55 + // document.getElementById('devkit').outerHTML = document.getElementById('devkit').outerHTML;
  56 +
  57 + tinyMCE.importCSS(document, tinyMCE.baseURL + '/plugins/devkit/css/devkit_ui.css');
  58 + },
  59 +
  60 + _start : function() {
  61 + this._logPadding += '\u00a0';
  62 +
  63 + return new Date().getTime();
  64 + },
  65 +
  66 + _end : function(st) {
  67 + if (this._logPadding.length > 0)
  68 + this._logPadding = this._logPadding.substring(0, this._logPadding.length - 1);
  69 +
  70 + if (this._benchMark)
  71 + this._log("benchmark", "Execution time: " + (new Date().getTime() - st));
  72 + },
  73 +
  74 + _log : function(t) {
  75 + var m, a, i, e = document.getElementById('devkit'), now = new Date().getTime();
  76 +
  77 + if (!this._startTime)
  78 + this._startTime = now;
  79 +
  80 + m = (this._logPadding.length > 1 ? this._logPadding : '') + '[' + (now - this._startTime) + '] [' + t + '] ';
  81 +
  82 + a = this._log.arguments;
  83 + for (i=1; i<a.length; i++) {
  84 + if (typeof(a[i]) == 'undefined')
  85 + continue;
  86 +
  87 + if (i > 1)
  88 + m += ', ';
  89 +
  90 + m += a[i];
  91 + }
  92 +
  93 + if (!new RegExp(this._logFilter, 'gi').test(m)) {
  94 + if (this._logPadding.length > 0)
  95 + this._logPadding = this._logPadding.substring(0, this._logPadding.length - 1);
  96 +
  97 + return;
  98 + }
  99 +
  100 + if (!this._winLoaded)
  101 + tinyMCE.log[tinyMCE.log.length] = m;
  102 + else
  103 + e.contentWindow.debug(m);
  104 + },
  105 +
  106 + _debugEvents : function(s) {
  107 + var i, ld, inst, n, ev = ['CheckboxStateChange','DOMAttrModified','DOMMenuItemActive',
  108 + 'DOMMenuItemInactive','DOMMouseScroll','DOMNodeInserted','DOMNodeRemoved',
  109 + 'RadioStateChange','blur','broadcast','change','click','close','command',
  110 + 'commandupdate','contextmenu','dblclick','dragdrop','dragenter','dragexit',
  111 + 'draggesture','dragover','focus','input','keydown','keypress','keyup','load',
  112 + 'mousedown','mouseout','mouseover','mouseup','overflow','overflowchanged','popuphidden',
  113 + 'popuphiding','popupshowing','popupshown','select','syncfrompreference','synctopreference',
  114 + 'underflow','unload','abort','activate','afterprint','afterupdate','beforeactivate',
  115 + 'beforecopy','beforecut','beforedeactivate','beforeeditfocus','beforepaste','beforeprint',
  116 + 'beforeunload','beforeupdate','bounce','cellchange','controlselect','copy','cut',
  117 + 'dataavailable','datasetchanged','datasetcomplete','deactivate','dragend','dragleave',
  118 + 'dragstart','drop','error','errorupdate','filterchange','finish','focusin','focusout',
  119 + 'help','layoutcomplete','losecapture','mouseenter','mouseleave','mousewheel',
  120 + 'move','moveend','movestart','paste','propertychange','readystatechange','reset','resize',
  121 + 'resizeend','resizestart','rowenter','rowexit','rowsdelete','rowsinserted','scroll',
  122 + 'selectionchange','selectstart','start','stop','submit'];
  123 + // mousemove
  124 +
  125 + if (TinyMCE_DevKitPlugin._isDebugEvents == s)
  126 + return;
  127 +
  128 + TinyMCE_DevKitPlugin._isDebugEvents = s;
  129 +
  130 + for (n in tinyMCE.instances) {
  131 + inst = tinyMCE.instances[n];
  132 +
  133 + if (!tinyMCE.isInstance(inst) || inst.getDoc() == ld)
  134 + continue;
  135 +
  136 + ld = inst.getDoc();
  137 +
  138 + for (i=0; i<ev.length; i++) {
  139 + if (s)
  140 + tinyMCE.addEvent(ld, ev[i], TinyMCE_DevKitPlugin._debugEvent);
  141 + else
  142 + tinyMCE.removeEvent(ld, ev[i], TinyMCE_DevKitPlugin._debugEvent);
  143 + }
  144 + }
  145 + },
  146 +
  147 + _debugEvent : function(e) {
  148 + var t;
  149 +
  150 + e = e ? e : tinyMCE.selectedInstance.getWin().event;
  151 + t = e.srcElement ? e.srcElement : e.target;
  152 +
  153 + tinyMCE.debug(e.type, t ? t.nodeName : '');
  154 + },
  155 +
  156 + _serialize : function(o) {
  157 + var i, v, s = TinyMCE_DevKitPlugin._serialize;
  158 +
  159 + if (o == null)
  160 + return 'null';
  161 +
  162 + switch (typeof o) {
  163 + case 'string':
  164 + v = '\bb\tt\nn\ff\rr\""\'\'\\\\';
  165 +
  166 + return '"' + o.replace(new RegExp('([\u0080-\uFFFF\\x00-\\x1f\\"])', 'g'), function(a, b) {
  167 + i = v.indexOf(b);
  168 +
  169 + if (i+1)
  170 + return '\\' + v.charAt(i + 1);
  171 +
  172 + a = b.charCodeAt().toString(16);
  173 +
  174 + return '\\u' + '0000'.substring(a.length) + a;
  175 + }) + '"';
  176 +
  177 + case 'object':
  178 + if (o instanceof Array) {
  179 + for (i=0, v = '['; i<o.length; i++)
  180 + v += (i > 0 ? ',' : '') + s(o[i]);
  181 +
  182 + return v + ']';
  183 + }
  184 +
  185 + v = '{';
  186 +
  187 + for (i in o)
  188 + v += typeof o[i] != 'function' ? (v.length > 1 ? ',"' : '"') + i + '":' + s(o[i]) : '';
  189 +
  190 + return v + '}';
  191 + }
  192 +
  193 + return '' + o;
  194 + }
  195 +};
  196 +
  197 +// Patch and piggy back functions
  198 +tinyMCE.__debug = tinyMCE.debug;
  199 +tinyMCE.debug = function() {
  200 + var a, i, m = '', now = new Date().getTime(), start = TinyMCE_DevKitPlugin._startTime;
  201 +
  202 + if (!start)
  203 + TinyMCE_DevKitPlugin._startTime = start = now;
  204 +
  205 + a = this.debug.arguments;
  206 + for (i=0; i<a.length; i++) {
  207 + if (typeof(a[i]) == 'undefined')
  208 + continue;
  209 +
  210 + if (i > 0)
  211 + m += ', ';
  212 +
  213 + m += a[i];
  214 + }
  215 +
  216 + TinyMCE_DevKitPlugin._log('debug', m);
  217 +};
  218 +
  219 +tinyMCE.dump = function(o) {
  220 + tinyMCE.debug(TinyMCE_DevKitPlugin._serialize(o));
  221 +};
  222 +
  223 +tinyMCE.sleep = function(t) {
  224 + var s = new Date().getTime(), b;
  225 +
  226 + while (new Date().getTime() - s < t) b=1;
  227 +};
  228 +
  229 +tinyMCE.__execCommand = tinyMCE.execCommand;
  230 +tinyMCE.execCommand = function(command, user_interface, value) {
  231 + var r, st, dk = TinyMCE_DevKitPlugin;
  232 +
  233 + st = dk._start();
  234 + dk._log('execCommand', command, user_interface, value);
  235 + r = tinyMCE.__execCommand(command, user_interface, value);
  236 + dk._end(st);
  237 +
  238 + return r;
  239 +};
  240 +
  241 +tinyMCE.__execInstanceCommand = tinyMCE.execInstanceCommand;
  242 +tinyMCE.execInstanceCommand = function(editor_id, command, user_interface, value, focus) {
  243 + var r, st, dk = TinyMCE_DevKitPlugin;
  244 +
  245 + st = dk._start();
  246 + dk._log('execInstanceCommand', editor_id, command, user_interface, value);
  247 + r = tinyMCE.__execInstanceCommand(editor_id, command, user_interface, value);
  248 + dk._end(st);
  249 +
  250 + return r;
  251 +};
  252 +
  253 +TinyMCE_Engine.prototype.__handleEvent = TinyMCE_Engine.prototype.handleEvent;
  254 +TinyMCE_Engine.prototype.handleEvent = function(e) {
  255 + var r, st, dk = TinyMCE_DevKitPlugin;
  256 +
  257 + st = dk._start();
  258 + dk._log('handleEvent', e.type);
  259 + r = tinyMCE.__handleEvent(e);
  260 + dk._end(st);
  261 +
  262 + return r;
  263 +};
  264 +
  265 +tinyMCE.__importCSS = tinyMCE.importCSS;
  266 +tinyMCE.importCSS = function(doc, css) {
  267 + var r, st, dk = TinyMCE_DevKitPlugin;
  268 +
  269 + st = dk._start();
  270 + dk._log('importCSS', doc, css);
  271 + r = tinyMCE.__importCSS(doc, css);
  272 + dk._end(st);
  273 +
  274 + return r;
  275 +};
  276 +
  277 +tinyMCE.__triggerNodeChange = tinyMCE.triggerNodeChange;
  278 +tinyMCE.triggerNodeChange = function(focus, setup_content) {
  279 + var r, st, dk = TinyMCE_DevKitPlugin;
  280 +
  281 + st = dk._start();
  282 + dk._log('triggerNodeChange', focus, setup_content);
  283 + r = tinyMCE.__triggerNodeChange(focus, setup_content);
  284 + dk._end(st);
  285 +
  286 + return r;
  287 +};
  288 +
  289 +tinyMCE.__dispatchCallback = tinyMCE.dispatchCallback;
  290 +tinyMCE.dispatchCallback = function(i, p, n) {
  291 + var r, st, dk = TinyMCE_DevKitPlugin;
  292 +
  293 + st = dk._start();
  294 + dk._log('dispatchCallback', i, p, n);
  295 + r = tinyMCE.__dispatchCallback(i, p, n);
  296 + dk._end(st);
  297 +
  298 + return r;
  299 +};
  300 +
  301 +tinyMCE.__executeCallback = tinyMCE.executeCallback;
  302 +tinyMCE.executeCallback = function(i, p, n) {
  303 + var r, st, dk = TinyMCE_DevKitPlugin;
  304 +
  305 + st = dk._start();
  306 + dk._log('executeCallback', i, p, n);
  307 + r = tinyMCE.__executeCallback(i, p, n);
  308 + dk._end(st);
  309 +
  310 + return r;
  311 +};
  312 +
  313 +tinyMCE.__execCommandCallback = tinyMCE.execCommandCallback;
  314 +tinyMCE.execCommandCallback = function(i, p, n) {
  315 + var r, st, dk = TinyMCE_DevKitPlugin;
  316 +
  317 + st = dk._start();
  318 + dk._log('execCommandCallback', i, p, n);
  319 + r = tinyMCE.__execCommandCallback(i, p, n);
  320 + dk._end(st);
  321 +
  322 + return r;
  323 +};
  324 +
  325 +tinyMCE.addPlugin("devkit", TinyMCE_DevKitPlugin);
public/javascripts/tiny_mce/plugins/devkit/images/flip_down.gif 0 → 100755

179 Bytes

public/javascripts/tiny_mce/plugins/devkit/images/flip_up.gif 0 → 100755

193 Bytes

public/javascripts/tiny_mce/plugins/devkit/jscripts/devkit.js 0 → 100755
@@ -0,0 +1,331 @@ @@ -0,0 +1,331 @@
  1 +var devkit = parent.tinyMCE.plugins['devkit'], logEnabled = true, flip = false, book = null;
  2 +
  3 +function init() {
  4 + var log, i, f = document.forms[0];
  5 +
  6 + devkit._winLoaded = true;
  7 +
  8 + log = tinyMCE.log;
  9 +
  10 + for (i=0; i<log.length; i++)
  11 + debug(log[i]);
  12 +
  13 + f.logfilter.value = devkit._logFilter;
  14 +}
  15 +
  16 +function changeFilter(f) {
  17 + devkit._logFilter = f;
  18 +}
  19 +
  20 +function toggleLog(s) {
  21 + logEnabled = s;
  22 +}
  23 +
  24 +function toggleFlip() {
  25 + document.getElementById('flipbtn').src = flip ? 'images/flip_down.gif' : 'images/flip_up.gif';
  26 +
  27 + if (flip)
  28 + parent.document.getElementById('devkit').className = 'devkitup';
  29 + else
  30 + parent.document.getElementById('devkit').className = 'devkitdown';
  31 +
  32 + flip = !flip;
  33 +}
  34 +
  35 +function debug(s) {
  36 + var d, l, n;
  37 +
  38 + if (!logEnabled || !new RegExp(devkit._logFilter, 'gi').test(s))
  39 + return;
  40 +
  41 + d = document;
  42 + l = d.getElementById('log');
  43 + n = d.createElement('span');
  44 +
  45 + n.innerHTML = tinyMCE.xmlEncode(s);
  46 +
  47 + l.appendChild(n);
  48 + l.scrollTop = l.scrollHeight;
  49 +}
  50 +
  51 +function renderInfo() {
  52 + var se = document.getElementById('info'), n, sn, inst, h = '', sel, rng, instCount = 0, rc;
  53 +
  54 + h += '<h2>Browser info:</h2>';
  55 +
  56 + h += '<table border="0" cellpadding="0" cellspacing="0" class="data">';
  57 + h += addRenderInfo('navigator.userAgent', navigator.userAgent);
  58 + h += addRenderInfo('navigator.appName', navigator.appName);
  59 + h += addRenderInfo('navigator.platform', navigator.platform);
  60 + h += addRenderInfo('navigator.language', navigator.language, 'bspec');
  61 + h += addRenderInfo('navigator.browserLanguage', navigator.browserLanguage, 'bspec');
  62 + h += addRenderInfo('navigator.systemLanguage', navigator.systemLanguage, 'bspec');
  63 + h += addRenderInfo('navigator.userLanguage', navigator.userLanguage, 'bspec');
  64 + h += addRenderInfo('opera.buildNumber("inconspicuous")', typeof(opera) != 'undefined' && opera.buildNumber ? opera.buildNumber('inconspicuous') : null, 'bspec');
  65 + h += addRenderInfo('window.innerWidth', parent.window.innerWidth, 'bspec');
  66 + h += addRenderInfo('window.innerHeight', parent.window.innerHeight, 'bspec');
  67 + h += addRenderInfo('document.body.offsetWidth', parent.document.body.offsetWidth);
  68 + h += addRenderInfo('document.body.offsetHeight', parent.document.body.offsetHeight);
  69 + h += addRenderInfo('screen.width', screen.width);
  70 + h += addRenderInfo('screen.height', screen.height);
  71 + h += addRenderInfo('screen.availWidth', screen.availWidth);
  72 + h += addRenderInfo('screen.availHeight', screen.availHeight);
  73 + h += addRenderInfo('screen.colorDepth', screen.colorDepth);
  74 + h += addRenderInfo('screen.pixelDepth', screen.pixelDepth, 'bspec');
  75 + h += addRenderInfo('document.contentType', document.contentType, 'bspec');
  76 + h += '</table>';
  77 +
  78 + h += '<h2>TinyMCE_Engine info:</h2>';
  79 +
  80 + h += '<table border="0" cellpadding="0" cellspacing="0" class="data">';
  81 + h += addRenderInfo('baseURL', tinyMCE.baseURL);
  82 + h += addRenderInfo('selectedInstance.editorId', tinyMCE.selectedInstance ? tinyMCE.selectedInstance.editorId : null);
  83 + h += addRenderInfo('selectedElement.nodeName', tinyMCE.selectedElement ? tinyMCE.selectedElement.nodeName : null, 'dep');
  84 + h += addRenderInfo('loadedFiles',tinyMCE.loadedFiles.join(','));
  85 + h += addRenderInfo('isMSIE', tinyMCE.isMSIE);
  86 + h += addRenderInfo('isMSIE5', tinyMCE.isMSIE5);
  87 + h += addRenderInfo('isMSIE5_0', tinyMCE.isMSIE5_0);
  88 + h += addRenderInfo('isMSIE7', tinyMCE.isMSIE7);
  89 + h += addRenderInfo('isGecko', tinyMCE.isGecko);
  90 + h += addRenderInfo('isSafari', tinyMCE.isSafari);
  91 + h += addRenderInfo('isOpera', tinyMCE.isOpera);
  92 + h += addRenderInfo('isMac', tinyMCE.isMac);
  93 + h += addRenderInfo('isNS7', tinyMCE.isNS7);
  94 + h += addRenderInfo('isNS71', tinyMCE.isNS71);
  95 + h += addRenderInfo('idCounter', tinyMCE.idCounter);
  96 + h += addRenderInfo('currentConfig', tinyMCE.currentConfig);
  97 + h += addRenderInfo('majorVersion', tinyMCE.majorVersion);
  98 + h += addRenderInfo('minorVersion', tinyMCE.minorVersion);
  99 + h += addRenderInfo('releaseDate', tinyMCE.releaseDate);
  100 + h += addRenderInfo('documentBasePath', tinyMCE.documentBasePath);
  101 + h += addRenderInfo('documentURL', tinyMCE.documentURL);
  102 + h += '</table>';
  103 +
  104 + for (n in tinyMCE.instances) {
  105 + inst = tinyMCE.instances[n];
  106 +
  107 + if (!tinyMCE.isInstance(inst))
  108 + continue;
  109 +
  110 + sel = inst.selection.getSel();
  111 + rng = inst.selection.getRng();
  112 +
  113 + h += '<h2>TinyMCE_Control(' + (instCount++) + ') id: ' + inst.editorId + '</h2>';
  114 + h += '<table border="0" cellpadding="0" cellspacing="0" class="data">';
  115 +
  116 + h += addRenderInfo('editorId', inst.editorId);
  117 + h += addRenderInfo('visualAid', inst.visualAid);
  118 + h += addRenderInfo('foreColor', inst.foreColor);
  119 + h += addRenderInfo('backColor', inst.backColor);
  120 + h += addRenderInfo('formTargetElementId', inst.formTargetElementId);
  121 + h += addRenderInfo('formElement', inst.formElement ? inst.formElement.nodeName : null);
  122 + h += addRenderInfo('oldTargetElement', inst.oldTargetElement ? inst.oldTargetElement.nodeName : null);
  123 + h += addRenderInfo('linkElement', inst.linkElement ? inst.linkElement.nodeName : null, 'dep');
  124 + h += addRenderInfo('imgElement', inst.imgElement ? inst.imgElement.nodeName : null, 'dep');
  125 + h += addRenderInfo('selectedNode', inst.selectedNode ? inst.selectedNode.nodeName : null, 'dep');
  126 + h += addRenderInfo('targetElement', inst.targetElement ? inst.targetElement.nodeName : null);
  127 + h += addRenderInfo('getBody().nodeName', inst.getBody() ? inst.getBody().nodeName : null);
  128 + h += addRenderInfo('getBody().getAttribute("id")', inst.getBody() ? inst.getBody().getAttribute("id") : null);
  129 + h += addRenderInfo('getDoc().location', inst.getDoc() ? inst.getDoc().location : null);
  130 + h += addRenderInfo('startContent', inst.startContent);
  131 + h += addRenderInfo('isHidden()', inst.isHidden());
  132 + h += addRenderInfo('isDirty()', inst.isDirty());
  133 + h += addRenderInfo('undoRedo.undoLevels.length', inst.undoRedo.undoLevels.length);
  134 + h += addRenderInfo('undoRedo.undoIndex', inst.undoRedo.undoIndex);
  135 + h += addRenderInfo('selection.getSelectedHTML()', inst.selection.getSelectedHTML());
  136 + h += addRenderInfo('selection.isCollapsed()', inst.selection.isCollapsed() || 'false');
  137 + h += addRenderInfo('selection.getSelectedText()', inst.selection.getSelectedText());
  138 + h += addRenderInfo('selection.getFocusElement().nodeName', inst.selection.getFocusElement().nodeName);
  139 + h += addRenderInfo('selection.getFocusElement().outerHTML', tinyMCE.getOuterHTML(inst.selection.getFocusElement()));
  140 +
  141 + if ((tinyMCE.isGecko || tinyMCE.isOpera) && sel && rng) {
  142 + h += addRenderInfo('selection.getSel().anchorNode.nodeName', sel.anchorNode ? sel.anchorNode.nodeName : null, 'bspec');
  143 + h += addRenderInfo('selection.getSel().anchorOffset', sel.anchorOffset, 'bspec');
  144 + h += addRenderInfo('selection.getSel().focusNode.nodeName', sel.focusNode ? sel.focusNode.nodeName : null, 'bspec');
  145 + h += addRenderInfo('selection.getSel().focusOffset', sel.focusOffset, 'bspec');
  146 + h += addRenderInfo('selection.getRng().startContainer.nodeName', rng.startContainer ? rng.startContainer.nodeName : null, 'bspec');
  147 + h += addRenderInfo('selection.getRng().startOffset', rng.startOffset, 'bspec');
  148 + h += addRenderInfo('selection.getRng().endContainer.nodeName', rng.endContainer ? rng.endContainer.nodeName : null, 'bspec');
  149 + h += addRenderInfo('selection.getRng().endOffset', rng.endOffset, 'bspec');
  150 + }
  151 +
  152 + if (typeof(rng.item) != 'undefined' || typeof(rng.htmlText) != 'undefined') {
  153 + if (!rng.item) {
  154 + h += addRenderInfo('selection.getSel().type', sel.type, 'bspec');
  155 + h += addRenderInfo('selection.getRng().htmlText', rng.htmlText, 'bspec');
  156 + h += addRenderInfo('selection.getRng().text', rng.text, 'bspec');
  157 + } else
  158 + h += addRenderInfo('selection.getRng().item(0).nodeName', rng.item(0).nodeName, 'bspec');
  159 + }
  160 +
  161 + h += '</table>';
  162 + }
  163 +
  164 + h += '<p>Fields marked in <strong class="bspec">gray</strong> is not cross browser and should be used with care.</p>';
  165 + h += '<p>Fields marked <strong class="dep">red</strong> are marked deprecated and will be removed in the future.</p><br />';
  166 +
  167 + se.innerHTML = h;
  168 +}
  169 +
  170 +function addRenderInfo(n, v, c) {
  171 + return '<tr><td' + (c ? ' class="' + c + '"' : '')+ '>' + n + '</td><td><input type="text" value="' + tinyMCE.xmlEncode(v != null ? ('' + v).replace(/[\r\n]/g, '') : 'null') + '" /></td></tr>';
  172 +}
  173 +
  174 +function renderSettings() {
  175 + var se = document.getElementById('settings'), n, sn, inst, h = '', v;
  176 +
  177 + for (n in tinyMCE.instances) {
  178 + inst = tinyMCE.instances[n];
  179 +
  180 + if (!tinyMCE.isInstance(inst))
  181 + continue;
  182 +
  183 + h += '<h2>Instance id: ' + inst.editorId + '</h2>';
  184 + h += '<table border="0" cellpadding="0" cellspacing="0" class="data">';
  185 +
  186 + for (sn in inst.settings) {
  187 + v = inst.settings[sn];
  188 +
  189 + h += '<tr><td class="col1">' + tinyMCE.xmlEncode(sn) + '</td><td><input type="text" value="' + tinyMCE.xmlEncode(v) + '" /></td></tr>';
  190 + }
  191 +
  192 + h += '</table>';
  193 + }
  194 +
  195 + se.innerHTML = h;
  196 +}
  197 +
  198 +function renderContent() {
  199 + var se = document.getElementById('content'), n, inst, h = '';
  200 +
  201 + for (n in tinyMCE.instances) {
  202 + inst = tinyMCE.instances[n];
  203 +
  204 + if (!tinyMCE.isInstance(inst))
  205 + continue;
  206 +
  207 + h += '<h2>Instance id: ' + inst.editorId + '</h2>';
  208 +
  209 + h += '<h3>Start content - inst.startContent:</h3>';
  210 + h += '<div>' + tinyMCE.xmlEncode(inst.startContent) + '</div>';
  211 +
  212 + h += '<h3>Raw content - inst.getBody().innerHTML or inst.getHTML(true):</h3>';
  213 + h += '<div>' + tinyMCE.xmlEncode(inst.getHTML(true)) + '</div>';
  214 +
  215 + h += '<h3>Cleaned content - inst.getHTML():</h3>';
  216 + h += '<div>' + tinyMCE.xmlEncode(inst.getHTML()) + '</div>';
  217 +
  218 + if (inst.serializedHTML) {
  219 + h += '<h3>Serialized HTML content - inst.serializedHTML:</h3>';
  220 + h += '<div>' + tinyMCE.xmlEncode(inst.serializedHTML) + '</div>';
  221 + }
  222 + }
  223 +
  224 + se.innerHTML = h;
  225 +}
  226 +
  227 +function renderCommandStates() {
  228 + var se = document.getElementById('command_states'), n, inst, h = '', v, ex;
  229 + var cmds = new Array('2D-Position','AbsolutePosition','BackColor','BlockDirLTR','BlockDirRTL','Bold','BrowseMode','Copy','CreateBookmark','CreateLink','Cut','Delete','DirLTR','DirRTL','EditMode','enableInlineTableEditing','enableObjectResizing','FontName','FontSize','ForeColor','FormatBlock','Indent','InsertButton','InsertFieldset','InsertHorizontalRule','InsertIFrame','InsertImage','InsertInputButton','InsertInputCheckbox','InsertInputFileUpload','InsertInputHidden','InsertInputImage','InsertInputPassword','InsertInputRadio','InsertInputReset','InsertInputSubmit','InsertInputText','InsertMarquee','InsertOrderedList','InsertParagraph','InsertSelectDropdown','InsertSelectListbox','InsertTextArea','InsertUnorderedList','Italic','JustifyCenter','JustifyFull','JustifyLeft','JustifyNone','JustifyRight','LiveResize','MultipleSelection','Open','Outdent','OverWrite','Paste','PlayImage','Redo','Refresh','RemoveFormat','SaveAs','SelectAll','SizeToControl','SizeToControlHeight','SizeToControlWidth','Stop','StopImage','StrikeThrough','styleWithCSS','Subscript','Superscript','UnBookmark','Underline','Undo','Unlink','Unselect'), i;
  230 +
  231 + for (n in tinyMCE.instances) {
  232 + inst = tinyMCE.instances[n];
  233 +
  234 + if (!tinyMCE.isInstance(inst))
  235 + continue;
  236 +
  237 + h += '<h2>Instance id: ' + inst.editorId + '</h2>';
  238 + h += '<table border="0" cellpadding="0" cellspacing="0" class="data">';
  239 +
  240 + for (i=0; i<cmds.length; i++) {
  241 + v = null;
  242 +
  243 + try {
  244 + v = tinyMCE.isGecko || inst.getDoc().queryCommandSupported(cmds[i]);
  245 + v = v ? inst.queryCommandState(cmds[i]) : 'Not supported';
  246 + } catch (ex) {
  247 + v = 'Not supported';
  248 + }
  249 +
  250 + h += '<tr><td><input type="text" value="' + tinyMCE.xmlEncode(cmds[i]) + '" /></td><td><input type="text" value="' + tinyMCE.xmlEncode(v) + '" /></td></tr>';
  251 + }
  252 +
  253 + h += '</table>';
  254 + }
  255 +
  256 + se.innerHTML = h;
  257 +}
  258 +
  259 +function renderUndoRedo() {
  260 + var se = document.getElementById('undo_redo'), inst, n, h = '', i, le, id, d, ur;
  261 + var f = document.forms[0];
  262 +
  263 + if (tinyMCE.undoLevels) {
  264 + le = tinyMCE.undoLevels;
  265 +
  266 + h += '<h2>Global undo/redo</h2>';
  267 + h += '<table border="0" cellpadding="0" cellspacing="0" width="50%" class="data">';
  268 + h += '<tr><td>undoLevels.length</td><td>' + le.length + '</td></tr>';
  269 + h += '<tr><td>undoIndex</td><td>' + tinyMCE.undoIndex + '</td></tr>';
  270 + h += '</table>';
  271 +
  272 + for (i=0; i<le.length; i++)
  273 + h += '<h3>Level: ' + i + ', Instance: ' + (le[i] ? le[i].editorId : 'null') + '</h3>';
  274 + }
  275 +
  276 + for (n in tinyMCE.instances) {
  277 + inst = tinyMCE.instances[n];
  278 +
  279 + if (!tinyMCE.isInstance(inst))
  280 + continue;
  281 +
  282 + ur = inst.undoRedo;
  283 + le = ur.undoLevels;
  284 +
  285 + h += '<hr /><h2>Instance id: ' + inst.editorId + '</h2>';
  286 + h += '<table border="0" cellpadding="0" cellspacing="0" width="50%" class="data">';
  287 + h += '<tr><td>undoLevels.length</td><td>' + le.length + '</td></tr>';
  288 + h += '<tr><td>undoIndex</td><td>' + ur.undoIndex + '</td></tr>';
  289 + h += '<tr><td>typingUndoIndex</td><td>' + ur.typingUndoIndex + '</td></tr>';
  290 + h += '<tr><td>undoRedo</td><td>' + ur.undoRedo + '</td></tr>';
  291 + h += '</table>';
  292 +
  293 + for (i=0; i<le.length; i++) {
  294 + h += '<h3>Level: ' + i + (!le[i].bookmark ? "" : " [bookmark]") + '</h3>';
  295 + h += '<div class="undodata">' + tinyMCE.xmlEncode(le[i].content) + '</div>';
  296 +
  297 + if (i > 0 && f.undo_diff.checked) {
  298 + d = diff_main(i > 0 ? le[i-1].content.replace(/[\r\n]+/g, '') : null, le[i].content.replace(/[\r\n]+/g, ''), false);
  299 + diff_cleanup_semantic(d);
  300 + h += '<h3>Diff ' + (i-1) + ',' + i + '</h3><div class="undodata">' + diff_prettyhtml(d) + '</div>';
  301 + }
  302 + }
  303 + }
  304 +
  305 + se.innerHTML = h;
  306 +}
  307 +
  308 +function clearLog() {
  309 + document.getElementById('log').innerHTML = '';
  310 + devkit._startTime = null;
  311 +}
  312 +
  313 +function cancelAction() {
  314 + parent.document.getElementById('devkit').style.display = 'none';
  315 +}
  316 +
  317 +function toggleDebugEvents(s) {
  318 + devkit._debugEvents(s);
  319 +}
  320 +
  321 +function storeSelection() {
  322 + book = tinyMCE.selectedInstance.selection.getBookmark();
  323 +
  324 + return false;
  325 +}
  326 +
  327 +function restoreSelection() {
  328 + tinyMCE.selectedInstance.selection.moveToBookmark(book);
  329 +
  330 + return false;
  331 +}
0 \ No newline at end of file 332 \ No newline at end of file
public/javascripts/tiny_mce/plugins/devkit/jscripts/diff.js 0 → 100755
@@ -0,0 +1,1192 @@ @@ -0,0 +1,1192 @@
  1 +// Diff_Match_Patch v1.3
  2 +// Computes the difference between two texts to create a patch.
  3 +// Applies the patch onto another text, allowing for errors.
  4 +// Copyright (C) 2006 Neil Fraser
  5 +// http://neil.fraser.name/software/diff_match_patch/
  6 +
  7 +// This program is free software; you can redistribute it and/or
  8 +// modify it under the terms of the GNU General Public License
  9 +// as published by the Free Software Foundation.
  10 +
  11 +// This program is distributed in the hope that it will be useful,
  12 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 +// GNU General Public License (www.gnu.org) for more details.
  15 +
  16 +
  17 +// Constants.
  18 +// Redefine these in your program to override the defaults.
  19 +
  20 +// Number of seconds to map a diff before giving up. (0 for infinity)
  21 +var DIFF_TIMEOUT = 1.0;
  22 +// Cost of an empty edit operation in terms of edit characters.
  23 +var DIFF_EDIT_COST = 4;
  24 +// Tweak the relative importance (0.0 = accuracy, 1.0 = proximity)
  25 +var MATCH_BALANCE = 0.5;
  26 +// At what point is no match declared (0.0 = perfection, 1.0 = very loose)
  27 +var MATCH_THRESHOLD = 0.5;
  28 +// The min and max cutoffs used when computing text lengths.
  29 +var MATCH_MINLENGTH = 100;
  30 +var MATCH_MAXLENGTH = 1000;
  31 +// Chunk size for context length.
  32 +var PATCH_MARGIN = 4;
  33 +
  34 +
  35 + //////////////////////////////////////////////////////////////////////
  36 + // Diff //
  37 +//////////////////////////////////////////////////////////////////////
  38 +
  39 +// The data structure representing a diff is an array of tuples:
  40 +// [[-1, "Hello"], [1, "Goodbye"], [0, " world."]]
  41 +// which means: delete "Hello", add "Goodbye" and keep " world."
  42 +
  43 +
  44 +function diff_main(text1, text2, checklines) {
  45 + // Find the differences between two texts. Return an array of changes.
  46 + // If checklines is present and false, then don't run a line-level diff first to identify the changed areas.
  47 + // Check for equality (speedup)
  48 + if (text1 == text2)
  49 + return [[0, text1]];
  50 +
  51 + if (typeof checklines == 'undefined')
  52 + checklines = true;
  53 +
  54 + var a;
  55 + // Trim off common prefix (speedup)
  56 + a = diff_prefix(text1, text2);
  57 + text1 = a[0];
  58 + text2 = a[1];
  59 + var commonprefix = a[2];
  60 +
  61 + // Trim off common suffix (speedup)
  62 + a = diff_suffix(text1, text2);
  63 + text1 = a[0];
  64 + text2 = a[1];
  65 + var commonsuffix = a[2];
  66 +
  67 + var diff, i;
  68 + var longtext = text1.length > text2.length ? text1 : text2;
  69 + var shorttext = text1.length > text2.length ? text2 : text1;
  70 +
  71 + if (!text1) { // Just add some text (speedup)
  72 + diff = [[1, text2]];
  73 + } else if (!text2) { // Just delete some text (speedup)
  74 + diff = [[-1, text1]];
  75 + } else if ((i = longtext.indexOf(shorttext)) != -1) {
  76 + // Shorter text is inside the longer text (speedup)
  77 + diff = [[1, longtext.substring(0, i)], [0, shorttext], [1, longtext.substring(i+shorttext.length)]];
  78 + // Swap insertions for deletions if diff is reversed.
  79 + if (text1.length > text2.length)
  80 + diff[0][0] = diff[2][0] = -1;
  81 + } else {
  82 + longtext = shorttext = null; // Garbage collect
  83 + // Check to see if the problem can be split in two.
  84 + var hm = diff_halfmatch(text1, text2);
  85 + if (hm) {
  86 + // A half-match was found, sort out the return data.
  87 + var text1_a = hm[0];
  88 + var text1_b = hm[1];
  89 + var text2_a = hm[2];
  90 + var text2_b = hm[3];
  91 + var mid_common = hm[4];
  92 + // Send both pairs off for separate processing.
  93 + var diff_a = diff_main(text1_a, text2_a, checklines);
  94 + var diff_b = diff_main(text1_b, text2_b, checklines);
  95 + // Merge the results.
  96 + diff = diff_a.concat([[0, mid_common]], diff_b);
  97 + } else {
  98 + // Perform a real diff.
  99 + if (checklines && text1.length + text2.length < 250)
  100 + checklines = false; // Too trivial for the overhead.
  101 + if (checklines) {
  102 + // Scan the text on a line-by-line basis first.
  103 + a = diff_lines2chars(text1, text2);
  104 + text1 = a[0];
  105 + text2 = a[1];
  106 + var linearray = a[2];
  107 + }
  108 + diff = diff_map(text1, text2);
  109 + if (!diff) // No acceptable result.
  110 + diff = [[-1, text1], [1, text2]];
  111 + if (checklines) {
  112 + diff_chars2lines(diff, linearray); // Convert the diff back to original text.
  113 + diff_cleanup_semantic(diff); // Eliminate freak matches (e.g. blank lines)
  114 +
  115 + // Rediff any replacement blocks, this time on character-by-character basis.
  116 + diff.push([0, '']); // Add a dummy entry at the end.
  117 + var pointer = 0;
  118 + var count_delete = 0;
  119 + var count_insert = 0;
  120 + var text_delete = '';
  121 + var text_insert = '';
  122 + while(pointer < diff.length) {
  123 + if (diff[pointer][0] == 1) {
  124 + count_insert++;
  125 + text_insert += diff[pointer][1];
  126 + } else if (diff[pointer][0] == -1) {
  127 + count_delete++;
  128 + text_delete += diff[pointer][1];
  129 + } else { // Upon reaching an equality, check for prior redundancies.
  130 + if (count_delete >= 1 && count_insert >= 1) {
  131 + // Delete the offending records and add the merged ones.
  132 + a = diff_main(text_delete, text_insert, false);
  133 + diff.splice(pointer - count_delete - count_insert, count_delete + count_insert);
  134 + pointer = pointer - count_delete - count_insert;
  135 + for (i=a.length-1; i>=0; i--)
  136 + diff.splice(pointer, 0, a[i]);
  137 + pointer = pointer + a.length;
  138 + }
  139 + count_insert = 0;
  140 + count_delete = 0;
  141 + text_delete = '';
  142 + text_insert = '';
  143 + }
  144 + pointer++;
  145 + }
  146 + diff.pop(); // Remove the dummy entry at the end.
  147 +
  148 + }
  149 + }
  150 + }
  151 +
  152 + if (commonprefix)
  153 + diff.unshift([0, commonprefix]);
  154 + if (commonsuffix)
  155 + diff.push([0, commonsuffix]);
  156 + diff_cleanup_merge(diff);
  157 + return diff;
  158 +}
  159 +
  160 +
  161 +function diff_lines2chars(text1, text2) {
  162 + // Split text into an array of strings.
  163 + // Reduce the texts to a string of hashes where each character represents one line.
  164 + var linearray = new Array(); // linearray[4] == "Hello\n"
  165 + var linehash = new Object(); // linehash["Hello\n"] == 4
  166 +
  167 + // "\x00" is a valid JavaScript character, but the Venkman debugger doesn't like it (bug 335098)
  168 + // So we'll insert a junk entry to avoid generating a null character.
  169 + linearray.push('');
  170 +
  171 + function diff_lines2chars_munge(text) {
  172 + // My first ever closure!
  173 + var i, line;
  174 + var chars = '';
  175 + while (text) {
  176 + i = text.indexOf('\n');
  177 + if (i == -1)
  178 + i = text.length;
  179 + line = text.substring(0, i+1);
  180 + text = text.substring(i+1);
  181 + if (linehash.hasOwnProperty ? linehash.hasOwnProperty(line) : (linehash[line] !== undefined)) {
  182 + chars += String.fromCharCode(linehash[line]);
  183 + } else {
  184 + linearray.push(line);
  185 + linehash[line] = linearray.length - 1;
  186 + chars += String.fromCharCode(linearray.length - 1);
  187 + }
  188 + }
  189 + return chars;
  190 + }
  191 +
  192 + var chars1 = diff_lines2chars_munge(text1);
  193 + var chars2 = diff_lines2chars_munge(text2);
  194 + return [chars1, chars2, linearray];
  195 +}
  196 +
  197 +
  198 +function diff_chars2lines(diff, linearray) {
  199 + // Rehydrate the text in a diff from a string of line hashes to real lines of text.
  200 + var chars, text;
  201 + for (var x=0; x<diff.length; x++) {
  202 + chars = diff[x][1];
  203 + text = '';
  204 + for (var y=0; y<chars.length; y++)
  205 + text += linearray[chars.charCodeAt(y)];
  206 + diff[x][1] = text;
  207 + }
  208 +}
  209 +
  210 +
  211 +function diff_map(text1, text2) {
  212 + // Explore the intersection points between the two texts.
  213 + var now = new Date();
  214 + var ms_end = now.getTime() + DIFF_TIMEOUT * 1000; // Don't run for too long.
  215 + var max = (text1.length + text2.length) / 2;
  216 + var v_map1 = new Array();
  217 + var v_map2 = new Array();
  218 + var v1 = new Object();
  219 + var v2 = new Object();
  220 + v1[1] = 0;
  221 + v2[1] = 0;
  222 + var x, y;
  223 + var footstep; // Used to track overlapping paths.
  224 + var footsteps = new Object();
  225 + var done = false;
  226 + var hasOwnProperty = !!(footsteps.hasOwnProperty);
  227 + // If the total number of characters is odd, then the front path will collide with the reverse path.
  228 + var front = (text1.length + text2.length) % 2;
  229 + for (var d=0; d<max; d++) {
  230 + now = new Date();
  231 + if (DIFF_TIMEOUT > 0 && now.getTime() > ms_end) // Timeout reached
  232 + return null;
  233 +
  234 + // Walk the front path one step.
  235 + v_map1[d] = new Object();
  236 + for (var k=-d; k<=d; k+=2) {
  237 + if (k == -d || k != d && v1[k-1] < v1[k+1])
  238 + x = v1[k+1];
  239 + else
  240 + x = v1[k-1]+1;
  241 + y = x - k;
  242 + footstep = x+","+y;
  243 + if (front && (hasOwnProperty ? footsteps.hasOwnProperty(footstep) : (footsteps[footstep] !== undefined)))
  244 + done = true;
  245 + if (!front)
  246 + footsteps[footstep] = d;
  247 + while (!done && x < text1.length && y < text2.length && text1.charAt(x) == text2.charAt(y)) {
  248 + x++; y++;
  249 + footstep = x+","+y;
  250 + if (front && (hasOwnProperty ? footsteps.hasOwnProperty(footstep) : (footsteps[footstep] !== undefined)))
  251 + done = true;
  252 + if (!front)
  253 + footsteps[footstep] = d;
  254 + }
  255 + v1[k] = x;
  256 + v_map1[d][x+","+y] = true;
  257 + if (done) {
  258 + // Front path ran over reverse path.
  259 + v_map2 = v_map2.slice(0, footsteps[footstep]+1);
  260 + var a = diff_path1(v_map1, text1.substring(0, x), text2.substring(0, y));
  261 + return a.concat(diff_path2(v_map2, text1.substring(x), text2.substring(y)));
  262 + }
  263 + }
  264 +
  265 + // Walk the reverse path one step.
  266 + v_map2[d] = new Object();
  267 + for (var k=-d; k<=d; k+=2) {
  268 + if (k == -d || k != d && v2[k-1] < v2[k+1])
  269 + x = v2[k+1];
  270 + else
  271 + x = v2[k-1]+1;
  272 + y = x - k;
  273 + footstep = (text1.length-x)+","+(text2.length-y);
  274 + if (!front && (hasOwnProperty ? footsteps.hasOwnProperty(footstep) : (footsteps[footstep] !== undefined)))
  275 + done = true;
  276 + if (front)
  277 + footsteps[footstep] = d;
  278 + while (!done && x < text1.length && y < text2.length && text1.charAt(text1.length-x-1) == text2.charAt(text2.length-y-1)) {
  279 + x++; y++;
  280 + footstep = (text1.length-x)+","+(text2.length-y);
  281 + if (!front && (hasOwnProperty ? footsteps.hasOwnProperty(footstep) : (footsteps[footstep] !== undefined)))
  282 + done = true;
  283 + if (front)
  284 + footsteps[footstep] = d;
  285 + }
  286 + v2[k] = x;
  287 + v_map2[d][x+","+y] = true;
  288 + if (done) {
  289 + // Reverse path ran over front path.
  290 + v_map1 = v_map1.slice(0, footsteps[footstep]+1);
  291 + var a = diff_path1(v_map1, text1.substring(0, text1.length-x), text2.substring(0, text2.length-y));
  292 + return a.concat(diff_path2(v_map2, text1.substring(text1.length-x), text2.substring(text2.length-y)));
  293 + }
  294 + }
  295 + }
  296 + // Number of diffs equals number of characters, no commonality at all.
  297 + return null;
  298 +}
  299 +
  300 +
  301 +function diff_path1(v_map, text1, text2) {
  302 + // Work from the middle back to the start to determine the path.
  303 + var path = [];
  304 + var x = text1.length;
  305 + var y = text2.length;
  306 + var last_op = null;
  307 + for (var d=v_map.length-2; d>=0; d--) {
  308 + while(1) {
  309 + if (v_map[d].hasOwnProperty ? v_map[d].hasOwnProperty((x-1)+","+y) : (v_map[d][(x-1)+","+y] !== undefined)) {
  310 + x--;
  311 + if (last_op === -1)
  312 + path[0][1] = text1.charAt(x) + path[0][1];
  313 + else
  314 + path.unshift([-1, text1.charAt(x)]);
  315 + last_op = -1;
  316 + break;
  317 + } else if (v_map[d].hasOwnProperty ? v_map[d].hasOwnProperty(x+","+(y-1)) : (v_map[d][x+","+(y-1)] !== undefined)) {
  318 + y--;
  319 + if (last_op === 1)
  320 + path[0][1] = text2.charAt(y) + path[0][1];
  321 + else
  322 + path.unshift([1, text2.charAt(y)]);
  323 + last_op = 1;
  324 + break;
  325 + } else {
  326 + x--;
  327 + y--;
  328 + //if (text1.charAt(x) != text2.charAt(y))
  329 + // return alert("No diagonal. Can't happen. (diff_path1)");
  330 + if (last_op === 0)
  331 + path[0][1] = text1.charAt(x) + path[0][1];
  332 + else
  333 + path.unshift([0, text1.charAt(x)]);
  334 + last_op = 0;
  335 + }
  336 + }
  337 + }
  338 + return path;
  339 +}
  340 +
  341 +
  342 +function diff_path2(v_map, text1, text2) {
  343 + // Work from the middle back to the end to determine the path.
  344 + var path = [];
  345 + var x = text1.length;
  346 + var y = text2.length;
  347 + var last_op = null;
  348 + for (var d=v_map.length-2; d>=0; d--) {
  349 + while(1) {
  350 + if (v_map[d].hasOwnProperty ? v_map[d].hasOwnProperty((x-1)+","+y) : (v_map[d][(x-1)+","+y] !== undefined)) {
  351 + x--;
  352 + if (last_op === -1)
  353 + path[path.length-1][1] += text1.charAt(text1.length-x-1);
  354 + else
  355 + path.push([-1, text1.charAt(text1.length-x-1)]);
  356 + last_op = -1;
  357 + break;
  358 + } else if (v_map[d].hasOwnProperty ? v_map[d].hasOwnProperty(x+","+(y-1)) : (v_map[d][x+","+(y-1)] !== undefined)) {
  359 + y--;
  360 + if (last_op === 1)
  361 + path[path.length-1][1] += text2.charAt(text2.length-y-1);
  362 + else
  363 + path.push([1, text2.charAt(text2.length-y-1)]);
  364 + last_op = 1;
  365 + break;
  366 + } else {
  367 + x--;
  368 + y--;
  369 + //if (text1.charAt(text1.length-x-1) != text2.charAt(text2.length-y-1))
  370 + // return alert("No diagonal. Can't happen. (diff_path2)");
  371 + if (last_op === 0)
  372 + path[path.length-1][1] += text1.charAt(text1.length-x-1);
  373 + else
  374 + path.push([0, text1.charAt(text1.length-x-1)]);
  375 + last_op = 0;
  376 + }
  377 + }
  378 + }
  379 + return path;
  380 +}
  381 +
  382 +
  383 +function diff_prefix(text1, text2) {
  384 + // Trim off common prefix
  385 + var pointermin = 0;
  386 + var pointermax = Math.min(text1.length, text2.length);
  387 + var pointermid = pointermax;
  388 + while(pointermin < pointermid) {
  389 + if (text1.substring(0, pointermid) == text2.substring(0, pointermid))
  390 + pointermin = pointermid;
  391 + else
  392 + pointermax = pointermid;
  393 + pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
  394 + }
  395 + var commonprefix = text1.substring(0, pointermid);
  396 + text1 = text1.substring(pointermid);
  397 + text2 = text2.substring(pointermid);
  398 + return [text1, text2, commonprefix];
  399 +}
  400 +
  401 +
  402 +function diff_suffix(text1, text2) {
  403 + // Trim off common suffix
  404 + var pointermin = 0;
  405 + var pointermax = Math.min(text1.length, text2.length);
  406 + var pointermid = pointermax;
  407 + while(pointermin < pointermid) {
  408 + if (text1.substring(text1.length-pointermid) == text2.substring(text2.length-pointermid))
  409 + pointermin = pointermid;
  410 + else
  411 + pointermax = pointermid;
  412 + pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
  413 + }
  414 + var commonsuffix = text1.substring(text1.length-pointermid);
  415 + text1 = text1.substring(0, text1.length-pointermid);
  416 + text2 = text2.substring(0, text2.length-pointermid);
  417 + return [text1, text2, commonsuffix];
  418 +}
  419 +
  420 +
  421 +function diff_halfmatch(text1, text2) {
  422 + // Do the two texts share a substring which is at least half the length of the longer text?
  423 + var longtext = text1.length > text2.length ? text1 : text2;
  424 + var shorttext = text1.length > text2.length ? text2 : text1;
  425 + if (longtext.length < 10 || shorttext.length < 1)
  426 + return null; // Pointless.
  427 +
  428 + function diff_halfmatch_i(longtext, shorttext, i) {
  429 + // Start with a 1/4 length substring at position i as a seed.
  430 + var seed = longtext.substring(i, i+Math.floor(longtext.length/4));
  431 + var j = -1;
  432 + var best_common = '';
  433 + var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
  434 + while ((j = shorttext.indexOf(seed, j+1)) != -1) {
  435 + var my_prefix = diff_prefix(longtext.substring(i), shorttext.substring(j));
  436 + var my_suffix = diff_suffix(longtext.substring(0, i), shorttext.substring(0, j));
  437 + if (best_common.length < (my_suffix[2] + my_prefix[2]).length) {
  438 + best_common = my_suffix[2] + my_prefix[2];
  439 + best_longtext_a = my_suffix[0];
  440 + best_longtext_b = my_prefix[0];
  441 + best_shorttext_a = my_suffix[1];
  442 + best_shorttext_b = my_prefix[1];
  443 + }
  444 + }
  445 + if (best_common.length >= longtext.length/2)
  446 + return [best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b, best_common];
  447 + else
  448 + return null;
  449 + }
  450 +
  451 + // First check if the second quarter is the seed for a half-match.
  452 + var hm1 = diff_halfmatch_i(longtext, shorttext, Math.ceil(longtext.length/4));
  453 + // Check again based on the third quarter.
  454 + var hm2 = diff_halfmatch_i(longtext, shorttext, Math.ceil(longtext.length/2));
  455 + var hm;
  456 + if (!hm1 && !hm2)
  457 + return null;
  458 + else if (!hm2)
  459 + hm = hm1;
  460 + else if (!hm1)
  461 + hm = hm2;
  462 + else // Both matched. Select the longest.
  463 + hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
  464 +
  465 + // A half-match was found, sort out the return data.
  466 + if (text1.length > text2.length) {
  467 + var text1_a = hm[0];
  468 + var text1_b = hm[1];
  469 + var text2_a = hm[2];
  470 + var text2_b = hm[3];
  471 + } else {
  472 + var text2_a = hm[0];
  473 + var text2_b = hm[1];
  474 + var text1_a = hm[2];
  475 + var text1_b = hm[3];
  476 + }
  477 + var mid_common = hm[4];
  478 + return [text1_a, text1_b, text2_a, text2_b, mid_common];
  479 +}
  480 +
  481 +
  482 +function diff_cleanup_semantic(diff) {
  483 + // Reduce the number of edits by eliminating semantically trivial equalities.
  484 + var changes = false;
  485 + var equalities = []; // Stack of indices where equalities are found.
  486 + var lastequality = null; // Always equal to equalities[equalities.length-1][1]
  487 + var pointer = 0; // Index of current position.
  488 + var length_changes1 = 0; // Number of characters that changed prior to the equality.
  489 + var length_changes2 = 0; // Number of characters that changed after the equality.
  490 + while (pointer < diff.length) {
  491 + if (diff[pointer][0] == 0) { // equality found
  492 + equalities.push(pointer);
  493 + length_changes1 = length_changes2;
  494 + length_changes2 = 0;
  495 + lastequality = diff[pointer][1];
  496 + } else { // an insertion or deletion
  497 + length_changes2 += diff[pointer][1].length;
  498 + if (lastequality != null && (lastequality.length <= length_changes1) && (lastequality.length <= length_changes2)) {
  499 + //alert("Splitting: '"+lastequality+"'");
  500 + diff.splice(equalities[equalities.length-1], 0, [-1, lastequality]); // Duplicate record
  501 + diff[equalities[equalities.length-1]+1][0] = 1; // Change second copy to insert.
  502 + equalities.pop(); // Throw away the equality we just deleted;
  503 + equalities.pop(); // Throw away the previous equality;
  504 + pointer = equalities.length ? equalities[equalities.length-1] : -1;
  505 + length_changes1 = 0; // Reset the counters.
  506 + length_changes2 = 0;
  507 + lastequality = null;
  508 + changes = true;
  509 + }
  510 + }
  511 + pointer++;
  512 + }
  513 +
  514 + if (changes)
  515 + diff_cleanup_merge(diff);
  516 +}
  517 +
  518 +
  519 +function diff_cleanup_efficiency(diff) {
  520 + // Reduce the number of edits by eliminating operationally trivial equalities.
  521 + var changes = false;
  522 + var equalities = []; // Stack of indices where equalities are found.
  523 + var lastequality = ''; // Always equal to equalities[equalities.length-1][1]
  524 + var pointer = 0; // Index of current position.
  525 + var pre_ins = false; // Is there an insertion operation before the last equality.
  526 + var pre_del = false; // Is there an deletion operation before the last equality.
  527 + var post_ins = false; // Is there an insertion operation after the last equality.
  528 + var post_del = false; // Is there an deletion operation after the last equality.
  529 + while (pointer < diff.length) {
  530 + if (diff[pointer][0] == 0) { // equality found
  531 + if (diff[pointer][1].length < DIFF_EDIT_COST && (post_ins || post_del)) {
  532 + // Candidate found.
  533 + equalities.push(pointer);
  534 + pre_ins = post_ins;
  535 + pre_del = post_del;
  536 + lastequality = diff[pointer][1];
  537 + } else {
  538 + // Not a candidate, and can never become one.
  539 + equalities = [];
  540 + lastequality = '';
  541 + }
  542 + post_ins = post_del = false;
  543 + } else { // an insertion or deletion
  544 + if (diff[pointer][0] == -1)
  545 + post_del = true;
  546 + else
  547 + post_ins = true;
  548 + // Five types to be split:
  549 + // <ins>A</ins><del>B</del>XY<ins>C</ins><del>D</del>
  550 + // <ins>A</ins>X<ins>C</ins><del>D</del>
  551 + // <ins>A</ins><del>B</del>X<ins>C</ins>
  552 + // <ins>A</del>X<ins>C</ins><del>D</del>
  553 + // <ins>A</ins><del>B</del>X<del>C</del>
  554 + if (lastequality && ((pre_ins && pre_del && post_ins && post_del) || ((lastequality.length < DIFF_EDIT_COST/2) && (pre_ins + pre_del + post_ins + post_del) == 3))) {
  555 + //alert("Splitting: '"+lastequality+"'");
  556 + diff.splice(equalities[equalities.length-1], 0, [-1, lastequality]); // Duplicate record
  557 + diff[equalities[equalities.length-1]+1][0] = 1; // Change second copy to insert.
  558 + equalities.pop(); // Throw away the equality we just deleted;
  559 + lastequality = '';
  560 + if (pre_ins && pre_del) {
  561 + // No changes made which could affect previous entry, keep going.
  562 + post_ins = post_del = true;
  563 + equalities = [];
  564 + } else {
  565 + equalities.pop(); // Throw away the previous equality;
  566 + pointer = equalities.length ? equalities[equalities.length-1] : -1;
  567 + post_ins = post_del = false;
  568 + }
  569 + changes = true;
  570 + }
  571 + }
  572 + pointer++;
  573 + }
  574 +
  575 + if (changes)
  576 + diff_cleanup_merge(diff);
  577 +}
  578 +
  579 +
  580 +function diff_cleanup_merge(diff) {
  581 + // Reorder and merge like edit sections. Merge equalities.
  582 + // Any edit section can move as long as it doesn't cross an equality.
  583 + diff.push([0, '']); // Add a dummy entry at the end.
  584 + var pointer = 0;
  585 + var count_delete = 0;
  586 + var count_insert = 0;
  587 + var text_delete = '';
  588 + var text_insert = '';
  589 + var record_insert, record_delete;
  590 + var my_xfix;
  591 + while(pointer < diff.length) {
  592 + if (diff[pointer][0] == 1) {
  593 + count_insert++;
  594 + text_insert += diff[pointer][1];
  595 + pointer++;
  596 + } else if (diff[pointer][0] == -1) {
  597 + count_delete++;
  598 + text_delete += diff[pointer][1];
  599 + pointer++;
  600 + } else { // Upon reaching an equality, check for prior redundancies.
  601 + if (count_delete > 1 || count_insert > 1) {
  602 + if (count_delete > 1 && count_insert > 1) {
  603 + // Factor out any common prefixies.
  604 + my_xfix = diff_prefix(text_insert, text_delete);
  605 + if (my_xfix[2] != '') {
  606 + if ((pointer - count_delete - count_insert) > 0 && diff[pointer - count_delete - count_insert - 1][0] == 0) {
  607 + text_insert = my_xfix[0];
  608 + text_delete = my_xfix[1];
  609 + diff[pointer - count_delete - count_insert - 1][1] += my_xfix[2];
  610 + }
  611 + }
  612 + // Factor out any common suffixies.
  613 + my_xfix = diff_suffix(text_insert, text_delete);
  614 + if (my_xfix[2] != '') {
  615 + text_insert = my_xfix[0];
  616 + text_delete = my_xfix[1];
  617 + diff[pointer][1] = my_xfix[2] + diff[pointer][1];
  618 + }
  619 + }
  620 + // Delete the offending records and add the merged ones.
  621 + if (count_delete == 0)
  622 + diff.splice(pointer - count_delete - count_insert, count_delete + count_insert, [1, text_insert]);
  623 + else if (count_insert == 0)
  624 + diff.splice(pointer - count_delete - count_insert, count_delete + count_insert, [-1, text_delete]);
  625 + else
  626 + diff.splice(pointer - count_delete - count_insert, count_delete + count_insert, [-1, text_delete], [1, text_insert]);
  627 + pointer = pointer - count_delete - count_insert + (count_delete ? 1 : 0) + (count_insert ? 1 : 0) + 1;
  628 + } else if (pointer != 0 && diff[pointer-1][0] == 0) {
  629 + // Merge this equality with the previous one.
  630 + diff[pointer-1][1] += diff[pointer][1];
  631 + diff.splice(pointer, 1);
  632 + } else {
  633 + pointer++;
  634 + }
  635 + count_insert = 0;
  636 + count_delete = 0;
  637 + text_delete = '';
  638 + text_insert = '';
  639 + }
  640 + }
  641 + if (diff[diff.length-1][1] == '')
  642 + diff.pop(); // Remove the dummy entry at the end.
  643 +}
  644 +
  645 +
  646 +function diff_addindex(diff) {
  647 + // Add an index to each tuple, represents where the tuple is located in text2.
  648 + // e.g. [[-1, 'h', 0], [1, 'c', 0], [0, 'at', 1]]
  649 + var i = 0;
  650 + for (var x=0; x<diff.length; x++) {
  651 + diff[x].push(i);
  652 + if (diff[x][0] != -1)
  653 + i += diff[x][1].length;
  654 + }
  655 +}
  656 +
  657 +
  658 +function diff_xindex(diff, loc) {
  659 + // loc is a location in text1, compute and return the equivalent location in text2.
  660 + // e.g. "The cat" vs "The big cat", 1->1, 5->8
  661 + var chars1 = 0;
  662 + var chars2 = 0;
  663 + var last_chars1 = 0;
  664 + var last_chars2 = 0;
  665 + for (var x=0; x<diff.length; x++) {
  666 + if (diff[x][0] != 1) // Equality or deletion.
  667 + chars1 += diff[x][1].length;
  668 + if (diff[x][0] != -1) // Equality or insertion.
  669 + chars2 += diff[x][1].length;
  670 + if (chars1 > loc) // Overshot the location.
  671 + break;
  672 + last_chars1 = chars1;
  673 + last_chars2 = chars2;
  674 + }
  675 + if (diff.length != x && diff[x][0] == -1) // The location was deleted.
  676 + return last_chars2;
  677 + // Add the remaining character length.
  678 + return last_chars2 + (loc - last_chars1);
  679 +}
  680 +
  681 +
  682 +function diff_prettyhtml(diff) {
  683 + // Convert a diff array into a pretty HTML report.
  684 + diff_addindex(diff);
  685 + var html = '';
  686 + for (var x=0; x<diff.length; x++) {
  687 + var m = diff[x][0]; // Mode (-1=delete, 0=copy, 1=add)
  688 + var t = diff[x][1]; // Text of change.
  689 + var i = diff[x][2]; // Index of change.
  690 + t = t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
  691 + t = t.replace(/\n/g, "&para;<BR>");
  692 + if (m == -1)
  693 + html += "<DEL STYLE='background:#FFE6E6;' TITLE='i="+i+"'>"+t+"</DEL>";
  694 + else if (m == 1)
  695 + html += "<INS STYLE='background:#E6FFE6;' TITLE='i="+i+"'>"+t+"</INS>";
  696 + else
  697 + html += "<SPAN TITLE='i="+i+"'>"+t+"</SPAN>";
  698 + }
  699 + return html;
  700 +}
  701 +
  702 +
  703 + //////////////////////////////////////////////////////////////////////
  704 + // Match //
  705 +//////////////////////////////////////////////////////////////////////
  706 +
  707 +
  708 +function match_getmaxbits() {
  709 + // Compute the number of bits in an int.
  710 + // The normal answer for JavaScript is 32.
  711 + var maxbits = 0;
  712 + var oldi = 1;
  713 + var newi = 2;
  714 + while (oldi != newi) {
  715 + maxbits++;
  716 + oldi = newi;
  717 + newi = newi << 1;
  718 + }
  719 + return maxbits;
  720 +}
  721 +var MATCH_MAXBITS = match_getmaxbits();
  722 +
  723 +
  724 +function match_main(text, pattern, loc) {
  725 + // Locate the best instance of 'pattern' in 'text' near 'loc'.
  726 + loc = Math.max(0, Math.min(loc, text.length-pattern.length));
  727 + if (text == pattern) {
  728 + // Shortcut (potentially not guaranteed by the algorithm)
  729 + return 0;
  730 + } else if (text.length == 0) {
  731 + // Nothing to match.
  732 + return null;
  733 + } else if (text.substring(loc, loc + pattern.length) == pattern) {
  734 + // Perfect match at the perfect spot! (Includes case of null pattern)
  735 + return loc;
  736 + } else {
  737 + // Do a fuzzy compare.
  738 + var match = match_bitap(text, pattern, loc);
  739 + return match;
  740 + }
  741 +}
  742 +
  743 +
  744 +function match_bitap(text, pattern, loc) {
  745 + // Locate the best instance of 'pattern' in 'text' near 'loc' using the Bitap algorithm.
  746 + if (pattern.length > MATCH_MAXBITS)
  747 + return alert("Pattern too long for this browser.");
  748 +
  749 + // Initialise the alphabet.
  750 + var s = match_alphabet(pattern);
  751 +
  752 + var score_text_length = text.length;
  753 + // Coerce the text length between reasonable maximums and minimums.
  754 + score_text_length = Math.max(score_text_length, MATCH_MINLENGTH);
  755 + score_text_length = Math.min(score_text_length, MATCH_MAXLENGTH);
  756 +
  757 + function match_bitap_score (e, x) {
  758 + // Compute and return the score for a match with e errors and x location.
  759 + var d = Math.abs(loc-x);
  760 + return (e / pattern.length / MATCH_BALANCE) + (d / score_text_length / (1.0 - MATCH_BALANCE));
  761 + }
  762 +
  763 + // Highest score beyond which we give up.
  764 + var score_threshold = MATCH_THRESHOLD;
  765 + // Is there a nearby exact match? (speedup)
  766 + var best_loc = text.indexOf(pattern, loc);
  767 + if (best_loc != -1)
  768 + score_threshold = Math.min(match_bitap_score(0, best_loc), score_threshold);
  769 + // What about in the other direction? (speedup)
  770 + best_loc = text.lastIndexOf(pattern, loc+pattern.length);
  771 + if (best_loc != -1)
  772 + score_threshold = Math.min(match_bitap_score(0, best_loc), score_threshold);
  773 +
  774 + // Initialise the bit arrays.
  775 + var r = Array();
  776 + var d = -1;
  777 + var matchmask = Math.pow(2, pattern.length-1);
  778 + best_loc = null;
  779 +
  780 + var bin_min, bin_mid;
  781 + var bin_max = Math.max(loc+loc, text.length);
  782 + var last_rd;
  783 + for (var d=0; d<pattern.length; d++) {
  784 + // Scan for the best match; each iteration allows for one more error.
  785 + var rd = Array(text.length);
  786 +
  787 + // Run a binary search to determine how far from 'loc' we can stray at this error level.
  788 + bin_min = loc;
  789 + bin_mid = bin_max;
  790 + while(bin_min < bin_mid) {
  791 + if (match_bitap_score(d, bin_mid) < score_threshold)
  792 + bin_min = bin_mid;
  793 + else
  794 + bin_max = bin_mid;
  795 + bin_mid = Math.floor((bin_max - bin_min) / 2 + bin_min);
  796 + }
  797 + bin_max = bin_mid; // Use the result from this iteration as the maximum for the next.
  798 + var start = Math.max(0, loc - (bin_mid - loc) - 1);
  799 + var finish = Math.min(text.length-1, pattern.length + bin_mid);
  800 +
  801 + if (text.charAt(finish) == pattern.charAt(pattern.length-1))
  802 + rd[finish] = Math.pow(2, d+1)-1;
  803 + else
  804 + rd[finish] = Math.pow(2, d)-1;
  805 + for (var j=finish-1; j>=start; j--) {
  806 + // The alphabet (s) is a sparse hash, so the following lines generate warnings.
  807 + if (d == 0) // First pass: exact match.
  808 + rd[j] = ((rd[j+1] << 1) | 1) & s[text.charAt(j)];
  809 + else // Subsequent passes: fuzzy match.
  810 + rd[j] = ((rd[j+1] << 1) | 1) & s[text.charAt(j)] | ((last_rd[j+1] << 1) | 1) | ((last_rd[j] << 1) | 1) | last_rd[j+1];
  811 + if (rd[j] & matchmask) {
  812 + var score = match_bitap_score(d, j);
  813 + // This match will almost certainly be better than any existing match. But check anyway.
  814 + if (score <= score_threshold) {
  815 + // Told you so.
  816 + score_threshold = score;
  817 + best_loc = j;
  818 + if (j > loc) {
  819 + // When passing loc, don't exceed our current distance from loc.
  820 + start = Math.max(0, loc - (j - loc));
  821 + } else {
  822 + // Already passed loc, downhill from here on in.
  823 + break;
  824 + }
  825 + }
  826 + }
  827 + }
  828 + if (match_bitap_score(d+1, loc) > score_threshold) // No hope for a (better) match at greater error levels.
  829 + break;
  830 + last_rd = rd;
  831 + }
  832 + return best_loc;
  833 +}
  834 +
  835 +
  836 +function match_alphabet(pattern) {
  837 + // Initialise the alphabet for the Bitap algorithm.
  838 + var s = Object();
  839 + for (var i=0; i<pattern.length; i++)
  840 + s[pattern.charAt(i)] = 0;
  841 + for (var i=0; i<pattern.length; i++)
  842 + s[pattern.charAt(i)] |= Math.pow(2, pattern.length-i-1);
  843 + return s;
  844 +}
  845 +
  846 +
  847 + //////////////////////////////////////////////////////////////////////
  848 + // Patch //
  849 +//////////////////////////////////////////////////////////////////////
  850 +
  851 +
  852 +function patch_obj() {
  853 + // Constructor for a patch object.
  854 + this.diffs = [];
  855 + this.start1 = null;
  856 + this.start2 = null;
  857 + this.length1 = 0;
  858 + this.length2 = 0;
  859 +
  860 + this.toString = function() {
  861 + // Emmulate GNU diff's format.
  862 + // Header: @@ -382,8 +481,9 @@
  863 + // Indicies are printed as 1-based, not 0-based.
  864 + var coords1, coords2;
  865 + if (this.length1 == 0)
  866 + coords1 = this.start1+",0";
  867 + else if (this.length1 == 1)
  868 + coords1 = this.start1+1;
  869 + else
  870 + coords1 = (this.start1+1)+","+this.length1;
  871 + if (this.length2 == 0)
  872 + coords2 = this.start2+",0";
  873 + else if (this.length2 == 1)
  874 + coords2 = this.start2+1;
  875 + else
  876 + coords2 = (this.start2+1)+","+this.length2;
  877 + var txt = "@@ -"+coords1+" +"+coords2+" @@\n";
  878 + // Escape the body of the patch with %xx notation.
  879 + for (var x=0; x<this.diffs.length; x++)
  880 + txt += ("- +".charAt(this.diffs[x][0]+1)) + encodeURI(this.diffs[x][1]) + "\n";
  881 + return txt.replace(/%20/g, ' ');
  882 + }
  883 +
  884 + this.text1 = function() {
  885 + // Compute and return the source text (all equalities and deletions).
  886 + var txt = '';
  887 + for (var x=0; x<this.diffs.length; x++)
  888 + if (this.diffs[x][0] == 0 || this.diffs[x][0] == -1)
  889 + txt += this.diffs[x][1];
  890 + return txt;
  891 + }
  892 +
  893 + this.text2 = function() {
  894 + // Compute and return the destination text (all equalities and insertions).
  895 + var txt = '';
  896 + for (var x=0; x<this.diffs.length; x++)
  897 + if (this.diffs[x][0] == 0 || this.diffs[x][0] == 1)
  898 + txt += this.diffs[x][1];
  899 + return txt;
  900 + }
  901 +}
  902 +
  903 +
  904 +function patch_addcontext(patch, text) {
  905 + var pattern = text.substring(patch.start2, patch.start2+patch.length1);
  906 + var padding = 0;
  907 + // Increase the context until we're unique (but don't let the pattern expand beyond MATCH_MAXBITS).
  908 + while (text.indexOf(pattern) != text.lastIndexOf(pattern) && pattern.length < MATCH_MAXBITS-PATCH_MARGIN-PATCH_MARGIN) {
  909 + padding += PATCH_MARGIN;
  910 + pattern = text.substring(patch.start2 - padding, patch.start2+patch.length1 + padding);
  911 + }
  912 + // Add one chunk for good luck.
  913 + padding += PATCH_MARGIN;
  914 + // Add the prefix.
  915 + var prefix = text.substring(patch.start2 - padding, patch.start2);
  916 + if (prefix != '')
  917 + patch.diffs.unshift([0, prefix]);
  918 + // Add the suffix
  919 + var suffix = text.substring(patch.start2+patch.length1, patch.start2+patch.length1 + padding);
  920 + if (suffix != '')
  921 + patch.diffs.push([0, suffix]);
  922 +
  923 + // Roll back the start points.
  924 + patch.start1 -= prefix.length;
  925 + patch.start2 -= prefix.length;
  926 + // Extend the lengths.
  927 + patch.length1 += prefix.length + suffix.length;
  928 + patch.length2 += prefix.length + suffix.length;
  929 +}
  930 +
  931 +
  932 +function patch_make(text1, text2, diff) {
  933 + // Compute a list of patches to turn text1 into text2.
  934 + // Use diff if provided, otherwise compute it ourselves.
  935 + if (typeof diff == 'undefined') {
  936 + diff = diff_main(text1, text2, true);
  937 + if (diff.length > 2) {
  938 + diff_cleanup_semantic(diff);
  939 + diff_cleanup_efficiency(diff);
  940 + }
  941 + }
  942 + if (diff.length == 0)
  943 + return []; // Get rid of the null case.
  944 + var patches = [];
  945 + var patch = new patch_obj();
  946 + var char_count1 = 0; // Number of characters into the text1 string.
  947 + var char_count2 = 0; // Number of characters into the text2 string.
  948 + var last_type = null;
  949 + var prepatch_text = text1; // Recreate the patches to determine context info.
  950 + var postpatch_text = text1;
  951 + for (var x=0; x<diff.length; x++) {
  952 + var diff_type = diff[x][0];
  953 + var diff_text = diff[x][1];
  954 +
  955 + if (patch.diffs.length == 0 && diff_type != 0) {
  956 + // A new patch starts here.
  957 + patch.start1 = char_count1;
  958 + patch.start2 = char_count2;
  959 + }
  960 +
  961 + if (diff_type == 1) {
  962 + // Insertion
  963 + patch.diffs.push(diff[x]);
  964 + patch.length2 += diff_text.length;
  965 + postpatch_text = postpatch_text.substring(0, char_count2) + diff_text + postpatch_text.substring(char_count2);
  966 + } else if (diff_type == -1) {
  967 + // Deletion.
  968 + patch.length1 += diff_text.length;
  969 + patch.diffs.push(diff[x]);
  970 + postpatch_text = postpatch_text.substring(0, char_count2) + postpatch_text.substring(char_count2 + diff_text.length);
  971 + } else if (diff_type == 0 && diff_text.length <= 2*PATCH_MARGIN && patch.diffs.length != 0 && diff.length != x+1) {
  972 + // Small equality inside a patch.
  973 + patch.diffs.push(diff[x]);
  974 + patch.length1 += diff_text.length;
  975 + patch.length2 += diff_text.length;
  976 + }
  977 +
  978 + last_type = diff_type;
  979 + if (diff_type == 0 && diff_text.length >= 2*PATCH_MARGIN) {
  980 + // Time for a new patch.
  981 + if (patch.diffs.length != 0) {
  982 + patch_addcontext(patch, prepatch_text);
  983 + patches.push(patch);
  984 + var patch = new patch_obj();
  985 + last_type = null;
  986 + prepatch_text = postpatch_text;
  987 + }
  988 + }
  989 +
  990 + // Update the current character count.
  991 + if (diff_type != 1)
  992 + char_count1 += diff_text.length;
  993 + if (diff_type != -1)
  994 + char_count2 += diff_text.length;
  995 + }
  996 + // Pick up the leftover patch if not empty.
  997 + if (patch.diffs.length != 0) {
  998 + patch_addcontext(patch, prepatch_text);
  999 + patches.push(patch);
  1000 + }
  1001 +
  1002 + return patches;
  1003 +}
  1004 +
  1005 +
  1006 +function patch_apply(patches, text) {
  1007 + // Merge a set of patches onto the text.
  1008 + // Return a patched text, as well as a list of true/false values indicating which patches were applied.
  1009 + patch_splitmax(patches);
  1010 + var results = [];
  1011 + var delta = 0;
  1012 + var expected_loc, start_loc;
  1013 + var text1, text2;
  1014 + var diff, mod, index1, index2;
  1015 + for (var x=0; x<patches.length; x++) {
  1016 + expected_loc = patches[x].start2 + delta;
  1017 + text1 = patches[x].text1();
  1018 + start_loc = match_main(text, text1, expected_loc);
  1019 + if (start_loc == null) {
  1020 + // No match found. :(
  1021 + results.push(false);
  1022 + } else {
  1023 + // Found a match. :)
  1024 + results.push(true);
  1025 + delta = start_loc - expected_loc;
  1026 + text2 = text.substring(start_loc, start_loc + text1.length);
  1027 + if (text1 == text2) {
  1028 + // Perfect match, just shove the replacement text in.
  1029 + text = text.substring(0, start_loc) + patches[x].text2() + text.substring(start_loc + text1.length);
  1030 + } else {
  1031 + // Imperfect match. Run a diff to get a framework of equivalent indicies.
  1032 + diff = diff_main(text1, text2, false);
  1033 + index1 = 0;
  1034 + for (var y=0; y<patches[x].diffs.length; y++) {
  1035 + mod = patches[x].diffs[y];
  1036 + if (mod[0] != 0)
  1037 + index2 = diff_xindex(diff, index1);
  1038 + if (mod[0] == 1) // Insertion
  1039 + text = text.substring(0, start_loc + index2) + mod[1] + text.substring(start_loc + index2);
  1040 + else if (mod[0] == -1) // Deletion
  1041 + text = text.substring(0, start_loc + index2) + text.substring(start_loc + diff_xindex(diff, index1 + mod[1].length));
  1042 + if (mod[0] != -1)
  1043 + index1 += mod[1].length;
  1044 + }
  1045 + }
  1046 + }
  1047 + }
  1048 + return [text, results];
  1049 +}
  1050 +
  1051 +
  1052 +function patch_splitmax(patches) {
  1053 + // Look through the patches and break up any which are longer than the maximum limit of the match algorithm.
  1054 + var bigpatch, patch, patch_size, start1, start2, diff_type, diff_text, precontext, postcontext, empty;
  1055 + for (var x=0; x<patches.length; x++) {
  1056 + if (patches[x].length1 > MATCH_MAXBITS) {
  1057 + bigpatch = patches[x];
  1058 + // Remove the big old patch.
  1059 + patches.splice(x, 1);
  1060 + patch_size = MATCH_MAXBITS;
  1061 + start1 = bigpatch.start1;
  1062 + start2 = bigpatch.start2;
  1063 + precontext = '';
  1064 + while (bigpatch.diffs.length != 0) {
  1065 + // Create one of several smaller patches.
  1066 + patch = new patch_obj();
  1067 + empty = true;
  1068 + patch.start1 = start1 - precontext.length;
  1069 + patch.start2 = start2 - precontext.length;
  1070 + if (precontext != '') {
  1071 + patch.length1 = patch.length2 = precontext.length;
  1072 + patch.diffs.push([0, precontext]);
  1073 + }
  1074 + while (bigpatch.diffs.length != 0 && patch.length1 < patch_size - PATCH_MARGIN) {
  1075 + diff_type = bigpatch.diffs[0][0];
  1076 + diff_text = bigpatch.diffs[0][1];
  1077 + if (diff_type == 1) {
  1078 + // Insertions are harmless.
  1079 + patch.length2 += diff_text.length;
  1080 + start2 += diff_text.length;
  1081 + patch.diffs.push(bigpatch.diffs.shift());
  1082 + empty = false;
  1083 + } else {
  1084 + // Deletion or equality. Only take as much as we can stomach.
  1085 + diff_text = diff_text.substring(0, patch_size - patch.length1 - PATCH_MARGIN);
  1086 + patch.length1 += diff_text.length;
  1087 + start1 += diff_text.length;
  1088 + if (diff_type == 0) {
  1089 + patch.length2 += diff_text.length;
  1090 + start2 += diff_text.length;
  1091 + } else {
  1092 + empty = false;
  1093 + }
  1094 + patch.diffs.push([diff_type, diff_text]);
  1095 + if (diff_text == bigpatch.diffs[0][1])
  1096 + bigpatch.diffs.shift();
  1097 + else
  1098 + bigpatch.diffs[0][1] = bigpatch.diffs[0][1].substring(diff_text.length);
  1099 + }
  1100 + }
  1101 + // Compute the head context for the next patch.
  1102 + precontext = patch.text2();
  1103 + precontext = precontext.substring(precontext.length - PATCH_MARGIN);
  1104 + // Append the end context for this patch.
  1105 + postcontext = bigpatch.text1().substring(0, PATCH_MARGIN);
  1106 + if (postcontext != '') {
  1107 + patch.length1 += postcontext.length;
  1108 + patch.length2 += postcontext.length;
  1109 + if (patch.diffs.length > 0 && patch.diffs[patch.diffs.length-1][0] == 0)
  1110 + patch.diffs[patch.diffs.length-1][1] += postcontext;
  1111 + else
  1112 + patch.diffs.push([0, postcontext]);
  1113 + }
  1114 + if (!empty)
  1115 + patches.splice(x++, 0, patch);
  1116 + }
  1117 + }
  1118 + }
  1119 +}
  1120 +
  1121 +
  1122 +function patch_totext(patches) {
  1123 + // Take a list of patches and return a textual representation.
  1124 + var text = '';
  1125 + for (var x=0; x<patches.length; x++)
  1126 + text += patches[x];
  1127 + return text;
  1128 +}
  1129 +
  1130 +
  1131 +function patch_fromtext(text) {
  1132 + // Take a textual representation of patches and return a list of patch objects.
  1133 + var patches = [];
  1134 + text = text.split('\n');
  1135 + var patch, m, chars1, chars2, sign, line;
  1136 + while (text.length != 0) {
  1137 + m = text[0].match(/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/);
  1138 + if (!m)
  1139 + return alert("Invalid patch string:\n"+text[0]);
  1140 + patch = new patch_obj();
  1141 + patches.push(patch);
  1142 + patch.start1 = parseInt(m[1]);
  1143 + if (m[2] == '') {
  1144 + patch.start1--;
  1145 + patch.length1 = 1;
  1146 + } else if (m[2] == '0') {
  1147 + patch.length1 = 0;
  1148 + } else {
  1149 + patch.start1--;
  1150 + patch.length1 = parseInt(m[2]);
  1151 + }
  1152 +
  1153 + patch.start2 = parseInt(m[3]);
  1154 + if (m[4] == '') {
  1155 + patch.start2--;
  1156 + patch.length2 = 1;
  1157 + } else if (m[4] == '0') {
  1158 + patch.length2 = 0;
  1159 + } else {
  1160 + patch.start2--;
  1161 + patch.length2 = parseInt(m[4]);
  1162 + }
  1163 + text.shift();
  1164 +
  1165 + while (text.length != 0) {
  1166 + sign = text[0].charAt(0);
  1167 + line = decodeURIComponent(text[0].substring(1));
  1168 + if (sign == '-') {
  1169 + // Deletion.
  1170 + patch.diffs.push([-1, line]);
  1171 + } else if (sign == '+') {
  1172 + // Insertion.
  1173 + patch.diffs.push([1, line]);
  1174 + } else if (sign == ' ') {
  1175 + // Minor equality.
  1176 + patch.diffs.push([0, line]);
  1177 + } else if (sign == '@') {
  1178 + // Start of next patch.
  1179 + break;
  1180 + } else if (sign == '') {
  1181 + // Blank line? Whatever.
  1182 + } else {
  1183 + // WTF?
  1184 + return alert("Invalid patch mode: '"+sign+"'\n"+line);
  1185 + }
  1186 + text.shift();
  1187 + }
  1188 + }
  1189 + return patches;
  1190 +}
  1191 +
  1192 +// EOF
public/javascripts/tiny_mce/plugins/devkit/langs/en.js 0 → 100755
@@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
  1 +// UK lang variables
  2 +
  3 +tinyMCE.addToLang('devkit',{
  4 +title : 'TinyMCE Development Kit',
  5 +info_tab : 'Info',
  6 +settings_tab : 'Settings',
  7 +log_tab : 'Log',
  8 +content_tab : 'Content',
  9 +command_states_tab : 'Commands',
  10 +undo_redo_tab : 'Undo/Redo',
  11 +misc_tab : 'Misc',
  12 +filter : 'Filter:',
  13 +clear_log : 'Clear log',
  14 +refresh : 'Refresh',
  15 +info_help : 'Press Refresh to view info.',
  16 +settings_help : 'Press Refresh to display the settings array for each TinyMCE_Control instance.',
  17 +content_help : 'Press Refresh to display the raw and cleaned HTML content for each TinyMCE_Control instance.',
  18 +command_states_help : 'Press Refresh to display the current command states from inst.queryCommandState. This list will also mark unsupported commands.',
  19 +undo_redo_help : 'Press Refresh to display the global and instance undo/redo levels.',
  20 +misc_help : 'Here are various tools for debugging and development purposes.',
  21 +debug_events : 'Debug events',
  22 +undo_diff : 'Diff undo levels'
  23 +});
public/javascripts/tiny_mce/plugins/directionality/editor_plugin.js 0 → 100755
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +tinyMCE.importPluginLanguagePack('directionality');var TinyMCE_DirectionalityPlugin={getInfo:function(){return{longname:'Directionality',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},getControlHTML:function(cn){switch(cn){case"ltr":return tinyMCE.getButtonHTML(cn,'lang_directionality_ltr_desc','{$pluginurl}/images/ltr.gif','mceDirectionLTR');case"rtl":return tinyMCE.getButtonHTML(cn,'lang_directionality_rtl_desc','{$pluginurl}/images/rtl.gif','mceDirectionRTL')}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceDirectionLTR":var inst=tinyMCE.getInstanceById(editor_id);var elm=tinyMCE.getParentElement(inst.getFocusElement(),"p,div,td,h1,h2,h3,h4,h5,h6,pre,address");if(elm)elm.setAttribute("dir","ltr");tinyMCE.triggerNodeChange(false);return true;case"mceDirectionRTL":var inst=tinyMCE.getInstanceById(editor_id);var elm=tinyMCE.getParentElement(inst.getFocusElement(),"p,div,td,h1,h2,h3,h4,h5,h6,pre,address");if(elm)elm.setAttribute("dir","rtl");tinyMCE.triggerNodeChange(false);return true}return false},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){function getAttrib(elm,name){return elm.getAttribute(name)?elm.getAttribute(name):""}if(node==null)return;var elm=tinyMCE.getParentElement(node,"p,div,td,h1,h2,h3,h4,h5,h6,pre,address");if(!elm){tinyMCE.switchClass(editor_id+'_ltr','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_rtl','mceButtonDisabled');return true}tinyMCE.switchClass(editor_id+'_ltr','mceButtonNormal');tinyMCE.switchClass(editor_id+'_rtl','mceButtonNormal');var dir=getAttrib(elm,"dir");if(dir=="ltr"||dir=="")tinyMCE.switchClass(editor_id+'_ltr','mceButtonSelected');else tinyMCE.switchClass(editor_id+'_rtl','mceButtonSelected');return true}};tinyMCE.addPlugin("directionality",TinyMCE_DirectionalityPlugin);
0 \ No newline at end of file 2 \ No newline at end of file
public/javascripts/tiny_mce/plugins/directionality/editor_plugin_src.js 0 → 100755
@@ -0,0 +1,90 @@ @@ -0,0 +1,90 @@
  1 +/**
  2 + * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
  3 + *
  4 + * @author Moxiecode
  5 + * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
  6 + */
  7 +
  8 +/* Import plugin specific language pack */
  9 +tinyMCE.importPluginLanguagePack('directionality');
  10 +
  11 +var TinyMCE_DirectionalityPlugin = {
  12 + getInfo : function() {
  13 + return {
  14 + longname : 'Directionality',
  15 + author : 'Moxiecode Systems AB',
  16 + authorurl : 'http://tinymce.moxiecode.com',
  17 + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',
  18 + version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
  19 + };
  20 + },
  21 +
  22 + getControlHTML : function(cn) {
  23 + switch (cn) {
  24 + case "ltr":
  25 + return tinyMCE.getButtonHTML(cn, 'lang_directionality_ltr_desc', '{$pluginurl}/images/ltr.gif', 'mceDirectionLTR');
  26 +
  27 + case "rtl":
  28 + return tinyMCE.getButtonHTML(cn, 'lang_directionality_rtl_desc', '{$pluginurl}/images/rtl.gif', 'mceDirectionRTL');
  29 + }
  30 +
  31 + return "";
  32 + },
  33 +
  34 + execCommand : function(editor_id, element, command, user_interface, value) {
  35 + // Handle commands
  36 + switch (command) {
  37 + case "mceDirectionLTR":
  38 + var inst = tinyMCE.getInstanceById(editor_id);
  39 + var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address");
  40 +
  41 + if (elm)
  42 + elm.setAttribute("dir", "ltr");
  43 +
  44 + tinyMCE.triggerNodeChange(false);
  45 + return true;
  46 +
  47 + case "mceDirectionRTL":
  48 + var inst = tinyMCE.getInstanceById(editor_id);
  49 + var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address");
  50 +
  51 + if (elm)
  52 + elm.setAttribute("dir", "rtl");
  53 +
  54 + tinyMCE.triggerNodeChange(false);
  55 + return true;
  56 + }
  57 +
  58 + // Pass to next handler in chain
  59 + return false;
  60 + },
  61 +
  62 + handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
  63 + function getAttrib(elm, name) {
  64 + return elm.getAttribute(name) ? elm.getAttribute(name) : "";
  65 + }
  66 +
  67 + if (node == null)
  68 + return;
  69 +
  70 + var elm = tinyMCE.getParentElement(node, "p,div,td,h1,h2,h3,h4,h5,h6,pre,address");
  71 + if (!elm) {
  72 + tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonDisabled');
  73 + tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonDisabled');
  74 + return true;
  75 + }
  76 +
  77 + tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonNormal');
  78 + tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonNormal');
  79 +
  80 + var dir = getAttrib(elm, "dir");
  81 + if (dir == "ltr" || dir == "")
  82 + tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonSelected');
  83 + else
  84 + tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonSelected');
  85 +
  86 + return true;
  87 + }
  88 +};
  89 +
  90 +tinyMCE.addPlugin("directionality", TinyMCE_DirectionalityPlugin);
public/javascripts/tiny_mce/plugins/directionality/images/ltr.gif 0 → 100755

155 Bytes

public/javascripts/tiny_mce/plugins/directionality/images/rtl.gif 0 → 100755

153 Bytes

public/javascripts/tiny_mce/plugins/directionality/langs/en.js 0 → 100755
@@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
  1 +// UK lang variables
  2 +
  3 +tinyMCE.addToLang('',{
  4 +directionality_ltr_desc : 'Direction left to right',
  5 +directionality_rtl_desc : 'Direction right to left'
  6 +});
public/javascripts/tiny_mce/plugins/directionality/readme.txt 0 → 100755
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +Check the TinyMCE documentation for details on this plugin.
public/javascripts/tiny_mce/plugins/emotions/editor_plugin.js 0 → 100755
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +tinyMCE.importPluginLanguagePack('emotions');var TinyMCE_EmotionsPlugin={getInfo:function(){return{longname:'Emotions',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},getControlHTML:function(cn){switch(cn){case"emotions":return tinyMCE.getButtonHTML(cn,'lang_emotions_desc','{$pluginurl}/images/emotions.gif','mceEmotion')}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceEmotion":var template=new Array();template['file']='../../plugins/emotions/emotions.htm';template['width']=250;template['height']=160;template['width']+=tinyMCE.getLang('lang_emotions_delta_width',0);template['height']+=tinyMCE.getLang('lang_emotions_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true}return false}};tinyMCE.addPlugin('emotions',TinyMCE_EmotionsPlugin);
0 \ No newline at end of file 2 \ No newline at end of file
public/javascripts/tiny_mce/plugins/emotions/editor_plugin_src.js 0 → 100755
@@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
  1 +/**
  2 + * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
  3 + *
  4 + * @author Moxiecode
  5 + * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
  6 + */
  7 +
  8 +/* Import plugin specific language pack */
  9 +tinyMCE.importPluginLanguagePack('emotions');
  10 +
  11 +// Plucin static class
  12 +var TinyMCE_EmotionsPlugin = {
  13 + getInfo : function() {
  14 + return {
  15 + longname : 'Emotions',
  16 + author : 'Moxiecode Systems AB',
  17 + authorurl : 'http://tinymce.moxiecode.com',
  18 + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions',
  19 + version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
  20 + };
  21 + },
  22 +
  23 + /**
  24 + * Returns the HTML contents of the emotions control.
  25 + */
  26 + getControlHTML : function(cn) {
  27 + switch (cn) {
  28 + case "emotions":
  29 + return tinyMCE.getButtonHTML(cn, 'lang_emotions_desc', '{$pluginurl}/images/emotions.gif', 'mceEmotion');
  30 + }
  31 +
  32 + return "";
  33 + },
  34 +
  35 + /**
  36 + * Executes the mceEmotion command.
  37 + */
  38 + execCommand : function(editor_id, element, command, user_interface, value) {
  39 + // Handle commands
  40 + switch (command) {
  41 + case "mceEmotion":
  42 + var template = new Array();
  43 +
  44 + template['file'] = '../../plugins/emotions/emotions.htm'; // Relative to theme
  45 + template['width'] = 250;
  46 + template['height'] = 160;
  47 +
  48 + // Language specific width and height addons
  49 + template['width'] += tinyMCE.getLang('lang_emotions_delta_width', 0);
  50 + template['height'] += tinyMCE.getLang('lang_emotions_delta_height', 0);
  51 +
  52 + tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"});
  53 +
  54 + return true;
  55 + }
  56 +
  57 + // Pass to next handler in chain
  58 + return false;
  59 + }
  60 +};
  61 +
  62 +// Register plugin
  63 +tinyMCE.addPlugin('emotions', TinyMCE_EmotionsPlugin);
public/javascripts/tiny_mce/plugins/emotions/emotions.htm 0 → 100755
@@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
  1 +<html xmlns="http://www.w3.org/1999/xhtml">
  2 +<head>
  3 + <title>{$lang_emotions_title}</title>
  4 + <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
  5 + <script language="javascript" type="text/javascript" src="jscripts/functions.js"></script>
  6 + <base target="_self" />
  7 +</head>
  8 +<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
  9 + <div align="center">
  10 + <div class="title">{$lang_emotions_title}:<br /><br /></div>
  11 +
  12 + <table border="0" cellspacing="0" cellpadding="4">
  13 + <tr>
  14 + <td><a href="javascript:insertEmotion('smiley-cool.gif','lang_emotions_cool');"><img src="images/smiley-cool.gif" width="18" height="18" border="0" alt="{$lang_emotions_cool}" title="{$lang_emotions_cool}" /></a></td>
  15 + <td><a href="javascript:insertEmotion('smiley-cry.gif','lang_emotions_cry');"><img src="images/smiley-cry.gif" width="18" height="18" border="0" alt="{$lang_emotions_cry}" title="{$lang_emotions_cry}" /></a></td>
  16 + <td><a href="javascript:insertEmotion('smiley-embarassed.gif','lang_emotions_embarassed');"><img src="images/smiley-embarassed.gif" width="18" height="18" border="0" alt="{$lang_emotions_embarassed}" title="{$lang_emotions_embarassed}" /></a></td>
  17 + <td><a href="javascript:insertEmotion('smiley-foot-in-mouth.gif','lang_emotions_foot_in_mouth');"><img src="images/smiley-foot-in-mouth.gif" width="18" height="18" border="0" alt="{$lang_emotions_foot_in_mouth}" title="{$lang_emotions_foot_in_mouth}" /></a></td>
  18 + </tr>
  19 + <tr>
  20 + <td><a href="javascript:insertEmotion('smiley-frown.gif','lang_emotions_frown');"><img src="images/smiley-frown.gif" width="18" height="18" border="0" alt="{$lang_emotions_frown}" title="{$lang_emotions_frown}" /></a></td>
  21 + <td><a href="javascript:insertEmotion('smiley-innocent.gif','lang_emotions_innocent');"><img src="images/smiley-innocent.gif" width="18" height="18" border="0" alt="{$lang_emotions_innocent}" title="{$lang_emotions_innocent}" /></a></td>
  22 + <td><a href="javascript:insertEmotion('smiley-kiss.gif','lang_emotions_kiss');"><img src="images/smiley-kiss.gif" width="18" height="18" border="0" alt="{$lang_emotions_kiss}" title="{$lang_emotions_kiss}" /></a></td>
  23 + <td><a href="javascript:insertEmotion('smiley-laughing.gif','lang_emotions_laughing');"><img src="images/smiley-laughing.gif" width="18" height="18" border="0" alt="{$lang_emotions_laughing}" title="{$lang_emotions_laughing}" /></a></td>
  24 + </tr>
  25 + <tr>
  26 + <td><a href="javascript:insertEmotion('smiley-money-mouth.gif','lang_emotions_money_mouth');"><img src="images/smiley-money-mouth.gif" width="18" height="18" border="0" alt="{$lang_emotions_money_mouth}" title="{$lang_emotions_money_mouth}" /></a></td>
  27 + <td><a href="javascript:insertEmotion('smiley-sealed.gif','lang_emotions_sealed');"><img src="images/smiley-sealed.gif" width="18" height="18" border="0" alt="{$lang_emotions_sealed}" title="{$lang_emotions_sealed}" /></a></td>
  28 + <td><a href="javascript:insertEmotion('smiley-smile.gif','lang_emotions_smile');"><img src="images/smiley-smile.gif" width="18" height="18" border="0" alt="{$lang_emotions_smile}" title="{$lang_emotions_smile}" /></a></td>
  29 + <td><a href="javascript:insertEmotion('smiley-surprised.gif','lang_emotions_surprised');"><img src="images/smiley-surprised.gif" width="18" height="18" border="0" alt="{$lang_emotions_surprised}" title="{$lang_emotions_surprised}" /></a></td>
  30 + </tr>
  31 + <tr>
  32 + <td><a href="javascript:insertEmotion('smiley-tongue-out.gif','lang_emotions_tongue_out');"><img src="images/smiley-tongue-out.gif" width="18" height="18" border="0" alt="{$lang_emotions_tongue-out}" title="{$lang_emotions_tongue_out}" /></a></td>
  33 + <td><a href="javascript:insertEmotion('smiley-undecided.gif','lang_emotions_undecided');"><img src="images/smiley-undecided.gif" width="18" height="18" border="0" alt="{$lang_emotions_undecided}" title="{$lang_emotions_undecided}" /></a></td>
  34 + <td><a href="javascript:insertEmotion('smiley-wink.gif','lang_emotions_wink');"><img src="images/smiley-wink.gif" width="18" height="18" border="0" alt="{$lang_emotions_wink}" title="{$lang_emotions_wink}" /></a></td>
  35 + <td><a href="javascript:insertEmotion('smiley-yell.gif','lang_emotions_yell');"><img src="images/smiley-yell.gif" width="18" height="18" border="0" alt="{$lang_emotions_yell}" title="{$lang_emotions_yell}" /></a></td>
  36 + </tr>
  37 + </table>
  38 + </div>
  39 +</body>
  40 +</html>
public/javascripts/tiny_mce/plugins/emotions/images/emotions.gif 0 → 100755

319 Bytes

public/javascripts/tiny_mce/plugins/emotions/images/readme.txt 0 → 100755
@@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
  1 +These emotions where taken from Mozilla Thunderbird.
  2 +I hope they don't get angry if I use them here after all this is a open source project aswell.
public/javascripts/tiny_mce/plugins/emotions/images/smiley-cool.gif 0 → 100755

354 Bytes

public/javascripts/tiny_mce/plugins/emotions/images/smiley-cry.gif 0 → 100755

329 Bytes

public/javascripts/tiny_mce/plugins/emotions/images/smiley-embarassed.gif 0 → 100755

331 Bytes

public/javascripts/tiny_mce/plugins/emotions/images/smiley-foot-in-mouth.gif 0 → 100755

344 Bytes

public/javascripts/tiny_mce/plugins/emotions/images/smiley-frown.gif 0 → 100755

340 Bytes

public/javascripts/tiny_mce/plugins/emotions/images/smiley-innocent.gif 0 → 100755

336 Bytes

public/javascripts/tiny_mce/plugins/emotions/images/smiley-kiss.gif 0 → 100755

338 Bytes

public/javascripts/tiny_mce/plugins/emotions/images/smiley-laughing.gif 0 → 100755

344 Bytes

public/javascripts/tiny_mce/plugins/emotions/images/smiley-money-mouth.gif 0 → 100755

321 Bytes

public/javascripts/tiny_mce/plugins/emotions/images/smiley-sealed.gif 0 → 100755

325 Bytes

public/javascripts/tiny_mce/plugins/emotions/images/smiley-smile.gif 0 → 100755

345 Bytes

public/javascripts/tiny_mce/plugins/emotions/images/smiley-surprised.gif 0 → 100755

342 Bytes

public/javascripts/tiny_mce/plugins/emotions/images/smiley-tongue-out.gif 0 → 100755

328 Bytes

public/javascripts/tiny_mce/plugins/emotions/images/smiley-undecided.gif 0 → 100755

337 Bytes

public/javascripts/tiny_mce/plugins/emotions/images/smiley-wink.gif 0 → 100755

351 Bytes

public/javascripts/tiny_mce/plugins/emotions/images/smiley-yell.gif 0 → 100755

336 Bytes

public/javascripts/tiny_mce/plugins/emotions/jscripts/functions.js 0 → 100755
@@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
  1 +function init() {
  2 + tinyMCEPopup.resizeToInnerSize();
  3 +}
  4 +
  5 +function insertEmotion(file_name, title) {
  6 + title = tinyMCE.getLang(title);
  7 +
  8 + if (title == null)
  9 + title = "";
  10 +
  11 + // XML encode
  12 + title = title.replace(/&/g, '&amp;');
  13 + title = title.replace(/\"/g, '&quot;');
  14 + title = title.replace(/</g, '&lt;');
  15 + title = title.replace(/>/g, '&gt;');
  16 +
  17 + var html = '<img src="' + tinyMCE.baseURL + "/plugins/emotions/images/" + file_name + '" mce_src="' + tinyMCE.baseURL + "/plugins/emotions/images/" + file_name + '" border="0" alt="' + title + '" title="' + title + '" />';
  18 +
  19 + tinyMCE.execCommand('mceInsertContent', false, html);
  20 + tinyMCEPopup.close();
  21 +}
public/javascripts/tiny_mce/plugins/emotions/langs/en.js 0 → 100755
@@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
  1 +// UK lang variables
  2 +
  3 +tinyMCE.addToLang('emotions',{
  4 +title : 'Insert emotion',
  5 +desc : 'Emotions',
  6 +cool : 'Cool',
  7 +cry : 'Cry',
  8 +embarassed : 'Embarassed',
  9 +foot_in_mouth : 'Foot in mouth',
  10 +frown : 'Frown',
  11 +innocent : 'Innocent',
  12 +kiss : 'Kiss',
  13 +laughing : 'Laughing',
  14 +money_mouth : 'Money mouth',
  15 +sealed : 'Sealed',
  16 +smile : 'Smile',
  17 +surprised : 'Surprised',
  18 +tongue_out : 'Tongue out',
  19 +undecided : 'Undecided',
  20 +wink : 'Wink',
  21 +yell : 'Yell'
  22 +});
public/javascripts/tiny_mce/plugins/emotions/readme.txt 0 → 100755
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +Check the TinyMCE documentation for details on this plugin.
public/javascripts/tiny_mce/plugins/flash/css/content.css 0 → 100755
@@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
  1 +.mceItemFlash {
  2 + border: 1px dotted #cc0000;
  3 + background-image: url('../images/flash.gif');
  4 + background-position: center;
  5 + background-repeat: no-repeat;
  6 + background-color: #ffffcc;
  7 +}
public/javascripts/tiny_mce/plugins/flash/css/flash.css 0 → 100755
@@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
  1 +.panel_wrapper div.current {
  2 + height: 100px;
  3 +}
  4 +
  5 +#width, #height {
  6 + width: 50px;
  7 +}
  8 +
  9 +#file {
  10 + width: 250px;
  11 +}
public/javascripts/tiny_mce/plugins/flash/editor_plugin.js 0 → 100755
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +tinyMCE.importPluginLanguagePack('flash');var TinyMCE_FlashPlugin={getInfo:function(){return{longname:'Flash',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/flash',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},initInstance:function(inst){if(!tinyMCE.settings['flash_skip_plugin_css'])tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/plugins/flash/css/content.css")},getControlHTML:function(cn){switch(cn){case"flash":return tinyMCE.getButtonHTML(cn,'lang_flash_desc','{$pluginurl}/images/flash.gif','mceFlash')}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceFlash":var name="",swffile="",swfwidth="",swfheight="",action="insert";var template=new Array();var inst=tinyMCE.getInstanceById(editor_id);var focusElm=inst.getFocusElement();template['file']='../../plugins/flash/flash.htm';template['width']=430;template['height']=175;template['width']+=tinyMCE.getLang('lang_flash_delta_width',0);template['height']+=tinyMCE.getLang('lang_flash_delta_height',0);if(focusElm!=null&&focusElm.nodeName.toLowerCase()=="img"){name=tinyMCE.getAttrib(focusElm,'class');if(name.indexOf('mceItemFlash')==-1)return true;swffile=tinyMCE.getAttrib(focusElm,'alt');if(tinyMCE.getParam('convert_urls'))swffile=eval(tinyMCE.settings['urlconverter_callback']+"(swffile, null, true);");swfwidth=tinyMCE.getAttrib(focusElm,'width');swfheight=tinyMCE.getAttrib(focusElm,'height');action="update"}tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",swffile:swffile,swfwidth:swfwidth,swfheight:swfheight,action:action});return true}return false},cleanup:function(type,content){switch(type){case"insert_to_editor_dom":if(tinyMCE.getParam('convert_urls')){var imgs=content.getElementsByTagName("img");for(var i=0;i<imgs.length;i++){if(tinyMCE.getAttrib(imgs[i],"class")=="mceItemFlash"){var src=tinyMCE.getAttrib(imgs[i],"alt");if(tinyMCE.getParam('convert_urls'))src=eval(tinyMCE.settings['urlconverter_callback']+"(src, null, true);");imgs[i].setAttribute('alt',src);imgs[i].setAttribute('title',src)}}}break;case"get_from_editor_dom":var imgs=content.getElementsByTagName("img");for(var i=0;i<imgs.length;i++){if(tinyMCE.getAttrib(imgs[i],"class")=="mceItemFlash"){var src=tinyMCE.getAttrib(imgs[i],"alt");if(tinyMCE.getParam('convert_urls'))src=eval(tinyMCE.settings['urlconverter_callback']+"(src, null, true);");imgs[i].setAttribute('alt',src);imgs[i].setAttribute('title',src)}}break;case"insert_to_editor":var startPos=0;var embedList=new Array();content=content.replace(new RegExp('<[ ]*embed','gi'),'<embed');content=content.replace(new RegExp('<[ ]*/embed[ ]*>','gi'),'</embed>');content=content.replace(new RegExp('<[ ]*object','gi'),'<object');content=content.replace(new RegExp('<[ ]*/object[ ]*>','gi'),'</object>');while((startPos=content.indexOf('<embed',startPos+1))!=-1){var endPos=content.indexOf('>',startPos);var attribs=TinyMCE_FlashPlugin._parseAttributes(content.substring(startPos+6,endPos));embedList[embedList.length]=attribs}var index=0;while((startPos=content.indexOf('<object',startPos))!=-1){if(index>=embedList.length)break;var attribs=embedList[index];endPos=content.indexOf('</object>',startPos);endPos+=9;var contentAfter=content.substring(endPos);content=content.substring(0,startPos);content+='<img width="'+attribs["width"]+'" height="'+attribs["height"]+'"';content+=' src="'+(tinyMCE.getParam("theme_href")+'/images/spacer.gif')+'" title="'+attribs["src"]+'"';content+=' alt="'+attribs["src"]+'" class="mceItemFlash" />'+content.substring(endPos);content+=contentAfter;index++;startPos++}var index=0;while((startPos=content.indexOf('<embed',startPos))!=-1){if(index>=embedList.length)break;var attribs=embedList[index];endPos=content.indexOf('>',startPos);endPos+=9;var contentAfter=content.substring(endPos);content=content.substring(0,startPos);content+='<img width="'+attribs["width"]+'" height="'+attribs["height"]+'"';content+=' src="'+(tinyMCE.getParam("theme_href")+'/images/spacer.gif')+'" title="'+attribs["src"]+'"';content+=' alt="'+attribs["src"]+'" class="mceItemFlash" />'+content.substring(endPos);content+=contentAfter;index++;startPos++}break;case"get_from_editor":var startPos=-1;while((startPos=content.indexOf('<img',startPos+1))!=-1){var endPos=content.indexOf('/>',startPos);var attribs=TinyMCE_FlashPlugin._parseAttributes(content.substring(startPos+4,endPos));if(attribs['class']!="mceItemFlash")continue;endPos+=2;var embedHTML='';var wmode=tinyMCE.getParam("flash_wmode","");var quality=tinyMCE.getParam("flash_quality","high");var menu=tinyMCE.getParam("flash_menu","false");embedHTML+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';embedHTML+=' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"';embedHTML+=' width="'+attribs["width"]+'" height="'+attribs["height"]+'">';embedHTML+='<param name="movie" value="'+attribs["title"]+'" />';embedHTML+='<param name="quality" value="'+quality+'" />';embedHTML+='<param name="menu" value="'+menu+'" />';embedHTML+='<param name="wmode" value="'+wmode+'" />';embedHTML+='<embed src="'+attribs["title"]+'" wmode="'+wmode+'" quality="'+quality+'" menu="'+menu+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+attribs["width"]+'" height="'+attribs["height"]+'"></embed></object>';chunkBefore=content.substring(0,startPos);chunkAfter=content.substring(endPos);content=chunkBefore+embedHTML+chunkAfter}break}return content},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){if(node==null)return;do{if(node.nodeName=="IMG"&&tinyMCE.getAttrib(node,'class').indexOf('mceItemFlash')==0){tinyMCE.switchClass(editor_id+'_flash','mceButtonSelected');return true}}while((node=node.parentNode));tinyMCE.switchClass(editor_id+'_flash','mceButtonNormal');return true},_parseAttributes:function(attribute_string){var attributeName="";var attributeValue="";var withInName;var withInValue;var attributes=new Array();var whiteSpaceRegExp=new RegExp('^[ \n\r\t]+','g');if(attribute_string==null||attribute_string.length<2)return null;withInName=withInValue=false;for(var i=0;i<attribute_string.length;i++){var chr=attribute_string.charAt(i);if((chr=='"'||chr=="'")&&!withInValue)withInValue=true;else if((chr=='"'||chr=="'")&&withInValue){withInValue=false;var pos=attributeName.lastIndexOf(' ');if(pos!=-1)attributeName=attributeName.substring(pos+1);attributes[attributeName.toLowerCase()]=attributeValue.substring(1);attributeName="";attributeValue=""}else if(!whiteSpaceRegExp.test(chr)&&!withInName&&!withInValue)withInName=true;if(chr=='='&&withInName)withInName=false;if(withInName)attributeName+=chr;if(withInValue)attributeValue+=chr}return attributes}};tinyMCE.addPlugin("flash",TinyMCE_FlashPlugin);
0 \ No newline at end of file 2 \ No newline at end of file
public/javascripts/tiny_mce/plugins/flash/editor_plugin_src.js 0 → 100755
@@ -0,0 +1,285 @@ @@ -0,0 +1,285 @@
  1 +/**
  2 + * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
  3 + *
  4 + * @author Moxiecode
  5 + * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
  6 + */
  7 +
  8 +/* Import plugin specific language pack */
  9 +tinyMCE.importPluginLanguagePack('flash');
  10 +
  11 +var TinyMCE_FlashPlugin = {
  12 + getInfo : function() {
  13 + return {
  14 + longname : 'Flash',
  15 + author : 'Moxiecode Systems AB',
  16 + authorurl : 'http://tinymce.moxiecode.com',
  17 + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/flash',
  18 + version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
  19 + };
  20 + },
  21 +
  22 + initInstance : function(inst) {
  23 + if (!tinyMCE.settings['flash_skip_plugin_css'])
  24 + tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/flash/css/content.css");
  25 + },
  26 +
  27 + getControlHTML : function(cn) {
  28 + switch (cn) {
  29 + case "flash":
  30 + return tinyMCE.getButtonHTML(cn, 'lang_flash_desc', '{$pluginurl}/images/flash.gif', 'mceFlash');
  31 + }
  32 +
  33 + return "";
  34 + },
  35 +
  36 + execCommand : function(editor_id, element, command, user_interface, value) {
  37 + // Handle commands
  38 + switch (command) {
  39 + case "mceFlash":
  40 + var name = "", swffile = "", swfwidth = "", swfheight = "", action = "insert";
  41 + var template = new Array();
  42 + var inst = tinyMCE.getInstanceById(editor_id);
  43 + var focusElm = inst.getFocusElement();
  44 +
  45 + template['file'] = '../../plugins/flash/flash.htm'; // Relative to theme
  46 + template['width'] = 430;
  47 + template['height'] = 175;
  48 +
  49 + template['width'] += tinyMCE.getLang('lang_flash_delta_width', 0);
  50 + template['height'] += tinyMCE.getLang('lang_flash_delta_height', 0);
  51 +
  52 + // Is selection a image
  53 + if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
  54 + name = tinyMCE.getAttrib(focusElm, 'class');
  55 +
  56 + if (name.indexOf('mceItemFlash') == -1) // Not a Flash
  57 + return true;
  58 +
  59 + // Get rest of Flash items
  60 + swffile = tinyMCE.getAttrib(focusElm, 'alt');
  61 +
  62 + if (tinyMCE.getParam('convert_urls'))
  63 + swffile = eval(tinyMCE.settings['urlconverter_callback'] + "(swffile, null, true);");
  64 +
  65 + swfwidth = tinyMCE.getAttrib(focusElm, 'width');
  66 + swfheight = tinyMCE.getAttrib(focusElm, 'height');
  67 + action = "update";
  68 + }
  69 +
  70 + tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", swffile : swffile, swfwidth : swfwidth, swfheight : swfheight, action : action});
  71 + return true;
  72 + }
  73 +
  74 + // Pass to next handler in chain
  75 + return false;
  76 + },
  77 +
  78 + cleanup : function(type, content) {
  79 + switch (type) {
  80 + case "insert_to_editor_dom":
  81 + // Force relative/absolute
  82 + if (tinyMCE.getParam('convert_urls')) {
  83 + var imgs = content.getElementsByTagName("img");
  84 + for (var i=0; i<imgs.length; i++) {
  85 + if (tinyMCE.getAttrib(imgs[i], "class") == "mceItemFlash") {
  86 + var src = tinyMCE.getAttrib(imgs[i], "alt");
  87 +
  88 + if (tinyMCE.getParam('convert_urls'))
  89 + src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, null, true);");
  90 +
  91 + imgs[i].setAttribute('alt', src);
  92 + imgs[i].setAttribute('title', src);
  93 + }
  94 + }
  95 + }
  96 + break;
  97 +
  98 + case "get_from_editor_dom":
  99 + var imgs = content.getElementsByTagName("img");
  100 + for (var i=0; i<imgs.length; i++) {
  101 + if (tinyMCE.getAttrib(imgs[i], "class") == "mceItemFlash") {
  102 + var src = tinyMCE.getAttrib(imgs[i], "alt");
  103 +
  104 + if (tinyMCE.getParam('convert_urls'))
  105 + src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, null, true);");
  106 +
  107 + imgs[i].setAttribute('alt', src);
  108 + imgs[i].setAttribute('title', src);
  109 + }
  110 + }
  111 + break;
  112 +
  113 + case "insert_to_editor":
  114 + var startPos = 0;
  115 + var embedList = new Array();
  116 +
  117 + // Fix the embed and object elements
  118 + content = content.replace(new RegExp('<[ ]*embed','gi'),'<embed');
  119 + content = content.replace(new RegExp('<[ ]*/embed[ ]*>','gi'),'</embed>');
  120 + content = content.replace(new RegExp('<[ ]*object','gi'),'<object');
  121 + content = content.replace(new RegExp('<[ ]*/object[ ]*>','gi'),'</object>');
  122 +
  123 + // Parse all embed tags
  124 + while ((startPos = content.indexOf('<embed', startPos+1)) != -1) {
  125 + var endPos = content.indexOf('>', startPos);
  126 + var attribs = TinyMCE_FlashPlugin._parseAttributes(content.substring(startPos + 6, endPos));
  127 + embedList[embedList.length] = attribs;
  128 + }
  129 +
  130 + // Parse all object tags and replace them with images from the embed data
  131 + var index = 0;
  132 + while ((startPos = content.indexOf('<object', startPos)) != -1) {
  133 + if (index >= embedList.length)
  134 + break;
  135 +
  136 + var attribs = embedList[index];
  137 +
  138 + // Find end of object
  139 + endPos = content.indexOf('</object>', startPos);
  140 + endPos += 9;
  141 +
  142 + // Insert image
  143 + var contentAfter = content.substring(endPos);
  144 + content = content.substring(0, startPos);
  145 + content += '<img width="' + attribs["width"] + '" height="' + attribs["height"] + '"';
  146 + content += ' src="' + (tinyMCE.getParam("theme_href") + '/images/spacer.gif') + '" title="' + attribs["src"] + '"';
  147 + content += ' alt="' + attribs["src"] + '" class="mceItemFlash" />' + content.substring(endPos);
  148 + content += contentAfter;
  149 + index++;
  150 +
  151 + startPos++;
  152 + }
  153 +
  154 + // Parse all embed tags and replace them with images from the embed data
  155 + var index = 0;
  156 + while ((startPos = content.indexOf('<embed', startPos)) != -1) {
  157 + if (index >= embedList.length)
  158 + break;
  159 +
  160 + var attribs = embedList[index];
  161 +
  162 + // Find end of embed
  163 + endPos = content.indexOf('>', startPos);
  164 + endPos += 9;
  165 +
  166 + // Insert image
  167 + var contentAfter = content.substring(endPos);
  168 + content = content.substring(0, startPos);
  169 + content += '<img width="' + attribs["width"] + '" height="' + attribs["height"] + '"';
  170 + content += ' src="' + (tinyMCE.getParam("theme_href") + '/images/spacer.gif') + '" title="' + attribs["src"] + '"';
  171 + content += ' alt="' + attribs["src"] + '" class="mceItemFlash" />' + content.substring(endPos);
  172 + content += contentAfter;
  173 + index++;
  174 +
  175 + startPos++;
  176 + }
  177 +
  178 + break;
  179 +
  180 + case "get_from_editor":
  181 + // Parse all img tags and replace them with object+embed
  182 + var startPos = -1;
  183 +
  184 + while ((startPos = content.indexOf('<img', startPos+1)) != -1) {
  185 + var endPos = content.indexOf('/>', startPos);
  186 + var attribs = TinyMCE_FlashPlugin._parseAttributes(content.substring(startPos + 4, endPos));
  187 +
  188 + // Is not flash, skip it
  189 + if (attribs['class'] != "mceItemFlash")
  190 + continue;
  191 +
  192 + endPos += 2;
  193 +
  194 + var embedHTML = '';
  195 + var wmode = tinyMCE.getParam("flash_wmode", "");
  196 + var quality = tinyMCE.getParam("flash_quality", "high");
  197 + var menu = tinyMCE.getParam("flash_menu", "false");
  198 +
  199 + // Insert object + embed
  200 + embedHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
  201 + embedHTML += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"';
  202 + embedHTML += ' width="' + attribs["width"] + '" height="' + attribs["height"] + '">';
  203 + embedHTML += '<param name="movie" value="' + attribs["title"] + '" />';
  204 + embedHTML += '<param name="quality" value="' + quality + '" />';
  205 + embedHTML += '<param name="menu" value="' + menu + '" />';
  206 + embedHTML += '<param name="wmode" value="' + wmode + '" />';
  207 + embedHTML += '<embed src="' + attribs["title"] + '" wmode="' + wmode + '" quality="' + quality + '" menu="' + menu + '" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + attribs["width"] + '" height="' + attribs["height"] + '"></embed></object>';
  208 +
  209 + // Insert embed/object chunk
  210 + chunkBefore = content.substring(0, startPos);
  211 + chunkAfter = content.substring(endPos);
  212 + content = chunkBefore + embedHTML + chunkAfter;
  213 + }
  214 + break;
  215 + }
  216 +
  217 + // Pass through to next handler in chain
  218 + return content;
  219 + },
  220 +
  221 + handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
  222 + if (node == null)
  223 + return;
  224 +
  225 + do {
  226 + if (node.nodeName == "IMG" && tinyMCE.getAttrib(node, 'class').indexOf('mceItemFlash') == 0) {
  227 + tinyMCE.switchClass(editor_id + '_flash', 'mceButtonSelected');
  228 + return true;
  229 + }
  230 + } while ((node = node.parentNode));
  231 +
  232 + tinyMCE.switchClass(editor_id + '_flash', 'mceButtonNormal');
  233 +
  234 + return true;
  235 + },
  236 +
  237 + // Private plugin internal functions
  238 +
  239 + _parseAttributes : function(attribute_string) {
  240 + var attributeName = "";
  241 + var attributeValue = "";
  242 + var withInName;
  243 + var withInValue;
  244 + var attributes = new Array();
  245 + var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');
  246 +
  247 + if (attribute_string == null || attribute_string.length < 2)
  248 + return null;
  249 +
  250 + withInName = withInValue = false;
  251 +
  252 + for (var i=0; i<attribute_string.length; i++) {
  253 + var chr = attribute_string.charAt(i);
  254 +
  255 + if ((chr == '"' || chr == "'") && !withInValue)
  256 + withInValue = true;
  257 + else if ((chr == '"' || chr == "'") && withInValue) {
  258 + withInValue = false;
  259 +
  260 + var pos = attributeName.lastIndexOf(' ');
  261 + if (pos != -1)
  262 + attributeName = attributeName.substring(pos+1);
  263 +
  264 + attributes[attributeName.toLowerCase()] = attributeValue.substring(1);
  265 +
  266 + attributeName = "";
  267 + attributeValue = "";
  268 + } else if (!whiteSpaceRegExp.test(chr) && !withInName && !withInValue)
  269 + withInName = true;
  270 +
  271 + if (chr == '=' && withInName)
  272 + withInName = false;
  273 +
  274 + if (withInName)
  275 + attributeName += chr;
  276 +
  277 + if (withInValue)
  278 + attributeValue += chr;
  279 + }
  280 +
  281 + return attributes;
  282 + }
  283 +};
  284 +
  285 +tinyMCE.addPlugin("flash", TinyMCE_FlashPlugin);
public/javascripts/tiny_mce/plugins/flash/flash.htm 0 → 100755
@@ -0,0 +1,70 @@ @@ -0,0 +1,70 @@
  1 +<html xmlns="http://www.w3.org/1999/xhtml">
  2 +<head>
  3 + <title>{$lang_flash_title}</title>
  4 + <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
  5 + <script language="javascript" type="text/javascript" src="jscripts/flash.js"></script>
  6 + <script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
  7 + <script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
  8 + <link href="css/flash.css" rel="stylesheet" type="text/css" />
  9 + <base target="_self" />
  10 +</head>
  11 +<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
  12 + <form onsubmit="insertFlash();return false;" action="#">
  13 + <div class="tabs">
  14 + <ul>
  15 + <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_flash_general}</a></span></li>
  16 + </ul>
  17 + </div>
  18 +
  19 + <div class="panel_wrapper">
  20 + <div id="general_panel" class="panel current">
  21 + <fieldset>
  22 + <legend>{$lang_flash_general}</legend>
  23 +
  24 + <table border="0" cellpadding="4" cellspacing="0">
  25 + <tr>
  26 + <td nowrap="nowrap"><label for="file">{$lang_flash_file}</label></td>
  27 + <td nowrap="nowrap">
  28 + <table border="0" cellspacing="0" cellpadding="0">
  29 + <tr>
  30 + <td><input id="file" name="file" type="text" value="" onfocus="this.select();" /></td>
  31 + <td id="filebrowsercontainer">&nbsp;</td>
  32 + </tr>
  33 + </table>
  34 + </td>
  35 + </tr>
  36 + <tr id="linklistrow">
  37 + <td><label for="linklist">{$lang_flash_list}</label></td>
  38 + <td id="linklistcontainer">&nbsp;</td>
  39 + </tr>
  40 + <tr>
  41 + <td nowrap="nowrap"><label>{$lang_flash_size}</label></td>
  42 + <td nowrap="nowrap">
  43 + <input type="text" id="width" name="width" value="" onfocus="this.select();" />
  44 + <select name="width2" id="width2" style="width: 50px">
  45 + <option value="">px</option>
  46 + <option value="%">%</option>
  47 + </select>&nbsp;x&nbsp;<input id="height" name="height" type="text" value="" onfocus="this.select();" />
  48 + <select name="height2" id="height2" style="width: 50px">
  49 + <option value="">px</option>
  50 + <option value="%">%</option>
  51 + </select>
  52 + </td>
  53 + </tr>
  54 + </table>
  55 + </fieldset>
  56 + </div>
  57 + </div>
  58 +
  59 + <div class="mceActionPanel">
  60 + <div style="float: left">
  61 + <input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertFlash();" />
  62 + </div>
  63 +
  64 + <div style="float: right">
  65 + <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
  66 + </div>
  67 + </div>
  68 + </form>
  69 +</body>
  70 +</html>
public/javascripts/tiny_mce/plugins/flash/images/flash.gif 0 → 100755

241 Bytes

public/javascripts/tiny_mce/plugins/flash/jscripts/flash.js 0 → 100755
@@ -0,0 +1,107 @@ @@ -0,0 +1,107 @@
  1 +var url = tinyMCE.getParam("flash_external_list_url");
  2 +if (url != null) {
  3 + // Fix relative
  4 + if (url.charAt(0) != '/' && url.indexOf('://') == -1)
  5 + url = tinyMCE.documentBasePath + "/" + url;
  6 +
  7 + document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>');
  8 +}
  9 +
  10 +function init() {
  11 + tinyMCEPopup.resizeToInnerSize();
  12 +
  13 + document.getElementById("filebrowsercontainer").innerHTML = getBrowserHTML('filebrowser','file','flash','flash');
  14 +
  15 + // Image list outsrc
  16 + var html = getFlashListHTML('filebrowser','file','flash','flash');
  17 + if (html == "")
  18 + document.getElementById("linklistrow").style.display = 'none';
  19 + else
  20 + document.getElementById("linklistcontainer").innerHTML = html;
  21 +
  22 + var formObj = document.forms[0];
  23 + var swffile = tinyMCE.getWindowArg('swffile');
  24 + var swfwidth = '' + tinyMCE.getWindowArg('swfwidth');
  25 + var swfheight = '' + tinyMCE.getWindowArg('swfheight');
  26 +
  27 + if (swfwidth.indexOf('%')!=-1) {
  28 + formObj.width2.value = "%";
  29 + formObj.width.value = swfwidth.substring(0,swfwidth.length-1);
  30 + } else {
  31 + formObj.width2.value = "px";
  32 + formObj.width.value = swfwidth;
  33 + }
  34 +
  35 + if (swfheight.indexOf('%')!=-1) {
  36 + formObj.height2.value = "%";
  37 + formObj.height.value = swfheight.substring(0,swfheight.length-1);
  38 + } else {
  39 + formObj.height2.value = "px";
  40 + formObj.height.value = swfheight;
  41 + }
  42 +
  43 + formObj.file.value = swffile;
  44 + formObj.insert.value = tinyMCE.getLang('lang_' + tinyMCE.getWindowArg('action'), 'Insert', true);
  45 +
  46 + selectByValue(formObj, 'linklist', swffile);
  47 +
  48 + // Handle file browser
  49 + if (isVisible('filebrowser'))
  50 + document.getElementById('file').style.width = '230px';
  51 +
  52 + // Auto select flash in list
  53 + if (typeof(tinyMCEFlashList) != "undefined" && tinyMCEFlashList.length > 0) {
  54 + for (var i=0; i<formObj.linklist.length; i++) {
  55 + if (formObj.linklist.options[i].value == tinyMCE.getWindowArg('swffile'))
  56 + formObj.linklist.options[i].selected = true;
  57 + }
  58 + }
  59 +}
  60 +
  61 +function getFlashListHTML() {
  62 + if (typeof(tinyMCEFlashList) != "undefined" && tinyMCEFlashList.length > 0) {
  63 + var html = "";
  64 +
  65 + html += '<select id="linklist" name="linklist" style="width: 250px" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.file.value=this.options[this.selectedIndex].value;">';
  66 + html += '<option value="">---</option>';
  67 +
  68 + for (var i=0; i<tinyMCEFlashList.length; i++)
  69 + html += '<option value="' + tinyMCEFlashList[i][1] + '">' + tinyMCEFlashList[i][0] + '</option>';
  70 +
  71 + html += '</select>';
  72 +
  73 + return html;
  74 + }
  75 +
  76 + return "";
  77 +}
  78 +
  79 +function insertFlash() {
  80 + var formObj = document.forms[0];
  81 + var html = '';
  82 + var file = formObj.file.value;
  83 + var width = formObj.width.value;
  84 + var height = formObj.height.value;
  85 + if (formObj.width2.value=='%') {
  86 + width = width + '%';
  87 + }
  88 + if (formObj.height2.value=='%') {
  89 + height = height + '%';
  90 + }
  91 +
  92 + if (width == "")
  93 + width = 100;
  94 +
  95 + if (height == "")
  96 + height = 100;
  97 +
  98 + html += ''
  99 + + '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" mce_src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
  100 + + 'width="' + width + '" height="' + height + '" '
  101 + + 'border="0" alt="' + file + '" title="' + file + '" class="mceItemFlash" />';
  102 +
  103 + tinyMCEPopup.execCommand("mceInsertContent", true, html);
  104 + tinyMCE.selectedInstance.repaint();
  105 +
  106 + tinyMCEPopup.close();
  107 +}
public/javascripts/tiny_mce/plugins/flash/langs/en.js 0 → 100755
@@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
  1 +// UK lang variables
  2 +
  3 +tinyMCE.addToLang('flash',{
  4 +title : 'Insert / edit Flash Movie',
  5 +desc : 'Insert / edit Flash Movie',
  6 +file : 'Flash-File (.swf)',
  7 +size : 'Size',
  8 +list : 'Flash files',
  9 +props : 'Flash properties',
  10 +general : 'General'
  11 +});
public/javascripts/tiny_mce/plugins/flash/readme.txt 0 → 100755
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +Check the TinyMCE documentation for details on this plugin.
public/javascripts/tiny_mce/plugins/fullpage/blank.htm 0 → 100755
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +<html xmlns="http://www.w3.org/1999/xhtml">
  2 +<head>
  3 + <title>blank_page</title>
  4 + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5 +</head>
  6 +<body onload="parent.setupIframe(document);">
  7 +
  8 +</body>
  9 +</html>
public/javascripts/tiny_mce/plugins/fullpage/css/fullpage.css 0 → 100755
@@ -0,0 +1,176 @@ @@ -0,0 +1,176 @@
  1 +/* Hide the advanced tab */
  2 +#advanced_tab {
  3 + display: none;
  4 +}
  5 +
  6 +#metatitle, #metakeywords, #metadescription, #metaauthor, #metacopyright {
  7 + width: 280px;
  8 +}
  9 +
  10 +#doctype, #docencoding {
  11 + width: 200px;
  12 +}
  13 +
  14 +#langcode {
  15 + width: 30px;
  16 +}
  17 +
  18 +#bgimage {
  19 + width: 220px;
  20 +}
  21 +
  22 +#fontface {
  23 + width: 240px;
  24 +}
  25 +
  26 +#leftmargin, #rightmargin, #topmargin, #bottommargin {
  27 + width: 50px;
  28 +}
  29 +
  30 +.panel_wrapper div.current {
  31 + height: 400px;
  32 +}
  33 +
  34 +#stylesheet, #style {
  35 + width: 240px;
  36 +}
  37 +
  38 +/* Head list classes */
  39 +
  40 +.headlistwrapper {
  41 + width: 100%;
  42 +}
  43 +
  44 +.addbutton, .removebutton, .moveupbutton, .movedownbutton {
  45 + border-top: 1px solid;
  46 + border-left: 1px solid;
  47 + border-bottom: 1px solid;
  48 + border-right: 1px solid;
  49 + border-color: #F0F0EE;
  50 + cursor: default;
  51 + display: block;
  52 + width: 20px;
  53 + height: 20px;
  54 +}
  55 +
  56 +.addbutton:hover, .removebutton:hover, .moveupbutton:hover, .movedownbutton:hover {
  57 + border: 1px solid #0A246A;
  58 + background-color: #B6BDD2;
  59 +}
  60 +
  61 +.addbutton {
  62 + background-image: url('../images/add.gif');
  63 + float: left;
  64 + margin-right: 3px;
  65 +}
  66 +
  67 +.removebutton {
  68 + background-image: url('../images/remove.gif');
  69 + float: left;
  70 +}
  71 +
  72 +.moveupbutton {
  73 + background-image: url('../images/move_up.gif');
  74 + float: left;
  75 + margin-right: 3px;
  76 +}
  77 +
  78 +.movedownbutton {
  79 + background-image: url('../images/move_down.gif');
  80 + float: left;
  81 +}
  82 +
  83 +.selected {
  84 + border: 1px solid #0A246A;
  85 + background-color: #B6BDD2;
  86 +}
  87 +
  88 +.toolbar {
  89 + width: 100%;
  90 +}
  91 +
  92 +#headlist {
  93 + width: 100%;
  94 + margin-top: 3px;
  95 + font-size: 11px;
  96 +}
  97 +
  98 +#info, #title_element, #meta_element, #script_element, #style_element, #base_element, #link_element, #comment_element, #unknown_element {
  99 + display: none;
  100 +}
  101 +
  102 +#addmenu {
  103 + position: absolute;
  104 + border: 1px solid gray;
  105 + display: none;
  106 + z-index: 100;
  107 + background-color: white;
  108 +}
  109 +
  110 +#addmenu a {
  111 + display: block;
  112 + width: 100%;
  113 + line-height: 20px;
  114 + text-decoration: none;
  115 + background-color: white;
  116 +}
  117 +
  118 +#addmenu a:hover {
  119 + background-color: #B6BDD2;
  120 + color: black;
  121 +}
  122 +
  123 +#addmenu span {
  124 + padding-left: 10px;
  125 + padding-right: 10px;
  126 +}
  127 +
  128 +#updateElementPanel {
  129 + display: none;
  130 +}
  131 +
  132 +#script_element .panel_wrapper div.current {
  133 + height: 108px;
  134 +}
  135 +
  136 +#style_element .panel_wrapper div.current {
  137 + height: 108px;
  138 +}
  139 +
  140 +#link_element .panel_wrapper div.current {
  141 + height: 140px;
  142 +}
  143 +
  144 +#element_script_value {
  145 + width: 100%;
  146 + height: 100px;
  147 +}
  148 +
  149 +#element_comment_value {
  150 + width: 100%;
  151 + height: 120px;
  152 +}
  153 +
  154 +#element_style_value {
  155 + width: 100%;
  156 + height: 100px;
  157 +}
  158 +
  159 +#element_title, #element_script_src, #element_meta_name, #element_meta_content, #element_base_href, #element_link_href, #element_link_title {
  160 + width: 250px;
  161 +}
  162 +
  163 +.updateElementButton {
  164 + margin-top: 3px;
  165 +}
  166 +
  167 +/* MSIE specific styles */
  168 +
  169 +* html .addbutton, * html .removebutton, * html .moveupbutton, * html .movedownbutton {
  170 + width: 22px;
  171 + height: 22px;
  172 +}
  173 +
  174 +textarea {
  175 + height: 55px;
  176 +}
0 \ No newline at end of file 177 \ No newline at end of file
public/javascripts/tiny_mce/plugins/fullpage/editor_plugin.js 0 → 100755
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +tinyMCE.importPluginLanguagePack('fullpage');var TinyMCE_FullPagePlugin={getInfo:function(){return{longname:'Fullpage',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},getControlHTML:function(cn){switch(cn){case"fullpage":return tinyMCE.getButtonHTML(cn,'lang_fullpage_desc','{$pluginurl}/images/fullpage.gif','mceFullPageProperties')}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceFullPageProperties":var template=new Array();template['file']='../../plugins/fullpage/fullpage.htm';template['width']=430;template['height']=485+(tinyMCE.isOpera?5:0);template['width']+=tinyMCE.getLang('lang_fullpage_delta_width',0);template['height']+=tinyMCE.getLang('lang_fullpage_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case"mceFullPageUpdate":TinyMCE_FullPagePlugin._addToHead(tinyMCE.getInstanceById(editor_id));return true}return false},cleanup:function(type,content,inst){switch(type){case"insert_to_editor":var tmp=content.toLowerCase();var pos=tmp.indexOf('<body'),pos2;if(pos!=-1){pos=tmp.indexOf('>',pos);pos2=tmp.lastIndexOf('</body>');inst.fullpageTopContent=content.substring(0,pos+1);content=content.substring(pos+1,pos2);}else{if(!inst.fullpageTopContent){var docType=tinyMCE.getParam("fullpage_default_doctype",'<!DOCTYPE html PUBLIC "-/'+'/W3C//DTD XHTML 1.0 Transitional/'+'/EN" "http:/'+'/www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');var enc=tinyMCE.getParam("fullpage_default_encoding",'utf-8');var title=tinyMCE.getParam("fullpage_default_title",'Untitled document');var lang=tinyMCE.getParam("fullpage_default_langcode",'en');var pi=tinyMCE.getParam("fullpage_default_xml_pi",true);var ff=tinyMCE.getParam("fullpage_default_font_family","");var fz=tinyMCE.getParam("fullpage_default_font_size","");var ds=tinyMCE.getParam("fullpage_default_style","");var dtc=tinyMCE.getParam("fullpage_default_text_color","");title=title.replace(/&/g,'&amp;');title=title.replace(/\"/g,'&quot;');title=title.replace(/</g,'&lt;');title=title.replace(/>/g,'&gt;');tmp='';if(pi)tmp+='<?xml version="1.0" encoding="'+enc+'"?>\n';tmp+=docType+'\n';tmp+='<html xmlns="http:/'+'/www.w3.org/1999/xhtml" lang="'+lang+'" xml:lang="'+lang+'">\n';tmp+='<head>\n';tmp+='\t<title>'+title+'</title>\n';tmp+='\t<meta http-equiv="Content-Type" content="text/html; charset='+enc+'" />\n';tmp+='</head>\n';tmp+='<body';if(ff!=''||fz!=''){tmp+=' style="';if(ds!='')tmp+=ds+";";if(ff!='')tmp+='font-family: '+ff+";";if(fz!='')tmp+='font-size: '+fz+";";tmp+='"'}if(dtc!='')tmp+=' text="'+dtc+'"';tmp+='>\n';inst.fullpageTopContent=tmp}}this._addToHead(inst);break;case"get_from_editor":if(inst.fullpageTopContent&&!tinyMCE.getParam("fullpage_hide_in_source_view",false)){content=content.replace(/(\s)?mce\_[a-z_]+\=[^\s>]+(\s|\>)/i,'');content=inst.fullpageTopContent+content+"\n</body>\n</html>"}break;case"submit_content":if(inst.fullpageTopContent&&tinyMCE.getParam("fullpage_hide_in_source_view",false))content=inst.fullpageTopContent+content+"\n</body>\n</html>";break}return content},_addToHead:function(inst){var doc=inst.getDoc();var head=doc.getElementsByTagName("head")[0];var body=doc.body;var h=inst.fullpageTopContent;var e=doc.createElement("body");var nl,i,le,tmp;h=h.replace(/(\r|\n)/gi,'');h=h.replace(/<\?[^\>]*\>/gi,'');h=h.replace(/<\/?(!DOCTYPE|head|html)[^\>]*\>/gi,'');h=h.replace(/<script(.*?)<\/script>/gi,'');h=h.replace(/<title(.*?)<\/title>/gi,'');h=h.replace(/<(meta|base)[^>]*>/gi,'');h=h.replace(/<link([^>]*)\/>/gi,'<pre mce_type="link" $1></pre>');h=h.replace(/<body/gi,'<div mce_type="body"');h+='</div>';e.innerHTML=h;body.vLink=body.aLink=body.link=body.text='';body.style.cssText='';nl=head.getElementsByTagName('link');for(i=0;i<nl.length;i++){if(tinyMCE.getAttrib(nl[i],'mce_head')=="true")nl[i].parentNode.removeChild(nl[i])}nl=e.getElementsByTagName('pre');for(i=0;i<nl.length;i++){tmp=tinyMCE.getAttrib(nl[i],'media');if(tinyMCE.getAttrib(nl[i],'mce_type')=="link"&&(tmp==""||tmp=="screen"||tmp=="all")&&tinyMCE.getAttrib(nl[i],'rel')=="stylesheet"){le=doc.createElement("link");le.rel="stylesheet";le.href=tinyMCE.getAttrib(nl[i],'href');le.setAttribute("mce_head","true");head.appendChild(le)}}nl=e.getElementsByTagName('div');if(nl.length>0){body.style.cssText=tinyMCE.getAttrib(nl[0],'style');if((tmp=tinyMCE.getAttrib(nl[0],'leftmargin'))!=''&&body.style.marginLeft=='')body.style.marginLeft=tmp+"px";if((tmp=tinyMCE.getAttrib(nl[0],'rightmargin'))!=''&&body.style.marginRight=='')body.style.marginRight=tmp+"px";if((tmp=tinyMCE.getAttrib(nl[0],'topmargin'))!=''&&body.style.marginTop=='')body.style.marginTop=tmp+"px";if((tmp=tinyMCE.getAttrib(nl[0],'bottommargin'))!=''&&body.style.marginBottom=='')body.style.marginBottom=tmp+"px";body.dir=tinyMCE.getAttrib(nl[0],'dir');body.vLink=tinyMCE.getAttrib(nl[0],'vlink');body.aLink=tinyMCE.getAttrib(nl[0],'alink');body.link=tinyMCE.getAttrib(nl[0],'link');body.text=tinyMCE.getAttrib(nl[0],'text');if((tmp=tinyMCE.getAttrib(nl[0],'background'))!='')body.style.backgroundImage="url('"+tmp+"')";if((tmp=tinyMCE.getAttrib(nl[0],'bgcolor'))!='')body.style.backgroundColor=tmp}}};tinyMCE.addPlugin("fullpage",TinyMCE_FullPagePlugin);
0 \ No newline at end of file 2 \ No newline at end of file
public/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js 0 → 100755
@@ -0,0 +1,235 @@ @@ -0,0 +1,235 @@
  1 +/**
  2 + * $Id: editor_plugin_src.js 232 2007-03-05 17:00:27Z spocke $
  3 + *
  4 + * @author Moxiecode
  5 + * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
  6 + */
  7 +
  8 +/* Import plugin specific language pack */
  9 +tinyMCE.importPluginLanguagePack('fullpage');
  10 +
  11 +var TinyMCE_FullPagePlugin = {
  12 + getInfo : function() {
  13 + return {
  14 + longname : 'Fullpage',
  15 + author : 'Moxiecode Systems AB',
  16 + authorurl : 'http://tinymce.moxiecode.com',
  17 + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage',
  18 + version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
  19 + };
  20 + },
  21 +
  22 + getControlHTML : function(cn) {
  23 + switch (cn) {
  24 + case "fullpage":
  25 + return tinyMCE.getButtonHTML(cn, 'lang_fullpage_desc', '{$pluginurl}/images/fullpage.gif', 'mceFullPageProperties');
  26 + }
  27 +
  28 + return "";
  29 + },
  30 +
  31 + execCommand : function(editor_id, element, command, user_interface, value) {
  32 + // Handle commands
  33 + switch (command) {
  34 + case "mceFullPageProperties":
  35 + var template = new Array();
  36 +
  37 + template['file'] = '../../plugins/fullpage/fullpage.htm';
  38 + template['width'] = 430;
  39 + template['height'] = 485 + (tinyMCE.isOpera ? 5 : 0);
  40 +
  41 + template['width'] += tinyMCE.getLang('lang_fullpage_delta_width', 0);
  42 + template['height'] += tinyMCE.getLang('lang_fullpage_delta_height', 0);
  43 +
  44 + tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"});
  45 + return true;
  46 +
  47 + case "mceFullPageUpdate":
  48 + TinyMCE_FullPagePlugin._addToHead(tinyMCE.getInstanceById(editor_id));
  49 + return true;
  50 + }
  51 +
  52 + // Pass to next handler in chain
  53 + return false;
  54 + },
  55 +
  56 + cleanup : function(type, content, inst) {
  57 + switch (type) {
  58 + case "insert_to_editor":
  59 + var tmp = content.toLowerCase();
  60 + var pos = tmp.indexOf('<body'), pos2;
  61 +
  62 + // Split page in header and body chunks
  63 + if (pos != -1) {
  64 + pos = tmp.indexOf('>', pos);
  65 + pos2 = tmp.lastIndexOf('</body>');
  66 + inst.fullpageTopContent = content.substring(0, pos + 1);
  67 + content = content.substring(pos + 1, pos2);
  68 + // tinyMCE.debug(inst.fullpageTopContent, content);
  69 + } else {
  70 + if (!inst.fullpageTopContent) {
  71 + var docType = tinyMCE.getParam("fullpage_default_doctype", '<!DOCTYPE html PUBLIC "-/'+'/W3C//DTD XHTML 1.0 Transitional/'+'/EN" "http:/'+'/www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
  72 + var enc = tinyMCE.getParam("fullpage_default_encoding", 'utf-8');
  73 + var title = tinyMCE.getParam("fullpage_default_title", 'Untitled document');
  74 + var lang = tinyMCE.getParam("fullpage_default_langcode", 'en');
  75 + var pi = tinyMCE.getParam("fullpage_default_xml_pi", true);
  76 + var ff = tinyMCE.getParam("fullpage_default_font_family", "");
  77 + var fz = tinyMCE.getParam("fullpage_default_font_size", "");
  78 + var ds = tinyMCE.getParam("fullpage_default_style", "");
  79 + var dtc = tinyMCE.getParam("fullpage_default_text_color", "");
  80 +
  81 + // Xml encode it
  82 + title = title.replace(/&/g, '&amp;');
  83 + title = title.replace(/\"/g, '&quot;');
  84 + title = title.replace(/</g, '&lt;');
  85 + title = title.replace(/>/g, '&gt;');
  86 +
  87 + tmp = '';
  88 +
  89 + // Make default chunk
  90 + if (pi)
  91 + tmp += '<?xml version="1.0" encoding="' + enc + '"?>\n';
  92 +
  93 + tmp += docType + '\n';
  94 + tmp += '<html xmlns="http:/'+'/www.w3.org/1999/xhtml" lang="' + lang + '" xml:lang="' + lang + '">\n';
  95 + tmp += '<head>\n';
  96 + tmp += '\t<title>' + title + '</title>\n';
  97 + tmp += '\t<meta http-equiv="Content-Type" content="text/html; charset=' + enc + '" />\n';
  98 + tmp += '</head>\n';
  99 + tmp += '<body';
  100 +
  101 + if (ff != '' || fz != '') {
  102 + tmp += ' style="';
  103 +
  104 + if (ds != '')
  105 + tmp += ds + ";";
  106 +
  107 + if (ff != '')
  108 + tmp += 'font-family: ' + ff + ";";
  109 +
  110 + if (fz != '')
  111 + tmp += 'font-size: ' + fz + ";";
  112 +
  113 + tmp += '"';
  114 + }
  115 +
  116 + if (dtc != '')
  117 + tmp += ' text="' + dtc + '"';
  118 +
  119 + tmp += '>\n';
  120 +
  121 + inst.fullpageTopContent = tmp;
  122 + }
  123 + }
  124 +
  125 + this._addToHead(inst);
  126 +
  127 + break;
  128 +
  129 + case "get_from_editor":
  130 + if (inst.fullpageTopContent && !tinyMCE.getParam("fullpage_hide_in_source_view", false)) {
  131 + content = content.replace(/(\s)?mce\_[a-z_]+\=[^\s>]+(\s|\>)/i, ''); // Remove internal stuff
  132 + content = inst.fullpageTopContent + content + "\n</body>\n</html>";
  133 + }
  134 +
  135 + break;
  136 +
  137 + case "submit_content":
  138 + if (inst.fullpageTopContent && tinyMCE.getParam("fullpage_hide_in_source_view", false))
  139 + content = inst.fullpageTopContent + content + "\n</body>\n</html>";
  140 +
  141 + break;
  142 + }
  143 +
  144 + // Pass through to next handler in chain
  145 + return content;
  146 + },
  147 +
  148 + // Private plugin internal methods
  149 +
  150 + _addToHead : function(inst) {
  151 + var doc = inst.getDoc();
  152 + var head = doc.getElementsByTagName("head")[0];
  153 + var body = doc.body;
  154 + var h = inst.fullpageTopContent;
  155 + var e = doc.createElement("body");
  156 + var nl, i, le, tmp;
  157 +
  158 + // Remove stuff we don't want
  159 + h = h.replace(/(\r|\n)/gi, '');
  160 + h = h.replace(/<\?[^\>]*\>/gi, '');
  161 + h = h.replace(/<\/?(!DOCTYPE|head|html)[^\>]*\>/gi, '');
  162 + h = h.replace(/<script(.*?)<\/script>/gi, '');
  163 + h = h.replace(/<title(.*?)<\/title>/gi, '');
  164 + h = h.replace(/<(meta|base)[^>]*>/gi, '');
  165 +
  166 + // Make link and style elements into pre
  167 + h = h.replace(/<link([^>]*)\/>/gi, '<pre mce_type="link" $1></pre>');
  168 + //h = h.replace(/<style([^>]*)>(.*?)<\/style>/gi, '<pre mce_type="style" $1>$2</pre>');
  169 +
  170 + // Make body a div
  171 + h = h.replace(/<body/gi, '<div mce_type="body"');
  172 + h += '</div>';
  173 +
  174 + // Now crapy MSIE can parse it
  175 + e.innerHTML = h;
  176 +
  177 + // Reset all body attributes
  178 + body.vLink = body.aLink = body.link = body.text = '';
  179 + body.style.cssText = '';
  180 +
  181 + // Delete all old links
  182 + nl = head.getElementsByTagName('link');
  183 + for (i=0; i<nl.length; i++) {
  184 + if (tinyMCE.getAttrib(nl[i], 'mce_head') == "true")
  185 + nl[i].parentNode.removeChild(nl[i]);
  186 + }
  187 +
  188 + // Add link elements
  189 + nl = e.getElementsByTagName('pre');
  190 + for (i=0; i<nl.length; i++) {
  191 + tmp = tinyMCE.getAttrib(nl[i], 'media');
  192 + if (tinyMCE.getAttrib(nl[i], 'mce_type') == "link" && (tmp == "" || tmp == "screen" || tmp == "all") && tinyMCE.getAttrib(nl[i], 'rel') == "stylesheet") {
  193 + le = doc.createElement("link");
  194 +
  195 + le.rel = "stylesheet";
  196 + le.href = tinyMCE.getAttrib(nl[i], 'href');
  197 + le.setAttribute("mce_head", "true");
  198 +
  199 + head.appendChild(le);
  200 + }
  201 + }
  202 +
  203 + // Add body attributes
  204 + nl = e.getElementsByTagName('div');
  205 + if (nl.length > 0) {
  206 + body.style.cssText = tinyMCE.getAttrib(nl[0], 'style');
  207 +
  208 + if ((tmp = tinyMCE.getAttrib(nl[0], 'leftmargin')) != '' && body.style.marginLeft == '')
  209 + body.style.marginLeft = tmp + "px";
  210 +
  211 + if ((tmp = tinyMCE.getAttrib(nl[0], 'rightmargin')) != '' && body.style.marginRight == '')
  212 + body.style.marginRight = tmp + "px";
  213 +
  214 + if ((tmp = tinyMCE.getAttrib(nl[0], 'topmargin')) != '' && body.style.marginTop == '')
  215 + body.style.marginTop = tmp + "px";
  216 +
  217 + if ((tmp = tinyMCE.getAttrib(nl[0], 'bottommargin')) != '' && body.style.marginBottom == '')
  218 + body.style.marginBottom = tmp + "px";
  219 +
  220 + body.dir = tinyMCE.getAttrib(nl[0], 'dir');
  221 + body.vLink = tinyMCE.getAttrib(nl[0], 'vlink');
  222 + body.aLink = tinyMCE.getAttrib(nl[0], 'alink');
  223 + body.link = tinyMCE.getAttrib(nl[0], 'link');
  224 + body.text = tinyMCE.getAttrib(nl[0], 'text');
  225 +
  226 + if ((tmp = tinyMCE.getAttrib(nl[0], 'background')) != '')
  227 + body.style.backgroundImage = "url('" + tmp + "')";
  228 +
  229 + if ((tmp = tinyMCE.getAttrib(nl[0], 'bgcolor')) != '')
  230 + body.style.backgroundColor = tmp;
  231 + }
  232 + }
  233 +};
  234 +
  235 +tinyMCE.addPlugin("fullpage", TinyMCE_FullPagePlugin);
public/javascripts/tiny_mce/plugins/fullpage/fullpage.htm 0 → 100755
@@ -0,0 +1,577 @@ @@ -0,0 +1,577 @@
  1 +<html xmlns="http://www.w3.org/1999/xhtml">
  2 +<head>
  3 + <title>{$lang_fullpage_title}</title>
  4 + <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
  5 + <script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
  6 + <script language="javascript" type="text/javascript" src="../../utils/mclayer.js"></script>
  7 + <script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
  8 + <script language="javascript" type="text/javascript" src="jscripts/fullpage.js"></script>
  9 + <link href="css/fullpage.css" rel="stylesheet" type="text/css" />
  10 + <base target="_self" />
  11 +</head>
  12 +<body id="advlink" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
  13 + <form onsubmit="updateAction();return false;" name="fullpage" action="#">
  14 + <div class="tabs">
  15 + <ul>
  16 + <li id="meta_tab" class="current"><span><a href="javascript:mcTabs.displayTab('meta_tab','meta_panel');" onmousedown="return false;">{$lang_fullpage_meta_tab}</a></span></li>
  17 + <li id="appearance_tab"><span><a href="javascript:mcTabs.displayTab('appearance_tab','appearance_panel');" onmousedown="return false;">{$lang_fullpage_appearance_tab}</a></span></li>
  18 + <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{$lang_fullpage_advanced_tab}</a></span></li>
  19 + </ul>
  20 + </div>
  21 +
  22 + <div class="panel_wrapper">
  23 + <div id="meta_panel" class="panel current">
  24 + <fieldset>
  25 + <legend>{$lang_fullpage_meta_props}</legend>
  26 +
  27 + <table border="0" cellpadding="4" cellspacing="0">
  28 + <tr>
  29 + <td nowrap="nowrap"><label for="metatitle">{$lang_fullpage_meta_title}</label>&nbsp;</td>
  30 + <td><input type="text" id="metatitle" name="metatitle" value="" /></td>
  31 + </tr>
  32 + <tr>
  33 + <td nowrap="nowrap"><label for="metakeywords">{$lang_fullpage_meta_keywords}</label>&nbsp;</td>
  34 + <td><textarea id="metakeywords" name="metakeywords" rows="4"></textarea></td>
  35 + </tr>
  36 + <tr>
  37 + <td nowrap="nowrap"><label for="metadescription">{$lang_fullpage_meta_description}</label>&nbsp;</td>
  38 + <td><textarea id="metadescription" name="metadescription" rows="4"></textarea></td>
  39 + </tr>
  40 + <tr>
  41 + <td nowrap="nowrap"><label for="metaauthor">{$lang_fullpage_author}</label>&nbsp;</td>
  42 + <td><input type="text" id="metaauthor" name="metaauthor" value="" /></td>
  43 + </tr>
  44 + <tr>
  45 + <td nowrap="nowrap"><label for="metacopyright">{$lang_fullpage_copyright}</label>&nbsp;</td>
  46 + <td><input type="text" id="metacopyright" name="metacopyright" value="" /></td>
  47 + </tr>
  48 + <tr>
  49 + <td nowrap="nowrap"><label for="metarobots">{$lang_fullpage_meta_robots}</label>&nbsp;</td>
  50 + <td>
  51 +<select id="metarobots" name="metarobots">
  52 + <option value="">{$lang_not_set}</option>
  53 + <option value="index,follow">{$lang_fullpage_meta_index_follow}</option>
  54 + <option value="index,nofollow">{$lang_fullpage_meta_index_nofollow}</option>
  55 + <option value="noindex,follow">{$lang_fullpage_meta_noindex_follow}</option>
  56 + <option value="noindex,nofollow">{$lang_fullpage_meta_noindex_nofollow}</option>
  57 +</select>
  58 + </td>
  59 + </tr>
  60 + </table>
  61 + </fieldset>
  62 +
  63 + <fieldset>
  64 + <legend>{$lang_fullpage_langprops}</legend>
  65 +
  66 + <table border="0" cellpadding="4" cellspacing="0">
  67 + <tr>
  68 + <td class="column1"><label for="docencoding">{$lang_fullpage_encoding}</label></td>
  69 + <td>
  70 + <select id="docencoding" name="docencoding">
  71 + <option value="">{$lang_not_set}</option>
  72 + </select>
  73 + </td>
  74 + </tr>
  75 + <tr>
  76 + <td nowrap="nowrap"><label for="doctypes">{$lang_fullpage_doctypes}</label>&nbsp;</td>
  77 + <td>
  78 + <select id="doctypes" name="doctypes">
  79 + <option value="">{$lang_not_set}</option>
  80 + </select>
  81 + </td>
  82 + </tr>
  83 + <tr>
  84 + <td nowrap="nowrap"><label for="langcode">{$lang_fullpage_langcode}</label>&nbsp;</td>
  85 + <td><input type="text" id="langcode" name="langcode" value="" /></td>
  86 + </tr>
  87 + <tr>
  88 + <td class="column1"><label for="langdir">{$lang_fullpage_langdir}</label></td>
  89 + <td>
  90 + <select id="langdir" name="langdir">
  91 + <option value="">{$lang_not_set}</option>
  92 + <option value="ltr">{$lang_fullpage_ltr}</option>
  93 + <option value="rtl">{$lang_fullpage_rtl}</option>
  94 + </select>
  95 + </td>
  96 + </tr>
  97 + <tr>
  98 + <td nowrap="nowrap"><label for="xml_pi">{$lang_fullpage_xml_pi}</label>&nbsp;</td>
  99 + <td><input type="checkbox" id="xml_pi" name="xml_pi" class="checkbox" /></td>
  100 + </tr>
  101 + </table>
  102 + </fieldset>
  103 + </div>
  104 +
  105 + <div id="appearance_panel" class="panel">
  106 + <fieldset>
  107 + <legend>{$lang_fullpage_appearance_textprops}</legend>
  108 +
  109 + <table border="0" cellpadding="4" cellspacing="0">
  110 + <tr>
  111 + <td class="column1"><label for="fontface">{$lang_fullpage_fontface}</label></td>
  112 + <td>
  113 + <select id="fontface" name="fontface" onchange="changedStyleField(this);">
  114 + <option value="">{$lang_not_set}</option>
  115 + </select>
  116 + </td>
  117 + </tr>
  118 +
  119 + <tr>
  120 + <td class="column1"><label for="fontsize">{$lang_fullpage_fontsize}</label></td>
  121 + <td>
  122 + <select id="fontsize" name="fontsize" onchange="changedStyleField(this);">
  123 + <option value="">{$lang_not_set}</option>
  124 + </select>
  125 + </td>
  126 + </tr>
  127 +
  128 + <tr>
  129 + <td class="column1"><label for="textcolor">{$lang_fullpage_textcolor}</label></td>
  130 + <td>
  131 + <table border="0" cellpadding="0" cellspacing="0">
  132 + <tr>
  133 + <td><input id="textcolor" name="textcolor" type="text" value="" size="9" onchange="updateColor('textcolor_pick','textcolor');changedStyleField(this);" /></td>
  134 + <td id="textcolor_pickcontainer">&nbsp;</td>
  135 + </tr>
  136 + </table>
  137 + </td>
  138 + </tr>
  139 + </table>
  140 + </fieldset>
  141 +
  142 + <fieldset>
  143 + <legend>{$lang_fullpage_appearance_bgprops}</legend>
  144 +
  145 + <table border="0" cellpadding="4" cellspacing="0">
  146 + <tr>
  147 + <td class="column1"><label for="bgimage">{$lang_fullpage_bgimage}</label></td>
  148 + <td>
  149 + <table border="0" cellpadding="0" cellspacing="0">
  150 + <tr>
  151 + <td><input id="bgimage" name="bgimage" type="text" value="" onchange="changedStyleField(this);" /></td>
  152 + <td id="bgimage_pickcontainer">&nbsp;</td>
  153 + </tr>
  154 + </table>
  155 + </td>
  156 + </tr>
  157 + <tr>
  158 + <td class="column1"><label for="bgcolor">{$lang_fullpage_bgcolor}</label></td>
  159 + <td>
  160 + <table border="0" cellpadding="0" cellspacing="0">
  161 + <tr>
  162 + <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedStyleField(this);" /></td>
  163 + <td id="bgcolor_pickcontainer">&nbsp;</td>
  164 + </tr>
  165 + </table>
  166 + </td>
  167 + </tr>
  168 + </table>
  169 + </fieldset>
  170 +
  171 + <fieldset>
  172 + <legend>{$lang_fullpage_appearance_marginprops}</legend>
  173 +
  174 + <table border="0" cellpadding="4" cellspacing="0">
  175 + <tr>
  176 + <td class="column1"><label for="leftmargin">{$lang_fullpage_left_margin}</label></td>
  177 + <td><input id="leftmargin" name="leftmargin" type="text" value="" onchange="changedStyleField(this);" /></td>
  178 + <td class="column1"><label for="rightmargin">{$lang_fullpage_right_margin}</label></td>
  179 + <td><input id="rightmargin" name="rightmargin" type="text" value="" onchange="changedStyleField(this);" /></td>
  180 + </tr>
  181 + <tr>
  182 + <td class="column1"><label for="topmargin">{$lang_fullpage_top_margin}</label></td>
  183 + <td><input id="topmargin" name="topmargin" type="text" value="" onchange="changedStyleField(this);" /></td>
  184 + <td class="column1"><label for="bottommargin">{$lang_fullpage_bottom_margin}</label></td>
  185 + <td><input id="bottommargin" name="bottommargin" type="text" value="" onchange="changedStyleField(this);" /></td>
  186 + </tr>
  187 + </table>
  188 + </fieldset>
  189 +
  190 + <fieldset>
  191 + <legend>{$lang_fullpage_appearance_linkprops}</legend>
  192 +
  193 + <table border="0" cellpadding="4" cellspacing="0">
  194 + <tr>
  195 + <td class="column1"><label for="link_color">{$lang_fullpage_link_color}</label></td>
  196 + <td>
  197 + <table border="0" cellpadding="0" cellspacing="0">
  198 + <tr>
  199 + <td><input id="link_color" name="link_color" type="text" value="" size="9" onchange="updateColor('link_color_pick','link_color');changedStyleField(this);" /></td>
  200 + <td id="link_color_pickcontainer">&nbsp;</td>
  201 + </tr>
  202 + </table>
  203 + </td>
  204 +
  205 + <td class="column1"><label for="visited_color">{$lang_fullpage_visited_color}</label></td>
  206 + <td>
  207 + <table border="0" cellpadding="0" cellspacing="0">
  208 + <tr>
  209 + <td><input id="visited_color" name="visited_color" type="text" value="" size="9" onchange="updateColor('visited_color_pick','visited_color');changedStyleField(this);" /></td>
  210 + <td id="visited_color_pickcontainer">&nbsp;</td>
  211 + </tr>
  212 + </table>
  213 + </td>
  214 + </tr>
  215 +
  216 + <tr>
  217 + <td class="column1"><label for="active_color">{$lang_fullpage_active_color}</label></td>
  218 + <td>
  219 + <table border="0" cellpadding="0" cellspacing="0">
  220 + <tr>
  221 + <td><input id="active_color" name="active_color" type="text" value="" size="9" onchange="updateColor('active_color_pick','active_color');changedStyleField(this);" /></td>
  222 + <td id="active_color_pickcontainer">&nbsp;</td>
  223 + </tr>
  224 + </table>
  225 + </td>
  226 +
  227 + <td>&nbsp;</td>
  228 + <td>&nbsp;</td>
  229 +
  230 +<!-- <td class="column1"><label for="hover_color">{$lang_fullpage_hover_color}</label></td>
  231 + <td>
  232 + <table border="0" cellpadding="0" cellspacing="0">
  233 + <tr>
  234 + <td><input id="hover_color" name="hover_color" type="text" value="" size="9" onchange="changedStyleField(this);" /></td>
  235 + <td id="hover_color_pickcontainer">&nbsp;</td>
  236 + </tr>
  237 + </table>
  238 + </td> -->
  239 + </tr>
  240 + </table>
  241 + </fieldset>
  242 +
  243 + <fieldset>
  244 + <legend>{$lang_fullpage_appearance_style}</legend>
  245 +
  246 + <table border="0" cellpadding="4" cellspacing="0">
  247 + <tr>
  248 + <td class="column1"><label for="stylesheet">{$lang_fullpage_stylesheet}</label></td>
  249 + <td><table border="0" cellpadding="0" cellspacing="0">
  250 + <tr>
  251 + <td><input id="stylesheet" name="stylesheet" type="text" value="" /></td>
  252 + <td id="stylesheet_browsercontainer">&nbsp;</td>
  253 + </tr>
  254 + </table></td>
  255 + </tr>
  256 + <tr>
  257 + <td class="column1"><label for="style">{$lang_fullpage_style}</label></td>
  258 + <td><input id="style" name="style" type="text" value="" onchange="changedStyleField(this);" /></td>
  259 + </tr>
  260 + </table>
  261 + </fieldset>
  262 + </div>
  263 +
  264 + <div id="advanced_panel" class="panel">
  265 + <div id="addmenu">
  266 + <table border="0" cellpadding="0" cellspacing="0">
  267 + <tr><td><a href="javascript:addHeadElm('title');" onmousedown="return false;"><span>{$lang_fullpage_add_title}</span></a></td></tr>
  268 + <tr><td><a href="javascript:addHeadElm('meta');" onmousedown="return false;"><span>{$lang_fullpage_add_meta}</span></a></td></tr>
  269 + <tr><td><a href="javascript:addHeadElm('script');" onmousedown="return false;"><span>{$lang_fullpage_add_script}</span></a></td></tr>
  270 + <tr><td><a href="javascript:addHeadElm('style');" onmousedown="return false;"><span>{$lang_fullpage_add_style}</span></a></td></tr>
  271 + <tr><td><a href="javascript:addHeadElm('link');" onmousedown="return false;"><span>{$lang_fullpage_add_link}</span></a></td></tr>
  272 + <tr><td><a href="javascript:addHeadElm('base');" onmousedown="return false;"><span>{$lang_fullpage_add_base}</span></a></td></tr>
  273 + <tr><td><a href="javascript:addHeadElm('comment');" onmousedown="return false;"><span>{$lang_fullpage_add_comment}</span></a></td></tr>
  274 + </table>
  275 + </div>
  276 +
  277 + <fieldset>
  278 + <legend>{$lang_fullpage_head_elements}</legend>
  279 +
  280 + <div class="headlistwrapper">
  281 + <div class="toolbar">
  282 + <div style="float: left">
  283 + <a id="addbutton" href="javascript:showAddMenu();" onmousedown="return false;" class="addbutton" title="{$lang_fullpage_add}"></a>
  284 + <a href="#" onmousedown="return false;" class="removebutton" title="{$lang_fullpage_remove}"></a>
  285 + </div>
  286 + <div style="float: right">
  287 + <a href="#" onmousedown="return false;" class="moveupbutton" title="{$lang_fullpage_moveup}"></a>
  288 + <a href="#" onmousedown="return false;" class="movedownbutton" title="{$lang_fullpage_movedown}"></a>
  289 + </div>
  290 + <br style="clear: both" />
  291 + </div>
  292 + <select id="headlist" size="26" onchange="updateHeadElm(this.options[this.selectedIndex].value);">
  293 + <option value="title_0">&lt;title&gt;Some title bla bla bla&lt;/title&gt;</option>
  294 + <option value="meta_1">&lt;meta name="keywords"&gt;Some bla bla bla&lt;/meta&gt;</option>
  295 + <option value="meta_2">&lt;meta name="description"&gt;Some bla bla bla bla bla bla bla bla bla&lt;/meta&gt;</option>
  296 + <option value="script_3">&lt;script language=&quot;javascript&quot;&gt;...&lt;/script&gt;</option>
  297 + <option value="style_4">&lt;style&gt;...&lt;/style&gt;</option>
  298 + <option value="base_5">&lt;base href="." /&gt;</option>
  299 + <option value="comment_6">&lt;!-- ... --&gt;</option>
  300 + <option value="link_7">&lt;link href="." /&gt;</option>
  301 + </select>
  302 + </div>
  303 + </fieldset>
  304 +
  305 + <fieldset id="meta_element">
  306 + <legend>{$lang_fullpage_meta_element}</legend>
  307 +
  308 + <table border="0" cellpadding="4" cellspacing="0">
  309 + <tr>
  310 + <td class="column1"><label for="element_meta_type">{$lang_fullpage_type}</label></td>
  311 + <td><select id="element_meta_type">
  312 + <option value="name">name</option>
  313 + <option value="http-equiv">http-equiv</option>
  314 + </select></td>
  315 + </tr>
  316 + <tr>
  317 + <td class="column1"><label for="element_meta_name">{$lang_fullpage_name}</label></td>
  318 + <td><input id="element_meta_name" name="element_meta_name" type="text" value="" /></td>
  319 + </tr>
  320 + <tr>
  321 + <td class="column1"><label for="element_meta_content">{$lang_fullpage_content}</label></td>
  322 + <td><input id="element_meta_content" name="element_meta_content" type="text" value="" /></td>
  323 + </tr>
  324 + </table>
  325 +
  326 + <input type="button" id="meta_updateelement" class="updateElementButton" name="update" value="{$lang_update}" onclick="updateElement();" />
  327 + </fieldset>
  328 +
  329 + <fieldset id="title_element">
  330 + <legend>{$lang_fullpage_title_element}</legend>
  331 +
  332 + <table border="0" cellpadding="4" cellspacing="0">
  333 + <tr>
  334 + <td class="column1"><label for="element_title">{$lang_fullpage_meta_title}</label></td>
  335 + <td><input id="element_title" name="element_title" type="text" value="" /></td>
  336 + </tr>
  337 + </table>
  338 +
  339 + <input type="button" id="title_updateelement" class="updateElementButton" name="update" value="{$lang_update}" onclick="updateElement();" />
  340 + </fieldset>
  341 +
  342 + <fieldset id="script_element">
  343 + <legend>{$lang_fullpage_script_element}</legend>
  344 +
  345 + <div class="tabs">
  346 + <ul>
  347 + <li id="script_props_tab" class="current"><span><a href="javascript:mcTabs.displayTab('script_props_tab','script_props_panel');" onmousedown="return false;">{$lang_fullpage_properties}</a></span></li>
  348 + <li id="script_value_tab"><span><a href="javascript:mcTabs.displayTab('script_value_tab','script_value_panel');" onmousedown="return false;">{$lang_fullpage_value}</a></span></li>
  349 + </ul>
  350 + </div>
  351 +
  352 + <br style="clear: both" />
  353 +
  354 + <div class="panel_wrapper">
  355 + <div id="script_props_panel" class="panel current">
  356 + <table border="0" cellpadding="4" cellspacing="0">
  357 + <tr>
  358 + <td class="column1"><label for="element_script_type">{$lang_fullpage_type}</label></td>
  359 + <td><select id="element_script_type">
  360 + <option value="text/javascript">text/javascript</option>
  361 + <option value="text/jscript">text/jscript</option>
  362 + <option value="text/vbscript">text/vbscript</option>
  363 + <option value="text/vbs">text/vbs</option>
  364 + <option value="text/ecmascript">text/ecmascript</option>
  365 + <option value="text/xml">text/xml</option>
  366 + </select></td>
  367 + </tr>
  368 + <tr>
  369 + <td class="column1"><label for="element_script_src">{$lang_fullpage_src}</label></td>
  370 + <td><table border="0" cellpadding="0" cellspacing="0">
  371 + <tr>
  372 + <td><input id="element_script_src" name="element_script_src" type="text" value="" /></td>
  373 + <td id="script_src_pickcontainer">&nbsp;</td>
  374 + </tr>
  375 + </table></td>
  376 + </tr>
  377 + <tr>
  378 + <td class="column1"><label for="element_script_charset">{$lang_fullpage_charset}</label></td>
  379 + <td><select id="element_script_charset"><option value="">{$lang_not_set}</option></select></td>
  380 + </tr>
  381 + <tr>
  382 + <td class="column1"><label for="element_script_defer">{$lang_fullpage_defer}</label></td>
  383 + <td><input type="checkbox" id="element_script_defer" name="element_script_defer" class="checkbox" /></td>
  384 + </tr>
  385 + </table>
  386 + </div>
  387 +
  388 + <div id="script_value_panel" class="panel">
  389 + <textarea id="element_script_value"></textarea>
  390 + </div>
  391 + </div>
  392 +
  393 + <input type="button" id="script_updateelement" class="updateElementButton" name="update" value="{$lang_update}" onclick="updateElement();" />
  394 + </fieldset>
  395 +
  396 + <fieldset id="style_element">
  397 + <legend>{$lang_fullpage_style_element}</legend>
  398 +
  399 + <div class="tabs">
  400 + <ul>
  401 + <li id="style_props_tab" class="current"><span><a href="javascript:mcTabs.displayTab('style_props_tab','style_props_panel');" onmousedown="return false;">{$lang_fullpage_properties}</a></span></li>
  402 + <li id="style_value_tab"><span><a href="javascript:mcTabs.displayTab('style_value_tab','style_value_panel');" onmousedown="return false;">{$lang_fullpage_value}</a></span></li>
  403 + </ul>
  404 + </div>
  405 +
  406 + <br style="clear: both" />
  407 +
  408 + <div class="panel_wrapper">
  409 + <div id="style_props_panel" class="panel current">
  410 + <table border="0" cellpadding="4" cellspacing="0">
  411 + <tr>
  412 + <td class="column1"><label for="element_style_type">{$lang_fullpage_type}</label></td>
  413 + <td><select id="element_style_type">
  414 + <option value="text/css">text/css</option>
  415 + </select></td>
  416 + </tr>
  417 + <tr>
  418 + <td class="column1"><label for="element_style_media">{$lang_fullpage_media}</label></td>
  419 + <td><select id="element_style_media"></select></td>
  420 + </tr>
  421 + </table>
  422 + </div>
  423 +
  424 + <div id="style_value_panel" class="panel">
  425 + <textarea id="element_style_value"></textarea>
  426 + </div>
  427 + </div>
  428 +
  429 + <input type="button" id="style_updateelement" class="updateElementButton" name="update" value="{$lang_update}" onclick="updateElement();" />
  430 + </fieldset>
  431 +
  432 + <fieldset id="base_element">
  433 + <legend>{$lang_fullpage_base_element}</legend>
  434 +
  435 + <table border="0" cellpadding="4" cellspacing="0">
  436 + <tr>
  437 + <td class="column1"><label for="element_base_href">{$lang_fullpage_href}</label></td>
  438 + <td><input id="element_base_href" name="element_base_href" type="text" value="" /></td>
  439 + </tr>
  440 + <tr>
  441 + <td class="column1"><label for="element_base_target">{$lang_fullpage_target}</label></td>
  442 + <td><input id="element_base_target" name="element_base_target" type="text" value="" /></td>
  443 + </tr>
  444 + </table>
  445 +
  446 + <input type="button" id="base_updateelement" class="updateElementButton" name="update" value="{$lang_update}" onclick="updateElement();" />
  447 + </fieldset>
  448 +
  449 + <fieldset id="link_element">
  450 + <legend>{$lang_fullpage_link_element}</legend>
  451 +
  452 + <div class="tabs">
  453 + <ul>
  454 + <li id="link_general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('link_general_tab','link_general_panel');" onmousedown="return false;">{$lang_fullpage_general_props}</a></span></li>
  455 + <li id="link_advanced_tab"><span><a href="javascript:mcTabs.displayTab('link_advanced_tab','link_advanced_panel');" onmousedown="return false;">{$lang_fullpage_advanced_props}</a></span></li>
  456 + </ul>
  457 + </div>
  458 +
  459 + <br style="clear: both" />
  460 +
  461 + <div class="panel_wrapper">
  462 + <div id="link_general_panel" class="panel current">
  463 + <table border="0" cellpadding="4" cellspacing="0">
  464 + <tr>
  465 + <td class="column1"><label for="element_link_href">{$lang_fullpage_href}</label></td>
  466 + <td><table border="0" cellpadding="0" cellspacing="0">
  467 + <tr>
  468 + <td><input id="element_link_href" name="element_link_href" type="text" value="" /></td>
  469 + <td id="link_href_pickcontainer">&nbsp;</td>
  470 + </tr>
  471 + </table></td>
  472 + </tr>
  473 + <tr>
  474 + <td class="column1"><label for="element_link_title">{$lang_fullpage_meta_title}</label></td>
  475 + <td><input id="element_link_title" name="element_link_title" type="text" value="" /></td>
  476 + </tr>
  477 + <tr>
  478 + <td class="column1"><label for="element_link_type">{$lang_fullpage_type}</label></td>
  479 + <td><select id="element_link_type" name="element_link_type">
  480 + <option value="text/css">text/css</option>
  481 + <option value="text/javascript">text/javascript</option>
  482 + </select></td>
  483 + </tr>
  484 + <tr>
  485 + <td class="column1"><label for="element_link_media">{$lang_fullpage_media}</label></td>
  486 + <td><select id="element_link_media" name="element_link_media"></select></td>
  487 + </tr>
  488 + <tr>
  489 + <td><label for="element_style_rel">{$lang_fullpage_rel}</label></td>
  490 + <td><select id="element_style_rel" name="element_style_rel">
  491 + <option value="">{$lang_not_set}</option>
  492 + <option value="stylesheet">Stylesheet</option>
  493 + <option value="alternate">Alternate</option>
  494 + <option value="designates">Designates</option>
  495 + <option value="start">Start</option>
  496 + <option value="next">Next</option>
  497 + <option value="prev">Prev</option>
  498 + <option value="contents">Contents</option>
  499 + <option value="index">Index</option>
  500 + <option value="glossary">Glossary</option>
  501 + <option value="copyright">Copyright</option>
  502 + <option value="chapter">Chapter</option>
  503 + <option value="subsection">Subsection</option>
  504 + <option value="appendix">Appendix</option>
  505 + <option value="help">Help</option>
  506 + <option value="bookmark">Bookmark</option>
  507 + </select>
  508 + </td>
  509 + </tr>
  510 + </table>
  511 + </div>
  512 +
  513 + <div id="link_advanced_panel" class="panel">
  514 + <table border="0" cellpadding="4" cellspacing="0">
  515 + <tr>
  516 + <td class="column1"><label for="element_link_charset">{$lang_fullpage_charset}</label></td>
  517 + <td><select id="element_link_charset"><option value="">{$lang_not_set}</option></select></td>
  518 + </tr>
  519 + <tr>
  520 + <td class="column1"><label for="element_link_hreflang">{$lang_fullpage_hreflang}</label></td>
  521 + <td><input id="element_link_hreflang" name="element_link_hreflang" type="text" value="" /></td>
  522 + </tr>
  523 + <tr>
  524 + <td class="column1"><label for="element_link_target">{$lang_fullpage_target}</label></td>
  525 + <td><input id="element_link_target" name="element_link_target" type="text" value="" /></td>
  526 + </tr>
  527 + <tr>
  528 + <td><label for="element_style_rev">{$lang_fullpage_rev}</label></td>
  529 + <td><select id="element_style_rev" name="element_style_rev">
  530 + <option value="">{$lang_not_set}</option>
  531 + <option value="alternate">Alternate</option>
  532 + <option value="designates">Designates</option>
  533 + <option value="stylesheet">Stylesheet</option>
  534 + <option value="start">Start</option>
  535 + <option value="next">Next</option>
  536 + <option value="prev">Prev</option>
  537 + <option value="contents">Contents</option>
  538 + <option value="index">Index</option>
  539 + <option value="glossary">Glossary</option>
  540 + <option value="copyright">Copyright</option>
  541 + <option value="chapter">Chapter</option>
  542 + <option value="subsection">Subsection</option>
  543 + <option value="appendix">Appendix</option>
  544 + <option value="help">Help</option>
  545 + <option value="bookmark">Bookmark</option>
  546 + </select>
  547 + </td>
  548 + </tr>
  549 + </table>
  550 + </div>
  551 + </div>
  552 +
  553 + <input type="button" id="link_updateelement" class="updateElementButton" name="update" value="{$lang_update}" onclick="updateElement();" />
  554 + </fieldset>
  555 +
  556 + <fieldset id="comment_element">
  557 + <legend>{$lang_fullpage_comment_element}</legend>
  558 +
  559 + <textarea id="element_comment_value"></textarea>
  560 +
  561 + <input type="button" id="comment_updateelement" class="updateElementButton" name="update" value="{$lang_update}" onclick="updateElement();" />
  562 + </fieldset>
  563 + </div>
  564 + </div>
  565 +
  566 + <div class="mceActionPanel">
  567 + <div style="float: left">
  568 + <input type="button" id="insert" name="update" value="{$lang_update}" onclick="updateAction();" />
  569 + </div>
  570 +
  571 + <div style="float: right">
  572 + <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
  573 + </div>
  574 + </div>
  575 + </form>
  576 +</body>
  577 +</html>
public/javascripts/tiny_mce/plugins/fullpage/images/add.gif 0 → 100755

893 Bytes

public/javascripts/tiny_mce/plugins/fullpage/images/fullpage.gif 0 → 100755

632 Bytes