Compare commits

..

105 Commits
3.3.2 ... 3.3

Author SHA1 Message Date
Laurent Destailleur
ab2517d538 Fix: Removed tables of external modules 2014-08-06 10:36:44 +02:00
Laurent Destailleur
9fc440df7b Fix phpunit to be compatible with new version of phpunit 2014-05-02 00:08:34 +02:00
Laurent Destailleur
f652a4d807 Script to prepare 3.3.5 2014-03-09 02:08:13 +01:00
Laurent Destailleur
a6bb785b5f Fix: Compatibility with v4 of ckeditor (for debian) 2014-03-08 14:06:01 +01:00
Laurent Destailleur
555a49d66e Update doc 2014-01-05 01:20:27 +01:00
Laurent Destailleur
5a7fe6b4a7 Fix: Change to make debian package ok despite removal of ckeditor
package.
2014-01-05 01:17:38 +01:00
Laurent Destailleur
0e54780377 Fix: Update doc and packager for doliwamp
Conflicts:
	build/exe/doliwamp/doliwamp.iss

Conflicts:
	build/exe/doliwamp/doliwamp.iss

Conflicts:
	build/exe/doliwamp/doliwamp.iss
2013-12-31 15:41:25 +01:00
Laurent Destailleur
7fc052ce19 More prerequisites to check to run makepack-dolibarr to build debian
package (check on dpatch too).
2013-12-31 15:27:15 +01:00
Laurent Destailleur
a59a0151fb Fix: Removed analytics tags 2013-12-30 12:35:32 +01:00
Laurent Destailleur
fce34301f9 More test to avoid errors when env is not complete. 2013-12-26 19:39:29 +01:00
Laurent Destailleur
1f3f6cc7b8 Fix: Avoid to have external package into standard distribution 2013-12-14 02:55:12 +01:00
Laurent Destailleur
565fb615bc Update gitignore 2013-12-09 01:41:48 +01:00
Laurent Destailleur
a7c246cec1 Check parameters of script 2013-12-01 15:21:58 +01:00
Laurent Destailleur
1ddf9f6ac5 Fix: Not coherent filename 2013-11-24 19:34:25 +01:00
Laurent Destailleur
a9d5363799 Merge pull request #1313 from altairis-fr/3.3
[Task 1144 ] Fix wrong max-length of produt ref
2013-11-20 14:33:57 -08:00
Christophe Battarel
e654dac578 [Task 1144 ] Fix wrong max-length of produt ref 2013-11-20 10:33:06 +01:00
Laurent Destailleur
8653f3f026 Add missing Country UK. 2013-11-04 12:38:21 +01:00
Laurent Destailleur
5fbb967941 Fix: restart of mysql for opensuse 2013-10-29 22:57:51 +01:00
Laurent Destailleur
f5387081e0 Update doc 2013-09-25 11:25:30 +02:00
Laurent Destailleur
8024a61376 Add missing label 2013-09-22 21:07:00 +02:00
Laurent Destailleur
ad09470f48 Fix: Better management of pdf generation when tcpdf not available. 2013-09-22 19:53:27 +02:00
Laurent Destailleur
bd0e328d5b Use official package directly to build debian. 2013-09-19 23:51:47 +02:00
Laurent Destailleur
2a1dae78ca Fix: We must not remove sources from packages 2013-09-19 19:49:41 +02:00
Laurent Destailleur
848c693822 Fix: Error in url 2013-09-19 00:59:02 +02:00
Laurent Destailleur
30c4d5dedb Fix for debian package 2013-09-19 00:39:13 +02:00
Laurent Destailleur
9adbb0e973 Fix: update copyright file 2013-09-14 20:51:21 +02:00
Laurent Destailleur
86e827e3f7 Fix: Missing sources
Fix: packager
2013-09-12 23:47:36 +02:00
Laurent Destailleur
239cb02613 Doc 2013-09-11 23:10:19 +02:00
Laurent Destailleur
6f2652f2b6 Fix: Use correct standard 2013-09-11 23:07:47 +02:00
Laurent Destailleur
d6c35c1ee7 Fix: Opensource rules violation (sources must be included with lib) 2013-09-11 21:39:33 +02:00
Laurent Destailleur
fa0825885a Merge branch '3.3' of git@github.com:Dolibarr/dolibarr.git into 3.3 2013-09-11 14:20:36 +02:00
Laurent Destailleur
fa5fea68b0 Removed warnings 2013-09-10 12:25:42 +02:00
Laurent Destailleur
c02b0f2381 Removed warnings 2013-09-10 12:25:02 +02:00
Laurent Destailleur
2f0ad6a22c Fix: syntax error in ruleset.xml 2013-09-10 02:32:33 +02:00
Laurent Destailleur
0fa836fd45 Fix bad name 2013-09-09 20:42:12 +02:00
Laurent Destailleur
11992dca9f Fix init data sql 2013-09-09 20:37:44 +02:00
Laurent Destailleur
574c4373b4 Fix: bug with php 5.4 2013-09-09 19:53:35 +02:00
Laurent Destailleur
e932bef031 Fix: Bug with php 5.4 2013-09-09 17:50:42 +02:00
Laurent Destailleur
411a6bb819 Enabled travis-ci on old branch 2013-09-09 17:05:52 +02:00
Laurent Destailleur
8a0ac8b650 Merge branch '3.3' of https://github.com/Dolibarr/dolibarr.git into 3.3 2013-09-06 13:43:12 +02:00
Laurent Destailleur
651596e8d5 Fix: missing ; 2013-09-06 13:42:14 +02:00
Laurent Destailleur
5db9505f40 Fix debian package 2013-09-06 01:30:49 +02:00
Laurent Destailleur
a9c14c80f0 Fix: debian files 2013-09-06 01:27:11 +02:00
Laurent Destailleur
c71c4e86f6 Fix: watch file for debian package. 2013-09-05 23:52:13 +02:00
Laurent Destailleur
556827c818 Fix: wash file 2013-09-05 22:58:11 +02:00
Laurent Destailleur
2ce6f55d92 Merge branch '3.3' of https://github.com/Dolibarr/dolibarr.git into 3.3 2013-09-05 17:54:00 +02:00
Laurent Destailleur
7afb1aef14 Fix: Image was not correctly generated. Bad licence into it. 2013-09-05 17:53:07 +02:00
Laurent Destailleur
da7c8b42f2 Fix: Image was not correctly generated. Bad licence into it. 2013-09-04 22:34:49 +02:00
Laurent Destailleur
dd3d0ad9ac Merge pull request #1181 from grandoc/3.3
fix some trad
2013-08-21 13:13:42 -07:00
Grand Philippe
49e38e1263 fix some trad 2013-08-16 10:16:06 +02:00
Laurent Destailleur
34987d3e8b Exclude conf.php file from git 2013-08-10 13:02:13 +02:00
Laurent Destailleur
3730d874c9 Fix: [ bug #991 ] Error when adding a product in POS when no Tax is
associated to the country of the company
2013-08-01 18:09:01 +02:00
Laurent Destailleur
a43e7fd34e Fix: Changelog 2013-07-27 12:39:01 +02:00
Laurent Destailleur
3cd46d5e20 Merge pull request #1134 from FHenry/3.3
Fix [ bug #1001 ] Charge sociale : état incorrect
2013-07-27 02:38:56 -07:00
Laurent Destailleur
ae9c3cd780 Prepare 3.3.4 2013-07-26 16:43:06 +02:00
Laurent Destailleur
d0af692ed5 Fix: date must be reported according to user timezone
Conflicts:
	htdocs/core/class/html.formfile.class.php
2013-07-26 15:23:41 +02:00
Florian Henry
7af45ccdf3 update changelog 2013-07-26 12:52:51 +02:00
Florian Henry
116988febd Fix [ bug #1001 ] Charge sociale : état incorrect 2013-07-26 12:49:11 +02:00
Laurent Destailleur
16d530b22d Fix: Watermark make pagebreak crazy. 2013-07-25 18:58:47 +02:00
Laurent Destailleur
7cf429d238 Fix: Color change on page break. 2013-07-24 15:04:09 +02:00
Laurent Destailleur
f32bc24285 Fix: Upgrade of package break install
Conflicts:
	build/rpm/dolibarr_fedora.spec
	build/rpm/dolibarr_generic.spec
2013-07-24 13:49:40 +02:00
Laurent Destailleur
e8400afeba Fix: rpm packages
Conflicts:
	build/rpm/dolibarr_generic.spec
2013-07-24 13:46:50 +02:00
Laurent Destailleur
c24659b3a5 Merge branch '3.3' of git@github.com:Dolibarr/dolibarr.git into 3.3 2013-07-14 20:29:25 +02:00
Laurent Destailleur
dc5ad1a0f3 Fix: Total missing 2013-07-14 20:29:07 +02:00
Laurent Destailleur
f4428c8a8a Fix: Bad link 2013-07-09 15:27:06 +02:00
Laurent Destailleur
1561062285 Merge pull request #1073 from FHenry/3.3
Fix bug pgsql : add mail directly into mailling
2013-06-27 14:50:47 -07:00
Florian Henry
469e700895 Fix bug pgsql : add mail directly into mailling 2013-06-27 14:35:41 +02:00
Laurent Destailleur
2af8f295b1 Fix: warning not always visible. Depends if addon modules were
installed. Var should provide a quick fix.
2013-06-25 21:25:09 +02:00
Laurent Destailleur
187feff7d5 Prepare 3.3.3 2013-06-25 20:40:22 +02:00
Laurent Destailleur
ad49f965d5 Merge pull request #1060 from FHenry/3.3
Fix trad holidays module
2013-06-19 09:34:10 -07:00
Laurent Destailleur
d6d7665e65 Merge pull request #1059 from marcosgdf/translations
Fixed es_ES translation typo
2013-06-19 09:34:03 -07:00
Laurent Destailleur
9518cb7836 Merge pull request #1058 from marcosgdf/bug-947
Fix: [ bug #947 ] Can't create proposal lines with unit price = 0
2013-06-19 09:33:44 -07:00
Florian Henry
ee1e266774 Fix trad holidays module 2013-06-19 11:22:53 +02:00
Marcos García
76d9ba6a43 Fixed es_ES translation typo 2013-06-19 10:24:24 +02:00
Marcos García
676191c1f9 Fix: [ bug #947 ] Can't create proposal lines with unit price = 0 2013-06-19 10:22:46 +02:00
Laurent Destailleur
c92471d40b Merge pull request #1043 from FHenry/3.3
Fix [ bug #934 ] Impossible de créer une facture prédéfinie (pgsql)
2013-06-13 15:25:16 -07:00
Florian Henry
fb0a99cb55 Fix [ bug #934 ] Impossible de créer une facture prédéfinie (pgsql) 2013-06-13 15:05:19 +02:00
Laurent Destailleur
49dcc32374 Fix: Param lang forbidden into price function 2013-06-08 16:53:26 +02:00
Laurent Destailleur
e13974b5f3 Fix: tcpdf bug 2013-06-08 15:29:27 +02:00
Laurent Destailleur
2c71c898eb Fix: param lang not provided to price function 2013-06-08 15:21:47 +02:00
simnandez
a4841dacda Fix: Warning missing argument 2 into withdrawals 2013-06-05 15:09:13 +02:00
Laurent Destailleur
94d1f23721 Merge pull request #1019 from GPCsolutions/3.3-societefix
Fixed field name
2013-06-04 10:19:44 -07:00
Raphaël Doursenaud
880a27f827 Fixed field name 2013-06-04 18:40:46 +02:00
Laurent Destailleur
4f0758f9b1 Merge pull request #1011 from marcosgdf/minor
Avoid warnings
2013-06-02 04:29:23 -07:00
Laurent Destailleur
c8c9ea797d Merge pull request #1009 from marcosgdf/bug-903
Fixed bug #903: Fatal error: Call to undefined function dol_get_first_da...
2013-06-02 04:17:07 -07:00
Marcos García
cf1d269f15 Avoid warnings 2013-06-01 16:11:45 +02:00
Marcos García
8ae0939ae5 Fixed bug #903: Fatal error: Call to undefined function dol_get_first_day() in htdocs/commande/liste.php 2013-06-01 15:39:45 +02:00
Juanjo Menent
694eef9386 Merge pull request #1006 from marcosgdf/translations
Reverting PR #1002
2013-05-30 08:10:19 -07:00
Marcos García
f6057bd794 Reverting PR #1002
Incorrect translation that shouldn't have been accepted
2013-05-30 16:48:04 +02:00
Laurent Destailleur
7ecafc2e54 Merge pull request #1003 from FHenry/3.3
add translation
2013-05-29 08:26:12 -07:00
Florian Henry
8b2dc49734 update trans 2013-05-29 16:06:04 +02:00
Florian Henry
7ab46b8e7b add translation 2013-05-29 15:59:16 +02:00
Laurent Destailleur
6d2db1c09f Merge pull request #977 from cbattarel/3.3
[ bug #806 ] Tasks are ordered alphabetically instead of chronological order
2013-05-28 15:14:02 -07:00
Laurent Destailleur
b4ae479a69 Merge pull request #988 from FHenry/3.3
Fix [ bug #911 ] Reorder intervention do not work and PgSQL
2013-05-26 05:59:54 -07:00
Laurent Destailleur
2e8d2b884f Merge branch '3.3' of git@github.com:Dolibarr/dolibarr.git into 3.3 2013-05-26 13:31:11 +02:00
Laurent Destailleur
c66304e217 Fix: Update version 2013-05-26 13:20:37 +02:00
Florian Henry
f543f00024 Fix PGSQL Bugs
Removing parenthesis make query works for MySQL and PgSQL
2013-05-26 10:34:00 +02:00
Florian Henry
56556ba222 Fix [ bug #911 ] Reorder intervention do not work 2013-05-26 10:15:43 +02:00
Christophe Battarel
b8c51e3760 sort tasks by start date 2013-05-25 11:49:05 +02:00
Laurent Destailleur
389d64c25b Merge pull request #982 from FHenry/3.3
Fix search product if multilingue
2013-05-25 02:01:14 -07:00
Florian Henry
5b02a3a67c Fix search product if multilingue 2013-05-24 22:44:26 +02:00
Christophe Battarel
5de7f77a09 update ChaneLog 2013-05-23 23:09:32 +02:00
Christophe Battarel
b89b7405f8 update function comments header 2013-05-23 22:54:06 +02:00
Christophe Battarel
b96bff4770 [ bug #806 ] Tasks are ordered alphabetically instead of chronological order 2013-05-23 22:51:27 +02:00
Laurent Destailleur
ee84457104 Fix: not defined default value 2013-05-23 10:04:35 +02:00
639 changed files with 168218 additions and 3516 deletions

84
.travis.yml Normal file
View 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.3.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

View File

@@ -36,7 +36,7 @@ jQuery blockUI 2.43 GPL and MIT Licence Yes JS libra
jQuery jPicker 1.1.00 GPL and MIT Licence Yes JS library for color picker with not defined list of colors
jQuery Layout 1.3.0 GPL and MIT Licence Yes JS library plugin Layout (RC-29.15)
jQuery TableDnD 0.5 GPL and MIT Licence Yes JS library plugin TableDnD (to reorder table rows)
jQuery Mobile 1.0rc2 GPL and MIT Licence Yes JS library for smartphone (not used)
jQuery Mobile 1.3.0 GPL and MIT Licence Yes JS library for smartphone (not used)
jQuery Tiptip 1.3 GPL and MIT Licence Yes JS library for tooltips
JSGantt 1.2 BSD Licence Yes JS library (to build Gantt reports)

View File

@@ -2,7 +2,25 @@
English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 3.3.5 compared to 3.3.4 *****
- Fix: Change to make debian package ok despite removal of ckeditor.
- Fix: jcrop file to match debian rules
- Fix: Add missing country UK.
- Fix: Minor fix into package.
- Fix: Add missing label on project field.
***** ChangeLog for 3.3.4 compared to 3.3.3 *****
- Fix: [ bug #1001 ] Social Contribution : State not correct
- Fix: Better management of pdf generation when tcpdf is not available.
- Fix: Change to be more debian compliant natively.
***** ChangeLog for 3.3.3 compared to 3.3.2 *****
- Fix: [ bug #903 ] Fatal error: Call to undefined function dol_get_first_day() in htdocs/commande/liste.php
- Fix: [ bug #934 ] Error on proformat invoice creation (pgsql)
- Fix: [ bug #947 ] Can't create proposal lines with unit price = 0
***** ChangeLog for 3.3.2 compared to 3.3.1 *****
@@ -33,6 +51,7 @@ English Dolibarr ChangeLog
- Fix: [ bug #866 ] Standing order from an invoice suggests invoice total amount instead of remaining to pay
- Fix: [ bug #788 ] Date of linked interventions are not shown
- Fix: external users should not see costprice and margin infos
- Fix: [ bug #806 ] Tasks are ordered alphabetically instead of chronological order
***** ChangeLog for 3.3.1 compared to 3.3 *****

View File

@@ -7,10 +7,27 @@ All sub-directories of "build" directory contains files required to build
automatically Dolibarr packages.
There are several tools:
- To build full Dolibarr packages, launch the script
> Edit version in makepack-dolibarr.pl file.
> Launch command perl makepack-dolibarr.pl
Note: Prerequisites to build tgz, debian, rpm package
> apt-get install tar dpkg dpatch p7zip-full rpm zip
Note: Prerequisites to build autoexe DoliWamp package:
> Install InnoSetup
For example by running isetup-5.3.9.exe (http://www.jrsoftware.org)
> Install WampServer into "C:\Program Files\Wamp"
For example by running wampserver2.2e-php5.4.3-httpd-2.4.2-mysql5.5.24-x64.exe (http://www.wampserver.com)
> Install WampServer addon to have versions: Apache2.2.11, Mysql5.0.45, Php5.3.0
For example by running WampServer2-APACHE2211.exe (http://www.wampserver.com)
For example by running WampServer2-MYSQL5045.exe (http://www.wampserver.com)
For example by running WampServer2-PHP530.exe (http://www.wampserver.com)
> To build from Windows (running from makepack-dolibarr.pl script is however
recommanded), open file build/exe/doliwamp.iss and click on button "Compile".
The .exe file will be build into directory build.
- To build a translaction package, launch the script
> perl makepack-dolibarrlang.pl
@@ -20,17 +37,6 @@ There are several tools:
- To build a package for a module, launch the script
> perl makepack-dolibarrmodule.pl
- To build an autoexe DoliWamp package:
> Install InnoSetup (http://www.jrsoftware.org)
> Install WampServer into "C:\Program Files\Wamp" (http://www.wampserver.com)
> Install WampServer addon to have versions:
Apache2.2.6, Mysql5.0.45, Php5.2.5
> Modify file build/exe/doliwamp.iss to change variable SourceDir
with value of Dolibarr repository.
> Modify AppVerName and OutputBaseFilename.
> Launch innosetup, open file build/exe/doliwamp.iss and click on
button "Compile". The .exe file will be build into directory build.
- To build developper documentation, launch the script
> perl dolybarr-doxygen-build.pl
@@ -43,24 +49,33 @@ generated packages will not contains this "build" directory.
We can find in "build", following sub-directories:
* deb:
* aps:
To build APS package.
* debian:
To build Debian package.
* rpm:
To build Redhat or Mandrake package.
* dmg:
To build Mac OS package (not ready yet).
* tgz:
To build a tgz package.
* doap:
To build Doap descriptor to promote/describe Dolibarr releases.
* doxygen:
Dir with config file to build doxygen documentation.
* exe:
To build exe package for Windows that distribute Dolibarr sources or
to build the complete DoliWamp package.
* tgz:
To build a zip package.
* launchpad:
Doc file to explain how to use launchpad.
* doap:
To build Doap descriptor to promote/describe Dolibarr releases.
* live:
Doc file to explain how to create a demo live CD.
* obs:
Doc file to explain how to push release onto OBS.
* pad:
To build a PAD file descriptor to promote/describe Dolibarr releases.
@@ -68,5 +83,14 @@ To build a PAD file descriptor to promote/describe Dolibarr releases.
* patch:
Script file to generate a patch file to distribute a Dolibarr mod.
* dmg:
To build dmg DoliMamp package for Mac OS X
* perl:
Tool to install dolibarr when using virtualmin pro
* rpm:
To build Redhat, Opensuse or Mandriva package.
* tgz:
To build a tgz package.
* zip:
To build a zip package.

View File

@@ -1,9 +1,6 @@
dolibarr (3.3.2+nmu1) unstable; urgency=low
dolibarr (3.3.5) unstable; urgency=low
* Non-maintainer upload.
[ Laurent Destailleur (eldy) ]
* New upstream release.
closes: bug#634783
-- Dolibarr team <contact@dolibarr.org> Mon, 22 Apr 2013 12:00:00 +0100
# For a changelog file dedicated to end users, see /usr/share/doc/dolibarr/ChangeLog.gz
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Mon, 30 Dec 2013 12:00:00 +0100

View File

@@ -1,5 +1,6 @@
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
Section: web
Priority: optional

View File

@@ -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-Contact: Laurent Destailleur <eldy@users.sourceforge.net>
Source: git@github.com:Dolibarr/dolibarr.git
Source: http://sourceforge.net/projects/dolibarr/files/
Files: *
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/>.
.
On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file
`/usr/share/common-licenses/GPL-2'.
License version 3 can be found in the file
`/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/*
Copyright: FPDFI team
Copyright: 2004-2011 Setasign - Jan Slabon
License: GPL-2+
This program is free software; you can redistribute it
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
License version 2 can be found in the file
`/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/*
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
and/or modify it under the terms of the GNU General Public
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
`/usr/share/common-licenses/GPL-2'.
.
=== MIT LICENSE ===
.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@@ -121,13 +264,19 @@ License: MIT or GPL-2+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
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/*
Copyright: Flot team
License: Public Domain
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/*
Copyright: JSGantt team
@@ -151,12 +300,28 @@ License: GPL-2+
License version 2 can be found in the file
`/usr/share/common-licenses/GPL-2'.
Files: htdocs/includes/phpexcel/*
Copyright: PHPExcel team
License: LGPL 2.1
See http://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html
Files: htdocs/includes/nusoap/*
Copyright: 2002-2010 NuSphere Corporation
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'.
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/*
Copyright: 2008, Julien Pauli
@@ -182,8 +347,44 @@ License: GPL-2+
License version 2 can be found in the file
`/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/*
Copyright: TCPDF team
License: LGPL 3.0
See http://www.gnu.org/licenses/old-licenses/lgpl-3.0-standalone.html
Copyright: 2002-2013 Nicola Asuni - Tecnick.com LTD
License: LGPL-3.0+
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".

View File

@@ -1,6 +1,5 @@
debian/dolibarr.desktop usr/share/applications
debian/dolibarr.xpm usr/share/pixmaps
ChangeLog usr/share/doc/dolibarr
README usr/share/doc/dolibarr
doc/install usr/share/doc/dolibarr
doc/user usr/share/doc/dolibarr

23
build/debian/get-orig-source.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/sh
# Scan for new official sources and download file
# 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 *.tgz)
version=$(echo "$tgzfile" | perl -pi -e 's/^dolibarr-//; s/\.tgz$//; s/_/./g; s/\+nmu1//; ')
cd - >/dev/null
mv $tmpdir/dolibarr-${version}.tgz ../
echo "File ../dolibarr-${version}.tgz is ready for git-import"
rm -rf $tmpdir

View File

@@ -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

5
build/debian/watch Normal file
View File

@@ -0,0 +1,5 @@
# watch control file for uscan
version=3
#http://sf.net/dolibarr/dolibarr-(.+)\.tgz
http://www.dolibarr.org/files/stable/standard/dolibarr-(.+)\.tgz

File diff suppressed because it is too large Load Diff

View File

@@ -2,43 +2,44 @@
#----------------------------------------------------------------------------
# \file build/makepack-dolibarr.pl
# \brief Dolibarr package builder (tgz, zip, rpm, deb, exe, aps)
# \author (c)2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
# \author (c)2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
#
# This is list of constant you can set to have generated packages moved into a specific dir:
#DESTIBETARC='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/lastbuild'
#DESTISTABLE='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/stable'
#DESTIMODULES='/media/HDDATA1_LD/Mes Sites/Web/Admin1/wwwroot/files/modules'
#DESTIDOLIMEDBETARC='/media/HDDATA1_LD/Mes Sites/Web/DoliCloud/dolimed.com/htdocs/files/lastbuild'
#DESTIDOLIMEDMODULES='/media/HDDATA1_LD/Mes Sites/Web/DoliCloud/dolimed.com/htdocs/files/modules'
#DESTIDOLIMEDSTABLE='/media/HDDATA1_LD/Mes Sites/Web/DoliCloud/dolimed.com/htdocs/files/stable'
#----------------------------------------------------------------------------
use Cwd;
$PROJECT="dolibarr";
$MAJOR="3";
$MINOR="3";
$BUILD="2"; # 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
@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages
%REQUIREMENTPUBLISH=(
"SF"=>"git ssh rsync"
);
%REQUIREMENTTARGET=( # Tool requirement for each package
"SNAPSHOT"=>"tar",
"TGZ"=>"tar",
"ZIP"=>"7z",
"XZ"=>"xz",
"RPM_GENERIC"=>"rpmbuild",
"RPM_FEDORA"=>"rpmbuild",
"RPM_MANDRIVA"=>"rpmbuild",
"RPM_OPENSUSE"=>"rpmbuild",
"DEB"=>"dpkg",
"APS"=>"zip",
"EXEDOLIWAMP"=>"ISCC.exe"
"EXEDOLIWAMP"=>"ISCC.exe",
"SNAPSHOT"=>"tar"
);
%ALTERNATEPATH=(
"7z"=>"7-ZIP",
"makensis.exe"=>"NSIS"
);
$FILENAME="$PROJECT";
$FILENAMESNAPSHOT="$PROJECT-snapshot";
$FILENAMETGZ="$PROJECT-$MAJOR.$MINOR.$BUILD";
$FILENAMEZIP="$PROJECT-$MAJOR.$MINOR.$BUILD";
$FILENAMERPM="$PROJECT-$MAJOR.$MINOR.$BUILD-$RPMSUBVERSION";
$FILENAMEDEB="${PROJECT}_${MAJOR}.${MINOR}.${BUILD}";
$FILENAMEAPS="$PROJECT-$MAJOR.$MINOR.$BUILD.app";
$FILENAMEEXEDOLIWAMP="DoliWamp-$MAJOR.$MINOR.$BUILD";
if (-d "/usr/src/redhat") { $RPMDIR="/usr/src/redhat"; } # redhat
if (-d "/usr/src/packages") { $RPMDIR="/usr/src/packages"; } # opensuse
if (-d "/usr/src/RPM") { $RPMDIR="/usr/src/RPM"; } # mandrake
@@ -57,6 +58,24 @@ $DIR||='.'; $DIR =~ s/([^\/\\])[\\\/]+$/$1/;
$SOURCE="$DIR/..";
$DESTI="$SOURCE/build";
$PUBLISH="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr";
if (! $ENV{"DESTIBETARC"} || ! $ENV{"DESTISTABLE"})
{
print "Error: Missing environment variables.\n";
print "You must define the environment variable DESTIBETARC and DESTISTABLE to point to the\ndirectories where you want to save the generated packages.\n";
print "Example: DESTIBETARC='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/lastbuild'\n";
print "Example: DESTISTABLE='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/stable'\n";
print "$PROG.$Extension aborted.\n";
sleep 2;
exit 1;
}
if (! -d $ENV{"DESTIBETARC"} || ! -d $ENV{"DESTISTABLE"})
{
print "Error: Directory of environment variable DESTIBETARC or DESTISTABLE does not exist.\n";
print "$PROG.$Extension aborted.\n";
sleep 2;
exit 1;
}
# Detect OS type
# --------------
@@ -64,7 +83,7 @@ if ("$^O" =~ /linux/i || (-d "/etc" && -d "/var" && "$^O" !~ /cygwin/i)) { $OS='
elsif (-d "/etc" && -d "/Users") { $OS='macosx'; $CR=''; }
elsif ("$^O" =~ /cygwin/i || "$^O" =~ /win32/i) { $OS='windows'; $CR="\r"; }
if (! $OS) {
print "$PROG.$Extension was not able to detect your OS.\n";
print "Error: Can't detect your OS.\n";
print "Can't continue.\n";
print "$PROG.$Extension aborted.\n";
sleep 2;
@@ -93,7 +112,57 @@ if (! $TEMP || ! -d $TEMP) {
$BUILDROOT="$TEMP/buildroot";
my $copyalreadydone=0; # Use "-" before number of choice to avoid copy
# Get version $MAJOR, $MINOR and $BUILD
$result = open( IN, "<" . $SOURCE . "/htdocs/filefunc.inc.php" );
if ( !$result ) { die "Error: Can't open descriptor file " . $SOURCE . "/htdocs/filefunc.inc.php\n"; }
while (<IN>) {
if ( $_ =~ /define\('DOL_VERSION','([\d\.]+)'\)/ ) { $PROJVERSION = $1; break; }
}
close IN;
($MAJOR,$MINOR,$BUILD)=split(/\./,$PROJVERSION,3);
if ($MINOR eq '') { die "Error can't detect version into ".$SOURCE . "/htdocs/filefunc.inc.php"; }
# Set vars for packaging
$FILENAME = "$PROJECT";
$FILENAMESNAPSHOT = "$PROJECT-snapshot";
$FILENAMETGZ = "$PROJECT-$MAJOR.$MINOR.$BUILD";
$FILENAMEZIP = "$PROJECT-$MAJOR.$MINOR.$BUILD";
$FILENAMEXZ = "$PROJECT-$MAJOR.$MINOR.$BUILD";
$FILENAMEDEB = "see later";
$FILENAMEAPS = "$PROJECT-$MAJOR.$MINOR.$BUILD.app";
$FILENAMEEXEDOLIWAMP = "DoliWamp-$MAJOR.$MINOR.$BUILD";
# For RPM
$ARCH='noarch';
$newbuild = $BUILD;
$newbuild =~ s/(dev|alpha)/0.1.a/gi; # dev (fedora)
$newbuild =~ s/beta/0.2.beta1/gi; # beta (fedora)
$newbuild =~ s/rc./0.3.rc1/gi; # rc (fedora)
if ($newbuild !~ /-/) { $newbuild.='-0.3'; } # finale (fedora)
#$newbuild =~ s/(dev|alpha)/0/gi; # dev
#$newbuild =~ s/beta/1/gi; # beta
#$newbuild =~ s/rc./2/gi; # rc
#if ($newbuild !~ /-/) { $newbuild.='-3'; } # finale
$REL1 = $newbuild; $REL1 =~ s/-.*$//gi;
if ($RPMSUBVERSION eq 'auto') { $RPMSUBVERSION = $newbuild; $RPMSUBVERSION =~ s/^.*-//gi; }
$FILENAMETGZ2="$PROJECT-$MAJOR.$MINOR.$REL1";
$FILENAMERPM=$FILENAMETGZ2."-".$RPMSUBVERSION.".".$ARCH.".rpm";
# For Deb
$newbuild = $BUILD;
$newbuild =~ s/(dev|alpha)/1/gi; # dev
$newbuild =~ s/beta/2/gi; # beta
$newbuild =~ s/rc./3/gi; # rc
if ($newbuild !~ /-/) { $newbuild.='-3'; } # finale is same than rc.
# now newbuild is 0-1 or 0-3 for example. Note that for native package (see debian/source/format), we should not use a dash part but to get a better version management
$build = $newbuild;
$build =~ s/-.*$//g;
# now build is 0 for example
# $build .= '+nmu1';
# now build is 0+nmu1 for example
$FILENAMEDEBNATIVE="${PROJECT}_${MAJOR}.${MINOR}.${build}";
$FILENAMEDEB="${PROJECT}_${MAJOR}.${MINOR}.${newbuild}";
my $copyalreadydone=0;
my $batch=0;
for (0..@ARGV-1) {
if ($ARGV[$_] =~ /^-*target=(\w+)/i) { $target=$1; $batch=1; }
@@ -103,41 +172,47 @@ for (0..@ARGV-1) {
$FILENAMESNAPSHOT.="-".$PREFIX;
}
}
if ($ENV{"DESTIBETARC"} && $BUILD =~ /[a-z]/i) { $DESTI = $ENV{"DESTIBETARC"}; } # Force output dir if env DESTI is defined
if ($ENV{"DESTISTABLE"} && $BUILD =~ /^[0-9]+$/) { $DESTI = $ENV{"DESTISTABLE"}; } # Force output dir if env DESTI is defined
if ($ENV{"DESTIBETARC"} && $BUILD =~ /[a-z]/i) { $DESTI = $ENV{"DESTIBETARC"}; } # Force output dir if env DESTIBETARC is defined
if ($ENV{"DESTISTABLE"} && $BUILD =~ /^[0-9]+$/) { $DESTI = $ENV{"DESTISTABLE"}; } # Force output dir if env DESTISTABLE is defined
if ($ENV{"PUBLISHBETARC"} && $BUILD =~ /[a-z]/i) { $PUBLISH = $ENV{"PUBLISHBETARC"}; } # Force target site for publishing if env PUBLISHBETARC is defined
if ($ENV{"PUBLISHSTABLE"} && $BUILD =~ /^[0-9]+$/) { $PUBLISH = $ENV{"PUBLISHSTABLE"}; } # Force target site for publishing if env PUBLISHSTABLE is defined
print "Makepack version $VERSION\n";
print "Building package name: $PROJECT\n";
print "Building package version: $MAJOR.$MINOR.$BUILD\n";
print "Building/publishing package name: $PROJECT\n";
print "Building/publishing package version: $MAJOR.$MINOR.$BUILD\n";
print "Source directory (SOURCE): $SOURCE\n";
print "Target directory (DESTI) : $DESTI\n";
print "Publishing target (PUBLISH): $PUBLISH\n";
# Choose package targets
#-----------------------
if ($target) {
$CHOOSEDTARGET{uc($target)}=1;
if ($target eq "ALL") {
foreach my $key (@LISTETARGET) {
if ($key ne 'SNAPSHOT' && $key ne 'SF') { $CHOOSEDTARGET{$key}=1; }
}
}
if ($target ne "ALL" && $target ne "SF") { $CHOOSEDTARGET{uc($target)}=1; }
if ($target eq "SF") { $CHOOSEDPUBLISH{"SF"}=1; }
}
else {
my $found=0;
my $NUM_SCRIPT;
my $cpt=0;
while (! $found) {
my $cpt=0;
printf(" %2d - %-12s (%s)\n",$cpt,"All (Except SNAPSHOT)","Need ".join(",",values %REQUIREMENTTARGET));
printf(" %2d - %-12s (%s)\n",$cpt,"ALL (1..9)","Need ".join(",",values %REQUIREMENTTARGET));
foreach my $target (@LISTETARGET) {
$cpt++;
printf(" %2d - %-12s (%s)\n",$cpt,$target,"Need ".$REQUIREMENTTARGET{$target});
}
$cpt=99;
printf(" %2d - %-12s (%s)\n",$cpt,"SF (publish)","Need ".join(",",values %REQUIREMENTPUBLISH));
# On demande de choisir le fichier à passer
# Ask which target to build
print "Choose one package number or several separated with space (0 - ".$cpt."): ";
$NUM_SCRIPT=<STDIN>;
chomp($NUM_SCRIPT);
if ($NUM_SCRIPT =~ s/-//g) {
# Do not do copy
$copyalreadydone=1;
}
if ($NUM_SCRIPT !~ /^[0-9\s]+$/)
{
print "This is not a valid package number list.\n";
@@ -149,15 +224,20 @@ else {
}
}
print "\n";
if ($NUM_SCRIPT) {
foreach my $num (split(/\s+/,$NUM_SCRIPT)) {
$CHOOSEDTARGET{$LISTETARGET[$num-1]}=1;
}
if ($NUM_SCRIPT eq "99") {
$CHOOSEDPUBLISH{"SF"}=1;
}
else {
foreach my $key (@LISTETARGET) {
if ($key ne 'SNAPSHOT') { $CHOOSEDTARGET{$key}=1; }
}
if ($NUM_SCRIPT eq "0") {
foreach my $key (@LISTETARGET) {
if ($key ne 'SNAPSHOT' && $key ne 'SF') { $CHOOSEDTARGET{$key}=1; }
}
}
else {
foreach my $num (split(/\s+/,$NUM_SCRIPT)) {
$CHOOSEDTARGET{$LISTETARGET[$num-1]}=1;
}
}
}
}
@@ -174,11 +254,13 @@ foreach my $target (keys %CHOOSEDTARGET) {
}
$atleastonerpm=1;
}
foreach my $req (split(/[,\s]/,$REQUIREMENTTARGET{$target})) {
foreach my $req (split(/[,\s]/,$REQUIREMENTTARGET{$target}))
{
# Test
print "Test requirement for target $target: Search '$req'... ";
$newreq=$req; $newparam='';
if ($newreq eq 'zip') { $newparam.='-h'; }
if ($newreq eq 'xz') { $newparam.='-h'; }
$cmd="\"$newreq\" $newparam 2>&1";
print "Test command ".$cmd."... ";
$ret=`$cmd`;
@@ -197,7 +279,7 @@ foreach my $target (keys %CHOOSEDTARGET) {
last;
} else {
# Pas erreur ou erreur autre que programme absent
print " Found ".$REQUIREMENTTARGET{$target}."\n";
print " Found ".$req."\n";
}
}
}
@@ -208,16 +290,20 @@ print "\n";
#----------------------------------------------
$nboftargetok=0;
$nboftargetneedbuildroot=0;
$nboftargetneedcvs=0;
$nbofpublishneedtag=0;
foreach my $target (keys %CHOOSEDTARGET) {
if ($CHOOSEDTARGET{$target} < 0) { next; }
if ($target ne 'EXE' && $target ne 'EXEDOLIWAMP')
{
$nboftargetneedbuildroot++;
}
if ($target eq 'SNAPSHOT')
$nboftargetok++;
}
foreach my $target (keys %CHOOSEDPUBLISH) {
if ($CHOOSEDPUBLISH{$target} < 0) { next; }
if ($target eq 'SF')
{
$nboftargetneedcvs++;
$nbofpublishneedtag++;
}
$nboftargetok++;
}
@@ -226,13 +312,26 @@ if ($nboftargetok) {
# Update CVS if required
#-----------------------
if ($nboftargetneedcvs)
if ($nbofpublishneedtag)
{
print "Go to directory $SOURCE\n";
$olddir=getcwd();
chdir("$SOURCE");
print "Run cvs update -P -d\n";
$ret=`cvs update -P -d 2>&1`;
print 'Run git tag -a -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n";
$ret=`git tag -a -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD" 2>&1`;
if ($ret =~ /already exists/)
{
print "WARNING: Tag ".$MAJOR.'.'.$MINOR.'.'.$BUILD." already exists. Overwrite (y/N) ? ";
$QUESTIONOVERWRITETAG=<STDIN>;
chomp($QUESTIONOVERWRITETAG);
if ($QUESTIONOVERWRITETAG =~ /(o|y)/)
{
print 'Run git tag -a -f -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n";
$ret=`git tag -a -f -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD"`;
}
}
print 'Run git push --tags'."\n";
$ret=`git push --tags`;
chdir("$olddir");
}
@@ -250,15 +349,20 @@ if ($nboftargetok) {
mkdir "$BUILDROOT/$PROJECT";
print "Copy $SOURCE into $BUILDROOT/$PROJECT\n";
$ret=`cp -pr "$SOURCE" "$BUILDROOT/$PROJECT"`;
#print "Copy $SOURCE/build/debian/apache/.htaccess into $BUILDROOT/$PROJECT/build/debian/apache/.htaccess\n";
#$ret=`cp -pr "$SOURCE/build/debian/apache/.htaccess" "$BUILDROOT/$PROJECT/build/debian/apache/.htaccess"`;
}
print "Clean $BUILDROOT\n";
$ret=`rm -f $BUILDROOT/$PROJECT/.buildpath`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.cache`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.externalToolBuilders`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.git`;
$ret=`rm -f $BUILDROOT/$PROJECT/.gitmodules`;
$ret=`rm -f $BUILDROOT/$PROJECT/.gitignore`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.project`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.settings`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.travis.yml`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.tx`;
$ret=`rm -f $BUILDROOT/$PROJECT/build.xml`;
$ret=`rm -f $BUILDROOT/$PROJECT/quickbuild.xml`;
$ret=`rm -f $BUILDROOT/$PROJECT/pom.xml`;
@@ -274,6 +378,7 @@ if ($nboftargetok) {
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar.gz`;
$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/doxygen/doxygen_warnings.log`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/cache.manifest`;
@@ -287,6 +392,8 @@ if ($nboftargetok) {
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/mysql/README`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/pgsql/README`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/install/mssql`;
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/codesniffer`;
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/codetemplates`;
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/dbmodel`;
@@ -320,8 +427,12 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/documents`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/document`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/bootstrap*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`;
$ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`;
@@ -330,8 +441,12 @@ if ($nboftargetok) {
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/jqueryFileTree/connectors/jqueryFileTree.pl`; # Avoid errors into rpmlint
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/template`; # Package not valid for most linux distributions (errors reported into compile.js). Package should be embed by modules to avoid problems.
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpmailer`; # Package not valid for most linux distributions (errors reported into file LICENSE). Package should be embed by modules to avoid problems.
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/_source`; # Keep this removal in case we embed libraries
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/adapters`; # Keep this removal in case we embed libraries
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/license.txt`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip`;
@@ -341,7 +456,7 @@ if ($nboftargetok) {
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/LICENSE.TXT`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/savant`;
}
# Build package for each target
#------------------------------
foreach my $target (keys %CHOOSEDTARGET)
@@ -364,8 +479,7 @@ if ($nboftargetok) {
$ret=`$cmd`;
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 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";
$ret=`$cmd`;
@@ -378,6 +492,7 @@ if ($nboftargetok) {
if ($target eq 'TGZ')
{
$NEWDESTI=$DESTI;
mkdir($DESTI.'/standard');
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
print "Remove target $FILENAMETGZ.tgz...\n";
@@ -401,9 +516,41 @@ if ($nboftargetok) {
next;
}
if ($target eq 'XZ')
{
$NEWDESTI=$DESTI;
mkdir($DESTI.'/standard');
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')
{
$NEWDESTI=$DESTI;
mkdir($DESTI.'/standard');
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
print "Remove target $FILENAMEZIP.zip...\n";
@@ -438,31 +585,18 @@ if ($nboftargetok) {
if ($target =~ /FEDO/i) { $subdir="package_rpm_redhat-fedora"; }
if ($target =~ /MAND/i) { $subdir="package_rpm_mandriva"; }
if ($target =~ /OPEN/i) { $subdir="package_rpm_opensuse"; }
mkdir($DESTI.'/'.$subdir);
if (-d $DESTI.'/'.$subdir) { $NEWDESTI=$DESTI.'/'.$subdir; }
$ARCH='noarch';
if ($RPMDIR eq "") { $RPMDIR=$ENV{'HOME'}."/rpmbuild"; }
$newbuild = $BUILD;
# For fedora
$newbuild =~ s/(dev|alpha)/0.1.a/gi; # dev
$newbuild =~ s/beta/0.2.beta1/gi; # beta
$newbuild =~ s/rc./0.3.rc1/gi; # rc
if ($newbuild !~ /-/) { $newbuild.='-3'; } # finale
#$newbuild =~ s/(dev|alpha)/0/gi; # dev
#$newbuild =~ s/beta/1/gi; # beta
#$newbuild =~ s/rc./2/gi; # rc
#if ($newbuild !~ /-/) { $newbuild.='-3'; } # finale
$REL1 = $newbuild; $REL1 =~ s/-.*$//gi;
if ($RPMSUBVERSION eq 'auto') { $RPMSUBVERSION = $newbuild; $RPMSUBVERSION =~ s/^.*-//gi; }
print "Version is $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n";
$FILENAMETGZ2="$PROJECT-$MAJOR.$MINOR.$REL1";
print "Version is $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n";
#print "Create directory $RPMDIR\n";
#$ret=`mkdir -p "$RPMDIR"`;
print "Remove target ".$FILENAMETGZ2."-".$RPMSUBVERSION.".".$ARCH.".rpm...\n";
unlink("$NEWDESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION.".".$ARCH.".rpm");
print "Remove target ".$FILENAMERPM."...\n";
unlink("$NEWDESTI/".$FILENAMERPM);
print "Remove target ".$FILENAMETGZ2."-".$RPMSUBVERSION.".src.rpm...\n";
unlink("$NEWDESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION.".src.rpm");
@@ -473,8 +607,8 @@ if ($nboftargetok) {
$ret=`$cmd`;
# Set owners
print "Set owners on files/dir\n";
$ret=`chown -R root.root $BUILDROOT/$FILENAMETGZ2`;
#print "Set owners on files/dir\n";
#$ret=`chown -R root.root $BUILDROOT/$FILENAMETGZ2`;
print "Set permissions on files/dir\n";
$ret=`chmod -R 755 $BUILDROOT/$FILENAMETGZ2`;
@@ -517,11 +651,9 @@ if ($nboftargetok) {
# Move to final dir
print "Move $RPMDIR/RPMS/".$ARCH."/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.".$ARCH.".rpm into $NEWDESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.".$ARCH.".rpm\n";
#$cmd="mv \"$RPMDIR/RPMS/".$ARCH."/".$FILENAMETGZ2."-".$RPMSUBVERSION.".".$ARCH.".rpm\" \"$NEWDESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION.".".$ARCH.".rpm\"";
$cmd="mv $RPMDIR/RPMS/".$ARCH."/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.".$ARCH.".rpm \"$NEWDESTI/\"";
$ret=`$cmd`;
print "Move $RPMDIR/SRPMS/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.src.rpm into $NEWDESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.src.rpm\n";
#$cmd="mv \"$RPMDIR/SRPMS/".$FILENAMETGZ2."-".$RPMSUBVERSION.".src.rpm\" \"$NEWDESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION.".src.rpm\"";
$cmd="mv $RPMDIR/SRPMS/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.src.rpm \"$NEWDESTI/\"";
$ret=`$cmd`;
print "Move $RPMDIR/SOURCES/".$FILENAMETGZ2.".tgz into $NEWDESTI/".$FILENAMETGZ2.".tgz\n";
@@ -533,23 +665,11 @@ if ($nboftargetok) {
if ($target eq 'DEB')
{
$NEWDESTI=$DESTI;
mkdir($DESTI.'/package_debian-ubuntu');
if (-d $DESTI.'/package_debian-ubuntu') { $NEWDESTI=$DESTI.'/package_debian-ubuntu'; }
$olddir=getcwd();
$newbuild = $BUILD;
$newbuild =~ s/(dev|alpha)/1/gi; # dev
$newbuild =~ s/beta/2/gi; # beta
$newbuild =~ s/rc./3/gi; # rc
if ($newbuild !~ /-/) { $newbuild.='-4'; } # finale
# now newbuild is 0-1 or 0-4 for example
print "Version is $MAJOR.$MINOR.$newbuild\n";
$build = $newbuild;
$build =~ s/-.*$//g;
# now build is 0 for example
$build .= '+nmu1';
# now build is 0+nmu1 for example
print "Remove target ${FILENAMEDEB}_all.deb...\n";
unlink("$NEWDESTI/${FILENAMEDEB}_all.deb");
print "Remove target ${FILENAMEDEB}.dsc...\n";
@@ -558,6 +678,8 @@ if ($nboftargetok) {
unlink("$NEWDESTI/${FILENAMEDEB}.tar.gz");
print "Remove target ${FILENAMEDEB}.changes...\n";
unlink("$NEWDESTI/${FILENAMEDEB}.changes");
print "Remove target ${FILENAMEDEBNATIVE}.orig.tar.gz...\n";
unlink("$NEWDESTI/${FILENAMEDEBNATIVE}.orig.tar.gz");
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp`;
$ret=`rm -fr $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build`;
@@ -565,6 +687,8 @@ if ($nboftargetok) {
print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$PROJECT.tmp\n";
$cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$PROJECT.tmp\"";
$ret=`$cmd`;
#$cmd="cp -pr \"$BUILDROOT/$PROJECT/build/debian/apache/.htaccess\" \"$BUILDROOT/$PROJECT.tmp/build/debian/apache/.htaccess\"";
#$ret=`$cmd`;
print "Remove other files\n";
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/README-FR`;
@@ -592,7 +716,7 @@ if ($nboftargetok) {
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.templates.futur`;
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/rules`;
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/README.howto`;
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/wash`;
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/watch`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/doap`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/exe`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/launchpad`;
@@ -601,13 +725,9 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/perl`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/rpm`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/zip`;
# We remove embedded libraries or fonts (this is also inside rules file, target clean)
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/fonts`,
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/geoip`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/nusoap`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/odtphp/zip/pclzip`;
# Rename upstream changelog to match debian rules
$ret=`mv $BUILDROOT/$PROJECT.tmp/ChangeLog $BUILDROOT/$PROJECT.tmp/changelog`;
# Prepare source package (init debian dir)
print "Create directory $BUILDROOT/$PROJECT.tmp/debian\n";
$ret=`mkdir "$BUILDROOT/$PROJECT.tmp/debian"`;
@@ -624,18 +744,24 @@ if ($nboftargetok) {
$ret=`cp -f "$SOURCE/build/debian/dolibarr.xpm" "$BUILDROOT/$PROJECT.tmp/debian"`;
$ret=`cp -f "$SOURCE/build/debian/README.source" "$BUILDROOT/$PROJECT.tmp/debian"`;
$ret=`cp -f "$SOURCE/build/debian/rules" "$BUILDROOT/$PROJECT.tmp/debian"`;
$ret=`cp -f "$SOURCE/build/debian/watch" "$BUILDROOT/$PROJECT.tmp/debian"`;
$ret=`cp -fr "$SOURCE/build/debian/patches" "$BUILDROOT/$PROJECT.tmp/debian"`;
$ret=`cp -fr "$SOURCE/build/debian/po" "$BUILDROOT/$PROJECT.tmp/debian"`;
$ret=`cp -fr "$SOURCE/build/debian/source" "$BUILDROOT/$PROJECT.tmp/debian"`;
#$ret=`cp -fr "$SOURCE/build/debian/apache" "$BUILDROOT/$PROJECT.tmp/debian/apache"`;
#$ret=`cp -f "$SOURCE/build/debian/apache/.htaccess" "$BUILDROOT/$PROJECT.tmp/debian/apache"`;
#$ret=`cp -fr "$SOURCE/build/debian/lighttpd" "$BUILDROOT/$PROJECT.tmp/debian/lighttpd"`;
# Add files also required to build binary package
$ret=`cp -f "$SOURCE/build/debian/dolibarr.config" "$BUILDROOT/$PROJECT.tmp/debian"`;
$ret=`cp -f "$SOURCE/build/debian/dolibarr.postinst" "$BUILDROOT/$PROJECT.tmp/debian"`;
$ret=`cp -f "$SOURCE/build/debian/dolibarr.postrm" "$BUILDROOT/$PROJECT.tmp/debian"`;
$ret=`cp -f "$SOURCE/build/debian/dolibarr.templates" "$BUILDROOT/$PROJECT.tmp/debian"`;
$ret=`cp -f "$SOURCE/build/debian/install.forced.php.install" "$BUILDROOT/$PROJECT.tmp/debian"`;
# Set owners and permissions
print "Set owners on files/dir\n";
$ret=`chown -R root.root $BUILDROOT/$PROJECT.tmp`;
#print "Set owners on files/dir\n";
#$ret=`chown -R root.root $BUILDROOT/$PROJECT.tmp`;
print "Set permissions on files/dir\n";
$ret=`chmod -R 755 $BUILDROOT/$PROJECT.tmp`;
$cmd="find $BUILDROOT/$PROJECT.tmp -type f -exec chmod 644 {} \\; ";
@@ -664,22 +790,35 @@ if ($nboftargetok) {
$cmd="mv $BUILDROOT/$PROJECT.tmp $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build";
$ret=`$cmd`;
print "Go into directory $BUILDROOT\n";
chdir("$BUILDROOT");
# We need a tarball to be able to build "quilt" debian package (not required for native but we need patch so it is not a native)
print "Compress $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build into $BUILDROOT/$FILENAMEDEBNATIVE.orig.tar.gz...\n";
$cmd="tar --exclude-vcs --exclude-from \"$BUILDROOT/$PROJECT/build/tgz/tar_exclude.txt\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$BUILDROOT/$FILENAMEDEBNATIVE.orig.tar.gz\" $PROJECT-$MAJOR.$MINOR.$build";
print $cmd."\n";
$ret=`$cmd`;
# Creation of source package
print "Go into directory $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n";
chdir("$BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build");
#$cmd="dpkg-source -b $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build";
$cmd="dpkg-buildpackage -us -uc";
print "Launch DEB build ($cmd)\n";
$ret=`$cmd`;
$ret=`$cmd 2>&1 3>&1`;
print $ret."\n";
chdir("$olddir");
print "You can check bin package with lintian --pedantic -E -I \"$NEWDESTI/${FILENAMEDEB}_all.deb\"\n";
print "You can check src package with lintian --pedantic -E -I \"$NEWDESTI/${FILENAMEDEB}.dsc\"\n";
# Move to final dir
print "Move *_all.deb to $NEWDESTI\n";
print "Move *_all.deb *.dsc *.orig.tar.gz *.changes to $NEWDESTI\n";
$ret=`mv $BUILDROOT/*_all.deb "$NEWDESTI/"`;
$ret=`mv $BUILDROOT/*.dsc "$NEWDESTI/"`;
$ret=`mv $BUILDROOT/*.tar.gz "$NEWDESTI/"`;
$ret=`mv $BUILDROOT/*.orig.tar.gz "$NEWDESTI/"`;
$ret=`mv $BUILDROOT/*.changes "$NEWDESTI/"`;
next;
}
@@ -687,6 +826,7 @@ if ($nboftargetok) {
if ($target eq 'APS')
{
$NEWDESTI=$DESTI;
mkdir($DESTI.'/package_aps');
if (-d $DESTI.'/package_aps') { $NEWDESTI=$DESTI.'/package_aps'; }
$newbuild = $BUILD;
@@ -771,6 +911,7 @@ if ($nboftargetok) {
if ($target eq 'EXEDOLIWAMP')
{
$NEWDESTI=$DESTI;
mkdir($DESTI.'/package_windows');
if (-d $DESTI.'/package_windows') { $NEWDESTI=$DESTI.'/package_windows'; }
print "Remove target $FILENAMEEXEDOLIWAMP.exe...\n";
@@ -792,6 +933,81 @@ if ($nboftargetok) {
next;
}
}
# Build package for each target
#------------------------------
foreach my $target (keys %CHOOSEDPUBLISH)
{
if ($CHOOSEDPUBLISH{$target} < 0) { next; }
print "\nList of files to publish\n";
%filestoscan=(
"$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)',
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)',
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)',
"$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM',
"$DESTI/standard/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM'
);
foreach my $file (sort keys %filestoscan)
{
$found=0;
my $filesize = -s $file;
print $file." ".($filesize?"(found)":"(not found)");
print ($filesize?" - ".$filesize:"");
print "\n";
}
if ($target eq 'SF')
{
print "\n";
$NEWPUBLISH=$PUBLISH;
print "Publish to target $NEWPUBLISH. Click enter or CTRL+C...\n";
# Ask which target to build
$NUM_SCRIPT=<STDIN>;
chomp($NUM_SCRIPT);
print "Create empty dir /tmp/emptydir. We need it to create target dir using rsync.\n";
$ret=`mkdir -p "/tmp/emptydir/"`;
foreach my $file (sort keys %filestoscan)
{
$found=0;
my $filesize = -s $file;
if (! $filesize) { next; }
print "\n";
print "Publish file ".$file." to ".$filestoscan{$file}."\n";
$destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD;
# mkdir
#my $ssh = Net::SSH::Perl->new("frs.sourceforge.net");
#$ssh->login("$user","$pass");
#use String::ShellQuote qw( shell_quote );
#$ssh->cmd('mkdir '.shell_quote($destFolder).' && exit');
#use Net::SFTP::Foreign;
#my $sftp = Net::SFTP::Foreign->new($ip, user => $user, password => $pass, autodie => 1);
#$sftp->mkdir($destFolder)
#$command="ssh eldy,dolibarr\@frs.sourceforge.net mkdir -p \"$destFolder\"";
#print "$command\n";
#my $ret=`$command 2>&1`;
$command="rsync -s -e 'ssh' --recursive /tmp/emptydir/ \"".$destFolder."\"";
print "$command\n";
my $ret=`$command 2>&1`;
$command="rsync -s $OPTIONUPDATEDIST -e 'ssh' \"$file\" \"".$destFolder."\"";
print "$command\n";
my $ret=`$command 2>&1`;
print "$ret\n";
}
}
}
}
print "\n----- Summary -----\n";

View File

@@ -9,16 +9,16 @@ beta version of Dolibarr, step by step.
- Check all files are commited.
- Update version/info in /ChangeLog
- Update version number with x.x.x-y in htdocs/filefunc.inc.php
- Update version number with x.x.x-y in build/makepack-dolibarr.pl
- Update version number with x.x.x-y in build/debian/changelog
- Update version number with x.x.x-y in build/exe/doliwamp/doliwamp.iss
- Update version number with x.x.x-y in build/rpm/*.spec
- Update version number with x.x.x in build/doxygen/dolibarr-doxygen.doxyfile
- Update version number with x.x.x in build/perl/virtualmin/dolibarr.pl
- Update version number with x.y.z-w in htdocs/filefunc.inc.php
- Update version number with x.y.z-w in build/makepack-dolibarr.pl
- Update version number with x.y.z-w in build/debian/changelog
- Update version number with x.y.z-w in build/exe/doliwamp/doliwamp.iss
- Update version number with x.y.z-w in build/rpm/*.spec
- Update version number with x.y.z in build/doxygen/dolibarr-doxygen.doxyfile
- Update version number with x.y.z in build/perl/virtualmin/dolibarr.pl
- Commit all changes.
- Add a Tag (DOLIBARR_x_y_BETA)
- Create a branch (DOLIBARR_x_y_BRANCH).
- Add a Tag (x.y.betaz_YYYYMMDD) and push it: git push --tags
- Create a branch (x.y).
- Run makepack-dolibarr.pl to generate all packages.
- Move build files into www.dolibarr.org web site (/home/dolibarr/wwwroot/files).
@@ -33,14 +33,14 @@ complete release of Dolibarr, step by step.
- Check all files are commited.
- Update version/info in ChangeLog
- Update version number with x.x.x in htdocs/filefunc.inc.php
- Update version number with x.x.x in build/makepack-dolibarr.pl
- Update version number with x.x.x in build/debian/changelog
- Update version number with x.x.x in build/exe/doliwamp/doliwamp.iss
- Update version number with x.x.x in build/rpm/*.spec
- Update version number with x.y.z in htdocs/filefunc.inc.php
- Update version number with x.y.z in build/makepack-dolibarr.pl
- Update version number with x.y.z in build/debian/changelog
- Update version number with x.y.z in build/exe/doliwamp/doliwamp.iss
- Update version number with x.y.z in build/rpm/*.spec
- Update PAD files.
- Commit all changes.
- Add a Tag (DOLIBARR_x_y)
- Add a Tag (x.y.z)
- Build Dolibarr and DoliWamp packages with makepack-dolibarr.pl
- Check content of built packages.

View File

@@ -34,10 +34,10 @@
</Company_Info>
<Program_Info>
<Program_Name>Dolibarr</Program_Name>
<Program_Version>3.3.0</Program_Version>
<Program_Release_Month>02</Program_Release_Month>
<Program_Release_Day>17</Program_Release_Day>
<Program_Release_Year>2013</Program_Release_Year>
<Program_Version>3.3.5</Program_Version>
<Program_Release_Month>01</Program_Release_Month>
<Program_Release_Day>01</Program_Release_Day>
<Program_Release_Year>2014</Program_Release_Year>
<Program_Cost_Dollars />
<Program_Cost_Other_Code />
<Program_Cost_Other />

View File

@@ -34,10 +34,10 @@
</Company_Info>
<Program_Info>
<Program_Name>DoliWamp</Program_Name>
<Program_Version>3.3.0</Program_Version>
<Program_Release_Month>02</Program_Release_Month>
<Program_Release_Day>17</Program_Release_Day>
<Program_Release_Year>2013</Program_Release_Year>
<Program_Version>3.3.5</Program_Version>
<Program_Release_Month>01</Program_Release_Month>
<Program_Release_Day>01</Program_Release_Day>
<Program_Release_Year>2014</Program_Release_Year>
<Program_Cost_Dollars />
<Program_Cost_Other_Code />
<Program_Cost_Other />

View File

@@ -30,7 +30,7 @@ return "Regis Houssin";
# script_dolibarr_versions()
sub script_dolibarr_versions
{
return ( "3.3.2", "3.3.1", "3.3.0", "3.2.1", "3.1.1" );
return ( "3.3.3", "3.3.2", "3.3.1", "3.3.0", "3.2.1", "3.1.1" );
}
sub script_dolibarr_category

View File

@@ -302,35 +302,38 @@ echo "-------------------------------------------------------"
echo
#---- postun (after uninstall)
#---- postun (after upgrade or uninstall)
%postun
# Define vars
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
# Remove apache link
if [ -L $apachelink ] ;
if [ "x$1" = "x0" ] ;
then
echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink
status=purge
fi
# Remove
echo "Removed package"
# Restart web servers if required
if [ "x$status" = "xpurge" ] ;
then
# Restart web server
echo Restart web server
if [ -f %{_sysconfdir}/init.d/httpd ]; then
%{_sysconfdir}/init.d/httpd restart
fi
if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart
fi
# Define vars
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
# Remove apache link
if [ -L $apachelink ] ;
then
echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink
status=purge
fi
# Restart web servers if required
if [ "x$status" = "xpurge" ] ;
then
# Restart web server
echo Restart web server
/sbin/service httpd restart
fi
else
# Upgrade
echo "No remove ation done (this is an upgrade)"
fi
%changelog
* Mon Apr 22 2013 Laurent Destailleur 3.3.2-0.3
* Mon Apr 22 2013 Laurent Destailleur 3.3.5-0.3
- Initial version (#723326)

View File

@@ -448,11 +448,26 @@ if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart
fi
# Restart mysql
echo Restart mysql
# Restart mysql server
echo Restart mysql server
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion}
/sbin/service mysqld restart
%else
%if 0%{?suse_version}
if [ -f /etc/init.d/mysqld ]; then
/etc/init.d/mysqld restart
else
/sbin/service mysql restart
fi
%else
if [ -f /etc/init.d/mysqld ]; then
/etc/init.d/mysqld restart
fi
if [ -f /etc/init.d/mysql ]; then
/etc/init.d/mysql restart
fi
%endif
%endif
# Show result
echo
@@ -467,59 +482,71 @@ echo
#---- postun (after uninstall)
#---- postun (after upgrade or uninstall)
%postun
# Define vars
os='unknown';
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion}
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
%else
%if 0%{?suse_version}
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
%else
if [ -d %{_sysconfdir}/httpd/conf.d ]; then
export os='fedora-redhat';
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
fi
if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^wwwrun /etc/passwd | wc -l` -ge 1 ]; then
export os='opensuse';
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
fi
if [ -d %{_sysconfdir}/httpd/conf.d -a `grep -i "^mageia\|mandriva" /etc/issue | wc -l` -ge 1 ]; then
export os='mageia-mandriva';
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
fi
if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^www-data /etc/passwd | wc -l` -ge 1 ]; then
export os='ubuntu-debian';
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
fi
%endif
%endif
# Remove apache link
if [ -L $apachelink ] ;
if [ "x$1" = "x0" ] ;
then
echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink
status=purge
fi
# Remove
echo "Removed package"
# Restart web servers if required
if [ "x$status" = "xpurge" ] ;
then
# Restart web server
echo Restart web server
if [ -f %{_sysconfdir}/init.d/httpd ]; then
%{_sysconfdir}/init.d/httpd restart
fi
if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart
fi
# Define vars
os='unknown';
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion}
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
%else
%if 0%{?suse_version}
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
%else
if [ -d %{_sysconfdir}/httpd/conf.d ]; then
export os='fedora-redhat';
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
fi
if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^wwwrun /etc/passwd | wc -l` -ge 1 ]; then
export os='opensuse';
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
fi
if [ -d %{_sysconfdir}/httpd/conf.d -a `grep -i "^mageia\|mandriva" /etc/issue | wc -l` -ge 1 ]; then
export os='mageia-mandriva';
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
fi
if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^www-data /etc/passwd | wc -l` -ge 1 ]; then
export os='ubuntu-debian';
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
fi
%endif
%endif
# Remove apache link
if [ -L $apachelink ] ;
then
echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink
status=purge
fi
# Restart web servers if required
if [ "x$status" = "xpurge" ] ;
then
# Restart web server
echo Restart web server
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion}
/sbin/service httpd restart
%else
if [ -f %{_sysconfdir}/init.d/httpd ]; then
%{_sysconfdir}/init.d/httpd restart
fi
if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart
fi
%endif
fi
else
# Upgrade
echo "No remove ation done (this is an upgrade)"
fi
%changelog
* Mon Apr 22 2013 Laurent Destailleur 3.3.2-0.3
* Mon Apr 22 2013 Laurent Destailleur 3.3.5-0.3
- Initial version (#723326)

View File

@@ -278,6 +278,9 @@ echo Restart mysql
if [ -f /etc/init.d/mysqld ]; then
/etc/init.d/mysqld restart
fi
if [ -f /etc/init.d/mysql ]; then
/etc/init.d/mysql restart
fi
# Show result
echo
@@ -291,35 +294,44 @@ echo "-------------------------------------------------------"
echo
#---- postun (after uninstall)
#---- postun (after upgrade or uninstall)
%postun
# Define vars
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
# Remove apache link
if [ -L $apachelink ] ;
if [ "x$1" = "x0" ] ;
then
echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink
status=purge
fi
# Remove
echo "Removed package"
# Restart web servers if required
if [ "x$status" = "xpurge" ] ;
then
# Restart web server
echo Restart web server
if [ -f %{_sysconfdir}/init.d/httpd ]; then
%{_sysconfdir}/init.d/httpd restart
fi
if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart
fi
# Define vars
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
# Remove apache link
if [ -L $apachelink ] ;
then
echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink
status=purge
fi
# Restart web servers if required
if [ "x$status" = "xpurge" ] ;
then
# Restart web server
echo Restart web server
if [ -f %{_sysconfdir}/init.d/httpd ]; then
%{_sysconfdir}/init.d/httpd restart
fi
if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart
fi
fi
else
# Upgrade
echo "No remove ation done (this is an upgrade)"
fi
%changelog
* Mon Apr 22 2013 Laurent Destailleur 3.3.2-0.3
* Mon Apr 22 2013 Laurent Destailleur 3.3.5-0.3
- Initial version (#723326)

View File

@@ -288,6 +288,8 @@ fi
echo Restart mysql
if [ -f /etc/init.d/mysqld ]; then
/etc/init.d/mysqld restart
else
/sbin/service mysql restart
fi
# Show result
@@ -302,35 +304,43 @@ echo "-------------------------------------------------------"
echo
#---- postun (after uninstall)
#---- postun (after upgrade or uninstall)
%postun
# Define vars
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
# Remove apache link
if [ -L $apachelink ] ;
if [ "x$1" = "x0" ] ;
then
echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink
status=purge
# Remove
echo "Removed package"
# Define vars
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
# Remove apache link
if [ -L $apachelink ] ;
then
echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink
status=purge
fi
# Restart web servers if required
if [ "x$status" = "xpurge" ] ;
then
# Restart web server
echo Restart web server
if [ -f %{_sysconfdir}/init.d/httpd ]; then
%{_sysconfdir}/init.d/httpd restart
fi
if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart
fi
fi
else
# Upgrade
echo "No remove ation done (this is an upgrade)"
fi
# Restart web servers if required
if [ "x$status" = "xpurge" ] ;
then
# Restart web server
echo Restart web server
if [ -f %{_sysconfdir}/init.d/httpd ]; then
%{_sysconfdir}/init.d/httpd restart
fi
if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart
fi
fi
%changelog
* Mon Apr 22 2013 Laurent Destailleur 3.3.2-0.3
* Mon Apr 22 2013 Laurent Destailleur 3.3.5-0.3
- Initial version (#723326)

View File

@@ -37,44 +37,26 @@ htdocs/customleave
htdocs/customgoogle
htdocs/document
htdocs/documents
htdocs/includes/jpgraph2
htdocs/includes/fckeditor/_samples
htdocs/includes/fckeditor/_testcases
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/free*.ctg.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
scripts/addons
scripts/books
scripts/courrier
scripts/lolix
scripts/product/import-product.php
scripts/product/materiel.net.php
test
CVS
*~
.#*
.buildpath
.cache
.cvsignore
.gitignore
.externalToolBuilders
.htaccess
.settings
.project
.travis.yml
Thumbs.db
data_dev.sql
doli*.tar.gz
@@ -84,18 +66,5 @@ doli*.rpm
doli*.deb
doli*.zip
cvschangelogbuilder_dolibarr*
deneb
janus
jupiter
lune
mars
pluton
saturne
venus
bigorneau
tourteau
bulot
huitre
pdf_huitre.modules.php
doxygen_warnings.log
dolibarr_install.log

View File

@@ -31,11 +31,8 @@
*/htdocs/custom2/*
*/htdocs/document/*
*/htdocs/documents/*
*/htdocs/lolix/*
*/htdocs/postnuke/*
*/htdocs/telephonie/*
*/htdocs/voyage/*
*/htdocs/includes/jpgraph2/*
*/htdocs/includes/ckeditor/_source
*/htdocs/includes/ckeditor/*_source.js
*/htdocs/includes/fckeditor/_samples/*
*/htdocs/includes/fckeditor/_testcases/*
*/htdocs/includes/nusoap/samples/*
@@ -49,20 +46,18 @@
*/htdocs/includes/tcpdf/fonts/utils/*
*/htdocs/includes/tcpdf/fonts/free*.ctg.z
*/htdocs/includes/tcpdf/fonts/free*.z
*/htdocs/oscommerce_ws/ws_client_demo/*
*/htdocs/theme/rodolphe/*
*/scripts/addons/*
*/scripts/courrier/*
*/scripts/lolix/*
*/test
*/CVS/*
*~
*.#*
*.buildpath*
*.cache*
*.cvsignore*
*.gitignore*
*.htaccess*
*.settings*
*.project*
*.travis.yml*
Thumbs.db
data_dev.sql
dolibarr*.tar.gz
@@ -72,19 +67,5 @@ dolibarr*.rpm
dolibarr*.deb
dolibarr*.zip
cvschangelogbuilder_dolibarr*
*/deneb/*
*/janus/*
*/jupiter/*
*/lune/*
*/mars/*
*/mercure/*
*/pluton/*
*/saturne/*
*/venus/*
*/bigorneau/*
*/tourteau/*
*/bulot/*
*/huitre/*
*/pdf_huitre.modules.php
doxygen_warnings.log
dolibarr_install.log

View File

@@ -219,6 +219,10 @@
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNameInvalid">
<severity>0</severity>
</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">
<severity>0</severity>
</rule>

View File

@@ -48,3 +48,8 @@ with
//var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth);
window.location.href=pRef
* Replace hard coded string with i18n["String"];
JCROP:
------
* Remove analytics tag into file index.html

View File

@@ -5619,69 +5619,6 @@ INSERT INTO `llx_stock_mouvement` VALUES (1,'2010-07-08 22:43:51','2010-07-09 00
/*!40000 ALTER TABLE `llx_stock_mouvement` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `llx_submitew_targets`
--
DROP TABLE IF EXISTS `llx_submitew_targets`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `llx_submitew_targets` (
`rowid` int(11) NOT NULL AUTO_INCREMENT,
`label` varchar(64) NOT NULL,
`targetcode` varchar(16) NOT NULL,
`langcode` varchar(5) DEFAULT 'en_US',
`url` varchar(250) DEFAULT NULL,
`login` varchar(128) DEFAULT NULL,
`pass` varchar(128) DEFAULT NULL,
`comment` varchar(250) DEFAULT NULL,
`position` int(11) DEFAULT '0',
`titlelength` int(11) DEFAULT '32',
`descshortlength` int(11) DEFAULT '256',
`desclonglength` int(11) DEFAULT '2000',
PRIMARY KEY (`rowid`),
UNIQUE KEY `uk_submitewtargets` (`label`,`langcode`)
) ENGINE=InnoDB AUTO_INCREMENT=72 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `llx_submitew_targets`
--
LOCK TABLES `llx_submitew_targets` WRITE;
/*!40000 ALTER TABLE `llx_submitew_targets` DISABLE KEYS */;
INSERT INTO `llx_submitew_targets` VALUES (17,'hhho','email','fr_FR','',NULL,NULL,NULL,0,0,-1,0),(34,'pppp','facebook','fr_FR',NULL,'eldy','ld101010-fk',NULL,0,-1,-1,-1),(35,'hfghfgh','web','de_DE','http://wwww','ffffmmm','null',NULL,0,-1,-1,-1),(37,'llll','linkedin','fr_FR','',NULL,NULL,NULL,0,32,256,2000),(55,'fff','dig','fr_FR',NULL,'hfgh','hfghgf',NULL,0,-1,-1,-1),(56,'aaaaaaa','linkedin','da_DK',NULL,'aa','aaa',NULL,0,32,256,2000),(57,'ddd','dig','en_US',NULL,'dd',NULL,NULL,0,32,256,2000),(59,'dddff','dig','en_US',NULL,NULL,NULL,NULL,0,32,256,2000),(68,'dddffe','dig','en_US',NULL,NULL,NULL,NULL,0,32,256,2000),(70,'dddffef','dig','en_US','http://www.dig.com',NULL,NULL,NULL,0,32,256,2000),(71,'ffff','dig','en_US','http://www.dig.com',NULL,NULL,NULL,0,32,256,2000);
/*!40000 ALTER TABLE `llx_submitew_targets` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `llx_submitew_targets_params`
--
DROP TABLE IF EXISTS `llx_submitew_targets_params`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `llx_submitew_targets_params` (
`rowid` int(11) NOT NULL AUTO_INCREMENT,
`fk_target` int(11) NOT NULL,
`paramkey` varchar(16) NOT NULL,
`paramvalue` varchar(128) DEFAULT '',
PRIMARY KEY (`rowid`),
UNIQUE KEY `idx_submitewtargets_fk_target` (`fk_target`),
UNIQUE KEY `uk_submitewtargets_params` (`fk_target`,`paramkey`,`paramvalue`),
CONSTRAINT `fk_submitewtargets_fk_target` FOREIGN KEY (`fk_target`) REFERENCES `llx_submitew_targets` (`rowid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `llx_submitew_targets_params`
--
LOCK TABLES `llx_submitew_targets_params` WRITE;
/*!40000 ALTER TABLE `llx_submitew_targets_params` DISABLE KEYS */;
/*!40000 ALTER TABLE `llx_submitew_targets_params` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `llx_texts`
--

View File

@@ -5528,69 +5528,6 @@ INSERT INTO `llx_stock_mouvement` (`rowid`, `tms`, `datem`, `fk_product`, `fk_en
/*!40000 ALTER TABLE `llx_stock_mouvement` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `llx_submitew_targets`
--
DROP TABLE IF EXISTS `llx_submitew_targets`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `llx_submitew_targets` (
`rowid` int(11) NOT NULL AUTO_INCREMENT,
`label` varchar(64) NOT NULL,
`targetcode` varchar(16) NOT NULL,
`langcode` varchar(5) DEFAULT 'en_US',
`url` varchar(250) DEFAULT NULL,
`login` varchar(128) DEFAULT NULL,
`pass` varchar(128) DEFAULT NULL,
`comment` varchar(250) DEFAULT NULL,
`position` int(11) DEFAULT '0',
`titlelength` int(11) DEFAULT '32',
`descshortlength` int(11) DEFAULT '256',
`desclonglength` int(11) DEFAULT '2000',
PRIMARY KEY (`rowid`),
UNIQUE KEY `uk_submitewtargets` (`label`,`langcode`)
) ENGINE=InnoDB AUTO_INCREMENT=72 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `llx_submitew_targets`
--
LOCK TABLES `llx_submitew_targets` WRITE;
/*!40000 ALTER TABLE `llx_submitew_targets` DISABLE KEYS */;
INSERT INTO `llx_submitew_targets` (`rowid`, `label`, `targetcode`, `langcode`, `url`, `login`, `pass`, `comment`, `position`, `titlelength`, `descshortlength`, `desclonglength`) VALUES (17,'hhho','email','fr_FR','',NULL,NULL,NULL,0,0,-1,0),(34,'pppp','facebook','fr_FR',NULL,'eldy','ld101010-fk',NULL,0,-1,-1,-1),(35,'hfghfgh','web','de_DE','http://wwww','ffffmmm','null',NULL,0,-1,-1,-1),(37,'llll','linkedin','fr_FR','',NULL,NULL,NULL,0,32,256,2000),(55,'fff','dig','fr_FR',NULL,'hfgh','hfghgf',NULL,0,-1,-1,-1),(56,'aaaaaaa','linkedin','da_DK',NULL,'aa','aaa',NULL,0,32,256,2000),(57,'ddd','dig','en_US',NULL,'dd',NULL,NULL,0,32,256,2000),(59,'dddff','dig','en_US',NULL,NULL,NULL,NULL,0,32,256,2000),(68,'dddffe','dig','en_US',NULL,NULL,NULL,NULL,0,32,256,2000),(70,'dddffef','dig','en_US','http://www.dig.com',NULL,NULL,NULL,0,32,256,2000),(71,'ffff','dig','en_US','http://www.dig.com',NULL,NULL,NULL,0,32,256,2000);
/*!40000 ALTER TABLE `llx_submitew_targets` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `llx_submitew_targets_params`
--
DROP TABLE IF EXISTS `llx_submitew_targets_params`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `llx_submitew_targets_params` (
`rowid` int(11) NOT NULL AUTO_INCREMENT,
`fk_target` int(11) NOT NULL,
`paramkey` varchar(16) NOT NULL,
`paramvalue` varchar(128) DEFAULT '',
PRIMARY KEY (`rowid`),
UNIQUE KEY `idx_submitewtargets_fk_target` (`fk_target`),
UNIQUE KEY `uk_submitewtargets_params` (`fk_target`,`paramkey`,`paramvalue`),
CONSTRAINT `fk_submitewtargets_fk_target` FOREIGN KEY (`fk_target`) REFERENCES `llx_submitew_targets` (`rowid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `llx_submitew_targets_params`
--
LOCK TABLES `llx_submitew_targets_params` WRITE;
/*!40000 ALTER TABLE `llx_submitew_targets_params` DISABLE KEYS */;
/*!40000 ALTER TABLE `llx_submitew_targets_params` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `llx_texts`
--

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

12
htdocs/.gitignore vendored
View File

@@ -1,5 +1,11 @@
/test.php
/custom*
/bootstrap
/multicompany
/skincoloreditor
/extensions*
/nltechno*
/bootstrap*
/google*
/multicompany*
/numberingpack*
/ovh*
/pos
/ultimatepdf*

View File

@@ -118,12 +118,12 @@ print '<br>';
print $langs->trans("NoteOnPathLocation").'<br>';
$url1='http://www.maxmind.com/app/perl?rId=awstats';
$url1='http://www.maxmind.com/en/city?rId=awstats';
print $langs->trans("YouCanDownloadFreeDatFileTo",'<a href="'.$url1.'" target="_blank">'.$url1.'</a>');
print '<br>';
$url2='http://www.maxmind.com/app/perl?rId=awstats';
$url2='http://www.maxmind.com/en/city?rId=awstats';
print $langs->trans("YouCanDownloadAdvancedDatFileTo",'<a href="'.$url2.'" target="_blank">'.$url2.'</a>');
if ($geoip)

View File

@@ -68,7 +68,7 @@ print '<br>';
print '<br>';
//print '<hr style="color: #DDDDDD;">';
print img_picto('','puce').' '.$langs->trans("SetupDescription4",DOL_URL_ROOT.'/admin/modules.php?mainmenu=home');
if (count($conf->modules) <= 1) // If only user module enabled
if (count($conf->modules) <= (empty($conf->global->MAIN_MINNB_MODULE)?1:$conf->global->MAIN_MINNB_MODULE)) // If only user module enabled
{
$langs->load("errors");
$warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"));

View File

@@ -154,7 +154,8 @@ foreach ($modulesdir as $dir)
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified=0;
if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified=0;
//if ($mode == 'expdev' && ($objMod->version != 'experimental' && $objMod->version != 'development')) $modulequalified=0;
// We discard modules according to property disabled
if (! empty($objMod->hidden)) $modulequalified=false;
// Define array $categ with categ with at least one qualified module
if ($modulequalified)

View File

@@ -1000,7 +1000,7 @@ if ($id > 0)
{
$project=new Project($db);
$project->fetch($act->fk_project);
print $project->getNomUrl(1);
print $project->getNomUrl(1,'',1);
}
print '</td></tr>';
}

View File

@@ -153,9 +153,9 @@ $sql.= " ua.login as loginauthor, ua.rowid as useridauthor,";
$sql.= " ut.login as logintodo, ut.rowid as useridtodo,";
$sql.= " ud.login as logindone, ud.rowid as useriddone,";
$sql.= " sp.name, sp.firstname";
$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c,";
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c,";
$sql.= " ".MAIN_DB_PREFIX.'user as u,';
$sql.= " ".MAIN_DB_PREFIX."actioncomm as a)";
$sql.= " ".MAIN_DB_PREFIX."actioncomm as a";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";

View File

@@ -641,7 +641,8 @@ else if ($action == "addline" && $user->rights->propal->creer)
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
$error++;
}
if ((empty($idprod) || GETPOST('usenewaddlineform')) && (!($price_ht != 0) || $price_ht == '')) // Unit price can be 0 but not ''. Also price can be negative for proposal.
if ((empty($idprod) || GETPOST('usenewaddlineform')) && $price_ht == '') // Unit price can be 0 but not ''. Also price can be negative for proposal.
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
$error++;

View File

@@ -27,6 +27,7 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';

View File

@@ -122,8 +122,8 @@ class FactureRec extends Facture
$sql.= ", '".$facsrc->socid."'";
$sql.= ", ".$conf->entity;
$sql.= ", ".$this->db->idate($now);
$sql.= ", '".$facsrc->amount."'";
$sql.= ", '".$facsrc->remise."'";
$sql.= ", ".(!empty($facsrc->amount)?$facsrc->amount:'0');
$sql.= ", ".(!empty($facsrc->remise)?$this->remise:'0');
$sql.= ", '".$this->db->escape($this->note)."'";
$sql.= ", '".$user->id."'";
$sql.= ", ".(! empty($facsrc->fk_project)?"'".$facsrc->fk_project."'":"null");

View File

@@ -400,7 +400,7 @@ if ($resql)
print '<td align="right"><b>'.price($total_tva).' '.getCurrencySymbol($conf->currency).'</b></td>';
print '<td align="right"><b>'.price($total_ttc).' '.getCurrencySymbol($conf->currency).'</b></td>';
print '<td align="right"><b>'.price($total_paid).' '.getCurrencySymbol($conf->currency).'</b></td>';
print '<td align="center">&nbsp;</td>';
print '<td align="right"><b>'.price($total_ttc - $total_paid).' '.getCurrencySymbol($conf->currency).'</b></td>';
print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>';
print "</tr>\n";

View File

@@ -262,7 +262,7 @@ if ($resql)
// Expected to pay
print '<td align="right">'.price($objp->sc_amount).'</td>';
// Status
print '<td align="center">'.$socialcontrib->LibStatut($objp->fk_statut,2).'</td>';
print '<td align="center">'.$socialcontrib->getLibStatut(4).'</td>';
// Amount payed
print '<td align="right">'.price($objp->amount).'</td>';
print "</tr>\n";

View File

@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
@@ -57,7 +57,7 @@ if ($sortorder == "") $sortorder="DESC";
if ($sortfield == "") $sortfield="p.datec";
$rej = new RejetPrelevement($db, $user);
$ligne = new LignePrelevement($db);
$ligne = new LignePrelevement($db, $user);
/*
* Liste des factures

View File

@@ -1,3 +1,4 @@
/conf.php
/conf.php.old
/conf.php.sav
/conf.php.mysql

View File

@@ -27,7 +27,7 @@
/**
* 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 $error='';

View File

@@ -1068,7 +1068,13 @@ abstract class CommonObject
// We frist search all lines that are parent lines (for multilevel details lines)
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
$sql.= ' AND fk_parent_line IS NULL';
//This test is to fix Fix [ bug #911 ] Reorder intervention do not work in 3.3
//Do not merge in 3.4 'table column fk_parent_line already added into 3.4
if ($this->table_element_line != 'fichinterdet') {
$sql.= ' AND fk_parent_line IS NULL';
}
$sql.= ' ORDER BY rang ASC, rowid '.$rowidorder;
dol_syslog(get_class($this)."::line_order search all parent lines sql=".$sql, LOG_DEBUG);

View File

@@ -169,7 +169,8 @@ class DolEditor
//$skin='office2003';
//$skin='v2';
$skin='kama';
if (constant('JS_CKEDITOR')) $skin='moono'; // To use external ckeditor 4 js lib
if ($this->toolbarname=='dolibarr_mailings') {$htmlencode_force='true';}
else {$htmlencode_force='false';}

View File

@@ -483,7 +483,7 @@ class FormFile
// Show file date
$date=(! empty($file['date'])?$file['date']:dol_filemtime($filedir."/".$file["name"]));
$out.= '<td align="right" nowrap="nowrap">'.dol_print_date($date, 'dayhour').'</td>';
$out.= '<td align="right" nowrap="nowrap">'.dol_print_date($date, 'dayhour', 'tzuser').'</td>';
if ($delallowed)
{

View File

@@ -184,11 +184,10 @@ function show_array_actions_to_do($max=5)
$sql = "SELECT a.id, a.label, a.datep as dp, a.datep2 as dp2, a.fk_user_author, a.percent,";
$sql.= " c.code, c.libelle,";
$sql.= " s.nom as sname, s.rowid, s.client";
$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c,";
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c,";
$sql.= " ".MAIN_DB_PREFIX."actioncomm as a";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ")";
$sql.= " WHERE c.id = a.fk_action";
$sql.= " AND a.entity = ".$conf->entity;
$sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))";
@@ -283,11 +282,10 @@ function show_array_last_actions_done($max=5)
$sql = "SELECT a.id, a.percent, a.datep as da, a.datep2 as da2, a.fk_user_author, a.label,";
$sql.= " c.code, c.libelle,";
$sql.= " s.rowid, s.nom as sname, s.client";
$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c,";
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c,";
$sql.= " ".MAIN_DB_PREFIX."actioncomm as a";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.=")";
$sql.= " WHERE c.id = a.fk_action";
$sql.= " AND a.entity = ".$conf->entity;
$sql.= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))";

View File

@@ -66,7 +66,7 @@ function pdf_getFormat()
}
/**
* 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 $metric Unit of format ('mm')
@@ -407,19 +407,24 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
elseif ($unit=='cm') $k=72/2.54;
elseif ($unit=='in') $k=72;
$watermark_angle=atan($h/$w);
$watermark_x=5;
$watermark_y=$h-50; // We must be sure to not print into margins
$watermark_width=$h;
$pdf->SetFont('','B',50);
$savx=$pdf->getX(); $savy=$pdf->getY();
$watermark_angle=atan($h/$w)/2;
$watermark_x_pos=0;
$watermark_y_pos=$h/3;
$watermark_x=$w/2;
$watermark_y=$h/3;
$pdf->SetFont('','B',40);
$pdf->SetTextColor(255,192,203);
//rotate
$pdf->_out(sprintf('q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm',cos($watermark_angle),sin($watermark_angle),-sin($watermark_angle),cos($watermark_angle),$watermark_x*$k,($h-$watermark_y)*$k,-$watermark_x*$k,-($h-$watermark_y)*$k));
//print watermark
$pdf->SetXY($watermark_x,$watermark_y);
$pdf->Cell($watermark_width,25,$outputlangs->convToOutputCharset($text),0,2,"C",0);
$pdf->SetXY($watermark_x_pos,$watermark_y_pos);
$pdf->Cell($w-20,25,$outputlangs->convToOutputCharset($text),"",2,"C",0);
//antirotate
$pdf->_out('Q');
$pdf->SetXY($savx,$savy);
}
@@ -1118,7 +1123,7 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0,$hookmanage
}
else
{
if (empty($hidedetails) || $hidedetails > 1) return price($sign * $object->lines[$i]->subprice);
if (empty($hidedetails) || $hidedetails > 1) return price($sign * $object->lines[$i]->subprice, 0, $outputlangs);
}
}
@@ -1144,7 +1149,7 @@ function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0)
}
else
{
if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100);
if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
}
}
@@ -1328,7 +1333,7 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0,$hookman
}
else
{
if (empty($hidedetails) || $hidedetails > 1) return price($sign * $object->lines[$i]->total_ht);
if (empty($hidedetails) || $hidedetails > 1) return price($sign * $object->lines[$i]->total_ht, 0, $outputlangs);
}
}
}
@@ -1362,7 +1367,7 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
else
{
if (empty($hidedetails) || $hidedetails > 1) return
price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100);
price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
}
}
}

View File

@@ -69,6 +69,9 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
$result=array();
// Clean parameters
if (empty($txtva)) $txtva=0;
if (empty($seller) || ! is_object($seller))
{
if (! is_object($mysoc)) // mysoc may be not defined (during migration process)

View File

@@ -660,7 +660,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
}
$newmenu->add("/admin/company.php?mainmenu=home", $langs->trans("MenuCompanySetup").' '.$warnpicto,1);
$warnpicto='';
if (count($conf->modules) <= 1) // If only user module enabled
if (count($conf->modules) <= (empty($conf->global->MAIN_MINNB_MODULE)?1:$conf->global->MAIN_MINNB_MODULE)) // If only user module enabled
{
$langs->load("errors");
$warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"));

View File

@@ -145,7 +145,7 @@ class CommActionRapport
$nbpage = $this->_pages($pdf, $outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close();
$pdf->Output($file,'F');

View File

@@ -161,7 +161,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
// Pied de page
$this->_pagefoot($pdf,'',$outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close();

View File

@@ -471,7 +471,7 @@ class pdf_einstein extends ModelePDFCommandes
// Pied de page
$this->_pagefoot($pdf,$object,$outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close();
@@ -702,7 +702,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (! empty($object->remise)?$object->remise:0)), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (! empty($object->remise)?$object->remise:0), 0, $outputlangs), 0, 'R', 1);
// Show VAT by rates and total
$pdf->SetFillColor(248,248,248);
@@ -743,7 +743,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
}
}
}
@@ -776,7 +776,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
}
}
@@ -803,7 +803,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
}
}
@@ -834,14 +834,14 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvakey, 0, $outputlangs), 0, 'R', 1);
}
else
{
$totalvat.=vatrate(abs($tvakey),1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
}
}
}
@@ -874,7 +874,7 @@ class pdf_einstein extends ModelePDFCommandes
if ($localtax_type == '7') { // amount on order
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvakey, 0, $outputlangs), 0, 'R', 1);
}
else
{
@@ -882,7 +882,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
}
}
}
@@ -897,7 +897,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc, 0, $outputlangs), $useborder, 'R', 1);
}
}
@@ -919,7 +919,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle), 0, 'R', 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0);
$index++;
$pdf->SetTextColor(0,0,60);
@@ -928,7 +928,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer), $useborder, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetTextColor(0,0,0);
@@ -1204,6 +1204,8 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4));
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
}
$pdf->SetTextColor(0,0,0);
}
/**

View File

@@ -169,7 +169,7 @@ class pdf_expedition_merou extends ModelePdfExpedition
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Sending"));
@@ -302,7 +302,7 @@ class pdf_expedition_merou extends ModelePdfExpedition
// Pied de page
$this->_pagefoot($pdf, $object, $outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close();

View File

@@ -155,7 +155,7 @@ class pdf_expedition_rouget extends ModelePdfExpedition
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Sending"));
@@ -322,7 +322,7 @@ class pdf_expedition_rouget extends ModelePdfExpedition
// Pied de page
$this->_pagefoot($pdf,$object,$outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close();

View File

@@ -473,7 +473,7 @@ class pdf_crabe extends ModelePDFFactures
// Pied de page
$this->_pagefoot($pdf,$object,$outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close();
@@ -589,7 +589,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($tab3_posx, $tab3_top+$y);
$pdf->MultiCell(20, 3, dol_print_date($obj->datef,'day',false,$outputlangs,true), 0, 'L', 0);
$pdf->SetXY($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 3, price($obj->amount_ttc), 0, 'L', 0);
$pdf->MultiCell(20, 3, price($obj->amount_ttc, 0, $outputlangs), 0, 'L', 0);
$pdf->SetXY($tab3_posx+40, $tab3_top+$y);
$pdf->MultiCell(20, 3, $text, 0, 'L', 0);
$pdf->SetXY($tab3_posx+58, $tab3_top+$y);
@@ -626,7 +626,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($tab3_posx, $tab3_top+$y);
$pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->date),'day',false,$outputlangs,true), 0, 'L', 0);
$pdf->SetXY($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 3, price($sign * $row->amount), 0, 'L', 0);
$pdf->MultiCell(20, 3, price($sign * $row->amount, 0, $outputlangs), 0, 'L', 0);
$pdf->SetXY($tab3_posx+40, $tab3_top+$y);
$oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $row->code);
@@ -832,7 +832,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($object->total_ht + (! empty($object->remise)?$object->remise:0))), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($object->total_ht + (! empty($object->remise)?$object->remise:0)), 0, $outputlangs), 0, 'R', 1);
// Show VAT by rates and total
$pdf->SetFillColor(248,248,248);
@@ -874,7 +874,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
}
}
}
@@ -908,7 +908,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
}
}
@@ -935,7 +935,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
}
}
@@ -966,14 +966,14 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvakey, 0, $outputlangs), 0, 'R', 1);
}
else
{
$totalvat.=vatrate(abs($tvakey),1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
}
}
}
@@ -1007,7 +1007,7 @@ class pdf_crabe extends ModelePDFFactures
if ($localtax_type == '7') { // amount on order
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvakey, 0, $outputlangs), 0, 'R', 1);
}
else
{
@@ -1015,7 +1015,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
}
}
}
@@ -1030,7 +1030,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_ttc), $useborder, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_ttc, 0, $outputlangs), $useborder, 'R', 1);
}
}
@@ -1049,7 +1049,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("Paid"), 0, 'L', 0);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle + $depositsamount), 0, 'R', 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle + $depositsamount, 0, $outputlangs), 0, 'R', 0);
// Credit note
if ($creditnoteamount)
@@ -1058,7 +1058,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("CreditNotes"), 0, 'L', 0);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($creditnoteamount), 0, 'R', 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($creditnoteamount, 0, $outputlangs), 0, 'R', 0);
}
// Escompte
@@ -1070,7 +1070,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOffered"), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount), $useborder, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 0, $outputlangs), $useborder, 'R', 1);
$resteapayer=0;
}
@@ -1081,7 +1081,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer), $useborder, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1);
// Fin
$pdf->SetFont('','', $default_font_size - 1);
@@ -1410,6 +1410,8 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4));
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
}
$pdf->SetTextColor(0,0,0);
}
/**

View File

@@ -320,7 +320,7 @@ class pdf_soleil extends ModelePDFFicheinter
}
$this->_pagefoot($pdf,$object,$outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close();

View File

@@ -162,7 +162,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$dir = $conf->expedition->dir_output."/receipt/" . $objectref;
$file = $dir . "/" . $objectref . ".pdf";
}
if (! file_exists($dir))
{
if (dol_mkdir($dir) < 0)
@@ -175,7 +175,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
if (file_exists($dir))
{
$nblines = count($object->lines);
// Create pdf instance
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
@@ -288,7 +288,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$curX = $this->posxdesc-1;
$showpricebeforepagebreak=1;
$pdf->startTransaction();
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxcomm-$curX,3,$curX,$curY,$hideref,$hidedesc);
$pageposafter=$pdf->getPage();
@@ -320,7 +320,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
{
$pdf->commitTransaction();
}
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
@@ -429,11 +429,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder
// Affiche zone infos
$posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
// Pied de page
$this->_pagefoot($pdf,$object,$outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
// Check product remaining to be delivered
// TODO doit etre modifie
//$waitingDelivery = $object->getRemainingDelivered();
@@ -492,7 +492,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$this->_pagefoot($pdf,$object,$outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
}*/
$pdf->Close();
@@ -539,20 +539,20 @@ class pdf_typhon extends ModelePDFDeliveryOrder
{
global $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetFont('','', $default_font_size);
$pdf->SetXY($this->marge_gauche, $posy);
$larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3;
$pdf->Rect($this->marge_gauche, $posy + 1, $larg_sign, 25);
$pdf->SetXY($this->marge_gauche + 2, $posy + 2);
$pdf->MultiCell($larg_sign,2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":",'','L');
$pdf->Rect(2*$larg_sign+$this->marge_gauche, $posy + 1, $larg_sign, 25);
$pdf->SetXY(2*$larg_sign+$this->marge_gauche + 2, $posy + 2);
$pdf->MultiCell($larg_sign,2, $outputlangs->trans("ForCustomer").':','','L');
}
/**
* Show table for lines
*
@@ -568,13 +568,13 @@ class pdf_typhon extends ModelePDFDeliveryOrder
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf,$mysoc;
// Force to disable hidetop and hidebottom
$hidebottom=0;
if ($hidetop) $hidetop=-1;
$default_font_size = pdf_getPDFFontSize($outputlangs);
// Amount in (at tab_top - 1)
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
@@ -586,11 +586,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder
{
$pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6);
}
$pdf->SetDrawColor(128,128,128);
$pdf->SetFont('','', $default_font_size - 1);
if (empty($hidetop))
if (empty($hidetop))
{
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
$pdf->MultiCell($this->posxcomm - $this->posxdesc,2, $outputlangs->transnoentities("Designation"),'','L');
@@ -634,15 +634,15 @@ class pdf_typhon extends ModelePDFDeliveryOrder
{
pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->COMMANDE_DRAFT_WATERMARK);
}
$pdf->SetTextColor(0,0,60);
$pdf->SetFont('','B', $default_font_size + 3);
$posy=$this->marge_haute;
$posx=$this->page_largeur-$this->marge_droite-100;
$pdf->SetXY($this->marge_gauche,$posy);
// Logo
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
@@ -694,21 +694,21 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$pdf->SetTextColor(0,0,60);
$posy+=2;
// Show list of linked objects
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
if ($showaddress)
{
// Sender properties
$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur);
// Show sender
$posy=42;
$posx=$this->marge_gauche;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
$hautcadre=40;
// Show sender frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
@@ -728,7 +728,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$pdf->SetXY($posx+2,$posy+8);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
// Client destinataire
$posy=42;
$pdf->SetTextColor(0,0,0);

View File

@@ -169,7 +169,7 @@ class MailingTargets // This can't be abstract as it is used for some method
$sql .= "'".$this->db->escape($cibles[$i]['email'])."',";
$sql .= "'".$this->db->escape($cibles[$i]['other'])."',";
$sql .= "'".$this->db->escape($cibles[$i]['source_url'])."',";
$sql .= "'".$this->db->escape($cibles[$i]['source_id'])."',";
$sql .= "".(empty($cibles[$i]['source_id']) ? 'null' : "'".$this->db->escape($cibles[$i]['source_id'])."'").",";
if (! empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE)) {
$sql .= "'".$this->db->escape(md5($cibles[$i]['email'].';'.$cibles[$i]['name'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY))."',";
}

View File

@@ -175,11 +175,9 @@ class mailing_thirdparties_services_expired extends MailingTargets
* For example if this selector is used to extract 500 different
* emails from a text file, this function must return 500.
*
* @param int $filter Filter
* @param string $option Option
* @return int Number of recipients
*/
function getNbOfRecipients($sql,$filter=1,$option='')
function getNbOfRecipients($sql='')
{
$now=dol_now();

View File

@@ -62,6 +62,8 @@ class modFckeditor extends DolibarrModules
$this->config_page_url = array("fckeditor.php");
// Dependances
global $dolibarr_js_CKEDITOR;
$this->hidden = ($dolibarr_js_CKEDITOR == 'disabled'?1:0); // A condition to disable module (used for native debian packages)
$this->depends = array();
$this->requiredby = array();

View File

@@ -287,7 +287,7 @@ class pdf_baleine extends ModelePDFProjects
* Pied de page
*/
$this->_pagefoot($pdf,$object,$outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close();

View File

@@ -471,7 +471,7 @@ class pdf_azur extends ModelePDFPropales
// Pied de page
$this->_pagefoot($pdf,$object,$outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close();
@@ -735,7 +735,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (! empty($object->remise)?$object->remise:0)), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (! empty($object->remise)?$object->remise:0), 0, $outputlangs), 0, 'R', 1);
// Show VAT by rates and total
$pdf->SetFillColor(248,248,248);
@@ -777,7 +777,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
}
}
}
@@ -811,7 +811,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
}
}
@@ -838,7 +838,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
}
}
@@ -869,14 +869,14 @@ class pdf_azur extends ModelePDFPropales
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvakey, 0, $outputlangs), 0, 'R', 1);
}
else
{
$totalvat.=vatrate(abs($tvakey),1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
}
}
}
@@ -909,7 +909,7 @@ class pdf_azur extends ModelePDFPropales
if ($localtax_type == '7') { // amount on order
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvakey, 0, $outputlangs), 0, 'R', 1);
}
else
{
@@ -917,7 +917,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
}
}
}
@@ -932,7 +932,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc, 0, $outputlangs), $useborder, 'R', 1);
}
}
@@ -951,7 +951,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle), 0, 'R', 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0);
/*
if ($object->close_code == 'discount_vat')
@@ -963,7 +963,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOffered"), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle), $useborder, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle, 0, $outputlangs), $useborder, 'R', 1);
$resteapayer=0;
}
@@ -976,7 +976,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer), $useborder, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetTextColor(0,0,0);
@@ -1273,6 +1273,8 @@ class pdf_azur extends ModelePDFPropales
$pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4));
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
}
$pdf->SetTextColor(0,0,0);
}
/**

View File

@@ -210,7 +210,7 @@ class pdf_paiement
$this->Body($pdf, 1, $lines, $outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close();

View File

@@ -407,7 +407,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
// Pied de page
$this->_pagefoot($pdf, $object, $outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close();

View File

@@ -425,7 +425,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
// Pied de page
$this->_pagefoot($pdf, $object, $outputlangs);
$pdf->AliasNbPages();
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close();

View File

@@ -29,7 +29,7 @@
* \brief File that include conf.php file and commons lib like functions.lib.php
*/
if (! defined('DOL_VERSION')) define('DOL_VERSION','3.3.2');
if (! defined('DOL_VERSION')) define('DOL_VERSION','3.3.5');
if (! defined('EURO')) define('EURO',chr(128));
// Define syslog constants

View 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
* &lt;script&gt;
* CKEDITOR.config.jqueryOverrideVal = true;
* &lt;/script&gt;
* &lt;!-- Important: The JQuery adapter is loaded *after* setting jqueryOverrideVal --&gt;
* &lt;script src="/ckeditor/adapters/jquery.js"&gt;&lt;/script&gt;
* @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;
};
});
}
})();

View 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
*/

View 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
*/

View 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 )

View 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 &lt;textarea&gt; 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 &lt;textarea&gt; 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
* &lt;textarea id="myfield" name="myfield"&gt;&lt:/textarea&gt;
* ...
* <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
* &lt;div id="editorSpace"&gt;&lt:/div&gt;
* ...
* <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 &lt;textarea&gt; elements available in the document with
* editor instances.
* @example
* // Replace all &lt;textarea&gt; elements in the page.
* CKEDITOR.replaceAll();
* @example
* // Replace all &lt;textarea class="myClassName"&gt; elements in the page.
* CKEDITOR.replaceAll( 'myClassName' );
* @example
* // Selectively replace &lt;textarea&gt; 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';
})();
}

View 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 );
* });
*/

View 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.
* });
*/

View 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>&lt;p&gt;</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>&lt;br&gt;</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>&lt;div&gt;</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>&lt;CKEditor folder&gt;</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>&lt;textarea&gt;</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>&lt;CKEditor folder&gt;</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> &ndash; indicates that content direction will be the same as the user interface language direction;</li>
* <li><code>'ltr'</code> &ndash; for Left-To-Right language (like English);</li>
* <li><code>'rtl'</code> &ndash; 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>&lt;br&gt;</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) &ndash; new <code>&lt;p&gt;</code> paragraphs are created;</li>
* <li><code>{@link CKEDITOR.ENTER_BR}</code> (2) &ndash; lines are broken with <code>&lt;br&gt;</code> elements;</li>
* <li><code>{@link CKEDITOR.ENTER_DIV}</code> (3) &ndash; new <code>&lt;div&gt;</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>&lt;div&gt;</code> element will create a new paragraph with <code>&lt;p&gt;</code>
* instead of a <code>&lt;div&gt;</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) &ndash; new <code>&lt;p&gt;</code> paragraphs are created;</li>
* <li><code>{@link CKEDITOR.ENTER_BR}</code> (2) &ndash; lines are broken with <code>&lt;br&gt;</code> elements;</li>
* <li><code>{@link CKEDITOR.ENTER_DIV}</code> (3) &ndash; new <code>&lt;div&gt;</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>'&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;'</code>
* @example
* // Set the DOCTYPE to the HTML 4 (Quirks) mode.
* config.docType = '&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"&gt;';
*/
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>&lt;html&gt;</code>,
* <code>&lt;head&gt;</code>, and <code>&lt;body&gt;</code> elements.
* The final output will also reflect this setting, including the
* <code>&lt;body&gt;</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 )

View 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 &lt;body&gt;
* 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 ); // '&lt;p&gt;This is &lt;b&gt;an example&lt;/b&gt;.&lt;/p&gt;'
*/
/**
* 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 &lt;body&gt; 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 = '&lt;p&gt;This is &lt;b&gt;an example&lt;/b&gt;.&lt;/p&gt;';
* var data = editor.dataProcessor.toDataFormat( html ); // 'This is [b]an example[/b].'
*/

View 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 )

View 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 + '-->';
}
});

View 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 &lt;head&gt; element for this document.
* @returns {CKEDITOR.dom.element} The &lt;head&gt; 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 &lt;body&gt; element for this document.
* @returns {CKEDITOR.dom.element} The &lt;body&gt; 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(
* '&lt;html&gt;' +
* '&lt;head&gt;&lt;title&gt;Sample Doc&lt;/title&gt;&lt;/head&gt;' +
* '&lt;body&gt;Document contents created by code&lt;/body&gt;' +
* '&lt;/html&gt;' );
*/
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();
}
});

View File

@@ -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
} );

View 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 );

File diff suppressed because it is too large Load Diff

View 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;
}
};

View 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;

View 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: "&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;"
*/
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: "&lt;em&gt;&lt;/em&gt;&lt;strong&gt;&lt;/strong&gt;"
*/
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: "&lt;strong&gt;&lt;/strong&gt;&lt;em&gt;&lt;/em&gt;"
*/
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>&lt;body&gt;</code> is the second child
* of <code>&lt;html&gt;</code> (<code>&lt;head&gt;</code> being the first),
* and we would like to address the third child under the
* fourth child of <code>&lt;body&gt;</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( '&lt;div&gt;&lt;b&gt;Example&lt;/b&gt; &lt;i&gt;next&lt;/i&gt;&lt;/div&gt;' );
* 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:
* // &lt;div id="outer"&gt;&lt;div id="inner"&gt;&lt;p&gt;&lt;b&gt;Some text&lt;/b&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;
* // If node == &lt;b&gt;
* ascendant = node.getAscendant( 'div' ); // ascendant == &lt;div id="inner"&gt
* ascendant = node.getAscendant( 'b' ); // ascendant == null
* ascendant = node.getAscendant( 'b', true ); // ascendant == &lt;b&gt;
* ascendant = node.getAscendant( { div: 1, p: 1} ); // Searches for the first 'div' or 'p': ascendant == &lt;div id="inner"&gt
*/
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:
* // &lt;div contenteditable="false"&gt;Some &lt;b&gt;text&lt;/b&gt;&lt;/div&gt;
*
* // If "ele" is the above &lt;div&gt;
* 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;
}
}
}
);

View 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;
}
};

File diff suppressed because it is too large Load Diff

View 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
*/

View 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 );
}
});

View 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:
*
* [&lt;p&gt;Some &lt;b&gt;sample] text&lt;/b&gt;
*
* While walking forward into the above range, the following nodes are
* returned: &lt;p&gt;, "Some ", &lt;b&gt; 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
// * &lt;body&gt; 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 ]*(?:&nbsp;|\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;
};
})();

View 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
};
}
}
});

View 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 (&lt;span&gt; like) elements.
*/
$inline : L, // Just like span.
/**
* list of elements that can be children at &lt;body&gt;.
*/
$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 )

File diff suppressed because it is too large Load Diff

View 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 &lt;textarea&gt; 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 );
}

View 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 )

View 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 ) ;
}
};
})();
}

View 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'
* });
*/

View 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' );
* });
*/

Some files were not shown because too many files have changed in this diff Show More