Merge branch '3.4' of https://github.com/Dolibarr/dolibarr into 3.4
Conflicts: ChangeLog
This commit is contained in:
commit
c9c86c9b18
84
.travis.yml
Normal file
84
.travis.yml
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
# This script is used by Travis CI to run automatically Continuous test integration
|
||||||
|
# from Dolibarr GitHub repository.
|
||||||
|
# Command run is phpunit
|
||||||
|
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
|
||||||
|
|
||||||
|
services:
|
||||||
|
- memcached # will start memcached
|
||||||
|
|
||||||
|
# This will tell travis to run phpunit
|
||||||
|
language: php
|
||||||
|
php:
|
||||||
|
- "5.3"
|
||||||
|
- "5.4"
|
||||||
|
|
||||||
|
env:
|
||||||
|
- DB=mysql
|
||||||
|
# - DB=postgres
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- echo Start travis
|
||||||
|
- echo Current dir is `pwd`
|
||||||
|
- echo Home dir is `echo ~`
|
||||||
|
- echo Update composer
|
||||||
|
# - ~/.phpenv/versions/$(phpenv version-name)/bin/composer.phar self-update
|
||||||
|
- echo Create dir $(pwd)/htdocs/documents
|
||||||
|
- sudo mkdir -p $(pwd)/htdocs/documents/admin/temp;
|
||||||
|
- sudo touch $(pwd)/htdocs/documents/dolibarr.log;
|
||||||
|
- sudo chmod a+rwx /home; sudo chmod a+rwx /home/travis; sudo chmod -R a+rwx /home/travis/build;
|
||||||
|
- sudo chmod -R a+rwx $(pwd);
|
||||||
|
- sudo chown -R www-data:travis $(pwd)/htdocs/documents;
|
||||||
|
- find $(pwd)/htdocs/documents -type d -exec ls -alt {} \;
|
||||||
|
- echo Edit php.ini file
|
||||||
|
- echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||||
|
- echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||||
|
# - echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||||
|
- echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||||
|
- echo "zend_extension_ts = xdebug.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||||
|
- cat ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||||
|
- echo Init database
|
||||||
|
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS myapp_test;' -U postgres; fi"
|
||||||
|
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE myapp_test;' -U postgres; fi"
|
||||||
|
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'DROP DATABASE IF EXISTS myapp_test;'; fi"
|
||||||
|
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE IF NOT EXISTS myapp_test;'; fi"
|
||||||
|
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -D myapp_test < $(pwd)/dev/initdata/mysqldump_dolibarr_3.4.0.sql; fi"
|
||||||
|
- echo Create config file htdocs/conf/conf.php
|
||||||
|
- echo '<?php ' > htdocs/conf/conf.php
|
||||||
|
- sh -c "if [ '$DB' = 'pgsql' ]; then echo '$'dolibarr_main_db_type=\'pgsql\'';' >> htdocs/conf/conf.php; fi"
|
||||||
|
- sh -c "if [ '$DB' = 'mysql' ]; then echo '$'dolibarr_main_db_type=\'mysqli\'';' >> htdocs/conf/conf.php; fi"
|
||||||
|
- echo '$'dolibarr_main_url_root=\'http://localhost/\'';' >> htdocs/conf/conf.php
|
||||||
|
- echo '$'dolibarr_main_document_root=\'$(pwd)/htdocs\'';' >> htdocs/conf/conf.php
|
||||||
|
- echo '$'dolibarr_main_data_root=\'$(pwd)/htdocs/documents\'';' >> htdocs/conf/conf.php
|
||||||
|
- echo '$'dolibarr_main_db_host=\'localhost\'';' >> htdocs/conf/conf.php
|
||||||
|
- echo '$'dolibarr_main_db_name=\'myapp_test\'';' >> htdocs/conf/conf.php
|
||||||
|
- echo '$'dolibarr_main_db_user=\'travis\'';' >> htdocs/conf/conf.php
|
||||||
|
- echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> htdocs/conf/conf.php
|
||||||
|
- echo '?>' >> htdocs/conf/conf.php
|
||||||
|
- echo Show conf.php content
|
||||||
|
- cat htdocs/conf/conf.php
|
||||||
|
- echo Install apache server
|
||||||
|
- sudo apt-get update > /dev/null
|
||||||
|
- sudo apt-get install -y --force-yes apache2 libapache2-mod-php5 php5-curl php5-mysql php5-pgsql php5-intl
|
||||||
|
- sudo sed -i -e "s,/var/www,$(pwd)/htdocs,g" /etc/apache2/sites-available/default
|
||||||
|
- echo Show default virtual host
|
||||||
|
- sudo cat /etc/apache2/sites-available/default
|
||||||
|
- sudo /etc/init.d/apache2 restart
|
||||||
|
- wget http://localhost/
|
||||||
|
- cat index.html
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Omitting "script:" will default to phpunit
|
||||||
|
# use the $DB env variable to determine the phpunit.xml to use
|
||||||
|
#script: phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/AllTests.php
|
||||||
|
#script: phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/BuildDocTest.php
|
||||||
|
#script: phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/WebservicesOtherTest.php
|
||||||
|
script:
|
||||||
|
# - phpcs -s --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ .
|
||||||
|
- phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||||
|
|
||||||
|
after_script:
|
||||||
|
# - echo Output dolibarr log file; cat $(pwd)/htdocs/documents/dolibarr.log
|
||||||
|
- echo Output apache log file; sudo cat /var/log/apache2/error.log
|
||||||
|
- echo End travis
|
||||||
|
|
||||||
13
ChangeLog
13
ChangeLog
@ -14,7 +14,19 @@ Fix: Fix bug with canvas thirdparty
|
|||||||
Fix: [ bug #1037 ] Consumption> Supplier invoices related
|
Fix: [ bug #1037 ] Consumption> Supplier invoices related
|
||||||
Fix: User group name do not display in card (view or edit mode)
|
Fix: User group name do not display in card (view or edit mode)
|
||||||
Fix: Link "Show all supplier invoice" on suplier card not working
|
Fix: Link "Show all supplier invoice" on suplier card not working
|
||||||
|
Fix: [ bug #1039 ] Pre-defined invoices conversion
|
||||||
|
Fix: If only service module is activated, it's impossible to delete service
|
||||||
|
Fix: [ bug #1043 ] Bad interventions ref numbering
|
||||||
|
Fix: Mailing module : if an email is already in destinaires list all other email from selector was not inserted
|
||||||
|
Fix: Localtaxes balance not showing
|
||||||
|
Fix: Intervention box links to contracts id
|
||||||
|
Fix: Compatiblity with multicompany module
|
||||||
Fix: Edit propal line was losing product supplier price id
|
Fix: Edit propal line was losing product supplier price id
|
||||||
|
Fix: Delete linked element to supplier invoice when deleted
|
||||||
|
Fix: [ bug #1061 ] Bad info shipped products
|
||||||
|
Fix: [ bug #1062 ] Documents lost in propals and contracts validating
|
||||||
|
Qual: Add travis-ci integration
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 3.4 compared to 3.3.* *****
|
***** ChangeLog for 3.4 compared to 3.3.* *****
|
||||||
For users:
|
For users:
|
||||||
@ -72,6 +84,7 @@ For users:
|
|||||||
- Fix: [Bug #958] LocalTax2 for Spain fails on Suppliers
|
- Fix: [Bug #958] LocalTax2 for Spain fails on Suppliers
|
||||||
- Fix: [ bug #972 ] Auto completion contact field do not take account the min caract number before search
|
- Fix: [ bug #972 ] Auto completion contact field do not take account the min caract number before search
|
||||||
- Fix: [ bug #971 ] html.form.class.php select_contact with autocomplete do not exclude id from exclude array
|
- Fix: [ bug #971 ] html.form.class.php select_contact with autocomplete do not exclude id from exclude array
|
||||||
|
- Fix: Expedition creation, can retreive product from other expedition
|
||||||
|
|
||||||
For translators:
|
For translators:
|
||||||
- Update language files.
|
- Update language files.
|
||||||
|
|||||||
2
README
2
README
@ -92,7 +92,7 @@ Main modules/features:
|
|||||||
- Payments management
|
- Payments management
|
||||||
- Standing orders management
|
- Standing orders management
|
||||||
- Shipping management
|
- Shipping management
|
||||||
- ECM (Electronic Content Management)
|
- EDM (Electronic Document Management)
|
||||||
- EMailings
|
- EMailings
|
||||||
- Agenda with ical,vcal export for third tools integration
|
- Agenda with ical,vcal export for third tools integration
|
||||||
- Management of foundation members
|
- Management of foundation members
|
||||||
|
|||||||
@ -87,10 +87,10 @@ See ChangeLog file found into package.
|
|||||||
- Standing orders management
|
- Standing orders management
|
||||||
- Shipping management
|
- Shipping management
|
||||||
- Agenda with ical,vcal export for third tools integration
|
- Agenda with ical,vcal export for third tools integration
|
||||||
- ECM (Electronic Content Management)
|
- EDM (Electronic Document Management)
|
||||||
- Foundations members management
|
- Foundations members management
|
||||||
- Employee's holidays management
|
- Employee's holidays management
|
||||||
- Mass emailing
|
- Mass Emailing
|
||||||
- Realize surveys
|
- Realize surveys
|
||||||
- Point of Sale
|
- Point of Sale
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
dolibarr (3.4.0+nmu1) unstable; urgency=low
|
dolibarr (3.4.1) unstable; urgency=low
|
||||||
|
|
||||||
* Non-maintainer upload.
|
[ Laurent Destailleur (eldy) ]
|
||||||
* New upstream release.
|
* New upstream release.
|
||||||
closes: bug#634783
|
|
||||||
|
|
||||||
-- Dolibarr team <contact@dolibarr.org> Mon, 22 Apr 2013 12:00:00 +0100
|
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Mon, 22 Apr 2013 12:00:00 +0100
|
||||||
|
|
||||||
# For a changelog file dedicated to end users, see /usr/share/doc/dolibarr/ChangeLog.gz
|
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
Source: dolibarr
|
Source: dolibarr
|
||||||
Maintainer: Laurent Destailleur <eldy@users.sourceforge.net>
|
Maintainer: Laurent Destailleur (eldy) <eldy@users.sourceforge.net>
|
||||||
|
Uploaders: Laurent Destailleur (eldy) <eldy@users.sourceforge.net>
|
||||||
Standards-Version: 3.9.2
|
Standards-Version: 3.9.2
|
||||||
Section: web
|
Section: web
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Homepage: http://www.dolibarr.org
|
Homepage: http://www.dolibarr.org
|
||||||
Build-Depends: debhelper (>= 7), po-debconf, dpatch
|
Build-Depends: debhelper (>= 7), po-debconf, dpatch
|
||||||
|
Comments: This package need at least debian 7 or ubuntu 13.04 or any distribution based on this version
|
||||||
|
|
||||||
Package: dolibarr
|
Package: dolibarr
|
||||||
Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5,
|
Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5,
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
Format: http://anonscm.debian.org/viewvc/dep/web/deps/dep5.mdwn?revision=174
|
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
Upstream-Name: Dolibarr
|
Upstream-Name: Dolibarr
|
||||||
Upstream-Contact: Laurent Destailleur <eldy@users.sourceforge.net>
|
Upstream-Contact: Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
Source: git@github.com:Dolibarr/dolibarr.git
|
Source: http://sourceforge.net/projects/dolibarr/files/
|
||||||
|
|
||||||
Files: *
|
Files: *
|
||||||
Copyright: 2002-2009, Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
Copyright: 2002-2009, Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
@ -55,12 +55,129 @@ License: GPL-3+
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
.
|
.
|
||||||
On Debian systems, the full text of the GNU General Public
|
On Debian systems, the full text of the GNU General Public
|
||||||
License version 2 can be found in the file
|
License version 3 can be found in the file
|
||||||
`/usr/share/common-licenses/GPL-2'.
|
`/usr/share/common-licenses/GPL-3'.
|
||||||
|
|
||||||
|
Files: htdocs/includes/adodbtime/*
|
||||||
|
Copyright: 2003-2005, John Lim
|
||||||
|
unknown, jackbbs
|
||||||
|
License: BSD
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
.
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
.
|
||||||
|
Neither the name of the John Lim nor the names of its contributors may be
|
||||||
|
used to endorse or promote products derived from this software without
|
||||||
|
specific prior written permission.
|
||||||
|
Comment:
|
||||||
|
Those files are not shipped in the binary package since we use
|
||||||
|
the library as packaged in "libphp-adodb".
|
||||||
|
|
||||||
|
Files: htdocs/includes/ckeditor/*
|
||||||
|
Copyright: 2003-2012 CKSource - Frederico Knabben
|
||||||
|
License: GPL-2+
|
||||||
|
The ckeditor is tripple licensed under the GNU General Public License (GPL),
|
||||||
|
GNU Lesser General Public License (LGPL), and Mozilla Public License (MPL).
|
||||||
|
In Debian, it is distributed under the GNU General Public License (GPL).
|
||||||
|
.
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
.
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
.
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
.
|
||||||
|
On Debian systems, the complete text of the GNU General Public License
|
||||||
|
can be found in /usr/share/common-licenses/GPL-2 file.
|
||||||
|
Comment:
|
||||||
|
Sources for all minified javascript libraries are available in same directory
|
||||||
|
than minified version (.min.js), except for ckeditor whose sources are files
|
||||||
|
ckeditor_basic_source.js, ckeditor_source.js and files into directory _source.
|
||||||
|
Those files are not shipped in the binary package since we use the
|
||||||
|
library as packaged in "ckeditor".
|
||||||
|
|
||||||
|
Files: htdocs/includes/fonts/*
|
||||||
|
Copyright: 2003, Bitstream Inc
|
||||||
|
unknown, Gavin Graham
|
||||||
|
License: other
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of the fonts accompanying this license ("Fonts") and associated
|
||||||
|
documentation files (the "Font Software"), to reproduce and distribute
|
||||||
|
the Font Software, including without limitation the rights to use,
|
||||||
|
copy, merge, publish, distribute, and/or sell copies of the Font
|
||||||
|
Software, and to permit persons to whom the Font Software is furnished
|
||||||
|
to do so, subject to the following conditions:
|
||||||
|
.
|
||||||
|
The above copyright and trademark notices and this permission notice
|
||||||
|
shall be included in all copies of one or more of the Font Software
|
||||||
|
typefaces.
|
||||||
|
.
|
||||||
|
The Font Software may be modified, altered, or added to, and in
|
||||||
|
particular the designs of glyphs or characters in the Fonts may be
|
||||||
|
modified and additional glyphs or characters may be added to the
|
||||||
|
Fonts, only if the fonts are renamed to names not containing either
|
||||||
|
the words "Bitstream" or the word "Vera".
|
||||||
|
.
|
||||||
|
This License becomes null and void to the extent applicable to Fonts
|
||||||
|
or Font Software that has been modified and is distributed under the
|
||||||
|
"Bitstream Vera" names.
|
||||||
|
.
|
||||||
|
The Font Software may be sold as part of a larger software package but
|
||||||
|
no copy of one or more of the Font Software typefaces may be sold by
|
||||||
|
itself.
|
||||||
|
.
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||||
|
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
|
||||||
|
BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL,
|
||||||
|
OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT
|
||||||
|
SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||||
|
.
|
||||||
|
Except as contained in this notice, the names of Gnome, the Gnome
|
||||||
|
Foundation, and Bitstream Inc., shall not be used in advertising or
|
||||||
|
otherwise to promote the sale, use or other dealings in this Font
|
||||||
|
Software without prior written authorization from the Gnome Foundation
|
||||||
|
or Bitstream Inc., respectively. For further information, contact:
|
||||||
|
fonts at gnome dot org.
|
||||||
|
Comments:
|
||||||
|
Those files are not shipped in the binary package as we
|
||||||
|
configure Dolibarr to use Dejavu fonts from "fonts-dejavu-core".
|
||||||
|
|
||||||
|
Files: docs/images/*
|
||||||
|
Copyright: Laurent Destailleur
|
||||||
|
License: CC-BY-SA-3.0
|
||||||
|
You are free:
|
||||||
|
to Share (to copy, distribute and transmit the work) and
|
||||||
|
to Remix (to adapt the work) under the following conditions:
|
||||||
|
.
|
||||||
|
Attribution - You must attribute the work in the manner specified by the
|
||||||
|
author or licensor (but not in any way that suggests that they endorse you
|
||||||
|
or your use of the work).
|
||||||
|
.
|
||||||
|
Share Alike - If you alter, transform, or build upon this work, you may
|
||||||
|
distribute the resulting work only under the same, similar or a compatible
|
||||||
|
license.
|
||||||
|
.
|
||||||
|
For more information, see http://creativecommons.org/licenses/by-sa/3.0/
|
||||||
|
|
||||||
Files: htdocs/includes/fpdi/*
|
Files: htdocs/includes/fpdi/*
|
||||||
Copyright: FPDFI team
|
Copyright: 2004-2011 Setasign - Jan Slabon
|
||||||
License: GPL-2+
|
License: GPL-2+
|
||||||
This program is free software; you can redistribute it
|
This program is free software; you can redistribute it
|
||||||
and/or modify it under the terms of the GNU General Public
|
and/or modify it under the terms of the GNU General Public
|
||||||
@ -80,11 +197,35 @@ License: GPL-2+
|
|||||||
On Debian systems, the full text of the GNU General Public
|
On Debian systems, the full text of the GNU General Public
|
||||||
License version 2 can be found in the file
|
License version 2 can be found in the file
|
||||||
`/usr/share/common-licenses/GPL-2'.
|
`/usr/share/common-licenses/GPL-2'.
|
||||||
|
Comment:
|
||||||
|
Those files are not shipped in the binary package as we
|
||||||
|
configure Dolibarr to use the library packaged in "libfpdi-php".
|
||||||
|
|
||||||
|
Files: htdocs/includes/geoip/*
|
||||||
|
Copyright: 2007 MaxMind LLC
|
||||||
|
License: LGPL-2.1+
|
||||||
|
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 program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
.
|
||||||
|
On Debian systems, the full text of the GNU Lesser General Public
|
||||||
|
License version 2.1 can be found in the file
|
||||||
|
`/usr/share/common-licenses/LGPL-2.1'.
|
||||||
|
|
||||||
Files: htdocs/includes/jquery/*
|
Files: htdocs/includes/jquery/*
|
||||||
Copyright: JQuery team
|
Copyright: JQuery team
|
||||||
License: MIT or GPL-2+
|
License: GPL-2+ or MIT
|
||||||
|
=== GPL-2+ LICENSE NOTICE ===
|
||||||
|
.
|
||||||
This program is free software; you can redistribute it
|
This program is free software; you can redistribute it
|
||||||
and/or modify it under the terms of the GNU General Public
|
and/or modify it under the terms of the GNU General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
@ -104,6 +245,8 @@ License: MIT or GPL-2+
|
|||||||
License version 2 can be found in the file
|
License version 2 can be found in the file
|
||||||
`/usr/share/common-licenses/GPL-2'.
|
`/usr/share/common-licenses/GPL-2'.
|
||||||
.
|
.
|
||||||
|
=== MIT LICENSE ===
|
||||||
|
.
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
@ -121,13 +264,19 @@ License: MIT or GPL-2+
|
|||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
|
Comment:
|
||||||
|
JQuery itself is not shipped in the binary package, instead Dolibarr is
|
||||||
|
configured to use the packaged version from "libjs-jquery" and
|
||||||
|
"libjs-jquery-ui". Most of the plugins are shipped though.
|
||||||
|
|
||||||
|
|
||||||
Files: htdocs/includes/jquery/plugins/flot/*
|
Files: htdocs/includes/jquery/plugins/flot/*
|
||||||
Copyright: Flot team
|
Copyright: Flot team
|
||||||
License: Public Domain
|
License: Public Domain
|
||||||
This work is not subject to copyright in any jurisdiction
|
This work is not subject to copyright in any jurisdiction
|
||||||
|
Comment:
|
||||||
|
Those files are not shipped in the binary package because we configure
|
||||||
|
Dolibarr to use the files provided by "libjs-flot".
|
||||||
|
|
||||||
Files: htdocs/includes/jsgantt/*
|
Files: htdocs/includes/jsgantt/*
|
||||||
Copyright: JSGantt team
|
Copyright: JSGantt team
|
||||||
@ -151,12 +300,28 @@ License: GPL-2+
|
|||||||
License version 2 can be found in the file
|
License version 2 can be found in the file
|
||||||
`/usr/share/common-licenses/GPL-2'.
|
`/usr/share/common-licenses/GPL-2'.
|
||||||
|
|
||||||
|
Files: htdocs/includes/nusoap/*
|
||||||
Files: htdocs/includes/phpexcel/*
|
Copyright: 2002-2010 NuSphere Corporation
|
||||||
Copyright: PHPExcel team
|
License: LGPL-2.1+
|
||||||
License: LGPL 2.1
|
This library is free software; you can redistribute it and/or
|
||||||
See http://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html
|
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 program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
.
|
||||||
|
On Debian systems, the full text of the GNU Lesser General Public
|
||||||
|
License version 2.1 can be found in the file
|
||||||
|
`/usr/share/common-licenses/LGPL-2.1'.
|
||||||
|
Comment:
|
||||||
|
Those files are not shipped in the binary package since we
|
||||||
|
configure Dolibarr to use the library provided in "libnusoap-php".
|
||||||
|
|
||||||
Files: htdocs/includes/odtphp/*
|
Files: htdocs/includes/odtphp/*
|
||||||
Copyright: 2008, Julien Pauli
|
Copyright: 2008, Julien Pauli
|
||||||
@ -182,8 +347,44 @@ License: GPL-2+
|
|||||||
License version 2 can be found in the file
|
License version 2 can be found in the file
|
||||||
`/usr/share/common-licenses/GPL-2'.
|
`/usr/share/common-licenses/GPL-2'.
|
||||||
|
|
||||||
|
Files: htdocs/includes/phpexcel/*
|
||||||
|
Copyright: 2006-2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
License: LGPL-2.1+
|
||||||
|
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 program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
.
|
||||||
|
On Debian systems, the full text of the GNU Lesser General Public
|
||||||
|
License version 2.1 can be found in the file
|
||||||
|
`/usr/share/common-licenses/LGPL-2.1'.
|
||||||
|
|
||||||
Files: htdocs/includes/tcpdf/*
|
Files: htdocs/includes/tcpdf/*
|
||||||
Copyright: TCPDF team
|
Copyright: 2002-2013 Nicola Asuni - Tecnick.com LTD
|
||||||
License: LGPL 3.0
|
License: LGPL-3.0+
|
||||||
See http://www.gnu.org/licenses/old-licenses/lgpl-3.0-standalone.html
|
TCPDF 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 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
.
|
||||||
|
TCPDF 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 TCPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
.
|
||||||
|
On Debian systems, the complete text of the GNU Lesser General
|
||||||
|
Public License version 3 can be found in "/usr/share/common-licenses/LGPL-3".
|
||||||
|
Comment:
|
||||||
|
Those files are not shipped in the binary package since we configure
|
||||||
|
Dolibarr to use the library provided by "php-tcpdf".
|
||||||
|
|||||||
40
build/debian/get-orig-source.sh
Executable file
40
build/debian/get-orig-source.sh
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# run with
|
||||||
|
# debian/get-orig-source.sh [x.y.z]
|
||||||
|
|
||||||
|
tmpdir=$(mktemp -d)
|
||||||
|
echo "tmpdir = $tmpdir"
|
||||||
|
|
||||||
|
if [ -n "$1" ]; then
|
||||||
|
uscan_opts="--download-version=$1"
|
||||||
|
fi
|
||||||
|
uscan --noconf --force-download --no-symlink --verbose --destdir=$tmpdir $uscan_opts
|
||||||
|
|
||||||
|
cd $tmpdir
|
||||||
|
|
||||||
|
tgzfile=$(echo *.tar.gz)
|
||||||
|
version=$(echo "$tgzfile" | perl -pi -e 's/^dolibarr_//; s/\.zip$//; s/_/./g; s/\+nmu1//; s/$/+dfsg/;')
|
||||||
|
|
||||||
|
# Extract the zip file
|
||||||
|
tar -xvf $tgzfile
|
||||||
|
srcdir=$(find . -maxdepth 1 -mindepth 1 -type d | sed -e 's/\.\///')
|
||||||
|
|
||||||
|
if [ ! -d "$srcdir" ]; then
|
||||||
|
echo "ERROR: Failed to identify the extracted directory in $tmpdir (got $srcdir)" >&2
|
||||||
|
rm -rf $tmpdir
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Repack as tar.xz
|
||||||
|
tar Jcf dolibarr_${version}.orig.tar.xz $srcdir
|
||||||
|
|
||||||
|
cd - >/dev/null
|
||||||
|
|
||||||
|
if [ -e ../dolibarr_${version}.orig.tar.xz ]; then
|
||||||
|
echo "Not overwriting ../dolibarr_${version}.orig.tar.xz";
|
||||||
|
else
|
||||||
|
echo "Created ../dolibarr_${version}.orig.tar.xz"
|
||||||
|
mv $tmpdir/dolibarr_${version}.orig.tar.xz ../
|
||||||
|
fi
|
||||||
|
|
||||||
|
#rm -rf $tmpdir
|
||||||
@ -1,3 +0,0 @@
|
|||||||
# watch control file for uscan
|
|
||||||
#version=3
|
|
||||||
#http://http://sourceforge.net/projects/dolibarr/files/Dolibarr%20installer%20for%20Debian-Ubuntu%20%28DoliDeb%29/ debian uupdate
|
|
||||||
4
build/debian/watch
Normal file
4
build/debian/watch
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# watch control file for uscan
|
||||||
|
version=3
|
||||||
|
#http://sf.net/dolibarr/dolibarr-(.+)\.tgz
|
||||||
|
http://www.dolibarr.org/files/stable/package_debian-ubuntu/dolibarr_(.+)\.tar\.gz
|
||||||
@ -31,7 +31,7 @@ PROJECT_NAME = dolibarr
|
|||||||
# This could be handy for archiving the generated documentation or
|
# This could be handy for archiving the generated documentation or
|
||||||
# if some version control system is used.
|
# if some version control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER = 3.4.0
|
PROJECT_NUMBER = 3.4.1
|
||||||
|
|
||||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||||
# base path where the generated documentation will be put.
|
# base path where the generated documentation will be put.
|
||||||
|
|||||||
@ -17,9 +17,9 @@
|
|||||||
; ----- Change this -----
|
; ----- Change this -----
|
||||||
AppName=DoliWamp
|
AppName=DoliWamp
|
||||||
; DoliWamp-x.x.x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x
|
; DoliWamp-x.x.x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x
|
||||||
AppVerName=DoliWamp-3.4.0
|
AppVerName=DoliWamp-3.4.1
|
||||||
; DoliWamp-x.x x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x
|
; DoliWamp-x.x x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x
|
||||||
OutputBaseFilename=DoliWamp-3.4.0
|
OutputBaseFilename=DoliWamp-3.4.1
|
||||||
; Define full path from wich all relative path are defined
|
; Define full path from wich all relative path are defined
|
||||||
; You must modify this to put here your dolibarr root directory
|
; You must modify this to put here your dolibarr root directory
|
||||||
;SourceDir=Z:\home\ldestailleur\git\dolibarrxxx
|
;SourceDir=Z:\home\ldestailleur\git\dolibarrxxx
|
||||||
@ -107,13 +107,13 @@ Source: "C:\Program Files\Wamp\bin\apache\apache2.2.11\*.*"; DestDir: "{app}\bin
|
|||||||
Source: "C:\Program Files\Wamp\bin\php\php5.3.0\*.*"; DestDir: "{app}\bin\php\php5.3.0"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log"
|
Source: "C:\Program Files\Wamp\bin\php\php5.3.0\*.*"; DestDir: "{app}\bin\php\php5.3.0"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log"
|
||||||
Source: "C:\Program Files\Wamp\bin\mysql\mysql5.0.45\*.*"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe"
|
Source: "C:\Program Files\Wamp\bin\mysql\mysql5.0.45\*.*"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe"
|
||||||
; Mysql data files (does not overwrite if exists)
|
; Mysql data files (does not overwrite if exists)
|
||||||
Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db"
|
Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db"
|
||||||
; Dolibarr
|
; Dolibarr
|
||||||
Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,documents\*,includes\savant\*,includes\phpmailer\*,jquery\plugins\template\*,PHPExcel\Shared\PDF\*,PHPExcel\Shared\PCLZip\*,tcpdf\fonts\dejavu-fonts-ttf-2.33\*,tcpdf\fonts\freefont-20100919\*,tcpdf\fonts\utils\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\conf.php.sav,*\install.forced.php"
|
Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,documents\*,includes\ckeditor\_source\*,includes\savant\*,includes\phpmailer\*,jquery\plugins\template\*,PHPExcel\Shared\PDF\*,PHPExcel\Shared\PCLZip\*,tcpdf\fonts\dejavu-fonts-ttf-2.33\*,tcpdf\fonts\freefont-20100919\*,tcpdf\fonts\utils\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\conf.php.sav,*\install.forced.php"
|
||||||
Source: "dev\*.*"; DestDir: "{app}\www\dolibarr\dev"; Flags: ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db,dbmodel\*,fpdf\*,initdata\*,iso-normes\*,licence\*,phpcheckstyle\*,phpunit\*,samples\*,test\*,uml\*,xdebug\*"
|
Source: "dev\*.*"; DestDir: "{app}\www\dolibarr\dev"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,dbmodel\*,fpdf\*,initdata\*,iso-normes\*,licence\*,phpcheckstyle\*,phpunit\*,samples\*,test\*,uml\*,xdebug\*"
|
||||||
Source: "doc\*.*"; DestDir: "{app}\www\dolibarr\doc"; Flags: ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db,wiki\*,plaquette\*,dev\*,images\dolibarr_screenshot2.png,images\dolibarr_screenshot3.png,images\dolibarr_screenshot4.png,images\dolibarr_screenshot5.png,images\dolibarr_screenshot6.png,images\dolibarr_screenshot7.png,images\dolibarr_screenshot8.png,images\dolibarr_screenshot9.png,images\dolibarr_screenshot10.png,images\dolibarr_screenshot11.png,images\dolibarr_screenshot12.png"
|
Source: "doc\*.*"; DestDir: "{app}\www\dolibarr\doc"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,wiki\*,plaquette\*,dev\*,images\dolibarr_screenshot2.png,images\dolibarr_screenshot3.png,images\dolibarr_screenshot4.png,images\dolibarr_screenshot5.png,images\dolibarr_screenshot6.png,images\dolibarr_screenshot7.png,images\dolibarr_screenshot8.png,images\dolibarr_screenshot9.png,images\dolibarr_screenshot10.png,images\dolibarr_screenshot11.png,images\dolibarr_screenshot12.png"
|
||||||
Source: "scripts\*.*"; DestDir: "{app}\www\dolibarr\scripts"; Flags: ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db,product\materiel.net.php,product\import-product.php"
|
Source: "scripts\*.*"; DestDir: "{app}\www\dolibarr\scripts"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,product\materiel.net.php,product\import-product.php"
|
||||||
Source: "*.*"; DestDir: "{app}\www\dolibarr"; Flags: ignoreversion; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db,default.properties,install.lock"
|
Source: "*.*"; DestDir: "{app}\www\dolibarr"; Flags: ignoreversion; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,default.properties,install.lock"
|
||||||
; Config files
|
; Config files
|
||||||
Source: "build\exe\doliwamp\phpmyadmin.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion;
|
Source: "build\exe\doliwamp\phpmyadmin.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion;
|
||||||
Source: "build\exe\doliwamp\dolibarr.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion;
|
Source: "build\exe\doliwamp\dolibarr.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion;
|
||||||
|
|||||||
@ -10,7 +10,7 @@ use Cwd;
|
|||||||
$PROJECT="dolibarr";
|
$PROJECT="dolibarr";
|
||||||
$MAJOR="3";
|
$MAJOR="3";
|
||||||
$MINOR="4";
|
$MINOR="4";
|
||||||
$BUILD="0"; # Mettre x pour release, x-dev pour dev, x-beta pour beta, x-rc pour release candidate
|
$BUILD="1"; # Mettre x pour release, x-dev pour dev, x-beta pour beta, x-rc pour release candidate
|
||||||
$RPMSUBVERSION="auto"; # auto use value found into BUILD
|
$RPMSUBVERSION="auto"; # auto use value found into BUILD
|
||||||
|
|
||||||
@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages
|
@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages
|
||||||
@ -18,6 +18,7 @@ $RPMSUBVERSION="auto"; # auto use value found into BUILD
|
|||||||
"SNAPSHOT"=>"tar",
|
"SNAPSHOT"=>"tar",
|
||||||
"TGZ"=>"tar",
|
"TGZ"=>"tar",
|
||||||
"ZIP"=>"7z",
|
"ZIP"=>"7z",
|
||||||
|
"XZ"=>"xz",
|
||||||
"RPM_GENERIC"=>"rpmbuild",
|
"RPM_GENERIC"=>"rpmbuild",
|
||||||
"RPM_FEDORA"=>"rpmbuild",
|
"RPM_FEDORA"=>"rpmbuild",
|
||||||
"RPM_MANDRIVA"=>"rpmbuild",
|
"RPM_MANDRIVA"=>"rpmbuild",
|
||||||
@ -35,6 +36,7 @@ $FILENAME="$PROJECT";
|
|||||||
$FILENAMESNAPSHOT="$PROJECT-snapshot";
|
$FILENAMESNAPSHOT="$PROJECT-snapshot";
|
||||||
$FILENAMETGZ="$PROJECT-$MAJOR.$MINOR.$BUILD";
|
$FILENAMETGZ="$PROJECT-$MAJOR.$MINOR.$BUILD";
|
||||||
$FILENAMEZIP="$PROJECT-$MAJOR.$MINOR.$BUILD";
|
$FILENAMEZIP="$PROJECT-$MAJOR.$MINOR.$BUILD";
|
||||||
|
$FILENAMEXZ="$PROJECT-$MAJOR.$MINOR.$BUILD";
|
||||||
$FILENAMERPM="$PROJECT-$MAJOR.$MINOR.$BUILD-$RPMSUBVERSION";
|
$FILENAMERPM="$PROJECT-$MAJOR.$MINOR.$BUILD-$RPMSUBVERSION";
|
||||||
$FILENAMEDEB="${PROJECT}_${MAJOR}.${MINOR}.${BUILD}";
|
$FILENAMEDEB="${PROJECT}_${MAJOR}.${MINOR}.${BUILD}";
|
||||||
$FILENAMEAPS="$PROJECT-$MAJOR.$MINOR.$BUILD.app";
|
$FILENAMEAPS="$PROJECT-$MAJOR.$MINOR.$BUILD.app";
|
||||||
@ -179,6 +181,7 @@ foreach my $target (keys %CHOOSEDTARGET) {
|
|||||||
print "Test requirement for target $target: Search '$req'... ";
|
print "Test requirement for target $target: Search '$req'... ";
|
||||||
$newreq=$req; $newparam='';
|
$newreq=$req; $newparam='';
|
||||||
if ($newreq eq 'zip') { $newparam.='-h'; }
|
if ($newreq eq 'zip') { $newparam.='-h'; }
|
||||||
|
if ($newreq eq 'xz') { $newparam.='-h'; }
|
||||||
$cmd="\"$newreq\" $newparam 2>&1";
|
$cmd="\"$newreq\" $newparam 2>&1";
|
||||||
print "Test command ".$cmd."... ";
|
print "Test command ".$cmd."... ";
|
||||||
$ret=`$cmd`;
|
$ret=`$cmd`;
|
||||||
@ -274,6 +277,7 @@ if ($nboftargetok) {
|
|||||||
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar`;
|
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar`;
|
||||||
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar.gz`;
|
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar.gz`;
|
||||||
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tgz`;
|
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tgz`;
|
||||||
|
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.xz`;
|
||||||
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.zip`;
|
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.zip`;
|
||||||
$ret=`rm -f $BUILDROOT/$PROJECT/build/doxygen/doxygen_warnings.log`;
|
$ret=`rm -f $BUILDROOT/$PROJECT/build/doxygen/doxygen_warnings.log`;
|
||||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/cache.manifest`;
|
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/cache.manifest`;
|
||||||
@ -367,7 +371,7 @@ if ($nboftargetok) {
|
|||||||
|
|
||||||
print "Compress $BUILDROOT into $FILENAMESNAPSHOT.tgz...\n";
|
print "Compress $BUILDROOT into $FILENAMESNAPSHOT.tgz...\n";
|
||||||
#$cmd="tar --exclude \"$BUILDROOT/tgz/tar_exclude.txt\" --exclude .cache --exclude .settings --exclude conf.php --directory \"$BUILDROOT\" -czvf \"$FILENAMESNAPSHOT.tgz\" $FILENAMESNAPSHOT";
|
#$cmd="tar --exclude \"$BUILDROOT/tgz/tar_exclude.txt\" --exclude .cache --exclude .settings --exclude conf.php --directory \"$BUILDROOT\" -czvf \"$FILENAMESNAPSHOT.tgz\" $FILENAMESNAPSHOT";
|
||||||
$cmd="tar --exclude doli*.tgz --exclude doli*.deb --exclude doli*.exe --exclude doli*.zip --exclude doli*.rpm --exclude .cache --exclude .settings --exclude conf.php --exclude conf.php.mysql --exclude conf.php.old --exclude conf.php.postgres --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$FILENAMESNAPSHOT.tgz\" $FILENAMESNAPSHOT";
|
$cmd="tar --exclude doli*.tgz --exclude doli*.deb --exclude doli*.exe --exclude doli*.xz --exclude doli*.zip --exclude doli*.rpm --exclude .cache --exclude .settings --exclude conf.php --exclude conf.php.mysql --exclude conf.php.old --exclude conf.php.postgres --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$FILENAMESNAPSHOT.tgz\" $FILENAMESNAPSHOT";
|
||||||
print $cmd."\n";
|
print $cmd."\n";
|
||||||
$ret=`$cmd`;
|
$ret=`$cmd`;
|
||||||
|
|
||||||
@ -403,6 +407,36 @@ if ($nboftargetok) {
|
|||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($target eq 'XZ')
|
||||||
|
{
|
||||||
|
$NEWDESTI=$DESTI;
|
||||||
|
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
|
||||||
|
|
||||||
|
print "Remove target $FILENAMEXZ.xz...\n";
|
||||||
|
unlink("$NEWDESTI/$FILENAMEXZ.xz");
|
||||||
|
|
||||||
|
#rmdir "$BUILDROOT/$FILENAMEXZ";
|
||||||
|
$ret=`rm -fr $BUILDROOT/$FILENAMEXZ`;
|
||||||
|
print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMEXZ\n";
|
||||||
|
$cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$FILENAMEXZ\"";
|
||||||
|
$ret=`$cmd`;
|
||||||
|
|
||||||
|
print "Compress $FILENAMEXZ into $FILENAMEXZ.xz...\n";
|
||||||
|
|
||||||
|
print "Go to directory $BUILDROOT\n";
|
||||||
|
$olddir=getcwd();
|
||||||
|
chdir("$BUILDROOT");
|
||||||
|
$cmd= "xz -9 -r $BUILDROOT/$FILENAMEAPS.xz \*";
|
||||||
|
print $cmd."\n";
|
||||||
|
$ret= `$cmd`;
|
||||||
|
chdir("$olddir");
|
||||||
|
|
||||||
|
# Move to final dir
|
||||||
|
print "Move $FILENAMEXZ.xz to $NEWDESTI/$FILENAMEXZ.xz\n";
|
||||||
|
$ret=`mv "$BUILDROOT/$FILENAMEXZ.xz" "$NEWDESTI/$FILENAMEXZ.xz"`;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
if ($target eq 'ZIP')
|
if ($target eq 'ZIP')
|
||||||
{
|
{
|
||||||
$NEWDESTI=$DESTI;
|
$NEWDESTI=$DESTI;
|
||||||
@ -549,7 +583,7 @@ if ($nboftargetok) {
|
|||||||
$build = $newbuild;
|
$build = $newbuild;
|
||||||
$build =~ s/-.*$//g;
|
$build =~ s/-.*$//g;
|
||||||
# now build is 0 for example
|
# now build is 0 for example
|
||||||
$build .= '+nmu1';
|
# $build .= '+nmu1';
|
||||||
# now build is 0+nmu1 for example
|
# now build is 0+nmu1 for example
|
||||||
|
|
||||||
print "Remove target ${FILENAMEDEB}_all.deb...\n";
|
print "Remove target ${FILENAMEDEB}_all.deb...\n";
|
||||||
|
|||||||
@ -30,7 +30,7 @@ return "Regis Houssin";
|
|||||||
# script_dolibarr_versions()
|
# script_dolibarr_versions()
|
||||||
sub script_dolibarr_versions
|
sub script_dolibarr_versions
|
||||||
{
|
{
|
||||||
return ( "3.4.0", "3.3.3", "3.3.2", "3.3.1", "3.3.0", "3.2.1", "3.1.1" );
|
return ( "3.4.1", "3.4.0", "3.3.3", "3.3.2", "3.3.1", "3.3.0", "3.2.1", "3.1.1" );
|
||||||
}
|
}
|
||||||
|
|
||||||
sub script_dolibarr_category
|
sub script_dolibarr_category
|
||||||
|
|||||||
@ -330,5 +330,5 @@ fi
|
|||||||
|
|
||||||
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
|
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
|
||||||
%changelog
|
%changelog
|
||||||
* Sun Feb 17 2013 Laurent Destailleur 3.4.0-0.3
|
* Sun Feb 17 2013 Laurent Destailleur 3.4.1-0.3
|
||||||
- Initial version (#723326)
|
- Initial version (#723326)
|
||||||
|
|||||||
@ -554,5 +554,5 @@ fi
|
|||||||
|
|
||||||
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
|
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
|
||||||
%changelog
|
%changelog
|
||||||
* Sun Feb 17 2013 Laurent Destailleur 3.4.0-0.3
|
* Sun Feb 17 2013 Laurent Destailleur 3.4.1-0.3
|
||||||
- Initial version (#723326)
|
- Initial version (#723326)
|
||||||
|
|||||||
@ -335,5 +335,5 @@ fi
|
|||||||
|
|
||||||
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
|
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
|
||||||
%changelog
|
%changelog
|
||||||
* Sun Feb 17 2013 Laurent Destailleur 3.4.0-0.3
|
* Sun Feb 17 2013 Laurent Destailleur 3.4.1-0.3
|
||||||
- Initial version (#723326)
|
- Initial version (#723326)
|
||||||
|
|||||||
@ -341,5 +341,5 @@ fi
|
|||||||
|
|
||||||
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
|
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
|
||||||
%changelog
|
%changelog
|
||||||
* Sun Feb 17 2013 Laurent Destailleur 3.4.0-0.3
|
* Sun Feb 17 2013 Laurent Destailleur 3.4.1-0.3
|
||||||
- Initial version (#723326)
|
- Initial version (#723326)
|
||||||
|
|||||||
@ -37,44 +37,28 @@ htdocs/customleave
|
|||||||
htdocs/customgoogle
|
htdocs/customgoogle
|
||||||
htdocs/document
|
htdocs/document
|
||||||
htdocs/documents
|
htdocs/documents
|
||||||
htdocs/includes/jpgraph2
|
htdocs/includes/ckeditor/_source
|
||||||
|
htdocs/includes/ckeditor/*_source.js
|
||||||
htdocs/includes/fckeditor/_samples
|
htdocs/includes/fckeditor/_samples
|
||||||
htdocs/includes/fckeditor/_testcases
|
htdocs/includes/fckeditor/_testcases
|
||||||
htdocs/includes/nusoap/samples
|
htdocs/includes/nusoap/samples
|
||||||
htdocs/includes/phplot5
|
|
||||||
htdocs/includes/scriptaculous/test
|
|
||||||
htdocs/includes/treemenu/docs
|
|
||||||
htdocs/includes/treemenu/images
|
|
||||||
htdocs/includes/treemenu/imagesAlt
|
|
||||||
htdocs/includes/treemenu/imagesAlt2
|
|
||||||
htdocs/includes/tcpdf/fonts/utils
|
htdocs/includes/tcpdf/fonts/utils
|
||||||
htdocs/includes/tcpdf/fonts/free*.ctg.z
|
htdocs/includes/tcpdf/fonts/free*.ctg.z
|
||||||
htdocs/includes/tcpdf/fonts/free*.z
|
htdocs/includes/tcpdf/fonts/free*.z
|
||||||
htdocs/lolix
|
|
||||||
htdocs/oscommerce_ws/ws_client_demo
|
|
||||||
htdocs/postnuke
|
|
||||||
htdocs/public/bplc
|
|
||||||
htdocs/rapport
|
|
||||||
htdocs/theme/rodolphe
|
|
||||||
htdocs/telephonie
|
|
||||||
htdocs/voyage
|
|
||||||
mssql
|
mssql
|
||||||
scripts/addons
|
|
||||||
scripts/books
|
|
||||||
scripts/courrier
|
|
||||||
scripts/lolix
|
|
||||||
scripts/product/import-product.php
|
|
||||||
scripts/product/materiel.net.php
|
|
||||||
test
|
test
|
||||||
CVS
|
CVS
|
||||||
*~
|
*~
|
||||||
.#*
|
.#*
|
||||||
|
.buildpath
|
||||||
.cache
|
.cache
|
||||||
.cvsignore
|
.cvsignore
|
||||||
|
.gitignore
|
||||||
.externalToolBuilders
|
.externalToolBuilders
|
||||||
.htaccess
|
.htaccess
|
||||||
.settings
|
.settings
|
||||||
.project
|
.project
|
||||||
|
.travis.yml
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
data_dev.sql
|
data_dev.sql
|
||||||
doli*.tar.gz
|
doli*.tar.gz
|
||||||
@ -84,18 +68,5 @@ doli*.rpm
|
|||||||
doli*.deb
|
doli*.deb
|
||||||
doli*.zip
|
doli*.zip
|
||||||
cvschangelogbuilder_dolibarr*
|
cvschangelogbuilder_dolibarr*
|
||||||
deneb
|
|
||||||
janus
|
|
||||||
jupiter
|
|
||||||
lune
|
|
||||||
mars
|
|
||||||
pluton
|
|
||||||
saturne
|
|
||||||
venus
|
|
||||||
bigorneau
|
|
||||||
tourteau
|
|
||||||
bulot
|
|
||||||
huitre
|
|
||||||
pdf_huitre.modules.php
|
|
||||||
doxygen_warnings.log
|
doxygen_warnings.log
|
||||||
dolibarr_install.log
|
dolibarr_install.log
|
||||||
@ -31,11 +31,8 @@
|
|||||||
*/htdocs/custom2/*
|
*/htdocs/custom2/*
|
||||||
*/htdocs/document/*
|
*/htdocs/document/*
|
||||||
*/htdocs/documents/*
|
*/htdocs/documents/*
|
||||||
*/htdocs/lolix/*
|
*/htdocs/includes/ckeditor/_source
|
||||||
*/htdocs/postnuke/*
|
*/htdocs/includes/ckeditor/*_source.js
|
||||||
*/htdocs/telephonie/*
|
|
||||||
*/htdocs/voyage/*
|
|
||||||
*/htdocs/includes/jpgraph2/*
|
|
||||||
*/htdocs/includes/fckeditor/_samples/*
|
*/htdocs/includes/fckeditor/_samples/*
|
||||||
*/htdocs/includes/fckeditor/_testcases/*
|
*/htdocs/includes/fckeditor/_testcases/*
|
||||||
*/htdocs/includes/nusoap/samples/*
|
*/htdocs/includes/nusoap/samples/*
|
||||||
@ -49,20 +46,18 @@
|
|||||||
*/htdocs/includes/tcpdf/fonts/utils/*
|
*/htdocs/includes/tcpdf/fonts/utils/*
|
||||||
*/htdocs/includes/tcpdf/fonts/free*.ctg.z
|
*/htdocs/includes/tcpdf/fonts/free*.ctg.z
|
||||||
*/htdocs/includes/tcpdf/fonts/free*.z
|
*/htdocs/includes/tcpdf/fonts/free*.z
|
||||||
*/htdocs/oscommerce_ws/ws_client_demo/*
|
|
||||||
*/htdocs/theme/rodolphe/*
|
|
||||||
*/scripts/addons/*
|
|
||||||
*/scripts/courrier/*
|
|
||||||
*/scripts/lolix/*
|
|
||||||
*/test
|
*/test
|
||||||
*/CVS/*
|
*/CVS/*
|
||||||
*~
|
*~
|
||||||
*.#*
|
*.#*
|
||||||
|
*.buildpath*
|
||||||
*.cache*
|
*.cache*
|
||||||
*.cvsignore*
|
*.cvsignore*
|
||||||
|
*.gitignore*
|
||||||
*.htaccess*
|
*.htaccess*
|
||||||
*.settings*
|
*.settings*
|
||||||
*.project*
|
*.project*
|
||||||
|
*.travis.yml*
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
data_dev.sql
|
data_dev.sql
|
||||||
dolibarr*.tar.gz
|
dolibarr*.tar.gz
|
||||||
@ -72,19 +67,5 @@ dolibarr*.rpm
|
|||||||
dolibarr*.deb
|
dolibarr*.deb
|
||||||
dolibarr*.zip
|
dolibarr*.zip
|
||||||
cvschangelogbuilder_dolibarr*
|
cvschangelogbuilder_dolibarr*
|
||||||
*/deneb/*
|
|
||||||
*/janus/*
|
|
||||||
*/jupiter/*
|
|
||||||
*/lune/*
|
|
||||||
*/mars/*
|
|
||||||
*/mercure/*
|
|
||||||
*/pluton/*
|
|
||||||
*/saturne/*
|
|
||||||
*/venus/*
|
|
||||||
*/bigorneau/*
|
|
||||||
*/tourteau/*
|
|
||||||
*/bulot/*
|
|
||||||
*/huitre/*
|
|
||||||
*/pdf_huitre.modules.php
|
|
||||||
doxygen_warnings.log
|
doxygen_warnings.log
|
||||||
dolibarr_install.log
|
dolibarr_install.log
|
||||||
@ -219,6 +219,10 @@
|
|||||||
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNameInvalid">
|
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNameInvalid">
|
||||||
<severity>0</severity>
|
<severity>0</severity>
|
||||||
</rule>
|
</rule>
|
||||||
|
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNoCapital">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
<!-- some phpcs have a typo error in rule, so we add it too -->
|
||||||
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNoCaptial">
|
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNoCaptial">
|
||||||
<severity>0</severity>
|
<severity>0</severity>
|
||||||
</rule>
|
</rule>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 40 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 7.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB |
@ -5,6 +5,7 @@
|
|||||||
* Copyright (C) 2006-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2006-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||||
|
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -520,7 +521,7 @@ class Categorie
|
|||||||
$sql = "SELECT fk_parent as id_parent, rowid as id_son";
|
$sql = "SELECT fk_parent as id_parent, rowid as id_son";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie";
|
$sql.= " FROM ".MAIN_DB_PREFIX."categorie";
|
||||||
$sql.= " WHERE fk_parent != 0";
|
$sql.= " WHERE fk_parent != 0";
|
||||||
$sql.= " AND entity = ".$conf->entity;
|
$sql.= " AND entity IN (".getEntity('category',1).")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::load_motherof sql=".$sql);
|
dol_syslog(get_class($this)."::load_motherof sql=".$sql);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -1259,6 +1259,7 @@ class Propal extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function valid($user, $notrigger=0)
|
function valid($user, $notrigger=0)
|
||||||
{
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
@ -1305,8 +1306,31 @@ class Propal extends CommonObject
|
|||||||
// Fin appel triggers
|
// Fin appel triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
// Rename directory if dir was a temporary ref
|
||||||
|
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
||||||
|
{
|
||||||
|
// Rename of propal directory ($this->ref = old ref, $num = new ref)
|
||||||
|
// to not lose the linked files
|
||||||
|
$facref = dol_sanitizeFileName($this->ref);
|
||||||
|
$snumfa = dol_sanitizeFileName($num);
|
||||||
|
$dirsource = $conf->propal->dir_output.'/'.$facref;
|
||||||
|
$dirdest = $conf->propal->dir_output.'/'.$snumfa;
|
||||||
|
if (file_exists($dirsource))
|
||||||
|
{
|
||||||
|
dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest);
|
||||||
|
|
||||||
|
if (@rename($dirsource, $dirdest))
|
||||||
|
{
|
||||||
|
|
||||||
|
dol_syslog("Rename ok");
|
||||||
|
// Deleting old PDF in new rep
|
||||||
|
dol_delete_file($conf->propal->dir_output.'/'.$snumfa.'/'.$facref.'*.*');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->brouillon=0;
|
$this->brouillon=0;
|
||||||
$this->statut = 1;
|
$this->statut = 1;
|
||||||
$this->user_valid_id=$user->id;
|
$this->user_valid_id=$user->id;
|
||||||
@ -1315,13 +1339,13 @@ class Propal extends CommonObject
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,10 +3,10 @@
|
|||||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2011 Jean Heimburger <jean@tiaris.info>
|
* Copyright (C) 2011 Jean Heimburger <jean@tiaris.info>
|
||||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU *General Public License as published by
|
* it under the terms of the GNU *General Public License as published by
|
||||||
@ -1597,7 +1597,7 @@ class Commande extends CommonOrder
|
|||||||
if ($filtre_statut >= 0) $sql.= ' ed.fk_expedition = e.rowid AND';
|
if ($filtre_statut >= 0) $sql.= ' ed.fk_expedition = e.rowid AND';
|
||||||
$sql.= ' ed.fk_origin_line = cd.rowid';
|
$sql.= ' ed.fk_origin_line = cd.rowid';
|
||||||
$sql.= ' AND cd.fk_commande =' .$this->id;
|
$sql.= ' AND cd.fk_commande =' .$this->id;
|
||||||
if ($filtre_statut >= 0) $sql.=' AND e.fk_statut = '.$filtre_statut;
|
if ($filtre_statut >= 0) $sql.=' AND e.fk_statut >= '.$filtre_statut;
|
||||||
$sql.= ' GROUP BY cd.rowid, cd.fk_product';
|
$sql.= ' GROUP BY cd.rowid, cd.fk_product';
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,8 @@
|
|||||||
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
|
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -115,7 +116,7 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
print_fiche_titre($langs->trans("CreateRepeatableInvoice"));
|
print_fiche_titre($langs->trans("CreateRepeatableInvoice"));
|
||||||
|
|
||||||
$object = new FactureRec($db); // Source invoice
|
$object = new Facture($db); // Source invoice
|
||||||
$product_static = new Product($db);
|
$product_static = new Product($db);
|
||||||
|
|
||||||
if ($object->fetch($id) > 0)
|
if ($object->fetch($id) > 0)
|
||||||
|
|||||||
@ -111,6 +111,7 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.t
|
|||||||
else $sql.= " AND f.type IN (0,1,2,3)";
|
else $sql.= " AND f.type IN (0,1,2,3)";
|
||||||
if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||||
|
|
||||||
|
dol_syslog("sql=".$sql);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -116,6 +116,7 @@ $sql.= " AND fd.product_type IN (0,1)";
|
|||||||
if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||||
$sql.= " ORDER BY f.rowid";
|
$sql.= " ORDER BY f.rowid";
|
||||||
|
|
||||||
|
dol_syslog("sql=".$sql);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
|
|||||||
1
htdocs/conf/.gitignore
vendored
1
htdocs/conf/.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
|
/conf.php
|
||||||
/conf.php.old
|
/conf.php.old
|
||||||
/conf.php.sav
|
/conf.php.sav
|
||||||
/conf.php.mysql
|
/conf.php.mysql
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
|
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
|
||||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
*
|
*
|
||||||
@ -281,6 +281,7 @@ class Contrat extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function validate($user)
|
function validate($user)
|
||||||
{
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
@ -315,7 +316,36 @@ class Contrat extends CommonObject
|
|||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||||
// Fin appel triggers
|
// Fin appel triggers
|
||||||
|
|
||||||
return 1;
|
if (! $error)
|
||||||
|
{
|
||||||
|
// Rename directory if dir was a temporary ref
|
||||||
|
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
||||||
|
{
|
||||||
|
// Rename of propal directory ($this->ref = old ref, $num = new ref)
|
||||||
|
// to not lose the linked files
|
||||||
|
$facref = dol_sanitizeFileName($this->ref);
|
||||||
|
$snumfa = dol_sanitizeFileName($num);
|
||||||
|
$dirsource = $conf->contract->dir_output.'/'.$facref;
|
||||||
|
$dirdest = $conf->contract->dir_output.'/'.$snumfa;
|
||||||
|
if (file_exists($dirsource))
|
||||||
|
{
|
||||||
|
dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest);
|
||||||
|
|
||||||
|
if (@rename($dirsource, $dirdest))
|
||||||
|
{
|
||||||
|
dol_syslog("Rename ok");
|
||||||
|
// Deleting old PDF in new rep
|
||||||
|
dol_delete_file($conf->contract->dir_output.'/'.$snumfa.'/'.$facref.'*.*');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
/* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
|
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -25,7 +26,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to manage the box to show last contracts
|
* Class to manage the box to show last interventions
|
||||||
*/
|
*/
|
||||||
class box_ficheinter extends ModeleBoxes
|
class box_ficheinter extends ModeleBoxes
|
||||||
{
|
{
|
||||||
@ -95,11 +96,11 @@ class box_ficheinter extends ModeleBoxes
|
|||||||
|
|
||||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||||
'logo' => $this->boximg,
|
'logo' => $this->boximg,
|
||||||
'url' => DOL_URL_ROOT."/ficheinter/fiche.php?id=".$objp->rowid);
|
'url' => DOL_URL_ROOT."/fichinter/fiche.php?id=".$objp->rowid);
|
||||||
|
|
||||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
||||||
'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref
|
'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some interventions have no ref
|
||||||
'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid);
|
'url' => DOL_URL_ROOT."/fichinter/fiche.php?id=".$objp->rowid);
|
||||||
|
|
||||||
$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"',
|
$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"',
|
||||||
'logo' => 'company',
|
'logo' => 'company',
|
||||||
@ -120,7 +121,7 @@ class box_ficheinter extends ModeleBoxes
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedContracts"));
|
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInterventions"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
/**
|
/**
|
||||||
* Parent class of boxes
|
* Parent class of boxes
|
||||||
*/
|
*/
|
||||||
class ModeleBoxes // Can't be abtract as it is instanciated to build "empty" boxes
|
class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" boxes
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
var $error='';
|
var $error='';
|
||||||
|
|||||||
@ -245,7 +245,7 @@ abstract class CommonDocGenerator
|
|||||||
$array_key.'_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement),
|
$array_key.'_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement),
|
||||||
$array_key.'_payment_term_code'=>$object->cond_reglement_code,
|
$array_key.'_payment_term_code'=>$object->cond_reglement_code,
|
||||||
$array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):$object->cond_reglement),
|
$array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):$object->cond_reglement),
|
||||||
$array_key.'_total_ht'=>price($object->total_ht2),
|
$array_key.'_total_ht'=>price($object->total_ht),
|
||||||
$array_key.'_total_vat'=>price($object->total_tva),
|
$array_key.'_total_vat'=>price($object->total_tva),
|
||||||
$array_key.'_total_ttc'=>price($object->total_ttc),
|
$array_key.'_total_ttc'=>price($object->total_ttc),
|
||||||
$array_key.'_total_discount_ht' => price($object->getTotalDiscount()),
|
$array_key.'_total_discount_ht' => price($object->getTotalDiscount()),
|
||||||
|
|||||||
@ -3232,5 +3232,17 @@ abstract class CommonObject
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function __clone()
|
||||||
|
{
|
||||||
|
// Force a copy of this->lines, otherwise it will point to same object.
|
||||||
|
if (isset($this->lines) && is_array($this->lines))
|
||||||
|
{
|
||||||
|
for($i=0; $i < count($this->lines); $i++)
|
||||||
|
{
|
||||||
|
$this->lines[$i] = dol_clone($this->lines[$i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -677,9 +677,9 @@ class ExtraFields
|
|||||||
}
|
}
|
||||||
elseif ($type == 'sellist')
|
elseif ($type == 'sellist')
|
||||||
{
|
{
|
||||||
|
|
||||||
$out='<select class="flat" name="options_'.$key.'">';
|
$out='<select class="flat" name="options_'.$key.'">';
|
||||||
if (is_array($param['options'])) {
|
if (is_array($param['options']))
|
||||||
|
{
|
||||||
$param_list=array_keys($param['options']);
|
$param_list=array_keys($param['options']);
|
||||||
$InfoFieldList = explode(":", $param_list[0]);
|
$InfoFieldList = explode(":", $param_list[0]);
|
||||||
|
|
||||||
@ -698,7 +698,6 @@ class ExtraFields
|
|||||||
|
|
||||||
dol_syslog(get_class($this).'::showInputField type=sellist sql='.$sql);
|
dol_syslog(get_class($this).'::showInputField type=sellist sql='.$sql);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$out.='<option value="0"> </option>';
|
$out.='<option value="0"> </option>';
|
||||||
@ -710,7 +709,7 @@ class ExtraFields
|
|||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
$labeltoshow=dol_trunc($obj->$InfoFieldList[1],18);
|
$labeltoshow=dol_trunc($obj->$InfoFieldList[1],18);
|
||||||
if ($value==$obj->rowid)
|
if ($value==$obj->rowid)
|
||||||
{
|
{
|
||||||
$out.='<option value="'.$obj->rowid.'" selected="selected">'.$labeltoshow.'</option>';
|
$out.='<option value="'.$obj->rowid.'" selected="selected">'.$labeltoshow.'</option>';
|
||||||
}
|
}
|
||||||
@ -721,7 +720,7 @@ class ExtraFields
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->db->free();
|
$this->db->free($resql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$out.='</select>';
|
$out.='</select>';
|
||||||
|
|||||||
@ -362,11 +362,11 @@ class FormOther
|
|||||||
$sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u";
|
$sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||||
$sql_usr.= " WHERE u.entity IN (0,".$conf->entity.")";
|
$sql_usr.= " WHERE u.entity IN (0,".$conf->entity.")";
|
||||||
if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.fk_societe = ".($user->societe_id?$user->societe_id:0);
|
if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.fk_societe = ".($user->societe_id?$user->societe_id:0);
|
||||||
// Add existing sales representatives of company
|
// Add existing sales representatives of thirdparty of external user
|
||||||
if (empty($user->rights->user->user->lire) && $user->societe_id)
|
if (empty($user->rights->user->user->lire) && $user->societe_id)
|
||||||
{
|
{
|
||||||
$sql_usr.=" UNION ";
|
$sql_usr.=" UNION ";
|
||||||
$sql_usr.= "SELECT u2.rowid, u2.name as name, u2.firstname, u2.login";
|
$sql_usr.= "SELECT u2.rowid, u2.lastname as name, u2.firstname, u2.login";
|
||||||
$sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u2, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
$sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u2, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql_usr.= " WHERE u2.entity IN (0,".$conf->entity.")";
|
$sql_usr.= " WHERE u2.entity IN (0,".$conf->entity.")";
|
||||||
$sql_usr.= " AND u2.rowid = sc.fk_user AND sc.fk_soc=".$user->societe_id;
|
$sql_usr.= " AND u2.rowid = sc.fk_user AND sc.fk_soc=".$user->societe_id;
|
||||||
|
|||||||
@ -742,13 +742,18 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n
|
|||||||
{
|
{
|
||||||
$globencoded=str_replace('[','\[',$file_osencoded);
|
$globencoded=str_replace('[','\[',$file_osencoded);
|
||||||
$globencoded=str_replace(']','\]',$globencoded);
|
$globencoded=str_replace(']','\]',$globencoded);
|
||||||
foreach (glob($globencoded) as $filename)
|
$listofdir=glob($globencoded);
|
||||||
|
if (! empty($listofdir) && is_array($listofdir))
|
||||||
{
|
{
|
||||||
if ($nophperrors) $ok=@unlink($filename); // The unlink encapsulated by dolibarr
|
foreach ($listofdir as $filename)
|
||||||
else $ok=unlink($filename); // The unlink encapsulated by dolibarr
|
{
|
||||||
if ($ok) dol_syslog("Removed file ".$filename, LOG_DEBUG);
|
if ($nophperrors) $ok=@unlink($filename); // The unlink encapsulated by dolibarr
|
||||||
else dol_syslog("Failed to remove file ".$filename, LOG_WARNING);
|
else $ok=unlink($filename); // The unlink encapsulated by dolibarr
|
||||||
|
if ($ok) dol_syslog("Removed file ".$filename, LOG_DEBUG);
|
||||||
|
else dol_syslog("Failed to remove file ".$filename, LOG_WARNING);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else dol_syslog("No files to delete found", LOG_WARNING);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -67,7 +67,7 @@ function pdf_getFormat($outputlangs='')
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a PDF instance object. We create a FPDI instance that instanciate TCPDF.
|
* Return a PDF instance object. We create a FPDI instance that instantiate TCPDF.
|
||||||
*
|
*
|
||||||
* @param string $format Array(width,height). Keep empty to use default setup.
|
* @param string $format Array(width,height). Keep empty to use default setup.
|
||||||
* @param string $metric Unit of format ('mm')
|
* @param string $metric Unit of format ('mm')
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
/* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org>
|
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org>
|
||||||
* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -372,8 +373,8 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction,
|
|||||||
{
|
{
|
||||||
if (! isset($list[$assoc['rate']]['totalht'])) $list[$assoc['rate']]['totalht']=0;
|
if (! isset($list[$assoc['rate']]['totalht'])) $list[$assoc['rate']]['totalht']=0;
|
||||||
if (! isset($list[$assoc['rate']]['vat'])) $list[$assoc['rate']]['vat']=0;
|
if (! isset($list[$assoc['rate']]['vat'])) $list[$assoc['rate']]['vat']=0;
|
||||||
if (! isset($list[$assoc['rate']]['locatax1'])) $list[$assoc['rate']]['localtax1']=0;
|
if (! isset($list[$assoc['rate']]['localtax1'])) $list[$assoc['rate']]['localtax1']=0;
|
||||||
if (! isset($list[$assoc['rate']]['locatax2'])) $list[$assoc['rate']]['localtax2']=0;
|
if (! isset($list[$assoc['rate']]['localtax2'])) $list[$assoc['rate']]['localtax2']=0;
|
||||||
|
|
||||||
if ($assoc['rowid'] != $oldrowid) // Si rupture sur d.rowid
|
if ($assoc['rowid'] != $oldrowid) // Si rupture sur d.rowid
|
||||||
{
|
{
|
||||||
@ -536,8 +537,8 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction,
|
|||||||
{
|
{
|
||||||
if (! isset($list[$assoc['rate']]['totalht'])) $list[$assoc['rate']]['totalht']=0;
|
if (! isset($list[$assoc['rate']]['totalht'])) $list[$assoc['rate']]['totalht']=0;
|
||||||
if (! isset($list[$assoc['rate']]['vat'])) $list[$assoc['rate']]['vat']=0;
|
if (! isset($list[$assoc['rate']]['vat'])) $list[$assoc['rate']]['vat']=0;
|
||||||
if (! isset($list[$assoc['rate']]['locatax1'])) $list[$assoc['rate']]['localtax1']=0;
|
if (! isset($list[$assoc['rate']]['localtax1'])) $list[$assoc['rate']]['localtax1']=0;
|
||||||
if (! isset($list[$assoc['rate']]['locatax2'])) $list[$assoc['rate']]['localtax2']=0;
|
if (! isset($list[$assoc['rate']]['localtax2'])) $list[$assoc['rate']]['localtax2']=0;
|
||||||
|
|
||||||
if ($assoc['rowid'] != $oldrowid) // Si rupture sur d.rowid
|
if ($assoc['rowid'] != $oldrowid) // Si rupture sur d.rowid
|
||||||
{
|
{
|
||||||
|
|||||||
@ -214,7 +214,8 @@ class MenuManager
|
|||||||
print str_pad('',1).'<li data-role="list-divider" class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
|
print str_pad('',1).'<li data-role="list-divider" class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
|
||||||
print '<a href="'.$relurl.'">';
|
print '<a href="'.$relurl.'">';
|
||||||
print str_pad('',12,' ');
|
print str_pad('',12,' ');
|
||||||
print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
|
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") print $langs->trans("Access"); // No translation
|
||||||
|
else print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print '</li>'."\n";
|
print '</li>'."\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -168,7 +168,8 @@ class MenuManager
|
|||||||
print str_pad('',1).'<li data-role="list-divider" class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
|
print str_pad('',1).'<li data-role="list-divider" class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
|
||||||
print '<a href="'.$relurl.'">';
|
print '<a href="'.$relurl.'">';
|
||||||
print str_pad('',12,' ');
|
print str_pad('',12,' ');
|
||||||
print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
|
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") print $langs->trans("Access"); // No translation
|
||||||
|
else print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print '</li>'."\n";
|
print '</li>'."\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||||
|
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -119,7 +120,7 @@ class mod_arctic extends ModeleNumRefFicheinter
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$numFinal=get_next_value($db,$mask,'fichinter','ref','',$objsoc->code_client,$object->date);
|
$numFinal=get_next_value($db,$mask,'fichinter','ref','',$objsoc->code_client,$object->datec);
|
||||||
|
|
||||||
return $numFinal;
|
return $numFinal;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -121,7 +122,7 @@ class mod_pacific extends ModeleNumRefFicheinter
|
|||||||
}
|
}
|
||||||
|
|
||||||
//$date=time();
|
//$date=time();
|
||||||
$date=$object->date;
|
$date=$object->datec;
|
||||||
$yymm = strftime("%y%m",$date);
|
$yymm = strftime("%y%m",$date);
|
||||||
$num = sprintf("%04s",$max+1);
|
$num = sprintf("%04s",$max+1);
|
||||||
|
|
||||||
|
|||||||
@ -202,8 +202,9 @@ class mailing_contacts1 extends MailingTargets
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc";
|
||||||
$sql.= " WHERE c.entity IN (".getEntity('societe', 1).")";
|
$sql.= " WHERE c.entity IN (".getEntity('societe', 1).")";
|
||||||
$sql.= " AND c.email != ''";
|
$sql.= " AND c.email <> ''";
|
||||||
$sql.= " AND c.no_email = 0";
|
$sql.= " AND c.no_email = 0";
|
||||||
|
$sql.= " AND c.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
|
||||||
foreach($filtersarray as $key)
|
foreach($filtersarray as $key)
|
||||||
{
|
{
|
||||||
if ($key == 'prospects') $sql.= " AND s.client=2";
|
if ($key == 'prospects') $sql.= " AND s.client=2";
|
||||||
|
|||||||
@ -84,9 +84,10 @@ class mailing_contacts2 extends MailingTargets
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
|
||||||
$sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")";
|
$sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")";
|
||||||
$sql.= " AND sp.email != ''"; // Note that null != '' is false
|
$sql.= " AND sp.email <> ''"; // Note that null != '' is false
|
||||||
$sql.= " AND sp.no_email = 0";
|
$sql.= " AND sp.no_email = 0";
|
||||||
//$sql.= " AND sp.poste != ''";
|
//$sql.= " AND sp.poste != ''";
|
||||||
|
$sql.= " AND sp.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
|
||||||
if ($filtersarray[0]<>'all') $sql.= " AND sp.poste ='".$this->db->escape($filtersarray[0])."'";
|
if ($filtersarray[0]<>'all') $sql.= " AND sp.poste ='".$this->db->escape($filtersarray[0])."'";
|
||||||
$sql.= " ORDER BY sp.lastname, sp.firstname";
|
$sql.= " ORDER BY sp.lastname, sp.firstname";
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -83,9 +83,10 @@ class mailing_contacts3 extends MailingTargets
|
|||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
|
||||||
if ($filtersarray[0] <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie as c";
|
if ($filtersarray[0] <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie as c";
|
||||||
if ($filtersarray[0] <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as cs";
|
if ($filtersarray[0] <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as cs";
|
||||||
$sql.= " WHERE sp.email != ''"; // Note that null != '' is false
|
$sql.= " WHERE sp.email <> ''"; // Note that null != '' is false
|
||||||
$sql.= " AND sp.no_email = 0";
|
$sql.= " AND sp.no_email = 0";
|
||||||
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
|
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
|
||||||
|
$sql.= " AND sp.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
|
||||||
if ($filtersarray[0] <> 'all') $sql.= " AND cs.fk_categorie = c.rowid";
|
if ($filtersarray[0] <> 'all') $sql.= " AND cs.fk_categorie = c.rowid";
|
||||||
if ($filtersarray[0] <> 'all') $sql.= " AND cs.fk_societe = sp.fk_soc";
|
if ($filtersarray[0] <> 'all') $sql.= " AND cs.fk_societe = sp.fk_soc";
|
||||||
if ($filtersarray[0] <> 'all') $sql.= " AND c.label = '".$this->db->escape($filtersarray[0])."'";
|
if ($filtersarray[0] <> 'all') $sql.= " AND c.label = '".$this->db->escape($filtersarray[0])."'";
|
||||||
|
|||||||
@ -169,7 +169,8 @@ class mailing_fraise extends MailingTargets
|
|||||||
$sql.= " a.lastname, a.firstname,";
|
$sql.= " a.lastname, a.firstname,";
|
||||||
$sql.= " a.datefin, a.civilite, a.login, a.societe"; // Other fields
|
$sql.= " a.datefin, a.civilite, a.login, a.societe"; // Other fields
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a";
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a";
|
||||||
$sql.= " WHERE a.email IS NOT NULL";
|
$sql.= " WHERE a.email <> ''"; // Note that null != '' is false
|
||||||
|
$sql.= " AND a.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
|
||||||
if (isset($_POST["filter"]) && $_POST["filter"] == '-1') $sql.= " AND a.statut=-1";
|
if (isset($_POST["filter"]) && $_POST["filter"] == '-1') $sql.= " AND a.statut=-1";
|
||||||
if (isset($_POST["filter"]) && $_POST["filter"] == '1a') $sql.= " AND a.statut=1 AND a.datefin >= '".$this->db->idate($now)."'";
|
if (isset($_POST["filter"]) && $_POST["filter"] == '1a') $sql.= " AND a.statut=1 AND a.datefin >= '".$this->db->idate($now)."'";
|
||||||
if (isset($_POST["filter"]) && $_POST["filter"] == '1b') $sql.= " AND a.statut=1 AND (a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."')";
|
if (isset($_POST["filter"]) && $_POST["filter"] == '1b') $sql.= " AND a.statut=1 AND (a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."')";
|
||||||
|
|||||||
@ -150,8 +150,9 @@ class mailing_pomme extends MailingTargets
|
|||||||
$sql = "SELECT u.rowid as id, u.email as email, null as fk_contact,";
|
$sql = "SELECT u.rowid as id, u.email as email, null as fk_contact,";
|
||||||
$sql.= " u.lastname as name, u.firstname as firstname, u.login, u.office_phone";
|
$sql.= " u.lastname as name, u.firstname as firstname, u.login, u.office_phone";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||||
$sql.= " WHERE u.email != ''"; // u.email IS NOT NULL est implicite dans ce test
|
$sql.= " WHERE u.email <> ''"; // u.email IS NOT NULL est implicite dans ce test
|
||||||
$sql.= " AND u.entity IN (0,".$conf->entity.")";
|
$sql.= " AND u.entity IN (0,".$conf->entity.")";
|
||||||
|
$sql.= " AND u.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
|
||||||
foreach($filtersarray as $key)
|
foreach($filtersarray as $key)
|
||||||
{
|
{
|
||||||
if ($key == '1') $sql.= " AND u.statut=1";
|
if ($key == '1') $sql.= " AND u.statut=1";
|
||||||
|
|||||||
@ -63,23 +63,26 @@ class mailing_thirdparties extends MailingTargets
|
|||||||
{
|
{
|
||||||
$sql = "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, null as label";
|
$sql = "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, null as label";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql.= " WHERE s.email != ''";
|
$sql.= " WHERE s.email <> ''";
|
||||||
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
|
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
|
||||||
|
$sql.= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, c.label as label";
|
$sql = "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, c.label as label";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."categorie_societe as cs, ".MAIN_DB_PREFIX."categorie as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."categorie_societe as cs, ".MAIN_DB_PREFIX."categorie as c";
|
||||||
$sql.= " WHERE s.email != ''";
|
$sql.= " WHERE s.email <> ''";
|
||||||
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
|
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
|
||||||
|
$sql.= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
|
||||||
$sql.= " AND cs.fk_societe = s.rowid";
|
$sql.= " AND cs.fk_societe = s.rowid";
|
||||||
$sql.= " AND c.rowid = cs.fk_categorie";
|
$sql.= " AND c.rowid = cs.fk_categorie";
|
||||||
$sql.= " AND c.rowid='".$this->db->escape($_POST['filter'])."'";
|
$sql.= " AND c.rowid='".$this->db->escape($_POST['filter'])."'";
|
||||||
$sql.= " UNION ";
|
$sql.= " UNION ";
|
||||||
$sql.= "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, c.label as label";
|
$sql.= "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, c.label as label";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."categorie_fournisseur as cs, ".MAIN_DB_PREFIX."categorie as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."categorie_fournisseur as cs, ".MAIN_DB_PREFIX."categorie as c";
|
||||||
$sql.= " WHERE s.email != ''";
|
$sql.= " WHERE s.email <> ''";
|
||||||
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
|
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
|
||||||
|
$sql.= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
|
||||||
$sql.= " AND cs.fk_societe = s.rowid";
|
$sql.= " AND cs.fk_societe = s.rowid";
|
||||||
$sql.= " AND c.rowid = cs.fk_categorie";
|
$sql.= " AND c.rowid = cs.fk_categorie";
|
||||||
$sql.= " AND c.rowid='".$this->db->escape($_POST['filter'])."'";
|
$sql.= " AND c.rowid='".$this->db->escape($_POST['filter'])."'";
|
||||||
|
|||||||
@ -100,6 +100,7 @@ class mailing_thirdparties_services_expired extends MailingTargets
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."product as p";
|
$sql.= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."product as p";
|
||||||
$sql.= " WHERE s.entity IN (".getEntity('societe', 1).")";
|
$sql.= " WHERE s.entity IN (".getEntity('societe', 1).")";
|
||||||
|
$sql.= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
|
||||||
$sql.= " AND s.rowid = c.fk_soc AND cd.fk_contrat = c.rowid AND s.email != ''";
|
$sql.= " AND s.rowid = c.fk_soc AND cd.fk_contrat = c.rowid AND s.email != ''";
|
||||||
$sql.= " AND cd.statut= 4 AND cd.fk_product=p.rowid AND p.ref = '".$product."'";
|
$sql.= " AND cd.statut= 4 AND cd.fk_product=p.rowid AND p.ref = '".$product."'";
|
||||||
$sql.= " AND cd.date_fin_validite < '".$this->db->idate($now)."'";
|
$sql.= " AND cd.date_fin_validite < '".$this->db->idate($now)."'";
|
||||||
|
|||||||
@ -224,6 +224,7 @@ class Expedition extends CommonObject
|
|||||||
$sql.= ", ".(!empty($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null");
|
$sql.= ", ".(!empty($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null");
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -323,6 +324,7 @@ class Expedition extends CommonObject
|
|||||||
$sql.= ", ".$qty;
|
$sql.= ", ".$qty;
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::create_line sql=".$sql, LOG_DEBUG);
|
||||||
if (! $this->db->query($sql))
|
if (! $this->db->query($sql))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
|
|||||||
@ -88,6 +88,8 @@ if ($action == 'add')
|
|||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
$object = new Expedition($db);
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$object->note = GETPOST('note','alpha');
|
$object->note = GETPOST('note','alpha');
|
||||||
|
|||||||
@ -29,7 +29,7 @@
|
|||||||
* \brief File that include conf.php file and commons lib like functions.lib.php
|
* \brief File that include conf.php file and commons lib like functions.lib.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','3.4.0');
|
if (! defined('DOL_VERSION')) define('DOL_VERSION','3.4.1');
|
||||||
if (! defined('EURO')) define('EURO',chr(128));
|
if (! defined('EURO')) define('EURO',chr(128));
|
||||||
|
|
||||||
// Define syslog constants
|
// Define syslog constants
|
||||||
|
|||||||
@ -629,6 +629,13 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
// Fin appel triggers
|
// Fin appel triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
// Delete linked object
|
||||||
|
$res = $this->deleteObjectLinked();
|
||||||
|
if ($res < 0) $error++;
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// We remove directory
|
// We remove directory
|
||||||
|
|||||||
@ -181,6 +181,7 @@ class ProductFournisseur extends Product
|
|||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price";
|
||||||
$sql.= " SET fk_user = " . $user->id." ,";
|
$sql.= " SET fk_user = " . $user->id." ,";
|
||||||
|
$sql.= " ref_fourn = \"" . $this->db->escape($ref_fourn) . "\",";
|
||||||
$sql.= " price = ".price2num($buyprice).",";
|
$sql.= " price = ".price2num($buyprice).",";
|
||||||
$sql.= " quantity = ".$qty.",";
|
$sql.= " quantity = ".$qty.",";
|
||||||
$sql.= " remise_percent = ".$remise_percent.",";
|
$sql.= " remise_percent = ".$remise_percent.",";
|
||||||
|
|||||||
@ -168,6 +168,8 @@ if (GETPOST("search_montant_ttc"))
|
|||||||
$sql.= $db->order($sortfield,$sortorder);
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
$sql.= $db->plimit($limit+1, $offset);
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
|
|
||||||
|
|
||||||
|
dol_syslog("fourn/facture/index.php::list sql=".$sql, LOG_DEBUG);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -343,7 +343,7 @@ if ($object->fetch($id))
|
|||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="4">';
|
print '<td colspan="4">';
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans('LastSuppliersBills',($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="facture/index.php?socid='.$object->id.'">'.$langs->trans('AllBills').' ('.$num.')</td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans('LastSuppliersBills',($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/fourn/facture/index.php?socid='.$object->id.'">'.$langs->trans('AllBills').' ('.$num.')</td>';
|
||||||
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?mode=supplier&socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?mode=supplier&socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|||||||
@ -269,6 +269,7 @@ print "</tr>\n";
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre" align="left" width="50">';
|
print '<td class="liste_titre" align="left" width="50">';
|
||||||
print '<input class="flat" size="4" type="text" name="search_ref" value="'.$search_ref.'">';
|
print '<input class="flat" size="4" type="text" name="search_ref" value="'.$search_ref.'">';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
// DATE CREATE
|
// DATE CREATE
|
||||||
print '<td class="liste_titre" colspan="1" align="center">';
|
print '<td class="liste_titre" colspan="1" align="center">';
|
||||||
@ -322,10 +323,13 @@ print '<td> </td>';
|
|||||||
print '<td class="liste_titre" width="70px;" align="center">';
|
print '<td class="liste_titre" width="70px;" align="center">';
|
||||||
$holiday->selectStatutCP($search_statut);
|
$holiday->selectStatutCP($search_statut);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// ACTION
|
// ACTION
|
||||||
print '<td>';
|
print '<td align="right">';
|
||||||
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans('Search').'">';
|
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans('Search').'">';
|
||||||
print "</td></tr>\n";
|
print '</td>';
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
// Lines
|
// Lines
|
||||||
@ -364,7 +368,7 @@ if (! empty($holiday->holiday))
|
|||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
$nbopenedday=num_open_day($infos_CP['date_debut'], $infos_CP['date_fin'], 0, 1, $infos_CP['halfday']);
|
$nbopenedday=num_open_day($infos_CP['date_debut'], $infos_CP['date_fin'], 0, 1, $infos_CP['halfday']);
|
||||||
print $nbopenedday.' '.$langs->trans('DurationDays');
|
print $nbopenedday.' '.$langs->trans('DurationDays');
|
||||||
print '<td align="right">'.$holidaystatic->LibStatut($infos_CP['statut'],5).'</td>';
|
print '<td align="right" colspan="2">'.$holidaystatic->LibStatut($infos_CP['statut'],5).'</td>';
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -374,7 +378,7 @@ if (! empty($holiday->holiday))
|
|||||||
if($holiday_payes == '2')
|
if($holiday_payes == '2')
|
||||||
{
|
{
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td colspan="8" class="pair" style="text-align: center; padding: 5px;">'.$langs->trans('None').'</td>';
|
print '<td colspan="9" class="pair" style="text-align: center; padding: 5px;">'.$langs->trans('None').'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
306
htdocs/includes/ckeditor/_source/adapters/jquery.js
vendored
Normal file
306
htdocs/includes/ckeditor/_source/adapters/jquery.js
vendored
Normal file
@ -0,0 +1,306 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileOverview jQuery adapter provides easy use of basic CKEditor functions
|
||||||
|
* and access to internal API. It also integrates some aspects of CKEditor with
|
||||||
|
* jQuery framework.
|
||||||
|
*
|
||||||
|
* Every TEXTAREA, DIV and P elements can be converted to working editor.
|
||||||
|
*
|
||||||
|
* Plugin exposes some of editor's event to jQuery event system. All of those are namespaces inside
|
||||||
|
* ".ckeditor" namespace and can be binded/listened on supported textarea, div and p nodes.
|
||||||
|
*
|
||||||
|
* Available jQuery events:
|
||||||
|
* - instanceReady.ckeditor( editor, rootNode )
|
||||||
|
* Triggered when new instance is ready.
|
||||||
|
* - destroy.ckeditor( editor )
|
||||||
|
* Triggered when instance is destroyed.
|
||||||
|
* - getData.ckeditor( editor, eventData )
|
||||||
|
* Triggered when getData event is fired inside editor. It can change returned data using eventData reference.
|
||||||
|
* - setData.ckeditor( editor )
|
||||||
|
* Triggered when getData event is fired inside editor.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* <script src="jquery.js"></script>
|
||||||
|
* <script src="ckeditor.js"></script>
|
||||||
|
* <script src="adapters/jquery/adapter.js"></script>
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function()
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Allows CKEditor to override jQuery.fn.val(), making it possible to use the val()
|
||||||
|
* function on textareas, as usual, having it synchronized with CKEditor.<br>
|
||||||
|
* <br>
|
||||||
|
* This configuration option is global and executed during the jQuery Adapter loading.
|
||||||
|
* It can't be customized across editor instances.
|
||||||
|
* @type Boolean
|
||||||
|
* @example
|
||||||
|
* <script>
|
||||||
|
* CKEDITOR.config.jqueryOverrideVal = true;
|
||||||
|
* </script>
|
||||||
|
* <!-- Important: The JQuery adapter is loaded *after* setting jqueryOverrideVal -->
|
||||||
|
* <script src="/ckeditor/adapters/jquery.js"></script>
|
||||||
|
* @example
|
||||||
|
* // ... then later in the code ...
|
||||||
|
*
|
||||||
|
* $( 'textarea' ).ckeditor();
|
||||||
|
* // ...
|
||||||
|
* $( 'textarea' ).val( 'New content' );
|
||||||
|
*/
|
||||||
|
CKEDITOR.config.jqueryOverrideVal = typeof CKEDITOR.config.jqueryOverrideVal == 'undefined'
|
||||||
|
? true : CKEDITOR.config.jqueryOverrideVal;
|
||||||
|
|
||||||
|
var jQuery = window.jQuery;
|
||||||
|
|
||||||
|
if ( typeof jQuery == 'undefined' )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// jQuery object methods.
|
||||||
|
jQuery.extend( jQuery.fn,
|
||||||
|
/** @lends jQuery.fn */
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Return existing CKEditor instance for first matched element.
|
||||||
|
* Allows to easily use internal API. Doesn't return jQuery object.
|
||||||
|
*
|
||||||
|
* Raised exception if editor doesn't exist or isn't ready yet.
|
||||||
|
*
|
||||||
|
* @name jQuery.ckeditorGet
|
||||||
|
* @return CKEDITOR.editor
|
||||||
|
* @see CKEDITOR.editor
|
||||||
|
*/
|
||||||
|
ckeditorGet: function()
|
||||||
|
{
|
||||||
|
var instance = this.eq( 0 ).data( 'ckeditorInstance' );
|
||||||
|
if ( !instance )
|
||||||
|
throw "CKEditor not yet initialized, use ckeditor() with callback.";
|
||||||
|
return instance;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Triggers creation of CKEditor in all matched elements (reduced to DIV, P and TEXTAREAs).
|
||||||
|
* Binds callback to instanceReady event of all instances. If editor is already created, than
|
||||||
|
* callback is fired right away.
|
||||||
|
*
|
||||||
|
* Mixed parameter order allowed.
|
||||||
|
*
|
||||||
|
* @param callback Function to be run on editor instance. Passed parameters: [ textarea ].
|
||||||
|
* Callback is fiered in "this" scope being ckeditor instance and having source textarea as first param.
|
||||||
|
*
|
||||||
|
* @param config Configuration options for new instance(s) if not already created.
|
||||||
|
* See URL
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* $( 'textarea' ).ckeditor( function( textarea ) {
|
||||||
|
* $( textarea ).val( this.getData() )
|
||||||
|
* } );
|
||||||
|
*
|
||||||
|
* @name jQuery.fn.ckeditor
|
||||||
|
* @return jQuery.fn
|
||||||
|
*/
|
||||||
|
ckeditor: function( callback, config )
|
||||||
|
{
|
||||||
|
if ( !CKEDITOR.env.isCompatible )
|
||||||
|
return this;
|
||||||
|
|
||||||
|
if ( !jQuery.isFunction( callback ))
|
||||||
|
{
|
||||||
|
var tmp = config;
|
||||||
|
config = callback;
|
||||||
|
callback = tmp;
|
||||||
|
}
|
||||||
|
config = config || {};
|
||||||
|
|
||||||
|
this.filter( 'textarea, div, p' ).each( function()
|
||||||
|
{
|
||||||
|
var $element = jQuery( this ),
|
||||||
|
editor = $element.data( 'ckeditorInstance' ),
|
||||||
|
instanceLock = $element.data( '_ckeditorInstanceLock' ),
|
||||||
|
element = this;
|
||||||
|
|
||||||
|
if ( editor && !instanceLock )
|
||||||
|
{
|
||||||
|
if ( callback )
|
||||||
|
callback.apply( editor, [ this ] );
|
||||||
|
}
|
||||||
|
else if ( !instanceLock )
|
||||||
|
{
|
||||||
|
// CREATE NEW INSTANCE
|
||||||
|
|
||||||
|
// Handle config.autoUpdateElement inside this plugin if desired.
|
||||||
|
if ( config.autoUpdateElement
|
||||||
|
|| ( typeof config.autoUpdateElement == 'undefined' && CKEDITOR.config.autoUpdateElement ) )
|
||||||
|
{
|
||||||
|
config.autoUpdateElementJquery = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Always disable config.autoUpdateElement.
|
||||||
|
config.autoUpdateElement = false;
|
||||||
|
$element.data( '_ckeditorInstanceLock', true );
|
||||||
|
|
||||||
|
// Set instance reference in element's data.
|
||||||
|
editor = CKEDITOR.replace( element, config );
|
||||||
|
$element.data( 'ckeditorInstance', editor );
|
||||||
|
|
||||||
|
// Register callback.
|
||||||
|
editor.on( 'instanceReady', function( event )
|
||||||
|
{
|
||||||
|
var editor = event.editor;
|
||||||
|
setTimeout( function()
|
||||||
|
{
|
||||||
|
// Delay bit more if editor is still not ready.
|
||||||
|
if ( !editor.element )
|
||||||
|
{
|
||||||
|
setTimeout( arguments.callee, 100 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove this listener.
|
||||||
|
event.removeListener( 'instanceReady', this.callee );
|
||||||
|
|
||||||
|
// Forward setData on dataReady.
|
||||||
|
editor.on( 'dataReady', function()
|
||||||
|
{
|
||||||
|
$element.trigger( 'setData' + '.ckeditor', [ editor ] );
|
||||||
|
});
|
||||||
|
|
||||||
|
// Forward getData.
|
||||||
|
editor.on( 'getData', function( event ) {
|
||||||
|
$element.trigger( 'getData' + '.ckeditor', [ editor, event.data ] );
|
||||||
|
}, 999 );
|
||||||
|
|
||||||
|
// Forward destroy event.
|
||||||
|
editor.on( 'destroy', function()
|
||||||
|
{
|
||||||
|
$element.trigger( 'destroy.ckeditor', [ editor ] );
|
||||||
|
});
|
||||||
|
|
||||||
|
// Integrate with form submit.
|
||||||
|
if ( editor.config.autoUpdateElementJquery && $element.is( 'textarea' ) && $element.parents( 'form' ).length )
|
||||||
|
{
|
||||||
|
var onSubmit = function()
|
||||||
|
{
|
||||||
|
$element.ckeditor( function()
|
||||||
|
{
|
||||||
|
editor.updateElement();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// Bind to submit event.
|
||||||
|
$element.parents( 'form' ).submit( onSubmit );
|
||||||
|
|
||||||
|
// Bind to form-pre-serialize from jQuery Forms plugin.
|
||||||
|
$element.parents( 'form' ).bind( 'form-pre-serialize', onSubmit );
|
||||||
|
|
||||||
|
// Unbind when editor destroyed.
|
||||||
|
$element.bind( 'destroy.ckeditor', function()
|
||||||
|
{
|
||||||
|
$element.parents( 'form' ).unbind( 'submit', onSubmit );
|
||||||
|
$element.parents( 'form' ).unbind( 'form-pre-serialize', onSubmit );
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Garbage collect on destroy.
|
||||||
|
editor.on( 'destroy', function()
|
||||||
|
{
|
||||||
|
$element.data( 'ckeditorInstance', null );
|
||||||
|
});
|
||||||
|
|
||||||
|
// Remove lock.
|
||||||
|
$element.data( '_ckeditorInstanceLock', null );
|
||||||
|
|
||||||
|
// Fire instanceReady event.
|
||||||
|
$element.trigger( 'instanceReady.ckeditor', [ editor ] );
|
||||||
|
|
||||||
|
// Run given (first) code.
|
||||||
|
if ( callback )
|
||||||
|
callback.apply( editor, [ element ] );
|
||||||
|
}, 0 );
|
||||||
|
}, null, null, 9999);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Editor is already during creation process, bind our code to the event.
|
||||||
|
CKEDITOR.on( 'instanceReady', function( event )
|
||||||
|
{
|
||||||
|
var editor = event.editor;
|
||||||
|
setTimeout( function()
|
||||||
|
{
|
||||||
|
// Delay bit more if editor is still not ready.
|
||||||
|
if ( !editor.element )
|
||||||
|
{
|
||||||
|
setTimeout( arguments.callee, 100 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( editor.element.$ == element )
|
||||||
|
{
|
||||||
|
// Run given code.
|
||||||
|
if ( callback )
|
||||||
|
callback.apply( editor, [ element ] );
|
||||||
|
}
|
||||||
|
}, 0 );
|
||||||
|
}, null, null, 9999);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// New val() method for objects.
|
||||||
|
if ( CKEDITOR.config.jqueryOverrideVal )
|
||||||
|
{
|
||||||
|
jQuery.fn.val = CKEDITOR.tools.override( jQuery.fn.val, function( oldValMethod )
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* CKEditor-aware val() method.
|
||||||
|
*
|
||||||
|
* Acts same as original jQuery val(), but for textareas which have CKEditor instances binded to them, method
|
||||||
|
* returns editor's content. It also works for settings values.
|
||||||
|
*
|
||||||
|
* @param oldValMethod
|
||||||
|
* @name jQuery.fn.val
|
||||||
|
*/
|
||||||
|
return function( newValue, forceNative )
|
||||||
|
{
|
||||||
|
var isSetter = typeof newValue != 'undefined',
|
||||||
|
result;
|
||||||
|
|
||||||
|
this.each( function()
|
||||||
|
{
|
||||||
|
var $this = jQuery( this ),
|
||||||
|
editor = $this.data( 'ckeditorInstance' );
|
||||||
|
|
||||||
|
if ( !forceNative && $this.is( 'textarea' ) && editor )
|
||||||
|
{
|
||||||
|
if ( isSetter )
|
||||||
|
editor.setData( newValue );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = editor.getData();
|
||||||
|
// break;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( isSetter )
|
||||||
|
oldValMethod.call( $this, newValue );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = oldValMethod.call( $this );
|
||||||
|
// break;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
return isSetter ? this : result;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})();
|
||||||
87
htdocs/includes/ckeditor/_source/core/_bootstrap.js
Normal file
87
htdocs/includes/ckeditor/_source/core/_bootstrap.js
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileOverview API initialization code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function()
|
||||||
|
{
|
||||||
|
// Disable HC detaction in WebKit. (#5429)
|
||||||
|
if ( CKEDITOR.env.webkit )
|
||||||
|
{
|
||||||
|
CKEDITOR.env.hc = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check whether high contrast is active by creating a colored border.
|
||||||
|
var hcDetect = CKEDITOR.dom.element.createFromHtml(
|
||||||
|
'<div style="width:0px;height:0px;position:absolute;left:-10000px;' +
|
||||||
|
'border: 1px solid;border-color: red blue;"></div>', CKEDITOR.document );
|
||||||
|
|
||||||
|
hcDetect.appendTo( CKEDITOR.document.getHead() );
|
||||||
|
|
||||||
|
// Update CKEDITOR.env.
|
||||||
|
// Catch exception needed sometimes for FF. (#4230)
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CKEDITOR.env.hc = hcDetect.getComputedStyle( 'border-top-color' ) == hcDetect.getComputedStyle( 'border-right-color' );
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
CKEDITOR.env.hc = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( CKEDITOR.env.hc )
|
||||||
|
CKEDITOR.env.cssClass += ' cke_hc';
|
||||||
|
|
||||||
|
hcDetect.remove();
|
||||||
|
})();
|
||||||
|
|
||||||
|
// Load core plugins.
|
||||||
|
CKEDITOR.plugins.load( CKEDITOR.config.corePlugins.split( ',' ), function()
|
||||||
|
{
|
||||||
|
CKEDITOR.status = 'loaded';
|
||||||
|
CKEDITOR.fire( 'loaded' );
|
||||||
|
|
||||||
|
// Process all instances created by the "basic" implementation.
|
||||||
|
var pending = CKEDITOR._.pending;
|
||||||
|
if ( pending )
|
||||||
|
{
|
||||||
|
delete CKEDITOR._.pending;
|
||||||
|
|
||||||
|
for ( var i = 0 ; i < pending.length ; i++ )
|
||||||
|
CKEDITOR.add( pending[ i ] );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Needed for IE6 to not request image (HTTP 200 or 304) for every CSS background. (#6187)
|
||||||
|
if ( CKEDITOR.env.ie )
|
||||||
|
{
|
||||||
|
// Remove IE mouse flickering on IE6 because of background images.
|
||||||
|
try
|
||||||
|
{
|
||||||
|
document.execCommand( 'BackgroundImageCache', false, true );
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
// We have been reported about loading problems caused by the above
|
||||||
|
// line. For safety, let's just ignore errors.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that CKEditor is running on a High Contrast environment.
|
||||||
|
* @name CKEDITOR.env.hc
|
||||||
|
* @example
|
||||||
|
* if ( CKEDITOR.env.hc )
|
||||||
|
* alert( 'You're running on High Contrast mode. The editor interface will get adapted to provide you a better experience.' );
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fired when a CKEDITOR core object is fully loaded and ready for interaction.
|
||||||
|
* @name CKEDITOR#loaded
|
||||||
|
* @event
|
||||||
|
*/
|
||||||
141
htdocs/includes/ckeditor/_source/core/ckeditor.js
vendored
Normal file
141
htdocs/includes/ckeditor/_source/core/ckeditor.js
vendored
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileOverview Contains the third and last part of the {@link CKEDITOR} object
|
||||||
|
* definition.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Remove the CKEDITOR.loadFullCore reference defined on ckeditor_basic.
|
||||||
|
delete CKEDITOR.loadFullCore;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds references to all editor instances created. The name of the properties
|
||||||
|
* in this object correspond to instance names, and their values contains the
|
||||||
|
* {@link CKEDITOR.editor} object representing them.
|
||||||
|
* @type {Object}
|
||||||
|
* @example
|
||||||
|
* alert( <b>CKEDITOR.instances</b>.editor1.name ); // "editor1"
|
||||||
|
*/
|
||||||
|
CKEDITOR.instances = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The document of the window holding the CKEDITOR object.
|
||||||
|
* @type {CKEDITOR.dom.document}
|
||||||
|
* @example
|
||||||
|
* alert( <b>CKEDITOR.document</b>.getBody().getName() ); // "body"
|
||||||
|
*/
|
||||||
|
CKEDITOR.document = new CKEDITOR.dom.document( document );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an editor instance to the global {@link CKEDITOR} object. This function
|
||||||
|
* is available for internal use mainly.
|
||||||
|
* @param {CKEDITOR.editor} editor The editor instance to be added.
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.add = function( editor )
|
||||||
|
{
|
||||||
|
CKEDITOR.instances[ editor.name ] = editor;
|
||||||
|
|
||||||
|
editor.on( 'focus', function()
|
||||||
|
{
|
||||||
|
if ( CKEDITOR.currentInstance != editor )
|
||||||
|
{
|
||||||
|
CKEDITOR.currentInstance = editor;
|
||||||
|
CKEDITOR.fire( 'currentInstance' );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
editor.on( 'blur', function()
|
||||||
|
{
|
||||||
|
if ( CKEDITOR.currentInstance == editor )
|
||||||
|
{
|
||||||
|
CKEDITOR.currentInstance = null;
|
||||||
|
CKEDITOR.fire( 'currentInstance' );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes an editor instance from the global {@link CKEDITOR} object. This function
|
||||||
|
* is available for internal use only. External code must use {@link CKEDITOR.editor.prototype.destroy}
|
||||||
|
* to avoid memory leaks.
|
||||||
|
* @param {CKEDITOR.editor} editor The editor instance to be removed.
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.remove = function( editor )
|
||||||
|
{
|
||||||
|
delete CKEDITOR.instances[ editor.name ];
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perform global clean up to free as much memory as possible
|
||||||
|
* when there are no instances left
|
||||||
|
*/
|
||||||
|
CKEDITOR.on( 'instanceDestroyed', function ()
|
||||||
|
{
|
||||||
|
if ( CKEDITOR.tools.isEmpty( this.instances ) )
|
||||||
|
CKEDITOR.fire( 'reset' );
|
||||||
|
});
|
||||||
|
|
||||||
|
// Load the bootstrap script.
|
||||||
|
CKEDITOR.loader.load( 'core/_bootstrap' ); // @Packager.RemoveLine
|
||||||
|
|
||||||
|
// Tri-state constants.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to indicate the ON or ACTIVE state.
|
||||||
|
* @constant
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.TRISTATE_ON = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to indicate the OFF or NON ACTIVE state.
|
||||||
|
* @constant
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.TRISTATE_OFF = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to indicate DISABLED state.
|
||||||
|
* @constant
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.TRISTATE_DISABLED = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The editor which is currently active (have user focus).
|
||||||
|
* @name CKEDITOR.currentInstance
|
||||||
|
* @type CKEDITOR.editor
|
||||||
|
* @see CKEDITOR#currentInstance
|
||||||
|
* @example
|
||||||
|
* function showCurrentEditorName()
|
||||||
|
* {
|
||||||
|
* if ( CKEDITOR.currentInstance )
|
||||||
|
* alert( CKEDITOR.currentInstance.name );
|
||||||
|
* else
|
||||||
|
* alert( 'Please focus an editor first.' );
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fired when the CKEDITOR.currentInstance object reference changes. This may
|
||||||
|
* happen when setting the focus on different editor instances in the page.
|
||||||
|
* @name CKEDITOR#currentInstance
|
||||||
|
* @event
|
||||||
|
* var editor; // Variable to hold a reference to the current editor.
|
||||||
|
* CKEDITOR.on( 'currentInstance' , function( e )
|
||||||
|
* {
|
||||||
|
* editor = CKEDITOR.currentInstance;
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fired when the last instance has been destroyed. This event is used to perform
|
||||||
|
* global memory clean up.
|
||||||
|
* @name CKEDITOR#reset
|
||||||
|
* @event
|
||||||
|
*/
|
||||||
235
htdocs/includes/ckeditor/_source/core/ckeditor_base.js
Normal file
235
htdocs/includes/ckeditor/_source/core/ckeditor_base.js
Normal file
@ -0,0 +1,235 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileOverview Contains the first and essential part of the {@link CKEDITOR}
|
||||||
|
* object definition.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// #### Compressed Code
|
||||||
|
// Must be updated on changes in the script as well as updated in the
|
||||||
|
// ckeditor_source.js and ckeditor_basic_source.js files.
|
||||||
|
|
||||||
|
// if(!window.CKEDITOR)window.CKEDITOR=(function(){var a={timestamp:'',version:'3.6.4',revision:'7575',rnd:Math.floor(Math.random()*900)+100,_:{},status:'unloaded',basePath:(function(){var d=window.CKEDITOR_BASEPATH||'';if(!d){var e=document.getElementsByTagName('script');for(var f=0;f<e.length;f++){var g=e[f].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i);if(g){d=g[1];break;}}}if(d.indexOf(':/')==-1)if(d.indexOf('/')===0)d=location.href.match(/^.*?:\/\/[^\/]*/)[0]+d;else d=location.href.match(/^[^\?]*\/(?:)/)[0]+d;if(!d)throw 'The CKEditor installation path could not be automatically detected. Please set the global variable "CKEDITOR_BASEPATH" before creating editor instances.';return d;})(),getUrl:function(d){if(d.indexOf(':/')==-1&&d.indexOf('/')!==0)d=this.basePath+d;if(this.timestamp&&d.charAt(d.length-1)!='/'&&!/[&?]t=/.test(d))d+=(d.indexOf('?')>=0?'&':'?')+'t='+this.timestamp;return d;}},b=window.CKEDITOR_GETURL;if(b){var c=a.getUrl;a.getUrl=function(d){return b.call(a,d)||c.call(a,d);};}return a;})();
|
||||||
|
|
||||||
|
// #### Raw code
|
||||||
|
// ATTENTION: read the above "Compressed Code" notes when changing this code.
|
||||||
|
|
||||||
|
/* @Packager.RemoveLine
|
||||||
|
// Avoid having the editor code initialized twice. (#7588)
|
||||||
|
// Use CKEDITOR.dom to check whether the full ckeditor.js code has been loaded
|
||||||
|
// or just ckeditor_basic.js.
|
||||||
|
// Remove these lines when compressing manually.
|
||||||
|
if ( window.CKEDITOR && window.CKEDITOR.dom )
|
||||||
|
return;
|
||||||
|
@Packager.RemoveLine */
|
||||||
|
|
||||||
|
if ( !window.CKEDITOR )
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @name CKEDITOR
|
||||||
|
* @namespace This is the API entry point. The entire CKEditor code runs under this object.
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
window.CKEDITOR = (function()
|
||||||
|
{
|
||||||
|
var CKEDITOR =
|
||||||
|
/** @lends CKEDITOR */
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A constant string unique for each release of CKEditor. Its value
|
||||||
|
* is used, by default, to build the URL for all resources loaded
|
||||||
|
* by the editor code, guaranteeing clean cache results when
|
||||||
|
* upgrading.
|
||||||
|
* @type String
|
||||||
|
* @example
|
||||||
|
* alert( CKEDITOR.timestamp ); // e.g. '87dm'
|
||||||
|
*/
|
||||||
|
// The production implementation contains a fixed timestamp, unique
|
||||||
|
// for each release and generated by the releaser.
|
||||||
|
// (Base 36 value of each component of YYMMDDHH - 4 chars total - e.g. 87bm == 08071122)
|
||||||
|
timestamp : 'C6HH5UF',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains the CKEditor version number.
|
||||||
|
* @type String
|
||||||
|
* @example
|
||||||
|
* alert( CKEDITOR.version ); // e.g. 'CKEditor 3.4.1'
|
||||||
|
*/
|
||||||
|
version : '3.6.4',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains the CKEditor revision number.
|
||||||
|
* The revision number is incremented automatically, following each
|
||||||
|
* modification to the CKEditor source code.
|
||||||
|
* @type String
|
||||||
|
* @example
|
||||||
|
* alert( CKEDITOR.revision ); // e.g. '3975'
|
||||||
|
*/
|
||||||
|
revision : '7575',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A 3-digit random integer, valid for the entire life of the CKEDITOR object.
|
||||||
|
* @type Number
|
||||||
|
* @example
|
||||||
|
* alert( CKEDITOR.rnd ); // e.g. '319'
|
||||||
|
*/
|
||||||
|
rnd : Math.floor( Math.random() * ( 999/*Max*/ - 100/*Min*/ + 1 ) ) + 100/*Min*/,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Private object used to hold core stuff. It should not be used outside of
|
||||||
|
* the API code as properties defined here may change at any time
|
||||||
|
* without notice.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_ : {},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates the API loading status. The following statuses are available:
|
||||||
|
* <ul>
|
||||||
|
* <li><b>unloaded</b>: the API is not yet loaded.</li>
|
||||||
|
* <li><b>basic_loaded</b>: the basic API features are available.</li>
|
||||||
|
* <li><b>basic_ready</b>: the basic API is ready to load the full core code.</li>
|
||||||
|
* <li><b>loading</b>: the full API is being loaded.</li>
|
||||||
|
* <li><b>loaded</b>: the API can be fully used.</li>
|
||||||
|
* </ul>
|
||||||
|
* @type String
|
||||||
|
* @example
|
||||||
|
* if ( <b>CKEDITOR.status</b> == 'loaded' )
|
||||||
|
* {
|
||||||
|
* // The API can now be fully used.
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
status : 'unloaded',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains the full URL for the CKEditor installation directory.
|
||||||
|
* It is possible to manually provide the base path by setting a
|
||||||
|
* global variable named CKEDITOR_BASEPATH. This global variable
|
||||||
|
* must be set <strong>before</strong> the editor script loading.
|
||||||
|
* @type String
|
||||||
|
* @example
|
||||||
|
* alert( <b>CKEDITOR.basePath</b> ); // "http://www.example.com/ckeditor/" (e.g.)
|
||||||
|
*/
|
||||||
|
basePath : (function()
|
||||||
|
{
|
||||||
|
// ATTENTION: fixes to this code must be ported to
|
||||||
|
// var basePath in "core/loader.js".
|
||||||
|
|
||||||
|
// Find out the editor directory path, based on its <script> tag.
|
||||||
|
var path = window.CKEDITOR_BASEPATH || '';
|
||||||
|
|
||||||
|
if ( !path )
|
||||||
|
{
|
||||||
|
var scripts = document.getElementsByTagName( 'script' );
|
||||||
|
|
||||||
|
for ( var i = 0 ; i < scripts.length ; i++ )
|
||||||
|
{
|
||||||
|
var match = scripts[i].src.match( /(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i );
|
||||||
|
|
||||||
|
if ( match )
|
||||||
|
{
|
||||||
|
path = match[1];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// In IE (only) the script.src string is the raw value entered in the
|
||||||
|
// HTML source. Other browsers return the full resolved URL instead.
|
||||||
|
if ( path.indexOf(':/') == -1 )
|
||||||
|
{
|
||||||
|
// Absolute path.
|
||||||
|
if ( path.indexOf( '/' ) === 0 )
|
||||||
|
path = location.href.match( /^.*?:\/\/[^\/]*/ )[0] + path;
|
||||||
|
// Relative path.
|
||||||
|
else
|
||||||
|
path = location.href.match( /^[^\?]*\/(?:)/ )[0] + path;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !path )
|
||||||
|
throw 'The CKEditor installation path could not be automatically detected. Please set the global variable "CKEDITOR_BASEPATH" before creating editor instances.';
|
||||||
|
|
||||||
|
return path;
|
||||||
|
})(),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the full URL for CKEditor resources. By default, URLs
|
||||||
|
* returned by this function contain a querystring parameter ("t")
|
||||||
|
* set to the {@link CKEDITOR.timestamp} value.<br />
|
||||||
|
* <br />
|
||||||
|
* It is possible to provide a custom implementation of this
|
||||||
|
* function by setting a global variable named CKEDITOR_GETURL.
|
||||||
|
* This global variable must be set <strong>before</strong> the editor script
|
||||||
|
* loading. If the custom implementation returns nothing (==null), the
|
||||||
|
* default implementation is used.
|
||||||
|
* @param {String} resource The resource whose full URL we want to get.
|
||||||
|
* It may be a full, absolute, or relative URL.
|
||||||
|
* @returns {String} The full URL.
|
||||||
|
* @example
|
||||||
|
* // e.g. http://www.example.com/ckeditor/skins/default/editor.css?t=87dm
|
||||||
|
* alert( CKEDITOR.getUrl( 'skins/default/editor.css' ) );
|
||||||
|
* @example
|
||||||
|
* // e.g. http://www.example.com/skins/default/editor.css?t=87dm
|
||||||
|
* alert( CKEDITOR.getUrl( '/skins/default/editor.css' ) );
|
||||||
|
* @example
|
||||||
|
* // e.g. http://www.somesite.com/skins/default/editor.css?t=87dm
|
||||||
|
* alert( CKEDITOR.getUrl( 'http://www.somesite.com/skins/default/editor.css' ) );
|
||||||
|
*/
|
||||||
|
getUrl : function( resource )
|
||||||
|
{
|
||||||
|
// If this is not a full or absolute path.
|
||||||
|
if ( resource.indexOf(':/') == -1 && resource.indexOf( '/' ) !== 0 )
|
||||||
|
resource = this.basePath + resource;
|
||||||
|
|
||||||
|
// Add the timestamp, except for directories.
|
||||||
|
if ( this.timestamp && resource.charAt( resource.length - 1 ) != '/' && !(/[&?]t=/).test( resource ) )
|
||||||
|
resource += ( resource.indexOf( '?' ) >= 0 ? '&' : '?' ) + 't=' + this.timestamp;
|
||||||
|
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Make it possible to override the getUrl function with a custom
|
||||||
|
// implementation pointing to a global named CKEDITOR_GETURL.
|
||||||
|
var newGetUrl = window.CKEDITOR_GETURL;
|
||||||
|
if ( newGetUrl )
|
||||||
|
{
|
||||||
|
var originalGetUrl = CKEDITOR.getUrl;
|
||||||
|
CKEDITOR.getUrl = function ( resource )
|
||||||
|
{
|
||||||
|
return newGetUrl.call( CKEDITOR, resource ) ||
|
||||||
|
originalGetUrl.call( CKEDITOR, resource );
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return CKEDITOR;
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function called upon loading a custom configuration file that can
|
||||||
|
* modify the editor instance configuration ({@link CKEDITOR.editor#config }).
|
||||||
|
* It is usually defined inside the custom configuration files that can
|
||||||
|
* include developer defined settings.
|
||||||
|
* @name CKEDITOR.editorConfig
|
||||||
|
* @function
|
||||||
|
* @param {CKEDITOR.config} config A configuration object containing the
|
||||||
|
* settings defined for a {@link CKEDITOR.editor} instance up to this
|
||||||
|
* function call. Note that not all settings may still be available. See
|
||||||
|
* <a href="http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Setting_Configurations#Configuration_Loading_Order">Configuration Loading Order</a>
|
||||||
|
* for details.
|
||||||
|
* @example
|
||||||
|
* // This is supposed to be placed in the config.js file.
|
||||||
|
* CKEDITOR.editorConfig = function( config )
|
||||||
|
* {
|
||||||
|
* // Define changes to default configuration here. For example:
|
||||||
|
* config.language = 'fr';
|
||||||
|
* config.uiColor = '#AADC6E';
|
||||||
|
* };
|
||||||
|
*/
|
||||||
|
|
||||||
|
// PACKAGER_RENAME( CKEDITOR )
|
||||||
238
htdocs/includes/ckeditor/_source/core/ckeditor_basic.js
Normal file
238
htdocs/includes/ckeditor/_source/core/ckeditor_basic.js
Normal file
@ -0,0 +1,238 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileOverview Contains the second part of the {@link CKEDITOR} object
|
||||||
|
* definition, which defines the basic editor features to be available in
|
||||||
|
* the root ckeditor_basic.js file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( CKEDITOR.status == 'unloaded' )
|
||||||
|
{
|
||||||
|
(function()
|
||||||
|
{
|
||||||
|
CKEDITOR.event.implementOn( CKEDITOR );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forces the full CKEditor core code, in the case only the basic code has been
|
||||||
|
* loaded (ckeditor_basic.js). This method self-destroys (becomes undefined) in
|
||||||
|
* the first call or as soon as the full code is available.
|
||||||
|
* @example
|
||||||
|
* // Check if the full core code has been loaded and load it.
|
||||||
|
* if ( CKEDITOR.loadFullCore )
|
||||||
|
* <b>CKEDITOR.loadFullCore()</b>;
|
||||||
|
*/
|
||||||
|
CKEDITOR.loadFullCore = function()
|
||||||
|
{
|
||||||
|
// If not the basic code is not ready it, just mark it to be loaded.
|
||||||
|
if ( CKEDITOR.status != 'basic_ready' )
|
||||||
|
{
|
||||||
|
CKEDITOR.loadFullCore._load = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Destroy this function.
|
||||||
|
delete CKEDITOR.loadFullCore;
|
||||||
|
|
||||||
|
// Append the script to the head.
|
||||||
|
var script = document.createElement( 'script' );
|
||||||
|
script.type = 'text/javascript';
|
||||||
|
script.src = CKEDITOR.basePath + 'ckeditor.js';
|
||||||
|
|
||||||
|
document.getElementsByTagName( 'head' )[0].appendChild( script );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The time to wait (in seconds) to load the full editor code after the
|
||||||
|
* page load, if the "ckeditor_basic" file is used. If set to zero, the
|
||||||
|
* editor is loaded on demand, as soon as an instance is created.
|
||||||
|
*
|
||||||
|
* This value must be set on the page before the page load completion.
|
||||||
|
* @type Number
|
||||||
|
* @default 0 (zero)
|
||||||
|
* @example
|
||||||
|
* // Loads the full source after five seconds.
|
||||||
|
* CKEDITOR.loadFullCoreTimeout = 5;
|
||||||
|
*/
|
||||||
|
CKEDITOR.loadFullCoreTimeout = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The class name used to identify <textarea> elements to be replace
|
||||||
|
* by CKEditor instances.
|
||||||
|
* @type String
|
||||||
|
* @default 'ckeditor'
|
||||||
|
* @example
|
||||||
|
* <b>CKEDITOR.replaceClass</b> = 'rich_editor';
|
||||||
|
*/
|
||||||
|
CKEDITOR.replaceClass = 'ckeditor';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the replacement of all textareas with class name matching
|
||||||
|
* {@link CKEDITOR.replaceClass}.
|
||||||
|
* @type Boolean
|
||||||
|
* @default true
|
||||||
|
* @example
|
||||||
|
* // Disable the auto-replace feature.
|
||||||
|
* <b>CKEDITOR.replaceByClassEnabled</b> = false;
|
||||||
|
*/
|
||||||
|
CKEDITOR.replaceByClassEnabled = 1;
|
||||||
|
|
||||||
|
var createInstance = function( elementOrIdOrName, config, creationFunction, data )
|
||||||
|
{
|
||||||
|
if ( CKEDITOR.env.isCompatible )
|
||||||
|
{
|
||||||
|
// Load the full core.
|
||||||
|
if ( CKEDITOR.loadFullCore )
|
||||||
|
CKEDITOR.loadFullCore();
|
||||||
|
|
||||||
|
var editor = creationFunction( elementOrIdOrName, config, data );
|
||||||
|
CKEDITOR.add( editor );
|
||||||
|
return editor;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replaces a <textarea> or a DOM element (DIV) with a CKEditor
|
||||||
|
* instance. For textareas, the initial value in the editor will be the
|
||||||
|
* textarea value. For DOM elements, their innerHTML will be used
|
||||||
|
* instead. We recommend using TEXTAREA and DIV elements only.
|
||||||
|
* @param {Object|String} elementOrIdOrName The DOM element (textarea), its
|
||||||
|
* ID or name.
|
||||||
|
* @param {Object} [config] The specific configurations to apply to this
|
||||||
|
* editor instance. Configurations set here will override global CKEditor
|
||||||
|
* settings.
|
||||||
|
* @returns {CKEDITOR.editor} The editor instance created.
|
||||||
|
* @example
|
||||||
|
* <textarea id="myfield" name="myfield"><:/textarea>
|
||||||
|
* ...
|
||||||
|
* <b>CKEDITOR.replace( 'myfield' )</b>;
|
||||||
|
* @example
|
||||||
|
* var textarea = document.body.appendChild( document.createElement( 'textarea' ) );
|
||||||
|
* <b>CKEDITOR.replace( textarea )</b>;
|
||||||
|
*/
|
||||||
|
CKEDITOR.replace = function( elementOrIdOrName, config )
|
||||||
|
{
|
||||||
|
return createInstance( elementOrIdOrName, config, CKEDITOR.editor.replace );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new editor instance inside a specific DOM element.
|
||||||
|
* @param {Object|String} elementOrId The DOM element or its ID.
|
||||||
|
* @param {Object} [config] The specific configurations to apply to this
|
||||||
|
* editor instance. Configurations set here will override global CKEditor
|
||||||
|
* settings.
|
||||||
|
* @param {String} [data] Since 3.3. Initial value for the instance.
|
||||||
|
* @returns {CKEDITOR.editor} The editor instance created.
|
||||||
|
* @example
|
||||||
|
* <div id="editorSpace"><:/div>
|
||||||
|
* ...
|
||||||
|
* <b>CKEDITOR.appendTo( 'editorSpace' )</b>;
|
||||||
|
*/
|
||||||
|
CKEDITOR.appendTo = function( elementOrId, config, data )
|
||||||
|
{
|
||||||
|
return createInstance( elementOrId, config, CKEDITOR.editor.appendTo, data );
|
||||||
|
};
|
||||||
|
|
||||||
|
// Documented at ckeditor.js.
|
||||||
|
CKEDITOR.add = function( editor )
|
||||||
|
{
|
||||||
|
// For now, just put the editor in the pending list. It will be
|
||||||
|
// processed as soon as the full code gets loaded.
|
||||||
|
var pending = this._.pending || ( this._.pending = [] );
|
||||||
|
pending.push( editor );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace all <textarea> elements available in the document with
|
||||||
|
* editor instances.
|
||||||
|
* @example
|
||||||
|
* // Replace all <textarea> elements in the page.
|
||||||
|
* CKEDITOR.replaceAll();
|
||||||
|
* @example
|
||||||
|
* // Replace all <textarea class="myClassName"> elements in the page.
|
||||||
|
* CKEDITOR.replaceAll( 'myClassName' );
|
||||||
|
* @example
|
||||||
|
* // Selectively replace <textarea> elements, based on custom assertions.
|
||||||
|
* CKEDITOR.replaceAll( function( textarea, config )
|
||||||
|
* {
|
||||||
|
* // Custom code to evaluate the replace, returning false
|
||||||
|
* // if it must not be done.
|
||||||
|
* // It also passes the "config" parameter, so the
|
||||||
|
* // developer can customize the instance.
|
||||||
|
* } );
|
||||||
|
*/
|
||||||
|
CKEDITOR.replaceAll = function()
|
||||||
|
{
|
||||||
|
var textareas = document.getElementsByTagName( 'textarea' );
|
||||||
|
|
||||||
|
for ( var i = 0 ; i < textareas.length ; i++ )
|
||||||
|
{
|
||||||
|
var config = null,
|
||||||
|
textarea = textareas[i];
|
||||||
|
|
||||||
|
// The "name" and/or "id" attribute must exist.
|
||||||
|
if ( !textarea.name && !textarea.id )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ( typeof arguments[0] == 'string' )
|
||||||
|
{
|
||||||
|
// The textarea class name could be passed as the function
|
||||||
|
// parameter.
|
||||||
|
|
||||||
|
var classRegex = new RegExp( '(?:^|\\s)' + arguments[0] + '(?:$|\\s)' );
|
||||||
|
|
||||||
|
if ( !classRegex.test( textarea.className ) )
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if ( typeof arguments[0] == 'function' )
|
||||||
|
{
|
||||||
|
// An assertion function could be passed as the function parameter.
|
||||||
|
// It must explicitly return "false" to ignore a specific <textarea>.
|
||||||
|
config = {};
|
||||||
|
if ( arguments[0]( textarea, config ) === false )
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.replace( textarea, config );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
(function()
|
||||||
|
{
|
||||||
|
var onload = function()
|
||||||
|
{
|
||||||
|
var loadFullCore = CKEDITOR.loadFullCore,
|
||||||
|
loadFullCoreTimeout = CKEDITOR.loadFullCoreTimeout;
|
||||||
|
|
||||||
|
// Replace all textareas with the default class name.
|
||||||
|
if ( CKEDITOR.replaceByClassEnabled )
|
||||||
|
CKEDITOR.replaceAll( CKEDITOR.replaceClass );
|
||||||
|
|
||||||
|
CKEDITOR.status = 'basic_ready';
|
||||||
|
|
||||||
|
if ( loadFullCore && loadFullCore._load )
|
||||||
|
loadFullCore();
|
||||||
|
else if ( loadFullCoreTimeout )
|
||||||
|
{
|
||||||
|
setTimeout( function()
|
||||||
|
{
|
||||||
|
if ( CKEDITOR.loadFullCore )
|
||||||
|
CKEDITOR.loadFullCore();
|
||||||
|
}
|
||||||
|
, loadFullCoreTimeout * 1000 );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if ( window.addEventListener )
|
||||||
|
window.addEventListener( 'load', onload, false );
|
||||||
|
else if ( window.attachEvent )
|
||||||
|
window.attachEvent( 'onload', onload );
|
||||||
|
})();
|
||||||
|
|
||||||
|
CKEDITOR.status = 'basic_loaded';
|
||||||
|
})();
|
||||||
|
}
|
||||||
225
htdocs/includes/ckeditor/_source/core/command.js
Normal file
225
htdocs/includes/ckeditor/_source/core/command.js
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a command class instance.
|
||||||
|
* @class Represents a command that can be executed on an editor instance.
|
||||||
|
* @param {CKEDITOR.editor} editor The editor instance this command will be
|
||||||
|
* related to.
|
||||||
|
* @param {CKEDITOR.commandDefinition} commandDefinition The command
|
||||||
|
* definition.
|
||||||
|
* @augments CKEDITOR.event
|
||||||
|
* @example
|
||||||
|
* var command = new CKEDITOR.command( editor,
|
||||||
|
* {
|
||||||
|
* exec : function( editor )
|
||||||
|
* {
|
||||||
|
* alert( editor.document.getBody().getHtml() );
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
CKEDITOR.command = function( editor, commandDefinition )
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Lists UI items that are associated to this command. This list can be
|
||||||
|
* used to interact with the UI on command execution (by the execution code
|
||||||
|
* itself, for example).
|
||||||
|
* @type Array
|
||||||
|
* @example
|
||||||
|
* alert( 'Number of UI items associated to this command: ' + command.<b>uiItems</b>.length );
|
||||||
|
*/
|
||||||
|
this.uiItems = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Executes the command.
|
||||||
|
* @param {Object} [data] Any data to pass to the command. Depends on the
|
||||||
|
* command implementation and requirements.
|
||||||
|
* @returns {Boolean} A boolean indicating that the command has been
|
||||||
|
* successfully executed.
|
||||||
|
* @example
|
||||||
|
* command.<b>exec()</b>; // The command gets executed.
|
||||||
|
*/
|
||||||
|
this.exec = function( data )
|
||||||
|
{
|
||||||
|
if ( this.state == CKEDITOR.TRISTATE_DISABLED )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( this.editorFocus ) // Give editor focus if necessary (#4355).
|
||||||
|
editor.focus();
|
||||||
|
|
||||||
|
if ( this.fire( 'exec' ) === true )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return ( commandDefinition.exec.call( this, editor, data ) !== false );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Explicitly update the status of the command, by firing the {@link CKEDITOR.command#event:refresh} event,
|
||||||
|
* as well as invoke the {@link CKEDITOR.commandDefinition.prototype.refresh} method if defined, this method
|
||||||
|
* is to allow different parts of the editor code to contribute in command status resolution.
|
||||||
|
*/
|
||||||
|
this.refresh = function()
|
||||||
|
{
|
||||||
|
if ( this.fire( 'refresh' ) === true )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return ( commandDefinition.refresh && commandDefinition.refresh.apply( this, arguments ) !== false );
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.tools.extend( this, commandDefinition,
|
||||||
|
// Defaults
|
||||||
|
/** @lends CKEDITOR.command.prototype */
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The editor modes within which the command can be executed. The
|
||||||
|
* execution will have no action if the current mode is not listed
|
||||||
|
* in this property.
|
||||||
|
* @type Object
|
||||||
|
* @default { wysiwyg : 1 }
|
||||||
|
* @see CKEDITOR.editor.prototype.mode
|
||||||
|
* @example
|
||||||
|
* // Enable the command in both WYSIWYG and Source modes.
|
||||||
|
* command.<b>modes</b> = { wysiwyg : 1, source : 1 };
|
||||||
|
* @example
|
||||||
|
* // Enable the command in Source mode only.
|
||||||
|
* command.<b>modes</b> = { source : 1 };
|
||||||
|
*/
|
||||||
|
modes : { wysiwyg : 1 },
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that the editor will get the focus before executing
|
||||||
|
* the command.
|
||||||
|
* @type Boolean
|
||||||
|
* @default true
|
||||||
|
* @example
|
||||||
|
* // Do not force the editor to have focus when executing the command.
|
||||||
|
* command.<b>editorFocus</b> = false;
|
||||||
|
*/
|
||||||
|
editorFocus : 1,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates the editor state. Possible values are:
|
||||||
|
* <ul>
|
||||||
|
* <li>{@link CKEDITOR.TRISTATE_DISABLED}: the command is
|
||||||
|
* disabled. It's execution will have no effect. Same as
|
||||||
|
* {@link disable}.</li>
|
||||||
|
* <li>{@link CKEDITOR.TRISTATE_ON}: the command is enabled
|
||||||
|
* and currently active in the editor (for context sensitive commands,
|
||||||
|
* for example).</li>
|
||||||
|
* <li>{@link CKEDITOR.TRISTATE_OFF}: the command is enabled
|
||||||
|
* and currently inactive in the editor (for context sensitive
|
||||||
|
* commands, for example).</li>
|
||||||
|
* </ul>
|
||||||
|
* Do not set this property directly, using the {@link #setState}
|
||||||
|
* method instead.
|
||||||
|
* @type Number
|
||||||
|
* @default {@link CKEDITOR.TRISTATE_OFF}
|
||||||
|
* @example
|
||||||
|
* if ( command.<b>state</b> == CKEDITOR.TRISTATE_DISABLED )
|
||||||
|
* alert( 'This command is disabled' );
|
||||||
|
*/
|
||||||
|
state : CKEDITOR.TRISTATE_OFF
|
||||||
|
});
|
||||||
|
|
||||||
|
// Call the CKEDITOR.event constructor to initialize this instance.
|
||||||
|
CKEDITOR.event.call( this );
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.command.prototype =
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Enables the command for execution. The command state (see
|
||||||
|
* {@link CKEDITOR.command.prototype.state}) available before disabling it
|
||||||
|
* is restored.
|
||||||
|
* @example
|
||||||
|
* command.<b>enable()</b>;
|
||||||
|
* command.exec(); // Execute the command.
|
||||||
|
*/
|
||||||
|
enable : function()
|
||||||
|
{
|
||||||
|
if ( this.state == CKEDITOR.TRISTATE_DISABLED )
|
||||||
|
this.setState( ( !this.preserveState || ( typeof this.previousState == 'undefined' ) ) ? CKEDITOR.TRISTATE_OFF : this.previousState );
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables the command for execution. The command state (see
|
||||||
|
* {@link CKEDITOR.command.prototype.state}) will be set to
|
||||||
|
* {@link CKEDITOR.TRISTATE_DISABLED}.
|
||||||
|
* @example
|
||||||
|
* command.<b>disable()</b>;
|
||||||
|
* command.exec(); // "false" - Nothing happens.
|
||||||
|
*/
|
||||||
|
disable : function()
|
||||||
|
{
|
||||||
|
this.setState( CKEDITOR.TRISTATE_DISABLED );
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the command state.
|
||||||
|
* @param {Number} newState The new state. See {@link #state}.
|
||||||
|
* @returns {Boolean} Returns "true" if the command state changed.
|
||||||
|
* @example
|
||||||
|
* command.<b>setState( CKEDITOR.TRISTATE_ON )</b>;
|
||||||
|
* command.exec(); // Execute the command.
|
||||||
|
* command.<b>setState( CKEDITOR.TRISTATE_DISABLED )</b>;
|
||||||
|
* command.exec(); // "false" - Nothing happens.
|
||||||
|
* command.<b>setState( CKEDITOR.TRISTATE_OFF )</b>;
|
||||||
|
* command.exec(); // Execute the command.
|
||||||
|
*/
|
||||||
|
setState : function( newState )
|
||||||
|
{
|
||||||
|
// Do nothing if there is no state change.
|
||||||
|
if ( this.state == newState )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
this.previousState = this.state;
|
||||||
|
|
||||||
|
// Set the new state.
|
||||||
|
this.state = newState;
|
||||||
|
|
||||||
|
// Fire the "state" event, so other parts of the code can react to the
|
||||||
|
// change.
|
||||||
|
this.fire( 'state' );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggles the on/off (active/inactive) state of the command. This is
|
||||||
|
* mainly used internally by context sensitive commands.
|
||||||
|
* @example
|
||||||
|
* command.<b>toggleState()</b>;
|
||||||
|
*/
|
||||||
|
toggleState : function()
|
||||||
|
{
|
||||||
|
if ( this.state == CKEDITOR.TRISTATE_OFF )
|
||||||
|
this.setState( CKEDITOR.TRISTATE_ON );
|
||||||
|
else if ( this.state == CKEDITOR.TRISTATE_ON )
|
||||||
|
this.setState( CKEDITOR.TRISTATE_OFF );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.event.implementOn( CKEDITOR.command.prototype, true );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates the previous command state.
|
||||||
|
* @name CKEDITOR.command.prototype.previousState
|
||||||
|
* @type Number
|
||||||
|
* @see #state
|
||||||
|
* @example
|
||||||
|
* alert( command.<b>previousState</b> );
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fired when the command state changes.
|
||||||
|
* @name CKEDITOR.command#state
|
||||||
|
* @event
|
||||||
|
* @example
|
||||||
|
* command.on( <b>'state'</b> , function( e )
|
||||||
|
* {
|
||||||
|
* // Alerts the new state.
|
||||||
|
* alert( this.state );
|
||||||
|
* });
|
||||||
|
*/
|
||||||
129
htdocs/includes/ckeditor/_source/core/commanddefinition.js
Normal file
129
htdocs/includes/ckeditor/_source/core/commanddefinition.js
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileOverview Defines the "virtual" {@link CKEDITOR.commandDefinition} class,
|
||||||
|
* which contains the defintion of a command. This file is for
|
||||||
|
* documentation purposes only.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (Virtual Class) Do not call this constructor. This class is not really part
|
||||||
|
* of the API.
|
||||||
|
* @name CKEDITOR.commandDefinition
|
||||||
|
* @class Virtual class that illustrates the features of command objects to be
|
||||||
|
* passed to the {@link CKEDITOR.editor.prototype.addCommand} function.
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The function to be fired when the commend is executed.
|
||||||
|
* @name CKEDITOR.commandDefinition.prototype.exec
|
||||||
|
* @function
|
||||||
|
* @param {CKEDITOR.editor} editor The editor within which run the command.
|
||||||
|
* @param {Object} [data] Additional data to be used to execute the command.
|
||||||
|
* @returns {Boolean} Whether the command has been successfully executed.
|
||||||
|
* Defaults to "true", if nothing is returned.
|
||||||
|
* @example
|
||||||
|
* editorInstance.addCommand( 'sample',
|
||||||
|
* {
|
||||||
|
* exec : function( editor )
|
||||||
|
* {
|
||||||
|
* alert( 'Executing a command for the editor name "' + editor.name + '"!' );
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the command need to be hooked into the redo/undo system.
|
||||||
|
* @name CKEDITOR.commandDefinition.prototype.canUndo
|
||||||
|
* @type {Boolean}
|
||||||
|
* @default true
|
||||||
|
* @field
|
||||||
|
* @example
|
||||||
|
* editorInstance.addCommand( 'alertName',
|
||||||
|
* {
|
||||||
|
* exec : function( editor )
|
||||||
|
* {
|
||||||
|
* alert( editor.name );
|
||||||
|
* },
|
||||||
|
* canUndo : false // No support for undo/redo
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the command is asynchronous, which means that the
|
||||||
|
* {@link CKEDITOR.editor#event:afterCommandExec} event will be fired by the
|
||||||
|
* command itself manually, and that the return value of this command is not to
|
||||||
|
* be returned by the {@link CKEDITOR.command#exec} function.
|
||||||
|
* @name CKEDITOR.commandDefinition.prototype.async
|
||||||
|
* @default false
|
||||||
|
* @type {Boolean}
|
||||||
|
* @example
|
||||||
|
* editorInstance.addCommand( 'loadOptions',
|
||||||
|
* {
|
||||||
|
* exec : function( editor )
|
||||||
|
* {
|
||||||
|
* // Asynchronous operation below.
|
||||||
|
* CKEDITOR.ajax.loadXml( 'data.xml', function()
|
||||||
|
* {
|
||||||
|
* editor.fire( 'afterCommandExec' );
|
||||||
|
* ));
|
||||||
|
* },
|
||||||
|
* async : true // The command need some time to complete after exec function returns.
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the command should give focus to the editor before execution.
|
||||||
|
* @name CKEDITOR.commandDefinition.prototype.editorFocus
|
||||||
|
* @type {Boolean}
|
||||||
|
* @default true
|
||||||
|
* @see CKEDITOR.command#editorFocus
|
||||||
|
* @example
|
||||||
|
* editorInstance.addCommand( 'maximize',
|
||||||
|
* {
|
||||||
|
* exec : function( editor )
|
||||||
|
* {
|
||||||
|
* // ...
|
||||||
|
* },
|
||||||
|
* editorFocus : false // The command doesn't require focusing the editing document.
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the command state should be set to {@link CKEDITOR.TRISTATE_DISABLED} on startup.
|
||||||
|
* @name CKEDITOR.commandDefinition.prototype.startDisabled
|
||||||
|
* @type {Boolean}
|
||||||
|
* @default false
|
||||||
|
* @example
|
||||||
|
* editorInstance.addCommand( 'unlink',
|
||||||
|
* {
|
||||||
|
* exec : function( editor )
|
||||||
|
* {
|
||||||
|
* // ...
|
||||||
|
* },
|
||||||
|
* startDisabled : true // Command is unavailable until selection is inside a link.
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The editor modes within which the command can be executed. The execution
|
||||||
|
* will have no action if the current mode is not listed in this property.
|
||||||
|
* @name CKEDITOR.commandDefinition.prototype.modes
|
||||||
|
* @type Object
|
||||||
|
* @default { wysiwyg : 1 }
|
||||||
|
* @see CKEDITOR.command#modes
|
||||||
|
* @example
|
||||||
|
* editorInstance.addCommand( 'link',
|
||||||
|
* {
|
||||||
|
* exec : function( editor )
|
||||||
|
* {
|
||||||
|
* // ...
|
||||||
|
* },
|
||||||
|
* modes : { wysiwyg : 1 } // Command is available in wysiwyg mode only.
|
||||||
|
* });
|
||||||
|
*/
|
||||||
447
htdocs/includes/ckeditor/_source/core/config.js
Normal file
447
htdocs/includes/ckeditor/_source/core/config.js
Normal file
@ -0,0 +1,447 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileOverview Defines the <code>{@link CKEDITOR.config}</code> object that stores the
|
||||||
|
* default configuration settings.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used in conjunction with <code>{@link CKEDITOR.config.enterMode}</code>
|
||||||
|
* and <code>{@link CKEDITOR.config.shiftEnterMode}</code> configuration
|
||||||
|
* settings to make the editor produce <code><p></code> tags when
|
||||||
|
* using the <em>Enter</em> key.
|
||||||
|
* @constant
|
||||||
|
*/
|
||||||
|
CKEDITOR.ENTER_P = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used in conjunction with <code>{@link CKEDITOR.config.enterMode}</code>
|
||||||
|
* and <code>{@link CKEDITOR.config.shiftEnterMode}</code> configuration
|
||||||
|
* settings to make the editor produce <code><br></code> tags when
|
||||||
|
* using the <em>Enter</em> key.
|
||||||
|
* @constant
|
||||||
|
*/
|
||||||
|
CKEDITOR.ENTER_BR = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used in conjunction with <code>{@link CKEDITOR.config.enterMode}</code>
|
||||||
|
* and <code>{@link CKEDITOR.config.shiftEnterMode}</code> configuration
|
||||||
|
* settings to make the editor produce <code><div></code> tags when
|
||||||
|
* using the <em>Enter</em> key.
|
||||||
|
* @constant
|
||||||
|
*/
|
||||||
|
CKEDITOR.ENTER_DIV = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @namespace Stores default configuration settings. Changes to this object are
|
||||||
|
* reflected in all editor instances, if not specified otherwise for a particular
|
||||||
|
* instance.
|
||||||
|
*/
|
||||||
|
CKEDITOR.config =
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The URL path for the custom configuration file to be loaded. If not
|
||||||
|
* overloaded with inline configuration, it defaults to the <code>config.js</code>
|
||||||
|
* file present in the root of the CKEditor installation directory.<br /><br />
|
||||||
|
*
|
||||||
|
* CKEditor will recursively load custom configuration files defined inside
|
||||||
|
* other custom configuration files.
|
||||||
|
* @type String
|
||||||
|
* @default <code>'<em><CKEditor folder></em>/config.js'</code>
|
||||||
|
* @example
|
||||||
|
* // Load a specific configuration file.
|
||||||
|
* CKEDITOR.replace( 'myfield', { customConfig : '/myconfig.js' } );
|
||||||
|
* @example
|
||||||
|
* // Do not load any custom configuration file.
|
||||||
|
* CKEDITOR.replace( 'myfield', { customConfig : '' } );
|
||||||
|
*/
|
||||||
|
customConfig : 'config.js',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the replaced element (usually a <code><textarea></code>)
|
||||||
|
* is to be updated automatically when posting the form containing the editor.
|
||||||
|
* @type Boolean
|
||||||
|
* @default <code>true</code>
|
||||||
|
* @example
|
||||||
|
* config.autoUpdateElement = true;
|
||||||
|
*/
|
||||||
|
autoUpdateElement : true,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base href URL used to resolve relative and absolute URLs in the
|
||||||
|
* editor content.
|
||||||
|
* @type String
|
||||||
|
* @default <code>''</code> (empty)
|
||||||
|
* @example
|
||||||
|
* config.baseHref = 'http://www.example.com/path/';
|
||||||
|
*/
|
||||||
|
baseHref : '',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The CSS file(s) to be used to apply style to editor contents. It should
|
||||||
|
* reflect the CSS used in the final pages where the contents are to be
|
||||||
|
* used.
|
||||||
|
* @type String|Array
|
||||||
|
* @default <code>'<em><CKEditor folder></em>/contents.css'</code>
|
||||||
|
* @example
|
||||||
|
* config.contentsCss = '/css/mysitestyles.css';
|
||||||
|
* config.contentsCss = ['/css/mysitestyles.css', '/css/anotherfile.css'];
|
||||||
|
*/
|
||||||
|
contentsCss : CKEDITOR.basePath + 'contents.css',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The writing direction of the language used to create the editor
|
||||||
|
* contents. Allowed values are:
|
||||||
|
* <ul>
|
||||||
|
* <li><code>'ui'</code> – indicates that content direction will be the same as the user interface language direction;</li>
|
||||||
|
* <li><code>'ltr'</code> – for Left-To-Right language (like English);</li>
|
||||||
|
* <li><code>'rtl'</code> – for Right-To-Left languages (like Arabic).</li>
|
||||||
|
* </ul>
|
||||||
|
* @default <code>'ui'</code>
|
||||||
|
* @type String
|
||||||
|
* @example
|
||||||
|
* config.contentsLangDirection = 'rtl';
|
||||||
|
*/
|
||||||
|
contentsLangDirection : 'ui',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Language code of the writing language which is used to create the editor
|
||||||
|
* contents.
|
||||||
|
* @default Same value as editor UI language.
|
||||||
|
* @type String
|
||||||
|
* @example
|
||||||
|
* config.contentsLanguage = 'fr';
|
||||||
|
*/
|
||||||
|
contentsLanguage : '',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The user interface language localization to use. If left empty, the editor
|
||||||
|
* will automatically be localized to the user language. If the user language is not supported,
|
||||||
|
* the language specified in the <code>{@link CKEDITOR.config.defaultLanguage}</code>
|
||||||
|
* configuration setting is used.
|
||||||
|
* @default <code>''</code> (empty)
|
||||||
|
* @type String
|
||||||
|
* @example
|
||||||
|
* // Load the German interface.
|
||||||
|
* config.language = 'de';
|
||||||
|
*/
|
||||||
|
language : '',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The language to be used if the <code>{@link CKEDITOR.config.language}</code>
|
||||||
|
* setting is left empty and it is not possible to localize the editor to the user language.
|
||||||
|
* @default <code>'en'</code>
|
||||||
|
* @type String
|
||||||
|
* @example
|
||||||
|
* config.defaultLanguage = 'it';
|
||||||
|
*/
|
||||||
|
defaultLanguage : 'en',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the behavior of the <em>Enter</em> key. It also determines other behavior
|
||||||
|
* rules of the editor, like whether the <code><br></code> element is to be used
|
||||||
|
* as a paragraph separator when indenting text.
|
||||||
|
* The allowed values are the following constants that cause the behavior outlined below:
|
||||||
|
* <ul>
|
||||||
|
* <li><code>{@link CKEDITOR.ENTER_P}</code> (1) – new <code><p></code> paragraphs are created;</li>
|
||||||
|
* <li><code>{@link CKEDITOR.ENTER_BR}</code> (2) – lines are broken with <code><br></code> elements;</li>
|
||||||
|
* <li><code>{@link CKEDITOR.ENTER_DIV}</code> (3) – new <code><div></code> blocks are created.</li>
|
||||||
|
* </ul>
|
||||||
|
* <strong>Note</strong>: It is recommended to use the
|
||||||
|
* <code>{@link CKEDITOR.ENTER_P}</code> setting because of its semantic value and
|
||||||
|
* correctness. The editor is optimized for this setting.
|
||||||
|
* @type Number
|
||||||
|
* @default <code>{@link CKEDITOR.ENTER_P}</code>
|
||||||
|
* @example
|
||||||
|
* // Not recommended.
|
||||||
|
* config.enterMode = CKEDITOR.ENTER_BR;
|
||||||
|
*/
|
||||||
|
enterMode : CKEDITOR.ENTER_P,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Force the use of <code>{@link CKEDITOR.config.enterMode}</code> as line break regardless
|
||||||
|
* of the context. If, for example, <code>{@link CKEDITOR.config.enterMode}</code> is set
|
||||||
|
* to <code>{@link CKEDITOR.ENTER_P}</code>, pressing the <em>Enter</em> key inside a
|
||||||
|
* <code><div></code> element will create a new paragraph with <code><p></code>
|
||||||
|
* instead of a <code><div></code>.
|
||||||
|
* @since 3.2.1
|
||||||
|
* @type Boolean
|
||||||
|
* @default <code>false</code>
|
||||||
|
* @example
|
||||||
|
* // Not recommended.
|
||||||
|
* config.forceEnterMode = true;
|
||||||
|
*/
|
||||||
|
forceEnterMode : false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Similarly to the <code>{@link CKEDITOR.config.enterMode}</code> setting, it defines the behavior
|
||||||
|
* of the <em>Shift+Enter</em> key combination.
|
||||||
|
* The allowed values are the following constants the behavior outlined below:
|
||||||
|
* <ul>
|
||||||
|
* <li><code>{@link CKEDITOR.ENTER_P}</code> (1) – new <code><p></code> paragraphs are created;</li>
|
||||||
|
* <li><code>{@link CKEDITOR.ENTER_BR}</code> (2) – lines are broken with <code><br></code> elements;</li>
|
||||||
|
* <li><code>{@link CKEDITOR.ENTER_DIV}</code> (3) – new <code><div></code> blocks are created.</li>
|
||||||
|
* </ul>
|
||||||
|
* @type Number
|
||||||
|
* @default <code>{@link CKEDITOR.ENTER_BR}</code>
|
||||||
|
* @example
|
||||||
|
* config.shiftEnterMode = CKEDITOR.ENTER_P;
|
||||||
|
*/
|
||||||
|
shiftEnterMode : CKEDITOR.ENTER_BR,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A comma separated list of plugins that are not related to editor
|
||||||
|
* instances. Reserved for plugins that extend the core code only.<br /><br />
|
||||||
|
*
|
||||||
|
* There are no ways to override this setting except by editing the source
|
||||||
|
* code of CKEditor (<code>_source/core/config.js</code>).
|
||||||
|
* @type String
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
corePlugins : '',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>DOCTYPE</code> to be used when loading the editor content as HTML.
|
||||||
|
* @type String
|
||||||
|
* @default <code>'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'</code>
|
||||||
|
* @example
|
||||||
|
* // Set the DOCTYPE to the HTML 4 (Quirks) mode.
|
||||||
|
* config.docType = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
|
||||||
|
*/
|
||||||
|
docType : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>id</code> attribute to be used on the <code>body</code> element
|
||||||
|
* of the editing area. This can be useful when you intend to reuse the original CSS
|
||||||
|
* file you are using on your live website and want to assign the editor the same ID
|
||||||
|
* as the section that will include the contents. In this way ID-specific CSS rules will
|
||||||
|
* be enabled.
|
||||||
|
* @since 3.1
|
||||||
|
* @type String
|
||||||
|
* @default <code>''</code> (empty)
|
||||||
|
* @example
|
||||||
|
* config.bodyId = 'contents_id';
|
||||||
|
*/
|
||||||
|
bodyId : '',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the <code>class</code> attribute to be used on the <code>body</code> element
|
||||||
|
* of the editing area. This can be useful when you intend to reuse the original CSS
|
||||||
|
* file you are using on your live website and want to assign the editor the same class
|
||||||
|
* as the section that will include the contents. In this way class-specific CSS rules will
|
||||||
|
* be enabled.
|
||||||
|
* @since 3.1
|
||||||
|
* @type String
|
||||||
|
* @default <code>''</code> (empty)
|
||||||
|
* @example
|
||||||
|
* config.bodyClass = 'contents';
|
||||||
|
*/
|
||||||
|
bodyClass : '',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether the contents to be edited are being input as a full
|
||||||
|
* HTML page. A full page includes the <code><html></code>,
|
||||||
|
* <code><head></code>, and <code><body></code> elements.
|
||||||
|
* The final output will also reflect this setting, including the
|
||||||
|
* <code><body></code> contents only if this setting is disabled.
|
||||||
|
* @since 3.1
|
||||||
|
* @type Boolean
|
||||||
|
* @default <code>false</code>
|
||||||
|
* @example
|
||||||
|
* config.fullPage = true;
|
||||||
|
*/
|
||||||
|
fullPage : false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The height of the editing area (that includes the editor content). This
|
||||||
|
* can be an integer, for pixel sizes, or any CSS-defined length unit.<br>
|
||||||
|
* <br>
|
||||||
|
* <strong>Note:</strong> Percent units (%) are not supported.
|
||||||
|
* @type Number|String
|
||||||
|
* @default <code>200</code>
|
||||||
|
* @example
|
||||||
|
* config.height = 500; // 500 pixels.
|
||||||
|
* @example
|
||||||
|
* config.height = '25em'; // CSS length.
|
||||||
|
* @example
|
||||||
|
* config.height = '300px'; // CSS length.
|
||||||
|
*/
|
||||||
|
height : 200,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comma separated list of plugins to be loaded and initialized for an editor
|
||||||
|
* instance. This setting should rarely be changed. It is recommended to use the
|
||||||
|
* <code>{@link CKEDITOR.config.extraPlugins}</code> and
|
||||||
|
* <code>{@link CKEDITOR.config.removePlugins}</code> for customization purposes instead.
|
||||||
|
* @type String
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
plugins :
|
||||||
|
'about,' +
|
||||||
|
'a11yhelp,' +
|
||||||
|
'basicstyles,' +
|
||||||
|
'bidi,' +
|
||||||
|
'blockquote,' +
|
||||||
|
'button,' +
|
||||||
|
'clipboard,' +
|
||||||
|
'colorbutton,' +
|
||||||
|
'colordialog,' +
|
||||||
|
'contextmenu,' +
|
||||||
|
'dialogadvtab,' +
|
||||||
|
'div,' +
|
||||||
|
'elementspath,' +
|
||||||
|
'enterkey,' +
|
||||||
|
'entities,' +
|
||||||
|
'filebrowser,' +
|
||||||
|
'find,' +
|
||||||
|
'flash,' +
|
||||||
|
'font,' +
|
||||||
|
'format,' +
|
||||||
|
'forms,' +
|
||||||
|
'horizontalrule,' +
|
||||||
|
'htmldataprocessor,' +
|
||||||
|
'iframe,' +
|
||||||
|
'image,' +
|
||||||
|
'indent,' +
|
||||||
|
'justify,' +
|
||||||
|
'keystrokes,' +
|
||||||
|
'link,' +
|
||||||
|
'list,' +
|
||||||
|
'liststyle,' +
|
||||||
|
'maximize,' +
|
||||||
|
'newpage,' +
|
||||||
|
'pagebreak,' +
|
||||||
|
'pastefromword,' +
|
||||||
|
'pastetext,' +
|
||||||
|
'popup,' +
|
||||||
|
'preview,' +
|
||||||
|
'print,' +
|
||||||
|
'removeformat,' +
|
||||||
|
'resize,' +
|
||||||
|
'save,' +
|
||||||
|
'scayt,' +
|
||||||
|
'showblocks,' +
|
||||||
|
'showborders,' +
|
||||||
|
'smiley,' +
|
||||||
|
'sourcearea,' +
|
||||||
|
'specialchar,' +
|
||||||
|
'stylescombo,' +
|
||||||
|
'tab,' +
|
||||||
|
'table,' +
|
||||||
|
'tabletools,' +
|
||||||
|
'templates,' +
|
||||||
|
'toolbar,' +
|
||||||
|
'undo,' +
|
||||||
|
'wsc,' +
|
||||||
|
'wysiwygarea',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of additional plugins to be loaded. This setting makes it easier
|
||||||
|
* to add new plugins without having to touch and potentially break the
|
||||||
|
* <code>{@link CKEDITOR.config.plugins}</code> setting.
|
||||||
|
* @type String
|
||||||
|
* @example
|
||||||
|
* config.extraPlugins = 'myplugin,anotherplugin';
|
||||||
|
*/
|
||||||
|
extraPlugins : '',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of plugins that must not be loaded. This setting makes it possible
|
||||||
|
* to avoid loading some plugins defined in the <code>{@link CKEDITOR.config.plugins}</code>
|
||||||
|
* setting, without having to touch it and potentially break it.
|
||||||
|
* @type String
|
||||||
|
* @example
|
||||||
|
* config.removePlugins = 'elementspath,save,font';
|
||||||
|
*/
|
||||||
|
removePlugins : '',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of regular expressions to be executed on input HTML,
|
||||||
|
* indicating HTML source code that when matched, must <strong>not</strong> be available in the WYSIWYG
|
||||||
|
* mode for editing.
|
||||||
|
* @type Array
|
||||||
|
* @default <code>[]</code> (empty array)
|
||||||
|
* @example
|
||||||
|
* config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // PHP code
|
||||||
|
* config.protectedSource.push( /<%[\s\S]*?%>/g ); // ASP code
|
||||||
|
* config.protectedSource.push( /(<asp:[^\>]+>[\s|\S]*?<\/asp:[^\>]+>)|(<asp:[^\>]+\/>)/gi ); // ASP.Net code
|
||||||
|
*/
|
||||||
|
protectedSource : [],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The editor <code>tabindex</code> value.
|
||||||
|
* @type Number
|
||||||
|
* @default <code>0</code> (zero)
|
||||||
|
* @example
|
||||||
|
* config.tabIndex = 1;
|
||||||
|
*/
|
||||||
|
tabIndex : 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The theme to be used to build the user interface.
|
||||||
|
* @type String
|
||||||
|
* @default <code>'default'</code>
|
||||||
|
* @see CKEDITOR.config.skin
|
||||||
|
* @example
|
||||||
|
* config.theme = 'default';
|
||||||
|
*/
|
||||||
|
theme : 'default',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The skin to load. It may be the name of the skin folder inside the
|
||||||
|
* editor installation path, or the name and the path separated by a comma.
|
||||||
|
* @type String
|
||||||
|
* @default <code>'default'</code>
|
||||||
|
* @example
|
||||||
|
* config.skin = 'v2';
|
||||||
|
* @example
|
||||||
|
* config.skin = 'myskin,/customstuff/myskin/';
|
||||||
|
*/
|
||||||
|
skin : 'kama',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The editor UI outer width. This can be an integer, for pixel sizes, or
|
||||||
|
* any CSS-defined unit.<br>
|
||||||
|
* <br>
|
||||||
|
* Unlike the <code>{@link CKEDITOR.config.height}</code> setting, this
|
||||||
|
* one will set the outer width of the entire editor UI, not for the
|
||||||
|
* editing area only.
|
||||||
|
* @type String|Number
|
||||||
|
* @default <code>''</code> (empty)
|
||||||
|
* @example
|
||||||
|
* config.width = 850; // 850 pixels wide.
|
||||||
|
* @example
|
||||||
|
* config.width = '75%'; // CSS unit.
|
||||||
|
*/
|
||||||
|
width : '',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base Z-index for floating dialog windows and popups.
|
||||||
|
* @type Number
|
||||||
|
* @default <code>10000</code>
|
||||||
|
* @example
|
||||||
|
* config.baseFloatZIndex = 2000
|
||||||
|
*/
|
||||||
|
baseFloatZIndex : 10000
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that some of the editor features, like alignment and text
|
||||||
|
* direction, should use the "computed value" of the feature to indicate its
|
||||||
|
* on/off state instead of using the "real value".<br />
|
||||||
|
* <br />
|
||||||
|
* If enabled in a Left-To-Right written document, the "Left Justify"
|
||||||
|
* alignment button will be shown as active, even if the alignment style is not
|
||||||
|
* explicitly applied to the current paragraph in the editor.
|
||||||
|
* @name CKEDITOR.config.useComputedState
|
||||||
|
* @type Boolean
|
||||||
|
* @default <code>true</code>
|
||||||
|
* @since 3.4
|
||||||
|
* @example
|
||||||
|
* config.useComputedState = false;
|
||||||
|
*/
|
||||||
|
|
||||||
|
// PACKAGER_RENAME( CKEDITOR.config )
|
||||||
65
htdocs/includes/ckeditor/_source/core/dataprocessor.js
Normal file
65
htdocs/includes/ckeditor/_source/core/dataprocessor.js
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileOverview Defines the "virtual" {@link CKEDITOR.dataProcessor} class, which
|
||||||
|
* defines the basic structure of data processor objects to be
|
||||||
|
* set to {@link CKEDITOR.editor.dataProcessor}.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If defined, points to the data processor which is responsible to translate
|
||||||
|
* and transform the editor data on input and output.
|
||||||
|
* Generaly it will point to an instance of {@link CKEDITOR.htmlDataProcessor},
|
||||||
|
* which handles HTML data. The editor may also handle other data formats by
|
||||||
|
* using different data processors provided by specific plugins.
|
||||||
|
* @name CKEDITOR.editor.prototype.dataProcessor
|
||||||
|
* @type CKEDITOR.dataProcessor
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is here for documentation purposes only and is not really part of
|
||||||
|
* the API. It serves as the base ("interface") for data processors
|
||||||
|
* implementation.
|
||||||
|
* @name CKEDITOR.dataProcessor
|
||||||
|
* @class Represents a data processor, which is responsible to translate and
|
||||||
|
* transform the editor data on input and output.
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transforms input data into HTML to be loaded in the editor.
|
||||||
|
* While the editor is able to handle non HTML data (like BBCode), at runtime
|
||||||
|
* it can handle HTML data only. The role of the data processor is transforming
|
||||||
|
* the input data into HTML through this function.
|
||||||
|
* @name CKEDITOR.dataProcessor.prototype.toHtml
|
||||||
|
* @function
|
||||||
|
* @param {String} data The input data to be transformed.
|
||||||
|
* @param {String} [fixForBody] The tag name to be used if the data must be
|
||||||
|
* fixed because it is supposed to be loaded direcly into the <body>
|
||||||
|
* tag. This is generally not used by non-HTML data processors.
|
||||||
|
* @example
|
||||||
|
* // Tranforming BBCode data, having a custom BBCode data processor.
|
||||||
|
* var data = 'This is [b]an example[/b].';
|
||||||
|
* var html = editor.dataProcessor.toHtml( data ); // '<p>This is <b>an example</b>.</p>'
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transforms HTML into data to be outputted by the editor, in the format
|
||||||
|
* expected by the data processor.
|
||||||
|
* While the editor is able to handle non HTML data (like BBCode), at runtime
|
||||||
|
* it can handle HTML data only. The role of the data processor is transforming
|
||||||
|
* the HTML data containined by the editor into a specific data format through
|
||||||
|
* this function.
|
||||||
|
* @name CKEDITOR.dataProcessor.prototype.toDataFormat
|
||||||
|
* @function
|
||||||
|
* @param {String} html The HTML to be transformed.
|
||||||
|
* @param {String} fixForBody The tag name to be used if the output data is
|
||||||
|
* coming from <body> and may be eventually fixed for it. This is
|
||||||
|
* generally not used by non-HTML data processors.
|
||||||
|
* // Tranforming into BBCode data, having a custom BBCode data processor.
|
||||||
|
* var html = '<p>This is <b>an example</b>.</p>';
|
||||||
|
* var data = editor.dataProcessor.toDataFormat( html ); // 'This is [b]an example[/b].'
|
||||||
|
*/
|
||||||
20
htdocs/includes/ckeditor/_source/core/dom.js
Normal file
20
htdocs/includes/ckeditor/_source/core/dom.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileOverview Defines the {@link CKEDITOR.dom} object, which contains DOM
|
||||||
|
* manipulation objects and function.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @namespace DOM manipulation objects, classes and functions.
|
||||||
|
* @see CKEDITOR.dom.element
|
||||||
|
* @see CKEDITOR.dom.node
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.dom =
|
||||||
|
{};
|
||||||
|
|
||||||
|
// PACKAGER_RENAME( CKEDITOR.dom )
|
||||||
44
htdocs/includes/ckeditor/_source/core/dom/comment.js
Normal file
44
htdocs/includes/ckeditor/_source/core/dom/comment.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileOverview Defines the {@link CKEDITOR.dom.comment} class, which represents
|
||||||
|
* a DOM comment node.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a DOM comment node.
|
||||||
|
* @constructor
|
||||||
|
* @augments CKEDITOR.dom.node
|
||||||
|
* @param {Object|String} comment A native DOM comment node or a string containing
|
||||||
|
* the text to use to create a new comment node.
|
||||||
|
* @param {CKEDITOR.dom.document} [ownerDocument] The document that will contain
|
||||||
|
* the node in case of new node creation. Defaults to the current document.
|
||||||
|
* @example
|
||||||
|
* var nativeNode = document.createComment( 'Example' );
|
||||||
|
* var comment = CKEDITOR.dom.comment( nativeNode );
|
||||||
|
* @example
|
||||||
|
* var comment = CKEDITOR.dom.comment( 'Example' );
|
||||||
|
*/
|
||||||
|
CKEDITOR.dom.comment = function( comment, ownerDocument )
|
||||||
|
{
|
||||||
|
if ( typeof comment == 'string' )
|
||||||
|
comment = ( ownerDocument ? ownerDocument.$ : document ).createComment( comment );
|
||||||
|
|
||||||
|
CKEDITOR.dom.domObject.call( this, comment );
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.dom.comment.prototype = new CKEDITOR.dom.node();
|
||||||
|
|
||||||
|
CKEDITOR.tools.extend( CKEDITOR.dom.comment.prototype,
|
||||||
|
/** @lends CKEDITOR.dom.comment.prototype */
|
||||||
|
{
|
||||||
|
type : CKEDITOR.NODE_COMMENT,
|
||||||
|
|
||||||
|
getOuterHtml : function()
|
||||||
|
{
|
||||||
|
return '<!--' + this.$.nodeValue + '-->';
|
||||||
|
}
|
||||||
|
});
|
||||||
251
htdocs/includes/ckeditor/_source/core/dom/document.js
Normal file
251
htdocs/includes/ckeditor/_source/core/dom/document.js
Normal file
@ -0,0 +1,251 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileOverview Defines the {@link CKEDITOR.dom.document} class, which
|
||||||
|
* represents a DOM document.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a DOM document.
|
||||||
|
* @constructor
|
||||||
|
* @augments CKEDITOR.dom.domObject
|
||||||
|
* @param {Object} domDocument A native DOM document.
|
||||||
|
* @example
|
||||||
|
* var document = new CKEDITOR.dom.document( document );
|
||||||
|
*/
|
||||||
|
CKEDITOR.dom.document = function( domDocument )
|
||||||
|
{
|
||||||
|
CKEDITOR.dom.domObject.call( this, domDocument );
|
||||||
|
};
|
||||||
|
|
||||||
|
// PACKAGER_RENAME( CKEDITOR.dom.document )
|
||||||
|
|
||||||
|
CKEDITOR.dom.document.prototype = new CKEDITOR.dom.domObject();
|
||||||
|
|
||||||
|
CKEDITOR.tools.extend( CKEDITOR.dom.document.prototype,
|
||||||
|
/** @lends CKEDITOR.dom.document.prototype */
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Appends a CSS file to the document.
|
||||||
|
* @param {String} cssFileUrl The CSS file URL.
|
||||||
|
* @example
|
||||||
|
* <b>CKEDITOR.document.appendStyleSheet( '/mystyles.css' )</b>;
|
||||||
|
*/
|
||||||
|
appendStyleSheet : function( cssFileUrl )
|
||||||
|
{
|
||||||
|
if ( this.$.createStyleSheet )
|
||||||
|
this.$.createStyleSheet( cssFileUrl );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var link = new CKEDITOR.dom.element( 'link' );
|
||||||
|
link.setAttributes(
|
||||||
|
{
|
||||||
|
rel :'stylesheet',
|
||||||
|
type : 'text/css',
|
||||||
|
href : cssFileUrl
|
||||||
|
});
|
||||||
|
|
||||||
|
this.getHead().append( link );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
appendStyleText : function( cssStyleText )
|
||||||
|
{
|
||||||
|
if ( this.$.createStyleSheet )
|
||||||
|
{
|
||||||
|
var styleSheet = this.$.createStyleSheet( "" );
|
||||||
|
styleSheet.cssText = cssStyleText ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var style = new CKEDITOR.dom.element( 'style', this );
|
||||||
|
style.append( new CKEDITOR.dom.text( cssStyleText, this ) );
|
||||||
|
this.getHead().append( style );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
createElement : function( name, attribsAndStyles )
|
||||||
|
{
|
||||||
|
var element = new CKEDITOR.dom.element( name, this );
|
||||||
|
|
||||||
|
if ( attribsAndStyles )
|
||||||
|
{
|
||||||
|
if ( attribsAndStyles.attributes )
|
||||||
|
element.setAttributes( attribsAndStyles.attributes );
|
||||||
|
|
||||||
|
if ( attribsAndStyles.styles )
|
||||||
|
element.setStyles( attribsAndStyles.styles );
|
||||||
|
}
|
||||||
|
|
||||||
|
return element;
|
||||||
|
},
|
||||||
|
|
||||||
|
createText : function( text )
|
||||||
|
{
|
||||||
|
return new CKEDITOR.dom.text( text, this );
|
||||||
|
},
|
||||||
|
|
||||||
|
focus : function()
|
||||||
|
{
|
||||||
|
this.getWindow().focus();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets and element based on its id.
|
||||||
|
* @param {String} elementId The element id.
|
||||||
|
* @returns {CKEDITOR.dom.element} The element instance, or null if not found.
|
||||||
|
* @example
|
||||||
|
* var element = <b>CKEDITOR.document.getById( 'myElement' )</b>;
|
||||||
|
* alert( element.getId() ); // "myElement"
|
||||||
|
*/
|
||||||
|
getById : function( elementId )
|
||||||
|
{
|
||||||
|
var $ = this.$.getElementById( elementId );
|
||||||
|
return $ ? new CKEDITOR.dom.element( $ ) : null;
|
||||||
|
},
|
||||||
|
|
||||||
|
getByAddress : function( address, normalized )
|
||||||
|
{
|
||||||
|
var $ = this.$.documentElement;
|
||||||
|
|
||||||
|
for ( var i = 0 ; $ && i < address.length ; i++ )
|
||||||
|
{
|
||||||
|
var target = address[ i ];
|
||||||
|
|
||||||
|
if ( !normalized )
|
||||||
|
{
|
||||||
|
$ = $.childNodes[ target ];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var currentIndex = -1;
|
||||||
|
|
||||||
|
for (var j = 0 ; j < $.childNodes.length ; j++ )
|
||||||
|
{
|
||||||
|
var candidate = $.childNodes[ j ];
|
||||||
|
|
||||||
|
if ( normalized === true &&
|
||||||
|
candidate.nodeType == 3 &&
|
||||||
|
candidate.previousSibling &&
|
||||||
|
candidate.previousSibling.nodeType == 3 )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentIndex++;
|
||||||
|
|
||||||
|
if ( currentIndex == target )
|
||||||
|
{
|
||||||
|
$ = candidate;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ ? new CKEDITOR.dom.node( $ ) : null;
|
||||||
|
},
|
||||||
|
|
||||||
|
getElementsByTag : function( tagName, namespace )
|
||||||
|
{
|
||||||
|
if ( !( CKEDITOR.env.ie && ! ( document.documentMode > 8 ) ) && namespace )
|
||||||
|
tagName = namespace + ':' + tagName;
|
||||||
|
return new CKEDITOR.dom.nodeList( this.$.getElementsByTagName( tagName ) );
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the <head> element for this document.
|
||||||
|
* @returns {CKEDITOR.dom.element} The <head> element.
|
||||||
|
* @example
|
||||||
|
* var element = <b>CKEDITOR.document.getHead()</b>;
|
||||||
|
* alert( element.getName() ); // "head"
|
||||||
|
*/
|
||||||
|
getHead : function()
|
||||||
|
{
|
||||||
|
var head = this.$.getElementsByTagName( 'head' )[0];
|
||||||
|
if ( !head )
|
||||||
|
head = this.getDocumentElement().append( new CKEDITOR.dom.element( 'head' ), true );
|
||||||
|
else
|
||||||
|
head = new CKEDITOR.dom.element( head );
|
||||||
|
|
||||||
|
return (
|
||||||
|
this.getHead = function()
|
||||||
|
{
|
||||||
|
return head;
|
||||||
|
})();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the <body> element for this document.
|
||||||
|
* @returns {CKEDITOR.dom.element} The <body> element.
|
||||||
|
* @example
|
||||||
|
* var element = <b>CKEDITOR.document.getBody()</b>;
|
||||||
|
* alert( element.getName() ); // "body"
|
||||||
|
*/
|
||||||
|
getBody : function()
|
||||||
|
{
|
||||||
|
var body = new CKEDITOR.dom.element( this.$.body );
|
||||||
|
|
||||||
|
return (
|
||||||
|
this.getBody = function()
|
||||||
|
{
|
||||||
|
return body;
|
||||||
|
})();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the DOM document element for this document.
|
||||||
|
* @returns {CKEDITOR.dom.element} The DOM document element.
|
||||||
|
*/
|
||||||
|
getDocumentElement : function()
|
||||||
|
{
|
||||||
|
var documentElement = new CKEDITOR.dom.element( this.$.documentElement );
|
||||||
|
|
||||||
|
return (
|
||||||
|
this.getDocumentElement = function()
|
||||||
|
{
|
||||||
|
return documentElement;
|
||||||
|
})();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the window object that holds this document.
|
||||||
|
* @returns {CKEDITOR.dom.window} The window object.
|
||||||
|
*/
|
||||||
|
getWindow : function()
|
||||||
|
{
|
||||||
|
var win = new CKEDITOR.dom.window( this.$.parentWindow || this.$.defaultView );
|
||||||
|
|
||||||
|
return (
|
||||||
|
this.getWindow = function()
|
||||||
|
{
|
||||||
|
return win;
|
||||||
|
})();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines the document contents through document.write. Note that the
|
||||||
|
* previous document contents will be lost (cleaned).
|
||||||
|
* @since 3.5
|
||||||
|
* @param {String} html The HTML defining the document contents.
|
||||||
|
* @example
|
||||||
|
* document.write(
|
||||||
|
* '<html>' +
|
||||||
|
* '<head><title>Sample Doc</title></head>' +
|
||||||
|
* '<body>Document contents created by code</body>' +
|
||||||
|
* '</html>' );
|
||||||
|
*/
|
||||||
|
write : function( html )
|
||||||
|
{
|
||||||
|
// Don't leave any history log in IE. (#5657)
|
||||||
|
this.$.open( 'text/html', 'replace' );
|
||||||
|
|
||||||
|
// Support for custom document.domain in IE.
|
||||||
|
CKEDITOR.env.isCustomDomain() && ( this.$.domain = document.domain );
|
||||||
|
|
||||||
|
this.$.write( html );
|
||||||
|
this.$.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class DocumentFragment is a "lightweight" or "minimal" Document object. It is
|
||||||
|
* commonly used to extract a portion of a document's tree or to create a new
|
||||||
|
* fragment of a document. Various operations may take DocumentFragment objects
|
||||||
|
* as arguments and results in all the child nodes of the DocumentFragment being
|
||||||
|
* moved to the child list of this node.
|
||||||
|
* @param {Object} ownerDocument
|
||||||
|
*/
|
||||||
|
CKEDITOR.dom.documentFragment = function( ownerDocument )
|
||||||
|
{
|
||||||
|
ownerDocument = ownerDocument || CKEDITOR.document;
|
||||||
|
this.$ = ownerDocument.$.createDocumentFragment();
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.tools.extend( CKEDITOR.dom.documentFragment.prototype,
|
||||||
|
CKEDITOR.dom.element.prototype,
|
||||||
|
{
|
||||||
|
type : CKEDITOR.NODE_DOCUMENT_FRAGMENT,
|
||||||
|
insertAfterNode : function( node )
|
||||||
|
{
|
||||||
|
node = node.$;
|
||||||
|
node.parentNode.insertBefore( this.$, node.nextSibling );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
true,
|
||||||
|
{
|
||||||
|
'append' : 1,
|
||||||
|
'appendBogus' : 1,
|
||||||
|
'getFirst' : 1,
|
||||||
|
'getLast' : 1,
|
||||||
|
'appendTo' : 1,
|
||||||
|
'moveChildren' : 1,
|
||||||
|
'insertBefore' : 1,
|
||||||
|
'insertAfterNode' : 1,
|
||||||
|
'replace' : 1,
|
||||||
|
'trim' : 1,
|
||||||
|
'type' : 1,
|
||||||
|
'ltrim' : 1,
|
||||||
|
'rtrim' : 1,
|
||||||
|
'getDocument' : 1,
|
||||||
|
'getChildCount' : 1,
|
||||||
|
'getChild' : 1,
|
||||||
|
'getChildren' : 1
|
||||||
|
} );
|
||||||
258
htdocs/includes/ckeditor/_source/core/dom/domobject.js
Normal file
258
htdocs/includes/ckeditor/_source/core/dom/domobject.js
Normal file
@ -0,0 +1,258 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileOverview Defines the {@link CKEDITOR.editor} class, which is the base
|
||||||
|
* for other classes representing DOM objects.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a DOM object. This class is not intended to be used directly. It
|
||||||
|
* serves as the base class for other classes representing specific DOM
|
||||||
|
* objects.
|
||||||
|
* @constructor
|
||||||
|
* @param {Object} nativeDomObject A native DOM object.
|
||||||
|
* @augments CKEDITOR.event
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.dom.domObject = function( nativeDomObject )
|
||||||
|
{
|
||||||
|
if ( nativeDomObject )
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The native DOM object represented by this class instance.
|
||||||
|
* @type Object
|
||||||
|
* @example
|
||||||
|
* var element = new CKEDITOR.dom.element( 'span' );
|
||||||
|
* alert( element.$.nodeType ); // "1"
|
||||||
|
*/
|
||||||
|
this.$ = nativeDomObject;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.dom.domObject.prototype = (function()
|
||||||
|
{
|
||||||
|
// Do not define other local variables here. We want to keep the native
|
||||||
|
// listener closures as clean as possible.
|
||||||
|
|
||||||
|
var getNativeListener = function( domObject, eventName )
|
||||||
|
{
|
||||||
|
return function( domEvent )
|
||||||
|
{
|
||||||
|
// In FF, when reloading the page with the editor focused, it may
|
||||||
|
// throw an error because the CKEDITOR global is not anymore
|
||||||
|
// available. So, we check it here first. (#2923)
|
||||||
|
if ( typeof CKEDITOR != 'undefined' )
|
||||||
|
domObject.fire( eventName, new CKEDITOR.dom.event( domEvent ) );
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
return /** @lends CKEDITOR.dom.domObject.prototype */ {
|
||||||
|
|
||||||
|
getPrivate : function()
|
||||||
|
{
|
||||||
|
var priv;
|
||||||
|
|
||||||
|
// Get the main private function from the custom data. Create it if not
|
||||||
|
// defined.
|
||||||
|
if ( !( priv = this.getCustomData( '_' ) ) )
|
||||||
|
this.setCustomData( '_', ( priv = {} ) );
|
||||||
|
|
||||||
|
return priv;
|
||||||
|
},
|
||||||
|
|
||||||
|
/** @ignore */
|
||||||
|
on : function( eventName )
|
||||||
|
{
|
||||||
|
// We customize the "on" function here. The basic idea is that we'll have
|
||||||
|
// only one listener for a native event, which will then call all listeners
|
||||||
|
// set to the event.
|
||||||
|
|
||||||
|
// Get the listeners holder object.
|
||||||
|
var nativeListeners = this.getCustomData( '_cke_nativeListeners' );
|
||||||
|
|
||||||
|
if ( !nativeListeners )
|
||||||
|
{
|
||||||
|
nativeListeners = {};
|
||||||
|
this.setCustomData( '_cke_nativeListeners', nativeListeners );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if we have a listener for that event.
|
||||||
|
if ( !nativeListeners[ eventName ] )
|
||||||
|
{
|
||||||
|
var listener = nativeListeners[ eventName ] = getNativeListener( this, eventName );
|
||||||
|
|
||||||
|
if ( this.$.addEventListener )
|
||||||
|
this.$.addEventListener( eventName, listener, !!CKEDITOR.event.useCapture );
|
||||||
|
else if ( this.$.attachEvent )
|
||||||
|
this.$.attachEvent( 'on' + eventName, listener );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call the original implementation.
|
||||||
|
return CKEDITOR.event.prototype.on.apply( this, arguments );
|
||||||
|
},
|
||||||
|
|
||||||
|
/** @ignore */
|
||||||
|
removeListener : function( eventName )
|
||||||
|
{
|
||||||
|
// Call the original implementation.
|
||||||
|
CKEDITOR.event.prototype.removeListener.apply( this, arguments );
|
||||||
|
|
||||||
|
// If we don't have listeners for this event, clean the DOM up.
|
||||||
|
if ( !this.hasListeners( eventName ) )
|
||||||
|
{
|
||||||
|
var nativeListeners = this.getCustomData( '_cke_nativeListeners' );
|
||||||
|
var listener = nativeListeners && nativeListeners[ eventName ];
|
||||||
|
if ( listener )
|
||||||
|
{
|
||||||
|
if ( this.$.removeEventListener )
|
||||||
|
this.$.removeEventListener( eventName, listener, false );
|
||||||
|
else if ( this.$.detachEvent )
|
||||||
|
this.$.detachEvent( 'on' + eventName, listener );
|
||||||
|
|
||||||
|
delete nativeListeners[ eventName ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes any listener set on this object.
|
||||||
|
* To avoid memory leaks we must assure that there are no
|
||||||
|
* references left after the object is no longer needed.
|
||||||
|
*/
|
||||||
|
removeAllListeners : function()
|
||||||
|
{
|
||||||
|
var nativeListeners = this.getCustomData( '_cke_nativeListeners' );
|
||||||
|
for ( var eventName in nativeListeners )
|
||||||
|
{
|
||||||
|
var listener = nativeListeners[ eventName ];
|
||||||
|
if ( this.$.detachEvent )
|
||||||
|
this.$.detachEvent( 'on' + eventName, listener );
|
||||||
|
else if ( this.$.removeEventListener )
|
||||||
|
this.$.removeEventListener( eventName, listener, false );
|
||||||
|
|
||||||
|
delete nativeListeners[ eventName ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
(function( domObjectProto )
|
||||||
|
{
|
||||||
|
var customData = {};
|
||||||
|
|
||||||
|
CKEDITOR.on( 'reset', function()
|
||||||
|
{
|
||||||
|
customData = {};
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether the specified object is equal to the current object.
|
||||||
|
* @name CKEDITOR.dom.domObject.prototype.equals
|
||||||
|
* @function
|
||||||
|
* @param {Object} object The object to compare with the current object.
|
||||||
|
* @returns {Boolean} "true" if the object is equal.
|
||||||
|
* @example
|
||||||
|
* var doc = new CKEDITOR.dom.document( document );
|
||||||
|
* alert( doc.equals( CKEDITOR.document ) ); // "true"
|
||||||
|
* alert( doc == CKEDITOR.document ); // "false"
|
||||||
|
*/
|
||||||
|
domObjectProto.equals = function( object )
|
||||||
|
{
|
||||||
|
return ( object && object.$ === this.$ );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a data slot value for this object. These values are shared by all
|
||||||
|
* instances pointing to that same DOM object.
|
||||||
|
* <strong>Note:</strong> The created data slot is only guarantied to be available on this unique dom node,
|
||||||
|
* thus any wish to continue access it from other element clones (either created by clone node or from innerHtml)
|
||||||
|
* will fail, for such usage, please use {@link CKEDITOR.dom.element::setAttribute} instead.
|
||||||
|
* @name CKEDITOR.dom.domObject.prototype.setCustomData
|
||||||
|
* @function
|
||||||
|
* @param {String} key A key used to identify the data slot.
|
||||||
|
* @param {Object} value The value to set to the data slot.
|
||||||
|
* @returns {CKEDITOR.dom.domObject} This DOM object instance.
|
||||||
|
* @see CKEDITOR.dom.domObject.prototype.getCustomData
|
||||||
|
* @example
|
||||||
|
* var element = new CKEDITOR.dom.element( 'span' );
|
||||||
|
* element.setCustomData( 'hasCustomData', true );
|
||||||
|
*/
|
||||||
|
domObjectProto.setCustomData = function( key, value )
|
||||||
|
{
|
||||||
|
var expandoNumber = this.getUniqueId(),
|
||||||
|
dataSlot = customData[ expandoNumber ] || ( customData[ expandoNumber ] = {} );
|
||||||
|
|
||||||
|
dataSlot[ key ] = value;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value set to a data slot in this object.
|
||||||
|
* @name CKEDITOR.dom.domObject.prototype.getCustomData
|
||||||
|
* @function
|
||||||
|
* @param {String} key The key used to identify the data slot.
|
||||||
|
* @returns {Object} This value set to the data slot.
|
||||||
|
* @see CKEDITOR.dom.domObject.prototype.setCustomData
|
||||||
|
* @example
|
||||||
|
* var element = new CKEDITOR.dom.element( 'span' );
|
||||||
|
* alert( element.getCustomData( 'hasCustomData' ) ); // e.g. 'true'
|
||||||
|
*/
|
||||||
|
domObjectProto.getCustomData = function( key )
|
||||||
|
{
|
||||||
|
var expandoNumber = this.$[ 'data-cke-expando' ],
|
||||||
|
dataSlot = expandoNumber && customData[ expandoNumber ];
|
||||||
|
|
||||||
|
return dataSlot && dataSlot[ key ];
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name CKEDITOR.dom.domObject.prototype.removeCustomData
|
||||||
|
*/
|
||||||
|
domObjectProto.removeCustomData = function( key )
|
||||||
|
{
|
||||||
|
var expandoNumber = this.$[ 'data-cke-expando' ],
|
||||||
|
dataSlot = expandoNumber && customData[ expandoNumber ],
|
||||||
|
retval = dataSlot && dataSlot[ key ];
|
||||||
|
|
||||||
|
if ( typeof retval != 'undefined' )
|
||||||
|
delete dataSlot[ key ];
|
||||||
|
|
||||||
|
return retval || null;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes any data stored on this object.
|
||||||
|
* To avoid memory leaks we must assure that there are no
|
||||||
|
* references left after the object is no longer needed.
|
||||||
|
* @name CKEDITOR.dom.domObject.prototype.clearCustomData
|
||||||
|
* @function
|
||||||
|
*/
|
||||||
|
domObjectProto.clearCustomData = function()
|
||||||
|
{
|
||||||
|
// Clear all event listeners
|
||||||
|
this.removeAllListeners();
|
||||||
|
|
||||||
|
var expandoNumber = this.$[ 'data-cke-expando' ];
|
||||||
|
expandoNumber && delete customData[ expandoNumber ];
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an ID that can be used to identiquely identify this DOM object in
|
||||||
|
* the running session.
|
||||||
|
* @name CKEDITOR.dom.domObject.prototype.getUniqueId
|
||||||
|
* @function
|
||||||
|
* @returns {Number} A unique ID.
|
||||||
|
*/
|
||||||
|
domObjectProto.getUniqueId = function()
|
||||||
|
{
|
||||||
|
return this.$[ 'data-cke-expando' ] || ( this.$[ 'data-cke-expando' ] = CKEDITOR.tools.getNextNumber() );
|
||||||
|
};
|
||||||
|
|
||||||
|
// Implement CKEDITOR.event.
|
||||||
|
CKEDITOR.event.implementOn( domObjectProto );
|
||||||
|
|
||||||
|
})( CKEDITOR.dom.domObject.prototype );
|
||||||
1806
htdocs/includes/ckeditor/_source/core/dom/element.js
Normal file
1806
htdocs/includes/ckeditor/_source/core/dom/element.js
Normal file
File diff suppressed because it is too large
Load Diff
117
htdocs/includes/ckeditor/_source/core/dom/elementpath.js
Normal file
117
htdocs/includes/ckeditor/_source/core/dom/elementpath.js
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function()
|
||||||
|
{
|
||||||
|
// Elements that may be considered the "Block boundary" in an element path.
|
||||||
|
var pathBlockElements = { address:1,blockquote:1,dl:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1,li:1,dt:1,dd:1, legend:1,caption:1 };
|
||||||
|
|
||||||
|
// Elements that may be considered the "Block limit" in an element path.
|
||||||
|
var pathBlockLimitElements = { body:1,div:1,table:1,tbody:1,tr:1,td:1,th:1,form:1,fieldset:1 };
|
||||||
|
|
||||||
|
// Check if an element contains any block element.
|
||||||
|
var checkHasBlock = function( element )
|
||||||
|
{
|
||||||
|
var childNodes = element.getChildren();
|
||||||
|
|
||||||
|
for ( var i = 0, count = childNodes.count() ; i < count ; i++ )
|
||||||
|
{
|
||||||
|
var child = childNodes.getItem( i );
|
||||||
|
|
||||||
|
if ( child.type == CKEDITOR.NODE_ELEMENT && CKEDITOR.dtd.$block[ child.getName() ] )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
CKEDITOR.dom.elementPath = function( lastNode )
|
||||||
|
{
|
||||||
|
var block = null;
|
||||||
|
var blockLimit = null;
|
||||||
|
var elements = [];
|
||||||
|
|
||||||
|
var e = lastNode;
|
||||||
|
|
||||||
|
while ( e )
|
||||||
|
{
|
||||||
|
if ( e.type == CKEDITOR.NODE_ELEMENT )
|
||||||
|
{
|
||||||
|
if ( !this.lastElement )
|
||||||
|
this.lastElement = e;
|
||||||
|
|
||||||
|
var elementName = e.getName();
|
||||||
|
|
||||||
|
if ( !blockLimit )
|
||||||
|
{
|
||||||
|
if ( !block && pathBlockElements[ elementName ] )
|
||||||
|
block = e;
|
||||||
|
|
||||||
|
if ( pathBlockLimitElements[ elementName ] )
|
||||||
|
{
|
||||||
|
// DIV is considered the Block, if no block is available (#525)
|
||||||
|
// and if it doesn't contain other blocks.
|
||||||
|
if ( !block && elementName == 'div' && !checkHasBlock( e ) )
|
||||||
|
block = e;
|
||||||
|
else
|
||||||
|
blockLimit = e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
elements.push( e );
|
||||||
|
|
||||||
|
if ( elementName == 'body' )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
e = e.getParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.block = block;
|
||||||
|
this.blockLimit = blockLimit;
|
||||||
|
this.elements = elements;
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
CKEDITOR.dom.elementPath.prototype =
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Compares this element path with another one.
|
||||||
|
* @param {CKEDITOR.dom.elementPath} otherPath The elementPath object to be
|
||||||
|
* compared with this one.
|
||||||
|
* @returns {Boolean} "true" if the paths are equal, containing the same
|
||||||
|
* number of elements and the same elements in the same order.
|
||||||
|
*/
|
||||||
|
compare : function( otherPath )
|
||||||
|
{
|
||||||
|
var thisElements = this.elements;
|
||||||
|
var otherElements = otherPath && otherPath.elements;
|
||||||
|
|
||||||
|
if ( !otherElements || thisElements.length != otherElements.length )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for ( var i = 0 ; i < thisElements.length ; i++ )
|
||||||
|
{
|
||||||
|
if ( !thisElements[ i ].equals( otherElements[ i ] ) )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
|
contains : function( tagNames )
|
||||||
|
{
|
||||||
|
var elements = this.elements;
|
||||||
|
for ( var i = 0 ; i < elements.length ; i++ )
|
||||||
|
{
|
||||||
|
if ( elements[ i ].getName() in tagNames )
|
||||||
|
return elements[ i ];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
145
htdocs/includes/ckeditor/_source/core/dom/event.js
Normal file
145
htdocs/includes/ckeditor/_source/core/dom/event.js
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileOverview Defines the {@link CKEDITOR.dom.event} class, which
|
||||||
|
* represents the a native DOM event object.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a native DOM event object.
|
||||||
|
* @constructor
|
||||||
|
* @param {Object} domEvent A native DOM event object.
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.dom.event = function( domEvent )
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The native DOM event object represented by this class instance.
|
||||||
|
* @type Object
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
this.$ = domEvent;
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.dom.event.prototype =
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Gets the key code associated to the event.
|
||||||
|
* @returns {Number} The key code.
|
||||||
|
* @example
|
||||||
|
* alert( event.getKey() ); "65" is "a" has been pressed
|
||||||
|
*/
|
||||||
|
getKey : function()
|
||||||
|
{
|
||||||
|
return this.$.keyCode || this.$.which;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a number represeting the combination of the keys pressed during the
|
||||||
|
* event. It is the sum with the current key code and the {@link CKEDITOR.CTRL},
|
||||||
|
* {@link CKEDITOR.SHIFT} and {@link CKEDITOR.ALT} constants.
|
||||||
|
* @returns {Number} The number representing the keys combination.
|
||||||
|
* @example
|
||||||
|
* alert( event.getKeystroke() == 65 ); // "a" key
|
||||||
|
* alert( event.getKeystroke() == CKEDITOR.CTRL + 65 ); // CTRL + "a" key
|
||||||
|
* alert( event.getKeystroke() == CKEDITOR.CTRL + CKEDITOR.SHIFT + 65 ); // CTRL + SHIFT + "a" key
|
||||||
|
*/
|
||||||
|
getKeystroke : function()
|
||||||
|
{
|
||||||
|
var keystroke = this.getKey();
|
||||||
|
|
||||||
|
if ( this.$.ctrlKey || this.$.metaKey )
|
||||||
|
keystroke += CKEDITOR.CTRL;
|
||||||
|
|
||||||
|
if ( this.$.shiftKey )
|
||||||
|
keystroke += CKEDITOR.SHIFT;
|
||||||
|
|
||||||
|
if ( this.$.altKey )
|
||||||
|
keystroke += CKEDITOR.ALT;
|
||||||
|
|
||||||
|
return keystroke;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevents the original behavior of the event to happen. It can optionally
|
||||||
|
* stop propagating the event in the event chain.
|
||||||
|
* @param {Boolean} [stopPropagation] Stop propagating this event in the
|
||||||
|
* event chain.
|
||||||
|
* @example
|
||||||
|
* var element = CKEDITOR.document.getById( 'myElement' );
|
||||||
|
* element.on( 'click', function( ev )
|
||||||
|
* {
|
||||||
|
* // The DOM event object is passed by the "data" property.
|
||||||
|
* var domEvent = ev.data;
|
||||||
|
* // Prevent the click to chave any effect in the element.
|
||||||
|
* domEvent.preventDefault();
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
preventDefault : function( stopPropagation )
|
||||||
|
{
|
||||||
|
var $ = this.$;
|
||||||
|
if ( $.preventDefault )
|
||||||
|
$.preventDefault();
|
||||||
|
else
|
||||||
|
$.returnValue = false;
|
||||||
|
|
||||||
|
if ( stopPropagation )
|
||||||
|
this.stopPropagation();
|
||||||
|
},
|
||||||
|
|
||||||
|
stopPropagation : function()
|
||||||
|
{
|
||||||
|
var $ = this.$;
|
||||||
|
if ( $.stopPropagation )
|
||||||
|
$.stopPropagation();
|
||||||
|
else
|
||||||
|
$.cancelBubble = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the DOM node where the event was targeted to.
|
||||||
|
* @returns {CKEDITOR.dom.node} The target DOM node.
|
||||||
|
* @example
|
||||||
|
* var element = CKEDITOR.document.getById( 'myElement' );
|
||||||
|
* element.on( 'click', function( ev )
|
||||||
|
* {
|
||||||
|
* // The DOM event object is passed by the "data" property.
|
||||||
|
* var domEvent = ev.data;
|
||||||
|
* // Add a CSS class to the event target.
|
||||||
|
* domEvent.getTarget().addClass( 'clicked' );
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
|
||||||
|
getTarget : function()
|
||||||
|
{
|
||||||
|
var rawNode = this.$.target || this.$.srcElement;
|
||||||
|
return rawNode ? new CKEDITOR.dom.node( rawNode ) : null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// For the followind constants, we need to go over the Unicode boundaries
|
||||||
|
// (0x10FFFF) to avoid collision.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CTRL key (0x110000).
|
||||||
|
* @constant
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.CTRL = 0x110000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SHIFT key (0x220000).
|
||||||
|
* @constant
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.SHIFT = 0x220000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ALT key (0x440000).
|
||||||
|
* @constant
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.ALT = 0x440000;
|
||||||
691
htdocs/includes/ckeditor/_source/core/dom/node.js
Normal file
691
htdocs/includes/ckeditor/_source/core/dom/node.js
Normal file
@ -0,0 +1,691 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileOverview Defines the {@link CKEDITOR.dom.node} class which is the base
|
||||||
|
* class for classes that represent DOM nodes.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class for classes representing DOM nodes. This constructor may return
|
||||||
|
* an instance of a class that inherits from this class, like
|
||||||
|
* {@link CKEDITOR.dom.element} or {@link CKEDITOR.dom.text}.
|
||||||
|
* @augments CKEDITOR.dom.domObject
|
||||||
|
* @param {Object} domNode A native DOM node.
|
||||||
|
* @constructor
|
||||||
|
* @see CKEDITOR.dom.element
|
||||||
|
* @see CKEDITOR.dom.text
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.dom.node = function( domNode )
|
||||||
|
{
|
||||||
|
if ( domNode )
|
||||||
|
{
|
||||||
|
var type = domNode.nodeType == CKEDITOR.NODE_DOCUMENT ? 'document'
|
||||||
|
: domNode.nodeType == CKEDITOR.NODE_ELEMENT ? 'element'
|
||||||
|
: domNode.nodeType == CKEDITOR.NODE_TEXT ? 'text'
|
||||||
|
: domNode.nodeType == CKEDITOR.NODE_COMMENT ? 'comment'
|
||||||
|
: 'domObject'; // Call the base constructor otherwise.
|
||||||
|
|
||||||
|
return new CKEDITOR.dom[ type ]( domNode );
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.dom.node.prototype = new CKEDITOR.dom.domObject();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Element node type.
|
||||||
|
* @constant
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.NODE_ELEMENT = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Document node type.
|
||||||
|
* @constant
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.NODE_DOCUMENT = 9;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Text node type.
|
||||||
|
* @constant
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.NODE_TEXT = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comment node type.
|
||||||
|
* @constant
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.NODE_COMMENT = 8;
|
||||||
|
|
||||||
|
CKEDITOR.NODE_DOCUMENT_FRAGMENT = 11;
|
||||||
|
|
||||||
|
CKEDITOR.POSITION_IDENTICAL = 0;
|
||||||
|
CKEDITOR.POSITION_DISCONNECTED = 1;
|
||||||
|
CKEDITOR.POSITION_FOLLOWING = 2;
|
||||||
|
CKEDITOR.POSITION_PRECEDING = 4;
|
||||||
|
CKEDITOR.POSITION_IS_CONTAINED = 8;
|
||||||
|
CKEDITOR.POSITION_CONTAINS = 16;
|
||||||
|
|
||||||
|
CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype,
|
||||||
|
/** @lends CKEDITOR.dom.node.prototype */
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Makes this node a child of another element.
|
||||||
|
* @param {CKEDITOR.dom.element} element The target element to which
|
||||||
|
* this node will be appended.
|
||||||
|
* @returns {CKEDITOR.dom.element} The target element.
|
||||||
|
* @example
|
||||||
|
* var p = new CKEDITOR.dom.element( 'p' );
|
||||||
|
* var strong = new CKEDITOR.dom.element( 'strong' );
|
||||||
|
* strong.appendTo( p );
|
||||||
|
*
|
||||||
|
* // result: "<p><strong></strong></p>"
|
||||||
|
*/
|
||||||
|
appendTo : function( element, toStart )
|
||||||
|
{
|
||||||
|
element.append( this, toStart );
|
||||||
|
return element;
|
||||||
|
},
|
||||||
|
|
||||||
|
clone : function( includeChildren, cloneId )
|
||||||
|
{
|
||||||
|
var $clone = this.$.cloneNode( includeChildren );
|
||||||
|
|
||||||
|
var removeIds = function( node )
|
||||||
|
{
|
||||||
|
if ( node.nodeType != CKEDITOR.NODE_ELEMENT )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( !cloneId )
|
||||||
|
node.removeAttribute( 'id', false );
|
||||||
|
node.removeAttribute( 'data-cke-expando', false );
|
||||||
|
|
||||||
|
if ( includeChildren )
|
||||||
|
{
|
||||||
|
var childs = node.childNodes;
|
||||||
|
for ( var i=0; i < childs.length; i++ )
|
||||||
|
removeIds( childs[ i ] );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// The "id" attribute should never be cloned to avoid duplication.
|
||||||
|
removeIds( $clone );
|
||||||
|
|
||||||
|
return new CKEDITOR.dom.node( $clone );
|
||||||
|
},
|
||||||
|
|
||||||
|
hasPrevious : function()
|
||||||
|
{
|
||||||
|
return !!this.$.previousSibling;
|
||||||
|
},
|
||||||
|
|
||||||
|
hasNext : function()
|
||||||
|
{
|
||||||
|
return !!this.$.nextSibling;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inserts this element after a node.
|
||||||
|
* @param {CKEDITOR.dom.node} node The node that will precede this element.
|
||||||
|
* @returns {CKEDITOR.dom.node} The node preceding this one after
|
||||||
|
* insertion.
|
||||||
|
* @example
|
||||||
|
* var em = new CKEDITOR.dom.element( 'em' );
|
||||||
|
* var strong = new CKEDITOR.dom.element( 'strong' );
|
||||||
|
* strong.insertAfter( em );
|
||||||
|
*
|
||||||
|
* // result: "<em></em><strong></strong>"
|
||||||
|
*/
|
||||||
|
insertAfter : function( node )
|
||||||
|
{
|
||||||
|
node.$.parentNode.insertBefore( this.$, node.$.nextSibling );
|
||||||
|
return node;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inserts this element before a node.
|
||||||
|
* @param {CKEDITOR.dom.node} node The node that will succeed this element.
|
||||||
|
* @returns {CKEDITOR.dom.node} The node being inserted.
|
||||||
|
* @example
|
||||||
|
* var em = new CKEDITOR.dom.element( 'em' );
|
||||||
|
* var strong = new CKEDITOR.dom.element( 'strong' );
|
||||||
|
* strong.insertBefore( em );
|
||||||
|
*
|
||||||
|
* // result: "<strong></strong><em></em>"
|
||||||
|
*/
|
||||||
|
insertBefore : function( node )
|
||||||
|
{
|
||||||
|
node.$.parentNode.insertBefore( this.$, node.$ );
|
||||||
|
return node;
|
||||||
|
},
|
||||||
|
|
||||||
|
insertBeforeMe : function( node )
|
||||||
|
{
|
||||||
|
this.$.parentNode.insertBefore( node.$, this.$ );
|
||||||
|
return node;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a uniquely identifiable tree address for this node.
|
||||||
|
* The tree address returned is an array of integers, with each integer
|
||||||
|
* indicating a child index of a DOM node, starting from
|
||||||
|
* <code>document.documentElement</code>.
|
||||||
|
*
|
||||||
|
* For example, assuming <code><body></code> is the second child
|
||||||
|
* of <code><html></code> (<code><head></code> being the first),
|
||||||
|
* and we would like to address the third child under the
|
||||||
|
* fourth child of <code><body></code>, the tree address returned would be:
|
||||||
|
* [1, 3, 2]
|
||||||
|
*
|
||||||
|
* The tree address cannot be used for finding back the DOM tree node once
|
||||||
|
* the DOM tree structure has been modified.
|
||||||
|
*/
|
||||||
|
getAddress : function( normalized )
|
||||||
|
{
|
||||||
|
var address = [];
|
||||||
|
var $documentElement = this.getDocument().$.documentElement;
|
||||||
|
var node = this.$;
|
||||||
|
|
||||||
|
while ( node && node != $documentElement )
|
||||||
|
{
|
||||||
|
var parentNode = node.parentNode;
|
||||||
|
|
||||||
|
if ( parentNode )
|
||||||
|
{
|
||||||
|
// Get the node index. For performance, call getIndex
|
||||||
|
// directly, instead of creating a new node object.
|
||||||
|
address.unshift( this.getIndex.call( { $ : node }, normalized ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
node = parentNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return address;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the document containing this element.
|
||||||
|
* @returns {CKEDITOR.dom.document} The document.
|
||||||
|
* @example
|
||||||
|
* var element = CKEDITOR.document.getById( 'example' );
|
||||||
|
* alert( <strong>element.getDocument().equals( CKEDITOR.document )</strong> ); // "true"
|
||||||
|
*/
|
||||||
|
getDocument : function()
|
||||||
|
{
|
||||||
|
return new CKEDITOR.dom.document( this.$.ownerDocument || this.$.parentNode.ownerDocument );
|
||||||
|
},
|
||||||
|
|
||||||
|
getIndex : function( normalized )
|
||||||
|
{
|
||||||
|
// Attention: getAddress depends on this.$
|
||||||
|
|
||||||
|
var current = this.$,
|
||||||
|
index = 0;
|
||||||
|
|
||||||
|
while ( ( current = current.previousSibling ) )
|
||||||
|
{
|
||||||
|
// When normalizing, do not count it if this is an
|
||||||
|
// empty text node or if it's a text node following another one.
|
||||||
|
if ( normalized && current.nodeType == 3 &&
|
||||||
|
( !current.nodeValue.length ||
|
||||||
|
( current.previousSibling && current.previousSibling.nodeType == 3 ) ) )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return index;
|
||||||
|
},
|
||||||
|
|
||||||
|
getNextSourceNode : function( startFromSibling, nodeType, guard )
|
||||||
|
{
|
||||||
|
// If "guard" is a node, transform it in a function.
|
||||||
|
if ( guard && !guard.call )
|
||||||
|
{
|
||||||
|
var guardNode = guard;
|
||||||
|
guard = function( node )
|
||||||
|
{
|
||||||
|
return !node.equals( guardNode );
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var node = ( !startFromSibling && this.getFirst && this.getFirst() ),
|
||||||
|
parent;
|
||||||
|
|
||||||
|
// Guarding when we're skipping the current element( no children or 'startFromSibling' ).
|
||||||
|
// send the 'moving out' signal even we don't actually dive into.
|
||||||
|
if ( !node )
|
||||||
|
{
|
||||||
|
if ( this.type == CKEDITOR.NODE_ELEMENT && guard && guard( this, true ) === false )
|
||||||
|
return null;
|
||||||
|
node = this.getNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
while ( !node && ( parent = ( parent || this ).getParent() ) )
|
||||||
|
{
|
||||||
|
// The guard check sends the "true" paramenter to indicate that
|
||||||
|
// we are moving "out" of the element.
|
||||||
|
if ( guard && guard( parent, true ) === false )
|
||||||
|
return null;
|
||||||
|
|
||||||
|
node = parent.getNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !node )
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if ( guard && guard( node ) === false )
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if ( nodeType && nodeType != node.type )
|
||||||
|
return node.getNextSourceNode( false, nodeType, guard );
|
||||||
|
|
||||||
|
return node;
|
||||||
|
},
|
||||||
|
|
||||||
|
getPreviousSourceNode : function( startFromSibling, nodeType, guard )
|
||||||
|
{
|
||||||
|
if ( guard && !guard.call )
|
||||||
|
{
|
||||||
|
var guardNode = guard;
|
||||||
|
guard = function( node )
|
||||||
|
{
|
||||||
|
return !node.equals( guardNode );
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var node = ( !startFromSibling && this.getLast && this.getLast() ),
|
||||||
|
parent;
|
||||||
|
|
||||||
|
// Guarding when we're skipping the current element( no children or 'startFromSibling' ).
|
||||||
|
// send the 'moving out' signal even we don't actually dive into.
|
||||||
|
if ( !node )
|
||||||
|
{
|
||||||
|
if ( this.type == CKEDITOR.NODE_ELEMENT && guard && guard( this, true ) === false )
|
||||||
|
return null;
|
||||||
|
node = this.getPrevious();
|
||||||
|
}
|
||||||
|
|
||||||
|
while ( !node && ( parent = ( parent || this ).getParent() ) )
|
||||||
|
{
|
||||||
|
// The guard check sends the "true" paramenter to indicate that
|
||||||
|
// we are moving "out" of the element.
|
||||||
|
if ( guard && guard( parent, true ) === false )
|
||||||
|
return null;
|
||||||
|
|
||||||
|
node = parent.getPrevious();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !node )
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if ( guard && guard( node ) === false )
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if ( nodeType && node.type != nodeType )
|
||||||
|
return node.getPreviousSourceNode( false, nodeType, guard );
|
||||||
|
|
||||||
|
return node;
|
||||||
|
},
|
||||||
|
|
||||||
|
getPrevious : function( evaluator )
|
||||||
|
{
|
||||||
|
var previous = this.$, retval;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
previous = previous.previousSibling;
|
||||||
|
|
||||||
|
// Avoid returning the doc type node.
|
||||||
|
// http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-412266927
|
||||||
|
retval = previous && previous.nodeType != 10 && new CKEDITOR.dom.node( previous );
|
||||||
|
}
|
||||||
|
while ( retval && evaluator && !evaluator( retval ) )
|
||||||
|
return retval;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the node that follows this element in its parent's child list.
|
||||||
|
* @param {Function} evaluator Filtering the result node.
|
||||||
|
* @returns {CKEDITOR.dom.node} The next node or null if not available.
|
||||||
|
* @example
|
||||||
|
* var element = CKEDITOR.dom.element.createFromHtml( '<div><b>Example</b> <i>next</i></div>' );
|
||||||
|
* var first = <strong>element.getFirst().getNext()</strong>;
|
||||||
|
* alert( first.getName() ); // "i"
|
||||||
|
*/
|
||||||
|
getNext : function( evaluator )
|
||||||
|
{
|
||||||
|
var next = this.$, retval;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
next = next.nextSibling;
|
||||||
|
retval = next && new CKEDITOR.dom.node( next );
|
||||||
|
}
|
||||||
|
while ( retval && evaluator && !evaluator( retval ) )
|
||||||
|
return retval;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the parent element for this node.
|
||||||
|
* @returns {CKEDITOR.dom.element} The parent element.
|
||||||
|
* @example
|
||||||
|
* var node = editor.document.getBody().getFirst();
|
||||||
|
* var parent = node.<strong>getParent()</strong>;
|
||||||
|
* alert( node.getName() ); // "body"
|
||||||
|
*/
|
||||||
|
getParent : function()
|
||||||
|
{
|
||||||
|
var parent = this.$.parentNode;
|
||||||
|
return ( parent && parent.nodeType == 1 ) ? new CKEDITOR.dom.node( parent ) : null;
|
||||||
|
},
|
||||||
|
|
||||||
|
getParents : function( closerFirst )
|
||||||
|
{
|
||||||
|
var node = this;
|
||||||
|
var parents = [];
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
parents[ closerFirst ? 'push' : 'unshift' ]( node );
|
||||||
|
}
|
||||||
|
while ( ( node = node.getParent() ) )
|
||||||
|
|
||||||
|
return parents;
|
||||||
|
},
|
||||||
|
|
||||||
|
getCommonAncestor : function( node )
|
||||||
|
{
|
||||||
|
if ( node.equals( this ) )
|
||||||
|
return this;
|
||||||
|
|
||||||
|
if ( node.contains && node.contains( this ) )
|
||||||
|
return node;
|
||||||
|
|
||||||
|
var start = this.contains ? this : this.getParent();
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if ( start.contains( node ) )
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
while ( ( start = start.getParent() ) );
|
||||||
|
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
|
getPosition : function( otherNode )
|
||||||
|
{
|
||||||
|
var $ = this.$;
|
||||||
|
var $other = otherNode.$;
|
||||||
|
|
||||||
|
if ( $.compareDocumentPosition )
|
||||||
|
return $.compareDocumentPosition( $other );
|
||||||
|
|
||||||
|
// IE and Safari have no support for compareDocumentPosition.
|
||||||
|
|
||||||
|
if ( $ == $other )
|
||||||
|
return CKEDITOR.POSITION_IDENTICAL;
|
||||||
|
|
||||||
|
// Only element nodes support contains and sourceIndex.
|
||||||
|
if ( this.type == CKEDITOR.NODE_ELEMENT && otherNode.type == CKEDITOR.NODE_ELEMENT )
|
||||||
|
{
|
||||||
|
if ( $.contains )
|
||||||
|
{
|
||||||
|
if ( $.contains( $other ) )
|
||||||
|
return CKEDITOR.POSITION_CONTAINS + CKEDITOR.POSITION_PRECEDING;
|
||||||
|
|
||||||
|
if ( $other.contains( $ ) )
|
||||||
|
return CKEDITOR.POSITION_IS_CONTAINED + CKEDITOR.POSITION_FOLLOWING;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 'sourceIndex' in $ )
|
||||||
|
{
|
||||||
|
return ( $.sourceIndex < 0 || $other.sourceIndex < 0 ) ? CKEDITOR.POSITION_DISCONNECTED :
|
||||||
|
( $.sourceIndex < $other.sourceIndex ) ? CKEDITOR.POSITION_PRECEDING :
|
||||||
|
CKEDITOR.POSITION_FOLLOWING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// For nodes that don't support compareDocumentPosition, contains
|
||||||
|
// or sourceIndex, their "address" is compared.
|
||||||
|
|
||||||
|
var addressOfThis = this.getAddress(),
|
||||||
|
addressOfOther = otherNode.getAddress(),
|
||||||
|
minLevel = Math.min( addressOfThis.length, addressOfOther.length );
|
||||||
|
|
||||||
|
// Determinate preceed/follow relationship.
|
||||||
|
for ( var i = 0 ; i <= minLevel - 1 ; i++ )
|
||||||
|
{
|
||||||
|
if ( addressOfThis[ i ] != addressOfOther[ i ] )
|
||||||
|
{
|
||||||
|
if ( i < minLevel )
|
||||||
|
{
|
||||||
|
return addressOfThis[ i ] < addressOfOther[ i ] ?
|
||||||
|
CKEDITOR.POSITION_PRECEDING : CKEDITOR.POSITION_FOLLOWING;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determinate contains/contained relationship.
|
||||||
|
return ( addressOfThis.length < addressOfOther.length ) ?
|
||||||
|
CKEDITOR.POSITION_CONTAINS + CKEDITOR.POSITION_PRECEDING :
|
||||||
|
CKEDITOR.POSITION_IS_CONTAINED + CKEDITOR.POSITION_FOLLOWING;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the closest ancestor node of this node, specified by its name.
|
||||||
|
* @param {String} reference The name of the ancestor node to search or
|
||||||
|
* an object with the node names to search for.
|
||||||
|
* @param {Boolean} [includeSelf] Whether to include the current
|
||||||
|
* node in the search.
|
||||||
|
* @returns {CKEDITOR.dom.node} The located ancestor node or null if not found.
|
||||||
|
* @since 3.6.1
|
||||||
|
* @example
|
||||||
|
* // Suppose we have the following HTML structure:
|
||||||
|
* // <div id="outer"><div id="inner"><p><b>Some text</b></p></div></div>
|
||||||
|
* // If node == <b>
|
||||||
|
* ascendant = node.getAscendant( 'div' ); // ascendant == <div id="inner">
|
||||||
|
* ascendant = node.getAscendant( 'b' ); // ascendant == null
|
||||||
|
* ascendant = node.getAscendant( 'b', true ); // ascendant == <b>
|
||||||
|
* ascendant = node.getAscendant( { div: 1, p: 1} ); // Searches for the first 'div' or 'p': ascendant == <div id="inner">
|
||||||
|
*/
|
||||||
|
getAscendant : function( reference, includeSelf )
|
||||||
|
{
|
||||||
|
var $ = this.$,
|
||||||
|
name;
|
||||||
|
|
||||||
|
if ( !includeSelf )
|
||||||
|
$ = $.parentNode;
|
||||||
|
|
||||||
|
while ( $ )
|
||||||
|
{
|
||||||
|
if ( $.nodeName && ( name = $.nodeName.toLowerCase(), ( typeof reference == 'string' ? name == reference : name in reference ) ) )
|
||||||
|
return new CKEDITOR.dom.node( $ );
|
||||||
|
|
||||||
|
$ = $.parentNode;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
|
hasAscendant : function( name, includeSelf )
|
||||||
|
{
|
||||||
|
var $ = this.$;
|
||||||
|
|
||||||
|
if ( !includeSelf )
|
||||||
|
$ = $.parentNode;
|
||||||
|
|
||||||
|
while ( $ )
|
||||||
|
{
|
||||||
|
if ( $.nodeName && $.nodeName.toLowerCase() == name )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
$ = $.parentNode;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
move : function( target, toStart )
|
||||||
|
{
|
||||||
|
target.append( this.remove(), toStart );
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes this node from the document DOM.
|
||||||
|
* @param {Boolean} [preserveChildren] Indicates that the children
|
||||||
|
* elements must remain in the document, removing only the outer
|
||||||
|
* tags.
|
||||||
|
* @example
|
||||||
|
* var element = CKEDITOR.dom.element.getById( 'MyElement' );
|
||||||
|
* <strong>element.remove()</strong>;
|
||||||
|
*/
|
||||||
|
remove : function( preserveChildren )
|
||||||
|
{
|
||||||
|
var $ = this.$;
|
||||||
|
var parent = $.parentNode;
|
||||||
|
|
||||||
|
if ( parent )
|
||||||
|
{
|
||||||
|
if ( preserveChildren )
|
||||||
|
{
|
||||||
|
// Move all children before the node.
|
||||||
|
for ( var child ; ( child = $.firstChild ) ; )
|
||||||
|
{
|
||||||
|
parent.insertBefore( $.removeChild( child ), $ );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
parent.removeChild( $ );
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
replace : function( nodeToReplace )
|
||||||
|
{
|
||||||
|
this.insertBefore( nodeToReplace );
|
||||||
|
nodeToReplace.remove();
|
||||||
|
},
|
||||||
|
|
||||||
|
trim : function()
|
||||||
|
{
|
||||||
|
this.ltrim();
|
||||||
|
this.rtrim();
|
||||||
|
},
|
||||||
|
|
||||||
|
ltrim : function()
|
||||||
|
{
|
||||||
|
var child;
|
||||||
|
while ( this.getFirst && ( child = this.getFirst() ) )
|
||||||
|
{
|
||||||
|
if ( child.type == CKEDITOR.NODE_TEXT )
|
||||||
|
{
|
||||||
|
var trimmed = CKEDITOR.tools.ltrim( child.getText() ),
|
||||||
|
originalLength = child.getLength();
|
||||||
|
|
||||||
|
if ( !trimmed )
|
||||||
|
{
|
||||||
|
child.remove();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if ( trimmed.length < originalLength )
|
||||||
|
{
|
||||||
|
child.split( originalLength - trimmed.length );
|
||||||
|
|
||||||
|
// IE BUG: child.remove() may raise JavaScript errors here. (#81)
|
||||||
|
this.$.removeChild( this.$.firstChild );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
rtrim : function()
|
||||||
|
{
|
||||||
|
var child;
|
||||||
|
while ( this.getLast && ( child = this.getLast() ) )
|
||||||
|
{
|
||||||
|
if ( child.type == CKEDITOR.NODE_TEXT )
|
||||||
|
{
|
||||||
|
var trimmed = CKEDITOR.tools.rtrim( child.getText() ),
|
||||||
|
originalLength = child.getLength();
|
||||||
|
|
||||||
|
if ( !trimmed )
|
||||||
|
{
|
||||||
|
child.remove();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if ( trimmed.length < originalLength )
|
||||||
|
{
|
||||||
|
child.split( trimmed.length );
|
||||||
|
|
||||||
|
// IE BUG: child.getNext().remove() may raise JavaScript errors here.
|
||||||
|
// (#81)
|
||||||
|
this.$.lastChild.parentNode.removeChild( this.$.lastChild );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !CKEDITOR.env.ie && !CKEDITOR.env.opera )
|
||||||
|
{
|
||||||
|
child = this.$.lastChild;
|
||||||
|
|
||||||
|
if ( child && child.type == 1 && child.nodeName.toLowerCase() == 'br' )
|
||||||
|
{
|
||||||
|
// Use "eChildNode.parentNode" instead of "node" to avoid IE bug (#324).
|
||||||
|
child.parentNode.removeChild( child ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if this node is read-only (should not be changed).
|
||||||
|
* @returns {Boolean}
|
||||||
|
* @since 3.5
|
||||||
|
* @example
|
||||||
|
* // For the following HTML:
|
||||||
|
* // <div contenteditable="false">Some <b>text</b></div>
|
||||||
|
*
|
||||||
|
* // If "ele" is the above <div>
|
||||||
|
* ele.isReadOnly(); // true
|
||||||
|
*/
|
||||||
|
isReadOnly : function()
|
||||||
|
{
|
||||||
|
var element = this;
|
||||||
|
if ( this.type != CKEDITOR.NODE_ELEMENT )
|
||||||
|
element = this.getParent();
|
||||||
|
|
||||||
|
if ( element && typeof element.$.isContentEditable != 'undefined' )
|
||||||
|
return ! ( element.$.isContentEditable || element.data( 'cke-editable' ) );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Degrade for old browsers which don't support "isContentEditable", e.g. FF3
|
||||||
|
var current = element;
|
||||||
|
while( current )
|
||||||
|
{
|
||||||
|
if ( current.is( 'body' ) || !!current.data( 'cke-editable' ) )
|
||||||
|
break;
|
||||||
|
|
||||||
|
if ( current.getAttribute( 'contentEditable' ) == 'false' )
|
||||||
|
return true;
|
||||||
|
else if ( current.getAttribute( 'contentEditable' ) == 'true' )
|
||||||
|
break;
|
||||||
|
|
||||||
|
current = current.getParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
26
htdocs/includes/ckeditor/_source/core/dom/nodelist.js
Normal file
26
htdocs/includes/ckeditor/_source/core/dom/nodelist.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
CKEDITOR.dom.nodeList = function( nativeList )
|
||||||
|
{
|
||||||
|
this.$ = nativeList;
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.dom.nodeList.prototype =
|
||||||
|
{
|
||||||
|
count : function()
|
||||||
|
{
|
||||||
|
return this.$.length;
|
||||||
|
},
|
||||||
|
|
||||||
|
getItem : function( index )
|
||||||
|
{
|
||||||
|
var $node = this.$[ index ];
|
||||||
|
return $node ? new CKEDITOR.dom.node( $node ) : null;
|
||||||
|
}
|
||||||
|
};
|
||||||
2087
htdocs/includes/ckeditor/_source/core/dom/range.js
Normal file
2087
htdocs/includes/ckeditor/_source/core/dom/range.js
Normal file
File diff suppressed because it is too large
Load Diff
213
htdocs/includes/ckeditor/_source/core/dom/rangelist.js
Normal file
213
htdocs/includes/ckeditor/_source/core/dom/rangelist.js
Normal file
@ -0,0 +1,213 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function()
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Represents a list os CKEDITOR.dom.range objects, which can be easily
|
||||||
|
* iterated sequentially.
|
||||||
|
* @constructor
|
||||||
|
* @param {CKEDITOR.dom.range|Array} [ranges] The ranges contained on this list.
|
||||||
|
* Note that, if an array of ranges is specified, the range sequence
|
||||||
|
* should match its DOM order. This class will not help to sort them.
|
||||||
|
*/
|
||||||
|
CKEDITOR.dom.rangeList = function( ranges )
|
||||||
|
{
|
||||||
|
if ( ranges instanceof CKEDITOR.dom.rangeList )
|
||||||
|
return ranges;
|
||||||
|
|
||||||
|
if ( !ranges )
|
||||||
|
ranges = [];
|
||||||
|
else if ( ranges instanceof CKEDITOR.dom.range )
|
||||||
|
ranges = [ ranges ];
|
||||||
|
|
||||||
|
return CKEDITOR.tools.extend( ranges, mixins );
|
||||||
|
};
|
||||||
|
|
||||||
|
var mixins =
|
||||||
|
/** @lends CKEDITOR.dom.rangeList.prototype */
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Creates an instance of the rangeList iterator, it should be used
|
||||||
|
* only when the ranges processing could be DOM intrusive, which
|
||||||
|
* means it may pollute and break other ranges in this list.
|
||||||
|
* Otherwise, it's enough to just iterate over this array in a for loop.
|
||||||
|
* @returns {CKEDITOR.dom.rangeListIterator}
|
||||||
|
*/
|
||||||
|
createIterator : function()
|
||||||
|
{
|
||||||
|
var rangeList = this,
|
||||||
|
bookmark = CKEDITOR.dom.walker.bookmark(),
|
||||||
|
guard = function( node ) { return ! ( node.is && node.is( 'tr' ) ); },
|
||||||
|
bookmarks = [],
|
||||||
|
current;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @lends CKEDITOR.dom.rangeListIterator.prototype
|
||||||
|
*/
|
||||||
|
return {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the next range in the list.
|
||||||
|
* @param {Boolean} mergeConsequent Whether join two adjacent ranges into single, e.g. consequent table cells.
|
||||||
|
*/
|
||||||
|
getNextRange : function( mergeConsequent )
|
||||||
|
{
|
||||||
|
current = current == undefined ? 0 : current + 1;
|
||||||
|
|
||||||
|
var range = rangeList[ current ];
|
||||||
|
|
||||||
|
// Multiple ranges might be mangled by each other.
|
||||||
|
if ( range && rangeList.length > 1 )
|
||||||
|
{
|
||||||
|
// Bookmarking all other ranges on the first iteration,
|
||||||
|
// the range correctness after it doesn't matter since we'll
|
||||||
|
// restore them before the next iteration.
|
||||||
|
if ( !current )
|
||||||
|
{
|
||||||
|
// Make sure bookmark correctness by reverse processing.
|
||||||
|
for ( var i = rangeList.length - 1; i >= 0; i-- )
|
||||||
|
bookmarks.unshift( rangeList[ i ].createBookmark( true ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( mergeConsequent )
|
||||||
|
{
|
||||||
|
// Figure out how many ranges should be merged.
|
||||||
|
var mergeCount = 0;
|
||||||
|
while ( rangeList[ current + mergeCount + 1 ] )
|
||||||
|
{
|
||||||
|
var doc = range.document,
|
||||||
|
found = 0,
|
||||||
|
left = doc.getById( bookmarks[ mergeCount ].endNode ),
|
||||||
|
right = doc.getById( bookmarks[ mergeCount + 1 ].startNode ),
|
||||||
|
next;
|
||||||
|
|
||||||
|
// Check subsequent range.
|
||||||
|
while ( 1 )
|
||||||
|
{
|
||||||
|
next = left.getNextSourceNode( false );
|
||||||
|
if ( !right.equals( next ) )
|
||||||
|
{
|
||||||
|
// This could be yet another bookmark or
|
||||||
|
// walking across block boundaries.
|
||||||
|
if ( bookmark( next ) || ( next.type == CKEDITOR.NODE_ELEMENT && next.isBlockBoundary() ) )
|
||||||
|
{
|
||||||
|
left = next;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
found = 1;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !found )
|
||||||
|
break;
|
||||||
|
|
||||||
|
mergeCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
range.moveToBookmark( bookmarks.shift() );
|
||||||
|
|
||||||
|
// Merge ranges finally after moving to bookmarks.
|
||||||
|
while( mergeCount-- )
|
||||||
|
{
|
||||||
|
next = rangeList[ ++current ];
|
||||||
|
next.moveToBookmark( bookmarks.shift() );
|
||||||
|
range.setEnd( next.endContainer, next.endOffset );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
createBookmarks : function( serializable )
|
||||||
|
{
|
||||||
|
var retval = [], bookmark;
|
||||||
|
for ( var i = 0; i < this.length ; i++ )
|
||||||
|
{
|
||||||
|
retval.push( bookmark = this[ i ].createBookmark( serializable, true) );
|
||||||
|
|
||||||
|
// Updating the container & offset values for ranges
|
||||||
|
// that have been touched.
|
||||||
|
for ( var j = i + 1; j < this.length; j++ )
|
||||||
|
{
|
||||||
|
this[ j ] = updateDirtyRange( bookmark, this[ j ] );
|
||||||
|
this[ j ] = updateDirtyRange( bookmark, this[ j ], true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return retval;
|
||||||
|
},
|
||||||
|
|
||||||
|
createBookmarks2 : function( normalized )
|
||||||
|
{
|
||||||
|
var bookmarks = [];
|
||||||
|
|
||||||
|
for ( var i = 0 ; i < this.length ; i++ )
|
||||||
|
bookmarks.push( this[ i ].createBookmark2( normalized ) );
|
||||||
|
|
||||||
|
return bookmarks;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move each range in the list to the position specified by a list of bookmarks.
|
||||||
|
* @param {Array} bookmarks The list of bookmarks, each one matching a range in the list.
|
||||||
|
*/
|
||||||
|
moveToBookmarks : function( bookmarks )
|
||||||
|
{
|
||||||
|
for ( var i = 0 ; i < this.length ; i++ )
|
||||||
|
this[ i ].moveToBookmark( bookmarks[ i ] );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Update the specified range which has been mangled by previous insertion of
|
||||||
|
// range bookmark nodes.(#3256)
|
||||||
|
function updateDirtyRange( bookmark, dirtyRange, checkEnd )
|
||||||
|
{
|
||||||
|
var serializable = bookmark.serializable,
|
||||||
|
container = dirtyRange[ checkEnd ? 'endContainer' : 'startContainer' ],
|
||||||
|
offset = checkEnd ? 'endOffset' : 'startOffset';
|
||||||
|
|
||||||
|
var bookmarkStart = serializable ?
|
||||||
|
dirtyRange.document.getById( bookmark.startNode )
|
||||||
|
: bookmark.startNode;
|
||||||
|
|
||||||
|
var bookmarkEnd = serializable ?
|
||||||
|
dirtyRange.document.getById( bookmark.endNode )
|
||||||
|
: bookmark.endNode;
|
||||||
|
|
||||||
|
if ( container.equals( bookmarkStart.getPrevious() ) )
|
||||||
|
{
|
||||||
|
dirtyRange.startOffset = dirtyRange.startOffset
|
||||||
|
- container.getLength()
|
||||||
|
- bookmarkEnd.getPrevious().getLength();
|
||||||
|
container = bookmarkEnd.getNext();
|
||||||
|
}
|
||||||
|
else if ( container.equals( bookmarkEnd.getPrevious() ) )
|
||||||
|
{
|
||||||
|
dirtyRange.startOffset = dirtyRange.startOffset - container.getLength();
|
||||||
|
container = bookmarkEnd.getNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
container.equals( bookmarkStart.getParent() ) && dirtyRange[ offset ]++;
|
||||||
|
container.equals( bookmarkEnd.getParent() ) && dirtyRange[ offset ]++;
|
||||||
|
|
||||||
|
// Update and return this range.
|
||||||
|
dirtyRange[ checkEnd ? 'endContainer' : 'startContainer' ] = container;
|
||||||
|
return dirtyRange;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (Virtual Class) Do not call this constructor. This class is not really part
|
||||||
|
* of the API. It just describes the return type of {@link CKEDITOR.dom.rangeList#createIterator}.
|
||||||
|
* @name CKEDITOR.dom.rangeListIterator
|
||||||
|
* @constructor
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
128
htdocs/includes/ckeditor/_source/core/dom/text.js
Normal file
128
htdocs/includes/ckeditor/_source/core/dom/text.js
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileOverview Defines the {@link CKEDITOR.dom.text} class, which represents
|
||||||
|
* a DOM text node.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a DOM text node.
|
||||||
|
* @constructor
|
||||||
|
* @augments CKEDITOR.dom.node
|
||||||
|
* @param {Object|String} text A native DOM text node or a string containing
|
||||||
|
* the text to use to create a new text node.
|
||||||
|
* @param {CKEDITOR.dom.document} [ownerDocument] The document that will contain
|
||||||
|
* the node in case of new node creation. Defaults to the current document.
|
||||||
|
* @example
|
||||||
|
* var nativeNode = document.createTextNode( 'Example' );
|
||||||
|
* var text = CKEDITOR.dom.text( nativeNode );
|
||||||
|
* @example
|
||||||
|
* var text = CKEDITOR.dom.text( 'Example' );
|
||||||
|
*/
|
||||||
|
CKEDITOR.dom.text = function( text, ownerDocument )
|
||||||
|
{
|
||||||
|
if ( typeof text == 'string' )
|
||||||
|
text = ( ownerDocument ? ownerDocument.$ : document ).createTextNode( text );
|
||||||
|
|
||||||
|
// Theoretically, we should call the base constructor here
|
||||||
|
// (not CKEDITOR.dom.node though). But, IE doesn't support expando
|
||||||
|
// properties on text node, so the features provided by domObject will not
|
||||||
|
// work for text nodes (which is not a big issue for us).
|
||||||
|
//
|
||||||
|
// CKEDITOR.dom.domObject.call( this, element );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The native DOM text node represented by this class instance.
|
||||||
|
* @type Object
|
||||||
|
* @example
|
||||||
|
* var element = new CKEDITOR.dom.text( 'Example' );
|
||||||
|
* alert( element.$.nodeType ); // "3"
|
||||||
|
*/
|
||||||
|
this.$ = text;
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.dom.text.prototype = new CKEDITOR.dom.node();
|
||||||
|
|
||||||
|
CKEDITOR.tools.extend( CKEDITOR.dom.text.prototype,
|
||||||
|
/** @lends CKEDITOR.dom.text.prototype */
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The node type. This is a constant value set to
|
||||||
|
* {@link CKEDITOR.NODE_TEXT}.
|
||||||
|
* @type Number
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
type : CKEDITOR.NODE_TEXT,
|
||||||
|
|
||||||
|
getLength : function()
|
||||||
|
{
|
||||||
|
return this.$.nodeValue.length;
|
||||||
|
},
|
||||||
|
|
||||||
|
getText : function()
|
||||||
|
{
|
||||||
|
return this.$.nodeValue;
|
||||||
|
},
|
||||||
|
|
||||||
|
setText : function( text )
|
||||||
|
{
|
||||||
|
this.$.nodeValue = text;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Breaks this text node into two nodes at the specified offset,
|
||||||
|
* keeping both in the tree as siblings. This node then only contains
|
||||||
|
* all the content up to the offset point. A new text node, which is
|
||||||
|
* inserted as the next sibling of this node, contains all the content
|
||||||
|
* at and after the offset point. When the offset is equal to the
|
||||||
|
* length of this node, the new node has no data.
|
||||||
|
* @param {Number} The position at which to split, starting from zero.
|
||||||
|
* @returns {CKEDITOR.dom.text} The new text node.
|
||||||
|
*/
|
||||||
|
split : function( offset )
|
||||||
|
{
|
||||||
|
// If the offset is after the last char, IE creates the text node
|
||||||
|
// on split, but don't include it into the DOM. So, we have to do
|
||||||
|
// that manually here.
|
||||||
|
if ( CKEDITOR.env.ie && offset == this.getLength() )
|
||||||
|
{
|
||||||
|
var next = this.getDocument().createText( '' );
|
||||||
|
next.insertAfter( this );
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
|
||||||
|
var doc = this.getDocument();
|
||||||
|
var retval = new CKEDITOR.dom.text( this.$.splitText( offset ), doc );
|
||||||
|
|
||||||
|
// IE BUG: IE8 does not update the childNodes array in DOM after splitText(),
|
||||||
|
// we need to make some DOM changes to make it update. (#3436)
|
||||||
|
if ( CKEDITOR.env.ie8 )
|
||||||
|
{
|
||||||
|
var workaround = new CKEDITOR.dom.text( '', doc );
|
||||||
|
workaround.insertAfter( retval );
|
||||||
|
workaround.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts characters from indexA up to but not including indexB.
|
||||||
|
* @param {Number} indexA An integer between 0 and one less than the
|
||||||
|
* length of the text.
|
||||||
|
* @param {Number} [indexB] An integer between 0 and the length of the
|
||||||
|
* string. If omitted, extracts characters to the end of the text.
|
||||||
|
*/
|
||||||
|
substring : function( indexA, indexB )
|
||||||
|
{
|
||||||
|
// We need the following check due to a Firefox bug
|
||||||
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=458886
|
||||||
|
if ( typeof indexB != 'number' )
|
||||||
|
return this.$.nodeValue.substr( indexA );
|
||||||
|
else
|
||||||
|
return this.$.nodeValue.substring( indexA, indexB );
|
||||||
|
}
|
||||||
|
});
|
||||||
502
htdocs/includes/ckeditor/_source/core/dom/walker.js
Normal file
502
htdocs/includes/ckeditor/_source/core/dom/walker.js
Normal file
@ -0,0 +1,502 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function()
|
||||||
|
{
|
||||||
|
// This function is to be called under a "walker" instance scope.
|
||||||
|
function iterate( rtl, breakOnFalse )
|
||||||
|
{
|
||||||
|
var range = this.range;
|
||||||
|
|
||||||
|
// Return null if we have reached the end.
|
||||||
|
if ( this._.end )
|
||||||
|
return null;
|
||||||
|
|
||||||
|
// This is the first call. Initialize it.
|
||||||
|
if ( !this._.start )
|
||||||
|
{
|
||||||
|
this._.start = 1;
|
||||||
|
|
||||||
|
// A collapsed range must return null at first call.
|
||||||
|
if ( range.collapsed )
|
||||||
|
{
|
||||||
|
this.end();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move outside of text node edges.
|
||||||
|
range.optimize();
|
||||||
|
}
|
||||||
|
|
||||||
|
var node,
|
||||||
|
startCt = range.startContainer,
|
||||||
|
endCt = range.endContainer,
|
||||||
|
startOffset = range.startOffset,
|
||||||
|
endOffset = range.endOffset,
|
||||||
|
guard,
|
||||||
|
userGuard = this.guard,
|
||||||
|
type = this.type,
|
||||||
|
getSourceNodeFn = ( rtl ? 'getPreviousSourceNode' : 'getNextSourceNode' );
|
||||||
|
|
||||||
|
// Create the LTR guard function, if necessary.
|
||||||
|
if ( !rtl && !this._.guardLTR )
|
||||||
|
{
|
||||||
|
// The node that stops walker from moving up.
|
||||||
|
var limitLTR = endCt.type == CKEDITOR.NODE_ELEMENT ?
|
||||||
|
endCt :
|
||||||
|
endCt.getParent();
|
||||||
|
|
||||||
|
// The node that stops the walker from going to next.
|
||||||
|
var blockerLTR = endCt.type == CKEDITOR.NODE_ELEMENT ?
|
||||||
|
endCt.getChild( endOffset ) :
|
||||||
|
endCt.getNext();
|
||||||
|
|
||||||
|
this._.guardLTR = function( node, movingOut )
|
||||||
|
{
|
||||||
|
return ( ( !movingOut || !limitLTR.equals( node ) )
|
||||||
|
&& ( !blockerLTR || !node.equals( blockerLTR ) )
|
||||||
|
&& ( node.type != CKEDITOR.NODE_ELEMENT || !movingOut || node.getName() != 'body' ) );
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the RTL guard function, if necessary.
|
||||||
|
if ( rtl && !this._.guardRTL )
|
||||||
|
{
|
||||||
|
// The node that stops walker from moving up.
|
||||||
|
var limitRTL = startCt.type == CKEDITOR.NODE_ELEMENT ?
|
||||||
|
startCt :
|
||||||
|
startCt.getParent();
|
||||||
|
|
||||||
|
// The node that stops the walker from going to next.
|
||||||
|
var blockerRTL = startCt.type == CKEDITOR.NODE_ELEMENT ?
|
||||||
|
startOffset ?
|
||||||
|
startCt.getChild( startOffset - 1 ) : null :
|
||||||
|
startCt.getPrevious();
|
||||||
|
|
||||||
|
this._.guardRTL = function( node, movingOut )
|
||||||
|
{
|
||||||
|
return ( ( !movingOut || !limitRTL.equals( node ) )
|
||||||
|
&& ( !blockerRTL || !node.equals( blockerRTL ) )
|
||||||
|
&& ( node.type != CKEDITOR.NODE_ELEMENT || !movingOut || node.getName() != 'body' ) );
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define which guard function to use.
|
||||||
|
var stopGuard = rtl ? this._.guardRTL : this._.guardLTR;
|
||||||
|
|
||||||
|
// Make the user defined guard function participate in the process,
|
||||||
|
// otherwise simply use the boundary guard.
|
||||||
|
if ( userGuard )
|
||||||
|
{
|
||||||
|
guard = function( node, movingOut )
|
||||||
|
{
|
||||||
|
if ( stopGuard( node, movingOut ) === false )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return userGuard( node, movingOut );
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
guard = stopGuard;
|
||||||
|
|
||||||
|
if ( this.current )
|
||||||
|
node = this.current[ getSourceNodeFn ]( false, type, guard );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Get the first node to be returned.
|
||||||
|
if ( rtl )
|
||||||
|
{
|
||||||
|
node = endCt;
|
||||||
|
|
||||||
|
if ( node.type == CKEDITOR.NODE_ELEMENT )
|
||||||
|
{
|
||||||
|
if ( endOffset > 0 )
|
||||||
|
node = node.getChild( endOffset - 1 );
|
||||||
|
else
|
||||||
|
node = ( guard ( node, true ) === false ) ?
|
||||||
|
null : node.getPreviousSourceNode( true, type, guard );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
node = startCt;
|
||||||
|
|
||||||
|
if ( node.type == CKEDITOR.NODE_ELEMENT )
|
||||||
|
{
|
||||||
|
if ( ! ( node = node.getChild( startOffset ) ) )
|
||||||
|
node = ( guard ( startCt, true ) === false ) ?
|
||||||
|
null : startCt.getNextSourceNode( true, type, guard ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( node && guard( node ) === false )
|
||||||
|
node = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
while ( node && !this._.end )
|
||||||
|
{
|
||||||
|
this.current = node;
|
||||||
|
|
||||||
|
if ( !this.evaluator || this.evaluator( node ) !== false )
|
||||||
|
{
|
||||||
|
if ( !breakOnFalse )
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
else if ( breakOnFalse && this.evaluator )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
node = node[ getSourceNodeFn ]( false, type, guard );
|
||||||
|
}
|
||||||
|
|
||||||
|
this.end();
|
||||||
|
return this.current = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function iterateToLast( rtl )
|
||||||
|
{
|
||||||
|
var node, last = null;
|
||||||
|
|
||||||
|
while ( ( node = iterate.call( this, rtl ) ) )
|
||||||
|
last = node;
|
||||||
|
|
||||||
|
return last;
|
||||||
|
}
|
||||||
|
|
||||||
|
CKEDITOR.dom.walker = CKEDITOR.tools.createClass(
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Utility class to "walk" the DOM inside a range boundaries. If
|
||||||
|
* necessary, partially included nodes (text nodes) are broken to
|
||||||
|
* reflect the boundaries limits, so DOM and range changes may happen.
|
||||||
|
* Outside changes to the range may break the walker.
|
||||||
|
*
|
||||||
|
* The walker may return nodes that are not totaly included into the
|
||||||
|
* range boundaires. Let's take the following range representation,
|
||||||
|
* where the square brackets indicate the boundaries:
|
||||||
|
*
|
||||||
|
* [<p>Some <b>sample] text</b>
|
||||||
|
*
|
||||||
|
* While walking forward into the above range, the following nodes are
|
||||||
|
* returned: <p>, "Some ", <b> and "sample". Going
|
||||||
|
* backwards instead we have: "sample" and "Some ". So note that the
|
||||||
|
* walker always returns nodes when "entering" them, but not when
|
||||||
|
* "leaving" them. The guard function is instead called both when
|
||||||
|
* entering and leaving nodes.
|
||||||
|
*
|
||||||
|
* @constructor
|
||||||
|
* @param {CKEDITOR.dom.range} range The range within which walk.
|
||||||
|
*/
|
||||||
|
$ : function( range )
|
||||||
|
{
|
||||||
|
this.range = range;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A function executed for every matched node, to check whether
|
||||||
|
* it's to be considered into the walk or not. If not provided, all
|
||||||
|
* matched nodes are considered good.
|
||||||
|
* If the function returns "false" the node is ignored.
|
||||||
|
* @name CKEDITOR.dom.walker.prototype.evaluator
|
||||||
|
* @property
|
||||||
|
* @type Function
|
||||||
|
*/
|
||||||
|
// this.evaluator = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A function executed for every node the walk pass by to check
|
||||||
|
* whether the walk is to be finished. It's called when both
|
||||||
|
* entering and exiting nodes, as well as for the matched nodes.
|
||||||
|
* If this function returns "false", the walking ends and no more
|
||||||
|
* nodes are evaluated.
|
||||||
|
* @name CKEDITOR.dom.walker.prototype.guard
|
||||||
|
* @property
|
||||||
|
* @type Function
|
||||||
|
*/
|
||||||
|
// this.guard = null;
|
||||||
|
|
||||||
|
/** @private */
|
||||||
|
this._ = {};
|
||||||
|
},
|
||||||
|
|
||||||
|
// statics :
|
||||||
|
// {
|
||||||
|
// /* Creates a CKEDITOR.dom.walker instance to walk inside DOM boundaries set by nodes.
|
||||||
|
// * @param {CKEDITOR.dom.node} startNode The node from wich the walk
|
||||||
|
// * will start.
|
||||||
|
// * @param {CKEDITOR.dom.node} [endNode] The last node to be considered
|
||||||
|
// * in the walk. No more nodes are retrieved after touching or
|
||||||
|
// * passing it. If not provided, the walker stops at the
|
||||||
|
// * <body> closing boundary.
|
||||||
|
// * @returns {CKEDITOR.dom.walker} A DOM walker for the nodes between the
|
||||||
|
// * provided nodes.
|
||||||
|
// */
|
||||||
|
// createOnNodes : function( startNode, endNode, startInclusive, endInclusive )
|
||||||
|
// {
|
||||||
|
// var range = new CKEDITOR.dom.range();
|
||||||
|
// if ( startNode )
|
||||||
|
// range.setStartAt( startNode, startInclusive ? CKEDITOR.POSITION_BEFORE_START : CKEDITOR.POSITION_AFTER_END ) ;
|
||||||
|
// else
|
||||||
|
// range.setStartAt( startNode.getDocument().getBody(), CKEDITOR.POSITION_AFTER_START ) ;
|
||||||
|
//
|
||||||
|
// if ( endNode )
|
||||||
|
// range.setEndAt( endNode, endInclusive ? CKEDITOR.POSITION_AFTER_END : CKEDITOR.POSITION_BEFORE_START ) ;
|
||||||
|
// else
|
||||||
|
// range.setEndAt( startNode.getDocument().getBody(), CKEDITOR.POSITION_BEFORE_END ) ;
|
||||||
|
//
|
||||||
|
// return new CKEDITOR.dom.walker( range );
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
//
|
||||||
|
proto :
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Stop walking. No more nodes are retrieved if this function gets
|
||||||
|
* called.
|
||||||
|
*/
|
||||||
|
end : function()
|
||||||
|
{
|
||||||
|
this._.end = 1;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the next node (at right).
|
||||||
|
* @returns {CKEDITOR.dom.node} The next node or null if no more
|
||||||
|
* nodes are available.
|
||||||
|
*/
|
||||||
|
next : function()
|
||||||
|
{
|
||||||
|
return iterate.call( this );
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the previous node (at left).
|
||||||
|
* @returns {CKEDITOR.dom.node} The previous node or null if no more
|
||||||
|
* nodes are available.
|
||||||
|
*/
|
||||||
|
previous : function()
|
||||||
|
{
|
||||||
|
return iterate.call( this, 1 );
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check all nodes at right, executing the evaluation fuction.
|
||||||
|
* @returns {Boolean} "false" if the evaluator function returned
|
||||||
|
* "false" for any of the matched nodes. Otherwise "true".
|
||||||
|
*/
|
||||||
|
checkForward : function()
|
||||||
|
{
|
||||||
|
return iterate.call( this, 0, 1 ) !== false;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check all nodes at left, executing the evaluation fuction.
|
||||||
|
* @returns {Boolean} "false" if the evaluator function returned
|
||||||
|
* "false" for any of the matched nodes. Otherwise "true".
|
||||||
|
*/
|
||||||
|
checkBackward : function()
|
||||||
|
{
|
||||||
|
return iterate.call( this, 1, 1 ) !== false;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Executes a full walk forward (to the right), until no more nodes
|
||||||
|
* are available, returning the last valid node.
|
||||||
|
* @returns {CKEDITOR.dom.node} The last node at the right or null
|
||||||
|
* if no valid nodes are available.
|
||||||
|
*/
|
||||||
|
lastForward : function()
|
||||||
|
{
|
||||||
|
return iterateToLast.call( this );
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Executes a full walk backwards (to the left), until no more nodes
|
||||||
|
* are available, returning the last valid node.
|
||||||
|
* @returns {CKEDITOR.dom.node} The last node at the left or null
|
||||||
|
* if no valid nodes are available.
|
||||||
|
*/
|
||||||
|
lastBackward : function()
|
||||||
|
{
|
||||||
|
return iterateToLast.call( this, 1 );
|
||||||
|
},
|
||||||
|
|
||||||
|
reset : function()
|
||||||
|
{
|
||||||
|
delete this.current;
|
||||||
|
this._ = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Anything whose display computed style is block, list-item, table,
|
||||||
|
* table-row-group, table-header-group, table-footer-group, table-row,
|
||||||
|
* table-column-group, table-column, table-cell, table-caption, or whose node
|
||||||
|
* name is hr, br (when enterMode is br only) is a block boundary.
|
||||||
|
*/
|
||||||
|
var blockBoundaryDisplayMatch =
|
||||||
|
{
|
||||||
|
block : 1,
|
||||||
|
'list-item' : 1,
|
||||||
|
table : 1,
|
||||||
|
'table-row-group' : 1,
|
||||||
|
'table-header-group' : 1,
|
||||||
|
'table-footer-group' : 1,
|
||||||
|
'table-row' : 1,
|
||||||
|
'table-column-group' : 1,
|
||||||
|
'table-column' : 1,
|
||||||
|
'table-cell' : 1,
|
||||||
|
'table-caption' : 1
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.dom.element.prototype.isBlockBoundary = function( customNodeNames )
|
||||||
|
{
|
||||||
|
var nodeNameMatches = customNodeNames ?
|
||||||
|
CKEDITOR.tools.extend( {}, CKEDITOR.dtd.$block, customNodeNames || {} ) :
|
||||||
|
CKEDITOR.dtd.$block;
|
||||||
|
|
||||||
|
// Don't consider floated formatting as block boundary, fall back to dtd check in that case. (#6297)
|
||||||
|
return this.getComputedStyle( 'float' ) == 'none' && blockBoundaryDisplayMatch[ this.getComputedStyle( 'display' ) ]
|
||||||
|
|| nodeNameMatches[ this.getName() ];
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.dom.walker.blockBoundary = function( customNodeNames )
|
||||||
|
{
|
||||||
|
return function( node , type )
|
||||||
|
{
|
||||||
|
return ! ( node.type == CKEDITOR.NODE_ELEMENT
|
||||||
|
&& node.isBlockBoundary( customNodeNames ) );
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.dom.walker.listItemBoundary = function()
|
||||||
|
{
|
||||||
|
return this.blockBoundary( { br : 1 } );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the to-be-evaluated node is a bookmark node OR bookmark node
|
||||||
|
* inner contents.
|
||||||
|
* @param {Boolean} contentOnly Whether only test againt the text content of
|
||||||
|
* bookmark node instead of the element itself(default).
|
||||||
|
* @param {Boolean} isReject Whether should return 'false' for the bookmark
|
||||||
|
* node instead of 'true'(default).
|
||||||
|
*/
|
||||||
|
CKEDITOR.dom.walker.bookmark = function( contentOnly, isReject )
|
||||||
|
{
|
||||||
|
function isBookmarkNode( node )
|
||||||
|
{
|
||||||
|
return ( node && node.getName
|
||||||
|
&& node.getName() == 'span'
|
||||||
|
&& node.data( 'cke-bookmark' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return function( node )
|
||||||
|
{
|
||||||
|
var isBookmark, parent;
|
||||||
|
// Is bookmark inner text node?
|
||||||
|
isBookmark = ( node && !node.getName && ( parent = node.getParent() )
|
||||||
|
&& isBookmarkNode( parent ) );
|
||||||
|
// Is bookmark node?
|
||||||
|
isBookmark = contentOnly ? isBookmark : isBookmark || isBookmarkNode( node );
|
||||||
|
return !! ( isReject ^ isBookmark );
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the node is a text node containing only whitespaces characters.
|
||||||
|
* @param isReject
|
||||||
|
*/
|
||||||
|
CKEDITOR.dom.walker.whitespaces = function( isReject )
|
||||||
|
{
|
||||||
|
return function( node )
|
||||||
|
{
|
||||||
|
var isWhitespace = node && ( node.type == CKEDITOR.NODE_TEXT )
|
||||||
|
&& !CKEDITOR.tools.trim( node.getText() );
|
||||||
|
return !! ( isReject ^ isWhitespace );
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the node is invisible in wysiwyg mode.
|
||||||
|
* @param isReject
|
||||||
|
*/
|
||||||
|
CKEDITOR.dom.walker.invisible = function( isReject )
|
||||||
|
{
|
||||||
|
var whitespace = CKEDITOR.dom.walker.whitespaces();
|
||||||
|
return function( node )
|
||||||
|
{
|
||||||
|
// Nodes that take no spaces in wysiwyg:
|
||||||
|
// 1. White-spaces but not including NBSP;
|
||||||
|
// 2. Empty inline elements, e.g. <b></b> we're checking here
|
||||||
|
// 'offsetHeight' instead of 'offsetWidth' for properly excluding
|
||||||
|
// all sorts of empty paragraph, e.g. <br />.
|
||||||
|
var isInvisible = whitespace( node ) || node.is && !node.$.offsetHeight;
|
||||||
|
return !! ( isReject ^ isInvisible );
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.dom.walker.nodeType = function( type, isReject )
|
||||||
|
{
|
||||||
|
return function( node )
|
||||||
|
{
|
||||||
|
return !! ( isReject ^ ( node.type == type ) );
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.dom.walker.bogus = function( isReject )
|
||||||
|
{
|
||||||
|
function nonEmpty( node )
|
||||||
|
{
|
||||||
|
return !isWhitespaces( node ) && !isBookmark( node );
|
||||||
|
}
|
||||||
|
|
||||||
|
return function( node )
|
||||||
|
{
|
||||||
|
var isBogus = !CKEDITOR.env.ie ? node.is && node.is( 'br' ) :
|
||||||
|
node.getText && tailNbspRegex.test( node.getText() );
|
||||||
|
|
||||||
|
if ( isBogus )
|
||||||
|
{
|
||||||
|
var parent = node.getParent(), next = node.getNext( nonEmpty );
|
||||||
|
isBogus = parent.isBlockBoundary() &&
|
||||||
|
( !next ||
|
||||||
|
next.type == CKEDITOR.NODE_ELEMENT &&
|
||||||
|
next.isBlockBoundary() );
|
||||||
|
}
|
||||||
|
|
||||||
|
return !! ( isReject ^ isBogus );
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var tailNbspRegex = /^[\t\r\n ]*(?: |\xa0)$/,
|
||||||
|
isWhitespaces = CKEDITOR.dom.walker.whitespaces(),
|
||||||
|
isBookmark = CKEDITOR.dom.walker.bookmark(),
|
||||||
|
toSkip = function( node )
|
||||||
|
{
|
||||||
|
return isBookmark( node )
|
||||||
|
|| isWhitespaces( node )
|
||||||
|
|| node.type == CKEDITOR.NODE_ELEMENT
|
||||||
|
&& node.getName() in CKEDITOR.dtd.$inline
|
||||||
|
&& !( node.getName() in CKEDITOR.dtd.$empty );
|
||||||
|
};
|
||||||
|
|
||||||
|
// Check if there's a filler node at the end of an element, and return it.
|
||||||
|
CKEDITOR.dom.element.prototype.getBogus = function()
|
||||||
|
{
|
||||||
|
// Bogus are not always at the end, e.g. <p><a>text<br /></a></p> (#7070).
|
||||||
|
var tail = this;
|
||||||
|
do { tail = tail.getPreviousSourceNode(); }
|
||||||
|
while ( toSkip( tail ) )
|
||||||
|
|
||||||
|
if ( tail && ( !CKEDITOR.env.ie ? tail.is && tail.is( 'br' )
|
||||||
|
: tail.getText && tailNbspRegex.test( tail.getText() ) ) )
|
||||||
|
{
|
||||||
|
return tail;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
96
htdocs/includes/ckeditor/_source/core/dom/window.js
Normal file
96
htdocs/includes/ckeditor/_source/core/dom/window.js
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileOverview Defines the {@link CKEDITOR.dom.document} class, which
|
||||||
|
* represents a DOM document.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a DOM window.
|
||||||
|
* @constructor
|
||||||
|
* @augments CKEDITOR.dom.domObject
|
||||||
|
* @param {Object} domWindow A native DOM window.
|
||||||
|
* @example
|
||||||
|
* var document = new CKEDITOR.dom.window( window );
|
||||||
|
*/
|
||||||
|
CKEDITOR.dom.window = function( domWindow )
|
||||||
|
{
|
||||||
|
CKEDITOR.dom.domObject.call( this, domWindow );
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.dom.window.prototype = new CKEDITOR.dom.domObject();
|
||||||
|
|
||||||
|
CKEDITOR.tools.extend( CKEDITOR.dom.window.prototype,
|
||||||
|
/** @lends CKEDITOR.dom.window.prototype */
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Moves the selection focus to this window.
|
||||||
|
* @function
|
||||||
|
* @example
|
||||||
|
* var win = new CKEDITOR.dom.window( window );
|
||||||
|
* <b>win.focus()</b>;
|
||||||
|
*/
|
||||||
|
focus : function()
|
||||||
|
{
|
||||||
|
// Webkit is sometimes failed to focus iframe, blur it first(#3835).
|
||||||
|
if ( CKEDITOR.env.webkit && this.$.parent )
|
||||||
|
this.$.parent.focus();
|
||||||
|
this.$.focus();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the width and height of this window's viewable area.
|
||||||
|
* @function
|
||||||
|
* @returns {Object} An object with the "width" and "height"
|
||||||
|
* properties containing the size.
|
||||||
|
* @example
|
||||||
|
* var win = new CKEDITOR.dom.window( window );
|
||||||
|
* var size = <b>win.getViewPaneSize()</b>;
|
||||||
|
* alert( size.width );
|
||||||
|
* alert( size.height );
|
||||||
|
*/
|
||||||
|
getViewPaneSize : function()
|
||||||
|
{
|
||||||
|
var doc = this.$.document,
|
||||||
|
stdMode = doc.compatMode == 'CSS1Compat';
|
||||||
|
return {
|
||||||
|
width : ( stdMode ? doc.documentElement.clientWidth : doc.body.clientWidth ) || 0,
|
||||||
|
height : ( stdMode ? doc.documentElement.clientHeight : doc.body.clientHeight ) || 0
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the current position of the window's scroll.
|
||||||
|
* @function
|
||||||
|
* @returns {Object} An object with the "x" and "y" properties
|
||||||
|
* containing the scroll position.
|
||||||
|
* @example
|
||||||
|
* var win = new CKEDITOR.dom.window( window );
|
||||||
|
* var pos = <b>win.getScrollPosition()</b>;
|
||||||
|
* alert( pos.x );
|
||||||
|
* alert( pos.y );
|
||||||
|
*/
|
||||||
|
getScrollPosition : function()
|
||||||
|
{
|
||||||
|
var $ = this.$;
|
||||||
|
|
||||||
|
if ( 'pageXOffset' in $ )
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
x : $.pageXOffset || 0,
|
||||||
|
y : $.pageYOffset || 0
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var doc = $.document;
|
||||||
|
return {
|
||||||
|
x : doc.documentElement.scrollLeft || doc.body.scrollLeft || 0,
|
||||||
|
y : doc.documentElement.scrollTop || doc.body.scrollTop || 0
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
266
htdocs/includes/ckeditor/_source/core/dtd.js
Normal file
266
htdocs/includes/ckeditor/_source/core/dtd.js
Normal file
@ -0,0 +1,266 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileOverview Defines the {@link CKEDITOR.dtd} object, which holds the DTD
|
||||||
|
* mapping for XHTML 1.0 Transitional. This file was automatically
|
||||||
|
* generated from the file: xhtml1-transitional.dtd.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @namespace Holds and object representation of the HTML DTD to be used by the
|
||||||
|
* editor in its internal operations.<br />
|
||||||
|
* <br />
|
||||||
|
* Each element in the DTD is represented by a property in this object. Each
|
||||||
|
* property contains the list of elements that can be contained by the element.
|
||||||
|
* Text is represented by the "#" property.<br />
|
||||||
|
* <br />
|
||||||
|
* Several special grouping properties are also available. Their names start
|
||||||
|
* with the "$" character.
|
||||||
|
* @example
|
||||||
|
* // Check if "div" can be contained in a "p" element.
|
||||||
|
* alert( !!CKEDITOR.dtd[ 'p' ][ 'div' ] ); "false"
|
||||||
|
* @example
|
||||||
|
* // Check if "p" can be contained in a "div" element.
|
||||||
|
* alert( !!CKEDITOR.dtd[ 'div' ][ 'p' ] ); "true"
|
||||||
|
* @example
|
||||||
|
* // Check if "p" is a block element.
|
||||||
|
* alert( !!CKEDITOR.dtd.$block[ 'p' ] ); "true"
|
||||||
|
*/
|
||||||
|
CKEDITOR.dtd = (function()
|
||||||
|
{
|
||||||
|
var X = CKEDITOR.tools.extend,
|
||||||
|
|
||||||
|
A = {isindex:1,fieldset:1},
|
||||||
|
B = {input:1,button:1,select:1,textarea:1,label:1},
|
||||||
|
C = X({a:1},B),
|
||||||
|
D = X({iframe:1},C),
|
||||||
|
E = {hr:1,ul:1,menu:1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,mark:1,time:1,meter:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,blockquote:1,noscript:1,table:1,center:1,address:1,dir:1,pre:1,h5:1,dl:1,h4:1,noframes:1,h6:1,ol:1,h1:1,h3:1,h2:1},
|
||||||
|
F = {ins:1,del:1,script:1,style:1},
|
||||||
|
G = X({b:1,acronym:1,bdo:1,'var':1,'#':1,abbr:1,code:1,br:1,i:1,cite:1,kbd:1,u:1,strike:1,s:1,tt:1,strong:1,q:1,samp:1,em:1,dfn:1,span:1,wbr:1},F),
|
||||||
|
H = X({sub:1,img:1,object:1,sup:1,basefont:1,map:1,applet:1,font:1,big:1,small:1,mark:1},G),
|
||||||
|
I = X({p:1},H),
|
||||||
|
J = X({iframe:1},H,B),
|
||||||
|
K = {img:1,noscript:1,br:1,kbd:1,center:1,button:1,basefont:1,h5:1,h4:1,samp:1,h6:1,ol:1,h1:1,h3:1,h2:1,form:1,font:1,'#':1,select:1,menu:1,ins:1,abbr:1,label:1,code:1,table:1,script:1,cite:1,input:1,iframe:1,strong:1,textarea:1,noframes:1,big:1,small:1,span:1,hr:1,sub:1,bdo:1,'var':1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,mark:1,time:1,meter:1,menu:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,object:1,sup:1,strike:1,dir:1,map:1,dl:1,applet:1,del:1,isindex:1,fieldset:1,ul:1,b:1,acronym:1,a:1,blockquote:1,i:1,u:1,s:1,tt:1,address:1,q:1,pre:1,p:1,em:1,dfn:1},
|
||||||
|
|
||||||
|
L = X({a:1},J),
|
||||||
|
M = {tr:1},
|
||||||
|
N = {'#':1},
|
||||||
|
O = X({param:1},K),
|
||||||
|
P = X({form:1},A,D,E,I),
|
||||||
|
Q = {li:1},
|
||||||
|
R = {style:1,script:1},
|
||||||
|
S = {base:1,link:1,meta:1,title:1},
|
||||||
|
T = X(S,R),
|
||||||
|
U = {head:1,body:1},
|
||||||
|
V = {html:1};
|
||||||
|
|
||||||
|
var block = {address:1,blockquote:1,center:1,dir:1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,time:1,meter:1,menu:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,isindex:1,noframes:1,ol:1,p:1,pre:1,table:1,ul:1};
|
||||||
|
|
||||||
|
return /** @lends CKEDITOR.dtd */ {
|
||||||
|
|
||||||
|
// The "$" items have been added manually.
|
||||||
|
|
||||||
|
// List of elements living outside body.
|
||||||
|
$nonBodyContent: X(V,U,S),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of block elements, like "p" or "div".
|
||||||
|
* @type Object
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
$block : block,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of block limit elements.
|
||||||
|
* @type Object
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
$blockLimit : { body:1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,time:1,meter:1,menu:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,td:1,th:1,caption:1,form:1 },
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of inline (<span> like) elements.
|
||||||
|
*/
|
||||||
|
$inline : L, // Just like span.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list of elements that can be children at <body>.
|
||||||
|
*/
|
||||||
|
$body : X({script:1,style:1}, block),
|
||||||
|
|
||||||
|
$cdata : {script:1,style:1},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of empty (self-closing) elements, like "br" or "img".
|
||||||
|
* @type Object
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
$empty : {area:1,base:1,br:1,col:1,hr:1,img:1,input:1,link:1,meta:1,param:1,wbr:1},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of list item elements, like "li" or "dd".
|
||||||
|
* @type Object
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
$listItem : {dd:1,dt:1,li:1},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of list root elements.
|
||||||
|
* @type Object
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
$list: {ul:1,ol:1,dl:1},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Elements that accept text nodes, but are not possible to edit into
|
||||||
|
* the browser.
|
||||||
|
* @type Object
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
$nonEditable : {applet:1,button:1,embed:1,iframe:1,map:1,object:1,option:1,script:1,textarea:1,param:1,audio:1,video:1},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of block tags with each one a singleton element lives in the corresponding structure for description.
|
||||||
|
*/
|
||||||
|
$captionBlock : { caption:1, legend:1 },
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of elements that can be ignored if empty, like "b" or "span".
|
||||||
|
* @type Object
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
$removeEmpty : {abbr:1,acronym:1,address:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,s:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1,mark:1},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of elements that have tabindex set to zero by default.
|
||||||
|
* @type Object
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
$tabIndex : {a:1,area:1,button:1,input:1,object:1,select:1,textarea:1},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of elements used inside the "table" element, like "tbody" or "td".
|
||||||
|
* @type Object
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
$tableContent : {caption:1,col:1,colgroup:1,tbody:1,td:1,tfoot:1,th:1,thead:1,tr:1},
|
||||||
|
|
||||||
|
html: U,
|
||||||
|
head: T,
|
||||||
|
style: N,
|
||||||
|
script: N,
|
||||||
|
body: P,
|
||||||
|
base: {},
|
||||||
|
link: {},
|
||||||
|
meta: {},
|
||||||
|
title: N,
|
||||||
|
col : {},
|
||||||
|
tr : {td:1,th:1},
|
||||||
|
img : {},
|
||||||
|
colgroup : {col:1},
|
||||||
|
noscript : P,
|
||||||
|
td : P,
|
||||||
|
br : {},
|
||||||
|
wbr : {},
|
||||||
|
th : P,
|
||||||
|
center : P,
|
||||||
|
kbd : L,
|
||||||
|
button : X(I,E),
|
||||||
|
basefont : {},
|
||||||
|
h5 : L,
|
||||||
|
h4 : L,
|
||||||
|
samp : L,
|
||||||
|
h6 : L,
|
||||||
|
ol : Q,
|
||||||
|
h1 : L,
|
||||||
|
h3 : L,
|
||||||
|
option : N,
|
||||||
|
h2 : L,
|
||||||
|
form : X(A,D,E,I),
|
||||||
|
select : {optgroup:1,option:1},
|
||||||
|
font : L,
|
||||||
|
ins : L,
|
||||||
|
menu : Q,
|
||||||
|
abbr : L,
|
||||||
|
label : L,
|
||||||
|
table : {thead:1,col:1,tbody:1,tr:1,colgroup:1,caption:1,tfoot:1},
|
||||||
|
code : L,
|
||||||
|
tfoot : M,
|
||||||
|
cite : L,
|
||||||
|
li : P,
|
||||||
|
input : {},
|
||||||
|
iframe : P,
|
||||||
|
strong : L,
|
||||||
|
textarea : N,
|
||||||
|
noframes : P,
|
||||||
|
big : L,
|
||||||
|
small : L,
|
||||||
|
span : L,
|
||||||
|
hr : {},
|
||||||
|
dt : L,
|
||||||
|
sub : L,
|
||||||
|
optgroup : {option:1},
|
||||||
|
param : {},
|
||||||
|
bdo : L,
|
||||||
|
'var' : L,
|
||||||
|
div : P,
|
||||||
|
object : O,
|
||||||
|
sup : L,
|
||||||
|
dd : P,
|
||||||
|
strike : L,
|
||||||
|
area : {},
|
||||||
|
dir : Q,
|
||||||
|
map : X({area:1,form:1,p:1},A,F,E),
|
||||||
|
applet : O,
|
||||||
|
dl : {dt:1,dd:1},
|
||||||
|
del : L,
|
||||||
|
isindex : {},
|
||||||
|
fieldset : X({legend:1},K),
|
||||||
|
thead : M,
|
||||||
|
ul : Q,
|
||||||
|
acronym : L,
|
||||||
|
b : L,
|
||||||
|
a : J,
|
||||||
|
blockquote : P,
|
||||||
|
caption : L,
|
||||||
|
i : L,
|
||||||
|
u : L,
|
||||||
|
tbody : M,
|
||||||
|
s : L,
|
||||||
|
address : X(D,I),
|
||||||
|
tt : L,
|
||||||
|
legend : L,
|
||||||
|
q : L,
|
||||||
|
pre : X(G,C),
|
||||||
|
p : L,
|
||||||
|
em : L,
|
||||||
|
dfn : L,
|
||||||
|
//HTML5
|
||||||
|
section : P,
|
||||||
|
header : P,
|
||||||
|
footer : P,
|
||||||
|
nav : P,
|
||||||
|
article : P,
|
||||||
|
aside : P,
|
||||||
|
figure: P,
|
||||||
|
dialog : P,
|
||||||
|
hgroup : P,
|
||||||
|
mark : L,
|
||||||
|
time : L,
|
||||||
|
meter : L,
|
||||||
|
menu : L,
|
||||||
|
command : L,
|
||||||
|
keygen : L,
|
||||||
|
output : L,
|
||||||
|
progress : O,
|
||||||
|
audio : O,
|
||||||
|
video : O,
|
||||||
|
details : O,
|
||||||
|
datagrid : O,
|
||||||
|
datalist : O
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
// PACKAGER_RENAME( CKEDITOR.dtd )
|
||||||
1059
htdocs/includes/ckeditor/_source/core/editor.js
Normal file
1059
htdocs/includes/ckeditor/_source/core/editor.js
Normal file
File diff suppressed because it is too large
Load Diff
186
htdocs/includes/ckeditor/_source/core/editor_basic.js
Normal file
186
htdocs/includes/ckeditor/_source/core/editor_basic.js
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( !CKEDITOR.editor )
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* No element is linked to the editor instance.
|
||||||
|
* @constant
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.ELEMENT_MODE_NONE = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The element is to be replaced by the editor instance.
|
||||||
|
* @constant
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.ELEMENT_MODE_REPLACE = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The editor is to be created inside the element.
|
||||||
|
* @constant
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.ELEMENT_MODE_APPENDTO = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an editor class instance. This constructor should be rarely
|
||||||
|
* used, in favor of the {@link CKEDITOR} editor creation functions.
|
||||||
|
* @ class Represents an editor instance.
|
||||||
|
* @param {Object} instanceConfig Configuration values for this specific
|
||||||
|
* instance.
|
||||||
|
* @param {CKEDITOR.dom.element} [element] The element linked to this
|
||||||
|
* instance.
|
||||||
|
* @param {Number} [mode] The mode in which the element is linked to this
|
||||||
|
* instance. See {@link #elementMode}.
|
||||||
|
* @param {String} [data] Since 3.3. Initial value for the instance.
|
||||||
|
* @augments CKEDITOR.event
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.editor = function( instanceConfig, element, mode, data )
|
||||||
|
{
|
||||||
|
this._ =
|
||||||
|
{
|
||||||
|
// Save the config to be processed later by the full core code.
|
||||||
|
instanceConfig : instanceConfig,
|
||||||
|
element : element,
|
||||||
|
data : data
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The mode in which the {@link #element} is linked to this editor
|
||||||
|
* instance. It can be any of the following values:
|
||||||
|
* <ul>
|
||||||
|
* <li>{@link CKEDITOR.ELEMENT_MODE_NONE}: No element is linked to the
|
||||||
|
* editor instance.</li>
|
||||||
|
* <li>{@link CKEDITOR.ELEMENT_MODE_REPLACE}: The element is to be
|
||||||
|
* replaced by the editor instance.</li>
|
||||||
|
* <li>{@link CKEDITOR.ELEMENT_MODE_APPENDTO}: The editor is to be
|
||||||
|
* created inside the element.</li>
|
||||||
|
* </ul>
|
||||||
|
* @name CKEDITOR.editor.prototype.elementMode
|
||||||
|
* @type Number
|
||||||
|
* @example
|
||||||
|
* var editor = CKEDITOR.replace( 'editor1' );
|
||||||
|
* alert( <b>editor.elementMode</b> ); "1"
|
||||||
|
*/
|
||||||
|
this.elementMode = mode || CKEDITOR.ELEMENT_MODE_NONE;
|
||||||
|
|
||||||
|
// Call the CKEDITOR.event constructor to initialize this instance.
|
||||||
|
CKEDITOR.event.call( this );
|
||||||
|
|
||||||
|
this._init();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replaces a <textarea> or a DOM element (DIV) with a CKEditor
|
||||||
|
* instance. For textareas, the initial value in the editor will be the
|
||||||
|
* textarea value. For DOM elements, their innerHTML will be used
|
||||||
|
* instead. We recommend using TEXTAREA and DIV elements only. Do not use
|
||||||
|
* this function directly. Use {@link CKEDITOR.replace} instead.
|
||||||
|
* @param {Object|String} elementOrIdOrName The DOM element (textarea), its
|
||||||
|
* ID or name.
|
||||||
|
* @param {Object} [config] The specific configurations to apply to this
|
||||||
|
* editor instance. Configurations set here will override global CKEditor
|
||||||
|
* settings.
|
||||||
|
* @returns {CKEDITOR.editor} The editor instance created.
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.editor.replace = function( elementOrIdOrName, config )
|
||||||
|
{
|
||||||
|
var element = elementOrIdOrName;
|
||||||
|
|
||||||
|
if ( typeof element != 'object' )
|
||||||
|
{
|
||||||
|
// Look for the element by id. We accept any kind of element here.
|
||||||
|
element = document.getElementById( elementOrIdOrName );
|
||||||
|
|
||||||
|
// Elements that should go into head are unacceptable (#6791).
|
||||||
|
if ( element && element.tagName.toLowerCase() in {style:1,script:1,base:1,link:1,meta:1,title:1} )
|
||||||
|
element = null;
|
||||||
|
|
||||||
|
// If not found, look for elements by name. In this case we accept only
|
||||||
|
// textareas.
|
||||||
|
if ( !element )
|
||||||
|
{
|
||||||
|
var i = 0,
|
||||||
|
textareasByName = document.getElementsByName( elementOrIdOrName );
|
||||||
|
|
||||||
|
while ( ( element = textareasByName[ i++ ] ) && element.tagName.toLowerCase() != 'textarea' )
|
||||||
|
{ /*jsl:pass*/ }
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !element )
|
||||||
|
throw '[CKEDITOR.editor.replace] The element with id or name "' + elementOrIdOrName + '" was not found.';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do not replace the textarea right now, just hide it. The effective
|
||||||
|
// replacement will be done by the _init function.
|
||||||
|
element.style.visibility = 'hidden';
|
||||||
|
|
||||||
|
// Create the editor instance.
|
||||||
|
return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_REPLACE );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new editor instance inside a specific DOM element. Do not use
|
||||||
|
* this function directly. Use {@link CKEDITOR.appendTo} instead.
|
||||||
|
* @param {Object|String} elementOrId The DOM element or its ID.
|
||||||
|
* @param {Object} [config] The specific configurations to apply to this
|
||||||
|
* editor instance. Configurations set here will override global CKEditor
|
||||||
|
* settings.
|
||||||
|
* @param {String} [data] Since 3.3. Initial value for the instance.
|
||||||
|
* @returns {CKEDITOR.editor} The editor instance created.
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.editor.appendTo = function( elementOrId, config, data )
|
||||||
|
{
|
||||||
|
var element = elementOrId;
|
||||||
|
if ( typeof element != 'object' )
|
||||||
|
{
|
||||||
|
element = document.getElementById( elementOrId );
|
||||||
|
|
||||||
|
if ( !element )
|
||||||
|
throw '[CKEDITOR.editor.appendTo] The element with id "' + elementOrId + '" was not found.';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the editor instance.
|
||||||
|
return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_APPENDTO, data );
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.editor.prototype =
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Initializes the editor instance. This function will be overriden by the
|
||||||
|
* full CKEDITOR.editor implementation (editor.js).
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_init : function()
|
||||||
|
{
|
||||||
|
var pending = CKEDITOR.editor._pending || ( CKEDITOR.editor._pending = [] );
|
||||||
|
pending.push( this );
|
||||||
|
},
|
||||||
|
|
||||||
|
// Both fire and fireOnce will always pass this editor instance as the
|
||||||
|
// "editor" param in CKEDITOR.event.fire. So, we override it to do that
|
||||||
|
// automaticaly.
|
||||||
|
|
||||||
|
/** @ignore */
|
||||||
|
fire : function( eventName, data )
|
||||||
|
{
|
||||||
|
return CKEDITOR.event.prototype.fire.call( this, eventName, data, this );
|
||||||
|
},
|
||||||
|
|
||||||
|
/** @ignore */
|
||||||
|
fireOnce : function( eventName, data )
|
||||||
|
{
|
||||||
|
return CKEDITOR.event.prototype.fireOnce.call( this, eventName, data, this );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// "Inherit" (copy actually) from CKEDITOR.event.
|
||||||
|
CKEDITOR.event.implementOn( CKEDITOR.editor.prototype, true );
|
||||||
|
}
|
||||||
305
htdocs/includes/ckeditor/_source/core/env.js
Normal file
305
htdocs/includes/ckeditor/_source/core/env.js
Normal file
@ -0,0 +1,305 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileOverview Defines the {@link CKEDITOR.env} object, which constains
|
||||||
|
* environment and browser information.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( !CKEDITOR.env )
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @namespace Environment and browser information.
|
||||||
|
*/
|
||||||
|
CKEDITOR.env = (function()
|
||||||
|
{
|
||||||
|
var agent = navigator.userAgent.toLowerCase();
|
||||||
|
var opera = window.opera;
|
||||||
|
|
||||||
|
var env =
|
||||||
|
/** @lends CKEDITOR.env */
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Indicates that CKEditor is running on Internet Explorer.
|
||||||
|
* @type Boolean
|
||||||
|
* @example
|
||||||
|
* if ( CKEDITOR.env.ie )
|
||||||
|
* alert( "I'm on IE!" );
|
||||||
|
*/
|
||||||
|
ie : /*@cc_on!@*/false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that CKEditor is running on Opera.
|
||||||
|
* @type Boolean
|
||||||
|
* @example
|
||||||
|
* if ( CKEDITOR.env.opera )
|
||||||
|
* alert( "I'm on Opera!" );
|
||||||
|
*/
|
||||||
|
opera : ( !!opera && opera.version ),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that CKEditor is running on a WebKit based browser, like
|
||||||
|
* Safari.
|
||||||
|
* @type Boolean
|
||||||
|
* @example
|
||||||
|
* if ( CKEDITOR.env.webkit )
|
||||||
|
* alert( "I'm on WebKit!" );
|
||||||
|
*/
|
||||||
|
webkit : ( agent.indexOf( ' applewebkit/' ) > -1 ),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that CKEditor is running on Adobe AIR.
|
||||||
|
* @type Boolean
|
||||||
|
* @example
|
||||||
|
* if ( CKEDITOR.env.air )
|
||||||
|
* alert( "I'm on AIR!" );
|
||||||
|
*/
|
||||||
|
air : ( agent.indexOf( ' adobeair/' ) > -1 ),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that CKEditor is running on Macintosh.
|
||||||
|
* @type Boolean
|
||||||
|
* @example
|
||||||
|
* if ( CKEDITOR.env.mac )
|
||||||
|
* alert( "I love apples!" );
|
||||||
|
*/
|
||||||
|
mac : ( agent.indexOf( 'macintosh' ) > -1 ),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that CKEditor is running on a quirks mode environemnt.
|
||||||
|
* @type Boolean
|
||||||
|
* @example
|
||||||
|
* if ( CKEDITOR.env.quirks )
|
||||||
|
* alert( "Nooooo!" );
|
||||||
|
*/
|
||||||
|
quirks : ( document.compatMode == 'BackCompat' ),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that CKEditor is running on a mobile like environemnt.
|
||||||
|
* @type Boolean
|
||||||
|
* @example
|
||||||
|
* if ( CKEDITOR.env.mobile )
|
||||||
|
* alert( "I'm running with CKEditor today!" );
|
||||||
|
*/
|
||||||
|
mobile : ( agent.indexOf( 'mobile' ) > -1 ),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that CKEditor is running on Apple iPhone/iPad/iPod devices.
|
||||||
|
* @type Boolean
|
||||||
|
* @example
|
||||||
|
* if ( CKEDITOR.env.iOS )
|
||||||
|
* alert( "I like little apples!" );
|
||||||
|
*/
|
||||||
|
iOS : /(ipad|iphone|ipod)/.test(agent),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that the browser has a custom domain enabled. This has
|
||||||
|
* been set with "document.domain".
|
||||||
|
* @returns {Boolean} "true" if a custom domain is enabled.
|
||||||
|
* @example
|
||||||
|
* if ( CKEDITOR.env.isCustomDomain() )
|
||||||
|
* alert( "I'm in a custom domain!" );
|
||||||
|
*/
|
||||||
|
isCustomDomain : function()
|
||||||
|
{
|
||||||
|
if ( !this.ie )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var domain = document.domain,
|
||||||
|
hostname = window.location.hostname;
|
||||||
|
|
||||||
|
return domain != hostname &&
|
||||||
|
domain != ( '[' + hostname + ']' ); // IPv6 IP support (#5434)
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that page is running under an encrypted connection.
|
||||||
|
* @returns {Boolean} "true" if the page has an encrypted connection.
|
||||||
|
* @example
|
||||||
|
* if ( CKEDITOR.env.secure )
|
||||||
|
* alert( "I'm in SSL!" );
|
||||||
|
*/
|
||||||
|
secure : location.protocol == 'https:'
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that CKEditor is running on a Gecko based browser, like
|
||||||
|
* Firefox.
|
||||||
|
* @name CKEDITOR.env.gecko
|
||||||
|
* @type Boolean
|
||||||
|
* @example
|
||||||
|
* if ( CKEDITOR.env.gecko )
|
||||||
|
* alert( "I'm riding a gecko!" );
|
||||||
|
*/
|
||||||
|
env.gecko = ( navigator.product == 'Gecko' && !env.webkit && !env.opera );
|
||||||
|
|
||||||
|
var version = 0;
|
||||||
|
|
||||||
|
// Internet Explorer 6.0+
|
||||||
|
if ( env.ie )
|
||||||
|
{
|
||||||
|
version = parseFloat( agent.match( /msie (\d+)/ )[1] );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that CKEditor is running on Internet Explorer 8.
|
||||||
|
* @name CKEDITOR.env.ie8
|
||||||
|
* @type Boolean
|
||||||
|
* @example
|
||||||
|
* if ( CKEDITOR.env.ie8 )
|
||||||
|
* alert( "I'm on IE8!" );
|
||||||
|
*/
|
||||||
|
env.ie8 = !!document.documentMode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that CKEditor is running on Internet Explorer 8 on
|
||||||
|
* standards mode.
|
||||||
|
* @name CKEDITOR.env.ie8Compat
|
||||||
|
* @type Boolean
|
||||||
|
* @example
|
||||||
|
* if ( CKEDITOR.env.ie8Compat )
|
||||||
|
* alert( "Now I'm on IE8, for real!" );
|
||||||
|
*/
|
||||||
|
env.ie8Compat = document.documentMode == 8;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that CKEditor is running on Internet Explorer 9's standards mode.
|
||||||
|
* @name CKEDITOR.env.ie9Compat
|
||||||
|
* @type Boolean
|
||||||
|
* @example
|
||||||
|
* if ( CKEDITOR.env.ie9Compat )
|
||||||
|
* alert( "IE9, the beauty of the web!" );
|
||||||
|
*/
|
||||||
|
env.ie9Compat = document.documentMode == 9;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that CKEditor is running on an IE7-like environment, which
|
||||||
|
* includes IE7 itself and IE8's IE7 document mode.
|
||||||
|
* @name CKEDITOR.env.ie7Compat
|
||||||
|
* @type Boolean
|
||||||
|
* @example
|
||||||
|
* if ( CKEDITOR.env.ie8Compat )
|
||||||
|
* alert( "I'm on IE7 or on an IE7 like IE8!" );
|
||||||
|
*/
|
||||||
|
env.ie7Compat = ( ( version == 7 && !document.documentMode )
|
||||||
|
|| document.documentMode == 7 );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that CKEditor is running on an IE6-like environment, which
|
||||||
|
* includes IE6 itself and IE7 and IE8 quirks mode.
|
||||||
|
* @name CKEDITOR.env.ie6Compat
|
||||||
|
* @type Boolean
|
||||||
|
* @example
|
||||||
|
* if ( CKEDITOR.env.ie6Compat )
|
||||||
|
* alert( "I'm on IE6 or quirks mode!" );
|
||||||
|
*/
|
||||||
|
env.ie6Compat = ( version < 7 || env.quirks );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gecko.
|
||||||
|
if ( env.gecko )
|
||||||
|
{
|
||||||
|
var geckoRelease = agent.match( /rv:([\d\.]+)/ );
|
||||||
|
if ( geckoRelease )
|
||||||
|
{
|
||||||
|
geckoRelease = geckoRelease[1].split( '.' );
|
||||||
|
version = geckoRelease[0] * 10000 + ( geckoRelease[1] || 0 ) * 100 + ( geckoRelease[2] || 0 ) * 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opera 9.50+
|
||||||
|
if ( env.opera )
|
||||||
|
version = parseFloat( opera.version() );
|
||||||
|
|
||||||
|
// Adobe AIR 1.0+
|
||||||
|
// Checked before Safari because AIR have the WebKit rich text editor
|
||||||
|
// features from Safari 3.0.4, but the version reported is 420.
|
||||||
|
if ( env.air )
|
||||||
|
version = parseFloat( agent.match( / adobeair\/(\d+)/ )[1] );
|
||||||
|
|
||||||
|
// WebKit 522+ (Safari 3+)
|
||||||
|
if ( env.webkit )
|
||||||
|
version = parseFloat( agent.match( / applewebkit\/(\d+)/ )[1] );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains the browser version.<br />
|
||||||
|
* <br />
|
||||||
|
* For gecko based browsers (like Firefox) it contains the revision
|
||||||
|
* number with first three parts concatenated with a padding zero
|
||||||
|
* (e.g. for revision 1.9.0.2 we have 10900).<br />
|
||||||
|
* <br />
|
||||||
|
* For webkit based browser (like Safari and Chrome) it contains the
|
||||||
|
* WebKit build version (e.g. 522).
|
||||||
|
* @name CKEDITOR.env.version
|
||||||
|
* @type Boolean
|
||||||
|
* @example
|
||||||
|
* if ( CKEDITOR.env.ie && <b>CKEDITOR.env.version</b> <= 6 )
|
||||||
|
* alert( "Ouch!" );
|
||||||
|
*/
|
||||||
|
env.version = version;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that CKEditor is running on a compatible browser.
|
||||||
|
* @name CKEDITOR.env.isCompatible
|
||||||
|
* @type Boolean
|
||||||
|
* @example
|
||||||
|
* if ( CKEDITOR.env.isCompatible )
|
||||||
|
* alert( "Your browser is pretty cool!" );
|
||||||
|
*/
|
||||||
|
env.isCompatible =
|
||||||
|
|
||||||
|
// White list of mobile devices that supports.
|
||||||
|
env.iOS && version >= 534 ||
|
||||||
|
|
||||||
|
!env.mobile && (
|
||||||
|
|
||||||
|
( env.ie && version >= 6 ) ||
|
||||||
|
( env.gecko && version >= 10801 ) ||
|
||||||
|
( env.opera && version >= 9.5 ) ||
|
||||||
|
( env.air && version >= 1 ) ||
|
||||||
|
( env.webkit && version >= 522 ) ||
|
||||||
|
false );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The CSS class to be appended on the main UI containers, making it
|
||||||
|
* easy to apply browser specific styles to it.
|
||||||
|
* @name CKEDITOR.env.cssClass
|
||||||
|
* @type String
|
||||||
|
* @example
|
||||||
|
* myDiv.className = CKEDITOR.env.cssClass;
|
||||||
|
*/
|
||||||
|
env.cssClass =
|
||||||
|
'cke_browser_' + (
|
||||||
|
env.ie ? 'ie' :
|
||||||
|
env.gecko ? 'gecko' :
|
||||||
|
env.opera ? 'opera' :
|
||||||
|
env.webkit ? 'webkit' :
|
||||||
|
'unknown' );
|
||||||
|
|
||||||
|
if ( env.quirks )
|
||||||
|
env.cssClass += ' cke_browser_quirks';
|
||||||
|
|
||||||
|
if ( env.ie )
|
||||||
|
{
|
||||||
|
env.cssClass += ' cke_browser_ie' + (
|
||||||
|
env.version < 7 ? '6' :
|
||||||
|
env.version >= 8 ? document.documentMode:
|
||||||
|
'7' );
|
||||||
|
|
||||||
|
if ( env.quirks )
|
||||||
|
env.cssClass += ' cke_browser_iequirks';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( env.gecko && version < 10900 )
|
||||||
|
env.cssClass += ' cke_browser_gecko18';
|
||||||
|
|
||||||
|
if ( env.air )
|
||||||
|
env.cssClass += ' cke_browser_air';
|
||||||
|
|
||||||
|
return env;
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
|
||||||
|
// PACKAGER_RENAME( CKEDITOR.env )
|
||||||
|
// PACKAGER_RENAME( CKEDITOR.env.ie )
|
||||||
342
htdocs/includes/ckeditor/_source/core/event.js
Normal file
342
htdocs/includes/ckeditor/_source/core/event.js
Normal file
@ -0,0 +1,342 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileOverview Defines the {@link CKEDITOR.event} class, which serves as the
|
||||||
|
* base for classes and objects that require event handling features.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( !CKEDITOR.event )
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Creates an event class instance. This constructor is rearely used, being
|
||||||
|
* the {@link #.implementOn} function used in class prototypes directly
|
||||||
|
* instead.
|
||||||
|
* @class This is a base class for classes and objects that require event
|
||||||
|
* handling features.<br />
|
||||||
|
* <br />
|
||||||
|
* Do not confuse this class with {@link CKEDITOR.dom.event} which is
|
||||||
|
* instead used for DOM events. The CKEDITOR.event class implements the
|
||||||
|
* internal event system used by the CKEditor to fire API related events.
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.event = function()
|
||||||
|
{};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the {@link CKEDITOR.event} features in an object.
|
||||||
|
* @param {Object} targetObject The object into which implement the features.
|
||||||
|
* @example
|
||||||
|
* var myObject = { message : 'Example' };
|
||||||
|
* <b>CKEDITOR.event.implementOn( myObject }</b>;
|
||||||
|
* myObject.on( 'testEvent', function()
|
||||||
|
* {
|
||||||
|
* alert( this.message ); // "Example"
|
||||||
|
* });
|
||||||
|
* myObject.fire( 'testEvent' );
|
||||||
|
*/
|
||||||
|
CKEDITOR.event.implementOn = function( targetObject )
|
||||||
|
{
|
||||||
|
var eventProto = CKEDITOR.event.prototype;
|
||||||
|
|
||||||
|
for ( var prop in eventProto )
|
||||||
|
{
|
||||||
|
if ( targetObject[ prop ] == undefined )
|
||||||
|
targetObject[ prop ] = eventProto[ prop ];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.event.prototype = (function()
|
||||||
|
{
|
||||||
|
// Returns the private events object for a given object.
|
||||||
|
var getPrivate = function( obj )
|
||||||
|
{
|
||||||
|
var _ = ( obj.getPrivate && obj.getPrivate() ) || obj._ || ( obj._ = {} );
|
||||||
|
return _.events || ( _.events = {} );
|
||||||
|
};
|
||||||
|
|
||||||
|
var eventEntry = function( eventName )
|
||||||
|
{
|
||||||
|
this.name = eventName;
|
||||||
|
this.listeners = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
eventEntry.prototype =
|
||||||
|
{
|
||||||
|
// Get the listener index for a specified function.
|
||||||
|
// Returns -1 if not found.
|
||||||
|
getListenerIndex : function( listenerFunction )
|
||||||
|
{
|
||||||
|
for ( var i = 0, listeners = this.listeners ; i < listeners.length ; i++ )
|
||||||
|
{
|
||||||
|
if ( listeners[i].fn == listenerFunction )
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return /** @lends CKEDITOR.event.prototype */ {
|
||||||
|
/**
|
||||||
|
* Registers a listener to a specific event in the current object.
|
||||||
|
* @param {String} eventName The event name to which listen.
|
||||||
|
* @param {Function} listenerFunction The function listening to the
|
||||||
|
* event. A single {@link CKEDITOR.eventInfo} object instanced
|
||||||
|
* is passed to this function containing all the event data.
|
||||||
|
* @param {Object} [scopeObj] The object used to scope the listener
|
||||||
|
* call (the this object. If omitted, the current object is used.
|
||||||
|
* @param {Object} [listenerData] Data to be sent as the
|
||||||
|
* {@link CKEDITOR.eventInfo#listenerData} when calling the
|
||||||
|
* listener.
|
||||||
|
* @param {Number} [priority] The listener priority. Lower priority
|
||||||
|
* listeners are called first. Listeners with the same priority
|
||||||
|
* value are called in registration order. Defaults to 10.
|
||||||
|
* @example
|
||||||
|
* someObject.on( 'someEvent', function()
|
||||||
|
* {
|
||||||
|
* alert( this == someObject ); // "true"
|
||||||
|
* });
|
||||||
|
* @example
|
||||||
|
* someObject.on( 'someEvent', function()
|
||||||
|
* {
|
||||||
|
* alert( this == anotherObject ); // "true"
|
||||||
|
* }
|
||||||
|
* , anotherObject );
|
||||||
|
* @example
|
||||||
|
* someObject.on( 'someEvent', function( event )
|
||||||
|
* {
|
||||||
|
* alert( event.listenerData ); // "Example"
|
||||||
|
* }
|
||||||
|
* , null, 'Example' );
|
||||||
|
* @example
|
||||||
|
* someObject.on( 'someEvent', function() { ... } ); // 2nd called
|
||||||
|
* someObject.on( 'someEvent', function() { ... }, null, null, 100 ); // 3rd called
|
||||||
|
* someObject.on( 'someEvent', function() { ... }, null, null, 1 ); // 1st called
|
||||||
|
*/
|
||||||
|
on : function( eventName, listenerFunction, scopeObj, listenerData, priority )
|
||||||
|
{
|
||||||
|
// Get the event entry (create it if needed).
|
||||||
|
var events = getPrivate( this ),
|
||||||
|
event = events[ eventName ] || ( events[ eventName ] = new eventEntry( eventName ) );
|
||||||
|
|
||||||
|
if ( event.getListenerIndex( listenerFunction ) < 0 )
|
||||||
|
{
|
||||||
|
// Get the listeners.
|
||||||
|
var listeners = event.listeners;
|
||||||
|
|
||||||
|
// Fill the scope.
|
||||||
|
if ( !scopeObj )
|
||||||
|
scopeObj = this;
|
||||||
|
|
||||||
|
// Default the priority, if needed.
|
||||||
|
if ( isNaN( priority ) )
|
||||||
|
priority = 10;
|
||||||
|
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
// Create the function to be fired for this listener.
|
||||||
|
var listenerFirer = function( editor, publisherData, stopFn, cancelFn )
|
||||||
|
{
|
||||||
|
var ev =
|
||||||
|
{
|
||||||
|
name : eventName,
|
||||||
|
sender : this,
|
||||||
|
editor : editor,
|
||||||
|
data : publisherData,
|
||||||
|
listenerData : listenerData,
|
||||||
|
stop : stopFn,
|
||||||
|
cancel : cancelFn,
|
||||||
|
removeListener : function()
|
||||||
|
{
|
||||||
|
me.removeListener( eventName, listenerFunction );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
listenerFunction.call( scopeObj, ev );
|
||||||
|
|
||||||
|
return ev.data;
|
||||||
|
};
|
||||||
|
listenerFirer.fn = listenerFunction;
|
||||||
|
listenerFirer.priority = priority;
|
||||||
|
|
||||||
|
// Search for the right position for this new listener, based on its
|
||||||
|
// priority.
|
||||||
|
for ( var i = listeners.length - 1 ; i >= 0 ; i-- )
|
||||||
|
{
|
||||||
|
// Find the item which should be before the new one.
|
||||||
|
if ( listeners[ i ].priority <= priority )
|
||||||
|
{
|
||||||
|
// Insert the listener in the array.
|
||||||
|
listeners.splice( i + 1, 0, listenerFirer );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no position has been found (or zero length), put it in
|
||||||
|
// the front of list.
|
||||||
|
listeners.unshift( listenerFirer );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fires an specific event in the object. All registered listeners are
|
||||||
|
* called at this point.
|
||||||
|
* @function
|
||||||
|
* @param {String} eventName The event name to fire.
|
||||||
|
* @param {Object} [data] Data to be sent as the
|
||||||
|
* {@link CKEDITOR.eventInfo#data} when calling the
|
||||||
|
* listeners.
|
||||||
|
* @param {CKEDITOR.editor} [editor] The editor instance to send as the
|
||||||
|
* {@link CKEDITOR.eventInfo#editor} when calling the
|
||||||
|
* listener.
|
||||||
|
* @returns {Boolean|Object} A booloan indicating that the event is to be
|
||||||
|
* canceled, or data returned by one of the listeners.
|
||||||
|
* @example
|
||||||
|
* someObject.on( 'someEvent', function() { ... } );
|
||||||
|
* someObject.on( 'someEvent', function() { ... } );
|
||||||
|
* <b>someObject.fire( 'someEvent' )</b>; // both listeners are called
|
||||||
|
* @example
|
||||||
|
* someObject.on( 'someEvent', function( event )
|
||||||
|
* {
|
||||||
|
* alert( event.data ); // "Example"
|
||||||
|
* });
|
||||||
|
* <b>someObject.fire( 'someEvent', 'Example' )</b>;
|
||||||
|
*/
|
||||||
|
fire : (function()
|
||||||
|
{
|
||||||
|
// Create the function that marks the event as stopped.
|
||||||
|
var stopped = false;
|
||||||
|
var stopEvent = function()
|
||||||
|
{
|
||||||
|
stopped = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create the function that marks the event as canceled.
|
||||||
|
var canceled = false;
|
||||||
|
var cancelEvent = function()
|
||||||
|
{
|
||||||
|
canceled = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
return function( eventName, data, editor )
|
||||||
|
{
|
||||||
|
// Get the event entry.
|
||||||
|
var event = getPrivate( this )[ eventName ];
|
||||||
|
|
||||||
|
// Save the previous stopped and cancelled states. We may
|
||||||
|
// be nesting fire() calls.
|
||||||
|
var previousStopped = stopped,
|
||||||
|
previousCancelled = canceled;
|
||||||
|
|
||||||
|
// Reset the stopped and canceled flags.
|
||||||
|
stopped = canceled = false;
|
||||||
|
|
||||||
|
if ( event )
|
||||||
|
{
|
||||||
|
var listeners = event.listeners;
|
||||||
|
|
||||||
|
if ( listeners.length )
|
||||||
|
{
|
||||||
|
// As some listeners may remove themselves from the
|
||||||
|
// event, the original array length is dinamic. So,
|
||||||
|
// let's make a copy of all listeners, so we are
|
||||||
|
// sure we'll call all of them.
|
||||||
|
listeners = listeners.slice( 0 );
|
||||||
|
|
||||||
|
// Loop through all listeners.
|
||||||
|
for ( var i = 0 ; i < listeners.length ; i++ )
|
||||||
|
{
|
||||||
|
// Call the listener, passing the event data.
|
||||||
|
var retData = listeners[i].call( this, editor, data, stopEvent, cancelEvent );
|
||||||
|
|
||||||
|
if ( typeof retData != 'undefined' )
|
||||||
|
data = retData;
|
||||||
|
|
||||||
|
// No further calls is stopped or canceled.
|
||||||
|
if ( stopped || canceled )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var ret = canceled || ( typeof data == 'undefined' ? false : data );
|
||||||
|
|
||||||
|
// Restore the previous stopped and canceled states.
|
||||||
|
stopped = previousStopped;
|
||||||
|
canceled = previousCancelled;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
})(),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fires an specific event in the object, releasing all listeners
|
||||||
|
* registered to that event. The same listeners are not called again on
|
||||||
|
* successive calls of it or of {@link #fire}.
|
||||||
|
* @param {String} eventName The event name to fire.
|
||||||
|
* @param {Object} [data] Data to be sent as the
|
||||||
|
* {@link CKEDITOR.eventInfo#data} when calling the
|
||||||
|
* listeners.
|
||||||
|
* @param {CKEDITOR.editor} [editor] The editor instance to send as the
|
||||||
|
* {@link CKEDITOR.eventInfo#editor} when calling the
|
||||||
|
* listener.
|
||||||
|
* @returns {Boolean|Object} A booloan indicating that the event is to be
|
||||||
|
* canceled, or data returned by one of the listeners.
|
||||||
|
* @example
|
||||||
|
* someObject.on( 'someEvent', function() { ... } );
|
||||||
|
* someObject.fire( 'someEvent' ); // above listener called
|
||||||
|
* <b>someObject.fireOnce( 'someEvent' )</b>; // above listener called
|
||||||
|
* someObject.fire( 'someEvent' ); // no listeners called
|
||||||
|
*/
|
||||||
|
fireOnce : function( eventName, data, editor )
|
||||||
|
{
|
||||||
|
var ret = this.fire( eventName, data, editor );
|
||||||
|
delete getPrivate( this )[ eventName ];
|
||||||
|
return ret;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters a listener function from being called at the specified
|
||||||
|
* event. No errors are thrown if the listener has not been
|
||||||
|
* registered previously.
|
||||||
|
* @param {String} eventName The event name.
|
||||||
|
* @param {Function} listenerFunction The listener function to unregister.
|
||||||
|
* @example
|
||||||
|
* var myListener = function() { ... };
|
||||||
|
* someObject.on( 'someEvent', myListener );
|
||||||
|
* someObject.fire( 'someEvent' ); // myListener called
|
||||||
|
* <b>someObject.removeListener( 'someEvent', myListener )</b>;
|
||||||
|
* someObject.fire( 'someEvent' ); // myListener not called
|
||||||
|
*/
|
||||||
|
removeListener : function( eventName, listenerFunction )
|
||||||
|
{
|
||||||
|
// Get the event entry.
|
||||||
|
var event = getPrivate( this )[ eventName ];
|
||||||
|
|
||||||
|
if ( event )
|
||||||
|
{
|
||||||
|
var index = event.getListenerIndex( listenerFunction );
|
||||||
|
if ( index >= 0 )
|
||||||
|
event.listeners.splice( index, 1 );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if there is any listener registered to a given event.
|
||||||
|
* @param {String} eventName The event name.
|
||||||
|
* @example
|
||||||
|
* var myListener = function() { ... };
|
||||||
|
* someObject.on( 'someEvent', myListener );
|
||||||
|
* alert( someObject.<b>hasListeners( 'someEvent' )</b> ); // "true"
|
||||||
|
* alert( someObject.<b>hasListeners( 'noEvent' )</b> ); // "false"
|
||||||
|
*/
|
||||||
|
hasListeners : function( eventName )
|
||||||
|
{
|
||||||
|
var event = getPrivate( this )[ eventName ];
|
||||||
|
return ( event && event.listeners.length > 0 ) ;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
}
|
||||||
132
htdocs/includes/ckeditor/_source/core/eventInfo.js
Normal file
132
htdocs/includes/ckeditor/_source/core/eventInfo.js
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileOverview Defines the "virtual" {@link CKEDITOR.eventInfo} class, which
|
||||||
|
* contains the defintions of the event object passed to event listeners.
|
||||||
|
* This file is for documentation purposes only.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (Virtual Class) Do not call this constructor. This class is not really part
|
||||||
|
* of the API.
|
||||||
|
* @class Virtual class that illustrates the features of the event object to be
|
||||||
|
* passed to event listeners by a {@link CKEDITOR.event} based object.
|
||||||
|
* @name CKEDITOR.eventInfo
|
||||||
|
* @example
|
||||||
|
* // Do not do this.
|
||||||
|
* var myEvent = new CKEDITOR.eventInfo(); // Error: CKEDITOR.eventInfo is undefined
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The event name.
|
||||||
|
* @name CKEDITOR.eventInfo.prototype.name
|
||||||
|
* @field
|
||||||
|
* @type String
|
||||||
|
* @example
|
||||||
|
* someObject.on( 'someEvent', function( event )
|
||||||
|
* {
|
||||||
|
* alert( <b>event.name</b> ); // "someEvent"
|
||||||
|
* });
|
||||||
|
* someObject.fire( 'someEvent' );
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The object that publishes (sends) the event.
|
||||||
|
* @name CKEDITOR.eventInfo.prototype.sender
|
||||||
|
* @field
|
||||||
|
* @type Object
|
||||||
|
* @example
|
||||||
|
* someObject.on( 'someEvent', function( event )
|
||||||
|
* {
|
||||||
|
* alert( <b>event.sender</b> == someObject ); // "true"
|
||||||
|
* });
|
||||||
|
* someObject.fire( 'someEvent' );
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The editor instance that holds the sender. May be the same as sender. May be
|
||||||
|
* null if the sender is not part of an editor instance, like a component
|
||||||
|
* running in standalone mode.
|
||||||
|
* @name CKEDITOR.eventInfo.prototype.editor
|
||||||
|
* @field
|
||||||
|
* @type CKEDITOR.editor
|
||||||
|
* @example
|
||||||
|
* myButton.on( 'someEvent', function( event )
|
||||||
|
* {
|
||||||
|
* alert( <b>event.editor</b> == myEditor ); // "true"
|
||||||
|
* });
|
||||||
|
* myButton.fire( 'someEvent', null, <b>myEditor</b> );
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Any kind of additional data. Its format and usage is event dependent.
|
||||||
|
* @name CKEDITOR.eventInfo.prototype.data
|
||||||
|
* @field
|
||||||
|
* @type Object
|
||||||
|
* @example
|
||||||
|
* someObject.on( 'someEvent', function( event )
|
||||||
|
* {
|
||||||
|
* alert( <b>event.data</b> ); // "Example"
|
||||||
|
* });
|
||||||
|
* someObject.fire( 'someEvent', <b>'Example'</b> );
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Any extra data appended during the listener registration.
|
||||||
|
* @name CKEDITOR.eventInfo.prototype.listenerData
|
||||||
|
* @field
|
||||||
|
* @type Object
|
||||||
|
* @example
|
||||||
|
* someObject.on( 'someEvent', function( event )
|
||||||
|
* {
|
||||||
|
* alert( <b>event.listenerData</b> ); // "Example"
|
||||||
|
* }
|
||||||
|
* , null, <b>'Example'</b> );
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that no further listeners are to be called.
|
||||||
|
* @name CKEDITOR.eventInfo.prototype.stop
|
||||||
|
* @function
|
||||||
|
* @example
|
||||||
|
* someObject.on( 'someEvent', function( event )
|
||||||
|
* {
|
||||||
|
* <b>event.stop()</b>;
|
||||||
|
* });
|
||||||
|
* someObject.on( 'someEvent', function( event )
|
||||||
|
* {
|
||||||
|
* // This one will not be called.
|
||||||
|
* });
|
||||||
|
* alert( someObject.fire( 'someEvent' ) ); // "false"
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that the event is to be cancelled (if cancelable).
|
||||||
|
* @name CKEDITOR.eventInfo.prototype.cancel
|
||||||
|
* @function
|
||||||
|
* @example
|
||||||
|
* someObject.on( 'someEvent', function( event )
|
||||||
|
* {
|
||||||
|
* <b>event.cancel()</b>;
|
||||||
|
* });
|
||||||
|
* someObject.on( 'someEvent', function( event )
|
||||||
|
* {
|
||||||
|
* // This one will not be called.
|
||||||
|
* });
|
||||||
|
* alert( someObject.fire( 'someEvent' ) ); // "true"
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the current listener.
|
||||||
|
* @name CKEDITOR.eventInfo.prototype.removeListener
|
||||||
|
* @function
|
||||||
|
* @example
|
||||||
|
* someObject.on( 'someEvent', function( event )
|
||||||
|
* {
|
||||||
|
* <b>event.removeListener()</b>;
|
||||||
|
* // Now this function won't be called again by 'someEvent'
|
||||||
|
* });
|
||||||
|
*/
|
||||||
152
htdocs/includes/ckeditor/_source/core/focusmanager.js
Normal file
152
htdocs/includes/ckeditor/_source/core/focusmanager.js
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileOverview Defines the {@link CKEDITOR.focusManager} class, which is used
|
||||||
|
* to handle the focus on editor instances..
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a focusManager class instance.
|
||||||
|
* @class Manages the focus activity in an editor instance. This class is to be
|
||||||
|
* used mainly by UI elements coders when adding interface elements that need
|
||||||
|
* to set the focus state of the editor.
|
||||||
|
* @param {CKEDITOR.editor} editor The editor instance.
|
||||||
|
* @example
|
||||||
|
* var focusManager = <b>new CKEDITOR.focusManager( editor )</b>;
|
||||||
|
* focusManager.focus();
|
||||||
|
*/
|
||||||
|
CKEDITOR.focusManager = function( editor )
|
||||||
|
{
|
||||||
|
if ( editor.focusManager )
|
||||||
|
return editor.focusManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that the editor instance has focus.
|
||||||
|
* @type Boolean
|
||||||
|
* @example
|
||||||
|
* alert( CKEDITOR.instances.editor1.focusManager.hasFocus ); // e.g "true"
|
||||||
|
*/
|
||||||
|
this.hasFocus = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object used to hold private stuff.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this._ =
|
||||||
|
{
|
||||||
|
editor : editor
|
||||||
|
};
|
||||||
|
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.focusManager.prototype =
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Used to indicate that the editor instance has the focus.<br />
|
||||||
|
* <br />
|
||||||
|
* Note that this function will not explicitelly set the focus in the
|
||||||
|
* editor (for example, making the caret blinking on it). Use
|
||||||
|
* {@link CKEDITOR.editor#focus} for it instead.
|
||||||
|
* @example
|
||||||
|
* var editor = CKEDITOR.instances.editor1;
|
||||||
|
* <b>editor.focusManager.focus()</b>;
|
||||||
|
*/
|
||||||
|
focus : function()
|
||||||
|
{
|
||||||
|
if ( this._.timer )
|
||||||
|
clearTimeout( this._.timer );
|
||||||
|
|
||||||
|
if ( !this.hasFocus )
|
||||||
|
{
|
||||||
|
// If another editor has the current focus, we first "blur" it. In
|
||||||
|
// this way the events happen in a more logical sequence, like:
|
||||||
|
// "focus 1" > "blur 1" > "focus 2"
|
||||||
|
// ... instead of:
|
||||||
|
// "focus 1" > "focus 2" > "blur 1"
|
||||||
|
if ( CKEDITOR.currentInstance )
|
||||||
|
CKEDITOR.currentInstance.focusManager.forceBlur();
|
||||||
|
|
||||||
|
var editor = this._.editor;
|
||||||
|
|
||||||
|
editor.container.getChild( 1 ).addClass( 'cke_focus' );
|
||||||
|
|
||||||
|
this.hasFocus = true;
|
||||||
|
editor.fire( 'focus' );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to indicate that the editor instance has lost the focus.<br />
|
||||||
|
* <br />
|
||||||
|
* Note that this functions acts asynchronously with a delay of 100ms to
|
||||||
|
* avoid subsequent blur/focus effects. If you want the "blur" to happen
|
||||||
|
* immediately, use the {@link #forceBlur} function instead.
|
||||||
|
* @example
|
||||||
|
* var editor = CKEDITOR.instances.editor1;
|
||||||
|
* <b>editor.focusManager.blur()</b>;
|
||||||
|
*/
|
||||||
|
blur : function()
|
||||||
|
{
|
||||||
|
var focusManager = this;
|
||||||
|
|
||||||
|
if ( focusManager._.timer )
|
||||||
|
clearTimeout( focusManager._.timer );
|
||||||
|
|
||||||
|
focusManager._.timer = setTimeout(
|
||||||
|
function()
|
||||||
|
{
|
||||||
|
delete focusManager._.timer;
|
||||||
|
focusManager.forceBlur();
|
||||||
|
}
|
||||||
|
, 100 );
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to indicate that the editor instance has lost the focus. Unlike
|
||||||
|
* {@link #blur}, this function is synchronous, marking the instance as
|
||||||
|
* "blured" immediately.
|
||||||
|
* @example
|
||||||
|
* var editor = CKEDITOR.instances.editor1;
|
||||||
|
* <b>editor.focusManager.forceBlur()</b>;
|
||||||
|
*/
|
||||||
|
forceBlur : function()
|
||||||
|
{
|
||||||
|
if ( this.hasFocus )
|
||||||
|
{
|
||||||
|
var editor = this._.editor;
|
||||||
|
|
||||||
|
editor.container.getChild( 1 ).removeClass( 'cke_focus' );
|
||||||
|
|
||||||
|
this.hasFocus = false;
|
||||||
|
editor.fire( 'blur' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fired when the editor instance receives the input focus.
|
||||||
|
* @name CKEDITOR.editor#focus
|
||||||
|
* @event
|
||||||
|
* @param {CKEDITOR.editor} editor The editor instance.
|
||||||
|
* @example
|
||||||
|
* editor.on( 'focus', function( e )
|
||||||
|
* {
|
||||||
|
* alert( 'The editor named ' + e.editor.name + ' is now focused' );
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fired when the editor instance loses the input focus.
|
||||||
|
* @name CKEDITOR.editor#blur
|
||||||
|
* @event
|
||||||
|
* @param {CKEDITOR.editor} editor The editor instance.
|
||||||
|
* @example
|
||||||
|
* editor.on( 'blur', function( e )
|
||||||
|
* {
|
||||||
|
* alert( 'The editor named ' + e.editor.name + ' lost the focus' );
|
||||||
|
* });
|
||||||
|
*/
|
||||||
224
htdocs/includes/ckeditor/_source/core/htmlparser.js
Normal file
224
htdocs/includes/ckeditor/_source/core/htmlparser.js
Normal file
@ -0,0 +1,224 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a {@link CKEDITOR.htmlParser} class instance.
|
||||||
|
* @class Provides an "event like" system to parse strings of HTML data.
|
||||||
|
* @example
|
||||||
|
* var parser = new CKEDITOR.htmlParser();
|
||||||
|
* parser.onTagOpen = function( tagName, attributes, selfClosing )
|
||||||
|
* {
|
||||||
|
* alert( tagName );
|
||||||
|
* };
|
||||||
|
* parser.parse( '<p>Some <b>text</b>.</p>' );
|
||||||
|
*/
|
||||||
|
CKEDITOR.htmlParser = function()
|
||||||
|
{
|
||||||
|
this._ =
|
||||||
|
{
|
||||||
|
htmlPartsRegex : new RegExp( '<(?:(?:\\/([^>]+)>)|(?:!--([\\S|\\s]*?)-->)|(?:([^\\s>]+)\\s*((?:(?:"[^"]*")|(?:\'[^\']*\')|[^"\'>])*)\\/?>))', 'g' )
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
(function()
|
||||||
|
{
|
||||||
|
var attribsRegex = /([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))|(?=\s|$))/g,
|
||||||
|
emptyAttribs = {checked:1,compact:1,declare:1,defer:1,disabled:1,ismap:1,multiple:1,nohref:1,noresize:1,noshade:1,nowrap:1,readonly:1,selected:1};
|
||||||
|
|
||||||
|
CKEDITOR.htmlParser.prototype =
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Function to be fired when a tag opener is found. This function
|
||||||
|
* should be overriden when using this class.
|
||||||
|
* @param {String} tagName The tag name. The name is guarantted to be
|
||||||
|
* lowercased.
|
||||||
|
* @param {Object} attributes An object containing all tag attributes. Each
|
||||||
|
* property in this object represent and attribute name and its
|
||||||
|
* value is the attribute value.
|
||||||
|
* @param {Boolean} selfClosing true if the tag closes itself, false if the
|
||||||
|
* tag doesn't.
|
||||||
|
* @example
|
||||||
|
* var parser = new CKEDITOR.htmlParser();
|
||||||
|
* parser.onTagOpen = function( tagName, attributes, selfClosing )
|
||||||
|
* {
|
||||||
|
* alert( tagName ); // e.g. "b"
|
||||||
|
* });
|
||||||
|
* parser.parse( "<!-- Example --><b>Hello</b>" );
|
||||||
|
*/
|
||||||
|
onTagOpen : function() {},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to be fired when a tag closer is found. This function
|
||||||
|
* should be overriden when using this class.
|
||||||
|
* @param {String} tagName The tag name. The name is guarantted to be
|
||||||
|
* lowercased.
|
||||||
|
* @example
|
||||||
|
* var parser = new CKEDITOR.htmlParser();
|
||||||
|
* parser.onTagClose = function( tagName )
|
||||||
|
* {
|
||||||
|
* alert( tagName ); // e.g. "b"
|
||||||
|
* });
|
||||||
|
* parser.parse( "<!-- Example --><b>Hello</b>" );
|
||||||
|
*/
|
||||||
|
onTagClose : function() {},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to be fired when text is found. This function
|
||||||
|
* should be overriden when using this class.
|
||||||
|
* @param {String} text The text found.
|
||||||
|
* @example
|
||||||
|
* var parser = new CKEDITOR.htmlParser();
|
||||||
|
* parser.onText = function( text )
|
||||||
|
* {
|
||||||
|
* alert( text ); // e.g. "Hello"
|
||||||
|
* });
|
||||||
|
* parser.parse( "<!-- Example --><b>Hello</b>" );
|
||||||
|
*/
|
||||||
|
onText : function() {},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to be fired when CDATA section is found. This function
|
||||||
|
* should be overriden when using this class.
|
||||||
|
* @param {String} cdata The CDATA been found.
|
||||||
|
* @example
|
||||||
|
* var parser = new CKEDITOR.htmlParser();
|
||||||
|
* parser.onCDATA = function( cdata )
|
||||||
|
* {
|
||||||
|
* alert( cdata ); // e.g. "var hello;"
|
||||||
|
* });
|
||||||
|
* parser.parse( "<script>var hello;</script>" );
|
||||||
|
*/
|
||||||
|
onCDATA : function() {},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to be fired when a commend is found. This function
|
||||||
|
* should be overriden when using this class.
|
||||||
|
* @param {String} comment The comment text.
|
||||||
|
* @example
|
||||||
|
* var parser = new CKEDITOR.htmlParser();
|
||||||
|
* parser.onComment = function( comment )
|
||||||
|
* {
|
||||||
|
* alert( comment ); // e.g. " Example "
|
||||||
|
* });
|
||||||
|
* parser.parse( "<!-- Example --><b>Hello</b>" );
|
||||||
|
*/
|
||||||
|
onComment : function() {},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses text, looking for HTML tokens, like tag openers or closers,
|
||||||
|
* or comments. This function fires the onTagOpen, onTagClose, onText
|
||||||
|
* and onComment function during its execution.
|
||||||
|
* @param {String} html The HTML to be parsed.
|
||||||
|
* @example
|
||||||
|
* var parser = new CKEDITOR.htmlParser();
|
||||||
|
* // The onTagOpen, onTagClose, onText and onComment should be overriden
|
||||||
|
* // at this point.
|
||||||
|
* parser.parse( "<!-- Example --><b>Hello</b>" );
|
||||||
|
*/
|
||||||
|
parse : function( html )
|
||||||
|
{
|
||||||
|
var parts,
|
||||||
|
tagName,
|
||||||
|
nextIndex = 0,
|
||||||
|
cdata; // The collected data inside a CDATA section.
|
||||||
|
|
||||||
|
while ( ( parts = this._.htmlPartsRegex.exec( html ) ) )
|
||||||
|
{
|
||||||
|
var tagIndex = parts.index;
|
||||||
|
if ( tagIndex > nextIndex )
|
||||||
|
{
|
||||||
|
var text = html.substring( nextIndex, tagIndex );
|
||||||
|
|
||||||
|
if ( cdata )
|
||||||
|
cdata.push( text );
|
||||||
|
else
|
||||||
|
this.onText( text );
|
||||||
|
}
|
||||||
|
|
||||||
|
nextIndex = this._.htmlPartsRegex.lastIndex;
|
||||||
|
|
||||||
|
/*
|
||||||
|
"parts" is an array with the following items:
|
||||||
|
0 : The entire match for opening/closing tags and comments.
|
||||||
|
1 : Group filled with the tag name for closing tags.
|
||||||
|
2 : Group filled with the comment text.
|
||||||
|
3 : Group filled with the tag name for opening tags.
|
||||||
|
4 : Group filled with the attributes part of opening tags.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Closing tag
|
||||||
|
if ( ( tagName = parts[ 1 ] ) )
|
||||||
|
{
|
||||||
|
tagName = tagName.toLowerCase();
|
||||||
|
|
||||||
|
if ( cdata && CKEDITOR.dtd.$cdata[ tagName ] )
|
||||||
|
{
|
||||||
|
// Send the CDATA data.
|
||||||
|
this.onCDATA( cdata.join('') );
|
||||||
|
cdata = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !cdata )
|
||||||
|
{
|
||||||
|
this.onTagClose( tagName );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If CDATA is enabled, just save the raw match.
|
||||||
|
if ( cdata )
|
||||||
|
{
|
||||||
|
cdata.push( parts[ 0 ] );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opening tag
|
||||||
|
if ( ( tagName = parts[ 3 ] ) )
|
||||||
|
{
|
||||||
|
tagName = tagName.toLowerCase();
|
||||||
|
|
||||||
|
// There are some tag names that can break things, so let's
|
||||||
|
// simply ignore them when parsing. (#5224)
|
||||||
|
if ( /="/.test( tagName ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var attribs = {},
|
||||||
|
attribMatch,
|
||||||
|
attribsPart = parts[ 4 ],
|
||||||
|
selfClosing = !!( attribsPart && attribsPart.charAt( attribsPart.length - 1 ) == '/' );
|
||||||
|
|
||||||
|
if ( attribsPart )
|
||||||
|
{
|
||||||
|
while ( ( attribMatch = attribsRegex.exec( attribsPart ) ) )
|
||||||
|
{
|
||||||
|
var attName = attribMatch[1].toLowerCase(),
|
||||||
|
attValue = attribMatch[2] || attribMatch[3] || attribMatch[4] || '';
|
||||||
|
|
||||||
|
if ( !attValue && emptyAttribs[ attName ] )
|
||||||
|
attribs[ attName ] = attName;
|
||||||
|
else
|
||||||
|
attribs[ attName ] = attValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.onTagOpen( tagName, attribs, selfClosing );
|
||||||
|
|
||||||
|
// Open CDATA mode when finding the appropriate tags.
|
||||||
|
if ( !cdata && CKEDITOR.dtd.$cdata[ tagName ] )
|
||||||
|
cdata = [];
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Comment
|
||||||
|
if ( ( tagName = parts[ 2 ] ) )
|
||||||
|
this.onComment( tagName );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( html.length > nextIndex )
|
||||||
|
this.onText( html.substring( nextIndex, html.length ) );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
145
htdocs/includes/ckeditor/_source/core/htmlparser/basicwriter.js
Normal file
145
htdocs/includes/ckeditor/_source/core/htmlparser/basicwriter.js
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
CKEDITOR.htmlParser.basicWriter = CKEDITOR.tools.createClass(
|
||||||
|
{
|
||||||
|
$ : function()
|
||||||
|
{
|
||||||
|
this._ =
|
||||||
|
{
|
||||||
|
output : []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
proto :
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Writes the tag opening part for a opener tag.
|
||||||
|
* @param {String} tagName The element name for this tag.
|
||||||
|
* @param {Object} attributes The attributes defined for this tag. The
|
||||||
|
* attributes could be used to inspect the tag.
|
||||||
|
* @example
|
||||||
|
* // Writes "<p".
|
||||||
|
* writer.openTag( 'p', { class : 'MyClass', id : 'MyId' } );
|
||||||
|
*/
|
||||||
|
openTag : function( tagName, attributes )
|
||||||
|
{
|
||||||
|
this._.output.push( '<', tagName );
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the tag closing part for a opener tag.
|
||||||
|
* @param {String} tagName The element name for this tag.
|
||||||
|
* @param {Boolean} isSelfClose Indicates that this is a self-closing tag,
|
||||||
|
* like "br" or "img".
|
||||||
|
* @example
|
||||||
|
* // Writes ">".
|
||||||
|
* writer.openTagClose( 'p', false );
|
||||||
|
* @example
|
||||||
|
* // Writes " />".
|
||||||
|
* writer.openTagClose( 'br', true );
|
||||||
|
*/
|
||||||
|
openTagClose : function( tagName, isSelfClose )
|
||||||
|
{
|
||||||
|
if ( isSelfClose )
|
||||||
|
this._.output.push( ' />' );
|
||||||
|
else
|
||||||
|
this._.output.push( '>' );
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes an attribute. This function should be called after opening the
|
||||||
|
* tag with {@link #openTagClose}.
|
||||||
|
* @param {String} attName The attribute name.
|
||||||
|
* @param {String} attValue The attribute value.
|
||||||
|
* @example
|
||||||
|
* // Writes ' class="MyClass"'.
|
||||||
|
* writer.attribute( 'class', 'MyClass' );
|
||||||
|
*/
|
||||||
|
attribute : function( attName, attValue )
|
||||||
|
{
|
||||||
|
// Browsers don't always escape special character in attribute values. (#4683, #4719).
|
||||||
|
if ( typeof attValue == 'string' )
|
||||||
|
attValue = CKEDITOR.tools.htmlEncodeAttr( attValue );
|
||||||
|
|
||||||
|
this._.output.push( ' ', attName, '="', attValue, '"' );
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes a closer tag.
|
||||||
|
* @param {String} tagName The element name for this tag.
|
||||||
|
* @example
|
||||||
|
* // Writes "</p>".
|
||||||
|
* writer.closeTag( 'p' );
|
||||||
|
*/
|
||||||
|
closeTag : function( tagName )
|
||||||
|
{
|
||||||
|
this._.output.push( '</', tagName, '>' );
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes text.
|
||||||
|
* @param {String} text The text value
|
||||||
|
* @example
|
||||||
|
* // Writes "Hello Word".
|
||||||
|
* writer.text( 'Hello Word' );
|
||||||
|
*/
|
||||||
|
text : function( text )
|
||||||
|
{
|
||||||
|
this._.output.push( text );
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes a comment.
|
||||||
|
* @param {String} comment The comment text.
|
||||||
|
* @example
|
||||||
|
* // Writes "<!-- My comment -->".
|
||||||
|
* writer.comment( ' My comment ' );
|
||||||
|
*/
|
||||||
|
comment : function( comment )
|
||||||
|
{
|
||||||
|
this._.output.push( '<!--', comment, '-->' );
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes any kind of data to the ouput.
|
||||||
|
* @example
|
||||||
|
* writer.write( 'This is an <b>example</b>.' );
|
||||||
|
*/
|
||||||
|
write : function( data )
|
||||||
|
{
|
||||||
|
this._.output.push( data );
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Empties the current output buffer.
|
||||||
|
* @example
|
||||||
|
* writer.reset();
|
||||||
|
*/
|
||||||
|
reset : function()
|
||||||
|
{
|
||||||
|
this._.output = [];
|
||||||
|
this._.indent = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Empties the current output buffer.
|
||||||
|
* @param {Boolean} reset Indicates that the {@link reset} function is to
|
||||||
|
* be automatically called after retrieving the HTML.
|
||||||
|
* @returns {String} The HTML written to the writer so far.
|
||||||
|
* @example
|
||||||
|
* var html = writer.getHtml();
|
||||||
|
*/
|
||||||
|
getHtml : function( reset )
|
||||||
|
{
|
||||||
|
var html = this._.output.join( '' );
|
||||||
|
|
||||||
|
if ( reset )
|
||||||
|
this.reset();
|
||||||
|
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
43
htdocs/includes/ckeditor/_source/core/htmlparser/cdata.js
Normal file
43
htdocs/includes/ckeditor/_source/core/htmlparser/cdata.js
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function()
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A lightweight representation of HTML text.
|
||||||
|
* @constructor
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.htmlParser.cdata = function( value )
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The CDATA value.
|
||||||
|
* @type String
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
this.value = value;
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.htmlParser.cdata.prototype =
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* CDATA has the same type as {@link CKEDITOR.htmlParser.text} This is
|
||||||
|
* a constant value set to {@link CKEDITOR.NODE_TEXT}.
|
||||||
|
* @type Number
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
type : CKEDITOR.NODE_TEXT,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes write the CDATA with no special manipulations.
|
||||||
|
* @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
|
||||||
|
*/
|
||||||
|
writeHtml : function( writer )
|
||||||
|
{
|
||||||
|
writer.write( this.value );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
60
htdocs/includes/ckeditor/_source/core/htmlparser/comment.js
Normal file
60
htdocs/includes/ckeditor/_source/core/htmlparser/comment.js
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A lightweight representation of an HTML comment.
|
||||||
|
* @constructor
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.htmlParser.comment = function( value )
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The comment text.
|
||||||
|
* @type String
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
this.value = value;
|
||||||
|
|
||||||
|
/** @private */
|
||||||
|
this._ =
|
||||||
|
{
|
||||||
|
isBlockLike : false
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.htmlParser.comment.prototype =
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The node type. This is a constant value set to {@link CKEDITOR.NODE_COMMENT}.
|
||||||
|
* @type Number
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
type : CKEDITOR.NODE_COMMENT,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the HTML representation of this comment to a CKEDITOR.htmlWriter.
|
||||||
|
* @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
writeHtml : function( writer, filter )
|
||||||
|
{
|
||||||
|
var comment = this.value;
|
||||||
|
|
||||||
|
if ( filter )
|
||||||
|
{
|
||||||
|
if ( !( comment = filter.onComment( comment, this ) ) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( typeof comment != 'string' )
|
||||||
|
{
|
||||||
|
comment.parent = this.parent;
|
||||||
|
comment.writeHtml( writer, filter );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.comment( comment );
|
||||||
|
}
|
||||||
|
};
|
||||||
306
htdocs/includes/ckeditor/_source/core/htmlparser/element.js
Normal file
306
htdocs/includes/ckeditor/_source/core/htmlparser/element.js
Normal file
@ -0,0 +1,306 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A lightweight representation of an HTML element.
|
||||||
|
* @param {String} name The element name.
|
||||||
|
* @param {Object} attributes And object holding all attributes defined for
|
||||||
|
* this element.
|
||||||
|
* @constructor
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.htmlParser.element = function( name, attributes )
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The element name.
|
||||||
|
* @type String
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
this.name = name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds the attributes defined for this element.
|
||||||
|
* @type Object
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
this.attributes = attributes || {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The nodes that are direct children of this element.
|
||||||
|
* @type Array
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
this.children = [];
|
||||||
|
|
||||||
|
// Reveal the real semantic of our internal custom tag name (#6639),
|
||||||
|
// when resolving whether it's block like.
|
||||||
|
var realName = name || '',
|
||||||
|
prefixed = realName.match( /^cke:(.*)/ );
|
||||||
|
prefixed && ( realName = prefixed[ 1 ] );
|
||||||
|
|
||||||
|
var isBlockLike = !!( CKEDITOR.dtd.$nonBodyContent[ realName ]
|
||||||
|
|| CKEDITOR.dtd.$block[ realName ]
|
||||||
|
|| CKEDITOR.dtd.$listItem[ realName ]
|
||||||
|
|| CKEDITOR.dtd.$tableContent[ realName ]
|
||||||
|
|| CKEDITOR.dtd.$nonEditable[ realName ]
|
||||||
|
|| realName == 'br' );
|
||||||
|
|
||||||
|
this.isEmpty = !!CKEDITOR.dtd.$empty[ name ];
|
||||||
|
this.isUnknown = !CKEDITOR.dtd[ name ];
|
||||||
|
|
||||||
|
/** @private */
|
||||||
|
this._ =
|
||||||
|
{
|
||||||
|
isBlockLike : isBlockLike,
|
||||||
|
hasInlineStarted : this.isEmpty || !isBlockLike
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object presentation of CSS style declaration text.
|
||||||
|
* @param {CKEDITOR.htmlParser.element|String} elementOrStyleText A html parser element or the inline style text.
|
||||||
|
*/
|
||||||
|
CKEDITOR.htmlParser.cssStyle = function()
|
||||||
|
{
|
||||||
|
var styleText,
|
||||||
|
arg = arguments[ 0 ],
|
||||||
|
rules = {};
|
||||||
|
|
||||||
|
styleText = arg instanceof CKEDITOR.htmlParser.element ? arg.attributes.style : arg;
|
||||||
|
|
||||||
|
// html-encoded quote might be introduced by 'font-family'
|
||||||
|
// from MS-Word which confused the following regexp. e.g.
|
||||||
|
//'font-family: "Lucida, Console"'
|
||||||
|
( styleText || '' )
|
||||||
|
.replace( /"/g, '"' )
|
||||||
|
.replace( /\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g,
|
||||||
|
function( match, name, value )
|
||||||
|
{
|
||||||
|
name == 'font-family' && ( value = value.replace( /["']/g, '' ) );
|
||||||
|
rules[ name.toLowerCase() ] = value;
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
|
||||||
|
rules : rules,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply the styles onto the specified element or object.
|
||||||
|
* @param {CKEDITOR.htmlParser.element|CKEDITOR.dom.element|Object} obj
|
||||||
|
*/
|
||||||
|
populate : function( obj )
|
||||||
|
{
|
||||||
|
var style = this.toString();
|
||||||
|
if ( style )
|
||||||
|
{
|
||||||
|
obj instanceof CKEDITOR.dom.element ?
|
||||||
|
obj.setAttribute( 'style', style ) :
|
||||||
|
obj instanceof CKEDITOR.htmlParser.element ?
|
||||||
|
obj.attributes.style = style :
|
||||||
|
obj.style = style;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
toString : function()
|
||||||
|
{
|
||||||
|
var output = [];
|
||||||
|
for ( var i in rules )
|
||||||
|
rules[ i ] && output.push( i, ':', rules[ i ], ';' );
|
||||||
|
return output.join( '' );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
(function()
|
||||||
|
{
|
||||||
|
// Used to sort attribute entries in an array, where the first element of
|
||||||
|
// each object is the attribute name.
|
||||||
|
var sortAttribs = function( a, b )
|
||||||
|
{
|
||||||
|
a = a[0];
|
||||||
|
b = b[0];
|
||||||
|
return a < b ? -1 : a > b ? 1 : 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.htmlParser.element.prototype =
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The node type. This is a constant value set to {@link CKEDITOR.NODE_ELEMENT}.
|
||||||
|
* @type Number
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
type : CKEDITOR.NODE_ELEMENT,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a node to the element children list.
|
||||||
|
* @param {Object} node The node to be added. It can be any of of the
|
||||||
|
* following types: {@link CKEDITOR.htmlParser.element},
|
||||||
|
* {@link CKEDITOR.htmlParser.text} and
|
||||||
|
* {@link CKEDITOR.htmlParser.comment}.
|
||||||
|
* @function
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
add : CKEDITOR.htmlParser.fragment.prototype.add,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clone this element.
|
||||||
|
* @returns {CKEDITOR.htmlParser.element} The element clone.
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
clone : function()
|
||||||
|
{
|
||||||
|
return new CKEDITOR.htmlParser.element( this.name, this.attributes );
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the element HTML to a CKEDITOR.htmlWriter.
|
||||||
|
* @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
writeHtml : function( writer, filter )
|
||||||
|
{
|
||||||
|
var attributes = this.attributes;
|
||||||
|
|
||||||
|
// Ignore cke: prefixes when writing HTML.
|
||||||
|
var element = this,
|
||||||
|
writeName = element.name,
|
||||||
|
a, newAttrName, value;
|
||||||
|
|
||||||
|
var isChildrenFiltered;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Providing an option for bottom-up filtering order ( element
|
||||||
|
* children to be pre-filtered before the element itself ).
|
||||||
|
*/
|
||||||
|
element.filterChildren = function()
|
||||||
|
{
|
||||||
|
if ( !isChildrenFiltered )
|
||||||
|
{
|
||||||
|
var writer = new CKEDITOR.htmlParser.basicWriter();
|
||||||
|
CKEDITOR.htmlParser.fragment.prototype.writeChildrenHtml.call( element, writer, filter );
|
||||||
|
element.children = new CKEDITOR.htmlParser.fragment.fromHtml( writer.getHtml(), 0, element.clone() ).children;
|
||||||
|
isChildrenFiltered = 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if ( filter )
|
||||||
|
{
|
||||||
|
while ( true )
|
||||||
|
{
|
||||||
|
if ( !( writeName = filter.onElementName( writeName ) ) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
element.name = writeName;
|
||||||
|
|
||||||
|
if ( !( element = filter.onElement( element ) ) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
element.parent = this.parent;
|
||||||
|
|
||||||
|
if ( element.name == writeName )
|
||||||
|
break;
|
||||||
|
|
||||||
|
// If the element has been replaced with something of a
|
||||||
|
// different type, then make the replacement write itself.
|
||||||
|
if ( element.type != CKEDITOR.NODE_ELEMENT )
|
||||||
|
{
|
||||||
|
element.writeHtml( writer, filter );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
writeName = element.name;
|
||||||
|
|
||||||
|
// This indicate that the element has been dropped by
|
||||||
|
// filter but not the children.
|
||||||
|
if ( !writeName )
|
||||||
|
{
|
||||||
|
// Fix broken parent refs.
|
||||||
|
for ( var c = 0, length = this.children.length ; c < length ; c++ )
|
||||||
|
this.children[ c ].parent = element.parent;
|
||||||
|
|
||||||
|
this.writeChildrenHtml.call( element, writer, isChildrenFiltered ? null : filter );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The element may have been changed, so update the local
|
||||||
|
// references.
|
||||||
|
attributes = element.attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Open element tag.
|
||||||
|
writer.openTag( writeName, attributes );
|
||||||
|
|
||||||
|
// Copy all attributes to an array.
|
||||||
|
var attribsArray = [];
|
||||||
|
// Iterate over the attributes twice since filters may alter
|
||||||
|
// other attributes.
|
||||||
|
for ( var i = 0 ; i < 2; i++ )
|
||||||
|
{
|
||||||
|
for ( a in attributes )
|
||||||
|
{
|
||||||
|
newAttrName = a;
|
||||||
|
value = attributes[ a ];
|
||||||
|
if ( i == 1 )
|
||||||
|
attribsArray.push( [ a, value ] );
|
||||||
|
else if ( filter )
|
||||||
|
{
|
||||||
|
while ( true )
|
||||||
|
{
|
||||||
|
if ( !( newAttrName = filter.onAttributeName( a ) ) )
|
||||||
|
{
|
||||||
|
delete attributes[ a ];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if ( newAttrName != a )
|
||||||
|
{
|
||||||
|
delete attributes[ a ];
|
||||||
|
a = newAttrName;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ( newAttrName )
|
||||||
|
{
|
||||||
|
if ( ( value = filter.onAttribute( element, newAttrName, value ) ) === false )
|
||||||
|
delete attributes[ newAttrName ];
|
||||||
|
else
|
||||||
|
attributes [ newAttrName ] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Sort the attributes by name.
|
||||||
|
if ( writer.sortAttributes )
|
||||||
|
attribsArray.sort( sortAttribs );
|
||||||
|
|
||||||
|
// Send the attributes.
|
||||||
|
var len = attribsArray.length;
|
||||||
|
for ( i = 0 ; i < len ; i++ )
|
||||||
|
{
|
||||||
|
var attrib = attribsArray[ i ];
|
||||||
|
writer.attribute( attrib[0], attrib[1] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close the tag.
|
||||||
|
writer.openTagClose( writeName, element.isEmpty );
|
||||||
|
|
||||||
|
if ( !element.isEmpty )
|
||||||
|
{
|
||||||
|
this.writeChildrenHtml.call( element, writer, isChildrenFiltered ? null : filter );
|
||||||
|
// Close the element.
|
||||||
|
writer.closeTag( writeName );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
writeChildrenHtml : function( writer, filter )
|
||||||
|
{
|
||||||
|
// Send children.
|
||||||
|
CKEDITOR.htmlParser.fragment.prototype.writeChildrenHtml.apply( this, arguments );
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
288
htdocs/includes/ckeditor/_source/core/htmlparser/filter.js
Normal file
288
htdocs/includes/ckeditor/_source/core/htmlparser/filter.js
Normal file
@ -0,0 +1,288 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function()
|
||||||
|
{
|
||||||
|
CKEDITOR.htmlParser.filter = CKEDITOR.tools.createClass(
|
||||||
|
{
|
||||||
|
$ : function( rules )
|
||||||
|
{
|
||||||
|
this._ =
|
||||||
|
{
|
||||||
|
elementNames : [],
|
||||||
|
attributeNames : [],
|
||||||
|
elements : { $length : 0 },
|
||||||
|
attributes : { $length : 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
if ( rules )
|
||||||
|
this.addRules( rules, 10 );
|
||||||
|
},
|
||||||
|
|
||||||
|
proto :
|
||||||
|
{
|
||||||
|
addRules : function( rules, priority )
|
||||||
|
{
|
||||||
|
if ( typeof priority != 'number' )
|
||||||
|
priority = 10;
|
||||||
|
|
||||||
|
// Add the elementNames.
|
||||||
|
addItemsToList( this._.elementNames, rules.elementNames, priority );
|
||||||
|
|
||||||
|
// Add the attributeNames.
|
||||||
|
addItemsToList( this._.attributeNames, rules.attributeNames, priority );
|
||||||
|
|
||||||
|
// Add the elements.
|
||||||
|
addNamedItems( this._.elements, rules.elements, priority );
|
||||||
|
|
||||||
|
// Add the attributes.
|
||||||
|
addNamedItems( this._.attributes, rules.attributes, priority );
|
||||||
|
|
||||||
|
// Add the text.
|
||||||
|
this._.text = transformNamedItem( this._.text, rules.text, priority ) || this._.text;
|
||||||
|
|
||||||
|
// Add the comment.
|
||||||
|
this._.comment = transformNamedItem( this._.comment, rules.comment, priority ) || this._.comment;
|
||||||
|
|
||||||
|
// Add root fragment.
|
||||||
|
this._.root = transformNamedItem( this._.root, rules.root, priority ) || this._.root;
|
||||||
|
},
|
||||||
|
|
||||||
|
onElementName : function( name )
|
||||||
|
{
|
||||||
|
return filterName( name, this._.elementNames );
|
||||||
|
},
|
||||||
|
|
||||||
|
onAttributeName : function( name )
|
||||||
|
{
|
||||||
|
return filterName( name, this._.attributeNames );
|
||||||
|
},
|
||||||
|
|
||||||
|
onText : function( text )
|
||||||
|
{
|
||||||
|
var textFilter = this._.text;
|
||||||
|
return textFilter ? textFilter.filter( text ) : text;
|
||||||
|
},
|
||||||
|
|
||||||
|
onComment : function( commentText, comment )
|
||||||
|
{
|
||||||
|
var textFilter = this._.comment;
|
||||||
|
return textFilter ? textFilter.filter( commentText, comment ) : commentText;
|
||||||
|
},
|
||||||
|
|
||||||
|
onFragment : function( element )
|
||||||
|
{
|
||||||
|
var rootFilter = this._.root;
|
||||||
|
return rootFilter ? rootFilter.filter( element ) : element;
|
||||||
|
},
|
||||||
|
|
||||||
|
onElement : function( element )
|
||||||
|
{
|
||||||
|
// We must apply filters set to the specific element name as
|
||||||
|
// well as those set to the generic $ name. So, add both to an
|
||||||
|
// array and process them in a small loop.
|
||||||
|
var filters = [ this._.elements[ '^' ], this._.elements[ element.name ], this._.elements.$ ],
|
||||||
|
filter, ret;
|
||||||
|
|
||||||
|
for ( var i = 0 ; i < 3 ; i++ )
|
||||||
|
{
|
||||||
|
filter = filters[ i ];
|
||||||
|
if ( filter )
|
||||||
|
{
|
||||||
|
ret = filter.filter( element, this );
|
||||||
|
|
||||||
|
if ( ret === false )
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if ( ret && ret != element )
|
||||||
|
return this.onNode( ret );
|
||||||
|
|
||||||
|
// The non-root element has been dismissed by one of the filters.
|
||||||
|
if ( element.parent && !element.name )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return element;
|
||||||
|
},
|
||||||
|
|
||||||
|
onNode : function( node )
|
||||||
|
{
|
||||||
|
var type = node.type;
|
||||||
|
|
||||||
|
return type == CKEDITOR.NODE_ELEMENT ? this.onElement( node ) :
|
||||||
|
type == CKEDITOR.NODE_TEXT ? new CKEDITOR.htmlParser.text( this.onText( node.value ) ) :
|
||||||
|
type == CKEDITOR.NODE_COMMENT ? new CKEDITOR.htmlParser.comment( this.onComment( node.value ) ):
|
||||||
|
null;
|
||||||
|
},
|
||||||
|
|
||||||
|
onAttribute : function( element, name, value )
|
||||||
|
{
|
||||||
|
var filter = this._.attributes[ name ];
|
||||||
|
|
||||||
|
if ( filter )
|
||||||
|
{
|
||||||
|
var ret = filter.filter( value, element, this );
|
||||||
|
|
||||||
|
if ( ret === false )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( typeof ret != 'undefined' )
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function filterName( name, filters )
|
||||||
|
{
|
||||||
|
for ( var i = 0 ; name && i < filters.length ; i++ )
|
||||||
|
{
|
||||||
|
var filter = filters[ i ];
|
||||||
|
name = name.replace( filter[ 0 ], filter[ 1 ] );
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
function addItemsToList( list, items, priority )
|
||||||
|
{
|
||||||
|
if ( typeof items == 'function' )
|
||||||
|
items = [ items ];
|
||||||
|
|
||||||
|
var i, j,
|
||||||
|
listLength = list.length,
|
||||||
|
itemsLength = items && items.length;
|
||||||
|
|
||||||
|
if ( itemsLength )
|
||||||
|
{
|
||||||
|
// Find the index to insert the items at.
|
||||||
|
for ( i = 0 ; i < listLength && list[ i ].pri < priority ; i++ )
|
||||||
|
{ /*jsl:pass*/ }
|
||||||
|
|
||||||
|
// Add all new items to the list at the specific index.
|
||||||
|
for ( j = itemsLength - 1 ; j >= 0 ; j-- )
|
||||||
|
{
|
||||||
|
var item = items[ j ];
|
||||||
|
if ( item )
|
||||||
|
{
|
||||||
|
item.pri = priority;
|
||||||
|
list.splice( i, 0, item );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addNamedItems( hashTable, items, priority )
|
||||||
|
{
|
||||||
|
if ( items )
|
||||||
|
{
|
||||||
|
for ( var name in items )
|
||||||
|
{
|
||||||
|
var current = hashTable[ name ];
|
||||||
|
|
||||||
|
hashTable[ name ] =
|
||||||
|
transformNamedItem(
|
||||||
|
current,
|
||||||
|
items[ name ],
|
||||||
|
priority );
|
||||||
|
|
||||||
|
if ( !current )
|
||||||
|
hashTable.$length++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function transformNamedItem( current, item, priority )
|
||||||
|
{
|
||||||
|
if ( item )
|
||||||
|
{
|
||||||
|
item.pri = priority;
|
||||||
|
|
||||||
|
if ( current )
|
||||||
|
{
|
||||||
|
// If the current item is not an Array, transform it.
|
||||||
|
if ( !current.splice )
|
||||||
|
{
|
||||||
|
if ( current.pri > priority )
|
||||||
|
current = [ item, current ];
|
||||||
|
else
|
||||||
|
current = [ current, item ];
|
||||||
|
|
||||||
|
current.filter = callItems;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
addItemsToList( current, item, priority );
|
||||||
|
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item.filter = item;
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Invoke filters sequentially on the array, break the iteration
|
||||||
|
// when it doesn't make sense to continue anymore.
|
||||||
|
function callItems( currentEntry )
|
||||||
|
{
|
||||||
|
var isNode = currentEntry.type
|
||||||
|
|| currentEntry instanceof CKEDITOR.htmlParser.fragment;
|
||||||
|
|
||||||
|
for ( var i = 0 ; i < this.length ; i++ )
|
||||||
|
{
|
||||||
|
// Backup the node info before filtering.
|
||||||
|
if ( isNode )
|
||||||
|
{
|
||||||
|
var orgType = currentEntry.type,
|
||||||
|
orgName = currentEntry.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
var item = this[ i ],
|
||||||
|
ret = item.apply( window, arguments );
|
||||||
|
|
||||||
|
if ( ret === false )
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
// We're filtering node (element/fragment).
|
||||||
|
if ( isNode )
|
||||||
|
{
|
||||||
|
// No further filtering if it's not anymore
|
||||||
|
// fitable for the subsequent filters.
|
||||||
|
if ( ret && ( ret.name != orgName
|
||||||
|
|| ret.type != orgType ) )
|
||||||
|
{
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Filtering value (nodeName/textValue/attrValue).
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// No further filtering if it's not
|
||||||
|
// any more values.
|
||||||
|
if ( typeof ret != 'string' )
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret != undefined && ( currentEntry = ret );
|
||||||
|
}
|
||||||
|
|
||||||
|
return currentEntry;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
// "entities" plugin
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
text : function( text )
|
||||||
|
{
|
||||||
|
// TODO : Process entities.
|
||||||
|
return text.toUpperCase();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
*/
|
||||||
537
htdocs/includes/ckeditor/_source/core/htmlparser/fragment.js
Normal file
537
htdocs/includes/ckeditor/_source/core/htmlparser/fragment.js
Normal file
@ -0,0 +1,537 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A lightweight representation of an HTML DOM structure.
|
||||||
|
* @constructor
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
CKEDITOR.htmlParser.fragment = function()
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The nodes contained in the root of this fragment.
|
||||||
|
* @type Array
|
||||||
|
* @example
|
||||||
|
* var fragment = CKEDITOR.htmlParser.fragment.fromHtml( '<b>Sample</b> Text' );
|
||||||
|
* alert( fragment.children.length ); "2"
|
||||||
|
*/
|
||||||
|
this.children = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the fragment parent. Should always be null.
|
||||||
|
* @type Object
|
||||||
|
* @default null
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
this.parent = null;
|
||||||
|
|
||||||
|
/** @private */
|
||||||
|
this._ =
|
||||||
|
{
|
||||||
|
isBlockLike : true,
|
||||||
|
hasInlineStarted : false
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
(function()
|
||||||
|
{
|
||||||
|
// Block-level elements whose internal structure should be respected during
|
||||||
|
// parser fixing.
|
||||||
|
var nonBreakingBlocks = CKEDITOR.tools.extend( { table:1,ul:1,ol:1,dl:1 }, CKEDITOR.dtd.table, CKEDITOR.dtd.ul, CKEDITOR.dtd.ol, CKEDITOR.dtd.dl );
|
||||||
|
|
||||||
|
// IE < 8 don't output the close tag on definition list items. (#6975)
|
||||||
|
var optionalCloseTags = CKEDITOR.env.ie && CKEDITOR.env.version < 8 ? { dd : 1, dt :1 } : {};
|
||||||
|
|
||||||
|
var listBlocks = { ol:1, ul:1 };
|
||||||
|
|
||||||
|
// Dtd of the fragment element, basically it accept anything except for intermediate structure, e.g. orphan <li>.
|
||||||
|
var rootDtd = CKEDITOR.tools.extend( {}, { html: 1 }, CKEDITOR.dtd.html, CKEDITOR.dtd.body, CKEDITOR.dtd.head, { style:1,script:1 } );
|
||||||
|
|
||||||
|
function isRemoveEmpty( node )
|
||||||
|
{
|
||||||
|
// Empty link is to be removed when empty but not anchor. (#7894)
|
||||||
|
return node.name == 'a' && node.attributes.href
|
||||||
|
|| CKEDITOR.dtd.$removeEmpty[ node.name ];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a {@link CKEDITOR.htmlParser.fragment} from an HTML string.
|
||||||
|
* @param {String} fragmentHtml The HTML to be parsed, filling the fragment.
|
||||||
|
* @param {Number} [fixForBody=false] Wrap body with specified element if needed.
|
||||||
|
* @param {CKEDITOR.htmlParser.element} contextNode Parse the html as the content of this element.
|
||||||
|
* @returns CKEDITOR.htmlParser.fragment The fragment created.
|
||||||
|
* @example
|
||||||
|
* var fragment = CKEDITOR.htmlParser.fragment.fromHtml( '<b>Sample</b> Text' );
|
||||||
|
* alert( fragment.children[0].name ); "b"
|
||||||
|
* alert( fragment.children[1].value ); " Text"
|
||||||
|
*/
|
||||||
|
CKEDITOR.htmlParser.fragment.fromHtml = function( fragmentHtml, fixForBody, contextNode )
|
||||||
|
{
|
||||||
|
var parser = new CKEDITOR.htmlParser(),
|
||||||
|
fragment = contextNode || new CKEDITOR.htmlParser.fragment(),
|
||||||
|
pendingInline = [],
|
||||||
|
pendingBRs = [],
|
||||||
|
currentNode = fragment,
|
||||||
|
// Indicate we're inside a <textarea> element, spaces should be touched differently.
|
||||||
|
inTextarea = false,
|
||||||
|
// Indicate we're inside a <pre> element, spaces should be touched differently.
|
||||||
|
inPre = false;
|
||||||
|
|
||||||
|
function checkPending( newTagName )
|
||||||
|
{
|
||||||
|
var pendingBRsSent;
|
||||||
|
|
||||||
|
if ( pendingInline.length > 0 )
|
||||||
|
{
|
||||||
|
for ( var i = 0 ; i < pendingInline.length ; i++ )
|
||||||
|
{
|
||||||
|
var pendingElement = pendingInline[ i ],
|
||||||
|
pendingName = pendingElement.name,
|
||||||
|
pendingDtd = CKEDITOR.dtd[ pendingName ],
|
||||||
|
currentDtd = currentNode.name && CKEDITOR.dtd[ currentNode.name ];
|
||||||
|
|
||||||
|
if ( ( !currentDtd || currentDtd[ pendingName ] ) && ( !newTagName || !pendingDtd || pendingDtd[ newTagName ] || !CKEDITOR.dtd[ newTagName ] ) )
|
||||||
|
{
|
||||||
|
if ( !pendingBRsSent )
|
||||||
|
{
|
||||||
|
sendPendingBRs();
|
||||||
|
pendingBRsSent = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get a clone for the pending element.
|
||||||
|
pendingElement = pendingElement.clone();
|
||||||
|
|
||||||
|
// Add it to the current node and make it the current,
|
||||||
|
// so the new element will be added inside of it.
|
||||||
|
pendingElement.parent = currentNode;
|
||||||
|
currentNode = pendingElement;
|
||||||
|
|
||||||
|
// Remove the pending element (back the index by one
|
||||||
|
// to properly process the next entry).
|
||||||
|
pendingInline.splice( i, 1 );
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Some element of the same type cannot be nested, flat them,
|
||||||
|
// e.g. <a href="#">foo<a href="#">bar</a></a>. (#7894)
|
||||||
|
if ( pendingName == currentNode.name )
|
||||||
|
addElement( currentNode, currentNode.parent, 1 ), i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendPendingBRs()
|
||||||
|
{
|
||||||
|
while ( pendingBRs.length )
|
||||||
|
addElement( pendingBRs.shift(), currentNode );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Beside of simply append specified element to target, this function also takes
|
||||||
|
* care of other dirty lifts like forcing block in body, trimming spaces at
|
||||||
|
* the block boundaries etc.
|
||||||
|
*
|
||||||
|
* @param {Element} element The element to be added as the last child of {@link target}.
|
||||||
|
* @param {Element} target The parent element to relieve the new node.
|
||||||
|
* @param {Boolean} [moveCurrent=false] Don't change the "currentNode" global unless
|
||||||
|
* there's a return point node specified on the element, otherwise move current onto {@link target} node.
|
||||||
|
*/
|
||||||
|
function addElement( element, target, moveCurrent )
|
||||||
|
{
|
||||||
|
// Ignore any element that has already been added.
|
||||||
|
if ( element.previous !== undefined )
|
||||||
|
return;
|
||||||
|
|
||||||
|
target = target || currentNode || fragment;
|
||||||
|
|
||||||
|
// Current element might be mangled by fix body below,
|
||||||
|
// save it for restore later.
|
||||||
|
var savedCurrent = currentNode;
|
||||||
|
|
||||||
|
// If the target is the fragment and this inline element can't go inside
|
||||||
|
// body (if fixForBody).
|
||||||
|
if ( fixForBody && ( !target.type || target.name == 'body' ) )
|
||||||
|
{
|
||||||
|
var elementName, realElementName;
|
||||||
|
if ( element.attributes
|
||||||
|
&& ( realElementName =
|
||||||
|
element.attributes[ 'data-cke-real-element-type' ] ) )
|
||||||
|
elementName = realElementName;
|
||||||
|
else
|
||||||
|
elementName = element.name;
|
||||||
|
|
||||||
|
if ( elementName && !( elementName in CKEDITOR.dtd.$body || elementName == 'body' || element.isOrphan ) )
|
||||||
|
{
|
||||||
|
// Create a <p> in the fragment.
|
||||||
|
currentNode = target;
|
||||||
|
parser.onTagOpen( fixForBody, {} );
|
||||||
|
|
||||||
|
// The new target now is the <p>.
|
||||||
|
element.returnPoint = target = currentNode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rtrim empty spaces on block end boundary. (#3585)
|
||||||
|
if ( element._.isBlockLike
|
||||||
|
&& element.name != 'pre' && element.name != 'textarea' )
|
||||||
|
{
|
||||||
|
|
||||||
|
var length = element.children.length,
|
||||||
|
lastChild = element.children[ length - 1 ],
|
||||||
|
text;
|
||||||
|
if ( lastChild && lastChild.type == CKEDITOR.NODE_TEXT )
|
||||||
|
{
|
||||||
|
if ( !( text = CKEDITOR.tools.rtrim( lastChild.value ) ) )
|
||||||
|
element.children.length = length -1;
|
||||||
|
else
|
||||||
|
lastChild.value = text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
target.add( element );
|
||||||
|
|
||||||
|
if ( element.name == 'pre' )
|
||||||
|
inPre = false;
|
||||||
|
|
||||||
|
if ( element.name == 'textarea' )
|
||||||
|
inTextarea = false;
|
||||||
|
|
||||||
|
|
||||||
|
if ( element.returnPoint )
|
||||||
|
{
|
||||||
|
currentNode = element.returnPoint;
|
||||||
|
delete element.returnPoint;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
currentNode = moveCurrent ? target : savedCurrent;
|
||||||
|
}
|
||||||
|
|
||||||
|
parser.onTagOpen = function( tagName, attributes, selfClosing, optionalClose )
|
||||||
|
{
|
||||||
|
var element = new CKEDITOR.htmlParser.element( tagName, attributes );
|
||||||
|
|
||||||
|
// "isEmpty" will be always "false" for unknown elements, so we
|
||||||
|
// must force it if the parser has identified it as a selfClosing tag.
|
||||||
|
if ( element.isUnknown && selfClosing )
|
||||||
|
element.isEmpty = true;
|
||||||
|
|
||||||
|
// Check for optional closed elements, including browser quirks and manually opened blocks.
|
||||||
|
element.isOptionalClose = tagName in optionalCloseTags || optionalClose;
|
||||||
|
|
||||||
|
// This is a tag to be removed if empty, so do not add it immediately.
|
||||||
|
if ( isRemoveEmpty( element ) )
|
||||||
|
{
|
||||||
|
pendingInline.push( element );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if ( tagName == 'pre' )
|
||||||
|
inPre = true;
|
||||||
|
else if ( tagName == 'br' && inPre )
|
||||||
|
{
|
||||||
|
currentNode.add( new CKEDITOR.htmlParser.text( '\n' ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if ( tagName == 'textarea' )
|
||||||
|
inTextarea = true;
|
||||||
|
|
||||||
|
if ( tagName == 'br' )
|
||||||
|
{
|
||||||
|
pendingBRs.push( element );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
while( 1 )
|
||||||
|
{
|
||||||
|
var currentName = currentNode.name;
|
||||||
|
|
||||||
|
var currentDtd = currentName ? ( CKEDITOR.dtd[ currentName ]
|
||||||
|
|| ( currentNode._.isBlockLike ? CKEDITOR.dtd.div : CKEDITOR.dtd.span ) )
|
||||||
|
: rootDtd;
|
||||||
|
|
||||||
|
// If the element cannot be child of the current element.
|
||||||
|
if ( !element.isUnknown && !currentNode.isUnknown && !currentDtd[ tagName ] )
|
||||||
|
{
|
||||||
|
// Current node doesn't have a close tag, time for a close
|
||||||
|
// as this element isn't fit in. (#7497)
|
||||||
|
if ( currentNode.isOptionalClose )
|
||||||
|
parser.onTagClose( currentName );
|
||||||
|
// Fixing malformed nested lists by moving it into a previous list item. (#3828)
|
||||||
|
else if ( tagName in listBlocks
|
||||||
|
&& currentName in listBlocks )
|
||||||
|
{
|
||||||
|
var children = currentNode.children,
|
||||||
|
lastChild = children[ children.length - 1 ];
|
||||||
|
|
||||||
|
// Establish the list item if it's not existed.
|
||||||
|
if ( !( lastChild && lastChild.name == 'li' ) )
|
||||||
|
addElement( ( lastChild = new CKEDITOR.htmlParser.element( 'li' ) ), currentNode );
|
||||||
|
|
||||||
|
!element.returnPoint && ( element.returnPoint = currentNode );
|
||||||
|
currentNode = lastChild;
|
||||||
|
}
|
||||||
|
// Establish new list root for orphan list items.
|
||||||
|
else if ( tagName in CKEDITOR.dtd.$listItem && currentName != tagName )
|
||||||
|
parser.onTagOpen( tagName == 'li' ? 'ul' : 'dl', {}, 0, 1 );
|
||||||
|
// We're inside a structural block like table and list, AND the incoming element
|
||||||
|
// is not of the same type (e.g. <td>td1<td>td2</td>), we simply add this new one before it,
|
||||||
|
// and most importantly, return back to here once this element is added,
|
||||||
|
// e.g. <table><tr><td>td1</td><p>p1</p><td>td2</td></tr></table>
|
||||||
|
else if ( currentName in nonBreakingBlocks && currentName != tagName )
|
||||||
|
{
|
||||||
|
!element.returnPoint && ( element.returnPoint = currentNode );
|
||||||
|
currentNode = currentNode.parent;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// The current element is an inline element, which
|
||||||
|
// need to be continued even after the close, so put
|
||||||
|
// it in the pending list.
|
||||||
|
if ( currentName in CKEDITOR.dtd.$inline )
|
||||||
|
pendingInline.unshift( currentNode );
|
||||||
|
|
||||||
|
// The most common case where we just need to close the
|
||||||
|
// current one and append the new one to the parent.
|
||||||
|
if ( currentNode.parent )
|
||||||
|
addElement( currentNode, currentNode.parent, 1 );
|
||||||
|
// We've tried our best to fix the embarrassment here, while
|
||||||
|
// this element still doesn't find it's parent, mark it as
|
||||||
|
// orphan and show our tolerance to it.
|
||||||
|
else
|
||||||
|
{
|
||||||
|
element.isOrphan = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
checkPending( tagName );
|
||||||
|
sendPendingBRs();
|
||||||
|
|
||||||
|
element.parent = currentNode;
|
||||||
|
|
||||||
|
if ( element.isEmpty )
|
||||||
|
addElement( element );
|
||||||
|
else
|
||||||
|
currentNode = element;
|
||||||
|
};
|
||||||
|
|
||||||
|
parser.onTagClose = function( tagName )
|
||||||
|
{
|
||||||
|
// Check if there is any pending tag to be closed.
|
||||||
|
for ( var i = pendingInline.length - 1 ; i >= 0 ; i-- )
|
||||||
|
{
|
||||||
|
// If found, just remove it from the list.
|
||||||
|
if ( tagName == pendingInline[ i ].name )
|
||||||
|
{
|
||||||
|
pendingInline.splice( i, 1 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var pendingAdd = [],
|
||||||
|
newPendingInline = [],
|
||||||
|
candidate = currentNode;
|
||||||
|
|
||||||
|
while ( candidate != fragment && candidate.name != tagName )
|
||||||
|
{
|
||||||
|
// If this is an inline element, add it to the pending list, if we're
|
||||||
|
// really closing one of the parents element later, they will continue
|
||||||
|
// after it.
|
||||||
|
if ( !candidate._.isBlockLike )
|
||||||
|
newPendingInline.unshift( candidate );
|
||||||
|
|
||||||
|
// This node should be added to it's parent at this point. But,
|
||||||
|
// it should happen only if the closing tag is really closing
|
||||||
|
// one of the nodes. So, for now, we just cache it.
|
||||||
|
pendingAdd.push( candidate );
|
||||||
|
|
||||||
|
// Make sure return point is properly restored.
|
||||||
|
candidate = candidate.returnPoint || candidate.parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( candidate != fragment )
|
||||||
|
{
|
||||||
|
// Add all elements that have been found in the above loop.
|
||||||
|
for ( i = 0 ; i < pendingAdd.length ; i++ )
|
||||||
|
{
|
||||||
|
var node = pendingAdd[ i ];
|
||||||
|
addElement( node, node.parent );
|
||||||
|
}
|
||||||
|
|
||||||
|
currentNode = candidate;
|
||||||
|
|
||||||
|
if ( candidate._.isBlockLike )
|
||||||
|
sendPendingBRs();
|
||||||
|
|
||||||
|
addElement( candidate, candidate.parent );
|
||||||
|
|
||||||
|
// The parent should start receiving new nodes now, except if
|
||||||
|
// addElement changed the currentNode.
|
||||||
|
if ( candidate == currentNode )
|
||||||
|
currentNode = currentNode.parent;
|
||||||
|
|
||||||
|
pendingInline = pendingInline.concat( newPendingInline );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( tagName == 'body' )
|
||||||
|
fixForBody = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
parser.onText = function( text )
|
||||||
|
{
|
||||||
|
// Trim empty spaces at beginning of text contents except <pre> and <textarea>.
|
||||||
|
if ( ( !currentNode._.hasInlineStarted || pendingBRs.length ) && !inPre && !inTextarea )
|
||||||
|
{
|
||||||
|
text = CKEDITOR.tools.ltrim( text );
|
||||||
|
|
||||||
|
if ( text.length === 0 )
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var currentName = currentNode.name,
|
||||||
|
currentDtd = currentName ? ( CKEDITOR.dtd[ currentName ]
|
||||||
|
|| ( currentNode._.isBlockLike ?
|
||||||
|
CKEDITOR.dtd.div : CKEDITOR.dtd.span ) ) : rootDtd;
|
||||||
|
|
||||||
|
// Fix orphan text in list/table. (#8540) (#8870)
|
||||||
|
if ( !inTextarea &&
|
||||||
|
!currentDtd [ '#' ] &&
|
||||||
|
currentName in nonBreakingBlocks )
|
||||||
|
{
|
||||||
|
parser.onTagOpen( currentName in listBlocks ? 'li' :
|
||||||
|
currentName == 'dl' ? 'dd' :
|
||||||
|
currentName == 'table' ? 'tr' :
|
||||||
|
currentName == 'tr' ? 'td' : '' );
|
||||||
|
parser.onText( text );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sendPendingBRs();
|
||||||
|
checkPending();
|
||||||
|
|
||||||
|
if ( fixForBody
|
||||||
|
&& ( !currentNode.type || currentNode.name == 'body' )
|
||||||
|
&& CKEDITOR.tools.trim( text ) )
|
||||||
|
{
|
||||||
|
this.onTagOpen( fixForBody, {}, 0, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shrinking consequential spaces into one single for all elements
|
||||||
|
// text contents.
|
||||||
|
if ( !inPre && !inTextarea )
|
||||||
|
text = text.replace( /[\t\r\n ]{2,}|[\t\r\n]/g, ' ' );
|
||||||
|
|
||||||
|
currentNode.add( new CKEDITOR.htmlParser.text( text ) );
|
||||||
|
};
|
||||||
|
|
||||||
|
parser.onCDATA = function( cdata )
|
||||||
|
{
|
||||||
|
currentNode.add( new CKEDITOR.htmlParser.cdata( cdata ) );
|
||||||
|
};
|
||||||
|
|
||||||
|
parser.onComment = function( comment )
|
||||||
|
{
|
||||||
|
sendPendingBRs();
|
||||||
|
checkPending();
|
||||||
|
currentNode.add( new CKEDITOR.htmlParser.comment( comment ) );
|
||||||
|
};
|
||||||
|
|
||||||
|
// Parse it.
|
||||||
|
parser.parse( fragmentHtml );
|
||||||
|
|
||||||
|
// Send all pending BRs except one, which we consider a unwanted bogus. (#5293)
|
||||||
|
sendPendingBRs( !CKEDITOR.env.ie && 1 );
|
||||||
|
|
||||||
|
// Close all pending nodes, make sure return point is properly restored.
|
||||||
|
while ( currentNode != fragment )
|
||||||
|
addElement( currentNode, currentNode.parent, 1 );
|
||||||
|
|
||||||
|
return fragment;
|
||||||
|
};
|
||||||
|
|
||||||
|
CKEDITOR.htmlParser.fragment.prototype =
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Adds a node to this fragment.
|
||||||
|
* @param {Object} node The node to be added. It can be any of of the
|
||||||
|
* following types: {@link CKEDITOR.htmlParser.element},
|
||||||
|
* {@link CKEDITOR.htmlParser.text} and
|
||||||
|
* {@link CKEDITOR.htmlParser.comment}.
|
||||||
|
* @param {Number} [index] From where the insertion happens.
|
||||||
|
* @example
|
||||||
|
*/
|
||||||
|
add : function( node, index )
|
||||||
|
{
|
||||||
|
isNaN( index ) && ( index = this.children.length );
|
||||||
|
|
||||||
|
var previous = index > 0 ? this.children[ index - 1 ] : null;
|
||||||
|
if ( previous )
|
||||||
|
{
|
||||||
|
// If the block to be appended is following text, trim spaces at
|
||||||
|
// the right of it.
|
||||||
|
if ( node._.isBlockLike && previous.type == CKEDITOR.NODE_TEXT )
|
||||||
|
{
|
||||||
|
previous.value = CKEDITOR.tools.rtrim( previous.value );
|
||||||
|
|
||||||
|
// If we have completely cleared the previous node.
|
||||||
|
if ( previous.value.length === 0 )
|
||||||
|
{
|
||||||
|
// Remove it from the list and add the node again.
|
||||||
|
this.children.pop();
|
||||||
|
this.add( node );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
previous.next = node;
|
||||||
|
}
|
||||||
|
|
||||||
|
node.previous = previous;
|
||||||
|
node.parent = this;
|
||||||
|
|
||||||
|
this.children.splice( index, 0, node );
|
||||||
|
|
||||||
|
this._.hasInlineStarted = node.type == CKEDITOR.NODE_TEXT || ( node.type == CKEDITOR.NODE_ELEMENT && !node._.isBlockLike );
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the fragment HTML to a CKEDITOR.htmlWriter.
|
||||||
|
* @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
|
||||||
|
* @example
|
||||||
|
* var writer = new CKEDITOR.htmlWriter();
|
||||||
|
* var fragment = CKEDITOR.htmlParser.fragment.fromHtml( '<P><B>Example' );
|
||||||
|
* fragment.writeHtml( writer )
|
||||||
|
* alert( writer.getHtml() ); "<p><b>Example</b></p>"
|
||||||
|
*/
|
||||||
|
writeHtml : function( writer, filter )
|
||||||
|
{
|
||||||
|
var isChildrenFiltered;
|
||||||
|
this.filterChildren = function()
|
||||||
|
{
|
||||||
|
var writer = new CKEDITOR.htmlParser.basicWriter();
|
||||||
|
this.writeChildrenHtml.call( this, writer, filter, true );
|
||||||
|
var html = writer.getHtml();
|
||||||
|
this.children = new CKEDITOR.htmlParser.fragment.fromHtml( html ).children;
|
||||||
|
isChildrenFiltered = 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Filtering the root fragment before anything else.
|
||||||
|
!this.name && filter && filter.onFragment( this );
|
||||||
|
|
||||||
|
this.writeChildrenHtml( writer, isChildrenFiltered ? null : filter );
|
||||||
|
},
|
||||||
|
|
||||||
|
writeChildrenHtml : function( writer, filter )
|
||||||
|
{
|
||||||
|
for ( var i = 0 ; i < this.children.length ; i++ )
|
||||||
|
this.children[i].writeHtml( writer, filter );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user