added ability to insert attached images in HTML editor
1 files added
1 files renamed
27 files modified
| | |
| | | 2007/12/10 (estadtherr) |
| | | ---------- |
| | | - Upgrade to TinyMCE 2.1.3 |
| | | - Allow inserting image attachments into HTML messages while composing |
| | | |
| | | 2007/12/10 (thomasb) |
| | | ---------- |
| | |
| | | if ($_action=='upload') |
| | | include('program/steps/mail/upload.inc'); |
| | | |
| | | if ($_action=='compose' || $_action=='remove-attachment') |
| | | if ($_action=='compose' || $_action=='remove-attachment' || $_action=='display-attachment') |
| | | include('program/steps/mail/compose.inc'); |
| | | |
| | | if ($_action=='addcontact') |
| | |
| | | |
| | | if (!this.check_compose_input()) |
| | | break; |
| | | |
| | | |
| | | // Reset the auto-save timer |
| | | self.clearTimeout(this.save_timer); |
| | | |
| | |
| | | // upload attachment file |
| | | this.upload_file = function(form) |
| | | { |
| | | |
| | | if (!form) |
| | | return false; |
| | | |
| | |
| | | theme_advanced_toolbar_align : 'left', |
| | | extended_valid_elements : 'font[face|size|color|style],span[id|class|align|style]', |
| | | content_css : skin_path + '/editor_content.css', |
| | | popups_css : skin_path + '/editor_popup.css', |
| | | editor_css : skin_path + '/editor_ui.css' |
| | | editor_css : skin_path + '/editor_ui.css', |
| | | external_image_list_url : 'program/js/editor_images.js' |
| | | }); |
| | | } |
| | | |
New file |
| | |
| | | |
| | | var rc_client = tinyMCEPopup.windowOpener.rcube_webmail_client; |
| | | if (rc_client.gui_objects.attachmentlist) |
| | | { |
| | | var tinyMCEImageList = new Array(); |
| | | var attachElems = rc_client.gui_objects.attachmentlist.getElementsByTagName("li"); |
| | | for (i = 0; i < attachElems.length; i++) |
| | | { |
| | | var liElem = attachElems[i]; |
| | | var fname = attachElems[i].id; |
| | | for (j = 0; j < liElem.childNodes.length; j++) |
| | | { |
| | | if (liElem.childNodes[j].nodeName == "#text") |
| | | { |
| | | fname = liElem.childNodes[j].nodeValue; |
| | | } |
| | | } |
| | | tinyMCEImageList.push([fname, rc_client.env.comm_path+'&_action=display-attachment&_file='+attachElems[i].id]); |
| | | } |
| | | }; |
| | |
| | | GNU LESSER GENERAL PUBLIC LICENSE
|
| | | Version 2.1, February 1999
|
| | |
|
| | | Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
| | | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
| | | Everyone is permitted to copy and distribute verbatim copies
|
| | | of this license document, but changing it is not allowed.
|
| | |
|
| | | [This is the first released version of the Lesser GPL. It also counts
|
| | | as the successor of the GNU Library Public License, version 2, hence
|
| | | the version number 2.1.]
|
| | |
|
| | | Preamble
|
| | |
|
| | | The licenses for most software are designed to take away your
|
| | | freedom to share and change it. By contrast, the GNU General Public
|
| | | Licenses are intended to guarantee your freedom to share and change
|
| | | free software--to make sure the software is free for all its users.
|
| | |
|
| | | This license, the Lesser General Public License, applies to some
|
| | | specially designated software packages--typically libraries--of the
|
| | | Free Software Foundation and other authors who decide to use it. You
|
| | | can use it too, but we suggest you first think carefully about whether
|
| | | this license or the ordinary General Public License is the better
|
| | | strategy to use in any particular case, based on the explanations below.
|
| | |
|
| | | When we speak of free software, we are referring to freedom of use,
|
| | | not price. Our General Public Licenses are designed to make sure that
|
| | | you have the freedom to distribute copies of free software (and charge
|
| | | for this service if you wish); that you receive source code or can get
|
| | | it if you want it; that you can change the software and use pieces of
|
| | | it in new free programs; and that you are informed that you can do
|
| | | these things.
|
| | |
|
| | | To protect your rights, we need to make restrictions that forbid
|
| | | distributors to deny you these rights or to ask you to surrender these
|
| | | rights. These restrictions translate to certain responsibilities for
|
| | | you if you distribute copies of the library or if you modify it.
|
| | |
|
| | | For example, if you distribute copies of the library, whether gratis
|
| | | or for a fee, you must give the recipients all the rights that we gave
|
| | | you. You must make sure that they, too, receive or can get the source
|
| | | code. If you link other code with the library, you must provide
|
| | | complete object files to the recipients, so that they can relink them
|
| | | with the library after making changes to the library and recompiling
|
| | | it. And you must show them these terms so they know their rights.
|
| | |
|
| | | We protect your rights with a two-step method: (1) we copyright the
|
| | | library, and (2) we offer you this license, which gives you legal
|
| | | permission to copy, distribute and/or modify the library.
|
| | |
|
| | | To protect each distributor, we want to make it very clear that
|
| | | there is no warranty for the free library. Also, if the library is
|
| | | modified by someone else and passed on, the recipients should know
|
| | | that what they have is not the original version, so that the original
|
| | | author's reputation will not be affected by problems that might be
|
| | | introduced by others.
|
| | |
|
| | | Finally, software patents pose a constant threat to the existence of
|
| | | any free program. We wish to make sure that a company cannot
|
| | | effectively restrict the users of a free program by obtaining a
|
| | | restrictive license from a patent holder. Therefore, we insist that
|
| | | any patent license obtained for a version of the library must be
|
| | | consistent with the full freedom of use specified in this license.
|
| | |
|
| | | Most GNU software, including some libraries, is covered by the
|
| | | ordinary GNU General Public License. This license, the GNU Lesser
|
| | | General Public License, applies to certain designated libraries, and
|
| | | is quite different from the ordinary General Public License. We use
|
| | | this license for certain libraries in order to permit linking those
|
| | | libraries into non-free programs.
|
| | |
|
| | | When a program is linked with a library, whether statically or using
|
| | | a shared library, the combination of the two is legally speaking a
|
| | | combined work, a derivative of the original library. The ordinary
|
| | | General Public License therefore permits such linking only if the
|
| | | entire combination fits its criteria of freedom. The Lesser General
|
| | | Public License permits more lax criteria for linking other code with
|
| | | the library.
|
| | |
|
| | | We call this license the "Lesser" General Public License because it
|
| | | does Less to protect the user's freedom than the ordinary General
|
| | | Public License. It also provides other free software developers Less
|
| | | of an advantage over competing non-free programs. These disadvantages
|
| | | are the reason we use the ordinary General Public License for many
|
| | | libraries. However, the Lesser license provides advantages in certain
|
| | | special circumstances.
|
| | |
|
| | | For example, on rare occasions, there may be a special need to
|
| | | encourage the widest possible use of a certain library, so that it becomes
|
| | | a de-facto standard. To achieve this, non-free programs must be
|
| | | allowed to use the library. A more frequent case is that a free
|
| | | library does the same job as widely used non-free libraries. In this
|
| | | case, there is little to gain by limiting the free library to free
|
| | | software only, so we use the Lesser General Public License.
|
| | |
|
| | | In other cases, permission to use a particular library in non-free
|
| | | programs enables a greater number of people to use a large body of
|
| | | free software. For example, permission to use the GNU C Library in
|
| | | non-free programs enables many more people to use the whole GNU
|
| | | operating system, as well as its variant, the GNU/Linux operating
|
| | | system.
|
| | |
|
| | | Although the Lesser General Public License is Less protective of the
|
| | | users' freedom, it does ensure that the user of a program that is
|
| | | linked with the Library has the freedom and the wherewithal to run
|
| | | that program using a modified version of the Library.
|
| | |
|
| | | The precise terms and conditions for copying, distribution and
|
| | | modification follow. Pay close attention to the difference between a
|
| | | "work based on the library" and a "work that uses the library". The
|
| | | former contains code derived from the library, whereas the latter must
|
| | | be combined with the library in order to run.
|
| | |
|
| | | GNU LESSER GENERAL PUBLIC LICENSE
|
| | | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
| | |
|
| | | 0. This License Agreement applies to any software library or other
|
| | | program which contains a notice placed by the copyright holder or
|
| | | other authorized party saying it may be distributed under the terms of
|
| | | this Lesser General Public License (also called "this License").
|
| | | Each licensee is addressed as "you".
|
| | |
|
| | | A "library" means a collection of software functions and/or data
|
| | | prepared so as to be conveniently linked with application programs
|
| | | (which use some of those functions and data) to form executables.
|
| | |
|
| | | The "Library", below, refers to any such software library or work
|
| | | which has been distributed under these terms. A "work based on the
|
| | | Library" means either the Library or any derivative work under
|
| | | copyright law: that is to say, a work containing the Library or a
|
| | | portion of it, either verbatim or with modifications and/or translated
|
| | | straightforwardly into another language. (Hereinafter, translation is
|
| | | included without limitation in the term "modification".)
|
| | |
|
| | | "Source code" for a work means the preferred form of the work for
|
| | | making modifications to it. For a library, complete source code means
|
| | | all the source code for all modules it contains, plus any associated
|
| | | interface definition files, plus the scripts used to control compilation
|
| | | and installation of the library.
|
| | |
|
| | | Activities other than copying, distribution and modification are not
|
| | | covered by this License; they are outside its scope. The act of
|
| | | running a program using the Library is not restricted, and output from
|
| | | such a program is covered only if its contents constitute a work based
|
| | | on the Library (independent of the use of the Library in a tool for
|
| | | writing it). Whether that is true depends on what the Library does
|
| | | and what the program that uses the Library does.
|
| | | |
| | | 1. You may copy and distribute verbatim copies of the Library's
|
| | | complete source code as you receive it, in any medium, provided that
|
| | | you conspicuously and appropriately publish on each copy an
|
| | | appropriate copyright notice and disclaimer of warranty; keep intact
|
| | | all the notices that refer to this License and to the absence of any
|
| | | warranty; and distribute a copy of this License along with the
|
| | | Library.
|
| | |
|
| | | You may charge a fee for the physical act of transferring a copy,
|
| | | and you may at your option offer warranty protection in exchange for a
|
| | | fee.
|
| | |
|
| | | 2. You may modify your copy or copies of the Library or any portion
|
| | | of it, thus forming a work based on the Library, and copy and
|
| | | distribute such modifications or work under the terms of Section 1
|
| | | above, provided that you also meet all of these conditions:
|
| | |
|
| | | a) The modified work must itself be a software library.
|
| | |
|
| | | b) You must cause the files modified to carry prominent notices
|
| | | stating that you changed the files and the date of any change.
|
| | |
|
| | | c) You must cause the whole of the work to be licensed at no
|
| | | charge to all third parties under the terms of this License.
|
| | |
|
| | | d) If a facility in the modified Library refers to a function or a
|
| | | table of data to be supplied by an application program that uses
|
| | | the facility, other than as an argument passed when the facility
|
| | | is invoked, then you must make a good faith effort to ensure that,
|
| | | in the event an application does not supply such function or
|
| | | table, the facility still operates, and performs whatever part of
|
| | | its purpose remains meaningful.
|
| | |
|
| | | (For example, a function in a library to compute square roots has
|
| | | a purpose that is entirely well-defined independent of the
|
| | | application. Therefore, Subsection 2d requires that any
|
| | | application-supplied function or table used by this function must
|
| | | be optional: if the application does not supply it, the square
|
| | | root function must still compute square roots.)
|
| | |
|
| | | These requirements apply to the modified work as a whole. If
|
| | | identifiable sections of that work are not derived from the Library,
|
| | | and can be reasonably considered independent and separate works in
|
| | | themselves, then this License, and its terms, do not apply to those
|
| | | sections when you distribute them as separate works. But when you
|
| | | distribute the same sections as part of a whole which is a work based
|
| | | on the Library, the distribution of the whole must be on the terms of
|
| | | this License, whose permissions for other licensees extend to the
|
| | | entire whole, and thus to each and every part regardless of who wrote
|
| | | it.
|
| | |
|
| | | Thus, it is not the intent of this section to claim rights or contest
|
| | | your rights to work written entirely by you; rather, the intent is to
|
| | | exercise the right to control the distribution of derivative or
|
| | | collective works based on the Library.
|
| | |
|
| | | In addition, mere aggregation of another work not based on the Library
|
| | | with the Library (or with a work based on the Library) on a volume of
|
| | | a storage or distribution medium does not bring the other work under
|
| | | the scope of this License.
|
| | |
|
| | | 3. You may opt to apply the terms of the ordinary GNU General Public
|
| | | License instead of this License to a given copy of the Library. To do
|
| | | this, you must alter all the notices that refer to this License, so
|
| | | that they refer to the ordinary GNU General Public License, version 2,
|
| | | instead of to this License. (If a newer version than version 2 of the
|
| | | ordinary GNU General Public License has appeared, then you can specify
|
| | | that version instead if you wish.) Do not make any other change in
|
| | | these notices.
|
| | |
|
| | | Once this change is made in a given copy, it is irreversible for
|
| | | that copy, so the ordinary GNU General Public License applies to all
|
| | | subsequent copies and derivative works made from that copy.
|
| | |
|
| | | This option is useful when you wish to copy part of the code of
|
| | | the Library into a program that is not a library.
|
| | |
|
| | | 4. You may copy and distribute the Library (or a portion or
|
| | | derivative of it, under Section 2) in object code or executable form
|
| | | under the terms of Sections 1 and 2 above provided that you accompany
|
| | | it with the complete corresponding machine-readable source code, which
|
| | | must be distributed under the terms of Sections 1 and 2 above on a
|
| | | medium customarily used for software interchange.
|
| | |
|
| | | If distribution of object code is made by offering access to copy
|
| | | from a designated place, then offering equivalent access to copy the
|
| | | source code from the same place satisfies the requirement to
|
| | | distribute the source code, even though third parties are not
|
| | | compelled to copy the source along with the object code.
|
| | |
|
| | | 5. A program that contains no derivative of any portion of the
|
| | | Library, but is designed to work with the Library by being compiled or
|
| | | linked with it, is called a "work that uses the Library". Such a
|
| | | work, in isolation, is not a derivative work of the Library, and
|
| | | therefore falls outside the scope of this License.
|
| | |
|
| | | However, linking a "work that uses the Library" with the Library
|
| | | creates an executable that is a derivative of the Library (because it
|
| | | contains portions of the Library), rather than a "work that uses the
|
| | | library". The executable is therefore covered by this License.
|
| | | Section 6 states terms for distribution of such executables.
|
| | |
|
| | | When a "work that uses the Library" uses material from a header file
|
| | | that is part of the Library, the object code for the work may be a
|
| | | derivative work of the Library even though the source code is not.
|
| | | Whether this is true is especially significant if the work can be
|
| | | linked without the Library, or if the work is itself a library. The
|
| | | threshold for this to be true is not precisely defined by law.
|
| | |
|
| | | If such an object file uses only numerical parameters, data
|
| | | structure layouts and accessors, and small macros and small inline
|
| | | functions (ten lines or less in length), then the use of the object
|
| | | file is unrestricted, regardless of whether it is legally a derivative
|
| | | work. (Executables containing this object code plus portions of the
|
| | | Library will still fall under Section 6.)
|
| | |
|
| | | Otherwise, if the work is a derivative of the Library, you may
|
| | | distribute the object code for the work under the terms of Section 6.
|
| | | Any executables containing that work also fall under Section 6,
|
| | | whether or not they are linked directly with the Library itself.
|
| | |
|
| | | 6. As an exception to the Sections above, you may also combine or
|
| | | link a "work that uses the Library" with the Library to produce a
|
| | | work containing portions of the Library, and distribute that work
|
| | | under terms of your choice, provided that the terms permit
|
| | | modification of the work for the customer's own use and reverse
|
| | | engineering for debugging such modifications.
|
| | |
|
| | | You must give prominent notice with each copy of the work that the
|
| | | Library is used in it and that the Library and its use are covered by
|
| | | this License. You must supply a copy of this License. If the work
|
| | | during execution displays copyright notices, you must include the
|
| | | copyright notice for the Library among them, as well as a reference
|
| | | directing the user to the copy of this License. Also, you must do one
|
| | | of these things:
|
| | |
|
| | | a) Accompany the work with the complete corresponding
|
| | | machine-readable source code for the Library including whatever
|
| | | changes were used in the work (which must be distributed under
|
| | | Sections 1 and 2 above); and, if the work is an executable linked
|
| | | with the Library, with the complete machine-readable "work that
|
| | | uses the Library", as object code and/or source code, so that the
|
| | | user can modify the Library and then relink to produce a modified
|
| | | executable containing the modified Library. (It is understood
|
| | | that the user who changes the contents of definitions files in the
|
| | | Library will not necessarily be able to recompile the application
|
| | | to use the modified definitions.)
|
| | |
|
| | | b) Use a suitable shared library mechanism for linking with the
|
| | | Library. A suitable mechanism is one that (1) uses at run time a
|
| | | copy of the library already present on the user's computer system,
|
| | | rather than copying library functions into the executable, and (2)
|
| | | will operate properly with a modified version of the library, if
|
| | | the user installs one, as long as the modified version is
|
| | | interface-compatible with the version that the work was made with.
|
| | |
|
| | | c) Accompany the work with a written offer, valid for at
|
| | | least three years, to give the same user the materials
|
| | | specified in Subsection 6a, above, for a charge no more
|
| | | than the cost of performing this distribution.
|
| | |
|
| | | d) If distribution of the work is made by offering access to copy
|
| | | from a designated place, offer equivalent access to copy the above
|
| | | specified materials from the same place.
|
| | |
|
| | | e) Verify that the user has already received a copy of these
|
| | | materials or that you have already sent this user a copy.
|
| | |
|
| | | For an executable, the required form of the "work that uses the
|
| | | Library" must include any data and utility programs needed for
|
| | | reproducing the executable from it. However, as a special exception,
|
| | | the materials to be distributed need not include anything that is
|
| | | normally distributed (in either source or binary form) with the major
|
| | | components (compiler, kernel, and so on) of the operating system on
|
| | | which the executable runs, unless that component itself accompanies
|
| | | the executable.
|
| | |
|
| | | It may happen that this requirement contradicts the license
|
| | | restrictions of other proprietary libraries that do not normally
|
| | | accompany the operating system. Such a contradiction means you cannot
|
| | | use both them and the Library together in an executable that you
|
| | | distribute.
|
| | |
|
| | | 7. You may place library facilities that are a work based on the
|
| | | Library side-by-side in a single library together with other library
|
| | | facilities not covered by this License, and distribute such a combined
|
| | | library, provided that the separate distribution of the work based on
|
| | | the Library and of the other library facilities is otherwise
|
| | | permitted, and provided that you do these two things:
|
| | |
|
| | | a) Accompany the combined library with a copy of the same work
|
| | | based on the Library, uncombined with any other library
|
| | | facilities. This must be distributed under the terms of the
|
| | | Sections above.
|
| | |
|
| | | b) Give prominent notice with the combined library of the fact
|
| | | that part of it is a work based on the Library, and explaining
|
| | | where to find the accompanying uncombined form of the same work.
|
| | |
|
| | | 8. You may not copy, modify, sublicense, link with, or distribute
|
| | | the Library except as expressly provided under this License. Any
|
| | | attempt otherwise to copy, modify, sublicense, link with, or
|
| | | distribute the Library is void, and will automatically terminate your
|
| | | rights under this License. However, parties who have received copies,
|
| | | or rights, from you under this License will not have their licenses
|
| | | terminated so long as such parties remain in full compliance.
|
| | |
|
| | | 9. You are not required to accept this License, since you have not
|
| | | signed it. However, nothing else grants you permission to modify or
|
| | | distribute the Library or its derivative works. These actions are
|
| | | prohibited by law if you do not accept this License. Therefore, by
|
| | | modifying or distributing the Library (or any work based on the
|
| | | Library), you indicate your acceptance of this License to do so, and
|
| | | all its terms and conditions for copying, distributing or modifying
|
| | | the Library or works based on it.
|
| | |
|
| | | 10. Each time you redistribute the Library (or any work based on the
|
| | | Library), the recipient automatically receives a license from the
|
| | | original licensor to copy, distribute, link with or modify the Library
|
| | | subject to these terms and conditions. You may not impose any further
|
| | | restrictions on the recipients' exercise of the rights granted herein.
|
| | | You are not responsible for enforcing compliance by third parties with
|
| | | this License.
|
| | |
|
| | | 11. If, as a consequence of a court judgment or allegation of patent
|
| | | infringement or for any other reason (not limited to patent issues),
|
| | | conditions are imposed on you (whether by court order, agreement or
|
| | | otherwise) that contradict the conditions of this License, they do not
|
| | | excuse you from the conditions of this License. If you cannot
|
| | | distribute so as to satisfy simultaneously your obligations under this
|
| | | License and any other pertinent obligations, then as a consequence you
|
| | | may not distribute the Library at all. For example, if a patent
|
| | | license would not permit royalty-free redistribution of the Library by
|
| | | all those who receive copies directly or indirectly through you, then
|
| | | the only way you could satisfy both it and this License would be to
|
| | | refrain entirely from distribution of the Library.
|
| | |
|
| | | If any portion of this section is held invalid or unenforceable under any
|
| | | particular circumstance, the balance of the section is intended to apply,
|
| | | and the section as a whole is intended to apply in other circumstances.
|
| | |
|
| | | It is not the purpose of this section to induce you to infringe any
|
| | | patents or other property right claims or to contest validity of any
|
| | | such claims; this section has the sole purpose of protecting the
|
| | | integrity of the free software distribution system which is
|
| | | implemented by public license practices. Many people have made
|
| | | generous contributions to the wide range of software distributed
|
| | | through that system in reliance on consistent application of that
|
| | | system; it is up to the author/donor to decide if he or she is willing
|
| | | to distribute software through any other system and a licensee cannot
|
| | | impose that choice.
|
| | |
|
| | | This section is intended to make thoroughly clear what is believed to
|
| | | be a consequence of the rest of this License.
|
| | |
|
| | | 12. If the distribution and/or use of the Library is restricted in
|
| | | certain countries either by patents or by copyrighted interfaces, the
|
| | | original copyright holder who places the Library under this License may add
|
| | | an explicit geographical distribution limitation excluding those countries,
|
| | | so that distribution is permitted only in or among countries not thus
|
| | | excluded. In such case, this License incorporates the limitation as if
|
| | | written in the body of this License.
|
| | |
|
| | | 13. The Free Software Foundation may publish revised and/or new
|
| | | versions of the Lesser General Public License from time to time.
|
| | | Such new versions will be similar in spirit to the present version,
|
| | | but may differ in detail to address new problems or concerns.
|
| | |
|
| | | Each version is given a distinguishing version number. If the Library
|
| | | specifies a version number of this License which applies to it and
|
| | | "any later version", you have the option of following the terms and
|
| | | conditions either of that version or of any later version published by
|
| | | the Free Software Foundation. If the Library does not specify a
|
| | | license version number, you may choose any version ever published by
|
| | | the Free Software Foundation.
|
| | |
|
| | | 14. If you wish to incorporate parts of the Library into other free
|
| | | programs whose distribution conditions are incompatible with these,
|
| | | write to the author to ask for permission. For software which is
|
| | | copyrighted by the Free Software Foundation, write to the Free
|
| | | Software Foundation; we sometimes make exceptions for this. Our
|
| | | decision will be guided by the two goals of preserving the free status
|
| | | of all derivatives of our free software and of promoting the sharing
|
| | | and reuse of software generally.
|
| | |
|
| | | NO WARRANTY
|
| | |
|
| | | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
| | | WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
| | | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
| | | OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
| | | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
| | | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
| | | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
| | | LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
| | | THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
| | |
|
| | | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
| | | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
| | | AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
| | | FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
| | | CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
| | | LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
| | | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
| | | FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
| | | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
| | | DAMAGES.
|
| | |
|
| | | END OF TERMS AND CONDITIONS
|
| | |
|
| | | How to Apply These Terms to Your New Libraries
|
| | |
|
| | | If you develop a new library, and you want it to be of the greatest
|
| | | possible use to the public, we recommend making it free software that
|
| | | everyone can redistribute and change. You can do so by permitting
|
| | | redistribution under these terms (or, alternatively, under the terms of the
|
| | | ordinary General Public License).
|
| | |
|
| | | To apply these terms, attach the following notices to the library. It is
|
| | | safest to attach them to the start of each source file to most effectively
|
| | | convey the exclusion of warranty; and each file should have at least the
|
| | | "copyright" line and a pointer to where the full notice is found.
|
| | |
|
| | | <one line to give the library's name and a brief idea of what it does.>
|
| | | Copyright (C) <year> <name of author>
|
| | |
|
| | | This library is free software; you can redistribute it and/or
|
| | | modify it under the terms of the GNU Lesser General Public
|
| | | License as published by the Free Software Foundation; either
|
| | | version 2.1 of the License, or (at your option) any later version.
|
| | |
|
| | | This library is distributed in the hope that it will be useful,
|
| | | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| | | Lesser General Public License for more details.
|
| | |
|
| | | You should have received a copy of the GNU Lesser General Public
|
| | | License along with this library; if not, write to the Free Software
|
| | | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
| | |
|
| | | Also add information on how to contact you by electronic and paper mail.
|
| | |
|
| | | You should also get your employer (if you work as a programmer) or your
|
| | | school, if any, to sign a "copyright disclaimer" for the library, if
|
| | | necessary. Here is a sample; alter the names:
|
| | |
|
| | | Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
| | | library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
| | |
|
| | | <signature of Ty Coon>, 1 April 1990
|
| | | Ty Coon, President of Vice
|
| | |
|
| | | That's all there is to it!
|
| | |
|
| | |
|
| | | GNU LESSER GENERAL PUBLIC LICENSE |
| | | Version 2.1, February 1999 |
| | | |
| | | Copyright (C) 1991, 1999 Free Software Foundation, Inc. |
| | | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| | | Everyone is permitted to copy and distribute verbatim copies |
| | | of this license document, but changing it is not allowed. |
| | | |
| | | [This is the first released version of the Lesser GPL. It also counts |
| | | as the successor of the GNU Library Public License, version 2, hence |
| | | the version number 2.1.] |
| | | |
| | | Preamble |
| | | |
| | | The licenses for most software are designed to take away your |
| | | freedom to share and change it. By contrast, the GNU General Public |
| | | Licenses are intended to guarantee your freedom to share and change |
| | | free software--to make sure the software is free for all its users. |
| | | |
| | | This license, the Lesser General Public License, applies to some |
| | | specially designated software packages--typically libraries--of the |
| | | Free Software Foundation and other authors who decide to use it. You |
| | | can use it too, but we suggest you first think carefully about whether |
| | | this license or the ordinary General Public License is the better |
| | | strategy to use in any particular case, based on the explanations below. |
| | | |
| | | When we speak of free software, we are referring to freedom of use, |
| | | not price. Our General Public Licenses are designed to make sure that |
| | | you have the freedom to distribute copies of free software (and charge |
| | | for this service if you wish); that you receive source code or can get |
| | | it if you want it; that you can change the software and use pieces of |
| | | it in new free programs; and that you are informed that you can do |
| | | these things. |
| | | |
| | | To protect your rights, we need to make restrictions that forbid |
| | | distributors to deny you these rights or to ask you to surrender these |
| | | rights. These restrictions translate to certain responsibilities for |
| | | you if you distribute copies of the library or if you modify it. |
| | | |
| | | For example, if you distribute copies of the library, whether gratis |
| | | or for a fee, you must give the recipients all the rights that we gave |
| | | you. You must make sure that they, too, receive or can get the source |
| | | code. If you link other code with the library, you must provide |
| | | complete object files to the recipients, so that they can relink them |
| | | with the library after making changes to the library and recompiling |
| | | it. And you must show them these terms so they know their rights. |
| | | |
| | | We protect your rights with a two-step method: (1) we copyright the |
| | | library, and (2) we offer you this license, which gives you legal |
| | | permission to copy, distribute and/or modify the library. |
| | | |
| | | To protect each distributor, we want to make it very clear that |
| | | there is no warranty for the free library. Also, if the library is |
| | | modified by someone else and passed on, the recipients should know |
| | | that what they have is not the original version, so that the original |
| | | author's reputation will not be affected by problems that might be |
| | | introduced by others. |
| | | |
| | | Finally, software patents pose a constant threat to the existence of |
| | | any free program. We wish to make sure that a company cannot |
| | | effectively restrict the users of a free program by obtaining a |
| | | restrictive license from a patent holder. Therefore, we insist that |
| | | any patent license obtained for a version of the library must be |
| | | consistent with the full freedom of use specified in this license. |
| | | |
| | | Most GNU software, including some libraries, is covered by the |
| | | ordinary GNU General Public License. This license, the GNU Lesser |
| | | General Public License, applies to certain designated libraries, and |
| | | is quite different from the ordinary General Public License. We use |
| | | this license for certain libraries in order to permit linking those |
| | | libraries into non-free programs. |
| | | |
| | | When a program is linked with a library, whether statically or using |
| | | a shared library, the combination of the two is legally speaking a |
| | | combined work, a derivative of the original library. The ordinary |
| | | General Public License therefore permits such linking only if the |
| | | entire combination fits its criteria of freedom. The Lesser General |
| | | Public License permits more lax criteria for linking other code with |
| | | the library. |
| | | |
| | | We call this license the "Lesser" General Public License because it |
| | | does Less to protect the user's freedom than the ordinary General |
| | | Public License. It also provides other free software developers Less |
| | | of an advantage over competing non-free programs. These disadvantages |
| | | are the reason we use the ordinary General Public License for many |
| | | libraries. However, the Lesser license provides advantages in certain |
| | | special circumstances. |
| | | |
| | | For example, on rare occasions, there may be a special need to |
| | | encourage the widest possible use of a certain library, so that it becomes |
| | | a de-facto standard. To achieve this, non-free programs must be |
| | | allowed to use the library. A more frequent case is that a free |
| | | library does the same job as widely used non-free libraries. In this |
| | | case, there is little to gain by limiting the free library to free |
| | | software only, so we use the Lesser General Public License. |
| | | |
| | | In other cases, permission to use a particular library in non-free |
| | | programs enables a greater number of people to use a large body of |
| | | free software. For example, permission to use the GNU C Library in |
| | | non-free programs enables many more people to use the whole GNU |
| | | operating system, as well as its variant, the GNU/Linux operating |
| | | system. |
| | | |
| | | Although the Lesser General Public License is Less protective of the |
| | | users' freedom, it does ensure that the user of a program that is |
| | | linked with the Library has the freedom and the wherewithal to run |
| | | that program using a modified version of the Library. |
| | | |
| | | The precise terms and conditions for copying, distribution and |
| | | modification follow. Pay close attention to the difference between a |
| | | "work based on the library" and a "work that uses the library". The |
| | | former contains code derived from the library, whereas the latter must |
| | | be combined with the library in order to run. |
| | | |
| | | GNU LESSER GENERAL PUBLIC LICENSE |
| | | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
| | | |
| | | 0. This License Agreement applies to any software library or other |
| | | program which contains a notice placed by the copyright holder or |
| | | other authorized party saying it may be distributed under the terms of |
| | | this Lesser General Public License (also called "this License"). |
| | | Each licensee is addressed as "you". |
| | | |
| | | A "library" means a collection of software functions and/or data |
| | | prepared so as to be conveniently linked with application programs |
| | | (which use some of those functions and data) to form executables. |
| | | |
| | | The "Library", below, refers to any such software library or work |
| | | which has been distributed under these terms. A "work based on the |
| | | Library" means either the Library or any derivative work under |
| | | copyright law: that is to say, a work containing the Library or a |
| | | portion of it, either verbatim or with modifications and/or translated |
| | | straightforwardly into another language. (Hereinafter, translation is |
| | | included without limitation in the term "modification".) |
| | | |
| | | "Source code" for a work means the preferred form of the work for |
| | | making modifications to it. For a library, complete source code means |
| | | all the source code for all modules it contains, plus any associated |
| | | interface definition files, plus the scripts used to control compilation |
| | | and installation of the library. |
| | | |
| | | Activities other than copying, distribution and modification are not |
| | | covered by this License; they are outside its scope. The act of |
| | | running a program using the Library is not restricted, and output from |
| | | such a program is covered only if its contents constitute a work based |
| | | on the Library (independent of the use of the Library in a tool for |
| | | writing it). Whether that is true depends on what the Library does |
| | | and what the program that uses the Library does. |
| | | |
| | | 1. You may copy and distribute verbatim copies of the Library's |
| | | complete source code as you receive it, in any medium, provided that |
| | | you conspicuously and appropriately publish on each copy an |
| | | appropriate copyright notice and disclaimer of warranty; keep intact |
| | | all the notices that refer to this License and to the absence of any |
| | | warranty; and distribute a copy of this License along with the |
| | | Library. |
| | | |
| | | You may charge a fee for the physical act of transferring a copy, |
| | | and you may at your option offer warranty protection in exchange for a |
| | | fee. |
| | | |
| | | 2. You may modify your copy or copies of the Library or any portion |
| | | of it, thus forming a work based on the Library, and copy and |
| | | distribute such modifications or work under the terms of Section 1 |
| | | above, provided that you also meet all of these conditions: |
| | | |
| | | a) The modified work must itself be a software library. |
| | | |
| | | b) You must cause the files modified to carry prominent notices |
| | | stating that you changed the files and the date of any change. |
| | | |
| | | c) You must cause the whole of the work to be licensed at no |
| | | charge to all third parties under the terms of this License. |
| | | |
| | | d) If a facility in the modified Library refers to a function or a |
| | | table of data to be supplied by an application program that uses |
| | | the facility, other than as an argument passed when the facility |
| | | is invoked, then you must make a good faith effort to ensure that, |
| | | in the event an application does not supply such function or |
| | | table, the facility still operates, and performs whatever part of |
| | | its purpose remains meaningful. |
| | | |
| | | (For example, a function in a library to compute square roots has |
| | | a purpose that is entirely well-defined independent of the |
| | | application. Therefore, Subsection 2d requires that any |
| | | application-supplied function or table used by this function must |
| | | be optional: if the application does not supply it, the square |
| | | root function must still compute square roots.) |
| | | |
| | | These requirements apply to the modified work as a whole. If |
| | | identifiable sections of that work are not derived from the Library, |
| | | and can be reasonably considered independent and separate works in |
| | | themselves, then this License, and its terms, do not apply to those |
| | | sections when you distribute them as separate works. But when you |
| | | distribute the same sections as part of a whole which is a work based |
| | | on the Library, the distribution of the whole must be on the terms of |
| | | this License, whose permissions for other licensees extend to the |
| | | entire whole, and thus to each and every part regardless of who wrote |
| | | it. |
| | | |
| | | Thus, it is not the intent of this section to claim rights or contest |
| | | your rights to work written entirely by you; rather, the intent is to |
| | | exercise the right to control the distribution of derivative or |
| | | collective works based on the Library. |
| | | |
| | | In addition, mere aggregation of another work not based on the Library |
| | | with the Library (or with a work based on the Library) on a volume of |
| | | a storage or distribution medium does not bring the other work under |
| | | the scope of this License. |
| | | |
| | | 3. You may opt to apply the terms of the ordinary GNU General Public |
| | | License instead of this License to a given copy of the Library. To do |
| | | this, you must alter all the notices that refer to this License, so |
| | | that they refer to the ordinary GNU General Public License, version 2, |
| | | instead of to this License. (If a newer version than version 2 of the |
| | | ordinary GNU General Public License has appeared, then you can specify |
| | | that version instead if you wish.) Do not make any other change in |
| | | these notices. |
| | | |
| | | Once this change is made in a given copy, it is irreversible for |
| | | that copy, so the ordinary GNU General Public License applies to all |
| | | subsequent copies and derivative works made from that copy. |
| | | |
| | | This option is useful when you wish to copy part of the code of |
| | | the Library into a program that is not a library. |
| | | |
| | | 4. You may copy and distribute the Library (or a portion or |
| | | derivative of it, under Section 2) in object code or executable form |
| | | under the terms of Sections 1 and 2 above provided that you accompany |
| | | it with the complete corresponding machine-readable source code, which |
| | | must be distributed under the terms of Sections 1 and 2 above on a |
| | | medium customarily used for software interchange. |
| | | |
| | | If distribution of object code is made by offering access to copy |
| | | from a designated place, then offering equivalent access to copy the |
| | | source code from the same place satisfies the requirement to |
| | | distribute the source code, even though third parties are not |
| | | compelled to copy the source along with the object code. |
| | | |
| | | 5. A program that contains no derivative of any portion of the |
| | | Library, but is designed to work with the Library by being compiled or |
| | | linked with it, is called a "work that uses the Library". Such a |
| | | work, in isolation, is not a derivative work of the Library, and |
| | | therefore falls outside the scope of this License. |
| | | |
| | | However, linking a "work that uses the Library" with the Library |
| | | creates an executable that is a derivative of the Library (because it |
| | | contains portions of the Library), rather than a "work that uses the |
| | | library". The executable is therefore covered by this License. |
| | | Section 6 states terms for distribution of such executables. |
| | | |
| | | When a "work that uses the Library" uses material from a header file |
| | | that is part of the Library, the object code for the work may be a |
| | | derivative work of the Library even though the source code is not. |
| | | Whether this is true is especially significant if the work can be |
| | | linked without the Library, or if the work is itself a library. The |
| | | threshold for this to be true is not precisely defined by law. |
| | | |
| | | If such an object file uses only numerical parameters, data |
| | | structure layouts and accessors, and small macros and small inline |
| | | functions (ten lines or less in length), then the use of the object |
| | | file is unrestricted, regardless of whether it is legally a derivative |
| | | work. (Executables containing this object code plus portions of the |
| | | Library will still fall under Section 6.) |
| | | |
| | | Otherwise, if the work is a derivative of the Library, you may |
| | | distribute the object code for the work under the terms of Section 6. |
| | | Any executables containing that work also fall under Section 6, |
| | | whether or not they are linked directly with the Library itself. |
| | | |
| | | 6. As an exception to the Sections above, you may also combine or |
| | | link a "work that uses the Library" with the Library to produce a |
| | | work containing portions of the Library, and distribute that work |
| | | under terms of your choice, provided that the terms permit |
| | | modification of the work for the customer's own use and reverse |
| | | engineering for debugging such modifications. |
| | | |
| | | You must give prominent notice with each copy of the work that the |
| | | Library is used in it and that the Library and its use are covered by |
| | | this License. You must supply a copy of this License. If the work |
| | | during execution displays copyright notices, you must include the |
| | | copyright notice for the Library among them, as well as a reference |
| | | directing the user to the copy of this License. Also, you must do one |
| | | of these things: |
| | | |
| | | a) Accompany the work with the complete corresponding |
| | | machine-readable source code for the Library including whatever |
| | | changes were used in the work (which must be distributed under |
| | | Sections 1 and 2 above); and, if the work is an executable linked |
| | | with the Library, with the complete machine-readable "work that |
| | | uses the Library", as object code and/or source code, so that the |
| | | user can modify the Library and then relink to produce a modified |
| | | executable containing the modified Library. (It is understood |
| | | that the user who changes the contents of definitions files in the |
| | | Library will not necessarily be able to recompile the application |
| | | to use the modified definitions.) |
| | | |
| | | b) Use a suitable shared library mechanism for linking with the |
| | | Library. A suitable mechanism is one that (1) uses at run time a |
| | | copy of the library already present on the user's computer system, |
| | | rather than copying library functions into the executable, and (2) |
| | | will operate properly with a modified version of the library, if |
| | | the user installs one, as long as the modified version is |
| | | interface-compatible with the version that the work was made with. |
| | | |
| | | c) Accompany the work with a written offer, valid for at |
| | | least three years, to give the same user the materials |
| | | specified in Subsection 6a, above, for a charge no more |
| | | than the cost of performing this distribution. |
| | | |
| | | d) If distribution of the work is made by offering access to copy |
| | | from a designated place, offer equivalent access to copy the above |
| | | specified materials from the same place. |
| | | |
| | | e) Verify that the user has already received a copy of these |
| | | materials or that you have already sent this user a copy. |
| | | |
| | | For an executable, the required form of the "work that uses the |
| | | Library" must include any data and utility programs needed for |
| | | reproducing the executable from it. However, as a special exception, |
| | | the materials to be distributed need not include anything that is |
| | | normally distributed (in either source or binary form) with the major |
| | | components (compiler, kernel, and so on) of the operating system on |
| | | which the executable runs, unless that component itself accompanies |
| | | the executable. |
| | | |
| | | It may happen that this requirement contradicts the license |
| | | restrictions of other proprietary libraries that do not normally |
| | | accompany the operating system. Such a contradiction means you cannot |
| | | use both them and the Library together in an executable that you |
| | | distribute. |
| | | |
| | | 7. You may place library facilities that are a work based on the |
| | | Library side-by-side in a single library together with other library |
| | | facilities not covered by this License, and distribute such a combined |
| | | library, provided that the separate distribution of the work based on |
| | | the Library and of the other library facilities is otherwise |
| | | permitted, and provided that you do these two things: |
| | | |
| | | a) Accompany the combined library with a copy of the same work |
| | | based on the Library, uncombined with any other library |
| | | facilities. This must be distributed under the terms of the |
| | | Sections above. |
| | | |
| | | b) Give prominent notice with the combined library of the fact |
| | | that part of it is a work based on the Library, and explaining |
| | | where to find the accompanying uncombined form of the same work. |
| | | |
| | | 8. You may not copy, modify, sublicense, link with, or distribute |
| | | the Library except as expressly provided under this License. Any |
| | | attempt otherwise to copy, modify, sublicense, link with, or |
| | | distribute the Library is void, and will automatically terminate your |
| | | rights under this License. However, parties who have received copies, |
| | | or rights, from you under this License will not have their licenses |
| | | terminated so long as such parties remain in full compliance. |
| | | |
| | | 9. You are not required to accept this License, since you have not |
| | | signed it. However, nothing else grants you permission to modify or |
| | | distribute the Library or its derivative works. These actions are |
| | | prohibited by law if you do not accept this License. Therefore, by |
| | | modifying or distributing the Library (or any work based on the |
| | | Library), you indicate your acceptance of this License to do so, and |
| | | all its terms and conditions for copying, distributing or modifying |
| | | the Library or works based on it. |
| | | |
| | | 10. Each time you redistribute the Library (or any work based on the |
| | | Library), the recipient automatically receives a license from the |
| | | original licensor to copy, distribute, link with or modify the Library |
| | | subject to these terms and conditions. You may not impose any further |
| | | restrictions on the recipients' exercise of the rights granted herein. |
| | | You are not responsible for enforcing compliance by third parties with |
| | | this License. |
| | | |
| | | 11. If, as a consequence of a court judgment or allegation of patent |
| | | infringement or for any other reason (not limited to patent issues), |
| | | conditions are imposed on you (whether by court order, agreement or |
| | | otherwise) that contradict the conditions of this License, they do not |
| | | excuse you from the conditions of this License. If you cannot |
| | | distribute so as to satisfy simultaneously your obligations under this |
| | | License and any other pertinent obligations, then as a consequence you |
| | | may not distribute the Library at all. For example, if a patent |
| | | license would not permit royalty-free redistribution of the Library by |
| | | all those who receive copies directly or indirectly through you, then |
| | | the only way you could satisfy both it and this License would be to |
| | | refrain entirely from distribution of the Library. |
| | | |
| | | If any portion of this section is held invalid or unenforceable under any |
| | | particular circumstance, the balance of the section is intended to apply, |
| | | and the section as a whole is intended to apply in other circumstances. |
| | | |
| | | It is not the purpose of this section to induce you to infringe any |
| | | patents or other property right claims or to contest validity of any |
| | | such claims; this section has the sole purpose of protecting the |
| | | integrity of the free software distribution system which is |
| | | implemented by public license practices. Many people have made |
| | | generous contributions to the wide range of software distributed |
| | | through that system in reliance on consistent application of that |
| | | system; it is up to the author/donor to decide if he or she is willing |
| | | to distribute software through any other system and a licensee cannot |
| | | impose that choice. |
| | | |
| | | This section is intended to make thoroughly clear what is believed to |
| | | be a consequence of the rest of this License. |
| | | |
| | | 12. If the distribution and/or use of the Library is restricted in |
| | | certain countries either by patents or by copyrighted interfaces, the |
| | | original copyright holder who places the Library under this License may add |
| | | an explicit geographical distribution limitation excluding those countries, |
| | | so that distribution is permitted only in or among countries not thus |
| | | excluded. In such case, this License incorporates the limitation as if |
| | | written in the body of this License. |
| | | |
| | | 13. The Free Software Foundation may publish revised and/or new |
| | | versions of the Lesser General Public License from time to time. |
| | | Such new versions will be similar in spirit to the present version, |
| | | but may differ in detail to address new problems or concerns. |
| | | |
| | | Each version is given a distinguishing version number. If the Library |
| | | specifies a version number of this License which applies to it and |
| | | "any later version", you have the option of following the terms and |
| | | conditions either of that version or of any later version published by |
| | | the Free Software Foundation. If the Library does not specify a |
| | | license version number, you may choose any version ever published by |
| | | the Free Software Foundation. |
| | | |
| | | 14. If you wish to incorporate parts of the Library into other free |
| | | programs whose distribution conditions are incompatible with these, |
| | | write to the author to ask for permission. For software which is |
| | | copyrighted by the Free Software Foundation, write to the Free |
| | | Software Foundation; we sometimes make exceptions for this. Our |
| | | decision will be guided by the two goals of preserving the free status |
| | | of all derivatives of our free software and of promoting the sharing |
| | | and reuse of software generally. |
| | | |
| | | NO WARRANTY |
| | | |
| | | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO |
| | | WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. |
| | | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR |
| | | OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY |
| | | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE |
| | | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| | | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE |
| | | LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME |
| | | THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. |
| | | |
| | | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN |
| | | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY |
| | | AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU |
| | | FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR |
| | | CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE |
| | | LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING |
| | | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A |
| | | FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF |
| | | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
| | | DAMAGES. |
| | | |
| | | END OF TERMS AND CONDITIONS |
| | | |
| | | How to Apply These Terms to Your New Libraries |
| | | |
| | | If you develop a new library, and you want it to be of the greatest |
| | | possible use to the public, we recommend making it free software that |
| | | everyone can redistribute and change. You can do so by permitting |
| | | redistribution under these terms (or, alternatively, under the terms of the |
| | | ordinary General Public License). |
| | | |
| | | To apply these terms, attach the following notices to the library. It is |
| | | safest to attach them to the start of each source file to most effectively |
| | | convey the exclusion of warranty; and each file should have at least the |
| | | "copyright" line and a pointer to where the full notice is found. |
| | | |
| | | <one line to give the library's name and a brief idea of what it does.> |
| | | Copyright (C) <year> <name of author> |
| | | |
| | | This library is free software; you can redistribute it and/or |
| | | modify it under the terms of the GNU Lesser General Public |
| | | License as published by the Free Software Foundation; either |
| | | version 2.1 of the License, or (at your option) any later version. |
| | | |
| | | This library is distributed in the hope that it will be useful, |
| | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| | | Lesser General Public License for more details. |
| | | |
| | | You should have received a copy of the GNU Lesser General Public |
| | | License along with this library; if not, write to the Free Software |
| | | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| | | |
| | | Also add information on how to contact you by electronic and paper mail. |
| | | |
| | | You should also get your employer (if you work as a programmer) or your |
| | | school, if any, to sign a "copyright disclaimer" for the library, if |
| | | necessary. Here is a sample; alter the names: |
| | | |
| | | Yoyodyne, Inc., hereby disclaims all copyright interest in the |
| | | library `Frob' (a library for tweaking knobs) written by James Random Hacker. |
| | | |
| | | <signature of Ty Coon>, 1 April 1990 |
| | | Ty Coon, President of Vice |
| | | |
| | | That's all there is to it! |
| | | |
| | | |
| | |
| | | .mceItemFlash, .mceItemShockWave, .mceItemQuickTime, .mceItemWindowsMedia, .mceItemRealMedia {
|
| | | border: 1px dotted #cc0000;
|
| | | background-position: center;
|
| | | background-repeat: no-repeat;
|
| | | background-color: #ffffcc;
|
| | | }
|
| | |
|
| | | .mceItemShockWave {
|
| | | background-image: url('../images/shockwave.gif');
|
| | | }
|
| | |
|
| | | .mceItemFlash {
|
| | | background-image: url('../images/flash.gif');
|
| | | }
|
| | |
|
| | | .mceItemQuickTime {
|
| | | background-image: url('../images/quicktime.gif');
|
| | | }
|
| | |
|
| | | .mceItemWindowsMedia {
|
| | | background-image: url('../images/windowsmedia.gif');
|
| | | }
|
| | |
|
| | | .mceItemRealMedia {
|
| | | background-image: url('../images/realmedia.gif');
|
| | | }
|
| | | .mceItemFlash, .mceItemShockWave, .mceItemQuickTime, .mceItemWindowsMedia, .mceItemRealMedia { |
| | | border: 1px dotted #cc0000; |
| | | background-position: center; |
| | | background-repeat: no-repeat; |
| | | background-color: #ffffcc; |
| | | } |
| | | |
| | | .mceItemShockWave { |
| | | background-image: url('../images/shockwave.gif'); |
| | | } |
| | | |
| | | .mceItemFlash { |
| | | background-image: url('../images/flash.gif'); |
| | | } |
| | | |
| | | .mceItemQuickTime { |
| | | background-image: url('../images/quicktime.gif'); |
| | | } |
| | | |
| | | .mceItemWindowsMedia { |
| | | background-image: url('../images/windowsmedia.gif'); |
| | | } |
| | | |
| | | .mceItemRealMedia { |
| | | background-image: url('../images/realmedia.gif'); |
| | | } |
| | |
| | | #id, #name, #hspace, #vspace, #class_name, #align {
|
| | | width: 100px;
|
| | | }
|
| | |
|
| | | #hspace, #vspace {
|
| | | width: 50px;
|
| | | }
|
| | |
|
| | | #flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode {
|
| | | width: 100px;
|
| | | }
|
| | |
|
| | | #flash_base, #flash_flashvars {
|
| | | width: 240px;
|
| | | }
|
| | |
|
| | | #width, #height {
|
| | | width: 40px;
|
| | | }
|
| | |
|
| | | #src, #media_type {
|
| | | width: 250px;
|
| | | }
|
| | |
|
| | | #class {
|
| | | width: 120px;
|
| | | }
|
| | |
|
| | | #prev {
|
| | | margin: 0;
|
| | | border: 1px solid black;
|
| | | width: 99%;
|
| | | height: 230px;
|
| | | overflow: auto;
|
| | | }
|
| | |
|
| | | .panel_wrapper div.current {
|
| | | height: 390px;
|
| | | overflow: auto;
|
| | | }
|
| | |
|
| | | #flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options {
|
| | | display: none;
|
| | | }
|
| | |
|
| | | .mceAddSelectValue {
|
| | | background-color: #DDDDDD;
|
| | | }
|
| | |
|
| | | #qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume {
|
| | | width: 70px;
|
| | | }
|
| | |
|
| | | #wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume {
|
| | | width: 70px;
|
| | | }
|
| | |
|
| | | #rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks {
|
| | | width: 70px;
|
| | | }
|
| | |
|
| | | #shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle {
|
| | | width: 90px;
|
| | | }
|
| | |
|
| | | #qt_qtsrc {
|
| | | width: 200px;
|
| | | }
|
| | | #id, #name, #hspace, #vspace, #class_name, #align { |
| | | width: 100px; |
| | | } |
| | | |
| | | #hspace, #vspace { |
| | | width: 50px; |
| | | } |
| | | |
| | | #flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode { |
| | | width: 100px; |
| | | } |
| | | |
| | | #flash_base, #flash_flashvars { |
| | | width: 240px; |
| | | } |
| | | |
| | | #width, #height { |
| | | width: 40px; |
| | | } |
| | | |
| | | #src, #media_type { |
| | | width: 250px; |
| | | } |
| | | |
| | | #class { |
| | | width: 120px; |
| | | } |
| | | |
| | | #prev { |
| | | margin: 0; |
| | | border: 1px solid black; |
| | | width: 99%; |
| | | height: 230px; |
| | | overflow: auto; |
| | | } |
| | | |
| | | .panel_wrapper div.current { |
| | | height: 390px; |
| | | overflow: auto; |
| | | } |
| | | |
| | | #flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options { |
| | | display: none; |
| | | } |
| | | |
| | | .mceAddSelectValue { |
| | | background-color: #DDDDDD; |
| | | } |
| | | |
| | | #qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume { |
| | | width: 70px; |
| | | } |
| | | |
| | | #wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume { |
| | | width: 70px; |
| | | } |
| | | |
| | | #rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks { |
| | | width: 70px; |
| | | } |
| | | |
| | | #shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle { |
| | | width: 90px; |
| | | } |
| | | |
| | | #qt_qtsrc { |
| | | width: 200px; |
| | | } |
| | |
| | | /**
|
| | | * $Id: editor_plugin_src.js 296 2007-08-21 10:36:35Z spocke $
|
| | | *
|
| | | * @author Moxiecode
|
| | | * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
| | | */
|
| | |
|
| | | /* Import plugin specific language pack */
|
| | | tinyMCE.importPluginLanguagePack('media');
|
| | |
|
| | | var TinyMCE_MediaPlugin = {
|
| | | getInfo : function() {
|
| | | return {
|
| | | longname : 'Media',
|
| | | author : 'Moxiecode Systems AB',
|
| | | authorurl : 'http://tinymce.moxiecode.com',
|
| | | infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',
|
| | | version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
|
| | | };
|
| | | },
|
| | |
|
| | | initInstance : function(inst) {
|
| | | // Warn if user has flash plugin and media plugin at the same time
|
| | | if (inst.hasPlugin('flash') && !tinyMCE.flashWarn) {
|
| | | alert('Flash plugin is deprecated and should not be used together with the media plugin.');
|
| | | tinyMCE.flashWarn = true;
|
| | | }
|
| | |
|
| | | if (!tinyMCE.settings['media_skip_plugin_css'])
|
| | | tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/media/css/content.css");
|
| | | },
|
| | |
|
| | | getControlHTML : function(cn) {
|
| | | switch (cn) {
|
| | | case "media":
|
| | | return tinyMCE.getButtonHTML(cn, 'lang_media_desc', '{$pluginurl}/images/media.gif', 'mceMedia');
|
| | | }
|
| | |
|
| | | return "";
|
| | | },
|
| | |
|
| | | execCommand : function(editor_id, element, command, user_interface, value) {
|
| | | // Handle commands
|
| | | switch (command) {
|
| | | case "mceMedia":
|
| | | tinyMCE.openWindow({
|
| | | file : '../../plugins/media/media.htm',
|
| | | width : 430 + tinyMCE.getLang('lang_media_delta_width', 0),
|
| | | height : 470 + tinyMCE.getLang('lang_media_delta_height', 0)
|
| | | }, {
|
| | | editor_id : editor_id,
|
| | | inline : "yes"
|
| | | });
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | // Pass to next handler in chain
|
| | | return false;
|
| | | },
|
| | |
|
| | | cleanup : function(type, content, inst) {
|
| | | var nl, img, i, ne, d, s, ci;
|
| | |
|
| | | switch (type) {
|
| | | case "insert_to_editor":
|
| | | img = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
|
| | | content = content.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, '<img class="mceItem$1" title="$2" src="' + img + '" />');
|
| | | content = content.replace(/<object([^>]*)>/gi, '<div class="mceItemObject" $1>');
|
| | | content = content.replace(/<embed([^>]*)>/gi, '<div class="mceItemObjectEmbed" $1>');
|
| | | content = content.replace(/<\/(object|embed)([^>]*)>/gi, '</div>');
|
| | | content = content.replace(/<param([^>]*)>/gi, '<div $1 class="mceItemParam"></div>');
|
| | | content = content.replace(new RegExp('\\/ class="mceItemParam"><\\/div>', 'gi'), 'class="mceItemParam"></div>');
|
| | | break;
|
| | |
|
| | | case "insert_to_editor_dom":
|
| | | d = inst.getDoc();
|
| | | nl = content.getElementsByTagName("img");
|
| | | for (i=0; i<nl.length; i++) {
|
| | | if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(nl[i].className)) {
|
| | | nl[i].width = nl[i].title.replace(/.*width:[^0-9]?([0-9]+)%?.*/g, '$1');
|
| | | nl[i].height = nl[i].title.replace(/.*height:[^0-9]?([0-9]+)%?.*/g, '$1');
|
| | | //nl[i].align = nl[i].title.replace(/.*align:([a-z]+).*/gi, '$1');
|
| | | }
|
| | | }
|
| | |
|
| | | nl = tinyMCE.selectElements(content, 'DIV', function (n) {return tinyMCE.hasCSSClass(n, 'mceItemObject');});
|
| | | for (i=0; i<nl.length; i++) {
|
| | | ci = tinyMCE.getAttrib(nl[i], "classid").toLowerCase().replace(/\s+/g, '');
|
| | |
|
| | | switch (ci) {
|
| | | case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':
|
| | | nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemFlash', d, nl[i]), nl[i]);
|
| | | break;
|
| | |
|
| | | case 'clsid:166b1bca-3f9c-11cf-8075-444553540000':
|
| | | nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemShockWave', d, nl[i]), nl[i]);
|
| | | break;
|
| | |
|
| | | case 'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':
|
| | | case 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':
|
| | | case 'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':
|
| | | nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemWindowsMedia', d, nl[i]), nl[i]);
|
| | | break;
|
| | |
|
| | | case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':
|
| | | nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemQuickTime', d, nl[i]), nl[i]);
|
| | | break;
|
| | |
|
| | | case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':
|
| | | nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemRealMedia', d, nl[i]), nl[i]);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | // Handle embed (if any)
|
| | | nl = tinyMCE.selectNodes(content, function (n) {return n.className == 'mceItemObjectEmbed';});
|
| | | for (i=0; i<nl.length; i++) {
|
| | | switch (tinyMCE.getAttrib(nl[i], 'type')) {
|
| | | case 'application/x-shockwave-flash':
|
| | | TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemFlash');
|
| | | break;
|
| | |
|
| | | case 'application/x-director':
|
| | | TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemShockWave');
|
| | | break;
|
| | |
|
| | | case 'application/x-mplayer2':
|
| | | TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemWindowsMedia');
|
| | | break;
|
| | |
|
| | | case 'video/quicktime':
|
| | | TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemQuickTime');
|
| | | break;
|
| | |
|
| | | case 'audio/x-pn-realaudio-plugin':
|
| | | TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemRealMedia');
|
| | | break;
|
| | | }
|
| | | }
|
| | | break;
|
| | |
|
| | | case "get_from_editor":
|
| | | var startPos = -1, endPos, attribs, chunkBefore, chunkAfter, embedHTML, at, pl, cb, mt, ex;
|
| | |
|
| | | while ((startPos = content.indexOf('<img', startPos+1)) != -1) {
|
| | | endPos = content.indexOf('/>', startPos);
|
| | | attribs = TinyMCE_MediaPlugin._parseAttributes(content.substring(startPos + 4, endPos));
|
| | |
|
| | | // Is not flash, skip it
|
| | | if (!/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(attribs['class']))
|
| | | continue;
|
| | |
|
| | | endPos += 2;
|
| | |
|
| | | // Parse attributes
|
| | | at = attribs['title'];
|
| | | if (at) {
|
| | | at = at.replace(/&(#39|apos);/g, "'");
|
| | | at = at.replace(/&#quot;/g, '"');
|
| | |
|
| | | try {
|
| | | pl = eval('x={' + at + '};');
|
| | | } catch (ex) {
|
| | | pl = {};
|
| | | }
|
| | | }
|
| | |
|
| | | // Use object/embed
|
| | | if (!tinyMCE.getParam('media_use_script', false)) {
|
| | | switch (attribs['class']) {
|
| | | case 'mceItemFlash':
|
| | | ci = 'd27cdb6e-ae6d-11cf-96b8-444553540000';
|
| | | cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
|
| | | mt = 'application/x-shockwave-flash';
|
| | | break;
|
| | |
|
| | | case 'mceItemShockWave':
|
| | | ci = '166B1BCA-3F9C-11CF-8075-444553540000';
|
| | | cb = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';
|
| | | mt = 'application/x-director';
|
| | | break;
|
| | |
|
| | | case 'mceItemWindowsMedia':
|
| | | ci = tinyMCE.getParam('media_wmp6_compatible') ? '05589FA1-C356-11CE-BF01-00AA0055595A' : '6BF52A52-394A-11D3-B153-00C04F79FAA6';
|
| | | cb = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
|
| | | mt = 'application/x-mplayer2';
|
| | | break;
|
| | |
|
| | | case 'mceItemQuickTime':
|
| | | ci = '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
|
| | | cb = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
|
| | | mt = 'video/quicktime';
|
| | | break;
|
| | |
|
| | | case 'mceItemRealMedia':
|
| | | ci = 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';
|
| | | cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
|
| | | mt = 'audio/x-pn-realaudio-plugin';
|
| | | break;
|
| | | }
|
| | |
|
| | | // Convert the URL
|
| | | pl.src = tinyMCE.convertURL(pl.src, null, true);
|
| | |
|
| | | embedHTML = TinyMCE_MediaPlugin._getEmbed(ci, cb, mt, pl, attribs);
|
| | | } else {
|
| | | // Use script version
|
| | | switch (attribs['class']) {
|
| | | case 'mceItemFlash':
|
| | | s = 'writeFlash';
|
| | | break;
|
| | |
|
| | | case 'mceItemShockWave':
|
| | | s = 'writeShockWave';
|
| | | break;
|
| | |
|
| | | case 'mceItemWindowsMedia':
|
| | | s = 'writeWindowsMedia';
|
| | | break;
|
| | |
|
| | | case 'mceItemQuickTime':
|
| | | s = 'writeQuickTime';
|
| | | break;
|
| | |
|
| | | case 'mceItemRealMedia':
|
| | | s = 'writeRealMedia';
|
| | | break;
|
| | | }
|
| | |
|
| | | if (attribs.width)
|
| | | at = at.replace(/width:[^0-9]?[0-9]+%?[^0-9]?/g, "width:'" + attribs.width + "'");
|
| | |
|
| | | if (attribs.height)
|
| | | at = at.replace(/height:[^0-9]?[0-9]+%?[^0-9]?/g, "height:'" + attribs.height + "'");
|
| | |
|
| | | // Force absolute URL
|
| | | pl.src = tinyMCE.convertURL(pl.src, null, true);
|
| | | at = at.replace(new RegExp("src:'[^']*'", "g"), "src:'" + pl.src + "'");
|
| | |
|
| | | embedHTML = '<script type="text/javascript">' + s + '({' + at + '});</script>';
|
| | | }
|
| | |
|
| | | // Insert embed/object chunk
|
| | | 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" && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(node, 'class'))) {
|
| | | tinyMCE.switchClass(editor_id + '_media', 'mceButtonSelected');
|
| | | return true;
|
| | | }
|
| | | } while ((node = node.parentNode));
|
| | |
|
| | | tinyMCE.switchClass(editor_id + '_media', 'mceButtonNormal');
|
| | |
|
| | | return true;
|
| | | },
|
| | |
|
| | | _createImgFromEmbed : function(n, d, cl) {
|
| | | var ne, at, i, ti = '', an;
|
| | |
|
| | | ne = d.createElement('img');
|
| | | ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
|
| | | ne.width = tinyMCE.getAttrib(n, 'width');
|
| | | ne.height = tinyMCE.getAttrib(n, 'height');
|
| | | ne.className = cl;
|
| | |
|
| | | at = n.attributes;
|
| | | for (i=0; i<at.length; i++) {
|
| | | if (at[i].specified && at[i].nodeValue) {
|
| | | an = at[i].nodeName.toLowerCase();
|
| | |
|
| | | if (an == 'src')
|
| | | continue;
|
| | |
|
| | | if (an == 'mce_src')
|
| | | an = 'src';
|
| | |
|
| | | if (an.indexOf('mce_') == -1 && !new RegExp('^(class|type)$').test(an))
|
| | | ti += an.toLowerCase() + ':\'' + at[i].nodeValue + "',";
|
| | | }
|
| | | }
|
| | |
|
| | | ti = ti.length > 0 ? ti.substring(0, ti.length - 1) : ti;
|
| | | ne.title = ti;
|
| | |
|
| | | n.parentNode.replaceChild(ne, n);
|
| | | },
|
| | |
|
| | | _createImg : function(cl, d, n) {
|
| | | var i, nl, ti = "", an, av, al = new Array();
|
| | |
|
| | | ne = d.createElement('img');
|
| | | ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
|
| | | ne.width = tinyMCE.getAttrib(n, 'width');
|
| | | ne.height = tinyMCE.getAttrib(n, 'height');
|
| | | ne.className = cl;
|
| | |
|
| | | al.id = tinyMCE.getAttrib(n, 'id');
|
| | | al.name = tinyMCE.getAttrib(n, 'name');
|
| | | al.width = tinyMCE.getAttrib(n, 'width');
|
| | | al.height = tinyMCE.getAttrib(n, 'height');
|
| | | al.bgcolor = tinyMCE.getAttrib(n, 'bgcolor');
|
| | | al.align = tinyMCE.getAttrib(n, 'align');
|
| | | al.class_name = tinyMCE.getAttrib(n, 'mce_class');
|
| | |
|
| | | nl = n.getElementsByTagName('div');
|
| | | for (i=0; i<nl.length; i++) {
|
| | | av = tinyMCE.getAttrib(nl[i], 'value');
|
| | | av = av.replace(new RegExp('\\\\', 'g'), '\\\\');
|
| | | av = av.replace(new RegExp('"', 'g'), '\\"');
|
| | | av = av.replace(new RegExp("'", 'g'), "\\'");
|
| | | an = tinyMCE.getAttrib(nl[i], 'name');
|
| | | al[an] = av;
|
| | | }
|
| | |
|
| | | if (al.movie) {
|
| | | al.src = al.movie;
|
| | | al.movie = null;
|
| | | }
|
| | |
|
| | | for (an in al) {
|
| | | if (al[an] != null && typeof(al[an]) != "function" && al[an] != '')
|
| | | ti += an.toLowerCase() + ':\'' + al[an] + "',";
|
| | | }
|
| | |
|
| | | ti = ti.length > 0 ? ti.substring(0, ti.length - 1) : ti;
|
| | | ne.title = ti;
|
| | |
|
| | | return ne;
|
| | | },
|
| | |
|
| | | _getEmbed : function(cls, cb, mt, p, at) {
|
| | | var h = '', n;
|
| | |
|
| | | p.width = at.width ? at.width : p.width;
|
| | | p.height = at.height ? at.height : p.height;
|
| | |
|
| | | h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
|
| | | h += typeof(p.id) != "undefined" ? ' id="' + p.id + '"' : '';
|
| | | h += typeof(p.name) != "undefined" ? ' name="' + p.name + '"' : '';
|
| | | h += typeof(p.width) != "undefined" ? ' width="' + p.width + '"' : '';
|
| | | h += typeof(p.height) != "undefined" ? ' height="' + p.height + '"' : '';
|
| | | h += typeof(p.align) != "undefined" ? ' align="' + p.align + '"' : '';
|
| | | h += '>';
|
| | |
|
| | | for (n in p) {
|
| | | if (typeof(p[n]) != "undefined" && typeof(p[n]) != "function") {
|
| | | h += '<param name="' + n + '" value="' + p[n] + '" />';
|
| | |
|
| | | // Add extra url parameter if it's an absolute URL on WMP
|
| | | if (n == 'src' && p[n].indexOf('://') != -1 && mt == 'application/x-mplayer2')
|
| | | h += '<param name="url" value="' + p[n] + '" />';
|
| | | }
|
| | | }
|
| | |
|
| | | h += '<embed type="' + mt + '"';
|
| | |
|
| | | for (n in p) {
|
| | | if (typeof(p[n]) == "function")
|
| | | continue;
|
| | |
|
| | | // Skip url parameter for embed tag on WMP
|
| | | if (!(n == 'url' && mt == 'application/x-mplayer2'))
|
| | | h += ' ' + n + '="' + p[n] + '"';
|
| | | }
|
| | |
|
| | | h += '></embed></object>';
|
| | |
|
| | | return h;
|
| | | },
|
| | |
|
| | | _parseAttributes : function(attribute_string) {
|
| | | var attributeName = "", endChr = '"';
|
| | | 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;
|
| | | endChr = chr;
|
| | | } else if (chr == endChr && 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("media", TinyMCE_MediaPlugin);
|
| | | /** |
| | | * $Id: editor_plugin_src.js 296 2007-08-21 10:36:35Z spocke $ |
| | | * |
| | | * @author Moxiecode |
| | | * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. |
| | | */ |
| | | |
| | | /* Import plugin specific language pack */ |
| | | tinyMCE.importPluginLanguagePack('media'); |
| | | |
| | | var TinyMCE_MediaPlugin = { |
| | | getInfo : function() { |
| | | return { |
| | | longname : 'Media', |
| | | author : 'Moxiecode Systems AB', |
| | | authorurl : 'http://tinymce.moxiecode.com', |
| | | infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media', |
| | | version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion |
| | | }; |
| | | }, |
| | | |
| | | initInstance : function(inst) { |
| | | // Warn if user has flash plugin and media plugin at the same time |
| | | if (inst.hasPlugin('flash') && !tinyMCE.flashWarn) { |
| | | alert('Flash plugin is deprecated and should not be used together with the media plugin.'); |
| | | tinyMCE.flashWarn = true; |
| | | } |
| | | |
| | | if (!tinyMCE.settings['media_skip_plugin_css']) |
| | | tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/media/css/content.css"); |
| | | }, |
| | | |
| | | getControlHTML : function(cn) { |
| | | switch (cn) { |
| | | case "media": |
| | | return tinyMCE.getButtonHTML(cn, 'lang_media_desc', '{$pluginurl}/images/media.gif', 'mceMedia'); |
| | | } |
| | | |
| | | return ""; |
| | | }, |
| | | |
| | | execCommand : function(editor_id, element, command, user_interface, value) { |
| | | // Handle commands |
| | | switch (command) { |
| | | case "mceMedia": |
| | | tinyMCE.openWindow({ |
| | | file : '../../plugins/media/media.htm', |
| | | width : 430 + tinyMCE.getLang('lang_media_delta_width', 0), |
| | | height : 470 + tinyMCE.getLang('lang_media_delta_height', 0) |
| | | }, { |
| | | editor_id : editor_id, |
| | | inline : "yes" |
| | | }); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | // Pass to next handler in chain |
| | | return false; |
| | | }, |
| | | |
| | | cleanup : function(type, content, inst) { |
| | | var nl, img, i, ne, d, s, ci; |
| | | |
| | | switch (type) { |
| | | case "insert_to_editor": |
| | | img = tinyMCE.getParam("theme_href") + '/images/spacer.gif'; |
| | | content = content.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, '<img class="mceItem$1" title="$2" src="' + img + '" />'); |
| | | content = content.replace(/<object([^>]*)>/gi, '<div class="mceItemObject" $1>'); |
| | | content = content.replace(/<embed([^>]*)>/gi, '<div class="mceItemObjectEmbed" $1>'); |
| | | content = content.replace(/<\/(object|embed)([^>]*)>/gi, '</div>'); |
| | | content = content.replace(/<param([^>]*)>/gi, '<div $1 class="mceItemParam"></div>'); |
| | | content = content.replace(new RegExp('\\/ class="mceItemParam"><\\/div>', 'gi'), 'class="mceItemParam"></div>'); |
| | | break; |
| | | |
| | | case "insert_to_editor_dom": |
| | | d = inst.getDoc(); |
| | | nl = content.getElementsByTagName("img"); |
| | | for (i=0; i<nl.length; i++) { |
| | | if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(nl[i].className)) { |
| | | nl[i].width = nl[i].title.replace(/.*width:[^0-9]?([0-9]+)%?.*/g, '$1'); |
| | | nl[i].height = nl[i].title.replace(/.*height:[^0-9]?([0-9]+)%?.*/g, '$1'); |
| | | //nl[i].align = nl[i].title.replace(/.*align:([a-z]+).*/gi, '$1'); |
| | | } |
| | | } |
| | | |
| | | nl = tinyMCE.selectElements(content, 'DIV', function (n) {return tinyMCE.hasCSSClass(n, 'mceItemObject');}); |
| | | for (i=0; i<nl.length; i++) { |
| | | ci = tinyMCE.getAttrib(nl[i], "classid").toLowerCase().replace(/\s+/g, ''); |
| | | |
| | | switch (ci) { |
| | | case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000': |
| | | nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemFlash', d, nl[i]), nl[i]); |
| | | break; |
| | | |
| | | case 'clsid:166b1bca-3f9c-11cf-8075-444553540000': |
| | | nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemShockWave', d, nl[i]), nl[i]); |
| | | break; |
| | | |
| | | case 'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6': |
| | | case 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95': |
| | | case 'clsid:05589fa1-c356-11ce-bf01-00aa0055595a': |
| | | nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemWindowsMedia', d, nl[i]), nl[i]); |
| | | break; |
| | | |
| | | case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b': |
| | | nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemQuickTime', d, nl[i]), nl[i]); |
| | | break; |
| | | |
| | | case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa': |
| | | nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemRealMedia', d, nl[i]), nl[i]); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | // Handle embed (if any) |
| | | nl = tinyMCE.selectNodes(content, function (n) {return n.className == 'mceItemObjectEmbed';}); |
| | | for (i=0; i<nl.length; i++) { |
| | | switch (tinyMCE.getAttrib(nl[i], 'type')) { |
| | | case 'application/x-shockwave-flash': |
| | | TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemFlash'); |
| | | break; |
| | | |
| | | case 'application/x-director': |
| | | TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemShockWave'); |
| | | break; |
| | | |
| | | case 'application/x-mplayer2': |
| | | TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemWindowsMedia'); |
| | | break; |
| | | |
| | | case 'video/quicktime': |
| | | TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemQuickTime'); |
| | | break; |
| | | |
| | | case 'audio/x-pn-realaudio-plugin': |
| | | TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemRealMedia'); |
| | | break; |
| | | } |
| | | } |
| | | break; |
| | | |
| | | case "get_from_editor": |
| | | var startPos = -1, endPos, attribs, chunkBefore, chunkAfter, embedHTML, at, pl, cb, mt, ex; |
| | | |
| | | while ((startPos = content.indexOf('<img', startPos+1)) != -1) { |
| | | endPos = content.indexOf('/>', startPos); |
| | | attribs = TinyMCE_MediaPlugin._parseAttributes(content.substring(startPos + 4, endPos)); |
| | | |
| | | // Is not flash, skip it |
| | | if (!/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(attribs['class'])) |
| | | continue; |
| | | |
| | | endPos += 2; |
| | | |
| | | // Parse attributes |
| | | at = attribs['title']; |
| | | if (at) { |
| | | at = at.replace(/&(#39|apos);/g, "'"); |
| | | at = at.replace(/&#quot;/g, '"'); |
| | | |
| | | try { |
| | | pl = eval('x={' + at + '};'); |
| | | } catch (ex) { |
| | | pl = {}; |
| | | } |
| | | } |
| | | |
| | | // Use object/embed |
| | | if (!tinyMCE.getParam('media_use_script', false)) { |
| | | switch (attribs['class']) { |
| | | case 'mceItemFlash': |
| | | ci = 'd27cdb6e-ae6d-11cf-96b8-444553540000'; |
| | | cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; |
| | | mt = 'application/x-shockwave-flash'; |
| | | break; |
| | | |
| | | case 'mceItemShockWave': |
| | | ci = '166B1BCA-3F9C-11CF-8075-444553540000'; |
| | | cb = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0'; |
| | | mt = 'application/x-director'; |
| | | break; |
| | | |
| | | case 'mceItemWindowsMedia': |
| | | ci = tinyMCE.getParam('media_wmp6_compatible') ? '05589FA1-C356-11CE-BF01-00AA0055595A' : '6BF52A52-394A-11D3-B153-00C04F79FAA6'; |
| | | cb = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; |
| | | mt = 'application/x-mplayer2'; |
| | | break; |
| | | |
| | | case 'mceItemQuickTime': |
| | | ci = '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B'; |
| | | cb = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0'; |
| | | mt = 'video/quicktime'; |
| | | break; |
| | | |
| | | case 'mceItemRealMedia': |
| | | ci = 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'; |
| | | cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; |
| | | mt = 'audio/x-pn-realaudio-plugin'; |
| | | break; |
| | | } |
| | | |
| | | // Convert the URL |
| | | pl.src = tinyMCE.convertURL(pl.src, null, true); |
| | | |
| | | embedHTML = TinyMCE_MediaPlugin._getEmbed(ci, cb, mt, pl, attribs); |
| | | } else { |
| | | // Use script version |
| | | switch (attribs['class']) { |
| | | case 'mceItemFlash': |
| | | s = 'writeFlash'; |
| | | break; |
| | | |
| | | case 'mceItemShockWave': |
| | | s = 'writeShockWave'; |
| | | break; |
| | | |
| | | case 'mceItemWindowsMedia': |
| | | s = 'writeWindowsMedia'; |
| | | break; |
| | | |
| | | case 'mceItemQuickTime': |
| | | s = 'writeQuickTime'; |
| | | break; |
| | | |
| | | case 'mceItemRealMedia': |
| | | s = 'writeRealMedia'; |
| | | break; |
| | | } |
| | | |
| | | if (attribs.width) |
| | | at = at.replace(/width:[^0-9]?[0-9]+%?[^0-9]?/g, "width:'" + attribs.width + "'"); |
| | | |
| | | if (attribs.height) |
| | | at = at.replace(/height:[^0-9]?[0-9]+%?[^0-9]?/g, "height:'" + attribs.height + "'"); |
| | | |
| | | // Force absolute URL |
| | | pl.src = tinyMCE.convertURL(pl.src, null, true); |
| | | at = at.replace(new RegExp("src:'[^']*'", "g"), "src:'" + pl.src + "'"); |
| | | |
| | | embedHTML = '<script type="text/javascript">' + s + '({' + at + '});</script>'; |
| | | } |
| | | |
| | | // Insert embed/object chunk |
| | | 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" && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(node, 'class'))) { |
| | | tinyMCE.switchClass(editor_id + '_media', 'mceButtonSelected'); |
| | | return true; |
| | | } |
| | | } while ((node = node.parentNode)); |
| | | |
| | | tinyMCE.switchClass(editor_id + '_media', 'mceButtonNormal'); |
| | | |
| | | return true; |
| | | }, |
| | | |
| | | _createImgFromEmbed : function(n, d, cl) { |
| | | var ne, at, i, ti = '', an; |
| | | |
| | | ne = d.createElement('img'); |
| | | ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif'; |
| | | ne.width = tinyMCE.getAttrib(n, 'width'); |
| | | ne.height = tinyMCE.getAttrib(n, 'height'); |
| | | ne.className = cl; |
| | | |
| | | at = n.attributes; |
| | | for (i=0; i<at.length; i++) { |
| | | if (at[i].specified && at[i].nodeValue) { |
| | | an = at[i].nodeName.toLowerCase(); |
| | | |
| | | if (an == 'src') |
| | | continue; |
| | | |
| | | if (an == 'mce_src') |
| | | an = 'src'; |
| | | |
| | | if (an.indexOf('mce_') == -1 && !new RegExp('^(class|type)$').test(an)) |
| | | ti += an.toLowerCase() + ':\'' + at[i].nodeValue + "',"; |
| | | } |
| | | } |
| | | |
| | | ti = ti.length > 0 ? ti.substring(0, ti.length - 1) : ti; |
| | | ne.title = ti; |
| | | |
| | | n.parentNode.replaceChild(ne, n); |
| | | }, |
| | | |
| | | _createImg : function(cl, d, n) { |
| | | var i, nl, ti = "", an, av, al = new Array(); |
| | | |
| | | ne = d.createElement('img'); |
| | | ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif'; |
| | | ne.width = tinyMCE.getAttrib(n, 'width'); |
| | | ne.height = tinyMCE.getAttrib(n, 'height'); |
| | | ne.className = cl; |
| | | |
| | | al.id = tinyMCE.getAttrib(n, 'id'); |
| | | al.name = tinyMCE.getAttrib(n, 'name'); |
| | | al.width = tinyMCE.getAttrib(n, 'width'); |
| | | al.height = tinyMCE.getAttrib(n, 'height'); |
| | | al.bgcolor = tinyMCE.getAttrib(n, 'bgcolor'); |
| | | al.align = tinyMCE.getAttrib(n, 'align'); |
| | | al.class_name = tinyMCE.getAttrib(n, 'mce_class'); |
| | | |
| | | nl = n.getElementsByTagName('div'); |
| | | for (i=0; i<nl.length; i++) { |
| | | av = tinyMCE.getAttrib(nl[i], 'value'); |
| | | av = av.replace(new RegExp('\\\\', 'g'), '\\\\'); |
| | | av = av.replace(new RegExp('"', 'g'), '\\"'); |
| | | av = av.replace(new RegExp("'", 'g'), "\\'"); |
| | | an = tinyMCE.getAttrib(nl[i], 'name'); |
| | | al[an] = av; |
| | | } |
| | | |
| | | if (al.movie) { |
| | | al.src = al.movie; |
| | | al.movie = null; |
| | | } |
| | | |
| | | for (an in al) { |
| | | if (al[an] != null && typeof(al[an]) != "function" && al[an] != '') |
| | | ti += an.toLowerCase() + ':\'' + al[an] + "',"; |
| | | } |
| | | |
| | | ti = ti.length > 0 ? ti.substring(0, ti.length - 1) : ti; |
| | | ne.title = ti; |
| | | |
| | | return ne; |
| | | }, |
| | | |
| | | _getEmbed : function(cls, cb, mt, p, at) { |
| | | var h = '', n; |
| | | |
| | | p.width = at.width ? at.width : p.width; |
| | | p.height = at.height ? at.height : p.height; |
| | | |
| | | h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"'; |
| | | h += typeof(p.id) != "undefined" ? ' id="' + p.id + '"' : ''; |
| | | h += typeof(p.name) != "undefined" ? ' name="' + p.name + '"' : ''; |
| | | h += typeof(p.width) != "undefined" ? ' width="' + p.width + '"' : ''; |
| | | h += typeof(p.height) != "undefined" ? ' height="' + p.height + '"' : ''; |
| | | h += typeof(p.align) != "undefined" ? ' align="' + p.align + '"' : ''; |
| | | h += '>'; |
| | | |
| | | for (n in p) { |
| | | if (typeof(p[n]) != "undefined" && typeof(p[n]) != "function") { |
| | | h += '<param name="' + n + '" value="' + p[n] + '" />'; |
| | | |
| | | // Add extra url parameter if it's an absolute URL on WMP |
| | | if (n == 'src' && p[n].indexOf('://') != -1 && mt == 'application/x-mplayer2') |
| | | h += '<param name="url" value="' + p[n] + '" />'; |
| | | } |
| | | } |
| | | |
| | | h += '<embed type="' + mt + '"'; |
| | | |
| | | for (n in p) { |
| | | if (typeof(p[n]) == "function") |
| | | continue; |
| | | |
| | | // Skip url parameter for embed tag on WMP |
| | | if (!(n == 'url' && mt == 'application/x-mplayer2')) |
| | | h += ' ' + n + '="' + p[n] + '"'; |
| | | } |
| | | |
| | | h += '></embed></object>'; |
| | | |
| | | return h; |
| | | }, |
| | | |
| | | _parseAttributes : function(attribute_string) { |
| | | var attributeName = "", endChr = '"'; |
| | | 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; |
| | | endChr = chr; |
| | | } else if (chr == endChr && 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("media", TinyMCE_MediaPlugin); |
| | |
| | | /**
|
| | | * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.
|
| | | */
|
| | |
|
| | | function writeFlash(p) {
|
| | | writeEmbed(
|
| | | 'D27CDB6E-AE6D-11cf-96B8-444553540000',
|
| | | 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
|
| | | 'application/x-shockwave-flash',
|
| | | p
|
| | | );
|
| | | }
|
| | |
|
| | | function writeShockWave(p) {
|
| | | writeEmbed(
|
| | | '166B1BCA-3F9C-11CF-8075-444553540000',
|
| | | 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
|
| | | 'application/x-director',
|
| | | p
|
| | | );
|
| | | }
|
| | |
|
| | | function writeQuickTime(p) {
|
| | | writeEmbed(
|
| | | '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
|
| | | 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
|
| | | 'video/quicktime',
|
| | | p
|
| | | );
|
| | | }
|
| | |
|
| | | function writeRealMedia(p) {
|
| | | writeEmbed(
|
| | | 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
|
| | | 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
|
| | | 'audio/x-pn-realaudio-plugin',
|
| | | p
|
| | | );
|
| | | }
|
| | |
|
| | | function writeWindowsMedia(p) {
|
| | | p.url = p.src;
|
| | | writeEmbed(
|
| | | '6BF52A52-394A-11D3-B153-00C04F79FAA6',
|
| | | 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
|
| | | 'application/x-mplayer2',
|
| | | p
|
| | | );
|
| | | }
|
| | |
|
| | | function writeEmbed(cls, cb, mt, p) {
|
| | | var h = '', n;
|
| | |
|
| | | h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
|
| | | h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
|
| | | h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
|
| | | h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
|
| | | h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
|
| | | h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
|
| | | h += '>';
|
| | |
|
| | | for (n in p)
|
| | | h += '<param name="' + n + '" value="' + p[n] + '">';
|
| | |
|
| | | h += '<embed type="' + mt + '"';
|
| | |
|
| | | for (n in p)
|
| | | h += n + '="' + p[n] + '" ';
|
| | |
|
| | | h += '></embed></object>';
|
| | |
|
| | | document.write(h);
|
| | | }
|
| | | /** |
| | | * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose. |
| | | */ |
| | | |
| | | function writeFlash(p) { |
| | | writeEmbed( |
| | | 'D27CDB6E-AE6D-11cf-96B8-444553540000', |
| | | 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', |
| | | 'application/x-shockwave-flash', |
| | | p |
| | | ); |
| | | } |
| | | |
| | | function writeShockWave(p) { |
| | | writeEmbed( |
| | | '166B1BCA-3F9C-11CF-8075-444553540000', |
| | | 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0', |
| | | 'application/x-director', |
| | | p |
| | | ); |
| | | } |
| | | |
| | | function writeQuickTime(p) { |
| | | writeEmbed( |
| | | '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B', |
| | | 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0', |
| | | 'video/quicktime', |
| | | p |
| | | ); |
| | | } |
| | | |
| | | function writeRealMedia(p) { |
| | | writeEmbed( |
| | | 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA', |
| | | 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', |
| | | 'audio/x-pn-realaudio-plugin', |
| | | p |
| | | ); |
| | | } |
| | | |
| | | function writeWindowsMedia(p) { |
| | | p.url = p.src; |
| | | writeEmbed( |
| | | '6BF52A52-394A-11D3-B153-00C04F79FAA6', |
| | | 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701', |
| | | 'application/x-mplayer2', |
| | | p |
| | | ); |
| | | } |
| | | |
| | | function writeEmbed(cls, cb, mt, p) { |
| | | var h = '', n; |
| | | |
| | | h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"'; |
| | | h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : ''; |
| | | h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : ''; |
| | | h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : ''; |
| | | h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : ''; |
| | | h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : ''; |
| | | h += '>'; |
| | | |
| | | for (n in p) |
| | | h += '<param name="' + n + '" value="' + p[n] + '">'; |
| | | |
| | | h += '<embed type="' + mt + '"'; |
| | | |
| | | for (n in p) |
| | | h += n + '="' + p[n] + '" '; |
| | | |
| | | h += '></embed></object>'; |
| | | |
| | | document.write(h); |
| | | } |
| | |
| | | var oldWidth, oldHeight;
|
| | | var url = tinyMCE.getParam("media_external_list_url");
|
| | | if (url != null) {
|
| | | // Fix relative
|
| | | if (url.charAt(0) != '/' && url.indexOf('://') == -1)
|
| | | url = tinyMCE.documentBasePath + "/" + url;
|
| | |
|
| | | document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>');
|
| | | }
|
| | |
|
| | | function init() {
|
| | | var pl = "", f, val;
|
| | | var type = "flash", fe, i;
|
| | |
|
| | | tinyMCEPopup.resizeToInnerSize();
|
| | | f = document.forms[0]
|
| | |
|
| | | fe = tinyMCE.selectedInstance.getFocusElement();
|
| | | if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(fe, 'class'))) {
|
| | | pl = "x={" + fe.title + "};";
|
| | |
|
| | | switch (tinyMCE.getAttrib(fe, 'class')) {
|
| | | case 'mceItemFlash':
|
| | | type = 'flash';
|
| | | break;
|
| | |
|
| | | case 'mceItemShockWave':
|
| | | type = 'shockwave';
|
| | | break;
|
| | |
|
| | | case 'mceItemWindowsMedia':
|
| | | type = 'wmp';
|
| | | break;
|
| | |
|
| | | case 'mceItemQuickTime':
|
| | | type = 'qt';
|
| | | break;
|
| | |
|
| | | case 'mceItemRealMedia':
|
| | | type = 'rmp';
|
| | | break;
|
| | | }
|
| | |
|
| | | document.forms[0].insert.value = tinyMCE.getLang('lang_update', 'Insert', true); |
| | | }
|
| | |
|
| | | document.getElementById('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media');
|
| | | document.getElementById('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','qt_qtsrc','media','media');
|
| | | document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
|
| | |
|
| | | var html = getMediaListHTML('filebrowser','src','media','media');
|
| | | if (html == "")
|
| | | document.getElementById("linklistrow").style.display = 'none';
|
| | | else
|
| | | document.getElementById("linklistcontainer").innerHTML = html;
|
| | |
|
| | | // Resize some elements
|
| | | if (isVisible('filebrowsercontainer'))
|
| | | document.getElementById('src').style.width = '230px';
|
| | |
|
| | | // Setup form
|
| | | if (pl != "") {
|
| | | pl = eval(pl);
|
| | |
|
| | | switch (type) {
|
| | | case "flash":
|
| | | setBool(pl, 'flash', 'play');
|
| | | setBool(pl, 'flash', 'loop');
|
| | | setBool(pl, 'flash', 'menu');
|
| | | setBool(pl, 'flash', 'swliveconnect');
|
| | | setStr(pl, 'flash', 'quality');
|
| | | setStr(pl, 'flash', 'scale');
|
| | | setStr(pl, 'flash', 'salign');
|
| | | setStr(pl, 'flash', 'wmode');
|
| | | setStr(pl, 'flash', 'base');
|
| | | setStr(pl, 'flash', 'flashvars');
|
| | | break;
|
| | |
|
| | | case "qt":
|
| | | setBool(pl, 'qt', 'loop');
|
| | | setBool(pl, 'qt', 'autoplay');
|
| | | setBool(pl, 'qt', 'cache');
|
| | | setBool(pl, 'qt', 'controller');
|
| | | setBool(pl, 'qt', 'correction');
|
| | | setBool(pl, 'qt', 'enablejavascript');
|
| | | setBool(pl, 'qt', 'kioskmode');
|
| | | setBool(pl, 'qt', 'autohref');
|
| | | setBool(pl, 'qt', 'playeveryframe');
|
| | | setBool(pl, 'qt', 'tarsetcache');
|
| | | setStr(pl, 'qt', 'scale');
|
| | | setStr(pl, 'qt', 'starttime');
|
| | | setStr(pl, 'qt', 'endtime');
|
| | | setStr(pl, 'qt', 'tarset');
|
| | | setStr(pl, 'qt', 'qtsrcchokespeed');
|
| | | setStr(pl, 'qt', 'volume');
|
| | | setStr(pl, 'qt', 'qtsrc');
|
| | | break;
|
| | |
|
| | | case "shockwave":
|
| | | setBool(pl, 'shockwave', 'sound');
|
| | | setBool(pl, 'shockwave', 'progress');
|
| | | setBool(pl, 'shockwave', 'autostart');
|
| | | setBool(pl, 'shockwave', 'swliveconnect');
|
| | | setStr(pl, 'shockwave', 'swvolume');
|
| | | setStr(pl, 'shockwave', 'swstretchstyle');
|
| | | setStr(pl, 'shockwave', 'swstretchhalign');
|
| | | setStr(pl, 'shockwave', 'swstretchvalign');
|
| | | break;
|
| | |
|
| | | case "wmp":
|
| | | setBool(pl, 'wmp', 'autostart');
|
| | | setBool(pl, 'wmp', 'enabled');
|
| | | setBool(pl, 'wmp', 'enablecontextmenu');
|
| | | setBool(pl, 'wmp', 'fullscreen');
|
| | | setBool(pl, 'wmp', 'invokeurls');
|
| | | setBool(pl, 'wmp', 'mute');
|
| | | setBool(pl, 'wmp', 'stretchtofit');
|
| | | setBool(pl, 'wmp', 'windowlessvideo');
|
| | | setStr(pl, 'wmp', 'balance');
|
| | | setStr(pl, 'wmp', 'baseurl');
|
| | | setStr(pl, 'wmp', 'captioningid');
|
| | | setStr(pl, 'wmp', 'currentmarker');
|
| | | setStr(pl, 'wmp', 'currentposition');
|
| | | setStr(pl, 'wmp', 'defaultframe');
|
| | | setStr(pl, 'wmp', 'playcount');
|
| | | setStr(pl, 'wmp', 'rate');
|
| | | setStr(pl, 'wmp', 'uimode');
|
| | | setStr(pl, 'wmp', 'volume');
|
| | | break;
|
| | |
|
| | | case "rmp":
|
| | | setBool(pl, 'rmp', 'autostart');
|
| | | setBool(pl, 'rmp', 'loop');
|
| | | setBool(pl, 'rmp', 'autogotourl');
|
| | | setBool(pl, 'rmp', 'center');
|
| | | setBool(pl, 'rmp', 'imagestatus');
|
| | | setBool(pl, 'rmp', 'maintainaspect');
|
| | | setBool(pl, 'rmp', 'nojava');
|
| | | setBool(pl, 'rmp', 'prefetch');
|
| | | setBool(pl, 'rmp', 'shuffle');
|
| | | setStr(pl, 'rmp', 'console');
|
| | | setStr(pl, 'rmp', 'controls');
|
| | | setStr(pl, 'rmp', 'numloop');
|
| | | setStr(pl, 'rmp', 'scriptcallbacks');
|
| | | break;
|
| | | }
|
| | |
|
| | | setStr(pl, null, 'src');
|
| | | setStr(pl, null, 'id');
|
| | | setStr(pl, null, 'name');
|
| | | setStr(pl, null, 'vspace');
|
| | | setStr(pl, null, 'hspace');
|
| | | setStr(pl, null, 'bgcolor');
|
| | | setStr(pl, null, 'align');
|
| | | setStr(pl, null, 'width');
|
| | | setStr(pl, null, 'height');
|
| | |
|
| | | if ((val = tinyMCE.getAttrib(fe, "width")) != "")
|
| | | pl.width = f.width.value = val;
|
| | |
|
| | | if ((val = tinyMCE.getAttrib(fe, "height")) != "")
|
| | | pl.height = f.height.value = val;
|
| | |
|
| | | oldWidth = pl.width ? parseInt(pl.width) : 0;
|
| | | oldHeight = pl.height ? parseInt(pl.height) : 0;
|
| | | } else
|
| | | oldWidth = oldHeight = 0;
|
| | |
|
| | | selectByValue(f, 'media_type', type);
|
| | | changedType(type);
|
| | | updateColor('bgcolor_pick', 'bgcolor');
|
| | |
|
| | | TinyMCE_EditableSelects.init();
|
| | | generatePreview();
|
| | | }
|
| | |
|
| | | function insertMedia() {
|
| | | var fe, f = document.forms[0], h;
|
| | |
|
| | | if (!AutoValidator.validate(f)) {
|
| | | alert(tinyMCE.getLang('lang_invalid_data'));
|
| | | return false;
|
| | | }
|
| | |
|
| | | f.width.value = f.width.value == "" ? 100 : f.width.value;
|
| | | f.height.value = f.height.value == "" ? 100 : f.height.value;
|
| | |
|
| | | fe = tinyMCE.selectedInstance.getFocusElement();
|
| | | if (fe != null && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(fe, 'class'))) {
|
| | | switch (f.media_type.options[f.media_type.selectedIndex].value) {
|
| | | case "flash":
|
| | | fe.className = "mceItemFlash";
|
| | | break;
|
| | |
|
| | | case "shockwave":
|
| | | fe.className = "mceItemShockWave";
|
| | | break;
|
| | |
|
| | | case "qt":
|
| | | fe.className = "mceItemQuickTime";
|
| | | break;
|
| | |
|
| | | case "wmp":
|
| | | fe.className = "mceItemWindowsMedia";
|
| | | break;
|
| | |
|
| | | case "rmp":
|
| | | fe.className = "mceItemRealMedia";
|
| | | break;
|
| | | }
|
| | |
|
| | | if (fe.width != f.width.value || fe.height != f.height.height)
|
| | | tinyMCE.selectedInstance.repaint();
|
| | |
|
| | | fe.title = serializeParameters();
|
| | | fe.width = f.width.value;
|
| | | fe.height = f.height.value;
|
| | | fe.style.width = f.width.value + (f.width.value.indexOf('%') == -1 ? 'px' : '');
|
| | | fe.style.height = f.height.value + (f.height.value.indexOf('%') == -1 ? 'px' : '');
|
| | | fe.align = f.align.options[f.align.selectedIndex].value;
|
| | | } else {
|
| | | h = '<img src="' + tinyMCE.getParam("theme_href") + '/images/spacer.gif"' ;
|
| | |
|
| | | switch (f.media_type.options[f.media_type.selectedIndex].value) {
|
| | | case "flash":
|
| | | h += ' class="mceItemFlash"';
|
| | | break;
|
| | |
|
| | | case "shockwave":
|
| | | h += ' class="mceItemShockWave"';
|
| | | break;
|
| | |
|
| | | case "qt":
|
| | | h += ' class="mceItemQuickTime"';
|
| | | break;
|
| | |
|
| | | case "wmp":
|
| | | h += ' class="mceItemWindowsMedia"';
|
| | | break;
|
| | |
|
| | | case "rmp":
|
| | | h += ' class="mceItemRealMedia"';
|
| | | break;
|
| | | }
|
| | |
|
| | | h += ' title="' + serializeParameters() + '"';
|
| | | h += ' width="' + f.width.value + '"';
|
| | | h += ' height="' + f.height.value + '"';
|
| | | h += ' align="' + f.align.options[f.align.selectedIndex].value + '"';
|
| | |
|
| | | h += ' />';
|
| | |
|
| | | tinyMCE.selectedInstance.execCommand('mceInsertContent', false, h);
|
| | | }
|
| | |
|
| | | tinyMCEPopup.close();
|
| | | }
|
| | |
|
| | | function getMediaListHTML() {
|
| | | if (typeof(tinyMCEMediaList) != "undefined" && tinyMCEMediaList.length > 0) {
|
| | | var html = "";
|
| | |
|
| | | html += '<select id="linklist" name="linklist" style="width: 250px" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.src.value=this.options[this.selectedIndex].value;">';
|
| | | html += '<option value="">---</option>';
|
| | |
|
| | | for (var i=0; i<tinyMCEMediaList.length; i++)
|
| | | html += '<option value="' + tinyMCEMediaList[i][1] + '">' + tinyMCEMediaList[i][0] + '</option>';
|
| | |
|
| | | html += '</select>';
|
| | |
|
| | | return html;
|
| | | }
|
| | |
|
| | | return "";
|
| | | }
|
| | |
|
| | | function getType(v) {
|
| | | var fo, i, c, el, x, f = document.forms[0];
|
| | |
|
| | | fo = tinyMCE.getParam("media_types", "flash=swf;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(';');
|
| | |
|
| | | // YouTube
|
| | | if (v.indexOf('http://www.youtube.com/watch?v=') == 0 || v.indexOf('http://youtube.com/watch?v=') == 0) {
|
| | | f.width.value = '425';
|
| | | f.height.value = '350';
|
| | |
|
| | | v = v.replace('http://youtube.com/watch?v=', '');
|
| | | v = v.replace('http://www.youtube.com/watch?v=', '');
|
| | |
|
| | | f.src.value = 'http://www.youtube.com/v/' + v;
|
| | | return 'flash';
|
| | | }
|
| | |
|
| | | // Google video
|
| | | if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) {
|
| | | f.width.value = '425';
|
| | | f.height.value = '326';
|
| | | f.src.value = 'http://video.google.com/googleplayer.swf?docId=' + v.substring('http://video.google.com/videoplay?docid='.length) + '&hl=en';
|
| | | return 'flash';
|
| | | }
|
| | |
|
| | | for (i=0; i<fo.length; i++) {
|
| | | c = fo[i].split('=');
|
| | |
|
| | | el = c[1].split(',');
|
| | | for (x=0; x<el.length; x++)
|
| | | if (v.indexOf('.' + el[x]) != -1)
|
| | | return c[0];
|
| | | }
|
| | |
|
| | | return null;
|
| | | }
|
| | |
|
| | | function switchType(v) {
|
| | | var t = getType(v), d = document, f = d.forms[0];
|
| | |
|
| | | if (!t)
|
| | | return;
|
| | |
|
| | | selectByValue(d.forms[0], 'media_type', t);
|
| | | changedType(t);
|
| | |
|
| | | // Update qtsrc also
|
| | | if (t == 'qt' && f.src.value.toLowerCase().indexOf('rtsp://') != -1) {
|
| | | alert(tinyMCE.getLang("lang_media_qt_stream_warn"));
|
| | |
|
| | | if (f.qt_qtsrc.value == '')
|
| | | f.qt_qtsrc.value = f.src.value;
|
| | | }
|
| | | }
|
| | |
|
| | | function changedType(t) {
|
| | | var d = document;
|
| | |
|
| | | d.getElementById('flash_options').style.display = 'none';
|
| | | d.getElementById('qt_options').style.display = 'none';
|
| | | d.getElementById('shockwave_options').style.display = 'none';
|
| | | d.getElementById('wmp_options').style.display = 'none';
|
| | | d.getElementById('rmp_options').style.display = 'none';
|
| | | d.getElementById(t + '_options').style.display = 'block';
|
| | | }
|
| | |
|
| | | function serializeParameters() {
|
| | | var d = document, f = d.forms[0], s = '';
|
| | |
|
| | | switch (f.media_type.options[f.media_type.selectedIndex].value) {
|
| | | case "flash":
|
| | | s += getBool('flash', 'play', true);
|
| | | s += getBool('flash', 'loop', true);
|
| | | s += getBool('flash', 'menu', true);
|
| | | s += getBool('flash', 'swliveconnect', false);
|
| | | s += getStr('flash', 'quality');
|
| | | s += getStr('flash', 'scale');
|
| | | s += getStr('flash', 'salign');
|
| | | s += getStr('flash', 'wmode');
|
| | | s += getStr('flash', 'base');
|
| | | s += getStr('flash', 'flashvars');
|
| | | break;
|
| | |
|
| | | case "qt":
|
| | | s += getBool('qt', 'loop', false);
|
| | | s += getBool('qt', 'autoplay', true);
|
| | | s += getBool('qt', 'cache', false);
|
| | | s += getBool('qt', 'controller', true);
|
| | | s += getBool('qt', 'correction', false, 'none', 'full');
|
| | | s += getBool('qt', 'enablejavascript', false);
|
| | | s += getBool('qt', 'kioskmode', false);
|
| | | s += getBool('qt', 'autohref', false);
|
| | | s += getBool('qt', 'playeveryframe', false);
|
| | | s += getBool('qt', 'targetcache', false);
|
| | | s += getStr('qt', 'scale');
|
| | | s += getStr('qt', 'starttime');
|
| | | s += getStr('qt', 'endtime');
|
| | | s += getStr('qt', 'target');
|
| | | s += getStr('qt', 'qtsrcchokespeed');
|
| | | s += getStr('qt', 'volume');
|
| | | s += getStr('qt', 'qtsrc');
|
| | | break;
|
| | |
|
| | | case "shockwave":
|
| | | s += getBool('shockwave', 'sound');
|
| | | s += getBool('shockwave', 'progress');
|
| | | s += getBool('shockwave', 'autostart');
|
| | | s += getBool('shockwave', 'swliveconnect');
|
| | | s += getStr('shockwave', 'swvolume');
|
| | | s += getStr('shockwave', 'swstretchstyle');
|
| | | s += getStr('shockwave', 'swstretchhalign');
|
| | | s += getStr('shockwave', 'swstretchvalign');
|
| | | break;
|
| | |
|
| | | case "wmp":
|
| | | s += getBool('wmp', 'autostart', true);
|
| | | s += getBool('wmp', 'enabled', false);
|
| | | s += getBool('wmp', 'enablecontextmenu', true);
|
| | | s += getBool('wmp', 'fullscreen', false);
|
| | | s += getBool('wmp', 'invokeurls', true);
|
| | | s += getBool('wmp', 'mute', false);
|
| | | s += getBool('wmp', 'stretchtofit', false);
|
| | | s += getBool('wmp', 'windowlessvideo', false);
|
| | | s += getStr('wmp', 'balance');
|
| | | s += getStr('wmp', 'baseurl');
|
| | | s += getStr('wmp', 'captioningid');
|
| | | s += getStr('wmp', 'currentmarker');
|
| | | s += getStr('wmp', 'currentposition');
|
| | | s += getStr('wmp', 'defaultframe');
|
| | | s += getStr('wmp', 'playcount');
|
| | | s += getStr('wmp', 'rate');
|
| | | s += getStr('wmp', 'uimode');
|
| | | s += getStr('wmp', 'volume');
|
| | | break;
|
| | |
|
| | | case "rmp":
|
| | | s += getBool('rmp', 'autostart', false);
|
| | | s += getBool('rmp', 'loop', false);
|
| | | s += getBool('rmp', 'autogotourl', true);
|
| | | s += getBool('rmp', 'center', false);
|
| | | s += getBool('rmp', 'imagestatus', true);
|
| | | s += getBool('rmp', 'maintainaspect', false);
|
| | | s += getBool('rmp', 'nojava', false);
|
| | | s += getBool('rmp', 'prefetch', false);
|
| | | s += getBool('rmp', 'shuffle', false);
|
| | | s += getStr('rmp', 'console');
|
| | | s += getStr('rmp', 'controls');
|
| | | s += getStr('rmp', 'numloop');
|
| | | s += getStr('rmp', 'scriptcallbacks');
|
| | | break;
|
| | | }
|
| | |
|
| | | s += getStr(null, 'id');
|
| | | s += getStr(null, 'name');
|
| | | s += getStr(null, 'src');
|
| | | s += getStr(null, 'align');
|
| | | s += getStr(null, 'bgcolor');
|
| | | s += getInt(null, 'vspace');
|
| | | s += getInt(null, 'hspace');
|
| | | s += getStr(null, 'width');
|
| | | s += getStr(null, 'height');
|
| | |
|
| | | s = s.length > 0 ? s.substring(0, s.length - 1) : s;
|
| | |
|
| | | return s;
|
| | | }
|
| | |
|
| | | function setBool(pl, p, n) {
|
| | | if (typeof(pl[n]) == "undefined")
|
| | | return;
|
| | |
|
| | | document.forms[0].elements[p + "_" + n].checked = pl[n];
|
| | | }
|
| | |
|
| | | function setStr(pl, p, n) {
|
| | | var f = document.forms[0], e = f.elements[(p != null ? p + "_" : '') + n];
|
| | |
|
| | | if (typeof(pl[n]) == "undefined")
|
| | | return;
|
| | |
|
| | | if (e.type == "text")
|
| | | e.value = pl[n];
|
| | | else
|
| | | selectByValue(f, (p != null ? p + "_" : '') + n, pl[n]);
|
| | | }
|
| | |
|
| | | function getBool(p, n, d, tv, fv) {
|
| | | var v = document.forms[0].elements[p + "_" + n].checked;
|
| | |
|
| | | tv = typeof(tv) == 'undefined' ? 'true' : "'" + jsEncode(tv) + "'";
|
| | | fv = typeof(fv) == 'undefined' ? 'false' : "'" + jsEncode(fv) + "'";
|
| | |
|
| | | return (v == d) ? '' : n + (v ? ':' + tv + ',' : ':' + fv + ',');
|
| | | }
|
| | |
|
| | | function getStr(p, n, d) {
|
| | | var e = document.forms[0].elements[(p != null ? p + "_" : "") + n];
|
| | | var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value;
|
| | |
|
| | | return ((n == d || v == '') ? '' : n + ":'" + jsEncode(v) + "',");
|
| | | }
|
| | |
|
| | | function getInt(p, n, d) {
|
| | | var e = document.forms[0].elements[(p != null ? p + "_" : "") + n];
|
| | | var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value;
|
| | |
|
| | | return ((n == d || v == '') ? '' : n + ":" + v.replace(/[^0-9]+/g, '') + ",");
|
| | | }
|
| | |
|
| | | function jsEncode(s) {
|
| | | s = s.replace(new RegExp('\\\\', 'g'), '\\\\');
|
| | | s = s.replace(new RegExp('"', 'g'), '\\"');
|
| | | s = s.replace(new RegExp("'", 'g'), "\\'");
|
| | |
|
| | | return s;
|
| | | }
|
| | |
|
| | | function generatePreview(c) {
|
| | | var f = document.forms[0], p = document.getElementById('prev'), h = '', cls, pl, n, type, codebase, wp, hp, nw, nh;
|
| | |
|
| | | p.innerHTML = '<!-- x --->';
|
| | |
|
| | | nw = parseInt(f.width.value);
|
| | | nh = parseInt(f.height.value);
|
| | |
|
| | | if (f.width.value != "" && f.height.value != "") {
|
| | | if (f.constrain.checked) {
|
| | | if (c == 'width' && oldWidth != 0) {
|
| | | wp = nw / oldWidth;
|
| | | nh = Math.round(wp * nh);
|
| | | f.height.value = nh;
|
| | | } else if (c == 'height' && oldHeight != 0) {
|
| | | hp = nh / oldHeight;
|
| | | nw = Math.round(hp * nw);
|
| | | f.width.value = nw;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if (f.width.value != "")
|
| | | oldWidth = nw;
|
| | |
|
| | | if (f.height.value != "")
|
| | | oldHeight = nh;
|
| | |
|
| | | // After constrain
|
| | | pl = serializeParameters();
|
| | |
|
| | | switch (f.media_type.options[f.media_type.selectedIndex].value) {
|
| | | case "flash":
|
| | | cls = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
|
| | | codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
|
| | | type = 'application/x-shockwave-flash';
|
| | | break;
|
| | |
|
| | | case "shockwave":
|
| | | cls = 'clsid:166B1BCA-3F9C-11CF-8075-444553540000';
|
| | | codebase = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';
|
| | | type = 'application/x-director';
|
| | | break;
|
| | |
|
| | | case "qt":
|
| | | cls = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
|
| | | codebase = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
|
| | | type = 'video/quicktime';
|
| | | break;
|
| | |
|
| | | case "wmp":
|
| | | cls = tinyMCE.getParam('media_wmp6_compatible') ? 'clsid:05589FA1-C356-11CE-BF01-00AA0055595A' : 'clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6';
|
| | | codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
|
| | | type = 'application/x-mplayer2';
|
| | | break;
|
| | |
|
| | | case "rmp":
|
| | | cls = 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';
|
| | | codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
|
| | | type = 'audio/x-pn-realaudio-plugin';
|
| | | break;
|
| | | }
|
| | |
|
| | | if (pl == '') {
|
| | | p.innerHTML = '';
|
| | | return;
|
| | | }
|
| | |
|
| | | pl = eval('x={' + pl + '};');
|
| | |
|
| | | if (!pl.src) {
|
| | | p.innerHTML = '';
|
| | | return;
|
| | | }
|
| | |
|
| | | pl.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], pl.src);
|
| | | pl.width = !pl.width ? 100 : pl.width;
|
| | | pl.height = !pl.height ? 100 : pl.height;
|
| | | pl.id = !pl.id ? 'obj' : pl.id;
|
| | | pl.name = !pl.name ? 'eobj' : pl.name;
|
| | | pl.align = !pl.align ? '' : pl.align;
|
| | |
|
| | | h += '<object classid="clsid:' + cls + '" codebase="' + codebase + '" width="' + pl.width + '" height="' + pl.height + '" id="' + pl.id + '" name="' + pl.name + '" align="' + pl.align + '">';
|
| | |
|
| | | for (n in pl) {
|
| | | h += '<param name="' + n + '" value="' + pl[n] + '">';
|
| | |
|
| | | // Add extra url parameter if it's an absolute URL
|
| | | if (n == 'src' && pl[n].indexOf('://') != -1)
|
| | | h += '<param name="url" value="' + pl[n] + '" />';
|
| | | }
|
| | |
|
| | | h += '<embed type="' + type + '" ';
|
| | |
|
| | | for (n in pl)
|
| | | h += n + '="' + pl[n] + '" ';
|
| | |
|
| | | h += '></embed></object>';
|
| | |
|
| | | p.innerHTML = "<!-- x --->" + h;
|
| | | }
|
| | | var oldWidth, oldHeight; |
| | | var url = tinyMCE.getParam("media_external_list_url"); |
| | | if (url != null) { |
| | | // Fix relative |
| | | if (url.charAt(0) != '/' && url.indexOf('://') == -1) |
| | | url = tinyMCE.documentBasePath + "/" + url; |
| | | |
| | | document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>'); |
| | | } |
| | | |
| | | function init() { |
| | | var pl = "", f, val; |
| | | var type = "flash", fe, i; |
| | | |
| | | tinyMCEPopup.resizeToInnerSize(); |
| | | f = document.forms[0] |
| | | |
| | | fe = tinyMCE.selectedInstance.getFocusElement(); |
| | | if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(fe, 'class'))) { |
| | | pl = "x={" + fe.title + "};"; |
| | | |
| | | switch (tinyMCE.getAttrib(fe, 'class')) { |
| | | case 'mceItemFlash': |
| | | type = 'flash'; |
| | | break; |
| | | |
| | | case 'mceItemShockWave': |
| | | type = 'shockwave'; |
| | | break; |
| | | |
| | | case 'mceItemWindowsMedia': |
| | | type = 'wmp'; |
| | | break; |
| | | |
| | | case 'mceItemQuickTime': |
| | | type = 'qt'; |
| | | break; |
| | | |
| | | case 'mceItemRealMedia': |
| | | type = 'rmp'; |
| | | break; |
| | | } |
| | | |
| | | document.forms[0].insert.value = tinyMCE.getLang('lang_update', 'Insert', true); |
| | | } |
| | | |
| | | document.getElementById('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media'); |
| | | document.getElementById('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','qt_qtsrc','media','media'); |
| | | document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor'); |
| | | |
| | | var html = getMediaListHTML('filebrowser','src','media','media'); |
| | | if (html == "") |
| | | document.getElementById("linklistrow").style.display = 'none'; |
| | | else |
| | | document.getElementById("linklistcontainer").innerHTML = html; |
| | | |
| | | // Resize some elements |
| | | if (isVisible('filebrowsercontainer')) |
| | | document.getElementById('src').style.width = '230px'; |
| | | |
| | | // Setup form |
| | | if (pl != "") { |
| | | pl = eval(pl); |
| | | |
| | | switch (type) { |
| | | case "flash": |
| | | setBool(pl, 'flash', 'play'); |
| | | setBool(pl, 'flash', 'loop'); |
| | | setBool(pl, 'flash', 'menu'); |
| | | setBool(pl, 'flash', 'swliveconnect'); |
| | | setStr(pl, 'flash', 'quality'); |
| | | setStr(pl, 'flash', 'scale'); |
| | | setStr(pl, 'flash', 'salign'); |
| | | setStr(pl, 'flash', 'wmode'); |
| | | setStr(pl, 'flash', 'base'); |
| | | setStr(pl, 'flash', 'flashvars'); |
| | | break; |
| | | |
| | | case "qt": |
| | | setBool(pl, 'qt', 'loop'); |
| | | setBool(pl, 'qt', 'autoplay'); |
| | | setBool(pl, 'qt', 'cache'); |
| | | setBool(pl, 'qt', 'controller'); |
| | | setBool(pl, 'qt', 'correction'); |
| | | setBool(pl, 'qt', 'enablejavascript'); |
| | | setBool(pl, 'qt', 'kioskmode'); |
| | | setBool(pl, 'qt', 'autohref'); |
| | | setBool(pl, 'qt', 'playeveryframe'); |
| | | setBool(pl, 'qt', 'tarsetcache'); |
| | | setStr(pl, 'qt', 'scale'); |
| | | setStr(pl, 'qt', 'starttime'); |
| | | setStr(pl, 'qt', 'endtime'); |
| | | setStr(pl, 'qt', 'tarset'); |
| | | setStr(pl, 'qt', 'qtsrcchokespeed'); |
| | | setStr(pl, 'qt', 'volume'); |
| | | setStr(pl, 'qt', 'qtsrc'); |
| | | break; |
| | | |
| | | case "shockwave": |
| | | setBool(pl, 'shockwave', 'sound'); |
| | | setBool(pl, 'shockwave', 'progress'); |
| | | setBool(pl, 'shockwave', 'autostart'); |
| | | setBool(pl, 'shockwave', 'swliveconnect'); |
| | | setStr(pl, 'shockwave', 'swvolume'); |
| | | setStr(pl, 'shockwave', 'swstretchstyle'); |
| | | setStr(pl, 'shockwave', 'swstretchhalign'); |
| | | setStr(pl, 'shockwave', 'swstretchvalign'); |
| | | break; |
| | | |
| | | case "wmp": |
| | | setBool(pl, 'wmp', 'autostart'); |
| | | setBool(pl, 'wmp', 'enabled'); |
| | | setBool(pl, 'wmp', 'enablecontextmenu'); |
| | | setBool(pl, 'wmp', 'fullscreen'); |
| | | setBool(pl, 'wmp', 'invokeurls'); |
| | | setBool(pl, 'wmp', 'mute'); |
| | | setBool(pl, 'wmp', 'stretchtofit'); |
| | | setBool(pl, 'wmp', 'windowlessvideo'); |
| | | setStr(pl, 'wmp', 'balance'); |
| | | setStr(pl, 'wmp', 'baseurl'); |
| | | setStr(pl, 'wmp', 'captioningid'); |
| | | setStr(pl, 'wmp', 'currentmarker'); |
| | | setStr(pl, 'wmp', 'currentposition'); |
| | | setStr(pl, 'wmp', 'defaultframe'); |
| | | setStr(pl, 'wmp', 'playcount'); |
| | | setStr(pl, 'wmp', 'rate'); |
| | | setStr(pl, 'wmp', 'uimode'); |
| | | setStr(pl, 'wmp', 'volume'); |
| | | break; |
| | | |
| | | case "rmp": |
| | | setBool(pl, 'rmp', 'autostart'); |
| | | setBool(pl, 'rmp', 'loop'); |
| | | setBool(pl, 'rmp', 'autogotourl'); |
| | | setBool(pl, 'rmp', 'center'); |
| | | setBool(pl, 'rmp', 'imagestatus'); |
| | | setBool(pl, 'rmp', 'maintainaspect'); |
| | | setBool(pl, 'rmp', 'nojava'); |
| | | setBool(pl, 'rmp', 'prefetch'); |
| | | setBool(pl, 'rmp', 'shuffle'); |
| | | setStr(pl, 'rmp', 'console'); |
| | | setStr(pl, 'rmp', 'controls'); |
| | | setStr(pl, 'rmp', 'numloop'); |
| | | setStr(pl, 'rmp', 'scriptcallbacks'); |
| | | break; |
| | | } |
| | | |
| | | setStr(pl, null, 'src'); |
| | | setStr(pl, null, 'id'); |
| | | setStr(pl, null, 'name'); |
| | | setStr(pl, null, 'vspace'); |
| | | setStr(pl, null, 'hspace'); |
| | | setStr(pl, null, 'bgcolor'); |
| | | setStr(pl, null, 'align'); |
| | | setStr(pl, null, 'width'); |
| | | setStr(pl, null, 'height'); |
| | | |
| | | if ((val = tinyMCE.getAttrib(fe, "width")) != "") |
| | | pl.width = f.width.value = val; |
| | | |
| | | if ((val = tinyMCE.getAttrib(fe, "height")) != "") |
| | | pl.height = f.height.value = val; |
| | | |
| | | oldWidth = pl.width ? parseInt(pl.width) : 0; |
| | | oldHeight = pl.height ? parseInt(pl.height) : 0; |
| | | } else |
| | | oldWidth = oldHeight = 0; |
| | | |
| | | selectByValue(f, 'media_type', type); |
| | | changedType(type); |
| | | updateColor('bgcolor_pick', 'bgcolor'); |
| | | |
| | | TinyMCE_EditableSelects.init(); |
| | | generatePreview(); |
| | | } |
| | | |
| | | function insertMedia() { |
| | | var fe, f = document.forms[0], h; |
| | | |
| | | if (!AutoValidator.validate(f)) { |
| | | alert(tinyMCE.getLang('lang_invalid_data')); |
| | | return false; |
| | | } |
| | | |
| | | f.width.value = f.width.value == "" ? 100 : f.width.value; |
| | | f.height.value = f.height.value == "" ? 100 : f.height.value; |
| | | |
| | | fe = tinyMCE.selectedInstance.getFocusElement(); |
| | | if (fe != null && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(fe, 'class'))) { |
| | | switch (f.media_type.options[f.media_type.selectedIndex].value) { |
| | | case "flash": |
| | | fe.className = "mceItemFlash"; |
| | | break; |
| | | |
| | | case "shockwave": |
| | | fe.className = "mceItemShockWave"; |
| | | break; |
| | | |
| | | case "qt": |
| | | fe.className = "mceItemQuickTime"; |
| | | break; |
| | | |
| | | case "wmp": |
| | | fe.className = "mceItemWindowsMedia"; |
| | | break; |
| | | |
| | | case "rmp": |
| | | fe.className = "mceItemRealMedia"; |
| | | break; |
| | | } |
| | | |
| | | if (fe.width != f.width.value || fe.height != f.height.height) |
| | | tinyMCE.selectedInstance.repaint(); |
| | | |
| | | fe.title = serializeParameters(); |
| | | fe.width = f.width.value; |
| | | fe.height = f.height.value; |
| | | fe.style.width = f.width.value + (f.width.value.indexOf('%') == -1 ? 'px' : ''); |
| | | fe.style.height = f.height.value + (f.height.value.indexOf('%') == -1 ? 'px' : ''); |
| | | fe.align = f.align.options[f.align.selectedIndex].value; |
| | | } else { |
| | | h = '<img src="' + tinyMCE.getParam("theme_href") + '/images/spacer.gif"' ; |
| | | |
| | | switch (f.media_type.options[f.media_type.selectedIndex].value) { |
| | | case "flash": |
| | | h += ' class="mceItemFlash"'; |
| | | break; |
| | | |
| | | case "shockwave": |
| | | h += ' class="mceItemShockWave"'; |
| | | break; |
| | | |
| | | case "qt": |
| | | h += ' class="mceItemQuickTime"'; |
| | | break; |
| | | |
| | | case "wmp": |
| | | h += ' class="mceItemWindowsMedia"'; |
| | | break; |
| | | |
| | | case "rmp": |
| | | h += ' class="mceItemRealMedia"'; |
| | | break; |
| | | } |
| | | |
| | | h += ' title="' + serializeParameters() + '"'; |
| | | h += ' width="' + f.width.value + '"'; |
| | | h += ' height="' + f.height.value + '"'; |
| | | h += ' align="' + f.align.options[f.align.selectedIndex].value + '"'; |
| | | |
| | | h += ' />'; |
| | | |
| | | tinyMCE.selectedInstance.execCommand('mceInsertContent', false, h); |
| | | } |
| | | |
| | | tinyMCEPopup.close(); |
| | | } |
| | | |
| | | function getMediaListHTML() { |
| | | if (typeof(tinyMCEMediaList) != "undefined" && tinyMCEMediaList.length > 0) { |
| | | var html = ""; |
| | | |
| | | html += '<select id="linklist" name="linklist" style="width: 250px" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.src.value=this.options[this.selectedIndex].value;">'; |
| | | html += '<option value="">---</option>'; |
| | | |
| | | for (var i=0; i<tinyMCEMediaList.length; i++) |
| | | html += '<option value="' + tinyMCEMediaList[i][1] + '">' + tinyMCEMediaList[i][0] + '</option>'; |
| | | |
| | | html += '</select>'; |
| | | |
| | | return html; |
| | | } |
| | | |
| | | return ""; |
| | | } |
| | | |
| | | function getType(v) { |
| | | var fo, i, c, el, x, f = document.forms[0]; |
| | | |
| | | fo = tinyMCE.getParam("media_types", "flash=swf;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(';'); |
| | | |
| | | // YouTube |
| | | if (v.indexOf('http://www.youtube.com/watch?v=') == 0 || v.indexOf('http://youtube.com/watch?v=') == 0) { |
| | | f.width.value = '425'; |
| | | f.height.value = '350'; |
| | | |
| | | v = v.replace('http://youtube.com/watch?v=', ''); |
| | | v = v.replace('http://www.youtube.com/watch?v=', ''); |
| | | |
| | | f.src.value = 'http://www.youtube.com/v/' + v; |
| | | return 'flash'; |
| | | } |
| | | |
| | | // Google video |
| | | if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) { |
| | | f.width.value = '425'; |
| | | f.height.value = '326'; |
| | | f.src.value = 'http://video.google.com/googleplayer.swf?docId=' + v.substring('http://video.google.com/videoplay?docid='.length) + '&hl=en'; |
| | | return 'flash'; |
| | | } |
| | | |
| | | for (i=0; i<fo.length; i++) { |
| | | c = fo[i].split('='); |
| | | |
| | | el = c[1].split(','); |
| | | for (x=0; x<el.length; x++) |
| | | if (v.indexOf('.' + el[x]) != -1) |
| | | return c[0]; |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | function switchType(v) { |
| | | var t = getType(v), d = document, f = d.forms[0]; |
| | | |
| | | if (!t) |
| | | return; |
| | | |
| | | selectByValue(d.forms[0], 'media_type', t); |
| | | changedType(t); |
| | | |
| | | // Update qtsrc also |
| | | if (t == 'qt' && f.src.value.toLowerCase().indexOf('rtsp://') != -1) { |
| | | alert(tinyMCE.getLang("lang_media_qt_stream_warn")); |
| | | |
| | | if (f.qt_qtsrc.value == '') |
| | | f.qt_qtsrc.value = f.src.value; |
| | | } |
| | | } |
| | | |
| | | function changedType(t) { |
| | | var d = document; |
| | | |
| | | d.getElementById('flash_options').style.display = 'none'; |
| | | d.getElementById('qt_options').style.display = 'none'; |
| | | d.getElementById('shockwave_options').style.display = 'none'; |
| | | d.getElementById('wmp_options').style.display = 'none'; |
| | | d.getElementById('rmp_options').style.display = 'none'; |
| | | d.getElementById(t + '_options').style.display = 'block'; |
| | | } |
| | | |
| | | function serializeParameters() { |
| | | var d = document, f = d.forms[0], s = ''; |
| | | |
| | | switch (f.media_type.options[f.media_type.selectedIndex].value) { |
| | | case "flash": |
| | | s += getBool('flash', 'play', true); |
| | | s += getBool('flash', 'loop', true); |
| | | s += getBool('flash', 'menu', true); |
| | | s += getBool('flash', 'swliveconnect', false); |
| | | s += getStr('flash', 'quality'); |
| | | s += getStr('flash', 'scale'); |
| | | s += getStr('flash', 'salign'); |
| | | s += getStr('flash', 'wmode'); |
| | | s += getStr('flash', 'base'); |
| | | s += getStr('flash', 'flashvars'); |
| | | break; |
| | | |
| | | case "qt": |
| | | s += getBool('qt', 'loop', false); |
| | | s += getBool('qt', 'autoplay', true); |
| | | s += getBool('qt', 'cache', false); |
| | | s += getBool('qt', 'controller', true); |
| | | s += getBool('qt', 'correction', false, 'none', 'full'); |
| | | s += getBool('qt', 'enablejavascript', false); |
| | | s += getBool('qt', 'kioskmode', false); |
| | | s += getBool('qt', 'autohref', false); |
| | | s += getBool('qt', 'playeveryframe', false); |
| | | s += getBool('qt', 'targetcache', false); |
| | | s += getStr('qt', 'scale'); |
| | | s += getStr('qt', 'starttime'); |
| | | s += getStr('qt', 'endtime'); |
| | | s += getStr('qt', 'target'); |
| | | s += getStr('qt', 'qtsrcchokespeed'); |
| | | s += getStr('qt', 'volume'); |
| | | s += getStr('qt', 'qtsrc'); |
| | | break; |
| | | |
| | | case "shockwave": |
| | | s += getBool('shockwave', 'sound'); |
| | | s += getBool('shockwave', 'progress'); |
| | | s += getBool('shockwave', 'autostart'); |
| | | s += getBool('shockwave', 'swliveconnect'); |
| | | s += getStr('shockwave', 'swvolume'); |
| | | s += getStr('shockwave', 'swstretchstyle'); |
| | | s += getStr('shockwave', 'swstretchhalign'); |
| | | s += getStr('shockwave', 'swstretchvalign'); |
| | | break; |
| | | |
| | | case "wmp": |
| | | s += getBool('wmp', 'autostart', true); |
| | | s += getBool('wmp', 'enabled', false); |
| | | s += getBool('wmp', 'enablecontextmenu', true); |
| | | s += getBool('wmp', 'fullscreen', false); |
| | | s += getBool('wmp', 'invokeurls', true); |
| | | s += getBool('wmp', 'mute', false); |
| | | s += getBool('wmp', 'stretchtofit', false); |
| | | s += getBool('wmp', 'windowlessvideo', false); |
| | | s += getStr('wmp', 'balance'); |
| | | s += getStr('wmp', 'baseurl'); |
| | | s += getStr('wmp', 'captioningid'); |
| | | s += getStr('wmp', 'currentmarker'); |
| | | s += getStr('wmp', 'currentposition'); |
| | | s += getStr('wmp', 'defaultframe'); |
| | | s += getStr('wmp', 'playcount'); |
| | | s += getStr('wmp', 'rate'); |
| | | s += getStr('wmp', 'uimode'); |
| | | s += getStr('wmp', 'volume'); |
| | | break; |
| | | |
| | | case "rmp": |
| | | s += getBool('rmp', 'autostart', false); |
| | | s += getBool('rmp', 'loop', false); |
| | | s += getBool('rmp', 'autogotourl', true); |
| | | s += getBool('rmp', 'center', false); |
| | | s += getBool('rmp', 'imagestatus', true); |
| | | s += getBool('rmp', 'maintainaspect', false); |
| | | s += getBool('rmp', 'nojava', false); |
| | | s += getBool('rmp', 'prefetch', false); |
| | | s += getBool('rmp', 'shuffle', false); |
| | | s += getStr('rmp', 'console'); |
| | | s += getStr('rmp', 'controls'); |
| | | s += getStr('rmp', 'numloop'); |
| | | s += getStr('rmp', 'scriptcallbacks'); |
| | | break; |
| | | } |
| | | |
| | | s += getStr(null, 'id'); |
| | | s += getStr(null, 'name'); |
| | | s += getStr(null, 'src'); |
| | | s += getStr(null, 'align'); |
| | | s += getStr(null, 'bgcolor'); |
| | | s += getInt(null, 'vspace'); |
| | | s += getInt(null, 'hspace'); |
| | | s += getStr(null, 'width'); |
| | | s += getStr(null, 'height'); |
| | | |
| | | s = s.length > 0 ? s.substring(0, s.length - 1) : s; |
| | | |
| | | return s; |
| | | } |
| | | |
| | | function setBool(pl, p, n) { |
| | | if (typeof(pl[n]) == "undefined") |
| | | return; |
| | | |
| | | document.forms[0].elements[p + "_" + n].checked = pl[n]; |
| | | } |
| | | |
| | | function setStr(pl, p, n) { |
| | | var f = document.forms[0], e = f.elements[(p != null ? p + "_" : '') + n]; |
| | | |
| | | if (typeof(pl[n]) == "undefined") |
| | | return; |
| | | |
| | | if (e.type == "text") |
| | | e.value = pl[n]; |
| | | else |
| | | selectByValue(f, (p != null ? p + "_" : '') + n, pl[n]); |
| | | } |
| | | |
| | | function getBool(p, n, d, tv, fv) { |
| | | var v = document.forms[0].elements[p + "_" + n].checked; |
| | | |
| | | tv = typeof(tv) == 'undefined' ? 'true' : "'" + jsEncode(tv) + "'"; |
| | | fv = typeof(fv) == 'undefined' ? 'false' : "'" + jsEncode(fv) + "'"; |
| | | |
| | | return (v == d) ? '' : n + (v ? ':' + tv + ',' : ':' + fv + ','); |
| | | } |
| | | |
| | | function getStr(p, n, d) { |
| | | var e = document.forms[0].elements[(p != null ? p + "_" : "") + n]; |
| | | var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value; |
| | | |
| | | return ((n == d || v == '') ? '' : n + ":'" + jsEncode(v) + "',"); |
| | | } |
| | | |
| | | function getInt(p, n, d) { |
| | | var e = document.forms[0].elements[(p != null ? p + "_" : "") + n]; |
| | | var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value; |
| | | |
| | | return ((n == d || v == '') ? '' : n + ":" + v.replace(/[^0-9]+/g, '') + ","); |
| | | } |
| | | |
| | | function jsEncode(s) { |
| | | s = s.replace(new RegExp('\\\\', 'g'), '\\\\'); |
| | | s = s.replace(new RegExp('"', 'g'), '\\"'); |
| | | s = s.replace(new RegExp("'", 'g'), "\\'"); |
| | | |
| | | return s; |
| | | } |
| | | |
| | | function generatePreview(c) { |
| | | var f = document.forms[0], p = document.getElementById('prev'), h = '', cls, pl, n, type, codebase, wp, hp, nw, nh; |
| | | |
| | | p.innerHTML = '<!-- x --->'; |
| | | |
| | | nw = parseInt(f.width.value); |
| | | nh = parseInt(f.height.value); |
| | | |
| | | if (f.width.value != "" && f.height.value != "") { |
| | | if (f.constrain.checked) { |
| | | if (c == 'width' && oldWidth != 0) { |
| | | wp = nw / oldWidth; |
| | | nh = Math.round(wp * nh); |
| | | f.height.value = nh; |
| | | } else if (c == 'height' && oldHeight != 0) { |
| | | hp = nh / oldHeight; |
| | | nw = Math.round(hp * nw); |
| | | f.width.value = nw; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (f.width.value != "") |
| | | oldWidth = nw; |
| | | |
| | | if (f.height.value != "") |
| | | oldHeight = nh; |
| | | |
| | | // After constrain |
| | | pl = serializeParameters(); |
| | | |
| | | switch (f.media_type.options[f.media_type.selectedIndex].value) { |
| | | case "flash": |
| | | cls = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'; |
| | | codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; |
| | | type = 'application/x-shockwave-flash'; |
| | | break; |
| | | |
| | | case "shockwave": |
| | | cls = 'clsid:166B1BCA-3F9C-11CF-8075-444553540000'; |
| | | codebase = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0'; |
| | | type = 'application/x-director'; |
| | | break; |
| | | |
| | | case "qt": |
| | | cls = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B'; |
| | | codebase = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0'; |
| | | type = 'video/quicktime'; |
| | | break; |
| | | |
| | | case "wmp": |
| | | cls = tinyMCE.getParam('media_wmp6_compatible') ? 'clsid:05589FA1-C356-11CE-BF01-00AA0055595A' : 'clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6'; |
| | | codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; |
| | | type = 'application/x-mplayer2'; |
| | | break; |
| | | |
| | | case "rmp": |
| | | cls = 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'; |
| | | codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; |
| | | type = 'audio/x-pn-realaudio-plugin'; |
| | | break; |
| | | } |
| | | |
| | | if (pl == '') { |
| | | p.innerHTML = ''; |
| | | return; |
| | | } |
| | | |
| | | pl = eval('x={' + pl + '};'); |
| | | |
| | | if (!pl.src) { |
| | | p.innerHTML = ''; |
| | | return; |
| | | } |
| | | |
| | | pl.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], pl.src); |
| | | pl.width = !pl.width ? 100 : pl.width; |
| | | pl.height = !pl.height ? 100 : pl.height; |
| | | pl.id = !pl.id ? 'obj' : pl.id; |
| | | pl.name = !pl.name ? 'eobj' : pl.name; |
| | | pl.align = !pl.align ? '' : pl.align; |
| | | |
| | | h += '<object classid="clsid:' + cls + '" codebase="' + codebase + '" width="' + pl.width + '" height="' + pl.height + '" id="' + pl.id + '" name="' + pl.name + '" align="' + pl.align + '">'; |
| | | |
| | | for (n in pl) { |
| | | h += '<param name="' + n + '" value="' + pl[n] + '">'; |
| | | |
| | | // Add extra url parameter if it's an absolute URL |
| | | if (n == 'src' && pl[n].indexOf('://') != -1) |
| | | h += '<param name="url" value="' + pl[n] + '" />'; |
| | | } |
| | | |
| | | h += '<embed type="' + type + '" '; |
| | | |
| | | for (n in pl) |
| | | h += n + '="' + pl[n] + '" '; |
| | | |
| | | h += '></embed></object>'; |
| | | |
| | | p.innerHTML = "<!-- x --->" + h; |
| | | } |
| | |
| | | // UK lang variables
|
| | |
|
| | | tinyMCE.addToLang('media',{
|
| | | title : 'Insert / edit embedded media',
|
| | | desc : 'Insert / edit embedded media',
|
| | | general : 'General',
|
| | | advanced : 'Advanced',
|
| | | file : 'File/URL',
|
| | | list : 'List',
|
| | | size : 'Dimensions',
|
| | | preview : 'Preview',
|
| | | constrain_proportions : 'Constrain proportions',
|
| | | type : 'Type',
|
| | | id : 'Id',
|
| | | name : 'Name',
|
| | | class_name : 'Class',
|
| | | vspace : 'V-Space',
|
| | | hspace : 'H-Space',
|
| | | play : 'Auto play',
|
| | | loop : 'Loop',
|
| | | menu : 'Show menu',
|
| | | quality : 'Quality',
|
| | | scale : 'Scale',
|
| | | align : 'Align',
|
| | | salign : 'SAlign',
|
| | | wmode : 'WMode',
|
| | | bgcolor : 'Background',
|
| | | base : 'Base',
|
| | | flashvars : 'Flashvars',
|
| | | liveconnect : 'SWLiveConnect',
|
| | | autohref : 'AutoHREF',
|
| | | cache : 'Cache',
|
| | | hidden : 'Hidden',
|
| | | controller : 'Controller',
|
| | | kioskmode : 'Kiosk mode',
|
| | | playeveryframe : 'Play every frame',
|
| | | targetcache : 'Target cache',
|
| | | correction : 'No correction',
|
| | | enablejavascript : 'Enable JavaScript',
|
| | | starttime : 'Start time',
|
| | | endtime : 'End time',
|
| | | href : 'Href',
|
| | | qtsrcchokespeed : 'Choke speed',
|
| | | target : 'Target',
|
| | | volume : 'Volume',
|
| | | autostart : 'Auto start',
|
| | | enabled : 'Enabled',
|
| | | fullscreen : 'Fullscreen',
|
| | | invokeurls : 'Invoke URLs',
|
| | | mute : 'Mute',
|
| | | stretchtofit : 'Stretch to fit',
|
| | | windowlessvideo : 'Windowless video',
|
| | | balance : 'Balance',
|
| | | baseurl : 'Base URL',
|
| | | captioningid : 'Captioning id',
|
| | | currentmarker : 'Current marker',
|
| | | currentposition : 'Current position',
|
| | | defaultframe : 'Default frame',
|
| | | playcount : 'Play count',
|
| | | rate : 'Rate',
|
| | | uimode : 'UI Mode',
|
| | | flash_options : 'Flash options',
|
| | | qt_options : 'Quicktime options',
|
| | | wmp_options : 'Windows media player options',
|
| | | rmp_options : 'Real media player options',
|
| | | shockwave_options : 'Shockwave options',
|
| | | autogotourl : 'Auto goto URL',
|
| | | center : 'Center',
|
| | | imagestatus : 'Image status',
|
| | | maintainaspect : 'Maintain aspect',
|
| | | nojava : 'No java',
|
| | | prefetch : 'Prefetch',
|
| | | shuffle : 'Shuffle',
|
| | | console : 'Console',
|
| | | numloop : 'Num loops',
|
| | | controls : 'Controls',
|
| | | scriptcallbacks : 'Script callbacks',
|
| | | swstretchstyle : 'Stretch style',
|
| | | swstretchhalign : 'Stretch H-Align',
|
| | | swstretchvalign : 'Stretch V-Align',
|
| | | sound : 'Sound',
|
| | | progress : 'Progress',
|
| | | qtsrc : 'QT Src',
|
| | | qt_stream_warn : 'Streamed rtsp resources should be added to the QT Src field under the advanced tab.\nYou should also add a non streamed version to the Src field..',
|
| | | align_top : 'Top',
|
| | | align_right : 'Right',
|
| | | align_bottom : 'Bottom',
|
| | | align_left : 'Left',
|
| | | align_center : 'Center',
|
| | | align_top_left : 'Top left',
|
| | | align_top_right : 'Top right',
|
| | | align_bottom_left : 'Bottom left',
|
| | | align_bottom_right : 'Bottom right'
|
| | | // UK lang variables |
| | | |
| | | tinyMCE.addToLang('media',{ |
| | | title : 'Insert / edit embedded media', |
| | | desc : 'Insert / edit embedded media', |
| | | general : 'General', |
| | | advanced : 'Advanced', |
| | | file : 'File/URL', |
| | | list : 'List', |
| | | size : 'Dimensions', |
| | | preview : 'Preview', |
| | | constrain_proportions : 'Constrain proportions', |
| | | type : 'Type', |
| | | id : 'Id', |
| | | name : 'Name', |
| | | class_name : 'Class', |
| | | vspace : 'V-Space', |
| | | hspace : 'H-Space', |
| | | play : 'Auto play', |
| | | loop : 'Loop', |
| | | menu : 'Show menu', |
| | | quality : 'Quality', |
| | | scale : 'Scale', |
| | | align : 'Align', |
| | | salign : 'SAlign', |
| | | wmode : 'WMode', |
| | | bgcolor : 'Background', |
| | | base : 'Base', |
| | | flashvars : 'Flashvars', |
| | | liveconnect : 'SWLiveConnect', |
| | | autohref : 'AutoHREF', |
| | | cache : 'Cache', |
| | | hidden : 'Hidden', |
| | | controller : 'Controller', |
| | | kioskmode : 'Kiosk mode', |
| | | playeveryframe : 'Play every frame', |
| | | targetcache : 'Target cache', |
| | | correction : 'No correction', |
| | | enablejavascript : 'Enable JavaScript', |
| | | starttime : 'Start time', |
| | | endtime : 'End time', |
| | | href : 'Href', |
| | | qtsrcchokespeed : 'Choke speed', |
| | | target : 'Target', |
| | | volume : 'Volume', |
| | | autostart : 'Auto start', |
| | | enabled : 'Enabled', |
| | | fullscreen : 'Fullscreen', |
| | | invokeurls : 'Invoke URLs', |
| | | mute : 'Mute', |
| | | stretchtofit : 'Stretch to fit', |
| | | windowlessvideo : 'Windowless video', |
| | | balance : 'Balance', |
| | | baseurl : 'Base URL', |
| | | captioningid : 'Captioning id', |
| | | currentmarker : 'Current marker', |
| | | currentposition : 'Current position', |
| | | defaultframe : 'Default frame', |
| | | playcount : 'Play count', |
| | | rate : 'Rate', |
| | | uimode : 'UI Mode', |
| | | flash_options : 'Flash options', |
| | | qt_options : 'Quicktime options', |
| | | wmp_options : 'Windows media player options', |
| | | rmp_options : 'Real media player options', |
| | | shockwave_options : 'Shockwave options', |
| | | autogotourl : 'Auto goto URL', |
| | | center : 'Center', |
| | | imagestatus : 'Image status', |
| | | maintainaspect : 'Maintain aspect', |
| | | nojava : 'No java', |
| | | prefetch : 'Prefetch', |
| | | shuffle : 'Shuffle', |
| | | console : 'Console', |
| | | numloop : 'Num loops', |
| | | controls : 'Controls', |
| | | scriptcallbacks : 'Script callbacks', |
| | | swstretchstyle : 'Stretch style', |
| | | swstretchhalign : 'Stretch H-Align', |
| | | swstretchvalign : 'Stretch V-Align', |
| | | sound : 'Sound', |
| | | progress : 'Progress', |
| | | qtsrc : 'QT Src', |
| | | qt_stream_warn : 'Streamed rtsp resources should be added to the QT Src field under the advanced tab.\nYou should also add a non streamed version to the Src field..', |
| | | align_top : 'Top', |
| | | align_right : 'Right', |
| | | align_bottom : 'Bottom', |
| | | align_left : 'Left', |
| | | align_center : 'Center', |
| | | align_top_left : 'Top left', |
| | | align_top_right : 'Top right', |
| | | align_bottom_left : 'Bottom left', |
| | | align_bottom_right : 'Bottom right' |
| | | }); |
| | |
| | | This is the location you place TinyMCE plugins.
|
| | | This is the location you place TinyMCE plugins. |
| | |
| | | /* CSS file for cell dialog in the table plugin */
|
| | |
|
| | | .panel_wrapper div.current {
|
| | | height: 200px;
|
| | | }
|
| | |
|
| | | .advfield {
|
| | | width: 200px;
|
| | | }
|
| | |
|
| | | #action {
|
| | | margin-bottom: 3px;
|
| | | }
|
| | |
|
| | | #class {
|
| | | width: 150px;
|
| | | /* CSS file for cell dialog in the table plugin */ |
| | | |
| | | .panel_wrapper div.current { |
| | | height: 200px; |
| | | } |
| | | |
| | | .advfield { |
| | | width: 200px; |
| | | } |
| | | |
| | | #action { |
| | | margin-bottom: 3px; |
| | | } |
| | | |
| | | #class { |
| | | width: 150px; |
| | | } |
| | |
| | | /* CSS file for row dialog in the table plugin */
|
| | |
|
| | | .panel_wrapper div.current {
|
| | | height: 200px;
|
| | | }
|
| | |
|
| | | .advfield {
|
| | | width: 200px;
|
| | | }
|
| | |
|
| | | #action {
|
| | | margin-bottom: 3px;
|
| | | }
|
| | |
|
| | | #rowtype,#align,#valign,#class,#height {
|
| | | width: 150px;
|
| | | }
|
| | |
|
| | | #height {
|
| | | width: 50px; |
| | | }
|
| | |
|
| | | .col2 {
|
| | | padding-left: 20px;
|
| | | }
|
| | | /* CSS file for row dialog in the table plugin */ |
| | | |
| | | .panel_wrapper div.current { |
| | | height: 200px; |
| | | } |
| | | |
| | | .advfield { |
| | | width: 200px; |
| | | } |
| | | |
| | | #action { |
| | | margin-bottom: 3px; |
| | | } |
| | | |
| | | #rowtype,#align,#valign,#class,#height { |
| | | width: 150px; |
| | | } |
| | | |
| | | #height { |
| | | width: 50px; |
| | | } |
| | | |
| | | .col2 { |
| | | padding-left: 20px; |
| | | } |
| | |
| | | /* CSS file for table dialog in the table plugin */
|
| | |
|
| | | .panel_wrapper div.current {
|
| | | height: 220px;
|
| | | }
|
| | |
|
| | | .advfield {
|
| | | width: 200px;
|
| | | }
|
| | |
|
| | | #class {
|
| | | width: 150px;
|
| | | }
|
| | | /* CSS file for table dialog in the table plugin */ |
| | | |
| | | .panel_wrapper div.current { |
| | | height: 220px; |
| | | } |
| | | |
| | | .advfield { |
| | | width: 200px; |
| | | } |
| | | |
| | | #class { |
| | | width: 150px; |
| | | } |
| | |
| | | /**
|
| | | * $Id: editor_template_src.js 296 2007-08-21 10:36:35Z spocke $
|
| | | *
|
| | | * @author Moxiecode
|
| | | * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
| | | */
|
| | |
|
| | | /* Import theme specific language pack */
|
| | | tinyMCE.importThemeLanguagePack('advanced');
|
| | |
|
| | | var TinyMCE_AdvancedTheme = {
|
| | | // Private theme fields
|
| | | _defColors : "000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",
|
| | | _autoImportCSSClasses : true,
|
| | | _resizer : {},
|
| | | _buttons : [
|
| | | // Control id, button img, button title, command, user_interface, value
|
| | | ['bold', '{$lang_bold_img}', 'lang_bold_desc', 'Bold'],
|
| | | ['italic', '{$lang_italic_img}', 'lang_italic_desc', 'Italic'],
|
| | | ['underline', '{$lang_underline_img}', 'lang_underline_desc', 'Underline'],
|
| | | ['strikethrough', 'strikethrough.gif', 'lang_striketrough_desc', 'Strikethrough'],
|
| | | ['justifyleft', 'justifyleft.gif', 'lang_justifyleft_desc', 'JustifyLeft'],
|
| | | ['justifycenter', 'justifycenter.gif', 'lang_justifycenter_desc', 'JustifyCenter'],
|
| | | ['justifyright', 'justifyright.gif', 'lang_justifyright_desc', 'JustifyRight'],
|
| | | ['justifyfull', 'justifyfull.gif', 'lang_justifyfull_desc', 'JustifyFull'],
|
| | | ['bullist', 'bullist.gif', 'lang_bullist_desc', 'InsertUnorderedList'],
|
| | | ['numlist', 'numlist.gif', 'lang_numlist_desc', 'InsertOrderedList'],
|
| | | ['outdent', 'outdent.gif', 'lang_outdent_desc', 'Outdent'],
|
| | | ['indent', 'indent.gif', 'lang_indent_desc', 'Indent'],
|
| | | ['cut', 'cut.gif', 'lang_cut_desc', 'Cut'],
|
| | | ['copy', 'copy.gif', 'lang_copy_desc', 'Copy'],
|
| | | ['paste', 'paste.gif', 'lang_paste_desc', 'Paste'],
|
| | | ['undo', 'undo.gif', 'lang_undo_desc', 'Undo'],
|
| | | ['redo', 'redo.gif', 'lang_redo_desc', 'Redo'],
|
| | | ['link', 'link.gif', 'lang_link_desc', 'mceLink', true],
|
| | | ['unlink', 'unlink.gif', 'lang_unlink_desc', 'unlink'],
|
| | | ['image', 'image.gif', 'lang_image_desc', 'mceImage', true],
|
| | | ['cleanup', 'cleanup.gif', 'lang_cleanup_desc', 'mceCleanup'],
|
| | | ['help', 'help.gif', 'lang_help_desc', 'mceHelp'],
|
| | | ['code', 'code.gif', 'lang_theme_code_desc', 'mceCodeEditor'],
|
| | | ['hr', 'hr.gif', 'lang_theme_hr_desc', 'inserthorizontalrule'],
|
| | | ['removeformat', 'removeformat.gif', 'lang_theme_removeformat_desc', 'removeformat'],
|
| | | ['sub', 'sub.gif', 'lang_theme_sub_desc', 'subscript'],
|
| | | ['sup', 'sup.gif', 'lang_theme_sup_desc', 'superscript'],
|
| | | ['forecolor', 'forecolor.gif', 'lang_theme_forecolor_desc', 'forecolor', true],
|
| | | ['forecolorpicker', 'forecolor.gif', 'lang_theme_forecolor_desc', 'forecolorpicker', true],
|
| | | ['backcolor', 'backcolor.gif', 'lang_theme_backcolor_desc', 'HiliteColor', true],
|
| | | ['backcolorpicker', 'backcolor.gif', 'lang_theme_backcolor_desc', 'backcolorpicker', true],
|
| | | ['charmap', 'charmap.gif', 'lang_theme_charmap_desc', 'mceCharMap'],
|
| | | ['visualaid', 'visualaid.gif', 'lang_theme_visualaid_desc', 'mceToggleVisualAid'],
|
| | | ['anchor', 'anchor.gif', 'lang_theme_anchor_desc', 'mceInsertAnchor'],
|
| | | ['newdocument', 'newdocument.gif', 'lang_newdocument_desc', 'mceNewDocument']
|
| | | ],
|
| | |
|
| | | _buttonMap : 'anchor,backcolor,bold,bullist,charmap,cleanup,code,copy,cut,forecolor,help,hr,image,indent,italic,justifycenter,justifyfull,justifyleft,justifyright,link,newdocument,numlist,outdent,paste,redo,removeformat,strikethrough,sub,sup,underline,undo,unlink,visualaid,advhr,ltr,rtl,emotions,flash,fullpage,fullscreen,iespell,insertdate,inserttime,pastetext,pasteword,selectall,preview,print,save,replace,search,table,cell_props,delete_col,delete_row,col_after,col_before,row_after,row_before,merge_cells,row_props,split_cells,delete_table',
|
| | |
|
| | | /**
|
| | | * Returns HTML code for the specificed control.
|
| | | */
|
| | | getControlHTML : function(button_name) {
|
| | | var i, x, but;
|
| | |
|
| | | // Lookup button in button list
|
| | | for (i=0; i<TinyMCE_AdvancedTheme._buttons.length; i++) {
|
| | | but = TinyMCE_AdvancedTheme._buttons[i];
|
| | |
|
| | | if (but[0] == button_name && (button_name == "forecolor" || button_name == "backcolor"))
|
| | | return tinyMCE.getMenuButtonHTML(but[0], but[2], '{$themeurl}/images/' + but[1], but[3] + "Menu", but[3], (but.length > 4 ? but[4] : false), (but.length > 5 ? but[5] : null));
|
| | |
|
| | | if (but[0] == button_name)
|
| | | return tinyMCE.getButtonHTML(but[0], but[2], '{$themeurl}/images/' + but[1], but[3], (but.length > 4 ? but[4] : false), (but.length > 5 ? but[5] : null));
|
| | | }
|
| | |
|
| | | // Custom controlls other than buttons
|
| | | switch (button_name) {
|
| | | case "formatselect":
|
| | | var html = '<select id="{$editor_id}_formatSelect" name="{$editor_id}_formatSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FormatBlock\',false,this.options[this.selectedIndex].value);" class="mceSelectList">';
|
| | | var formats = tinyMCE.getParam("theme_advanced_blockformats", "p,address,pre,h1,h2,h3,h4,h5,h6", true).split(',');
|
| | | var lookup = [
|
| | | ['p', '{$lang_theme_paragraph}'],
|
| | | ['address', '{$lang_theme_address}'],
|
| | | ['pre', '{$lang_theme_pre}'],
|
| | | ['h1', '{$lang_theme_h1}'],
|
| | | ['h2', '{$lang_theme_h2}'],
|
| | | ['h3', '{$lang_theme_h3}'],
|
| | | ['h4', '{$lang_theme_h4}'],
|
| | | ['h5', '{$lang_theme_h5}'],
|
| | | ['h6', '{$lang_theme_h6}'],
|
| | | ['div', '{$lang_theme_div}'],
|
| | | ['blockquote', '{$lang_theme_blockquote}'],
|
| | | ['code', '{$lang_theme_code}'],
|
| | | ['dt', '{$lang_theme_dt}'],
|
| | | ['dd', '{$lang_theme_dd}'],
|
| | | ['samp', '{$lang_theme_samp}']
|
| | | ];
|
| | |
|
| | | html += '<option value="">{$lang_theme_block}</option>';
|
| | |
|
| | | // Build format select
|
| | | for (var i=0; i<formats.length; i++) {
|
| | | for (var x=0; x<lookup.length; x++) {
|
| | | if (formats[i] == lookup[x][0])
|
| | | html += '<option value="<' + lookup[x][0] + '>">' + lookup[x][1] + '</option>';
|
| | | }
|
| | | }
|
| | |
|
| | | html += '</select>';
|
| | |
|
| | | return html;
|
| | |
|
| | | case "styleselect":
|
| | | return '<select id="{$editor_id}_styleSelect" onmousedown="tinyMCE.themes.advanced._setupCSSClasses(\'{$editor_id}\');" name="{$editor_id}_styleSelect" onfocus="tinyMCE.addSelectAccessibility(event,this,window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSetCSSClass\',false,this.options[this.selectedIndex].value);" class="mceSelectList">{$style_select_options}</select>';
|
| | |
|
| | | case "fontselect":
|
| | | var fontHTML = '<select id="{$editor_id}_fontNameSelect" name="{$editor_id}_fontNameSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontName\',false,this.options[this.selectedIndex].value);" class="mceSelectList"><option value="">{$lang_theme_fontdefault}</option>';
|
| | | var iFonts = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';
|
| | | var nFonts = 'Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats';
|
| | | var fonts = tinyMCE.getParam("theme_advanced_fonts", nFonts).split(';');
|
| | | for (i=0; i<fonts.length; i++) {
|
| | | if (fonts[i] != '') {
|
| | | var parts = fonts[i].split('=');
|
| | | fontHTML += '<option value="' + parts[1] + '">' + parts[0] + '</option>';
|
| | | }
|
| | | }
|
| | |
|
| | | fontHTML += '</select>';
|
| | | return fontHTML;
|
| | |
|
| | | case "fontsizeselect":
|
| | | return '<select id="{$editor_id}_fontSizeSelect" name="{$editor_id}_fontSizeSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontSize\',false,this.options[this.selectedIndex].value);" class="mceSelectList">'+
|
| | | '<option value="0">{$lang_theme_font_size}</option>'+
|
| | | '<option value="1">1 (8 pt)</option>'+
|
| | | '<option value="2">2 (10 pt)</option>'+
|
| | | '<option value="3">3 (12 pt)</option>'+
|
| | | '<option value="4">4 (14 pt)</option>'+
|
| | | '<option value="5">5 (18 pt)</option>'+
|
| | | '<option value="6">6 (24 pt)</option>'+
|
| | | '<option value="7">7 (36 pt)</option>'+
|
| | | '</select>';
|
| | |
|
| | | case "|":
|
| | | case "separator":
|
| | | return '<img src="{$themeurl}/images/separator.gif" width="2" height="20" class="mceSeparatorLine" alt="" />';
|
| | |
|
| | | case "spacer":
|
| | | return '<img src="{$themeurl}/images/separator.gif" width="2" height="15" border="0" class="mceSeparatorLine" style="vertical-align: middle" alt="" />';
|
| | |
|
| | | case "rowseparator":
|
| | | return '<br />';
|
| | | }
|
| | |
|
| | | return "";
|
| | | },
|
| | |
|
| | | /**
|
| | | * Theme specific execcommand handling.
|
| | | */
|
| | | execCommand : function(editor_id, element, command, user_interface, value) {
|
| | | switch (command) {
|
| | | case 'mceHelp':
|
| | | tinyMCE.openWindow({
|
| | | file : 'about.htm',
|
| | | width : 480,
|
| | | height : 380
|
| | | }, {
|
| | | tinymce_version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion,
|
| | | tinymce_releasedate : tinyMCE.releaseDate,
|
| | | inline : "yes"
|
| | | });
|
| | | return true;
|
| | |
|
| | | case "mceLink":
|
| | | var inst = tinyMCE.getInstanceById(editor_id);
|
| | | var doc = inst.getDoc();
|
| | | var selectedText = "";
|
| | |
|
| | | if (tinyMCE.isMSIE) {
|
| | | var rng = doc.selection.createRange();
|
| | | selectedText = rng.text;
|
| | | } else
|
| | | selectedText = inst.getSel().toString();
|
| | |
|
| | | if (!tinyMCE.linkElement) {
|
| | | if ((tinyMCE.selectedElement.nodeName.toLowerCase() != "img") && (selectedText.length <= 0))
|
| | | return true;
|
| | | }
|
| | |
|
| | | var href = "", target = "", title = "", onclick = "", action = "insert", style_class = "";
|
| | |
|
| | | if (tinyMCE.selectedElement.nodeName.toLowerCase() == "a")
|
| | | tinyMCE.linkElement = tinyMCE.selectedElement;
|
| | |
|
| | | // Is anchor not a link
|
| | | if (tinyMCE.linkElement != null && tinyMCE.getAttrib(tinyMCE.linkElement, 'href') == "")
|
| | | tinyMCE.linkElement = null;
|
| | |
|
| | | if (tinyMCE.linkElement) {
|
| | | href = tinyMCE.getAttrib(tinyMCE.linkElement, 'href');
|
| | | target = tinyMCE.getAttrib(tinyMCE.linkElement, 'target');
|
| | | title = tinyMCE.getAttrib(tinyMCE.linkElement, 'title');
|
| | | onclick = tinyMCE.getAttrib(tinyMCE.linkElement, 'onclick');
|
| | | style_class = tinyMCE.getAttrib(tinyMCE.linkElement, 'class');
|
| | |
|
| | | // Try old onclick to if copy/pasted content
|
| | | if (onclick == "")
|
| | | onclick = tinyMCE.getAttrib(tinyMCE.linkElement, 'onclick');
|
| | |
|
| | | onclick = tinyMCE.cleanupEventStr(onclick);
|
| | |
|
| | | href = eval(tinyMCE.settings['urlconverter_callback'] + "(href, tinyMCE.linkElement, true);");
|
| | |
|
| | | // Use mce_href if defined
|
| | | mceRealHref = tinyMCE.getAttrib(tinyMCE.linkElement, 'mce_href');
|
| | | if (mceRealHref != "") {
|
| | | href = mceRealHref;
|
| | |
|
| | | if (tinyMCE.getParam('convert_urls'))
|
| | | href = eval(tinyMCE.settings['urlconverter_callback'] + "(href, tinyMCE.linkElement, true);");
|
| | | }
|
| | |
|
| | | action = "update";
|
| | | }
|
| | |
|
| | | var template = new Array();
|
| | |
|
| | | template['file'] = 'link.htm';
|
| | | template['width'] = 310;
|
| | | template['height'] = 200;
|
| | |
|
| | | // Language specific width and height addons
|
| | | template['width'] += tinyMCE.getLang('lang_insert_link_delta_width', 0);
|
| | | template['height'] += tinyMCE.getLang('lang_insert_link_delta_height', 0);
|
| | |
|
| | | if (inst.settings['insertlink_callback']) {
|
| | | var returnVal = eval(inst.settings['insertlink_callback'] + "(href, target, title, onclick, action, style_class);");
|
| | | if (returnVal && returnVal['href'])
|
| | | TinyMCE_AdvancedTheme._insertLink(returnVal['href'], returnVal['target'], returnVal['title'], returnVal['onclick'], returnVal['style_class']);
|
| | | } else {
|
| | | tinyMCE.openWindow(template, {href : href, target : target, title : title, onclick : onclick, action : action, className : style_class, inline : "yes"});
|
| | | }
|
| | |
|
| | | return true;
|
| | |
|
| | | case "mceImage":
|
| | | var src = "", alt = "", border = "", hspace = "", vspace = "", width = "", height = "", align = "";
|
| | | var title = "", onmouseover = "", onmouseout = "", action = "insert";
|
| | | var img = tinyMCE.imgElement;
|
| | | var inst = tinyMCE.getInstanceById(editor_id);
|
| | |
|
| | | if (tinyMCE.selectedElement != null && tinyMCE.selectedElement.nodeName.toLowerCase() == "img") {
|
| | | img = tinyMCE.selectedElement;
|
| | | tinyMCE.imgElement = img;
|
| | | }
|
| | |
|
| | | if (img) {
|
| | | // Is it a internal MCE visual aid image, then skip this one.
|
| | | if (tinyMCE.getAttrib(img, 'name').indexOf('mce_') == 0)
|
| | | return true;
|
| | |
|
| | | src = tinyMCE.getAttrib(img, 'src');
|
| | | alt = tinyMCE.getAttrib(img, 'alt');
|
| | |
|
| | | // Try polling out the title
|
| | | if (alt == "")
|
| | | alt = tinyMCE.getAttrib(img, 'title');
|
| | |
|
| | | // Fix width/height attributes if the styles is specified
|
| | | if (tinyMCE.isGecko) {
|
| | | var w = img.style.width;
|
| | | if (w != null && w != "")
|
| | | img.setAttribute("width", w);
|
| | |
|
| | | var h = img.style.height;
|
| | | if (h != null && h != "")
|
| | | img.setAttribute("height", h);
|
| | | }
|
| | |
|
| | | border = tinyMCE.getAttrib(img, 'border');
|
| | | hspace = tinyMCE.getAttrib(img, 'hspace');
|
| | | vspace = tinyMCE.getAttrib(img, 'vspace');
|
| | | width = tinyMCE.getAttrib(img, 'width');
|
| | | height = tinyMCE.getAttrib(img, 'height');
|
| | | align = tinyMCE.getAttrib(img, 'align');
|
| | | onmouseover = tinyMCE.getAttrib(img, 'onmouseover');
|
| | | onmouseout = tinyMCE.getAttrib(img, 'onmouseout');
|
| | | title = tinyMCE.getAttrib(img, 'title');
|
| | |
|
| | | // Is realy specified?
|
| | | if (tinyMCE.isMSIE) {
|
| | | width = img.attributes['width'].specified ? width : "";
|
| | | height = img.attributes['height'].specified ? height : "";
|
| | | }
|
| | |
|
| | | //onmouseover = tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseover));
|
| | | //onmouseout = tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseout));
|
| | |
|
| | | src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, img, true);");
|
| | |
|
| | | // Use mce_src if defined
|
| | | mceRealSrc = tinyMCE.getAttrib(img, 'mce_src');
|
| | | if (mceRealSrc != "") {
|
| | | src = mceRealSrc;
|
| | |
|
| | | if (tinyMCE.getParam('convert_urls'))
|
| | | src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, img, true);");
|
| | | }
|
| | |
|
| | | //if (onmouseover != "")
|
| | | // onmouseover = eval(tinyMCE.settings['urlconverter_callback'] + "(onmouseover, img, true);");
|
| | |
|
| | | //if (onmouseout != "")
|
| | | // onmouseout = eval(tinyMCE.settings['urlconverter_callback'] + "(onmouseout, img, true);");
|
| | |
|
| | | action = "update";
|
| | | }
|
| | |
|
| | | var template = new Array();
|
| | |
|
| | | template['file'] = 'image.htm?src={$src}';
|
| | | template['width'] = 355;
|
| | | template['height'] = 265 + (tinyMCE.isMSIE ? 25 : 0);
|
| | |
|
| | | // Language specific width and height addons
|
| | | template['width'] += tinyMCE.getLang('lang_insert_image_delta_width', 0);
|
| | | template['height'] += tinyMCE.getLang('lang_insert_image_delta_height', 0);
|
| | |
|
| | | if (inst.settings['insertimage_callback']) {
|
| | | var returnVal = eval(inst.settings['insertimage_callback'] + "(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);");
|
| | | if (returnVal && returnVal['src'])
|
| | | TinyMCE_AdvancedTheme._insertImage(returnVal['src'], returnVal['alt'], returnVal['border'], returnVal['hspace'], returnVal['vspace'], returnVal['width'], returnVal['height'], returnVal['align'], returnVal['title'], returnVal['onmouseover'], returnVal['onmouseout']);
|
| | | } else
|
| | | tinyMCE.openWindow(template, {src : src, alt : alt, border : border, hspace : hspace, vspace : vspace, width : width, height : height, align : align, title : title, onmouseover : onmouseover, onmouseout : onmouseout, action : action, inline : "yes"});
|
| | |
|
| | | return true;
|
| | |
|
| | | case "forecolor":
|
| | | var fcp = new TinyMCE_Layer(editor_id + '_fcPreview', false), p, img, elm;
|
| | |
|
| | | TinyMCE_AdvancedTheme._hideMenus(editor_id);
|
| | |
|
| | | if (!fcp.exists()) {
|
| | | fcp.create('div', 'mceColorPreview', document.getElementById(editor_id + '_toolbar'));
|
| | | elm = fcp.getElement();
|
| | | elm._editor_id = editor_id;
|
| | | elm._command = "forecolor";
|
| | | elm._switchId = editor_id + "_forecolor";
|
| | | tinyMCE.addEvent(elm, 'click', TinyMCE_AdvancedTheme._handleMenuEvent);
|
| | | tinyMCE.addEvent(elm, 'mouseover', TinyMCE_AdvancedTheme._handleMenuEvent);
|
| | | tinyMCE.addEvent(elm, 'mouseout', TinyMCE_AdvancedTheme._handleMenuEvent);
|
| | | }
|
| | |
|
| | | img = tinyMCE.selectNodes(document.getElementById(editor_id + "_forecolor"), function(n) {return n.nodeName == "IMG";})[0];
|
| | | p = tinyMCE.getAbsPosition(img, document.getElementById(editor_id + '_toolbar'));
|
| | |
|
| | | fcp.moveTo(p.absLeft, p.absTop);
|
| | | fcp.getElement().style.backgroundColor = value != null ? value : tinyMCE.getInstanceById(editor_id).foreColor;
|
| | | fcp.show();
|
| | |
|
| | | return false;
|
| | |
|
| | | case "forecolorpicker":
|
| | | this._pickColor(editor_id, 'forecolor');
|
| | | return true;
|
| | |
|
| | | case "forecolorMenu":
|
| | | TinyMCE_AdvancedTheme._hideMenus(editor_id);
|
| | |
|
| | | // Create color layer
|
| | | var ml = new TinyMCE_Layer(editor_id + '_fcMenu');
|
| | |
|
| | | if (!ml.exists())
|
| | | ml.create('div', 'mceMenu', document.body, TinyMCE_AdvancedTheme._getColorHTML(editor_id, 'theme_advanced_text_colors', 'forecolor'));
|
| | |
|
| | | tinyMCE.switchClass(editor_id + '_forecolor', 'mceMenuButtonFocus');
|
| | | ml.moveRelativeTo(document.getElementById(editor_id + "_forecolor"), 'bl');
|
| | |
|
| | | ml.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? -1 : 1, -1);
|
| | |
|
| | | if (tinyMCE.isOpera)
|
| | | ml.moveBy(0, -2);
|
| | |
|
| | | ml.show();
|
| | | return true;
|
| | |
|
| | | case "HiliteColor":
|
| | | var bcp = new TinyMCE_Layer(editor_id + '_bcPreview', false), p, img;
|
| | |
|
| | | TinyMCE_AdvancedTheme._hideMenus(editor_id);
|
| | |
|
| | | if (!bcp.exists()) {
|
| | | bcp.create('div', 'mceColorPreview', document.getElementById(editor_id + '_toolbar'));
|
| | | elm = bcp.getElement();
|
| | | elm._editor_id = editor_id;
|
| | | elm._command = "HiliteColor";
|
| | | elm._switchId = editor_id + "_backcolor";
|
| | | tinyMCE.addEvent(elm, 'click', TinyMCE_AdvancedTheme._handleMenuEvent);
|
| | | tinyMCE.addEvent(elm, 'mouseover', TinyMCE_AdvancedTheme._handleMenuEvent);
|
| | | tinyMCE.addEvent(elm, 'mouseout', TinyMCE_AdvancedTheme._handleMenuEvent);
|
| | | }
|
| | |
|
| | | img = tinyMCE.selectNodes(document.getElementById(editor_id + "_backcolor"), function(n) {return n.nodeName == "IMG";})[0];
|
| | | p = tinyMCE.getAbsPosition(img, document.getElementById(editor_id + '_toolbar'));
|
| | |
|
| | | bcp.moveTo(p.absLeft, p.absTop);
|
| | | bcp.getElement().style.backgroundColor = value != null ? value : tinyMCE.getInstanceById(editor_id).backColor;
|
| | | bcp.show();
|
| | |
|
| | | return false;
|
| | |
|
| | | case "HiliteColorMenu":
|
| | | TinyMCE_AdvancedTheme._hideMenus(editor_id);
|
| | |
|
| | | // Create color layer
|
| | | var ml = new TinyMCE_Layer(editor_id + '_bcMenu');
|
| | |
|
| | | if (!ml.exists())
|
| | | ml.create('div', 'mceMenu', document.body, TinyMCE_AdvancedTheme._getColorHTML(editor_id, 'theme_advanced_background_colors', 'HiliteColor'));
|
| | |
|
| | | tinyMCE.switchClass(editor_id + '_backcolor', 'mceMenuButtonFocus');
|
| | | ml.moveRelativeTo(document.getElementById(editor_id + "_backcolor"), 'bl');
|
| | |
|
| | | ml.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? -1 : 1, -1);
|
| | |
|
| | | if (tinyMCE.isOpera)
|
| | | ml.moveBy(0, -2);
|
| | |
|
| | | ml.show();
|
| | | return true;
|
| | | |
| | | case "backcolorpicker":
|
| | | this._pickColor(editor_id, 'HiliteColor');
|
| | | return true;
|
| | |
|
| | | case "mceColorPicker":
|
| | | if (user_interface) {
|
| | | var template = [];
|
| | | |
| | | if (!value['callback'] && !value['color'])
|
| | | value['color'] = value['document'].getElementById(value['element_id']).value;
|
| | |
|
| | | template['file'] = 'color_picker.htm';
|
| | | template['width'] = 380;
|
| | | template['height'] = 250;
|
| | | template['close_previous'] = "no";
|
| | |
|
| | | template['width'] += tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width', 0);
|
| | | template['height'] += tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_height', 0);
|
| | |
|
| | | if (typeof(value['store_selection']) == "undefined")
|
| | | value['store_selection'] = true;
|
| | |
|
| | | tinyMCE.lastColorPickerValue = value;
|
| | | tinyMCE.openWindow(template, {editor_id : editor_id, mce_store_selection : value['store_selection'], inline : "yes", command : "mceColorPicker", input_color : value['color']});
|
| | | } else {
|
| | | var savedVal = tinyMCE.lastColorPickerValue, elm;
|
| | |
|
| | | if (savedVal['callback']) {
|
| | | savedVal['callback'](value);
|
| | | return true;
|
| | | }
|
| | |
|
| | | elm = savedVal['document'].getElementById(savedVal['element_id']);
|
| | | elm.value = value;
|
| | |
|
| | | if (elm.onchange != null && elm.onchange != '')
|
| | | eval('elm.onchange();');
|
| | | }
|
| | | return true;
|
| | |
|
| | | case "mceCodeEditor":
|
| | | var template = new Array();
|
| | |
|
| | | template['file'] = 'source_editor.htm';
|
| | | template['width'] = parseInt(tinyMCE.getParam("theme_advanced_source_editor_width", 720));
|
| | | template['height'] = parseInt(tinyMCE.getParam("theme_advanced_source_editor_height", 580));
|
| | |
|
| | | tinyMCE.openWindow(template, {editor_id : editor_id, resizable : "yes", scrollbars : "no", inline : "yes"});
|
| | | return true;
|
| | |
|
| | | case "mceCharMap":
|
| | | var template = new Array();
|
| | |
|
| | | template['file'] = 'charmap.htm';
|
| | | template['width'] = 550 + (tinyMCE.isOpera ? 40 : 0);
|
| | | template['height'] = 250;
|
| | |
|
| | | template['width'] += tinyMCE.getLang('lang_theme_advanced_charmap_delta_width', 0);
|
| | | template['height'] += tinyMCE.getLang('lang_theme_advanced_charmap_delta_height', 0);
|
| | |
|
| | | tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"});
|
| | | return true;
|
| | |
|
| | | case "mceInsertAnchor":
|
| | | var template = new Array();
|
| | |
|
| | | template['file'] = 'anchor.htm';
|
| | | template['width'] = 320;
|
| | | template['height'] = 90 + (tinyMCE.isNS7 ? 30 : 0);
|
| | |
|
| | | template['width'] += tinyMCE.getLang('lang_theme_advanced_anchor_delta_width', 0);
|
| | | template['height'] += tinyMCE.getLang('lang_theme_advanced_anchor_delta_height', 0);
|
| | |
|
| | | tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"});
|
| | | return true;
|
| | |
|
| | | case "mceNewDocument":
|
| | | if (confirm(tinyMCE.entityDecode(tinyMCE.getLang('lang_newdocument'))))
|
| | | tinyMCE.execInstanceCommand(editor_id, 'mceSetContent', false, ' ');
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | return false;
|
| | | },
|
| | |
|
| | | /**
|
| | | * Editor instance template function.
|
| | | */
|
| | | getEditorTemplate : function(settings, editorId) {
|
| | | function removeFromArray(in_array, remove_array) {
|
| | | var outArray = new Array(), skip;
|
| | | |
| | | for (var i=0; i<in_array.length; i++) {
|
| | | skip = false;
|
| | |
|
| | | for (var j=0; j<remove_array.length; j++) {
|
| | | if (in_array[i] == remove_array[j]) {
|
| | | skip = true;
|
| | | }
|
| | | }
|
| | |
|
| | | if (!skip) {
|
| | | outArray[outArray.length] = in_array[i];
|
| | | }
|
| | | }
|
| | |
|
| | | return outArray;
|
| | | }
|
| | |
|
| | | function addToArray(in_array, add_array) {
|
| | | for (var i=0; i<add_array.length; i++) {
|
| | | in_array[in_array.length] = add_array[i];
|
| | | }
|
| | |
|
| | | return in_array;
|
| | | }
|
| | |
|
| | | var template = new Array();
|
| | | var deltaHeight = 0;
|
| | | var resizing = tinyMCE.getParam("theme_advanced_resizing", false);
|
| | | var path = tinyMCE.getParam("theme_advanced_path", true);
|
| | | var statusbarHTML = '<div id="{$editor_id}_path" class="mceStatusbarPathText" style="display: ' + (path ? "block" : "none") + '"> </div><div id="{$editor_id}_resize" class="mceStatusbarResize" style="display: ' + (resizing ? "block" : "none") + '" onmousedown="tinyMCE.themes.advanced._setResizing(event,\'{$editor_id}\',true);"></div><br style="clear: both" />';
|
| | | var layoutManager = tinyMCE.getParam("theme_advanced_layout_manager", "SimpleLayout");
|
| | |
|
| | | // Setup style select options -- MOVED UP FOR EXTERNAL TOOLBAR COMPATABILITY!
|
| | | var styleSelectHTML = '<option value="">{$lang_theme_style_select}</option>';
|
| | | if (settings['theme_advanced_styles']) {
|
| | | var stylesAr = settings['theme_advanced_styles'].split(';');
|
| | | |
| | | for (var i=0; i<stylesAr.length; i++) {
|
| | | var key, value;
|
| | |
|
| | | key = stylesAr[i].split('=')[0];
|
| | | value = stylesAr[i].split('=')[1];
|
| | |
|
| | | styleSelectHTML += '<option value="' + value + '">' + key + '</option>';
|
| | | }
|
| | |
|
| | | TinyMCE_AdvancedTheme._autoImportCSSClasses = false;
|
| | | }
|
| | |
|
| | | switch(layoutManager) {
|
| | | case "SimpleLayout" : //the default TinyMCE Layout (for backwards compatibility)...
|
| | | var toolbarHTML = "";
|
| | | var toolbarLocation = tinyMCE.getParam("theme_advanced_toolbar_location", "bottom");
|
| | | var toolbarAlign = tinyMCE.getParam("theme_advanced_toolbar_align", "center");
|
| | | var pathLocation = tinyMCE.getParam("theme_advanced_path_location", "none"); // Compatiblity
|
| | | var statusbarLocation = tinyMCE.getParam("theme_advanced_statusbar_location", pathLocation);
|
| | | var defVals = {
|
| | | theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect",
|
| | | theme_advanced_buttons2 : "bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code",
|
| | | theme_advanced_buttons3 : "hr,removeformat,visualaid,separator,sub,sup,separator,charmap"
|
| | | };
|
| | |
|
| | | // Add accessibility control
|
| | | toolbarHTML += '<a href="#" accesskey="q" title="' + tinyMCE.getLang("lang_toolbar_focus") + '"';
|
| | |
|
| | | if (!tinyMCE.getParam("accessibility_focus"))
|
| | | toolbarHTML += ' onfocus="tinyMCE.getInstanceById(\'' + editorId + '\').getWin().focus();"';
|
| | |
|
| | | toolbarHTML += '></a>';
|
| | |
|
| | | // Render rows
|
| | | for (var i=1; i<100; i++) {
|
| | | var def = defVals["theme_advanced_buttons" + i];
|
| | |
|
| | | var buttons = tinyMCE.getParam("theme_advanced_buttons" + i, def == null ? '' : def, true, ',');
|
| | | if (buttons.length == 0)
|
| | | break;
|
| | |
|
| | | buttons = removeFromArray(buttons, tinyMCE.getParam("theme_advanced_disable", "", true, ','));
|
| | | buttons = addToArray(buttons, tinyMCE.getParam("theme_advanced_buttons" + i + "_add", "", true, ','));
|
| | | buttons = addToArray(tinyMCE.getParam("theme_advanced_buttons" + i + "_add_before", "", true, ','), buttons);
|
| | |
|
| | | for (var b=0; b<buttons.length; b++)
|
| | | toolbarHTML += tinyMCE.getControlHTML(buttons[b]);
|
| | |
|
| | | if (buttons.length > 0) {
|
| | | toolbarHTML += "<br />";
|
| | | deltaHeight -= 23;
|
| | | }
|
| | | }
|
| | |
|
| | | // Add accessibility control
|
| | | toolbarHTML += '<a href="#" accesskey="z" onfocus="tinyMCE.getInstanceById(\'' + editorId + '\').getWin().focus();"></a>';
|
| | |
|
| | | // Setup template html
|
| | | template['html'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width_style};height:{$height_style}"><tbody>';
|
| | |
|
| | | if (toolbarLocation == "top")
|
| | | template['html'] += '<tr><td dir="ltr" class="mceToolbarTop" align="' + toolbarAlign + '" height="1" nowrap="nowrap"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>';
|
| | |
|
| | | if (statusbarLocation == "top") {
|
| | | template['html'] += '<tr><td class="mceStatusbarTop" height="1">' + statusbarHTML + '</td></tr>';
|
| | | deltaHeight -= 23;
|
| | | }
|
| | |
|
| | | template['html'] += '<tr><td align="center"><span id="{$editor_id}"></span></td></tr>';
|
| | |
|
| | | if (toolbarLocation == "bottom")
|
| | | template['html'] += '<tr><td dir="ltr" class="mceToolbarBottom" align="' + toolbarAlign + '" height="1"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>';
|
| | |
|
| | | // External toolbar changes
|
| | | if (toolbarLocation == "external") {
|
| | | var bod = document.body;
|
| | | var elm = document.createElement ("div");
|
| | |
|
| | | toolbarHTML = tinyMCE.replaceVar(toolbarHTML, 'style_select_options', styleSelectHTML);
|
| | | toolbarHTML = tinyMCE.applyTemplate(toolbarHTML, {editor_id : editorId});
|
| | |
|
| | | elm.className = "mceToolbarExternal";
|
| | | elm.id = editorId+"_toolbar";
|
| | | elm.innerHTML = '<table width="100%" border="0" align="center"><tr><td align="center">'+toolbarHTML+'</td></tr></table>';
|
| | | bod.appendChild (elm);
|
| | | // bod.style.marginTop = elm.offsetHeight + "px";
|
| | |
|
| | | deltaHeight = 0;
|
| | | tinyMCE.getInstanceById(editorId).toolbarElement = elm;
|
| | |
|
| | | //template['html'] = '<div id="mceExternalToolbar" align="center" class="mceToolbarExternal"><table width="100%" border="0" align="center"><tr><td align="center">'+toolbarHTML+'</td></tr></table></div>' + template["html"];
|
| | | } else {
|
| | | tinyMCE.getInstanceById(editorId).toolbarElement = null;
|
| | | }
|
| | |
|
| | | if (statusbarLocation == "bottom") {
|
| | | template['html'] += '<tr><td class="mceStatusbarBottom" height="1">' + statusbarHTML + '</td></tr>';
|
| | | deltaHeight -= 23;
|
| | | }
|
| | |
|
| | | template['html'] += '</tbody></table>';
|
| | | //"SimpleLayout"
|
| | | break;
|
| | |
|
| | | case "RowLayout" : //Container Layout - containers defined in "theme_advanced_containers" are rendered from top to bottom.
|
| | | template['html'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';
|
| | |
|
| | | var containers = tinyMCE.getParam("theme_advanced_containers", "", true, ",");
|
| | | var defaultContainerCSS = tinyMCE.getParam("theme_advanced_containers_default_class", "container");
|
| | | var defaultContainerAlign = tinyMCE.getParam("theme_advanced_containers_default_align", "center");
|
| | |
|
| | | //Render Containers:
|
| | | for (var i = 0; i < containers.length; i++)
|
| | | {
|
| | | if (containers[i] == "mceEditor") //Exceptions for mceEditor and ...
|
| | | template['html'] += '<tr><td align="center" class="mceEditor_border"><span id="{$editor_id}"></span></td></tr>';
|
| | | else if (containers[i] == "mceElementpath" || containers[i] == "mceStatusbar") // ... mceElementpath:
|
| | | {
|
| | | var pathClass = "mceStatusbar";
|
| | |
|
| | | if (i == containers.length-1)
|
| | | {
|
| | | pathClass = "mceStatusbarBottom";
|
| | | }
|
| | | else if (i == 0)
|
| | | {
|
| | | pathClass = "mceStatusbar";
|
| | | }
|
| | | else
|
| | | {
|
| | | deltaHeight-=2;
|
| | | }
|
| | |
|
| | | template['html'] += '<tr><td class="' + pathClass + '" height="1">' + statusbarHTML + '</td></tr>';
|
| | | deltaHeight -= 22;
|
| | | } else { // Render normal Container
|
| | | var curContainer = tinyMCE.getParam("theme_advanced_container_"+containers[i], "", true, ',');
|
| | | var curContainerHTML = "";
|
| | | var curAlign = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align", defaultContainerAlign);
|
| | | var curCSS = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class", defaultContainerCSS);
|
| | |
|
| | | curContainer = removeFromArray(curContainer, tinyMCE.getParam("theme_advanced_disable", "", true, ','));
|
| | |
|
| | | for (var j=0; j<curContainer.length; j++)
|
| | | curContainerHTML += tinyMCE.getControlHTML(curContainer[j]);
|
| | |
|
| | | if (curContainer.length > 0) {
|
| | | curContainerHTML += "<br />";
|
| | | deltaHeight -= 23;
|
| | | }
|
| | |
|
| | | template['html'] += '<tr><td class="' + curCSS + '" align="' + curAlign + '" height="1">' + curContainerHTML + '</td></tr>';
|
| | | }
|
| | | }
|
| | |
|
| | | template['html'] += '</tbody></table>';
|
| | | //RowLayout
|
| | | break;
|
| | |
|
| | | case "CustomLayout" : //User defined layout callback...
|
| | | var customLayout = tinyMCE.getParam("theme_advanced_custom_layout","");
|
| | |
|
| | | if (customLayout != "" && eval("typeof(" + customLayout + ")") != "undefined") {
|
| | | template = eval(customLayout + "(template);");
|
| | | }
|
| | | break;
|
| | | }
|
| | |
|
| | | if (resizing)
|
| | | template['html'] += '<span id="{$editor_id}_resize_box" class="mceResizeBox"></span>';
|
| | |
|
| | | template['html'] = tinyMCE.replaceVar(template['html'], 'style_select_options', styleSelectHTML);
|
| | |
|
| | | // Set to default values
|
| | | if (!template['delta_width'])
|
| | | template['delta_width'] = 0;
|
| | |
|
| | | if (!template['delta_height'])
|
| | | template['delta_height'] = deltaHeight;
|
| | |
|
| | | return template;
|
| | | },
|
| | |
|
| | | initInstance : function(inst) {
|
| | | if (tinyMCE.getParam("theme_advanced_resizing", false)) {
|
| | | if (tinyMCE.getParam("theme_advanced_resizing_use_cookie", true)) {
|
| | | var w = TinyMCE_AdvancedTheme._getCookie("TinyMCE_" + inst.editorId + "_width");
|
| | | var h = TinyMCE_AdvancedTheme._getCookie("TinyMCE_" + inst.editorId + "_height");
|
| | |
|
| | | TinyMCE_AdvancedTheme._resizeTo(inst, w, h, tinyMCE.getParam("theme_advanced_resize_horizontal", true));
|
| | | }
|
| | | }
|
| | |
|
| | | inst.addShortcut('ctrl', 'k', 'lang_link_desc', 'mceLink');
|
| | | },
|
| | |
|
| | | removeInstance : function(inst) {
|
| | | new TinyMCE_Layer(inst.editorId + '_fcMenu').remove();
|
| | | new TinyMCE_Layer(inst.editorId + '_bcMenu').remove();
|
| | | },
|
| | |
|
| | | hideInstance : function(inst) {
|
| | | TinyMCE_AdvancedTheme._hideMenus(inst.editorId);
|
| | | },
|
| | |
|
| | | _handleMenuEvent : function(e) {
|
| | | var te = tinyMCE.isMSIE ? window.event.srcElement : e.target;
|
| | | tinyMCE._menuButtonEvent(e.type == "mouseover" ? "over" : "out", document.getElementById(te._switchId));
|
| | |
|
| | | if (e.type == "click")
|
| | | tinyMCE.execInstanceCommand(te._editor_id, te._command);
|
| | | },
|
| | |
|
| | | _hideMenus : function(id) {
|
| | | var fcml = new TinyMCE_Layer(id + '_fcMenu'), bcml = new TinyMCE_Layer(id + '_bcMenu');
|
| | |
|
| | | if (fcml.exists() && fcml.isVisible()) {
|
| | | tinyMCE.switchClass(id + '_forecolor', 'mceMenuButton');
|
| | | fcml.hide();
|
| | | }
|
| | |
|
| | | if (bcml.exists() && bcml.isVisible()) {
|
| | | tinyMCE.switchClass(id + '_backcolor', 'mceMenuButton');
|
| | | bcml.hide();
|
| | | }
|
| | | },
|
| | |
|
| | | /**
|
| | | * Node change handler.
|
| | | */
|
| | | handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection, setup_content) {
|
| | | var alignNode, breakOut, classNode;
|
| | |
|
| | | function selectByValue(select_elm, value, first_index) {
|
| | | first_index = typeof(first_index) == "undefined" ? false : true;
|
| | |
|
| | | if (select_elm) {
|
| | | for (var i=0; i<select_elm.options.length; i++) {
|
| | | var ov = "" + select_elm.options[i].value;
|
| | |
|
| | | if (first_index && ov.toLowerCase().indexOf(value.toLowerCase()) == 0) {
|
| | | select_elm.selectedIndex = i;
|
| | | return true;
|
| | | }
|
| | |
|
| | | if (ov == value) {
|
| | | select_elm.selectedIndex = i;
|
| | | return true;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | return false;
|
| | | };
|
| | |
|
| | | // No node provided
|
| | | if (node == null)
|
| | | return;
|
| | |
|
| | | // Update path
|
| | | var pathElm = document.getElementById(editor_id + "_path");
|
| | | var inst = tinyMCE.getInstanceById(editor_id);
|
| | | var doc = inst.getDoc();
|
| | | TinyMCE_AdvancedTheme._hideMenus(editor_id);
|
| | |
|
| | | if (pathElm) {
|
| | | // Get node path
|
| | | var parentNode = node;
|
| | | var path = new Array();
|
| | | |
| | | while (parentNode != null) {
|
| | | if (parentNode.nodeName.toUpperCase() == "BODY") {
|
| | | break;
|
| | | }
|
| | |
|
| | | // Only append element nodes to path
|
| | | if (parentNode.nodeType == 1 && tinyMCE.getAttrib(parentNode, "class").indexOf('mceItemHidden') == -1) {
|
| | | path[path.length] = parentNode;
|
| | | }
|
| | |
|
| | | parentNode = parentNode.parentNode;
|
| | | }
|
| | |
|
| | | // Setup HTML
|
| | | var html = "";
|
| | | for (var i=path.length-1; i>=0; i--) {
|
| | | var nodeName = path[i].nodeName.toLowerCase();
|
| | | var nodeData = "";
|
| | |
|
| | | if (nodeName.indexOf("html:") == 0)
|
| | | nodeName = nodeName.substring(5);
|
| | |
|
| | | if (nodeName == "b") {
|
| | | nodeName = "strong";
|
| | | }
|
| | |
|
| | | if (nodeName == "i") {
|
| | | nodeName = "em";
|
| | | }
|
| | |
|
| | | if (nodeName == "span") {
|
| | | var cn = tinyMCE.getAttrib(path[i], "class");
|
| | | if (cn != "" && cn.indexOf('mceItem') == -1)
|
| | | nodeData += "class: " + cn + " ";
|
| | |
|
| | | var st = tinyMCE.getAttrib(path[i], "style");
|
| | | if (st != "") {
|
| | | st = tinyMCE.serializeStyle(tinyMCE.parseStyle(st));
|
| | | nodeData += "style: " + tinyMCE.xmlEncode(st) + " ";
|
| | | }
|
| | | }
|
| | |
|
| | | if (nodeName == "font") {
|
| | | if (tinyMCE.getParam("convert_fonts_to_spans"))
|
| | | nodeName = "span";
|
| | |
|
| | | var face = tinyMCE.getAttrib(path[i], "face");
|
| | | if (face != "")
|
| | | nodeData += "font: " + tinyMCE.xmlEncode(face) + " ";
|
| | |
|
| | | var size = tinyMCE.getAttrib(path[i], "size");
|
| | | if (size != "")
|
| | | nodeData += "size: " + tinyMCE.xmlEncode(size) + " ";
|
| | |
|
| | | var color = tinyMCE.getAttrib(path[i], "color");
|
| | | if (color != "")
|
| | | nodeData += "color: " + tinyMCE.xmlEncode(color) + " ";
|
| | | }
|
| | |
|
| | | if (tinyMCE.getAttrib(path[i], 'id') != "") {
|
| | | nodeData += "id: " + path[i].getAttribute('id') + " ";
|
| | | }
|
| | |
|
| | | var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i], "class"), false);
|
| | | if (className != "" && className.indexOf('mceItem') == -1)
|
| | | nodeData += "class: " + className + " ";
|
| | |
|
| | | if (tinyMCE.getAttrib(path[i], 'src') != "") {
|
| | | var src = tinyMCE.getAttrib(path[i], "mce_src");
|
| | |
|
| | | if (src == "")
|
| | | src = tinyMCE.getAttrib(path[i], "src");
|
| | |
|
| | | nodeData += "src: " + tinyMCE.xmlEncode(src) + " ";
|
| | | }
|
| | |
|
| | | if (path[i].nodeName == 'A' && tinyMCE.getAttrib(path[i], 'href') != "") {
|
| | | var href = tinyMCE.getAttrib(path[i], "mce_href");
|
| | |
|
| | | if (href == "")
|
| | | href = tinyMCE.getAttrib(path[i], "href");
|
| | |
|
| | | nodeData += "href: " + tinyMCE.xmlEncode(href) + " ";
|
| | | }
|
| | |
|
| | | className = tinyMCE.getAttrib(path[i], "class");
|
| | | if ((nodeName == "img" || nodeName == "span") && className.indexOf('mceItem') != -1) {
|
| | | nodeName = className.replace(/mceItem([a-z]+)/gi, '$1').toLowerCase();
|
| | | nodeData = path[i].getAttribute('title');
|
| | | }
|
| | |
|
| | | if (nodeName == "a" && (anchor = tinyMCE.getAttrib(path[i], "name")) != "") {
|
| | | nodeName = "a";
|
| | | nodeName += "#" + tinyMCE.xmlEncode(anchor);
|
| | | nodeData = "";
|
| | | }
|
| | |
|
| | | if (tinyMCE.getAttrib(path[i], 'name').indexOf("mce_") != 0) {
|
| | | var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i], "class"), false);
|
| | | if (className != "" && className.indexOf('mceItem') == -1) {
|
| | | nodeName += "." + className;
|
| | | }
|
| | | }
|
| | |
|
| | | var cmd = 'tinyMCE.execInstanceCommand(\'' + editor_id + '\',\'mceSelectNodeDepth\',false,\'' + i + '\');';
|
| | | html += '<a title="' + nodeData + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" target="_self" class="mcePathItem">' + nodeName + '</a>';
|
| | |
|
| | | if (i > 0) {
|
| | | html += " » ";
|
| | | }
|
| | | }
|
| | |
|
| | | pathElm.innerHTML = '<a href="#" accesskey="x"></a>' + tinyMCE.getLang('lang_theme_path') + ": " + html + ' ';
|
| | | }
|
| | |
|
| | | // Reset old states
|
| | | tinyMCE.switchClass(editor_id + '_justifyleft', 'mceButtonNormal');
|
| | | tinyMCE.switchClass(editor_id + '_justifyright', 'mceButtonNormal');
|
| | | tinyMCE.switchClass(editor_id + '_justifycenter', 'mceButtonNormal');
|
| | | tinyMCE.switchClass(editor_id + '_justifyfull', 'mceButtonNormal');
|
| | | tinyMCE.switchClass(editor_id + '_bold', 'mceButtonNormal');
|
| | | tinyMCE.switchClass(editor_id + '_italic', 'mceButtonNormal');
|
| | | tinyMCE.switchClass(editor_id + '_underline', 'mceButtonNormal');
|
| | | tinyMCE.switchClass(editor_id + '_strikethrough', 'mceButtonNormal');
|
| | | tinyMCE.switchClass(editor_id + '_bullist', 'mceButtonNormal');
|
| | | tinyMCE.switchClass(editor_id + '_numlist', 'mceButtonNormal');
|
| | | tinyMCE.switchClass(editor_id + '_sub', 'mceButtonNormal');
|
| | | tinyMCE.switchClass(editor_id + '_sup', 'mceButtonNormal');
|
| | | tinyMCE.switchClass(editor_id + '_anchor', 'mceButtonNormal');
|
| | | tinyMCE.switchClass(editor_id + '_link', 'mceButtonDisabled');
|
| | | tinyMCE.switchClass(editor_id + '_unlink', 'mceButtonDisabled');
|
| | | tinyMCE.switchClass(editor_id + '_outdent', 'mceButtonDisabled');
|
| | | tinyMCE.switchClass(editor_id + '_image', 'mceButtonNormal');
|
| | | tinyMCE.switchClass(editor_id + '_hr', 'mceButtonNormal');
|
| | |
|
| | | if (node.nodeName == "A" && tinyMCE.getAttrib(node, "class").indexOf('mceItemAnchor') != -1)
|
| | | tinyMCE.switchClass(editor_id + '_anchor', 'mceButtonSelected');
|
| | |
|
| | | // Get link
|
| | | var anchorLink = tinyMCE.getParentElement(node, "a", "href");
|
| | |
|
| | | if (anchorLink || any_selection) {
|
| | | tinyMCE.switchClass(editor_id + '_link', anchorLink ? 'mceButtonSelected' : 'mceButtonNormal');
|
| | | tinyMCE.switchClass(editor_id + '_unlink', anchorLink ? 'mceButtonSelected' : 'mceButtonNormal');
|
| | | }
|
| | |
|
| | | // Handle visual aid
|
| | | tinyMCE.switchClass(editor_id + '_visualaid', visual_aid ? 'mceButtonSelected' : 'mceButtonNormal');
|
| | |
|
| | | if (undo_levels != -1) {
|
| | | tinyMCE.switchClass(editor_id + '_undo', 'mceButtonDisabled');
|
| | | tinyMCE.switchClass(editor_id + '_redo', 'mceButtonDisabled');
|
| | | }
|
| | |
|
| | | // Within li, blockquote
|
| | | if (tinyMCE.getParentElement(node, "li,blockquote"))
|
| | | tinyMCE.switchClass(editor_id + '_outdent', 'mceButtonNormal');
|
| | |
|
| | | // Has redo levels
|
| | | if (undo_index != -1 && (undo_index < undo_levels-1 && undo_levels > 0))
|
| | | tinyMCE.switchClass(editor_id + '_redo', 'mceButtonNormal');
|
| | |
|
| | | // Has undo levels
|
| | | if (undo_index != -1 && (undo_index > 0 && undo_levels > 0))
|
| | | tinyMCE.switchClass(editor_id + '_undo', 'mceButtonNormal');
|
| | |
|
| | | // Select class in select box
|
| | | var selectElm = document.getElementById(editor_id + "_styleSelect");
|
| | | |
| | | if (selectElm) {
|
| | | TinyMCE_AdvancedTheme._setupCSSClasses(editor_id);
|
| | |
|
| | | classNode = node;
|
| | | breakOut = false;
|
| | | var index = 0;
|
| | |
|
| | | do {
|
| | | if (classNode && classNode.className) {
|
| | | for (var i=0; i<selectElm.options.length; i++) {
|
| | | if (selectElm.options[i].value == classNode.className) {
|
| | | index = i;
|
| | | breakOut = true;
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | } while (!breakOut && classNode != null && (classNode = classNode.parentNode) != null);
|
| | |
|
| | | selectElm.selectedIndex = index;
|
| | | }
|
| | |
|
| | | // Select formatblock
|
| | | var selectElm = document.getElementById(editor_id + "_formatSelect");
|
| | | if (selectElm) {
|
| | | var elm = tinyMCE.getParentElement(node, "p,div,h1,h2,h3,h4,h5,h6,pre,address");
|
| | |
|
| | | if (elm)
|
| | | selectByValue(selectElm, "<" + elm.nodeName.toLowerCase() + ">");
|
| | | else
|
| | | selectByValue(selectElm, "");
|
| | | }
|
| | |
|
| | | // Select fontselect
|
| | | var selectElm = document.getElementById(editor_id + "_fontNameSelect");
|
| | | if (selectElm) {
|
| | | if (!tinyMCE.isSafari && !(tinyMCE.isMSIE && !tinyMCE.isOpera)) {
|
| | | var face = inst.queryCommandValue('FontName');
|
| | |
|
| | | face = face == null || face == "" ? "" : face;
|
| | |
|
| | | selectByValue(selectElm, face, face != "");
|
| | | } else {
|
| | | var elm = tinyMCE.getParentElement(node, "font", "face");
|
| | |
|
| | | if (elm) {
|
| | | var family = tinyMCE.getAttrib(elm, "face");
|
| | |
|
| | | if (family == '')
|
| | | family = '' + elm.style.fontFamily;
|
| | |
|
| | | if (!selectByValue(selectElm, family, family != ""))
|
| | | selectByValue(selectElm, "");
|
| | | } else
|
| | | selectByValue(selectElm, "");
|
| | | }
|
| | | }
|
| | |
|
| | | // Select fontsize
|
| | | var selectElm = document.getElementById(editor_id + "_fontSizeSelect");
|
| | | if (selectElm) {
|
| | | if (!tinyMCE.isSafari && !tinyMCE.isOpera) {
|
| | | var size = inst.queryCommandValue('FontSize');
|
| | | selectByValue(selectElm, size == null || size == "" ? "0" : size);
|
| | | } else {
|
| | | var elm = tinyMCE.getParentElement(node, "font", "size");
|
| | | if (elm) {
|
| | | var size = tinyMCE.getAttrib(elm, "size");
|
| | |
|
| | | if (size == '') {
|
| | | var sizes = new Array('', '8px', '10px', '12px', '14px', '18px', '24px', '36px');
|
| | |
|
| | | size = '' + elm.style.fontSize;
|
| | |
|
| | | for (var i=0; i<sizes.length; i++) {
|
| | | if (('' + sizes[i]) == size) {
|
| | | size = i;
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if (!selectByValue(selectElm, size))
|
| | | selectByValue(selectElm, "");
|
| | | } else
|
| | | selectByValue(selectElm, "0");
|
| | | }
|
| | | }
|
| | |
|
| | | // Handle align attributes
|
| | | alignNode = node;
|
| | | breakOut = false;
|
| | | do {
|
| | | if (!alignNode.getAttribute || !alignNode.getAttribute('align'))
|
| | | continue;
|
| | |
|
| | | switch (alignNode.getAttribute('align').toLowerCase()) {
|
| | | case "left":
|
| | | tinyMCE.switchClass(editor_id + '_justifyleft', 'mceButtonSelected');
|
| | | breakOut = true;
|
| | | break;
|
| | |
|
| | | case "right":
|
| | | tinyMCE.switchClass(editor_id + '_justifyright', 'mceButtonSelected');
|
| | | breakOut = true;
|
| | | break;
|
| | |
|
| | | case "middle":
|
| | | case "center":
|
| | | tinyMCE.switchClass(editor_id + '_justifycenter', 'mceButtonSelected');
|
| | | breakOut = true;
|
| | | break;
|
| | |
|
| | | case "justify":
|
| | | tinyMCE.switchClass(editor_id + '_justifyfull', 'mceButtonSelected');
|
| | | breakOut = true;
|
| | | break;
|
| | | }
|
| | | } while (!breakOut && (alignNode = alignNode.parentNode) != null);
|
| | |
|
| | | // Div justification
|
| | | var div = tinyMCE.getParentElement(node, "div");
|
| | | if (div && div.style.textAlign == "center")
|
| | | tinyMCE.switchClass(editor_id + '_justifycenter', 'mceButtonSelected');
|
| | |
|
| | | // Do special text
|
| | | if (!setup_content) {
|
| | | // , "JustifyLeft", "_justifyleft", "JustifyCenter", "justifycenter", "JustifyRight", "justifyright", "JustifyFull", "justifyfull", "InsertUnorderedList", "bullist", "InsertOrderedList", "numlist", "InsertUnorderedList", "bullist", "Outdent", "outdent", "Indent", "indent", "subscript", "sub"
|
| | | var ar = new Array("Bold", "_bold", "Italic", "_italic", "Strikethrough", "_strikethrough", "superscript", "_sup", "subscript", "_sub");
|
| | | for (var i=0; i<ar.length; i+=2) {
|
| | | if (inst.queryCommandState(ar[i]))
|
| | | tinyMCE.switchClass(editor_id + ar[i+1], 'mceButtonSelected');
|
| | | }
|
| | |
|
| | | if (inst.queryCommandState("Underline") && (node.parentNode == null || node.parentNode.nodeName != "A"))
|
| | | tinyMCE.switchClass(editor_id + '_underline', 'mceButtonSelected');
|
| | | }
|
| | |
|
| | | // Handle elements
|
| | | do {
|
| | | switch (node.nodeName) {
|
| | | case "UL":
|
| | | tinyMCE.switchClass(editor_id + '_bullist', 'mceButtonSelected');
|
| | | break;
|
| | |
|
| | | case "OL":
|
| | | tinyMCE.switchClass(editor_id + '_numlist', 'mceButtonSelected');
|
| | | break;
|
| | |
|
| | | case "HR":
|
| | | tinyMCE.switchClass(editor_id + '_hr', 'mceButtonSelected');
|
| | | break;
|
| | |
|
| | | case "IMG":
|
| | | if (tinyMCE.getAttrib(node, 'name').indexOf('mce_') != 0 && tinyMCE.getAttrib(node, 'class').indexOf('mceItem') == -1) {
|
| | | tinyMCE.switchClass(editor_id + '_image', 'mceButtonSelected');
|
| | | }
|
| | | break;
|
| | | }
|
| | | } while ((node = node.parentNode) != null);
|
| | | },
|
| | |
|
| | | // Private theme internal functions
|
| | |
|
| | | // This function auto imports CSS classes into the class selection droplist
|
| | | _setupCSSClasses : function(editor_id) {
|
| | | var i, selectElm;
|
| | |
|
| | | if (!TinyMCE_AdvancedTheme._autoImportCSSClasses)
|
| | | return;
|
| | |
|
| | | selectElm = document.getElementById(editor_id + '_styleSelect');
|
| | |
|
| | | if (selectElm && selectElm.getAttribute('cssImported') != 'true') {
|
| | | var csses = tinyMCE.getCSSClasses(editor_id);
|
| | | if (csses && selectElm) {
|
| | | for (i=0; i<csses.length; i++)
|
| | | selectElm.options[selectElm.options.length] = new Option(csses[i], csses[i]);
|
| | | }
|
| | |
|
| | | // Only do this once
|
| | | if (csses != null && csses.length > 0)
|
| | | selectElm.setAttribute('cssImported', 'true');
|
| | | }
|
| | | },
|
| | |
|
| | | _setCookie : function(name, value, expires, path, domain, secure) {
|
| | | var curCookie = name + "=" + escape(value) +
|
| | | ((expires) ? "; expires=" + expires.toGMTString() : "") +
|
| | | ((path) ? "; path=" + escape(path) : "") +
|
| | | ((domain) ? "; domain=" + domain : "") +
|
| | | ((secure) ? "; secure" : "");
|
| | |
|
| | | document.cookie = curCookie;
|
| | | },
|
| | |
|
| | | _getCookie : function(name) {
|
| | | var dc = document.cookie;
|
| | | var prefix = name + "=";
|
| | | var begin = dc.indexOf("; " + prefix);
|
| | |
|
| | | if (begin == -1) {
|
| | | begin = dc.indexOf(prefix);
|
| | |
|
| | | if (begin != 0)
|
| | | return null;
|
| | | } else
|
| | | begin += 2;
|
| | |
|
| | | var end = document.cookie.indexOf(";", begin);
|
| | |
|
| | | if (end == -1)
|
| | | end = dc.length;
|
| | |
|
| | | return unescape(dc.substring(begin + prefix.length, end));
|
| | | },
|
| | |
|
| | | _resizeTo : function(inst, w, h, set_w) {
|
| | | var editorContainer = document.getElementById(inst.editorId + '_parent');
|
| | | var tableElm = editorContainer.firstChild;
|
| | | var iframe = inst.iframeElement;
|
| | |
|
| | | if (w == null || w == "null") {
|
| | | set_w = false;
|
| | | w = 0;
|
| | | }
|
| | |
|
| | | if (h == null || h == "null")
|
| | | return;
|
| | |
|
| | | w = parseInt(w);
|
| | | h = parseInt(h);
|
| | |
|
| | | if (tinyMCE.isGecko) {
|
| | | w += 2;
|
| | | h += 2;
|
| | | }
|
| | |
|
| | | var dx = w - tableElm.clientWidth;
|
| | | var dy = h - tableElm.clientHeight;
|
| | |
|
| | | w = w < 1 ? 30 : w;
|
| | | h = h < 1 ? 30 : h;
|
| | |
|
| | | if (set_w)
|
| | | tableElm.style.width = w + "px";
|
| | |
|
| | | tableElm.style.height = h + "px";
|
| | |
|
| | | iw = iframe.clientWidth + dx;
|
| | | ih = iframe.clientHeight + dy;
|
| | |
|
| | | iw = iw < 1 ? 30 : iw;
|
| | | ih = ih < 1 ? 30 : ih;
|
| | |
|
| | | if (tinyMCE.isGecko) {
|
| | | iw -= 2;
|
| | | ih -= 2;
|
| | | }
|
| | |
|
| | | if (set_w)
|
| | | iframe.style.width = iw + "px";
|
| | |
|
| | | iframe.style.height = ih + "px";
|
| | |
|
| | | // Is it to small, make it bigger again
|
| | | if (set_w) {
|
| | | var tableBodyElm = tableElm.firstChild;
|
| | | var minIframeWidth = tableBodyElm.scrollWidth;
|
| | | if (inst.iframeElement.clientWidth < minIframeWidth) {
|
| | | dx = minIframeWidth - inst.iframeElement.clientWidth;
|
| | |
|
| | | inst.iframeElement.style.width = (iw + dx) + "px";
|
| | | }
|
| | | }
|
| | |
|
| | | // Remove pesky table controls
|
| | | inst.useCSS = false;
|
| | | },
|
| | |
|
| | | /**
|
| | | * Handles resizing events.
|
| | | */
|
| | | _resizeEventHandler : function(e) {
|
| | | var resizer = TinyMCE_AdvancedTheme._resizer;
|
| | |
|
| | | // Do nothing
|
| | | if (!resizer.resizing)
|
| | | return;
|
| | |
|
| | | e = typeof(e) == "undefined" ? window.event : e;
|
| | |
|
| | | var dx = e.screenX - resizer.downX;
|
| | | var dy = e.screenY - resizer.downY;
|
| | | var resizeBox = resizer.resizeBox;
|
| | | var editorId = resizer.editorId;
|
| | |
|
| | | switch (e.type) {
|
| | | case "mousemove":
|
| | | var w, h;
|
| | |
|
| | | w = resizer.width + dx;
|
| | | h = resizer.height + dy;
|
| | |
|
| | | w = w < 1 ? 1 : w;
|
| | | h = h < 1 ? 1 : h;
|
| | |
|
| | | if (resizer.horizontal)
|
| | | resizeBox.style.width = w + "px";
|
| | |
|
| | | resizeBox.style.height = h + "px";
|
| | | break;
|
| | |
|
| | | case "mouseup":
|
| | | TinyMCE_AdvancedTheme._setResizing(e, editorId, false);
|
| | | TinyMCE_AdvancedTheme._resizeTo(tinyMCE.getInstanceById(editorId), resizer.width + dx, resizer.height + dy, resizer.horizontal);
|
| | |
|
| | | // Expire in a month
|
| | | if (tinyMCE.getParam("theme_advanced_resizing_use_cookie", true)) {
|
| | | var expires = new Date();
|
| | | expires.setTime(expires.getTime() + 3600000 * 24 * 30);
|
| | |
|
| | | // Set the cookies
|
| | | TinyMCE_AdvancedTheme._setCookie("TinyMCE_" + editorId + "_width", "" + (resizer.horizontal ? resizer.width + dx : ""), expires);
|
| | | TinyMCE_AdvancedTheme._setCookie("TinyMCE_" + editorId + "_height", "" + (resizer.height + dy), expires);
|
| | | }
|
| | | break;
|
| | | }
|
| | | },
|
| | |
|
| | | /**
|
| | | * Starts/stops the editor resizing.
|
| | | */
|
| | | _setResizing : function(e, editor_id, state) {
|
| | | e = typeof(e) == "undefined" ? window.event : e;
|
| | |
|
| | | var resizer = TinyMCE_AdvancedTheme._resizer;
|
| | | var editorContainer = document.getElementById(editor_id + '_parent');
|
| | | var editorArea = document.getElementById(editor_id + '_parent').firstChild;
|
| | | var resizeBox = document.getElementById(editor_id + '_resize_box');
|
| | | var inst = tinyMCE.getInstanceById(editor_id);
|
| | |
|
| | | if (state) {
|
| | | // Place box over editor area
|
| | | var width = editorArea.clientWidth;
|
| | | var height = editorArea.clientHeight;
|
| | |
|
| | | resizeBox.style.width = width + "px";
|
| | | resizeBox.style.height = height + "px";
|
| | |
|
| | | resizer.iframeWidth = inst.iframeElement.clientWidth;
|
| | | resizer.iframeHeight = inst.iframeElement.clientHeight;
|
| | |
|
| | | // Hide editor and show resize box
|
| | | editorArea.style.display = "none";
|
| | | resizeBox.style.display = "block";
|
| | |
|
| | | // Add event handlers, only once
|
| | | if (!resizer.eventHandlers) {
|
| | | if (tinyMCE.isMSIE)
|
| | | tinyMCE.addEvent(document, "mousemove", TinyMCE_AdvancedTheme._resizeEventHandler);
|
| | | else
|
| | | tinyMCE.addEvent(window, "mousemove", TinyMCE_AdvancedTheme._resizeEventHandler);
|
| | |
|
| | | tinyMCE.addEvent(document, "mouseup", TinyMCE_AdvancedTheme._resizeEventHandler);
|
| | |
|
| | | resizer.eventHandlers = true;
|
| | | }
|
| | |
|
| | | resizer.resizing = true;
|
| | | resizer.downX = e.screenX;
|
| | | resizer.downY = e.screenY;
|
| | | resizer.width = parseInt(resizeBox.style.width);
|
| | | resizer.height = parseInt(resizeBox.style.height);
|
| | | resizer.editorId = editor_id;
|
| | | resizer.resizeBox = resizeBox;
|
| | | resizer.horizontal = tinyMCE.getParam("theme_advanced_resize_horizontal", true);
|
| | | } else {
|
| | | resizer.resizing = false;
|
| | | resizeBox.style.display = "none";
|
| | | editorArea.style.display = tinyMCE.isMSIE && !tinyMCE.isOpera ? "block" : "table";
|
| | | tinyMCE.execCommand('mceResetDesignMode');
|
| | | }
|
| | | },
|
| | |
|
| | | _getColorHTML : function(id, n, cm) {
|
| | | var i, h, cl;
|
| | |
|
| | | h = '<span class="mceMenuLine"></span>';
|
| | | cl = tinyMCE.getParam(n, TinyMCE_AdvancedTheme._defColors).split(',');
|
| | |
|
| | | h += '<table class="mceColors"><tr>';
|
| | | for (i=0; i<cl.length; i++) {
|
| | | c = 'tinyMCE.execInstanceCommand(\'' + id + '\', \'' + cm + '\', false, \'#' + cl[i] + '\');';
|
| | | h += '<td><a href="javascript:' + c + '" style="background-color: #' + cl[i] + '" onclick="' + c + ';return false;"></a></td>';
|
| | |
|
| | | if ((i+1) % 8 == 0)
|
| | | h += '</tr><tr>';
|
| | | }
|
| | |
|
| | | h += '</tr></table>';
|
| | |
|
| | | if (tinyMCE.getParam("theme_advanced_more_colors", true))
|
| | | h += '<a href="javascript:void(0);" onclick="TinyMCE_AdvancedTheme._pickColor(\'' + id + '\',\'' + cm + '\');" class="mceMoreColors">' + tinyMCE.getLang('lang_more_colors') + '</a>';
|
| | |
|
| | | return h;
|
| | | },
|
| | |
|
| | | _pickColor : function(id, cm) {
|
| | | var inputColor, inst = tinyMCE.selectedInstance;
|
| | |
|
| | | if (cm == 'forecolor' && inst)
|
| | | inputColor = inst.foreColor;
|
| | |
|
| | | if ((cm == 'backcolor' || cm == 'HiliteColor') && inst)
|
| | | inputColor = inst.backColor;
|
| | |
|
| | | tinyMCE.execCommand('mceColorPicker', true, {color : inputColor, callback : function(c) {
|
| | | tinyMCE.execInstanceCommand(id, cm, false, c);
|
| | | }});
|
| | | },
|
| | |
|
| | | _insertImage : function(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout) {
|
| | | tinyMCE.execCommand("mceInsertContent", false, tinyMCE.createTagHTML('img', {
|
| | | src : tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], src), // Force absolute
|
| | | mce_src : src,
|
| | | alt : alt,
|
| | | border : border,
|
| | | hspace : hspace,
|
| | | vspace : vspace,
|
| | | width : width,
|
| | | height : height,
|
| | | align : align,
|
| | | title : title,
|
| | | onmouseover : onmouseover,
|
| | | onmouseout : onmouseout
|
| | | }));
|
| | | },
|
| | |
|
| | | _insertLink : function(href, target, title, onclick, style_class) {
|
| | | tinyMCE.execCommand('mceBeginUndoLevel');
|
| | |
|
| | | if (tinyMCE.selectedInstance && tinyMCE.selectedElement && tinyMCE.selectedElement.nodeName.toLowerCase() == "img") {
|
| | | var doc = tinyMCE.selectedInstance.getDoc();
|
| | | var linkElement = tinyMCE.getParentElement(tinyMCE.selectedElement, "a");
|
| | | var newLink = false;
|
| | |
|
| | | if (!linkElement) {
|
| | | linkElement = doc.createElement("a");
|
| | | newLink = true;
|
| | | }
|
| | |
|
| | | var mhref = href;
|
| | | var thref = eval(tinyMCE.settings['urlconverter_callback'] + "(href, linkElement);");
|
| | | mhref = tinyMCE.getParam('convert_urls') ? href : mhref;
|
| | |
|
| | | tinyMCE.setAttrib(linkElement, 'href', thref);
|
| | | tinyMCE.setAttrib(linkElement, 'mce_href', mhref);
|
| | | tinyMCE.setAttrib(linkElement, 'target', target);
|
| | | tinyMCE.setAttrib(linkElement, 'title', title);
|
| | | tinyMCE.setAttrib(linkElement, 'onclick', onclick);
|
| | | tinyMCE.setAttrib(linkElement, 'class', style_class);
|
| | |
|
| | | if (newLink) {
|
| | | linkElement.appendChild(tinyMCE.selectedElement.cloneNode(true));
|
| | | tinyMCE.selectedElement.parentNode.replaceChild(linkElement, tinyMCE.selectedElement);
|
| | | }
|
| | |
|
| | | return;
|
| | | }
|
| | |
|
| | | if (!tinyMCE.linkElement && tinyMCE.selectedInstance) {
|
| | | if (tinyMCE.isSafari) {
|
| | | tinyMCE.execCommand("mceInsertContent", false, '<a href="' + tinyMCE.uniqueURL + '">' + tinyMCE.selectedInstance.selection.getSelectedHTML() + '</a>');
|
| | | } else
|
| | | tinyMCE.selectedInstance.contentDocument.execCommand("createlink", false, tinyMCE.uniqueURL);
|
| | |
|
| | | tinyMCE.linkElement = tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body, "a", "href", tinyMCE.uniqueURL);
|
| | |
|
| | | var elementArray = tinyMCE.getElementsByAttributeValue(tinyMCE.selectedInstance.contentDocument.body, "a", "href", tinyMCE.uniqueURL);
|
| | |
|
| | | for (var i=0; i<elementArray.length; i++) {
|
| | | var mhref = href;
|
| | | var thref = eval(tinyMCE.settings['urlconverter_callback'] + "(href, elementArray[i]);");
|
| | | mhref = tinyMCE.getParam('convert_urls') ? href : mhref;
|
| | |
|
| | | tinyMCE.setAttrib(elementArray[i], 'href', thref);
|
| | | tinyMCE.setAttrib(elementArray[i], 'mce_href', mhref);
|
| | | tinyMCE.setAttrib(elementArray[i], 'target', target);
|
| | | tinyMCE.setAttrib(elementArray[i], 'title', title);
|
| | | tinyMCE.setAttrib(elementArray[i], 'onclick', onclick);
|
| | | tinyMCE.setAttrib(elementArray[i], 'class', style_class);
|
| | | }
|
| | |
|
| | | tinyMCE.linkElement = elementArray[0];
|
| | | }
|
| | |
|
| | | if (tinyMCE.linkElement) {
|
| | | var mhref = href;
|
| | | href = eval(tinyMCE.settings['urlconverter_callback'] + "(href, tinyMCE.linkElement);");
|
| | | mhref = tinyMCE.getParam('convert_urls') ? href : mhref;
|
| | |
|
| | | tinyMCE.setAttrib(tinyMCE.linkElement, 'href', href);
|
| | | tinyMCE.setAttrib(tinyMCE.linkElement, 'mce_href', mhref);
|
| | | tinyMCE.setAttrib(tinyMCE.linkElement, 'target', target);
|
| | | tinyMCE.setAttrib(tinyMCE.linkElement, 'title', title);
|
| | | tinyMCE.setAttrib(tinyMCE.linkElement, 'onclick', onclick);
|
| | | tinyMCE.setAttrib(tinyMCE.linkElement, 'class', style_class);
|
| | | }
|
| | |
|
| | | tinyMCE.execCommand('mceEndUndoLevel');
|
| | | }
|
| | | };
|
| | |
|
| | | tinyMCE.addTheme("advanced", TinyMCE_AdvancedTheme);
|
| | |
|
| | | // Add default buttons maps for advanced theme and all internal plugins
|
| | | tinyMCE.addButtonMap(TinyMCE_AdvancedTheme._buttonMap);
|
| | | /** |
| | | * $Id: editor_template_src.js 296 2007-08-21 10:36:35Z spocke $ |
| | | * |
| | | * @author Moxiecode |
| | | * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. |
| | | */ |
| | | |
| | | /* Import theme specific language pack */ |
| | | tinyMCE.importThemeLanguagePack('advanced'); |
| | | |
| | | var TinyMCE_AdvancedTheme = { |
| | | // Private theme fields |
| | | _defColors : "000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF", |
| | | _autoImportCSSClasses : true, |
| | | _resizer : {}, |
| | | _buttons : [ |
| | | // Control id, button img, button title, command, user_interface, value |
| | | ['bold', '{$lang_bold_img}', 'lang_bold_desc', 'Bold'], |
| | | ['italic', '{$lang_italic_img}', 'lang_italic_desc', 'Italic'], |
| | | ['underline', '{$lang_underline_img}', 'lang_underline_desc', 'Underline'], |
| | | ['strikethrough', 'strikethrough.gif', 'lang_striketrough_desc', 'Strikethrough'], |
| | | ['justifyleft', 'justifyleft.gif', 'lang_justifyleft_desc', 'JustifyLeft'], |
| | | ['justifycenter', 'justifycenter.gif', 'lang_justifycenter_desc', 'JustifyCenter'], |
| | | ['justifyright', 'justifyright.gif', 'lang_justifyright_desc', 'JustifyRight'], |
| | | ['justifyfull', 'justifyfull.gif', 'lang_justifyfull_desc', 'JustifyFull'], |
| | | ['bullist', 'bullist.gif', 'lang_bullist_desc', 'InsertUnorderedList'], |
| | | ['numlist', 'numlist.gif', 'lang_numlist_desc', 'InsertOrderedList'], |
| | | ['outdent', 'outdent.gif', 'lang_outdent_desc', 'Outdent'], |
| | | ['indent', 'indent.gif', 'lang_indent_desc', 'Indent'], |
| | | ['cut', 'cut.gif', 'lang_cut_desc', 'Cut'], |
| | | ['copy', 'copy.gif', 'lang_copy_desc', 'Copy'], |
| | | ['paste', 'paste.gif', 'lang_paste_desc', 'Paste'], |
| | | ['undo', 'undo.gif', 'lang_undo_desc', 'Undo'], |
| | | ['redo', 'redo.gif', 'lang_redo_desc', 'Redo'], |
| | | ['link', 'link.gif', 'lang_link_desc', 'mceLink', true], |
| | | ['unlink', 'unlink.gif', 'lang_unlink_desc', 'unlink'], |
| | | ['image', 'image.gif', 'lang_image_desc', 'mceImage', true], |
| | | ['cleanup', 'cleanup.gif', 'lang_cleanup_desc', 'mceCleanup'], |
| | | ['help', 'help.gif', 'lang_help_desc', 'mceHelp'], |
| | | ['code', 'code.gif', 'lang_theme_code_desc', 'mceCodeEditor'], |
| | | ['hr', 'hr.gif', 'lang_theme_hr_desc', 'inserthorizontalrule'], |
| | | ['removeformat', 'removeformat.gif', 'lang_theme_removeformat_desc', 'removeformat'], |
| | | ['sub', 'sub.gif', 'lang_theme_sub_desc', 'subscript'], |
| | | ['sup', 'sup.gif', 'lang_theme_sup_desc', 'superscript'], |
| | | ['forecolor', 'forecolor.gif', 'lang_theme_forecolor_desc', 'forecolor', true], |
| | | ['forecolorpicker', 'forecolor.gif', 'lang_theme_forecolor_desc', 'forecolorpicker', true], |
| | | ['backcolor', 'backcolor.gif', 'lang_theme_backcolor_desc', 'HiliteColor', true], |
| | | ['backcolorpicker', 'backcolor.gif', 'lang_theme_backcolor_desc', 'backcolorpicker', true], |
| | | ['charmap', 'charmap.gif', 'lang_theme_charmap_desc', 'mceCharMap'], |
| | | ['visualaid', 'visualaid.gif', 'lang_theme_visualaid_desc', 'mceToggleVisualAid'], |
| | | ['anchor', 'anchor.gif', 'lang_theme_anchor_desc', 'mceInsertAnchor'], |
| | | ['newdocument', 'newdocument.gif', 'lang_newdocument_desc', 'mceNewDocument'] |
| | | ], |
| | | |
| | | _buttonMap : 'anchor,backcolor,bold,bullist,charmap,cleanup,code,copy,cut,forecolor,help,hr,image,indent,italic,justifycenter,justifyfull,justifyleft,justifyright,link,newdocument,numlist,outdent,paste,redo,removeformat,strikethrough,sub,sup,underline,undo,unlink,visualaid,advhr,ltr,rtl,emotions,flash,fullpage,fullscreen,iespell,insertdate,inserttime,pastetext,pasteword,selectall,preview,print,save,replace,search,table,cell_props,delete_col,delete_row,col_after,col_before,row_after,row_before,merge_cells,row_props,split_cells,delete_table', |
| | | |
| | | /** |
| | | * Returns HTML code for the specificed control. |
| | | */ |
| | | getControlHTML : function(button_name) { |
| | | var i, x, but; |
| | | |
| | | // Lookup button in button list |
| | | for (i=0; i<TinyMCE_AdvancedTheme._buttons.length; i++) { |
| | | but = TinyMCE_AdvancedTheme._buttons[i]; |
| | | |
| | | if (but[0] == button_name && (button_name == "forecolor" || button_name == "backcolor")) |
| | | return tinyMCE.getMenuButtonHTML(but[0], but[2], '{$themeurl}/images/' + but[1], but[3] + "Menu", but[3], (but.length > 4 ? but[4] : false), (but.length > 5 ? but[5] : null)); |
| | | |
| | | if (but[0] == button_name) |
| | | return tinyMCE.getButtonHTML(but[0], but[2], '{$themeurl}/images/' + but[1], but[3], (but.length > 4 ? but[4] : false), (but.length > 5 ? but[5] : null)); |
| | | } |
| | | |
| | | // Custom controlls other than buttons |
| | | switch (button_name) { |
| | | case "formatselect": |
| | | var html = '<select id="{$editor_id}_formatSelect" name="{$editor_id}_formatSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FormatBlock\',false,this.options[this.selectedIndex].value);" class="mceSelectList">'; |
| | | var formats = tinyMCE.getParam("theme_advanced_blockformats", "p,address,pre,h1,h2,h3,h4,h5,h6", true).split(','); |
| | | var lookup = [ |
| | | ['p', '{$lang_theme_paragraph}'], |
| | | ['address', '{$lang_theme_address}'], |
| | | ['pre', '{$lang_theme_pre}'], |
| | | ['h1', '{$lang_theme_h1}'], |
| | | ['h2', '{$lang_theme_h2}'], |
| | | ['h3', '{$lang_theme_h3}'], |
| | | ['h4', '{$lang_theme_h4}'], |
| | | ['h5', '{$lang_theme_h5}'], |
| | | ['h6', '{$lang_theme_h6}'], |
| | | ['div', '{$lang_theme_div}'], |
| | | ['blockquote', '{$lang_theme_blockquote}'], |
| | | ['code', '{$lang_theme_code}'], |
| | | ['dt', '{$lang_theme_dt}'], |
| | | ['dd', '{$lang_theme_dd}'], |
| | | ['samp', '{$lang_theme_samp}'] |
| | | ]; |
| | | |
| | | html += '<option value="">{$lang_theme_block}</option>'; |
| | | |
| | | // Build format select |
| | | for (var i=0; i<formats.length; i++) { |
| | | for (var x=0; x<lookup.length; x++) { |
| | | if (formats[i] == lookup[x][0]) |
| | | html += '<option value="<' + lookup[x][0] + '>">' + lookup[x][1] + '</option>'; |
| | | } |
| | | } |
| | | |
| | | html += '</select>'; |
| | | |
| | | return html; |
| | | |
| | | case "styleselect": |
| | | return '<select id="{$editor_id}_styleSelect" onmousedown="tinyMCE.themes.advanced._setupCSSClasses(\'{$editor_id}\');" name="{$editor_id}_styleSelect" onfocus="tinyMCE.addSelectAccessibility(event,this,window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSetCSSClass\',false,this.options[this.selectedIndex].value);" class="mceSelectList">{$style_select_options}</select>'; |
| | | |
| | | case "fontselect": |
| | | var fontHTML = '<select id="{$editor_id}_fontNameSelect" name="{$editor_id}_fontNameSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontName\',false,this.options[this.selectedIndex].value);" class="mceSelectList"><option value="">{$lang_theme_fontdefault}</option>'; |
| | | var iFonts = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings'; |
| | | var nFonts = 'Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats'; |
| | | var fonts = tinyMCE.getParam("theme_advanced_fonts", nFonts).split(';'); |
| | | for (i=0; i<fonts.length; i++) { |
| | | if (fonts[i] != '') { |
| | | var parts = fonts[i].split('='); |
| | | fontHTML += '<option value="' + parts[1] + '">' + parts[0] + '</option>'; |
| | | } |
| | | } |
| | | |
| | | fontHTML += '</select>'; |
| | | return fontHTML; |
| | | |
| | | case "fontsizeselect": |
| | | return '<select id="{$editor_id}_fontSizeSelect" name="{$editor_id}_fontSizeSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontSize\',false,this.options[this.selectedIndex].value);" class="mceSelectList">'+ |
| | | '<option value="0">{$lang_theme_font_size}</option>'+ |
| | | '<option value="1">1 (8 pt)</option>'+ |
| | | '<option value="2">2 (10 pt)</option>'+ |
| | | '<option value="3">3 (12 pt)</option>'+ |
| | | '<option value="4">4 (14 pt)</option>'+ |
| | | '<option value="5">5 (18 pt)</option>'+ |
| | | '<option value="6">6 (24 pt)</option>'+ |
| | | '<option value="7">7 (36 pt)</option>'+ |
| | | '</select>'; |
| | | |
| | | case "|": |
| | | case "separator": |
| | | return '<img src="{$themeurl}/images/separator.gif" width="2" height="20" class="mceSeparatorLine" alt="" />'; |
| | | |
| | | case "spacer": |
| | | return '<img src="{$themeurl}/images/separator.gif" width="2" height="15" border="0" class="mceSeparatorLine" style="vertical-align: middle" alt="" />'; |
| | | |
| | | case "rowseparator": |
| | | return '<br />'; |
| | | } |
| | | |
| | | return ""; |
| | | }, |
| | | |
| | | /** |
| | | * Theme specific execcommand handling. |
| | | */ |
| | | execCommand : function(editor_id, element, command, user_interface, value) { |
| | | switch (command) { |
| | | case 'mceHelp': |
| | | tinyMCE.openWindow({ |
| | | file : 'about.htm', |
| | | width : 480, |
| | | height : 380 |
| | | }, { |
| | | tinymce_version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion, |
| | | tinymce_releasedate : tinyMCE.releaseDate, |
| | | inline : "yes" |
| | | }); |
| | | return true; |
| | | |
| | | case "mceLink": |
| | | var inst = tinyMCE.getInstanceById(editor_id); |
| | | var doc = inst.getDoc(); |
| | | var selectedText = ""; |
| | | |
| | | if (tinyMCE.isMSIE) { |
| | | var rng = doc.selection.createRange(); |
| | | selectedText = rng.text; |
| | | } else |
| | | selectedText = inst.getSel().toString(); |
| | | |
| | | if (!tinyMCE.linkElement) { |
| | | if ((tinyMCE.selectedElement.nodeName.toLowerCase() != "img") && (selectedText.length <= 0)) |
| | | return true; |
| | | } |
| | | |
| | | var href = "", target = "", title = "", onclick = "", action = "insert", style_class = ""; |
| | | |
| | | if (tinyMCE.selectedElement.nodeName.toLowerCase() == "a") |
| | | tinyMCE.linkElement = tinyMCE.selectedElement; |
| | | |
| | | // Is anchor not a link |
| | | if (tinyMCE.linkElement != null && tinyMCE.getAttrib(tinyMCE.linkElement, 'href') == "") |
| | | tinyMCE.linkElement = null; |
| | | |
| | | if (tinyMCE.linkElement) { |
| | | href = tinyMCE.getAttrib(tinyMCE.linkElement, 'href'); |
| | | target = tinyMCE.getAttrib(tinyMCE.linkElement, 'target'); |
| | | title = tinyMCE.getAttrib(tinyMCE.linkElement, 'title'); |
| | | onclick = tinyMCE.getAttrib(tinyMCE.linkElement, 'onclick'); |
| | | style_class = tinyMCE.getAttrib(tinyMCE.linkElement, 'class'); |
| | | |
| | | // Try old onclick to if copy/pasted content |
| | | if (onclick == "") |
| | | onclick = tinyMCE.getAttrib(tinyMCE.linkElement, 'onclick'); |
| | | |
| | | onclick = tinyMCE.cleanupEventStr(onclick); |
| | | |
| | | href = eval(tinyMCE.settings['urlconverter_callback'] + "(href, tinyMCE.linkElement, true);"); |
| | | |
| | | // Use mce_href if defined |
| | | mceRealHref = tinyMCE.getAttrib(tinyMCE.linkElement, 'mce_href'); |
| | | if (mceRealHref != "") { |
| | | href = mceRealHref; |
| | | |
| | | if (tinyMCE.getParam('convert_urls')) |
| | | href = eval(tinyMCE.settings['urlconverter_callback'] + "(href, tinyMCE.linkElement, true);"); |
| | | } |
| | | |
| | | action = "update"; |
| | | } |
| | | |
| | | var template = new Array(); |
| | | |
| | | template['file'] = 'link.htm'; |
| | | template['width'] = 310; |
| | | template['height'] = 200; |
| | | |
| | | // Language specific width and height addons |
| | | template['width'] += tinyMCE.getLang('lang_insert_link_delta_width', 0); |
| | | template['height'] += tinyMCE.getLang('lang_insert_link_delta_height', 0); |
| | | |
| | | if (inst.settings['insertlink_callback']) { |
| | | var returnVal = eval(inst.settings['insertlink_callback'] + "(href, target, title, onclick, action, style_class);"); |
| | | if (returnVal && returnVal['href']) |
| | | TinyMCE_AdvancedTheme._insertLink(returnVal['href'], returnVal['target'], returnVal['title'], returnVal['onclick'], returnVal['style_class']); |
| | | } else { |
| | | tinyMCE.openWindow(template, {href : href, target : target, title : title, onclick : onclick, action : action, className : style_class, inline : "yes"}); |
| | | } |
| | | |
| | | return true; |
| | | |
| | | case "mceImage": |
| | | var src = "", alt = "", border = "", hspace = "", vspace = "", width = "", height = "", align = ""; |
| | | var title = "", onmouseover = "", onmouseout = "", action = "insert"; |
| | | var img = tinyMCE.imgElement; |
| | | var inst = tinyMCE.getInstanceById(editor_id); |
| | | |
| | | if (tinyMCE.selectedElement != null && tinyMCE.selectedElement.nodeName.toLowerCase() == "img") { |
| | | img = tinyMCE.selectedElement; |
| | | tinyMCE.imgElement = img; |
| | | } |
| | | |
| | | if (img) { |
| | | // Is it a internal MCE visual aid image, then skip this one. |
| | | if (tinyMCE.getAttrib(img, 'name').indexOf('mce_') == 0) |
| | | return true; |
| | | |
| | | src = tinyMCE.getAttrib(img, 'src'); |
| | | alt = tinyMCE.getAttrib(img, 'alt'); |
| | | |
| | | // Try polling out the title |
| | | if (alt == "") |
| | | alt = tinyMCE.getAttrib(img, 'title'); |
| | | |
| | | // Fix width/height attributes if the styles is specified |
| | | if (tinyMCE.isGecko) { |
| | | var w = img.style.width; |
| | | if (w != null && w != "") |
| | | img.setAttribute("width", w); |
| | | |
| | | var h = img.style.height; |
| | | if (h != null && h != "") |
| | | img.setAttribute("height", h); |
| | | } |
| | | |
| | | border = tinyMCE.getAttrib(img, 'border'); |
| | | hspace = tinyMCE.getAttrib(img, 'hspace'); |
| | | vspace = tinyMCE.getAttrib(img, 'vspace'); |
| | | width = tinyMCE.getAttrib(img, 'width'); |
| | | height = tinyMCE.getAttrib(img, 'height'); |
| | | align = tinyMCE.getAttrib(img, 'align'); |
| | | onmouseover = tinyMCE.getAttrib(img, 'onmouseover'); |
| | | onmouseout = tinyMCE.getAttrib(img, 'onmouseout'); |
| | | title = tinyMCE.getAttrib(img, 'title'); |
| | | |
| | | // Is realy specified? |
| | | if (tinyMCE.isMSIE) { |
| | | width = img.attributes['width'].specified ? width : ""; |
| | | height = img.attributes['height'].specified ? height : ""; |
| | | } |
| | | |
| | | //onmouseover = tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseover)); |
| | | //onmouseout = tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseout)); |
| | | |
| | | src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, img, true);"); |
| | | |
| | | // Use mce_src if defined |
| | | mceRealSrc = tinyMCE.getAttrib(img, 'mce_src'); |
| | | if (mceRealSrc != "") { |
| | | src = mceRealSrc; |
| | | |
| | | if (tinyMCE.getParam('convert_urls')) |
| | | src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, img, true);"); |
| | | } |
| | | |
| | | //if (onmouseover != "") |
| | | // onmouseover = eval(tinyMCE.settings['urlconverter_callback'] + "(onmouseover, img, true);"); |
| | | |
| | | //if (onmouseout != "") |
| | | // onmouseout = eval(tinyMCE.settings['urlconverter_callback'] + "(onmouseout, img, true);"); |
| | | |
| | | action = "update"; |
| | | } |
| | | |
| | | var template = new Array(); |
| | | |
| | | template['file'] = 'image.htm?src={$src}'; |
| | | template['width'] = 355; |
| | | template['height'] = 265 + (tinyMCE.isMSIE ? 25 : 0); |
| | | |
| | | // Language specific width and height addons |
| | | template['width'] += tinyMCE.getLang('lang_insert_image_delta_width', 0); |
| | | template['height'] += tinyMCE.getLang('lang_insert_image_delta_height', 0); |
| | | |
| | | if (inst.settings['insertimage_callback']) { |
| | | var returnVal = eval(inst.settings['insertimage_callback'] + "(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);"); |
| | | if (returnVal && returnVal['src']) |
| | | TinyMCE_AdvancedTheme._insertImage(returnVal['src'], returnVal['alt'], returnVal['border'], returnVal['hspace'], returnVal['vspace'], returnVal['width'], returnVal['height'], returnVal['align'], returnVal['title'], returnVal['onmouseover'], returnVal['onmouseout']); |
| | | } else |
| | | tinyMCE.openWindow(template, {src : src, alt : alt, border : border, hspace : hspace, vspace : vspace, width : width, height : height, align : align, title : title, onmouseover : onmouseover, onmouseout : onmouseout, action : action, inline : "yes"}); |
| | | |
| | | return true; |
| | | |
| | | case "forecolor": |
| | | var fcp = new TinyMCE_Layer(editor_id + '_fcPreview', false), p, img, elm; |
| | | |
| | | TinyMCE_AdvancedTheme._hideMenus(editor_id); |
| | | |
| | | if (!fcp.exists()) { |
| | | fcp.create('div', 'mceColorPreview', document.getElementById(editor_id + '_toolbar')); |
| | | elm = fcp.getElement(); |
| | | elm._editor_id = editor_id; |
| | | elm._command = "forecolor"; |
| | | elm._switchId = editor_id + "_forecolor"; |
| | | tinyMCE.addEvent(elm, 'click', TinyMCE_AdvancedTheme._handleMenuEvent); |
| | | tinyMCE.addEvent(elm, 'mouseover', TinyMCE_AdvancedTheme._handleMenuEvent); |
| | | tinyMCE.addEvent(elm, 'mouseout', TinyMCE_AdvancedTheme._handleMenuEvent); |
| | | } |
| | | |
| | | img = tinyMCE.selectNodes(document.getElementById(editor_id + "_forecolor"), function(n) {return n.nodeName == "IMG";})[0]; |
| | | p = tinyMCE.getAbsPosition(img, document.getElementById(editor_id + '_toolbar')); |
| | | |
| | | fcp.moveTo(p.absLeft, p.absTop); |
| | | fcp.getElement().style.backgroundColor = value != null ? value : tinyMCE.getInstanceById(editor_id).foreColor; |
| | | fcp.show(); |
| | | |
| | | return false; |
| | | |
| | | case "forecolorpicker": |
| | | this._pickColor(editor_id, 'forecolor'); |
| | | return true; |
| | | |
| | | case "forecolorMenu": |
| | | TinyMCE_AdvancedTheme._hideMenus(editor_id); |
| | | |
| | | // Create color layer |
| | | var ml = new TinyMCE_Layer(editor_id + '_fcMenu'); |
| | | |
| | | if (!ml.exists()) |
| | | ml.create('div', 'mceMenu', document.body, TinyMCE_AdvancedTheme._getColorHTML(editor_id, 'theme_advanced_text_colors', 'forecolor')); |
| | | |
| | | tinyMCE.switchClass(editor_id + '_forecolor', 'mceMenuButtonFocus'); |
| | | ml.moveRelativeTo(document.getElementById(editor_id + "_forecolor"), 'bl'); |
| | | |
| | | ml.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? -1 : 1, -1); |
| | | |
| | | if (tinyMCE.isOpera) |
| | | ml.moveBy(0, -2); |
| | | |
| | | ml.show(); |
| | | return true; |
| | | |
| | | case "HiliteColor": |
| | | var bcp = new TinyMCE_Layer(editor_id + '_bcPreview', false), p, img; |
| | | |
| | | TinyMCE_AdvancedTheme._hideMenus(editor_id); |
| | | |
| | | if (!bcp.exists()) { |
| | | bcp.create('div', 'mceColorPreview', document.getElementById(editor_id + '_toolbar')); |
| | | elm = bcp.getElement(); |
| | | elm._editor_id = editor_id; |
| | | elm._command = "HiliteColor"; |
| | | elm._switchId = editor_id + "_backcolor"; |
| | | tinyMCE.addEvent(elm, 'click', TinyMCE_AdvancedTheme._handleMenuEvent); |
| | | tinyMCE.addEvent(elm, 'mouseover', TinyMCE_AdvancedTheme._handleMenuEvent); |
| | | tinyMCE.addEvent(elm, 'mouseout', TinyMCE_AdvancedTheme._handleMenuEvent); |
| | | } |
| | | |
| | | img = tinyMCE.selectNodes(document.getElementById(editor_id + "_backcolor"), function(n) {return n.nodeName == "IMG";})[0]; |
| | | p = tinyMCE.getAbsPosition(img, document.getElementById(editor_id + '_toolbar')); |
| | | |
| | | bcp.moveTo(p.absLeft, p.absTop); |
| | | bcp.getElement().style.backgroundColor = value != null ? value : tinyMCE.getInstanceById(editor_id).backColor; |
| | | bcp.show(); |
| | | |
| | | return false; |
| | | |
| | | case "HiliteColorMenu": |
| | | TinyMCE_AdvancedTheme._hideMenus(editor_id); |
| | | |
| | | // Create color layer |
| | | var ml = new TinyMCE_Layer(editor_id + '_bcMenu'); |
| | | |
| | | if (!ml.exists()) |
| | | ml.create('div', 'mceMenu', document.body, TinyMCE_AdvancedTheme._getColorHTML(editor_id, 'theme_advanced_background_colors', 'HiliteColor')); |
| | | |
| | | tinyMCE.switchClass(editor_id + '_backcolor', 'mceMenuButtonFocus'); |
| | | ml.moveRelativeTo(document.getElementById(editor_id + "_backcolor"), 'bl'); |
| | | |
| | | ml.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? -1 : 1, -1); |
| | | |
| | | if (tinyMCE.isOpera) |
| | | ml.moveBy(0, -2); |
| | | |
| | | ml.show(); |
| | | return true; |
| | | |
| | | case "backcolorpicker": |
| | | this._pickColor(editor_id, 'HiliteColor'); |
| | | return true; |
| | | |
| | | case "mceColorPicker": |
| | | if (user_interface) { |
| | | var template = []; |
| | | |
| | | if (!value['callback'] && !value['color']) |
| | | value['color'] = value['document'].getElementById(value['element_id']).value; |
| | | |
| | | template['file'] = 'color_picker.htm'; |
| | | template['width'] = 380; |
| | | template['height'] = 250; |
| | | template['close_previous'] = "no"; |
| | | |
| | | template['width'] += tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width', 0); |
| | | template['height'] += tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_height', 0); |
| | | |
| | | if (typeof(value['store_selection']) == "undefined") |
| | | value['store_selection'] = true; |
| | | |
| | | tinyMCE.lastColorPickerValue = value; |
| | | tinyMCE.openWindow(template, {editor_id : editor_id, mce_store_selection : value['store_selection'], inline : "yes", command : "mceColorPicker", input_color : value['color']}); |
| | | } else { |
| | | var savedVal = tinyMCE.lastColorPickerValue, elm; |
| | | |
| | | if (savedVal['callback']) { |
| | | savedVal['callback'](value); |
| | | return true; |
| | | } |
| | | |
| | | elm = savedVal['document'].getElementById(savedVal['element_id']); |
| | | elm.value = value; |
| | | |
| | | if (elm.onchange != null && elm.onchange != '') |
| | | eval('elm.onchange();'); |
| | | } |
| | | return true; |
| | | |
| | | case "mceCodeEditor": |
| | | var template = new Array(); |
| | | |
| | | template['file'] = 'source_editor.htm'; |
| | | template['width'] = parseInt(tinyMCE.getParam("theme_advanced_source_editor_width", 720)); |
| | | template['height'] = parseInt(tinyMCE.getParam("theme_advanced_source_editor_height", 580)); |
| | | |
| | | tinyMCE.openWindow(template, {editor_id : editor_id, resizable : "yes", scrollbars : "no", inline : "yes"}); |
| | | return true; |
| | | |
| | | case "mceCharMap": |
| | | var template = new Array(); |
| | | |
| | | template['file'] = 'charmap.htm'; |
| | | template['width'] = 550 + (tinyMCE.isOpera ? 40 : 0); |
| | | template['height'] = 250; |
| | | |
| | | template['width'] += tinyMCE.getLang('lang_theme_advanced_charmap_delta_width', 0); |
| | | template['height'] += tinyMCE.getLang('lang_theme_advanced_charmap_delta_height', 0); |
| | | |
| | | tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"}); |
| | | return true; |
| | | |
| | | case "mceInsertAnchor": |
| | | var template = new Array(); |
| | | |
| | | template['file'] = 'anchor.htm'; |
| | | template['width'] = 320; |
| | | template['height'] = 90 + (tinyMCE.isNS7 ? 30 : 0); |
| | | |
| | | template['width'] += tinyMCE.getLang('lang_theme_advanced_anchor_delta_width', 0); |
| | | template['height'] += tinyMCE.getLang('lang_theme_advanced_anchor_delta_height', 0); |
| | | |
| | | tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"}); |
| | | return true; |
| | | |
| | | case "mceNewDocument": |
| | | if (confirm(tinyMCE.entityDecode(tinyMCE.getLang('lang_newdocument')))) |
| | | tinyMCE.execInstanceCommand(editor_id, 'mceSetContent', false, ' '); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | return false; |
| | | }, |
| | | |
| | | /** |
| | | * Editor instance template function. |
| | | */ |
| | | getEditorTemplate : function(settings, editorId) { |
| | | function removeFromArray(in_array, remove_array) { |
| | | var outArray = new Array(), skip; |
| | | |
| | | for (var i=0; i<in_array.length; i++) { |
| | | skip = false; |
| | | |
| | | for (var j=0; j<remove_array.length; j++) { |
| | | if (in_array[i] == remove_array[j]) { |
| | | skip = true; |
| | | } |
| | | } |
| | | |
| | | if (!skip) { |
| | | outArray[outArray.length] = in_array[i]; |
| | | } |
| | | } |
| | | |
| | | return outArray; |
| | | } |
| | | |
| | | function addToArray(in_array, add_array) { |
| | | for (var i=0; i<add_array.length; i++) { |
| | | in_array[in_array.length] = add_array[i]; |
| | | } |
| | | |
| | | return in_array; |
| | | } |
| | | |
| | | var template = new Array(); |
| | | var deltaHeight = 0; |
| | | var resizing = tinyMCE.getParam("theme_advanced_resizing", false); |
| | | var path = tinyMCE.getParam("theme_advanced_path", true); |
| | | var statusbarHTML = '<div id="{$editor_id}_path" class="mceStatusbarPathText" style="display: ' + (path ? "block" : "none") + '"> </div><div id="{$editor_id}_resize" class="mceStatusbarResize" style="display: ' + (resizing ? "block" : "none") + '" onmousedown="tinyMCE.themes.advanced._setResizing(event,\'{$editor_id}\',true);"></div><br style="clear: both" />'; |
| | | var layoutManager = tinyMCE.getParam("theme_advanced_layout_manager", "SimpleLayout"); |
| | | |
| | | // Setup style select options -- MOVED UP FOR EXTERNAL TOOLBAR COMPATABILITY! |
| | | var styleSelectHTML = '<option value="">{$lang_theme_style_select}</option>'; |
| | | if (settings['theme_advanced_styles']) { |
| | | var stylesAr = settings['theme_advanced_styles'].split(';'); |
| | | |
| | | for (var i=0; i<stylesAr.length; i++) { |
| | | var key, value; |
| | | |
| | | key = stylesAr[i].split('=')[0]; |
| | | value = stylesAr[i].split('=')[1]; |
| | | |
| | | styleSelectHTML += '<option value="' + value + '">' + key + '</option>'; |
| | | } |
| | | |
| | | TinyMCE_AdvancedTheme._autoImportCSSClasses = false; |
| | | } |
| | | |
| | | switch(layoutManager) { |
| | | case "SimpleLayout" : //the default TinyMCE Layout (for backwards compatibility)... |
| | | var toolbarHTML = ""; |
| | | var toolbarLocation = tinyMCE.getParam("theme_advanced_toolbar_location", "bottom"); |
| | | var toolbarAlign = tinyMCE.getParam("theme_advanced_toolbar_align", "center"); |
| | | var pathLocation = tinyMCE.getParam("theme_advanced_path_location", "none"); // Compatiblity |
| | | var statusbarLocation = tinyMCE.getParam("theme_advanced_statusbar_location", pathLocation); |
| | | var defVals = { |
| | | theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect", |
| | | theme_advanced_buttons2 : "bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code", |
| | | theme_advanced_buttons3 : "hr,removeformat,visualaid,separator,sub,sup,separator,charmap" |
| | | }; |
| | | |
| | | // Add accessibility control |
| | | toolbarHTML += '<a href="#" accesskey="q" title="' + tinyMCE.getLang("lang_toolbar_focus") + '"'; |
| | | |
| | | if (!tinyMCE.getParam("accessibility_focus")) |
| | | toolbarHTML += ' onfocus="tinyMCE.getInstanceById(\'' + editorId + '\').getWin().focus();"'; |
| | | |
| | | toolbarHTML += '></a>'; |
| | | |
| | | // Render rows |
| | | for (var i=1; i<100; i++) { |
| | | var def = defVals["theme_advanced_buttons" + i]; |
| | | |
| | | var buttons = tinyMCE.getParam("theme_advanced_buttons" + i, def == null ? '' : def, true, ','); |
| | | if (buttons.length == 0) |
| | | break; |
| | | |
| | | buttons = removeFromArray(buttons, tinyMCE.getParam("theme_advanced_disable", "", true, ',')); |
| | | buttons = addToArray(buttons, tinyMCE.getParam("theme_advanced_buttons" + i + "_add", "", true, ',')); |
| | | buttons = addToArray(tinyMCE.getParam("theme_advanced_buttons" + i + "_add_before", "", true, ','), buttons); |
| | | |
| | | for (var b=0; b<buttons.length; b++) |
| | | toolbarHTML += tinyMCE.getControlHTML(buttons[b]); |
| | | |
| | | if (buttons.length > 0) { |
| | | toolbarHTML += "<br />"; |
| | | deltaHeight -= 23; |
| | | } |
| | | } |
| | | |
| | | // Add accessibility control |
| | | toolbarHTML += '<a href="#" accesskey="z" onfocus="tinyMCE.getInstanceById(\'' + editorId + '\').getWin().focus();"></a>'; |
| | | |
| | | // Setup template html |
| | | template['html'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width_style};height:{$height_style}"><tbody>'; |
| | | |
| | | if (toolbarLocation == "top") |
| | | template['html'] += '<tr><td dir="ltr" class="mceToolbarTop" align="' + toolbarAlign + '" height="1" nowrap="nowrap"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>'; |
| | | |
| | | if (statusbarLocation == "top") { |
| | | template['html'] += '<tr><td class="mceStatusbarTop" height="1">' + statusbarHTML + '</td></tr>'; |
| | | deltaHeight -= 23; |
| | | } |
| | | |
| | | template['html'] += '<tr><td align="center"><span id="{$editor_id}"></span></td></tr>'; |
| | | |
| | | if (toolbarLocation == "bottom") |
| | | template['html'] += '<tr><td dir="ltr" class="mceToolbarBottom" align="' + toolbarAlign + '" height="1"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>'; |
| | | |
| | | // External toolbar changes |
| | | if (toolbarLocation == "external") { |
| | | var bod = document.body; |
| | | var elm = document.createElement ("div"); |
| | | |
| | | toolbarHTML = tinyMCE.replaceVar(toolbarHTML, 'style_select_options', styleSelectHTML); |
| | | toolbarHTML = tinyMCE.applyTemplate(toolbarHTML, {editor_id : editorId}); |
| | | |
| | | elm.className = "mceToolbarExternal"; |
| | | elm.id = editorId+"_toolbar"; |
| | | elm.innerHTML = '<table width="100%" border="0" align="center"><tr><td align="center">'+toolbarHTML+'</td></tr></table>'; |
| | | bod.appendChild (elm); |
| | | // bod.style.marginTop = elm.offsetHeight + "px"; |
| | | |
| | | deltaHeight = 0; |
| | | tinyMCE.getInstanceById(editorId).toolbarElement = elm; |
| | | |
| | | //template['html'] = '<div id="mceExternalToolbar" align="center" class="mceToolbarExternal"><table width="100%" border="0" align="center"><tr><td align="center">'+toolbarHTML+'</td></tr></table></div>' + template["html"]; |
| | | } else { |
| | | tinyMCE.getInstanceById(editorId).toolbarElement = null; |
| | | } |
| | | |
| | | if (statusbarLocation == "bottom") { |
| | | template['html'] += '<tr><td class="mceStatusbarBottom" height="1">' + statusbarHTML + '</td></tr>'; |
| | | deltaHeight -= 23; |
| | | } |
| | | |
| | | template['html'] += '</tbody></table>'; |
| | | //"SimpleLayout" |
| | | break; |
| | | |
| | | case "RowLayout" : //Container Layout - containers defined in "theme_advanced_containers" are rendered from top to bottom. |
| | | template['html'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>'; |
| | | |
| | | var containers = tinyMCE.getParam("theme_advanced_containers", "", true, ","); |
| | | var defaultContainerCSS = tinyMCE.getParam("theme_advanced_containers_default_class", "container"); |
| | | var defaultContainerAlign = tinyMCE.getParam("theme_advanced_containers_default_align", "center"); |
| | | |
| | | //Render Containers: |
| | | for (var i = 0; i < containers.length; i++) |
| | | { |
| | | if (containers[i] == "mceEditor") //Exceptions for mceEditor and ... |
| | | template['html'] += '<tr><td align="center" class="mceEditor_border"><span id="{$editor_id}"></span></td></tr>'; |
| | | else if (containers[i] == "mceElementpath" || containers[i] == "mceStatusbar") // ... mceElementpath: |
| | | { |
| | | var pathClass = "mceStatusbar"; |
| | | |
| | | if (i == containers.length-1) |
| | | { |
| | | pathClass = "mceStatusbarBottom"; |
| | | } |
| | | else if (i == 0) |
| | | { |
| | | pathClass = "mceStatusbar"; |
| | | } |
| | | else |
| | | { |
| | | deltaHeight-=2; |
| | | } |
| | | |
| | | template['html'] += '<tr><td class="' + pathClass + '" height="1">' + statusbarHTML + '</td></tr>'; |
| | | deltaHeight -= 22; |
| | | } else { // Render normal Container |
| | | var curContainer = tinyMCE.getParam("theme_advanced_container_"+containers[i], "", true, ','); |
| | | var curContainerHTML = ""; |
| | | var curAlign = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align", defaultContainerAlign); |
| | | var curCSS = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class", defaultContainerCSS); |
| | | |
| | | curContainer = removeFromArray(curContainer, tinyMCE.getParam("theme_advanced_disable", "", true, ',')); |
| | | |
| | | for (var j=0; j<curContainer.length; j++) |
| | | curContainerHTML += tinyMCE.getControlHTML(curContainer[j]); |
| | | |
| | | if (curContainer.length > 0) { |
| | | curContainerHTML += "<br />"; |
| | | deltaHeight -= 23; |
| | | } |
| | | |
| | | template['html'] += '<tr><td class="' + curCSS + '" align="' + curAlign + '" height="1">' + curContainerHTML + '</td></tr>'; |
| | | } |
| | | } |
| | | |
| | | template['html'] += '</tbody></table>'; |
| | | //RowLayout |
| | | break; |
| | | |
| | | case "CustomLayout" : //User defined layout callback... |
| | | var customLayout = tinyMCE.getParam("theme_advanced_custom_layout",""); |
| | | |
| | | if (customLayout != "" && eval("typeof(" + customLayout + ")") != "undefined") { |
| | | template = eval(customLayout + "(template);"); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | if (resizing) |
| | | template['html'] += '<span id="{$editor_id}_resize_box" class="mceResizeBox"></span>'; |
| | | |
| | | template['html'] = tinyMCE.replaceVar(template['html'], 'style_select_options', styleSelectHTML); |
| | | |
| | | // Set to default values |
| | | if (!template['delta_width']) |
| | | template['delta_width'] = 0; |
| | | |
| | | if (!template['delta_height']) |
| | | template['delta_height'] = deltaHeight; |
| | | |
| | | return template; |
| | | }, |
| | | |
| | | initInstance : function(inst) { |
| | | if (tinyMCE.getParam("theme_advanced_resizing", false)) { |
| | | if (tinyMCE.getParam("theme_advanced_resizing_use_cookie", true)) { |
| | | var w = TinyMCE_AdvancedTheme._getCookie("TinyMCE_" + inst.editorId + "_width"); |
| | | var h = TinyMCE_AdvancedTheme._getCookie("TinyMCE_" + inst.editorId + "_height"); |
| | | |
| | | TinyMCE_AdvancedTheme._resizeTo(inst, w, h, tinyMCE.getParam("theme_advanced_resize_horizontal", true)); |
| | | } |
| | | } |
| | | |
| | | inst.addShortcut('ctrl', 'k', 'lang_link_desc', 'mceLink'); |
| | | }, |
| | | |
| | | removeInstance : function(inst) { |
| | | new TinyMCE_Layer(inst.editorId + '_fcMenu').remove(); |
| | | new TinyMCE_Layer(inst.editorId + '_bcMenu').remove(); |
| | | }, |
| | | |
| | | hideInstance : function(inst) { |
| | | TinyMCE_AdvancedTheme._hideMenus(inst.editorId); |
| | | }, |
| | | |
| | | _handleMenuEvent : function(e) { |
| | | var te = tinyMCE.isMSIE ? window.event.srcElement : e.target; |
| | | tinyMCE._menuButtonEvent(e.type == "mouseover" ? "over" : "out", document.getElementById(te._switchId)); |
| | | |
| | | if (e.type == "click") |
| | | tinyMCE.execInstanceCommand(te._editor_id, te._command); |
| | | }, |
| | | |
| | | _hideMenus : function(id) { |
| | | var fcml = new TinyMCE_Layer(id + '_fcMenu'), bcml = new TinyMCE_Layer(id + '_bcMenu'); |
| | | |
| | | if (fcml.exists() && fcml.isVisible()) { |
| | | tinyMCE.switchClass(id + '_forecolor', 'mceMenuButton'); |
| | | fcml.hide(); |
| | | } |
| | | |
| | | if (bcml.exists() && bcml.isVisible()) { |
| | | tinyMCE.switchClass(id + '_backcolor', 'mceMenuButton'); |
| | | bcml.hide(); |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * Node change handler. |
| | | */ |
| | | handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection, setup_content) { |
| | | var alignNode, breakOut, classNode; |
| | | |
| | | function selectByValue(select_elm, value, first_index) { |
| | | first_index = typeof(first_index) == "undefined" ? false : true; |
| | | |
| | | if (select_elm) { |
| | | for (var i=0; i<select_elm.options.length; i++) { |
| | | var ov = "" + select_elm.options[i].value; |
| | | |
| | | if (first_index && ov.toLowerCase().indexOf(value.toLowerCase()) == 0) { |
| | | select_elm.selectedIndex = i; |
| | | return true; |
| | | } |
| | | |
| | | if (ov == value) { |
| | | select_elm.selectedIndex = i; |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | }; |
| | | |
| | | // No node provided |
| | | if (node == null) |
| | | return; |
| | | |
| | | // Update path |
| | | var pathElm = document.getElementById(editor_id + "_path"); |
| | | var inst = tinyMCE.getInstanceById(editor_id); |
| | | var doc = inst.getDoc(); |
| | | TinyMCE_AdvancedTheme._hideMenus(editor_id); |
| | | |
| | | if (pathElm) { |
| | | // Get node path |
| | | var parentNode = node; |
| | | var path = new Array(); |
| | | |
| | | while (parentNode != null) { |
| | | if (parentNode.nodeName.toUpperCase() == "BODY") { |
| | | break; |
| | | } |
| | | |
| | | // Only append element nodes to path |
| | | if (parentNode.nodeType == 1 && tinyMCE.getAttrib(parentNode, "class").indexOf('mceItemHidden') == -1) { |
| | | path[path.length] = parentNode; |
| | | } |
| | | |
| | | parentNode = parentNode.parentNode; |
| | | } |
| | | |
| | | // Setup HTML |
| | | var html = ""; |
| | | for (var i=path.length-1; i>=0; i--) { |
| | | var nodeName = path[i].nodeName.toLowerCase(); |
| | | var nodeData = ""; |
| | | |
| | | if (nodeName.indexOf("html:") == 0) |
| | | nodeName = nodeName.substring(5); |
| | | |
| | | if (nodeName == "b") { |
| | | nodeName = "strong"; |
| | | } |
| | | |
| | | if (nodeName == "i") { |
| | | nodeName = "em"; |
| | | } |
| | | |
| | | if (nodeName == "span") { |
| | | var cn = tinyMCE.getAttrib(path[i], "class"); |
| | | if (cn != "" && cn.indexOf('mceItem') == -1) |
| | | nodeData += "class: " + cn + " "; |
| | | |
| | | var st = tinyMCE.getAttrib(path[i], "style"); |
| | | if (st != "") { |
| | | st = tinyMCE.serializeStyle(tinyMCE.parseStyle(st)); |
| | | nodeData += "style: " + tinyMCE.xmlEncode(st) + " "; |
| | | } |
| | | } |
| | | |
| | | if (nodeName == "font") { |
| | | if (tinyMCE.getParam("convert_fonts_to_spans")) |
| | | nodeName = "span"; |
| | | |
| | | var face = tinyMCE.getAttrib(path[i], "face"); |
| | | if (face != "") |
| | | nodeData += "font: " + tinyMCE.xmlEncode(face) + " "; |
| | | |
| | | var size = tinyMCE.getAttrib(path[i], "size"); |
| | | if (size != "") |
| | | nodeData += "size: " + tinyMCE.xmlEncode(size) + " "; |
| | | |
| | | var color = tinyMCE.getAttrib(path[i], "color"); |
| | | if (color != "") |
| | | nodeData += "color: " + tinyMCE.xmlEncode(color) + " "; |
| | | } |
| | | |
| | | if (tinyMCE.getAttrib(path[i], 'id') != "") { |
| | | nodeData += "id: " + path[i].getAttribute('id') + " "; |
| | | } |
| | | |
| | | var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i], "class"), false); |
| | | if (className != "" && className.indexOf('mceItem') == -1) |
| | | nodeData += "class: " + className + " "; |
| | | |
| | | if (tinyMCE.getAttrib(path[i], 'src') != "") { |
| | | var src = tinyMCE.getAttrib(path[i], "mce_src"); |
| | | |
| | | if (src == "") |
| | | src = tinyMCE.getAttrib(path[i], "src"); |
| | | |
| | | nodeData += "src: " + tinyMCE.xmlEncode(src) + " "; |
| | | } |
| | | |
| | | if (path[i].nodeName == 'A' && tinyMCE.getAttrib(path[i], 'href') != "") { |
| | | var href = tinyMCE.getAttrib(path[i], "mce_href"); |
| | | |
| | | if (href == "") |
| | | href = tinyMCE.getAttrib(path[i], "href"); |
| | | |
| | | nodeData += "href: " + tinyMCE.xmlEncode(href) + " "; |
| | | } |
| | | |
| | | className = tinyMCE.getAttrib(path[i], "class"); |
| | | if ((nodeName == "img" || nodeName == "span") && className.indexOf('mceItem') != -1) { |
| | | nodeName = className.replace(/mceItem([a-z]+)/gi, '$1').toLowerCase(); |
| | | nodeData = path[i].getAttribute('title'); |
| | | } |
| | | |
| | | if (nodeName == "a" && (anchor = tinyMCE.getAttrib(path[i], "name")) != "") { |
| | | nodeName = "a"; |
| | | nodeName += "#" + tinyMCE.xmlEncode(anchor); |
| | | nodeData = ""; |
| | | } |
| | | |
| | | if (tinyMCE.getAttrib(path[i], 'name').indexOf("mce_") != 0) { |
| | | var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i], "class"), false); |
| | | if (className != "" && className.indexOf('mceItem') == -1) { |
| | | nodeName += "." + className; |
| | | } |
| | | } |
| | | |
| | | var cmd = 'tinyMCE.execInstanceCommand(\'' + editor_id + '\',\'mceSelectNodeDepth\',false,\'' + i + '\');'; |
| | | html += '<a title="' + nodeData + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" target="_self" class="mcePathItem">' + nodeName + '</a>'; |
| | | |
| | | if (i > 0) { |
| | | html += " » "; |
| | | } |
| | | } |
| | | |
| | | pathElm.innerHTML = '<a href="#" accesskey="x"></a>' + tinyMCE.getLang('lang_theme_path') + ": " + html + ' '; |
| | | } |
| | | |
| | | // Reset old states |
| | | tinyMCE.switchClass(editor_id + '_justifyleft', 'mceButtonNormal'); |
| | | tinyMCE.switchClass(editor_id + '_justifyright', 'mceButtonNormal'); |
| | | tinyMCE.switchClass(editor_id + '_justifycenter', 'mceButtonNormal'); |
| | | tinyMCE.switchClass(editor_id + '_justifyfull', 'mceButtonNormal'); |
| | | tinyMCE.switchClass(editor_id + '_bold', 'mceButtonNormal'); |
| | | tinyMCE.switchClass(editor_id + '_italic', 'mceButtonNormal'); |
| | | tinyMCE.switchClass(editor_id + '_underline', 'mceButtonNormal'); |
| | | tinyMCE.switchClass(editor_id + '_strikethrough', 'mceButtonNormal'); |
| | | tinyMCE.switchClass(editor_id + '_bullist', 'mceButtonNormal'); |
| | | tinyMCE.switchClass(editor_id + '_numlist', 'mceButtonNormal'); |
| | | tinyMCE.switchClass(editor_id + '_sub', 'mceButtonNormal'); |
| | | tinyMCE.switchClass(editor_id + '_sup', 'mceButtonNormal'); |
| | | tinyMCE.switchClass(editor_id + '_anchor', 'mceButtonNormal'); |
| | | tinyMCE.switchClass(editor_id + '_link', 'mceButtonDisabled'); |
| | | tinyMCE.switchClass(editor_id + '_unlink', 'mceButtonDisabled'); |
| | | tinyMCE.switchClass(editor_id + '_outdent', 'mceButtonDisabled'); |
| | | tinyMCE.switchClass(editor_id + '_image', 'mceButtonNormal'); |
| | | tinyMCE.switchClass(editor_id + '_hr', 'mceButtonNormal'); |
| | | |
| | | if (node.nodeName == "A" && tinyMCE.getAttrib(node, "class").indexOf('mceItemAnchor') != -1) |
| | | tinyMCE.switchClass(editor_id + '_anchor', 'mceButtonSelected'); |
| | | |
| | | // Get link |
| | | var anchorLink = tinyMCE.getParentElement(node, "a", "href"); |
| | | |
| | | if (anchorLink || any_selection) { |
| | | tinyMCE.switchClass(editor_id + '_link', anchorLink ? 'mceButtonSelected' : 'mceButtonNormal'); |
| | | tinyMCE.switchClass(editor_id + '_unlink', anchorLink ? 'mceButtonSelected' : 'mceButtonNormal'); |
| | | } |
| | | |
| | | // Handle visual aid |
| | | tinyMCE.switchClass(editor_id + '_visualaid', visual_aid ? 'mceButtonSelected' : 'mceButtonNormal'); |
| | | |
| | | if (undo_levels != -1) { |
| | | tinyMCE.switchClass(editor_id + '_undo', 'mceButtonDisabled'); |
| | | tinyMCE.switchClass(editor_id + '_redo', 'mceButtonDisabled'); |
| | | } |
| | | |
| | | // Within li, blockquote |
| | | if (tinyMCE.getParentElement(node, "li,blockquote")) |
| | | tinyMCE.switchClass(editor_id + '_outdent', 'mceButtonNormal'); |
| | | |
| | | // Has redo levels |
| | | if (undo_index != -1 && (undo_index < undo_levels-1 && undo_levels > 0)) |
| | | tinyMCE.switchClass(editor_id + '_redo', 'mceButtonNormal'); |
| | | |
| | | // Has undo levels |
| | | if (undo_index != -1 && (undo_index > 0 && undo_levels > 0)) |
| | | tinyMCE.switchClass(editor_id + '_undo', 'mceButtonNormal'); |
| | | |
| | | // Select class in select box |
| | | var selectElm = document.getElementById(editor_id + "_styleSelect"); |
| | | |
| | | if (selectElm) { |
| | | TinyMCE_AdvancedTheme._setupCSSClasses(editor_id); |
| | | |
| | | classNode = node; |
| | | breakOut = false; |
| | | var index = 0; |
| | | |
| | | do { |
| | | if (classNode && classNode.className) { |
| | | for (var i=0; i<selectElm.options.length; i++) { |
| | | if (selectElm.options[i].value == classNode.className) { |
| | | index = i; |
| | | breakOut = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } while (!breakOut && classNode != null && (classNode = classNode.parentNode) != null); |
| | | |
| | | selectElm.selectedIndex = index; |
| | | } |
| | | |
| | | // Select formatblock |
| | | var selectElm = document.getElementById(editor_id + "_formatSelect"); |
| | | if (selectElm) { |
| | | var elm = tinyMCE.getParentElement(node, "p,div,h1,h2,h3,h4,h5,h6,pre,address"); |
| | | |
| | | if (elm) |
| | | selectByValue(selectElm, "<" + elm.nodeName.toLowerCase() + ">"); |
| | | else |
| | | selectByValue(selectElm, ""); |
| | | } |
| | | |
| | | // Select fontselect |
| | | var selectElm = document.getElementById(editor_id + "_fontNameSelect"); |
| | | if (selectElm) { |
| | | if (!tinyMCE.isSafari && !(tinyMCE.isMSIE && !tinyMCE.isOpera)) { |
| | | var face = inst.queryCommandValue('FontName'); |
| | | |
| | | face = face == null || face == "" ? "" : face; |
| | | |
| | | selectByValue(selectElm, face, face != ""); |
| | | } else { |
| | | var elm = tinyMCE.getParentElement(node, "font", "face"); |
| | | |
| | | if (elm) { |
| | | var family = tinyMCE.getAttrib(elm, "face"); |
| | | |
| | | if (family == '') |
| | | family = '' + elm.style.fontFamily; |
| | | |
| | | if (!selectByValue(selectElm, family, family != "")) |
| | | selectByValue(selectElm, ""); |
| | | } else |
| | | selectByValue(selectElm, ""); |
| | | } |
| | | } |
| | | |
| | | // Select fontsize |
| | | var selectElm = document.getElementById(editor_id + "_fontSizeSelect"); |
| | | if (selectElm) { |
| | | if (!tinyMCE.isSafari && !tinyMCE.isOpera) { |
| | | var size = inst.queryCommandValue('FontSize'); |
| | | selectByValue(selectElm, size == null || size == "" ? "0" : size); |
| | | } else { |
| | | var elm = tinyMCE.getParentElement(node, "font", "size"); |
| | | if (elm) { |
| | | var size = tinyMCE.getAttrib(elm, "size"); |
| | | |
| | | if (size == '') { |
| | | var sizes = new Array('', '8px', '10px', '12px', '14px', '18px', '24px', '36px'); |
| | | |
| | | size = '' + elm.style.fontSize; |
| | | |
| | | for (var i=0; i<sizes.length; i++) { |
| | | if (('' + sizes[i]) == size) { |
| | | size = i; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!selectByValue(selectElm, size)) |
| | | selectByValue(selectElm, ""); |
| | | } else |
| | | selectByValue(selectElm, "0"); |
| | | } |
| | | } |
| | | |
| | | // Handle align attributes |
| | | alignNode = node; |
| | | breakOut = false; |
| | | do { |
| | | if (!alignNode.getAttribute || !alignNode.getAttribute('align')) |
| | | continue; |
| | | |
| | | switch (alignNode.getAttribute('align').toLowerCase()) { |
| | | case "left": |
| | | tinyMCE.switchClass(editor_id + '_justifyleft', 'mceButtonSelected'); |
| | | breakOut = true; |
| | | break; |
| | | |
| | | case "right": |
| | | tinyMCE.switchClass(editor_id + '_justifyright', 'mceButtonSelected'); |
| | | breakOut = true; |
| | | break; |
| | | |
| | | case "middle": |
| | | case "center": |
| | | tinyMCE.switchClass(editor_id + '_justifycenter', 'mceButtonSelected'); |
| | | breakOut = true; |
| | | break; |
| | | |
| | | case "justify": |
| | | tinyMCE.switchClass(editor_id + '_justifyfull', 'mceButtonSelected'); |
| | | breakOut = true; |
| | | break; |
| | | } |
| | | } while (!breakOut && (alignNode = alignNode.parentNode) != null); |
| | | |
| | | // Div justification |
| | | var div = tinyMCE.getParentElement(node, "div"); |
| | | if (div && div.style.textAlign == "center") |
| | | tinyMCE.switchClass(editor_id + '_justifycenter', 'mceButtonSelected'); |
| | | |
| | | // Do special text |
| | | if (!setup_content) { |
| | | // , "JustifyLeft", "_justifyleft", "JustifyCenter", "justifycenter", "JustifyRight", "justifyright", "JustifyFull", "justifyfull", "InsertUnorderedList", "bullist", "InsertOrderedList", "numlist", "InsertUnorderedList", "bullist", "Outdent", "outdent", "Indent", "indent", "subscript", "sub" |
| | | var ar = new Array("Bold", "_bold", "Italic", "_italic", "Strikethrough", "_strikethrough", "superscript", "_sup", "subscript", "_sub"); |
| | | for (var i=0; i<ar.length; i+=2) { |
| | | if (inst.queryCommandState(ar[i])) |
| | | tinyMCE.switchClass(editor_id + ar[i+1], 'mceButtonSelected'); |
| | | } |
| | | |
| | | if (inst.queryCommandState("Underline") && (node.parentNode == null || node.parentNode.nodeName != "A")) |
| | | tinyMCE.switchClass(editor_id + '_underline', 'mceButtonSelected'); |
| | | } |
| | | |
| | | // Handle elements |
| | | do { |
| | | switch (node.nodeName) { |
| | | case "UL": |
| | | tinyMCE.switchClass(editor_id + '_bullist', 'mceButtonSelected'); |
| | | break; |
| | | |
| | | case "OL": |
| | | tinyMCE.switchClass(editor_id + '_numlist', 'mceButtonSelected'); |
| | | break; |
| | | |
| | | case "HR": |
| | | tinyMCE.switchClass(editor_id + '_hr', 'mceButtonSelected'); |
| | | break; |
| | | |
| | | case "IMG": |
| | | if (tinyMCE.getAttrib(node, 'name').indexOf('mce_') != 0 && tinyMCE.getAttrib(node, 'class').indexOf('mceItem') == -1) { |
| | | tinyMCE.switchClass(editor_id + '_image', 'mceButtonSelected'); |
| | | } |
| | | break; |
| | | } |
| | | } while ((node = node.parentNode) != null); |
| | | }, |
| | | |
| | | // Private theme internal functions |
| | | |
| | | // This function auto imports CSS classes into the class selection droplist |
| | | _setupCSSClasses : function(editor_id) { |
| | | var i, selectElm; |
| | | |
| | | if (!TinyMCE_AdvancedTheme._autoImportCSSClasses) |
| | | return; |
| | | |
| | | selectElm = document.getElementById(editor_id + '_styleSelect'); |
| | | |
| | | if (selectElm && selectElm.getAttribute('cssImported') != 'true') { |
| | | var csses = tinyMCE.getCSSClasses(editor_id); |
| | | if (csses && selectElm) { |
| | | for (i=0; i<csses.length; i++) |
| | | selectElm.options[selectElm.options.length] = new Option(csses[i], csses[i]); |
| | | } |
| | | |
| | | // Only do this once |
| | | if (csses != null && csses.length > 0) |
| | | selectElm.setAttribute('cssImported', 'true'); |
| | | } |
| | | }, |
| | | |
| | | _setCookie : function(name, value, expires, path, domain, secure) { |
| | | var curCookie = name + "=" + escape(value) + |
| | | ((expires) ? "; expires=" + expires.toGMTString() : "") + |
| | | ((path) ? "; path=" + escape(path) : "") + |
| | | ((domain) ? "; domain=" + domain : "") + |
| | | ((secure) ? "; secure" : ""); |
| | | |
| | | document.cookie = curCookie; |
| | | }, |
| | | |
| | | _getCookie : function(name) { |
| | | var dc = document.cookie; |
| | | var prefix = name + "="; |
| | | var begin = dc.indexOf("; " + prefix); |
| | | |
| | | if (begin == -1) { |
| | | begin = dc.indexOf(prefix); |
| | | |
| | | if (begin != 0) |
| | | return null; |
| | | } else |
| | | begin += 2; |
| | | |
| | | var end = document.cookie.indexOf(";", begin); |
| | | |
| | | if (end == -1) |
| | | end = dc.length; |
| | | |
| | | return unescape(dc.substring(begin + prefix.length, end)); |
| | | }, |
| | | |
| | | _resizeTo : function(inst, w, h, set_w) { |
| | | var editorContainer = document.getElementById(inst.editorId + '_parent'); |
| | | var tableElm = editorContainer.firstChild; |
| | | var iframe = inst.iframeElement; |
| | | |
| | | if (w == null || w == "null") { |
| | | set_w = false; |
| | | w = 0; |
| | | } |
| | | |
| | | if (h == null || h == "null") |
| | | return; |
| | | |
| | | w = parseInt(w); |
| | | h = parseInt(h); |
| | | |
| | | if (tinyMCE.isGecko) { |
| | | w += 2; |
| | | h += 2; |
| | | } |
| | | |
| | | var dx = w - tableElm.clientWidth; |
| | | var dy = h - tableElm.clientHeight; |
| | | |
| | | w = w < 1 ? 30 : w; |
| | | h = h < 1 ? 30 : h; |
| | | |
| | | if (set_w) |
| | | tableElm.style.width = w + "px"; |
| | | |
| | | tableElm.style.height = h + "px"; |
| | | |
| | | iw = iframe.clientWidth + dx; |
| | | ih = iframe.clientHeight + dy; |
| | | |
| | | iw = iw < 1 ? 30 : iw; |
| | | ih = ih < 1 ? 30 : ih; |
| | | |
| | | if (tinyMCE.isGecko) { |
| | | iw -= 2; |
| | | ih -= 2; |
| | | } |
| | | |
| | | if (set_w) |
| | | iframe.style.width = iw + "px"; |
| | | |
| | | iframe.style.height = ih + "px"; |
| | | |
| | | // Is it to small, make it bigger again |
| | | if (set_w) { |
| | | var tableBodyElm = tableElm.firstChild; |
| | | var minIframeWidth = tableBodyElm.scrollWidth; |
| | | if (inst.iframeElement.clientWidth < minIframeWidth) { |
| | | dx = minIframeWidth - inst.iframeElement.clientWidth; |
| | | |
| | | inst.iframeElement.style.width = (iw + dx) + "px"; |
| | | } |
| | | } |
| | | |
| | | // Remove pesky table controls |
| | | inst.useCSS = false; |
| | | }, |
| | | |
| | | /** |
| | | * Handles resizing events. |
| | | */ |
| | | _resizeEventHandler : function(e) { |
| | | var resizer = TinyMCE_AdvancedTheme._resizer; |
| | | |
| | | // Do nothing |
| | | if (!resizer.resizing) |
| | | return; |
| | | |
| | | e = typeof(e) == "undefined" ? window.event : e; |
| | | |
| | | var dx = e.screenX - resizer.downX; |
| | | var dy = e.screenY - resizer.downY; |
| | | var resizeBox = resizer.resizeBox; |
| | | var editorId = resizer.editorId; |
| | | |
| | | switch (e.type) { |
| | | case "mousemove": |
| | | var w, h; |
| | | |
| | | w = resizer.width + dx; |
| | | h = resizer.height + dy; |
| | | |
| | | w = w < 1 ? 1 : w; |
| | | h = h < 1 ? 1 : h; |
| | | |
| | | if (resizer.horizontal) |
| | | resizeBox.style.width = w + "px"; |
| | | |
| | | resizeBox.style.height = h + "px"; |
| | | break; |
| | | |
| | | case "mouseup": |
| | | TinyMCE_AdvancedTheme._setResizing(e, editorId, false); |
| | | TinyMCE_AdvancedTheme._resizeTo(tinyMCE.getInstanceById(editorId), resizer.width + dx, resizer.height + dy, resizer.horizontal); |
| | | |
| | | // Expire in a month |
| | | if (tinyMCE.getParam("theme_advanced_resizing_use_cookie", true)) { |
| | | var expires = new Date(); |
| | | expires.setTime(expires.getTime() + 3600000 * 24 * 30); |
| | | |
| | | // Set the cookies |
| | | TinyMCE_AdvancedTheme._setCookie("TinyMCE_" + editorId + "_width", "" + (resizer.horizontal ? resizer.width + dx : ""), expires); |
| | | TinyMCE_AdvancedTheme._setCookie("TinyMCE_" + editorId + "_height", "" + (resizer.height + dy), expires); |
| | | } |
| | | break; |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * Starts/stops the editor resizing. |
| | | */ |
| | | _setResizing : function(e, editor_id, state) { |
| | | e = typeof(e) == "undefined" ? window.event : e; |
| | | |
| | | var resizer = TinyMCE_AdvancedTheme._resizer; |
| | | var editorContainer = document.getElementById(editor_id + '_parent'); |
| | | var editorArea = document.getElementById(editor_id + '_parent').firstChild; |
| | | var resizeBox = document.getElementById(editor_id + '_resize_box'); |
| | | var inst = tinyMCE.getInstanceById(editor_id); |
| | | |
| | | if (state) { |
| | | // Place box over editor area |
| | | var width = editorArea.clientWidth; |
| | | var height = editorArea.clientHeight; |
| | | |
| | | resizeBox.style.width = width + "px"; |
| | | resizeBox.style.height = height + "px"; |
| | | |
| | | resizer.iframeWidth = inst.iframeElement.clientWidth; |
| | | resizer.iframeHeight = inst.iframeElement.clientHeight; |
| | | |
| | | // Hide editor and show resize box |
| | | editorArea.style.display = "none"; |
| | | resizeBox.style.display = "block"; |
| | | |
| | | // Add event handlers, only once |
| | | if (!resizer.eventHandlers) { |
| | | if (tinyMCE.isMSIE) |
| | | tinyMCE.addEvent(document, "mousemove", TinyMCE_AdvancedTheme._resizeEventHandler); |
| | | else |
| | | tinyMCE.addEvent(window, "mousemove", TinyMCE_AdvancedTheme._resizeEventHandler); |
| | | |
| | | tinyMCE.addEvent(document, "mouseup", TinyMCE_AdvancedTheme._resizeEventHandler); |
| | | |
| | | resizer.eventHandlers = true; |
| | | } |
| | | |
| | | resizer.resizing = true; |
| | | resizer.downX = e.screenX; |
| | | resizer.downY = e.screenY; |
| | | resizer.width = parseInt(resizeBox.style.width); |
| | | resizer.height = parseInt(resizeBox.style.height); |
| | | resizer.editorId = editor_id; |
| | | resizer.resizeBox = resizeBox; |
| | | resizer.horizontal = tinyMCE.getParam("theme_advanced_resize_horizontal", true); |
| | | } else { |
| | | resizer.resizing = false; |
| | | resizeBox.style.display = "none"; |
| | | editorArea.style.display = tinyMCE.isMSIE && !tinyMCE.isOpera ? "block" : "table"; |
| | | tinyMCE.execCommand('mceResetDesignMode'); |
| | | } |
| | | }, |
| | | |
| | | _getColorHTML : function(id, n, cm) { |
| | | var i, h, cl; |
| | | |
| | | h = '<span class="mceMenuLine"></span>'; |
| | | cl = tinyMCE.getParam(n, TinyMCE_AdvancedTheme._defColors).split(','); |
| | | |
| | | h += '<table class="mceColors"><tr>'; |
| | | for (i=0; i<cl.length; i++) { |
| | | c = 'tinyMCE.execInstanceCommand(\'' + id + '\', \'' + cm + '\', false, \'#' + cl[i] + '\');'; |
| | | h += '<td><a href="javascript:' + c + '" style="background-color: #' + cl[i] + '" onclick="' + c + ';return false;"></a></td>'; |
| | | |
| | | if ((i+1) % 8 == 0) |
| | | h += '</tr><tr>'; |
| | | } |
| | | |
| | | h += '</tr></table>'; |
| | | |
| | | if (tinyMCE.getParam("theme_advanced_more_colors", true)) |
| | | h += '<a href="javascript:void(0);" onclick="TinyMCE_AdvancedTheme._pickColor(\'' + id + '\',\'' + cm + '\');" class="mceMoreColors">' + tinyMCE.getLang('lang_more_colors') + '</a>'; |
| | | |
| | | return h; |
| | | }, |
| | | |
| | | _pickColor : function(id, cm) { |
| | | var inputColor, inst = tinyMCE.selectedInstance; |
| | | |
| | | if (cm == 'forecolor' && inst) |
| | | inputColor = inst.foreColor; |
| | | |
| | | if ((cm == 'backcolor' || cm == 'HiliteColor') && inst) |
| | | inputColor = inst.backColor; |
| | | |
| | | tinyMCE.execCommand('mceColorPicker', true, {color : inputColor, callback : function(c) { |
| | | tinyMCE.execInstanceCommand(id, cm, false, c); |
| | | }}); |
| | | }, |
| | | |
| | | _insertImage : function(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout) { |
| | | tinyMCE.execCommand("mceInsertContent", false, tinyMCE.createTagHTML('img', { |
| | | src : tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, src), // Force absolute |
| | | mce_src : src, |
| | | alt : alt, |
| | | border : border, |
| | | hspace : hspace, |
| | | vspace : vspace, |
| | | width : width, |
| | | height : height, |
| | | align : align, |
| | | title : title, |
| | | onmouseover : onmouseover, |
| | | onmouseout : onmouseout |
| | | })); |
| | | }, |
| | | |
| | | _insertLink : function(href, target, title, onclick, style_class) { |
| | | tinyMCE.execCommand('mceBeginUndoLevel'); |
| | | |
| | | if (tinyMCE.selectedInstance && tinyMCE.selectedElement && tinyMCE.selectedElement.nodeName.toLowerCase() == "img") { |
| | | var doc = tinyMCE.selectedInstance.getDoc(); |
| | | var linkElement = tinyMCE.getParentElement(tinyMCE.selectedElement, "a"); |
| | | var newLink = false; |
| | | |
| | | if (!linkElement) { |
| | | linkElement = doc.createElement("a"); |
| | | newLink = true; |
| | | } |
| | | |
| | | var mhref = href; |
| | | var thref = eval(tinyMCE.settings['urlconverter_callback'] + "(href, linkElement);"); |
| | | mhref = tinyMCE.getParam('convert_urls') ? href : mhref; |
| | | |
| | | tinyMCE.setAttrib(linkElement, 'href', thref); |
| | | tinyMCE.setAttrib(linkElement, 'mce_href', mhref); |
| | | tinyMCE.setAttrib(linkElement, 'target', target); |
| | | tinyMCE.setAttrib(linkElement, 'title', title); |
| | | tinyMCE.setAttrib(linkElement, 'onclick', onclick); |
| | | tinyMCE.setAttrib(linkElement, 'class', style_class); |
| | | |
| | | if (newLink) { |
| | | linkElement.appendChild(tinyMCE.selectedElement.cloneNode(true)); |
| | | tinyMCE.selectedElement.parentNode.replaceChild(linkElement, tinyMCE.selectedElement); |
| | | } |
| | | |
| | | return; |
| | | } |
| | | |
| | | if (!tinyMCE.linkElement && tinyMCE.selectedInstance) { |
| | | if (tinyMCE.isSafari) { |
| | | tinyMCE.execCommand("mceInsertContent", false, '<a href="' + tinyMCE.uniqueURL + '">' + tinyMCE.selectedInstance.selection.getSelectedHTML() + '</a>'); |
| | | } else |
| | | tinyMCE.selectedInstance.contentDocument.execCommand("createlink", false, tinyMCE.uniqueURL); |
| | | |
| | | tinyMCE.linkElement = tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body, "a", "href", tinyMCE.uniqueURL); |
| | | |
| | | var elementArray = tinyMCE.getElementsByAttributeValue(tinyMCE.selectedInstance.contentDocument.body, "a", "href", tinyMCE.uniqueURL); |
| | | |
| | | for (var i=0; i<elementArray.length; i++) { |
| | | var mhref = href; |
| | | var thref = eval(tinyMCE.settings['urlconverter_callback'] + "(href, elementArray[i]);"); |
| | | mhref = tinyMCE.getParam('convert_urls') ? href : mhref; |
| | | |
| | | tinyMCE.setAttrib(elementArray[i], 'href', thref); |
| | | tinyMCE.setAttrib(elementArray[i], 'mce_href', mhref); |
| | | tinyMCE.setAttrib(elementArray[i], 'target', target); |
| | | tinyMCE.setAttrib(elementArray[i], 'title', title); |
| | | tinyMCE.setAttrib(elementArray[i], 'onclick', onclick); |
| | | tinyMCE.setAttrib(elementArray[i], 'class', style_class); |
| | | } |
| | | |
| | | tinyMCE.linkElement = elementArray[0]; |
| | | } |
| | | |
| | | if (tinyMCE.linkElement) { |
| | | var mhref = href; |
| | | href = eval(tinyMCE.settings['urlconverter_callback'] + "(href, tinyMCE.linkElement);"); |
| | | mhref = tinyMCE.getParam('convert_urls') ? href : mhref; |
| | | |
| | | tinyMCE.setAttrib(tinyMCE.linkElement, 'href', href); |
| | | tinyMCE.setAttrib(tinyMCE.linkElement, 'mce_href', mhref); |
| | | tinyMCE.setAttrib(tinyMCE.linkElement, 'target', target); |
| | | tinyMCE.setAttrib(tinyMCE.linkElement, 'title', title); |
| | | tinyMCE.setAttrib(tinyMCE.linkElement, 'onclick', onclick); |
| | | tinyMCE.setAttrib(tinyMCE.linkElement, 'class', style_class); |
| | | } |
| | | |
| | | tinyMCE.execCommand('mceEndUndoLevel'); |
| | | } |
| | | }; |
| | | |
| | | tinyMCE.addTheme("advanced", TinyMCE_AdvancedTheme); |
| | | |
| | | // Add default buttons maps for advanced theme and all internal plugins |
| | | tinyMCE.addButtonMap(TinyMCE_AdvancedTheme._buttonMap); |
| | |
| | | <html xmlns="http://www.w3.org/1999/xhtml">
|
| | | <head>
|
| | | <title>{$lang_insert_image_title}</title>
|
| | | <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
| | | <script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
|
| | | <script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
|
| | | <script language="javascript" type="text/javascript" src="jscripts/image.js"></script>
|
| | | <base target="_self" />
|
| | | </head>
|
| | | <body id="image" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
|
| | | <form onsubmit="insertImage();return false;" action="#">
|
| | | <div class="tabs">
|
| | | <ul>
|
| | | <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_insert_image_title}</a></span></li>
|
| | | </ul>
|
| | | </div>
|
| | |
|
| | | <div class="panel_wrapper">
|
| | | <div id="general_panel" class="panel current">
|
| | | <table border="0" cellpadding="4" cellspacing="0">
|
| | | <tr>
|
| | | <td nowrap="nowrap"><label for="src">{$lang_insert_image_src}</label></td>
|
| | | <td><table border="0" cellspacing="0" cellpadding="0">
|
| | | <tr>
|
| | | <td><input id="src" name="src" type="text" value="" style="width: 200px" onchange="getImageData();" /></td>
|
| | | <td id="srcbrowsercontainer"> </td>
|
| | | </tr>
|
| | | </table></td>
|
| | | </tr>
|
| | | <!-- Image list -->
|
| | | <script language="javascript">
|
| | | if (typeof(tinyMCEImageList) != "undefined" && tinyMCEImageList.length > 0) {
|
| | | var html = "";
|
| | |
|
| | | html += '<tr><td><label for="image_list">{$lang_image_list}</label></td>';
|
| | | html += '<td><select id="image_list" name="image_list" style="width: 200px" onchange="this.form.src.value=this.options[this.selectedIndex].value;resetImageData();getImageData();">';
|
| | | html += '<option value="">---</option>';
|
| | |
|
| | | for (var i=0; i<tinyMCEImageList.length; i++)
|
| | | html += '<option value="' + tinyMCEImageList[i][1] + '">' + tinyMCEImageList[i][0] + '</option>';
|
| | |
|
| | | html += '</select></td></tr>';
|
| | |
|
| | | document.write(html);
|
| | | }
|
| | | </script>
|
| | | <!-- /Image list -->
|
| | | <tr>
|
| | | <td nowrap="nowrap"><label for="alt">{$lang_insert_image_alt}</label></td>
|
| | | <td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td>
|
| | | </tr>
|
| | | <tr>
|
| | | <td nowrap="nowrap"><label for="align">{$lang_insert_image_align}</label></td>
|
| | | <td><select id="align" name="align">
|
| | | <option value="">{$lang_insert_image_align_default}</option>
|
| | | <option value="baseline">{$lang_insert_image_align_baseline}</option>
|
| | | <option value="top">{$lang_insert_image_align_top}</option>
|
| | | <option value="middle">{$lang_insert_image_align_middle}</option>
|
| | | <option value="bottom">{$lang_insert_image_align_bottom}</option>
|
| | | <option value="texttop">{$lang_insert_image_align_texttop}</option>
|
| | | <option value="absmiddle">{$lang_insert_image_align_absmiddle}</option>
|
| | | <option value="absbottom">{$lang_insert_image_align_absbottom}</option>
|
| | | <option value="left">{$lang_insert_image_align_left}</option>
|
| | | <option value="right">{$lang_insert_image_align_right}</option>
|
| | | </select></td>
|
| | | </tr>
|
| | | <tr>
|
| | | <td nowrap="nowrap"><label for="width">{$lang_insert_image_dimensions}</label></td>
|
| | | <td><input id="width" name="width" type="text" value="" size="3" maxlength="5" />
|
| | | x
|
| | | <input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td>
|
| | | </tr>
|
| | | <tr>
|
| | | <td nowrap="nowrap"><label for="border">{$lang_insert_image_border}</label></td>
|
| | | <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" /></td>
|
| | | </tr>
|
| | | <tr>
|
| | | <td nowrap="nowrap"><label for="vspace">{$lang_insert_image_vspace}</label></td>
|
| | | <td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" /></td>
|
| | | </tr>
|
| | | <tr>
|
| | | <td nowrap="nowrap"><label for="hspace">{$lang_insert_image_hspace}</label></td>
|
| | | <td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" /></td>
|
| | | </tr>
|
| | | </table>
|
| | | </div>
|
| | | </div>
|
| | |
|
| | | <div class="mceActionPanel">
|
| | | <div style="float: left">
|
| | | <input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertImage();" />
|
| | | </div>
|
| | |
|
| | | <div style="float: right">
|
| | | <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
|
| | | </div>
|
| | | </div>
|
| | | </form>
|
| | | </body>
|
| | | </html>
|
| | | <html xmlns="http://www.w3.org/1999/xhtml"> |
| | | <head> |
| | | <title>{$lang_insert_image_title}</title> |
| | | <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script> |
| | | <script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script> |
| | | <script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script> |
| | | <script language="javascript" type="text/javascript" src="jscripts/image.js"></script> |
| | | <base target="_self" /> |
| | | </head> |
| | | <body id="image" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none"> |
| | | <form onsubmit="insertImage();return false;" action="#"> |
| | | <div class="tabs"> |
| | | <ul> |
| | | <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_insert_image_title}</a></span></li> |
| | | </ul> |
| | | </div> |
| | | |
| | | <div class="panel_wrapper"> |
| | | <div id="general_panel" class="panel current"> |
| | | <table border="0" cellpadding="4" cellspacing="0"> |
| | | <tr> |
| | | <td nowrap="nowrap"><label for="src">{$lang_insert_image_src}</label></td> |
| | | <td><table border="0" cellspacing="0" cellpadding="0"> |
| | | <tr> |
| | | <td><input id="src" name="src" type="text" value="" style="width: 200px" onchange="getImageData();" /></td> |
| | | <td id="srcbrowsercontainer"> </td> |
| | | </tr> |
| | | </table></td> |
| | | </tr> |
| | | <!-- Image list --> |
| | | <script language="javascript"> |
| | | if (typeof(tinyMCEImageList) != "undefined" && tinyMCEImageList.length > 0) { |
| | | var html = ""; |
| | | |
| | | html += '<tr><td><label for="image_list">{$lang_image_list}</label></td>'; |
| | | html += '<td><select id="image_list" name="image_list" style="width: 200px" onchange="this.form.src.value=this.options[this.selectedIndex].value;resetImageData();getImageData();">'; |
| | | html += '<option value="">---</option>'; |
| | | |
| | | for (var i=0; i<tinyMCEImageList.length; i++) |
| | | html += '<option value="' + tinyMCEImageList[i][1] + '">' + tinyMCEImageList[i][0] + '</option>'; |
| | | |
| | | html += '</select></td></tr>'; |
| | | |
| | | document.write(html); |
| | | } |
| | | </script> |
| | | <!-- /Image list --> |
| | | <tr> |
| | | <td nowrap="nowrap"><label for="alt">{$lang_insert_image_alt}</label></td> |
| | | <td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td> |
| | | </tr> |
| | | <tr> |
| | | <td nowrap="nowrap"><label for="align">{$lang_insert_image_align}</label></td> |
| | | <td><select id="align" name="align"> |
| | | <option value="">{$lang_insert_image_align_default}</option> |
| | | <option value="baseline">{$lang_insert_image_align_baseline}</option> |
| | | <option value="top">{$lang_insert_image_align_top}</option> |
| | | <option value="middle">{$lang_insert_image_align_middle}</option> |
| | | <option value="bottom">{$lang_insert_image_align_bottom}</option> |
| | | <option value="texttop">{$lang_insert_image_align_texttop}</option> |
| | | <option value="absmiddle">{$lang_insert_image_align_absmiddle}</option> |
| | | <option value="absbottom">{$lang_insert_image_align_absbottom}</option> |
| | | <option value="left">{$lang_insert_image_align_left}</option> |
| | | <option value="right">{$lang_insert_image_align_right}</option> |
| | | </select></td> |
| | | </tr> |
| | | <tr> |
| | | <td nowrap="nowrap"><label for="width">{$lang_insert_image_dimensions}</label></td> |
| | | <td><input id="width" name="width" type="text" value="" size="3" maxlength="5" /> |
| | | x |
| | | <input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td> |
| | | </tr> |
| | | <tr> |
| | | <td nowrap="nowrap"><label for="border">{$lang_insert_image_border}</label></td> |
| | | <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" /></td> |
| | | </tr> |
| | | <tr> |
| | | <td nowrap="nowrap"><label for="vspace">{$lang_insert_image_vspace}</label></td> |
| | | <td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" /></td> |
| | | </tr> |
| | | <tr> |
| | | <td nowrap="nowrap"><label for="hspace">{$lang_insert_image_hspace}</label></td> |
| | | <td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" /></td> |
| | | </tr> |
| | | </table> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="mceActionPanel"> |
| | | <div style="float: left"> |
| | | <input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertImage();" /> |
| | | </div> |
| | | |
| | | <div style="float: right"> |
| | | <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" /> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | </body> |
| | | </html> |
| | |
| | | // Some global instances, this will be filled later
|
| | | var tinyMCE = null, tinyMCELang = null;
|
| | |
|
| | | function TinyMCE_Popup() {
|
| | | };
|
| | |
|
| | | TinyMCE_Popup.prototype = {
|
| | | findWin : function(w) {
|
| | | var c;
|
| | |
|
| | | // Check parents
|
| | | c = w;
|
| | | while (c && (c = c.parent) != null) {
|
| | | if (typeof(c.tinyMCE) != "undefined")
|
| | | return c;
|
| | | }
|
| | |
|
| | | // Check openers
|
| | | c = w;
|
| | | while (c && (c = c.opener) != null) {
|
| | | if (typeof(c.tinyMCE) != "undefined")
|
| | | return c;
|
| | | }
|
| | |
|
| | | // Try top
|
| | | if (typeof(top.tinyMCE) != "undefined")
|
| | | return top;
|
| | |
|
| | | return null;
|
| | | },
|
| | |
|
| | | init : function() {
|
| | | var win = window.opener ? window.opener : window.dialogArguments, c;
|
| | | var inst, re, title, divElm;
|
| | |
|
| | | if (!win)
|
| | | win = this.findWin(window);
|
| | |
|
| | | if (!win) {
|
| | | alert("tinyMCE object reference not found from popup.");
|
| | | return;
|
| | | }
|
| | |
|
| | | window.opener = win;
|
| | | this.windowOpener = win;
|
| | | this.onLoadEval = "";
|
| | |
|
| | | // Setup parent references
|
| | | tinyMCE = win.tinyMCE;
|
| | | tinyMCELang = win.tinyMCELang;
|
| | |
|
| | | inst = tinyMCE.selectedInstance;
|
| | | this.isWindow = tinyMCE.getWindowArg('mce_inside_iframe', false) == false;
|
| | | this.storeSelection = (tinyMCE.isRealIE) && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true);
|
| | |
|
| | | if (this.isWindow)
|
| | | window.focus();
|
| | |
|
| | | // Store selection
|
| | | if (this.storeSelection)
|
| | | inst.selectionBookmark = inst.selection.getBookmark(true);
|
| | |
|
| | | // Setup dir
|
| | | if (tinyMCELang.lang_dir)
|
| | | document.dir = tinyMCELang.lang_dir;
|
| | |
|
| | | // Setup title
|
| | | re = new RegExp('{|\\\$|}', 'g');
|
| | | title = document.title.replace(re, "");
|
| | | if (typeof(tinyMCELang[title]) != "undefined") {
|
| | | divElm = document.createElement("div");
|
| | | divElm.innerHTML = tinyMCELang[title];
|
| | | document.title = divElm.innerHTML;
|
| | |
|
| | | if (typeof(tinyMCE.setWindowTitle) != 'undefined')
|
| | | tinyMCE.setWindowTitle(window, divElm.innerHTML);
|
| | | }
|
| | |
|
| | | // Output Popup CSS class
|
| | | document.write('<link href="' + tinyMCE.getParam("popups_css") + '" rel="stylesheet" type="text/css">');
|
| | |
|
| | | if (tinyMCE.getParam("popups_css_add")) {
|
| | | c = tinyMCE.getParam("popups_css_add");
|
| | |
|
| | | // Is relative
|
| | | if (c.indexOf('://') == -1 && c.charAt(0) != '/')
|
| | | c = tinyMCE.documentBasePath + "/" + c;
|
| | |
|
| | | document.write('<link href="' + c + '" rel="stylesheet" type="text/css">');
|
| | | }
|
| | |
|
| | | tinyMCE.addEvent(window, "load", this.onLoad);
|
| | | },
|
| | |
|
| | | onLoad : function() {
|
| | | var dir, i, elms, body = document.body;
|
| | |
|
| | | if (tinyMCE.getWindowArg('mce_replacevariables', true))
|
| | | body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs);
|
| | |
|
| | | dir = tinyMCE.selectedInstance.settings.directionality;
|
| | | if (dir == "rtl" && document.forms && document.forms.length > 0) {
|
| | | elms = document.forms[0].elements;
|
| | | for (i=0; i<elms.length; i++) {
|
| | | if ((elms[i].type == "text" || elms[i].type == "textarea") && elms[i].getAttribute("dir") != "ltr")
|
| | | elms[i].dir = dir;
|
| | | }
|
| | | }
|
| | |
|
| | | if (body.style.display == 'none')
|
| | | body.style.display = 'block';
|
| | |
|
| | | // Execute real onload (Opera fix)
|
| | | if (tinyMCEPopup.onLoadEval !== '')
|
| | | eval(tinyMCEPopup.onLoadEval);
|
| | | },
|
| | |
|
| | | executeOnLoad : function(str) {
|
| | | if (tinyMCE.isOpera && parseFloat(opera.version()) < 9.5)
|
| | | this.onLoadEval = str;
|
| | | else
|
| | | eval(str);
|
| | | },
|
| | |
|
| | | resizeToInnerSize : function() {
|
| | | var i, doc, body, oldMargin, wrapper, iframe, nodes, dx, dy;
|
| | |
|
| | | // Netscape 7.1 workaround
|
| | | if (this.isWindow && tinyMCE.isNS71) {
|
| | | window.resizeBy(0, 10);
|
| | | return;
|
| | | }
|
| | |
|
| | | if (this.isWindow) {
|
| | | doc = document;
|
| | | body = doc.body;
|
| | |
|
| | | if (body.style.display == 'none')
|
| | | body.style.display = 'block';
|
| | |
|
| | | // Remove margin
|
| | | oldMargin = body.style.margin;
|
| | | body.style.margin = '0';
|
| | |
|
| | | // Create wrapper
|
| | | wrapper = doc.createElement("div");
|
| | | wrapper.id = 'mcBodyWrapper';
|
| | | wrapper.style.display = 'none';
|
| | | wrapper.style.margin = '0';
|
| | |
|
| | | // Wrap body elements
|
| | | nodes = doc.body.childNodes;
|
| | | for (i=nodes.length-1; i>=0; i--) {
|
| | | if (wrapper.hasChildNodes())
|
| | | wrapper.insertBefore(nodes[i].cloneNode(true), wrapper.firstChild);
|
| | | else
|
| | | wrapper.appendChild(nodes[i].cloneNode(true));
|
| | |
|
| | | nodes[i].parentNode.removeChild(nodes[i]);
|
| | | }
|
| | |
|
| | | // Add wrapper
|
| | | doc.body.appendChild(wrapper);
|
| | |
|
| | | // Create iframe
|
| | | iframe = document.createElement("iframe");
|
| | | iframe.id = "mcWinIframe";
|
| | | iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings.default_document;
|
| | | iframe.width = "100%";
|
| | | iframe.height = "100%";
|
| | | iframe.style.margin = '0';
|
| | |
|
| | | // Add iframe
|
| | | doc.body.appendChild(iframe);
|
| | |
|
| | | // Measure iframe
|
| | | iframe = document.getElementById('mcWinIframe');
|
| | | dx = tinyMCE.getWindowArg('mce_width') - iframe.clientWidth;
|
| | | dy = tinyMCE.getWindowArg('mce_height') - iframe.clientHeight;
|
| | |
|
| | | // Resize window
|
| | | // tinyMCE.debug(tinyMCE.getWindowArg('mce_width') + "," + tinyMCE.getWindowArg('mce_height') + " - " + dx + "," + dy);
|
| | | window.resizeBy(dx, dy);
|
| | |
|
| | | // Hide iframe and show wrapper
|
| | | body.style.margin = oldMargin;
|
| | | iframe.style.display = 'none';
|
| | | wrapper.style.display = 'block';
|
| | | }
|
| | | },
|
| | |
|
| | | resizeToContent : function() {
|
| | | var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
|
| | | var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
|
| | | var elm, width, height, x, y, dx, dy;
|
| | |
|
| | | if (isOpera)
|
| | | return;
|
| | |
|
| | | if (isMSIE) {
|
| | | try { window.resizeTo(10, 10); } catch (e) {}
|
| | |
|
| | | elm = document.body;
|
| | | width = elm.offsetWidth;
|
| | | height = elm.offsetHeight;
|
| | | dx = (elm.scrollWidth - width) + 4;
|
| | | dy = elm.scrollHeight - height;
|
| | |
|
| | | try { window.resizeBy(dx, dy); } catch (e) {}
|
| | | } else {
|
| | | window.scrollBy(1000, 1000);
|
| | | if (window.scrollX > 0 || window.scrollY > 0) {
|
| | | window.resizeBy(window.innerWidth * 2, window.innerHeight * 2);
|
| | | window.sizeToContent();
|
| | | window.scrollTo(0, 0);
|
| | | x = parseInt(screen.width / 2.0) - (window.outerWidth / 2.0);
|
| | | y = parseInt(screen.height / 2.0) - (window.outerHeight / 2.0);
|
| | | window.moveTo(x, y);
|
| | | }
|
| | | }
|
| | | },
|
| | |
|
| | | getWindowArg : function(name, default_value) {
|
| | | return tinyMCE.getWindowArg(name, default_value);
|
| | | },
|
| | |
|
| | | restoreSelection : function() {
|
| | | var inst;
|
| | |
|
| | | if (this.storeSelection) {
|
| | | inst = tinyMCE.selectedInstance;
|
| | |
|
| | | inst.getWin().focus();
|
| | |
|
| | | if (inst.selectionBookmark)
|
| | | inst.selection.moveToBookmark(inst.selectionBookmark);
|
| | | }
|
| | | },
|
| | |
|
| | | execCommand : function(command, user_interface, value) {
|
| | | var inst = tinyMCE.selectedInstance;
|
| | |
|
| | | this.restoreSelection();
|
| | | inst.execCommand(command, user_interface, value);
|
| | |
|
| | | // Store selection
|
| | | if (this.storeSelection)
|
| | | inst.selectionBookmark = inst.selection.getBookmark(true);
|
| | | },
|
| | |
|
| | | close : function() {
|
| | | tinyMCE.closeWindow(window);
|
| | | },
|
| | |
|
| | | pickColor : function(e, element_id) {
|
| | | tinyMCE.selectedInstance.execCommand('mceColorPicker', true, {
|
| | | element_id : element_id,
|
| | | document : document,
|
| | | window : window,
|
| | | store_selection : false
|
| | | });
|
| | | },
|
| | |
|
| | | openBrowser : function(element_id, type, option) {
|
| | | var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
|
| | | var url = document.getElementById(element_id).value;
|
| | |
|
| | | tinyMCE.setWindowArg("window", window);
|
| | | tinyMCE.setWindowArg("document", document);
|
| | |
|
| | | // Call to external callback
|
| | | if (eval('typeof(tinyMCEPopup.windowOpener.' + cb + ')') == "undefined")
|
| | | alert("Callback function: " + cb + " could not be found.");
|
| | | else
|
| | | eval("tinyMCEPopup.windowOpener." + cb + "(element_id, url, type, window);");
|
| | | },
|
| | |
|
| | | importClass : function(c) {
|
| | | var n;
|
| | |
|
| | | window[c] = function() {};
|
| | |
|
| | | for (n in window.opener[c].prototype)
|
| | | window[c].prototype[n] = window.opener[c].prototype[n];
|
| | |
|
| | | window[c].constructor = window.opener[c].constructor;
|
| | | }
|
| | |
|
| | | };
|
| | |
|
| | | // Setup global instance
|
| | | var tinyMCEPopup = new TinyMCE_Popup();
|
| | |
|
| | | tinyMCEPopup.init();
|
| | | // Some global instances, this will be filled later |
| | | var tinyMCE = null, tinyMCELang = null; |
| | | |
| | | function TinyMCE_Popup() { |
| | | }; |
| | | |
| | | TinyMCE_Popup.prototype = { |
| | | findWin : function(w) { |
| | | var c; |
| | | |
| | | // Check parents |
| | | c = w; |
| | | while (c && (c = c.parent) != null) { |
| | | if (typeof(c.tinyMCE) != "undefined") |
| | | return c; |
| | | } |
| | | |
| | | // Check openers |
| | | c = w; |
| | | while (c && (c = c.opener) != null) { |
| | | if (typeof(c.tinyMCE) != "undefined") |
| | | return c; |
| | | } |
| | | |
| | | // Try top |
| | | if (typeof(top.tinyMCE) != "undefined") |
| | | return top; |
| | | |
| | | return null; |
| | | }, |
| | | |
| | | init : function() { |
| | | var win = window.opener ? window.opener : window.dialogArguments, c; |
| | | var inst, re, title, divElm; |
| | | |
| | | if (!win) |
| | | win = this.findWin(window); |
| | | |
| | | if (!win) { |
| | | alert("tinyMCE object reference not found from popup."); |
| | | return; |
| | | } |
| | | |
| | | window.opener = win; |
| | | this.windowOpener = win; |
| | | this.onLoadEval = ""; |
| | | |
| | | // Setup parent references |
| | | tinyMCE = win.tinyMCE; |
| | | tinyMCELang = win.tinyMCELang; |
| | | |
| | | inst = tinyMCE.selectedInstance; |
| | | this.isWindow = tinyMCE.getWindowArg('mce_inside_iframe', false) == false; |
| | | this.storeSelection = (tinyMCE.isRealIE) && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true); |
| | | |
| | | if (this.isWindow) |
| | | window.focus(); |
| | | |
| | | // Store selection |
| | | if (this.storeSelection) |
| | | inst.selectionBookmark = inst.selection.getBookmark(true); |
| | | |
| | | // Setup dir |
| | | if (tinyMCELang.lang_dir) |
| | | document.dir = tinyMCELang.lang_dir; |
| | | |
| | | // Setup title |
| | | re = new RegExp('{|\\\$|}', 'g'); |
| | | title = document.title.replace(re, ""); |
| | | if (typeof(tinyMCELang[title]) != "undefined") { |
| | | divElm = document.createElement("div"); |
| | | divElm.innerHTML = tinyMCELang[title]; |
| | | document.title = divElm.innerHTML; |
| | | |
| | | if (typeof(tinyMCE.setWindowTitle) != 'undefined') |
| | | tinyMCE.setWindowTitle(window, divElm.innerHTML); |
| | | } |
| | | |
| | | // Output Popup CSS class |
| | | document.write('<link href="' + tinyMCE.getParam("popups_css") + '" rel="stylesheet" type="text/css">'); |
| | | |
| | | if (tinyMCE.getParam("popups_css_add")) { |
| | | c = tinyMCE.getParam("popups_css_add"); |
| | | |
| | | // Is relative |
| | | if (c.indexOf('://') == -1 && c.charAt(0) != '/') |
| | | c = tinyMCE.documentBasePath + "/" + c; |
| | | |
| | | document.write('<link href="' + c + '" rel="stylesheet" type="text/css">'); |
| | | } |
| | | |
| | | tinyMCE.addEvent(window, "load", this.onLoad); |
| | | }, |
| | | |
| | | onLoad : function() { |
| | | var dir, i, elms, body = document.body; |
| | | |
| | | if (tinyMCE.getWindowArg('mce_replacevariables', true)) |
| | | body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs); |
| | | |
| | | dir = tinyMCE.selectedInstance.settings.directionality; |
| | | if (dir == "rtl" && document.forms && document.forms.length > 0) { |
| | | elms = document.forms[0].elements; |
| | | for (i=0; i<elms.length; i++) { |
| | | if ((elms[i].type == "text" || elms[i].type == "textarea") && elms[i].getAttribute("dir") != "ltr") |
| | | elms[i].dir = dir; |
| | | } |
| | | } |
| | | |
| | | if (body.style.display == 'none') |
| | | body.style.display = 'block'; |
| | | |
| | | // Execute real onload (Opera fix) |
| | | if (tinyMCEPopup.onLoadEval !== '') |
| | | eval(tinyMCEPopup.onLoadEval); |
| | | }, |
| | | |
| | | executeOnLoad : function(str) { |
| | | if (tinyMCE.isOpera && parseFloat(opera.version()) < 9.5) |
| | | this.onLoadEval = str; |
| | | else |
| | | eval(str); |
| | | }, |
| | | |
| | | resizeToInnerSize : function() { |
| | | var i, doc, body, oldMargin, wrapper, iframe, nodes, dx, dy; |
| | | |
| | | // Netscape 7.1 workaround |
| | | if (this.isWindow && tinyMCE.isNS71) { |
| | | window.resizeBy(0, 10); |
| | | return; |
| | | } |
| | | |
| | | if (this.isWindow) { |
| | | doc = document; |
| | | body = doc.body; |
| | | |
| | | if (body.style.display == 'none') |
| | | body.style.display = 'block'; |
| | | |
| | | // Remove margin |
| | | oldMargin = body.style.margin; |
| | | body.style.margin = '0'; |
| | | |
| | | // Create wrapper |
| | | wrapper = doc.createElement("div"); |
| | | wrapper.id = 'mcBodyWrapper'; |
| | | wrapper.style.display = 'none'; |
| | | wrapper.style.margin = '0'; |
| | | |
| | | // Wrap body elements |
| | | nodes = doc.body.childNodes; |
| | | for (i=nodes.length-1; i>=0; i--) { |
| | | if (wrapper.hasChildNodes()) |
| | | wrapper.insertBefore(nodes[i].cloneNode(true), wrapper.firstChild); |
| | | else |
| | | wrapper.appendChild(nodes[i].cloneNode(true)); |
| | | |
| | | nodes[i].parentNode.removeChild(nodes[i]); |
| | | } |
| | | |
| | | // Add wrapper |
| | | doc.body.appendChild(wrapper); |
| | | |
| | | // Create iframe |
| | | iframe = document.createElement("iframe"); |
| | | iframe.id = "mcWinIframe"; |
| | | iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings.default_document; |
| | | iframe.width = "100%"; |
| | | iframe.height = "100%"; |
| | | iframe.style.margin = '0'; |
| | | |
| | | // Add iframe |
| | | doc.body.appendChild(iframe); |
| | | |
| | | // Measure iframe |
| | | iframe = document.getElementById('mcWinIframe'); |
| | | dx = tinyMCE.getWindowArg('mce_width') - iframe.clientWidth; |
| | | dy = tinyMCE.getWindowArg('mce_height') - iframe.clientHeight; |
| | | |
| | | // Resize window |
| | | // tinyMCE.debug(tinyMCE.getWindowArg('mce_width') + "," + tinyMCE.getWindowArg('mce_height') + " - " + dx + "," + dy); |
| | | window.resizeBy(dx, dy); |
| | | |
| | | // Hide iframe and show wrapper |
| | | body.style.margin = oldMargin; |
| | | iframe.style.display = 'none'; |
| | | wrapper.style.display = 'block'; |
| | | } |
| | | }, |
| | | |
| | | resizeToContent : function() { |
| | | var isMSIE = (navigator.appName == "Microsoft Internet Explorer"); |
| | | var isOpera = (navigator.userAgent.indexOf("Opera") != -1); |
| | | var elm, width, height, x, y, dx, dy; |
| | | |
| | | if (isOpera) |
| | | return; |
| | | |
| | | if (isMSIE) { |
| | | try { window.resizeTo(10, 10); } catch (e) {} |
| | | |
| | | elm = document.body; |
| | | width = elm.offsetWidth; |
| | | height = elm.offsetHeight; |
| | | dx = (elm.scrollWidth - width) + 4; |
| | | dy = elm.scrollHeight - height; |
| | | |
| | | try { window.resizeBy(dx, dy); } catch (e) {} |
| | | } else { |
| | | window.scrollBy(1000, 1000); |
| | | if (window.scrollX > 0 || window.scrollY > 0) { |
| | | window.resizeBy(window.innerWidth * 2, window.innerHeight * 2); |
| | | window.sizeToContent(); |
| | | window.scrollTo(0, 0); |
| | | x = parseInt(screen.width / 2.0) - (window.outerWidth / 2.0); |
| | | y = parseInt(screen.height / 2.0) - (window.outerHeight / 2.0); |
| | | window.moveTo(x, y); |
| | | } |
| | | } |
| | | }, |
| | | |
| | | getWindowArg : function(name, default_value) { |
| | | return tinyMCE.getWindowArg(name, default_value); |
| | | }, |
| | | |
| | | restoreSelection : function() { |
| | | var inst; |
| | | |
| | | if (this.storeSelection) { |
| | | inst = tinyMCE.selectedInstance; |
| | | |
| | | inst.getWin().focus(); |
| | | |
| | | if (inst.selectionBookmark) |
| | | inst.selection.moveToBookmark(inst.selectionBookmark); |
| | | } |
| | | }, |
| | | |
| | | execCommand : function(command, user_interface, value) { |
| | | var inst = tinyMCE.selectedInstance; |
| | | |
| | | this.restoreSelection(); |
| | | inst.execCommand(command, user_interface, value); |
| | | |
| | | // Store selection |
| | | if (this.storeSelection) |
| | | inst.selectionBookmark = inst.selection.getBookmark(true); |
| | | }, |
| | | |
| | | close : function() { |
| | | tinyMCE.closeWindow(window); |
| | | }, |
| | | |
| | | pickColor : function(e, element_id) { |
| | | tinyMCE.selectedInstance.execCommand('mceColorPicker', true, { |
| | | element_id : element_id, |
| | | document : document, |
| | | window : window, |
| | | store_selection : false |
| | | }); |
| | | }, |
| | | |
| | | openBrowser : function(element_id, type, option) { |
| | | var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback")); |
| | | var url = document.getElementById(element_id).value; |
| | | |
| | | tinyMCE.setWindowArg("window", window); |
| | | tinyMCE.setWindowArg("document", document); |
| | | |
| | | // Call to external callback |
| | | if (eval('typeof(tinyMCEPopup.windowOpener.' + cb + ')') == "undefined") |
| | | alert("Callback function: " + cb + " could not be found."); |
| | | else |
| | | eval("tinyMCEPopup.windowOpener." + cb + "(element_id, url, type, window);"); |
| | | }, |
| | | |
| | | importClass : function(c) { |
| | | var n; |
| | | |
| | | window[c] = function() {}; |
| | | |
| | | for (n in window.opener[c].prototype) |
| | | window[c].prototype[n] = window.opener[c].prototype[n]; |
| | | |
| | | window[c].constructor = window.opener[c].constructor; |
| | | } |
| | | |
| | | }; |
| | | |
| | | // Setup global instance |
| | | var tinyMCEPopup = new TinyMCE_Popup(); |
| | | |
| | | tinyMCEPopup.init(); |
| | |
| | | /**
|
| | | * $Id: editable_selects.js 162 2007-01-03 16:16:52Z spocke $
|
| | | *
|
| | | * Makes select boxes editable.
|
| | | *
|
| | | * @author Moxiecode
|
| | | * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
| | | */
|
| | |
|
| | | var TinyMCE_EditableSelects = {
|
| | | editSelectElm : null,
|
| | |
|
| | | init : function() {
|
| | | var nl = document.getElementsByTagName("select"), i, d = document, o;
|
| | |
|
| | | for (i=0; i<nl.length; i++) {
|
| | | if (nl[i].className.indexOf('mceEditableSelect') != -1) {
|
| | | o = new Option('(value)', '__mce_add_custom__');
|
| | |
|
| | | o.className = 'mceAddSelectValue';
|
| | |
|
| | | nl[i].options[nl[i].options.length] = o;
|
| | | nl[i].setAttribute('onchange', 'TinyMCE_EditableSelects.onChangeEditableSelect(this);');
|
| | | }
|
| | | }
|
| | | },
|
| | |
|
| | | onChangeEditableSelect : function(se) {
|
| | | var d = document, ne;
|
| | |
|
| | | if (se.options[se.selectedIndex].value == '__mce_add_custom__') {
|
| | | ne = d.createElement("input");
|
| | | ne.id = se.id + "_custom";
|
| | | ne.name = se.name + "_custom";
|
| | | ne.type = "text";
|
| | |
|
| | | ne.style.width = se.clientWidth;
|
| | | se.parentNode.insertBefore(ne, se);
|
| | | se.style.display = 'none';
|
| | | ne.focus();
|
| | | ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput;
|
| | | TinyMCE_EditableSelects.editSelectElm = se;
|
| | | }
|
| | | },
|
| | |
|
| | | onBlurEditableSelectInput : function() {
|
| | | var se = TinyMCE_EditableSelects.editSelectElm;
|
| | |
|
| | | if (se) {
|
| | | if (se.previousSibling.value != '') {
|
| | | addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value);
|
| | | selectByValue(document.forms[0], se.id, se.previousSibling.value);
|
| | | } else
|
| | | selectByValue(document.forms[0], se.id, '');
|
| | |
|
| | | se.style.display = 'inline';
|
| | | se.parentNode.removeChild(se.previousSibling);
|
| | | TinyMCE_EditableSelects.editSelectElm = null;
|
| | | }
|
| | | }
|
| | | };
|
| | | /** |
| | | * $Id: editable_selects.js 162 2007-01-03 16:16:52Z spocke $ |
| | | * |
| | | * Makes select boxes editable. |
| | | * |
| | | * @author Moxiecode |
| | | * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. |
| | | */ |
| | | |
| | | var TinyMCE_EditableSelects = { |
| | | editSelectElm : null, |
| | | |
| | | init : function() { |
| | | var nl = document.getElementsByTagName("select"), i, d = document, o; |
| | | |
| | | for (i=0; i<nl.length; i++) { |
| | | if (nl[i].className.indexOf('mceEditableSelect') != -1) { |
| | | o = new Option('(value)', '__mce_add_custom__'); |
| | | |
| | | o.className = 'mceAddSelectValue'; |
| | | |
| | | nl[i].options[nl[i].options.length] = o; |
| | | nl[i].setAttribute('onchange', 'TinyMCE_EditableSelects.onChangeEditableSelect(this);'); |
| | | } |
| | | } |
| | | }, |
| | | |
| | | onChangeEditableSelect : function(se) { |
| | | var d = document, ne; |
| | | |
| | | if (se.options[se.selectedIndex].value == '__mce_add_custom__') { |
| | | ne = d.createElement("input"); |
| | | ne.id = se.id + "_custom"; |
| | | ne.name = se.name + "_custom"; |
| | | ne.type = "text"; |
| | | |
| | | ne.style.width = se.clientWidth; |
| | | se.parentNode.insertBefore(ne, se); |
| | | se.style.display = 'none'; |
| | | ne.focus(); |
| | | ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput; |
| | | TinyMCE_EditableSelects.editSelectElm = se; |
| | | } |
| | | }, |
| | | |
| | | onBlurEditableSelectInput : function() { |
| | | var se = TinyMCE_EditableSelects.editSelectElm; |
| | | |
| | | if (se) { |
| | | if (se.previousSibling.value != '') { |
| | | addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value); |
| | | selectByValue(document.forms[0], se.id, se.previousSibling.value); |
| | | } else |
| | | selectByValue(document.forms[0], se.id, ''); |
| | | |
| | | se.style.display = 'inline'; |
| | | se.parentNode.removeChild(se.previousSibling); |
| | | TinyMCE_EditableSelects.editSelectElm = null; |
| | | } |
| | | } |
| | | }; |
| | |
| | | /**
|
| | | * $Id: form_utils.js 162 2007-01-03 16:16:52Z spocke $
|
| | | *
|
| | | * Various form utilitiy functions.
|
| | | *
|
| | | * @author Moxiecode
|
| | | * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
| | | */
|
| | |
|
| | | var themeBaseURL = tinyMCE.baseURL + '/themes/' + tinyMCE.getParam("theme");
|
| | |
|
| | | function getColorPickerHTML(id, target_form_element) {
|
| | | var h = "";
|
| | |
|
| | | h += '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">';
|
| | | h += '<img id="' + id + '" src="' + themeBaseURL + '/images/color.gif"';
|
| | | h += ' onmouseover="this.className=\'mceButtonOver\'"';
|
| | | h += ' onmouseout="this.className=\'mceButtonNormal\'"';
|
| | | h += ' onmousedown="this.className=\'mceButtonDown\'"';
|
| | | h += ' width="20" height="16" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
|
| | | h += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
|
| | |
|
| | | return h;
|
| | | }
|
| | |
|
| | | function pickColor(e, target_form_element) {
|
| | | if ((e.keyCode == 32 || e.keyCode == 13) || e.type == "mousedown")
|
| | | tinyMCEPopup.pickColor(e, target_form_element);
|
| | | }
|
| | |
|
| | | function updateColor(img_id, form_element_id) {
|
| | | document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
|
| | | }
|
| | |
|
| | | function setBrowserDisabled(id, state) {
|
| | | var img = document.getElementById(id);
|
| | | var lnk = document.getElementById(id + "_link");
|
| | |
|
| | | if (lnk) {
|
| | | if (state) {
|
| | | lnk.setAttribute("realhref", lnk.getAttribute("href"));
|
| | | lnk.removeAttribute("href");
|
| | | tinyMCE.switchClass(img, 'mceButtonDisabled', true);
|
| | | } else {
|
| | | lnk.setAttribute("href", lnk.getAttribute("realhref"));
|
| | | tinyMCE.switchClass(img, 'mceButtonNormal', false);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | function getBrowserHTML(id, target_form_element, type, prefix) {
|
| | | var option = prefix + "_" + type + "_browser_callback";
|
| | | var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
|
| | | if (cb == null)
|
| | | return "";
|
| | |
|
| | | var html = "";
|
| | |
|
| | | html += '<a id="' + id + '_link" href="javascript:openBrower(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;">';
|
| | | html += '<img id="' + id + '" src="' + themeBaseURL + '/images/browse.gif"';
|
| | | html += ' onmouseover="this.className=\'mceButtonOver\';"';
|
| | | html += ' onmouseout="this.className=\'mceButtonNormal\';"';
|
| | | html += ' onmousedown="this.className=\'mceButtonDown\';"';
|
| | | html += ' width="20" height="18" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
|
| | | html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
|
| | |
|
| | | return html;
|
| | | }
|
| | |
|
| | | function openBrower(img_id, target_form_element, type, option) {
|
| | | var img = document.getElementById(img_id);
|
| | |
|
| | | if (img.className != "mceButtonDisabled")
|
| | | tinyMCEPopup.openBrowser(target_form_element, type, option);
|
| | | }
|
| | |
|
| | | function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
|
| | | if (!form_obj || !form_obj.elements[field_name])
|
| | | return;
|
| | |
|
| | | var sel = form_obj.elements[field_name];
|
| | |
|
| | | var found = false;
|
| | | for (var i=0; i<sel.options.length; i++) {
|
| | | var option = sel.options[i];
|
| | |
|
| | | if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
|
| | | option.selected = true;
|
| | | found = true;
|
| | | } else
|
| | | option.selected = false;
|
| | | }
|
| | |
|
| | | if (!found && add_custom && value != '') {
|
| | | var option = new Option(value, value);
|
| | | option.selected = true;
|
| | | sel.options[sel.options.length] = option;
|
| | | sel.selectedIndex = sel.options.length - 1;
|
| | | }
|
| | |
|
| | | return found;
|
| | | }
|
| | |
|
| | | function getSelectValue(form_obj, field_name) {
|
| | | var elm = form_obj.elements[field_name];
|
| | |
|
| | | if (elm == null || elm.options == null)
|
| | | return "";
|
| | |
|
| | | return elm.options[elm.selectedIndex].value;
|
| | | }
|
| | |
|
| | | function addSelectValue(form_obj, field_name, name, value) {
|
| | | var s = form_obj.elements[field_name];
|
| | | var o = new Option(name, value);
|
| | | s.options[s.options.length] = o;
|
| | | }
|
| | |
|
| | | function addClassesToList(list_id, specific_option) {
|
| | | // Setup class droplist
|
| | | var styleSelectElm = document.getElementById(list_id);
|
| | | var styles = tinyMCE.getParam('theme_advanced_styles', false);
|
| | | styles = tinyMCE.getParam(specific_option, styles);
|
| | |
|
| | | if (styles) {
|
| | | var stylesAr = styles.split(';');
|
| | |
|
| | | for (var i=0; i<stylesAr.length; i++) {
|
| | | if (stylesAr != "") {
|
| | | var key, value;
|
| | |
|
| | | key = stylesAr[i].split('=')[0];
|
| | | value = stylesAr[i].split('=')[1];
|
| | |
|
| | | styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
|
| | | }
|
| | | }
|
| | | } else {
|
| | | // Use auto impored classes
|
| | | var csses = tinyMCE.getCSSClasses(tinyMCE.getWindowArg('editor_id'));
|
| | | for (var i=0; i<csses.length; i++)
|
| | | styleSelectElm.options[styleSelectElm.length] = new Option(csses[i], csses[i]);
|
| | | }
|
| | | }
|
| | |
|
| | | function isVisible(element_id) {
|
| | | var elm = document.getElementById(element_id);
|
| | |
|
| | | return elm && elm.style.display != "none";
|
| | | }
|
| | |
|
| | | function convertRGBToHex(col) {
|
| | | var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
|
| | |
|
| | | var rgb = col.replace(re, "$1,$2,$3").split(',');
|
| | | if (rgb.length == 3) {
|
| | | r = parseInt(rgb[0]).toString(16);
|
| | | g = parseInt(rgb[1]).toString(16);
|
| | | b = parseInt(rgb[2]).toString(16);
|
| | |
|
| | | r = r.length == 1 ? '0' + r : r;
|
| | | g = g.length == 1 ? '0' + g : g;
|
| | | b = b.length == 1 ? '0' + b : b;
|
| | |
|
| | | return "#" + r + g + b;
|
| | | }
|
| | |
|
| | | return col;
|
| | | }
|
| | |
|
| | | function convertHexToRGB(col) {
|
| | | if (col.indexOf('#') != -1) {
|
| | | col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
|
| | |
|
| | | r = parseInt(col.substring(0, 2), 16);
|
| | | g = parseInt(col.substring(2, 4), 16);
|
| | | b = parseInt(col.substring(4, 6), 16);
|
| | |
|
| | | return "rgb(" + r + "," + g + "," + b + ")";
|
| | | }
|
| | |
|
| | | return col;
|
| | | }
|
| | |
|
| | | function trimSize(size) {
|
| | | return size.replace(new RegExp('[^0-9%]', 'gi'), '');
|
| | | }
|
| | |
|
| | | function getCSSSize(size) {
|
| | | size = trimSize(size);
|
| | |
|
| | | if (size == "")
|
| | | return "";
|
| | |
|
| | | return size.indexOf('%') != -1 ? size : size + "px";
|
| | | }
|
| | |
|
| | | function getStyle(elm, attrib, style) {
|
| | | var val = tinyMCE.getAttrib(elm, attrib);
|
| | |
|
| | | if (val != '')
|
| | | return '' + val;
|
| | |
|
| | | if (typeof(style) == 'undefined')
|
| | | style = attrib;
|
| | |
|
| | | val = eval('elm.style.' + style);
|
| | |
|
| | | return val == null ? '' : '' + val;
|
| | | }
|
| | | /** |
| | | * $Id: form_utils.js 162 2007-01-03 16:16:52Z spocke $ |
| | | * |
| | | * Various form utilitiy functions. |
| | | * |
| | | * @author Moxiecode |
| | | * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. |
| | | */ |
| | | |
| | | var themeBaseURL = tinyMCE.baseURL + '/themes/' + tinyMCE.getParam("theme"); |
| | | |
| | | function getColorPickerHTML(id, target_form_element) { |
| | | var h = ""; |
| | | |
| | | h += '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">'; |
| | | h += '<img id="' + id + '" src="' + themeBaseURL + '/images/color.gif"'; |
| | | h += ' onmouseover="this.className=\'mceButtonOver\'"'; |
| | | h += ' onmouseout="this.className=\'mceButtonNormal\'"'; |
| | | h += ' onmousedown="this.className=\'mceButtonDown\'"'; |
| | | h += ' width="20" height="16" border="0" title="' + tinyMCE.getLang('lang_browse') + '"'; |
| | | h += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>'; |
| | | |
| | | return h; |
| | | } |
| | | |
| | | function pickColor(e, target_form_element) { |
| | | if ((e.keyCode == 32 || e.keyCode == 13) || e.type == "mousedown") |
| | | tinyMCEPopup.pickColor(e, target_form_element); |
| | | } |
| | | |
| | | function updateColor(img_id, form_element_id) { |
| | | document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value; |
| | | } |
| | | |
| | | function setBrowserDisabled(id, state) { |
| | | var img = document.getElementById(id); |
| | | var lnk = document.getElementById(id + "_link"); |
| | | |
| | | if (lnk) { |
| | | if (state) { |
| | | lnk.setAttribute("realhref", lnk.getAttribute("href")); |
| | | lnk.removeAttribute("href"); |
| | | tinyMCE.switchClass(img, 'mceButtonDisabled', true); |
| | | } else { |
| | | lnk.setAttribute("href", lnk.getAttribute("realhref")); |
| | | tinyMCE.switchClass(img, 'mceButtonNormal', false); |
| | | } |
| | | } |
| | | } |
| | | |
| | | function getBrowserHTML(id, target_form_element, type, prefix) { |
| | | var option = prefix + "_" + type + "_browser_callback"; |
| | | var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback")); |
| | | if (cb == null) |
| | | return ""; |
| | | |
| | | var html = ""; |
| | | |
| | | html += '<a id="' + id + '_link" href="javascript:openBrower(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;">'; |
| | | html += '<img id="' + id + '" src="' + themeBaseURL + '/images/browse.gif"'; |
| | | html += ' onmouseover="this.className=\'mceButtonOver\';"'; |
| | | html += ' onmouseout="this.className=\'mceButtonNormal\';"'; |
| | | html += ' onmousedown="this.className=\'mceButtonDown\';"'; |
| | | html += ' width="20" height="18" border="0" title="' + tinyMCE.getLang('lang_browse') + '"'; |
| | | html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>'; |
| | | |
| | | return html; |
| | | } |
| | | |
| | | function openBrower(img_id, target_form_element, type, option) { |
| | | var img = document.getElementById(img_id); |
| | | |
| | | if (img.className != "mceButtonDisabled") |
| | | tinyMCEPopup.openBrowser(target_form_element, type, option); |
| | | } |
| | | |
| | | function selectByValue(form_obj, field_name, value, add_custom, ignore_case) { |
| | | if (!form_obj || !form_obj.elements[field_name]) |
| | | return; |
| | | |
| | | var sel = form_obj.elements[field_name]; |
| | | |
| | | var found = false; |
| | | for (var i=0; i<sel.options.length; i++) { |
| | | var option = sel.options[i]; |
| | | |
| | | if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) { |
| | | option.selected = true; |
| | | found = true; |
| | | } else |
| | | option.selected = false; |
| | | } |
| | | |
| | | if (!found && add_custom && value != '') { |
| | | var option = new Option(value, value); |
| | | option.selected = true; |
| | | sel.options[sel.options.length] = option; |
| | | sel.selectedIndex = sel.options.length - 1; |
| | | } |
| | | |
| | | return found; |
| | | } |
| | | |
| | | function getSelectValue(form_obj, field_name) { |
| | | var elm = form_obj.elements[field_name]; |
| | | |
| | | if (elm == null || elm.options == null) |
| | | return ""; |
| | | |
| | | return elm.options[elm.selectedIndex].value; |
| | | } |
| | | |
| | | function addSelectValue(form_obj, field_name, name, value) { |
| | | var s = form_obj.elements[field_name]; |
| | | var o = new Option(name, value); |
| | | s.options[s.options.length] = o; |
| | | } |
| | | |
| | | function addClassesToList(list_id, specific_option) { |
| | | // Setup class droplist |
| | | var styleSelectElm = document.getElementById(list_id); |
| | | var styles = tinyMCE.getParam('theme_advanced_styles', false); |
| | | styles = tinyMCE.getParam(specific_option, styles); |
| | | |
| | | if (styles) { |
| | | var stylesAr = styles.split(';'); |
| | | |
| | | for (var i=0; i<stylesAr.length; i++) { |
| | | if (stylesAr != "") { |
| | | var key, value; |
| | | |
| | | key = stylesAr[i].split('=')[0]; |
| | | value = stylesAr[i].split('=')[1]; |
| | | |
| | | styleSelectElm.options[styleSelectElm.length] = new Option(key, value); |
| | | } |
| | | } |
| | | } else { |
| | | // Use auto impored classes |
| | | var csses = tinyMCE.getCSSClasses(tinyMCE.getWindowArg('editor_id')); |
| | | for (var i=0; i<csses.length; i++) |
| | | styleSelectElm.options[styleSelectElm.length] = new Option(csses[i], csses[i]); |
| | | } |
| | | } |
| | | |
| | | function isVisible(element_id) { |
| | | var elm = document.getElementById(element_id); |
| | | |
| | | return elm && elm.style.display != "none"; |
| | | } |
| | | |
| | | function convertRGBToHex(col) { |
| | | var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi"); |
| | | |
| | | var rgb = col.replace(re, "$1,$2,$3").split(','); |
| | | if (rgb.length == 3) { |
| | | r = parseInt(rgb[0]).toString(16); |
| | | g = parseInt(rgb[1]).toString(16); |
| | | b = parseInt(rgb[2]).toString(16); |
| | | |
| | | r = r.length == 1 ? '0' + r : r; |
| | | g = g.length == 1 ? '0' + g : g; |
| | | b = b.length == 1 ? '0' + b : b; |
| | | |
| | | return "#" + r + g + b; |
| | | } |
| | | |
| | | return col; |
| | | } |
| | | |
| | | function convertHexToRGB(col) { |
| | | if (col.indexOf('#') != -1) { |
| | | col = col.replace(new RegExp('[^0-9A-F]', 'gi'), ''); |
| | | |
| | | r = parseInt(col.substring(0, 2), 16); |
| | | g = parseInt(col.substring(2, 4), 16); |
| | | b = parseInt(col.substring(4, 6), 16); |
| | | |
| | | return "rgb(" + r + "," + g + "," + b + ")"; |
| | | } |
| | | |
| | | return col; |
| | | } |
| | | |
| | | function trimSize(size) { |
| | | return size.replace(new RegExp('[^0-9%]', 'gi'), ''); |
| | | } |
| | | |
| | | function getCSSSize(size) { |
| | | size = trimSize(size); |
| | | |
| | | if (size == "") |
| | | return ""; |
| | | |
| | | return size.indexOf('%') != -1 ? size : size + "px"; |
| | | } |
| | | |
| | | function getStyle(elm, attrib, style) { |
| | | var val = tinyMCE.getAttrib(elm, attrib); |
| | | |
| | | if (val != '') |
| | | return '' + val; |
| | | |
| | | if (typeof(style) == 'undefined') |
| | | style = attrib; |
| | | |
| | | val = eval('elm.style.' + style); |
| | | |
| | | return val == null ? '' : '' + val; |
| | | } |
| | |
| | | /**
|
| | | * $Id: mclayer.js 162 2007-01-03 16:16:52Z spocke $
|
| | | *
|
| | | * Moxiecode floating layer script.
|
| | | *
|
| | | * @author Moxiecode
|
| | | * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
| | | */
|
| | |
|
| | | function MCLayer(id) {
|
| | | this.id = id;
|
| | | this.settings = new Array();
|
| | | this.blockerElement = null;
|
| | | this.isMSIE = navigator.appName == "Microsoft Internet Explorer";
|
| | | this.events = false;
|
| | | this.autoHideCallback = null;
|
| | | }
|
| | |
|
| | | MCLayer.prototype = {
|
| | | moveRelativeTo : function(re, p, a) {
|
| | | var rep = this.getAbsPosition(re);
|
| | | var w = parseInt(re.offsetWidth);
|
| | | var h = parseInt(re.offsetHeight);
|
| | | var x, y;
|
| | |
|
| | | switch (p) {
|
| | | case "tl":
|
| | | break;
|
| | |
|
| | | case "tr":
|
| | | x = rep.absLeft + w;
|
| | | y = rep.absTop;
|
| | | break;
|
| | |
|
| | | case "bl":
|
| | | break;
|
| | |
|
| | | case "br":
|
| | | break;
|
| | | }
|
| | |
|
| | | this.moveTo(x, y);
|
| | | },
|
| | |
|
| | | moveBy : function(dx, dy) {
|
| | | var e = this.getElement();
|
| | | var x = parseInt(e.style.left);
|
| | | var y = parseInt(e.style.top);
|
| | |
|
| | | e.style.left = (x + dx) + "px";
|
| | | e.style.top = (y + dy) + "px";
|
| | |
|
| | | this.updateBlocker();
|
| | | },
|
| | |
|
| | | moveTo : function(x, y) {
|
| | | var e = this.getElement();
|
| | |
|
| | | e.style.left = x + "px";
|
| | | e.style.top = y + "px";
|
| | |
|
| | | this.updateBlocker();
|
| | | },
|
| | |
|
| | | show : function() {
|
| | | MCLayer.visibleLayer = this;
|
| | |
|
| | | this.getElement().style.display = 'block';
|
| | | this.updateBlocker();
|
| | | },
|
| | |
|
| | | hide : function() {
|
| | | this.getElement().style.display = 'none';
|
| | | this.updateBlocker();
|
| | | },
|
| | |
|
| | | setAutoHide : function(s, cb) {
|
| | | this.autoHideCallback = cb;
|
| | | this.registerEventHandlers();
|
| | | },
|
| | |
|
| | | getElement : function() {
|
| | | return document.getElementById(this.id);
|
| | | },
|
| | |
|
| | | updateBlocker : function() {
|
| | | if (!this.isMSIE)
|
| | | return;
|
| | |
|
| | | var e = this.getElement();
|
| | | var b = this.getBlocker();
|
| | | var x = this.parseInt(e.style.left);
|
| | | var y = this.parseInt(e.style.top);
|
| | | var w = this.parseInt(e.offsetWidth);
|
| | | var h = this.parseInt(e.offsetHeight);
|
| | |
|
| | | b.style.left = x + 'px';
|
| | | b.style.top = y + 'px';
|
| | | b.style.width = w + 'px';
|
| | | b.style.height = h + 'px';
|
| | | b.style.display = e.style.display;
|
| | | },
|
| | |
|
| | | getBlocker : function() {
|
| | | if (!this.blockerElement) {
|
| | | var d = document, b = d.createElement("iframe");
|
| | |
|
| | | b.style.cssText = 'display: none; left: 0px; position: absolute; top: 0';
|
| | | b.src = 'javascript:false;';
|
| | | b.frameBorder = '0';
|
| | | b.scrolling = 'no';
|
| | |
|
| | | d.body.appendChild(b);
|
| | | this.blockerElement = b;
|
| | | }
|
| | |
|
| | | return this.blockerElement;
|
| | | },
|
| | |
|
| | | getAbsPosition : function(n) {
|
| | | var p = {absLeft : 0, absTop : 0};
|
| | |
|
| | | while (n) {
|
| | | p.absLeft += n.offsetLeft;
|
| | | p.absTop += n.offsetTop;
|
| | | n = n.offsetParent;
|
| | | }
|
| | |
|
| | | return p;
|
| | | },
|
| | |
|
| | | registerEventHandlers : function() {
|
| | | if (!this.events) {
|
| | | var d = document;
|
| | |
|
| | | this.addEvent(d, 'mousedown', MCLayer.prototype.onMouseDown);
|
| | |
|
| | | this.events = true;
|
| | | }
|
| | | },
|
| | |
|
| | | addEvent : function(o, n, h) {
|
| | | if (o.attachEvent)
|
| | | o.attachEvent("on" + n, h);
|
| | | else
|
| | | o.addEventListener(n, h, false);
|
| | | },
|
| | |
|
| | | onMouseDown : function(e) {
|
| | | e = typeof(e) == "undefined" ? window.event : e;
|
| | | var b = document.body;
|
| | | var l = MCLayer.visibleLayer;
|
| | |
|
| | | if (l) {
|
| | | var mx = l.isMSIE ? e.clientX + b.scrollLeft : e.pageX;
|
| | | var my = l.isMSIE ? e.clientY + b.scrollTop : e.pageY;
|
| | | var el = l.getElement();
|
| | | var x = parseInt(el.style.left);
|
| | | var y = parseInt(el.style.top);
|
| | | var w = parseInt(el.offsetWidth);
|
| | | var h = parseInt(el.offsetHeight);
|
| | |
|
| | | if (!(mx > x && mx < x + w && my > y && my < y + h)) {
|
| | | MCLayer.visibleLayer = null;
|
| | |
|
| | | if (l.autoHideCallback && l.autoHideCallback(l, e, mx, my))
|
| | | return true;
|
| | |
|
| | | l.hide();
|
| | | }
|
| | | }
|
| | | },
|
| | |
|
| | | addCSSClass : function(e, c) {
|
| | | this.removeCSSClass(e, c);
|
| | | var a = this.explode(' ', e.className);
|
| | | a[a.length] = c;
|
| | | e.className = a.join(' ');
|
| | | },
|
| | |
|
| | | removeCSSClass : function(e, c) {
|
| | | var a = this.explode(' ', e.className), i;
|
| | |
|
| | | for (i=0; i<a.length; i++) {
|
| | | if (a[i] == c)
|
| | | a[i] = '';
|
| | | }
|
| | |
|
| | | e.className = a.join(' ');
|
| | | },
|
| | |
|
| | | explode : function(d, s) {
|
| | | var ar = s.split(d);
|
| | | var oar = new Array();
|
| | |
|
| | | for (var i = 0; i<ar.length; i++) {
|
| | | if (ar[i] != "")
|
| | | oar[oar.length] = ar[i];
|
| | | }
|
| | |
|
| | | return oar;
|
| | | },
|
| | |
|
| | | parseInt : function(s) {
|
| | | if (s == null || s == '')
|
| | | return 0;
|
| | |
|
| | | return parseInt(s);
|
| | | }
|
| | | }
|
| | | /** |
| | | * $Id: mclayer.js 162 2007-01-03 16:16:52Z spocke $ |
| | | * |
| | | * Moxiecode floating layer script. |
| | | * |
| | | * @author Moxiecode |
| | | * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. |
| | | */ |
| | | |
| | | function MCLayer(id) { |
| | | this.id = id; |
| | | this.settings = new Array(); |
| | | this.blockerElement = null; |
| | | this.isMSIE = navigator.appName == "Microsoft Internet Explorer"; |
| | | this.events = false; |
| | | this.autoHideCallback = null; |
| | | } |
| | | |
| | | MCLayer.prototype = { |
| | | moveRelativeTo : function(re, p, a) { |
| | | var rep = this.getAbsPosition(re); |
| | | var w = parseInt(re.offsetWidth); |
| | | var h = parseInt(re.offsetHeight); |
| | | var x, y; |
| | | |
| | | switch (p) { |
| | | case "tl": |
| | | break; |
| | | |
| | | case "tr": |
| | | x = rep.absLeft + w; |
| | | y = rep.absTop; |
| | | break; |
| | | |
| | | case "bl": |
| | | break; |
| | | |
| | | case "br": |
| | | break; |
| | | } |
| | | |
| | | this.moveTo(x, y); |
| | | }, |
| | | |
| | | moveBy : function(dx, dy) { |
| | | var e = this.getElement(); |
| | | var x = parseInt(e.style.left); |
| | | var y = parseInt(e.style.top); |
| | | |
| | | e.style.left = (x + dx) + "px"; |
| | | e.style.top = (y + dy) + "px"; |
| | | |
| | | this.updateBlocker(); |
| | | }, |
| | | |
| | | moveTo : function(x, y) { |
| | | var e = this.getElement(); |
| | | |
| | | e.style.left = x + "px"; |
| | | e.style.top = y + "px"; |
| | | |
| | | this.updateBlocker(); |
| | | }, |
| | | |
| | | show : function() { |
| | | MCLayer.visibleLayer = this; |
| | | |
| | | this.getElement().style.display = 'block'; |
| | | this.updateBlocker(); |
| | | }, |
| | | |
| | | hide : function() { |
| | | this.getElement().style.display = 'none'; |
| | | this.updateBlocker(); |
| | | }, |
| | | |
| | | setAutoHide : function(s, cb) { |
| | | this.autoHideCallback = cb; |
| | | this.registerEventHandlers(); |
| | | }, |
| | | |
| | | getElement : function() { |
| | | return document.getElementById(this.id); |
| | | }, |
| | | |
| | | updateBlocker : function() { |
| | | if (!this.isMSIE) |
| | | return; |
| | | |
| | | var e = this.getElement(); |
| | | var b = this.getBlocker(); |
| | | var x = this.parseInt(e.style.left); |
| | | var y = this.parseInt(e.style.top); |
| | | var w = this.parseInt(e.offsetWidth); |
| | | var h = this.parseInt(e.offsetHeight); |
| | | |
| | | b.style.left = x + 'px'; |
| | | b.style.top = y + 'px'; |
| | | b.style.width = w + 'px'; |
| | | b.style.height = h + 'px'; |
| | | b.style.display = e.style.display; |
| | | }, |
| | | |
| | | getBlocker : function() { |
| | | if (!this.blockerElement) { |
| | | var d = document, b = d.createElement("iframe"); |
| | | |
| | | b.style.cssText = 'display: none; left: 0px; position: absolute; top: 0'; |
| | | b.src = 'javascript:false;'; |
| | | b.frameBorder = '0'; |
| | | b.scrolling = 'no'; |
| | | |
| | | d.body.appendChild(b); |
| | | this.blockerElement = b; |
| | | } |
| | | |
| | | return this.blockerElement; |
| | | }, |
| | | |
| | | getAbsPosition : function(n) { |
| | | var p = {absLeft : 0, absTop : 0}; |
| | | |
| | | while (n) { |
| | | p.absLeft += n.offsetLeft; |
| | | p.absTop += n.offsetTop; |
| | | n = n.offsetParent; |
| | | } |
| | | |
| | | return p; |
| | | }, |
| | | |
| | | registerEventHandlers : function() { |
| | | if (!this.events) { |
| | | var d = document; |
| | | |
| | | this.addEvent(d, 'mousedown', MCLayer.prototype.onMouseDown); |
| | | |
| | | this.events = true; |
| | | } |
| | | }, |
| | | |
| | | addEvent : function(o, n, h) { |
| | | if (o.attachEvent) |
| | | o.attachEvent("on" + n, h); |
| | | else |
| | | o.addEventListener(n, h, false); |
| | | }, |
| | | |
| | | onMouseDown : function(e) { |
| | | e = typeof(e) == "undefined" ? window.event : e; |
| | | var b = document.body; |
| | | var l = MCLayer.visibleLayer; |
| | | |
| | | if (l) { |
| | | var mx = l.isMSIE ? e.clientX + b.scrollLeft : e.pageX; |
| | | var my = l.isMSIE ? e.clientY + b.scrollTop : e.pageY; |
| | | var el = l.getElement(); |
| | | var x = parseInt(el.style.left); |
| | | var y = parseInt(el.style.top); |
| | | var w = parseInt(el.offsetWidth); |
| | | var h = parseInt(el.offsetHeight); |
| | | |
| | | if (!(mx > x && mx < x + w && my > y && my < y + h)) { |
| | | MCLayer.visibleLayer = null; |
| | | |
| | | if (l.autoHideCallback && l.autoHideCallback(l, e, mx, my)) |
| | | return true; |
| | | |
| | | l.hide(); |
| | | } |
| | | } |
| | | }, |
| | | |
| | | addCSSClass : function(e, c) { |
| | | this.removeCSSClass(e, c); |
| | | var a = this.explode(' ', e.className); |
| | | a[a.length] = c; |
| | | e.className = a.join(' '); |
| | | }, |
| | | |
| | | removeCSSClass : function(e, c) { |
| | | var a = this.explode(' ', e.className), i; |
| | | |
| | | for (i=0; i<a.length; i++) { |
| | | if (a[i] == c) |
| | | a[i] = ''; |
| | | } |
| | | |
| | | e.className = a.join(' '); |
| | | }, |
| | | |
| | | explode : function(d, s) { |
| | | var ar = s.split(d); |
| | | var oar = new Array(); |
| | | |
| | | for (var i = 0; i<ar.length; i++) { |
| | | if (ar[i] != "") |
| | | oar[oar.length] = ar[i]; |
| | | } |
| | | |
| | | return oar; |
| | | }, |
| | | |
| | | parseInt : function(s) { |
| | | if (s == null || s == '') |
| | | return 0; |
| | | |
| | | return parseInt(s); |
| | | } |
| | | } |
| | |
| | | /**
|
| | | * $Id: mctabs.js 162 2007-01-03 16:16:52Z spocke $
|
| | | *
|
| | | * Moxiecode DHTML Tabs script.
|
| | | *
|
| | | * @author Moxiecode
|
| | | * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
| | | */
|
| | |
|
| | | function MCTabs() {
|
| | | this.settings = new Array();
|
| | | };
|
| | |
|
| | | MCTabs.prototype.init = function(settings) {
|
| | | this.settings = settings;
|
| | | };
|
| | |
|
| | | MCTabs.prototype.getParam = function(name, default_value) {
|
| | | var value = null;
|
| | |
|
| | | value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
|
| | |
|
| | | // Fix bool values
|
| | | if (value == "true" || value == "false")
|
| | | return (value == "true");
|
| | |
|
| | | return value;
|
| | | };
|
| | |
|
| | | MCTabs.prototype.displayTab = function(tab_id, panel_id) {
|
| | | var panelElm = document.getElementById(panel_id);
|
| | | var panelContainerElm = panelElm ? panelElm.parentNode : null;
|
| | | var tabElm = document.getElementById(tab_id);
|
| | | var tabContainerElm = tabElm ? tabElm.parentNode : null;
|
| | | var selectionClass = this.getParam('selection_class', 'current');
|
| | |
|
| | | if (tabElm && tabContainerElm) {
|
| | | var nodes = tabContainerElm.childNodes;
|
| | |
|
| | | // Hide all other tabs
|
| | | for (var i=0; i<nodes.length; i++) {
|
| | | if (nodes[i].nodeName == "LI")
|
| | | nodes[i].className = '';
|
| | | }
|
| | |
|
| | | // Show selected tab
|
| | | tabElm.className = 'current';
|
| | | }
|
| | |
|
| | | if (panelElm && panelContainerElm) {
|
| | | var nodes = panelContainerElm.childNodes;
|
| | |
|
| | | // Hide all other panels
|
| | | for (var i=0; i<nodes.length; i++) {
|
| | | if (nodes[i].nodeName == "DIV")
|
| | | nodes[i].className = 'panel';
|
| | | }
|
| | |
|
| | | // Show selected panel
|
| | | panelElm.className = 'current';
|
| | | }
|
| | | };
|
| | |
|
| | | MCTabs.prototype.getAnchor = function() {
|
| | | var pos, url = document.location.href;
|
| | |
|
| | | if ((pos = url.lastIndexOf('#')) != -1)
|
| | | return url.substring(pos + 1);
|
| | |
|
| | | return "";
|
| | | };
|
| | |
|
| | | // Global instance
|
| | | var mcTabs = new MCTabs();
|
| | | /** |
| | | * $Id: mctabs.js 162 2007-01-03 16:16:52Z spocke $ |
| | | * |
| | | * Moxiecode DHTML Tabs script. |
| | | * |
| | | * @author Moxiecode |
| | | * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. |
| | | */ |
| | | |
| | | function MCTabs() { |
| | | this.settings = new Array(); |
| | | }; |
| | | |
| | | MCTabs.prototype.init = function(settings) { |
| | | this.settings = settings; |
| | | }; |
| | | |
| | | MCTabs.prototype.getParam = function(name, default_value) { |
| | | var value = null; |
| | | |
| | | value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name]; |
| | | |
| | | // Fix bool values |
| | | if (value == "true" || value == "false") |
| | | return (value == "true"); |
| | | |
| | | return value; |
| | | }; |
| | | |
| | | MCTabs.prototype.displayTab = function(tab_id, panel_id) { |
| | | var panelElm = document.getElementById(panel_id); |
| | | var panelContainerElm = panelElm ? panelElm.parentNode : null; |
| | | var tabElm = document.getElementById(tab_id); |
| | | var tabContainerElm = tabElm ? tabElm.parentNode : null; |
| | | var selectionClass = this.getParam('selection_class', 'current'); |
| | | |
| | | if (tabElm && tabContainerElm) { |
| | | var nodes = tabContainerElm.childNodes; |
| | | |
| | | // Hide all other tabs |
| | | for (var i=0; i<nodes.length; i++) { |
| | | if (nodes[i].nodeName == "LI") |
| | | nodes[i].className = ''; |
| | | } |
| | | |
| | | // Show selected tab |
| | | tabElm.className = 'current'; |
| | | } |
| | | |
| | | if (panelElm && panelContainerElm) { |
| | | var nodes = panelContainerElm.childNodes; |
| | | |
| | | // Hide all other panels |
| | | for (var i=0; i<nodes.length; i++) { |
| | | if (nodes[i].nodeName == "DIV") |
| | | nodes[i].className = 'panel'; |
| | | } |
| | | |
| | | // Show selected panel |
| | | panelElm.className = 'current'; |
| | | } |
| | | }; |
| | | |
| | | MCTabs.prototype.getAnchor = function() { |
| | | var pos, url = document.location.href; |
| | | |
| | | if ((pos = url.lastIndexOf('#')) != -1) |
| | | return url.substring(pos + 1); |
| | | |
| | | return ""; |
| | | }; |
| | | |
| | | // Global instance |
| | | var mcTabs = new MCTabs(); |
| | |
| | | /**
|
| | | * $Id: validate.js 162 2007-01-03 16:16:52Z spocke $
|
| | | *
|
| | | * Various form validation methods.
|
| | | *
|
| | | * @author Moxiecode
|
| | | * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
| | | */
|
| | |
|
| | | /**
|
| | | // String validation:
|
| | |
|
| | | if (!Validator.isEmail('myemail'))
|
| | | alert('Invalid email.');
|
| | |
|
| | | // Form validation:
|
| | |
|
| | | var f = document.forms['myform'];
|
| | |
|
| | | if (!Validator.isEmail(f.myemail))
|
| | | alert('Invalid email.');
|
| | | */
|
| | |
|
| | | var Validator = {
|
| | | isEmail : function(s) {
|
| | | return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
|
| | | },
|
| | |
|
| | | isAbsUrl : function(s) {
|
| | | return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
|
| | | },
|
| | |
|
| | | isSize : function(s) {
|
| | | return this.test(s, '^[0-9]+(px|%)?$');
|
| | | },
|
| | |
|
| | | isId : function(s) {
|
| | | return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
|
| | | },
|
| | |
|
| | | isEmpty : function(s) {
|
| | | var nl, i;
|
| | |
|
| | | if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
|
| | | return true;
|
| | |
|
| | | if (s.type == 'checkbox' && !s.checked)
|
| | | return true;
|
| | |
|
| | | if (s.type == 'radio') {
|
| | | for (i=0, nl = s.form.elements; i<nl.length; i++) {
|
| | | if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
|
| | | return false;
|
| | | }
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
|
| | | },
|
| | |
|
| | | isNumber : function(s, d) {
|
| | | return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
|
| | | },
|
| | |
|
| | | test : function(s, p) {
|
| | | s = s.nodeType == 1 ? s.value : s;
|
| | |
|
| | | return s == '' || new RegExp(p).test(s);
|
| | | }
|
| | | };
|
| | |
|
| | | var AutoValidator = {
|
| | | settings : {
|
| | | id_cls : 'id',
|
| | | int_cls : 'int',
|
| | | url_cls : 'url',
|
| | | number_cls : 'number',
|
| | | email_cls : 'email',
|
| | | size_cls : 'size',
|
| | | required_cls : 'required',
|
| | | invalid_cls : 'invalid',
|
| | | min_cls : 'min',
|
| | | max_cls : 'max'
|
| | | },
|
| | |
|
| | | init : function(s) {
|
| | | var n;
|
| | |
|
| | | for (n in s)
|
| | | this.settings[n] = s[n];
|
| | | },
|
| | |
|
| | | validate : function(f) {
|
| | | var i, nl, s = this.settings, c = 0;
|
| | |
|
| | | nl = this.tags(f, 'label');
|
| | | for (i=0; i<nl.length; i++)
|
| | | this.removeClass(nl[i], s.invalid_cls);
|
| | |
|
| | | c += this.validateElms(f, 'input');
|
| | | c += this.validateElms(f, 'select');
|
| | | c += this.validateElms(f, 'textarea');
|
| | |
|
| | | return c == 3;
|
| | | },
|
| | |
|
| | | invalidate : function(n) {
|
| | | this.mark(n.form, n);
|
| | | },
|
| | |
|
| | | reset : function(e) {
|
| | | var t = new Array('label', 'input', 'select', 'textarea');
|
| | | var i, j, nl, s = this.settings;
|
| | |
|
| | | if (e == null)
|
| | | return;
|
| | |
|
| | | for (i=0; i<t.length; i++) {
|
| | | nl = this.tags(e.form ? e.form : e, t[i]);
|
| | | for (j=0; j<nl.length; j++)
|
| | | this.removeClass(nl[j], s.invalid_cls);
|
| | | }
|
| | | },
|
| | |
|
| | | validateElms : function(f, e) {
|
| | | var nl, i, n, s = this.settings, st = true, va = Validator, v;
|
| | |
|
| | | nl = this.tags(f, e);
|
| | | for (i=0; i<nl.length; i++) {
|
| | | n = nl[i];
|
| | |
|
| | | this.removeClass(n, s.invalid_cls);
|
| | |
|
| | | if (this.hasClass(n, s.required_cls) && va.isEmpty(n))
|
| | | st = this.mark(f, n);
|
| | |
|
| | | if (this.hasClass(n, s.number_cls) && !va.isNumber(n))
|
| | | st = this.mark(f, n);
|
| | |
|
| | | if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))
|
| | | st = this.mark(f, n);
|
| | |
|
| | | if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))
|
| | | st = this.mark(f, n);
|
| | |
|
| | | if (this.hasClass(n, s.email_cls) && !va.isEmail(n))
|
| | | st = this.mark(f, n);
|
| | |
|
| | | if (this.hasClass(n, s.size_cls) && !va.isSize(n))
|
| | | st = this.mark(f, n);
|
| | |
|
| | | if (this.hasClass(n, s.id_cls) && !va.isId(n))
|
| | | st = this.mark(f, n);
|
| | |
|
| | | if (this.hasClass(n, s.min_cls, true)) {
|
| | | v = this.getNum(n, s.min_cls);
|
| | |
|
| | | if (isNaN(v) || parseInt(n.value) < parseInt(v))
|
| | | st = this.mark(f, n);
|
| | | }
|
| | |
|
| | | if (this.hasClass(n, s.max_cls, true)) {
|
| | | v = this.getNum(n, s.max_cls);
|
| | |
|
| | | if (isNaN(v) || parseInt(n.value) > parseInt(v))
|
| | | st = this.mark(f, n);
|
| | | }
|
| | | }
|
| | |
|
| | | return st;
|
| | | },
|
| | |
|
| | | hasClass : function(n, c, d) {
|
| | | return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);
|
| | | },
|
| | |
|
| | | getNum : function(n, c) {
|
| | | c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];
|
| | | c = c.replace(/[^0-9]/g, '');
|
| | |
|
| | | return c;
|
| | | },
|
| | |
|
| | | addClass : function(n, c, b) {
|
| | | var o = this.removeClass(n, c);
|
| | | n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
|
| | | },
|
| | |
|
| | | removeClass : function(n, c) {
|
| | | c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
|
| | | return n.className = c != ' ' ? c : '';
|
| | | },
|
| | |
|
| | | tags : function(f, s) {
|
| | | return f.getElementsByTagName(s);
|
| | | },
|
| | |
|
| | | mark : function(f, n) {
|
| | | var s = this.settings;
|
| | |
|
| | | this.addClass(n, s.invalid_cls);
|
| | | this.markLabels(f, n, s.invalid_cls);
|
| | |
|
| | | return false;
|
| | | },
|
| | |
|
| | | markLabels : function(f, n, ic) {
|
| | | var nl, i;
|
| | |
|
| | | nl = this.tags(f, "label");
|
| | | for (i=0; i<nl.length; i++) {
|
| | | if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)
|
| | | this.addClass(nl[i], ic);
|
| | | }
|
| | |
|
| | | return null;
|
| | | }
|
| | | };
|
| | | /** |
| | | * $Id: validate.js 162 2007-01-03 16:16:52Z spocke $ |
| | | * |
| | | * Various form validation methods. |
| | | * |
| | | * @author Moxiecode |
| | | * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. |
| | | */ |
| | | |
| | | /** |
| | | // String validation: |
| | | |
| | | if (!Validator.isEmail('myemail')) |
| | | alert('Invalid email.'); |
| | | |
| | | // Form validation: |
| | | |
| | | var f = document.forms['myform']; |
| | | |
| | | if (!Validator.isEmail(f.myemail)) |
| | | alert('Invalid email.'); |
| | | */ |
| | | |
| | | var Validator = { |
| | | isEmail : function(s) { |
| | | return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$'); |
| | | }, |
| | | |
| | | isAbsUrl : function(s) { |
| | | return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$'); |
| | | }, |
| | | |
| | | isSize : function(s) { |
| | | return this.test(s, '^[0-9]+(px|%)?$'); |
| | | }, |
| | | |
| | | isId : function(s) { |
| | | return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$'); |
| | | }, |
| | | |
| | | isEmpty : function(s) { |
| | | var nl, i; |
| | | |
| | | if (s.nodeName == 'SELECT' && s.selectedIndex < 1) |
| | | return true; |
| | | |
| | | if (s.type == 'checkbox' && !s.checked) |
| | | return true; |
| | | |
| | | if (s.type == 'radio') { |
| | | for (i=0, nl = s.form.elements; i<nl.length; i++) { |
| | | if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked) |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s); |
| | | }, |
| | | |
| | | isNumber : function(s, d) { |
| | | return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$')); |
| | | }, |
| | | |
| | | test : function(s, p) { |
| | | s = s.nodeType == 1 ? s.value : s; |
| | | |
| | | return s == '' || new RegExp(p).test(s); |
| | | } |
| | | }; |
| | | |
| | | var AutoValidator = { |
| | | settings : { |
| | | id_cls : 'id', |
| | | int_cls : 'int', |
| | | url_cls : 'url', |
| | | number_cls : 'number', |
| | | email_cls : 'email', |
| | | size_cls : 'size', |
| | | required_cls : 'required', |
| | | invalid_cls : 'invalid', |
| | | min_cls : 'min', |
| | | max_cls : 'max' |
| | | }, |
| | | |
| | | init : function(s) { |
| | | var n; |
| | | |
| | | for (n in s) |
| | | this.settings[n] = s[n]; |
| | | }, |
| | | |
| | | validate : function(f) { |
| | | var i, nl, s = this.settings, c = 0; |
| | | |
| | | nl = this.tags(f, 'label'); |
| | | for (i=0; i<nl.length; i++) |
| | | this.removeClass(nl[i], s.invalid_cls); |
| | | |
| | | c += this.validateElms(f, 'input'); |
| | | c += this.validateElms(f, 'select'); |
| | | c += this.validateElms(f, 'textarea'); |
| | | |
| | | return c == 3; |
| | | }, |
| | | |
| | | invalidate : function(n) { |
| | | this.mark(n.form, n); |
| | | }, |
| | | |
| | | reset : function(e) { |
| | | var t = new Array('label', 'input', 'select', 'textarea'); |
| | | var i, j, nl, s = this.settings; |
| | | |
| | | if (e == null) |
| | | return; |
| | | |
| | | for (i=0; i<t.length; i++) { |
| | | nl = this.tags(e.form ? e.form : e, t[i]); |
| | | for (j=0; j<nl.length; j++) |
| | | this.removeClass(nl[j], s.invalid_cls); |
| | | } |
| | | }, |
| | | |
| | | validateElms : function(f, e) { |
| | | var nl, i, n, s = this.settings, st = true, va = Validator, v; |
| | | |
| | | nl = this.tags(f, e); |
| | | for (i=0; i<nl.length; i++) { |
| | | n = nl[i]; |
| | | |
| | | this.removeClass(n, s.invalid_cls); |
| | | |
| | | if (this.hasClass(n, s.required_cls) && va.isEmpty(n)) |
| | | st = this.mark(f, n); |
| | | |
| | | if (this.hasClass(n, s.number_cls) && !va.isNumber(n)) |
| | | st = this.mark(f, n); |
| | | |
| | | if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true)) |
| | | st = this.mark(f, n); |
| | | |
| | | if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n)) |
| | | st = this.mark(f, n); |
| | | |
| | | if (this.hasClass(n, s.email_cls) && !va.isEmail(n)) |
| | | st = this.mark(f, n); |
| | | |
| | | if (this.hasClass(n, s.size_cls) && !va.isSize(n)) |
| | | st = this.mark(f, n); |
| | | |
| | | if (this.hasClass(n, s.id_cls) && !va.isId(n)) |
| | | st = this.mark(f, n); |
| | | |
| | | if (this.hasClass(n, s.min_cls, true)) { |
| | | v = this.getNum(n, s.min_cls); |
| | | |
| | | if (isNaN(v) || parseInt(n.value) < parseInt(v)) |
| | | st = this.mark(f, n); |
| | | } |
| | | |
| | | if (this.hasClass(n, s.max_cls, true)) { |
| | | v = this.getNum(n, s.max_cls); |
| | | |
| | | if (isNaN(v) || parseInt(n.value) > parseInt(v)) |
| | | st = this.mark(f, n); |
| | | } |
| | | } |
| | | |
| | | return st; |
| | | }, |
| | | |
| | | hasClass : function(n, c, d) { |
| | | return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className); |
| | | }, |
| | | |
| | | getNum : function(n, c) { |
| | | c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0]; |
| | | c = c.replace(/[^0-9]/g, ''); |
| | | |
| | | return c; |
| | | }, |
| | | |
| | | addClass : function(n, c, b) { |
| | | var o = this.removeClass(n, c); |
| | | n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c; |
| | | }, |
| | | |
| | | removeClass : function(n, c) { |
| | | c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' '); |
| | | return n.className = c != ' ' ? c : ''; |
| | | }, |
| | | |
| | | tags : function(f, s) { |
| | | return f.getElementsByTagName(s); |
| | | }, |
| | | |
| | | mark : function(f, n) { |
| | | var s = this.settings; |
| | | |
| | | this.addClass(n, s.invalid_cls); |
| | | this.markLabels(f, n, s.invalid_cls); |
| | | |
| | | return false; |
| | | }, |
| | | |
| | | markLabels : function(f, n, ic) { |
| | | var nl, i; |
| | | |
| | | nl = this.tags(f, "label"); |
| | | for (i=0; i<nl.length; i++) { |
| | | if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id) |
| | | this.addClass(nl[i], ic); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | }; |
| | |
| | | |
| | | // remove an attachment |
| | | if ($_action=='remove-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_POST['_file'], $regs)) |
| | | { |
| | | { |
| | | $id = $regs[1]; |
| | | if (is_array($_SESSION['compose']['attachments'][$id])) |
| | | { |
| | | { |
| | | @unlink($_SESSION['compose']['attachments'][$id]['path']); |
| | | $_SESSION['compose']['attachments'][$id] = NULL; |
| | | $OUTPUT->command('remove_from_attachment_list', "rcmfile$id"); |
| | | $OUTPUT->send(); |
| | | exit; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if ($_action=='display-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_GET['_file'], $regs)) |
| | | { |
| | | $id = $regs[1]; |
| | | if (is_array($_SESSION['compose']['attachments'][$id])) |
| | | { |
| | | $apath = $_SESSION['compose']['attachments'][$id]['path']; |
| | | header('Content-Type: ' . $_SESSION['compose']['attachments'][$id]['mimetype']); |
| | | header('Content-Length: ' . filesize($apath)); |
| | | readfile($apath); |
| | | } |
| | | exit; |
| | | } |
| | | |
| | | $MESSAGE_FORM = NULL; |
| | | $MESSAGE = NULL; |
| | |
| | | // compose when a "new/forward/reply/draft" is called - otherwise the old session attachments will appear |
| | | |
| | | if (!is_array($_SESSION['compose']) || $_SESSION['compose']['id'] != get_input_value('_id', RCUBE_INPUT_GET)) |
| | | { |
| | | { |
| | | rcmail_compose_cleanup(); |
| | | $_SESSION['compose'] = array('id' => uniqid(rand())); |
| | | } |
| | | } |
| | | |
| | | // add some labels to client |
| | | rcube_add_label('nosubject', 'norecipientwarning', 'nosubjectwarning', 'nobodywarning', 'notsentwarning', 'savingmessage', 'sendingmessage', 'messagesaved', 'converting'); |
| | |
| | | |
| | | |
| | | if (!empty($msg_uid)) |
| | | { |
| | | { |
| | | // similar as in program/steps/mail/show.inc |
| | | $MESSAGE = array('UID' => $msg_uid); |
| | | $MESSAGE['headers'] = &$IMAP->get_headers($msg_uid); |
| | |
| | | $MESSAGE['parts'] = $IMAP->get_mime_numbers($MESSAGE['structure']); |
| | | |
| | | if ($compose_mode == RCUBE_COMPOSE_REPLY) |
| | | { |
| | | { |
| | | $_SESSION['compose']['reply_uid'] = $msg_uid; |
| | | $_SESSION['compose']['reply_msgid'] = $MESSAGE['headers']->messageID; |
| | | $_SESSION['compose']['references'] = trim($MESSAGE['headers']->references . " " . $MESSAGE['headers']->messageID); |
| | | |
| | | if (!empty($_GET['_all'])) |
| | | $MESSAGE['reply_all'] = 1; |
| | | } |
| | | else if ($compose_mode == RCUBE_COMPOSE_FORWARD) |
| | | { |
| | | $_SESSION['compose']['forward_uid'] = $msg_uid; |
| | | } |
| | | else if ($compose_mode == RCUBE_COMPOSE_DRAFT) |
| | | { |
| | | $_SESSION['compose']['draft_uid'] = $msg_uid; |
| | | } |
| | | |
| | | } |
| | | else if ($compose_mode == RCUBE_COMPOSE_FORWARD) |
| | | { |
| | | $_SESSION['compose']['forward_uid'] = $msg_uid; |
| | | } |
| | | else if ($compose_mode == RCUBE_COMPOSE_DRAFT) |
| | | { |
| | | $_SESSION['compose']['draft_uid'] = $msg_uid; |
| | | } |
| | | } |
| | | |
| | | /****** compose mode functions ********/ |
| | | |
| | | |
| | | function rcmail_compose_headers($attrib) |
| | | { |
| | | { |
| | | global $IMAP, $MESSAGE, $DB, $compose_mode; |
| | | static $sa_recipients = array(); |
| | | |
| | |
| | | $part = strtolower($attrib['part']); |
| | | |
| | | switch ($part) |
| | | { |
| | | { |
| | | case 'from': |
| | | return rcmail_compose_header_from($attrib); |
| | | |
| | |
| | | |
| | | case 'cc': |
| | | if (!$fname) |
| | | { |
| | | { |
| | | $fname = '_cc'; |
| | | $header = 'cc'; |
| | | } |
| | | } |
| | | case 'bcc': |
| | | if (!$fname) |
| | | { |
| | | { |
| | | $fname = '_bcc'; |
| | | $header = 'bcc'; |
| | | } |
| | | } |
| | | |
| | | $allow_attrib = array('id', 'class', 'style', 'cols', 'rows', 'tabindex'); |
| | | $field_type = 'textarea'; |
| | |
| | | $fname = '_replyto'; |
| | | $allow_attrib = array('id', 'class', 'style', 'size', 'tabindex'); |
| | | $field_type = 'textfield'; |
| | | break; |
| | | |
| | | } |
| | | break; |
| | | } |
| | | |
| | | if ($fname && !empty($_POST[$fname])) |
| | | $fvalue = get_input_value($fname, RCUBE_INPUT_POST, TRUE); |
| | | |
| | | else if ($header && $compose_mode == RCUBE_COMPOSE_REPLY) |
| | | { |
| | | { |
| | | // get recipent address(es) out of the message headers |
| | | if ($header=='to' && !empty($MESSAGE['headers']->replyto)) |
| | | $fvalue = $MESSAGE['headers']->replyto; |
| | |
| | | |
| | | // add recipent of original message if reply to all |
| | | else if ($header=='cc' && !empty($MESSAGE['reply_all'])) |
| | | { |
| | | { |
| | | if ($v = $MESSAGE['headers']->to) |
| | | $fvalue .= $v; |
| | | |
| | | if ($v = $MESSAGE['headers']->cc) |
| | | $fvalue .= (!empty($fvalue) ? ', ' : '') . $v; |
| | | } |
| | | } |
| | | |
| | | // split recipients and put them back together in a unique way |
| | | if (!empty($fvalue)) |
| | | { |
| | | { |
| | | $to_addresses = $IMAP->decode_address_list($fvalue); |
| | | $fvalue = ''; |
| | | foreach ($to_addresses as $addr_part) |
| | | { |
| | | { |
| | | if (!empty($addr_part['mailto']) && !in_array($addr_part['mailto'], $sa_recipients) && (!$MESSAGE['FROM'] || !in_array($addr_part['mailto'], $MESSAGE['FROM']))) |
| | | { |
| | | { |
| | | $fvalue .= (strlen($fvalue) ? ', ':'').$addr_part['string']; |
| | | $sa_recipients[] = $addr_part['mailto']; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else if ($header && $compose_mode == RCUBE_COMPOSE_DRAFT) |
| | | { |
| | | { |
| | | // get drafted headers |
| | | if ($header=='to' && !empty($MESSAGE['headers']->to)) |
| | | $fvalue = $IMAP->decode_header($MESSAGE['headers']->to); |
| | |
| | | |
| | | if ($header=='bcc' && !empty($MESSAGE['headers']->bcc)) |
| | | $fvalue = $IMAP->decode_header($MESSAGE['headers']->bcc); |
| | | } |
| | | } |
| | | |
| | | |
| | | if ($fname && $field_type) |
| | | { |
| | | { |
| | | // pass the following attributes to the form class |
| | | $field_attrib = array('name' => $fname); |
| | | foreach ($attrib as $attr => $value) |
| | |
| | | // create teaxtarea object |
| | | $input = new $field_type($field_attrib); |
| | | $out = $input->show($fvalue); |
| | | } |
| | | } |
| | | |
| | | if ($form_start) |
| | | $out = $form_start.$out; |
| | | |
| | | return $out; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | function rcmail_compose_header_from($attrib) |
| | | { |
| | | { |
| | | global $IMAP, $MESSAGE, $DB, $USER, $OUTPUT, $compose_mode; |
| | | |
| | | // pass the following attributes to the form class |
| | |
| | | // extract all recipients of the reply-message |
| | | $a_recipients = array(); |
| | | if ($compose_mode == RCUBE_COMPOSE_REPLY && is_object($MESSAGE['headers'])) |
| | | { |
| | | { |
| | | $MESSAGE['FROM'] = array(); |
| | | |
| | | $a_to = $IMAP->decode_address_list($MESSAGE['headers']->to); |
| | | foreach ($a_to as $addr) |
| | | { |
| | | { |
| | | if (!empty($addr['mailto'])) |
| | | $a_recipients[] = $addr['mailto']; |
| | | } |
| | | } |
| | | |
| | | if (!empty($MESSAGE['headers']->cc)) |
| | | { |
| | | { |
| | | $a_cc = $IMAP->decode_address_list($MESSAGE['headers']->cc); |
| | | foreach ($a_cc as $addr) |
| | | { |
| | | { |
| | | if (!empty($addr['mailto'])) |
| | | $a_recipients[] = $addr['mailto']; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // get this user's identities |
| | | $sql_result = $USER->list_identities(); |
| | | |
| | | if ($DB->num_rows($sql_result)) |
| | | { |
| | | { |
| | | $from_id = 0; |
| | | $a_signatures = array(); |
| | | |
| | |
| | | $select_from = new select($field_attrib); |
| | | |
| | | while ($sql_arr = $DB->fetch_assoc($sql_result)) |
| | | { |
| | | { |
| | | $identity_id = $sql_arr['identity_id']; |
| | | $select_from->add(format_email_recipient($sql_arr['email'], $sql_arr['name']), $identity_id); |
| | | |
| | | // add signature to array |
| | | if (!empty($sql_arr['signature'])) |
| | | { |
| | | { |
| | | $a_signatures[$identity_id]['text'] = $sql_arr['signature']; |
| | | $a_signatures[$identity_id]['is_html'] = ($sql_arr['html_signature'] == 1) ? true : false; |
| | | if ($a_signatures[$identity_id]['is_html']) |
| | | { |
| | | { |
| | | $h2t = new html2text($a_signatures[$identity_id]['text'], false, false); |
| | | $plainTextPart = $h2t->get_text(); |
| | | $a_signatures[$identity_id]['plain_text'] = trim($plainTextPart); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // set identity if it's one of the reply-message recipients |
| | | if (in_array($sql_arr['email'], $a_recipients)) |
| | |
| | | |
| | | if ($compose_mode == RCUBE_COMPOSE_DRAFT && strstr($MESSAGE['headers']->from, $sql_arr['email'])) |
| | | $from_id = $sql_arr['identity_id']; |
| | | } |
| | | } |
| | | |
| | | // overwrite identity selection with post parameter |
| | | if (isset($_POST['_from'])) |
| | |
| | | |
| | | // add signatures to client |
| | | $OUTPUT->set_env('signatures', $a_signatures); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | { |
| | | $input_from = new textfield($field_attrib); |
| | | $out = $input_from->show($_POST['_from']); |
| | | } |
| | | } |
| | | |
| | | if ($form_start) |
| | | $out = $form_start.$out; |
| | | |
| | | return $out; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | function rcmail_compose_body($attrib) |
| | | { |
| | | { |
| | | global $CONFIG, $OUTPUT, $MESSAGE, $compose_mode; |
| | | |
| | | list($form_start, $form_end) = get_form_tags($attrib); |
| | |
| | | $out .= "\n".'<iframe name="savetarget" src="program/blank.gif" style="width:0;height:0;visibility:hidden;"></iframe>'; |
| | | |
| | | return $out; |
| | | } |
| | | } |
| | | |
| | | |
| | | function rcmail_create_reply_body($body, $bodyIsHtml) |
| | | { |
| | | { |
| | | global $IMAP, $MESSAGE; |
| | | |
| | | if (! $bodyIsHtml) |
| | |
| | | |
| | | // add > to each line |
| | | for($n=0; $n<sizeof($a_lines); $n++) |
| | | { |
| | | { |
| | | if (strpos($a_lines[$n], '>')===0) |
| | | $a_lines[$n] = '>'.$a_lines[$n]; |
| | | else |
| | | $a_lines[$n] = '> '.$a_lines[$n]; |
| | | } |
| | | } |
| | | |
| | | $body = join("\n", $a_lines); |
| | | |
| | |
| | | } |
| | | else |
| | | { |
| | | $prefix = sprintf("<br><br>On %s, %s wrote:<br><blockquote type=\"cite\" " . |
| | | "style=\"padding-left: 5px; border-left: #1010ff 2px solid; " . |
| | | "margin-left: 5px; width: 100%%\">", |
| | | $MESSAGE['headers']->date, |
| | | $IMAP->decode_header($MESSAGE['headers']->from)); |
| | | $prefix = sprintf("<br><br>On %s, %s wrote:<br><blockquote type=\"cite\" " . |
| | | "style=\"padding-left: 5px; border-left: #1010ff 2px solid; " . |
| | | "margin-left: 5px; width: 100%%\">", |
| | | $MESSAGE['headers']->date, |
| | | $IMAP->decode_header($MESSAGE['headers']->from)); |
| | | |
| | | $suffix = "</blockquote>"; |
| | | $suffix = "</blockquote>"; |
| | | } |
| | | |
| | | return $prefix.$body.$suffix; |
| | | } |
| | | } |
| | | |
| | | |
| | | function rcmail_create_forward_body($body, $bodyIsHtml) |
| | | { |
| | | { |
| | | global $IMAP, $MESSAGE; |
| | | |
| | | if (! $bodyIsHtml) |
| | |
| | | } |
| | | else |
| | | { |
| | | $prefix = sprintf( |
| | | $prefix = sprintf( |
| | | "<br><br>-------- Original Message --------" . |
| | | "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tbody>" . |
| | | "<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">Subject: </th><td>%s</td></tr>" . |
| | |
| | | rcmail_write_compose_attachments($MESSAGE); |
| | | |
| | | return $prefix.$body; |
| | | } |
| | | } |
| | | |
| | | |
| | | function rcmail_create_draft_body($body, $bodyIsHtml) |
| | | { |
| | | { |
| | | global $IMAP, $MESSAGE; |
| | | |
| | | // add attachments |
| | |
| | | rcmail_write_compose_attachments($MESSAGE); |
| | | |
| | | return $body; |
| | | } |
| | | } |
| | | |
| | | |
| | | function rcmail_write_compose_attachments(&$message) |
| | | { |
| | | { |
| | | global $IMAP, $CONFIG; |
| | | |
| | | $temp_dir = unslashify($CONFIG['temp_dir']); |
| | |
| | | $_SESSION['compose']['attachments'] = array(); |
| | | |
| | | foreach ($message['parts'] as $pid => $part) |
| | | { |
| | | { |
| | | if ($part->ctype_primary != 'message' && $part->ctype_primary != 'text' && |
| | | ($part->disposition=='attachment' || $part->disposition=='inline' || $part->headers['content-id'] || |
| | | (empty($part->disposition) && $part->filename))) |
| | | { |
| | | { |
| | | $tmp_path = tempnam($temp_dir, 'rcmAttmnt'); |
| | | if ($fp = fopen($tmp_path, 'w')) |
| | | { |
| | | { |
| | | fwrite($fp, $IMAP->get_message_part($message['UID'], $pid, $part->encoding)); |
| | | fclose($fp); |
| | | |
| | |
| | | 'name' => $part->filename, |
| | | 'path' => $tmp_path |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | $_SESSION['compose']['forward_attachments'] = TRUE; |
| | | } |
| | | } |
| | | |
| | | |
| | | function rcmail_compose_subject($attrib) |
| | | { |
| | | { |
| | | global $CONFIG, $MESSAGE, $compose_mode; |
| | | |
| | | list($form_start, $form_end) = get_form_tags($attrib); |
| | |
| | | |
| | | // create a reply-subject |
| | | else if ($compose_mode == RCUBE_COMPOSE_REPLY) |
| | | { |
| | | { |
| | | if (eregi('^re:', $MESSAGE['subject'])) |
| | | $subject = $MESSAGE['subject']; |
| | | else |
| | | $subject = 'Re: '.$MESSAGE['subject']; |
| | | } |
| | | } |
| | | |
| | | // create a forward-subject |
| | | else if ($compose_mode == RCUBE_COMPOSE_FORWARD) |
| | | { |
| | | { |
| | | if (eregi('^fwd:', $MESSAGE['subject'])) |
| | | $subject = $MESSAGE['subject']; |
| | | else |
| | | $subject = 'Fwd: '.$MESSAGE['subject']; |
| | | } |
| | | } |
| | | |
| | | // creeate a draft-subject |
| | | else if ($compose_mode == RCUBE_COMPOSE_DRAFT) |
| | |
| | | $out .= $form_end ? "\n$form_end" : ''; |
| | | |
| | | return $out; |
| | | } |
| | | } |
| | | |
| | | |
| | | function rcmail_compose_attachment_list($attrib) |
| | | { |
| | | { |
| | | global $OUTPUT, $CONFIG; |
| | | |
| | | // add ID if not given |
| | |
| | | $out = '<ul'. $attrib_str . ">\n"; |
| | | |
| | | if (is_array($_SESSION['compose']['attachments'])) |
| | | { |
| | | { |
| | | if ($attrib['deleteicon']) |
| | | $button = sprintf('<img src="%s%s" alt="%s" border="0" style="padding-right:2px;vertical-align:middle" />', |
| | | $CONFIG['skin_path'], |
| | |
| | | Q(rcube_label('delete')), |
| | | $button, |
| | | Q($a_prop['name'])); |
| | | } |
| | | } |
| | | |
| | | $OUTPUT->add_gui_object('attachmentlist', $attrib['id']); |
| | | |
| | | $out .= '</ul>'; |
| | | return $out; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | function rcmail_compose_attachment_form($attrib) |
| | | { |
| | | { |
| | | global $OUTPUT, $SESS_HIDDEN_FIELD; |
| | | |
| | | // add ID if not given |
| | |
| | | |
| | | $OUTPUT->add_gui_object('uploadbox', $attrib['id']); |
| | | return $out; |
| | | } |
| | | } |
| | | |
| | | |
| | | function rcmail_compose_attachment_field($attrib) |
| | | { |
| | | { |
| | | // allow the following attributes to be added to the <input> tag |
| | | $attrib_str = create_attrib_string($attrib, array('id', 'class', 'style', 'size')); |
| | | |
| | | $out = '<input type="file" name="_attachments[]"'. $attrib_str . " />"; |
| | | return $out; |
| | | } |
| | | } |
| | | |
| | | |
| | | function rcmail_priority_selector($attrib) |
| | | { |
| | | { |
| | | list($form_start, $form_end) = get_form_tags($attrib); |
| | | unset($attrib['form']); |
| | | |
| | |
| | | $out .= $form_end ? "\n$form_end" : ''; |
| | | |
| | | return $out; |
| | | } |
| | | } |
| | | |
| | | |
| | | function rcmail_receipt_checkbox($attrib) |
| | | { |
| | | { |
| | | list($form_start, $form_end) = get_form_tags($attrib); |
| | | unset($attrib['form']); |
| | | |
| | |
| | | $out .= $form_end ? "\n$form_end" : ''; |
| | | |
| | | return $out; |
| | | } |
| | | } |
| | | |
| | | |
| | | function rcmail_editor_selector($attrib) |
| | |
| | | if ($compose_mode == RCUBE_COMPOSE_REPLY || |
| | | $compose_mode == RCUBE_COMPOSE_FORWARD || |
| | | $compose_mode == RCUBE_COMPOSE_DRAFT) |
| | | { |
| | | { |
| | | $hasHtml = rcmail_has_html_part($MESSAGE['parts']); |
| | | $useHtml = ($hasHtml && $CONFIG['htmleditor']); |
| | | } |
| | | } |
| | | |
| | | $selector = ''; |
| | | |
| | | $attrib['name'] = '_editorSelect'; |
| | | $attrib['onchange'] = 'return rcmail_toggle_editor(this)'; |
| | | foreach ($choices as $value => $text) |
| | | { |
| | | { |
| | | $checked = ''; |
| | | if ((($value == 'html') && $useHtml) || |
| | | (($value != 'html') && !$useHtml)) |
| | |
| | | $rb->show($value), |
| | | $attrib['id'], |
| | | rcube_label($text)); |
| | | } |
| | | } |
| | | |
| | | return $selector; |
| | | } |
| | | |
| | | |
| | | function get_form_tags($attrib) |
| | | { |
| | | { |
| | | global $CONFIG, $OUTPUT, $MESSAGE_FORM, $SESS_HIDDEN_FIELD; |
| | | |
| | | $form_start = ''; |
| | | if (!strlen($MESSAGE_FORM)) |
| | | { |
| | | { |
| | | $hiddenfields = new hiddenfield(array('name' => '_task', 'value' => $GLOBALS['_task'])); |
| | | $hiddenfields->add(array('name' => '_action', 'value' => 'send')); |
| | | |
| | | $form_start = empty($attrib['form']) ? '<form name="form" action="./" method="post">' : ''; |
| | | $form_start .= "\n$SESS_HIDDEN_FIELD\n"; |
| | | $form_start .= $hiddenfields->show(); |
| | | } |
| | | } |
| | | |
| | | $form_end = (strlen($MESSAGE_FORM) && !strlen($attrib['form'])) ? '</form>' : ''; |
| | | $form_name = !empty($attrib['form']) ? $attrib['form'] : 'form'; |
| | |
| | | $MESSAGE_FORM = $form_name; |
| | | |
| | | return array($form_start, $form_end); |
| | | } |
| | | } |
| | | |
| | | |
| | | // register UI objects |
| | |
| | | 'receiptcheckbox' => 'rcmail_receipt_checkbox', |
| | | )); |
| | | |
| | | |
| | | /****** get contacts for this user and add them to client scripts ********/ |
| | | |
| | | require_once('include/rcube_contacts.inc'); |
| | |
| | | $CONTACTS->set_pagesize(1000); |
| | | |
| | | if ($result = $CONTACTS->list_records()) |
| | | { |
| | | { |
| | | $a_contacts = array(); |
| | | while ($sql_arr = $result->iterate()) |
| | | if ($sql_arr['email']) |
| | | $a_contacts[] = format_email_recipient($sql_arr['email'], JQ($sql_arr['name'])); |
| | | |
| | | $OUTPUT->set_env('contacts', $a_contacts); |
| | | } |
| | | |
| | | } |
| | | |
| | | parse_template('compose'); |
| | | ?> |
| | |
| | | |
| | | // add stored attachments, if any |
| | | if (is_array($_SESSION['compose']['attachments'])) |
| | | foreach ($_SESSION['compose']['attachments'] as $attachment) |
| | | $MAIL_MIME->addAttachment($attachment['path'], $attachment['mimetype'], $attachment['name'], true, 'base64', 'attachment', $message_charset); |
| | | foreach ($_SESSION['compose']['attachments'] as $id => $attachment) |
| | | { |
| | | $dispurl = '/\ssrc\s*=\s*[\'"]?\S+display-attachment\S+file=rcmfile' . $id . '[\'"]?/'; |
| | | $match = preg_match($dispurl, $message_body); |
| | | if ($isHtml && ($match > 0)) |
| | | { |
| | | $message_body = preg_replace($dispurl, ' src="'.$attachment['name'].'"', $message_body); |
| | | $MAIL_MIME->setHTMLBody($message_body); |
| | | $MAIL_MIME->addHTMLImage($attachment['path'], $attachment['mimetype'], $attachment['name']); |
| | | } |
| | | else |
| | | { |
| | | $MAIL_MIME->addAttachment($attachment['path'], $attachment['mimetype'], $attachment['name'], true, 'base64', 'attachment', $message_charset); |
| | | } |
| | | } |
| | | |
| | | // add submitted attachments |
| | | if (is_array($_FILES['_attachments']['tmp_name'])) |
| | |
| | | $OUTPUT->command('sent_successfully', rcube_label('messagesent')); |
| | | $OUTPUT->send('iframe'); |
| | | } |
| | | |
| | | |
| | | ?> |
| | |
| | | $OUTPUT->add_script("tinyMCE.init({ mode : 'specific_textareas'," . |
| | | "apply_source_formatting : true," . |
| | | "content_css : '\$__skin_path' + '/editor_content.css'," . |
| | | "popups_css : '\$__skin_path' + '/editor_popups.css'," . |
| | | "editor_css : '\$__skin_path' + '/editor_ui.css'," . |
| | | "theme : 'advanced'," . |
| | | "theme_advanced_toolbar_location : 'top'," . |