From 32ca894952fd43e37bd5c88a62fe069dff766c4c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Aug 2012 22:05:40 +0200 Subject: [PATCH 01/26] Try a fix for js syntax error --- htdocs/core/tpl/objectline_add.tpl.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_add.tpl.php b/htdocs/core/tpl/objectline_add.tpl.php index 72e647f3da1..2fdf04d2403 100644 --- a/htdocs/core/tpl/objectline_add.tpl.php +++ b/htdocs/core/tpl/objectline_add.tpl.php @@ -234,8 +234,7 @@ $(document).ready(function() { $.post('/product/ajax/products.php', { 'action': 'fetch', 'id': $(this).val(), - 'price_level': price_level; ?> - }, + 'price_level': price_level)?1:$buyer->price_level; ?>}, function(data) { if (typeof data != 'undefined') { $('#product_ref').val(data.ref); From bd05056616f54307b405f3d8783ba2055b3f1917 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Aug 2012 22:25:58 +0200 Subject: [PATCH 02/26] Fix: Missing br removed from select_produits --- htdocs/core/tpl/predefinedproductline_create.tpl.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/tpl/predefinedproductline_create.tpl.php b/htdocs/core/tpl/predefinedproductline_create.tpl.php index 35ca0e16cf3..206e1e9c70e 100644 --- a/htdocs/core/tpl/predefinedproductline_create.tpl.php +++ b/htdocs/core/tpl/predefinedproductline_create.tpl.php @@ -73,6 +73,7 @@ jQuery(document).ready(function() { select_produits('','idprod','',$conf->product->limit_size,$buyer->price_level); + print '
'; if (is_object($hookmanager)) { From 6853ed0e5e3ca8b77f1dfb37910074fc913b6aaa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Aug 2012 18:39:34 +0200 Subject: [PATCH 03/26] Fix: permission for a user to view its own card using webservice --- htdocs/webservices/server_user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 2ad6d9acb45..d9a853f4d8a 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -180,7 +180,7 @@ function getUser($authentication,$id,$ref='',$ref_ext='') { $fuser->getrights(); - if ($fuser->rights->user->user->lire) + if ($fuser->rights->user->user->lire || ($fuser->rights->user->self->creer && $fuser->id = $id)) { $user=new User($db); $result=$user->fetch($id,$ref,$ref_ext); From 745b35f94e3ff75772a36a43e5752d1ecc3147bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Aug 2012 22:33:40 +0200 Subject: [PATCH 04/26] Missing translation key --- htdocs/langs/en_US/main.lang | 1 + htdocs/langs/fr_FR/main.lang | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 6c7c143716e..3a40db19912 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -14,6 +14,7 @@ FormatDateHourShort=%m/%d/%Y %I:%M %p FormatDateHourTextShort=%b %d, %Y, %I:%M %p FormatDateHourText=%B %d, %Y, %I:%M %p DatabaseConnection=Database connection +NoTranslation=No translation NoError=No error Error=Error ErrorFieldRequired=Field '%s' is required diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 22f37f7d3b5..5236417cd85 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -14,6 +14,7 @@ FormatDateHourShort=%d/%m/%Y %H:%M FormatDateHourTextShort=%d %b %Y %H:%M FormatDateHourText=%d %B %Y %H:%M DatabaseConnection=Connexion à la base +NoTranslation=Pas de traduction NoError=Aucune erreur Error=Erreur ErrorFieldRequired=Le champ '%s' est obligatoire @@ -654,4 +655,4 @@ ShortFriday=V ShortSaturday=S ShortSunday=D -View=Voir \ No newline at end of file +View=Voir From 8a74c928f3f596f7a88aa9fe69697233137d384c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Aug 2012 23:01:04 +0200 Subject: [PATCH 05/26] Fix: regression --- htdocs/product/class/product.class.php | 16 ++++++++++++++-- htdocs/product/traduction.php | 7 ++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 578f9bc54ed..39d514defa1 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -698,7 +698,13 @@ class Product extends CommonObject $sql2.= "','".$this->db->escape($this->description); $sql2.= "','".$this->db->escape($this->note)."')"; } - if (!$this->db->query($sql2)) return -1; + dol_syslog(get_class($this).'::setMultiLangs sql='.$sql2); + if (! $this->db->query($sql2)) + { + $this->error=$this->db->lasterror(); + dol_syslog(get_class($this).'::setMultiLangs error='.$this->error, LOG_ERR); + return -1; + } } else if (isset($this->multilangs["$key"])) { @@ -720,7 +726,13 @@ class Product extends CommonObject // on ne sauvegarde pas des champs vides if ( $this->multilangs["$key"]["label"] || $this->multilangs["$key"]["description"] || $this->multilangs["$key"]["note"] ) - if (!$this->db->query($sql2)) return -1; + dol_syslog(get_class($this).'::setMultiLangs sql='.$sql2); + if (! $this->db->query($sql2)) + { + $this->error=$this->db->lasterror(); + dol_syslog(get_class($this).'::setMultiLangs error='.$this->error, LOG_ERR); + return -1; + } } } return 1; diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index b856a057a91..945a70c012c 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -55,6 +55,7 @@ if ($cancel == $langs->trans("Cancel")) $action = ''; } + // Validation de l'ajout if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && @@ -103,7 +104,7 @@ $cancel != $langs->trans("Cancel") && { if ( $key == $current_lang ) { - $product->lable = $_POST["libelle-".$key]; + $product->label = $_POST["libelle-".$key]; $product->description = dol_htmlcleanlastbr($_POST["desc-".$key]); $product->note = dol_htmlcleanlastbr($_POST["note-".$key]); } @@ -163,7 +164,7 @@ if ($action == 'edit') //WYSIWYG Editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - print '
'; + print ''; print ''; print ''; print ''; @@ -250,7 +251,7 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; print '
'; - print ''; + print ''; print ''; print ''; print ''; From e3e36dca6d47e0fa997dcaf942579ca887f49c64 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Aug 2012 23:39:11 +0200 Subject: [PATCH 06/26] We set to zero to unifrmize way of working between customer and supplier payments --- htdocs/master.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index d8dbb852e16..134e68e7a81 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -270,6 +270,6 @@ if (! defined('NOREQUIRETRAN')) if (! defined('MAIN_LABEL_MENTION_NPR') ) define('MAIN_LABEL_MENTION_NPR','NPR'); // We force feature to help debug -$conf->global->MAIN_JS_ON_PAYMENT=1; +$conf->global->MAIN_JS_ON_PAYMENT=0; // We set to zero to unifrmize way of working between customer and supplier payments ?> From 7c0463b215a2c46f0470f5d1c873b2d8e9fec4c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Wed, 29 Aug 2012 00:29:47 +0200 Subject: [PATCH 07/26] Used incorrect translation keys Duplicated keys --- htdocs/adherents/card_subscriptions.php | 4 ++-- htdocs/admin/commande.php | 2 +- htdocs/admin/facture.php | 2 +- htdocs/admin/propal.php | 2 +- htdocs/core/modules/dons/html_cerfafr.html | 4 ++-- htdocs/core/modules/dons/html_cerfafr.modules.php | 4 ++-- htdocs/langs/en_US/donations.lang | 2 -- htdocs/langs/fr_FR/donations.lang | 2 -- 8 files changed, 9 insertions(+), 13 deletions(-) diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index ece8bcf5cd7..61ef0da1314 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -978,10 +978,10 @@ if ($rowid) $helpcontent=''; $helpcontent.=''.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.'
'."\n"; $helpcontent.=''.$langs->trans("MailRecipient").': '.$object->email.'
'."\n"; - $helpcontent.=''.$langs->trans("Subject").':
'."\n"; + $helpcontent.=''.$langs->trans("MailTopic").':
'."\n"; $helpcontent.=$subjecttosend."\n"; $helpcontent.="
"; - $helpcontent.=''.$langs->trans("Content").':
'; + $helpcontent.=''.$langs->trans("MailText").':
'; $helpcontent.=dol_htmlentitiesbr($texttosend)."\n"; print $form->textwithpicto($tmp,$helpcontent,1,'help'); diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 36c57926c4d..1a00c229150 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -472,7 +472,7 @@ foreach ($dirmodels as $reldir) $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1); $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1); $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); - //$htmltooltip.='
'.$langs->trans("Escompte").': '.yn($module->option_escompte,1,1); + //$htmltooltip.='
'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1); //$htmltooltip.='
'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1); $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1); diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 6e54456f59e..46c793e0d72 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -571,7 +571,7 @@ foreach ($dirmodels as $reldir) $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1); $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1); - $htmltooltip.='
'.$langs->trans("Escompte").': '.yn($module->option_escompte,1,1); + $htmltooltip.='
'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1); $htmltooltip.='
'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1); $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); $htmltooltip.='
'.$langs->trans("WatermarkOnDraftInvoices").': '.yn($module->option_draft_watermark,1,1); diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 02b57e63cb2..a0ed2dcba75 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -456,7 +456,7 @@ foreach ($dirmodels as $reldir) $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1); $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1); $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); - //$htmltooltip.='
'.$langs->trans("Escompte").': '.yn($module->option_escompte,1,1); + //$htmltooltip.='
'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1); //$htmltooltip.='
'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1); $htmltooltip.='
'.$langs->trans("WatermarkOnDraftProposal").': '.yn($module->option_draft_watermark,1,1); diff --git a/htdocs/core/modules/dons/html_cerfafr.html b/htdocs/core/modules/dons/html_cerfafr.html index 246c31fc1c7..664bf54d965 100644 --- a/htdocs/core/modules/dons/html_cerfafr.html +++ b/htdocs/core/modules/dons/html_cerfafr.html @@ -123,8 +123,8 @@ - __DonationPaymentDate__ : __DATE__
- __DonationPaymentMode__ : __PAYMENTMODE_LIB__
+ __DatePayment__ : __DATE__
+ __PaymentMode__ : __PAYMENTMODE_LIB__
diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index e2f979b06ac..8c96087c38d 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -140,8 +140,8 @@ class html_cerfafr extends ModeleDon $form = str_replace('__DonationRef__',$outputlangs->trans("DonationRef"),$form); $form = str_replace('__DonationReceipt__',$outputlangs->trans("DonationReceipt"),$form); $form = str_replace('__DonationRecipient__',$outputlangs->trans("DonationRecipient"),$form); - $form = str_replace('__DonationPaymentDate__',$outputlangs->trans("DonationPaymentDate"),$form); - $form = str_replace('__DonationPaymentMode__',$outputlangs->trans("DonationPaymentMode"),$form); + $form = str_replace('__DatePayment__',$outputlangs->trans("DatePayment"),$form); + $form = str_replace('__PaymentMode__',$outputlangs->trans("PaymentMode"),$form); $form = str_replace('__Name__',$outputlangs->trans("Name"),$form); $form = str_replace('__Address__',$outputlangs->trans("Address"),$form); $form = str_replace('__Zip__',$outputlangs->trans("Zip"),$form); diff --git a/htdocs/langs/en_US/donations.lang b/htdocs/langs/en_US/donations.lang index 0618c99e695..0c32ae3c055 100644 --- a/htdocs/langs/en_US/donations.lang +++ b/htdocs/langs/en_US/donations.lang @@ -27,8 +27,6 @@ BuildDonationReceipt=Build receipt DonationsModels=Documents models for donation receipts LastModifiedDonations=Last %s modified donations SearchADonation=Search a donation -DonationPaymentDate=Donation payment date -DonationPaymentMode=Donation payment mode DonationRecipient=Donation recipient ThankYou=Thank You IConfirmDonationReception=The recipient declare reception, as a donation, of the following amount \ No newline at end of file diff --git a/htdocs/langs/fr_FR/donations.lang b/htdocs/langs/fr_FR/donations.lang index 1e270d17f0b..76a6452411b 100644 --- a/htdocs/langs/fr_FR/donations.lang +++ b/htdocs/langs/fr_FR/donations.lang @@ -27,8 +27,6 @@ BuildDonationReceipt=Créer reçu DonationsModels=Modèle de document de bon de réception de dons LastModifiedDonations=Les %s derniers dons modifiés SearchADonation=Rechercher un don -DonationPaymentDate=Date du versement -DonationPaymentMode=Mode de versement DonationRecipient=Bénéficiaire des versements ThankYou=Merci IConfirmDonationReception=Le bénéficiaire reconnait avoir reçu au titre des versements ouvrant droit à réduction d'impôt, la somme de \ No newline at end of file From 1a676b5b4b81d667b16ba7c08687d1e07e11ef16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Wed, 29 Aug 2012 00:32:16 +0200 Subject: [PATCH 08/26] Added missing permission translations --- htdocs/langs/en_US/admin.lang | 2 ++ htdocs/langs/es_ES/admin.lang | 2 ++ htdocs/langs/fr_FR/admin.lang | 2 ++ 3 files changed, 6 insertions(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 7c5134a6c61..53aa67bb881 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -653,6 +653,8 @@ Permission2501=Read/Download documents Permission2502=Download documents Permission2503=Submit or delete documents Permission2515=Setup documents directories +Permission2801=Use FTP client in read mode (browse and download only) +Permission2802=Use FTP client in write mode (delete or upload files) Permission50101=Use Point of sales Permission50201= Read transactions Permission50202= Import transactions diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index d9f1b0661d7..00ff4873735 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -665,6 +665,8 @@ Permission2501=Consultar/Recuperar documentos Permission2502=Recuperar documentos Permission2503=Enviar o eliminar documentos Permission2515=Configuración directorios de documentos +Permission2801=Utilizar el cliente FTP en modo lectura (sólo explorar y descargar) +Permission2802=Utilizar el cliente FTP en modo escritura (borrar o subir archivos) Permission50101=Usar TPV Permission50201=Consultar las transacciones Permission50202=Importar las transacciones diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 6485c2d70a4..00c0082e1c7 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -661,6 +661,8 @@ Permission2501= Lire/Récupérer les documents Permission2502= Récupérer les documents Permission2503= Soumettre ou supprimer des documents Permission2515= Administrer les rubriques de documents +Permission2801=Utiliser un client FTP en mode lecture (parcours et download de fichiers) +Permission2802=Utiliser un client FTP en mode écriture (suppression et upload de fichiers) Permission50101=Utiliser Point de vente Permission50201= Consulter les transactions Permission50202= Importer les transactions From f9eb3873b0505fb9ab38e04901037031ff81738a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Wed, 29 Aug 2012 00:32:57 +0200 Subject: [PATCH 09/26] Improved and added missing es_ES translations --- htdocs/langs/en_US/members.lang | 4 ++-- htdocs/langs/es_ES/admin.lang | 4 +++- htdocs/langs/es_ES/companies.lang | 1 + htdocs/langs/es_ES/donations.lang | 7 ++++++- htdocs/langs/es_ES/main.lang | 5 +++-- htdocs/langs/es_ES/members.lang | 4 +++- htdocs/langs/es_ES/users.lang | 2 +- 7 files changed, 19 insertions(+), 8 deletions(-) diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 188ac1c89f7..f691003ee13 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -131,8 +131,8 @@ AddSubscription=Add subscription ShowSubscription=Show subscription MemberModifiedInDolibarr=Member modified in Dolibarr SendAnEMailToMember=Send information email to member -DescADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT=Sujet du mail reçu en cas d'auto-inscription d'un invité -DescADHERENT_AUTOREGISTER_NOTIF_MAIL=Mail reçu en cas d'auto-inscription d'un invité +DescADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT=Subject of the e-mail received in case of auto-inscription of a guest +DescADHERENT_AUTOREGISTER_NOTIF_MAIL=E-mail received in case of auto-inscription of a guest DescADHERENT_AUTOREGISTER_MAIL_SUBJECT=EMail subject for member autosubscription DescADHERENT_AUTOREGISTER_MAIL=EMail for member autosubscription DescADHERENT_MAIL_VALID_SUBJECT=EMail subject for member validation diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index 00ff4873735..5e93d6e6273 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -37,7 +37,7 @@ GlobalSetup=General GUISetup=Entorno SetupArea=Área configuración FormToTestFileUploadForm=Formulario de prueba de subida de archivo (según opciones elegidas) -IfModuleEnabled=Nota: sí sólo es eficaz si el módulo %s está activado +IfModuleEnabled=Nota: sólo es eficaz si el módulo %s está activado RemoveLock=Elimine el archivo %s, si existe, para permitir la utilidad de actualización. RestoreLock=Sustituir un archivo %s, dándole sólo derechos de lectura a este archivo con el fin de prohibir nuevas actualizaciones. SecuritySetup=Configuración de la seguridad @@ -1336,3 +1336,5 @@ ProjectsNumberingModules=Módulo de numeración para las referencias de los proy ProjectsSetup=Configuración del módulo Proyectos ProjectsModelModule=Modelo de documento para informes de proyectos Server=Servidor + +Logo=Logotipo \ No newline at end of file diff --git a/htdocs/langs/es_ES/companies.lang b/htdocs/langs/es_ES/companies.lang index febb31efef2..69a9b6437dc 100644 --- a/htdocs/langs/es_ES/companies.lang +++ b/htdocs/langs/es_ES/companies.lang @@ -70,6 +70,7 @@ Phone=Teléfono PhonePro=Teléf. trabajo PhonePerso=Teléf. particular PhoneMobile=Móvil +No_Email=No enviar emails masivos Fax=Fax Zip=Código postal Town=Población diff --git a/htdocs/langs/es_ES/donations.lang b/htdocs/langs/es_ES/donations.lang index fa8a7edcf42..30628fd5554 100644 --- a/htdocs/langs/es_ES/donations.lang +++ b/htdocs/langs/es_ES/donations.lang @@ -24,4 +24,9 @@ ValidPromess=Validar promesa BuildDonationReceipt=Crear recibo DonationsModels=Modelo de documento de recepción de donación LastModifiedDonations=Las %s últimas donaciones modificadas -SearchADonation=Buscar una donación \ No newline at end of file +SearchADonation=Buscar una donación +DonationReceipt=Recibo de donación +DonationRecipient=Beneficiario +DonationRef=Referencia +IConfirmDonationReception=El beneficiario confirma la recepción, como donación, de la siguiente cantidad +ThankYou=Muchas gracias \ No newline at end of file diff --git a/htdocs/langs/es_ES/main.lang b/htdocs/langs/es_ES/main.lang index 185e6421ec4..c6886883617 100644 --- a/htdocs/langs/es_ES/main.lang +++ b/htdocs/langs/es_ES/main.lang @@ -14,6 +14,7 @@ FormatDateHourShort=%d/%m/%Y %H:%M FormatDateHourTextShort=%d %b %Y %H:%M FormatDateHourText=%d %B %Y %H:%M DatabaseConnection=Conexión a la base de datos +NoTranslation=Sin traducción NoError=Ningún error Error=Error ErrorFieldRequired=El campo '%s' es obligatorio @@ -62,7 +63,7 @@ DolibarrInHttpAuthenticationSoPasswordUseless=Dolibarr está configurado en modo Administrator=Administrador Undefined=No definido PasswordForgotten=¿Olvidó su contraseña? -SeeAbove=Mencionar anteriormente +SeeAbove=Mencionado anteriormente HomeArea=Área inicio LastConnexion=Última conexión PreviousConnexion=Conexión anterior @@ -521,7 +522,7 @@ Priority=Prioridad SendByMail=Enviar por e-mail MailSentBy=Mail enviado por TextUsedInTheMessageBody=Texto utilizado en el cuerpo del mensaje -SendAcknowledgementByMail=Envio rec. por e-mail +SendAcknowledgementByMail=Enviar recibo por e-mail NoEMail=Sin e-mail Owner=Propietario DetectedVersion=Versión detectada diff --git a/htdocs/langs/es_ES/members.lang b/htdocs/langs/es_ES/members.lang index 4f55167c6cb..ecd037cbaa8 100644 --- a/htdocs/langs/es_ES/members.lang +++ b/htdocs/langs/es_ES/members.lang @@ -54,7 +54,7 @@ MembersAttributes=Atributos miembros SearchAMember=Buscar un miembro MemberStatusDraft=Borrador (a validar) MemberStatusDraftShort=A validar -MemberStatusActive=Validado (en espera de afiliación ) +MemberStatusActive=Validado (en espera de afiliación) MemberStatusActiveShort=Validado MemberStatusActiveLate=Afiliación no al día MemberStatusActiveLateShort=No al día @@ -134,6 +134,8 @@ AddSubscription=Añadir afiliación ShowSubscription=Mostrar afiliación MemberModifiedInDolibarr=Miembro modificado en Dolibarr SendAnEMailToMember=Enviar e-mail de información al miembro (E-mail: %s) +DescADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT=Asunto del e-mail recibido en caso de auto-inscripción de un invitado +DescADHERENT_AUTOREGISTER_NOTIF_MAIL=E-mail recibido en caso de auto-inscripción de un invitado DescADHERENT_AUTOREGISTER_MAIL_SUBJECT=Asunto del e-mail enviado cuando un invitado se auto-inscriba DescADHERENT_AUTOREGISTER_MAIL=E-mail enviado cuando un invitado se auto-inscriba DescADHERENT_MAIL_VALID_SUBJECT=Asunto del e-mail de validación de miembro diff --git a/htdocs/langs/es_ES/users.lang b/htdocs/langs/es_ES/users.lang index f0ac57cb693..d47d4ea548e 100644 --- a/htdocs/langs/es_ES/users.lang +++ b/htdocs/langs/es_ES/users.lang @@ -108,7 +108,7 @@ ConfirmCreateContact=¿Está seguro de querer crear una cuenta Dolibarr para est ConfirmCreateLogin=¿Está seguro de que desea crear una cuenta Dolibarr para este miembro? ConfirmCreateThirdParty=¿Está seguro de querer crear un tercero para este miembro? LoginToCreate=Login a crear -NameToCreate=nombre del tercero a crear +NameToCreate=Nombre del tercero a crear YourRole=Sus roles YourQuotaOfUsersIsReached=¡Ha llegado a su cuota de usuarios activos! NbOfUsers=Nº de usuarios From 70c467e4293dd66b983eba1412bb39a6ffef93aa Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 29 Aug 2012 08:17:25 +0200 Subject: [PATCH 10/26] Fix: Update vat rate combobox --- htdocs/core/ajax/vatrates.php | 11 ++++---- htdocs/core/lib/functions.lib.php | 4 +++ htdocs/core/tpl/objectline_add.tpl.php | 35 +++++++++++++++++++++----- 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/htdocs/core/ajax/vatrates.php b/htdocs/core/ajax/vatrates.php index 97ed9e4697c..6572bd883f1 100644 --- a/htdocs/core/ajax/vatrates.php +++ b/htdocs/core/ajax/vatrates.php @@ -32,6 +32,7 @@ require '../../main.inc.php'; $id = GETPOST('id','int'); $action = GETPOST('action','alpha'); $htmlname = GETPOST('htmlname','alpha'); +$productid = (GETPOST('productid','int')?GETPOST('productid','int'):0); /* * View @@ -46,15 +47,15 @@ if (! empty($id) && ! empty($action) && ! empty($htmlname)) { $form = new Form($db); $soc = new Societe($db); - + $soc->fetch($id); - + $return=array(); - - $return['value'] = $form->load_tva('tva_tx','',$soc,$mysoc,0,0,'',true); + + $return['value'] = $form->load_tva('tva_tx','',$soc,$mysoc,$productid,0,'',true); $return['num'] = $form->num; $return['error'] = $form->error; - + echo json_encode($return); } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 878cee4812f..790d8580b93 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2741,6 +2741,10 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr { global $db,$mysoc; + if (! class_exists('Product')) { + require DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + } + $ret=0; $found=0; diff --git a/htdocs/core/tpl/objectline_add.tpl.php b/htdocs/core/tpl/objectline_add.tpl.php index 2fdf04d2403..203ea15931f 100644 --- a/htdocs/core/tpl/objectline_add.tpl.php +++ b/htdocs/core/tpl/objectline_add.tpl.php @@ -153,7 +153,7 @@ if (! empty($conf->margin->enabled)) { '; From 54860ef304f279d22ad97314674651363ae3a6b9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 29 Aug 2012 09:55:32 +0200 Subject: [PATCH 13/26] Fix: upgrade tcpdf and fpdi --- COPYRIGHT | 6 +- htdocs/core/lib/pdf.lib.php | 8 +- .../modules/propale/doc/pdf_azur.modules.php | 16 +- .../includes/fpdfi/filters/FilterASCII85.php | 4 +- .../fpdfi/filters/FilterASCII85_FPDI.php | 64 +- htdocs/includes/fpdfi/filters/FilterLZW.php | 4 +- .../includes/fpdfi/filters/FilterLZW_FPDI.php | 64 +- htdocs/includes/fpdfi/fpdf_tpl.php | 898 +++++----- htdocs/includes/fpdfi/fpdi.php | 1111 ++++++------- htdocs/includes/fpdfi/fpdi2tcpdf_bridge.php | 12 +- htdocs/includes/fpdfi/fpdi_pdf_parser.php | 815 +++++----- htdocs/includes/fpdfi/pdf_context.php | 206 +-- htdocs/includes/fpdfi/pdf_parser.php | 1438 ++++++++--------- htdocs/includes/tcpdf/2dbarcodes.php | 12 +- htdocs/includes/tcpdf/CHANGELOG.TXT | 93 +- htdocs/includes/tcpdf/README.TXT | 6 +- htdocs/includes/tcpdf/barcodes.php | 12 +- htdocs/includes/tcpdf/config/lang/bul.php | 94 +- htdocs/includes/tcpdf/config/lang/rus.php | 4 +- htdocs/includes/tcpdf/config/lang/ukr.php | 47 + htdocs/includes/tcpdf/config/tcpdf_config.php | 8 +- htdocs/includes/tcpdf/qrcode.php | 22 +- htdocs/includes/tcpdf/tcpdf.php | 705 ++++++-- htdocs/includes/tcpdf/tcpdf_parser.php | 35 +- 24 files changed, 3121 insertions(+), 2563 deletions(-) create mode 100644 htdocs/includes/tcpdf/config/lang/ukr.php diff --git a/COPYRIGHT b/COPYRIGHT index 384fab6fd5c..c8e162b848d 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -13,12 +13,12 @@ Composant Version License Compatible GPL Usage PHP libraries: AdoDb-Date 0.21 Modified BSD License Yes Date convertion (not into rpm package) CKEditor 3.6.2 GPL or LGPL 2.1 or MPL 1.1 Yes Editor WYSIWYG -FPDI 1.4.1 Apache Software License 2.0 ? PDF templates management +FPDI 1.4.2 Apache Software License 2.0 No (GPLv3 only) PDF templates management (with FPDF_TPL 1.2) GeoIP 2004 LGPL 2.1 Yes Sample code to make geoip convert (not into deb package) NuSoap 0.9.5 LGPL 2.1 Yes Library to develop SOAP Web services (not into rpm and deb package) OdtPHP 1.0.1 GPL 2.0 Yes Library to build/edit ODT files PHPExcel 1.7.6 LGPL 2.1 Yes Read/Write XLS files, read ODS files -TCPDF 5.9.156 LGPL 3.0 Yes PDF generation +TCPDF 5.9.180 LGPL 3.0 Yes PDF generation JS libraries: jQuery 1.7.2 GPL and MIT Licence Yes JS library @@ -29,7 +29,7 @@ jQuery Flot 0.7 MIT Licence Yes JS library to build graph jQuery FileUpload 5.0.3 GPL and MIT Licence Yes JS library to upload files jQuery JCrop 0.9.8 GPL and MIT Licence Yes JS library plugin Crop (to crop images) jQuery jeditable 1.7.1 GPL and MIT Licence Yes JS library plugin jeditable (to edit in place) -jQuery jNotify 1.1.00 Apache Software License 2.0 ? JS library plugin jNotify (to use ajax popups) +jQuery jNotify 1.1.00 Apache Software License 2.0 No (GPLv3 only) JS library plugin jNotify (to use ajax popups) 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) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 33bc91637a3..3be9c1b03f9 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1046,9 +1046,9 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0,$hookmanage global $conf; $sign=1; - if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; + if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; - if (is_object($hookmanager) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) ) + if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line))) { $special_code = $object->lines[$i]->special_code; if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); @@ -1250,7 +1250,7 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0,$hookman global $conf; $sign=1; - if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; + if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; if ($object->lines[$i]->special_code == 3) { @@ -1258,7 +1258,7 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0,$hookman } else { - if (is_object($hookmanager) && ( ($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) ) + if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line))) { $special_code = $object->lines[$i]->special_code; if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 4a24f74c2a0..8aacca212b1 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -311,6 +311,10 @@ class pdf_azur extends ModelePDFPropales if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; + if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0; + if (! isset($this->localtax1[$localtax1rate])) $this->localtax1[$localtax1rate]=0; + if (! isset($this->localtax2[$localtax2rate])) $this->localtax2[$localtax2rate]=0; + $this->tva[$vatrate] += $tvaligne; $this->localtax1[$localtax1rate]+=$localtax1ligne; $this->localtax2[$localtax2rate]+=$localtax2ligne; @@ -455,7 +459,7 @@ class pdf_azur extends ModelePDFPropales } // Show shipping date - if ($object->type != 2 && $object->date_livraison) + if (isset($object->type) && $object->type != 2 && $object->date_livraison) { $outputlangs->load("sendings"); $pdf->SetFont('','B', $default_font_size - 2); @@ -469,7 +473,7 @@ class pdf_azur extends ModelePDFPropales $posy=$pdf->GetY()+1; } - elseif ($object->type != 2 && ($object->availability_code || $object->availability)) // Show availability conditions + elseif (isset($object->type) && $object->type != 2 && ($object->availability_code || $object->availability)) // Show availability conditions { $pdf->SetFont('','B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); @@ -486,7 +490,7 @@ class pdf_azur extends ModelePDFPropales } // Show payments conditions - if ($object->type != 2 && ($object->cond_reglement_code || $object->cond_reglement)) + if (isset($object->type) && $object->type != 2 && ($object->cond_reglement_code || $object->cond_reglement)) { $pdf->SetFont('','B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); @@ -503,7 +507,7 @@ class pdf_azur extends ModelePDFPropales } - if ($object->type != 2) + if (isset($object->type) && $object->type != 2) { // Check a payment mode is defined if (empty($object->mode_reglement_code) @@ -632,7 +636,7 @@ class pdf_azur extends ModelePDFPropales $this->atleastoneratenotnull=0; if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { - $tvaisnull=((! empty($this->tva) && count($this->tva) == 1 && is_float($this->tva['0.000'])) ? true : false); + $tvaisnull=((! empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull) { // Nothing to do @@ -1049,7 +1053,7 @@ class pdf_azur extends ModelePDFPropales $carac_client_name=$outputlangs->convToOutputCharset($object->client->nom); } - $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target'); + $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,(! empty($object->contact)?$object->contact:''),$usecontact,'target'); // Show recipient $posy=42; diff --git a/htdocs/includes/fpdfi/filters/FilterASCII85.php b/htdocs/includes/fpdfi/filters/FilterASCII85.php index 092f3299b64..01402ba1dc6 100755 --- a/htdocs/includes/fpdfi/filters/FilterASCII85.php +++ b/htdocs/includes/fpdfi/filters/FilterASCII85.php @@ -1,6 +1,6 @@ ORD_u) { diff --git a/htdocs/includes/fpdfi/filters/FilterASCII85_FPDI.php b/htdocs/includes/fpdfi/filters/FilterASCII85_FPDI.php index d4687ee88f2..fb5600116bc 100755 --- a/htdocs/includes/fpdfi/filters/FilterASCII85_FPDI.php +++ b/htdocs/includes/fpdfi/filters/FilterASCII85_FPDI.php @@ -1,33 +1,33 @@ -fpdi =& $fpdi; - } - - function error($msg) { - $this->fpdi->error($msg); - } +fpdi =& $fpdi; + } + + function error($msg) { + $this->fpdi->error($msg); + } } \ No newline at end of file diff --git a/htdocs/includes/fpdfi/filters/FilterLZW.php b/htdocs/includes/fpdfi/filters/FilterLZW.php index 76d303d3803..292461d248d 100755 --- a/htdocs/includes/fpdfi/filters/FilterLZW.php +++ b/htdocs/includes/fpdfi/filters/FilterLZW.php @@ -1,6 +1,6 @@ sTable[$oldCode]; - $string = $string.$string[0]; + $string = $string . $string[0]; $uncompData .= $string; $this->addStringToTable($string); diff --git a/htdocs/includes/fpdfi/filters/FilterLZW_FPDI.php b/htdocs/includes/fpdfi/filters/FilterLZW_FPDI.php index fd9451e214f..e7a88119ff9 100755 --- a/htdocs/includes/fpdfi/filters/FilterLZW_FPDI.php +++ b/htdocs/includes/fpdfi/filters/FilterLZW_FPDI.php @@ -1,33 +1,33 @@ -fpdi =& $fpdi; - } - - function error($msg) { - $this->fpdi->error($msg); - } +fpdi =& $fpdi; + } + + function error($msg) { + $this->fpdi->error($msg); + } } \ No newline at end of file diff --git a/htdocs/includes/fpdfi/fpdf_tpl.php b/htdocs/includes/fpdfi/fpdf_tpl.php index 6e234bf9321..d21743e6374 100755 --- a/htdocs/includes/fpdfi/fpdf_tpl.php +++ b/htdocs/includes/fpdfi/fpdf_tpl.php @@ -1,449 +1,449 @@ -Error('This method is only usable with FPDF. Use TCPDF methods startTemplate() instead.'); - return; - } - - if ($this->page <= 0) - $this->error("You have to add a page to fpdf first!"); - - if ($x == null) - $x = 0; - if ($y == null) - $y = 0; - if ($w == null) - $w = $this->w; - if ($h == null) - $h = $this->h; - - // Save settings - $this->tpl++; - $tpl =& $this->tpls[$this->tpl]; - $tpl = array( - 'o_x' => $this->x, - 'o_y' => $this->y, - 'o_AutoPageBreak' => $this->AutoPageBreak, - 'o_bMargin' => $this->bMargin, - 'o_tMargin' => $this->tMargin, - 'o_lMargin' => $this->lMargin, - 'o_rMargin' => $this->rMargin, - 'o_h' => $this->h, - 'o_w' => $this->w, - 'buffer' => '', - 'x' => $x, - 'y' => $y, - 'w' => $w, - 'h' => $h - ); - - $this->SetAutoPageBreak(false); - - // Define own high and width to calculate possitions correct - $this->h = $h; - $this->w = $w; - - $this->_intpl = true; - $this->SetXY($x + $this->lMargin, $y + $this->tMargin); - $this->SetRightMargin($this->w - $w + $this->rMargin); - - return $this->tpl; - } - - /** - * End Template - * - * This method ends a template and reset initiated variables on beginTemplate. - * - * @return mixed If a template is opened, the ID is returned. If not a false is returned. - */ - function endTemplate() { - if (is_subclass_of($this, 'TCPDF')) { - $args = func_get_args(); - return call_user_func_array(array($this, 'TCPDF::endTemplate'), $args); - } - - if ($this->_intpl) { - $this->_intpl = false; - $tpl =& $this->tpls[$this->tpl]; - $this->SetXY($tpl['o_x'], $tpl['o_y']); - $this->tMargin = $tpl['o_tMargin']; - $this->lMargin = $tpl['o_lMargin']; - $this->rMargin = $tpl['o_rMargin']; - $this->h = $tpl['o_h']; - $this->w = $tpl['o_w']; - $this->SetAutoPageBreak($tpl['o_AutoPageBreak'], $tpl['o_bMargin']); - - return $this->tpl; - } else { - return false; - } - } - - /** - * Use a Template in current Page or other Template - * - * You can use a template in a page or in another template. - * You can give the used template a new size like you use the Image()-method. - * All parameters are optional. The width or height is calculated automaticaly - * if one is given. If no parameter is given the origin size as defined in - * beginTemplate() is used. - * The calculated or used width and height are returned as an array. - * - * @param int $tplidx A valid template-Id - * @param int $_x The x-position - * @param int $_y The y-position - * @param int $_w The new width of the template - * @param int $_h The new height of the template - * @retrun array The height and width of the template - */ - function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0) { - if ($this->page <= 0) - $this->error('You have to add a page first!'); - - if (!isset($this->tpls[$tplidx])) - $this->error('Template does not exist!'); - - if ($this->_intpl) { - $this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx]; - } - - $tpl =& $this->tpls[$tplidx]; - $w = $tpl['w']; - $h = $tpl['h']; - - if ($_x == null) - $_x = 0; - if ($_y == null) - $_y = 0; - - $_x += $tpl['x']; - $_y += $tpl['y']; - - $wh = $this->getTemplateSize($tplidx, $_w, $_h); - $_w = $wh['w']; - $_h = $wh['h']; - - $tData = array( - 'x' => $this->x, - 'y' => $this->y, - 'w' => $_w, - 'h' => $_h, - 'scaleX' => ($_w / $w), - 'scaleY' => ($_h / $h), - 'tx' => $_x, - 'ty' => ($this->h - $_y - $_h), - 'lty' => ($this->h - $_y - $_h) - ($this->h - $h) * ($_h / $h) - ); - - $this->_out(sprintf('q %.4F 0 0 %.4F %.4F %.4F cm', $tData['scaleX'], $tData['scaleY'], $tData['tx'] * $this->k, $tData['ty'] * $this->k)); // Translate - $this->_out(sprintf('%s%d Do Q', $this->tplprefix, $tplidx)); - - // reset font in the outer graphic state - if ($this->FontFamily) { - $family = $this->FontFamily; - $this->FontFamily = ''; - $this->SetFont($family); - } - - $this->lastUsedTemplateData = $tData; - - return array('w' => $_w, 'h' => $_h); - } - - /** - * Get The calculated Size of a Template - * - * If one size is given, this method calculates the other one. - * - * @param int $tplidx A valid template-Id - * @param int $_w The width of the template - * @param int $_h The height of the template - * @return array The height and width of the template - */ - function getTemplateSize($tplidx, $_w = 0, $_h = 0) { - if (!$this->tpls[$tplidx]) - return false; - - $tpl =& $this->tpls[$tplidx]; - $w = $tpl['w']; - $h = $tpl['h']; - - if ($_w == 0 and $_h == 0) { - $_w = $w; - $_h = $h; - } - - if($_w == 0) - $_w = $_h * $w / $h; - if($_h == 0) - $_h = $_w * $h / $w; - - return array("w" => $_w, "h" => $_h); - } - - /** - * See FPDF/TCPDF-Documentation ;-) - */ - public function SetFont($family, $style = '', $size = 0) { - if (is_subclass_of($this, 'TCPDF')) { - $args = func_get_args(); - return call_user_func_array(array($this, 'TCPDF::SetFont'), $args); - } - - /** - * force the resetting of font changes in a template - */ - if ($this->_intpl) - $this->FontFamily = ''; - - parent::SetFont($family, $style, $size); - - $fontkey = $this->FontFamily . $this->FontStyle; - - if ($this->_intpl) { - $this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey]; - } else { - $this->_res['page'][$this->page]['fonts'][$fontkey] =& $this->fonts[$fontkey]; - } - } - - /** - * See FPDF/TCPDF-Documentation ;-) - */ - function Image($file, $x = null, $y = null, $w = 0, $h = 0, $type = '', $link = '') { - if (is_subclass_of($this, 'TCPDF')) { - $args = func_get_args(); - return call_user_func_array(array($this, 'TCPDF::Image'), $args); - } - - $ret = parent::Image($file, $x, $y, $w, $h, $type, $link); - if ($this->_intpl) { - $this->_res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file]; - } else { - $this->_res['page'][$this->page]['images'][$file] =& $this->images[$file]; - } - - return $ret; - } - - /** - * See FPDF-Documentation ;-) - * - * AddPage is not available when you're "in" a template. - */ - function AddPage($orientation = '', $format = '') { - if (is_subclass_of($this, 'TCPDF')) { - $args = func_get_args(); - return call_user_func_array(array($this, 'TCPDF::AddPage'), $args); - } - - if ($this->_intpl) - $this->Error('Adding pages in templates isn\'t possible!'); - - parent::AddPage($orientation, $format); - } - - /** - * Preserve adding Links in Templates ...won't work - */ - function Link($x, $y, $w, $h, $link) { - if (is_subclass_of($this, 'TCPDF')) { - $args = func_get_args(); - return call_user_func_array(array($this, 'TCPDF::Link'), $args); - } - - if ($this->_intpl) - $this->Error('Using links in templates aren\'t possible!'); - - parent::Link($x, $y, $w, $h, $link); - } - - function AddLink() { - if (is_subclass_of($this, 'TCPDF')) { - $args = func_get_args(); - return call_user_func_array(array($this, 'TCPDF::AddLink'), $args); - } - - if ($this->_intpl) - $this->Error('Adding links in templates aren\'t possible!'); - return parent::AddLink(); - } - - function SetLink($link, $y = 0, $page = -1) { - if (is_subclass_of($this, 'TCPDF')) { - $args = func_get_args(); - return call_user_func_array(array($this, 'TCPDF::SetLink'), $args); - } - - if ($this->_intpl) - $this->Error('Setting links in templates aren\'t possible!'); - parent::SetLink($link, $y, $page); - } - - /** - * Private Method that writes the form xobjects - */ - function _putformxobjects() { - $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; - reset($this->tpls); - foreach($this->tpls AS $tplidx => $tpl) { - - $p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer']; - $this->_newobj(); - $this->tpls[$tplidx]['n'] = $this->n; - $this->_out('<<'.$filter.'/Type /XObject'); - $this->_out('/Subtype /Form'); - $this->_out('/FormType 1'); - $this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]', - // llx - $tpl['x'] * $this->k, - // lly - -$tpl['y'] * $this->k, - // urx - ($tpl['w'] + $tpl['x']) * $this->k, - // ury - ($tpl['h'] - $tpl['y']) * $this->k - )); - - if ($tpl['x'] != 0 || $tpl['y'] != 0) { - $this->_out(sprintf('/Matrix [1 0 0 1 %.5F %.5F]', - -$tpl['x'] * $this->k * 2, $tpl['y'] * $this->k * 2 - )); - } - - $this->_out('/Resources '); - - $this->_out('<_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { - $this->_out('/Font <<'); - foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) - $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); - $this->_out('>>'); - } - if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || - isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) - { - $this->_out('/XObject <<'); - if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { - foreach($this->_res['tpl'][$tplidx]['images'] as $image) - $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); - } - if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { - foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) - $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); - } - $this->_out('>>'); - } - $this->_out('>>'); - - $this->_out('/Length ' . strlen($p) . ' >>'); - $this->_putstream($p); - $this->_out('endobj'); - } - } - - /** - * Overwritten to add _putformxobjects() after _putimages() - * - */ - function _putimages() { - parent::_putimages(); - $this->_putformxobjects(); - } - - function _putxobjectdict() { - parent::_putxobjectdict(); - - if (count($this->tpls)) { - foreach($this->tpls as $tplidx => $tpl) { - $this->_out(sprintf('%s%d %d 0 R', $this->tplprefix, $tplidx, $tpl['n'])); - } - } - } - - /** - * Private Method - */ - function _out($s) { - if ($this->state == 2 && $this->_intpl) { - $this->tpls[$this->tpl]['buffer'] .= $s . "\n"; - } else { - parent::_out($s); - } - } -} +Error('This method is only usable with FPDF. Use TCPDF methods startTemplate() instead.'); + return; + } + + if ($this->page <= 0) + $this->error("You have to add a page to fpdf first!"); + + if ($x == null) + $x = 0; + if ($y == null) + $y = 0; + if ($w == null) + $w = $this->w; + if ($h == null) + $h = $this->h; + + // Save settings + $this->tpl++; + $tpl =& $this->tpls[$this->tpl]; + $tpl = array( + 'o_x' => $this->x, + 'o_y' => $this->y, + 'o_AutoPageBreak' => $this->AutoPageBreak, + 'o_bMargin' => $this->bMargin, + 'o_tMargin' => $this->tMargin, + 'o_lMargin' => $this->lMargin, + 'o_rMargin' => $this->rMargin, + 'o_h' => $this->h, + 'o_w' => $this->w, + 'buffer' => '', + 'x' => $x, + 'y' => $y, + 'w' => $w, + 'h' => $h + ); + + $this->SetAutoPageBreak(false); + + // Define own high and width to calculate possitions correct + $this->h = $h; + $this->w = $w; + + $this->_intpl = true; + $this->SetXY($x + $this->lMargin, $y + $this->tMargin); + $this->SetRightMargin($this->w - $w + $this->rMargin); + + return $this->tpl; + } + + /** + * End Template + * + * This method ends a template and reset initiated variables on beginTemplate. + * + * @return mixed If a template is opened, the ID is returned. If not a false is returned. + */ + function endTemplate() { + if (is_subclass_of($this, 'TCPDF')) { + $args = func_get_args(); + return call_user_func_array(array($this, 'TCPDF::endTemplate'), $args); + } + + if ($this->_intpl) { + $this->_intpl = false; + $tpl =& $this->tpls[$this->tpl]; + $this->SetXY($tpl['o_x'], $tpl['o_y']); + $this->tMargin = $tpl['o_tMargin']; + $this->lMargin = $tpl['o_lMargin']; + $this->rMargin = $tpl['o_rMargin']; + $this->h = $tpl['o_h']; + $this->w = $tpl['o_w']; + $this->SetAutoPageBreak($tpl['o_AutoPageBreak'], $tpl['o_bMargin']); + + return $this->tpl; + } else { + return false; + } + } + + /** + * Use a Template in current Page or other Template + * + * You can use a template in a page or in another template. + * You can give the used template a new size like you use the Image()-method. + * All parameters are optional. The width or height is calculated automaticaly + * if one is given. If no parameter is given the origin size as defined in + * beginTemplate() is used. + * The calculated or used width and height are returned as an array. + * + * @param int $tplidx A valid template-Id + * @param int $_x The x-position + * @param int $_y The y-position + * @param int $_w The new width of the template + * @param int $_h The new height of the template + * @retrun array The height and width of the template + */ + function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0) { + if ($this->page <= 0) + $this->error('You have to add a page first!'); + + if (!isset($this->tpls[$tplidx])) + $this->error('Template does not exist!'); + + if ($this->_intpl) { + $this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx]; + } + + $tpl =& $this->tpls[$tplidx]; + $w = $tpl['w']; + $h = $tpl['h']; + + if ($_x == null) + $_x = 0; + if ($_y == null) + $_y = 0; + + $_x += $tpl['x']; + $_y += $tpl['y']; + + $wh = $this->getTemplateSize($tplidx, $_w, $_h); + $_w = $wh['w']; + $_h = $wh['h']; + + $tData = array( + 'x' => $this->x, + 'y' => $this->y, + 'w' => $_w, + 'h' => $_h, + 'scaleX' => ($_w / $w), + 'scaleY' => ($_h / $h), + 'tx' => $_x, + 'ty' => ($this->h - $_y - $_h), + 'lty' => ($this->h - $_y - $_h) - ($this->h - $h) * ($_h / $h) + ); + + $this->_out(sprintf('q %.4F 0 0 %.4F %.4F %.4F cm', $tData['scaleX'], $tData['scaleY'], $tData['tx'] * $this->k, $tData['ty'] * $this->k)); // Translate + $this->_out(sprintf('%s%d Do Q', $this->tplprefix, $tplidx)); + + // reset font in the outer graphic state + if ($this->FontFamily) { + $family = $this->FontFamily; + $this->FontFamily = ''; + $this->SetFont($family); + } + + $this->lastUsedTemplateData = $tData; + + return array('w' => $_w, 'h' => $_h); + } + + /** + * Get The calculated Size of a Template + * + * If one size is given, this method calculates the other one. + * + * @param int $tplidx A valid template-Id + * @param int $_w The width of the template + * @param int $_h The height of the template + * @return array The height and width of the template + */ + function getTemplateSize($tplidx, $_w = 0, $_h = 0) { + if (!$this->tpls[$tplidx]) + return false; + + $tpl =& $this->tpls[$tplidx]; + $w = $tpl['w']; + $h = $tpl['h']; + + if ($_w == 0 and $_h == 0) { + $_w = $w; + $_h = $h; + } + + if($_w == 0) + $_w = $_h * $w / $h; + if($_h == 0) + $_h = $_w * $h / $w; + + return array("w" => $_w, "h" => $_h); + } + + /** + * See FPDF/TCPDF-Documentation ;-) + */ + public function SetFont($family, $style = '', $size = 0) { + if (is_subclass_of($this, 'TCPDF')) { + $args = func_get_args(); + return call_user_func_array(array($this, 'TCPDF::SetFont'), $args); + } + + /** + * force the resetting of font changes in a template + */ + if ($this->_intpl) + $this->FontFamily = ''; + + parent::SetFont($family, $style, $size); + + $fontkey = $this->FontFamily . $this->FontStyle; + + if ($this->_intpl) { + $this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey]; + } else { + $this->_res['page'][$this->page]['fonts'][$fontkey] =& $this->fonts[$fontkey]; + } + } + + /** + * See FPDF/TCPDF-Documentation ;-) + */ + function Image($file, $x = null, $y = null, $w = 0, $h = 0, $type = '', $link = '') { + if (is_subclass_of($this, 'TCPDF')) { + $args = func_get_args(); + return call_user_func_array(array($this, 'TCPDF::Image'), $args); + } + + $ret = parent::Image($file, $x, $y, $w, $h, $type, $link); + if ($this->_intpl) { + $this->_res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file]; + } else { + $this->_res['page'][$this->page]['images'][$file] =& $this->images[$file]; + } + + return $ret; + } + + /** + * See FPDF-Documentation ;-) + * + * AddPage is not available when you're "in" a template. + */ + function AddPage($orientation = '', $format = '') { + if (is_subclass_of($this, 'TCPDF')) { + $args = func_get_args(); + return call_user_func_array(array($this, 'TCPDF::AddPage'), $args); + } + + if ($this->_intpl) + $this->Error('Adding pages in templates isn\'t possible!'); + + parent::AddPage($orientation, $format); + } + + /** + * Preserve adding Links in Templates ...won't work + */ + function Link($x, $y, $w, $h, $link) { + if (is_subclass_of($this, 'TCPDF')) { + $args = func_get_args(); + return call_user_func_array(array($this, 'TCPDF::Link'), $args); + } + + if ($this->_intpl) + $this->Error('Using links in templates aren\'t possible!'); + + parent::Link($x, $y, $w, $h, $link); + } + + function AddLink() { + if (is_subclass_of($this, 'TCPDF')) { + $args = func_get_args(); + return call_user_func_array(array($this, 'TCPDF::AddLink'), $args); + } + + if ($this->_intpl) + $this->Error('Adding links in templates aren\'t possible!'); + return parent::AddLink(); + } + + function SetLink($link, $y = 0, $page = -1) { + if (is_subclass_of($this, 'TCPDF')) { + $args = func_get_args(); + return call_user_func_array(array($this, 'TCPDF::SetLink'), $args); + } + + if ($this->_intpl) + $this->Error('Setting links in templates aren\'t possible!'); + parent::SetLink($link, $y, $page); + } + + /** + * Private Method that writes the form xobjects + */ + function _putformxobjects() { + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + reset($this->tpls); + foreach($this->tpls AS $tplidx => $tpl) { + + $p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer']; + $this->_newobj(); + $this->tpls[$tplidx]['n'] = $this->n; + $this->_out('<<'.$filter.'/Type /XObject'); + $this->_out('/Subtype /Form'); + $this->_out('/FormType 1'); + $this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]', + // llx + $tpl['x'] * $this->k, + // lly + -$tpl['y'] * $this->k, + // urx + ($tpl['w'] + $tpl['x']) * $this->k, + // ury + ($tpl['h'] - $tpl['y']) * $this->k + )); + + if ($tpl['x'] != 0 || $tpl['y'] != 0) { + $this->_out(sprintf('/Matrix [1 0 0 1 %.5F %.5F]', + -$tpl['x'] * $this->k * 2, $tpl['y'] * $this->k * 2 + )); + } + + $this->_out('/Resources '); + + $this->_out('<_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { + $this->_out('/Font <<'); + foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) + $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); + $this->_out('>>'); + } + if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || + isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) + { + $this->_out('/XObject <<'); + if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { + foreach($this->_res['tpl'][$tplidx]['images'] as $image) + $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); + } + if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { + foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) + $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); + } + $this->_out('>>'); + } + $this->_out('>>'); + + $this->_out('/Length ' . strlen($p) . ' >>'); + $this->_putstream($p); + $this->_out('endobj'); + } + } + + /** + * Overwritten to add _putformxobjects() after _putimages() + * + */ + function _putimages() { + parent::_putimages(); + $this->_putformxobjects(); + } + + function _putxobjectdict() { + parent::_putxobjectdict(); + + if (count($this->tpls)) { + foreach($this->tpls as $tplidx => $tpl) { + $this->_out(sprintf('%s%d %d 0 R', $this->tplprefix, $tplidx, $tpl['n'])); + } + } + } + + /** + * Private Method + */ + function _out($s) { + if ($this->state == 2 && $this->_intpl) { + $this->tpls[$this->tpl]['buffer'] .= $s . "\n"; + } else { + parent::_out($s); + } + } +} diff --git a/htdocs/includes/fpdfi/fpdi.php b/htdocs/includes/fpdfi/fpdi.php index faa1abe0f0d..0ae2c63741c 100755 --- a/htdocs/includes/fpdfi/fpdi.php +++ b/htdocs/includes/fpdfi/fpdi.php @@ -1,542 +1,571 @@ -current_filename = $filename; - - if (!isset($this->parsers[$filename])) - $this->parsers[$filename] = $this->_getPdfParser($filename); - $this->current_parser =& $this->parsers[$filename]; - - return $this->parsers[$filename]->getPageCount(); - } - - /** - * Returns a PDF parser object - * - * @param string $filename - * @return fpdi_pdf_parser - */ - function _getPdfParser($filename) { - return new fpdi_pdf_parser($filename, $this); - } - - /** - * Get the current PDF version - * - * @return string - */ - function getPDFVersion() { - return $this->PDFVersion; - } - - /** - * Set the PDF version - * - * @return string - */ - function setPDFVersion($version = '1.3') { - $this->PDFVersion = $version; - } - - /** - * Import a page - * - * @param int $pageno pagenumber - * @return int Index of imported page - to use with fpdf_tpl::useTemplate() - */ - function importPage($pageno, $boxName = '/CropBox') { - if ($this->_intpl) { - return $this->error('Please import the desired pages before creating a new template.'); - } - - $fn = $this->current_filename; - - // check if page already imported - $pageKey = $fn . '-' . ((int)$pageno) . $boxName; - if (isset($this->_importedPages[$pageKey])) - return $this->_importedPages[$pageKey]; - - $parser =& $this->parsers[$fn]; - $parser->setPageno($pageno); - - if (!in_array($boxName, $parser->availableBoxes)) - return $this->Error(sprintf('Unknown box: %s', $boxName)); - $pageboxes = $parser->getPageBoxes($pageno, $this->k); - - /** - * MediaBox - * CropBox: Default -> MediaBox - * BleedBox: Default -> CropBox - * TrimBox: Default -> CropBox - * ArtBox: Default -> CropBox - */ - if (!isset($pageboxes[$boxName]) && ($boxName == '/BleedBox' || $boxName == '/TrimBox' || $boxName == '/ArtBox')) - $boxName = '/CropBox'; - if (!isset($pageboxes[$boxName]) && $boxName == '/CropBox') - $boxName = '/MediaBox'; - - if (!isset($pageboxes[$boxName])) - return false; - $this->lastUsedPageBox = $boxName; - - $box = $pageboxes[$boxName]; - - $this->tpl++; - $this->tpls[$this->tpl] = array(); - $tpl =& $this->tpls[$this->tpl]; - $tpl['parser'] =& $parser; - $tpl['resources'] = $parser->getPageResources(); - $tpl['buffer'] = $parser->getContent(); - $tpl['box'] = $box; - - // To build an array that can be used by PDF_TPL::useTemplate() - $this->tpls[$this->tpl] = array_merge($this->tpls[$this->tpl], $box); - - // An imported page will start at 0,0 everytime. Translation will be set in _putformxobjects() - $tpl['x'] = 0; - $tpl['y'] = 0; - - // handle rotated pages - $rotation = $parser->getPageRotation($pageno); - $tpl['_rotationAngle'] = 0; - if (isset($rotation[1]) && ($angle = $rotation[1] % 360) != 0) { - $steps = $angle / 90; - - $_w = $tpl['w']; - $_h = $tpl['h']; - $tpl['w'] = $steps % 2 == 0 ? $_w : $_h; - $tpl['h'] = $steps % 2 == 0 ? $_h : $_w; - - if ($angle < 0) - $angle += 360; - - $tpl['_rotationAngle'] = $angle * -1; - } - - $this->_importedPages[$pageKey] = $this->tpl; - - return $this->tpl; - } - - function getLastUsedPageBox() { - return $this->lastUsedPageBox; - } - - function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0, $adjustPageSize = false) { - if ($adjustPageSize == true && is_null($_x) && is_null($_y)) { - $size = $this->getTemplateSize($tplidx, $_w, $_h); - $format = array($size['w'], $size['h']); - if (is_subclass_of($this, 'TCPDF')) { - $this->setPageFormat($format, $format[0] > $format[1] ? 'L' : 'P'); - } else { - if ($format[0] != $this->CurPageFormat[0] || $format[1] != $this->CurPageFormat[1]) { - $this->w = $format[0]; - $this->h = $format[1]; - $this->wPt = $this->w * $this->k; - $this->hPt = $this->h * $this->k; - $this->PageBreakTrigger = $this->h - $this->bMargin; - $this->CurPageFormat = $format; - $this->PageSizes[$this->page] = array($this->wPt, $this->hPt); - } - } - } - - $this->_out('q 0 J 1 w 0 j 0 G 0 g'); // reset standard values - $s = parent::useTemplate($tplidx, $_x, $_y, $_w, $_h); - $this->_out('Q'); - - return $s; - } - - /** - * Private method, that rebuilds all needed objects of source files - */ - function _putimportedobjects() { - if (is_array($this->parsers) && count($this->parsers) > 0) { - foreach($this->parsers AS $filename => $p) { - $this->current_parser =& $this->parsers[$filename]; - if (isset($this->_obj_stack[$filename]) && is_array($this->_obj_stack[$filename])) { - while(($n = key($this->_obj_stack[$filename])) !== null) { - $nObj = $this->current_parser->pdf_resolve_object($this->current_parser->c, $this->_obj_stack[$filename][$n][1]); - - $this->_newobj($this->_obj_stack[$filename][$n][0]); - - if ($nObj[0] == PDF_TYPE_STREAM) { - $this->pdf_write_value($nObj); - } else { - $this->pdf_write_value($nObj[1]); - } - - $this->_out('endobj'); - $this->_obj_stack[$filename][$n] = null; // free memory - unset($this->_obj_stack[$filename][$n]); - reset($this->_obj_stack[$filename]); - } - } - } - } - } - - - /** - * Private Method that writes the form xobjects - */ - function _putformxobjects() { - $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; - reset($this->tpls); - foreach($this->tpls AS $tplidx => $tpl) { - $p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer']; - $this->_newobj(); - $cN = $this->n; // TCPDF/Protection: rem current "n" - - $this->tpls[$tplidx]['n'] = $this->n; - $this->_out('<<' . $filter . '/Type /XObject'); - $this->_out('/Subtype /Form'); - $this->_out('/FormType 1'); - - $this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]', - (isset($tpl['box']['llx']) ? $tpl['box']['llx'] : $tpl['x']) * $this->k, - (isset($tpl['box']['lly']) ? $tpl['box']['lly'] : -$tpl['y']) * $this->k, - (isset($tpl['box']['urx']) ? $tpl['box']['urx'] : $tpl['w'] + $tpl['x']) * $this->k, - (isset($tpl['box']['ury']) ? $tpl['box']['ury'] : $tpl['h'] - $tpl['y']) * $this->k - )); - - $c = 1; - $s = 0; - $tx = 0; - $ty = 0; - - if (isset($tpl['box'])) { - $tx = -$tpl['box']['llx']; - $ty = -$tpl['box']['lly']; - - if ($tpl['_rotationAngle'] <> 0) { - $angle = $tpl['_rotationAngle'] * M_PI/180; - $c=cos($angle); - $s=sin($angle); - - switch($tpl['_rotationAngle']) { - case -90: - $tx = -$tpl['box']['lly']; - $ty = $tpl['box']['urx']; - break; - case -180: - $tx = $tpl['box']['urx']; - $ty = $tpl['box']['ury']; - break; - case -270: - $tx = $tpl['box']['ury']; - $ty = -$tpl['box']['llx']; - break; - } - } - } else if ($tpl['x'] != 0 || $tpl['y'] != 0) { - $tx = -$tpl['x']*2; - $ty = $tpl['y']*2; - } - - $tx *= $this->k; - $ty *= $this->k; - - if ($c != 1 || $s != 0 || $tx != 0 || $ty != 0) { - $this->_out(sprintf('/Matrix [%.5F %.5F %.5F %.5F %.5F %.5F]', - $c, $s, -$s, $c, $tx, $ty - )); - } - - $this->_out('/Resources '); - - if (isset($tpl['resources'])) { - $this->current_parser =& $tpl['parser']; - $this->pdf_write_value($tpl['resources']); // "n" will be changed - } else { - $this->_out('<_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { - $this->_out('/Font <<'); - foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) - $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); - $this->_out('>>'); - } - if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || - isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) - { - $this->_out('/XObject <<'); - if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { - foreach($this->_res['tpl'][$tplidx]['images'] as $image) - $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); - } - if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { - foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) - $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); - } - $this->_out('>>'); - } - $this->_out('>>'); - } - - $nN = $this->n; // TCPDF: rem new "n" - $this->n = $cN; // TCPDF: reset to current "n" - $this->_out('/Length ' . strlen($p) . ' >>'); - $this->_putstream($p); - $this->_out('endobj'); - $this->n = $nN; // TCPDF: reset to new "n" - } - - $this->_putimportedobjects(); - } - - /** - * Rewritten to handle existing own defined objects - */ - function _newobj($obj_id = false, $onlynewobj = false) { - if (!$obj_id) { - $obj_id = ++$this->n; - } - - //Begin a new object - if (!$onlynewobj) { - $this->offsets[$obj_id] = is_subclass_of($this, 'TCPDF') ? $this->bufferlen : strlen($this->buffer); - $this->_out($obj_id . ' 0 obj'); - $this->_current_obj_id = $obj_id; // for later use with encryption - } - - return $obj_id; - } - - /** - * Writes a value - * Needed to rebuild the source document - * - * @param mixed $value A PDF-Value. Structure of values see cases in this method - */ - function pdf_write_value(&$value) - { - if (is_subclass_of($this, 'TCPDF')) { - parent::pdf_write_value($value); - } - - switch ($value[0]) { - - case PDF_TYPE_TOKEN: - $this->_straightOut($value[1] . ' '); - break; - case PDF_TYPE_NUMERIC: - case PDF_TYPE_REAL: - if (is_float($value[1]) && $value[1] != 0) { - $this->_straightOut(rtrim(rtrim(sprintf('%F', $value[1]), '0'), '.') . ' '); - } else { - $this->_straightOut($value[1] . ' '); - } - break; - - case PDF_TYPE_ARRAY: - - // An array. Output the proper - // structure and move on. - - $this->_straightOut('['); - for ($i = 0; $i < count($value[1]); $i++) { - $this->pdf_write_value($value[1][$i]); - } - - $this->_out(']'); - break; - - case PDF_TYPE_DICTIONARY: - - // A dictionary. - $this->_straightOut('<<'); - - reset ($value[1]); - - while (list($k, $v) = each($value[1])) { - $this->_straightOut($k . ' '); - $this->pdf_write_value($v); - } - - $this->_straightOut('>>'); - break; - - case PDF_TYPE_OBJREF: - - // An indirect object reference - // Fill the object stack if needed - $cpfn =& $this->current_parser->filename; - - if (!isset($this->_don_obj_stack[$cpfn][$value[1]])) { - $this->_newobj(false, true); - $this->_obj_stack[$cpfn][$value[1]] = array($this->n, $value); - $this->_don_obj_stack[$cpfn][$value[1]] = array($this->n, $value); // Value is maybee obsolete!!! - } - $objid = $this->_don_obj_stack[$cpfn][$value[1]][0]; - - $this->_out($objid . ' 0 R'); - break; - - case PDF_TYPE_STRING: - - // A string. - $this->_straightOut('(' . $value[1] . ')'); - - break; - - case PDF_TYPE_STREAM: - - // A stream. First, output the - // stream dictionary, then the - // stream data itself. - $this->pdf_write_value($value[1]); - $this->_out('stream'); - $this->_out($value[2][1]); - $this->_out('endstream'); - break; - - case PDF_TYPE_HEX: - $this->_straightOut('<' . $value[1] . '>'); - break; - - case PDF_TYPE_BOOLEAN: - $this->_straightOut($value[1] ? 'true ' : 'false '); - break; - - case PDF_TYPE_NULL: - // The null object. - - $this->_straightOut('null '); - break; - } - } - - - /** - * Modified so not each call will add a newline to the output. - */ - function _straightOut($s) { - if (!is_subclass_of($this, 'TCPDF')) { - if($this->state==2) - $this->pages[$this->page] .= $s; - else - $this->buffer .= $s; - } else { - if ($this->state == 2) { - if (isset($this->footerlen[$this->page]) AND ($this->footerlen[$this->page] > 0)) { - // puts data before page footer - $page = substr($this->getPageBuffer($this->page), 0, -$this->footerlen[$this->page]); - $footer = substr($this->getPageBuffer($this->page), -$this->footerlen[$this->page]); - $this->setPageBuffer($this->page, $page . ' ' . $s . "\n" . $footer); - } else { - $this->setPageBuffer($this->page, $s, true); - } - } else { - $this->setBuffer($s); - } - } - } - - /** - * rewritten to close opened parsers - * - */ - function _enddoc() { - parent::_enddoc(); - $this->_closeParsers(); - } - - /** - * close all files opened by parsers - */ - function _closeParsers() { - if ($this->state > 2 && count($this->parsers) > 0) { - foreach ($this->parsers as $k => $_){ - $this->parsers[$k]->closeFile(); - $this->parsers[$k] = null; - unset($this->parsers[$k]); - } - return true; - } - return false; - } +current_filename = $filename; + + if (!isset($this->parsers[$filename])) + $this->parsers[$filename] = $this->_getPdfParser($filename); + $this->current_parser =& $this->parsers[$filename]; + + return $this->parsers[$filename]->getPageCount(); + } + + /** + * Returns a PDF parser object + * + * @param string $filename + * @return fpdi_pdf_parser + */ + function _getPdfParser($filename) { + return new fpdi_pdf_parser($filename, $this); + } + + /** + * Get the current PDF version + * + * @return string + */ + function getPDFVersion() { + return $this->PDFVersion; + } + + /** + * Set the PDF version + * + * @return string + */ + function setPDFVersion($version = '1.3') { + $this->PDFVersion = $version; + } + + /** + * Import a page + * + * @param int $pageno pagenumber + * @return int Index of imported page - to use with fpdf_tpl::useTemplate() + */ + function importPage($pageno, $boxName = '/CropBox') { + if ($this->_intpl) { + return $this->error('Please import the desired pages before creating a new template.'); + } + + $fn = $this->current_filename; + + // check if page already imported + $pageKey = $fn . '-' . ((int)$pageno) . $boxName; + if (isset($this->_importedPages[$pageKey])) + return $this->_importedPages[$pageKey]; + + $parser =& $this->parsers[$fn]; + $parser->setPageno($pageno); + + if (!in_array($boxName, $parser->availableBoxes)) + return $this->Error(sprintf('Unknown box: %s', $boxName)); + + $pageboxes = $parser->getPageBoxes($pageno, $this->k); + + /** + * MediaBox + * CropBox: Default -> MediaBox + * BleedBox: Default -> CropBox + * TrimBox: Default -> CropBox + * ArtBox: Default -> CropBox + */ + if (!isset($pageboxes[$boxName]) && ($boxName == '/BleedBox' || $boxName == '/TrimBox' || $boxName == '/ArtBox')) + $boxName = '/CropBox'; + if (!isset($pageboxes[$boxName]) && $boxName == '/CropBox') + $boxName = '/MediaBox'; + + if (!isset($pageboxes[$boxName])) + return false; + + $this->lastUsedPageBox = $boxName; + + $box = $pageboxes[$boxName]; + + $this->tpl++; + $this->tpls[$this->tpl] = array(); + $tpl =& $this->tpls[$this->tpl]; + $tpl['parser'] =& $parser; + $tpl['resources'] = $parser->getPageResources(); + $tpl['buffer'] = $parser->getContent(); + $tpl['box'] = $box; + + // To build an array that can be used by PDF_TPL::useTemplate() + $this->tpls[$this->tpl] = array_merge($this->tpls[$this->tpl], $box); + + // An imported page will start at 0,0 everytime. Translation will be set in _putformxobjects() + $tpl['x'] = 0; + $tpl['y'] = 0; + + // handle rotated pages + $rotation = $parser->getPageRotation($pageno); + $tpl['_rotationAngle'] = 0; + if (isset($rotation[1]) && ($angle = $rotation[1] % 360) != 0) { + $steps = $angle / 90; + + $_w = $tpl['w']; + $_h = $tpl['h']; + $tpl['w'] = $steps % 2 == 0 ? $_w : $_h; + $tpl['h'] = $steps % 2 == 0 ? $_h : $_w; + + if ($angle < 0) + $angle += 360; + + $tpl['_rotationAngle'] = $angle * -1; + } + + $this->_importedPages[$pageKey] = $this->tpl; + + return $this->tpl; + } + + /** + * Returns the last used page box + * + * @return string + */ + function getLastUsedPageBox() { + return $this->lastUsedPageBox; + } + + + function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0, $adjustPageSize = false) { + if ($adjustPageSize == true && is_null($_x) && is_null($_y)) { + $size = $this->getTemplateSize($tplidx, $_w, $_h); + $orientation = $size['w'] > $size['h'] ? 'L' : 'P'; + $size = array($size['w'], $size['h']); + + if (is_subclass_of($this, 'TCPDF')) { + $this->setPageFormat($size, $orientation); + } else { + $size = $this->_getpagesize($size); + + if($orientation!=$this->CurOrientation || $size[0]!=$this->CurPageSize[0] || $size[1]!=$this->CurPageSize[1]) + { + // New size or orientation + if($orientation=='P') + { + $this->w = $size[0]; + $this->h = $size[1]; + } + else + { + $this->w = $size[1]; + $this->h = $size[0]; + } + $this->wPt = $this->w*$this->k; + $this->hPt = $this->h*$this->k; + $this->PageBreakTrigger = $this->h-$this->bMargin; + $this->CurOrientation = $orientation; + $this->CurPageSize = $size; + $this->PageSizes[$this->page] = array($this->wPt, $this->hPt); + } + } + } + + $this->_out('q 0 J 1 w 0 j 0 G 0 g'); // reset standard values + $s = parent::useTemplate($tplidx, $_x, $_y, $_w, $_h); + $this->_out('Q'); + + return $s; + } + + /** + * Private method, that rebuilds all needed objects of source files + */ + function _putimportedobjects() { + if (is_array($this->parsers) && count($this->parsers) > 0) { + foreach($this->parsers AS $filename => $p) { + $this->current_parser =& $this->parsers[$filename]; + if (isset($this->_obj_stack[$filename]) && is_array($this->_obj_stack[$filename])) { + while(($n = key($this->_obj_stack[$filename])) !== null) { + $nObj = $this->current_parser->pdf_resolve_object($this->current_parser->c, $this->_obj_stack[$filename][$n][1]); + + $this->_newobj($this->_obj_stack[$filename][$n][0]); + + if ($nObj[0] == PDF_TYPE_STREAM) { + $this->pdf_write_value($nObj); + } else { + $this->pdf_write_value($nObj[1]); + } + + $this->_out('endobj'); + $this->_obj_stack[$filename][$n] = null; // free memory + unset($this->_obj_stack[$filename][$n]); + reset($this->_obj_stack[$filename]); + } + } + } + } + } + + + /** + * Private Method that writes the form xobjects + */ + function _putformxobjects() { + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + reset($this->tpls); + foreach($this->tpls AS $tplidx => $tpl) { + $p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer']; + $this->_newobj(); + $cN = $this->n; // TCPDF/Protection: rem current "n" + + $this->tpls[$tplidx]['n'] = $this->n; + $this->_out('<<' . $filter . '/Type /XObject'); + $this->_out('/Subtype /Form'); + $this->_out('/FormType 1'); + + $this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]', + (isset($tpl['box']['llx']) ? $tpl['box']['llx'] : $tpl['x']) * $this->k, + (isset($tpl['box']['lly']) ? $tpl['box']['lly'] : -$tpl['y']) * $this->k, + (isset($tpl['box']['urx']) ? $tpl['box']['urx'] : $tpl['w'] + $tpl['x']) * $this->k, + (isset($tpl['box']['ury']) ? $tpl['box']['ury'] : $tpl['h'] - $tpl['y']) * $this->k + )); + + $c = 1; + $s = 0; + $tx = 0; + $ty = 0; + + if (isset($tpl['box'])) { + $tx = -$tpl['box']['llx']; + $ty = -$tpl['box']['lly']; + + if ($tpl['_rotationAngle'] <> 0) { + $angle = $tpl['_rotationAngle'] * M_PI/180; + $c=cos($angle); + $s=sin($angle); + + switch($tpl['_rotationAngle']) { + case -90: + $tx = -$tpl['box']['lly']; + $ty = $tpl['box']['urx']; + break; + case -180: + $tx = $tpl['box']['urx']; + $ty = $tpl['box']['ury']; + break; + case -270: + $tx = $tpl['box']['ury']; + $ty = -$tpl['box']['llx']; + break; + } + } + } else if ($tpl['x'] != 0 || $tpl['y'] != 0) { + $tx = -$tpl['x'] * 2; + $ty = $tpl['y'] * 2; + } + + $tx *= $this->k; + $ty *= $this->k; + + if ($c != 1 || $s != 0 || $tx != 0 || $ty != 0) { + $this->_out(sprintf('/Matrix [%.5F %.5F %.5F %.5F %.5F %.5F]', + $c, $s, -$s, $c, $tx, $ty + )); + } + + $this->_out('/Resources '); + + if (isset($tpl['resources'])) { + $this->current_parser =& $tpl['parser']; + $this->pdf_write_value($tpl['resources']); // "n" will be changed + } else { + $this->_out('<_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { + $this->_out('/Font <<'); + foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) + $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); + $this->_out('>>'); + } + if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || + isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) + { + $this->_out('/XObject <<'); + if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { + foreach($this->_res['tpl'][$tplidx]['images'] as $image) + $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); + } + if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { + foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) + $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); + } + $this->_out('>>'); + } + $this->_out('>>'); + } + + $nN = $this->n; // TCPDF: rem new "n" + $this->n = $cN; // TCPDF: reset to current "n" + if (is_subclass_of($this, 'TCPDF')) { + $p = $this->_getrawstream($p); + $this->_out('/Length ' . strlen($p) . ' >>'); + $this->_out("stream\n" . $p . "\nendstream"); + } else { + $this->_out('/Length ' . strlen($p) . ' >>'); + $this->_putstream($p); + } + $this->_out('endobj'); + $this->n = $nN; // TCPDF: reset to new "n" + } + + $this->_putimportedobjects(); + } + + /** + * Rewritten to handle existing own defined objects + */ + function _newobj($obj_id = false, $onlynewobj = false) { + if (!$obj_id) { + $obj_id = ++$this->n; + } + + //Begin a new object + if (!$onlynewobj) { + $this->offsets[$obj_id] = is_subclass_of($this, 'TCPDF') ? $this->bufferlen : strlen($this->buffer); + $this->_out($obj_id . ' 0 obj'); + $this->_current_obj_id = $obj_id; // for later use with encryption + } + + return $obj_id; + } + + /** + * Writes a value + * Needed to rebuild the source document + * + * @param mixed $value A PDF-Value. Structure of values see cases in this method + */ + function pdf_write_value(&$value) + { + if (is_subclass_of($this, 'TCPDF')) { + parent::pdf_write_value($value); + } + + switch ($value[0]) { + + case PDF_TYPE_TOKEN: + $this->_straightOut($value[1] . ' '); + break; + case PDF_TYPE_NUMERIC: + case PDF_TYPE_REAL: + if (is_float($value[1]) && $value[1] != 0) { + $this->_straightOut(rtrim(rtrim(sprintf('%F', $value[1]), '0'), '.') . ' '); + } else { + $this->_straightOut($value[1] . ' '); + } + break; + + case PDF_TYPE_ARRAY: + + // An array. Output the proper + // structure and move on. + + $this->_straightOut('['); + for ($i = 0; $i < count($value[1]); $i++) { + $this->pdf_write_value($value[1][$i]); + } + + $this->_out(']'); + break; + + case PDF_TYPE_DICTIONARY: + + // A dictionary. + $this->_straightOut('<<'); + + reset ($value[1]); + + while (list($k, $v) = each($value[1])) { + $this->_straightOut($k . ' '); + $this->pdf_write_value($v); + } + + $this->_straightOut('>>'); + break; + + case PDF_TYPE_OBJREF: + + // An indirect object reference + // Fill the object stack if needed + $cpfn =& $this->current_parser->filename; + + if (!isset($this->_don_obj_stack[$cpfn][$value[1]])) { + $this->_newobj(false, true); + $this->_obj_stack[$cpfn][$value[1]] = array($this->n, $value); + $this->_don_obj_stack[$cpfn][$value[1]] = array($this->n, $value); // Value is maybee obsolete!!! + } + $objid = $this->_don_obj_stack[$cpfn][$value[1]][0]; + + $this->_out($objid . ' 0 R'); + break; + + case PDF_TYPE_STRING: + + // A string. + $this->_straightOut('(' . $value[1] . ')'); + + break; + + case PDF_TYPE_STREAM: + + // A stream. First, output the + // stream dictionary, then the + // stream data itself. + $this->pdf_write_value($value[1]); + $this->_out('stream'); + $this->_out($value[2][1]); + $this->_out('endstream'); + break; + + case PDF_TYPE_HEX: + $this->_straightOut('<' . $value[1] . '>'); + break; + + case PDF_TYPE_BOOLEAN: + $this->_straightOut($value[1] ? 'true ' : 'false '); + break; + + case PDF_TYPE_NULL: + // The null object. + + $this->_straightOut('null '); + break; + } + } + + + /** + * Modified so not each call will add a newline to the output. + */ + function _straightOut($s) { + if (!is_subclass_of($this, 'TCPDF')) { + if($this->state==2) + $this->pages[$this->page] .= $s; + else + $this->buffer .= $s; + } else { + if ($this->state == 2) { + if (isset($this->footerlen[$this->page]) AND ($this->footerlen[$this->page] > 0)) { + // puts data before page footer + $page = substr($this->getPageBuffer($this->page), 0, -$this->footerlen[$this->page]); + $footer = substr($this->getPageBuffer($this->page), -$this->footerlen[$this->page]); + $this->setPageBuffer($this->page, $page . ' ' . $s . "\n" . $footer); + } else { + $this->setPageBuffer($this->page, $s, true); + } + } else { + $this->setBuffer($s); + } + } + } + + /** + * rewritten to close opened parsers + * + */ + function _enddoc() { + parent::_enddoc(); + $this->_closeParsers(); + } + + /** + * close all files opened by parsers + */ + function _closeParsers() { + if ($this->state > 2 && count($this->parsers) > 0) { + foreach ($this->parsers as $k => $_){ + $this->parsers[$k]->closeFile(); + $this->parsers[$k] = null; + unset($this->parsers[$k]); + } + return true; + } + return false; + } } \ No newline at end of file diff --git a/htdocs/includes/fpdfi/fpdi2tcpdf_bridge.php b/htdocs/includes/fpdfi/fpdi2tcpdf_bridge.php index 640700a8322..8a031a38c69 100755 --- a/htdocs/includes/fpdfi/fpdi2tcpdf_bridge.php +++ b/htdocs/includes/fpdfi/fpdi2tcpdf_bridge.php @@ -1,6 +1,6 @@ encrypted) { $value[1] = $this->_unescape($value[1]); - $value[1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[1]); + $value[1] = $this->_encrypt_data($this->_current_obj_id, $value[1]); $value[1] = $this->_escape($value[1]); } break; case PDF_TYPE_STREAM: if ($this->encrypted) { - $value[2][1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[2][1]); + $value[2][1] = $this->_encrypt_data($this->_current_obj_id, $value[2][1]); + $value[1][1]['/Length'] = array( + PDF_TYPE_NUMERIC, + strlen($value[2][1]) + ); } break; case PDF_TYPE_HEX: if ($this->encrypted) { $value[1] = $this->hex2str($value[1]); - $value[1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[1]); + $value[1] = $this->_encrypt_data($this->_current_obj_id, $value[1]); // remake hexstring of encrypted string $value[1] = $this->str2hex($value[1]); diff --git a/htdocs/includes/fpdfi/fpdi_pdf_parser.php b/htdocs/includes/fpdfi/fpdi_pdf_parser.php index 1e87f891e87..fd2b4414c76 100755 --- a/htdocs/includes/fpdfi/fpdi_pdf_parser.php +++ b/htdocs/includes/fpdfi/fpdi_pdf_parser.php @@ -1,409 +1,408 @@ -fpdi =& $fpdi; - - parent::pdf_parser($filename); - - // resolve Pages-Dictonary - $pages = $this->pdf_resolve_object($this->c, $this->root[1][1]['/Pages']); - - // Read pages - $this->read_pages($this->c, $pages, $this->pages); - - // count pages; - $this->page_count = count($this->pages); - } - - /** - * Overwrite parent::error() - * - * @param string $msg Error-Message - */ - function error($msg) { - $this->fpdi->error($msg); - } - - /** - * Get pagecount from sourcefile - * - * @return int - */ - function getPageCount() { - return $this->page_count; - } - - - /** - * Set pageno - * - * @param int $pageno Pagenumber to use - */ - function setPageno($pageno) { - $pageno = ((int) $pageno) - 1; - - if ($pageno < 0 || $pageno >= $this->getPageCount()) { - $this->fpdi->error('Pagenumber is wrong!'); - } - - $this->pageno = $pageno; - } - - /** - * Get page-resources from current page - * - * @return array - */ - function getPageResources() { - return $this->_getPageResources($this->pages[$this->pageno]); - } - - /** - * Get page-resources from /Page - * - * @param array $obj Array of pdf-data - */ - function _getPageResources ($obj) { // $obj = /Page - $obj = $this->pdf_resolve_object($this->c, $obj); - - // If the current object has a resources - // dictionary associated with it, we use - // it. Otherwise, we move back to its - // parent object. - if (isset ($obj[1][1]['/Resources'])) { - $res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Resources']); - if ($res[0] == PDF_TYPE_OBJECT) - return $res[1]; - return $res; - } else { - if (!isset ($obj[1][1]['/Parent'])) { - return false; - } else { - $res = $this->_getPageResources($obj[1][1]['/Parent']); - if ($res[0] == PDF_TYPE_OBJECT) - return $res[1]; - return $res; - } - } - } - - - /** - * Get content of current page - * - * If more /Contents is an array, the streams are concated - * - * @return string - */ - function getContent() { - $buffer = ''; - - if (isset($this->pages[$this->pageno][1][1]['/Contents'])) { - $contents = $this->_getPageContent($this->pages[$this->pageno][1][1]['/Contents']); - foreach($contents AS $tmp_content) { - $buffer .= $this->_rebuildContentStream($tmp_content) . ' '; - } - } - - return $buffer; - } - - - /** - * Resolve all content-objects - * - * @param array $content_ref - * @return array - */ - function _getPageContent($content_ref) { - $contents = array(); - - if ($content_ref[0] == PDF_TYPE_OBJREF) { - $content = $this->pdf_resolve_object($this->c, $content_ref); - if ($content[1][0] == PDF_TYPE_ARRAY) { - $contents = $this->_getPageContent($content[1]); - } else { - $contents[] = $content; - } - } else if ($content_ref[0] == PDF_TYPE_ARRAY) { - foreach ($content_ref[1] AS $tmp_content_ref) { - $contents = array_merge($contents,$this->_getPageContent($tmp_content_ref)); - } - } - - return $contents; - } - - - /** - * Rebuild content-streams - * - * @param array $obj - * @return string - */ - function _rebuildContentStream($obj) { - $filters = array(); - - if (isset($obj[1][1]['/Filter'])) { - $_filter = $obj[1][1]['/Filter']; - - if ($_filter[0] == PDF_TYPE_OBJREF) { - $tmpFilter = $this->pdf_resolve_object($this->c, $_filter); - $_filter = $tmpFilter[1]; - } - - if ($_filter[0] == PDF_TYPE_TOKEN) { - $filters[] = $_filter; - } else if ($_filter[0] == PDF_TYPE_ARRAY) { - $filters = $_filter[1]; - } - } - - $stream = $obj[2][1]; - - foreach ($filters AS $_filter) { - switch ($_filter[1]) { - case '/FlateDecode': - case '/Fl': - // $stream .= "\x0F\x0D"; // in an errorious stream this suffix could work - // $stream .= "\x0A"; - // $stream .= "\x0D"; - if (function_exists('gzuncompress')) { - $stream = (strlen($stream) > 0) ? @gzuncompress($stream) : ''; - } else { - $this->error(sprintf('To handle %s filter, please compile php with zlib support.',$_filter[1])); - } - - if ($stream === false) { - $this->error('Error while decompressing stream.'); - } - break; - case '/LZWDecode': - include_once('filters/FilterLZW_FPDI.php'); - $decoder = new FilterLZW_FPDI($this->fpdi); - $stream = $decoder->decode($stream); - break; - case '/ASCII85Decode': - include_once('filters/FilterASCII85_FPDI.php'); - $decoder = new FilterASCII85_FPDI($this->fpdi); - $stream = $decoder->decode($stream); - break; - case null: - $stream = $stream; - break; - default: - $this->error(sprintf('Unsupported Filter: %s',$_filter[1])); - } - } - - return $stream; - } - - - /** - * Get a Box from a page - * Arrayformat is same as used by fpdf_tpl - * - * @param array $page a /Page - * @param string $box_index Type of Box @see $availableBoxes - * @param float Scale factor from user space units to points - * @return array - */ - function getPageBox($page, $box_index, $k) { - $page = $this->pdf_resolve_object($this->c, $page); - $box = null; - if (isset($page[1][1][$box_index])) - $box =& $page[1][1][$box_index]; - - if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) { - $tmp_box = $this->pdf_resolve_object($this->c, $box); - $box = $tmp_box[1]; - } - - if (!is_null($box) && $box[0] == PDF_TYPE_ARRAY) { - $b =& $box[1]; - return array('x' => $b[0][1]/$k, - 'y' => $b[1][1]/$k, - 'w' => abs($b[0][1]-$b[2][1])/$k, - 'h' => abs($b[1][1]-$b[3][1])/$k, - 'llx' => min($b[0][1], $b[2][1])/$k, - 'lly' => min($b[1][1], $b[3][1])/$k, - 'urx' => max($b[0][1], $b[2][1])/$k, - 'ury' => max($b[1][1], $b[3][1])/$k, - ); - } else if (!isset ($page[1][1]['/Parent'])) { - return false; - } else { - return $this->getPageBox($this->pdf_resolve_object($this->c, $page[1][1]['/Parent']), $box_index, $k); - } - } - - /** - * Get all page boxes by page no - * - * @param int The page number - * @param float Scale factor from user space units to points - * @return array - */ - function getPageBoxes($pageno, $k) { - return $this->_getPageBoxes($this->pages[$pageno-1], $k); - } - - /** - * Get all boxes from /Page - * - * @param array a /Page - * @return array - */ - function _getPageBoxes($page, $k) { - $boxes = array(); - - foreach($this->availableBoxes AS $box) { - if ($_box = $this->getPageBox($page, $box, $k)) { - $boxes[$box] = $_box; - } - } - - return $boxes; - } - - /** - * Get the page rotation by pageno - * - * @param integer $pageno - * @return array - */ - function getPageRotation($pageno) { - return $this->_getPageRotation($this->pages[$pageno-1]); - } - - function _getPageRotation($obj) { // $obj = /Page - $obj = $this->pdf_resolve_object($this->c, $obj); - if (isset ($obj[1][1]['/Rotate'])) { - $res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Rotate']); - if ($res[0] == PDF_TYPE_OBJECT) - return $res[1]; - return $res; - } else { - if (!isset ($obj[1][1]['/Parent'])) { - return false; - } else { - $res = $this->_getPageRotation($obj[1][1]['/Parent']); - if ($res[0] == PDF_TYPE_OBJECT) - return $res[1]; - return $res; - } - } - } - - /** - * Read all /Page(es) - * - * @param object pdf_context - * @param array /Pages - * @param array the result-array - */ - function read_pages(&$c, &$pages, &$result) { - // Get the kids dictionary - $_kids = $this->pdf_resolve_object ($c, $pages[1][1]['/Kids']); - - if (!is_array($_kids)) - $this->error('Cannot find /Kids in current /Page-Dictionary'); - - if ($_kids[1][0] == PDF_TYPE_ARRAY) { - $kids = $_kids[1][1]; - } else { - $kids = $_kids[1]; - } - - foreach ($kids as $v) { - $pg = $this->pdf_resolve_object ($c, $v); - if ($pg[1][1]['/Type'][1] === '/Pages') { - // If one of the kids is an embedded - // /Pages array, resolve it as well. - $this->read_pages($c, $pg, $result); - } else { - $result[] = $pg; - } - } - } - - - - /** - * Get PDF-Version - * - * And reset the PDF Version used in FPDI if needed - */ - function getPDFVersion() { - parent::getPDFVersion(); - $this->fpdi->setPDFVersion(max($this->fpdi->getPDFVersion(), $this->pdfVersion)); - } - +fpdi =& $fpdi; + + parent::pdf_parser($filename); + + // resolve Pages-Dictonary + $pages = $this->pdf_resolve_object($this->c, $this->root[1][1]['/Pages']); + + // Read pages + $this->read_pages($this->c, $pages, $this->pages); + + // count pages; + $this->page_count = count($this->pages); + } + + /** + * Overwrite parent::error() + * + * @param string $msg Error-Message + */ + function error($msg) { + $this->fpdi->error($msg); + } + + /** + * Get pagecount from sourcefile + * + * @return int + */ + function getPageCount() { + return $this->page_count; + } + + + /** + * Set pageno + * + * @param int $pageno Pagenumber to use + */ + function setPageno($pageno) { + $pageno = ((int) $pageno) - 1; + + if ($pageno < 0 || $pageno >= $this->getPageCount()) { + $this->fpdi->error('Pagenumber is wrong!'); + } + + $this->pageno = $pageno; + } + + /** + * Get page-resources from current page + * + * @return array + */ + function getPageResources() { + return $this->_getPageResources($this->pages[$this->pageno]); + } + + /** + * Get page-resources from /Page + * + * @param array $obj Array of pdf-data + */ + function _getPageResources ($obj) { // $obj = /Page + $obj = $this->pdf_resolve_object($this->c, $obj); + + // If the current object has a resources + // dictionary associated with it, we use + // it. Otherwise, we move back to its + // parent object. + if (isset ($obj[1][1]['/Resources'])) { + $res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Resources']); + if ($res[0] == PDF_TYPE_OBJECT) + return $res[1]; + return $res; + } else { + if (!isset ($obj[1][1]['/Parent'])) { + return false; + } else { + $res = $this->_getPageResources($obj[1][1]['/Parent']); + if ($res[0] == PDF_TYPE_OBJECT) + return $res[1]; + return $res; + } + } + } + + + /** + * Get content of current page + * + * If more /Contents is an array, the streams are concated + * + * @return string + */ + function getContent() { + $buffer = ''; + + if (isset($this->pages[$this->pageno][1][1]['/Contents'])) { + $contents = $this->_getPageContent($this->pages[$this->pageno][1][1]['/Contents']); + foreach($contents AS $tmp_content) { + $buffer .= $this->_rebuildContentStream($tmp_content) . ' '; + } + } + + return $buffer; + } + + + /** + * Resolve all content-objects + * + * @param array $content_ref + * @return array + */ + function _getPageContent($content_ref) { + $contents = array(); + + if ($content_ref[0] == PDF_TYPE_OBJREF) { + $content = $this->pdf_resolve_object($this->c, $content_ref); + if ($content[1][0] == PDF_TYPE_ARRAY) { + $contents = $this->_getPageContent($content[1]); + } else { + $contents[] = $content; + } + } else if ($content_ref[0] == PDF_TYPE_ARRAY) { + foreach ($content_ref[1] AS $tmp_content_ref) { + $contents = array_merge($contents,$this->_getPageContent($tmp_content_ref)); + } + } + + return $contents; + } + + + /** + * Rebuild content-streams + * + * @param array $obj + * @return string + */ + function _rebuildContentStream($obj) { + $filters = array(); + + if (isset($obj[1][1]['/Filter'])) { + $_filter = $obj[1][1]['/Filter']; + + if ($_filter[0] == PDF_TYPE_OBJREF) { + $tmpFilter = $this->pdf_resolve_object($this->c, $_filter); + $_filter = $tmpFilter[1]; + } + + if ($_filter[0] == PDF_TYPE_TOKEN) { + $filters[] = $_filter; + } else if ($_filter[0] == PDF_TYPE_ARRAY) { + $filters = $_filter[1]; + } + } + + $stream = $obj[2][1]; + + foreach ($filters AS $_filter) { + switch ($_filter[1]) { + case '/FlateDecode': + case '/Fl': + // $stream .= "\x0F\x0D"; // in an errorious stream this suffix could work + // $stream .= "\x0A"; + // $stream .= "\x0D"; + if (function_exists('gzuncompress')) { + $stream = (strlen($stream) > 0) ? @gzuncompress($stream) : ''; + } else { + $this->error(sprintf('To handle %s filter, please compile php with zlib support.',$_filter[1])); + } + + if ($stream === false) { + $this->error('Error while decompressing stream.'); + } + break; + case '/LZWDecode': + include_once('filters/FilterLZW_FPDI.php'); + $decoder = new FilterLZW_FPDI($this->fpdi); + $stream = $decoder->decode($stream); + break; + case '/ASCII85Decode': + include_once('filters/FilterASCII85_FPDI.php'); + $decoder = new FilterASCII85_FPDI($this->fpdi); + $stream = $decoder->decode($stream); + break; + case null: + $stream = $stream; + break; + default: + $this->error(sprintf('Unsupported Filter: %s',$_filter[1])); + } + } + + return $stream; + } + + + /** + * Get a Box from a page + * Arrayformat is same as used by fpdf_tpl + * + * @param array $page a /Page + * @param string $box_index Type of Box @see $availableBoxes + * @param float Scale factor from user space units to points + * @return array + */ + function getPageBox($page, $box_index, $k) { + $page = $this->pdf_resolve_object($this->c, $page); + $box = null; + if (isset($page[1][1][$box_index])) + $box =& $page[1][1][$box_index]; + + if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) { + $tmp_box = $this->pdf_resolve_object($this->c, $box); + $box = $tmp_box[1]; + } + + if (!is_null($box) && $box[0] == PDF_TYPE_ARRAY) { + $b =& $box[1]; + return array('x' => $b[0][1] / $k, + 'y' => $b[1][1] / $k, + 'w' => abs($b[0][1] - $b[2][1]) / $k, + 'h' => abs($b[1][1] - $b[3][1]) / $k, + 'llx' => min($b[0][1], $b[2][1]) / $k, + 'lly' => min($b[1][1], $b[3][1]) / $k, + 'urx' => max($b[0][1], $b[2][1]) / $k, + 'ury' => max($b[1][1], $b[3][1]) / $k, + ); + } else if (!isset ($page[1][1]['/Parent'])) { + return false; + } else { + return $this->getPageBox($this->pdf_resolve_object($this->c, $page[1][1]['/Parent']), $box_index, $k); + } + } + + /** + * Get all page boxes by page no + * + * @param int The page number + * @param float Scale factor from user space units to points + * @return array + */ + function getPageBoxes($pageno, $k) { + return $this->_getPageBoxes($this->pages[$pageno - 1], $k); + } + + /** + * Get all boxes from /Page + * + * @param array a /Page + * @return array + */ + function _getPageBoxes($page, $k) { + $boxes = array(); + + foreach($this->availableBoxes AS $box) { + if ($_box = $this->getPageBox($page, $box, $k)) { + $boxes[$box] = $_box; + } + } + + return $boxes; + } + + /** + * Get the page rotation by pageno + * + * @param integer $pageno + * @return array + */ + function getPageRotation($pageno) { + return $this->_getPageRotation($this->pages[$pageno - 1]); + } + + function _getPageRotation($obj) { // $obj = /Page + $obj = $this->pdf_resolve_object($this->c, $obj); + if (isset ($obj[1][1]['/Rotate'])) { + $res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Rotate']); + if ($res[0] == PDF_TYPE_OBJECT) + return $res[1]; + return $res; + } else { + if (!isset ($obj[1][1]['/Parent'])) { + return false; + } else { + $res = $this->_getPageRotation($obj[1][1]['/Parent']); + if ($res[0] == PDF_TYPE_OBJECT) + return $res[1]; + return $res; + } + } + } + + /** + * Read all /Page(es) + * + * @param object pdf_context + * @param array /Pages + * @param array the result-array + */ + function read_pages(&$c, &$pages, &$result) { + // Get the kids dictionary + $_kids = $this->pdf_resolve_object ($c, $pages[1][1]['/Kids']); + + if (!is_array($_kids)) + $this->error('Cannot find /Kids in current /Page-Dictionary'); + + if ($_kids[1][0] == PDF_TYPE_ARRAY) { + $kids = $_kids[1][1]; + } else { + $kids = $_kids[1]; + } + + foreach ($kids as $v) { + $pg = $this->pdf_resolve_object ($c, $v); + if ($pg[1][1]['/Type'][1] === '/Pages') { + // If one of the kids is an embedded + // /Pages array, resolve it as well. + $this->read_pages($c, $pg, $result); + } else { + $result[] = $pg; + } + } + } + + + + /** + * Get PDF-Version + * + * And reset the PDF Version used in FPDI if needed + */ + function getPDFVersion() { + parent::getPDFVersion(); + $this->fpdi->setPDFVersion(max($this->fpdi->getPDFVersion(), $this->pdfVersion)); + } } \ No newline at end of file diff --git a/htdocs/includes/fpdfi/pdf_context.php b/htdocs/includes/fpdfi/pdf_context.php index bd7f2be7f84..435df1e83da 100755 --- a/htdocs/includes/fpdfi/pdf_context.php +++ b/htdocs/includes/fpdfi/pdf_context.php @@ -1,104 +1,104 @@ -file =& $f; - if (is_string($this->file)) - $this->_mode = 1; - $this->reset(); - } - - // Optionally move the file - // pointer to a new location - // and reset the buffered data - - function reset($pos = null, $l = 100) { - if ($this->_mode == 0) { - if (!is_null ($pos)) { - fseek ($this->file, $pos); - } - - $this->buffer = $l > 0 ? fread($this->file, $l) : ''; - $this->length = strlen($this->buffer); - if ($this->length < $l) - $this->increase_length($l - $this->length); - } else { - $this->buffer = $this->file; - $this->length = strlen($this->buffer); - } - $this->offset = 0; - $this->stack = array(); - } - - // Make sure that there is at least one - // character beyond the current offset in - // the buffer to prevent the tokenizer - // from attempting to access data that does - // not exist - - function ensure_content() { - if ($this->offset >= $this->length - 1) { - return $this->increase_length(); - } else { - return true; - } - } - - // Forcefully read more data into the buffer - - function increase_length($l = 100) { - if ($this->_mode == 0 && feof($this->file)) { - return false; - } else if ($this->_mode == 0) { - $totalLength = $this->length + $l; - do { - $toRead = $totalLength - $this->length; - if ($toRead < 1) - break; - - $this->buffer .= fread($this->file, $toRead); - } while ((($this->length = strlen($this->buffer)) != $totalLength) && !feof($this->file)); - - return true; - } else { - return false; - } - } - } +file =& $f; + if (is_string($this->file)) + $this->_mode = 1; + $this->reset(); + } + + // Optionally move the file + // pointer to a new location + // and reset the buffered data + + function reset($pos = null, $l = 100) { + if ($this->_mode == 0) { + if (!is_null ($pos)) { + fseek ($this->file, $pos); + } + + $this->buffer = $l > 0 ? fread($this->file, $l) : ''; + $this->length = strlen($this->buffer); + if ($this->length < $l) + $this->increase_length($l - $this->length); + } else { + $this->buffer = $this->file; + $this->length = strlen($this->buffer); + } + $this->offset = 0; + $this->stack = array(); + } + + // Make sure that there is at least one + // character beyond the current offset in + // the buffer to prevent the tokenizer + // from attempting to access data that does + // not exist + + function ensure_content() { + if ($this->offset >= $this->length - 1) { + return $this->increase_length(); + } else { + return true; + } + } + + // Forcefully read more data into the buffer + + function increase_length($l = 100) { + if ($this->_mode == 0 && feof($this->file)) { + return false; + } else if ($this->_mode == 0) { + $totalLength = $this->length + $l; + do { + $toRead = $totalLength - $this->length; + if ($toRead < 1) + break; + + $this->buffer .= fread($this->file, $toRead); + } while ((($this->length = strlen($this->buffer)) != $totalLength) && !feof($this->file)); + + return true; + } else { + return false; + } + } + } } \ No newline at end of file diff --git a/htdocs/includes/fpdfi/pdf_parser.php b/htdocs/includes/fpdfi/pdf_parser.php index 3dbc557f493..4c6dd8e83e3 100755 --- a/htdocs/includes/fpdfi/pdf_parser.php +++ b/htdocs/includes/fpdfi/pdf_parser.php @@ -1,719 +1,719 @@ -filename = $filename; - - $this->f = @fopen($this->filename, 'rb'); - - if (!$this->f) - $this->error(sprintf('Cannot open %s !', $filename)); - - $this->getPDFVersion(); - - $this->c = new pdf_context($this->f); - - // Read xref-Data - $this->xref = array(); - $this->pdf_read_xref($this->xref, $this->pdf_find_xref()); - - // Check for Encryption - $this->getEncryption(); - - // Read root - $this->pdf_read_root(); - } - - /** - * Close the opened file - */ - function closeFile() { - if (isset($this->f) && is_resource($this->f)) { - fclose($this->f); - unset($this->f); - } - } - - /** - * Print Error and die - * - * @param string $msg Error-Message - */ - function error($msg) { - die('PDF-Parser Error: '.$msg); - } - - /** - * Check Trailer for Encryption - */ - function getEncryption() { - if (isset($this->xref['trailer'][1]['/Encrypt'])) { - $this->error('File is encrypted!'); - } - } - - /** - * Find/Return /Root - * - * @return array - */ - function pdf_find_root() { - if ($this->xref['trailer'][1]['/Root'][0] != PDF_TYPE_OBJREF) { - $this->error('Wrong Type of Root-Element! Must be an indirect reference'); - } - - return $this->xref['trailer'][1]['/Root']; - } - - /** - * Read the /Root - */ - function pdf_read_root() { - // read root - $this->root = $this->pdf_resolve_object($this->c, $this->pdf_find_root()); - } - - /** - * Get PDF-Version - * - * And reset the PDF Version used in FPDI if needed - */ - function getPDFVersion() { - fseek($this->f, 0); - preg_match('/\d\.\d/',fread($this->f,16),$m); - if (isset($m[0])) - $this->pdfVersion = $m[0]; - return $this->pdfVersion; - } - - /** - * Find the xref-Table - */ - function pdf_find_xref() { - $toRead = 1500; - - $stat = fseek ($this->f, -$toRead, SEEK_END); - if ($stat === -1) { - fseek ($this->f, 0); - } - $data = fread($this->f, $toRead); - - $pos = strlen($data) - strpos(strrev($data), strrev('startxref')); - $data = substr($data, $pos); - - if (!preg_match('/\s*(\d+).*$/s', $data, $matches)) { - $this->error('Unable to find pointer to xref table'); - } - - return (int) $matches[1]; - } - - /** - * Read xref-table - * - * @param array $result Array of xref-table - * @param integer $offset of xref-table - */ - function pdf_read_xref(&$result, $offset) { - $o_pos = $offset-min(20, $offset); - fseek($this->f, $o_pos); // set some bytes backwards to fetch errorious docs - - $data = fread($this->f, 100); - - $xrefPos = strrpos($data, 'xref'); - - if ($xrefPos === false) { - fseek($this->f, $offset); - $c = new pdf_context($this->f); - $xrefStreamObjDec = $this->pdf_read_value($c); - - if (is_array($xrefStreamObjDec) && isset($xrefStreamObjDec[0]) && $xrefStreamObjDec[0] == PDF_TYPE_OBJDEC) { - $this->error(sprintf('This document (%s) probably uses a compression technique which is not supported by the free parser shipped with FPDI.', $this->filename)); - } else { - $this->error('Unable to find xref table.'); - } - } - - if (!isset($result['xref_location'])) { - $result['xref_location'] = $o_pos+$xrefPos; - $result['max_object'] = 0; - } - - $cylces = -1; - $bytesPerCycle = 100; - - fseek($this->f, $o_pos = $o_pos+$xrefPos+4); // set the handle directly after the "xref"-keyword - $data = fread($this->f, $bytesPerCycle); - - while (($trailerPos = strpos($data, 'trailer', max($bytesPerCycle*$cylces++, 0))) === false && !feof($this->f)) { - $data .= fread($this->f, $bytesPerCycle); - } - - if ($trailerPos === false) { - $this->error('Trailer keyword not found after xref table'); - } - - $data = substr($data, 0, $trailerPos); - - // get Line-Ending - preg_match_all("/(\r\n|\n|\r)/", substr($data, 0, 100), $m); // check the first 100 bytes for linebreaks - - $differentLineEndings = count(array_unique($m[0])); - if ($differentLineEndings > 1) { - $lines = preg_split("/(\r\n|\n|\r)/", $data, -1, PREG_SPLIT_NO_EMPTY); - } else { - $lines = explode($m[0][1], $data); - } - - $data = $differentLineEndings = $m = null; - unset($data, $differentLineEndings, $m); - - $linesCount = count($lines); - - $start = 1; - - for ($i = 0; $i < $linesCount; $i++) { - $line = trim($lines[$i]); - if ($line) { - $pieces = explode(' ', $line); - $c = count($pieces); - switch($c) { - case 2: - $start = (int)$pieces[0]; - $end = $start+(int)$pieces[1]; - if ($end > $result['max_object']) - $result['max_object'] = $end; - break; - case 3: - if (!isset($result['xref'][$start])) - $result['xref'][$start] = array(); - - if (!array_key_exists($gen = (int) $pieces[1], $result['xref'][$start])) { - $result['xref'][$start][$gen] = $pieces[2] == 'n' ? (int) $pieces[0] : null; - } - $start++; - break; - default: - $this->error('Unexpected data in xref table'); - } - } - } - - $lines = $pieces = $line = $start = $end = $gen = null; - unset($lines, $pieces, $line, $start, $end, $gen); - - fseek($this->f, $o_pos+$trailerPos+7); - - $c = new pdf_context($this->f); - $trailer = $this->pdf_read_value($c); - - $c = null; - unset($c); - - if (!isset($result['trailer'])) { - $result['trailer'] = $trailer; - } - - if (isset($trailer[1]['/Prev'])) { - $this->pdf_read_xref($result, $trailer[1]['/Prev'][1]); - } - - $trailer = null; - unset($trailer); - - return true; - } - - /** - * Reads an Value - * - * @param object $c pdf_context - * @param string $token a Token - * @return mixed - */ - function pdf_read_value(&$c, $token = null) { - if (is_null($token)) { - $token = $this->pdf_read_token($c); - } - - if ($token === false) { - return false; - } - - switch ($token) { - case '<': - // This is a hex string. - // Read the value, then the terminator - - $pos = $c->offset; - - while(1) { - - $match = strpos ($c->buffer, '>', $pos); - - // If you can't find it, try - // reading more data from the stream - - if ($match === false) { - if (!$c->increase_length()) { - return false; - } else { - continue; - } - } - - $result = substr ($c->buffer, $c->offset, $match - $c->offset); - $c->offset = $match + 1; - - return array (PDF_TYPE_HEX, $result); - } - - break; - case '<<': - // This is a dictionary. - - $result = array(); - - // Recurse into this function until we reach - // the end of the dictionary. - while (($key = $this->pdf_read_token($c)) !== '>>') { - if ($key === false) { - return false; - } - - if (($value = $this->pdf_read_value($c)) === false) { - return false; - } - - // Catch missing value - if ($value[0] == PDF_TYPE_TOKEN && $value[1] == '>>') { - $result[$key] = array(PDF_TYPE_NULL); - break; - } - - $result[$key] = $value; - } - - return array (PDF_TYPE_DICTIONARY, $result); - - case '[': - // This is an array. - - $result = array(); - - // Recurse into this function until we reach - // the end of the array. - while (($token = $this->pdf_read_token($c)) !== ']') { - if ($token === false) { - return false; - } - - if (($value = $this->pdf_read_value($c, $token)) === false) { - return false; - } - - $result[] = $value; - } - - return array (PDF_TYPE_ARRAY, $result); - - case '(' : - // This is a string - $pos = $c->offset; - - $openBrackets = 1; - do { - for (; $openBrackets != 0 && $pos < $c->length; $pos++) { - switch (ord($c->buffer[$pos])) { - case 0x28: // '(' - $openBrackets++; - break; - case 0x29: // ')' - $openBrackets--; - break; - case 0x5C: // backslash - $pos++; - } - } - } while($openBrackets != 0 && $c->increase_length()); - - $result = substr($c->buffer, $c->offset, $pos - $c->offset - 1); - $c->offset = $pos; - - return array (PDF_TYPE_STRING, $result); - - case 'stream': - $o_pos = ftell($c->file)-strlen($c->buffer); - $o_offset = $c->offset; - - $c->reset($startpos = $o_pos + $o_offset); - - $e = 0; // ensure line breaks in front of the stream - if ($c->buffer[0] == chr(10) || $c->buffer[0] == chr(13)) - $e++; - if ($c->buffer[1] == chr(10) && $c->buffer[0] != chr(10)) - $e++; - - if ($this->actual_obj[1][1]['/Length'][0] == PDF_TYPE_OBJREF) { - $tmp_c = new pdf_context($this->f); - $tmp_length = $this->pdf_resolve_object($tmp_c, $this->actual_obj[1][1]['/Length']); - $length = $tmp_length[1][1]; - } else { - $length = $this->actual_obj[1][1]['/Length'][1]; - } - - if ($length > 0) { - $c->reset($startpos+$e,$length); - $v = $c->buffer; - } else { - $v = ''; - } - $c->reset($startpos+$e+$length+9); // 9 = strlen("endstream") - - return array(PDF_TYPE_STREAM, $v); - - default : - if (is_numeric ($token)) { - // A numeric token. Make sure that - // it is not part of something else. - if (($tok2 = $this->pdf_read_token ($c)) !== false) { - if (is_numeric ($tok2)) { - - // Two numeric tokens in a row. - // In this case, we're probably in - // front of either an object reference - // or an object specification. - // Determine the case and return the data - if (($tok3 = $this->pdf_read_token ($c)) !== false) { - switch ($tok3) { - case 'obj' : - return array (PDF_TYPE_OBJDEC, (int) $token, (int) $tok2); - case 'R' : - return array (PDF_TYPE_OBJREF, (int) $token, (int) $tok2); - } - // If we get to this point, that numeric value up - // there was just a numeric value. Push the extra - // tokens back into the stack and return the value. - array_push ($c->stack, $tok3); - } - } - - array_push ($c->stack, $tok2); - } - - if ($token === (string)((int)$token)) - return array (PDF_TYPE_NUMERIC, (int)$token); - else - return array (PDF_TYPE_REAL, (float)$token); - } else if ($token == 'true' || $token == 'false') { - return array (PDF_TYPE_BOOLEAN, $token == 'true'); - } else if ($token == 'null') { - return array (PDF_TYPE_NULL); - } else { - // Just a token. Return it. - return array (PDF_TYPE_TOKEN, $token); - } - } - } - - /** - * Resolve an object - * - * @param object $c pdf_context - * @param array $obj_spec The object-data - * @param boolean $encapsulate Must set to true, cause the parsing and fpdi use this method only without this para - */ - function pdf_resolve_object(&$c, $obj_spec, $encapsulate = true) { - // Exit if we get invalid data - if (!is_array($obj_spec)) { - $ret = false; - return $ret; - } - - if ($obj_spec[0] == PDF_TYPE_OBJREF) { - - // This is a reference, resolve it - if (isset($this->xref['xref'][$obj_spec[1]][$obj_spec[2]])) { - - // Save current file position - // This is needed if you want to resolve - // references while you're reading another object - // (e.g.: if you need to determine the length - // of a stream) - - $old_pos = ftell($c->file); - - // Reposition the file pointer and - // load the object header. - - $c->reset($this->xref['xref'][$obj_spec[1]][$obj_spec[2]]); - - $header = $this->pdf_read_value($c); - - if ($header[0] != PDF_TYPE_OBJDEC || $header[1] != $obj_spec[1] || $header[2] != $obj_spec[2]) { - $toSearchFor = $obj_spec[1].' '.$obj_spec[2].' obj'; - if (preg_match('/'.$toSearchFor.'/', $c->buffer)) { - $c->offset = strpos($c->buffer, $toSearchFor) + strlen($toSearchFor); - // reset stack - $c->stack = array(); - } else { - $this->error("Unable to find object ({$obj_spec[1]}, {$obj_spec[2]}) at expected location"); - } - } - - // If we're being asked to store all the information - // about the object, we add the object ID and generation - // number for later use - $result = array(); - $this->actual_obj =& $result; - if ($encapsulate) { - $result = array ( - PDF_TYPE_OBJECT, - 'obj' => $obj_spec[1], - 'gen' => $obj_spec[2] - ); - } - - // Now simply read the object data until - // we encounter an end-of-object marker - while(1) { - $value = $this->pdf_read_value($c); - if ($value === false || count($result) > 4) { - // in this case the parser coudn't find an endobj so we break here - break; - } - - if ($value[0] == PDF_TYPE_TOKEN && $value[1] === 'endobj') { - break; - } - - $result[] = $value; - } - - $c->reset($old_pos); - - if (isset($result[2][0]) && $result[2][0] == PDF_TYPE_STREAM) { - $result[0] = PDF_TYPE_STREAM; - } - - return $result; - } - } else { - return $obj_spec; - } - } - - - - /** - * Reads a token from the file - * - * @param object $c pdf_context - * @return mixed - */ - function pdf_read_token(&$c) - { - // If there is a token available - // on the stack, pop it out and - // return it. - - if (count($c->stack)) { - return array_pop($c->stack); - } - - // Strip away any whitespace - - do { - if (!$c->ensure_content()) { - return false; - } - $c->offset += strspn($c->buffer, " \n\r\t", $c->offset); - } while ($c->offset >= $c->length - 1); - - // Get the first character in the stream - - $char = $c->buffer[$c->offset++]; - - switch ($char) { - - case '[': - case ']': - case '(': - case ')': - - // This is either an array or literal string - // delimiter, Return it - - return $char; - - case '<': - case '>': - - // This could either be a hex string or - // dictionary delimiter. Determine the - // appropriate case and return the token - - if ($c->buffer[$c->offset] == $char) { - if (!$c->ensure_content()) { - return false; - } - $c->offset++; - return $char . $char; - } else { - return $char; - } - - case '%': - - // This is a comment - jump over it! - - $pos = $c->offset; - while(1) { - $match = preg_match("/(\r\n|\r|\n)/", $c->buffer, $m, PREG_OFFSET_CAPTURE, $pos); - if ($match === 0) { - if (!$c->increase_length()) { - return false; - } else { - continue; - } - } - - $c->offset = $m[0][1]+strlen($m[0][0]); - - return $this->pdf_read_token($c); - } - - default: - - // This is "another" type of token (probably - // a dictionary entry or a numeric value) - // Find the end and return it. - - if (!$c->ensure_content()) { - return false; - } - - while(1) { - - // Determine the length of the token - - $pos = strcspn($c->buffer, " %[]<>()\r\n\t/", $c->offset); - - if ($c->offset + $pos <= $c->length - 1) { - break; - } else { - // If the script reaches this point, - // the token may span beyond the end - // of the current buffer. Therefore, - // we increase the size of the buffer - // and try again--just to be safe. - - $c->increase_length(); - } - } - - $result = substr($c->buffer, $c->offset - 1, $pos + 1); - - $c->offset += $pos; - return $result; - } - } - } -} +filename = $filename; + + $this->f = @fopen($this->filename, 'rb'); + + if (!$this->f) + $this->error(sprintf('Cannot open %s !', $filename)); + + $this->getPDFVersion(); + + $this->c = new pdf_context($this->f); + + // Read xref-Data + $this->xref = array(); + $this->pdf_read_xref($this->xref, $this->pdf_find_xref()); + + // Check for Encryption + $this->getEncryption(); + + // Read root + $this->pdf_read_root(); + } + + /** + * Close the opened file + */ + function closeFile() { + if (isset($this->f) && is_resource($this->f)) { + fclose($this->f); + unset($this->f); + } + } + + /** + * Print Error and die + * + * @param string $msg Error-Message + */ + function error($msg) { + die('PDF-Parser Error: ' . $msg); + } + + /** + * Check Trailer for Encryption + */ + function getEncryption() { + if (isset($this->xref['trailer'][1]['/Encrypt'])) { + $this->error('File is encrypted!'); + } + } + + /** + * Find/Return /Root + * + * @return array + */ + function pdf_find_root() { + if ($this->xref['trailer'][1]['/Root'][0] != PDF_TYPE_OBJREF) { + $this->error('Wrong Type of Root-Element! Must be an indirect reference'); + } + + return $this->xref['trailer'][1]['/Root']; + } + + /** + * Read the /Root + */ + function pdf_read_root() { + // read root + $this->root = $this->pdf_resolve_object($this->c, $this->pdf_find_root()); + } + + /** + * Get PDF-Version + * + * And reset the PDF Version used in FPDI if needed + */ + function getPDFVersion() { + fseek($this->f, 0); + preg_match('/\d\.\d/',fread($this->f, 16), $m); + if (isset($m[0])) + $this->pdfVersion = $m[0]; + return $this->pdfVersion; + } + + /** + * Find the xref-Table + */ + function pdf_find_xref() { + $toRead = 1500; + + $stat = fseek ($this->f, -$toRead, SEEK_END); + if ($stat === -1) { + fseek ($this->f, 0); + } + $data = fread($this->f, $toRead); + + $pos = strlen($data) - strpos(strrev($data), strrev('startxref')); + $data = substr($data, $pos); + + if (!preg_match('/\s*(\d+).*$/s', $data, $matches)) { + $this->error('Unable to find pointer to xref table'); + } + + return (int) $matches[1]; + } + + /** + * Read xref-table + * + * @param array $result Array of xref-table + * @param integer $offset of xref-table + */ + function pdf_read_xref(&$result, $offset) { + $o_pos = $offset-min(20, $offset); + fseek($this->f, $o_pos); // set some bytes backwards to fetch errorious docs + + $data = fread($this->f, 100); + + $xrefPos = strrpos($data, 'xref'); + + if ($xrefPos === false) { + fseek($this->f, $offset); + $c = new pdf_context($this->f); + $xrefStreamObjDec = $this->pdf_read_value($c); + + if (is_array($xrefStreamObjDec) && isset($xrefStreamObjDec[0]) && $xrefStreamObjDec[0] == PDF_TYPE_OBJDEC) { + $this->error(sprintf('This document (%s) probably uses a compression technique which is not supported by the free parser shipped with FPDI.', $this->filename)); + } else { + $this->error('Unable to find xref table.'); + } + } + + if (!isset($result['xref_location'])) { + $result['xref_location'] = $o_pos + $xrefPos; + $result['max_object'] = 0; + } + + $cylces = -1; + $bytesPerCycle = 100; + + fseek($this->f, $o_pos = $o_pos + $xrefPos + 4); // set the handle directly after the "xref"-keyword + $data = fread($this->f, $bytesPerCycle); + + while (($trailerPos = strpos($data, 'trailer', max($bytesPerCycle * $cylces++, 0))) === false && !feof($this->f)) { + $data .= fread($this->f, $bytesPerCycle); + } + + if ($trailerPos === false) { + $this->error('Trailer keyword not found after xref table'); + } + + $data = substr($data, 0, $trailerPos); + + // get Line-Ending + preg_match_all("/(\r\n|\n|\r)/", substr($data, 0, 100), $m); // check the first 100 bytes for linebreaks + + $differentLineEndings = count(array_unique($m[0])); + if ($differentLineEndings > 1) { + $lines = preg_split("/(\r\n|\n|\r)/", $data, -1, PREG_SPLIT_NO_EMPTY); + } else { + $lines = explode($m[0][1], $data); + } + + $data = $differentLineEndings = $m = null; + unset($data, $differentLineEndings, $m); + + $linesCount = count($lines); + + $start = 1; + + for ($i = 0; $i < $linesCount; $i++) { + $line = trim($lines[$i]); + if ($line) { + $pieces = explode(' ', $line); + $c = count($pieces); + switch($c) { + case 2: + $start = (int)$pieces[0]; + $end = $start + (int)$pieces[1]; + if ($end > $result['max_object']) + $result['max_object'] = $end; + break; + case 3: + if (!isset($result['xref'][$start])) + $result['xref'][$start] = array(); + + if (!array_key_exists($gen = (int) $pieces[1], $result['xref'][$start])) { + $result['xref'][$start][$gen] = $pieces[2] == 'n' ? (int) $pieces[0] : null; + } + $start++; + break; + default: + $this->error('Unexpected data in xref table'); + } + } + } + + $lines = $pieces = $line = $start = $end = $gen = null; + unset($lines, $pieces, $line, $start, $end, $gen); + + fseek($this->f, $o_pos + $trailerPos + 7); + + $c = new pdf_context($this->f); + $trailer = $this->pdf_read_value($c); + + $c = null; + unset($c); + + if (!isset($result['trailer'])) { + $result['trailer'] = $trailer; + } + + if (isset($trailer[1]['/Prev'])) { + $this->pdf_read_xref($result, $trailer[1]['/Prev'][1]); + } + + $trailer = null; + unset($trailer); + + return true; + } + + /** + * Reads an Value + * + * @param object $c pdf_context + * @param string $token a Token + * @return mixed + */ + function pdf_read_value(&$c, $token = null) { + if (is_null($token)) { + $token = $this->pdf_read_token($c); + } + + if ($token === false) { + return false; + } + + switch ($token) { + case '<': + // This is a hex string. + // Read the value, then the terminator + + $pos = $c->offset; + + while(1) { + + $match = strpos ($c->buffer, '>', $pos); + + // If you can't find it, try + // reading more data from the stream + + if ($match === false) { + if (!$c->increase_length()) { + return false; + } else { + continue; + } + } + + $result = substr ($c->buffer, $c->offset, $match - $c->offset); + $c->offset = $match + 1; + + return array (PDF_TYPE_HEX, $result); + } + + break; + case '<<': + // This is a dictionary. + + $result = array(); + + // Recurse into this function until we reach + // the end of the dictionary. + while (($key = $this->pdf_read_token($c)) !== '>>') { + if ($key === false) { + return false; + } + + if (($value = $this->pdf_read_value($c)) === false) { + return false; + } + + // Catch missing value + if ($value[0] == PDF_TYPE_TOKEN && $value[1] == '>>') { + $result[$key] = array(PDF_TYPE_NULL); + break; + } + + $result[$key] = $value; + } + + return array (PDF_TYPE_DICTIONARY, $result); + + case '[': + // This is an array. + + $result = array(); + + // Recurse into this function until we reach + // the end of the array. + while (($token = $this->pdf_read_token($c)) !== ']') { + if ($token === false) { + return false; + } + + if (($value = $this->pdf_read_value($c, $token)) === false) { + return false; + } + + $result[] = $value; + } + + return array (PDF_TYPE_ARRAY, $result); + + case '(' : + // This is a string + $pos = $c->offset; + + $openBrackets = 1; + do { + for (; $openBrackets != 0 && $pos < $c->length; $pos++) { + switch (ord($c->buffer[$pos])) { + case 0x28: // '(' + $openBrackets++; + break; + case 0x29: // ')' + $openBrackets--; + break; + case 0x5C: // backslash + $pos++; + } + } + } while($openBrackets != 0 && $c->increase_length()); + + $result = substr($c->buffer, $c->offset, $pos - $c->offset - 1); + $c->offset = $pos; + + return array (PDF_TYPE_STRING, $result); + + case 'stream': + $o_pos = ftell($c->file)-strlen($c->buffer); + $o_offset = $c->offset; + + $c->reset($startpos = $o_pos + $o_offset); + + $e = 0; // ensure line breaks in front of the stream + if ($c->buffer[0] == chr(10) || $c->buffer[0] == chr(13)) + $e++; + if ($c->buffer[1] == chr(10) && $c->buffer[0] != chr(10)) + $e++; + + if ($this->actual_obj[1][1]['/Length'][0] == PDF_TYPE_OBJREF) { + $tmp_c = new pdf_context($this->f); + $tmp_length = $this->pdf_resolve_object($tmp_c, $this->actual_obj[1][1]['/Length']); + $length = $tmp_length[1][1]; + } else { + $length = $this->actual_obj[1][1]['/Length'][1]; + } + + if ($length > 0) { + $c->reset($startpos + $e,$length); + $v = $c->buffer; + } else { + $v = ''; + } + $c->reset($startpos + $e + $length + 9); // 9 = strlen("endstream") + + return array(PDF_TYPE_STREAM, $v); + + default : + if (is_numeric ($token)) { + // A numeric token. Make sure that + // it is not part of something else. + if (($tok2 = $this->pdf_read_token ($c)) !== false) { + if (is_numeric ($tok2)) { + + // Two numeric tokens in a row. + // In this case, we're probably in + // front of either an object reference + // or an object specification. + // Determine the case and return the data + if (($tok3 = $this->pdf_read_token ($c)) !== false) { + switch ($tok3) { + case 'obj': + return array (PDF_TYPE_OBJDEC, (int) $token, (int) $tok2); + case 'R': + return array (PDF_TYPE_OBJREF, (int) $token, (int) $tok2); + } + // If we get to this point, that numeric value up + // there was just a numeric value. Push the extra + // tokens back into the stack and return the value. + array_push ($c->stack, $tok3); + } + } + + array_push ($c->stack, $tok2); + } + + if ($token === (string)((int)$token)) + return array (PDF_TYPE_NUMERIC, (int)$token); + else + return array (PDF_TYPE_REAL, (float)$token); + } else if ($token == 'true' || $token == 'false') { + return array (PDF_TYPE_BOOLEAN, $token == 'true'); + } else if ($token == 'null') { + return array (PDF_TYPE_NULL); + } else { + // Just a token. Return it. + return array (PDF_TYPE_TOKEN, $token); + } + } + } + + /** + * Resolve an object + * + * @param object $c pdf_context + * @param array $obj_spec The object-data + * @param boolean $encapsulate Must set to true, cause the parsing and fpdi use this method only without this para + */ + function pdf_resolve_object(&$c, $obj_spec, $encapsulate = true) { + // Exit if we get invalid data + if (!is_array($obj_spec)) { + $ret = false; + return $ret; + } + + if ($obj_spec[0] == PDF_TYPE_OBJREF) { + + // This is a reference, resolve it + if (isset($this->xref['xref'][$obj_spec[1]][$obj_spec[2]])) { + + // Save current file position + // This is needed if you want to resolve + // references while you're reading another object + // (e.g.: if you need to determine the length + // of a stream) + + $old_pos = ftell($c->file); + + // Reposition the file pointer and + // load the object header. + + $c->reset($this->xref['xref'][$obj_spec[1]][$obj_spec[2]]); + + $header = $this->pdf_read_value($c); + + if ($header[0] != PDF_TYPE_OBJDEC || $header[1] != $obj_spec[1] || $header[2] != $obj_spec[2]) { + $toSearchFor = $obj_spec[1] . ' ' . $obj_spec[2] . ' obj'; + if (preg_match('/' . $toSearchFor . '/', $c->buffer)) { + $c->offset = strpos($c->buffer, $toSearchFor) + strlen($toSearchFor); + // reset stack + $c->stack = array(); + } else { + $this->error("Unable to find object ({$obj_spec[1]}, {$obj_spec[2]}) at expected location"); + } + } + + // If we're being asked to store all the information + // about the object, we add the object ID and generation + // number for later use + $result = array(); + $this->actual_obj =& $result; + if ($encapsulate) { + $result = array ( + PDF_TYPE_OBJECT, + 'obj' => $obj_spec[1], + 'gen' => $obj_spec[2] + ); + } + + // Now simply read the object data until + // we encounter an end-of-object marker + while(1) { + $value = $this->pdf_read_value($c); + if ($value === false || count($result) > 4) { + // in this case the parser coudn't find an endobj so we break here + break; + } + + if ($value[0] == PDF_TYPE_TOKEN && $value[1] === 'endobj') { + break; + } + + $result[] = $value; + } + + $c->reset($old_pos); + + if (isset($result[2][0]) && $result[2][0] == PDF_TYPE_STREAM) { + $result[0] = PDF_TYPE_STREAM; + } + + return $result; + } + } else { + return $obj_spec; + } + } + + + + /** + * Reads a token from the file + * + * @param object $c pdf_context + * @return mixed + */ + function pdf_read_token(&$c) + { + // If there is a token available + // on the stack, pop it out and + // return it. + + if (count($c->stack)) { + return array_pop($c->stack); + } + + // Strip away any whitespace + + do { + if (!$c->ensure_content()) { + return false; + } + $c->offset += strspn($c->buffer, " \n\r\t", $c->offset); + } while ($c->offset >= $c->length - 1); + + // Get the first character in the stream + + $char = $c->buffer[$c->offset++]; + + switch ($char) { + + case '[': + case ']': + case '(': + case ')': + + // This is either an array or literal string + // delimiter, Return it + + return $char; + + case '<': + case '>': + + // This could either be a hex string or + // dictionary delimiter. Determine the + // appropriate case and return the token + + if ($c->buffer[$c->offset] == $char) { + if (!$c->ensure_content()) { + return false; + } + $c->offset++; + return $char . $char; + } else { + return $char; + } + + case '%': + + // This is a comment - jump over it! + + $pos = $c->offset; + while(1) { + $match = preg_match("/(\r\n|\r|\n)/", $c->buffer, $m, PREG_OFFSET_CAPTURE, $pos); + if ($match === 0) { + if (!$c->increase_length()) { + return false; + } else { + continue; + } + } + + $c->offset = $m[0][1]+strlen($m[0][0]); + + return $this->pdf_read_token($c); + } + + default: + + // This is "another" type of token (probably + // a dictionary entry or a numeric value) + // Find the end and return it. + + if (!$c->ensure_content()) { + return false; + } + + while(1) { + + // Determine the length of the token + + $pos = strcspn($c->buffer, " %[]<>()\r\n\t/", $c->offset); + + if ($c->offset + $pos <= $c->length - 1) { + break; + } else { + // If the script reaches this point, + // the token may span beyond the end + // of the current buffer. Therefore, + // we increase the size of the buffer + // and try again--just to be safe. + + $c->increase_length(); + } + } + + $result = substr($c->buffer, $c->offset - 1, $pos + 1); + + $c->offset += $pos; + return $result; + } + } + } +} diff --git a/htdocs/includes/tcpdf/2dbarcodes.php b/htdocs/includes/tcpdf/2dbarcodes.php index e04b3073ce1..6490dfa7eaf 100644 --- a/htdocs/includes/tcpdf/2dbarcodes.php +++ b/htdocs/includes/tcpdf/2dbarcodes.php @@ -1,9 +1,9 @@ barcode_array['bcode'][$r][$c] == 1) { // draw a single barcode cell if ($imagick) { - $bar->rectangle($x, $y, ($x + $w), ($y + $h)); + $bar->rectangle($x, $y, ($x + $w - 1), ($y + $h - 1)); } else { - imagefilledrectangle($png, $x, $y, ($x + $w), ($y + $h), $fgcol); + imagefilledrectangle($png, $x, $y, ($x + $w - 1), ($y + $h - 1), $fgcol); } } $x += $w; diff --git a/htdocs/includes/tcpdf/CHANGELOG.TXT b/htdocs/includes/tcpdf/CHANGELOG.TXT index 23a14f9991d..d3c29f94068 100644 --- a/htdocs/includes/tcpdf/CHANGELOG.TXT +++ b/htdocs/includes/tcpdf/CHANGELOG.TXT @@ -1,3 +1,94 @@ +5.9.180 (2012-08-22) + - Bug item #3560493 "Problems with nested cells in HTML" was fixed. + +5.9.179 (2012-08-04) + - SVG 'use' tag was fixed for 'circle' and 'ellipse' shift problem. + - Alpha status is now correctly stored and restored by getGraphicVars() and SetGraphicVars() methods. + +5.9.178 (2012-08-02) + - SVG 'use' tag was fixed for 'circle' and 'ellipse'. + +5.9.177 (2012-08-02) + - An additional control on annotations was fixed. + +5.9.176 (2012-07-25) + - A bug related to stroke width was fixed. + - A problem related to font spacing in HTML was fixed. + +5.9.175 (2012-07-25) + - The problem of missing letter on hyphen break was fixed. + +5.9.174 (2012-07-25) + - The problem of wrong filename when downloading PDF from an Android device was fixed. + - The method setHeaderData() was extended to set text and line color for header (see example n. 1). + - The method setFooterData() was added to set text and line color for footer (see example n. 1). + - The methods setTextShadow() and getTextShadow() were added to set text shadows (see example n. 1). + - The GetCharWidth() method was fixed for negative character spacing. + - A 'none' border mode is now correctly recognized. + - Break on hyphen problem was fixed. + +5.9.173 (2012-07-23) + - Some additional control wher added on barcode methods. + - The option CURLOPT_FOLLOWLOCATION on Image method is now disabled if PHP safe_mode is on or open_basedir is set. + - Method Bookmark() was extended to include X parameter. + - Method setDestination() was extended to include X parameter. + - A problem with Thai language was fixed. + +5.9.172 (2012-07-02) + - A PNG color profile issue was fixed. + +5.9.171 (2012-07-01) + - Some SVG rendering problems were fixed. + +5.9.170 (2012-06-27) + - Bug #3538227 "Numerous errors inserting shared images" was fixed. + +5.9.169 (2012-06-25) + - Some SVG rendering problems were fixed. + +5.9.168 (2012-06-22) + - Thai language rendering was fixed. + +5.9.167 (2012-06-22) + - Thai language rendering was fixed and improved. + - Method isCharDefined() was improved. + - Protected method replaceChar() was added. + - Font "kerning" word was corrected to "tracking". + +5.9.166 (2012-06-21) + - Array to string conversion on file_id creation was fixed. + - Thai language rendering was fixed (thanks to Atsawin Chaowanakritsanakul). + +5.9.165 (2012-06-07) + - Some HTML form related bugs were fixed. + +5.9.164 (2012-06-06) + - A bug introduced on the latest release was fixed. + +5.9.163 (2012-06-05) + - Method getGDgamma() was changed. + - Rendering performances of PNG images with alpha channel were improved. + +5.9.162 (2012-05-11) + - A bug related to long text on TD cells was fixed. + +5.9.161 (2012-05-09) + - A bug on XREF table was fixed (Bug ID: 3525051). + - Deprecated Imagick:clone was replaced. + - Method objclone() was fixed for PHP4. + +5.9.160 (2012-05-03) + - A bug on tcpdf_parser.php was fixed. + +5.9.159 (2012-04-30) + - Barcode classes were updated to fix PNG export Bug (ID: 3522291). + +5.9.158 (2012-04-22) + - Some SVG-related bugs were fixed. + +5.9.157 (2012-04-16) + - Some SVG-related bugs were fixed. + 5.9.156 (2012-04-10) - Bug item #3515885 "TOC and booklet: left and right page exchanged". - SetAutoPageBreak(false) now works also in multicolumn mode. @@ -567,7 +658,7 @@ - The problem of blank page for nobr table higher than a single page was fixed. 5.9.000 (2010-10-06) - - Support for text stretching and spacing (kerning) was added, see example n. 63 and methods setFontStretching(), getFontStretching(), setFontSpacing(), getFontSpacing(). + - Support for text stretching and spacing (tracking) was added, see example n. 63 and methods setFontStretching(), getFontStretching(), setFontSpacing(), getFontSpacing(). - Support for CSS properties 'font-stretch' and 'letter-spacing' was added (see example n. 63). - The cMargin state was replaced by cell_padding array that can be set/get using setCellPadding() and getCellPadding() methods. - Methods getCellPaddings() and setCellPaddings() were added to fine tune cell paddings (see example n. 5). diff --git a/htdocs/includes/tcpdf/README.TXT b/htdocs/includes/tcpdf/README.TXT index 83520bb1272..ff86c9d23b0 100644 --- a/htdocs/includes/tcpdf/README.TXT +++ b/htdocs/includes/tcpdf/README.TXT @@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076 ------------------------------------------------------------ Name: TCPDF -Version: 5.9.156 -Release date: 2012-04-10 +Version: 5.9.180 +Release date: 2012-08-22 Author: Nicola Asuni Copyright (c) 2002-2012: @@ -47,7 +47,7 @@ Main Features: * no-write page regions; * bookmarks, named destinations and table of content; * text hyphenation; - * text stretching and spacing (tracking/kerning); + * text stretching and spacing (tracking); * automatic page break, line break and text alignments including justification; * automatic page numbering and page groups; * move and delete pages; diff --git a/htdocs/includes/tcpdf/barcodes.php b/htdocs/includes/tcpdf/barcodes.php index 4027aa7109a..c6c0172e4a3 100644 --- a/htdocs/includes/tcpdf/barcodes.php +++ b/htdocs/includes/tcpdf/barcodes.php @@ -1,9 +1,9 @@ * @package com.tecnick.tcpdf - * @version 1.0.023 + * @version 1.0.024 * @author Nicola Asuni */ class TCPDFBarcode { @@ -201,9 +201,9 @@ class TCPDFBarcode { $y = round(($v['p'] * $h / $this->barcode_array['maxh']), 3); // draw a vertical bar if ($imagick) { - $bar->rectangle($x, $y, ($x + $bw), ($y + $bh)); + $bar->rectangle($x, $y, ($x + $bw - 1), ($y + $bh - 1)); } else { - imagefilledrectangle($png, $x, $y, ($x + $bw), ($y + $bh), $fgcol); + imagefilledrectangle($png, $x, $y, ($x + $bw - 1), ($y + $bh - 1), $fgcol); } } $x += $bw; diff --git a/htdocs/includes/tcpdf/config/lang/bul.php b/htdocs/includes/tcpdf/config/lang/bul.php index 00a44ef03e4..d7bbaaf6a30 100644 --- a/htdocs/includes/tcpdf/config/lang/bul.php +++ b/htdocs/includes/tcpdf/config/lang/bul.php @@ -1,47 +1,47 @@ -dataStr) > 0) { - if ($this->dataStr == '') { - return 0; - } $mode = $this->identifyMode(0); switch ($mode) { case QR_MODE_NM: { @@ -1476,6 +1474,7 @@ class QRcode { } $this->dataStr = substr($this->dataStr, $length); } + return 0; } /** @@ -2028,7 +2027,7 @@ class QRcode { if ($ver > $this->version) { $this->version = $ver; } - for (;;) { + while (true) { $cbs = $this->createBitStream($items); $items = $cbs[0]; $bits = $cbs[1]; @@ -2315,17 +2314,18 @@ class QRcode { /** * Return a version number that satisfies the input code length. - * @param $size (int) input code length (byte) + * @param $size (int) input code length (bytes) * @param $level (int) error correction level * @return int version number */ protected function getMinimumVersion($size, $level) { - for ($i=1; $i <= QRSPEC_VERSION_MAX; ++$i) { - $words = $this->capacity[$i][QRCAP_WORDS] - $this->capacity[$i][QRCAP_EC][$level]; + for ($i = 1; $i <= QRSPEC_VERSION_MAX; ++$i) { + $words = ($this->capacity[$i][QRCAP_WORDS] - $this->capacity[$i][QRCAP_EC][$level]); if ($words >= $size) { return $i; } } + // the size of input data is greater than QR capacity, try to lover the error correction mode return -1; } diff --git a/htdocs/includes/tcpdf/tcpdf.php b/htdocs/includes/tcpdf/tcpdf.php index 7c18096a52a..21da1606ed1 100644 --- a/htdocs/includes/tcpdf/tcpdf.php +++ b/htdocs/includes/tcpdf/tcpdf.php @@ -1,9 +1,9 @@ no-write page regions; *
  • bookmarks, named destinations and table of content;
  • *
  • text hyphenation;
  • - *
  • text stretching and spacing (tracking/kerning);
  • + *
  • text stretching and spacing (tracking);
  • *
  • automatic page break, line break and text alignments including justification;
  • *
  • automatic page numbering and page groups;
  • *
  • move and delete pages;
  • @@ -137,7 +138,7 @@ * Tools to encode your unicode fonts are on fonts/utils directory.

    * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 5.9.156 + * @version 5.9.180 */ // Main configuration file. Define the K_TCPDF_EXTERNAL_CONFIG constant to skip this file. @@ -149,7 +150,7 @@ require_once(dirname(__FILE__).'/config/tcpdf_config.php'); * TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.
    * @package com.tecnick.tcpdf * @brief PHP class for generating PDF documents without requiring external extensions. - * @version 5.9.156 + * @version 5.9.180 * @author Nicola Asuni - info@tecnick.com */ class TCPDF { @@ -160,7 +161,7 @@ class TCPDF { * Current TCPDF version. * @private */ - private $tcpdf_version = '5.9.156'; + private $tcpdf_version = '5.9.180'; // Protected properties @@ -180,7 +181,13 @@ class TCPDF { * Array of object offsets. * @protected */ - protected $offsets; + protected $offsets = array(); + + /** + * Array of object IDs for each page. + * @protected + */ + protected $pageobjects = array(); /** * Buffer holding in-memory PDF. @@ -705,6 +712,41 @@ class TCPDF { */ protected $header_string = ''; + /** + * Color for header text (RGB array). + * @since 5.9.174 (2012-07-25) + * @protected + */ + protected $header_text_color = array(0,0,0); + + /** + * Color for header line (RGB array). + * @since 5.9.174 (2012-07-25) + * @protected + */ + protected $header_line_color = array(0,0,0); + + /** + * Color for footer text (RGB array). + * @since 5.9.174 (2012-07-25) + * @protected + */ + protected $footer_text_color = array(0,0,0); + + /** + * Color for footer line (RGB array). + * @since 5.9.174 (2012-07-25) + * @protected + */ + protected $footer_line_color = array(0,0,0); + + /** + * Text shadow data array. + * @since 5.9.174 (2012-07-25) + * @protected + */ + protected $txtshadow = array('enabled'=>false, 'depth_w'=>0, 'depth_h'=>0, 'color'=>false, 'opacity'=>1, 'blend_mode'=>'Normal'); + /** * Default number of columns for html table. * @protected @@ -1590,7 +1632,7 @@ class TCPDF { protected $font_stretching = 100; /** - * Increases or decreases the space between characters in a text by the specified amount (tracking/kerning). + * Increases or decreases the space between characters in a text by the specified amount (tracking). * @protected * @since 5.9.000 (2010-09-29) */ @@ -1873,6 +1915,13 @@ class TCPDF { */ protected $tcpdflink = true; + /** + * Cache array for computed GD gamma values. + * @protected + * @since 5.9.1632 (2012-06-05) + */ + protected $gdgammacache = array(); + //------------------------------------------------------------ // METHODS //------------------------------------------------------------ @@ -2006,6 +2055,7 @@ class TCPDF { $this->strokecolor = array('R' => 0, 'G' => 0, 'B' => 0); $this->bgcolor = array('R' => 255, 'G' => 255, 'B' => 255); $this->extgstates = array(); + $this->setTextShadow(); // user's rights $this->sign = false; $this->ur['enabled'] = false; @@ -2037,7 +2087,8 @@ class TCPDF { } $this->default_form_prop = array('lineWidth'=>1, 'borderStyle'=>'solid', 'fillColor'=>array(255, 255, 255), 'strokeColor'=>array(128, 128, 128)); // set file ID for trailer - $this->file_id = md5($this->getRandomSeed('TCPDF'.$orientation.$unit.$format.$encoding)); + $serformat = (is_array($format) ? serialize($format) : $format); + $this->file_id = md5($this->getRandomSeed('TCPDF'.$orientation.$unit.$serformat.$encoding)); // set document creation and modification timestamp $this->doc_creation_timestamp = time(); $this->doc_modification_timestamp = $this->doc_creation_timestamp; @@ -3059,8 +3110,8 @@ class TCPDF { // swap X and Y coordinates (change page orientation) $this->swapPageBoxCoordinates($this->page); } - $this->w = $this->wPt / $this->k; - $this->h = $this->hPt / $this->k; + $this->w = ($this->wPt / $this->k); + $this->h = ($this->hPt / $this->k); if ($this->empty_string($autopagebreak)) { if (isset($this->AutoPageBreak)) { $autopagebreak = $this->AutoPageBreak; @@ -4083,13 +4134,28 @@ class TCPDF { * @param $lw (string) header image logo width in mm * @param $ht (string) string to print as title on document header * @param $hs (string) string to print on document header + * @param $tc (array) RGB array color for text. + * @param $lc (array) RGB array color for line. * @public */ - public function setHeaderData($ln='', $lw=0, $ht='', $hs='') { + public function setHeaderData($ln='', $lw=0, $ht='', $hs='', $tc=array(0,0,0), $lc=array(0,0,0)) { $this->header_logo = $ln; $this->header_logo_width = $lw; $this->header_title = $ht; $this->header_string = $hs; + $this->header_text_color = $tc; + $this->header_line_color = $lc; + } + + /** + * Set footer data. + * @param $tc (array) RGB array color for text. + * @param $lc (array) RGB array color for line. + * @public + */ + public function setFooterData($tc=array(0,0,0), $lc=array(0,0,0)) { + $this->footer_text_color = $tc; + $this->footer_line_color = $lc; } /** @@ -4105,6 +4171,8 @@ class TCPDF { $ret['logo_width'] = $this->header_logo_width; $ret['title'] = $this->header_title; $ret['string'] = $this->header_string; + $ret['text_color'] = $this->header_text_color; + $ret['line_color'] = $this->header_line_color; return $ret; } @@ -4238,7 +4306,7 @@ class TCPDF { $header_x = $this->original_lMargin + ($headerdata['logo_width'] * 1.1); } $cw = $this->w - $this->original_lMargin - $this->original_rMargin - ($headerdata['logo_width'] * 1.1); - $this->SetTextColor(0, 0, 0); + $this->SetTextColorArray($this->header_text_color); // header title $this->SetFont($headerfont[0], 'B', $headerfont[2] + 1); $this->SetX($header_x); @@ -4248,7 +4316,7 @@ class TCPDF { $this->SetX($header_x); $this->MultiCell($cw, $cell_height, $headerdata['string'], 0, '', 0, 1, '', '', true, 0, false, true, 0, 'T', false); // print an ending header line - $this->SetLineStyle(array('width' => 0.85 / $this->k, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))); + $this->SetLineStyle(array('width' => 0.85 / $this->k, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => $headerdata['line_color'])); $this->SetY((2.835 / $this->k) + max($imgy, $this->y)); if ($this->rtl) { $this->SetX($this->original_rMargin); @@ -4284,10 +4352,10 @@ class TCPDF { */ public function Footer() { $cur_y = $this->y; - $this->SetTextColor(0, 0, 0); + $this->SetTextColorArray($this->footer_text_color); //set style for cell border - $line_width = 0.85 / $this->k; - $this->SetLineStyle(array('width' => $line_width, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))); + $line_width = (0.85 / $this->k); + $this->SetLineStyle(array('width' => $line_width, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => $this->footer_line_color)); //print document barcode $barcode = $this->getBarcode(); if (!empty($barcode)) { @@ -4919,9 +4987,9 @@ class TCPDF { } /** - * Returns the length of the char in user unit for the current font considering current stretching and spacing (tracking/kerning). + * Returns the length of the char in user unit for the current font considering current stretching and spacing (tracking). * @param $char (int) The char code whose length is to be returned - * @param $notlast (boolean) set to false for the latest character on string, true otherwise (default) + * @param $notlast (boolean) If false ignore the font-spacing. * @return float char width * @author Nicola Asuni * @public @@ -4930,7 +4998,7 @@ class TCPDF { public function GetCharWidth($char, $notlast=true) { // get raw width $chw = $this->getRawCharWidth($char); - if (($this->font_spacing != 0) AND $notlast) { + if (($this->font_spacing < 0) OR (($this->font_spacing > 0) AND $notlast)) { // increase/decrease font spacing $chw += $this->font_spacing; } @@ -5400,7 +5468,7 @@ class TCPDF { } /** - * Return the font ascent value + * Return the font ascent value. * @param $font (string) font name * @param $style (string) font style * @param $size (float) The size (in points) @@ -5421,7 +5489,7 @@ class TCPDF { } /** - * Return the font descent value + * Return true in the character is present in the specified font. * @param $char (mixed) Character to check (integer value or string) * @param $font (string) Font name (family name). * @param $style (string) Font style. @@ -5436,6 +5504,9 @@ class TCPDF { $char = $char[0]; } if ($this->empty_string($font)) { + if ($this->empty_string($style)) { + return (isset($this->CurrentFont['cw'][intval($char)])); + } $font = $this->FontFamily; } $fontdata = $this->AddFont($font, $style); @@ -5828,6 +5899,35 @@ class TCPDF { } } $this->checkPageBreak($h + $this->cell_margin['T'] + $this->cell_margin['B']); + // apply text shadow if enabled + if ($this->txtshadow['enabled']) { + // save data + $x = $this->x; + $y = $this->y; + $bc = $this->bgcolor; + $fc = $this->fgcolor; + $sc = $this->strokecolor; + $alpha = $this->alpha; + // print shadow + $this->x += $this->txtshadow['depth_w']; + $this->y += $this->txtshadow['depth_h']; + $this->SetFillColorArray($this->txtshadow['color']); + $this->SetTextColorArray($this->txtshadow['color']); + $this->SetDrawColorArray($this->txtshadow['color']); + if ($this->txtshadow['opacity'] != $alpha['CA']) { + $this->setAlpha($this->txtshadow['opacity'], $this->txtshadow['blend_mode']); + } + $this->_out($this->getCellCode($w, $h, $txt, $border, $ln, $align, $fill, $link, $stretch, true, $calign, $valign)); + //restore data + $this->x = $x; + $this->y = $y; + $this->SetFillColorArray($bc); + $this->SetTextColorArray($fc); + $this->SetDrawColorArray($sc); + if ($this->txtshadow['opacity'] != $alpha['CA']) { + $this->setAlpha($alpha['CA'], $alpha['BM'], $alpha['ca'], $alpha['AIS']); + } + } $this->_out($this->getCellCode($w, $h, $txt, $border, $ln, $align, $fill, $link, $stretch, true, $calign, $valign)); $this->cell_padding = $prev_cell_padding; $this->cell_margin = $prev_cell_margin; @@ -6023,34 +6123,97 @@ class TCPDF { } else { $unicode = $this->UTF8StringToArray($txt); // array of UTF-8 unicode values $unicode = $this->utf8Bidi($unicode, '', $this->tmprtl); + // replace thai chars (if any) if (defined('K_THAI_TOPCHARS') AND (K_THAI_TOPCHARS == true)) { - // ---- Fix for bug #2977340 "Incorrect Thai characters position arrangement" ---- - // NOTE: this doesn't work with HTML justification - // Symbols that could overlap on the font top (only works in LTR) - $topchar = array(3611, 3613, 3615, 3650, 3651, 3652); // chars that extends on top - $topsym = array(3633, 3636, 3637, 3638, 3639, 3655, 3656, 3657, 3658, 3659, 3660, 3661, 3662); // symbols with top position - $numchars = count($unicode); // number of chars - $unik = 0; - $uniblock = array(); - $uniblock[$unik] = array(); - $uniblock[$unik][] = $unicode[0]; - // resolve overlapping conflicts by splitting the string in several parts - for ($i = 1; $i < $numchars; ++$i) { - // check if symbols overlaps at top - if (in_array($unicode[$i], $topsym) AND (in_array($unicode[($i - 1)], $topsym) OR in_array($unicode[($i - 1)], $topchar))) { - // move symbols to another array - ++$unik; - $uniblock[$unik] = array(); - $uniblock[$unik][] = $unicode[$i]; - ++$unik; - $uniblock[$unik] = array(); - $unicode[$i] = 0x200b; // Unicode Character 'ZERO WIDTH SPACE' (DEC:8203, U+200B) + // number of chars + $numchars = count($unicode); + // po pla, for far, for fan + $longtail = array(0x0e1b, 0x0e1d, 0x0e1f); + // do chada, to patak + $lowtail = array(0x0e0e, 0x0e0f); + // mai hun arkad, sara i, sara ii, sara ue, sara uee + $upvowel = array(0x0e31, 0x0e34, 0x0e35, 0x0e36, 0x0e37); + // mai ek, mai tho, mai tri, mai chattawa, karan + $tonemark = array(0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c); + // sara u, sara uu, pinthu + $lowvowel = array(0x0e38, 0x0e39, 0x0e3a); + $output = array(); + for ($i = 0; $i < $numchars; $i++) { + if (($unicode[$i] >= 0x0e00) && ($unicode[$i] <= 0x0e5b)) { + $ch0 = $unicode[$i]; + $ch1 = ($i > 0) ? $unicode[($i - 1)] : 0; + $ch2 = ($i > 1) ? $unicode[($i - 2)] : 0; + $chn = ($i < ($numchars - 1)) ? $unicode[($i + 1)] : 0; + if (in_array($ch0, $tonemark)) { + if ($chn == 0x0e33) { + // sara um + if (in_array($ch1, $longtail)) { + // tonemark at upper left + $output[] = $this->replaceChar($ch0, (0xf713 + $ch0 - 0x0e48)); + } else { + // tonemark at upper right (normal position) + $output[] = $ch0; + } + } elseif (in_array($ch1, $longtail) OR (in_array($ch2, $longtail) AND in_array($ch1, $lowvowel))) { + // tonemark at lower left + $output[] = $this->replaceChar($ch0, (0xf705 + $ch0 - 0x0e48)); + } elseif (in_array($ch1, $upvowel)) { + if (in_array($ch2, $longtail)) { + // tonemark at upper left + $output[] = $this->replaceChar($ch0, (0xf713 + $ch0 - 0x0e48)); + } else { + // tonemark at upper right (normal position) + $output[] = $ch0; + } + } else { + // tonemark at lower right + $output[] = $this->replaceChar($ch0, (0xf70a + $ch0 - 0x0e48)); + } + } elseif (($ch0 == 0x0e33) AND (in_array($ch1, $longtail) OR (in_array($ch2, $longtail) AND in_array($ch1, $tonemark)))) { + // add lower left nikhahit and sara aa + if ($this->isCharDefined(0xf711) AND $this->isCharDefined(0x0e32)) { + $output[] = 0xf711; + $this->CurrentFont['subsetchars'][0xf711] = true; + $output[] = 0x0e32; + $this->CurrentFont['subsetchars'][0x0e32] = true; + } else { + $output[] = $ch0; + } + } elseif (in_array($ch1, $longtail)) { + if ($ch0 == 0x0e31) { + // lower left mai hun arkad + $output[] = $this->replaceChar($ch0, 0xf710); + } elseif (in_array($ch0, $upvowel)) { + // lower left + $output[] = $this->replaceChar($ch0, (0xf701 + $ch0 - 0x0e34)); + } elseif ($ch0 == 0x0e47) { + // lower left mai tai koo + $output[] = $this->replaceChar($ch0, 0xf712); + } else { + // normal character + $output[] = $ch0; + } + } elseif (in_array($ch1, $lowtail) AND in_array($ch0, $lowvowel)) { + // lower vowel + $output[] = $this->replaceChar($ch0, (0xf718 + $ch0 - 0x0e38)); + } elseif (($ch0 == 0x0e0d) AND in_array($chn, $lowvowel)) { + // yo ying without lower part + $output[] = $this->replaceChar($ch0, 0xf70f); + } elseif (($ch0 == 0x0e10) AND in_array($chn, $lowvowel)) { + // tho santan without lower part + $output[] = $this->replaceChar($ch0, 0xf700); + } else { + $output[] = $ch0; + } } else { - $uniblock[$unik][] = $unicode[$i]; + // non-thai character + $output[] = $unicode[$i]; } } - // ---- END OF Fix for bug #2977340 - } + $unicode = $output; + // update font subsetchars + $this->setFontSubBuffer($this->CurrentFont['fontkey'], 'subsetchars', $this->CurrentFont['subsetchars']); + } // end of K_THAI_TOPCHARS $txt2 = $this->arrUTF8ToUTF16BE($unicode, false); } } @@ -6094,7 +6257,7 @@ class TCPDF { $s .= 'q '.$this->TextColor.' '; } // rendering mode - $s .= sprintf('BT %d Tr %F w ET ', $this->textrendermode, $this->textstrokewidth); + $s .= sprintf('BT %d Tr %F w ET ', $this->textrendermode, ($this->textstrokewidth * $this->k)); // count number of spaces $ns = substr_count($txt, chr(32)); // Justification @@ -6250,6 +6413,25 @@ class TCPDF { return $rs; } + /** + * Replace a char if is defined on the current font. + * @param $oldchar (int) Integer code (unicode) of the character to replace. + * @param $newchar (int) Integer code (unicode) of the new character. + * @return int the replaced char or the old char in case the new char i not defined + * @protected + * @since 5.9.167 (2012-06-22) + */ + protected function replaceChar($oldchar, $newchar) { + if ($this->isCharDefined($newchar)) { + // add the new char on the subset list + $this->CurrentFont['subsetchars'][$newchar] = true; + // return the new character + return $newchar; + } + // return the old char + return $oldchar; + } + /** * Returns the code to draw the cell border * @param $x (float) X coordinate. @@ -7069,7 +7251,7 @@ class TCPDF { $w = $this->w - $this->rMargin - $this->x; } // max column width - $wmax = $w - $wadj; + $wmax = ($w - $wadj); if (!$firstline) { $wmax -= ($this->cell_padding['L'] + $this->cell_padding['R']); } @@ -7155,18 +7337,27 @@ class TCPDF { $this->rMargin += $margin['R']; } $w = $this->getRemainingWidth(); - $wmax = $w - $this->cell_padding['L'] - $this->cell_padding['R']; + $wmax = ($w - $this->cell_padding['L'] - $this->cell_padding['R']); } else { // 160 is the non-breaking space. // 173 is SHY (Soft Hypen). // \p{Z} or \p{Separator}: any kind of Unicode whitespace or invisible separator. // \p{Lo} or \p{Other_Letter}: a Unicode letter or ideograph that does not have lowercase and uppercase variants. // \p{Lo} is needed because Chinese characters are packed next to each other without spaces in between. - if (($c != 160) AND (($c == 173) OR preg_match($this->re_spaces, $this->unichr($c)))) { + if (($c != 160) + AND (($c == 173) + OR preg_match($this->re_spaces, $this->unichr($c)) + OR (($c == 45) + AND ($i < ($nb - 1)) + AND @preg_match('/[\p{L}]/'.$this->re_space['m'], $this->unichr($pc)) + AND @preg_match('/[\p{L}]/'.$this->re_space['m'], $this->unichr($chars[($i + 1)])) + ) + ) + ) { // update last blank space position $sep = $i; // check if is a SHY - if ($c == 173) { + if (($c == 173) OR ($c == 45)) { $shy = true; if ($pc == 45) { $tmp_shy_replacement_width = 0; @@ -7191,8 +7382,8 @@ class TCPDF { // we have reached the end of column if ($sep == -1) { // check if the line was already started - if (($this->rtl AND ($this->x <= ($this->w - $this->rMargin - $chrwidth))) - OR ((!$this->rtl) AND ($this->x >= ($this->lMargin + $chrwidth)))) { + if (($this->rtl AND ($this->x <= ($this->w - $this->rMargin - $this->cell_padding['R'] - $margin['R'] - $chrwidth))) + OR ((!$this->rtl) AND ($this->x >= ($this->lMargin + $this->cell_padding['L'] + $margin['L'] + $chrwidth)))) { // print a void cell and go to next line $this->Cell($w, $h, '', 0, 1); $linebreak = true; @@ -7255,9 +7446,9 @@ class TCPDF { $linew = $this->GetArrStringWidth($tmparr); unset($tmparr); if ($this->rtl) { - $this->endlinex = $startx - $linew; + $this->endlinex = ($startx - $linew); } else { - $this->endlinex = $startx + $linew; + $this->endlinex = ($startx + $linew); } $w = $linew; $tmpcellpadding = $this->cell_padding; @@ -7320,6 +7511,9 @@ class TCPDF { $this->Cell($w, $h, $shy_char_left.$tmpstr.$shy_char_right, 0, 1, $align, $fill, $link, $stretch); unset($tmpstr); if ($firstline) { + if ($chars[$sep] == 45) { + $endspace += 1; + } // return the remaining text $this->cell_padding = $tmpcellpadding; return ($this->UniArrSubString($uchars, ($sep + $endspace))); @@ -7327,7 +7521,7 @@ class TCPDF { $i = $sep; $sep = -1; $shy = false; - $j = ($i+1); + $j = ($i + 1); } } // account for margin changes @@ -7661,7 +7855,7 @@ class TCPDF { if ($file[0] === '@') { // image from string $imgdata = substr($file, 1); - $file = K_PATH_CACHE.'img_'.md5($imgdata); + $file = $this->getObjFilename('img'); $fp = fopen($file, 'w'); fwrite($fp, $imgdata); fclose($fp); @@ -7697,7 +7891,9 @@ class TCPDF { curl_setopt($cs, CURLOPT_BINARYTRANSFER, true); curl_setopt($cs, CURLOPT_FAILONERROR, true); curl_setopt($cs, CURLOPT_RETURNTRANSFER, true); - curl_setopt($cs, CURLOPT_FOLLOWLOCATION, true); + if ((ini_get('open_basedir') == '') AND (ini_get('safe_mode') == 'Off')) { + curl_setopt($cs, CURLOPT_FOLLOWLOCATION, true); + } curl_setopt($cs, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($cs, CURLOPT_TIMEOUT, 30); curl_setopt($cs, CURLOPT_SSL_VERIFYPEER, false); @@ -7707,7 +7903,7 @@ class TCPDF { curl_close($cs); if ($imgdata !== FALSE) { // copy image to cache - $file = K_PATH_CACHE.'img_'.md5($imgdata); + $file = $this->getObjFilename('img'); $fp = fopen($file, 'w'); fwrite($fp, $imgdata); fclose($fp); @@ -7738,7 +7934,7 @@ class TCPDF { } } // file hash - $filehash = md5($file); + $filehash = md5($this->file_id.$file); // get original image width and height in pixels list($pixw, $pixh) = $imsize; // calculate image width and height on document @@ -8320,11 +8516,13 @@ class TCPDF { $data .= $this->rfread($f, $n); fread($f, 4); } elseif ($type == 'iCCP') { - // skip profile name and null separator + // skip profile name $len = 0; while ((ord(fread($f, 1)) > 0) AND ($len < 80)) { ++$len; } + // skip null separator + fread($f, 1); // get compression method if (ord(fread($f, 1)) != 0) { //$this->Error('Unknown filter method: '.$file); @@ -8396,7 +8594,7 @@ class TCPDF { */ protected function ImagePngAlpha($file, $x, $y, $wpx, $hpx, $w, $h, $type, $link, $align, $resize, $dpi, $palign, $filehash='') { if (empty($filehash)) { - $filehash = md5($file); + $filehash = md5($this->file_id.$file); } // create temp image file (without alpha channel) $tempfile_plain = K_PATH_CACHE.'mskp_'.$filehash; @@ -8407,7 +8605,7 @@ class TCPDF { $img = new Imagick(); $img->readImage($file); // clone image object - $imga = $img->clone(); + $imga = $this->objclone($img); // extract alpha channel $img->separateImageChannel(8); // 8 = (imagick::CHANNEL_ALPHA | imagick::CHANNEL_OPACITY | imagick::CHANNEL_MATTE); $img->negateImage(true); @@ -8429,9 +8627,7 @@ class TCPDF { for ($xpx = 0; $xpx < $wpx; ++$xpx) { for ($ypx = 0; $ypx < $hpx; ++$ypx) { $color = imagecolorat($img, $xpx, $ypx); - $alpha = ($color >> 24); // shifts off the first 24 bits (where 8x3 are used for each color), and returns the remaining 7 allocated bits (commonly used for alpha) - $alpha = (((127 - $alpha) / 127) * 255); // GD alpha is only 7 bit (0 -> 127) - $alpha = $this->getGDgamma($alpha); // correct gamma + $alpha = $this->getGDgamma($color); // correct gamma imagesetpixel($imgalpha, $xpx, $ypx, $alpha); } } @@ -8455,13 +8651,27 @@ class TCPDF { } /** - * Correct the gamma value to be used with GD library - * @param $v (float) the gamma value to be corrected + * Get the GD-corrected PNG gamma value from alpha color + * @param $c (int) alpha color * @protected * @since 4.3.007 (2008-12-04) */ - protected function getGDgamma($v) { - return (pow(($v / 255), 2.2) * 255); + protected function getGDgamma($c) { + if (!isset($this->gdgammacache["'".$c."'"])) { + // shifts off the first 24 bits (where 8x3 are used for each color), + // and returns the remaining 7 allocated bits (commonly used for alpha) + $alpha = ($c >> 24); + // GD alpha is only 7 bit (0 -> 127) + $alpha = (((127 - $alpha) / 127) * 255); + // correct gamma + $this->gdgammacache["'".$c."'"] = (pow(($alpha / 255), 2.2) * 255); + // store the latest values on cache to improve performances + if (count($this->gdgammacache) > 8) { + // remove one element from the cache array + array_shift($this->gdgammacache); + } + } + return $this->gdgammacache["'".$c."'"]; } /** @@ -8736,7 +8946,7 @@ class TCPDF { header('Pragma: public'); header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); - header('Content-Disposition: inline; filename="'.basename($name).'";'); + header('Content-Disposition: inline; filename="'.basename($name).'"'); $this->sendOutputData($this->getBuffer(), $this->bufferlen); } else { echo $this->getBuffer(); @@ -8767,7 +8977,7 @@ class TCPDF { header('Content-Type: application/pdf'); } // use the Content-Disposition header to supply a recommended filename - header('Content-Disposition: attachment; filename="'.basename($name).'";'); + header('Content-Disposition: attachment; filename="'.basename($name).'"'); header('Content-Transfer-Encoding: binary'); $this->sendOutputData($this->getBuffer(), $this->bufferlen); break; @@ -8794,7 +9004,7 @@ class TCPDF { header('Pragma: public'); header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); - header('Content-Disposition: inline; filename="'.basename($name).'";'); + header('Content-Disposition: inline; filename="'.basename($name).'"'); $this->sendOutputData(file_get_contents($name), filesize($name)); } elseif ($dest == 'FD') { // send headers to browser @@ -8819,7 +9029,7 @@ class TCPDF { header('Content-Type: application/pdf'); } // use the Content-Disposition header to supply a recommended filename - header('Content-Disposition: attachment; filename="'.basename($name).'";'); + header('Content-Disposition: attachment; filename="'.basename($name).'"'); header('Content-Transfer-Encoding: binary'); $this->sendOutputData(file_get_contents($name), filesize($name)); } @@ -9430,7 +9640,7 @@ class TCPDF { if (isset($pl['opt']['be']) AND (is_array($pl['opt']['be']))) { $annots .= ' /BE <<'; $bstyles = array('S', 'C'); - if (isset($pl['opt']['be']['s']) AND in_array($pl['opt']['be']['s'], $markups)) { + if (isset($pl['opt']['be']['s']) AND in_array($pl['opt']['be']['s'], $bstyles)) { $annots .= ' /S /'.$pl['opt']['bs']['s']; } else { $annots .= ' /S /S'; @@ -9509,9 +9719,11 @@ class TCPDF { $annots .= ' /A <_datastring($this->unhtmlentities($pl['txt']), $annot_obj_id).'>>'; } else { // internal link - $l = $this->links[$pl['txt']]; - if (isset($this->page_obj_id[($l[0])])) { - $annots .= sprintf(' /Dest [%u 0 R /XYZ 0 %F null]', $this->page_obj_id[($l[0])], ($this->pagedim[$l[0]]['h'] - ($l[1] * $this->k))); + if (isset($this->links[$pl['txt']])) { + $l = $this->links[$pl['txt']]; + if (isset($this->page_obj_id[($l[0])])) { + $annots .= sprintf(' /Dest [%u 0 R /XYZ 0 %F null]', $this->page_obj_id[($l[0])], ($this->pagedim[$l[0]]['h'] - ($l[1] * $this->k))); + } } } $hmodes = array('N', 'I', 'O', 'P'); @@ -12855,11 +13067,14 @@ class TCPDF { $this->_out('xref'); $this->_out('0 '.($this->n + 1)); $this->_out('0000000000 65535 f '); + $freegen = ($this->n + 2); for ($i=1; $i <= $this->n; ++$i) { if (!isset($this->offsets[$i]) AND ($i > 1)) { - $this->offsets[$i] = $this->offsets[($i - 1)]; + $this->_out(sprintf('0000000000 %05d f ', $freegen)); + ++$freegen; + } else { + $this->_out(sprintf('%010d 00000 n ', $this->offsets[$i])); } - $this->_out(sprintf('%010d 00000 n ', $this->offsets[$i])); } // TRAILER $out = 'trailer'."\n"; @@ -12899,6 +13114,7 @@ class TCPDF { */ protected function _beginpage($orientation='', $format='') { ++$this->page; + $this->pageobjects[$this->page] = array(); $this->setPageBuffer($this->page, ''); // initialize array for graphics tranformation positions inside a page buffer $this->transfmrk[$this->page] = array(); @@ -12967,6 +13183,7 @@ class TCPDF { $objid = $this->n; } $this->offsets[$objid] = $this->bufferlen; + $this->pageobjects[$this->page][] = $objid; return $objid.' 0 obj'; } @@ -15012,7 +15229,7 @@ class TCPDF { * @since 2.1.000 (2008-01-08) */ protected function _outPoint($x, $y) { - $this->_out(sprintf('%F %F m', $x * $this->k, ($this->h - $y) * $this->k)); + $this->_out(sprintf('%F %F m', ($x * $this->k), (($this->h - $y) * $this->k))); } /** @@ -15024,7 +15241,7 @@ class TCPDF { * @since 2.1.000 (2008-01-08) */ protected function _outLine($x, $y) { - $this->_out(sprintf('%F %F l', $x * $this->k, ($this->h - $y) * $this->k)); + $this->_out(sprintf('%F %F l', ($x * $this->k), (($this->h - $y) * $this->k))); } /** @@ -16404,12 +16621,13 @@ class TCPDF { * @param $name (string) Destination name. * @param $y (float) Y position in user units of the destiantion on the selected page (default = -1 = current position; 0 = page start;). * @param $page (int) Target page number (leave empty for current page). + * @param $x (float) X position in user units of the destiantion on the selected page (default = -1 = current position;). * @return (string) Stripped named destination identifier or false in case of error. * @public * @author Christian Deligant, Nicola Asuni * @since 5.9.097 (2011-06-23) */ - public function setDestination($name, $y=-1, $page='') { + public function setDestination($name, $y=-1, $page='', $x=-1) { // remove unsupported characters $name = $this->encodeNameObject($name); if ($this->empty_string($name)) { @@ -16417,6 +16635,17 @@ class TCPDF { } if ($y == -1) { $y = $this->GetY(); + } elseif ($y < 0) { + $y = 0; + } elseif ($y > $this->h) { + $y = $this->h; + } + if ($x == -1) { + $x = $this->GetX(); + } elseif ($x < 0) { + $x = 0; + } elseif ($x > $this->w) { + $x = $this->w; } if (empty($page)) { $page = $this->PageNo(); @@ -16424,7 +16653,7 @@ class TCPDF { return; } } - $this->dests[$name] = array('y' => $y, 'p' => $page); + $this->dests[$name] = array('x' => $x, 'y' => $y, 'p' => $page); return $name; } @@ -16452,7 +16681,7 @@ class TCPDF { $this->n_dests = $this->_newobj(); $out = ' <<'; foreach($this->dests as $name => $o) { - $out .= ' /'.$name.' '.sprintf('[%u 0 R /XYZ 0 %F null]', $this->page_obj_id[($o['p'])], ($this->pagedim[$o['p']]['h'] - ($o['y'] * $this->k))); + $out .= ' /'.$name.' '.sprintf('[%u 0 R /XYZ %F %F null]', $this->page_obj_id[($o['p'])], ($o['x'] * $this->k), ($this->pagedim[$o['p']]['h'] - ($o['y'] * $this->k))); } $out .= ' >>'; $out .= "\n".'endobj'; @@ -16481,11 +16710,12 @@ class TCPDF { * @param $page (int) Target page number (leave empty for current page). * @param $style (string) Font style: B = Bold, I = Italic, BI = Bold + Italic. * @param $color (array) RGB color array (values from 0 to 255). + * @param $x (float) X position in user units of the bookmark on the selected page (default = -1 = current position;). * @public * @author Olivier Plathey, Nicola Asuni * @since 2.1.002 (2008-02-12) */ - public function Bookmark($txt, $level=0, $y=-1, $page='', $style='', $color=array(0,0,0)) { + public function Bookmark($txt, $level=0, $y=-1, $page='', $style='', $color=array(0,0,0), $x=-1) { if ($level < 0) { $level = 0; } @@ -16500,6 +16730,17 @@ class TCPDF { } if ($y == -1) { $y = $this->GetY(); + } elseif ($y < 0) { + $y = 0; + } elseif ($y > $this->h) { + $y = $this->h; + } + if ($x == -1) { + $x = $this->GetX(); + } elseif ($x < 0) { + $x = 0; + } elseif ($x > $this->w) { + $x = $this->w; } if (empty($page)) { $page = $this->PageNo(); @@ -16507,7 +16748,7 @@ class TCPDF { return; } } - $this->outlines[] = array('t' => $txt, 'l' => $level, 'y' => $y, 'p' => $page, 's' => strtoupper($style), 'c' => $color); + $this->outlines[] = array('t' => $txt, 'l' => $level, 'x' => $x, 'y' => $y, 'p' => $page, 's' => strtoupper($style), 'c' => $color); } /** @@ -16590,7 +16831,7 @@ class TCPDF { $out .= ' /Last '.($n + $o['last']).' 0 R'; } if (isset($this->page_obj_id[($o['p'])])) { - $out .= ' '.sprintf('/Dest [%u 0 R /XYZ 0 %F null]', $this->page_obj_id[($o['p'])], ($this->pagedim[$o['p']]['h'] - ($o['y'] * $this->k))); + $out .= ' '.sprintf('/Dest [%u 0 R /XYZ %F %F null]', $this->page_obj_id[($o['p'])], ($o['x'] * $this->k), ($this->pagedim[$o['p']]['h'] - ($o['y'] * $this->k))); } // set font style $style = 0; @@ -19169,7 +19410,7 @@ class TCPDF { */ public function PieSectorXY($xc, $yc, $rx, $ry, $a, $b, $style='FD', $cw=false, $o=0, $nc=2) { if ($this->rtl) { - $xc = $this->w - $xc; + $xc = ($this->w - $xc); } $op = $this->getPathPaintOperator($style); if ($op == 'f') { @@ -19177,8 +19418,8 @@ class TCPDF { } if ($cw) { $d = $b; - $b = 360 - $a + $o; - $a = 360 - $d + $o; + $b = (360 - $a + $o); + $a = (360 - $d + $o); } else { $b += $o; $a += $o; @@ -19578,7 +19819,7 @@ class TCPDF { // create new barcode object $barcodeobj = new TCPDFBarcode($code, $type); $arrcode = $barcodeobj->getBarcodeArray(); - if ($arrcode === false) { + if (($arrcode === false) OR empty($arrcode) OR ($arrcode['maxw'] == 0)) { $this->Error('Error in 1D barcode string'); } // set default values @@ -19949,7 +20190,7 @@ class TCPDF { // create new barcode object $barcodeobj = new TCPDF2DBarcode($code, $type); $arrcode = $barcodeobj->getBarcodeArray(); - if (($arrcode === false) OR empty($arrcode)) { + if (($arrcode === false) OR empty($arrcode) OR !isset($arrcode['num_rows']) OR ($arrcode['num_rows'] == 0) OR !isset($arrcode['num_cols']) OR ($arrcode['num_cols'] == 0)) { $this->Error('Error in 2D barcode string'); } // set default values @@ -20004,6 +20245,9 @@ class TCPDF { // module width and height $mw = $style['module_width']; $mh = $style['module_height']; + if (($mw == 0) OR ($mh == 0)) { + $this->Error('Error in 2D barcode string'); + } // get max dimensions if ($this->rtl) { $maxw = $x - $this->lMargin; @@ -20886,7 +21130,7 @@ class TCPDF { /** * Returns the letter-spacing value from CSS value * @param $spacing (string) letter-spacing value - * @param $parent (float) font spacing (tracking/kerning) value of the parent element + * @param $parent (float) font spacing (tracking) value of the parent element * @return float quantity to increases or decreases the space between characters in a text. * @protected * @since 5.9.000 (2010-10-02) @@ -21499,7 +21743,7 @@ class TCPDF { } if (isset($dom[$key]['style']['border-style'])) { $brd_styles = preg_split('/[\s]+/', trim($dom[$key]['style']['border-style'])); - if (isset($brd_styles[3])) { + if (isset($brd_styles[3]) AND ($brd_styles[3]!='none')) { $dom[$key]['border']['L']['cap'] = 'square'; $dom[$key]['border']['L']['join'] = 'miter'; $dom[$key]['border']['L']['dash'] = $this->getCSSBorderDashStyle($brd_styles[3]); @@ -21834,7 +22078,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $curfontascent = $this->getFontAscent($curfontname, $curfontstyle, $curfontsize); $curfontdescent = $this->getFontDescent($curfontname, $curfontstyle, $curfontsize); $curfontstretcing = $this->font_stretching; - $curfontkerning = $this->font_spacing; + $curfonttracking = $this->font_spacing; $this->newline = true; $newline = true; $startlinepage = $this->page; @@ -21973,7 +22217,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this_method_vars['curfontascent'] = $curfontascent; $this_method_vars['curfontdescent'] = $curfontdescent; $this_method_vars['curfontstretcing'] = $curfontstretcing; - $this_method_vars['curfontkerning'] = $curfontkerning; + $this_method_vars['curfonttracking'] = $curfonttracking; $this_method_vars['minstartliney'] = $minstartliney; $this_method_vars['maxbottomliney'] = $maxbottomliney; $this_method_vars['yshift'] = $yshift; @@ -23051,9 +23295,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } else { $wadj = 0; // space to leave for block continuity if ($this->rtl) { - $cwa = $this->x - $this->lMargin; + $cwa = ($this->x - $this->lMargin); } else { - $cwa = $this->w - $this->rMargin - $this->x; + $cwa = ($this->w - $this->rMargin - $this->x); } if (($strlinelen < $cwa) AND (isset($dom[($key + 1)])) AND ($dom[($key + 1)]['tag']) AND (!$dom[($key + 1)]['block'])) { // check the next text blocks for continuity @@ -23143,6 +23387,14 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } } else { $loop = 0; + // add the positive font spacing of the last character (if any) + if ($this->font_spacing > 0) { + if ($this->rtl) { + $this->x -= $this->font_spacing; + } else { + $this->x += $this->font_spacing; + } + } } } ++$key; @@ -23740,7 +23992,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $value = $tag['attribute']['value']; } if (isset($tag['attribute']['maxlength']) AND !$this->empty_string($tag['attribute']['maxlength'])) { - $opt['maxlen'] = intval($tag['attribute']['value']); + $opt['maxlen'] = intval($tag['attribute']['maxlength']); } $h = $this->FontSize * $this->cell_height_ratio; if (isset($tag['attribute']['size']) AND !$this->empty_string($tag['attribute']['size'])) { @@ -23786,14 +24038,23 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: break; } case 'checkbox': { + if (!isset($value)) { + break; + } $this->CheckBox($name, $w, $checked, $prop, $opt, $value, '', '', false); break; } case 'radio': { + if (!isset($value)) { + break; + } $this->RadioButton($name, $w, $prop, $opt, $value, $checked, '', '', false); break; } case 'submit': { + if (!isset($value)) { + $value = 'submit'; + } $w = $this->GetStringWidth($value) * 1.5; $h *= 1.6; $prop = array('lineWidth'=>1, 'borderStyle'=>'beveled', 'fillColor'=>array(196, 196, 196), 'strokeColor'=>array(255, 255, 255)); @@ -23810,6 +24071,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: break; } case 'reset': { + if (!isset($value)) { + $value = 'reset'; + } $w = $this->GetStringWidth($value) * 1.5; $h *= 1.6; $prop = array('lineWidth'=>1, 'borderStyle'=>'beveled', 'fillColor'=>array(196, 196, 196), 'strokeColor'=>array(255, 255, 255)); @@ -23855,6 +24119,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: break; } case 'button': { + if (!isset($value)) { + $value = ' '; + } $w = $this->GetStringWidth($value) * 1.5; $h *= 1.6; $prop = array('lineWidth'=>1, 'borderStyle'=>'beveled', 'fillColor'=>array(196, 196, 196), 'strokeColor'=>array(255, 255, 255)); @@ -24328,13 +24595,10 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if (end($this->transfmrk[$this->page]) !== false) { $pagemarkkey = key($this->transfmrk[$this->page]); $pagemark = $this->transfmrk[$this->page][$pagemarkkey]; - $this->transfmrk[$this->page][$pagemarkkey] += $offsetlen; } elseif ($this->InFooter) { $pagemark = $this->footerpos[$this->page]; - $this->footerpos[$this->page] += $offsetlen; } else { $pagemark = $this->intmrk[$this->page]; - $this->intmrk[$this->page] += $offsetlen; } $pagebuff = $this->getPageBuffer($this->page); $pstart = substr($pagebuff, 0, $pagemark); @@ -24738,17 +25002,14 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if (end($this->transfmrk[$this->page]) !== false) { $pagemarkkey = key($this->transfmrk[$this->page]); $pagemark = $this->transfmrk[$this->page][$pagemarkkey]; - $this->transfmrk[$this->page][$pagemarkkey] += $offsetlen; } elseif ($this->InFooter) { $pagemark = $this->footerpos[$this->page]; - $this->footerpos[$this->page] += $offsetlen; } else { $pagemark = $this->intmrk[$this->page]; - $this->intmrk[$this->page] += $offsetlen; } $pagebuff = $this->getPageBuffer($this->page); - $pstart = substr($pagebuff, 0, $this->bordermrk[$this->page]); - $pend = substr($pagebuff, $this->bordermrk[$this->page]); + $pstart = substr($pagebuff, 0, $pagemark); + $pend = substr($pagebuff, $pagemark); $this->setPageBuffer($this->page, $pstart.$ccode.$pend); $this->bordermrk[$this->page] += $offsetlen; $this->cntmrk[$this->page] += $offsetlen; @@ -25278,6 +25539,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 'cell_height_ratio' => $this->cell_height_ratio, 'font_stretching' => $this->font_stretching, 'font_spacing' => $this->font_spacing, + 'alpha' => $this->alpha, // extended 'lasth' => $this->lasth, 'tMargin' => $this->tMargin, @@ -25337,6 +25599,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->cell_height_ratio = $gvars['cell_height_ratio']; $this->font_stretching = $gvars['font_stretching']; $this->font_spacing = $gvars['font_spacing']; + $this->alpha = $gvars['alpha']; if ($extended) { // restore extended values $this->lasth = $gvars['lasth']; @@ -25651,6 +25914,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $tmpintmrk = $this->intmrk[$frompage]; $tmpbordermrk = $this->bordermrk[$frompage]; $tmpcntmrk = $this->cntmrk[$frompage]; + $tmppageobjects = $this->pageobjects[$frompage]; if (isset($this->footerpos[$frompage])) { $tmpfooterpos = $this->footerpos[$frompage]; } @@ -25686,6 +25950,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->intmrk[$i] = $this->intmrk[$j]; $this->bordermrk[$i] = $this->bordermrk[$j]; $this->cntmrk[$i] = $this->cntmrk[$j]; + $this->pageobjects[$i] = $this->pageobjects[$j]; if (isset($this->footerpos[$j])) { $this->footerpos[$i] = $this->footerpos[$j]; } elseif (isset($this->footerpos[$i])) { @@ -25720,6 +25985,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->intmrk[$topage] = $tmpintmrk; $this->bordermrk[$topage] = $tmpbordermrk; $this->cntmrk[$topage] = $tmpcntmrk; + $this->pageobjects[$topage] = $tmppageobjects; if (isset($tmpfooterpos)) { $this->footerpos[$topage] = $tmpfooterpos; } elseif (isset($this->footerpos[$topage])) { @@ -25807,6 +26073,12 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: unset($this->intmrk[$page]); unset($this->bordermrk[$page]); unset($this->cntmrk[$page]); + foreach ($this->pageobjects[$page] as $oid) { + if (isset($this->offsets[$oid])){ + unset($this->offsets[$oid]); + } + } + unset($this->pageobjects[$page]); if (isset($this->footerpos[$page])) { unset($this->footerpos[$page]); } @@ -25841,6 +26113,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->intmrk[$i] = $this->intmrk[$j]; $this->bordermrk[$i] = $this->bordermrk[$j]; $this->cntmrk[$i] = $this->cntmrk[$j]; + $this->pageobjects[$i] = $this->pageobjects[$j]; if (isset($this->footerpos[$j])) { $this->footerpos[$i] = $this->footerpos[$j]; } elseif (isset($this->footerpos[$i])) { @@ -25881,6 +26154,12 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: unset($this->intmrk[$this->numpages]); unset($this->bordermrk[$this->numpages]); unset($this->cntmrk[$this->numpages]); + foreach ($this->pageobjects[$this->numpages] as $oid) { + if (isset($this->offsets[$oid])){ + unset($this->offsets[$oid]); + } + } + unset($this->pageobjects[$this->numpages]); if (isset($this->footerpos[$this->numpages])) { unset($this->footerpos[$this->numpages]); } @@ -25982,6 +26261,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->intmrk[$this->page] = $this->intmrk[$page]; $this->bordermrk[$this->page] = $this->bordermrk[$page]; $this->cntmrk[$this->page] = $this->cntmrk[$page]; + $this->pageobjects[$this->page] = $this->pageobjects[$page]; $this->pageopen[$this->page] = false; if (isset($this->footerpos[$page])) { $this->footerpos[$this->page] = $this->footerpos[$page]; @@ -26007,7 +26287,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $tmpoutlines = $this->outlines; foreach ($tmpoutlines as $key => $outline) { if ($outline['p'] == $page) { - $this->outlines[] = array('t' => $outline['t'], 'l' => $outline['l'], 'y' => $outline['y'], 'p' => $this->page, 's' => $outline['s'], 'c' => $outline['c']); + $this->outlines[] = array('t' => $outline['t'], 'l' => $outline['l'], 'x' => $outline['x'], 'y' => $outline['y'], 'p' => $this->page, 's' => $outline['s'], 'c' => $outline['c']); } } // copy links @@ -26695,7 +26975,59 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } } $this->textrendermode = $textrendermode; - $this->textstrokewidth = $stroke * $this->k; + $this->textstrokewidth = $stroke; + } + + /** + * Set parameters for drop shadow effect for text. + * @param $params (array) Array of parameters: enabled (boolean) set to true to enable shadow; depth_w (float) shadow width in user units; depth_h (float) shadow height in user units; color (array) shadow color or false to use the stroke color; opacity (float) Alpha value: real value from 0 (transparent) to 1 (opaque); blend_mode (string) blend mode, one of the following: Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight, SoftLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity. + * @since 5.9.174 (2012-07-25) + * @public + */ + public function setTextShadow($params=array('enabled'=>false, 'depth_w'=>0, 'depth_h'=>0, 'color'=>false, 'opacity'=>1, 'blend_mode'=>'Normal')) { + if (isset($params['enabled'])) { + $this->txtshadow['enabled'] = $params['enabled']?true:false; + } else { + $this->txtshadow['enabled'] = false; + } + if (isset($params['depth_w'])) { + $this->txtshadow['depth_w'] = floatval($params['depth_w']); + } else { + $this->txtshadow['depth_w'] = 0; + } + if (isset($params['depth_h'])) { + $this->txtshadow['depth_h'] = floatval($params['depth_h']); + } else { + $this->txtshadow['depth_h'] = 0; + } + if (isset($params['color']) AND ($params['color'] !== false) AND is_array($params['color'])) { + $this->txtshadow['color'] = $params['color']; + } else { + $this->txtshadow['color'] = $this->strokecolor; + } + if (isset($params['opacity'])) { + $this->txtshadow['opacity'] = min(1, max(0, floatval($params['opacity']))); + } else { + $this->txtshadow['opacity'] = 1; + } + if (isset($params['blend_mode']) AND in_array($params['blend_mode'], array('Normal', 'Multiply', 'Screen', 'Overlay', 'Darken', 'Lighten', 'ColorDodge', 'ColorBurn', 'HardLight', 'SoftLight', 'Difference', 'Exclusion', 'Hue', 'Saturation', 'Color', 'Luminosity'))) { + $this->txtshadow['blend_mode'] = $params['blend_mode']; + } else { + $this->txtshadow['blend_mode'] = 'Normal'; + } + if ((($this->txtshadow['depth_w'] == 0) AND ($this->txtshadow['depth_h'] == 0)) OR ($this->txtshadow['opacity'] == 0)) { + $this->txtshadow['enabled'] = false; + } + } + + /** + * Return the text shadow parameters array. + * @return Array of parameters. + * @since 5.9.174 (2012-07-25) + * @public + */ + public function getTextShadow() { + return $this->txtshadow; } /** @@ -27337,7 +27669,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Get the amount to increase or decrease the space between characters in a text. - * @return int font spacing (tracking/kerning) value + * @return int font spacing (tracking) value * @author Nicola Asuni * @public * @since 5.9.000 (2010-09-29) @@ -27741,7 +28073,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // scale and translate $e = $ox * $this->k * (1 - $svgscale_x); $f = ($this->h - $oy) * $this->k * (1 - $svgscale_y); - $this->_out(sprintf('%F %F %F %F %F %F cm', $svgscale_x, 0, 0, $svgscale_y, $e + $svgoffset_x, $f + $svgoffset_y)); + $this->_out(sprintf('%F %F %F %F %F %F cm', $svgscale_x, 0, 0, $svgscale_y, ($e + $svgoffset_x), ($f + $svgoffset_y))); // creates a new XML parser to be used by the other XML functions $this->parser = xml_parser_create('UTF-8'); // the following function allows to use parser inside object @@ -28089,10 +28421,10 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $gradient['coords'][3] += $y; } // calculate percentages - $gradient['coords'][0] = ($gradient['coords'][0] - $x) / $w; - $gradient['coords'][1] = ($gradient['coords'][1] - $y) / $h; - $gradient['coords'][2] = ($gradient['coords'][2] - $x) / $w; - $gradient['coords'][3] = ($gradient['coords'][3] - $y) / $h; + $gradient['coords'][0] = (($gradient['coords'][0] - $x) / $w); + $gradient['coords'][1] = (($gradient['coords'][1] - $y) / $h); + $gradient['coords'][2] = (($gradient['coords'][2] - $x) / $w); + $gradient['coords'][3] = (($gradient['coords'][3] - $y) / $h); if (isset($gradient['coords'][4])) { $gradient['coords'][4] /= $w; } @@ -28121,9 +28453,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if ($gradient['type'] == 3) { // circular gradient $cy = $this->h - $y - ($gradient['coords'][1] * ($w + $h)); - $this->_out(sprintf('%F 0 0 %F %F %F cm', $w*$this->k, $w*$this->k, $x*$this->k, $cy*$this->k)); + $this->_out(sprintf('%F 0 0 %F %F %F cm', ($w * $this->k), ($w * $this->k), ($x * $this->k), ($cy * $this->k))); } else { - $this->_out(sprintf('%F 0 0 %F %F %F cm', $w*$this->k, $h*$this->k, $x*$this->k, ($this->h-($y+$h))*$this->k)); + $this->_out(sprintf('%F 0 0 %F %F %F cm', ($w * $this->k), ($h * $this->k), ($x * $this->k), (($this->h - ($y + $h)) * $this->k))); } if (count($gradient['stops']) > 1) { $this->Gradient($gradient['type'], $gradient['coords'], $gradient['stops'], array(), false); @@ -28331,6 +28663,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } else { $this->_outLine($x, $y); } + $x0 = $x; + $y0 = $y; } $xmin = min($xmin, $x); $ymin = min($ymin, $y); @@ -28352,6 +28686,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $y = $cp + $yoffset; if ((abs($x0 - $x) >= $minlen) OR (abs($y0 - $y) >= $minlen)) { $this->_outLine($x, $y); + $x0 = $x; + $y0 = $y; } $xmin = min($xmin, $x); $ymin = min($ymin, $y); @@ -28370,6 +28706,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $x = $cp + $xoffset; if ((abs($x0 - $x) >= $minlen) OR (abs($y0 - $y) >= $minlen)) { $this->_outLine($x, $y); + $x0 = $x; + $y0 = $y; } $xmin = min($xmin, $x); $xmax = max($xmax, $x); @@ -28384,6 +28722,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $y = $cp + $yoffset; if ((abs($x0 - $x) >= $minlen) OR (abs($y0 - $y) >= $minlen)) { $this->_outLine($x, $y); + $x0 = $x; + $y0 = $y; } $ymin = min($ymin, $y); $ymax = max($ymax, $y); @@ -28661,6 +29001,10 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // get styling properties $prev_svgstyle = $this->svgstyles[(count($this->svgstyles) - 1)]; // previous style $svgstyle = $this->svgstyles[0]; // set default style + if ($clipping AND !isset($attribs['fill']) AND (!isset($attribs['style']) OR (!preg_match('/[;\"\s]{1}fill[\s]*:[\s]*([^;\"]*)/si', $attribs['style'], $attrval)))) { + // default fill attribute for clipping + $attribs['fill'] = 'none'; + } if (isset($attribs['style']) AND !$this->empty_string($attribs['style'])) { // fix style for regular expression $attribs['style'] = ';'.$attribs['style']; @@ -28693,7 +29037,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if (!empty($ctm)) { $tm = $ctm; } else { - $tm = $this->svgstyles[(count($this->svgstyles) - 1)]['transfmatrix']; + //$tm = $this->svgstyles[(count($this->svgstyles) - 1)]['transfmatrix']; + $tm = array(1,0,0,1,0,0); } if (isset($attribs['transform']) AND !empty($attribs['transform'])) { $tm = $this->getTransformationMatrixProduct($tm, $this->getSVGTransformMatrix($attribs['transform'])); @@ -28732,6 +29077,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // group together related graphics elements array_push($this->svgstyles, $svgstyle); $this->StartTransform(); + $this->SVGTransform($tm); $this->setSVGStyles($svgstyle, $prev_svgstyle); break; } @@ -28752,15 +29098,19 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->svggradients[$this->svggradientid]['gradientUnits'] = 'objectBoundingBox'; } //$attribs['spreadMethod'] - $x1 = (isset($attribs['x1'])?$attribs['x1']:'0%'); - $y1 = (isset($attribs['y1'])?$attribs['y1']:'0%'); - $x2 = (isset($attribs['x2'])?$attribs['x2']:'100%'); - $y2 = (isset($attribs['y2'])?$attribs['y2']:'0%'); - if (substr($x1, -1) != '%') { - $this->svggradients[$this->svggradientid]['mode'] = 'measure'; - } else { + if (((!isset($attribs['x1'])) AND (!isset($attribs['y1'])) AND (!isset($attribs['x2'])) AND (!isset($attribs['y2']))) + OR ((isset($attribs['x1']) AND (substr($attribs['x1'], -1) == '%')) + OR (isset($attribs['y1']) AND (substr($attribs['y1'], -1) == '%')) + OR (isset($attribs['x2']) AND (substr($attribs['x2'], -1) == '%')) + OR (isset($attribs['y2']) AND (substr($attribs['y2'], -1) == '%')))) { $this->svggradients[$this->svggradientid]['mode'] = 'percentage'; + } else { + $this->svggradients[$this->svggradientid]['mode'] = 'measure'; } + $x1 = (isset($attribs['x1'])?$attribs['x1']:'0'); + $y1 = (isset($attribs['y1'])?$attribs['y1']:'0'); + $x2 = (isset($attribs['x2'])?$attribs['x2']:'100'); + $y2 = (isset($attribs['y2'])?$attribs['y2']:'0'); if (isset($attribs['gradientTransform'])) { $this->svggradients[$this->svggradientid]['gradientTransform'] = $this->getSVGTransformMatrix($attribs['gradientTransform']); } @@ -28788,16 +29138,18 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->svggradients[$this->svggradientid]['gradientUnits'] = 'objectBoundingBox'; } //$attribs['spreadMethod'] - $cx = (isset($attribs['cx'])?$attribs['cx']:0.5); - $cy = (isset($attribs['cy'])?$attribs['cy']:0.5); - $fx = (isset($attribs['fx'])?$attribs['fx']:$cx); - $fy = (isset($attribs['fy'])?$attribs['fy']:$cy); - $r = (isset($attribs['r'])?$attribs['r']:0.5); - if (isset($attribs['cx']) AND (substr($attribs['cx'], -1) != '%')) { - $this->svggradients[$this->svggradientid]['mode'] = 'measure'; - } else { + if (((!isset($attribs['cx'])) AND (!isset($attribs['cy']))) + OR ((isset($attribs['cx']) AND (substr($attribs['cx'], -1) == '%')) + OR (isset($attribs['cy']) AND (substr($attribs['cy'], -1) == '%')) )) { $this->svggradients[$this->svggradientid]['mode'] = 'percentage'; + } else { + $this->svggradients[$this->svggradientid]['mode'] = 'measure'; } + $cx = (isset($attribs['cx']) ? $attribs['cx'] : 0.5); + $cy = (isset($attribs['cy']) ? $attribs['cy'] : 0.5); + $fx = (isset($attribs['fx']) ? $attribs['fx'] : $cx); + $fy = (isset($attribs['fy']) ? $attribs['fy'] : $cy); + $r = (isset($attribs['r']) ? $attribs['r'] : 0.5); if (isset($attribs['gradientTransform'])) { $this->svggradients[$this->svggradientid]['gradientTransform'] = $this->getSVGTransformMatrix($attribs['gradientTransform']); } @@ -28876,12 +29228,12 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if ($invisible) { break; } - $cx = (isset($attribs['cx'])?$this->getHTMLUnitToUnits($attribs['cx'], 0, $this->svgunit, false):0); - $cy = (isset($attribs['cy'])?$this->getHTMLUnitToUnits($attribs['cy'], 0, $this->svgunit, false):0); - $r = (isset($attribs['r'])?$this->getHTMLUnitToUnits($attribs['r'], 0, $this->svgunit, false):0); - $x = $cx - $r; - $y = $cy - $r; - $w = 2 * $r; + $r = (isset($attribs['r']) ? $this->getHTMLUnitToUnits($attribs['r'], 0, $this->svgunit, false) : 0); + $cx = (isset($attribs['cx']) ? $this->getHTMLUnitToUnits($attribs['cx'], 0, $this->svgunit, false) : (isset($attribs['x']) ? $this->getHTMLUnitToUnits($attribs['x'], 0, $this->svgunit, false) : 0)); + $cy = (isset($attribs['cy']) ? $this->getHTMLUnitToUnits($attribs['cy'], 0, $this->svgunit, false) : (isset($attribs['y']) ? $this->getHTMLUnitToUnits($attribs['y'], 0, $this->svgunit, false) : 0)); + $x = ($cx - $r); + $y = ($cy - $r); + $w = (2 * $r); $h = $w; if ($clipping) { $this->SVGTransform($tm); @@ -28901,14 +29253,14 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if ($invisible) { break; } - $cx = (isset($attribs['cx'])?$this->getHTMLUnitToUnits($attribs['cx'], 0, $this->svgunit, false):0); - $cy = (isset($attribs['cy'])?$this->getHTMLUnitToUnits($attribs['cy'], 0, $this->svgunit, false):0); - $rx = (isset($attribs['rx'])?$this->getHTMLUnitToUnits($attribs['rx'], 0, $this->svgunit, false):0); - $ry = (isset($attribs['ry'])?$this->getHTMLUnitToUnits($attribs['ry'], 0, $this->svgunit, false):0); - $x = $cx - $rx; - $y = $cy - $ry; - $w = 2 * $rx; - $h = 2 * $ry; + $rx = (isset($attribs['rx']) ? $this->getHTMLUnitToUnits($attribs['rx'], 0, $this->svgunit, false) : 0); + $ry = (isset($attribs['ry']) ? $this->getHTMLUnitToUnits($attribs['ry'], 0, $this->svgunit, false) : 0); + $cx = (isset($attribs['cx']) ? $this->getHTMLUnitToUnits($attribs['cx'], 0, $this->svgunit, false) : (isset($attribs['x']) ? $this->getHTMLUnitToUnits($attribs['x'], 0, $this->svgunit, false) : 0)); + $cy = (isset($attribs['cy']) ? $this->getHTMLUnitToUnits($attribs['cy'], 0, $this->svgunit, false) : (isset($attribs['y']) ? $this->getHTMLUnitToUnits($attribs['y'], 0, $this->svgunit, false) : 0)); + $x = ($cx - $rx); + $y = ($cy - $ry); + $w = (2 * $rx); + $h = (2 * $ry); if ($clipping) { $this->SVGTransform($tm); $this->Ellipse($cx, $cy, $rx, $ry, 0, 0, 360, 'CNZ', array(), array(), 8); @@ -28981,7 +29333,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->StartTransform(); $this->SVGTransform($tm); $obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, $x, $y, $w, $h, 'PolyLine', array($p, 'CNZ')); - $this->PolyLine($p, 'D', array(), array()); + if (!empty($obstyle)) { + $this->PolyLine($p, $obstyle, array(), array()); + } $this->StopTransform(); } else { // polygon if ($clipping) { @@ -29050,14 +29404,26 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // text case 'text': case 'tspan': { + // only basic support - advanced features must be implemented $this->svgtextmode['invisible'] = $invisible; if ($invisible) { break; } array_push($this->svgstyles, $svgstyle); - // only basic support - advanced features must be implemented - $x = (isset($attribs['x'])?$this->getHTMLUnitToUnits($attribs['x'], 0, $this->svgunit, false):$this->x); - $y = (isset($attribs['y'])?$this->getHTMLUnitToUnits($attribs['y'], 0, $this->svgunit, false):$this->y); + if (isset($attribs['x'])) { + $x = $this->getHTMLUnitToUnits($attribs['x'], 0, $this->svgunit, false); + } elseif ($name == 'tspan') { + $x = $this->x; + } else { + $x = 0; + } + if (isset($attribs['y'])) { + $y = $this->getHTMLUnitToUnits($attribs['y'], 0, $this->svgunit, false); + } elseif ($name == 'tspan') { + $y = $this->y; + } else { + $y = 0; + } $svgstyle['text-color'] = $svgstyle['fill']; $this->svgtext = ''; if (isset($svgstyle['text-anchor'])) { @@ -29088,16 +29454,19 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } // use case 'use': { - if (isset($attribs['xlink:href'])) { - $use = $this->svgdefs[substr($attribs['xlink:href'], 1)]; - if (isset($attribs['xlink:href'])) { - unset($attribs['xlink:href']); + if (isset($attribs['xlink:href']) AND !empty($attribs['xlink:href'])) { + $svgdefid = substr($attribs['xlink:href'], 1); + if (isset($this->svgdefs[$svgdefid])) { + $use = $this->svgdefs[$svgdefid]; + if (isset($attribs['xlink:href'])) { + unset($attribs['xlink:href']); + } + if (isset($attribs['id'])) { + unset($attribs['id']); + } + $attribs = array_merge($attribs, $use['attribs']); + $this->startSVGElementHandler($parser, $use['name'], $attribs); } - if (isset($attribs['id'])) { - unset($attribs['id']); - } - $attribs = array_merge($use['attribs'], $attribs); - $this->startSVGElementHandler($parser, $use['name'], $use['attribs']); } break; } @@ -29162,7 +29531,17 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $textrendermode = $this->textrendermode; $textstrokewidth = $this->textstrokewidth; $this->setTextRenderingMode($this->svgtextmode['stroke'], true, false); + if ($name == 'text') { + // store current coordinates + $tmpx = $this->x; + $tmpy = $this->y; + } $this->Cell($textlen, 0, $text, 0, 0, '', false, '', 0, false, 'L', 'T'); + if ($name == 'text') { + // restore coordinates + $this->x = $tmpx; + $this->y = $tmpy; + } // restore previous rendering mode $this->textrendermode = $textrendermode; $this->textstrokewidth = $textstrokewidth; diff --git a/htdocs/includes/tcpdf/tcpdf_parser.php b/htdocs/includes/tcpdf/tcpdf_parser.php index 122676034d3..f17359f2134 100644 --- a/htdocs/includes/tcpdf/tcpdf_parser.php +++ b/htdocs/includes/tcpdf/tcpdf_parser.php @@ -1,9 +1,9 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 1.0.000 + * @version 1.0.001 */ // include class for decoding filters @@ -48,7 +48,7 @@ require_once(dirname(__FILE__).'/tcpdf_filters.php'); * This is a PHP class for parsing PDF documents.
    * @package com.tecnick.tcpdf * @brief This is a PHP class for parsing PDF documents.. - * @version 1.0.000 + * @version 1.0.001 * @author Nicola Asuni - info@tecnick.com */ class TCPDF_PARSER { @@ -127,20 +127,29 @@ class TCPDF_PARSER { * @since 1.0.000 (2011-05-24) */ protected function getXrefData($offset=0, $xref=array()) { - // find last startxref - if (preg_match_all('/[\r\n]startxref[\s]*[\r\n]+([0-9]+)[\s]*[\r\n]+%%EOF/i', $this->pdfdata, $matches, PREG_SET_ORDER, $offset) == 0) { - $this->Error('Unable to find startxref'); + if ($offset == 0) { + // find last startxref + if (preg_match_all('/[\r\n]startxref[\s]*[\r\n]+([0-9]+)[\s]*[\r\n]+%%EOF/i', $this->pdfdata, $matches, PREG_SET_ORDER, $offset) == 0) { + $this->Error('Unable to find startxref'); + } + $matches = array_pop($matches); + $startxref = $matches[1]; + } else { + // get the first xref at the specified offset + if (preg_match('/[\r\n]startxref[\s]*[\r\n]+([0-9]+)[\s]*[\r\n]+%%EOF/i', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset) == 0) { + $this->Error('Unable to find startxref'); + } + $startxref = $matches[1][0]; } - $matches = array_pop($matches); - $startxref = $matches[1]; // check xref position if (strpos($this->pdfdata, 'xref', $startxref) != $startxref) { $this->Error('Unable to find xref'); } // extract xref data (object indexes and offsets) - $offset = $startxref + 5; + $xoffset = $startxref + 5; // initialize object number $obj_num = 0; + $offset = $xoffset; while (preg_match('/^([0-9]+)[\s]([0-9]+)[\s]?([nf]?)/im', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset) > 0) { $offset = (strlen($matches[0][0]) + $matches[0][1]); if ($matches[3][0] == 'n') { @@ -162,7 +171,7 @@ class TCPDF_PARSER { } } // get trailer data - if (preg_match('/trailer[\s]*<<(.*)>>[\s]*[\r\n]+startxref[\s]*[\r\n]+/isU', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset) > 0) { + if (preg_match('/trailer[\s]*<<(.*)>>[\s]*[\r\n]+startxref[\s]*[\r\n]+/isU', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $xoffset) > 0) { $trailer_data = $matches[1][0]; if (!isset($xref['trailer'])) { // get only the last updated version @@ -188,7 +197,7 @@ class TCPDF_PARSER { } if (preg_match('/Prev[\s]+([0-9]+)/i', $trailer_data, $matches) > 0) { // get previous xref - $xref = getXrefData(substr($this->pdfdata, 0, $startxref), intval($matches[1]), $xref); + $xref = $this->getXrefData(intval($matches[1]), $xref); } } else { $this->Error('Unable to find trailer'); @@ -399,7 +408,7 @@ class TCPDF_PARSER { $offset = $element[2]; // decode stream using stream's dictionary information if ($decoding AND ($element[0] == 'stream') AND (isset($objdata[($i - 1)][0])) AND ($objdata[($i - 1)][0] == '<<')) { - $element[3] = $this->decodeStream($objdata[($i - 1)][1], $element[1]); + $element[3] = $this->decodeStream($objdata[($i - 1)][1], substr($element[1], 1)); } $objdata[$i] = $element; ++$i; From 5f326178434f722c50f9bd1be727b04f3b70896c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 29 Aug 2012 10:14:40 +0200 Subject: [PATCH 14/26] Fix: restore dolibarr parameters --- htdocs/includes/tcpdf/config/tcpdf_config.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/includes/tcpdf/config/tcpdf_config.php b/htdocs/includes/tcpdf/config/tcpdf_config.php index e3b3e4a5f8e..2396ea7e260 100644 --- a/htdocs/includes/tcpdf/config/tcpdf_config.php +++ b/htdocs/includes/tcpdf/config/tcpdf_config.php @@ -91,12 +91,16 @@ if (!defined('K_TCPDF_EXTERNAL_CONFIG')) { /** * cache directory for temporary files (full path) */ - define ('K_PATH_CACHE', K_PATH_MAIN.'cache/'); +// define ('K_PATH_CACHE', K_PATH_MAIN.'cache/'); + define ('K_PATH_CACHE', DOL_DATA_ROOT.'/admin/temp/'); + dol_mkdir(K_PATH_CACHE); /** * cache directory for temporary files (url path) */ - define ('K_PATH_URL_CACHE', K_PATH_URL.'cache/'); +// define ('K_PATH_URL_CACHE', K_PATH_URL.'cache/'); + define ('K_PATH_URL_CACHE', DOL_DATA_ROOT.'/admin/temp/'); + dol_mkdir(K_PATH_URL_CACHE); /** *images directory From 07aae3200f623417673580880b5ecd8daab8447f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Aug 2012 10:21:25 +0200 Subject: [PATCH 15/26] Fix: Test on ref and ref_ext into webservice --- htdocs/user/class/user.class.php | 2 ++ htdocs/webservices/server_user.php | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 087b9fbc1b4..c8b6556a374 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -41,6 +41,8 @@ class User extends CommonObject protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $id=0; + var $ref; + var $ref_ext; var $ldap_sid; var $search_sid; var $nom; // TODO deprecated diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index d9a853f4d8a..462929a06c7 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -180,7 +180,10 @@ function getUser($authentication,$id,$ref='',$ref_ext='') { $fuser->getrights(); - if ($fuser->rights->user->user->lire || ($fuser->rights->user->self->creer && $fuser->id = $id)) + if ($fuser->rights->user->user->lire + || ($fuser->rights->user->self->creer && $id && $id=$fuser->id) + || ($fuser->rights->user->self->creer && $ref && $ref=$fuser->login) + || ($fuser->rights->user->self->creer && $ref_ext && $ref_ext=$fuser->ref_ext)) { $user=new User($db); $result=$user->fetch($id,$ref,$ref_ext); From 6bdba9fa7265bf10ad653397a866405a6abd6d0b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 29 Aug 2012 11:55:53 +0200 Subject: [PATCH 16/26] Fix: get the good vat rates --- htdocs/core/ajax/vatrates.php | 14 ++++++- htdocs/core/tpl/objectline_add.tpl.php | 54 ++++++++++++++------------ 2 files changed, 42 insertions(+), 26 deletions(-) diff --git a/htdocs/core/ajax/vatrates.php b/htdocs/core/ajax/vatrates.php index 6572bd883f1..42ae0d3e670 100644 --- a/htdocs/core/ajax/vatrates.php +++ b/htdocs/core/ajax/vatrates.php @@ -32,6 +32,7 @@ require '../../main.inc.php'; $id = GETPOST('id','int'); $action = GETPOST('action','alpha'); $htmlname = GETPOST('htmlname','alpha'); +$selected = (GETPOST('selected')?GETPOST('selected'):'-1'); $productid = (GETPOST('productid','int')?GETPOST('productid','int'):0); /* @@ -50,9 +51,20 @@ if (! empty($id) && ! empty($action) && ! empty($htmlname)) $soc->fetch($id); + if ($action == 'getSellerVATRates') + { + $seller = $mysoc; + $buyer = $soc; + } + else + { + $buyer = $mysoc; + $seller = $soc; + } + $return=array(); - $return['value'] = $form->load_tva('tva_tx','',$soc,$mysoc,$productid,0,'',true); + $return['value'] = $form->load_tva('tva_tx',$selected,$seller,$buyer,$productid,0,'',true); $return['num'] = $form->num; $return['error'] = $form->error; diff --git a/htdocs/core/tpl/objectline_add.tpl.php b/htdocs/core/tpl/objectline_add.tpl.php index 203ea15931f..9b6b9e64b0f 100644 --- a/htdocs/core/tpl/objectline_add.tpl.php +++ b/htdocs/core/tpl/objectline_add.tpl.php @@ -78,7 +78,7 @@ if (! empty($conf->margin->enabled)) { 'origin_desc_cache' => 'desc', 'price_base_type' => 'pricebasetype', 'price_ht' => 'price_ht', - 'origin_price_ht_cache' => 'price_ht', + 'origin_price_ht_cache' => 'price_ht' //'price_ttc' => 'price_ttc', //'origin_price_ttc_cache' => 'price_ttc' ), @@ -230,16 +230,7 @@ $(document).ready(function() { } // Update vat rate combobox - $.post('/core/ajax/vatrates.php', { - 'action': 'getVATRate', - 'id': id; ?>, - 'productid': $(this).val(), - 'htmlname': 'tva_tx' }, - function(data) { - if (typeof data != 'undefined' && data.error == null) { - $("#tva_tx").html(data.value); - } - }, 'json'); + getVATRates('getSellerVATRates', 'tva_tx', $(this).val()); // For compatibility with combobox global->PRODUIT_USE_SEARCH_TO_SELECT)) { ?> @@ -256,6 +247,7 @@ $(document).ready(function() { $('#price_base_type').val(data.pricebasetype); $('#price_ht').val(data.price_ht).trigger('change'); $('#origin_price_ht_cache').val(data.price_ht); + //$('#origin_price_ttc_cache').val(data.price_ttc); $('#select_type').val(data.type).attr('disabled','disabled').trigger('change'); $('#update_label_area').show().trigger('show'); $('#update_desc_area').show().trigger('show'); @@ -270,16 +262,8 @@ $(document).ready(function() { $('#update_price_checkbox').removeAttr('checked'); $('#price_ttc').val(''); - // Update vat rate combobox - $.post('/core/ajax/vatrates.php', { - 'action': 'getVATRate', - 'id': id; ?>, - 'htmlname': 'tva_tx' }, - function(data) { - if (typeof data != 'undefined' && data.error == null) { - $("#tva_tx").html(data.value); - } - }, 'json'); + // Restore vat rate combobox + getVATRates('getSellerVATRates', 'tva_tx'); // For compatibility with combobox global->PRODUIT_USE_SEARCH_TO_SELECT)) { ?> @@ -290,6 +274,7 @@ $(document).ready(function() { $('#origin_desc_cache').val(''); $('#price_ht').val('').trigger('change'); $('#origin_price_ht_cache').val(''); + //$('#origin_price_ttc_cache').val(''); $('#price_base_type').val(''); $('#update_label_area').hide().trigger('hide'); $('#update_desc_area').hide().trigger('hide'); @@ -385,12 +370,17 @@ $(document).ready(function() { } $('#tva_tx').removeAttr('disabled'); } else { + // Restore vat rate combobox + getVATRates('getSellerVATRates', 'tva_tx'); + $('#tva_tx').attr('disabled', 'disabled'); + // Restore price_ht origin $('#price_ht') .attr('disabled','disabled') - .val($('#origin_price_ht_cache').val()) - .trigger('change'); - $('#price_ttc').attr('disabled','disabled'); - $('#tva_tx').attr('disabled', 'disabled'); + .val($('#origin_price_ht_cache').val()); + // Restore price_ttc origin + $('#price_ttc') + .attr('disabled','disabled') + .val($('#origin_price_ttc_cache').val()); } }); @@ -528,6 +518,20 @@ $(document).ready(function() { }, 'json'); } + function getVATRates(action, htmlname, idprod) { + var productid = (idprod?idprod:0); + $.post('/core/ajax/vatrates.php', { + 'action': action, + 'id': id; ?>, + 'productid': productid, + 'htmlname': htmlname }, + function(data) { + if (typeof data != 'undefined' && data.error == null) { + $("#" + htmlname).html(data.value); + } + }, 'json'); + } + // Check if decription is not empty for free line fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) { ?> CKEDITOR.on('instanceReady', function() { From 28d8431159c7a5901b7633c3e20af88736dab871 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Aug 2012 12:39:40 +0200 Subject: [PATCH 17/26] Fix: Packaging for 3.2.1 of zip --- build/makepack-dolibarr.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index bff952cd317..28708ddec73 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -412,7 +412,7 @@ if ($nboftargetok) { print "Go to directory $BUILDROOT\n"; $olddir=getcwd(); chdir("$BUILDROOT"); - $cmd= "7z a -r -tzip -xr\@\"$BUILDROOT\/$FILENAMEZIP\/build\/zip\/zip_exclude.txt\" -mx $BUILDROOT/$FILENAMEZIP.zip $FILENAMEZIP\\*"; + $cmd= "7z a -r -tzip -xr\@\"$BUILDROOT\/$FILENAMEZIP\/build\/zip\/zip_exclude.txt\" -mx $BUILDROOT/$FILENAMEZIP.zip $FILENAMEZIP\/*"; print $cmd."\n"; $ret= `$cmd`; chdir("$olddir"); From 87742cb3d8b539a6403d57dc6836afb05143a468 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Aug 2012 14:13:13 +0200 Subject: [PATCH 18/26] Qual: Move an admin tools into admin menu. Fix: Fix 7 bugs into the mass vat update tool. --- htdocs/core/lib/product.lib.php | 8 -- htdocs/core/menus/standard/eldy.lib.php | 12 ++- htdocs/langs/en_US/admin.lang | 7 ++ htdocs/langs/en_US/errors.lang | 1 + htdocs/langs/en_US/main.lang | 2 + htdocs/langs/fr_FR/admin.lang | 7 ++ htdocs/langs/fr_FR/errors.lang | 1 + htdocs/langs/fr_FR/main.lang | 2 + htdocs/product/admin/product_tools.php | 97 ++++++++++++++----------- 9 files changed, 85 insertions(+), 52 deletions(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index eb2de353ca9..c78fb19af09 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -153,14 +153,6 @@ function product_admin_prepare_head($object=null) $head[$h][2] = 'general'; $h++; - if ($conf->global->MAIN_FEATURES_LEVEL > 1) // Link to page to make mass editing of products vat - { - $head[$h][0] = DOL_URL_ROOT.'/product/admin/product_tools.php'; - $head[$h][1] = $langs->trans("Tools"); - $head[$h][2] = 'tools'; - $h++; - } - // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index e0921df9638..14464ab77f9 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -702,7 +702,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) $newmenu->add('/admin/system/database-tables.php?mainmenu=home', $langs->trans('Tables'), 2); $newmenu->add('/admin/system/database-tables-contraintes.php?mainmenu=home', $langs->trans('Constraints'), 2); } - // System info + // Admin tools $newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=admintools", $langs->trans("SystemTools"), 0, 1, '', $mainmenu, 'admintools'); if ($leftmenu=="admintools") { @@ -715,6 +715,16 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) $newmenu->add("/admin/tools/purge.php?mainmenu=home", $langs->trans("Purge"),1); $newmenu->add("/support/index.php?mainmenu=home", $langs->trans("HelpCenter"),1,1,'targethelp'); } + // Modules system tools + if (($conf->global->MAIN_FEATURES_LEVEL >= 1) && ! empty($conf->product->enabled) || ! empty($conf->service->enabled)) + { + $langs->load("products"); + $newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=modulesadmintools", $langs->trans("ModulesSystemTools"), 0, 1, '', $mainmenu, 'modulesadmintools'); + if ($leftmenu=="modulesadmintools") + { + $newmenu->add("/product/admin/product_tools.php?mainmenu=home&leftmenu=modulesadmintools",$langs->trans("ProductVatMassChange"),1); + } + } } $newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, 1, '', $mainmenu, 'users'); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 53aa67bb881..c22863729bb 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -332,6 +332,13 @@ SecurityTokenIsUnique=Use a unique securekey parameter for each URL EnterRefToBuildUrl=Enter reference for object %s GetSecuredUrl=Get calculated URL ButtonHideUnauthorized=Hide buttons for unauthorized actions instead of showing disabled buttons +ModulesSystemTools=Modules tools +ProductVatMassChange=Mass VAT change +ProductVatMassChangeDesc=This page can be used to modify a VAT rate defined on products or services from a value to another. Warning, this change is done on all database. +OldVATRates=Old VAT rate +NewVATRates=New VAT rate +PriceBaseTypeToChange=Modify on prices with base reference value defined on +MassConvert=Launch mass convert # Modules Module0Name=Users & groups diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 6b9885eb4cb..a1f45f4ca1f 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -110,6 +110,7 @@ ErrorFileMustBeADolibarrPackage=The file %s must be a Dolibarr zip package ErrorFileRequired=It takes a package Dolibarr file ErrorPhpCurlNotInstalled=The PHP CURL is not installed, this is essential to talk with Paypal ErrorFailedToAddToMailmanList=Failed to add record to Mailman list or SPIP base +ErrorNewVaueCantMatchOldValue=New value can't be equal to old one # Warnings WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 3a40db19912..ff2318bc184 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -15,6 +15,7 @@ FormatDateHourTextShort=%b %d, %Y, %I:%M %p FormatDateHourText=%B %d, %Y, %I:%M %p DatabaseConnection=Database connection NoTranslation=No translation +NoRecordFound=Aucun enregistrement trouvé NoError=No error Error=Error ErrorFieldRequired=Field '%s' is required @@ -530,6 +531,7 @@ GoBack=Go back CanBeModifiedIfOk=Can be modified if valid CanBeModifiedIfKo=Can be modified if not valid RecordModifiedSuccessfully=Record modified successfully +RecordsModified=%s records modified AutomaticCode=Automatic code NotManaged=Not managed FeatureDisabled=Feature disabled diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 00c0082e1c7..4f7be5890d8 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -334,6 +334,13 @@ GetSecuredUrl=Obtenir l'URL calculée ButtonHideUnauthorized=Cacher les boutons non autorisés (au lieu de les voir grisés) TotalNumberOfActivatedModules=Nombre total de modules fonctionnels activés: %s YouMustEnableOneModule=Vous devez activer au moins une fonctionnalité +ModulesSystemTools=Outils Modules +ProductVatMassChange=Modif TVA en masse +ProductVatMassChangeDesc=Cette page permet de modifier les taux de TVA définis sur les produits ou services d'une valeur vers une autre. Attention, la modification est réalisée en masse sur toute la base de donnée. +OldVATRates=Ancien taux de TVA +NewVATRates=Nouveau taux de TVA +PriceBaseTypeToChange=Modifier sur les prix dont la référence de base est le +MassConvert=Convertir en masse # Modules= undefined Module0Name= Utilisateurs & groupes diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index f14b4b22a30..6f4a790a6d6 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -111,6 +111,7 @@ ErrorFileMustBeADolibarrPackage=Le fichier doit être un package Dolibarr ErrorFileRequired=Il faut un fichier de package Dolibarr ErrorPhpCurlNotInstalled=L'extension PHP CURL n'est pas installée, ceci est indispensable pour dialoguer avec Paypal. ErrorFailedToAddToMailmanList=Echec de l'ajout à une liste Mailman ou base SPIP +ErrorNewVaueCantMatchOldValue=La nouvelle valeur ne peut être égale à l'ancienne # Warnings WarningMandatorySetupNotComplete=Les informations de configuration obligatoire doivent être renseignées diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 5236417cd85..198b7468028 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -15,6 +15,7 @@ FormatDateHourTextShort=%d %b %Y %H:%M FormatDateHourText=%d %B %Y %H:%M DatabaseConnection=Connexion à la base NoTranslation=Pas de traduction +NoRecordFound=Aucun enregistrement trouvé NoError=Aucune erreur Error=Erreur ErrorFieldRequired=Le champ '%s' est obligatoire @@ -532,6 +533,7 @@ GoBack=Retour arrière CanBeModifiedIfOk=Peut être modifié si valide CanBeModifiedIfKo=Peut être modifié si invalide RecordModifiedSuccessfully=Enregistrement modifié avec succès +RecordsModified=%s enregistrements modifiés AutomaticCode=Création automatique du code NotManaged=Non géré FeatureDisabled=Fonction désactivée diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index dd8066cebed..cec370c1e2c 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -21,8 +21,8 @@ * \brief Setup page of product module */ -// TODO We must add a sentence to explain goal of page // TODO We must add a confirmation on button because this will make a mass change +// TODO Should also change table product_price for price levels require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; @@ -38,7 +38,10 @@ if (! $user->admin) accessforbidden(); $action = GETPOST('action','alpha'); $oldvatrate=GETPOST('oldvatrate'); $newvatrate=GETPOST('newvatrate'); -$price_base_type=GETPOST('price_base_type'); +//$price_base_type=GETPOST('price_base_type'); + +$objectstatic = new Product($db); + /* * Actions @@ -48,53 +51,73 @@ if ($action == 'convert') { $error=0; - $db->begin(); - - $sql = 'SELECT rowid'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'product'; - $sql.= ' WHERE entity IN ('.getEntity('product',1).')'; - $sql.= ' AND tva_tx = "'.$oldvatrate.'"'; - - $resql=$db->query($sql); - if ($resql) + if ($oldvatrate == $newvatrate) { - $num = $db->num_rows($resql); - if ($num) + $langs->load("errors"); + setEventMessage($langs->trans("ErrorNewVaueCantMatchOldValue"),'errors'); + $error++; + } + + if (! $error) + { + $db->begin(); + + $sql = 'SELECT rowid'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'product'; + $sql.= ' WHERE entity IN ('.getEntity('product',1).')'; + $sql.= " AND tva_tx = '".$db->escape($oldvatrate)."'"; + //$sql.= ' AND price_base_type = "'..'"'; + //print $sql; + + $resql=$db->query($sql); + if ($resql) { - $i = 0; + $num = $db->num_rows($resql); + + $i = 0; $nbrecordsmodified=0; while ($i < $num) { $obj = $db->fetch_object($resql); - $object = new Product($db); - - $ret=$object->fetch($obj->rowid); - if ($ret) + $ret=$objectstatic->fetch($obj->rowid); + if ($ret > 0) { + $price_base_type = $objectstatic->price_base_type; // Get price_base_type of product/service to keep the same for update if ($price_base_type == 'TTC') { - $newprice=price2num($object->price_ttc,'MU'); // Second param must be MU (we want a unit price so 'MT'. If unit price was on 4 decimal, we must keep 4 decimals) + $newprice=price2num($objectstatic->price_ttc,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + $newminprice=$objectstatic->price_min_ttc; } else { - $newprice=price2num($object->price,'MU'); // Second param must be MU (we want a unit price so 'MT'. If unit price was on 4 decimal, we must keep 4 decimals) + $newprice=price2num($objectstatic->price,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + $newminprice=$objectstatic->price_min; } - + if ($newminprice > $newprice) $newminprice=$newprice; $newvat=str_replace('*','',$newvatrate); + $newnpr=$objectstatic->recuperableonly; + $newlevel=0; - $ret=$object->updatePrice($object->id, $newprice, $price_base_type, $user, $newvat); + $ret=$objectstatic->updatePrice($objectstatic->id, $newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); if ($ret < 0) $error++; + else $nbrecordsmodified++; + + // FIXME Now update all price levels. Call $objectstatic->updatePrice( as many times than exisitng price_level + } - $i++; + $i++; } if (! $error) { + if ($nbrecordsmodified > 0) setEventMessage($langs->trans("RecordsModified",$nbrecordsmodified)); + else setEventMessage($langs->trans("NoRecordFound"),'warnings'); $db->commit(); } else { + setEventMessage($langs->trans("Error"),'errors'); $db->rollback(); } } @@ -105,26 +128,13 @@ if ($action == 'convert') * View */ -$title = $langs->trans('ProductServiceSetup'); -$tab = $langs->trans("ProductsAndServices"); -if (empty($conf->produit->enabled)) -{ - $title = $langs->trans('ServiceSetup'); - $tab = $langs->trans('Services'); -} -else if (empty($conf->service->enabled)) -{ - $title = $langs->trans('ProductSetup'); - $tab = $langs->trans('Products'); -} +$title = $langs->trans('ModulesSystemTools'); llxHeader('',$title); -$linkback=''.$langs->trans("BackToModuleList").''; -print_fiche_titre($title,$linkback,'setup'); +print_fiche_titre($title,'','setup'); -$head = product_admin_prepare_head(); -dol_fiche_head($head, 'tools', $tab, 0, 'product'); +print $langs->trans("ProductVatMassChangeDesc").'

    '; $form=new Form($db); $var=true; @@ -155,28 +165,29 @@ print $form->load_tva('newvatrate', $newvatrate); print ''."\n"; print '
    '."\n"; +/* $var=!$var; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''."\n"; +*/ print '
    tva_assuj == "0") echo '0'; + if ($buyer->tva_assuj == "0") echo '0'; else echo $form->load_tva('tva_tx', (GETPOST('tva_tx')?GETPOST('tva_tx'):-1), $seller, $buyer); ?> @@ -229,6 +229,18 @@ $(document).ready(function() { $('#product_desc').focus(); } + // Update vat rate combobox + $.post('/core/ajax/vatrates.php', { + 'action': 'getVATRate', + 'id': id; ?>, + 'productid': $(this).val(), + 'htmlname': 'tva_tx' }, + function(data) { + if (typeof data != 'undefined' && data.error == null) { + $("#tva_tx").html(data.value); + } + }, 'json'); + // For compatibility with combobox global->PRODUIT_USE_SEARCH_TO_SELECT)) { ?> $.post('/product/ajax/products.php', { @@ -258,6 +270,17 @@ $(document).ready(function() { $('#update_price_checkbox').removeAttr('checked'); $('#price_ttc').val(''); + // Update vat rate combobox + $.post('/core/ajax/vatrates.php', { + 'action': 'getVATRate', + 'id': id; ?>, + 'htmlname': 'tva_tx' }, + function(data) { + if (typeof data != 'undefined' && data.error == null) { + $("#tva_tx").html(data.value); + } + }, 'json'); + // For compatibility with combobox global->PRODUIT_USE_SEARCH_TO_SELECT)) { ?> $('#select_type').val('').removeAttr('disabled').trigger('change'); @@ -272,7 +295,6 @@ $(document).ready(function() { $('#update_desc_area').hide().trigger('hide'); $('#update_price_area').hide().trigger('hide'); - } }); @@ -346,11 +368,13 @@ $(document).ready(function() { $('#update_price_area').bind('hide', function() { $('#price_ht').removeAttr('disabled'); $('#price_ttc').removeAttr('disabled'); + $('#tva_tx').removeAttr('disabled'); }); $('#update_price_area').bind('show', function() { $('#price_ht').attr('disabled', 'disabled'); $('#price_ttc').attr('disabled', 'disabled'); + $('#tva_tx').attr('disabled', 'disabled'); }); $('#update_price_checkbox').change(function() { @@ -359,15 +383,14 @@ $(document).ready(function() { if ($('#tva_tx').val() > 0) { $('#price_ttc').removeAttr('disabled') } + $('#tva_tx').removeAttr('disabled'); } else { $('#price_ht') .attr('disabled','disabled') .val($('#origin_price_ht_cache').val()) .trigger('change'); - $('#price_ttc') - .attr('disabled','disabled'); - //.val($('#origin_price_ttc_cache').val()) - //.trigger('change'); + $('#price_ttc').attr('disabled','disabled'); + $('#tva_tx').attr('disabled', 'disabled'); } }); From 89692fb79e8d4d733dd764a196ed3140fce26292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Wed, 29 Aug 2012 08:37:12 +0200 Subject: [PATCH 11/26] =?UTF-8?q?Uniformized=20sql=20error=20management=20?= =?UTF-8?q?Eldy=20told=20me=20that=20this=20is=20the=20correct=20way=20to?= =?UTF-8?q?=20handle=20SQL=20errors=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/core/boxes/box_bookmarks.php | 4 +++- htdocs/core/boxes/box_comptes.php | 4 +++- htdocs/core/boxes/box_contracts.php | 4 +++- htdocs/core/boxes/box_factures_fourn.php | 4 +++- htdocs/core/boxes/box_fournisseurs.php | 4 +++- htdocs/core/boxes/box_osc_client.php | 4 +++- htdocs/core/boxes/box_propales.php | 4 +++- htdocs/core/boxes/box_services_expired.php | 4 +++- htdocs/core/boxes/box_supplier_orders.php | 4 +++- 9 files changed, 27 insertions(+), 9 deletions(-) diff --git a/htdocs/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php index 291c7f52596..a341b9d5b76 100644 --- a/htdocs/core/boxes/box_bookmarks.php +++ b/htdocs/core/boxes/box_bookmarks.php @@ -116,7 +116,9 @@ class box_bookmarks extends ModeleBoxes } else { - dol_print_error($db); + $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql)); } } else { diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 09f84afca78..bb92403da0f 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -141,7 +141,9 @@ class box_comptes extends ModeleBoxes } } else { - dol_print_error($db); + $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql)); } } else { diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index 9f0448f0534..bd0b4d5e605 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -138,7 +138,9 @@ class box_contracts extends ModeleBoxes } else { - dol_print_error($db); + $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql)); } } else diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index a8f66935a48..2b2f85fef37 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -139,7 +139,9 @@ class box_factures_fourn extends ModeleBoxes if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoModifiedSupplierBills")); } else { - dol_print_error($db); + $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql)); } } else { diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index 38ffa7dbe7b..292c82abcb5 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -114,7 +114,9 @@ class box_fournisseurs extends ModeleBoxes if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedSuppliers")); } else { - dol_print_error($db); + $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql)); } } else { diff --git a/htdocs/core/boxes/box_osc_client.php b/htdocs/core/boxes/box_osc_client.php index dab5d325d76..aaaf232dfe9 100644 --- a/htdocs/core/boxes/box_osc_client.php +++ b/htdocs/core/boxes/box_osc_client.php @@ -92,7 +92,9 @@ class box_osc_clients extends ModeleBoxes } } else { - dol_print_error($db); + $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql)); } } else { diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index f36205a9616..e09fe652e53 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -134,7 +134,9 @@ class box_propales extends ModeleBoxes } else { - dol_print_error($db); + $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql)); } } else diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index 86b50c45951..80c3a63c259 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -134,7 +134,9 @@ class box_services_expired extends ModeleBoxes } else { - dol_print_error($db); + $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql)); } diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 355d5319855..ab34eb7eaa4 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -129,7 +129,9 @@ class box_supplier_orders extends ModeleBoxes } else { - dol_print_error($db); + $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql)); } } else From 3771ad2e87ab386eb2753d9b7903c06d14666420 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Aug 2012 09:43:24 +0200 Subject: [PATCH 12/26] Fix: Restore line feed after removing it from select_product function. --- htdocs/contrat/fiche.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 081b38c8ee9..1497dc40730 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -1277,9 +1277,10 @@ else print ''; // multiprix if($conf->global->PRODUIT_MULTIPRICES) - $form->select_produits('','idprod',1,$conf->product->limit_size,$object->thirdparty->price_level); + $form->select_produits('','idprod',1,$conf->product->limit_size,$object->thirdparty->price_level); else - $form->select_produits('','idprod',1,$conf->product->limit_size); + $form->select_produits('','idprod',1,$conf->product->limit_size); + print '
    '; print ''; print '
    '.$langs->trans("PriceBaseType").''.$langs->trans("PriceBaseTypeToChange").''."\n"; print $form->load_PriceBaseType($price_base_type); print '
    '; print ''; // Boutons actions print '
    '; -print ''; +print ''; print '
    '; print ''; -dol_htmloutput_mesg($mesg); +dol_htmloutput_events(); llxFooter(); $db->close(); - ?> From d6918d7a87b045e7bfd314ccbe9475e620837b7b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 29 Aug 2012 16:31:48 +0200 Subject: [PATCH 19/26] Fix: upgrade ckeditor --- COPYRIGHT | 2 +- htdocs/includes/ckeditor/CHANGES.html | 119 +- htdocs/includes/ckeditor/INSTALL.html | 4 +- htdocs/includes/ckeditor/LICENSE.html | 4 +- htdocs/includes/ckeditor/adapters/jquery.js | 12 +- htdocs/includes/ckeditor/ckeditor.asp | 10 +- htdocs/includes/ckeditor/ckeditor.js | 301 ++--- htdocs/includes/ckeditor/ckeditor.pack | 2 +- htdocs/includes/ckeditor/ckeditor.php | 58 +- htdocs/includes/ckeditor/ckeditor_basic.js | 16 +- .../ckeditor/ckeditor_basic_source.js | 40 +- htdocs/includes/ckeditor/ckeditor_php4.php | 1132 ++++++++--------- htdocs/includes/ckeditor/ckeditor_php5.php | 1112 ++++++++-------- htdocs/includes/ckeditor/ckeditor_source.js | 70 +- htdocs/includes/ckeditor/config.js | 22 +- htdocs/includes/ckeditor/contents.css | 2 +- htdocs/includes/ckeditor/lang/_languages.js | 12 +- .../ckeditor/lang/_translationstatus.txt | 121 +- htdocs/includes/ckeditor/lang/af.js | 12 +- htdocs/includes/ckeditor/lang/ar.js | 12 +- htdocs/includes/ckeditor/lang/bg.js | 12 +- htdocs/includes/ckeditor/lang/bn.js | 12 +- htdocs/includes/ckeditor/lang/bs.js | 12 +- htdocs/includes/ckeditor/lang/ca.js | 12 +- htdocs/includes/ckeditor/lang/cs.js | 12 +- htdocs/includes/ckeditor/lang/cy.js | 12 +- htdocs/includes/ckeditor/lang/da.js | 12 +- htdocs/includes/ckeditor/lang/de.js | 12 +- htdocs/includes/ckeditor/lang/el.js | 12 +- htdocs/includes/ckeditor/lang/en-au.js | 12 +- htdocs/includes/ckeditor/lang/en-ca.js | 12 +- htdocs/includes/ckeditor/lang/en-gb.js | 12 +- htdocs/includes/ckeditor/lang/en.js | 12 +- htdocs/includes/ckeditor/lang/eo.js | 12 +- htdocs/includes/ckeditor/lang/es.js | 12 +- htdocs/includes/ckeditor/lang/et.js | 12 +- htdocs/includes/ckeditor/lang/eu.js | 12 +- htdocs/includes/ckeditor/lang/fa.js | 12 +- htdocs/includes/ckeditor/lang/fi.js | 12 +- htdocs/includes/ckeditor/lang/fo.js | 12 +- htdocs/includes/ckeditor/lang/fr-ca.js | 12 +- htdocs/includes/ckeditor/lang/fr.js | 12 +- htdocs/includes/ckeditor/lang/gl.js | 12 +- htdocs/includes/ckeditor/lang/gu.js | 12 +- htdocs/includes/ckeditor/lang/he.js | 12 +- htdocs/includes/ckeditor/lang/hi.js | 12 +- htdocs/includes/ckeditor/lang/hr.js | 12 +- htdocs/includes/ckeditor/lang/hu.js | 12 +- htdocs/includes/ckeditor/lang/id.js | 6 + htdocs/includes/ckeditor/lang/is.js | 12 +- htdocs/includes/ckeditor/lang/it.js | 12 +- htdocs/includes/ckeditor/lang/ja.js | 12 +- htdocs/includes/ckeditor/lang/ka.js | 12 +- htdocs/includes/ckeditor/lang/km.js | 12 +- htdocs/includes/ckeditor/lang/ko.js | 12 +- htdocs/includes/ckeditor/lang/lt.js | 12 +- htdocs/includes/ckeditor/lang/lv.js | 12 +- htdocs/includes/ckeditor/lang/mk.js | 6 + htdocs/includes/ckeditor/lang/mn.js | 12 +- htdocs/includes/ckeditor/lang/ms.js | 12 +- htdocs/includes/ckeditor/lang/nb.js | 12 +- htdocs/includes/ckeditor/lang/nl.js | 12 +- htdocs/includes/ckeditor/lang/no.js | 12 +- htdocs/includes/ckeditor/lang/pl.js | 12 +- htdocs/includes/ckeditor/lang/pt-br.js | 12 +- htdocs/includes/ckeditor/lang/pt.js | 12 +- htdocs/includes/ckeditor/lang/ro.js | 12 +- htdocs/includes/ckeditor/lang/ru.js | 12 +- htdocs/includes/ckeditor/lang/sk.js | 12 +- htdocs/includes/ckeditor/lang/sl.js | 12 +- htdocs/includes/ckeditor/lang/sr-latn.js | 12 +- htdocs/includes/ckeditor/lang/sr.js | 12 +- htdocs/includes/ckeditor/lang/sv.js | 12 +- htdocs/includes/ckeditor/lang/th.js | 12 +- htdocs/includes/ckeditor/lang/tr.js | 12 +- htdocs/includes/ckeditor/lang/ug.js | 6 + htdocs/includes/ckeditor/lang/uk.js | 12 +- htdocs/includes/ckeditor/lang/vi.js | 12 +- htdocs/includes/ckeditor/lang/zh-cn.js | 12 +- htdocs/includes/ckeditor/lang/zh.js | 12 +- .../plugins/a11yhelp/dialogs/a11yhelp.js | 14 +- .../a11yhelp/lang/_translationstatus.txt | 25 + .../ckeditor/plugins/a11yhelp/lang/cs.js | 6 + .../ckeditor/plugins/a11yhelp/lang/cy.js | 6 + .../ckeditor/plugins/a11yhelp/lang/da.js | 6 + .../ckeditor/plugins/a11yhelp/lang/de.js | 6 + .../ckeditor/plugins/a11yhelp/lang/el.js | 6 + .../ckeditor/plugins/a11yhelp/lang/en.js | 12 +- .../ckeditor/plugins/a11yhelp/lang/eo.js | 6 + .../ckeditor/plugins/a11yhelp/lang/fa.js | 6 + .../ckeditor/plugins/a11yhelp/lang/fi.js | 6 + .../ckeditor/plugins/a11yhelp/lang/fr.js | 6 + .../ckeditor/plugins/a11yhelp/lang/gu.js | 6 + .../ckeditor/plugins/a11yhelp/lang/he.js | 12 +- .../ckeditor/plugins/a11yhelp/lang/it.js | 6 + .../ckeditor/plugins/a11yhelp/lang/mk.js | 6 + .../ckeditor/plugins/a11yhelp/lang/nb.js | 6 + .../ckeditor/plugins/a11yhelp/lang/nl.js | 6 + .../ckeditor/plugins/a11yhelp/lang/no.js | 6 + .../ckeditor/plugins/a11yhelp/lang/pt-br.js | 6 + .../ckeditor/plugins/a11yhelp/lang/ro.js | 6 + .../ckeditor/plugins/a11yhelp/lang/tr.js | 6 + .../ckeditor/plugins/a11yhelp/lang/ug.js | 6 + .../ckeditor/plugins/a11yhelp/lang/vi.js | 6 + .../ckeditor/plugins/a11yhelp/lang/zh-cn.js | 6 + .../ckeditor/plugins/about/dialogs/about.js | 12 +- .../ckeditor/plugins/adobeair/plugin.js | 12 +- .../includes/ckeditor/plugins/ajax/plugin.js | 12 +- .../ckeditor/plugins/autogrow/plugin.js | 12 +- .../ckeditor/plugins/bbcode/plugin.js | 18 +- .../plugins/clipboard/dialogs/paste.js | 14 +- .../colordialog/dialogs/colordialog.js | 14 +- .../devtools/lang/_translationstatus.txt | 28 + .../ckeditor/plugins/devtools/lang/bg.js | 6 + .../ckeditor/plugins/devtools/lang/cs.js | 6 + .../ckeditor/plugins/devtools/lang/cy.js | 6 + .../ckeditor/plugins/devtools/lang/da.js | 6 + .../ckeditor/plugins/devtools/lang/de.js | 6 + .../ckeditor/plugins/devtools/lang/el.js | 6 + .../ckeditor/plugins/devtools/lang/en.js | 12 +- .../ckeditor/plugins/devtools/lang/eo.js | 6 + .../ckeditor/plugins/devtools/lang/et.js | 6 + .../ckeditor/plugins/devtools/lang/fa.js | 6 + .../ckeditor/plugins/devtools/lang/fi.js | 6 + .../ckeditor/plugins/devtools/lang/fr.js | 6 + .../ckeditor/plugins/devtools/lang/gu.js | 6 + .../ckeditor/plugins/devtools/lang/he.js | 6 + .../ckeditor/plugins/devtools/lang/hr.js | 6 + .../ckeditor/plugins/devtools/lang/it.js | 6 + .../ckeditor/plugins/devtools/lang/nb.js | 6 + .../ckeditor/plugins/devtools/lang/nl.js | 6 + .../ckeditor/plugins/devtools/lang/no.js | 6 + .../ckeditor/plugins/devtools/lang/pl.js | 6 + .../ckeditor/plugins/devtools/lang/pt-br.js | 6 + .../ckeditor/plugins/devtools/lang/tr.js | 6 + .../ckeditor/plugins/devtools/lang/ug.js | 6 + .../ckeditor/plugins/devtools/lang/uk.js | 6 + .../ckeditor/plugins/devtools/lang/vi.js | 6 + .../ckeditor/plugins/devtools/lang/zh-cn.js | 6 + .../ckeditor/plugins/devtools/plugin.js | 12 +- .../plugins/dialog/dialogDefinition.js | 8 +- .../ckeditor/plugins/div/dialogs/div.js | 16 +- .../plugins/docprops/dialogs/docprops.js | 20 +- .../ckeditor/plugins/docprops/plugin.js | 12 +- .../ckeditor/plugins/find/dialogs/find.js | 20 +- .../ckeditor/plugins/flash/dialogs/flash.js | 18 +- .../ckeditor/plugins/forms/dialogs/button.js | 12 +- .../plugins/forms/dialogs/checkbox.js | 12 +- .../ckeditor/plugins/forms/dialogs/form.js | 12 +- .../plugins/forms/dialogs/hiddenfield.js | 12 +- .../ckeditor/plugins/forms/dialogs/radio.js | 12 +- .../ckeditor/plugins/forms/dialogs/select.js | 18 +- .../plugins/forms/dialogs/textarea.js | 12 +- .../plugins/forms/dialogs/textfield.js | 12 +- .../ckeditor/plugins/iframe/dialogs/iframe.js | 14 +- .../ckeditor/plugins/iframedialog/plugin.js | 12 +- .../ckeditor/plugins/image/dialogs/image.js | 26 +- .../ckeditor/plugins/link/dialogs/anchor.js | 12 +- .../ckeditor/plugins/link/dialogs/link.js | 24 +- .../plugins/liststyle/dialogs/liststyle.js | 14 +- .../plugins/pastefromword/filter/default.js | 22 +- .../plugins/pastetext/dialogs/pastetext.js | 12 +- .../placeholder/dialogs/placeholder.js | 12 +- .../placeholder/lang/_translationstatus.txt | 27 + .../ckeditor/plugins/placeholder/lang/bg.js | 6 + .../ckeditor/plugins/placeholder/lang/cs.js | 6 + .../ckeditor/plugins/placeholder/lang/cy.js | 6 + .../ckeditor/plugins/placeholder/lang/da.js | 6 + .../ckeditor/plugins/placeholder/lang/de.js | 6 + .../ckeditor/plugins/placeholder/lang/el.js | 6 + .../ckeditor/plugins/placeholder/lang/en.js | 12 +- .../ckeditor/plugins/placeholder/lang/eo.js | 6 + .../ckeditor/plugins/placeholder/lang/et.js | 6 + .../ckeditor/plugins/placeholder/lang/fa.js | 6 + .../ckeditor/plugins/placeholder/lang/fi.js | 6 + .../ckeditor/plugins/placeholder/lang/fr.js | 6 + .../ckeditor/plugins/placeholder/lang/he.js | 12 +- .../ckeditor/plugins/placeholder/lang/hr.js | 6 + .../ckeditor/plugins/placeholder/lang/it.js | 6 + .../ckeditor/plugins/placeholder/lang/nb.js | 6 + .../ckeditor/plugins/placeholder/lang/nl.js | 6 + .../ckeditor/plugins/placeholder/lang/no.js | 6 + .../ckeditor/plugins/placeholder/lang/pl.js | 6 + .../plugins/placeholder/lang/pt-br.js | 6 + .../ckeditor/plugins/placeholder/lang/tr.js | 6 + .../ckeditor/plugins/placeholder/lang/ug.js | 6 + .../ckeditor/plugins/placeholder/lang/uk.js | 6 + .../ckeditor/plugins/placeholder/lang/vi.js | 6 + .../plugins/placeholder/lang/zh-cn.js | 6 + .../ckeditor/plugins/placeholder/plugin.js | 12 +- .../ckeditor/plugins/preview/preview.html | 10 + .../ckeditor/plugins/scayt/dialogs/options.js | 16 +- .../plugins/scayt/dialogs/toolbar.css | 2 +- .../ckeditor/plugins/smiley/dialogs/smiley.js | 14 +- .../specialchar/dialogs/specialchar.js | 14 +- .../specialchar/lang/_translationstatus.txt | 22 + .../ckeditor/plugins/specialchar/lang/cs.js | 6 + .../ckeditor/plugins/specialchar/lang/cy.js | 6 + .../ckeditor/plugins/specialchar/lang/de.js | 6 + .../ckeditor/plugins/specialchar/lang/el.js | 6 + .../ckeditor/plugins/specialchar/lang/en.js | 12 +- .../ckeditor/plugins/specialchar/lang/eo.js | 6 + .../ckeditor/plugins/specialchar/lang/et.js | 6 + .../ckeditor/plugins/specialchar/lang/fa.js | 6 + .../ckeditor/plugins/specialchar/lang/fi.js | 6 + .../ckeditor/plugins/specialchar/lang/fr.js | 6 + .../ckeditor/plugins/specialchar/lang/he.js | 6 + .../ckeditor/plugins/specialchar/lang/hr.js | 6 + .../ckeditor/plugins/specialchar/lang/it.js | 6 + .../ckeditor/plugins/specialchar/lang/nb.js | 6 + .../ckeditor/plugins/specialchar/lang/nl.js | 6 + .../ckeditor/plugins/specialchar/lang/no.js | 6 + .../plugins/specialchar/lang/pt-br.js | 6 + .../ckeditor/plugins/specialchar/lang/tr.js | 6 + .../ckeditor/plugins/specialchar/lang/ug.js | 6 + .../plugins/specialchar/lang/zh-cn.js | 6 + .../ckeditor/plugins/styles/styles/default.js | 12 +- .../plugins/stylesheetparser/plugin.js | 12 +- .../ckeditor/plugins/table/dialogs/table.js | 18 +- .../ckeditor/plugins/tableresize/plugin.js | 14 +- .../plugins/tabletools/dialogs/tableCell.js | 16 +- .../plugins/templates/dialogs/templates.js | 14 +- .../plugins/templates/templates/default.js | 12 +- .../plugins/uicolor/dialogs/uicolor.js | 14 +- .../uicolor/lang/_translationstatus.txt | 28 + .../ckeditor/plugins/uicolor/lang/bg.js | 6 + .../ckeditor/plugins/uicolor/lang/cs.js | 6 + .../ckeditor/plugins/uicolor/lang/cy.js | 6 + .../ckeditor/plugins/uicolor/lang/da.js | 6 + .../ckeditor/plugins/uicolor/lang/de.js | 6 + .../ckeditor/plugins/uicolor/lang/el.js | 6 + .../ckeditor/plugins/uicolor/lang/en.js | 12 +- .../ckeditor/plugins/uicolor/lang/eo.js | 6 + .../ckeditor/plugins/uicolor/lang/et.js | 6 + .../ckeditor/plugins/uicolor/lang/fa.js | 6 + .../ckeditor/plugins/uicolor/lang/fi.js | 6 + .../ckeditor/plugins/uicolor/lang/fr.js | 6 + .../ckeditor/plugins/uicolor/lang/he.js | 12 +- .../ckeditor/plugins/uicolor/lang/hr.js | 6 + .../ckeditor/plugins/uicolor/lang/it.js | 6 + .../ckeditor/plugins/uicolor/lang/mk.js | 6 + .../ckeditor/plugins/uicolor/lang/nb.js | 6 + .../ckeditor/plugins/uicolor/lang/nl.js | 6 + .../ckeditor/plugins/uicolor/lang/no.js | 6 + .../ckeditor/plugins/uicolor/lang/pl.js | 6 + .../ckeditor/plugins/uicolor/lang/pt-br.js | 6 + .../ckeditor/plugins/uicolor/lang/tr.js | 6 + .../ckeditor/plugins/uicolor/lang/ug.js | 6 + .../ckeditor/plugins/uicolor/lang/uk.js | 6 + .../ckeditor/plugins/uicolor/lang/vi.js | 6 + .../ckeditor/plugins/uicolor/lang/zh-cn.js | 6 + .../ckeditor/plugins/uicolor/plugin.js | 12 +- .../plugins/uicolor/yui/assets/yui.css | 2 +- .../ckeditor/plugins/uicolor/yui/yui.js | 152 +-- .../ckeditor/plugins/wsc/dialogs/ciframe.html | 2 +- .../plugins/wsc/dialogs/tmpFrameset.html | 2 +- .../ckeditor/plugins/wsc/dialogs/wsc.css | 2 +- .../ckeditor/plugins/wsc/dialogs/wsc.js | 14 +- .../includes/ckeditor/plugins/xml/plugin.js | 12 +- .../includes/ckeditor/skins/kama/dialog.css | 12 +- .../includes/ckeditor/skins/kama/editor.css | 2 +- htdocs/includes/ckeditor/skins/kama/skin.js | 14 +- .../ckeditor/skins/kama/templates.css | 2 +- .../ckeditor/skins/office2003/dialog.css | 11 +- .../ckeditor/skins/office2003/editor.css | 2 +- .../ckeditor/skins/office2003/skin.js | 12 +- .../ckeditor/skins/office2003/templates.css | 2 +- htdocs/includes/ckeditor/skins/v2/dialog.css | 10 +- htdocs/includes/ckeditor/skins/v2/editor.css | 2 +- htdocs/includes/ckeditor/skins/v2/skin.js | 12 +- .../includes/ckeditor/skins/v2/templates.css | 2 +- .../includes/ckeditor/themes/default/theme.js | 16 +- htdocs/product/ajax/products.php | 10 +- 273 files changed, 3284 insertions(+), 2330 deletions(-) create mode 100644 htdocs/includes/ckeditor/lang/id.js create mode 100644 htdocs/includes/ckeditor/lang/mk.js create mode 100644 htdocs/includes/ckeditor/lang/ug.js create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/_translationstatus.txt create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/cs.js create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/cy.js create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/da.js create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/de.js create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/el.js create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/eo.js create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/fa.js create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/fi.js create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/fr.js create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/gu.js create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/it.js create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/mk.js create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/nb.js create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/nl.js create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/no.js create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/pt-br.js create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/ro.js create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/tr.js create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/ug.js create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/vi.js create mode 100644 htdocs/includes/ckeditor/plugins/a11yhelp/lang/zh-cn.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/_translationstatus.txt create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/bg.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/cs.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/cy.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/da.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/de.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/el.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/eo.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/et.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/fa.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/fi.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/fr.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/gu.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/he.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/hr.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/it.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/nb.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/nl.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/no.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/pl.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/pt-br.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/tr.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/ug.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/uk.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/vi.js create mode 100644 htdocs/includes/ckeditor/plugins/devtools/lang/zh-cn.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/_translationstatus.txt create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/bg.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/cs.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/cy.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/da.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/de.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/el.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/eo.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/et.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/fa.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/fi.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/fr.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/hr.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/it.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/nb.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/nl.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/no.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/pl.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/pt-br.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/tr.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/ug.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/uk.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/vi.js create mode 100644 htdocs/includes/ckeditor/plugins/placeholder/lang/zh-cn.js create mode 100644 htdocs/includes/ckeditor/plugins/preview/preview.html create mode 100644 htdocs/includes/ckeditor/plugins/specialchar/lang/_translationstatus.txt create mode 100644 htdocs/includes/ckeditor/plugins/specialchar/lang/cs.js create mode 100644 htdocs/includes/ckeditor/plugins/specialchar/lang/cy.js create mode 100644 htdocs/includes/ckeditor/plugins/specialchar/lang/de.js create mode 100644 htdocs/includes/ckeditor/plugins/specialchar/lang/el.js create mode 100644 htdocs/includes/ckeditor/plugins/specialchar/lang/eo.js create mode 100644 htdocs/includes/ckeditor/plugins/specialchar/lang/et.js create mode 100644 htdocs/includes/ckeditor/plugins/specialchar/lang/fa.js create mode 100644 htdocs/includes/ckeditor/plugins/specialchar/lang/fi.js create mode 100644 htdocs/includes/ckeditor/plugins/specialchar/lang/fr.js create mode 100644 htdocs/includes/ckeditor/plugins/specialchar/lang/he.js create mode 100644 htdocs/includes/ckeditor/plugins/specialchar/lang/hr.js create mode 100644 htdocs/includes/ckeditor/plugins/specialchar/lang/it.js create mode 100644 htdocs/includes/ckeditor/plugins/specialchar/lang/nb.js create mode 100644 htdocs/includes/ckeditor/plugins/specialchar/lang/nl.js create mode 100644 htdocs/includes/ckeditor/plugins/specialchar/lang/no.js create mode 100644 htdocs/includes/ckeditor/plugins/specialchar/lang/pt-br.js create mode 100644 htdocs/includes/ckeditor/plugins/specialchar/lang/tr.js create mode 100644 htdocs/includes/ckeditor/plugins/specialchar/lang/ug.js create mode 100644 htdocs/includes/ckeditor/plugins/specialchar/lang/zh-cn.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/_translationstatus.txt create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/bg.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/cs.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/cy.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/da.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/de.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/el.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/eo.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/et.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/fa.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/fi.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/fr.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/hr.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/it.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/mk.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/nb.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/nl.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/no.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/pl.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/pt-br.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/tr.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/ug.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/uk.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/vi.js create mode 100644 htdocs/includes/ckeditor/plugins/uicolor/lang/zh-cn.js diff --git a/COPYRIGHT b/COPYRIGHT index c8e162b848d..4c478710bc6 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -12,7 +12,7 @@ Composant Version License Compatible GPL Usage ---------------------------------------------------------------------------- PHP libraries: AdoDb-Date 0.21 Modified BSD License Yes Date convertion (not into rpm package) -CKEditor 3.6.2 GPL or LGPL 2.1 or MPL 1.1 Yes Editor WYSIWYG +CKEditor 3.6.4 GPL or LGPL 2.1 or MPL 1.1 Yes Editor WYSIWYG FPDI 1.4.2 Apache Software License 2.0 No (GPLv3 only) PDF templates management (with FPDF_TPL 1.2) GeoIP 2004 LGPL 2.1 Yes Sample code to make geoip convert (not into deb package) NuSoap 0.9.5 LGPL 2.1 Yes Library to develop SOAP Web services (not into rpm and deb package) diff --git a/htdocs/includes/ckeditor/CHANGES.html b/htdocs/includes/ckeditor/CHANGES.html index b30594741cd..62da0a31865 100644 --- a/htdocs/includes/ckeditor/CHANGES.html +++ b/htdocs/includes/ckeditor/CHANGES.html @@ -1,6 +1,6 @@ @@ -34,6 +34,121 @@ For licensing, see LICENSE.html or http://ckeditor.com/license

    CKEditor Changelog

    +

    + CKEditor 3.6.4

    +

    + Fixed issues:

    +
      +
    • #8887 : Ugly hover effect for buttons in dialog windows due to slightly wrong background position.
    • +
    • #8783 : getAttribute( 'contenteditable' ) returns 'inherited' on IE7 and IE6 for elements created from code.
    • +
    • #8463 : WebKit: Cut/Copy buttons didn't go on "enabled" state after selecting text in the editor.
    • +
    • #9043 : Command newpage didn't return its name when afterCommandExec event was fired.
    • +
    • #9015 : Applied ARIA label on dialog file input element.
    • +
    • #9016 : Applied the "presentation" role on the iframe element in dialog file field markup.
    • +
    • #8949 : Image Properties does not show in context menu when the image is wrapped in a div with the width set.
    • +
    • #9008 : Fixed list items order reversed when merging two lists.
    • +
    • #9042 : [Safari] Fixed pasting left garbage html at the end of document.
    • +
    • #7745 : The list of frames on JAWS will not any more show the "ALT+0 for help" text for the editor entry.
    • +
    • #8979 : Overriding matches will not any more interfere on the Font size combo.
    • +
    • #5447 : Anchor names created by the Link dialog are now trimmed to protect against unwanted spaces.
    • +
    • #8997 : Styles are lost on sub-lists when converting list type.
    • +
    • #8971 : [IE7] Dialog size are stretched when long text field value is received.
    • +
    • #8945 : Fake elements now show alternative text on High Contrast mode.
    • +
    • #8985 : Better handling of Enter key events on dialogs.
    • +
    • #8925 : [Firefox] Unexpected page scroll on large floating block when editor is re-focused.
    • +
    • #8978 : [IE] Saved editor text selection is lost after close menu.
    • +
    • #9022 : [IE7] Fixed wrong selection introduced in empty editor document when click to the bottom-right of the document.
    • +
    • #9034 : [IE7] Fixed JavaScript error caused by drag-to-select at the bottom of the document.
    • +
    • #9057 : Unexpected block established when decreasing indent of a styled list item.
    • +
    • #9063 : Styles on sub-list are lost when decreasing indent of the parent list.
    • +
    • #9047 : [Firefox] Anchors in the preview window will now work properly.
    • +
    • #8941 : [Webkit] Content region disappeared when resizing the browser.
    • +
    • #8968 : [Firefox] The forcePasteAsPlainText configuration is not working when using Ctrl/Cmd-V.
    • +
    • #6217 : Handled Del/Backspace key at the boundary of table to unify the cursor position.
    • +
    • #8950 : Changed the cursor position after calling editor::insertElement on block element.
    • +
    • #9080 : Fixed Backspace key in front of the list item to join with previous line.
    • +
    • #3592 : Removed the "title" field from flash dialog advanced tab.
    • +
    • #9084 : [IE] Dragging absolute positioned elements is now enabled by default.
    • +
    • #8879 : Corrected styling of labels used in dialog windows.
    • +
    • #8921 : [Chrome] Paste on a newly created CKEditor instance does not work on Chrome.
    • +
    • #9036 : Find feature cannot locate certain words while Match Whole Word is enabled.
    • +
    • #9069 : [Chrome] Issue with popups not opening properly on Chrome 20 makes it impossible to view the file browser window.
    • +
    • #5811 : Code for Image dialog is missing dialog dependency.
    • +
    • #5810 : Code for Div Container is missing dialog dependency.
    • +
    • #5809 : Dialog a11yhelp is missing dialog dependency.
    • +
    • #4045 : "Field Name" Column in sample_posteddata.php is to narrow.
    • +
    • Updated the following language files as submitted to the CKEditor UI Translation Center: Bulgarian, Chinese, Czech, Danish, Esperanto, Estonian, Greek, Italian, Norwegian, Portuguese, Romanian, Vietnamese.
    • +
    +

    + CKEditor 3.6.3

    +

    + New features:

    +
      +
    • #7430 : Justify commands now perform alignment on the element when an image is selected.
    • +
    • #8706 : Better ARIA accessibility for the color picker dialog window.
    • +
    • #7366 : Editor paste function is now available on browser toolbar and context menu.
    • +
    +

    + Fixed issues:

    +
      +
    • #8634 : [IE] Command execution always returns true in IE browsers.
    • +
    • #8333 : Dialog windows can now be closed with the Esc key even if there is no Cancel button available.
    • +
    • #8644 : Missing variable declaration in the dialog plugin.
    • +
    • #8699 : Focus is now moved to the clicked button and back to color picker dialog window opener (button) in all browsers after the dialog window is closed.
    • +
    • #8132 : [IE9] Link line gets broken when it contains a br tag.
    • +
    • #8629 : Optimize float panel layout when there is not enough space in the viewport.
    • +
    • #7955 : [FF] Page Up and Page Down in the WYSIWYG mode cause the selection to become lost.
    • +
    • #8698 : Esc key does not close the color picker dialog window.
    • +
    • #8413 : HTML comment nodes break content styling in tables.
    • +
    • #7932, #8643 : [IE] Clicking below the content region scrolls the page to the top.
    • +
    • #5538, #8729 : [IE] Focus jump results in incorrect context menu display.
    • +
    • #6359 : [IE] Selectable area in blank WYSIWYG editor is too small.
    • +
    • #7326, #8074 : [FF] Scrolling does not work correctly in editor with large amount of text.
    • +
    • #8630 : HTML events are now disabled when loading data.
    • +
    • #8433 : [IE9] Use W3C event model.
    • +
    • #8691 : [IE] Pasting invalid HTML crashes the browser.
    • +
    • #8345 : [IE] Selection is not properly restored after closing the Link dialog window.
    • +
    • #6308 : Vertical-only resize imposes fixed width on editor chrome.
    • +
    • #7360 : [WebKit] WYSIWYG area sometimes does not resize with the chrome.
    • +
    • #5527 : Do not encode the # character sent from the file browser.
    • +
    • #8014 : Autogrow now stretches to fit the content when switching editor modes.
    • +
    • #8249 : Inconsistent behavior with the Backspace key used at the start of a list item.
    • +
    • #8617 : [WebKit] Selection becomes broken after an inline style is opened.
    • +
    • #8527 : Insertion with cursor before an empty anchor is error-prone.
    • +
    • #8632 : Cursor panic when the Backspace key is used in a list item.
    • +
    • #8455 : Mousedown focus is too agressive.
    • +
    • #8475 : Issue with deleting elements with inline styling in tables.
    • +
    • #8324 : [IE8] Undo generates an error when a control type element is selected.
    • +
    • #7946 : Find and Replace dialog window result does not scroll into view when the editor is off the viewport.
    • +
    • #8157 : Flash/IFrame dialog window cannot be closed when displayed over Flash/IFrame with dialog_startupFocusTab set to true.
    • +
    • #8305 : Text direction lost when converting a paragraph to a list.
    • +
    • #8379 : The cursor moves to the start of the document when inserting a row or column is undone.
    • +
    • #6666 : Removed references to element.all.
    • +
    • #8732 : Issue when CKEDITOR.range::enlarge passes through comment nodes.
    • +
    • #7492 : The Style system can now use overrides with the same element (change classes instead of nesting).
    • +
    • #6111 : Splitting table cells results in incorrect column spans.
    • +
    • #8247 : [IE] Error when aligning a document with page breaks inside of contents.
    • +
    • #8540 : Orphan texts inside a list or table are now properly fixed.
    • +
    • #8774 : The Entities plugin can now be configured to only output XML entities.
    • +
    • #8602 : Image source is now properly hidden when running data through the data processor.
    • +
    • #8812 : [IE] Issues with the native range translation with comments in the DOM.
    • +
    • #7907 : Decreasing indentation of a RTL block in a list item loses text direction.
    • +
    • #8835 : Right margin on IE<8 removed to avoid mouse click confusion.
    • +
    • #8400 : [IE] Script error when closing the Cell Properties dialog window if the table cell text is selected.
    • +
    • #8248 : [IE8] Issues with Backspace and Del keys when used at the start or end of list items.
    • +
    • #8855 : [Chrome] Issue with the popup window size in Chrome 18 makes it impossible to view the file browser window.
    • +
    • #8407 : Unneeded aria-posinset and aria-setsize for a list block are now removed.
    • +
    • #8701 : Highlight field in the color picker does not show the correct color when keyboard navigation is used.
    • +
    • #8509 : Table height gets copied from the width value when the Advanced tab is hidden.
    • +
    • #8432 : [IE8] openDialog('image') error.
    • +
    • #8493 : [IE] It is impossible to add a link to the selected text.
    • +
    • #8528 : Redundant imagePreviewBoxId in the Image Properties dialog window is now removed.
    • +
    • #8864 : [IE] Fix ARIA presentation of toolbar rich combo in JAWS.
    • +
    • #8459 : Fix wrong undo step on enter key.
    • +
    • #8895 : Editing anchors using the Link dialog window could not work in release version.
    • +
    • #8876 : <link> element in the floating panels have been moved to <head>.
    • +
    • Updated the following language files as submitted to the CKEditor UI Translation Center: Arabic, Bulgarian, Chinese, Croatian, Czech, Danish, Dutch, Esperanto, Estonian, Faroese, French, German, Greek, Gujarati, Hindi, Italian, Macedonian, Norwegian (Bokmål and Nynorsk), Polish, Portuguese, Turkish, Uighur, Ukrainian, Vietnamese, Welsh.
    • +

    CKEditor 3.6.2

    @@ -1425,7 +1540,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license CKEditor - The text editor for Internet - http://ckeditor.com

    - Copyright © 2003-2011, CKSource - Frederico + Copyright © 2003-2012, CKSource - Frederico Knabben. All rights reserved.

    diff --git a/htdocs/includes/ckeditor/INSTALL.html b/htdocs/includes/ckeditor/INSTALL.html index fd2440edd53..aed6a4750b0 100644 --- a/htdocs/includes/ckeditor/INSTALL.html +++ b/htdocs/includes/ckeditor/INSTALL.html @@ -1,6 +1,6 @@ @@ -84,7 +84,7 @@ http://www.example.com/ckeditor/_samples/index.html CKEditor - The text editor for Internet - http://ckeditor.com

    - Copyright © 2003-2011, CKSource - Frederico + Copyright © 2003-2012, CKSource - Frederico Knabben. All rights reserved.

    diff --git a/htdocs/includes/ckeditor/LICENSE.html b/htdocs/includes/ckeditor/LICENSE.html index 90222429b80..67572d5bbb6 100644 --- a/htdocs/includes/ckeditor/LICENSE.html +++ b/htdocs/includes/ckeditor/LICENSE.html @@ -7,7 +7,7 @@ Software License Agreement ========================== CKEditor - The text editor for Internet - http://ckeditor.com -Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Licensed under the terms of any of the following licenses at your choice: @@ -1279,7 +1279,7 @@ EXHIBIT A -Mozilla Public License.

    CKEditor™ - The text editor for Internet™ - http://ckeditor.com
    - Copyright © 2003-2011, CKSource - Frederico Knabben. All rights reserved. + Copyright © 2003-2012, CKSource - Frederico Knabben. All rights reserved.

    Licensed under the terms of any of the following licenses at your choice: diff --git a/htdocs/includes/ckeditor/adapters/jquery.js b/htdocs/includes/ckeditor/adapters/jquery.js index 942a010422c..04f8c94dcbc 100644 --- a/htdocs/includes/ckeditor/adapters/jquery.js +++ b/htdocs/includes/ckeditor/adapters/jquery.js @@ -1,6 +1,6 @@ -/* -Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -(function(){CKEDITOR.config.jqueryOverrideVal=typeof CKEDITOR.config.jqueryOverrideVal=='undefined'?true:CKEDITOR.config.jqueryOverrideVal;var a=window.jQuery;if(typeof a=='undefined')return;a.extend(a.fn,{ckeditorGet:function(){var b=this.eq(0).data('ckeditorInstance');if(!b)throw 'CKEditor not yet initialized, use ckeditor() with callback.';return b;},ckeditor:function(b,c){if(!CKEDITOR.env.isCompatible)return this;if(!a.isFunction(b)){var d=c;c=b;b=d;}c=c||{};this.filter('textarea, div, p').each(function(){var e=a(this),f=e.data('ckeditorInstance'),g=e.data('_ckeditorInstanceLock'),h=this;if(f&&!g){if(b)b.apply(f,[this]);}else if(!g){if(c.autoUpdateElement||typeof c.autoUpdateElement=='undefined'&&CKEDITOR.config.autoUpdateElement)c.autoUpdateElementJquery=true;c.autoUpdateElement=false;e.data('_ckeditorInstanceLock',true);f=CKEDITOR.replace(h,c);e.data('ckeditorInstance',f);f.on('instanceReady',function(i){var j=i.editor;setTimeout(function(){if(!j.element){setTimeout(arguments.callee,100);return;}i.removeListener('instanceReady',this.callee);j.on('dataReady',function(){e.trigger('setData.ckeditor',[j]);});j.on('getData',function(l){e.trigger('getData.ckeditor',[j,l.data]);},999);j.on('destroy',function(){e.trigger('destroy.ckeditor',[j]);});if(j.config.autoUpdateElementJquery&&e.is('textarea')&&e.parents('form').length){var k=function(){e.ckeditor(function(){j.updateElement();});};e.parents('form').submit(k);e.parents('form').bind('form-pre-serialize',k);e.bind('destroy.ckeditor',function(){e.parents('form').unbind('submit',k);e.parents('form').unbind('form-pre-serialize',k);});}j.on('destroy',function(){e.data('ckeditorInstance',null);});e.data('_ckeditorInstanceLock',null);e.trigger('instanceReady.ckeditor',[j]);if(b)b.apply(j,[h]);},0);},null,null,9999);}else CKEDITOR.on('instanceReady',function(i){var j=i.editor;setTimeout(function(){if(!j.element){setTimeout(arguments.callee,100);return;}if(j.element.$==h)if(b)b.apply(j,[h]);},0);},null,null,9999);});return this;}});if(CKEDITOR.config.jqueryOverrideVal)a.fn.val=CKEDITOR.tools.override(a.fn.val,function(b){return function(c,d){var e=typeof c!='undefined',f;this.each(function(){var g=a(this),h=g.data('ckeditorInstance');if(!d&&g.is('textarea')&&h){if(e)h.setData(c);else{f=h.getData();return null;}}else if(e)b.call(g,c);else{f=b.call(g);return null;}return true;});return e?this:f;};});})(); +/* +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ + +(function(){CKEDITOR.config.jqueryOverrideVal=typeof CKEDITOR.config.jqueryOverrideVal=='undefined'?true:CKEDITOR.config.jqueryOverrideVal;var a=window.jQuery;if(typeof a=='undefined')return;a.extend(a.fn,{ckeditorGet:function(){var b=this.eq(0).data('ckeditorInstance');if(!b)throw 'CKEditor not yet initialized, use ckeditor() with callback.';return b;},ckeditor:function(b,c){if(!CKEDITOR.env.isCompatible)return this;if(!a.isFunction(b)){var d=c;c=b;b=d;}c=c||{};this.filter('textarea, div, p').each(function(){var e=a(this),f=e.data('ckeditorInstance'),g=e.data('_ckeditorInstanceLock'),h=this;if(f&&!g){if(b)b.apply(f,[this]);}else if(!g){if(c.autoUpdateElement||typeof c.autoUpdateElement=='undefined'&&CKEDITOR.config.autoUpdateElement)c.autoUpdateElementJquery=true;c.autoUpdateElement=false;e.data('_ckeditorInstanceLock',true);f=CKEDITOR.replace(h,c);e.data('ckeditorInstance',f);f.on('instanceReady',function(i){var j=i.editor;setTimeout(function(){if(!j.element){setTimeout(arguments.callee,100);return;}i.removeListener('instanceReady',this.callee);j.on('dataReady',function(){e.trigger('setData.ckeditor',[j]);});j.on('getData',function(l){e.trigger('getData.ckeditor',[j,l.data]);},999);j.on('destroy',function(){e.trigger('destroy.ckeditor',[j]);});if(j.config.autoUpdateElementJquery&&e.is('textarea')&&e.parents('form').length){var k=function(){e.ckeditor(function(){j.updateElement();});};e.parents('form').submit(k);e.parents('form').bind('form-pre-serialize',k);e.bind('destroy.ckeditor',function(){e.parents('form').unbind('submit',k);e.parents('form').unbind('form-pre-serialize',k);});}j.on('destroy',function(){e.data('ckeditorInstance',null);});e.data('_ckeditorInstanceLock',null);e.trigger('instanceReady.ckeditor',[j]);if(b)b.apply(j,[h]);},0);},null,null,9999);}else CKEDITOR.on('instanceReady',function(i){var j=i.editor;setTimeout(function(){if(!j.element){setTimeout(arguments.callee,100);return;}if(j.element.$==h)if(b)b.apply(j,[h]);},0);},null,null,9999);});return this;}});if(CKEDITOR.config.jqueryOverrideVal)a.fn.val=CKEDITOR.tools.override(a.fn.val,function(b){return function(c,d){var e=typeof c!='undefined',f;this.each(function(){var g=a(this),h=g.data('ckeditorInstance');if(!d&&g.is('textarea')&&h){if(e)h.setData(c);else{f=h.getData();return null;}}else if(e)b.call(g,c);else{f=b.call(g);return null;}return true;});return e?this:f;};});})(); diff --git a/htdocs/includes/ckeditor/ckeditor.asp b/htdocs/includes/ckeditor/ckeditor.asp index 2c426310278..094e7273156 100644 --- a/htdocs/includes/ckeditor/ckeditor.asp +++ b/htdocs/includes/ckeditor/ckeditor.asp @@ -1,6 +1,6 @@ -<% +<% ' - ' Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. + ' Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. ' For licensing, see LICENSE.html or http://ckeditor.com/license ' Shared variable for all instances ("static") @@ -91,9 +91,9 @@ Class CKEditor Private Sub Class_Initialize() - version = "3.6.2" - timeStamp = "B8DJ5M3" - mTimeStamp = "B8DJ5M3" + version = "3.6.4" + timeStamp = "C6HH5UF" + mTimeStamp = "C6HH5UF" Set oInstanceConfig = CreateObject("Scripting.Dictionary") Set oAllInstancesConfig = CreateObject("Scripting.Dictionary") diff --git a/htdocs/includes/ckeditor/ckeditor.js b/htdocs/includes/ckeditor/ckeditor.js index cf6aa12b41d..f3758ea29dd 100644 --- a/htdocs/includes/ckeditor/ckeditor.js +++ b/htdocs/includes/ckeditor/ckeditor.js @@ -1,149 +1,152 @@ -/* -Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -(function(){if(window.CKEDITOR&&window.CKEDITOR.dom)return;if(!window.CKEDITOR)window.CKEDITOR=(function(){var a={timestamp:'B8DJ5M3',version:'3.6.2',revision:'7275',_:{},status:'unloaded',basePath:(function(){var d=window.CKEDITOR_BASEPATH||'';if(!d){var e=document.getElementsByTagName('script');for(var f=0;f=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;})();var a=CKEDITOR;if(!a.event){a.event=function(){};a.event.implementOn=function(b){var c=a.event.prototype;for(var d in c){if(b[d]==undefined)b[d]=c[d];}};a.event.prototype=(function(){var b=function(d){var e=d.getPrivate&&d.getPrivate()||d._||(d._={});return e.events||(e.events={});},c=function(d){this.name=d;this.listeners=[];};c.prototype={getListenerIndex:function(d){for(var e=0,f=this.listeners;e=0;n--){if(k[n].priority<=h){k.splice(n+1,0,m);return;}}k.unshift(m);}},fire:(function(){var d=false,e=function(){d=true;},f=false,g=function(){f=true;};return function(h,i,j){var k=b(this)[h],l=d,m=f;d=f=false;if(k){var n=k.listeners;if(n.length){n=n.slice(0);for(var o=0;o=0)f.listeners.splice(g,1); -}},hasListeners:function(d){var e=b(this)[d];return e&&e.listeners.length>0;}};})();}if(!a.editor){a.ELEMENT_MODE_NONE=0;a.ELEMENT_MODE_REPLACE=1;a.ELEMENT_MODE_APPENDTO=2;a.editor=function(b,c,d,e){var f=this;f._={instanceConfig:b,element:c,data:e};f.elementMode=d||0;a.event.call(f);f._init();};a.editor.replace=function(b,c){var d=b;if(typeof d!='object'){d=document.getElementById(b);if(d&&d.tagName.toLowerCase() in {style:1,script:1,base:1,link:1,meta:1,title:1})d=null;if(!d){var e=0,f=document.getElementsByName(b);while((d=f[e++])&&d.tagName.toLowerCase()!='textarea'){}}if(!d)throw '[CKEDITOR.editor.replace] The element with id or name "'+b+'" was not found.';}d.style.visibility='hidden';return new a.editor(c,d,1);};a.editor.appendTo=function(b,c,d){var e=b;if(typeof e!='object'){e=document.getElementById(b);if(!e)throw '[CKEDITOR.editor.appendTo] The element with id "'+b+'" was not found.';}return new a.editor(c,e,2,d);};a.editor.prototype={_init:function(){var b=a.editor._pending||(a.editor._pending=[]);b.push(this);},fire:function(b,c){return a.event.prototype.fire.call(this,b,c,this);},fireOnce:function(b,c){return a.event.prototype.fireOnce.call(this,b,c,this);}};a.event.implementOn(a.editor.prototype,true);}if(!a.env)a.env=(function(){var b=navigator.userAgent.toLowerCase(),c=window.opera,d={ie:/*@cc_on!@*/false,opera:!!c&&c.version,webkit:b.indexOf(' applewebkit/')>-1,air:b.indexOf(' adobeair/')>-1,mac:b.indexOf('macintosh')>-1,quirks:document.compatMode=='BackCompat',mobile:b.indexOf('mobile')>-1,iOS:/(ipad|iphone|ipod)/.test(b),isCustomDomain:function(){if(!this.ie)return false;var g=document.domain,h=window.location.hostname;return g!=h&&g!='['+h+']';},secure:location.protocol=='https:'};d.gecko=navigator.product=='Gecko'&&!d.webkit&&!d.opera;var e=0;if(d.ie){e=parseFloat(b.match(/msie (\d+)/)[1]);d.ie8=!!document.documentMode;d.ie8Compat=document.documentMode==8;d.ie9Compat=document.documentMode==9;d.ie7Compat=e==7&&!document.documentMode||document.documentMode==7;d.ie6Compat=e<7||d.quirks;}if(d.gecko){var f=b.match(/rv:([\d\.]+)/);if(f){f=f[1].split('.');e=f[0]*10000+(f[1]||0)*100+ +(f[2]||0);}}if(d.opera)e=parseFloat(c.version());if(d.air)e=parseFloat(b.match(/ adobeair\/(\d+)/)[1]);if(d.webkit)e=parseFloat(b.match(/ applewebkit\/(\d+)/)[1]);d.version=e;d.isCompatible=d.iOS&&e>=534||!d.mobile&&(d.ie&&e>=6||d.gecko&&e>=10801||d.opera&&e>=9.5||d.air&&e>=1||d.webkit&&e>=522||false);d.cssClass='cke_browser_'+(d.ie?'ie':d.gecko?'gecko':d.opera?'opera':d.webkit?'webkit':'unknown'); -if(d.quirks)d.cssClass+=' cke_browser_quirks';if(d.ie){d.cssClass+=' cke_browser_ie'+(d.version<7?'6':d.version>=8?document.documentMode:'7');if(d.quirks)d.cssClass+=' cke_browser_iequirks';}if(d.gecko&&e<10900)d.cssClass+=' cke_browser_gecko18';if(d.air)d.cssClass+=' cke_browser_air';return d;})();var b=a.env;var c=b.ie;if(a.status=='unloaded')(function(){a.event.implementOn(a);a.loadFullCore=function(){if(a.status!='basic_ready'){a.loadFullCore._load=1;return;}delete a.loadFullCore;var e=document.createElement('script');e.type='text/javascript';e.src=a.basePath+'ckeditor.js';document.getElementsByTagName('head')[0].appendChild(e);};a.loadFullCoreTimeout=0;a.replaceClass='ckeditor';a.replaceByClassEnabled=1;var d=function(e,f,g,h){if(b.isCompatible){if(a.loadFullCore)a.loadFullCore();var i=g(e,f,h);a.add(i);return i;}return null;};a.replace=function(e,f){return d(e,f,a.editor.replace);};a.appendTo=function(e,f,g){return d(e,f,a.editor.appendTo,g);};a.add=function(e){var f=this._.pending||(this._.pending=[]);f.push(e);};a.replaceAll=function(){var e=document.getElementsByTagName('textarea');for(var f=0;f'+g+'');else h.push('');}return h.join('');},htmlEncode:function(f){var g=function(k){var l=new d.element('span');l.setText(k);return l.getHtml();},h=g('\n').toLowerCase()=='
    '?function(k){return g(k).replace(/
    /gi,'\n');}:g,i=g('>')=='>'?function(k){return h(k).replace(/>/g,'>');}:h,j=g(' ')=='  '?function(k){return i(k).replace(/ /g,' ');}:i;this.htmlEncode=j;return this.htmlEncode(f);},htmlEncodeAttr:function(f){return f.replace(/"/g,'"').replace(//g,'>');},getNextNumber:(function(){var f=0;return function(){return++f;};})(),getNextId:function(){return 'cke_'+this.getNextNumber();},override:function(f,g){return g(f);},setTimeout:function(f,g,h,i,j){if(!j)j=window;if(!h)h=j;return j.setTimeout(function(){if(i)f.apply(h,[].concat(i));else f.apply(h);},g||0);},trim:(function(){var f=/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g;return function(g){return g.replace(f,'');};})(),ltrim:(function(){var f=/^[ \t\n\r]+/g;return function(g){return g.replace(f,'');};})(),rtrim:(function(){var f=/[ \t\n\r]+$/g;return function(g){return g.replace(f,'');};})(),indexOf:Array.prototype.indexOf?function(f,g){return f.indexOf(g);}:function(f,g){for(var h=0,i=f.length;h',a.document);a.document.getBody().append(f);}if(!/%$/.test(g)){f.setStyle('width',g);return f.$.clientWidth;}return g;};})(),repeat:function(f,g){return new Array(g+1).join(f);},tryThese:function(){var f;for(var g=0,h=arguments.length;g8))&&i)h=i+':'+h;return new d.nodeList(this.$.getElementsByTagName(h));},getHead:function(){var h=this.$.getElementsByTagName('head')[0];if(!h)h=this.getDocumentElement().append(new d.element('head'),true);else h=new d.element(h);return(this.getHead=function(){return h;})();},getBody:function(){var h=new d.element(this.$.body);return(this.getBody=function(){return h;})();},getDocumentElement:function(){var h=new d.element(this.$.documentElement);return(this.getDocumentElement=function(){return h;})();},getWindow:function(){var h=new d.window(this.$.parentWindow||this.$.defaultView);return(this.getWindow=function(){return h;})();},write:function(h){var i=this;i.$.open('text/html','replace');b.isCustomDomain()&&(i.$.domain=document.domain);i.$.write(h);i.$.close();}});d.node=function(h){if(h){switch(h.nodeType){case 9:return new g(h);case 1:return new d.element(h);case 3:return new d.text(h);}d.domObject.call(this,h);}return this;};d.node.prototype=new d.domObject();a.NODE_ELEMENT=1;a.NODE_DOCUMENT=9;a.NODE_TEXT=3;a.NODE_COMMENT=8;a.NODE_DOCUMENT_FRAGMENT=11;a.POSITION_IDENTICAL=0;a.POSITION_DISCONNECTED=1;a.POSITION_FOLLOWING=2; -a.POSITION_PRECEDING=4;a.POSITION_IS_CONTAINED=8;a.POSITION_CONTAINS=16;e.extend(d.node.prototype,{appendTo:function(h,i){h.append(this,i);return h;},clone:function(h,i){var j=this.$.cloneNode(h),k=function(l){if(l.nodeType!=1)return;if(!i)l.removeAttribute('id',false);l.removeAttribute('data-cke-expando',false);if(h){var m=l.childNodes;for(var n=0;n]*>/g,''):i;},getOuterHtml:function(){var j=this;if(j.$.outerHTML)return j.$.outerHTML.replace(/<\?[^>]*>/,'');var i=j.$.ownerDocument.createElement('div');i.appendChild(j.$.cloneNode(true));return i.innerHTML;},setHtml:function(i){return this.$.innerHTML=i;},setText:function(i){h.prototype.setText=this.$.innerText!=undefined?function(j){return this.$.innerText=j;}:function(j){return this.$.textContent=j;};return this.setText(i);},getAttribute:(function(){var i=function(j){return this.$.getAttribute(j,2);};if(c&&(b.ie7Compat||b.ie6Compat))return function(j){var n=this;switch(j){case 'class':j='className';break;case 'http-equiv':j='httpEquiv';break;case 'name':return n.$.name;case 'tabindex':var k=i.call(n,j);if(k!==0&&n.$.tabIndex===0)k=null;return k;break;case 'checked':var l=n.$.attributes.getNamedItem(j),m=l.specified?l.nodeValue:n.$.checked;return m?'checked':null;case 'hspace':case 'value':return n.$[j];case 'style':return n.$.style.cssText;}return i.call(n,j);};else return i;})(),getChildren:function(){return new d.nodeList(this.$.childNodes);},getComputedStyle:c?function(i){return this.$.currentStyle[e.cssStyleToDomStyle(i)];}:function(i){return this.getWindow().$.getComputedStyle(this.$,'').getPropertyValue(i);},getDtd:function(){var i=f[this.getName()];this.getDtd=function(){return i;};return i;},getElementsByTag:g.prototype.getElementsByTag,getTabIndex:c?function(){var i=this.$.tabIndex;if(i===0&&!f.$tabIndex[this.getName()]&&parseInt(this.getAttribute('tabindex'),10)!==0)i=-1;return i;}:b.webkit?function(){var i=this.$.tabIndex;if(i==undefined){i=parseInt(this.getAttribute('tabindex'),10);if(isNaN(i))i=-1;}return i;}:function(){return this.$.tabIndex;},getText:function(){return this.$.textContent||this.$.innerText||'';},getWindow:function(){return this.getDocument().getWindow();},getId:function(){return this.$.id||null;},getNameAtt:function(){return this.$.name||null;},getName:function(){var i=this.$.nodeName.toLowerCase();if(c&&!(document.documentMode>8)){var j=this.$.scopeName;if(j!='HTML')i=j.toLowerCase()+':'+i;}return(this.getName=function(){return i;})();},getValue:function(){return this.$.value;},getFirst:function(i){var j=this.$.firstChild,k=j&&new d.node(j);if(k&&i&&!i(k))k=k.getNext(i);return k;},getLast:function(i){var j=this.$.lastChild,k=j&&new d.node(j);if(k&&i&&!i(k))k=k.getPrevious(i);return k;},getStyle:function(i){return this.$.style[e.cssStyleToDomStyle(i)]; -},is:function(){var i=this.getName();for(var j=0;j0&&(j>2||!k[i[0].nodeName]||j==2&&!k[i[1].nodeName]);},hasAttribute:(function(){function i(j){var k=this.$.attributes.getNamedItem(j);return!!(k&&k.specified);};return c&&b.version<8?function(j){if(j=='name')return!!this.$.name;return i.call(this,j);}:i;})(),hide:function(){this.setStyle('display','none');},moveChildren:function(i,j){var k=this.$;i=i.$;if(k==i)return;var l;if(j)while(l=k.lastChild)i.insertBefore(k.removeChild(l),i.firstChild);else while(l=k.firstChild)i.appendChild(k.removeChild(l));},mergeSiblings:(function(){function i(j,k,l){if(k&&k.type==1){var m=[];while(k.data('cke-bookmark')||k.isEmptyInlineRemoveable()){m.push(k);k=l?k.getNext():k.getPrevious();if(!k||k.type!=1)return;}if(j.isIdentical(k)){var n=l?j.getLast():j.getFirst(); -while(m.length)m.shift().move(j,!l);k.moveChildren(j,!l);k.remove();if(n&&n.type==1)n.mergeSiblings();}}};return function(j){var k=this;if(!(j===false||f.$removeEmpty[k.getName()]||k.is('a')))return;i(k,k.getNext(),true);i(k,k.getPrevious());};})(),show:function(){this.setStyles({display:'',visibility:''});},setAttribute:(function(){var i=function(j,k){this.$.setAttribute(j,k);return this;};if(c&&(b.ie7Compat||b.ie6Compat))return function(j,k){var l=this;if(j=='class')l.$.className=k;else if(j=='style')l.$.style.cssText=k;else if(j=='tabindex')l.$.tabIndex=k;else if(j=='checked')l.$.checked=k;else i.apply(l,arguments);return l;};else if(b.ie8Compat&&b.secure)return function(j,k){if(j=='src'&&k.match(/^http:\/\//))try{i.apply(this,arguments);}catch(l){}else i.apply(this,arguments);return this;};else return i;})(),setAttributes:function(i){for(var j in i)this.setAttribute(j,i[j]);return this;},setValue:function(i){this.$.value=i;return this;},removeAttribute:(function(){var i=function(j){this.$.removeAttribute(j);};if(c&&(b.ie7Compat||b.ie6Compat))return function(j){if(j=='class')j='className';else if(j=='tabindex')j='tabIndex';i.call(this,j);};else return i;})(),removeAttributes:function(i){if(e.isArray(i))for(var j=0;j=100?'':'progid:DXImageTransform.Microsoft.Alpha(opacity='+i+')');}else this.setStyle('opacity',i);},unselectable:b.gecko?function(){this.$.style.MozUserSelect='none';this.on('dragstart',function(i){i.data.preventDefault();});}:b.webkit?function(){this.$.style.KhtmlUserSelect='none';this.on('dragstart',function(i){i.data.preventDefault();});}:function(){if(c||b.opera){var i=this.$,j,k=0;i.unselectable='on';while(j=i.all[k++])switch(j.tagName.toLowerCase()){case 'iframe':case 'textarea':case 'input':case 'select':break;default:j.unselectable='on';}}},getPositionedAncestor:function(){var i=this;while(i.getName()!='html'){if(i.getComputedStyle('position')!='static')return i;i=i.getParent();}return null;},getDocumentPosition:function(i){var D=this; -var j=0,k=0,l=D.getDocument(),m=l.getBody(),n=l.$.compatMode=='BackCompat';if(document.documentElement.getBoundingClientRect){var o=D.$.getBoundingClientRect(),p=l.$,q=p.documentElement,r=q.clientTop||m.$.clientTop||0,s=q.clientLeft||m.$.clientLeft||0,t=true;if(c){var u=l.getDocumentElement().contains(D),v=l.getBody().contains(D);t=n&&v||!n&&u;}if(t){j=o.left+(!n&&q.scrollLeft||m.$.scrollLeft);j-=s;k=o.top+(!n&&q.scrollTop||m.$.scrollTop);k-=r;}}else{var w=D,x=null,y;while(w&&!(w.getName()=='body'||w.getName()=='html')){j+=w.$.offsetLeft-w.$.scrollLeft;k+=w.$.offsetTop-w.$.scrollTop;if(!w.equals(D)){j+=w.$.clientLeft||0;k+=w.$.clientTop||0;}var z=x;while(z&&!z.equals(w)){j-=z.$.scrollLeft;k-=z.$.scrollTop;z=z.getParent();}x=w;w=(y=w.$.offsetParent)?new h(y):null;}}if(i){var A=D.getWindow(),B=i.getWindow();if(!A.equals(B)&&A.$.frameElement){var C=new h(A.$.frameElement).getDocumentPosition(i);j+=C.x;k+=C.y;}}if(!document.documentElement.getBoundingClientRect)if(b.gecko&&!n){j+=D.$.clientLeft?1:0;k+=D.$.clientTop?1:0;}return{x:j,y:k};},scrollIntoView:function(i){var o=this;var j=o.getWindow(),k=j.getViewPaneSize().height,l=k*-1;if(i)l+=k;else{l+=o.$.offsetHeight||0;l+=parseInt(o.getComputedStyle('marginBottom')||0,10)||0;}var m=o.getDocumentPosition();l+=m.y;l=l<0?0:l;var n=j.getScrollPosition().y;if(l>n||lwindow.setTimeout(function(){window.close();},50);")');}return i&&new g(i.contentWindow.document);},copyAttributes:function(i,j){var p=this;var k=p.$.attributes;j=j||{};for(var l=0;l0&&j)j=j.childNodes[i.shift()];return j?new d.node(j):null;},getChildCount:function(){return this.$.childNodes.length;},disableContextMenu:function(){this.on('contextmenu',function(i){if(!i.data.getTarget().hasClass('cke_enable_context_menu'))i.data.preventDefault();});},getDirection:function(i){var j=this;return i?j.getComputedStyle('direction')||j.getDirection()||j.getDocument().$.dir||j.getDocument().getBody().getDirection(1):j.getStyle('direction')||j.getAttribute('dir');},data:function(i,j){i='data-'+i;if(j===undefined)return this.getAttribute(i);else if(j===false)this.removeAttribute(i);else this.setAttribute(i,j);return null;}});(function(){var i={width:['border-left-width','border-right-width','padding-left','padding-right'],height:['border-top-width','border-bottom-width','padding-top','padding-bottom']};function j(k){var l=0;for(var m=0,n=i[k].length;m',bodyId:'',bodyClass:'',fullPage:false,height:200,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,smiley,showblocks,showborders,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',extraPlugins:'',removePlugins:'',protectedSource:[],tabIndex:0,theme:'default',skin:'kama',width:'',baseFloatZIndex:10000}; -var i=a.config;a.focusManager=function(j){if(j.focusManager)return j.focusManager;this.hasFocus=false;this._={editor:j};return this;};a.focusManager.prototype={focus:function(){var k=this;if(k._.timer)clearTimeout(k._.timer);if(!k.hasFocus){if(a.currentInstance)a.currentInstance.focusManager.forceBlur();var j=k._.editor;j.container.getChild(1).addClass('cke_focus');k.hasFocus=true;j.fire('focus');}},blur:function(){var j=this;if(j._.timer)clearTimeout(j._.timer);j._.timer=setTimeout(function(){delete j._.timer;j.forceBlur();},100);},forceBlur:function(){if(this.hasFocus){var j=this._.editor;j.container.getChild(1).removeClass('cke_focus');this.hasFocus=false;j.fire('blur');}}};(function(){var j={};a.lang={languages:{af:1,ar:1,bg:1,bn:1,bs:1,ca:1,cs:1,cy:1,da:1,de:1,el:1,'en-au':1,'en-ca':1,'en-gb':1,en:1,eo:1,es:1,et:1,eu:1,fa:1,fi:1,fo:1,'fr-ca':1,fr:1,gl:1,gu:1,he:1,hi:1,hr:1,hu:1,is:1,it:1,ja:1,ka:1,km:1,ko:1,lt:1,lv:1,mn:1,ms:1,nb:1,nl:1,no:1,pl:1,'pt-br':1,pt:1,ro:1,ru:1,sk:1,sl:1,'sr-latn':1,sr:1,sv:1,th:1,tr:1,uk:1,vi:1,'zh-cn':1,zh:1},load:function(k,l,m){if(!k||!a.lang.languages[k])k=this.detect(l,k);if(!this[k])a.scriptLoader.load(a.getUrl('lang/'+k+'.js'),function(){m(k,this[k]);},this);else m(k,this[k]);},detect:function(k,l){var m=this.languages;l=l||navigator.userLanguage||navigator.language||k;var n=l.toLowerCase().match(/([a-z]+)(?:-([a-z]+))?/),o=n[1],p=n[2];if(m[o+'-'+p])o=o+'-'+p;else if(!m[o])o=null;a.lang.detect=o?function(){return o;}:function(q){return q;};return o||k;}};})();a.scriptLoader=(function(){var j={},k={};return{load:function(l,m,n,o){var p=typeof l=='string';if(p)l=[l];if(!n)n=a;var q=l.length,r=[],s=[],t=function(y){if(m)if(p)m.call(n,y);else m.call(n,r,s);};if(q===0){t(true);return;}var u=function(y,z){(z?r:s).push(y);if(--q<=0){o&&a.document.getDocumentElement().removeStyle('cursor');t(z);}},v=function(y,z){j[y]=1;var A=k[y];delete k[y];for(var B=0;B1)return;var A=new h('script');A.setAttributes({type:'text/javascript',src:y});if(m)if(c)A.$.onreadystatechange=function(){if(A.$.readyState=='loaded'||A.$.readyState=='complete'){A.$.onreadystatechange=null;v(y,true);}};else{A.$.onload=function(){setTimeout(function(){v(y,true);},0);};A.$.onerror=function(){v(y,false);};}A.appendTo(a.document.getHead());};o&&a.document.getDocumentElement().setStyle('cursor','wait');for(var x=0;x1)return;var w=!p.css||!p.css.length,x=!p.js||!p.js.length,y=function(){if(w&&x){p._isLoaded=1;for(var B=0;B=0?x.langCode:J[0];if(!I.langEntries||!I.langEntries[L])G.push(a.getUrl(K+'lang/'+L+'.js'));else{e.extend(x.lang,I.langEntries[L]);L=null;}}F.push(L);E.push(I);}a.scriptLoader.load(G,function(){var M=['beforeInit','init','afterInit'];for(var N=0;N]+)>)|(?:!--([\\S|\\s]*?)-->)|(?:([^\\s>]+)\\s*((?:(?:\"[^\"]*\")|(?:'[^']*')|[^\"'>])*)\\/?>))",'g')};};(function(){var l=/([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))|(?=\s|$))/g,m={checked:1,compact:1,declare:1,defer:1,disabled:1,ismap:1,multiple:1,nohref:1,noresize:1,noshade:1,nowrap:1,readonly:1,selected:1};a.htmlParser.prototype={onTagOpen:function(){},onTagClose:function(){},onText:function(){},onCDATA:function(){},onComment:function(){},parse:function(n){var A=this;var o,p,q=0,r;while(o=A._.htmlPartsRegex.exec(n)){var s=o.index;if(s>q){var t=n.substring(q,s);if(r)r.push(t);else A.onText(t);}q=A._.htmlPartsRegex.lastIndex;if(p=o[1]){p=p.toLowerCase();if(r&&f.$cdata[p]){A.onCDATA(r.join(''));r=null;}if(!r){A.onTagClose(p);continue;}}if(r){r.push(o[0]);continue;}if(p=o[3]){p=p.toLowerCase();if(/="/.test(p))continue; -var u={},v,w=o[4],x=!!(w&&w.charAt(w.length-1)=='/');if(w)while(v=l.exec(w)){var y=v[1].toLowerCase(),z=v[2]||v[3]||v[4]||'';if(!z&&m[y])u[y]=y;else u[y]=z;}A.onTagOpen(p,u,x);if(!r&&f.$cdata[p])r=[];continue;}if(p=o[2])A.onComment(p);}if(n.length>q)A.onText(n.substring(q,n.length));}};})();a.htmlParser.comment=function(l){this.value=l;this._={isBlockLike:false};};a.htmlParser.comment.prototype={type:8,writeHtml:function(l,m){var n=this.value;if(m){if(!(n=m.onComment(n,this)))return;if(typeof n!='string'){n.parent=this.parent;n.writeHtml(l,m);return;}}l.comment(n);}};(function(){a.htmlParser.text=function(l){this.value=l;this._={isBlockLike:false};};a.htmlParser.text.prototype={type:3,writeHtml:function(l,m){var n=this.value;if(m&&!(n=m.onText(n,this)))return;l.text(n);}};})();(function(){a.htmlParser.cdata=function(l){this.value=l;};a.htmlParser.cdata.prototype={type:3,writeHtml:function(l){l.write(this.value);}};})();a.htmlParser.fragment=function(){this.children=[];this.parent=null;this._={isBlockLike:true,hasInlineStarted:false};};(function(){var l=e.extend({table:1,ul:1,ol:1,dl:1},f.table,f.ul,f.ol,f.dl),m=c&&b.version<8?{dd:1,dt:1}:{},n={ol:1,ul:1},o=e.extend({},{html:1},f.html,f.body,f.head,{style:1,script:1});function p(q){return q.name=='a'&&q.attributes.href||f.$removeEmpty[q.name];};a.htmlParser.fragment.fromHtml=function(q,r,s){var t=new a.htmlParser(),u=s||new a.htmlParser.fragment(),v=[],w=[],x=u,y=false,z=false;function A(D){var E;if(v.length>0)for(var F=0;F=0;E--){if(D==v[E].name){v.splice(E,1);return;}}var F=[],G=[],H=x;while(H!=u&&H.name!=D){if(!H._.isBlockLike)G.unshift(H);F.push(H);H=H.returnPoint||H.parent;}if(H!=u){for(E=0;E0?t.children[r-1]:null;if(s){if(q._.isBlockLike&&s.type==3){s.value=e.rtrim(s.value);if(s.value.length===0){t.children.pop();t.add(q);return;}}s.next=q;}q.previous=s;q.parent=t;t.children.splice(r,0,q);t._.hasInlineStarted=q.type==3||q.type==1&&!q._.isBlockLike;},writeHtml:function(q,r){var s;this.filterChildren=function(){var t=new a.htmlParser.basicWriter();this.writeChildrenHtml.call(this,t,r,true);var u=t.getHtml();this.children=new a.htmlParser.fragment.fromHtml(u).children;s=1;};!this.name&&r&&r.onFragment(this);this.writeChildrenHtml(q,s?null:r);},writeChildrenHtml:function(q,r){for(var s=0;sn?1:0;};a.htmlParser.element.prototype={type:1,add:a.htmlParser.fragment.prototype.add,clone:function(){return new a.htmlParser.element(this.name,this.attributes);},writeHtml:function(m,n){var o=this.attributes,p=this,q=p.name,r,s,t,u;p.filterChildren=function(){if(!u){var B=new a.htmlParser.basicWriter();a.htmlParser.fragment.prototype.writeChildrenHtml.call(p,B,n);p.children=new a.htmlParser.fragment.fromHtml(B.getHtml(),0,p.clone()).children;u=1;}};if(n){for(;;){if(!(q=n.onElementName(q)))return;p.name=q;if(!(p=n.onElement(p)))return;p.parent=this.parent;if(p.name==q)break;if(p.type!=1){p.writeHtml(m,n);return;}q=p.name;if(!q){for(var v=0,w=this.children.length;v=0;u--){var x=r[u];if(x){x.pri=s;q.splice(t,0,x);}}}};function n(q,r,s){if(r)for(var t in r){var u=q[t];q[t]=o(u,r[t],s);if(!u)q.$length++;}};function o(q,r,s){if(r){r.pri=s;if(q){if(!q.splice){if(q.pri>s)q=[r,q];else q=[q,r];q.filter=p;}else m(q,r,s);return q;}else{r.filter=r;return r;}}};function p(q){var r=q.type||q instanceof a.htmlParser.fragment;for(var s=0;s');else this._.output.push('>');},attribute:function(l,m){if(typeof m=='string')m=e.htmlEncodeAttr(m);this._.output.push(' ',l,'="',m,'"');},closeTag:function(l){this._.output.push('');},text:function(l){this._.output.push(l);},comment:function(l){this._.output.push('');},write:function(l){this._.output.push(l);},reset:function(){this._.output=[];this._.indent=false;},getHtml:function(l){var m=this._.output.join('');if(l)this.reset();return m;}}});delete a.loadFullCore;a.instances={};a.document=new g(document);a.add=function(l){a.instances[l.name]=l; -l.on('focus',function(){if(a.currentInstance!=l){a.currentInstance=l;a.fire('currentInstance');}});l.on('blur',function(){if(a.currentInstance==l){a.currentInstance=null;a.fire('currentInstance');}});};a.remove=function(l){delete a.instances[l.name];};a.on('instanceDestroyed',function(){if(e.isEmpty(this.instances))a.fire('reset');});a.TRISTATE_ON=1;a.TRISTATE_OFF=2;a.TRISTATE_DISABLED=0;d.comment=e.createClass({base:d.node,$:function(l,m){if(typeof l=='string')l=(m?m.$:document).createComment(l);this.base(l);},proto:{type:8,getOuterHtml:function(){return '';}}});(function(){var l={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},m={body:1,div:1,table:1,tbody:1,tr:1,td:1,th:1,form:1,fieldset:1},n=function(o){var p=o.getChildren();for(var q=0,r=p.count();q0&&C.getChild(v.startOffset-1);this._.guardRTL=function(F,G){return(!G||!C.equals(F))&&(!D||!F.equals(D))&&(F.type!=1||!G||F.getName()!='body');};}var E=s?this._.guardRTL:this._.guardLTR;if(x)w=function(F,G){if(E(F,G)===false)return false;return x(F,G);};else w=E;if(this.current)u=this.current[z](false,y,w);else if(s){u=v.endContainer;if(v.endOffset>0){u=u.getChild(v.endOffset-1);if(w(u)===false)u=null;}else u=w(u,true)===false?null:u.getPreviousSourceNode(true,y,w);}else{u=v.startContainer;u=u.getChild(v.startOffset);if(u){if(w(u)===false)u=null;}else u=w(v.startContainer,true)===false?null:v.startContainer.getNextSourceNode(true,y,w);}while(u&&!this._.end){this.current=u;if(!this.evaluator||this.evaluator(u)!==false){if(!t)return u;}else if(t&&this.evaluator)return false;u=u[z](false,y,w);}this.end();return this.current=null;};function m(s){var t,u=null;while(t=l.call(this,s))u=t;return u;};d.walker=e.createClass({$:function(s){this.range=s;this._={};},proto:{end:function(){this._.end=1;},next:function(){return l.call(this);},previous:function(){return l.call(this,1);},checkForward:function(){return l.call(this,0,1)!==false;},checkBackward:function(){return l.call(this,1,1)!==false;},lastForward:function(){return m.call(this);},lastBackward:function(){return m.call(this,1);},reset:function(){delete this.current;this._={};}}});var n={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};h.prototype.isBlockBoundary=function(s){var t=s?e.extend({},f.$block,s||{}):f.$block;return this.getComputedStyle('float')=='none'&&n[this.getComputedStyle('display')]||t[this.getName()];};d.walker.blockBoundary=function(s){return function(t,u){return!(t.type==1&&t.isBlockBoundary(s)); -};};d.walker.listItemBoundary=function(){return this.blockBoundary({br:1});};d.walker.bookmark=function(s,t){function u(v){return v&&v.getName&&v.getName()=='span'&&v.data('cke-bookmark');};return function(v){var w,x;w=v&&!v.getName&&(x=v.getParent())&&u(x);w=s?w:w||u(v);return!!(t^w);};};d.walker.whitespaces=function(s){return function(t){var u=t&&t.type==3&&!e.trim(t.getText());return!!(s^u);};};d.walker.invisible=function(s){var t=d.walker.whitespaces();return function(u){var v=t(u)||u.is&&!u.$.offsetHeight;return!!(s^v);};};d.walker.nodeType=function(s,t){return function(u){return!!(t^u.type==s);};};var o=/^[\t\r\n ]*(?: |\xa0)$/,p=d.walker.whitespaces(),q=d.walker.bookmark(),r=function(s){return q(s)||p(s)||s.type==1&&s.getName() in f.$inline&&!(s.getName() in f.$empty);};h.prototype.getBogus=function(){var s=this;do s=s.getPreviousSourceNode();while(r(s));if(s&&(!c?s.is&&s.is('br'):s.getText&&o.test(s.getText())))return s;return false;};})();d.range=function(l){var m=this;m.startContainer=null;m.startOffset=null;m.endContainer=null;m.endOffset=null;m.collapsed=true;m.document=l;};(function(){var l=function(t){t.collapsed=t.startContainer&&t.endContainer&&t.startContainer.equals(t.endContainer)&&t.startOffset==t.endOffset;},m=function(t,u,v,w){t.optimizeBookmark();var x=t.startContainer,y=t.endContainer,z=t.startOffset,A=t.endOffset,B,C;if(y.type==3)y=y.split(A);else if(y.getChildCount()>0)if(A>=y.getChildCount()){y=y.append(t.document.createText(''));C=true;}else y=y.getChild(A);if(x.type==3){x.split(z);if(x.equals(y))y=x.getNext();}else if(!z){x=x.getFirst().insertBeforeMe(t.document.createText(''));B=true;}else if(z>=x.getChildCount()){x=x.append(t.document.createText(''));B=true;}else x=x.getChild(z).getPrevious();var D=x.getParents(),E=y.getParents(),F,G,H;for(F=0;F0&&!J.equals(y))K=I.append(J.clone());if(!D[O]||J.$.parentNode!=D[O].$.parentNode){L=J.getPrevious();while(L){if(L.equals(D[O])||L.equals(x))break;M=L.getPrevious();if(u==2)I.$.insertBefore(L.$.cloneNode(true),I.$.firstChild);else{L.remove();if(u==1)I.$.insertBefore(L.$,I.$.firstChild);}L=M;}}if(I)I=K;}if(u==2){var P=t.startContainer;if(P.type==3){P.$.data+=P.$.nextSibling.data; -P.$.parentNode.removeChild(P.$.nextSibling);}var Q=t.endContainer;if(Q.type==3&&Q.$.nextSibling){Q.$.data+=Q.$.nextSibling.data;Q.$.parentNode.removeChild(Q.$.nextSibling);}}else{if(G&&H&&(x.$.parentNode!=G.$.parentNode||y.$.parentNode!=H.$.parentNode)){var R=H.getIndex();if(B&&H.$.parentNode==x.$.parentNode)R--;if(w&&G.type==1){var S=h.createFromHtml(' ',t.document);S.insertAfter(G);G.mergeSiblings(false);t.moveToBookmark({startNode:S});}else t.setStart(H.getParent(),R);}t.collapse(true);}if(B)x.remove();if(C&&y.$.parentNode)y.remove();},n={abbr:1,acronym: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,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1};function o(t){var u=false,v=d.walker.bookmark(true);return function(w){if(v(w))return true;if(w.type==3){if(w.hasAscendant('pre')||e.trim(w.getText()).length)return false;}else if(w.type==1)if(!n[w.getName()])if(!t&&!c&&w.getName()=='br'&&!u)u=true;else return false;return true;};};function p(t){return t.type!=3&&t.getName() in f.$removeEmpty||!e.trim(t.getText())||!!t.getParent().data('cke-bookmark');};var q=new d.walker.whitespaces(),r=new d.walker.bookmark();function s(t){return!q(t)&&!r(t);};d.range.prototype={clone:function(){var u=this;var t=new d.range(u.document);t.startContainer=u.startContainer;t.startOffset=u.startOffset;t.endContainer=u.endContainer;t.endOffset=u.endOffset;t.collapsed=u.collapsed;return t;},collapse:function(t){var u=this;if(t){u.endContainer=u.startContainer;u.endOffset=u.startOffset;}else{u.startContainer=u.endContainer;u.startOffset=u.endOffset;}u.collapsed=true;},cloneContents:function(){var t=new d.documentFragment(this.document);if(!this.collapsed)m(this,2,t);return t;},deleteContents:function(t){if(this.collapsed)return;m(this,0,null,t);},extractContents:function(t){var u=new d.documentFragment(this.document);if(!this.collapsed)m(this,1,u,t);return u;},createBookmark:function(t){var z=this;var u,v,w,x,y=z.collapsed;u=z.document.createElement('span');u.data('cke-bookmark',1);u.setStyle('display','none');u.setHtml(' ');if(t){w='cke_bm_'+e.getNextNumber();u.setAttribute('id',w+'S');}if(!y){v=u.clone();v.setHtml(' ');if(t)v.setAttribute('id',w+'E');x=z.clone();x.collapse();x.insertNode(v);}x=z.clone();x.collapse(true);x.insertNode(u);if(v){z.setStartAfter(u);z.setEndBefore(v);}else z.moveToPosition(u,4);return{startNode:t?w+'S':u,endNode:t?w+'E':v,serializable:t,collapsed:y}; -},createBookmark2:function(t){var B=this;var u=B.startContainer,v=B.endContainer,w=B.startOffset,x=B.endOffset,y=B.collapsed,z,A;if(!u||!v)return{start:0,end:0};if(t){if(u.type==1){z=u.getChild(w);if(z&&z.type==3&&w>0&&z.getPrevious().type==3){u=z;w=0;}if(z&&z.type==1)w=z.getIndex(1);}while(u.type==3&&(A=u.getPrevious())&&A.type==3){u=A;w+=A.getLength();}if(!y){if(v.type==1){z=v.getChild(x);if(z&&z.type==3&&x>0&&z.getPrevious().type==3){v=z;x=0;}if(z&&z.type==1)x=z.getIndex(1);}while(v.type==3&&(A=v.getPrevious())&&A.type==3){v=A;x+=A.getLength();}}}return{start:u.getAddress(t),end:y?null:v.getAddress(t),startOffset:w,endOffset:x,normalized:t,collapsed:y,is2:true};},moveToBookmark:function(t){var B=this;if(t.is2){var u=B.document.getByAddress(t.start,t.normalized),v=t.startOffset,w=t.end&&B.document.getByAddress(t.end,t.normalized),x=t.endOffset;B.setStart(u,v);if(w)B.setEnd(w,x);else B.collapse(true);}else{var y=t.serializable,z=y?B.document.getById(t.startNode):t.startNode,A=y?B.document.getById(t.endNode):t.endNode;B.setStartBefore(z);z.remove();if(A){B.setEndBefore(A);A.remove();}else B.collapse(true);}},getBoundaryNodes:function(){var y=this;var t=y.startContainer,u=y.endContainer,v=y.startOffset,w=y.endOffset,x;if(t.type==1){x=t.getChildCount();if(x>v)t=t.getChild(v);else if(x<1)t=t.getPreviousSourceNode();else{t=t.$;while(t.lastChild)t=t.lastChild;t=new d.node(t);t=t.getNextSourceNode()||t;}}if(u.type==1){x=u.getChildCount();if(x>w)u=u.getChild(w).getPreviousSourceNode(true);else if(x<1)u=u.getPreviousSourceNode();else{u=u.$;while(u.lastChild)u=u.lastChild;u=new d.node(u);}}if(t.getPosition(u)&2)t=u;return{startNode:t,endNode:u};},getCommonAncestor:function(t,u){var y=this;var v=y.startContainer,w=y.endContainer,x;if(v.equals(w)){if(t&&v.type==1&&y.startOffset==y.endOffset-1)x=v.getChild(y.startOffset);else x=v;}else x=v.getCommonAncestor(w);return u&&!x.is?x.getParent():x;},optimize:function(){var v=this;var t=v.startContainer,u=v.startOffset;if(t.type!=1)if(!u)v.setStartBefore(t);else if(u>=t.getLength())v.setStartAfter(t);t=v.endContainer;u=v.endOffset;if(t.type!=1)if(!u)v.setEndBefore(t);else if(u>=t.getLength())v.setEndAfter(t);},optimizeBookmark:function(){var v=this;var t=v.startContainer,u=v.endContainer;if(t.is&&t.is('span')&&t.data('cke-bookmark'))v.setStartAt(t,3);if(u&&u.is&&u.is('span')&&u.data('cke-bookmark'))v.setEndAt(u,4);},trim:function(t,u){var B=this;var v=B.startContainer,w=B.startOffset,x=B.collapsed;if((!t||x)&&v&&v.type==3){if(!w){w=v.getIndex(); -v=v.getParent();}else if(w>=v.getLength()){w=v.getIndex()+1;v=v.getParent();}else{var y=v.split(w);w=v.getIndex()+1;v=v.getParent();if(B.startContainer.equals(B.endContainer))B.setEnd(y,B.endOffset-B.startOffset);else if(v.equals(B.endContainer))B.endOffset+=1;}B.setStart(v,w);if(x){B.collapse(true);return;}}var z=B.endContainer,A=B.endOffset;if(!(u||x)&&z&&z.type==3){if(!A){A=z.getIndex();z=z.getParent();}else if(A>=z.getLength()){A=z.getIndex()+1;z=z.getParent();}else{z.split(A);A=z.getIndex()+1;z=z.getParent();}B.setEnd(z,A);}},enlarge:function(t,u){switch(t){case 1:if(this.collapsed)return;var v=this.getCommonAncestor(),w=this.document.getBody(),x,y,z,A,B,C=false,D,E,F=this.startContainer,G=this.startOffset;if(F.type==3){if(G){F=!e.trim(F.substring(0,G)).length&&F;C=!!F;}if(F)if(!(A=F.getPrevious()))z=F.getParent();}else{if(G)A=F.getChild(G-1)||F.getLast();if(!A)z=F;}while(z||A){if(z&&!A){if(!B&&z.equals(v))B=true;if(!w.contains(z))break;if(!C||z.getComputedStyle('display')!='inline'){C=false;if(B)x=z;else this.setStartBefore(z);}A=z.getPrevious();}while(A){D=false;if(A.type==3){E=A.getText();if(/[^\s\ufeff]/.test(E))A=null;D=/[\s\ufeff]$/.test(E);}else if((A.$.offsetWidth>0||u&&A.is('br'))&&!A.data('cke-bookmark'))if(C&&f.$removeEmpty[A.getName()]){E=A.getText();if(/[^\s\ufeff]/.test(E))A=null;else{var H=A.$.all||A.$.getElementsByTagName('*');for(var I=0,J;J=H[I++];){if(!f.$removeEmpty[J.nodeName.toLowerCase()]){A=null;break;}}}if(A)D=!!E.length;}else A=null;if(D)if(C){if(B)x=z;else if(z)this.setStartBefore(z);}else C=true;if(A){var K=A.getPrevious();if(!z&&!K){z=A;A=null;break;}A=K;}else z=null;}if(z)z=z.getParent();}F=this.endContainer;G=this.endOffset;z=A=null;B=C=false;if(F.type==3){F=!e.trim(F.substring(G)).length&&F;C=!(F&&F.getLength());if(F)if(!(A=F.getNext()))z=F.getParent();}else{A=F.getChild(G);if(!A)z=F;}while(z||A){if(z&&!A){if(!B&&z.equals(v))B=true;if(!w.contains(z))break;if(!C||z.getComputedStyle('display')!='inline'){C=false;if(B)y=z;else if(z)this.setEndAfter(z);}A=z.getNext();}while(A){D=false;if(A.type==3){E=A.getText();if(/[^\s\ufeff]/.test(E))A=null;D=/^[\s\ufeff]/.test(E);}else if((A.$.offsetWidth>0||u&&A.is('br'))&&!A.data('cke-bookmark'))if(C&&f.$removeEmpty[A.getName()]){E=A.getText();if(/[^\s\ufeff]/.test(E))A=null;else{H=A.$.all||A.$.getElementsByTagName('*');for(I=0;J=H[I++];){if(!f.$removeEmpty[J.nodeName.toLowerCase()]){A=null;break;}}}if(A)D=!!E.length;}else A=null;if(D)if(C)if(B)y=z;else this.setEndAfter(z);if(A){K=A.getNext(); -if(!z&&!K){z=A;A=null;break;}A=K;}else z=null;}if(z)z=z.getParent();}if(x&&y){v=x.contains(y)?y:x;this.setStartBefore(v);this.setEndAfter(v);}break;case 2:case 3:var L=new d.range(this.document);w=this.document.getBody();L.setStartAt(w,1);L.setEnd(this.startContainer,this.startOffset);var M=new d.walker(L),N,O,P=d.walker.blockBoundary(t==3?{br:1}:null),Q=function(W){var X=P(W);if(!X)N=W;return X;},R=function(W){var X=Q(W);if(!X&&W.is&&W.is('br'))O=W;return X;};M.guard=Q;z=M.lastBackward();N=N||w;this.setStartAt(N,!N.is('br')&&(!z&&this.checkStartOfBlock()||z&&N.contains(z))?1:4);if(t==3){var S=this.clone();M=new d.walker(S);var T=d.walker.whitespaces(),U=d.walker.bookmark();M.evaluator=function(W){return!T(W)&&!U(W);};var V=M.previous();if(V&&V.type==1&&V.is('br'))return;}L=this.clone();L.collapse();L.setEndAt(w,2);M=new d.walker(L);M.guard=t==3?R:Q;N=null;z=M.lastForward();N=N||w;this.setEndAt(N,!z&&this.checkEndOfBlock()||z&&N.contains(z)?2:3);if(O)this.setEndAfter(O);}},shrink:function(t,u){if(!this.collapsed){t=t||2;var v=this.clone(),w=this.startContainer,x=this.endContainer,y=this.startOffset,z=this.endOffset,A=this.collapsed,B=1,C=1;if(w&&w.type==3)if(!y)v.setStartBefore(w);else if(y>=w.getLength())v.setStartAfter(w);else{v.setStartBefore(w);B=0;}if(x&&x.type==3)if(!z)v.setEndBefore(x);else if(z>=x.getLength())v.setEndAfter(x);else{v.setEndAfter(x);C=0;}var D=new d.walker(v),E=d.walker.bookmark();D.evaluator=function(I){return I.type==(t==1?1:3);};var F;D.guard=function(I,J){if(E(I))return true;if(t==1&&I.type==3)return false;if(J&&I.equals(F))return false;if(!J&&I.type==1)F=I;return true;};if(B){var G=D[t==1?'lastForward':'next']();G&&this.setStartAt(G,u?1:3);}if(C){D.reset();var H=D[t==1?'lastBackward':'previous']();H&&this.setEndAt(H,u?2:4);}return!!(B||C);}},insertNode:function(t){var x=this;x.optimizeBookmark();x.trim(false,true);var u=x.startContainer,v=x.startOffset,w=u.getChild(v);if(w)t.insertBefore(w);else u.append(t);if(t.getParent().equals(x.endContainer))x.endOffset++;x.setStartBefore(t);},moveToPosition:function(t,u){this.setStartAt(t,u);this.collapse(true);},selectNodeContents:function(t){this.setStart(t,0);this.setEnd(t,t.type==3?t.getLength():t.getChildCount());},setStart:function(t,u){var v=this;if(t.type==1&&f.$empty[t.getName()])u=t.getIndex(),t=t.getParent();v.startContainer=t;v.startOffset=u;if(!v.endContainer){v.endContainer=t;v.endOffset=u;}l(v);},setEnd:function(t,u){var v=this;if(t.type==1&&f.$empty[t.getName()])u=t.getIndex()+1,t=t.getParent(); -v.endContainer=t;v.endOffset=u;if(!v.startContainer){v.startContainer=t;v.startOffset=u;}l(v);},setStartAfter:function(t){this.setStart(t.getParent(),t.getIndex()+1);},setStartBefore:function(t){this.setStart(t.getParent(),t.getIndex());},setEndAfter:function(t){this.setEnd(t.getParent(),t.getIndex()+1);},setEndBefore:function(t){this.setEnd(t.getParent(),t.getIndex());},setStartAt:function(t,u){var v=this;switch(u){case 1:v.setStart(t,0);break;case 2:if(t.type==3)v.setStart(t,t.getLength());else v.setStart(t,t.getChildCount());break;case 3:v.setStartBefore(t);break;case 4:v.setStartAfter(t);}l(v);},setEndAt:function(t,u){var v=this;switch(u){case 1:v.setEnd(t,0);break;case 2:if(t.type==3)v.setEnd(t,t.getLength());else v.setEnd(t,t.getChildCount());break;case 3:v.setEndBefore(t);break;case 4:v.setEndAfter(t);}l(v);},fixBlock:function(t,u){var x=this;var v=x.createBookmark(),w=x.document.createElement(u);x.collapse(t);x.enlarge(2);x.extractContents().appendTo(w);w.trim();if(!c)w.appendBogus();x.insertNode(w);x.moveToBookmark(v);return w;},splitBlock:function(t){var D=this;var u=new d.elementPath(D.startContainer),v=new d.elementPath(D.endContainer),w=u.blockLimit,x=v.blockLimit,y=u.block,z=v.block,A=null;if(!w.equals(x))return null;if(t!='br'){if(!y){y=D.fixBlock(true,t);z=new d.elementPath(D.endContainer).block;}if(!z)z=D.fixBlock(false,t);}var B=y&&D.checkStartOfBlock(),C=z&&D.checkEndOfBlock();D.deleteContents();if(y&&y.equals(z))if(C){A=new d.elementPath(D.startContainer);D.moveToPosition(z,4);z=null;}else if(B){A=new d.elementPath(D.startContainer);D.moveToPosition(y,3);y=null;}else{z=D.splitElement(y);if(!c&&!y.is('ul','ol'))y.appendBogus();}return{previousBlock:y,nextBlock:z,wasStartOfBlock:B,wasEndOfBlock:C,elementPath:A};},splitElement:function(t){var w=this;if(!w.collapsed)return null;w.setEndAt(t,2);var u=w.extractContents(),v=t.clone(false);u.appendTo(v);v.insertAfter(t);w.moveToPosition(t,4);return v;},checkBoundaryOfElement:function(t,u){var v=u==1,w=this.clone();w.collapse(v);w[v?'setStartAt':'setEndAt'](t,v?1:2);var x=new d.walker(w);x.evaluator=p;return x[v?'checkBackward':'checkForward']();},checkStartOfBlock:function(){var z=this;var t=z.startContainer,u=z.startOffset;if(u&&t.type==3){var v=e.ltrim(t.substring(0,u));if(v.length)return false;}z.trim();var w=new d.elementPath(z.startContainer),x=z.clone();x.collapse(true);x.setStartAt(w.block||w.blockLimit,1);var y=new d.walker(x);y.evaluator=o(true);return y.checkBackward();},checkEndOfBlock:function(){var z=this; -var t=z.endContainer,u=z.endOffset;if(t.type==3){var v=e.rtrim(t.substring(u));if(v.length)return false;}z.trim();var w=new d.elementPath(z.endContainer),x=z.clone();x.collapse(false);x.setEndAt(w.block||w.blockLimit,2);var y=new d.walker(x);y.evaluator=o(false);return y.checkForward();},checkReadOnly:(function(){function t(u,v){while(u){if(u.type==1)if(u.getAttribute('contentEditable')=='false'&&!u.data('cke-editable'))return 0;else if(u.is('html')||u.getAttribute('contentEditable')=='true'&&(u.contains(v)||u.equals(v)))break;u=u.getParent();}return 1;};return function(){var u=this.startContainer,v=this.endContainer;return!(t(u,v)&&t(v,u));};})(),moveToElementEditablePosition:function(t,u){function v(x,y){var z;if(x.type==1&&x.isEditable(false)&&!f.$nonEditable[x.getName()])z=x[u?'getLast':'getFirst'](s);if(!y&&!z)z=x[u?'getPrevious':'getNext'](s);return z;};var w=0;while(t){if(t.type==3){this.moveToPosition(t,u?4:3);w=1;break;}if(t.type==1)if(t.isEditable()){this.moveToPosition(t,u?2:1);w=1;}t=v(t,w);}return!!w;},moveToElementEditStart:function(t){return this.moveToElementEditablePosition(t);},moveToElementEditEnd:function(t){return this.moveToElementEditablePosition(t,true);},getEnclosedNode:function(){var t=this.clone();t.optimize();if(t.startContainer.type!=1||t.endContainer.type!=1)return null;var u=new d.walker(t),v=d.walker.bookmark(true),w=d.walker.whitespaces(true),x=function(z){return w(z)&&v(z);};t.evaluator=x;var y=u.next();u.reset();return y&&y.equals(u.previous())?y:null;},getTouchedStartNode:function(){var t=this.startContainer;if(this.collapsed||t.type!=1)return t;return t.getChild(this.startOffset)||t;},getTouchedEndNode:function(){var t=this.endContainer;if(this.collapsed||t.type!=1)return t;return t.getChild(this.endOffset-1)||t;}};})();a.POSITION_AFTER_START=1;a.POSITION_BEFORE_END=2;a.POSITION_BEFORE_START=3;a.POSITION_AFTER_END=4;a.ENLARGE_ELEMENT=1;a.ENLARGE_BLOCK_CONTENTS=2;a.ENLARGE_LIST_ITEM_CONTENTS=3;a.START=1;a.END=2;a.STARTEND=3;a.SHRINK_ELEMENT=1;a.SHRINK_TEXT=2;(function(){d.rangeList=function(n){if(n instanceof d.rangeList)return n;if(!n)n=[];else if(n instanceof d.range)n=[n];return e.extend(n,l);};var l={createIterator:function(){var n=this,o=d.walker.bookmark(),p=function(s){return!(s.is&&s.is('tr'));},q=[],r;return{getNextRange:function(s){r=r==undefined?0:r+1;var t=n[r];if(t&&n.length>1){if(!r)for(var u=n.length-1;u>=0;u--)q.unshift(n[u].createBookmark(true));if(s){var v=0;while(n[r+v+1]){var w=t.document,x=0,y=w.getById(q[v].endNode),z=w.getById(q[v+1].startNode),A; -while(1){A=y.getNextSourceNode(false);if(!z.equals(A)){if(o(A)||A.type==1&&A.isBlockBoundary()){y=A;continue;}}else x=1;break;}if(!x)break;v++;}}t.moveToBookmark(q.shift());while(v--){A=n[++r];A.moveToBookmark(q.shift());t.setEnd(A.endContainer,A.endOffset);}}return t;}};},createBookmarks:function(n){var s=this;var o=[],p;for(var q=0;q',a.document);l.appendTo(a.document.getHead());try{b.hc=l.getComputedStyle('border-top-color')==l.getComputedStyle('border-right-color');}catch(m){b.hc=false;}if(b.hc)b.cssClass+=' cke_hc';l.remove();})();j.load(i.corePlugins.split(','),function(){a.status='loaded';a.fire('loaded');var l=a._.pending;if(l){delete a._.pending;for(var m=0;m0){z=A.shift();while(!z.getParent().equals(D))z=z.getParent();if(!z.equals(H))E.push(z);H=z;}while(E.length>0){z=E.shift();if(z.getName()=='blockquote'){var I=new d.documentFragment(q.document);while(z.getFirst()){I.append(z.getFirst().remove());A.push(I.getLast());}I.replace(z);}else A.push(z);}var J=q.document.createElement('blockquote');J.insertBefore(A[0]);while(A.length>0){z=A.shift();J.append(z);}}else if(r==1){var K=[],L={};while(z=y.getNextParagraph()){var M=null,N=null;while(z.getParent()){if(z.getParent().getName()=='blockquote'){M=z.getParent();N=z;break;}z=z.getParent();}if(M&&N&&!N.getCustomData('blockquote_moveout')){K.push(N);h.setMarker(L,N,'blockquote_moveout',true);}}h.clearAllMarkers(L);var O=[],P=[];L={};while(K.length>0){var Q=K.shift();J=Q.getParent();if(!Q.getPrevious())Q.remove().insertBefore(J);else if(!Q.getNext())Q.remove().insertAfter(J);else{Q.breakParent(Q.getParent());P.push(Q.getNext());}if(!J.getCustomData('blockquote_processed')){P.push(J);h.setMarker(L,J,'blockquote_processed',true);}O.push(Q);}h.clearAllMarkers(L);for(F=P.length-1;F>=0;F--){J=P[F];if(o(J))J.remove();}if(q.config.enterMode==2){var R=true;while(O.length){Q=O.shift();if(Q.getName()=='div'){I=new d.documentFragment(q.document);var S=R&&Q.getPrevious()&&!(Q.getPrevious().type==1&&Q.getPrevious().isBlockBoundary());if(S)I.append(q.document.createElement('br'));var T=Q.getNext()&&!(Q.getNext().type==1&&Q.getNext().isBlockBoundary());while(Q.getFirst())Q.getFirst().remove().appendTo(I);if(T)I.append(q.document.createElement('br'));I.replace(Q);R=false;}}}}s.selectBookmarks(u);q.focus();}};j.add('blockquote',{init:function(q){q.addCommand('blockquote',p);q.ui.addButton('Blockquote',{label:q.lang.blockquote,command:'blockquote'});q.on('selectionChange',n);},requires:['domiterator']});})();j.add('button',{beforeInit:function(m){m.ui.addHandler('button',k.button.handler);}});a.UI_BUTTON='button';k.button=function(m){e.extend(this,m,{title:m.label,className:m.className||m.command&&'cke_button_'+m.command||'',click:m.click||(function(n){n.execCommand(m.command); -})});this._={};};k.button.handler={create:function(m){return new k.button(m);}};(function(){k.button.prototype={render:function(m,n){var o=b,p=this._.id=e.getNextId(),q='',r=this.command,s;this._.editor=m;var t={id:p,button:this,editor:m,focus:function(){var z=a.document.getById(p);z.focus();},execute:function(){if(c&&b.version<7)e.setTimeout(function(){this.button.click(m);},0,this);else this.button.click(m);}},u=e.addFunction(function(z){if(t.onkey){z=new d.event(z);return t.onkey(t,z.getKeystroke())!==false;}}),v=e.addFunction(function(z){var A;if(t.onfocus)A=t.onfocus(t,new d.event(z))!==false;if(b.gecko&&b.version<10900)z.preventBubble();return A;});t.clickFn=s=e.addFunction(t.execute,t);if(this.modes){var w={};function x(){var z=m.mode;if(z){var A=this.modes[z]?w[z]!=undefined?w[z]:2:0;this.setState(m.readOnly&&!this.readOnly?0:A);}};m.on('beforeModeUnload',function(){if(m.mode&&this._.state!=0)w[m.mode]=this._.state;},this);m.on('mode',x,this);!this.readOnly&&m.on('readOnly',x,this);}else if(r){r=m.getCommand(r);if(r){r.on('state',function(){this.setState(r.state);},this);q+='cke_'+(r.state==1?'on':r.state==0?'disabled':'off');}}if(!r)q+='cke_off';if(this.className)q+=' '+this.className;n.push('','=10900&&!o.hc?'':'" href="javascript:void(\''+(this.title||'').replace("'",'')+"')\"",' title="',this.title,'" tabindex="-1" hidefocus="true" role="button" aria-labelledby="'+p+'_label"'+(this.hasArrow?' aria-haspopup="true"':''));if(o.opera||o.gecko&&o.mac)n.push(' onkeypress="return false;"');if(o.gecko)n.push(' onblur="this.style.cssText = this.style.cssText;"');n.push(' onkeydown="return CKEDITOR.tools.callFunction(',u,', event);" onfocus="return CKEDITOR.tools.callFunction(',v,', event);" '+(c?'onclick="return false;" onmouseup':'onclick')+'="CKEDITOR.tools.callFunction(',s,', this); return false;"> ',this.label,'');if(this.hasArrow)n.push(''+(b.hc?'▼':' ')+'');n.push('','');if(this.onRender)this.onRender();return t;},setState:function(m){if(this._.state==m)return false;this._.state=m;var n=a.document.getById(this._.id);if(n){n.setState(m); -m==0?n.setAttribute('aria-disabled',true):n.removeAttribute('aria-disabled');m==1?n.setAttribute('aria-pressed',true):n.removeAttribute('aria-pressed');return true;}else return false;}};})();k.prototype.addButton=function(m,n){this.add(m,'button',n);};(function(){var m=function(y,z){var A=y.document,B=A.getBody(),C=0,D=function(){C=1;};B.on(z,D);(b.version>7?A.$:A.$.selection.createRange()).execCommand(z);B.removeListener(z,D);return C;},n=c?function(y,z){return m(y,z);}:function(y,z){try{return y.document.$.execCommand(z,false,null);}catch(A){return false;}},o=function(y){var z=this;z.type=y;z.canUndo=z.type=='cut';z.startDisabled=true;};o.prototype={exec:function(y,z){this.type=='cut'&&t(y);var A=n(y,this.type);if(!A)alert(y.lang.clipboard[this.type+'Error']);return A;}};var p={canUndo:false,exec:c?function(y){y.focus();if(!y.document.getBody().fire('beforepaste')&&!m(y,'paste')){y.fire('pasteDialog');return false;}}:function(y){try{if(!y.document.getBody().fire('beforepaste')&&!y.document.$.execCommand('Paste',false,null))throw 0;}catch(z){setTimeout(function(){y.fire('pasteDialog');},0);return false;}}},q=function(y){if(this.mode!='wysiwyg')return;switch(y.data.keyCode){case 1114112+86:case 2228224+45:var z=this.document.getBody();if(!c&&z.fire('beforepaste'))y.cancel();else if(b.opera||b.gecko&&b.version<10900)z.fire('paste');return;case 1114112+88:case 2228224+46:var A=this;this.fire('saveSnapshot');setTimeout(function(){A.fire('saveSnapshot');},0);}};function r(y){y.cancel();};function s(y,z,A){var B=this.document;if(B.getById('cke_pastebin'))return;if(z=='text'&&y.data&&y.data.$.clipboardData){var C=y.data.$.clipboardData.getData('text/plain');if(C){y.data.preventDefault();A(C);return;}}var D=this.getSelection(),E=new d.range(B),F=new h(z=='text'?'textarea':b.webkit?'body':'div',B);F.setAttribute('id','cke_pastebin');b.webkit&&F.append(B.createText('\xa0'));B.getBody().append(F);F.setStyles({position:'absolute',top:D.getStartElement().getDocumentPosition().y+'px',width:'1px',height:'1px',overflow:'hidden'});F.setStyle(this.config.contentsLangDirection=='ltr'?'left':'right','-1000px');var G=D.createBookmarks();this.on('selectionChange',r,null,null,0);if(z=='text')F.$.focus();else{E.setStartAt(F,1);E.setEndAt(F,2);E.select(true);}var H=this;window.setTimeout(function(){z=='text'&&b.gecko&&H.focusGrabber.focus();F.remove();H.removeListener('selectionChange',r);var I;F=b.webkit&&(I=F.getFirst())&&I.is&&I.hasClass('Apple-style-span')?I:F;D.selectBookmarks(G); -A(F['get'+(z=='text'?'Value':'Html')]());},0);};function t(y){if(!c||b.quirks)return;var z=y.getSelection(),A;if(z.getType()==3&&(A=z.getSelectedElement())){var B=z.getRanges()[0],C=y.document.createText('');C.insertBefore(A);B.setStartBefore(C);B.setEndAfter(A);z.selectRanges([B]);setTimeout(function(){if(A.getParent()){C.remove();z.selectElement(A);}},0);}};var u;function v(y,z){c&&(u=1);var A=2;try{A=z.document.$.queryCommandEnabled(y)?2:0;}catch(B){}u=0;return A;};var w;function x(){var z=this;if(z.mode!='wysiwyg')return;z.getCommand('cut').setState(w?0:v('Cut',z));z.getCommand('copy').setState(v('Copy',z));var y=w?0:b.webkit?2:v('Paste',z);z.fire('pasteState',y);};j.add('clipboard',{requires:['dialog','htmldataprocessor'],init:function(y){y.on('paste',function(A){var B=A.data;if(B.html)y.insertHtml(B.html);else if(B.text)y.insertText(B.text);setTimeout(function(){y.fire('afterPaste');},0);},null,null,1000);y.on('pasteDialog',function(A){setTimeout(function(){y.openDialog('paste');},0);});y.on('pasteState',function(A){y.getCommand('paste').setState(A.data);});function z(A,B,C,D){var E=y.lang[B];y.addCommand(B,C);y.ui.addButton(A,{label:E,command:B});if(y.addMenuItems)y.addMenuItem(B,{label:E,command:B,group:'clipboard',order:D});};z('Cut','cut',new o('cut'),1);z('Copy','copy',new o('copy'),4);z('Paste','paste',p,8);a.dialog.add('paste',a.getUrl(this.path+'dialogs/paste.js'));y.on('key',q,y);y.on('contentDom',function(){var A=y.document.getBody();A.on(b.webkit?'paste':'beforepaste',function(B){if(u)return;var C={mode:'html'};y.fire('beforePaste',C);s.call(y,B,C.mode,function(D){if(!(D=e.trim(D.replace(/]+data-cke-bookmark[^<]*?<\/span>/ig,''))))return;var E={};E[C.mode]=D;y.fire('paste',E);});});A.on('contextmenu',function(){u=1;setTimeout(function(){u=0;},10);});A.on('beforecut',function(){!u&&t(y);});A.on('mouseup',function(){setTimeout(function(){x.call(y);},0);},y);A.on('keyup',x,y);});y.on('selectionChange',function(A){w=A.data.selection.getRanges()[0].checkReadOnly();x.call(y);});if(y.contextMenu)y.contextMenu.addListener(function(A,B){var C=B.getRanges()[0].checkReadOnly();return{cut:!C&&v('Cut',y),copy:v('Copy',y),paste:!C&&(b.webkit?2:v('Paste',y))};});}});})();j.add('colorbutton',{requires:['panelbutton','floatpanel','styles'],init:function(m){var n=m.config,o=m.lang.colorButton,p;if(!b.hc){q('TextColor','fore',o.textColorTitle);q('BGColor','back',o.bgColorTitle);}function q(t,u,v){var w=e.getNextId()+'_colorBox';m.ui.add(t,'panelbutton',{label:v,title:v,className:'cke_button_'+t.toLowerCase(),modes:{wysiwyg:1},panel:{css:m.skin.editor.css,attributes:{role:'listbox','aria-label':o.panelTitle}},onBlock:function(x,y){y.autoSize=true; -y.element.addClass('cke_colorblock');y.element.setHtml(r(x,u,w));y.element.getDocument().getBody().setStyle('overflow','hidden');k.fire('ready',this);var z=y.keys,A=m.lang.dir=='rtl';z[A?37:39]='next';z[40]='next';z[9]='next';z[A?39:37]='prev';z[38]='prev';z[2228224+9]='prev';z[32]='click';},onOpen:function(){var x=m.getSelection(),y=x&&x.getStartElement(),z=new d.elementPath(y),A;y=z.block||z.blockLimit||m.document.getBody();do A=y&&y.getComputedStyle(u=='back'?'background-color':'color')||'transparent';while(u=='back'&&A=='transparent'&&y&&(y=y.getParent()));if(!A||A=='transparent')A='#ffffff';this._.panel._.iframe.getFrameDocument().getById(w).setStyle('background-color',A);}});};function r(t,u,v){var w=[],x=n.colorButton_colors.split(','),y=x.length+(n.colorButton_enableMore?2:1),z=e.addFunction(function(F,G){if(F=='?'){var H=arguments.callee;function I(K){this.removeListener('ok',I);this.removeListener('cancel',I);K.name=='ok'&&H(this.getContentElement('picker','selectedColor').getValue(),G);};m.openDialog('colordialog',function(){this.on('ok',I);this.on('cancel',I);});return;}m.focus();t.hide(false);m.fire('saveSnapshot');new a.style(n['colorButton_'+G+'Style'],{color:'inherit'}).remove(m.document);if(F){var J=n['colorButton_'+G+'Style'];J.childRule=G=='back'?function(K){return s(K);}:function(K){return!(K.is('a')||K.getElementsByTag('a').count())||s(K);};new a.style(J,{color:F}).apply(m.document);}m.fire('saveSnapshot');});w.push('
    ',o.auto,'
    ');for(var A=0;A');var B=x[A].split('/'),C=B[0],D=B[1]||C;if(!B[1])C='#'+C.replace(/^(.)(.)(.)$/,'$1$1$2$2$3$3');var E=m.lang.colors[D]||D;w.push('');}if(n.colorButton_enableMore===undefined||n.colorButton_enableMore)w.push(''); -w.push('
    ',o.more,'
    ');return w.join('');};function s(t){return t.getAttribute('contentEditable')=='false'||t.getAttribute('data-nostyle');};}});i.colorButton_colors='000,800000,8B4513,2F4F4F,008080,000080,4B0082,696969,B22222,A52A2A,DAA520,006400,40E0D0,0000CD,800080,808080,F00,FF8C00,FFD700,008000,0FF,00F,EE82EE,A9A9A9,FFA07A,FFA500,FFFF00,00FF00,AFEEEE,ADD8E6,DDA0DD,D3D3D3,FFF0F5,FAEBD7,FFFFE0,F0FFF0,F0FFFF,F0F8FF,E6E6FA,FFF';i.colorButton_foreStyle={element:'span',styles:{color:'#(color)'},overrides:[{element:'font',attributes:{color:null}}]};i.colorButton_backStyle={element:'span',styles:{'background-color':'#(color)'}};j.colordialog={init:function(m){m.addCommand('colordialog',new a.dialogCommand('colordialog'));a.dialog.add('colordialog',this.path+'dialogs/colordialog.js');}};j.add('colordialog',j.colordialog);j.add('contextmenu',{requires:['menu'],onLoad:function(){j.contextMenu=e.createClass({base:a.menu,$:function(m){this.base.call(this,m,{panel:{className:m.skinClass+' cke_contextmenu',attributes:{'aria-label':m.lang.contextmenu.options}}});},proto:{addTarget:function(m,n){if(b.opera&&!('oncontextmenu' in document.body)){var o;m.on('mousedown',function(s){s=s.data;if(s.$.button!=2){if(s.getKeystroke()==1114112+1)m.fire('contextmenu',s);return;}if(n&&(b.mac?s.$.metaKey:s.$.ctrlKey))return;var t=s.getTarget();if(!o){var u=t.getDocument();o=u.createElement('input');o.$.type='button';u.getBody().append(o);}o.setAttribute('style','position:absolute;top:'+(s.$.clientY-2)+'px;left:'+(s.$.clientX-2)+'px;width:5px;height:5px;opacity:0.01');});m.on('mouseup',function(s){if(o){o.remove();o=undefined;m.fire('contextmenu',s.data);}});}m.on('contextmenu',function(s){var t=s.data;if(n&&(b.webkit?p:b.mac?t.$.metaKey:t.$.ctrlKey))return;t.preventDefault();var u=t.getTarget().getDocument().getDocumentElement(),v=t.$.clientX,w=t.$.clientY;e.setTimeout(function(){this.open(u,null,v,w);},c?200:0,this);},this);if(b.opera)m.on('keypress',function(s){var t=s.data;if(t.$.keyCode===0)t.preventDefault();});if(b.webkit){var p,q=function(s){p=b.mac?s.data.$.metaKey:s.data.$.ctrlKey;},r=function(){p=0;};m.on('keydown',q);m.on('keyup',r);m.on('contextmenu',r);}},open:function(m,n,o,p){this.editor.focus();m=m||a.document.getDocumentElement();this.show(m,n,o,p);}}});},beforeInit:function(m){m.contextMenu=new j.contextMenu(m);m.addCommand('contextMenu',{exec:function(){m.contextMenu.open(m.document.getBody());}});}});(function(){function m(o){var p=this.att,q=o&&o.hasAttribute(p)&&o.getAttribute(p)||''; -if(q!==undefined)this.setValue(q);};function n(){var o;for(var p=0;p ';j.add('elementspath',{requires:['selection'],init:function(o){var p='cke_path_'+o.name,q,r=function(){if(!q)q=a.document.getById(p);return q;},s='cke_elementspath_'+e.getNextNumber()+'_';o._.elementsPath={idBase:s,filters:[]};o.on('themeSpace',function(x){if(x.data.space=='bottom')x.data.html+=''+o.lang.elementsPath.eleLabel+''+'

    '+n+'
    ';});function t(x){o.focus();var y=o._.elementsPath.list[x];if(y.is('body')){var z=new d.range(o.document);z.selectNodeContents(y);z.select();}else o.getSelection().selectElement(y);};var u=e.addFunction(t),v=e.addFunction(function(x,y){var z=o._.elementsPath.idBase,A;y=new d.event(y);var B=o.lang.dir=='rtl';switch(y.getKeystroke()){case B?39:37:case 9:A=a.document.getById(z+(x+1));if(!A)A=a.document.getById(z+'0');A.focus();return false;case B?37:39:case 2228224+9:A=a.document.getById(z+(x-1));if(!A)A=a.document.getById(z+(o._.elementsPath.list.length-1));A.focus();return false;case 27:o.focus();return false;case 13:case 32:t(x);return false;}return true;});o.on('selectionChange',function(x){var y=b,z=x.data.selection,A=z.getStartElement(),B=[],C=x.editor,D=C._.elementsPath.list=[],E=C._.elementsPath.filters;while(A){var F=0,G;if(A.data('cke-display-name'))G=A.data('cke-display-name');else if(A.data('cke-real-element-type'))G=A.data('cke-real-element-type');else G=A.getName();for(var H=0;H',G,''+L+'',''); -}if(G=='body')break;A=A.getParent();}var M=r();M.setHtml(B.join('')+n);C.fire('elementsPathUpdate',{space:M});});function w(){q&&q.setHtml(n);delete o._.elementsPath.list;};o.on('readOnly',w);o.on('contentDomUnload',w);o.addCommand('elementsPathFocus',m.toolbarFocus);}});})();(function(){j.add('enterkey',{requires:['keystrokes','indent'],init:function(t){t.addCommand('enter',{modes:{wysiwyg:1},editorFocus:false,exec:function(v){r(v);}});t.addCommand('shiftEnter',{modes:{wysiwyg:1},editorFocus:false,exec:function(v){q(v);}});var u=t.keystrokeHandler.keystrokes;u[13]='enter';u[2228224+13]='shiftEnter';}});j.enterkey={enterBlock:function(t,u,v,w){v=v||s(t);if(!v)return;var x=v.document,y=v.checkStartOfBlock(),z=v.checkEndOfBlock(),A=new d.elementPath(v.startContainer),B=A.block;if(y&&z){if(B&&(B.is('li')||B.getParent().is('li'))){t.execCommand('outdent');return;}if(B&&B.getParent().is('blockquote')){B.breakParent(B.getParent());if(!B.getPrevious().getFirst(d.walker.invisible(1)))B.getPrevious().remove();if(!B.getNext().getFirst(d.walker.invisible(1)))B.getNext().remove();v.moveToElementEditStart(B);v.select();return;}}else if(B&&B.is('pre')){if(!z){n(t,u,v,w);return;}}else if(B&&f.$captionBlock[B.getName()]){n(t,u,v,w);return;}var C=u==3?'div':'p',D=v.splitBlock(C);if(!D)return;var E=D.previousBlock,F=D.nextBlock,G=D.wasStartOfBlock,H=D.wasEndOfBlock,I;if(F){I=F.getParent();if(I.is('li')){F.breakParent(I);F.move(F.getNext(),1);}}else if(E&&(I=E.getParent())&&I.is('li')){E.breakParent(I);I=E.getNext();v.moveToElementEditStart(I);E.move(E.getPrevious());}if(!G&&!H){if(F.is('li')&&(I=F.getFirst(d.walker.invisible(true)))&&I.is&&I.is('ul','ol'))(c?x.createText('\xa0'):x.createElement('br')).insertBefore(I);if(F)v.moveToElementEditStart(F);}else{var J,K;if(E){if(E.is('li')||!(p.test(E.getName())||E.is('pre')))J=E.clone();}else if(F)J=F.clone();if(!J){if(I&&I.is('li'))J=I;else{J=x.createElement(C);if(E&&(K=E.getDirection()))J.setAttribute('dir',K);}}else if(w&&!J.is('li'))J.renameNode(C);var L=D.elementPath;if(L)for(var M=0,N=L.elements.length;M0;v--)u[v].deleteContents();return u[0];};})();(function(){var m='nbsp,gt,lt,amp',n='quot,iexcl,cent,pound,curren,yen,brvbar,sect,uml,copy,ordf,laquo,not,shy,reg,macr,deg,plusmn,sup2,sup3,acute,micro,para,middot,cedil,sup1,ordm,raquo,frac14,frac12,frac34,iquest,times,divide,fnof,bull,hellip,prime,Prime,oline,frasl,weierp,image,real,trade,alefsym,larr,uarr,rarr,darr,harr,crarr,lArr,uArr,rArr,dArr,hArr,forall,part,exist,empty,nabla,isin,notin,ni,prod,sum,minus,lowast,radic,prop,infin,ang,and,or,cap,cup,int,there4,sim,cong,asymp,ne,equiv,le,ge,sub,sup,nsub,sube,supe,oplus,otimes,perp,sdot,lceil,rceil,lfloor,rfloor,lang,rang,loz,spades,clubs,hearts,diams,circ,tilde,ensp,emsp,thinsp,zwnj,zwj,lrm,rlm,ndash,mdash,lsquo,rsquo,sbquo,ldquo,rdquo,bdquo,dagger,Dagger,permil,lsaquo,rsaquo,euro',o='Agrave,Aacute,Acirc,Atilde,Auml,Aring,AElig,Ccedil,Egrave,Eacute,Ecirc,Euml,Igrave,Iacute,Icirc,Iuml,ETH,Ntilde,Ograve,Oacute,Ocirc,Otilde,Ouml,Oslash,Ugrave,Uacute,Ucirc,Uuml,Yacute,THORN,szlig,agrave,aacute,acirc,atilde,auml,aring,aelig,ccedil,egrave,eacute,ecirc,euml,igrave,iacute,icirc,iuml,eth,ntilde,ograve,oacute,ocirc,otilde,ouml,oslash,ugrave,uacute,ucirc,uuml,yacute,thorn,yuml,OElig,oelig,Scaron,scaron,Yuml',p='Alpha,Beta,Gamma,Delta,Epsilon,Zeta,Eta,Theta,Iota,Kappa,Lambda,Mu,Nu,Xi,Omicron,Pi,Rho,Sigma,Tau,Upsilon,Phi,Chi,Psi,Omega,alpha,beta,gamma,delta,epsilon,zeta,eta,theta,iota,kappa,lambda,mu,nu,xi,omicron,pi,rho,sigmaf,sigma,tau,upsilon,phi,chi,psi,omega,thetasym,upsih,piv'; -function q(r,s){var t={},u=[],v={nbsp:'\xa0',shy:'­',gt:'>',lt:'<',amp:'&'};r=r.replace(/\b(nbsp|shy|gt|lt|amp)(?:,|$)/g,function(A,B){var C=s?'&'+B+';':v[B],D=s?v[B]:'&'+B+';';t[C]=D;u.push(C);return '';});if(!s&&r){r=r.split(',');var w=document.createElement('div'),x;w.innerHTML='&'+r.join(';&')+';';x=w.innerHTML;w=null;for(var y=0;y0;case 'checked':return!!q.$.checked;case 'value':var p=q.getAttribute('type');return p=='checkbox'||p=='radio'?q.$.value!='on':q.$.value;}return m.apply(q,arguments);};});(function(){var m={canUndo:false,exec:function(o){var p=o.document.createElement('hr'),q=new d.range(o.document);o.insertElement(p);q.moveToPosition(p,4);var r=p.getNext();if(!r||r.type==1&&!r.isEditable())q.fixBlock(true,o.config.enterMode==3?'div':'p');q.select();}},n='horizontalrule';j.add(n,{init:function(o){o.addCommand(n,m);o.ui.addButton('HorizontalRule',{label:o.lang.horizontalrule,command:n});}});})();(function(){var m=/^[\t\r\n ]*(?: |\xa0)$/,n='{cke_protected}';function o(T){var U=T.children.length,V=T.children[U-1];while(V&&V.type==3&&!e.trim(V.value))V=T.children[--U];return V;};function p(T,U){var V=T.children,W=o(T);if(W){if((U||!c)&&W.type==1&&W.name=='br')V.pop();if(W.type==3&&m.test(W.value))V.pop();}};function q(T,U,V){if(!U&&(!V||typeof V=='function'&&V(T)===false))return false;if(U&&c&&(document.documentMode>7||T.name in f.tr||T.name in f.$listItem))return false;var W=o(T);return!W||W&&(W.type==1&&W.name=='br'||T.name=='form'&&W.name=='input');};function r(T,U){return function(V){p(V,!T);if(q(V,!T,U))if(T||c)V.add(new a.htmlParser.text('\xa0'));else V.add(new a.htmlParser.element('br',{}));};};var s=f,t=['caption','colgroup','col','thead','tfoot','tbody'],u=e.extend({},s.$block,s.$listItem,s.$tableContent);for(var v in u){if(!('br' in s[v]))delete u[v];}delete u.pre;var w={elements:{},attributeNames:[[/^on/,'data-cke-pa-on']]},x={elements:{}};for(v in u)x.elements[v]=r();var y={elementNames:[[/^cke:/,''],[/^\?xml:namespace$/,'']],attributeNames:[[/^data-cke-(saved|pa)-/,''],[/^data-cke-.*/,''],['hidefocus','']],elements:{$:function(T){var U=T.attributes; -if(U){if(U['data-cke-temp'])return false;var V=['name','href','src'],W;for(var X=0;Xe.indexOf(t,W.name)?1:-1:0;});},embed:function(T){var U=T.parent;if(U&&U.name=='object'){var V=U.attributes.width,W=U.attributes.height;V&&(T.attributes.width=V);W&&(T.attributes.height=W);}},param:function(T){T.children=[];T.isEmpty=true;return T;},a:function(T){if(!(T.children.length||T.attributes.name||T.attributes['data-cke-saved-name']))return false;},span:function(T){if(T.attributes['class']=='Apple-style-span')delete T.name;},pre:function(T){c&&p(T);},html:function(T){delete T.attributes.contenteditable;delete T.attributes['class'];},body:function(T){delete T.attributes.spellcheck;delete T.attributes.contenteditable;},style:function(T){var U=T.children[0];U&&U.value&&(U.value=e.trim(U.value));if(!T.attributes.type)T.attributes.type='text/css';},title:function(T){var U=T.children[0];U&&(U.value=T.attributes['data-cke-title']||'');}},attributes:{'class':function(T,U){return e.ltrim(T.replace(/(?:^|\s+)cke_[^\s]*/g,''))||false;}}};if(c)y.attributes.style=function(T,U){return T.replace(/(^|;)([^\:]+)/g,function(V){return V.toLowerCase();});};function z(T){var U=T.attributes;if(U.contenteditable!='false')U['data-cke-editable']=U.contenteditable?'true':1;U.contenteditable='false';};function A(T){var U=T.attributes;switch(U['data-cke-editable']){case 'true':U.contenteditable='true';break;case '1':delete U.contenteditable;break;}};for(v in {input:1,textarea:1}){w.elements[v]=z;y.elements[v]=A;}var B=/<(a|area|img|input)\b([^>]*)>/gi,C=/\b(on\w+|href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+))/gi,D=/(?:])[^>]*>[\s\S]*<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi,E=/([^<]*)<\/cke:encoded>/gi,F=/(<\/?)((?:object|embed|param|html|body|head|title)[^>]*>)/gi,G=/(<\/?)cke:((?:html|body|head|title)[^>]*>)/gi,H=/]*?)\/?>(?!\s*<\/cke:\1)/gi;function I(T){return T.replace(B,function(U,V,W){return '<'+V+W.replace(C,function(X,Y){if(!/^on/.test(Y)&&W.indexOf('data-cke-saved-'+Y)==-1)return ' data-cke-saved-'+X+' '+X;return X;})+'>';});};function J(T){return T.replace(D,function(U){return ''+encodeURIComponent(U)+'';});};function K(T){return T.replace(E,function(U,V){return decodeURIComponent(V);});};function L(T){return T.replace(F,'$1cke:$2'); -};function M(T){return T.replace(G,'$1$2');};function N(T){return T.replace(H,'');};function O(T){return T.replace(/(]*>)(\r\n|\n)/g,'$1$2$2');};function P(T){return T.replace(//g,function(U){return '';});};function Q(T){return T.replace(//g,function(U,V){return decodeURIComponent(V);});};function R(T,U){var V=U._.dataStore;return T.replace(//g,function(W,X){return decodeURIComponent(X);}).replace(/\{cke_protected_(\d+)\}/g,function(W,X){return V&&V[X]||'';});};function S(T,U){var V=[],W=U.config.protectedSource,X=U._.dataStore||(U._.dataStore={id:1}),Y=/<\!--\{cke_temp(comment)?\}(\d*?)-->/g,Z=[//gi,//gi].concat(W);T=T.replace(//g,function(ab){return '';});for(var aa=0;aa';});T=T.replace(Y,function(ab,ac,ad){return '';});return T.replace(/(['"]).*?\1/g,function(ab){return ab.replace(//g,function(ac,ad){X[X.id]=decodeURIComponent(ad);return '{cke_protected_'+X.id++ +'}';});});};j.add('htmldataprocessor',{requires:['htmlwriter'],init:function(T){var U=T.dataProcessor=new a.htmlDataProcessor(T);U.writer.forceSimpleAmpersand=T.config.forceSimpleAmpersand;U.dataFilter.addRules(w);U.dataFilter.addRules(x);U.htmlFilter.addRules(y);var V={elements:{}};for(v in u)V.elements[v]=r(true,T.config.fillEmptyBlocks);U.htmlFilter.addRules(V);},onLoad:function(){!('fillEmptyBlocks' in i)&&(i.fillEmptyBlocks=1);}});a.htmlDataProcessor=function(T){var U=this;U.editor=T;U.writer=new a.htmlWriter();U.dataFilter=new a.htmlParser.filter();U.htmlFilter=new a.htmlParser.filter();};a.htmlDataProcessor.prototype={toHtml:function(T,U){T=S(T,this.editor);T=I(T);T=J(T);T=L(T);T=N(T);T=O(T);var V=new h('div');V.setHtml('a'+T);T=V.getHtml().substr(1);T=M(T);T=K(T);T=Q(T);var W=a.htmlParser.fragment.fromHtml(T,U),X=new a.htmlParser.basicWriter();W.writeHtml(X,this.dataFilter);T=X.getHtml(true);T=P(T);return T;},toDataFormat:function(T,U){var V=this.writer,W=a.htmlParser.fragment.fromHtml(T,U);V.reset();W.writeHtml(V,this.htmlFilter); -var X=V.getHtml(true);X=Q(X);X=R(X,this.editor);return X;}};})();(function(){j.add('iframe',{requires:['dialog','fakeobjects'],init:function(m){var n='iframe',o=m.lang.iframe;a.dialog.add(n,this.path+'dialogs/iframe.js');m.addCommand(n,new a.dialogCommand(n));m.addCss('img.cke_iframe{background-image: url('+a.getUrl(this.path+'images/placeholder.png')+');'+'background-position: center center;'+'background-repeat: no-repeat;'+'border: 1px solid #a9a9a9;'+'width: 80px;'+'height: 80px;'+'}');m.ui.addButton('Iframe',{label:o.toolbar,command:n});m.on('doubleclick',function(p){var q=p.data.element;if(q.is('img')&&q.data('cke-real-element-type')=='iframe')p.data.dialog='iframe';});if(m.addMenuItems)m.addMenuItems({iframe:{label:o.title,command:'iframe',group:'image'}});if(m.contextMenu)m.contextMenu.addListener(function(p,q){if(p&&p.is('img')&&p.data('cke-real-element-type')=='iframe')return{iframe:2};});},afterInit:function(m){var n=m.dataProcessor,o=n&&n.dataFilter;if(o)o.addRules({elements:{iframe:function(p){return m.createFakeParserElement(p,'cke_iframe','iframe',true);}}});}});})();j.add('image',{init:function(m){var n='image';a.dialog.add(n,this.path+'dialogs/image.js');m.addCommand(n,new a.dialogCommand(n));m.ui.addButton('Image',{label:m.lang.common.image,command:n});m.on('doubleclick',function(o){var p=o.data.element;if(p.is('img')&&!p.data('cke-realelement')&&!p.isReadOnly())o.data.dialog='image';});if(m.addMenuItems)m.addMenuItems({image:{label:m.lang.image.menu,command:'image',group:'image'}});if(m.contextMenu)m.contextMenu.addListener(function(o,p){if(!o||!o.is('img')||o.data('cke-realelement')||o.isReadOnly())return null;return{image:2};});}});i.image_removeLinkByEmptyURL=true;(function(){var m={ol:1,ul:1},n=d.walker.whitespaces(true),o=d.walker.bookmark(false,true);function p(t){var B=this;if(t.editor.readOnly)return null;var u=t.editor,v=t.data.path,w=v&&v.contains(m),x=v.block||v.blockLimit;if(w)return B.setState(2);if(!B.useIndentClasses&&B.name=='indent')return B.setState(2);if(!x)return B.setState(0);if(B.useIndentClasses){var y=x.$.className.match(B.classNameRegex),z=0;if(y){y=y[1];z=B.indentClassMap[y];}if(B.name=='outdent'&&!z||B.name=='indent'&&z==u.config.indentClasses.length)return B.setState(0);return B.setState(2);}else{var A=parseInt(x.getStyle(r(x)),10);if(isNaN(A))A=0;if(A<=0)return B.setState(0);return B.setState(2);}};function q(t,u){var w=this;w.name=u;w.useIndentClasses=t.config.indentClasses&&t.config.indentClasses.length>0;if(w.useIndentClasses){w.classNameRegex=new RegExp('(?:^|\\s+)('+t.config.indentClasses.join('|')+')(?=$|\\s)'); -w.indentClassMap={};for(var v=0;vY;T++)X[T].indent+=U;var aa=j.list.arrayToList(X,v,null,t.config.enterMode,M.getDirection());if(u.name=='outdent'){var ab;if((ab=M.getParent())&&ab.is('li')){var ac=aa.listNode.getChildren(),ad=[],ae=ac.count(),af;for(T=ae-1;T>=0;T--){if((af=ac.getItem(T))&&af.is&&af.is('li'))ad.push(af);}}}if(aa)aa.listNode.replace(M);if(ad&&ad.length)for(T=0;T0)M.addClass(t.config.indentClasses[P-1]);}else{var Q=r(M,N),R=parseInt(M.getStyle(Q),10);if(isNaN(R))R=0;var S=t.config.indentOffset||40;R+=(u.name=='indent'?1:-1)*S;if(R<0)return false;R=Math.max(R,0);R=Math.ceil(R/S)*S;M.setStyle(Q,R?R+(t.config.indentUnit||'px'):'');if(M.getAttribute('style')==='')M.removeAttribute('style');}h.setMarker(v,M,'indent_processed',1); -return true;};var z=t.getSelection(),A=z.createBookmarks(1),B=z&&z.getRanges(1),C,D=B.createIterator();while(C=D.getNextRange()){var E=C.getCommonAncestor(),F=E;while(F&&!(F.type==1&&m[F.getName()]))F=F.getParent();if(!F){var G=C.getEnclosedNode();if(G&&G.type==1&&G.getName() in m){C.setStartAt(G,1);C.setEndAt(G,2);F=G;}}if(F&&C.startContainer.type==1&&C.startContainer.getName() in m){var H=new d.walker(C);H.evaluator=s;C.startContainer=H.next();}if(F&&C.endContainer.type==1&&C.endContainer.getName() in m){H=new d.walker(C);H.evaluator=s;C.endContainer=H.previous();}if(F){var I=F.getFirst(s),J=!!I.getNext(s),K=C.startContainer,L=I.equals(K)||I.contains(K);if(!(L&&(u.name=='indent'||u.useIndentClasses||parseInt(F.getStyle(r(F)),10))&&y(F,!J&&I.getDirection())))w(F);}else x();}h.clearAllMarkers(v);t.forceNextSelectionCheck();z.selectBookmarks(A);}};j.add('indent',{init:function(t){var u=t.addCommand('indent',new q(t,'indent')),v=t.addCommand('outdent',new q(t,'outdent'));t.ui.addButton('Indent',{label:t.lang.indent,command:'indent'});t.ui.addButton('Outdent',{label:t.lang.outdent,command:'outdent'});t.on('selectionChange',e.bind(p,u));t.on('selectionChange',e.bind(p,v));if(b.ie6Compat||b.ie7Compat)t.addCss('ul,ol{\tmargin-left: 0px;\tpadding-left: 40px;}');t.on('dirChanged',function(w){var x=new d.range(t.document);x.setStartBefore(w.data.node);x.setEndAfter(w.data.node);var y=new d.walker(x),z;while(z=y.next()){if(z.type==1){if(!z.equals(w.data.node)&&z.getDirection()){x.setStartAfter(z);y=new d.walker(x);continue;}var A=t.config.indentClasses;if(A){var B=w.data.dir=='ltr'?['_rtl','']:['','_rtl'];for(var C=0;C=0;A--){x=v[A].createIterator();x.enlargeBr=t!=2;while(y=x.getNextParagraph(t==1?'p':'div')){y.removeAttribute('align');y.removeStyle('text-align');var B=w&&(y.$.className=e.ltrim(y.$.className.replace(D.cssClassRegex,''))),C=D.state==2&&(!z||n(y,true)!=D.value);if(w){if(C)y.addClass(w);else if(!B)y.removeAttribute('class');}else if(C)y.setStyle('text-align',D.value);}}r.focus();r.forceNextSelectionCheck();s.selectBookmarks(u);}};j.add('justify',{init:function(r){var s=new p(r,'justifyleft','left'),t=new p(r,'justifycenter','center'),u=new p(r,'justifyright','right'),v=new p(r,'justifyblock','justify');r.addCommand('justifyleft',s);r.addCommand('justifycenter',t);r.addCommand('justifyright',u);r.addCommand('justifyblock',v);r.ui.addButton('JustifyLeft',{label:r.lang.justify.left,command:'justifyleft'});r.ui.addButton('JustifyCenter',{label:r.lang.justify.center,command:'justifycenter'});r.ui.addButton('JustifyRight',{label:r.lang.justify.right,command:'justifyright'});r.ui.addButton('JustifyBlock',{label:r.lang.justify.block,command:'justifyblock'});r.on('selectionChange',e.bind(o,s));r.on('selectionChange',e.bind(o,u));r.on('selectionChange',e.bind(o,t));r.on('selectionChange',e.bind(o,v));r.on('dirChanged',q);},requires:['domiterator']});})();j.add('keystrokes',{beforeInit:function(m){m.keystrokeHandler=new a.keystrokeHandler(m); -m.specialKeys={};},init:function(m){var n=m.config.keystrokes,o=m.config.blockedKeystrokes,p=m.keystrokeHandler.keystrokes,q=m.keystrokeHandler.blockedKeystrokes;for(var r=0;r7))Q.append(L.createText('\xa0'));Q.append(W.listNode);O=W.nextIndex;}else if(T.indent==-1&&!I&&T.grandparent){if(m[T.grandparent.getName()])Q=T.element.clone(false,true); -else if(K||T.element.hasAttributes()||J!=2){Q=L.createElement(S);T.element.copyAttributes(Q,{type:1,value:1});if(!K&&J==2&&!Q.hasAttributes())Q=new d.documentFragment(L);}else Q=new d.documentFragment(L);if(Q.type==1)if(T.grandparent.getDirection(1)!=R)Q.setAttribute('dir',R);for(U=0;UJ[L-1].indent+1){var P=J[L-1].indent+1-J[L].indent,Q=J[L].indent;while(J[L]&&J[L].indent>=Q){J[L].indent+=P;L++;}L--;}}var R=j.list.arrayToList(J,I,null,G.config.enterMode,H.root.getAttribute('dir')),S=R.listNode,T,U;function V(W){if((T=S[W?'getFirst':'getLast']())&&!(T.is&&T.isBlockBoundary())&&(U=H.root[W?'getPrevious':'getNext'](d.walker.whitespaces(true)))&&!(U.is&&U.isBlockBoundary({br:1})))G.document.createElement('br')[W?'insertBefore':'insertAfter'](T);};V(true);V();S.replace(H.root);};function x(G,H){this.name=G;this.type=H;};function y(G){var H=G.getDirection();if(H){for(var I=0,J=G.getChildren(),K;K=J.getItem(I),I=0&&(ae=Z[af]); -af--){if(m[ae.getName()]&&ad.contains(ae)){ad.removeCustomData('list_group_object_'+S);var ag=ae.getCustomData('list_group_object');if(ag)ag.contents.push(X);else{ag={root:ae,contents:[X]};P.push(ag);h.setMarker(Q,ae,'list_group_object',ag);}ac=1;break;}}if(ac)continue;var ah=ad;if(ah.getCustomData('list_group_object_'+S))ah.getCustomData('list_group_object_'+S).contents.push(X);else{ag={root:ah,contents:[X]};h.setMarker(Q,ah,'list_group_object_'+S,ag);P.push(ag);}}}var ai=[];while(P.length>0){ag=P.shift();if(this.state==2){if(m[ag.root.getName()])t.call(this,G,ag,Q,ai);else v.call(this,G,ag,ai);}else if(this.state==1&&m[ag.root.getName()])w.call(this,G,ag,Q);}for(af=0;af0)for(var u=t.length-1;u>=0;u--){var v=t[u][0],w=t[u][1];if(w)v.insertBefore(w);else v.appendTo(s);}};function o(s,t){var u=m(s),v={},w=s.$;if(!t){v['class']=w.className||'';w.className='';}v.inline=w.style.cssText||'';if(!t)w.style.cssText='position: static; overflow: visible';n(u);return v;};function p(s,t){var u=m(s),v=s.$;if('class' in t)v.className=t['class'];if('inline' in t)v.style.cssText=t.inline;n(u);};function q(s){var t=a.instances;for(var u in t){var v=t[u];if(v.mode=='wysiwyg'&&!v.readOnly){var w=v.document.getBody();w.setAttribute('contentEditable',false);w.setAttribute('contentEditable',true);}}if(s.focusManager.hasFocus){s.toolbox.focus();s.focus();}};function r(s){if(!c||b.version>6)return null;var t=h.createFromHtml('');return s.append(t,true);};j.add('maximize',{init:function(s){var t=s.lang,u=a.document,v=u.getWindow(),w,x,y,z;function A(){var C=v.getViewPaneSize();z&&z.setStyles({width:C.width+'px',height:C.height+'px'});s.resize(C.width,C.height,null,true);};var B=2;s.addCommand('maximize',{modes:{wysiwyg:!b.iOS,source:!b.iOS},readOnly:1,editorFocus:false,exec:function(){var C=s.container.getChild(1),D=s.getThemeSpace('contents');if(s.mode=='wysiwyg'){var E=s.getSelection();w=E&&E.getRanges();x=v.getScrollPosition();}else{var F=s.textarea.$;w=!c&&[F.selectionStart,F.selectionEnd];x=[F.scrollLeft,F.scrollTop];}if(this.state==2){v.on('resize',A); -y=v.getScrollPosition();var G=s.container;while(G=G.getParent()){G.setCustomData('maximize_saved_styles',o(G));G.setStyle('z-index',s.config.baseFloatZIndex-1);}D.setCustomData('maximize_saved_styles',o(D,true));C.setCustomData('maximize_saved_styles',o(C,true));var H={overflow:b.webkit?'':'hidden',width:0,height:0};u.getDocumentElement().setStyles(H);!b.gecko&&u.getDocumentElement().setStyle('position','fixed');!(b.gecko&&b.quirks)&&u.getBody().setStyles(H);c?setTimeout(function(){v.$.scrollTo(0,0);},0):v.$.scrollTo(0,0);C.setStyle('position',b.gecko&&b.quirks?'fixed':'absolute');C.$.offsetLeft;C.setStyles({'z-index':s.config.baseFloatZIndex-1,left:'0px',top:'0px'});z=r(C);C.addClass('cke_maximized');A();var I=C.getDocumentPosition();C.setStyles({left:-1*I.x+'px',top:-1*I.y+'px'});b.gecko&&q(s);}else if(this.state==1){v.removeListener('resize',A);var J=[D,C];for(var K=0;K ');s.children.length=0;s.add(u);var v=s.attributes;delete v['aria-label'];delete v.contenteditable;delete v.title;}return t;}}},5);if(p)p.addRules({elements:{div:function(r){var s=r.attributes,t=s&&s.style,u=t&&r.children.length==1&&r.children[0],v=u&&u.name=='span'&&u.attributes.style;if(v&&/page-break-after\s*:\s*always/i.test(t)&&/display\s*:\s*none/i.test(v)){s.contenteditable='false';s['class']='cke_pagebreak';s['data-cke-display-name']='pagebreak';s['aria-label']=n;s.title=n;r.children.length=0;}}}});},requires:['fakeobjects']});j.pagebreakCmd={exec:function(m){var n=m.lang.pagebreakAlt,o=h.createFromHtml('
    '+'
    ',m.document),p=m.getSelection().getRanges(true);m.fire('saveSnapshot');for(var q,r=p.length-1;r>=0;r--){q=p[r];if(r1&&n.substr(n.length-1,1)=='%')n=parseInt(window.screen.width*parseInt(n,10)/100,10);if(typeof o=='string'&&o.length>1&&o.substr(o.length-1,1)=='%')o=parseInt(window.screen.height*parseInt(o,10)/100,10);if(n<640)n=640;if(o<420)o=420;var q=parseInt((window.screen.height-o)/2,10),r=parseInt((window.screen.width-n)/2,10);p=(p||'location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,scrollbars=yes')+',width='+n+',height='+o+',top='+q+',left='+r;var s=window.open('',null,p,true);if(!s)return false;try{s.moveTo(r,q);s.resizeTo(n,o);s.focus();s.location.href=m;}catch(t){s=window.open(m,null,p,true);}return true;}});(function(){var m={modes:{wysiwyg:1,source:1},canUndo:false,readOnly:1,exec:function(o){var p,q=o.config,r=q.baseHref?'':'',s=b.isCustomDomain();if(q.fullPage)p=o.getData().replace(//,'$&'+r).replace(/[^>]*(?=<\/title>)/,'$& — '+o.lang.preview); -else{var t=''+''+r+''+o.lang.preview+''+e.buildStyleHtml(o.config.contentsCss)+''+t+o.getData()+'';}var v=640,w=420,x=80;try{var y=window.screen;v=Math.round(y.width*0.8);w=Math.round(y.height*0.7);x=Math.round(y.width*0.1);}catch(C){}var z='';if(s){window._cke_htmlToLoad=p;z='javascript:void( (function(){document.open();document.domain="'+document.domain+'";'+'document.write( window.opener._cke_htmlToLoad );'+'document.close();'+'window.opener._cke_htmlToLoad = null;'+'})() )';}var A=window.open(z,null,'toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width='+v+',height='+w+',left='+x);if(!s){var B=A.document;B.open();B.write(p);B.close();b.webkit&&setTimeout(function(){B.body.innerHTML+='';},0);}}},n='preview';j.add(n,{init:function(o){o.addCommand(n,m);o.ui.addButton('Preview',{label:o.lang.preview,command:n});}});})();j.add('print',{init:function(m){var n='print',o=m.addCommand(n,j.print);m.ui.addButton('Print',{label:m.lang.print,command:n});}});j.print={exec:function(m){if(b.opera)return;else if(b.gecko)m.window.$.print();else m.document.$.execCommand('Print');},canUndo:false,readOnly:1,modes:{wysiwyg:!b.opera}};j.add('removeformat',{requires:['selection'],init:function(m){m.addCommand('removeFormat',j.removeformat.commands.removeformat);m.ui.addButton('RemoveFormat',{label:m.lang.removeFormat,command:'removeFormat'});m._.removeFormat={filters:[]};}});j.removeformat={commands:{removeformat:{exec:function(m){var n=m._.removeFormatRegex||(m._.removeFormatRegex=new RegExp('^(?:'+m.config.removeFormatTags.replace(/,/g,'|')+')$','i')),o=m._.removeAttributes||(m._.removeAttributes=m.config.removeFormatAttributes.split(',')),p=j.removeformat.filter,q=m.getSelection().getRanges(1),r=q.createIterator(),s;while(s=r.getNextRange()){if(!s.collapsed)s.enlarge(1);var t=s.createBookmark(),u=t.startNode,v=t.endNode,w,x=function(z){var A=new d.elementPath(z),B=A.elements;for(var C=1,D;D=B[C];C++){if(D.equals(A.block)||D.equals(A.blockLimit))break;if(n.test(D.getName())&&p(m,D))z.breakParent(D);}};x(u);if(v){x(v);w=u.getNextSourceNode(true,1);while(w){if(w.equals(v))break;var y=w.getNextSourceNode(false,1);if(!(w.getName()=='img'&&w.data('cke-realelement'))&&p(m,w))if(n.test(w.getName()))w.remove(1); -else{w.removeAttributes(o);m.fire('removeFormatCleanup',w);}w=y;}}s.moveToBookmark(t);}m.getSelection().selectRanges(q);}}},filter:function(m,n){var o=m._.removeFormat.filters;for(var p=0;pr.width&&(n.resize_minWidth=r.width);n.resize_minHeight>r.height&&(n.resize_minHeight=r.height);a.document.on('mousemove',u);a.document.on('mouseup',v);if(m.document){m.document.on('mousemove',u);m.document.on('mouseup',v);}});m.on('destroy',function(){e.removeFunction(w);});m.on('themeSpace',function(x){if(x.data.space=='bottom'){var y='';if(s&&!t)y=' cke_resizer_horizontal';if(!s&&t)y=' cke_resizer_vertical';var z='
    ';o=='ltr'&&y=='ltr'?x.data.html+=z:x.data.html=z+x.data.html;}},m,null,100);}}});(function(){var m={modes:{wysiwyg:1,source:1},readOnly:1,exec:function(o){var p=o.element.$.form;if(p)try{p.submit();}catch(q){if(p.submit.click)p.submit.click(); -}}},n='save';j.add(n,{init:function(o){var p=o.addCommand(n,m);p.modes={wysiwyg:!!o.element.$.form};o.ui.addButton('Save',{label:o.lang.save,command:n});}});})();(function(){var m='scaytcheck',n='';function o(t,u){var v=0,w;for(w in u){if(u[w]==t){v=1;break;}}return v;};var p=function(){var t=this,u=function(){var y=t.config,z={};z.srcNodeRef=t.document.getWindow().$.frameElement;z.assocApp='CKEDITOR.'+a.version+'@'+a.revision;z.customerid=y.scayt_customerid||'1:WvF0D4-UtPqN1-43nkD4-NKvUm2-daQqk3-LmNiI-z7Ysb4-mwry24-T8YrS3-Q2tpq2';z.customDictionaryIds=y.scayt_customDictionaryIds||'';z.userDictionaryName=y.scayt_userDictionaryName||'';z.sLang=y.scayt_sLang||'en_US';z.onLoad=function(){if(!(c&&b.version<8))this.addStyle(this.selectorCss(),'padding-bottom: 2px !important;');if(t.focusManager.hasFocus&&!q.isControlRestored(t))this.focus();};z.onBeforeChange=function(){if(q.getScayt(t)&&!t.checkDirty())setTimeout(function(){t.resetDirty();},0);};var A=window.scayt_custom_params;if(typeof A=='object')for(var B in A)z[B]=A[B];if(q.getControlId(t))z.id=q.getControlId(t);var C=new window.scayt(z);C.afterMarkupRemove.push(function(E){new h(E,C.document).mergeSiblings();});var D=q.instances[t.name];if(D){C.sLang=D.sLang;C.option(D.option());C.paused=D.paused;}q.instances[t.name]=C;try{C.setDisabled(q.isPaused(t)===false);}catch(E){}t.fire('showScaytState');};t.on('contentDom',u);t.on('contentDomUnload',function(){var y=a.document.getElementsByTag('script'),z=/^dojoIoScript(\d+)$/i,A=/^https?:\/\/svc\.webspellchecker\.net\/spellcheck\/script\/ssrv\.cgi/i;for(var B=0;B=0){this.setState(0);q.loadEngine(t);}}};j.add('scayt',{requires:['menubutton'],beforeInit:function(t){var u=t.config.scayt_contextMenuItemsOrder||'suggest|moresuggest|control',v='';u=u.split('|');if(u&&u.length)for(var w=0;w tr > td, .%1 table.%2 > tr > th,','.%1 table.%2 > tbody > tr > td, .%1 table.%2 > tbody > tr > th,','.%1 table.%2 > thead > tr > td, .%1 table.%2 > thead > tr > th,','.%1 table.%2 > tfoot > tr > td, .%1 table.%2 > tfoot > tr > th','{','border : #d3d3d3 1px dotted','}']).join('');n=o.replace(/%2/g,m).replace(/%1/g,'cke_show_borders ');var p={preserveState:true,editorFocus:false,readOnly:1,exec:function(q){this.toggleState();this.refresh(q); -},refresh:function(q){if(q.document){var r=this.state==1?'addClass':'removeClass';q.document.getBody()[r]('cke_show_borders');}}};j.add('showborders',{requires:['wysiwygarea'],modes:{wysiwyg:1},init:function(q){var r=q.addCommand('showborders',p);r.canUndo=false;if(q.config.startupShowBorders!==false)r.setState(1);q.addCss(n);q.on('mode',function(){if(r.state!=0)r.refresh(q);},null,null,100);q.on('contentDom',function(){if(r.state!=0)r.refresh(q);});q.on('removeFormatCleanup',function(s){var t=s.data;if(q.getCommand('showborders').state==1&&t.is('table')&&(!t.hasAttribute('border')||parseInt(t.getAttribute('border'),10)<=0))t.addClass(m);});},afterInit:function(q){var r=q.dataProcessor,s=r&&r.dataFilter,t=r&&r.htmlFilter;if(s)s.addRules({elements:{table:function(u){var v=u.attributes,w=v['class'],x=parseInt(v.border,10);if((!x||x<=0)&&(!w||w.indexOf(m)==-1))v['class']=(w||'')+' '+m;}}});if(t)t.addRules({elements:{table:function(u){var v=u.attributes,w=v['class'];w&&(v['class']=w.replace(m,'').replace(/\s{2}/,' ').replace(/^\s+|\s+$/,''));}}});}});a.on('dialogDefinition',function(q){var r=q.data.name;if(r=='table'||r=='tableProperties'){var s=q.data.definition,t=s.getContents('info'),u=t.get('txtBorder'),v=u.commit;u.commit=e.override(v,function(y){return function(z,A){y.apply(this,arguments);var B=parseInt(this.getValue(),10);A[!B||B<=0?'addClass':'removeClass'](m);};});var w=s.getContents('advanced'),x=w&&w.get('advCSSClasses');if(x){x.setup=e.override(x.setup,function(y){return function(){y.apply(this,arguments);this.setValue(this.getValue().replace(/cke_show_border/,''));};});x.commit=e.override(x.commit,function(y){return function(z,A){y.apply(this,arguments);if(!parseInt(A.getAttribute('border'),10))A.addClass('cke_show_border');};});}}});})();j.add('sourcearea',{requires:['editingblock'],init:function(m){var n=j.sourcearea,o=a.document.getWindow();m.on('editingBlockReady',function(){var p,q;m.addMode('source',{load:function(r,s){if(c&&b.version<8)r.setStyle('position','relative');m.textarea=p=new h('textarea');p.setAttributes({dir:'ltr',tabIndex:b.webkit?-1:m.tabIndex,role:'textbox','aria-label':m.lang.editorTitle.replace('%1',m.name)});p.addClass('cke_source');p.addClass('cke_enable_context_menu');m.readOnly&&p.setAttribute('readOnly','readonly');var t={width:b.ie7Compat?'99%':'100%',height:'100%',resize:'none',outline:'none','text-align':'left'};if(c){q=function(){p.hide();p.setStyle('height',r.$.clientHeight+'px');p.setStyle('width',r.$.clientWidth+'px'); -p.show();};m.on('resize',q);o.on('resize',q);setTimeout(q,0);}r.setHtml('');r.append(p);p.setStyles(t);m.fire('ariaWidget',p);p.on('blur',function(){m.focusManager.blur();});p.on('focus',function(){m.focusManager.focus();});m.mayBeDirty=true;this.loadData(s);var u=m.keystrokeHandler;if(u)u.attach(p);setTimeout(function(){m.mode='source';m.fire('mode',{previousMode:m._.previousMode});},b.gecko||b.webkit?100:0);},loadData:function(r){p.setValue(r);m.fire('dataReady');},getData:function(){return p.getValue();},getSnapshotData:function(){return p.getValue();},unload:function(r){p.clearCustomData();m.textarea=p=null;if(q){m.removeListener('resize',q);o.removeListener('resize',q);}if(c&&b.version<8)r.removeStyle('position');},focus:function(){p.focus();}});});m.on('readOnly',function(){if(m.mode=='source')if(m.readOnly)m.textarea.setAttribute('readOnly','readonly');else m.textarea.removeAttribute('readOnly');});m.addCommand('source',n.commands.source);if(m.ui.addButton)m.ui.addButton('Source',{label:m.lang.source,command:'source'});m.on('mode',function(){m.getCommand('source').setState(m.mode=='source'?1:2);});}});j.sourcearea={commands:{source:{modes:{wysiwyg:1,source:1},editorFocus:false,readOnly:1,exec:function(m){if(m.mode=='wysiwyg')m.fire('saveSnapshot');m.getCommand('source').setState(0);m.setMode(m.mode=='source'?'wysiwyg':'source');},canUndo:false}}};(function(){j.add('stylescombo',{requires:['richcombo','styles'],init:function(n){var o=n.config,p=n.lang.stylesCombo,q={},r=[],s;function t(u){n.getStylesSet(function(v){if(!r.length){var w,x;for(var y=0,z=v.length;y0)return;if(T.type==1&&m.test(T.getName())&&!T.getCustomData('selected_cell')){h.setMarker(K,T,'selected_cell',true);J.push(T);}};for(var M=0;M1&&V&&U[Y]==V[Y]){Z=U[Y];Z.rowSpan+=1;}else{Z=new h(U[Y]).clone();Z.removeAttribute('rowSpan');!c&&Z.appendBogus();X.append(Z);Z=Z.$;}Y+=Z.colSpan-1;}H?X.insertBefore(S):X.insertAfter(S);};function q(G){if(G instanceof d.selection){var H=n(G),I=H[0],J=I.getAscendant('table'),K=e.buildTableMap(J),L=H[0].getParent(),M=L.$.rowIndex,N=H[H.length-1],O=N.getParent().$.rowIndex+N.$.rowSpan-1,P=[];for(var Q=M;Q<=O;Q++){var R=K[Q],S=new h(J.$.rows[Q]);for(var T=0;T0?X[M-1]:null)||J.$.parentNode);for(Q=P.length;Q>=0;Q--)q(P[Q]);return Y;}else if(G instanceof h){J=G.getAscendant('table');if(J.$.rows.length==1)J.remove();else G.remove();}return null;};function r(G,H){var I=G.getParent(),J=I.$.cells,K=0;for(var L=0;LI)I=K;}return I;};function t(G,H){var I=n(G),J=I[0],K=J.getAscendant('table'),L=s(I,1),M=s(I),N=H?L:M,O=e.buildTableMap(K),P=[],Q=[],R=O.length;for(var S=0;S1&&Q.length&&Q[S]==P[S]){U=P[S];U.colSpan+=1;}else{U=new h(P[S]).clone();U.removeAttribute('colSpan');!c&&U.appendBogus();U[H?'insertBefore':'insertAfter'].call(U,new h(P[S]));U=U.$;}S+=U.rowSpan-1;}};function u(G){var H=n(G),I=H[0],J=H[H.length-1],K=I.getAscendant('table'),L=e.buildTableMap(K),M,N,O=[];for(var P=0,Q=L.length;P1){L=H[J-1]+1;break;}}if(!L)L=H[0]>0?H[0]-1:H[H.length-1]+1;var N=I.$.rows;for(J=0,K=N.length;J=0;K--)x(H[K]);if(J)z(J,true);else if(I)I.remove();}else if(G instanceof h){var L=G.getParent();if(L.getChildCount()==1)L.remove();else G.remove();}};function y(G){var H=G.getBogus();H&&H.remove();G.trim();};function z(G,H){var I=new d.range(G.getDocument());if(!I['moveToElementEdit'+(H?'End':'Start')](G)){I.selectNodeContents(G);I.collapse(H?false:true);}I.select(true);};function A(G,H,I){var J=G[H];if(typeof I=='undefined')return J;for(var K=0;J&&K=Q)M.removeAttribute('rowSpan');else M.$.rowSpan=Y;if(Y>=P)M.removeAttribute('colSpan');else M.$.colSpan=Z;var ak=new d.nodeList(N.$.rows),al=ak.count();for(ac=al-1;ac>=0;ac--){var am=ak.getItem(ac);if(!am.$.cells.length){am.remove();al++;continue;}}return M;}else return Y*Z==ab;};function D(G,H){var I=n(G);if(I.length>1)return false;else if(H)return true;var J=I[0],K=J.getParent(),L=K.getAscendant('table'),M=e.buildTableMap(L),N=K.$.rowIndex,O=A(M,N,J),P=J.$.rowSpan,Q,R,S,T;if(P>1){R=Math.ceil(P/2);S=Math.floor(P/2);T=N+R;var U=new h(L.$.rows[T]),V=A(M,T),W;Q=J.clone();for(var X=0;XO){Q.insertBefore(new h(W));break;}else W=null;}if(!W)U.append(Q,true);}else{S=R=1;U=K.clone();U.insertAfter(K);U.append(Q=J.clone());var Y=A(M,N);for(var Z=0;Z1)return false;else if(H)return true;var J=I[0],K=J.getParent(),L=K.getAscendant('table'),M=e.buildTableMap(L),N=K.$.rowIndex,O=A(M,N,J),P=J.$.colSpan,Q,R,S;if(P>1){R=Math.ceil(P/2);S=Math.floor(P/2);}else{S=R=1;var T=B(M,O);for(var U=0;U0?2:0};}},tablecell_insertBefore:{label:H.cell.insertBefore,group:'tablecell',command:'cellInsertBefore',order:5},tablecell_insertAfter:{label:H.cell.insertAfter,group:'tablecell',command:'cellInsertAfter',order:10},tablecell_delete:{label:H.cell.deleteCell,group:'tablecell',command:'cellDelete',order:15},tablecell_merge:{label:H.cell.merge,group:'tablecell',command:'cellMerge',order:16},tablecell_merge_right:{label:H.cell.mergeRight,group:'tablecell',command:'cellMergeRight',order:17},tablecell_merge_down:{label:H.cell.mergeDown,group:'tablecell',command:'cellMergeDown',order:18},tablecell_split_horizontal:{label:H.cell.splitHorizontal,group:'tablecell',command:'cellHorizontalSplit',order:19},tablecell_split_vertical:{label:H.cell.splitVertical,group:'tablecell',command:'cellVerticalSplit',order:20},tablecell_properties:{label:H.cell.title,group:'tablecellproperties',command:'cellProperties',order:21},tablerow:{label:H.row.menu,group:'tablerow',order:1,getItems:function(){return{tablerow_insertBefore:2,tablerow_insertAfter:2,tablerow_delete:2};}},tablerow_insertBefore:{label:H.row.insertBefore,group:'tablerow',command:'rowInsertBefore',order:5},tablerow_insertAfter:{label:H.row.insertAfter,group:'tablerow',command:'rowInsertAfter',order:10},tablerow_delete:{label:H.row.deleteRow,group:'tablerow',command:'rowDelete',order:15},tablecolumn:{label:H.column.menu,group:'tablecolumn',order:1,getItems:function(){return{tablecolumn_insertBefore:2,tablecolumn_insertAfter:2,tablecolumn_delete:2}; -}},tablecolumn_insertBefore:{label:H.column.insertBefore,group:'tablecolumn',command:'columnInsertBefore',order:5},tablecolumn_insertAfter:{label:H.column.insertAfter,group:'tablecolumn',command:'columnInsertAfter',order:10},tablecolumn_delete:{label:H.column.deleteColumn,group:'tablecolumn',command:'columnDelete',order:15}});if(G.contextMenu)G.contextMenu.addListener(function(I,J){if(!I||I.isReadOnly())return null;while(I){if(I.getName() in F)return{tablecell:2,tablerow:2,tablecolumn:2};I=I.getParent();}return null;});},getSelectedCells:n};j.add('tabletools',j.tabletools);})();e.buildTableMap=function(m){var n=m.$.rows,o=-1,p=[];for(var q=0;qp&&(!s||!t||vt){s=v;t=u;}}else{if(q&&u==p){s=v;break;}if(ut)){s=v;t=u;}}}if(s)s.focus();};(function(){j.add('templates',{requires:['dialog'],init:function(o){a.dialog.add('templates',a.getUrl(this.path+'dialogs/templates.js'));o.addCommand('templates',new a.dialogCommand('templates'));o.ui.addButton('Templates',{label:o.lang.templates.button,command:'templates'});}});var m={},n={};a.addTemplates=function(o,p){m[o]=p;};a.getTemplates=function(o){return m[o];};a.loadTemplates=function(o,p){var q=[];for(var r=0,s=o.length;r':' style="display:none">');t.push('',o.lang.toolbars,'');var w=o.toolbox.toolbars,x=o.config.toolbar instanceof Array?o.config.toolbar:o.config['toolbar_'+o.config.toolbar];for(var y=0;y');v=0;}if(C==='/'){t.push('
    ');continue;}D=C.items||C;for(var E=0;E');B&&t.push('',B,'');t.push('');var I=w.push(A)-1;if(I>0){A.previous=w[I-1];A.previous.next=A;}}if(H){if(!v){t.push('');v=1;}}else if(v){t.push('');v=0;}var J=F.render(o,t);I=A.items.push(J)-1;if(I>0){J.previous=A.items[I-1];J.previous.next=J;}J.toolbar=A;J.onkey=q;J.onfocus=function(){if(!o.toolbox.focusCommandExecuted)o.focus();};}}if(v){t.push('');v=0;}if(A)t.push('');}t.push('');if(o.config.toolbarCanCollapse){var K=e.addFunction(function(){o.execCommand('toolbarCollapse');});o.on('destroy',function(){e.removeFunction(K);});var L=e.getNextId();o.addCommand('toolbarCollapse',{readOnly:1,exec:function(M){var N=a.document.getById(L),O=N.getPrevious(),P=M.getThemeSpace('contents'),Q=O.getParent(),R=parseInt(P.$.style.height,10),S=Q.$.offsetHeight,T=!O.isVisible();if(!T){O.hide();N.addClass('cke_toolbox_collapser_min');N.setAttribute('title',M.lang.toolbarExpand);}else{O.show();N.removeClass('cke_toolbox_collapser_min');N.setAttribute('title',M.lang.toolbarCollapse);}N.getFirst().setText(T?'▲':'◀');var U=Q.$.offsetHeight-S;P.setStyle('height',R-U+'px');M.fire('resize');},modes:{wysiwyg:1,source:1}});t.push('','','');}r.data.html+=t.join('');}});o.on('destroy',function(){var r,s=0,t,u,v;r=this.toolbox.toolbars;for(;s');return{};}};}});}});})();a.UI_SEPARATOR='separator';i.toolbarLocation='top';i.toolbar_Basic=[['Bold','Italic','-','NumberedList','BulletedList','-','Link','Unlink','-','About']];i.toolbar_Full=[{name:'document',items:['Source','-','Save','NewPage','DocProps','Preview','Print','-','Templates']},{name:'clipboard',items:['Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo']},{name:'editing',items:['Find','Replace','-','SelectAll','-','SpellChecker','Scayt']},{name:'forms',items:['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField']},'/',{name:'basicstyles',items:['Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat']},{name:'paragraph',items:['NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl']},{name:'links',items:['Link','Unlink','Anchor']},{name:'insert',items:['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe']},'/',{name:'styles',items:['Styles','Format','Font','FontSize']},{name:'colors',items:['TextColor','BGColor']},{name:'tools',items:['Maximize','ShowBlocks','-','About']}];i.toolbar='Full';i.toolbarCanCollapse=true;(function(){j.add('undo',{requires:['selection','wysiwygarea'],init:function(s){var t=new o(s),u=s.addCommand('undo',{exec:function(){if(t.undo()){s.selectionChange();this.fire('afterUndo');}},state:0,canUndo:false}),v=s.addCommand('redo',{exec:function(){if(t.redo()){s.selectionChange();this.fire('afterRedo');}},state:0,canUndo:false});t.onChange=function(){u.setState(t.undoable()?2:0);v.setState(t.redoable()?2:0);};function w(x){if(t.enabled&&x.data.command.canUndo!==false)t.save();};s.on('beforeCommandExec',w);s.on('afterCommandExec',w);s.on('saveSnapshot',function(x){t.save(x.data&&x.data.contentOnly);});s.on('contentDom',function(){s.document.on('keydown',function(x){if(!x.data.$.ctrlKey&&!x.data.$.metaKey)t.type(x);});});s.on('beforeModeUnload',function(){s.mode=='wysiwyg'&&t.save(true);});s.on('mode',function(){t.enabled=s.readOnly?false:s.mode=='wysiwyg';t.onChange();});s.ui.addButton('Undo',{label:s.lang.undo,command:'undo'});s.ui.addButton('Redo',{label:s.lang.redo,command:'redo'}); -s.resetUndo=function(){t.reset();s.fire('saveSnapshot');};s.on('updateSnapshot',function(){if(t.currentImage)t.update();});}});j.undo={};var m=j.undo.Image=function(s){this.editor=s;s.fire('beforeUndoImage');var t=s.getSnapshot(),u=t&&s.getSelection();c&&t&&(t=t.replace(/\s+data-cke-expando=".*?"/g,''));this.contents=t;this.bookmarks=u&&u.createBookmarks2(true);s.fire('afterUndoImage');},n=/\b(?:href|src|name)="[^"]*?"/gi;m.prototype={equals:function(s,t){var u=this.contents,v=s.contents;if(c&&(b.ie7Compat||b.ie6Compat)){u=u.replace(n,'');v=v.replace(n,'');}if(u!=v)return false;if(t)return true;var w=this.bookmarks,x=s.bookmarks;if(w||x){if(!w||!x||w.length!=x.length)return false;for(var y=0;y25){this.save(false,null,false);this.modifiersCount=1;}}else if(!y){this.modifiersCount=0;this.typesCount++;if(this.typesCount>25){this.save(false,null,false);this.typesCount=1;}}},reset:function(){var s=this;s.lastKeystroke=0;s.snapshots=[];s.index=-1;s.limit=s.editor.config.undoStackSize||20;s.currentImage=null;s.hasUndo=false;s.hasRedo=false;s.resetType();},resetType:function(){var s=this;s.typing=false;delete s.lastKeystroke;s.typesCount=0;s.modifiersCount=0;},fireChange:function(){var s=this;s.hasUndo=!!s.getNextImage(true);s.hasRedo=!!s.getNextImage(false);s.resetType();s.onChange();},save:function(s,t,u){var w=this;var v=w.snapshots;if(!t)t=new m(w.editor);if(t.contents===false)return false;if(w.currentImage&&t.equals(w.currentImage,s))return false;v.splice(w.index+1,v.length-w.index-1);if(v.length==w.limit)v.shift();w.index=v.push(t)-1;w.currentImage=t; -if(u!==false)w.fireChange();return true;},restoreImage:function(s){var u=this;u.editor.loadSnapshot(s.contents);if(s.bookmarks)u.editor.getSelection().selectBookmarks(s.bookmarks);else if(c){var t=u.editor.document.getBody().$.createTextRange();t.collapse(true);t.select();}u.index=s.index;u.update();u.fireChange();},getNextImage:function(s){var x=this;var t=x.snapshots,u=x.currentImage,v,w;if(u)if(s)for(w=x.index-1;w>=0;w--){v=t[w];if(!u.equals(v,true)){v.index=w;return v;}}else for(w=x.index+1;w]*>)\s*<(p|div|address|h\d|center|pre)[^>]*>\s*(?:]*>| |\u00A0| )?\s*(:?<\/\2>)?\s*(?=$|<\/body>)/gi,n=d.walker.whitespaces(true);function o(C){return C.isBlockBoundary()&&f.$empty[C.getName()];};function p(C){return function(D){if(this.mode=='wysiwyg'){this.focus();this.fire('saveSnapshot');C.call(this,D.data);e.setTimeout(function(){this.fire('saveSnapshot');},0,this);}};};function q(C){var M=this;if(M.dataProcessor)C=M.dataProcessor.toHtml(C);if(!C)return;var D=M.getSelection(),E=D.getRanges()[0];if(E.checkReadOnly())return;if(b.opera){var F=new d.elementPath(E.startContainer);if(F.block){var G=a.htmlParser.fragment.fromHtml(C,false).children;for(var H=0,I=G.length;H'+O+'';});G=G.replace(/\n/g,'
    ');if(!(F||c))G=G.replace(new RegExp('
    (?=)'),function(M){return e.repeat(M,2);});if(b.gecko||b.webkit){var I=new d.elementPath(D.getStartElement()),J=[];for(var K=0;K/));else if(L in f.$block)break;}G=J.join('')+G;}q.call(this,G);};function s(C){var D=this.getSelection(),E=D.getRanges(),F=C.getName(),G=f.$block[F],H=D.isLocked;if(H)D.unlock();var I,J,K,L;for(var M=E.length-1;M>=0;M--){I=E[M];if(!I.checkReadOnly()){I.deleteContents(1);J=!M&&C||C.clone(1);var N,O;if(G)while((N=I.getCommonAncestor(0,1))&&(O=f[N.getName()])&&!(O&&O[F])){if(N.getName() in f.span)I.splitElement(N);else if(I.checkStartOfBlock()&&I.checkEndOfBlock()){I.setStartBefore(N);I.collapse(true);N.remove();}else I.splitBlock();}I.insertNode(J);if(!K)K=J;}}if(K){I.moveToPosition(K,4);if(G){var P=K.getNext(n),Q=P&&P.type==1&&P.getName();if(Q&&f.$block[Q]&&f[Q]['#'])I.moveToElementEditStart(P);}}D.selectRanges([I]);if(H)this.getSelection().lock();};function t(C){if(!C.checkDirty())setTimeout(function(){C.resetDirty();},0);};var u=d.walker.whitespaces(true),v=d.walker.bookmark(false,true);function w(C){return u(C)&&v(C);};function x(C){return C.type==3&&e.trim(C.getText()).match(/^(?: |\xa0)$/);};function y(C){if(C.isLocked){C.unlock();setTimeout(function(){C.lock();},0);}};function z(C){return C.getOuterHtml().match(m);};u=d.walker.whitespaces(true);function A(C){var D=C.window,E=C.document,F=C.document.getBody(),G=F.getFirst(),H=F.getChildren().count();if(!H||H==1&&G.type==1&&G.hasAttribute('_moz_editor_bogus_node')){t(C);var I=C.element.getDocument(),J=I.getDocumentElement(),K=J.$.scrollTop,L=J.$.scrollLeft,M=E.$.createEvent('KeyEvents');M.initKeyEvent('keypress',true,true,D.$,false,false,false,false,0,32);E.$.dispatchEvent(M);if(K!=J.$.scrollTop||L!=J.$.scrollLeft)I.getWindow().$.scrollTo(L,K);H&&F.getFirst().remove();E.getBody().appendBogus();var N=new d.range(E);N.setStartAt(F,1);N.select();}};function B(C){var D=C.editor,E=C.data.path,F=E.blockLimit,G=C.data.selection,H=G.getRanges()[0],I=D.document.getBody(),J=D.config.enterMode; -if(b.gecko){A(D);var K=E.block||E.blockLimit,L=K&&K.getLast(w);if(K&&K.isBlockBoundary()&&!(L&&L.type==1&&L.isBlockBoundary())&&!K.is('pre')&&!K.getBogus())K.appendBogus();}if(D.config.autoParagraph!==false&&J!=2&&H.collapsed&&F.getName()=='body'&&!E.block){var M=H.fixBlock(true,D.config.enterMode==3?'div':'p');if(c){var N=M.getFirst(w);N&&x(N)&&N.remove();}if(z(M)){var O=M.getNext(u);if(O&&O.type==1&&!o(O)){H.moveToElementEditStart(O);M.remove();}else{O=M.getPrevious(u);if(O&&O.type==1&&!o(O)){H.moveToElementEditEnd(O);M.remove();}}}H.select();C.cancel();}var P=new d.range(D.document);P.moveToElementEditEnd(D.document.getBody());var Q=new d.elementPath(P.startContainer);if(!Q.blockLimit.is('body')){var R;if(J!=2)R=I.append(D.document.createElement(J==1?'p':'div'));else R=I;if(!c)R.appendBogus();}};j.add('wysiwygarea',{requires:['editingblock'],init:function(C){var D=C.config.enterMode!=2&&C.config.autoParagraph!==false?C.config.enterMode==3?'div':'p':false,E=C.lang.editorTitle.replace('%1',C.name),F;C.on('editingBlockReady',function(){var L,M,N,O,P,Q,R=b.isCustomDomain(),S=function(V){if(M)M.remove();var W='document.open();'+(R?'document.domain="'+document.domain+'";':'')+'document.close();';W=b.air?'javascript:void(0)':c?'javascript:void(function(){'+encodeURIComponent(W)+'}())':'';M=h.createFromHtml('');if(document.location.protocol=='chrome:')a.event.useCapture=true;M.on('load',function(X){P=1;X.removeListener();var Y=M.getFrameDocument();Y.write(V);b.air&&U(Y.getWindow().$);});if(document.location.protocol=='chrome:')a.event.useCapture=false;L.append(M);};F=e.addFunction(U);var T='';function U(V){if(!P)return;P=0;C.fire('ariaWidget',M);var W=V.document,X=W.body,Y=W.getElementById('cke_actscrpt');Y&&Y.parentNode.removeChild(Y);X.spellcheck=!C.config.disableNativeSpellChecker;var Z=!C.readOnly;if(c){X.hideFocus=true;X.disabled=true;X.contentEditable=Z;X.removeAttribute('disabled');}else setTimeout(function(){if(b.gecko&&b.version>=10900||b.opera)W.$.body.contentEditable=Z;else if(b.webkit)W.$.body.parentNode.contentEditable=Z;else W.$.designMode=Z?'off':'on';},0);Z&&b.gecko&&e.setTimeout(A,0,null,C);V=C.window=new d.window(V); -W=C.document=new g(W);Z&&W.on('dblclick',function(af){var ag=af.data.getTarget(),ah={element:ag,dialog:''};C.fire('doubleclick',ah);ah.dialog&&C.openDialog(ah.dialog);});c&&W.on('click',function(af){var ag=af.data.getTarget();if(ag.is('input')){var ah=ag.getAttribute('type');if(ah=='submit'||ah=='reset')af.data.preventDefault();}});if(!(c||b.opera))W.on('mousedown',function(af){var ag=af.data.getTarget();if(ag.is('img','hr','input','textarea','select'))C.getSelection().selectElement(ag);});if(b.gecko)W.on('mouseup',function(af){if(af.data.$.button==2){var ag=af.data.getTarget();if(!ag.getOuterHtml().replace(m,'')){var ah=new d.range(W);ah.moveToElementEditStart(ag);ah.select(true);}}});W.on('click',function(af){af=af.data;if(af.getTarget().is('a')&&af.$.button!=2)af.preventDefault();});if(b.webkit){W.on('mousedown',function(){ac=1;});W.on('click',function(af){if(af.data.getTarget().is('input','select'))af.data.preventDefault();});W.on('mouseup',function(af){if(af.data.getTarget().is('input','textarea'))af.data.preventDefault();});}if(Z&&c&&W.$.compatMode=='CSS1Compat'||b.gecko||b.opera){var aa=W.getDocumentElement();aa.on('mousedown',function(af){if(af.data.getTarget().equals(aa)){if(b.gecko&&b.version>=10900)J();K.focus();}});}var ab=c?M:V;ab.on('blur',function(){C.focusManager.blur();});var ac;ab.on('focus',function(){var af=C.document;if(Z&&b.gecko&&b.version>=10900)J();else if(b.opera)af.getBody().focus();else if(b.webkit)if(!ac){C.document.getDocumentElement().focus();ac=1;}C.focusManager.focus();});var ad=C.keystrokeHandler;ad.blockedKeystrokes[8]=!Z;ad.attach(W);W.getDocumentElement().addClass(W.$.compatMode);Z&&W.on('keydown',function(af){var ag=af.data.getKeystroke();if(ag in {8:1,46:1}){var ah=C.getSelection(),ai=ah.getSelectedElement(),aj=ah.getRanges()[0];if(ai){C.fire('saveSnapshot');aj.moveToPosition(ai,3);ai.remove();aj.select();C.fire('saveSnapshot');af.data.preventDefault();return;}}});if(c&&W.$.compatMode=='CSS1Compat'){var ae={33:1,34:1};W.on('keydown',function(af){if(af.data.getKeystroke() in ae)setTimeout(function(){C.getSelection().scrollIntoView();},0);});}if(c&&C.config.enterMode!=1)W.on('selectionchange',function(){var af=W.getBody(),ag=C.getSelection().getRanges()[0];if(af.getHtml().match(/^

     <\/p>$/i)&&ag.startContainer.equals(af))setTimeout(function(){ag=C.getSelection().getRanges()[0];if(!ag.startContainer.equals('body')){af.getFirst().remove(1);ag.moveToElementEditEnd(af);ag.select(1);}},0);});if(C.contextMenu)C.contextMenu.addTarget(W,C.config.browserContextMenuOnCtrl!==false); -setTimeout(function(){C.fire('contentDom');if(Q){C.mode='wysiwyg';C.fire('mode',{previousMode:C._.previousMode});Q=false;}N=false;if(O){C.focus();O=false;}setTimeout(function(){C.fire('dataReady');},0);try{C.document.$.execCommand('enableInlineTableEditing',false,!C.config.disableNativeTableHandles);}catch(af){}if(C.config.disableObjectResizing)try{C.document.$.execCommand('enableObjectResizing',false,false);}catch(ag){C.document.getBody().on(c?'resizestart':'resize',function(ah){ah.data.preventDefault();});}if(c)setTimeout(function(){if(C.document){var ah=C.document.$.body;ah.runtimeStyle.marginBottom='0px';ah.runtimeStyle.marginBottom='';}},1000);},0);};C.addMode('wysiwyg',{load:function(V,W,X){L=V;if(c&&b.quirks)V.setStyle('position','relative');C.mayBeDirty=true;Q=true;if(X)this.loadSnapshotData(W);else this.loadData(W);},loadData:function(V){N=true;C._.dataStore={id:1};var W=C.config,X=W.fullPage,Y=W.docType,Z='';!X&&(Z=e.buildStyleHtml(C.config.contentsCss)+Z);var aa=W.baseHref?'':'';if(X)V=V.replace(/]*>/i,function(ab){C.docType=Y=ab;return '';}).replace(/<\?xml\s[^\?]*\?>/i,function(ab){C.xmlDeclaration=ab;return '';});if(C.dataProcessor)V=C.dataProcessor.toHtml(V,D);if(X){if(!/]/.test(V))V=''+V;if(!/]/.test(V))V=''+V+'';if(!/]/.test(V))V=V.replace(/]*>/,'$&');else if(!/]/.test(V))V=V.replace(/]*>/,'$&');aa&&(V=V.replace(//,'$&'+aa));V=V.replace(/<\/head\s*>/,Z+'$&');V=Y+V;}else V=W.docType+''+''+''+E+''+aa+Z+''+''+V+'';if(b.gecko)V=V.replace(/
    (?=\s*<\/(:?html|body)>)/,'$&
    ');V+=T;this.onDispose();S(V);},getData:function(){var V=C.config,W=V.fullPage,X=W&&C.docType,Y=W&&C.xmlDeclaration,Z=M.getFrameDocument(),aa=W?Z.getDocumentElement().getOuterHtml():Z.getBody().getHtml();if(b.gecko)aa=aa.replace(/
    (?=\s*(:?$|<\/body>))/,'');if(C.dataProcessor)aa=C.dataProcessor.toDataFormat(aa,D);if(V.ignoreEmptyParagraph)aa=aa.replace(m,function(ab,ac){return ac;});if(Y)aa=Y+'\n'+aa;if(X)aa=X+'\n'+aa;return aa;},getSnapshotData:function(){return M.getFrameDocument().getBody().getHtml(); -},loadSnapshotData:function(V){M.getFrameDocument().getBody().setHtml(V);},onDispose:function(){if(!C.document)return;C.document.getDocumentElement().clearCustomData();C.document.getBody().clearCustomData();C.window.clearCustomData();C.document.clearCustomData();M.clearCustomData();M.remove();},unload:function(V){this.onDispose();C.window=C.document=M=L=O=null;C.fire('contentDomUnload');},focus:function(){var V=C.window;if(N)O=true;else if(V){b.air?setTimeout(function(){V.focus();},0):V.focus();C.selectionChange();}}});C.on('insertHtml',p(q),null,null,20);C.on('insertElement',p(s),null,null,20);C.on('insertText',p(r),null,null,20);C.on('selectionChange',function(V){if(C.readOnly)return;var W=C.getSelection();if(W&&!W.isLocked){var X=C.checkDirty();C.fire('saveSnapshot',{contentOnly:1});B.call(this,V);C.fire('updateSnapshot');!X&&C.resetDirty();}},null,null,1);});var G;C.on('contentDom',function(){var L=C.document.getElementsByTag('title').getItem(0);L.data('cke-title',C.document.$.title);C.document.$.title=E;});C.on('readOnly',function(){if(C.mode=='wysiwyg'){var L=C.getMode();L.loadData(L.getData());}});if(a.document.$.documentMode>=8){C.addCss('html.CSS1Compat [contenteditable=false]{ min-height:0 !important;}');var H=[];for(var I in f.$removeEmpty)H.push('html.CSS1Compat '+I+'[contenteditable=false]');C.addCss(H.join(',')+'{ display:inline-block;}');}else if(b.gecko){C.addCss('html { height: 100% !important; }');C.addCss('img:-moz-broken { -moz-force-broken-image-icon : 1;\twidth : 24px; height : 24px; }');}C.addCss('html {\t_overflow-y: scroll; cursor: text;\t*cursor:auto;}');C.addCss('img, input, textarea { cursor: default;}');function J(L){if(C.readOnly)return;e.tryThese(function(){C.document.$.designMode='on';setTimeout(function(){C.document.$.designMode='off';if(a.currentInstance==C)C.document.getBody().focus();},50);},function(){C.document.$.designMode='off';var M=C.document.getBody();M.setAttribute('contentEditable',false);M.setAttribute('contentEditable',true);!L&&J(1);});};if(b.gecko||c||b.opera){var K;C.on('uiReady',function(){K=C.container.append(h.createFromHtml(''));K.on('focus',function(){C.focus();});C.focusGrabber=K;});C.on('destroy',function(){e.removeFunction(F);K.clearCustomData();delete C.focusGrabber;});}C.on('insertElement',function(L){var M=L.data;if(M.type==1&&(M.is('input')||M.is('textarea'))){var N=M.getAttribute('contenteditable')=='false';if(!N){M.data('cke-editable',M.hasAttribute('contenteditable')?'true':'1'); -M.setAttribute('contenteditable',false);}}});}});if(b.gecko)(function(){var C=document.body;if(!C)window.addEventListener('load',arguments.callee,false);else{var D=C.getAttribute('onpageshow');C.setAttribute('onpageshow',(D?D+';':'')+'event.persisted && (function(){'+'var allInstances = CKEDITOR.instances, editor, doc;'+'for ( var i in allInstances )'+'{'+'\teditor = allInstances[ i ];'+'\tdoc = editor.document;'+'\tif ( doc )'+'\t{'+'\t\tdoc.$.designMode = "off";'+'\t\tdoc.$.designMode = "on";'+'\t}'+'}'+'})();');}})();})();i.disableObjectResizing=false;i.disableNativeTableHandles=true;i.disableNativeSpellChecker=true;i.ignoreEmptyParagraph=true;j.add('wsc',{requires:['dialog'],init:function(m){var n='checkspell',o=m.addCommand(n,new a.dialogCommand(n));o.modes={wysiwyg:!b.opera&&!b.air&&document.domain==window.location.hostname};m.ui.addButton('SpellChecker',{label:m.lang.spellCheck.toolbar,command:n});a.dialog.add(n,this.path+'dialogs/wsc.js');}});i.wsc_customerId=i.wsc_customerId||'1:ua3xw1-2XyGJ3-GWruD3-6OFNT1-oXcuB1-nR6Bp4-hgQHc-EcYng3-sdRXG3-NOfFk';i.wsc_customLoaderScript=i.wsc_customLoaderScript||null;a.DIALOG_RESIZE_NONE=0;a.DIALOG_RESIZE_WIDTH=1;a.DIALOG_RESIZE_HEIGHT=2;a.DIALOG_RESIZE_BOTH=3;(function(){var m=e.cssLength;function n(S){return!!this._.tabs[S][0].$.offsetHeight;};function o(){var W=this;var S=W._.currentTabId,T=W._.tabIdList.length,U=e.indexOf(W._.tabIdList,S)+T;for(var V=U-1;V>U-T;V--){if(n.call(W,W._.tabIdList[V%T]))return W._.tabIdList[V%T];}return null;};function p(){var W=this;var S=W._.currentTabId,T=W._.tabIdList.length,U=e.indexOf(W._.tabIdList,S);for(var V=U+1;V1){af._.tabBarMode=true;af._.tabs[af._.currentTabId][0].focus();aj=1;}else if((as==37||as==39)&&af._.tabBarMode){av=as==(at?39:37)?o.call(af):p.call(af);af.selectPage(av);af._.tabs[av][0].focus();aj=1;}else if((as==13||as==32)&&af._.tabBarMode){aw.selectPage(aw._.currentTabId);aw._.tabBarMode=false;aw._.currentFocusIndex=-1;ai(true);aj=1;}if(aj){ar.stop();ar.data.preventDefault();}};function al(ar){aj&&ar.data.preventDefault();};var am=this._.element;this.on('show',function(){am.on('keydown',ak,this,null,0);if(b.opera||b.gecko&&b.mac)am.on('keypress',al,this);});this.on('hide',function(){am.removeListener('keydown',ak);if(b.opera||b.gecko&&b.mac)am.removeListener('keypress',al);ag(function(ar){s.apply(ar);});});this.on('iframeAdded',function(ar){var as=new g(ar.data.iframe.$.contentWindow.document);as.on('keydown',ak,this,null,0);});this.on('show',function(){var av=this;ah();if(S.config.dialog_startupFocusTab&&af._.pageCount>1){af._.tabBarMode=true;af._.tabs[af._.currentTabId][0].focus();}else if(!av._.hasFocus){av._.currentFocusIndex=-1;if(U.onFocus){var ar=U.onFocus.call(av);ar&&ar.focus();}else ai(true);if(av._.editor.mode=='wysiwyg'&&c){var as=S.document.$.selection,at=as.createRange();if(at)if(at.parentElement&&at.parentElement().ownerDocument==S.document.$||at.item&&at.item(0).ownerDocument==S.document.$){var au=document.body.createTextRange();au.moveToElementText(av.getElement().getFirst().$);au.collapse(true);au.select();}}}},this,null,4294967295);if(b.ie6Compat)this.on('load',function(ar){var as=this.getElement(),at=as.getFirst();at.remove();at.appendTo(as);},this);A(this);B(this);new d.text(U.title,a.document).appendTo(this.parts.title);for(var an=0;an0?U:0)+'px'};ab[X?'right':'left']=(T>0?T:0)+'px';W.setStyles(ab);V&&(ac._.moved=1);};})(),getPosition:function(){return e.extend({},this._.position);},show:function(){var S=this._.element,T=this.definition;if(!(S.getParent()&&S.getParent().equals(a.document.getBody())))S.appendTo(a.document.getBody());else S.setStyle('display','block');if(b.gecko&&b.version<10900){var U=this.parts.dialog;U.setStyle('position','absolute');setTimeout(function(){U.setStyle('position','fixed');},0);}this.resize(this._.contentSize&&this._.contentSize.width||T.width||T.minWidth,this._.contentSize&&this._.contentSize.height||T.height||T.minHeight);this.reset(); -this.selectPage(this.definition.contents[0].id);if(a.dialog._.currentZIndex===null)a.dialog._.currentZIndex=this._.editor.config.baseFloatZIndex;this._.element.getFirst().setStyle('z-index',a.dialog._.currentZIndex+=10);if(a.dialog._.currentTop===null){a.dialog._.currentTop=this;this._.parentDialog=null;G(this._.editor);S.on('keydown',K);S.on(b.opera?'keypress':'keyup',L);for(var V in {keyup:1,keydown:1,keypress:1})S.on(V,R);}else{this._.parentDialog=a.dialog._.currentTop;var W=this._.parentDialog.getElement().getFirst();W.$.style.zIndex-=Math.floor(this._.editor.config.baseFloatZIndex/2);a.dialog._.currentTop=this;}M(this,this,'\x1b',null,function(){this.getButton('cancel')&&this.getButton('cancel').click();});this._.hasFocus=false;e.setTimeout(function(){this.layout();this.parts.dialog.setStyle('visibility','');this.fireOnce('load',{});k.fire('ready',this);this.fire('show',{});this._.editor.fire('dialogShow',this);this.foreach(function(X){X.setInitValue&&X.setInitValue();});},100,this);},layout:function(){var U=this;var S=a.document.getWindow().getViewPaneSize(),T=U.getSize();U.move(U._.moved?U._.position.x:(S.width-T.width)/2,U._.moved?U._.position.y:(S.height-T.height)/2);},foreach:function(S){var V=this;for(var T in V._.contents)for(var U in V._.contents[T])S.call(V,V._.contents[T][U]);return V;},reset:(function(){var S=function(T){if(T.reset)T.reset(1);};return function(){this.foreach(S);return this;};})(),setupContent:function(){var S=arguments;this.foreach(function(T){if(T.setup)T.setup.apply(T,S);});},commitContent:function(){var S=arguments;this.foreach(function(T){if(c&&this._.currentFocusIndex==T.focusIndex)T.getInputElement().$.blur();if(T.commit)T.commit.apply(T,S);});},hide:function(){if(!this.parts.dialog.isVisible())return;this.fire('hide',{});this._.editor.fire('dialogHide',this);var S=this._.element;S.setStyle('display','none');this.parts.dialog.setStyle('visibility','hidden');N(this);while(a.dialog._.currentTop!=this)a.dialog._.currentTop.hide();if(!this._.parentDialog)H();else{var T=this._.parentDialog.getElement().getFirst();T.setStyle('z-index',parseInt(T.$.style.zIndex,10)+Math.floor(this._.editor.config.baseFloatZIndex/2));}a.dialog._.currentTop=this._.parentDialog;if(!this._.parentDialog){a.dialog._.currentZIndex=null;S.removeListener('keydown',K);S.removeListener(b.opera?'keypress':'keyup',L);for(var U in {keyup:1,keydown:1,keypress:1})S.removeListener(U,R);var V=this._.editor;V.focus();if(V.mode=='wysiwyg'&&c){var W=V.getSelection(); -W&&W.unlock(true);}}else a.dialog._.currentZIndex-=10;delete this._.parentDialog;this.foreach(function(X){X.resetInitValue&&X.resetInitValue();});},addPage:function(S){var ae=this;var T=[],U=S.label?' title="'+e.htmlEncode(S.label)+'"':'',V=S.elements,W=a.dialog._.uiElementBuilders.vbox.build(ae,{type:'vbox',className:'cke_dialog_page_contents',children:S.elements,expand:!!S.expand,padding:S.padding,style:S.style||'width: 100%;height:100%'},T),X=h.createFromHtml(T.join(''));X.setAttribute('role','tabpanel');var Y=b,Z='cke_'+S.id+'_'+e.getNextNumber(),aa=h.createFromHtml(['0?' cke_last':'cke_first',U,!!S.hidden?' style="display:none"':'',' id="',Z,'"',Y.gecko&&Y.version>=10900&&!Y.hc?'':' href="javascript:void(0)"',' tabIndex="-1"',' hidefocus="true"',' role="tab">',S.label,''].join(''));X.setAttribute('aria-labelledby',Z);ae._.tabs[S.id]=[aa,X];ae._.tabIdList.push(S.id);!S.hidden&&ae._.pageCount++;ae._.lastTab=aa;ae.updateStyle();var ab=ae._.contents[S.id]={},ac,ad=W.getChild();while(ac=ad.shift()){ab[ac.id]=ac;if(typeof ac.getChild=='function')ad.push.apply(ad,ac.getChild());}X.setAttribute('name',S.id);X.appendTo(ae.parts.contents);aa.unselectable();ae.parts.tabs.append(aa);if(S.accessKey){M(ae,ae,'CTRL+'+S.accessKey,P,O);ae._.accessKeyMap['CTRL+'+S.accessKey]=S.id;}},selectPage:function(S){if(this._.currentTabId==S)return;if(this.fire('selectPage',{page:S,currentPage:this._.currentTabId})===true)return;for(var T in this._.tabs){var U=this._.tabs[T][0],V=this._.tabs[T][1];if(T!=S){U.removeClass('cke_dialog_tab_selected');V.hide();}V.setAttribute('aria-hidden',T!=S);}var W=this._.tabs[S];W[0].addClass('cke_dialog_tab_selected');if(b.ie6Compat||b.ie7Compat){q(W[1]);W[1].show();setTimeout(function(){q(W[1],1);},0);}else W[1].show();this._.currentTabId=S;this._.currentTabIndex=e.indexOf(this._.tabIdList,S);},updateStyle:function(){this.parts.dialog[(this._.pageCount===1?'add':'remove')+'Class']('cke_single_page');},hidePage:function(S){var U=this;var T=U._.tabs[S]&&U._.tabs[S][0];if(!T||U._.pageCount==1||!T.isVisible())return;else if(S==U._.currentTabId)U.selectPage(o.call(U));T.hide();U._.pageCount--;U.updateStyle();},showPage:function(S){var U=this;var T=U._.tabs[S]&&U._.tabs[S][0];if(!T)return;T.show();U._.pageCount++;U.updateStyle();},getElement:function(){return this._.element;},getName:function(){return this._.name;},getContentElement:function(S,T){var U=this._.contents[S];return U&&U[T];},getValueOf:function(S,T){return this.getContentElement(S,T).getValue(); -},setValueOf:function(S,T,U){return this.getContentElement(S,T).setValue(U);},getButton:function(S){return this._.buttons[S];},click:function(S){return this._.buttons[S].click();},disableButton:function(S){return this._.buttons[S].disable();},enableButton:function(S){return this._.buttons[S].enable();},getPageCount:function(){return this._.pageCount;},getParentEditor:function(){return this._.editor;},getSelectedElement:function(){return this.getParentEditor().getSelection().getSelectedElement();},addFocusable:function(S,T){var V=this;if(typeof T=='undefined'){T=V._.focusList.length;V._.focusList.push(new t(V,S,T));}else{V._.focusList.splice(T,0,new t(V,S,T));for(var U=T+1;Uad.width-ac.width-X)ai=ad.width-ac.width+(W.lang.dir=='rtl'?0:Y[1]);else ai=U.x;if(U.y+Y[0]ad.height-ac.height-X)aj=ad.height-ac.height+Y[2];else aj=U.y;S.move(ai,aj,1);ab.data.preventDefault();};function aa(ab){a.document.removeListener('mousemove',Z);a.document.removeListener('mouseup',aa);if(b.ie6Compat){var ac=E.getChild(0).getFrameDocument();ac.removeListener('mousemove',Z);ac.removeListener('mouseup',aa);}};S.parts.title.on('mousedown',function(ab){T={x:ab.data.$.screenX,y:ab.data.$.screenY};a.document.on('mousemove',Z);a.document.on('mouseup',aa);U=S.getPosition();if(b.ie6Compat){var ac=E.getChild(0).getFrameDocument();ac.on('mousemove',Z);ac.on('mouseup',aa);}ab.data.preventDefault();},S);};function B(S){var T=S.definition,U=T.resizable;if(U==0)return;var V=S.getParentEditor(),W,X,Y,Z,aa,ab,ac=e.addFunction(function(af){aa=S.getSize();var ag=S.parts.contents,ah=ag.$.getElementsByTagName('iframe').length;if(ah){ab=h.createFromHtml('

    ');ag.append(ab);}X=aa.height-S.parts.contents.getSize('height',!(b.gecko||b.opera||c&&b.quirks));W=aa.width-S.parts.contents.getSize('width',1);Z={x:af.screenX,y:af.screenY};Y=a.document.getWindow().getViewPaneSize();a.document.on('mousemove',ad);a.document.on('mouseup',ae);if(b.ie6Compat){var ai=E.getChild(0).getFrameDocument();ai.on('mousemove',ad);ai.on('mouseup',ae);}af.preventDefault&&af.preventDefault(); -});S.on('load',function(){var af='';if(U==1)af=' cke_resizer_horizontal';else if(U==2)af=' cke_resizer_vertical';var ag=h.createFromHtml('
    ');S.parts.footer.append(ag,1);});V.on('destroy',function(){e.removeFunction(ac);});function ad(af){var ag=V.lang.dir=='rtl',ah=(af.data.$.screenX-Z.x)*(ag?-1:1),ai=af.data.$.screenY-Z.y,aj=aa.width,ak=aa.height,al=aj+ah*(S._.moved?1:2),am=ak+ai*(S._.moved?1:2),an=S._.element.getFirst(),ao=ag&&an.getComputedStyle('right'),ap=S.getPosition();if(ap.y+am>Y.height)am=Y.height-ap.y;if((ag?ao:ap.x)+al>Y.width)al=Y.width-(ag?ao:ap.x);if(U==1||U==3)aj=Math.max(T.minWidth||0,al-W);if(U==2||U==3)ak=Math.max(T.minHeight||0,am-X);S.resize(aj,ak);if(!S._.moved)S.layout();af.data.preventDefault();};function ae(){a.document.removeListener('mouseup',ae);a.document.removeListener('mousemove',ad);if(ab){ab.remove();ab=null;}if(b.ie6Compat){var af=E.getChild(0).getFrameDocument();af.removeListener('mouseup',ae);af.removeListener('mousemove',ad);}};};var C,D={},E;function F(S){S.data.preventDefault(1);};function G(S){var T=a.document.getWindow(),U=S.config,V=U.dialog_backgroundCoverColor||'white',W=U.dialog_backgroundCoverOpacity,X=U.baseFloatZIndex,Y=e.genKey(V,W,X),Z=D[Y];if(!Z){var aa=['
    '];if(b.ie6Compat){var ab=b.isCustomDomain(),ac="";aa.push('');}aa.push('
    ');Z=h.createFromHtml(aa.join(''));Z.setOpacity(W!=undefined?W:0.5);Z.on('keydown',F);Z.on('keypress',F);Z.on('keyup',F);Z.appendTo(a.document.getBody());D[Y]=Z;}else Z.show();E=Z;var ad=function(){var ag=T.getViewPaneSize();Z.setStyles({width:ag.width+'px',height:ag.height+'px'});},ae=function(){var ag=T.getScrollPosition(),ah=a.dialog._.currentTop;Z.setStyles({left:ag.x+'px',top:ag.y+'px'});if(ah)do{var ai=ah.getPosition(); -ah.move(ai.x,ai.y);}while(ah=ah._.parentDialog)};C=ad;T.on('resize',ad);ad();if(!(b.mac&&b.webkit))Z.focus();if(b.ie6Compat){var af=function(){ae();arguments.callee.prevScrollHandler.apply(this,arguments);};T.$.setTimeout(function(){af.prevScrollHandler=window.onscroll||(function(){});window.onscroll=af;},0);ae();}};function H(){if(!E)return;var S=a.document.getWindow();E.hide();S.removeListener('resize',C);if(b.ie6Compat)S.$.setTimeout(function(){var T=window.onscroll&&window.onscroll.prevScrollHandler;window.onscroll=T||null;},0);C=null;};function I(){for(var S in D)D[S].remove();D={};};var J={},K=function(S){var T=S.data.$.ctrlKey||S.data.$.metaKey,U=S.data.$.altKey,V=S.data.$.shiftKey,W=String.fromCharCode(S.data.$.keyCode),X=J[(T?'CTRL+':'')+(U?'ALT+':'')+(V?'SHIFT+':'')+W];if(!X||!X.length)return;X=X[X.length-1];X.keydown&&X.keydown.call(X.uiElement,X.dialog,X.key);S.data.preventDefault();},L=function(S){var T=S.data.$.ctrlKey||S.data.$.metaKey,U=S.data.$.altKey,V=S.data.$.shiftKey,W=String.fromCharCode(S.data.$.keyCode),X=J[(T?'CTRL+':'')+(U?'ALT+':'')+(V?'SHIFT+':'')+W];if(!X||!X.length)return;X=X[X.length-1];if(X.keyup){X.keyup.call(X.uiElement,X.dialog,X.key);S.data.preventDefault();}},M=function(S,T,U,V,W){var X=J[U]||(J[U]=[]);X.push({uiElement:S,dialog:T,key:U,keyup:W||S.accessKeyUp,keydown:V||S.accessKeyDown});},N=function(S){for(var T in J){var U=J[T];for(var V=U.length-1;V>=0;V--){if(U[V].dialog==S||U[V].uiElement==S)U.splice(V,1);}if(U.length===0)delete J[T];}},O=function(S,T){if(S._.accessKeyMap[T])S.selectPage(S._.accessKeyMap[T]);},P=function(S,T){},Q={27:1,13:1},R=function(S){if(S.data.getKeystroke() in Q)S.data.stopPropagation();};(function(){k.dialog={uiElement:function(S,T,U,V,W,X,Y){if(arguments.length<4)return;var Z=(V.call?V(T):V)||'div',aa=['<',Z,' '],ab=(W&&W.call?W(T):W)||{},ac=(X&&X.call?X(T):X)||{},ad=(Y&&Y.call?Y.call(this,S,T):Y)||'',ae=this.domId=ac.id||e.getNextId()+'_uiElement',af=this.id=T.id,ag;ac.id=ae;var ah={};if(T.type)ah['cke_dialog_ui_'+T.type]=1;if(T.className)ah[T.className]=1;if(T.disabled)ah.cke_disabled=1;var ai=ac['class']&&ac['class'].split?ac['class'].split(' '):[];for(ag=0;ag=0;ag--){if(ak[ag]==='')ak.splice(ag,1);}if(ak.length>0)ac.style=(ac.style?ac.style+'; ':'')+ak.join('; ');for(ag in ac)aa.push(ag+'="'+e.htmlEncode(ac[ag])+'" ');aa.push('>',ad,'');U.push(aa.join(''));(this._||(this._={})).dialog=S;if(typeof T.isChanged=='boolean')this.isChanged=function(){return T.isChanged;};if(typeof T.isChanged=='function')this.isChanged=T.isChanged;if(typeof T.setValue=='function')this.setValue=e.override(this.setValue,function(an){return function(ao){an.call(this,T.setValue.call(this,ao));};});if(typeof T.getValue=='function')this.getValue=e.override(this.getValue,function(an){return function(){return T.getValue.call(this,an.call(this));};});a.event.implementOn(this);this.registerEvents(T);if(this.accessKeyUp&&this.accessKeyDown&&T.accessKey)M(this,S,'CTRL+'+T.accessKey);var am=this;S.on('load',function(){var an=am.getInputElement();if(an){var ao=am.type in {checkbox:1,ratio:1}&&c&&b.version<8?'cke_dialog_ui_focused':'';an.on('focus',function(){S._.tabBarMode=false;S._.hasFocus=true;am.fire('focus');ao&&this.addClass(ao);});an.on('blur',function(){am.fire('blur');ao&&this.removeClass(ao);});}});if(this.keyboardFocusable){this.tabIndex=T.tabIndex||0;this.focusIndex=S._.focusList.push(this)-1;this.on('focus',function(){S._.currentFocusIndex=am.focusIndex;});}e.extend(this,T);},hbox:function(S,T,U,V,W){if(arguments.length<4)return;this._||(this._={});var X=this._.children=T,Y=W&&W.widths||null,Z=W&&W.height||null,aa={},ab,ac=function(){var ae=[''];for(ab=0;ab0)ae.push('style="'+ag.join('; ')+'" ');ae.push('>',U[ab],'');}ae.push('');return ae.join('');},ad={role:'presentation'};W&&W.align&&(ad.align=W.align);k.dialog.uiElement.call(this,S,W||{type:'hbox'},V,'table',aa,ad,ac);},vbox:function(S,T,U,V,W){if(arguments.length<3)return;this._||(this._={});var X=this._.children=T,Y=W&&W.width||null,Z=W&&W.heights||null,aa=function(){var ab=['');for(var ac=0;ac');}ab.push('
    0)ab.push('style="',ad.join('; '),'" ');ab.push(' class="cke_dialog_ui_vbox_child">',U[ac],'
    ');return ab.join('');};k.dialog.uiElement.call(this,S,W||{type:'vbox'},V,'div',null,{role:'presentation'},aa);}};})();k.dialog.uiElement.prototype={getElement:function(){return a.document.getById(this.domId);},getInputElement:function(){return this.getElement();},getDialog:function(){return this._.dialog;},setValue:function(S,T){this.getInputElement().setValue(S);!T&&this.fire('change',{value:S});return this;},getValue:function(){return this.getInputElement().getValue();},isChanged:function(){return false;},selectParentTab:function(){var V=this;var S=V.getInputElement(),T=S,U;while((T=T.getParent())&&T.$.className.search('cke_dialog_page_contents')==-1){}if(!T)return V;U=T.getAttribute('name');if(V._.dialog._.currentTabId!=U)V._.dialog.selectPage(U);return V;},focus:function(){this.selectParentTab().getInputElement().focus();return this;},registerEvents:function(S){var T=/^on([A-Z]\w+)/,U,V=function(X,Y,Z,aa){Y.on('load',function(){X.getInputElement().on(Z,aa,X);});};for(var W in S){if(!(U=W.match(T)))continue;if(this.eventProcessors[W])this.eventProcessors[W].call(this,this._.dialog,S[W]);else V(this,this._.dialog,U[1].toLowerCase(),S[W]);}return this;},eventProcessors:{onLoad:function(S,T){S.on('load',T,this);},onShow:function(S,T){S.on('show',T,this);},onHide:function(S,T){S.on('hide',T,this);}},accessKeyDown:function(S,T){this.focus();},accessKeyUp:function(S,T){},disable:function(){var S=this.getElement(),T=this.getInputElement();T.setAttribute('disabled','true');S.addClass('cke_disabled');},enable:function(){var S=this.getElement(),T=this.getInputElement();T.removeAttribute('disabled');S.removeClass('cke_disabled');},isEnabled:function(){return!this.getElement().hasClass('cke_disabled');},isVisible:function(){return this.getInputElement().isVisible();},isFocusable:function(){if(!this.isEnabled()||!this.isVisible())return false; -return true;}};k.dialog.hbox.prototype=e.extend(new k.dialog.uiElement(),{getChild:function(S){var T=this;if(arguments.length<1)return T._.children.concat();if(!S.splice)S=[S];if(S.length<2)return T._.children[S[0]];else return T._.children[S[0]]&&T._.children[S[0]].getChild?T._.children[S[0]].getChild(S.slice(1,S.length)):null;}},true);k.dialog.vbox.prototype=new k.dialog.hbox();(function(){var S={build:function(T,U,V){var W=U.children,X,Y=[],Z=[];for(var aa=0;aa',T||U.name,'');return V.join('');}};a.style.getStyleText=function(T){var U=T._ST;if(U)return U;U=T.styles;var V=T.attributes&&T.attributes.style||'',W='';if(V.length)V=V.replace(o,';');for(var X in U){var Y=U[X],Z=(X+':'+Y).replace(o,';');if(Y=='inherit')W+=Z;else V+=Z;}if(V.length)V=P(V);V+=W;return T._ST=V;};function s(T){var U,V;while(T=T.getParent()){if(T.getName()=='body')break;if(T.getAttribute('data-nostyle'))U=T;else if(!V){var W=T.getAttribute('contentEditable');if(W=='false')U=T;else if(W=='true')V=1;}}return U;};function t(T){var ay=this;var U=T.document;if(T.collapsed){var V=J(ay,U);T.insertNode(V);T.moveToPosition(V,2);return;}var W=ay.element,X=ay._.definition,Y,Z=X.ignoreReadonly,aa=Z||X.includeReadonly;if(aa==undefined)aa=U.getCustomData('cke_includeReadonly');var ab=f[W]||(Y=true,f.span);T.enlarge(1,1);T.trim();var ac=T.createBookmark(),ad=ac.startNode,ae=ac.endNode,af=ad,ag;if(!Z){var ah=s(ad),ai=s(ae);if(ah)af=ah.getNextSourceNode(true);if(ai)ae=ai;}if(af.getPosition(ae)==2)af=0;while(af){var aj=false;if(af.equals(ae)){af=null;aj=true;}else{var ak=af.type,al=ak==1?af.getName():null,am=al&&af.getAttribute('contentEditable')=='false',an=al&&af.getAttribute('data-nostyle'); -if(al&&af.data('cke-bookmark')){af=af.getNextSourceNode(true);continue;}if(!al||ab[al]&&!an&&(!am||aa)&&(af.getPosition(ae)|4|0|8)==4+0+8&&(!X.childRule||X.childRule(af))){var ao=af.getParent();if(ao&&((ao.getDtd()||f.span)[W]||Y)&&(!X.parentRule||X.parentRule(ao))){if(!ag&&(!al||!f.$removeEmpty[al]||(af.getPosition(ae)|4|0|8)==4+0+8)){ag=new d.range(U);ag.setStartBefore(af);}if(ak==3||am||ak==1&&!af.getChildCount()){var ap=af,aq;while((aj=!ap.getNext(q))&&(aq=ap.getParent(),ab[aq.getName()])&&(aq.getPosition(ad)|2|0|8)==2+0+8&&(!X.childRule||X.childRule(aq)))ap=aq;ag.setEndAfter(ap);}}else aj=true;}else aj=true;af=af.getNextSourceNode(an||am);}if(aj&&ag&&!ag.collapsed){var ar=J(ay,U),as=ar.hasAttributes(),at=ag.getCommonAncestor(),au={styles:{},attrs:{},blockedStyles:{},blockedAttrs:{}},av,aw,ax;while(ar&&at){if(at.getName()==W){for(av in X.attributes){if(au.blockedAttrs[av]||!(ax=at.getAttribute(aw)))continue;if(ar.getAttribute(av)==ax)au.attrs[av]=1;else au.blockedAttrs[av]=1;}for(aw in X.styles){if(au.blockedStyles[aw]||!(ax=at.getStyle(aw)))continue;if(ar.getStyle(aw)==ax)au.styles[aw]=1;else au.blockedStyles[aw]=1;}}at=at.getParent();}for(av in au.attrs)ar.removeAttribute(av);for(aw in au.styles)ar.removeStyle(aw);if(as&&!ar.hasAttributes())ar=null;if(ar){ag.extractContents().appendTo(ar);G(ay,ar);ag.insertNode(ar);ar.mergeSiblings();if(!c)ar.$.normalize();}else{ar=new h('span');ag.extractContents().appendTo(ar);ag.insertNode(ar);G(ay,ar);ar.remove(true);}ag=null;}}T.moveToBookmark(ac);T.shrink(2);};function u(T){T.enlarge(1,1);var U=T.createBookmark(),V=U.startNode;if(T.collapsed){var W=new d.elementPath(V.getParent()),X;for(var Y=0,Z;Y'+V+'';else T.setHtml(V);U.remove();};function B(T){var U=/(\S\s*)\n(?:\s|(]+data-cke-bookmark.*?\/span>))*\n(?!$)/gi,V=T.getName(),W=C(T.getOuterHtml(),U,function(Y,Z,aa){return Z+''+aa+'
    ';}),X=[];W.replace(/([\s\S]*?)<\/pre>/gi,function(Y,Z){X.push(Z);});return X;};function C(T,U,V){var W='',X='';T=T.replace(/(^]+data-cke-bookmark.*?\/span>)|(]+data-cke-bookmark.*?\/span>$)/gi,function(Y,Z,aa){Z&&(W=Z);aa&&(X=aa);return '';});return W+T.replace(U,V)+X;};function D(T,U){var V;if(T.length>1)V=new d.documentFragment(U.getDocument());for(var W=0;W');X=X.replace(/[ \t]{2,}/g,function(Z){return e.repeat(' ',Z.length-1)+' ';});if(V){var Y=U.clone();Y.setHtml(X);V.append(Y);}else U.setHtml(X);}return V||U;};function E(T,U){var V=T.getBogus();V&&V.remove();var W=T.getHtml();W=C(W,/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g,'');W=W.replace(/[ \t\r\n]*(]*>)[ \t\r\n]*/gi,'$1');W=W.replace(/([ \t\n\r]+| )/g,' ');W=W.replace(/]*>/gi,'\n');if(c){var X=T.getDocument().createElement('div');X.append(U);U.$.outerHTML='
    '+W+'
    ';U.copyAttributes(X.getFirst());U=X.getFirst().remove();}else U.setHtml(W);return U;};function F(T,U){var V=T._.definition,W=e.extend({},V.attributes,N(T)[U.getName()]),X=V.styles,Y=e.isEmpty(W)&&e.isEmpty(X);for(var Z in W){if((Z=='class'||T._.definition.fullMatch)&&U.getAttribute(Z)!=O(Z,W[Z]))continue;Y=U.hasAttribute(Z);U.removeAttribute(Z);}for(var aa in X){if(T._.definition.fullMatch&&U.getStyle(aa)!=O(aa,X[aa],true))continue;Y=Y||!!U.getStyle(aa);U.removeStyle(aa);}if(Y)!f.$block[U.getName()]||T._.enterMode==2&&!U.hasAttributes()?I(U):U.renameNode(T._.enterMode==1?'p':'div');};function G(T,U){var V=T._.definition,W=V.attributes,X=V.styles,Y=N(T),Z=U.getElementsByTag(T.element);for(var aa=Z.count();--aa>=0;)F(T,Z.getItem(aa));for(var ab in Y){if(ab!=T.element){Z=U.getElementsByTag(ab);for(aa=Z.count()-1;aa>=0;aa--){var ac=Z.getItem(aa);H(ac,Y[ab]);}}}};function H(T,U){var V=U&&U.attributes;if(V)for(var W=0;W0)H+=(F.$.offsetWidth||0)-(F.$.clientWidth||0)+3;H+=4;F.setStyle('width',H+'px');v.element.addClass('cke_frameLoaded');var I=v.element.$.scrollHeight;if(c&&b.quirks&&I>0)I+=(F.$.offsetHeight||0)-(F.$.clientHeight||0)+3;F.setStyle('height',I+'px');u._.currentBlock.element.setStyle('display','none').removeStyle('display');}else F.removeStyle('height');var J=u.element,K=J.getWindow(),L=K.getScrollPosition(),M=K.getViewPaneSize(),N={height:J.$.offsetHeight,width:J.$.offsetWidth};if(A?B<0:B+N.width>M.width+L.x)B+=N.width*(A?1:-1); -if(C+N.height>M.height+L.y)C-=N.height;if(c){var O=new h(w.$.offsetParent),P=O;if(P.getName()=='html')P=P.getDocument().getBody();if(P.getComputedStyle('direction')=='rtl')if(b.ie8Compat)B-=w.getDocument().getDocumentElement().$.scrollLeft*2;else B-=O.$.scrollWidth-O.$.clientWidth;}var Q=w.getFirst(),R;if(R=Q.getCustomData('activePanel'))R.onHide&&R.onHide.call(this,1);Q.setCustomData('activePanel',this);w.setStyles({top:C+'px',left:B+'px'});w.setOpacity(1);},this);u.isLoaded?E():u.onLoad=E;e.setTimeout(function(){x.$.contentWindow.focus();this.allowBlur(true);},0,this);},b.air?200:0,this);this.visible=1;if(this.onShow)this.onShow.call(this);n=0;},hide:function(p){var r=this;if(r.visible&&(!r.onHide||r.onHide.call(r)!==true)){r.hideChild();b.gecko&&r._.iframe.getFrameDocument().$.activeElement.blur();r.element.setStyle('display','none');r.visible=0;r.element.getFirst().removeCustomData('activePanel');var q=p!==false&&r._.returnFocus;if(q){if(b.webkit&&q.type)q.getWindow().$.focus();q.focus();}}},allowBlur:function(p){var q=this._.panel;if(p!=undefined)q.allowBlur=p;return q.allowBlur;},showAsChild:function(p,q,r,s,t,u){if(this._.activeChild==p&&p._.panel._.offsetParentId==r.getId())return;this.hideChild();p.onHide=e.bind(function(){e.setTimeout(function(){if(!this._.focused)this.hide();},0,this);},this);this._.activeChild=p;this._.focused=false;p.showBlock(q,r,s,t,u);if(b.ie7Compat||b.ie8&&b.ie6Compat)setTimeout(function(){p.element.getChild(0).$.style.cssText+='';},100);},hideChild:function(){var p=this._.activeChild;if(p){delete p.onHide;delete p._.returnFocus;delete this._.activeChild;p.hide();}}}});a.on('instanceDestroyed',function(){var p=e.isEmpty(a.instances);for(var q in m){var r=m[q];if(p)r.destroy();else r.element.hide();}p&&(m={});});})();j.add('menu',{beforeInit:function(m){var n=m.config.menu_groups.split(','),o=m._.menuGroups={},p=m._.menuItems={};for(var q=0;q'],B=r.length,C=B&&r[0].group;for(var D=0;D');C=E.group;}E.render(this,D,A);}A.push('');u.setHtml(A.join(''));k.fire('ready',this);if(this.parent)this.parent._.panel.showAsChild(t,this.id,n,o,p,q);else t.showBlock(this.id,n,o,p,q);s.fire('menuShow',[t]);},addListener:function(n){this._.listeners.push(n);},hide:function(n){var o=this;o._.onHide&&o._.onHide();o._.panel&&o._.panel.hide(n);}}});function m(n){n.sort(function(o,p){if(o.groupp.group)return 1;return o.orderp.order?1:0;});};a.menuItem=e.createClass({$:function(n,o,p){var q=this;e.extend(q,p,{order:0,className:'cke_button_'+o});q.group=n._.menuGroups[q.group];q.editor=n;q.name=o;},proto:{render:function(n,o,p){var w=this;var q=n.id+String(o),r=typeof w.state=='undefined'?2:w.state,s=' cke_'+(r==1?'on':r==0?'disabled':'off'),t=w.label;if(w.className)s+=' '+w.className;var u=w.getItems;p.push(''+''+'');if(u)p.push('','&#',w.editor.lang.dir=='rtl'?'9668':'9658',';','');p.push(t,'');}}});})();i.menu_groups='clipboard,form,tablecell,tablecellproperties,tablerow,tablecolumn,table,anchor,link,image,flash,checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea,div'; -(function(){var m;j.add('editingblock',{init:function(n){if(!n.config.editingBlock)return;n.on('themeSpace',function(o){if(o.data.space=='contents')o.data.html+='
    ';});n.on('themeLoaded',function(){n.fireOnce('editingBlockReady');});n.on('uiReady',function(){n.setMode(n.config.startupMode);});n.on('afterSetData',function(){if(!m){function o(){m=true;n.getMode().loadData(n.getData());m=false;};if(n.mode)o();else n.on('mode',function(){if(n.mode){o();n.removeListener('mode',arguments.callee);}});}});n.on('beforeGetData',function(){if(!m&&n.mode){m=true;n.setData(n.getMode().getData(),null,1);m=false;}});n.on('getSnapshot',function(o){if(n.mode)o.data=n.getMode().getSnapshotData();});n.on('loadSnapshot',function(o){if(n.mode)n.getMode().loadSnapshotData(o.data);});n.on('mode',function(o){o.removeListener();b.webkit&&n.container.on('focus',function(){n.focus();});if(n.config.startupFocus)n.focus();setTimeout(function(){n.fireOnce('instanceReady');a.fire('instanceReady',null,n);},0);});n.on('destroy',function(){var o=this;if(o.mode)o._.modes[o.mode].unload(o.getThemeSpace('contents'));});}});a.editor.prototype.mode='';a.editor.prototype.addMode=function(n,o){o.name=n;(this._.modes||(this._.modes={}))[n]=o;};a.editor.prototype.setMode=function(n){this.fire('beforeSetMode',{newMode:n});var o,p=this.getThemeSpace('contents'),q=this.checkDirty();if(this.mode){if(n==this.mode)return;this._.previousMode=this.mode;this.fire('beforeModeUnload');var r=this.getMode();o=r.getData();r.unload(p);this.mode='';}p.setHtml('');var s=this.getMode(n);if(!s)throw '[CKEDITOR.editor.setMode] Unknown mode "'+n+'".';if(!q)this.on('mode',function(){this.resetDirty();this.removeListener('mode',arguments.callee);});s.load(p,typeof o!='string'?this.getData():o);};a.editor.prototype.getMode=function(n){return this._.modes&&this._.modes[n||this.mode];};a.editor.prototype.focus=function(){this.forceNextSelectionCheck();var n=this.getMode();if(n)n.focus();};})();i.startupMode='wysiwyg';i.editingBlock=true;(function(){function m(){var B=this;try{var y=B.getSelection();if(!y||!y.document.getWindow().$)return;var z=y.getStartElement(),A=new d.elementPath(z);if(!A.compare(B._.selectionPreviousPath)){B._.selectionPreviousPath=A;B.fire('selectionChange',{selection:y,path:A,element:z});}}catch(C){}};var n,o;function p(){o=true;if(n)return;q.call(this);n=e.setTimeout(q,200,this);};function q(){n=null;if(o){e.setTimeout(m,0,this);o=false;}};function r(y){function z(D){return D&&D.type==1&&D.getName() in f.$removeEmpty; -};function A(D){var E=y.document.getBody();return!D.is('body')&&E.getChildCount()==1;};var B=y.startContainer,C=y.startOffset;if(B.type==3)return false;return!e.trim(B.getHtml())?z(B)||A(B):z(B.getChild(C-1))||z(B.getChild(C));};var s={modes:{wysiwyg:1,source:1},readOnly:c||b.webkit,exec:function(y){switch(y.mode){case 'wysiwyg':y.document.$.execCommand('SelectAll',false,null);y.forceNextSelectionCheck();y.selectionChange();break;case 'source':var z=y.textarea.$;if(c)z.createTextRange().execCommand('SelectAll');else{z.selectionStart=0;z.selectionEnd=z.value.length;}z.focus();}},canUndo:false};function t(y){w(y);var z=y.createText('​');y.setCustomData('cke-fillingChar',z);return z;};function u(y){return y&&y.getCustomData('cke-fillingChar');};function v(y){var z=y&&u(y);if(z)if(z.getCustomData('ready'))w(y);else z.setCustomData('ready',1);};function w(y){var z=y&&y.removeCustomData('cke-fillingChar');if(z){z.setText(z.getText().replace(/\u200B/g,''));z=0;}};j.add('selection',{init:function(y){if(b.webkit){y.on('selectionChange',function(){v(y.document);});y.on('beforeSetMode',function(){w(y.document);});y.on('key',function(D){switch(D.data.keyCode){case 13:case 2228224+13:case 37:case 39:case 8:w(y.document);}},null,null,10);var z,A;function B(){var D=y.document,E=u(D);if(E){var F=D.$.defaultView.getSelection();if(F.type=='Caret'&&F.anchorNode==E.$)A=1;z=E.getText();E.setText(z.replace(/\u200B/g,''));}};function C(){var D=y.document,E=u(D);if(E){E.setText(z);if(A){D.$.defaultView.getSelection().setPosition(E.$,E.getLength());A=0;}}};y.on('beforeUndoImage',B);y.on('afterUndoImage',C);y.on('beforeGetData',B,null,null,0);y.on('getData',C);}y.on('contentDom',function(){var D=y.document,E=D.getBody(),F=D.getDocumentElement();if(c){var G,H,I=1;E.on('focusin',function(M){if(M.data.$.srcElement.nodeName!='BODY')return;if(G){if(I){try{G.select();}catch(O){}var N=D.getCustomData('cke_locked_selection');if(N){N.unlock();N.lock();}}G=null;}});E.on('focus',function(){H=1;L();});E.on('beforedeactivate',function(M){if(M.data.$.toElement)return;H=0;I=1;});if(c&&b.version<8)y.on('blur',function(M){try{y.document&&y.document.$.selection.empty();}catch(N){}});F.on('mousedown',function(){I=0;});F.on('mouseup',function(){I=1;});if(c&&(b.ie7Compat||b.version<8||b.quirks))F.on('click',function(M){if(M.data.getTarget().getName()=='html')y.getSelection().getRanges()[0].select();});var J;E.on('mousedown',function(M){if(M.data.$.button==2){var N=y.document.$.selection;if(N.type=='None')J=y.window.getScrollPosition(); -}K();});E.on('mouseup',function(M){if(M.data.$.button==2&&J){y.document.$.documentElement.scrollLeft=J.x;y.document.$.documentElement.scrollTop=J.y;}J=null;H=1;setTimeout(function(){L(true);},0);});E.on('keydown',K);E.on('keyup',function(){H=1;L();});D.on('selectionchange',L);function K(){H=0;};function L(M){if(H){var N=y.document,O=y.getSelection(),P=O&&O.getNative();if(M&&P&&P.type=='None')if(!N.$.queryCommandEnabled('InsertImage')){e.setTimeout(L,50,this,true);return;}var Q;if(P&&P.type&&P.type!='Control'&&(Q=P.createRange())&&(Q=Q.parentElement())&&(Q=Q.nodeName)&&Q.toLowerCase() in {input:1,textarea:1})return;G=P&&O.getRanges()[0];p.call(y);}};}else{D.on('mouseup',p,y);D.on('keyup',p,y);D.on('selectionchange',p,y);}});y.on('contentDomUnload',y.forceNextSelectionCheck,y);y.addCommand('selectAll',s);y.ui.addButton('SelectAll',{label:y.lang.selectAll,command:'selectAll'});y.selectionChange=p;b.ie9Compat&&y.on('destroy',function(){var D=y.getSelection();D&&D.getNative().clear();},null,null,9);}});a.editor.prototype.getSelection=function(){return this.document&&this.document.getSelection();};a.editor.prototype.forceNextSelectionCheck=function(){delete this._.selectionPreviousPath;};g.prototype.getSelection=function(){var y=new d.selection(this);return!y||y.isInvalid?null:y;};a.SELECTION_NONE=1;a.SELECTION_TEXT=2;a.SELECTION_ELEMENT=3;d.selection=function(y){var B=this;var z=y.getCustomData('cke_locked_selection');if(z)return z;B.document=y;B.isLocked=0;B._={cache:{}};if(c){var A=B.getNative().createRange();if(!A||A.item&&A.item(0).ownerDocument!=B.document.$||A.parentElement&&A.parentElement().ownerDocument!=B.document.$)B.isInvalid=true;}return B;};var x={img:1,hr:1,li:1,table:1,tr:1,td:1,th:1,embed:1,object:1,ol:1,ul:1,a:1,input:1,form:1,select:1,textarea:1,button:1,fieldset:1,thead:1,tfoot:1};d.selection.prototype={getNative:c?function(){return this._.cache.nativeSel||(this._.cache.nativeSel=this.document.$.selection);}:function(){return this._.cache.nativeSel||(this._.cache.nativeSel=this.document.getWindow().$.getSelection());},getType:c?function(){var y=this._.cache;if(y.type)return y.type;var z=1;try{var A=this.getNative(),B=A.type;if(B=='Text')z=2;if(B=='Control')z=3;if(A.createRange().parentElement)z=2;}catch(C){}return y.type=z;}:function(){var y=this._.cache;if(y.type)return y.type;var z=2,A=this.getNative();if(!A)z=1;else if(A.rangeCount==1){var B=A.getRangeAt(0),C=B.startContainer;if(C==B.endContainer&&C.nodeType==1&&B.endOffset-B.startOffset==1&&x[C.childNodes[B.startOffset].nodeName.toLowerCase()])z=3; -}return y.type=z;},getRanges:(function(){var y=c?(function(){function z(B){return new d.node(B).getIndex();};var A=function(B,C){B=B.duplicate();B.collapse(C);var D=B.parentElement(),E=D.ownerDocument;if(!D.hasChildNodes())return{container:D,offset:0};var F=D.children,G,H,I=B.duplicate(),J=0,K=F.length-1,L=-1,M,N;while(J<=K){L=Math.floor((J+K)/2);G=F[L];I.moveToElementText(G);M=I.compareEndPoints('StartToStart',B);if(M>0)K=L-1;else if(M<0)J=L+1;else if(b.ie9Compat&&G.tagName=='BR'){var O='cke_range_marker';B.execCommand('CreateBookmark',false,O);G=E.getElementsByName(O)[0];var P=z(G);D.removeChild(G);return{container:D,offset:P};}else return{container:D,offset:z(G)};}if(L==-1||L==F.length-1&&M<0){I.moveToElementText(D);I.setEndPoint('StartToStart',B);N=I.text.replace(/(\r\n|\r)/g,'\n').length;F=D.childNodes;if(!N){G=F[F.length-1];if(G.nodeType==1)return{container:D,offset:F.length};else return{container:G,offset:G.nodeValue.length};}var Q=F.length;while(N>0)N-=F[--Q].nodeValue.length;return{container:F[Q],offset:-N};}else{I.collapse(M>0?true:false);I.setEndPoint(M>0?'StartToStart':'EndToStart',B);N=I.text.replace(/(\r\n|\r)/g,'\n').length;if(!N)return{container:D,offset:z(G)+(M>0?0:1)};while(N>0)try{H=G[M>0?'previousSibling':'nextSibling'];N-=H.nodeValue.length;G=H;}catch(R){return{container:D,offset:z(G)};}return{container:G,offset:M>0?-N:G.nodeValue.length+N};}};return function(){var L=this;var B=L.getNative(),C=B&&B.createRange(),D=L.getType(),E;if(!B)return[];if(D==2){E=new d.range(L.document);var F=A(C,true);E.setStart(new d.node(F.container),F.offset);F=A(C);E.setEnd(new d.node(F.container),F.offset);if(E.endContainer.getPosition(E.startContainer)&4&&E.endOffset<=E.startContainer.getIndex())E.collapse();return[E];}else if(D==3){var G=[];for(var H=0;H=G.getLength())K.setStartAfter(G);else K.setStartBefore(G);if(H&&H.type==3)if(!J)K.setEndBefore(H);else K.setEndAfter(H);var L=new d.walker(K);L.evaluator=function(M){if(M.type==1&&M.isReadOnly()){var N=D.clone();D.setEndBefore(M);if(D.collapsed)B.splice(C--,1);if(!(M.getPosition(K.endContainer)&16)){N.setStartAfter(M);if(!N.collapsed)B.splice(C+1,0,N);}return true;}return false;};L.next();}}return A.ranges;};})(),getStartElement:function(){var F=this;var y=F._.cache;if(y.startElement!==undefined)return y.startElement;var z,A=F.getNative();switch(F.getType()){case 3:return F.getSelectedElement();case 2:var B=F.getRanges()[0];if(B){if(!B.collapsed){B.optimize();while(1){var C=B.startContainer,D=B.startOffset;if(D==(C.getChildCount?C.getChildCount():C.getLength())&&!C.isBlockBoundary())B.setStartAfter(C);else break;}z=B.startContainer;if(z.type!=1)return z.getParent();z=z.getChild(B.startOffset);if(!z||z.type!=1)z=B.startContainer;else{var E=z.getFirst();while(E&&E.type==1){z=E;E=E.getFirst();}}}else{z=B.startContainer;if(z.type!=1)z=z.getParent();}z=z.$;}}return y.startElement=z?new h(z):null;},getSelectedElement:function(){var y=this._.cache;if(y.selectedElement!==undefined)return y.selectedElement;var z=this,A=e.tryThese(function(){return z.getNative().createRange().item(0);},function(){var B,C,D=z.getRanges()[0],E=D.getCommonAncestor(1,1),F={table:1,ul:1,ol:1,dl:1};for(var G in F){if(B=E.getAscendant(G,1))break;}if(B){var H=new d.range(this.document);H.setStartAt(B,1);H.setEnd(D.startContainer,D.startOffset);var I=e.extend(F,f.$listItem,f.$tableContent),J=new d.walker(H),K=function(L,M){return function(N,O){if(N.type==3&&(!e.trim(N.getText())||N.getParent().data('cke-bookmark')))return true;var P;if(N.type==1){P=N.getName();if(P=='br'&&M&&N.equals(N.getParent().getBogus()))return true;if(O&&P in I||P in f.$removeEmpty)return true;}L.halted=1;return false;};};J.guard=K(J);if(J.checkBackward()&&!J.halted){J=new d.walker(H);H.setStart(D.endContainer,D.endOffset);H.setEndAt(B,2);J.guard=K(J,1);if(J.checkForward()&&!J.halted)C=B.$;}}if(!C)throw 0; -return C;},function(){var B=z.getRanges()[0],C,D;for(var E=2;E&&!((C=B.getEnclosedNode())&&C.type==1&&x[C.getName()]&&(D=C));E--)B.shrink(1);return D.$;});return y.selectedElement=A?new h(A):null;},getSelectedText:function(){var y=this._.cache;if(y.selectedText!==undefined)return y.selectedText;var z='',A=this.getNative();if(this.getType()==2)z=c?A.createRange().text:A.toString();return y.selectedText=z;},lock:function(){var y=this;y.getRanges();y.getStartElement();y.getSelectedElement();y.getSelectedText();y._.cache.nativeSel={};y.isLocked=1;y.document.setCustomData('cke_locked_selection',y);},unlock:function(y){var D=this;var z=D.document,A=z.getCustomData('cke_locked_selection');if(A){z.setCustomData('cke_locked_selection',null);if(y){var B=A.getSelectedElement(),C=!B&&A.getRanges();D.isLocked=0;D.reset();z.getBody().focus();if(B)D.selectElement(B);else D.selectRanges(C);}}if(!A||!y){D.isLocked=0;D.reset();}},reset:function(){this._.cache={};},selectElement:function(y){var A=this;if(A.isLocked){var z=new d.range(A.document);z.setStartBefore(y);z.setEndAfter(y);A._.cache.selectedElement=y;A._.cache.startElement=y;A._.cache.ranges=new d.rangeList(z);A._.cache.type=3;return;}z=new d.range(y.getDocument());z.setStartBefore(y);z.setEndAfter(y);z.select();A.document.fire('selectionchange');A.reset();},selectRanges:function(y){var M=this;if(M.isLocked){M._.cache.selectedElement=null;M._.cache.startElement=y[0]&&y[0].getTouchedStartNode();M._.cache.ranges=new d.rangeList(y);M._.cache.type=2;return;}if(c){if(y.length>1){var z=y[y.length-1];y[0].setEnd(z.endContainer,z.endOffset);y.length=1;}if(y[0])y[0].select();M.reset();}else{var A=M.getNative();if(!A)return;if(y.length){A.removeAllRanges();b.webkit&&w(M.document);}for(var B=0;B=0){H.collapse(1);I.setEnd(H.endContainer.$,H.endOffset);}else throw N;}A.addRange(I);}M.document.fire('selectionchange');M.reset();}},createBookmarks:function(y){return this.getRanges().createBookmarks(y);},createBookmarks2:function(y){return this.getRanges().createBookmarks2(y);},selectBookmarks:function(y){var z=[];for(var A=0;A','','',this.label,'','=10900&&!o.hc?'':" href=\"javascript:void('"+this.label+"')\"",' role="button" aria-labelledby="',p,'_label" aria-describedby="',p,'_text" aria-haspopup="true"');if(b.opera||b.gecko&&b.mac)n.push(' onkeypress="return false;"');if(b.gecko)n.push(' onblur="this.style.cssText = this.style.cssText;"');n.push(' onkeydown="CKEDITOR.tools.callFunction( ',t,', event, this );" onfocus="return CKEDITOR.tools.callFunction(',u,', event);" '+(c?'onclick="return false;" onmouseup':'onclick')+'="CKEDITOR.tools.callFunction(',q,', this); return false;">'+this.label+''+''+''+(b.hc?'▼':b.air?' ':'')+''+''+''+'');if(this.onRender)this.onRender();return r;},createPanel:function(m){if(this._.panel)return;var n=this._.panelDefinition,o=this._.panelDefinition.block,p=n.parent||a.document.getBody(),q=new k.floatPanel(m,p,n),r=q.addListBlock(this.id,o),s=this;q.onShow=function(){if(s.className)this.element.getFirst().addClass(s.className+'_panel');s.setState(1);r.focus(!s.multiSelect&&s.getValue());s._.on=1;if(s.onOpen)s.onOpen();};q.onHide=function(t){if(s.className)this.element.getFirst().removeClass(s.className+'_panel');s.setState(s.modes&&s.modes[m.mode]?2:0);s._.on=0;if(!t&&s.onClose)s.onClose();};q.onEscape=function(){q.hide();};r.onClick=function(t,u){s.document.getWindow().focus();if(s.onClick)s.onClick.call(s,t,u);if(u)s.setValue(t,s._.items[t]);else s.setValue(''); -q.hide(false);};this._.panel=q;this._.list=r;q.getBlock(this.id).onHide=function(){s._.on=0;s.setState(2);};if(this.init)this.init();},setValue:function(m,n){var p=this;p._.value=m;var o=p.document.getById('cke_'+p.id+'_text');if(o){if(!(m||n)){n=p.label;o.addClass('cke_inline_label');}else o.removeClass('cke_inline_label');o.setHtml(typeof n!='undefined'?n:m);}},getValue:function(){return this._.value||'';},unmarkAll:function(){this._.list.unmarkAll();},mark:function(m){this._.list.mark(m);},hideItem:function(m){this._.list.hideItem(m);},hideGroup:function(m){this._.list.hideGroup(m);},showAll:function(){this._.list.showAll();},add:function(m,n,o){this._.items[m]=o||m;this._.list.add(m,n,o);},startGroup:function(m){this._.list.startGroup(m);},commit:function(){var m=this;if(!m._.committed){m._.list.commit();m._.committed=1;k.fire('ready',m);}m._.committed=1;},setState:function(m){var n=this;if(n._.state==m)return;n.document.getById('cke_'+n.id).setState(m);n._.state=m;}}});k.prototype.addRichCombo=function(m,n){this.add(m,'richcombo',n);};j.add('htmlwriter');a.htmlWriter=e.createClass({base:a.htmlParser.basicWriter,$:function(){var o=this;o.base();o.indentationChars='\t';o.selfClosingEnd=' />';o.lineBreakChars='\n';o.forceSimpleAmpersand=0;o.sortAttributes=1;o._.indent=0;o._.indentation='';o._.inPre=0;o._.rules={};var m=f;for(var n in e.extend({},m.$nonBodyContent,m.$block,m.$listItem,m.$tableContent))o.setRules(n,{indent:1,breakBeforeOpen:1,breakAfterOpen:1,breakBeforeClose:!m[n]['#'],breakAfterClose:1});o.setRules('br',{breakAfterOpen:1});o.setRules('title',{indent:0,breakAfterOpen:0});o.setRules('style',{indent:0,breakBeforeClose:1});o.setRules('pre',{indent:0});},proto:{openTag:function(m,n){var p=this;var o=p._.rules[m];if(p._.indent)p.indentation();else if(o&&o.breakBeforeOpen){p.lineBreak();p.indentation();}p._.output.push('<',m);},openTagClose:function(m,n){var p=this;var o=p._.rules[m];if(n)p._.output.push(p.selfClosingEnd);else{p._.output.push('>');if(o&&o.indent)p._.indentation+=p.indentationChars;}if(o&&o.breakAfterOpen)p.lineBreak();m=='pre'&&(p._.inPre=1);},attribute:function(m,n){if(typeof n=='string'){this.forceSimpleAmpersand&&(n=n.replace(/&/g,'&'));n=e.htmlEncodeAttr(n);}this._.output.push(' ',m,'="',n,'"');},closeTag:function(m){var o=this;var n=o._.rules[m];if(n&&n.indent)o._.indentation=o._.indentation.substr(o.indentationChars.length);if(o._.indent)o.indentation();else if(n&&n.breakBeforeClose){o.lineBreak();o.indentation();}o._.output.push(''); -m=='pre'&&(o._.inPre=0);if(n&&n.breakAfterClose)o.lineBreak();},text:function(m){var n=this;if(n._.indent){n.indentation();!n._.inPre&&(m=e.ltrim(m));}n._.output.push(m);},comment:function(m){if(this._.indent)this.indentation();this._.output.push('');},lineBreak:function(){var m=this;if(!m._.inPre&&m._.output.length>0)m._.output.push(m.lineBreakChars);m._.indent=1;},indentation:function(){var m=this;if(!m._.inPre)m._.output.push(m._.indentation);m._.indent=0;},setRules:function(m,n){var o=this._.rules[m];if(o)e.extend(o,n,true);else this._.rules[m]=n;}}});j.add('menubutton',{requires:['button','menu'],beforeInit:function(m){m.ui.addHandler('menubutton',k.menuButton.handler);}});a.UI_MENUBUTTON='menubutton';(function(){var m=function(n){var o=this._;if(o.state===0)return;o.previousState=o.state;var p=o.menu;if(!p){p=o.menu=new a.menu(n,{panel:{className:n.skinClass+' cke_contextmenu',attributes:{'aria-label':n.lang.common.options}}});p.onHide=e.bind(function(){this.setState(this.modes&&this.modes[n.mode]?o.previousState:0);},this);if(this.onMenu)p.addListener(this.onMenu);}if(o.on){p.hide();return;}this.setState(1);p.show(a.document.getById(this._.id),4);};k.menuButton=e.createClass({base:k.button,$:function(n){var o=n.panel;delete n.panel;this.base(n);this.hasArrow=true;this.click=m;},statics:{handler:{create:function(n){return new k.menuButton(n);}}}});})();j.add('dialogui');(function(){var m=function(u){var x=this;x._||(x._={});x._['default']=x._.initValue=u['default']||'';x._.required=u.required||false;var v=[x._];for(var w=1;w',v.label,'','');else{var D={type:'hbox',widths:v.widths,padding:0,children:[{type:'html',html:'
    ';else T.setHtml(V);U.remove();};function B(T){var U=/(\S\s*)\n(?:\s|(]+data-cke-bookmark.*?\/span>))*\n(?!$)/gi,V=T.getName(),W=C(T.getOuterHtml(),U,function(Y,Z,aa){return Z+''+aa+'
    ';}),X=[];W.replace(/([\s\S]*?)<\/pre>/gi,function(Y,Z){X.push(Z);});return X;};function C(T,U,V){var W='',X='';T=T.replace(/(^]+data-cke-bookmark.*?\/span>)|(]+data-cke-bookmark.*?\/span>$)/gi,function(Y,Z,aa){Z&&(W=Z);aa&&(X=aa);return '';});return W+T.replace(U,V)+X;};function D(T,U){var V;if(T.length>1)V=new d.documentFragment(U.getDocument());for(var W=0;W');X=X.replace(/[ \t]{2,}/g,function(Z){return e.repeat(' ',Z.length-1)+' ';});if(V){var Y=U.clone();Y.setHtml(X);V.append(Y);}else U.setHtml(X);}return V||U;};function E(T,U){var V=T.getBogus();V&&V.remove();var W=T.getHtml();W=C(W,/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g,'');W=W.replace(/[ \t\r\n]*(]*>)[ \t\r\n]*/gi,'$1');W=W.replace(/([ \t\n\r]+| )/g,' ');W=W.replace(/]*>/gi,'\n');if(c){var X=T.getDocument().createElement('div');X.append(U);U.$.outerHTML='
    '+W+'
    ';U.copyAttributes(X.getFirst());U=X.getFirst().remove();}else U.setHtml(W);return U;};function F(T,U){var V=T._.definition,W=V.attributes,X=V.styles,Y=N(T)[U.getName()],Z=e.isEmpty(W)&&e.isEmpty(X);for(var aa in W){if((aa=='class'||T._.definition.fullMatch)&&U.getAttribute(aa)!=O(aa,W[aa]))continue;Z=U.hasAttribute(aa);U.removeAttribute(aa);}for(var ab in X){if(T._.definition.fullMatch&&U.getStyle(ab)!=O(ab,X[ab],true))continue;Z=Z||!!U.getStyle(ab);U.removeStyle(ab);}H(U,Y,m[U.getName()]);if(Z)!f.$block[U.getName()]||T._.enterMode==2&&!U.hasAttributes()?I(U):U.renameNode(T._.enterMode==1?'p':'div');};function G(T,U){var V=T._.definition,W=V.attributes,X=V.styles,Y=N(T),Z=U.getElementsByTag(T.element);for(var aa=Z.count();--aa>=0;)F(T,Z.getItem(aa));for(var ab in Y){if(ab!=T.element){Z=U.getElementsByTag(ab);for(aa=Z.count()-1;aa>=0;aa--){var ac=Z.getItem(aa);H(ac,Y[ab]);}}}};function H(T,U,V){var W=U&&U.attributes; +if(W)for(var X=0;X0)H+=(F.$.offsetWidth||0)-(F.$.clientWidth||0)+3;H+=4;F.setStyle('width',H+'px');v.element.addClass('cke_frameLoaded');var I=v.element.$.scrollHeight;if(c&&b.quirks&&I>0)I+=(F.$.offsetHeight||0)-(F.$.clientHeight||0)+3;F.setStyle('height',I+'px');u._.currentBlock.element.setStyle('display','none').removeStyle('display');}else F.removeStyle('height');if(A)B-=w.$.offsetWidth;w.setStyle('left',B+'px');var J=u.element,K=J.getWindow(),L=w.$.getBoundingClientRect(),M=K.getViewPaneSize(),N=L.width||L.right-L.left,O=L.height||L.bottom-L.top,P=A?L.right:M.width-L.left,Q=A?M.width-L.right:L.left;if(A){if(PN)B+=N;else if(M.width>N)B-=L.left;else B=B-L.right+M.width;}else if(PN)B-=N;else if(M.width>N)B=B-L.right+M.width;else B-=L.left;var R=M.height-L.top,S=L.top;if(RO)C-=O;else if(M.height>O)C=C-L.bottom+M.height;else C-=L.top;if(c){var T=new h(w.$.offsetParent),U=T;if(U.getName()=='html')U=U.getDocument().getBody();if(U.getComputedStyle('direction')=='rtl')if(b.ie8Compat)B-=w.getDocument().getDocumentElement().$.scrollLeft*2;else B-=T.$.scrollWidth-T.$.clientWidth;}var V=w.getFirst(),W;if(W=V.getCustomData('activePanel'))W.onHide&&W.onHide.call(this,1);V.setCustomData('activePanel',this);w.setStyles({top:C+'px',left:B+'px'});w.setOpacity(1);},this);u.isLoaded?E():u.onLoad=E;e.setTimeout(function(){x.$.contentWindow.focus();this.allowBlur(true);},0,this);},b.air?200:0,this);this.visible=1;if(this.onShow)this.onShow.call(this);n=0;},hide:function(p){var r=this;if(r.visible&&(!r.onHide||r.onHide.call(r)!==true)){r.hideChild();b.gecko&&r._.iframe.getFrameDocument().$.activeElement.blur();r.element.setStyle('display','none');r.visible=0;r.element.getFirst().removeCustomData('activePanel');var q=p!==false&&r._.returnFocus;if(q){if(b.webkit&&q.type)q.getWindow().$.focus();q.focus();}}},allowBlur:function(p){var q=this._.panel;if(p!=undefined)q.allowBlur=p;return q.allowBlur;},showAsChild:function(p,q,r,s,t,u){if(this._.activeChild==p&&p._.panel._.offsetParentId==r.getId())return;this.hideChild();p.onHide=e.bind(function(){e.setTimeout(function(){if(!this._.focused)this.hide(); +},0,this);},this);this._.activeChild=p;this._.focused=false;p.showBlock(q,r,s,t,u);if(b.ie7Compat||b.ie8&&b.ie6Compat)setTimeout(function(){p.element.getChild(0).$.style.cssText+='';},100);},hideChild:function(){var p=this._.activeChild;if(p){delete p.onHide;delete p._.returnFocus;delete this._.activeChild;p.hide();}}}});a.on('instanceDestroyed',function(){var p=e.isEmpty(a.instances);for(var q in m){var r=m[q];if(p)r.destroy();else r.element.hide();}p&&(m={});});})();j.add('menu',{beforeInit:function(m){var n=m.config.menu_groups.split(','),o=m._.menuGroups={},p=m._.menuItems={};for(var q=0;q'],B=r.length,C=B&&r[0].group;for(var D=0;D');C=E.group;}E.render(this,D,A);}A.push('');u.setHtml(A.join(''));k.fire('ready',this);if(this.parent)this.parent._.panel.showAsChild(t,this.id,n,o,p,q);else t.showBlock(this.id,n,o,p,q);s.fire('menuShow',[t]);},addListener:function(n){this._.listeners.push(n);},hide:function(n){var o=this;o._.onHide&&o._.onHide();o._.panel&&o._.panel.hide(n);}}});function m(n){n.sort(function(o,p){if(o.groupp.group)return 1;return o.orderp.order?1:0;});};a.menuItem=e.createClass({$:function(n,o,p){var q=this;e.extend(q,p,{order:0,className:'cke_button_'+o});q.group=n._.menuGroups[q.group];q.editor=n;q.name=o;},proto:{render:function(n,o,p){var w=this;var q=n.id+String(o),r=typeof w.state=='undefined'?2:w.state,s=' cke_'+(r==1?'on':r==0?'disabled':'off'),t=w.label;if(w.className)s+=' '+w.className; +var u=w.getItems;p.push(''+''+'');if(u)p.push('','&#',w.editor.lang.dir=='rtl'?'9668':'9658',';','');p.push(t,'');}}});})();i.menu_groups='clipboard,form,tablecell,tablecellproperties,tablerow,tablecolumn,table,anchor,link,image,flash,checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea,div';(function(){var m;j.add('editingblock',{init:function(n){if(!n.config.editingBlock)return;n.on('themeSpace',function(o){if(o.data.space=='contents')o.data.html+='
    ';});n.on('themeLoaded',function(){n.fireOnce('editingBlockReady');});n.on('uiReady',function(){n.setMode(n.config.startupMode);});n.on('afterSetData',function(){if(!m){function o(){m=true;n.getMode().loadData(n.getData());m=false;};if(n.mode)o();else n.on('mode',function(){if(n.mode){o();n.removeListener('mode',arguments.callee);}});}});n.on('beforeGetData',function(){if(!m&&n.mode){m=true;n.setData(n.getMode().getData(),null,1);m=false;}});n.on('getSnapshot',function(o){if(n.mode)o.data=n.getMode().getSnapshotData();});n.on('loadSnapshot',function(o){if(n.mode)n.getMode().loadSnapshotData(o.data);});n.on('mode',function(o){o.removeListener();b.webkit&&n.container.on('focus',function(){n.focus();});if(n.config.startupFocus)n.focus();setTimeout(function(){n.fireOnce('instanceReady');a.fire('instanceReady',null,n);},0);});n.on('destroy',function(){var o=this;if(o.mode)o._.modes[o.mode].unload(o.getThemeSpace('contents'));});}});a.editor.prototype.mode='';a.editor.prototype.addMode=function(n,o){o.name=n; +(this._.modes||(this._.modes={}))[n]=o;};a.editor.prototype.setMode=function(n){this.fire('beforeSetMode',{newMode:n});var o,p=this.getThemeSpace('contents'),q=this.checkDirty();if(this.mode){if(n==this.mode)return;this._.previousMode=this.mode;this.fire('beforeModeUnload');var r=this.getMode();o=r.getData();r.unload(p);this.mode='';}p.setHtml('');var s=this.getMode(n);if(!s)throw '[CKEDITOR.editor.setMode] Unknown mode "'+n+'".';if(!q)this.on('mode',function(){this.resetDirty();this.removeListener('mode',arguments.callee);});s.load(p,typeof o!='string'?this.getData():o);};a.editor.prototype.getMode=function(n){return this._.modes&&this._.modes[n||this.mode];};a.editor.prototype.focus=function(){this.forceNextSelectionCheck();var n=this.getMode();if(n)n.focus();};})();i.startupMode='wysiwyg';i.editingBlock=true;(function(){function m(){var C=this;try{var z=C.getSelection();if(!z||!z.document.getWindow().$)return;var A=z.getStartElement(),B=new d.elementPath(A);if(!B.compare(C._.selectionPreviousPath)){C._.selectionPreviousPath=B;C.fire('selectionChange',{selection:z,path:B,element:A});}}catch(D){}};var n,o;function p(){o=true;if(n)return;q.call(this);n=e.setTimeout(q,200,this);};function q(){n=null;if(o){e.setTimeout(m,0,this);o=false;}};function r(z){function A(E){return E&&E.type==1&&E.getName() in f.$removeEmpty;};function B(E){var F=z.document.getBody();return!E.is('body')&&F.getChildCount()==1;};var C=z.startContainer,D=z.startOffset;if(C.type==3)return false;return!e.trim(C.getHtml())?A(C)||B(C):A(C.getChild(D-1))||A(C.getChild(D));};var s={modes:{wysiwyg:1,source:1},readOnly:c||b.webkit,exec:function(z){switch(z.mode){case 'wysiwyg':z.document.$.execCommand('SelectAll',false,null);z.forceNextSelectionCheck();z.selectionChange();break;case 'source':var A=z.textarea.$;if(c)A.createTextRange().execCommand('SelectAll');else{A.selectionStart=0;A.selectionEnd=A.value.length;}A.focus();}},canUndo:false};function t(z){w(z);var A=z.createText('​');z.setCustomData('cke-fillingChar',A);return A;};function u(z){return z&&z.getCustomData('cke-fillingChar');};function v(z){var A=z&&u(z);if(A)if(A.getCustomData('ready'))w(z);else A.setCustomData('ready',1);};function w(z){var A=z&&z.removeCustomData('cke-fillingChar');if(A){var B,C=z.getSelection().getNative(),D=C&&C.type!='None'&&C.getRangeAt(0);if(A.getLength()>1&&D&&D.intersectsNode(A.$)){B=[C.anchorOffset,C.focusOffset];var E=C.anchorNode==A.$&&C.anchorOffset>0,F=C.focusNode==A.$&&C.focusOffset>0;E&&B[0]--;F&&B[1]--; +x(C)&&B.unshift(B.pop());}A.setText(A.getText().replace(/\u200B/g,''));if(B){var G=C.getRangeAt(0);G.setStart(G.startContainer,B[0]);G.setEnd(G.startContainer,B[1]);C.removeAllRanges();C.addRange(G);}}};function x(z){if(!z.isCollapsed){var A=z.getRangeAt(0);A.setStart(z.anchorNode,z.anchorOffset);A.setEnd(z.focusNode,z.focusOffset);return A.collapsed;}};j.add('selection',{init:function(z){if(b.webkit){z.on('selectionChange',function(){v(z.document);});z.on('beforeSetMode',function(){w(z.document);});var A,B;function C(){var E=z.document,F=u(E);if(F){var G=E.$.defaultView.getSelection();if(G.type=='Caret'&&G.anchorNode==F.$)B=1;A=F.getText();F.setText(A.replace(/\u200B/g,''));}};function D(){var E=z.document,F=u(E);if(F){F.setText(A);if(B){E.$.defaultView.getSelection().setPosition(F.$,F.getLength());B=0;}}};z.on('beforeUndoImage',C);z.on('afterUndoImage',D);z.on('beforeGetData',C,null,null,0);z.on('getData',D);}z.on('contentDom',function(){var E=z.document,F=E.getBody(),G=E.getDocumentElement();if(c){var H,I,J=1;F.on('focusin',function(O){if(O.data.$.srcElement.nodeName!='BODY')return;var P=E.getCustomData('cke_locked_selection');if(P){P.unlock(1);P.lock();}else if(H&&J){try{H.select();}catch(Q){}H=null;}});F.on('focus',function(){I=1;N();});F.on('beforedeactivate',function(O){if(O.data.$.toElement)return;I=0;J=1;});c&&z.on('blur',function(){try{E.$.selection.empty();}catch(O){}});G.on('mousedown',function(){J=0;});G.on('mouseup',function(){J=1;});var K;F.on('mousedown',function(O){if(O.data.$.button==2){var P=z.document.$.selection;if(P.type=='None')K=z.window.getScrollPosition();}M();});F.on('mouseup',function(O){if(O.data.$.button==2&&K){z.document.$.documentElement.scrollLeft=K.x;z.document.$.documentElement.scrollTop=K.y;}K=null;I=1;setTimeout(function(){N(true);},0);});F.on('keydown',M);F.on('keyup',function(){I=1;N();});if((b.ie7Compat||b.ie6Compat)&&E.$.compatMode!='BackCompat'){function L(O,P,Q){try{O.moveToPoint(P,Q);}catch(R){}};G.on('mousedown',function(O){function P(R){R=R.data.$;if(Q){var S=F.$.createTextRange();L(S,R.x,R.y);Q.setEndPoint(Q.compareEndPoints('StartToStart',S)<0?'EndToEnd':'StartToStart',S);Q.select();}};O=O.data.$;if(O.yF.$.offsetTop+F.$.clientHeight&&O.x0)L=M-1;else if(N<0)K=M+1;else if(b.ie9Compat&&H.tagName=='BR'){var Q=F.defaultView.getSelection();return{container:Q[D?'anchorNode':'focusNode'],offset:Q[D?'anchorOffset':'focusOffset']};}else return{container:E,offset:A(H)};}if(M==-1||M==G.length-1&&N<0){J.moveToElementText(E);J.setEndPoint('StartToStart',C);O=J.text.replace(/(\r\n|\r)/g,'\n').length;G=E.childNodes;if(!O){H=G[G.length-1];if(H.nodeType!=3)return{container:E,offset:G.length};else return{container:H,offset:H.nodeValue.length};}var R=G.length;while(O>0&&R>0){I=G[--R];if(I.nodeType==3){P=I;O-=I.nodeValue.length;}}return{container:P,offset:-O};}else{J.collapse(N>0?true:false);J.setEndPoint(N>0?'StartToStart':'EndToStart',C);O=J.text.replace(/(\r\n|\r)/g,'\n').length;if(!O)return{container:E,offset:A(H)+(N>0?0:1)};while(O>0)try{I=H[N>0?'previousSibling':'nextSibling'];if(I.nodeType==3){O-=I.nodeValue.length;P=I;}H=I;}catch(S){return{container:E,offset:A(H)};}return{container:P,offset:N>0?-O:P.nodeValue.length+O};}};return function(){var M=this;var C=M.getNative(),D=C&&C.createRange(),E=M.getType(),F;if(!C)return[];if(E==2){F=new d.range(M.document);var G=B(D,true);F.setStart(new d.node(G.container),G.offset);G=B(D);F.setEnd(new d.node(G.container),G.offset);if(F.endContainer.getPosition(F.startContainer)&4&&F.endOffset<=F.startContainer.getIndex())F.collapse();return[F];}else if(E==3){var H=[];for(var I=0;I=H.getLength())L.setStartAfter(H);else L.setStartBefore(H);if(I&&I.type==3)if(!K)L.setEndBefore(I);else L.setEndAfter(I);var M=new d.walker(L);M.evaluator=function(N){if(N.type==1&&N.isReadOnly()){var O=E.clone();E.setEndBefore(N);if(E.collapsed)C.splice(D--,1);if(!(N.getPosition(L.endContainer)&16)){O.setStartAfter(N);if(!O.collapsed)C.splice(D+1,0,O);}return true;}return false;};M.next();}}return B.ranges;};})(),getStartElement:function(){var G=this;var z=G._.cache;if(z.startElement!==undefined)return z.startElement;var A,B=G.getNative();switch(G.getType()){case 3:return G.getSelectedElement();case 2:var C=G.getRanges()[0];if(C){if(!C.collapsed){C.optimize();while(1){var D=C.startContainer,E=C.startOffset;if(E==(D.getChildCount?D.getChildCount():D.getLength())&&!D.isBlockBoundary())C.setStartAfter(D);else break;}A=C.startContainer;if(A.type!=1)return A.getParent();A=A.getChild(C.startOffset);if(!A||A.type!=1)A=C.startContainer;else{var F=A.getFirst();while(F&&F.type==1){A=F;F=F.getFirst();}}}else{A=C.startContainer;if(A.type!=1)A=A.getParent();}A=A.$;}}return z.startElement=A?new h(A):null;},getSelectedElement:function(){var z=this._.cache;if(z.selectedElement!==undefined)return z.selectedElement;var A=this,B=e.tryThese(function(){return A.getNative().createRange().item(0);},function(){var C,D,E=A.getRanges()[0],F=E.getCommonAncestor(1,1),G={table:1,ul:1,ol:1,dl:1};for(var H in G){if(C=F.getAscendant(H,1))break;}if(C){var I=new d.range(this.document);I.setStartAt(C,1);I.setEnd(E.startContainer,E.startOffset);var J=e.extend(G,f.$listItem,f.$tableContent),K=new d.walker(I),L=function(M,N){return function(O,P){if(O.type==3&&(!e.trim(O.getText())||O.getParent().data('cke-bookmark')))return true;var Q;if(O.type==1){Q=O.getName();if(Q=='br'&&N&&O.equals(O.getParent().getBogus()))return true;if(P&&Q in J||Q in f.$removeEmpty)return true;}M.halted=1;return false;};};K.guard=L(K);if(K.checkBackward()&&!K.halted){K=new d.walker(I);I.setStart(E.endContainer,E.endOffset);I.setEndAt(C,2);K.guard=L(K,1);if(K.checkForward()&&!K.halted)D=C.$; +}}if(!D)throw 0;return D;},function(){var C=A.getRanges()[0],D,E;for(var F=2;F&&!((D=C.getEnclosedNode())&&D.type==1&&y[D.getName()]&&(E=D));F--)C.shrink(1);return E.$;});return z.selectedElement=B?new h(B):null;},getSelectedText:function(){var z=this._.cache;if(z.selectedText!==undefined)return z.selectedText;var A='',B=this.getNative();if(this.getType()==2)A=c?B.createRange().text:B.toString();return z.selectedText=A;},lock:function(){var z=this;z.getRanges();z.getStartElement();z.getSelectedElement();z.getSelectedText();z._.cache.nativeSel={};z.isLocked=1;z.document.setCustomData('cke_locked_selection',z);},unlock:function(z){var E=this;var A=E.document,B=A.getCustomData('cke_locked_selection');if(B){A.setCustomData('cke_locked_selection',null);if(z){var C=B.getSelectedElement(),D=!C&&B.getRanges();E.isLocked=0;E.reset();if(C)E.selectElement(C);else E.selectRanges(D);}}if(!B||!z){E.isLocked=0;E.reset();}},reset:function(){this._.cache={};},selectElement:function(z){var B=this;if(B.isLocked){var A=new d.range(B.document);A.setStartBefore(z);A.setEndAfter(z);B._.cache.selectedElement=z;B._.cache.startElement=z;B._.cache.ranges=new d.rangeList(A);B._.cache.type=3;return;}A=new d.range(z.getDocument());A.setStartBefore(z);A.setEndAfter(z);A.select();B.document.fire('selectionchange');B.reset();},selectRanges:function(z){var N=this;if(N.isLocked){N._.cache.selectedElement=null;N._.cache.startElement=z[0]&&z[0].getTouchedStartNode();N._.cache.ranges=new d.rangeList(z);N._.cache.type=2;return;}if(c){if(z.length>1){var A=z[z.length-1];z[0].setEnd(A.endContainer,A.endOffset);z.length=1;}if(z[0])z[0].select();N.reset();}else{var B=N.getNative();if(!B)return;if(z.length){B.removeAllRanges();b.webkit&&w(N.document);}for(var C=0;C=0){I.collapse(1);J.setEnd(I.endContainer.$,I.endOffset);}else throw O;}B.addRange(J);}N.document.fire('selectionchange');N.reset();}},createBookmarks:function(z){return this.getRanges().createBookmarks(z);},createBookmarks2:function(z){return this.getRanges().createBookmarks2(z);},selectBookmarks:function(z){var A=[];for(var B=0;B','','',this.label,'','=10900&&!o.hc?'':" href=\"javascript:void('"+this.label+"')\"",' role="button" aria-labelledby="',p,'_label" aria-describedby="',p,'_text" aria-haspopup="true"');if(b.opera||b.gecko&&b.mac)n.push(' onkeypress="return false;"');if(b.gecko)n.push(' onblur="this.style.cssText = this.style.cssText;"');n.push(' onkeydown="CKEDITOR.tools.callFunction( ',t,', event, this );" onfocus="return CKEDITOR.tools.callFunction(',u,', event);" '+(c?'onclick="return false;" onmouseup':'onclick')+'="CKEDITOR.tools.callFunction(',q,', this); return false;">'+this.label+''+''+''+(b.hc?'▼':b.air?' ':'')+''+''+''+'');if(this.onRender)this.onRender();return r;},createPanel:function(m){if(this._.panel)return;var n=this._.panelDefinition,o=this._.panelDefinition.block,p=n.parent||a.document.getBody(),q=new k.floatPanel(m,p,n),r=q.addListBlock(this.id,o),s=this;q.onShow=function(){if(s.className)this.element.getFirst().addClass(s.className+'_panel');s.setState(1);r.focus(!s.multiSelect&&s.getValue());s._.on=1;if(s.onOpen)s.onOpen();};q.onHide=function(t){if(s.className)this.element.getFirst().removeClass(s.className+'_panel');s.setState(s.modes&&s.modes[m.mode]?2:0);s._.on=0;if(!t&&s.onClose)s.onClose();};q.onEscape=function(){q.hide();};r.onClick=function(t,u){s.document.getWindow().focus();if(s.onClick)s.onClick.call(s,t,u);if(u)s.setValue(t,s._.items[t]); +else s.setValue('');q.hide(false);};this._.panel=q;this._.list=r;q.getBlock(this.id).onHide=function(){s._.on=0;s.setState(2);};if(this.init)this.init();},setValue:function(m,n){var p=this;p._.value=m;var o=p.document.getById('cke_'+p.id+'_text');if(o){if(!(m||n)){n=p.label;o.addClass('cke_inline_label');}else o.removeClass('cke_inline_label');o.setHtml(typeof n!='undefined'?n:m);}},getValue:function(){return this._.value||'';},unmarkAll:function(){this._.list.unmarkAll();},mark:function(m){this._.list.mark(m);},hideItem:function(m){this._.list.hideItem(m);},hideGroup:function(m){this._.list.hideGroup(m);},showAll:function(){this._.list.showAll();},add:function(m,n,o){this._.items[m]=o||m;this._.list.add(m,n,o);},startGroup:function(m){this._.list.startGroup(m);},commit:function(){var m=this;if(!m._.committed){m._.list.commit();m._.committed=1;k.fire('ready',m);}m._.committed=1;},setState:function(m){var n=this;if(n._.state==m)return;n.document.getById('cke_'+n.id).setState(m);n._.state=m;}}});k.prototype.addRichCombo=function(m,n){this.add(m,'richcombo',n);};j.add('htmlwriter');a.htmlWriter=e.createClass({base:a.htmlParser.basicWriter,$:function(){var o=this;o.base();o.indentationChars='\t';o.selfClosingEnd=' />';o.lineBreakChars='\n';o.forceSimpleAmpersand=0;o.sortAttributes=1;o._.indent=0;o._.indentation='';o._.inPre=0;o._.rules={};var m=f;for(var n in e.extend({},m.$nonBodyContent,m.$block,m.$listItem,m.$tableContent))o.setRules(n,{indent:1,breakBeforeOpen:1,breakAfterOpen:1,breakBeforeClose:!m[n]['#'],breakAfterClose:1});o.setRules('br',{breakAfterOpen:1});o.setRules('title',{indent:0,breakAfterOpen:0});o.setRules('style',{indent:0,breakBeforeClose:1});o.setRules('pre',{indent:0});},proto:{openTag:function(m,n){var p=this;var o=p._.rules[m];if(p._.indent)p.indentation();else if(o&&o.breakBeforeOpen){p.lineBreak();p.indentation();}p._.output.push('<',m);},openTagClose:function(m,n){var p=this;var o=p._.rules[m];if(n)p._.output.push(p.selfClosingEnd);else{p._.output.push('>');if(o&&o.indent)p._.indentation+=p.indentationChars;}if(o&&o.breakAfterOpen)p.lineBreak();m=='pre'&&(p._.inPre=1);},attribute:function(m,n){if(typeof n=='string'){this.forceSimpleAmpersand&&(n=n.replace(/&/g,'&'));n=e.htmlEncodeAttr(n);}this._.output.push(' ',m,'="',n,'"');},closeTag:function(m){var o=this;var n=o._.rules[m];if(n&&n.indent)o._.indentation=o._.indentation.substr(o.indentationChars.length);if(o._.indent)o.indentation();else if(n&&n.breakBeforeClose){o.lineBreak();o.indentation(); +}o._.output.push('');m=='pre'&&(o._.inPre=0);if(n&&n.breakAfterClose)o.lineBreak();},text:function(m){var n=this;if(n._.indent){n.indentation();!n._.inPre&&(m=e.ltrim(m));}n._.output.push(m);},comment:function(m){if(this._.indent)this.indentation();this._.output.push('');},lineBreak:function(){var m=this;if(!m._.inPre&&m._.output.length>0)m._.output.push(m.lineBreakChars);m._.indent=1;},indentation:function(){var m=this;if(!m._.inPre)m._.output.push(m._.indentation);m._.indent=0;},setRules:function(m,n){var o=this._.rules[m];if(o)e.extend(o,n,true);else this._.rules[m]=n;}}});j.add('menubutton',{requires:['button','menu'],beforeInit:function(m){m.ui.addHandler('menubutton',k.menuButton.handler);}});a.UI_MENUBUTTON='menubutton';(function(){var m=function(n){var o=this._;if(o.state===0)return;o.previousState=o.state;var p=o.menu;if(!p){p=o.menu=new a.menu(n,{panel:{className:n.skinClass+' cke_contextmenu',attributes:{'aria-label':n.lang.common.options}}});p.onHide=e.bind(function(){this.setState(this.modes&&this.modes[n.mode]?o.previousState:0);},this);if(this.onMenu)p.addListener(this.onMenu);}if(o.on){p.hide();return;}this.setState(1);p.show(a.document.getById(this._.id),4);};k.menuButton=e.createClass({base:k.button,$:function(n){var o=n.panel;delete n.panel;this.base(n);this.hasArrow=true;this.click=m;},statics:{handler:{create:function(n){return new k.menuButton(n);}}}});})();j.add('dialogui');(function(){var m=function(u){var x=this;x._||(x._={});x._['default']=x._.initValue=u['default']||'';x._.required=u.required||false;var v=[x._];for(var w=1;w',v.label,'','');else{var D={type:'hbox',widths:v.widths,padding:0,children:[{type:'html',html:'