diff --git a/.gitattributes b/.gitattributes index 21256661..201aadbe 100755 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ -* text=auto \ No newline at end of file +* text=auto +CHANGELOG.md merge=union diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b6c7e82..6968e967 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ## 2.5 Evolutions : +* Ajout de la synchronisation du calendrier Prévarisc +* Ajout du système d'alerte lors de la modification d'un établissement * Ajout de la prise en charge du cache filesystem * Ajout des champs de fusion du maire dans la génération de documents * Ajout de la périodicité calculée pour les sites @@ -16,6 +18,7 @@ Evolutions : * Ajout de la possibilité d'ajouter rapidement une couche WMS IGN * Standardisation du viewer cartographique cote backoffice * Ajout de la balise de {avisDossierCommission} pour les PV de maires +* Ajout de la balise {familleEtab} Corrections : * Corrections sur l'enregistrement des prescriptions types : NUM_PRESCRIPTION_DOSSIER cannot be null @@ -29,13 +32,23 @@ Corrections : * Correction du modèle de convocation des groupes de visites qui n'utilisaient pas le modèle de document de visite * Correction de l'affectation d'un dossier à une autre commission, les heures de début et de fin restaient en place ce qui pouvait causer des problèmes lorsque les horaires différaient * Correction de la {dateVisite} sur les ODJ qui était positionnée à la date du jour par défaut si vide +* Correction de l'unité en mètres sur la mesure de distance cartographiques * Correction du non vidage de cache ets sur la partie contact (cf dus) * Correction de l'impossibilité de programmer un dossier de visite sur plusieurs journées * Correction de la balise {avisLastVP} qui disfonctionne ainsi que le calcul de la dernière VP -* Correction de l'unité en mètres sur la mesure de distance cartographiques * Correction de l'impossibilité de faire du drag and drop sur le calendrier pour les weekends * Correction de la suppression d'un lien établissement - dossier qui ne changeait pas l'avis de l'établissement * Correction d'un problème d'escapiing des quotes sur la recherche des ets +* Correction d'un problème de géolocalisation si aucune couche WMS n'est paramétrée +* Correction d'un problème de géolocalisation avec nominatim et du manque de couche WMS sur le viewer d'ajout d'un établissement +* Correction de l'escaping des quotes sur les plans +* Correction de l'escaping des noms de fichiers de la gestion des documents +* Correction de la date du doc ajouté sur les levées d'avis défavorables +* Correction du calcul de la périodicité des IGH et KO à l'insert de nouveaux IGH +* Correction de la non-génération des documents consultés non manuels pour les dossiers de levées d'avis défavorables +* Correction d'une fatal error sur la suppression d'un texte applicable non existant sur l'établissement +* Correction de l'affichage des icônes des fichiers joints en cas d'extension en majuscule +* Correction de l'image du préventionniste qui était trop grande dans le cas d'une carte IGN ## 2.4 diff --git a/application/Bootstrap.php b/application/Bootstrap.php index 3c03443d..0e1045b9 100755 --- a/application/Bootstrap.php +++ b/application/Bootstrap.php @@ -139,5 +139,33 @@ public function _initDataStore() return new $className($options); } + + public function _initTranslator() { + $translator = new Zend_Translate( + array( + 'adapter' => 'array', + 'content' => implode(DS, array( + APPLICATION_PATH, + "..", + "vendor", + "zendframework", + 'zendframework1', + 'resources', + 'languages', + )), + 'locale' => "fr", + 'scan' => Zend_Translate::LOCALE_DIRECTORY + ) + ); + Zend_Validate_Abstract::setDefaultTranslator($translator); + } + + public function _initAuth() { + $options = $this->getOption('cache'); + $max_lifetime = isset($options['session_max_lifetime']) ? (int) $options['session_max_lifetime'] : 7200; + $namespace = new Zend_Session_Namespace('Zend_Auth'); + $namespace->setExpirationSeconds($max_lifetime); + return $namespace; + } } diff --git a/application/controllers/AdminController.php b/application/controllers/AdminController.php index 8ef79304..77be8d2b 100755 --- a/application/controllers/AdminController.php +++ b/application/controllers/AdminController.php @@ -7,7 +7,7 @@ public function indexAction() $cache_config = $this->getInvokeArg('bootstrap')->getOption('cache'); $this->_helper->layout->setLayout('menu_admin'); - + if (getenv('PREVARISC_BRANCH') == false) { try { $git = new SebastianBergmann\Git\Git(APPLICATION_PATH . DS . '..'); @@ -26,6 +26,15 @@ public function indexAction() $this->view->key_ign = getenv('PREVARISC_PLUGIN_IGNKEY'); $this->view->key_googlemap = getenv('PREVARISC_PLUGIN_GOOGLEMAPKEY'); + $this->view->geoconcept_url = getenv('PREVARISC_PLUGIN_GEOCONCEPT_URL'); + $this->view->geoconcept_infos = array( + 'Url' => $this->view->geoconcept_url, + 'Layer' => getenv('PREVARISC_PLUGIN_GEOCONCEPT_LAYER'), + 'App ID' => getenv('PREVARISC_PLUGIN_GEOCONCEPT_APP_ID'), + 'Projection' => getenv('PREVARISC_PLUGIN_GEOCONCEPT_PROJECTION') ? : "Non paramétrée", + 'Token' => getenv('PREVARISC_PLUGIN_GEOCONCEPT_TOKEN'), + 'Geocoder Url' => getenv('PREVARISC_PLUGIN_GEOCONCEPT_GEOCODER'), + ); $this->view->dbname = getenv('PREVARISC_DB_DBNAME'); $this->view->db_url = getenv('PREVARISC_DB_HOST').(getenv('PREVARISC_DB_PORT') ? ':'.getenv('PREVARISC_DB_PORT') : ''); $this->view->api_enabled = getenv('PREVARISC_SECURITY_KEY') != ""; @@ -39,7 +48,7 @@ public function indexAction() } else if (getenv('PREVARISC_LDAP_ENABLED')) { $this->view->authentification = sprintf("LDAP + BDD : %s:%d/%s", getenv("PREVARISC_LDAP_HOST"), - getenv("PREVARISC_LDAP_PORT"), + getenv("PREVARISC_LDAP_PORT") ? : '389', getenv("PREVARISC_LDAP_BASEDN")); } else { $this->view->authentification = "BDD"; @@ -49,6 +58,8 @@ public function indexAction() $this->view->cache_url = $cache_config['host']. ($cache_config['port'] ? ':'.$cache_config['port'] : ''); $this->view->cache_lifetime = $cache_config['lifetime']; $this->view->cache_enabled = $cache_config['enabled']; + + $this->view->enforce_security = getenv('PREVARISC_ENFORCE_SECURITY') == 1; $service_search = new Service_Search; $users = $service_search->users(null, null, null, true, 1000)['results']; diff --git a/application/controllers/CalendrierDesCommissionsController.php b/application/controllers/CalendrierDesCommissionsController.php index 7b281010..5dd5dfc7 100755 --- a/application/controllers/CalendrierDesCommissionsController.php +++ b/application/controllers/CalendrierDesCommissionsController.php @@ -38,23 +38,42 @@ public function indexAction() $array_results = $model_commission->fetchAll("ID_COMMISSIONTYPE = " . $row_typeDeCommission->ID_COMMISSIONTYPE )->toArray(); $array_results2 = array(); foreach($array_results as $item) { - $array_results2[] = array( - "ID_COMMISSION" => $item["ID_COMMISSION"], - "LIBELLE_COMMISSION" => $item["LIBELLE_COMMISSION"], - "DOCUMENT_CR" => $item["DOCUMENT_CR"], - "ID_COMMISSIONTYPE" => $item["ID_COMMISSIONTYPE"], - "LIBELLE_COMMISSIONTYPE" => $row_typeDeCommission->LIBELLE_COMMISSIONTYPE - ); + $array_results2[] = array( + "ID_COMMISSION" => $item["ID_COMMISSION"], + "LIBELLE_COMMISSION" => $item["LIBELLE_COMMISSION"], + "DOCUMENT_CR" => $item["DOCUMENT_CR"], + "ID_COMMISSIONTYPE" => $item["ID_COMMISSIONTYPE"], + "LIBELLE_COMMISSIONTYPE" => $row_typeDeCommission->LIBELLE_COMMISSIONTYPE + ); } $array_commissions[$row_typeDeCommission->ID_COMMISSIONTYPE] = array( "LIBELLE" => $row_typeDeCommission->LIBELLE_COMMISSIONTYPE, "ARRAY" => $array_results2 ); } + + $userId = Zend_Auth::getInstance()->getIdentity()['ID_UTILISATEUR']; + + $url = sprintf("/api/1.0/calendar?userid=%s&key=%s", + $userId, + getenv('PREVARISC_SECURITY_KEY')); + + if ($this->_getParam("idComm")) { + $url .= sprintf("&commission=%s", $this->_getParam("idComm")); + } + + $protocol = ( ! empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'webcals': 'webcal'; + + $this->view->url_webcal = $protocol . '://' . $_SERVER["HTTP_HOST"] . $url; $this->view->array_commissions = $array_commissions; $cache = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('cache'); $this->view->is_admin = unserialize($cache->load('acl'))->isAllowed(Zend_Auth::getInstance()->getIdentity()['group']['LIBELLE_GROUPE'], "gestion_parametrages", "gestion_commissions"); + $this->view->is_view_all = unserialize($cache->load('acl'))->isAllowed( + Zend_Auth::getInstance()->getIdentity()['group']['LIBELLE_GROUPE'], + "commission", + "calendar_view_all" + ); } public function recupdatelieeAction() @@ -64,7 +83,7 @@ public function recupdatelieeAction() $infosDateComm = $dbDateComm->find($this->_getParam('idDate'))->current(); //Une fois les infos de la date récupérées on peux aller chercher les date liées à cette commission pour les afficher - if (!$infosDateComm['DATECOMMISSION_LIEES']) { + if ( ! $infosDateComm['DATECOMMISSION_LIEES']) { $commPrincipale = $this->_getParam('idDate'); } else { $commPrincipale = $infosDateComm['DATECOMMISSION_LIEES']; @@ -95,7 +114,7 @@ public function gestionodjAction() $dbCommissionType = new Model_DbTable_CommissionType; $infosCommissionType = $dbCommissionType->find($infosCommission['ID_COMMISSIONTYPE'])->current(); - + //récuperation de tout les dossiers affectés à cette date de commission $dbDossierAffectation = new Model_DbTable_DossierAffectation; @@ -123,7 +142,7 @@ public function gestionodjAction() $listeDossiersNonAffect[$val]['preventionnistes'] = $DB_prev->getPrevDossier( $ue['ID_DOSSIER'] ); } } - + //Gestion de l'affichage de la date de la commission $date = new Zend_Date($infosDateComm['DATE_COMMISSION'],'yyyy-MM-dd'); $this->view->dateFr = $date->get(Zend_Date::WEEKDAY." ".Zend_Date::DAY_SHORT." ".Zend_Date::MONTH_NAME_SHORT." ".Zend_Date::YEAR,'fr'); @@ -206,7 +225,9 @@ public function recupevenementAction() $dbDateCommission = new Model_DbTable_DateCommission; $items = array(); - $requete = "COMMISSION_CONCERNE = '" . $this->_getParam('idComm') . "' AND DATE_COMMISSION BETWEEN '" . $dateDebut . "' AND '" . $dateFin . "'"; + $requete = ($this->_getParam('idComm')) + ? "COMMISSION_CONCERNE = '" . $this->_getParam('idComm') . "' AND DATE_COMMISSION BETWEEN '" . $dateDebut . "' AND '" . $dateFin . "'" + : "DATE_COMMISSION BETWEEN '" . $dateDebut . "' AND '" . $dateFin . "'"; if ($this->_getParam('type')) { $requete .= " AND ID_COMMISSIONTYPEEVENEMENT = '".$this->_getParam('type')."'"; @@ -267,7 +288,7 @@ public function recupevenementodjAction() $affichage .= $dossierAffect['infosEtab']['parents'][0]["LIBELLE_ETABLISSEMENTINFORMATIONS"]." - "; } $affichage = $dossierAffect['infosEtab']['informations']['LIBELLE_ETABLISSEMENTINFORMATIONS' ]; - + $nbAdresse = count($dossierAffect['infosEtab']['adresses']); if($nbAdresse != 0){ $affichage .= " ("; @@ -281,7 +302,7 @@ public function recupevenementodjAction() }else{ $affichage .= " ( adresse non renseignée )"; } - + if ($dossierAffect['LIBELLE_DOSSIERNATURE'] != "") { $affichage .= " - ".$dossierAffect['LIBELLE_DOSSIERNATURE']; } @@ -297,7 +318,7 @@ public function recupevenementodjAction() $affichage .= $ue['NUM_DOCURBA']." . "; } } - + $DB_prev = new Model_DbTable_DossierPreventionniste; $preventionnistes = $DB_prev->getPrevDossier( $dossierAffect['ID_DOSSIER'] ); if(count($preventionnistes) > 0){ @@ -361,10 +382,10 @@ public function dialogcommAction() $this->view->dateClick = $this->_getParam('idDateComm'); //Récupération du nom de la commission - $dbCommissions = new Model_DbTable_Commission; + /*$dbCommissions = new Model_DbTable_Commission; $commFind = $dbCommissions->find($this->_getParam('idComm')); $commSelect = $commFind->current(); - $this->view->libelleCom = $commSelect->LIBELLE_COMMISSION; + $this->view->libelleCom = $commSelect->LIBELLE_COMMISSION;*/ $dbDateCommission = new Model_DbTable_DateCommission; $commQtipInfo = $dbDateCommission->find($this->_getParam('idDateComm'))->current(); @@ -528,9 +549,9 @@ public function dialogcommAction() $updateDateComm->HEUREFIN_COMMISSION = $HeureF->get('HH:mm'); $updateDateComm->DATE_COMMISSION = $date->get(Zend_Date::YEAR."-".Zend_Date::MONTH."-".Zend_Date::DAY); $updateDateComm->save(); - + $dbDateCommission->updateDependingDossierDates($updateDateComm); - + $this->view->updateDateComm = $updateDateComm; $this->view->first = $this->_getParam('first'); break; @@ -724,7 +745,7 @@ public function adddatesAction() public function deplacecommissiondateAction() { - + try { $date = new Zend_Date($_POST['debut'],Zend_Date::DATES,'en'); @@ -742,7 +763,7 @@ public function deplacecommissiondateAction() $commUpdate->save(); $dbDateCommission->updateDependingDossierDates($commUpdate); - + $this->_helper->flashMessenger(array( 'context' => 'success', 'title' => 'L\'événement a bien été déplacé', @@ -853,7 +874,7 @@ public function changementordreAction() $stringUpdate = $this->_getParam('ordreDossier'); $dossierId = explode(",",$stringUpdate); - + $dbDossierAffectation = new Model_DbTable_DossierAffectation; $numDossier = 0; @@ -887,7 +908,7 @@ public function generationconvocAction() //On récupère la liste des dossiers //Suivant si l'on prend en compte les heures ou non on choisi la requete à effectuer $dbDateCommPj = new Model_DbTable_DateCommissionPj; - + if ($commissionInfo['GESTION_HEURES'] == 1) { //prise en compte heures $listeDossiers = $dbDateCommPj->getDossiersInfosByHour($dateCommId); @@ -964,7 +985,6 @@ public function generationconvocAction() if($existe == 0){ if(count($ue['infosEtab']["adresses"]) > 0){ - $libelleCommune = $ue['infosEtab']['adresses'][0]['LIBELLE_COMMUNE']; $adresseCommune = $model_adresseCommune->find($ue['infosEtab']['adresses'][0]['NUMINSEE_COMMUNE'])->toArray(); $communeInfo = $model_utilisateurInfo->find($adresseCommune[0]["ID_UTILISATEURINFORMATIONS"])->toArray(); @@ -981,7 +1001,7 @@ public function generationconvocAction() $this->view->nomComm = $listeDossiers[0]["LIBELLE_DATECOMMISSION"]; $this->view->dateComm = $listeDossiers[0]["DATE_COMMISSION"]; $this->view->heureDeb = $listeDossiers[0]["HEUREDEB_COMMISSION"]; - + $this->_helper->flashMessenger(array( 'context' => 'success', 'title' => 'Le document a bien été généré', @@ -1035,12 +1055,15 @@ public function generationodjAction() foreach($listeDossiers as $val => $ue) { - + $listeDossiers[$val]['preventionnistes'] = array(); + $listeDossiers[$val]['listeDocUrba'] = array(); + $listeDossiers[$val]['infosEtab'] = array(); + $listePrev = $dbDossier->getPreventionnistesDossier($ue['ID_DOSSIER']); if (count($listePrev) > 0) { $listeDossiers[$val]['preventionnistes'] = $listePrev; } - + //On recupere la liste des établissements qui concernent le dossier $listeEtab = $dbDossier->getEtablissementDossierGenConvoc($ue['ID_DOSSIER']); //on recupere la liste des infos des établissement @@ -1113,13 +1136,12 @@ public function generationpvAction() //Suivant si l'on prend en compte les heures ou non on choisi la requete à effectuer $dbDateComm = new Model_DbTable_DateCommission; $commSelect = $dbDateComm->find($dateCommId)->current(); - + $commissionInfo = $dbDateComm->find($dateCommId)->current()->toArray(); //1 = salle . 2 = visite . 3 = groupe de visite //on recupere le type de commission (salle / visite / groupe de visite) $commissionInfo = $dbDateComm->find($dateCommId)->current()->toArray(); $this->view->dateComm = $commissionInfo['DATE_COMMISSION']; - //On récupère le nom de la commission $model_commission = new Model_DbTable_Commission; $this->view->commissionInfos = $model_commission->find($commissionInfo["COMMISSION_CONCERNE"])->toArray(); @@ -1130,13 +1152,13 @@ public function generationpvAction() //afin de récuperer les informations des communes (adresse des mairies etc) $model_adresseCommune = new Model_DbTable_AdresseCommune; $model_utilisateurInfo = new Model_DbTable_UtilisateurInformations; - + if($commissionInfo['GESTION_HEURES'] == 1){ $listeDossiers = $dbDateCommPj->TESTRECUPDOSSHEURE($dateCommId); }else{ $listeDossiers = $dbDateCommPj->TESTRECUPDOSS($dateCommId); } - + $dbDossier = new Model_DbTable_Dossier; $dbDocUrba = new Model_DbTable_DossierDocUrba; $service_etablissement = new Service_Etablissement; @@ -1180,7 +1202,7 @@ public function generationcompterenduAction() $model_commission = new Model_DbTable_Commission; $this->view->commissionInfos = $model_commission->find($commissionInfo["COMMISSION_CONCERNE"])->toArray(); $model_membres = new Model_DbTable_CommissionMembre; - + $this->view->membresFiles = $model_membres->fetchAll("ID_COMMISSION = " . $commissionInfo['COMMISSION_CONCERNE']); $dbDateCommPj = new Model_DbTable_DateCommissionPj; @@ -1188,12 +1210,12 @@ public function generationcompterenduAction() $model_adresseCommune = new Model_DbTable_AdresseCommune; $model_utilisateurInfo = new Model_DbTable_UtilisateurInformations; - if($commissionInfo['GESTION_HEURES'] == 1){ + if ($commissionInfo['GESTION_HEURES'] == 1){ $listeDossiers = $dbDateCommPj->TESTRECUPDOSSHEURE($dateCommId); - }else{ + } else { $listeDossiers = $dbDateCommPj->TESTRECUPDOSS($dateCommId); } - + $dbDossier = new Model_DbTable_Dossier; $dbDocUrba = new Model_DbTable_DossierDocUrba; $service_etablissement = new Service_Etablissement; @@ -1260,7 +1282,8 @@ public function validsuppressionAction() $dateComm->delete(); } - public function exportoutlookAction() { + public function exportoutlookAction() + { $idDateComm = $this->_getParam("dateCommId"); $this->view->layout()->disableLayout(); @@ -1379,6 +1402,4 @@ public function exportoutlookmoisAction() { } echo $ics; } - - } diff --git a/application/controllers/ChangementController.php b/application/controllers/ChangementController.php new file mode 100644 index 00000000..27457de2 --- /dev/null +++ b/application/controllers/ChangementController.php @@ -0,0 +1,101 @@ +_helper->layout->setLayout('menu_admin'); + $this->view->headScript()->appendFile('js/tinymce.min.js'); + + $serviceChangement = new Service_Changement; + + if($this->_request->isPost()) { + try { + $post = $this->_request->getPost(); + $serviceChangement->save($post); + $this->_helper->flashMessenger(array( + 'context' => 'success', + 'title' => 'Mise à jour réussie !', + 'message' => 'Les messages d\'alerte ont bien été mis à jour.' + )); + $this->_helper->redirector('index', null, null, array('id' => $this->_request->id)); + } catch (Exception $e) { + $this->_helper->flashMessenger(array( + 'context' => 'error', + 'title' => '', + 'message' => 'Les messages d\'alerte n\'ont pas été mis à jour. Veuillez rééssayez. (' + . $e->getMessage() . ')' + )); + } + } + + + $this->view->changements = $serviceChangement->getAll(); + } + + + public function alerteformAction() + { + $serviceEtablissement = new Service_Etablissement; + $serviceChangement = new Service_Changement; + $serviceUser = new Service_User; + + $etablissement = $serviceEtablissement->get( + $this->_getParam("id_etablissement")); + + $changement = $serviceChangement->get($this->_getParam("changement")); + + $users = $serviceUser->getUtilisateursForAlterte( + $changement["ID_CHANGEMENT"], $etablissement); + + $mails = array(); + $tos = array(); + foreach($users as $user) { + $mails[] = $user["MAIL_UTILISATEURINFORMATIONS"]; + $tos[] = sprintf('%s, %s Retirer', + $user["ID_UTILISATEUR"], + $user["NOM_UTILISATEURINFORMATIONS"], + $user["PRENOM_UTILISATEURINFORMATIONS"], + $user["ID_UTILISATEUR"], + $user["MAIL_UTILISATEURINFORMATIONS"] + ); + } + $this->view->tos = implode(", ", $tos); + $this->view->mails = implode(";", $mails); + + $this->view->objet = $serviceChangement->getObjet( + $changement["ID_CHANGEMENT"], $etablissement); + + $this->view->message = $serviceChangement->convertMessage( + $changement["MESSAGE_CHANGEMENT"], $etablissement); + } + + public function balisesAction() + { + $serviceChangement = new Service_Changement; + + $this->view->balises = $serviceChangement->getBalises(); + } + + public function sendmailalerteAction() + { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(true); + + $tos = $this->_getParam("mail-emails-dst"); + + $result = false; + + if ($tos !== "") { + $arrayMails = explode(";", $tos); + $object = $this->_getParam("alerte-objet"); + $message = $this->_getParam("alerte-message"); + + $serviceMail = new Service_Mail; + $result = $serviceMail->sendAlerteMail($object, $message, $arrayMails); + } + + echo Zend_Json::encode($result); + } +} \ No newline at end of file diff --git a/application/controllers/CommissionController.php b/application/controllers/CommissionController.php index 2f890cf3..251f5967 100755 --- a/application/controllers/CommissionController.php +++ b/application/controllers/CommissionController.php @@ -215,39 +215,58 @@ public function applyReglesAction() try { $this->_helper->viewRenderer->setNoRender(); - // Modèles - $model_etablissement = new Model_DbTable_Etablissement; + // Modèles et services $model_etablissementInformation = new Model_DbTable_EtablissementInformations; - $model_etablissementAdressse = new Model_DbTable_EtablissementAdresse; - - // On récup tout les établissements - $rowset_ets = $model_etablissement->fetchAll(); - + $model_commission = new Model_DbTable_Commission; + + if (!isset($_POST['ID_COMMISSION']) && !$_POST['ID_COMMISSION']) { + throw new Exception('Aucun ID de commission fournit dans la requête'); + } + + $id_commission = $_POST['ID_COMMISSION']; + $regles = $model_commission->getRegles($id_commission); + + $search = new Model_DbTable_Search; + $search->setItem("etablissement"); + $search->setCriteria("etablissementinformations.ID_GENRE", array(2, 5)); + $search->setCriteria("etablissementadresse.NUMINSEE_COMMUNE IS NOT NULL"); + $rowset_ets = $search->run(false, null, false)->toArray(); + + $ets_to_update = array(); + // Pour tout les ets, on récup leur commission par défaut - foreach ($rowset_ets as $row) { - - // Adresses - $rowset_adresse = $model_etablissementAdressse->get($row["ID_ETABLISSEMENT"]); - - // Si il y a une adresse - if (count($rowset_adresse) > 0) { - - // On récupère les infos - $info = $model_etablissement->getInformations($row["ID_ETABLISSEMENT"])->toArray(); - - // On merge l'adresse - $info["NUMINSEE_COMMUNE"][0] = $rowset_adresse[0]["NUMINSEE_COMMUNE"]; - - // On récupère la commission - $commission = $model_etablissement->getDefaultCommission($info); - - // Si elle n'est pas nulle on l'applique - if ($commission != null) { - $row_ets = $model_etablissementInformation->find($info["ID_ETABLISSEMENTINFORMATIONS"])->current(); - $row_ets->ID_COMMISSION = $commission[0]["ID_COMMISSION"]; - $row_ets->save(); + foreach ($rowset_ets as $key => $row) { + + // On récupère la commission + foreach($regles as $regle) { + + if ($row['ID_GENRE'] == 2 + && in_array($row['NUMINSEE_COMMUNE'], $regle['NUMINSEE_COMMUNE']) + && $row['LOCALSOMMEIL_ETABLISSEMENTINFORMATIONS'] == $regle['LOCALSOMMEIL'] + && $row['ID_TYPE'] == $regle['ID_TYPE'] + && $row['ID_CATEGORIE'] == $regle['ID_CATEGORIE']) + { + $ets_to_update[] = $row['ID_ETABLISSEMENTINFORMATIONS']; + break; + } + else if ($row['ID_GENRE'] == 5 + && in_array($row['NUMINSEE_COMMUNE'], $regle['NUMINSEE_COMMUNE']) + && $row['ID_CLASSE'] == $regle['ID_CLASSE']) + { + $ets_to_update[] = $row['ID_ETABLISSEMENTINFORMATIONS']; + break; } } + + // save memory + unset($rowset_ets[$key]); + } + + if ($ets_to_update) { + $model_etablissementInformation->update(array('ID_COMMISSION' => $id_commission), 'ID_ETABLISSEMENTINFORMATIONS IN ('.implode(',', $ets_to_update).')'); + + // removes cache if any changes + Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('cache')->clean(Zend_Cache::CLEANING_MODE_ALL); } } catch (Exception $e) { $this->_helper->flashMessenger(array( diff --git a/application/controllers/CouchesCartographiquesController.php b/application/controllers/CouchesCartographiquesController.php index a32b2af4..166ce8c3 100755 --- a/application/controllers/CouchesCartographiquesController.php +++ b/application/controllers/CouchesCartographiquesController.php @@ -9,6 +9,10 @@ public function listAction() $service_carto = new Service_Carto; $this->view->couches_cartographiques = $service_carto->getAll(); $this->view->key_ign = getenv('PREVARISC_PLUGIN_IGNKEY'); + $this->view->geoconcept_url = getenv('PREVARISC_PLUGIN_GEOCONCEPT_URL'); + $this->view->key_googlemap = getenv('PREVARISC_PLUGIN_GOOGLEMAPKEY'); + $this->view->default_lon = getenv('PREVARISC_CARTO_DEFAULT_LON') ? : "2.71490430425517"; + $this->view->default_lat = getenv('PREVARISC_CARTO_DEFAULT_LAT') ? : "50.4727273438818"; } public function addAction() diff --git a/application/controllers/DossierController.php b/application/controllers/DossierController.php old mode 100644 new mode 100755 index d9c150e4..5bce9748 --- a/application/controllers/DossierController.php +++ b/application/controllers/DossierController.php @@ -8,92 +8,92 @@ class DossierController extends Zend_Controller_Action private $listeChamps = array( //ETUDES //PC - OK - "1" => array("type","DATEINSERT","OBJET","NUMDOCURBA","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","SERVICEINSTRUC","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","COORDSSI","DATESDIS","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), + "1" => array("type","DATEINSERT","OBJET","NUMDOCURBA","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","SERVICEINSTRUC","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","COORDSSI","DATESDIS","DATEREP","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //AT - OK - "2" => array("type","DATEINSERT","OBJET","NUMDOCURBA","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","SERVICEINSTRUC","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","COORDSSI","DATESDIS","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), + "2" => array("type","DATEINSERT","OBJET","NUMDOCURBA","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","SERVICEINSTRUC","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","COORDSSI","DATESDIS","DATEREP","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //Dérogation - OK - "3" => array("type","DATEINSERT","OBJET","NUMDOCURBA","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","SERVICEINSTRUC","COMMISSION","DESCGEN","JUSTIFDEROG","MESURESCOMPENS","MESURESCOMPLE","DESCEFF","DATECOMM","AVIS","COORDSSI","DATESDIS","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","REGLEDEROG","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), + "3" => array("type","DATEINSERT","OBJET","NUMDOCURBA","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","SERVICEINSTRUC","COMMISSION","DESCGEN","JUSTIFDEROG","MESURESCOMPENS","MESURESCOMPLE","DESCEFF","DATECOMM","AVIS","COORDSSI","DATESDIS","DATEREP","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","REGLEDEROG","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //Cahier des charges fonctionnel du SSI - OK - "4" => array("type","DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DATECOMM","AVIS","COORDSSI","DATESDIS","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), + "4" => array("type","DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DATECOMM","AVIS","COORDSSI","DATESDIS","DATEREP","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //Cahier des charges de type T - OK - "5" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), + "5" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","DATEREP","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //Salon type T - OK - "6" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","CHARGESEC","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET", "HORSDELAI","AVIS_COMMISSION","OBSERVATION"), + "6" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","DATEREP","CHARGESEC","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET", "HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //RVRMD (diag sécu) => Levée de prescriptions - OK "7" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //Documents divers - OK "8" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","DATEPREF","DATEREP","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //Changement de DUS - OK - "9" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DATECOMM","AVIS","DATESDIS","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), + "9" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DATECOMM","AVIS","DATESDIS","DATEREP","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //Suivi organisme formation SSIAP - OK "10" => array("DATEINSERT","OBJET","NUMCHRONO","AVIS","DATESDIS","DATEPREF","DATEREP","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //Demande de registre de sécurité CTS - OK - "11" => array("DATEINSERT","OBJET","NUMCHRONO","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","DATEPREF","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET", "HORSDELAI","AVIS_COMMISSION","OBSERVATION"), + "11" => array("DATEINSERT","OBJET","NUMCHRONO","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","DATEPREF","DATEREP","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET", "HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //Demande d'implantation CTS < 6mois - OK - "12" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET", "HORSDELAI","AVIS_COMMISSION","OBSERVATION"), + "12" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","DATEREP","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET", "HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //Demande d'implantation CTS > 6mois - OK - "13" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET", "HORSDELAI","AVIS_COMMISSION","OBSERVATION"), + "13" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","DATEREP","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET", "HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //Permis d'aménager - OK - "14" => array("DATEINSERT","OBJET","NUMDOCURBA","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","DESCGEN","DESCEFF","DATESDIS","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), + "14" => array("DATEINSERT","OBJET","NUMDOCURBA","NUMCHRONO","COMMISSION","DATEMAIRIE","DATESECRETARIAT","SERVICEINSTRUC","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","DATEREP","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //Permis de démolir - OK - "15" => array("DATEINSERT","OBJET","NUMDOCURBA","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), + "15" => array("DATEINSERT","OBJET","NUMDOCURBA","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","DATEREP","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //CR de visite des organismes d'ins.... - OK - "16" => array("DATEINSERT","OBJET","NUMCHRONO","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","DATEPREF","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), + "16" => array("DATEINSERT","OBJET","NUMCHRONO","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","DATEPREF","DATEREP","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //Etude suite a un avis ne se prononce pas - OK MAIS VOIR POUR PARTICULARITé TABLEAU - "17" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), + "17" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","DATEREP","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //Utilisation exceptionnelle de locaux - OK - "18" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET", "HORSDELAI","AVIS_COMMISSION","OBSERVATION"), + "18" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","DATEREP","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET", "HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //Levée de réserves - OK - "19" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","AVIS_COMMISSION","OBSERVATION"), + "19" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","DATEREP","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","AVIS_COMMISSION","OBSERVATION"), //Echéncier de travaux - OK - "46" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","PREVENTIONNISTE","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), + "46" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","DATEREP","PREVENTIONNISTE","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //Déclaration préalable - "30" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","PREVENTIONNISTE","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION","NUMDOCURBA"), + "30" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","DATEREP","PREVENTIONNISTE","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION","NUMDOCURBA"), //RVRMD diag sécu - "33" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), + "33" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","DATEREP","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //Autorisation d'une ICPE - OK - "61" => array("type","DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","SERVICEINSTRUC","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","COORDSSI","DATESDIS","PREVENTIONNISTE","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), + "61" => array("type","DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","SERVICEINSTRUC","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","COORDSSI","DATESDIS","DATEREP","PREVENTIONNISTE","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //Certificats d'urbanisme (CU) - OK - "62" => array("type","DATEINSERT","OBJET","NUMDOCURBA","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","SERVICEINSTRUC","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","COORDSSI","DATESDIS","PREVENTIONNISTE","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), + "62" => array("type","DATEINSERT","OBJET","NUMDOCURBA","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","SERVICEINSTRUC","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","COORDSSI","DATESDIS","DATEREP","PREVENTIONNISTE","DEMANDEUR","INCOMPLET","HORSDELAI","AVIS_COMMISSION","OBSERVATION"), // Demande d'organisation de manifestation temporaire - OK - "63" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET", "HORSDELAI","AVIS_COMMISSION","OBSERVATION"), + "63" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","DATEREP","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET", "HORSDELAI","AVIS_COMMISSION","OBSERVATION"), // Déclassement / Reclassement - OK - "66" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET", "HORSDELAI","AVIS_COMMISSION","OBSERVATION"), + "66" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","DATESECRETARIAT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","AVIS","DATESDIS","DATEREP","PREVENTIONNISTE","ABSQUORUM","DEMANDEUR","INCOMPLET", "HORSDELAI","AVIS_COMMISSION","OBSERVATION"), //VISITE DE COMMISSION //Réception de travaux - OK - "20" => array("DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATEVISITE","COORDSSI","PREVENTIONNISTE","ABSQUORUM","NPSP","AVIS_COMMISSION","OBSERVATION","DATERVRAT","DELAIPRESC"), + "20" => array("DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATEVISITE","COORDSSI","DATEREP","PREVENTIONNISTE","ABSQUORUM","NPSP","AVIS_COMMISSION","OBSERVATION","DATERVRAT","DELAIPRESC"), //Avant ouverture - OK - "47" => array("DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATEVISITE","COORDSSI","PREVENTIONNISTE","ABSQUORUM","NPSP","AVIS_COMMISSION","OBSERVATION","DATERVRAT","DELAIPRESC"), + "47" => array("DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATEVISITE","COORDSSI","DATEREP","PREVENTIONNISTE","ABSQUORUM","NPSP","AVIS_COMMISSION","OBSERVATION","DATERVRAT","DELAIPRESC"), //Périodique - OK - "21" => array("DATEINSERT","COMMISSION","DESCGEN","DESCEFF","DATEVISITE","PREVENTIONNISTE","DIFFEREAVIS","ABSQUORUM","AVIS","AVIS_COMMISSION","OBSERVATION","DELAIPRESC"), + "21" => array("DATEINSERT","COMMISSION","DESCGEN","DESCEFF","DATEVISITE","DATEREP","PREVENTIONNISTE","DIFFEREAVIS","ABSQUORUM","AVIS","AVIS_COMMISSION","OBSERVATION","DELAIPRESC"), //Chantier - OK - "22" => array("DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATEVISITE","COORDSSI","PREVENTIONNISTE","OBSERVATION","DELAIPRESC"), + "22" => array("DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATEVISITE","COORDSSI","DATEREP","PREVENTIONNISTE","OBSERVATION","DELAIPRESC"), //Controle - OK - "23" => array("DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATEVISITE","COORDSSI","PREVENTIONNISTE","DIFFEREAVIS","ABSQUORUM","AVIS_COMMISSION","OBSERVATION","DELAIPRESC"), + "23" => array("DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATEVISITE","COORDSSI","DATEREP","PREVENTIONNISTE","DIFFEREAVIS","ABSQUORUM","AVIS_COMMISSION","OBSERVATION","DELAIPRESC"), //Inopinéee - OK - "24" => array("DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATEVISITE","PREVENTIONNISTE","DIFFEREAVIS","ABSQUORUM","AVIS_COMMISSION","OBSERVATION","DELAIPRESC"), + "24" => array("DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATEVISITE","DATEREP","PREVENTIONNISTE","DIFFEREAVIS","ABSQUORUM","AVIS_COMMISSION","OBSERVATION","DELAIPRESC"), //Visite conseil - OK - "64" => array("DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATEVISITE","COORDSSI","PREVENTIONNISTE","OBSERVATION","DELAIPRESC"), + "64" => array("DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATEVISITE","COORDSSI","DATEREP","PREVENTIONNISTE","OBSERVATION","DELAIPRESC"), //GROUPE DE VISITE //Réception de travaux - OK - "25" => array("type","DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATECOMM","DATEVISITE","AVIS","COORDSSI","PREVENTIONNISTE","NPSP","ABSQUORUM","AVIS_COMMISSION","OBSERVATION","DATERVRAT","DELAIPRESC"), + "25" => array("type","DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATECOMM","DATEVISITE","AVIS","COORDSSI","DATEREP","PREVENTIONNISTE","NPSP","ABSQUORUM","AVIS_COMMISSION","OBSERVATION","DATERVRAT","DELAIPRESC"), //Avant ouverture - OK - "48" => array("DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATECOMM","DATEVISITE","AVIS","COORDSSI","PREVENTIONNISTE","NPSP","ABSQUORUM","AVIS_COMMISSION","OBSERVATION","DATERVRAT","DELAIPRESC"), + "48" => array("DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATECOMM","DATEVISITE","AVIS","COORDSSI","DATEREP","PREVENTIONNISTE","NPSP","ABSQUORUM","AVIS_COMMISSION","OBSERVATION","DATERVRAT","DELAIPRESC"), //Périodique - OK - "26" => array("DATEINSERT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","DATEVISITE","AVIS","PREVENTIONNISTE","DIFFEREAVIS","ABSQUORUM","AVIS_COMMISSION","OBSERVATION","DELAIPRESC"), + "26" => array("DATEINSERT","COMMISSION","DESCGEN","DESCEFF","DATECOMM","DATEVISITE","AVIS","DATEREP","PREVENTIONNISTE","DIFFEREAVIS","ABSQUORUM","AVIS_COMMISSION","OBSERVATION","DELAIPRESC"), //Chantier - OK - "27" => array("DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATEVISITE","COORDSSI","PREVENTIONNISTE","OBSERVATION","DELAIPRESC"), + "27" => array("DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATEVISITE","COORDSSI","DATEREP","PREVENTIONNISTE","OBSERVATION","DELAIPRESC"), //Controle - OK - "28" => array("DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATECOMM","DATEVISITE","AVIS","COORDSSI","PREVENTIONNISTE","DIFFEREAVIS","ABSQUORUM","AVIS_COMMISSION","OBSERVATION","DELAIPRESC"), + "28" => array("DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATECOMM","DATEVISITE","AVIS","COORDSSI","DATEREP","PREVENTIONNISTE","DIFFEREAVIS","ABSQUORUM","AVIS_COMMISSION","OBSERVATION","DELAIPRESC"), //Inopinéee - OK - "29" => array("DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATECOMM","DATEVISITE","AVIS","PREVENTIONNISTE","DIFFEREAVIS","ABSQUORUM","AVIS_COMMISSION","OBSERVATION","DELAIPRESC"), + "29" => array("DATEINSERT","OBJET","COMMISSION","DESCGEN","DESCEFF","DATECOMM","DATEVISITE","AVIS","DATEREP","PREVENTIONNISTE","DIFFEREAVIS","ABSQUORUM","AVIS_COMMISSION","OBSERVATION","DELAIPRESC"), //REUNION //Locaux SDIS - OK - "31" => array("DATEINSERT","OBJET","DATEREUN","PREVENTIONNISTE","DEMANDEUR","OBSERVATION"), + "31" => array("DATEINSERT","OBJET","DATEREUN","DATEREP","PREVENTIONNISTE","DEMANDEUR","OBSERVATION"), //Exterieur SDIS - OK - "32" => array("DATEINSERT","OBJET","LIEUREUNION","DATEREUN","PREVENTIONNISTE","DEMANDEUR","OBSERVATION"), + "32" => array("DATEINSERT","OBJET","LIEUREUNION","DATEREUN","DATEREP","PREVENTIONNISTE","DEMANDEUR","OBSERVATION"), //Téléphonique - OK - "43" => array("DATEINSERT","OBJET","DATEREUN","PREVENTIONNISTE","DEMANDEUR","OBSERVATION"), + "43" => array("DATEINSERT","OBJET","DATEREUN","DATEREP","PREVENTIONNISTE","DEMANDEUR","OBSERVATION"), //COURRIER/COURRIEL //Lettre - OK "52" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","PREVENTIONNISTE","DATEREP","DATEENVTRANSIT","PREVENTIONNISTE","DATESDIS","DEMANDEUR","DATETRANSFERTCOMM","DATERECEPTIONCOMM","OBSERVATION"), @@ -121,22 +121,22 @@ class DossierController extends Zend_Controller_Action "65" => array("DATEINSERT","OBJET","NUMCHRONO","DATEMAIRIE","PREVENTIONNISTE","DATEREP","DATEENVTRANSIT","PREVENTIONNISTE","DATESDIS","DEMANDEUR","DATETRANSFERTCOMM","DATERECEPTIONCOMM","OBSERVATION"), //INTERVENTION //Incendie - OK - "37" => array("DATEINSERT","OBJET","OPERSDIS","RCCI","REX","NUMINTERV","DATEINTERV","DUREEINTERV","PREVENTIONNISTE","OBSERVATION"), + "37" => array("DATEINSERT","OBJET","OPERSDIS","RCCI","REX","NUMINTERV","DATEINTERV","DUREEINTERV","DATEREP","PREVENTIONNISTE","OBSERVATION"), //SAP - OK - "38" => array("DATEINSERT","OBJET","OPERSDIS","REX","NUMINTERV","DATEINTERV","DUREEINTERV","PREVENTIONNISTE","OBSERVATION"), + "38" => array("DATEINSERT","OBJET","OPERSDIS","REX","NUMINTERV","DATEINTERV","DUREEINTERV","DATEREP","PREVENTIONNISTE","OBSERVATION"), //Intervention div - OK - "39" => array("DATEINSERT","OBJET","OPERSDIS","REX","NUMINTERV","DATEINTERV","DUREEINTERV","PREVENTIONNISTE","OBSERVATION"), + "39" => array("DATEINSERT","OBJET","OPERSDIS","REX","NUMINTERV","DATEINTERV","DUREEINTERV","DATEREP","PREVENTIONNISTE","OBSERVATION"), //ARRETE //Ouverture - OK - "40" => array("DATEINSERT","DATESIGN","PREVENTIONNISTE","OBSERVATION"), + "40" => array("DATEINSERT","DATESIGN","DATEREP","PREVENTIONNISTE","OBSERVATION"), //Fermeture - OK - "41" => array("DATEINSERT","OBJET","DATESIGN","PREVENTIONNISTE","OBSERVATION"), + "41" => array("DATEINSERT","OBJET","DATESIGN","DATEREP","PREVENTIONNISTE","OBSERVATION"), //Mise en demeure - OK - "42" => array("DATEINSERT","OBJET","DATESIGN","PREVENTIONNISTE","OBSERVATION"), + "42" => array("DATEINSERT","OBJET","DATESIGN","DATEREP","PREVENTIONNISTE","OBSERVATION"), //Utilisation exceptionnelle de locaux - OK - "44" => array("DATEINSERT","OBJET","DATESIGN","PREVENTIONNISTE","OBSERVATION"), + "44" => array("DATEINSERT","OBJET","DATESIGN","DATEREP","PREVENTIONNISTE","OBSERVATION"), //Courrier - OK - "45" => array("DATEINSERT","OBJET","DATESIGN","PREVENTIONNISTE","OBSERVATION"), + "45" => array("DATEINSERT","OBJET","DATESIGN","DATEREP","PREVENTIONNISTE","OBSERVATION"), ); public function init() @@ -181,6 +181,9 @@ public function init() $this->view->idDossier = ($this->_getParam("id")); $this->view->verrou = $dossier->VERROU_DOSSIER; + + + } } @@ -207,6 +210,8 @@ public function addAction() public function indexAction() { + $this->view->headScript()->appendFile('/js/tinymce.min.js'); + $this->view->do = "new"; if ($this->_getParam("id")) { $this->view->do = "edit"; @@ -249,6 +254,9 @@ public function indexAction() $this->view->is_allowed_change_avis = unserialize($cache->load('acl'))->isAllowed(Zend_Auth::getInstance()->getIdentity()['group']['LIBELLE_GROUPE'], "avis_commission", "edit_avis_com"); + // Autorisation de suppression du dossier + $this->view->is_allowed_delete_dossier = unserialize($cache->load('acl'))->isAllowed(Zend_Auth::getInstance()->getIdentity()['group']['LIBELLE_GROUPE'], "suppression", "delete_dossier"); + $service_etablissement = new Service_Etablissement(); if ($this->_getParam("idEtablissement")) { @@ -307,7 +315,7 @@ public function indexAction() if (isset($commissionEtab)) { $this->view->commissionEtab = $commissionEtab; } - + $genreInfo = $this->view->genre; if (isset($idEtablissement)) { @@ -641,6 +649,7 @@ public function indexAction() unset($preventionnistes[-1]); $this->view->preventionnistes = $preventionnistes; $this->view->listeDocManquant = array(); + $this->view->dossierNatureListe = array(); } //23/10/12 Ajout du service instructeur remplacé par le select des groupements de communes @@ -882,6 +891,7 @@ public function saveAction() $docAttestation->LIBELLE_DOCAJOUT = "Attestation de"; $docAttestation->ID_NATURE = $idNature; $docAttestation->ID_DOSSIER = $idDossier; + $docAttestation->DATE_DOCAJOUT = '0000-00-00'; $docAttestation->save(); } } @@ -940,11 +950,11 @@ public function saveAction() $service_prescription = new Service_Prescriptions; $service_dossier = new Service_Dossier; if($this->_getParam('do') == 'new'){ - if($this->_getParam("TYPE_DOSSIER") == 1 ){ - $listePrescRegl = $service_prescription->getPrescriptions('etude',true); - $service_dossier->savePrescriptionRegl($idDossier,$listePrescRegl); - }else if($this->_getParam("TYPE_DOSSIER") == 2 || $this->_getParam("TYPE_DOSSIER") == 3){ - $listePrescRegl = $service_prescription->getPrescriptions('visite',true); + if($this->_getParam("TYPE_DOSSIER") == 1 ) { + $listePrescRegl = $service_prescription->getPrescriptions('etude', true); + $service_dossier->savePrescriptionRegl($idDossier,$listePrescRegl); + } else if ($this->_getParam("TYPE_DOSSIER") == 2 || $this->_getParam("TYPE_DOSSIER") == 3){ + $listePrescRegl = $service_prescription->getPrescriptions('visite', true); $service_dossier->savePrescriptionRegl($idDossier,$listePrescRegl); } } @@ -1186,7 +1196,7 @@ public function saveAction() && ($this->_getParam("AVIS_DOSSIER_COMMISSION") == 1 || $this->_getParam("AVIS_DOSSIER_COMMISSION") == 2) && $service_dossier->isDossierDonnantAvis($nouveauDossier, $idNature)) { - if ($this->_getParam('do') == 'new') { + if ($this->_getParam('do') == 'new' && $this->_getParam('idEtablissement')) { $listeEtab = array(array( 'ID_ETABLISSEMENT' => $this->_getParam('idEtablissement'), )); @@ -1194,10 +1204,43 @@ public function saveAction() $listeEtab = $DBetablissementDossier->getEtablissementListe($idDossier); } + $cache = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('cache'); + $mygroupe = Zend_Auth::getInstance()->getIdentity()['group']['LIBELLE_GROUPE']; + $service_ets = new Service_Etablissement; + $arrayEtsAvis = array(); + if (unserialize($cache->load('acl'))->isAllowed($mygroupe, "alerte_email", "alerte_avis") + && getenv('PREVARISC_MAIL_ENABLED') && getenv('PREVARISC_MAIL_ENABLED') == 1) { + foreach($listeEtab as $etab) { + $currentEts = $service_ets->get($etab['ID_ETABLISSEMENT']); + if ($currentEts) { + $arrayEtsAvis[$etab['ID_ETABLISSEMENT']]['avis'] = $currentEts['avis']; + $arrayEtsAvis[$etab['ID_ETABLISSEMENT']]['libelle'] = + $currentEts['informations']['LIBELLE_ETABLISSEMENTINFORMATIONS']; + } + } + } + $dbEtab = new Model_DbTable_Etablissement(); $updatedEtab = $service_dossier->saveDossierDonnantAvis($nouveauDossier, $listeEtab, $cache, $this->_getParam('repercuterAvis')); - + if (unserialize($cache->load('acl'))->isAllowed($mygroupe, "alerte_email", "alerte_avis") + && getenv('PREVARISC_MAIL_ENABLED') && getenv('PREVARISC_MAIL_ENABLED') == 1) { + $service_alerte = new Service_Alerte; + foreach($updatedEtab as $upEts) { + if ($upEts['ID_DOSSIER_DONNANT_AVIS'] === $nouveauDossier['ID_DOSSIER'] + && $nouveauDossier['AVIS_DOSSIER_COMMISSION'] !== + $arrayEtsAvis[$upEts['ID_ETABLISSEMENT']]['avis']) { + $options = $service_alerte->getLink(2, $upEts["ID_ETABLISSEMENT"]); + $this->_helper->flashMessenger(array( + 'context' => 'success', + 'title' => 'Mise à jour réussie !', 'message' => 'L\'établissement ' + . $arrayEtsAvis[$upEts['ID_ETABLISSEMENT']]['libelle'] + . ' a bien été mis à jour.' . $options)); + } + + } + } + // AVERTISSEMENT SUR L'OUVERTURE D'UN ETABLISSEMENT A EFFECTUER // Dans le cas d'une visite avant ouverture avec avis de commission positif if ($this->_getParam("AVIS_DOSSIER_COMMISSION") == 1 && in_array($idNature, array(47, 48))) @@ -1435,7 +1478,7 @@ public function docconsulteAction() } } elseif (1 == $dossierType['TYPE_DOSSIER']) { //cas d'une etude - if($nature['ID_NATURE'] == 19){ + if($nature['ID_NATURE'] == 19 || $nature['ID_NATURE'] == 7){ $listeDocConsulte[$nature["ID_NATURE"]] = $dblistedoc->getDocVisite(); }else{ $listeDocConsulte[$nature["ID_NATURE"]] = $dblistedoc->getDocEtude(); @@ -1511,7 +1554,7 @@ public function validdocAction() $date = "0000-00-00"; } $ref = str_replace("\"","''",$_POST['ref_'.$idValid]); - $libelle = $_POST['libelle_'.$idValid]; + $libelle = isset($_POST['libelle_'.$idValid]) ? $_POST['libelle_'.$idValid] : ""; //on définit s'il sagid d'un doc ajouté ou nom $tabNom = explode("_",$idValid); @@ -1631,10 +1674,18 @@ public function deleteetablissementAction() $cache = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('cache'); $deleteEtabDossier = $DBetablissementDossier->find($this->_getParam("idEtabDossier"))->current(); + if (!$deleteEtabDossier) { + $this->_helper->flashMessenger(array( + 'context' => 'warning', + 'title' => "L'établissement n'est pas lié à ce dossier.", + 'message' => '', + )); + return ; + } + $idEtablissement = $deleteEtabDossier['ID_ETABLISSEMENT']; $idDossier = $deleteEtabDossier['ID_DOSSIER']; $etablissement = $dbEtab->find($idEtablissement)->current(); - $deleteEtabDossier->delete(); $this->_helper->flashMessenger(array( @@ -1752,7 +1803,7 @@ public function rapportAction(){ $pathBase = REAL_DATA_PATH . DS . "uploads" . DS . "documents"; //Récupération des documents présents dans le dossier 0. Documents visibles après vérrouillage - $pathVer = $pathBase."/0"; + $pathVer = $pathBase. DS . "0"; $dirVer = opendir($pathVer) or die('Erreur de listage : le répertoire n\'existe pas'); $fichierVer = array(); $dossierVer = array(); @@ -2182,7 +2233,12 @@ public function creationdocAction($idDossier, $idEtab, $commission) $listeDocConsulte = $dblistedoc->getDocVisite(); } } elseif (1 == $dossierType['TYPE_DOSSIER']) { - $listeDocConsulte = $dblistedoc->getDocEtude(); + //cas d'une etude + if($dossierNature['ID_NATURE'] == 19 || $dossierNature['ID_NATURE'] == 7){ + $listeDocConsulte = $dblistedoc->getDocVisite(); + }else{ + $listeDocConsulte = $dblistedoc->getDocEtude(); + } } else { $listeDocConsulte = 0; } @@ -2211,14 +2267,17 @@ public function creationdocAction($idDossier, $idEtab, $commission) //On récupère toutes les cellules $idDateCommAffect = $affectDossier['ID_DATECOMMISSION_AFFECT']; $listeDossierConcerne = $dbAffectDossier->getDossierNonAffect($idDateCommAffect); + if(isset($affectDossier['ID_DATECOMMISSION_AFFECT']) && $affectDossier['ID_DATECOMMISSION_AFFECT'] != ''){ $cptIdArray = 0; foreach($listeDossierConcerne as $dossier){ + $listeDossierConcerne[$cptIdArray]['regl'] = $service_dossier->getPrescriptions((int) $dossier['ID_DOSSIER'],0); $listeDossierConcerne[$cptIdArray]['exploit'] = $service_dossier->getPrescriptions((int) $dossier['ID_DOSSIER'],1); $listeDossierConcerne[$cptIdArray]['amelio'] = $service_dossier->getPrescriptions((int) $dossier['ID_DOSSIER'],2); $cptIdArray++; } + $this->view->celluleDossier = $listeDossierConcerne; } }elseif($this->view->id_typeactivite == 29 && in_array($dossierNature["ID_NATURE"], $natureCCL) && !$this->_getParam("repriseCC")){ @@ -2316,7 +2375,12 @@ public function creationdocAction($idDossier, $idEtab, $commission) $nouvellePJ->ID_PIECEJOINTE = $this->view->idPieceJointe; $nouvellePJ->NOM_PIECEJOINTE = substr(basename($this->view->fichierSelect), 0, strlen(basename($this->view->fichierSelect)) - 3); $nouvellePJ->EXTENSION_PIECEJOINTE = ".odt"; - $nouvellePJ->DESCRIPTION_PIECEJOINTE = "Rapport de l'établissement ".$object_informations['LIBELLE_ETABLISSEMENTINFORMATIONS']." généré le ".$dateDuJour->get(Zend_Date::DAY."/".Zend_Date::MONTH."/".Zend_Date::YEAR)." à ".$dateDuJour->get(Zend_Date::HOUR.":".Zend_Date::MINUTE); + $nouvellePJ->DESCRIPTION_PIECEJOINTE = sprintf("Rapport de l'établissement %s (%s) généré le %s à %s", + $object_informations['LIBELLE_ETABLISSEMENTINFORMATIONS'], + $etablissement['NUMEROID_ETABLISSEMENT'], + $dateDuJour->get(Zend_Date::DAY."/".Zend_Date::MONTH."/".Zend_Date::YEAR), + $dateDuJour->get(Zend_Date::HOUR.":".Zend_Date::MINUTE) + ); $nouvellePJ->DATE_PIECEJOINTE = $dateDuJour->get(Zend_Date::YEAR."-".Zend_Date::MONTH."-".Zend_Date::DAY); $nouvellePJ->save(); @@ -2495,10 +2559,11 @@ public function prescriptionAction() public function prescriptionwordsearchAction() { + $this->view->tabMotCles = array(); if ($this->_getParam('motsCles')) { - $tabMotCles = explode(" ", $this->_getParam('motsCles')); + $this->view->tabMotCles = explode(" ", $this->_getParam('motsCles')); $dbPrescType = new Model_DbTable_PrescriptionType(); - $listePrescType = $dbPrescType->getPrescriptionTypeByWords($tabMotCles); + $listePrescType = $dbPrescType->getPrescriptionTypeByWords($this->view->tabMotCles); $dbPrescAssoc = new Model_DbTable_PrescriptionTypeAssoc(); $prescriptionArray = array(); @@ -2586,7 +2651,8 @@ public function prescriptionaddtypeAction() $idPrescType = $this->_getParam('idPrescType'); $idDossier = $this->_getParam('idDossier'); $this->view->typePrescDossier = $this->_getParam('typePrescriptionDossier'); - + $this->view->idDossier = $idDossier; + //on recup le num max de prescription du dossier $dbPrescDossier = new Model_DbTable_PrescriptionDossier(); $numMax = $dbPrescDossier->recupMaxNumPrescDossier($idDossier, $this->_getParam('typePrescriptionDossier')); @@ -2629,6 +2695,7 @@ public function prescriptionaddtypeAction() $listeExploit = $dbPrescDossier->recupPrescDossier($idDossier, 1); foreach($listeExploit as $prescDossier){ $prescCount = $dbPrescDossier->find($prescDossier['ID_PRESCRIPTION_DOSSIER'])->current(); + if (!$prescCount) continue; $prescCount->NUM_PRESCRIPTION_DOSSIER = $nbPresc; $prescCount->save(); $nbPresc++; @@ -2637,6 +2704,7 @@ public function prescriptionaddtypeAction() $listeAmelio = $dbPrescDossier->recupPrescDossier($idDossier, 2); foreach($listeAmelio as $prescDossier){ $prescCount = $dbPrescDossier->find($prescDossier['ID_PRESCRIPTION_DOSSIER'])->current(); + if (!$prescCount) continue; $prescCount->NUM_PRESCRIPTION_DOSSIER = $nbPresc; $prescCount->save(); $nbPresc++; @@ -2742,4 +2810,31 @@ public function deverrouAction() $lockDosier->save(); echo $lockDosier->ID_DOSSIER; } + + //GESTION DE LA SUPPRESSION + public function deleteAction() + { + try { + + $service_dossier = new Service_Dossier(); + $service_dossier->delete($this->_getParam("id")); + + // Récupération de la ressource cache à partir du bootstrap + $cache = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('cacheSearch'); + $cache->clean(Zend_Cache::CLEANING_MODE_ALL); + + $this->_helper->flashMessenger(array( + 'context' => 'success', + 'title' => 'Mise à jour réussie !', + 'message' => 'Le dossier a bien été supprimé.', + )); + $this->redirect("/search/dossier?objet=&page=1");; + } catch (Exception $e) { + $this->_helper->flashMessenger(array( + 'context' => 'error', + 'title' => '', + 'message' => 'L\'établissement n\'a pas été mis à jour. Veuillez rééssayez. (' . $e->getMessage() .')', + )); + } + } } diff --git a/application/controllers/EtablissementController.php b/application/controllers/EtablissementController.php index 61205b78..ee6aedbd 100755 --- a/application/controllers/EtablissementController.php +++ b/application/controllers/EtablissementController.php @@ -5,6 +5,7 @@ class EtablissementController extends Zend_Controller_Action public function indexAction() { $this->_helper->layout->setLayout('etablissement'); + $this->view->headScript()->appendFile('/js/tinymce.min.js'); $service_etablissement = new Service_Etablissement; $service_groupement_communes = new Service_GroupementCommunes; @@ -15,6 +16,7 @@ public function indexAction() $this->view->couches_cartographiques = $service_carto->getAll(); $this->view->key_ign = getenv('PREVARISC_PLUGIN_IGNKEY'); $this->view->key_googlemap = getenv('PREVARISC_PLUGIN_GOOGLEMAPKEY'); + $this->view->geoconcept_url = getenv('PREVARISC_PLUGIN_GEOCONCEPT_URL'); $this->view->etablissement = $etablissement; $this->view->default_periodicite = $DB_periodicite->gn4ForEtablissement($etablissement); @@ -23,6 +25,10 @@ public function indexAction() $this->view->avis = $service_etablissement->getAvisEtablissement($etablissement['general']['ID_ETABLISSEMENT'], $etablissement['general']['ID_DOSSIER_DONNANT_AVIS']); $this->view->store = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('dataStore'); + + $cache = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('cache'); + // Autorisation de suppression de l'établissement + $this->view->is_allowed_delete_etablissement = unserialize($cache->load('acl'))->isAllowed(Zend_Auth::getInstance()->getIdentity()['group']['LIBELLE_GROUPE'], "suppression", "delete_etablissement"); } public function editAction() @@ -35,10 +41,13 @@ public function editAction() $etablissement = $service_etablissement->get($this->_request->id); $this->view->avis = $service_etablissement->getAvisEtablissement($etablissement['general']['ID_ETABLISSEMENT'], $etablissement['general']['ID_DOSSIER_DONNANT_AVIS']); - + $this->view->etablissement = $etablissement; $this->view->key_ign = getenv('PREVARISC_PLUGIN_IGNKEY'); + $this->view->geoconcept_url = getenv('PREVARISC_PLUGIN_GEOCONCEPT_URL'); + $this->view->default_lon = getenv('PREVARISC_CARTO_DEFAULT_LON') ? : "2.71490430425517"; + $this->view->default_lat = getenv('PREVARISC_CARTO_DEFAULT_LAT') ? : "50.4727273438818"; $service_genre = new Service_Genre; $service_statut = new Service_Statut; @@ -63,9 +72,8 @@ public function editAction() $this->view->DB_famille = $service_famille->getAll(); $this->view->DB_classe = $service_classe->getAll(); $this->view->DB_classement = $service_classement->getAll(); - + $this->view->couches_cartographiques = $service_carto->getAll(); - $this->view->key_ign = getenv('PREVARISC_PLUGIN_IGNKEY'); $this->view->add = false; @@ -76,9 +84,21 @@ public function editAction() if($this->_request->isPost()) { try { $post = $this->_request->getPost(); + $options = ''; + if (getenv('PREVARISC_MAIL_ENABLED') && getenv('PREVARISC_MAIL_ENABLED') == 1) { + $typeAlerte = $service_etablissement->checkAlerte($etablissement, $post); + + if (unserialize($cache->load('acl'))->isAllowed($mygroupe, "alerte_email", "alerte_statut", "alerte_classement")) { + if ($typeAlerte !== false) { + $service_alerte = new Service_Alerte; + $options = $service_alerte->getLink($typeAlerte); + } + } + } + $date = date("Y-m-d"); $service_etablissement->save($post['ID_GENRE'], $post, $this->_request->id, $date); - $this->_helper->flashMessenger(array('context' => 'success', 'title' => 'Mise à jour réussie !', 'message' => 'L\'établissement a bien été mis à jour.')); + $this->_helper->flashMessenger(array('context' => 'success', 'title' => 'Mise à jour réussie !', 'message' => 'L\'établissement a bien été mis à jour.' . $options)); $this->_helper->redirector('index', null, null, array('id' => $this->_request->id)); } catch(Exception $e) { @@ -101,6 +121,7 @@ public function addAction() $service_famille = new Service_Famille; $service_classe = new Service_Classe; $service_classement = new Service_Classement; + $service_carto = new Service_Carto; $this->view->DB_genre = $service_genre->getAll(); $this->view->DB_statut = $service_statut->getAll(); @@ -115,8 +136,12 @@ public function addAction() $this->view->DB_classement = $service_classement->getAll(); $this->view->add = true; - + $this->view->key_ign = getenv('PREVARISC_PLUGIN_IGNKEY'); + $this->view->geoconcept_url = getenv('PREVARISC_PLUGIN_GEOCONCEPT_URL'); + $this->view->default_lon = getenv('PREVARISC_CARTO_DEFAULT_LON') ? : "2.71490430425517"; + $this->view->default_lat = getenv('PREVARISC_CARTO_DEFAULT_LAT') ? : "50.4727273438818"; + $this->view->couches_cartographiques = $service_carto->getAll(); $cache = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('cache'); $mygroupe = Zend_Auth::getInstance()->getIdentity()['group']['LIBELLE_GROUPE']; @@ -434,4 +459,30 @@ public function historiqueAction() $this->view->historique = $service_etablissement->getHistorique($this->_request->id); } + + public function deleteAction() + { + try { + + $idEtablissement = $this->_getParam("id"); + + // On supprime les dossiers de l'établissement + $service_dossier = new Service_Dossier(); + $service_dossier->deleteByEtab($idEtablissement); + + // On supprime l'établissement + $service_etablissement = new Service_Etablissement(); + $service_etablissement->delete($idEtablissement); + + // Récupération de la ressource cache à partir du bootstrap + $cache = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('cacheSearch'); + $cache->clean(Zend_Cache::CLEANING_MODE_ALL); + + $this->_helper->flashMessenger(array('context' => 'success', 'title' => 'Mise à jour réussie !', 'message' => 'L\'établissement a bien été supprimé.')); + $this->redirect("/search/etablissement?label=&page=1"); + } + catch(Exception $e) { + $this->_helper->flashMessenger(array('context' => 'error','title' => '','message' => 'L\'établissement n\'a pas été supprimé. Veuillez rééssayez. (' . $e->getMessage() . ')')); + } + } } diff --git a/application/controllers/GestionDesCommunesController.php b/application/controllers/GestionDesCommunesController.php index 4191300c..244702b2 100755 --- a/application/controllers/GestionDesCommunesController.php +++ b/application/controllers/GestionDesCommunesController.php @@ -33,6 +33,8 @@ public function displayAction() public function saveAction() { try { + if(isset($_POST["ID_UTILISATEURCIVILITE"]) && $_POST["ID_UTILISATEURCIVILITE"] == "null") + unset($_POST["ID_UTILISATEURCIVILITE"]); $this->_helper->viewRenderer->setNoRender(); diff --git a/application/controllers/GestionDesDocumentsController.php b/application/controllers/GestionDesDocumentsController.php index 634dcf5a..dbb28b37 100755 --- a/application/controllers/GestionDesDocumentsController.php +++ b/application/controllers/GestionDesDocumentsController.php @@ -60,27 +60,6 @@ public function indexAction() $this->view->path = DATA_PATH . "/uploads/documents"; $this->view->liste_commission = $liste_commission; - - - -/* - //on liste les documents présents dans $path déclaré global pour le controller - $path = $this->path; // dossier listé (pour lister le répertoir courant : $dir_nom = '.' --> ('point') - $dir = opendir($path) or die('Erreur de listage : le répertoire n\'existe pas'); // on ouvre le contenu du dossier courant - $fichier= array(); // on déclare le tableau contenant le nom des fichiers - $dossier= array(); // on déclare le tableau contenant le nom des dossiers - - while ($element = readdir($dir)) { - if ($element != '.' && $element != '..') { - if($element != '.gitignore') - if (!is_dir($path.DS.$element)) {$fichier[] = $element;} else {$dossier[] = $element;} - } - } - closedir($dir); - sort($fichier); - $this->view->path = DATA_PATH . "/uploads/documents"; - $this->view->listeFichiers = $fichier; -*/ } public function formAction() @@ -93,22 +72,27 @@ public function formAction() public function addAction() { try { + + $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); + + // Extension du fichier + $filename = str_replace(DS, '', $_FILES['fichier']['name']); + $extension = strtolower(strrchr($filename, ".")); + if (!in_array($extension, array('.odt'))) { + throw new Exception("Seuls les fichiers .odt sont autorisés en upload."); + } + //Si besoin verificaiton de l'extension du fichier (uniquement odt) - if (move_uploaded_file($_FILES['fichier']['tmp_name'], $this->path . DS. $this->_getParam('commission') .DS. $_FILES['fichier']['name'])) { - // Echappement des "backslashes" si le serveur est une machine Windows (Dossier\Fichier => DossierFichier) - $filePath = str_replace("\\", "\\\\", $this->_getParam('commission') . DS . $_FILES['fichier']['name']); - echo " - - "; + if (!move_uploaded_file($_FILES['fichier']['tmp_name'], $this->path . DS. $this->_getParam('commission') .DS. $filename)) { + throw new Exception('Impossible de déplacer le fichier uploadé'); } $this->_helper->flashMessenger(array( 'context' => 'success', 'title' => 'Le document a bien été ajouté', 'message' => '' )); + } catch (Exception $e) { $this->_helper->flashMessenger(array( 'context' => 'error', @@ -116,32 +100,30 @@ public function addAction() 'message' => $e->getMessage() )); } - } - - public function checkAction() - { - //On verifie si le fichier existe - $this->view->exists = file_exists( $this->path .DS. $this->_request->nomFich); + echo ' + + '; } public function suppdocAction() { try { + $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $path = $this->path.DS.$this->_getParam('idCommission'); + + $filename = str_replace(DS, '', $this->_getParam('name')); + //On verifie si le fichier existe - $exist = file_exists( $path .DS. $this->_getParam('name')); - unlink($path .DS. $this->_getParam('name')); - $exist2 = file_exists( $path .DS. $this->_getParam('name')); - - if ($exist != $exist2) { - echo "le fichier ".$this->_getParam('name')." a bien été supprimé"; - $this->_helper->flashMessenger(array( - 'context' => 'success', - 'title' => 'Le document '.$this->_getParam('name').' a bien été supprimé', - 'message' => '' - )); + $exist = file_exists($path .DS. $filename); + unlink($path .DS. $filename); + $exist2 = file_exists($path .DS. $filename); + + if ($exist == $exist2) { + throw new Exception('Impossible de supprimer le fichier '.$filename); } } catch (Exception $e) { $this->_helper->flashMessenger(array( @@ -149,6 +131,7 @@ public function suppdocAction() 'title' => 'Erreur lors de la suppression du document', 'message' => $e->getMessage() )); + echo $e->getMessage(); } } diff --git a/application/controllers/PieceJointeController.php b/application/controllers/PieceJointeController.php index 7d4d82e8..8732bee6 100755 --- a/application/controllers/PieceJointeController.php +++ b/application/controllers/PieceJointeController.php @@ -25,7 +25,7 @@ public function indexAction() $this->view->identifiant = $this->_request->id; $this->view->pjcomm = $this->_request->pjcomm; $listePj = $DBused->affichagePieceJointe("dossierpj", "dossierpj.ID_DOSSIER", $this->_request->id); - $this->view->verrou = $this->_request->verrou; + $this->view->verrou = $this->_request->verrou; } // Cas établissement @@ -79,7 +79,7 @@ public function getAction() $piece_jointe = $DBused->affichagePieceJointe("datecommissionpj", "piecejointe.ID_PIECEJOINTE", $this->_request->idpj); } - if (!$piece_jointe || count($piece_jointe) != 1) { + if (!$piece_jointe || count($piece_jointe) == 0) { throw new Zend_Controller_Action_Exception('Cannot find piece jointe for id '.$this->_request->idpj, 404); } @@ -91,23 +91,20 @@ public function getAction() $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); - if (!is_readable($filepath)) { + if (!is_readable($filepath)) { throw new Zend_Controller_Action_Exception('Cannot read file '.$filepath, 404); } - + + ob_get_clean(); + header("Pragma: public"); header("Expires: -1"); header("Cache-Control: public, must-revalidate, post-check=0, pre-check=0"); header('Content-Disposition: attachment; filename="'.$filename.'"'); header("Content-Type: application/octet-stream"); - $handle = fopen($filepath, "r"); - if ($handle) { - while (($buffer = fgets($handle, 4096)) !== false) { - echo $buffer; - } - fclose($handle); - } + readfile($filepath); + exit(); } @@ -141,8 +138,11 @@ public function addAction() } // Extension du fichier - $extension = strrchr($_FILES['fichier']['name'], "."); - + $extension = strtolower(strrchr($_FILES['fichier']['name'], ".")); + if (in_array($extension, array('.php', '.php4', '.php5', '.sh', '.ksh', '.csh'))) { + throw new Exception("Ce type de fichier n'est pas autorisé en upload"); + } + // Date d'aujourd'hui $dateNow = new Zend_Date(); @@ -263,7 +263,6 @@ public function deleteAction() // On récupère la pièce jointe $pj = $DBpieceJointe->find($this->_request->id_pj)->current(); -// var_dump($pj);exit(); // Selon le type, on fixe le modèle à utiliser switch ($this->_request->type) { @@ -281,7 +280,7 @@ public function deleteAction() } // On supprime dans la BDD et physiquement - if ($DBitem != null) { + if ($pj != null && $DBitem != null) { $file_path = $this->store->getFilePath($pj, $this->_request->type, $this->_request->id); $miniature_pj = $pj; diff --git a/application/controllers/SearchController.php b/application/controllers/SearchController.php index 23e535b3..5507fb14 100755 --- a/application/controllers/SearchController.php +++ b/application/controllers/SearchController.php @@ -45,8 +45,9 @@ public function etablissementAction() $local_sommeil = array_key_exists('presences_local_sommeil', $parameters) && count($parameters['presences_local_sommeil']) == 1 ? $parameters['presences_local_sommeil'][0] == 'true' : null; $city = array_key_exists('city', $parameters) && $parameters['city'] != '' ? $parameters['city'] : null; $street = array_key_exists('street', $parameters) && $parameters['street'] != '' ? $parameters['street'] : null; + $number = array_key_exists('number', $parameters) && $parameters['number'] != '' ? $parameters['number'] : null; - $search = $service_search->etablissements($label, $identifiant, $genres, $categories, $classes, $familles, $types_activites, $avis_favorable, $statuts, $local_sommeil, null, null, null, $city, $street, 50, $page); + $search = $service_search->etablissements($label, $identifiant, $genres, $categories, $classes, $familles, $types_activites, $avis_favorable, $statuts, $local_sommeil, null, null, null, $city, $street, $number, 50, $page); $paginator = new Zend_Paginator(new SDIS62_Paginator_Adapter_Array($search['results'], $search['search_metadata']['count'])); $paginator->setItemCountPerPage(50)->setCurrentPageNumber($page)->setDefaultScrollingStyle('Elastic'); @@ -54,7 +55,7 @@ public function etablissementAction() $this->view->results = $paginator; } catch(Exception $e) { - $this->_helper->flashMessenger(array('context' => 'error','title' => 'Problème de recherche','message' => 'La recherche n\'a pas été effectué correctement. Veuillez rééssayez. (' . $e->getMessage() . ')')); + $this->_helper->flashMessenger(array('context' => 'error','title' => 'Problème de recherche','message' => 'La recherche n\'a pas été effectuée correctement. Veuillez réessayer. (' . $e->getMessage() . ')')); } } } @@ -142,25 +143,38 @@ public function utilisateurAction() } } } + + public function displayAjaxSearchEtablissementAction() + { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(true); + + $service_search = new Service_Search; + + $data = $service_search->etablissements(null, null, null, null, null, null, null, null, null, null, null, null, $this->_request->parent, null, null, null); + + $data = $data['results']; + + $html = ""; - public function displayAjaxSearchAction() + echo $html; + } + + public function displayAjaxSearchDossierAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); $service_search = new Service_Search; - if($this->_request->items == 'etablissement') { - $data = $service_search->etablissements(null, null, null, null, null, null, null, null, null, null, null, null, $this->_request->parent, null, null, 1000); - } - else { - $data = $service_search->dossiers(null, null, null, $this->_request->parent, null, 100); - } + $data = $service_search->dossiers(null, null, null, $this->_request->parent, null, 100); $data = $data['results']; $html = ""; echo $html; diff --git a/application/controllers/SessionController.php b/application/controllers/SessionController.php index 0540ba0c..90e10d74 100755 --- a/application/controllers/SessionController.php +++ b/application/controllers/SessionController.php @@ -6,20 +6,19 @@ public function loginAction() { $this->_helper->layout->setLayout('login'); - $form = new Form_Login; - $service_user = new Service_User; + $form = new Form_Login(); + $service_user = new Service_User(); $username = null; + $password = ""; + $user = null; $this->view->form = $form; try { - - $username = null; - $password = ""; - // Adaptateur CAS if (getenv('PREVARISC_CAS_ENABLED') == 1) { $username = phpCAS::getUser(); - + + // Adapter NTLM } else if (getenv('PREVARISC_NTLM_ENABLED') == 1) { if (!isset($_SERVER['REMOTE_USER'])) { @@ -29,27 +28,29 @@ public function loginAction() if (count($cred) == 1) array_unshift($cred, null); list($domain, $username) = $cred; } - - } - if ($this->_request->isPost()) { + // Cas par défaut + } else if ($this->_request->isPost()) { if (!$form->isValid($this->_request->getPost())) { - throw new Zend_Auth_Exception('Données invalides.'); + error_log("Auth: formulaire classique invalide"); + throw new Zend_Auth_Exception('Authentification invalide.'); } + // Identifiants $username = $this->_request->prevarisc_login_username; $password = $this->_request->prevarisc_login_passwd; } if ($username) { - + // Récupération de l'utilisateur $user = $service_user->findByUsername($username); // Si l'utilisateur n'est pas actif, on renvoie false if ($user === null || ($user !== null && !$user['ACTIF_UTILISATEUR'])) { - throw new Exception('L\'utilisateur n\'existe pas ou n\'est pas actif.'); + error_log("Auth: utilisateur inexistant ou inactif '$username'"); + throw new Zend_Auth_Exception('Authentification invalide.'); } // Authentification adapters @@ -58,6 +59,20 @@ public function loginAction() // Adaptateur SSO noauth if (getenv('PREVARISC_CAS_ENABLED') == 1 || getenv('PREVARISC_NTLM_ENABLED') == 1 ) { $adapters['sso'] = new Service_PassAuthAdapater($username); + + // Cas classique s'il y a déjà eu des login infructueux + // Système anti-dos, anti-bruteforce : si pas l'ip habituelle, on drop la requête + } else if (getenv('PREVARISC_ENFORCE_SECURITY') == 1 + && isset($user['FAILED_LOGIN_ATTEMPTS_UTILISATEUR']) + && $user['FAILED_LOGIN_ATTEMPTS_UTILISATEUR'] >= 2 + && isset($user['IP_UTILISATEUR']) + && $user['IP_UTILISATEUR'] + ) { + if ($user['IP_UTILISATEUR'] != $_SERVER['REMOTE_ADDR']) { + error_log("Auth: trop d'essais infructeurs, denying IP ".$_SERVER['REMOTE_ADDR']." which does not match last login IP ".$user['IP_UTILISATEUR']); + throw new Zend_Auth_Exception('Authentification invalide.'); + } + } // Adaptateur principal (dbtable) @@ -73,21 +88,26 @@ public function loginAction() $adapters['ldap']->setLdap($ldap); $adapters['ldap']->setUsername($ldap->getCanonicalAccountName($username, $accountForm)); $adapters['ldap']->setPassword($password); - } catch (Exception $e) {} + } catch (Exception $e) { + error_log("Auth: ldap exception: ".$e->getMessage()); + } } // On lance le process d'identification avec les différents adaptateurs foreach ($adapters as $key => $adapter) { if ($adapter->authenticate()->isValid()) { - $storage = Zend_Auth::getInstance()->getStorage()->write($user); + $service_user->resetFailedLogin($user); + Zend_Auth::getInstance()->getStorage()->write($user); $this->_helper->redirector->gotoUrl(empty($this->_request->getParams()["redirect"]) ? '/' : urldecode($this->_request->getParams()["redirect"])); } } - - throw new Exception('Les identifiants ne correspondent pas.'); + + error_log("Auth: password incorrect pour '$username'"); + throw new Zend_Auth_Exception('Authentification invalide.'); } } catch (Exception $e) { + $service_user->logFailedLogin($user); $this->_helper->flashMessenger(array('context' => 'danger', 'title' => 'Erreur d\'authentification', 'message' => $e->getMessage())); } } @@ -95,7 +115,9 @@ public function loginAction() public function logoutAction() { $auth = Zend_Auth::getInstance(); - + + $user = $auth->getIdentity(); + if($auth->hasIdentity()) { $service_user = new Service_User; @@ -106,6 +128,9 @@ public function logoutAction() if (getenv('PREVARISC_CAS_ENABLED') == 1) { phpCAS::logout(); + // On test si l'utilisateur est connecté en NTLM + } else if (getenv('PREVARISC_NTLM_ENABLED') == 1 && $user && $user['PASSWD_UTILISATEUR'] == null) { + $this->_helper->layout->setLayout('error'); } else { $this->_helper->redirector->gotoUrl($this->view->url(array("controller" => null, "action" => null))); } diff --git a/application/controllers/UsersController.php b/application/controllers/UsersController.php index 07c3af17..4e76f04e 100755 --- a/application/controllers/UsersController.php +++ b/application/controllers/UsersController.php @@ -30,7 +30,9 @@ public function editAction() $this->view->fonctions = $service_user->getAllFonctions(); $this->view->communes = $service_adresse->getAllCommunes(); $this->view->groupes = $service_user->getAllGroupes(); - $this->view->params = array("LDAP_ACTIF" => getenv('PREVARISC_LDAP_ENABLED')); + $this->view->params = array("LDAP_ACTIF" => getenv('PREVARISC_LDAP_ENABLED') + || getenv('PREVARISC_NTLM_ENABLED') + || getenv('PREVARISC_CAS_ENABLED')); $this->view->add = false; @@ -61,7 +63,9 @@ public function addAction() $this->view->fonctions = $service_user->getAllFonctions(); $this->view->communes = $service_adresse->getAllCommunes(); $this->view->groupes = $service_user->getAllGroupes(); - $this->view->params = array("LDAP_ACTIF" => getenv('PREVARISC_LDAP_ENABLED')); + $this->view->params = array("LDAP_ACTIF" => getenv('PREVARISC_LDAP_ENABLED') + || getenv('PREVARISC_NTLM_ENABLED') + || getenv('PREVARISC_CAS_ENABLED')); $this->view->add = true; diff --git a/application/forms/Login.php b/application/forms/Login.php index 1b16f33e..be9c1449 100755 --- a/application/forms/Login.php +++ b/application/forms/Login.php @@ -14,15 +14,30 @@ public function init() 'placeholder' => 'Nom d\'utilisateur', 'required' => true, 'filters' => array(new Zend_Filter_HtmlEntities, new Zend_Filter_StripTags), - 'validators' => array(new Zend_Validate_StringLength(1,255)) + 'validators' => array(new Zend_Validate_StringLength(1,255)), + 'autocomplete' => getenv('PREVARISC_ENFORCE_SECURITY') ? 'off' : 'on', )); + $password_validators = array( + new Zend_Validate_StringLength(1,255), + ); + + if (getenv('PREVARISC_ENFORCE_SECURITY') == 1) { + $regex_validator = new Zend_Validate_Regex('/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*\W)[a-zA-Z\d\W]{8,}$/'); + $regex_validator->setMessage( + "Votre mot de passe doit contenir au moins 8 caractères " + . "dont 1 minuscule, 1 majuscule, 1 chiffre et 1 caractère spécial. " + . "Si celui-ci est définit dans un système externe à Prévarisc, merci de le changer dans ce système.", + Zend_Validate_Regex::NOT_MATCH); + $password_validators[] = $regex_validator; + } + $this->addElement('password', 'prevarisc_login_passwd', array( 'label' => 'Mot de passe', 'placeholder' => 'Mot de passe', 'required' => true, 'filters' => array(new Zend_Filter_HtmlEntities, new Zend_Filter_StripTags), - 'validators' => array(new Zend_Validate_StringLength(1,255)) + 'validators' => $password_validators, )); $this->addElement(new Zend_Form_Element_Submit("Connexion", array("class" => "btn btn-primary")), 'submit'); diff --git a/application/layouts/dossier.phtml b/application/layouts/dossier.phtml index fd0f633b..50198de0 100755 --- a/application/layouts/dossier.phtml +++ b/application/layouts/dossier.phtml @@ -85,6 +85,11 @@ Afficher ordre du jour + is_allowed_delete_dossier) : ?> +
  • + Supprimer le dossier +
  • + placeholder('lateral_navigation')->captureEnd(); endif; ?> diff --git a/application/layouts/error.phtml b/application/layouts/error.phtml index 648340da..5fcef9a6 100755 --- a/application/layouts/error.phtml +++ b/application/layouts/error.phtml @@ -13,10 +13,6 @@ layout()->content ?> -

    - Revenir sur l'accueil -

    - diff --git a/application/layouts/etablissement.phtml b/application/layouts/etablissement.phtml index b1f01e05..68da1c30 100755 --- a/application/layouts/etablissement.phtml +++ b/application/layouts/etablissement.phtml @@ -12,7 +12,12 @@
  • Afficher l'historique
  • 'dossier', 'action' => 'add', 'id_etablissement' => $this->etablissement['general']['ID_ETABLISSEMENT']), null, true)?> '> Ajouter un dossier
  • - + is_allowed_delete_etablissement): ?> +
  • + Supprimer l'établissement +
  • + + placeholder('lateral_navigation')->captureEnd(); ?> placeholder('before_content')->captureStart(); // Capture du 'before_content' ?> diff --git a/application/layouts/includes/nav-main.phtml b/application/layouts/includes/nav-main.phtml index 5d2530cf..51ec0ca7 100755 --- a/application/layouts/includes/nav-main.phtml +++ b/application/layouts/includes/nav-main.phtml @@ -65,6 +65,7 @@ } }, minChars: 3, + cacheLength: 0, width: 500, parse: function(data) { return $.map(data["response"]["results"], function(row) { @@ -90,9 +91,12 @@ LIBELLE_COMMUNE = item.LIBELLE_COMMUNE_ADRESSE_DEFAULT; } - - - return "[" + item.LIBELLE_GENRE + "] " + item.LIBELLE_ETABLISSEMENTINFORMATIONS + " (" + LIBELLE_COMMUNE + ")"; + if (LIBELLE_COMMUNE) { + return "[" + item.LIBELLE_GENRE + "] " + item.LIBELLE_ETABLISSEMENTINFORMATIONS + " (" + LIBELLE_COMMUNE + ")"; + } + else { + return "[" + item.LIBELLE_GENRE + "] " + item.LIBELLE_ETABLISSEMENTINFORMATIONS; + } } }).result(function(e, item) { window.location.href= "/etablissement/index/id/" + item.ID_ETABLISSEMENT; diff --git a/application/layouts/menu_admin.phtml b/application/layouts/menu_admin.phtml index 7e396b6a..afed58f8 100755 --- a/application/layouts/menu_admin.phtml +++ b/application/layouts/menu_admin.phtml @@ -46,6 +46,9 @@
  • getRequest()->getControllerName() == 'groupement') echo "class='active'" ?> > Groupements de communes
  • +
  • getRequest()->getControllerName() == 'changement') echo "class='active'" ?> > + Messages des alertes +
  • placeholder('lateral_navigation')->captureEnd(); ?> diff --git a/application/models/DbTable/AdresseCommune.php b/application/models/DbTable/AdresseCommune.php index e9ad506c..109d3dc8 100755 --- a/application/models/DbTable/AdresseCommune.php +++ b/application/models/DbTable/AdresseCommune.php @@ -15,4 +15,23 @@ public function get($q) return $this->fetchAll($select)->toArray(); } + public function getMairieInformation($numinsee) + { + $select = "SELECT * " + . "FROM adressecommune as commune " + . "INNER JOIN utilisateurinformations as user " + . "ON commune.ID_UTILISATEURINFORMATIONS = " + . "user.ID_UTILISATEURINFORMATIONS " + . "WHERE commune.NUMINSEE_COMMUNE = '" . $numinsee . "'"; + + $result = $this->getAdapter()->fetchAll($select); + if (count($result) > 0) { + $result = $result[0]; + } else { + $result = null; + } + + return $result; + } + } diff --git a/application/models/DbTable/Changement.php b/application/models/DbTable/Changement.php new file mode 100644 index 00000000..883ba564 --- /dev/null +++ b/application/models/DbTable/Changement.php @@ -0,0 +1,21 @@ +select() + ->setIntegrityCheck(false) + ->from("changement"); + + return $this->fetchAll($select)->toArray(); + } +} diff --git a/application/models/DbTable/Commission.php b/application/models/DbTable/Commission.php index 12a99f9e..4cb7554f 100755 --- a/application/models/DbTable/Commission.php +++ b/application/models/DbTable/Commission.php @@ -173,7 +173,7 @@ public function getCommissionIGH( $commune, $classe, $localsommeil) $results = $this->fetchAll($select); - if ($result != null) { + if ($results != null) { foreach($results as $result) { if ($result->NUMINSEE_COMMUNE != null) { @@ -200,5 +200,60 @@ public function getCommissionIGH( $commune, $classe, $localsommeil) } } + + public function getRegles($id_commission) + { + + $model_groupementCommune = new Model_DbTable_GroupementCommune; + + $regles = array(); + + $select = $this->select() + ->setIntegrityCheck(false) + ->from("commissionregle", array("ID_GROUPEMENT", "NUMINSEE_COMMUNE") ) + ->joinLeft("commission", "commission.ID_COMMISSION = commissionregle.ID_COMMISSION", null) + ->joinLeft("commissionregletype", "commissionregle.ID_REGLE = commissionregletype.ID_REGLE", array("ID_TYPE")) + ->joinLeft("commissionreglecategorie", "commissionregle.ID_REGLE = commissionreglecategorie.ID_REGLE", array("ID_CATEGORIE")) + ->joinLeft("commissionregleclasse", "commissionregle.ID_REGLE = commissionregleclasse.ID_REGLE", array("ID_CLASSE")) + ->joinLeft("commissionreglelocalsommeil", "commissionregle.ID_REGLE = commissionreglelocalsommeil.ID_REGLE", array("LOCALSOMMEIL")) + ->joinLeft("adressecommune", "adressecommune.NUMINSEE_COMMUNE = commissionregle.NUMINSEE_COMMUNE", null) + ->where("commission.ID_COMMISSION = ?", $id_commission); + + $results = $this->fetchAll($select); + + if ($results == null) { + return $regles; + } + + $groupement_cache = array(); + foreach($results as $result) { + + $communes = array(); + if ($result->NUMINSEE_COMMUNE != null) { + $communes = array($result->NUMINSEE_COMMUNE); + } elseif ($result->ID_GROUPEMENT != null) { + + if (!isset($groupement_cache[$result->ID_GROUPEMENT])) { + $groupement_cache[$result->ID_GROUPEMENT] = array(); + $row_groupement = $model_groupementCommune->fetchAll("ID_GROUPEMENT = '" . $result->ID_GROUPEMENT . "'"); + foreach($row_groupement as $row) { + $groupement_cache[$result->ID_GROUPEMENT][] = $row['NUMINSEE_COMMUNE']; + } + } + $communes = $groupement_cache[$result->ID_GROUPEMENT]; + } + + $regles[] = array( + 'NUMINSEE_COMMUNE' => $communes, + 'LOCALSOMMEIL' => $result->LOCALSOMMEIL, + 'ID_TYPE' => $result->ID_TYPE , + 'ID_CLASSE' => $result->ID_CLASSE, + 'ID_CATEGORIE' => $result->ID_CATEGORIE, + ); + + } + + return $regles; + } } diff --git a/application/models/DbTable/DateCommission.php b/application/models/DbTable/DateCommission.php index b3be85a1..608ae838 100755 --- a/application/models/DbTable/DateCommission.php +++ b/application/models/DbTable/DateCommission.php @@ -55,7 +55,7 @@ public function getNextCommission($idsCommission, $date, $next_date) ORDER BY DATE_COMMISSION, HEUREDEB_COMMISSION"; return $this->getAdapter()->fetchAll($select); } - + public function getMonthCommission($mois,$annee,$idcom) { $select = "SELECT * @@ -154,24 +154,24 @@ public function getDateLieesv2($idDateComm) ->where("dc.ID_DATECOMMISSION = ?",$idDateComm) ->orWhere("dc.DATECOMMISSION_LIEES = ?",$idDateComm) ->order("DATE_COMMISSION"); - + return $this->getAdapter()->fetchAll($select); } - + public function updateDependingDossierDates($datecommission) { $dbAffectDossier = new Model_DbTable_DossierAffectation(); $dbDossier = new Model_DbTable_Dossier(); - + // on récupère les dossiers liés à la commission $dossiersAffecte = $dbAffectDossier->fetchAll('ID_DATECOMMISSION_AFFECT = '.$datecommission->ID_DATECOMMISSION); $dossiersAffecteIds = array(); foreach($dossiersAffecte as $dossierAffecte) { $dossiersAffecteIds[] = $dossierAffecte['ID_DOSSIER_AFFECT']; } - + // si des dossiers sont liés, en fonction du type, - // on update les dates en text dans les différents fields du dossiers pour + // on update les dates en text dans les différents fields du dossiers pour // des cohérences de données if ($dossiersAffecteIds) { if (in_array($datecommission->ID_COMMISSIONTYPEEVENEMENT, array(1))) { @@ -185,4 +185,42 @@ public function updateDependingDossierDates($datecommission) } } + public function getEventInCommission( + $idUtilisateur = null, + $idCommission = null, + $start = null, + $end = null, + $ignoreEts = false) { + $select = $this->select() + ->setIntegrityCheck(false) + ->from(array('d' => 'dossier')) + ->join(array('da' => 'dossieraffectation'), 'd.ID_DOSSIER = da.ID_DOSSIER_AFFECT') + ->join(array('dc' => 'datecommission'), 'da.ID_DATECOMMISSION_AFFECT = dc.ID_DATECOMMISSION') + ->join(array('c' => 'commission'), 'dc.COMMISSION_CONCERNE = c.ID_COMMISSION'); + if ($ignoreEts) { + $select->joinLeft(array('ed' => 'etablissementdossier'), 'd.ID_DOSSIER = ed.ID_DOSSIER'); + } else { + $select->join(array('ed' => 'etablissementdossier'), 'd.ID_DOSSIER = ed.ID_DOSSIER'); + } + $select->join(array('dn' => 'dossiernature'), 'd.ID_DOSSIER = dn.ID_DOSSIER') + ->join(array('dnl' => 'dossiernatureliste'), 'dn.ID_NATURE = dnl.ID_DOSSIERNATURE') + ->join(array('dt' => 'dossiertype'), 'd.TYPE_DOSSIER = dt.ID_DOSSIERTYPE') + ->join(array('dp' => 'dossierpreventionniste'), 'd.ID_DOSSIER = dp.ID_DOSSIER') + ->join(array('u' => 'utilisateur'), 'dp.ID_PREVENTIONNISTE = u.ID_UTILISATEUR'); + if ($idUtilisateur !== null) { + $select->where('u.ID_UTILISATEUR = ?', $idUtilisateur); + } + if ($idCommission !== null) { + $select->where('dc.COMMISSION_CONCERNE = ?', $idCommission); + } + if ($start !== null) { + $select->where('YEAR(dc.DATE_COMMISSION) >= ?', $start); + } + if ($end !== null) { + $select->where('YEAR(dc.DATE_COMMISSION) <= ?', $end); + } + + return $this->getAdapter()->fetchAll($select); + } + } diff --git a/application/models/DbTable/DateCommissionPj.php b/application/models/DbTable/DateCommissionPj.php index 3115ebef..25df88b3 100755 --- a/application/models/DbTable/DateCommissionPj.php +++ b/application/models/DbTable/DateCommissionPj.php @@ -4,9 +4,9 @@ class Model_DbTable_DateCommissionPj extends Zend_Db_Table_Abstract { protected $_name="datecommissionpj"; // Nom de la base - protected $_primary = "ID_DATECOMMISSION";// Cl� primaire + protected $_primary = "ID_DATECOMMISSION";// Clé primaire - //r�cup�ration de la liste des dossiers pr�vu � la date de commission pass�e en param�tres + //récupération de la liste des dossiers prévu à la date de commission passée en paramètres /* public function getDossiersInfosOLD($dateCommId) { @@ -138,4 +138,5 @@ public function getPjInfos($idComm) return ( $this->fetchAll( $select ) != null ) ? $this->fetchAll( $select )->toArray() : null; } + } diff --git a/application/models/DbTable/Dossier.php b/application/models/DbTable/Dossier.php index 35f52ac2..1084b2f6 100755 --- a/application/models/DbTable/Dossier.php +++ b/application/models/DbTable/Dossier.php @@ -2,7 +2,6 @@ class Model_DbTable_Dossier extends Zend_Db_Table_Abstract { - protected $_name="dossier"; // Nom de la base protected $_primary = "ID_DOSSIER"; // Cl� primaire @@ -15,6 +14,7 @@ public function getGeneral($id) AND commission.id_commissiontype = commissiontype.id_commissiontype AND dossier.type_dossier = dossiertype.id_dossiertype AND dossier.nature_dossier = dossiernature.id_dossiernature + AND dossier.datesuppression_dossier IS NULL AND dossier.id_dossier = '".$id."';"; //echo $select; return $this->getAdapter()->fetchRow($select); @@ -40,12 +40,13 @@ public function getEtablissementLibelleListe($id_etablissement) //Fonction qui récup tous les établissements liés au dossier LAST VERSION public function getEtablissementDossier($id_dossier) { - //retourne la liste des catégories de prescriptions par ordre $select = " SELECT etablissementdossier.ID_ETABLISSEMENTDOSSIER ,t1.ID_ETABLISSEMENT, LIBELLE_ETABLISSEMENTINFORMATIONS, LIBELLE_GENRE - FROM etablissementdossier, etablissementinformations t1, genre + FROM etablissementdossier, etablissement e, etablissementinformations t1, genre WHERE etablissementdossier.ID_ETABLISSEMENT = t1.ID_ETABLISSEMENT + AND etablissementdossier.ID_ETABLISSEMENT = e.ID_ETABLISSEMENT + AND e.DATESUPPRESSION_ETABLISSEMENT IS NULL AND t1.ID_GENRE = genre.ID_GENRE AND etablissementdossier.ID_DOSSIER = '".$id_dossier."' AND t1.DATE_ETABLISSEMENTINFORMATIONS = ( @@ -58,14 +59,16 @@ public function getEtablissementDossier($id_dossier) //echo $select; return $this->getAdapter()->fetchAll($select); } - + // Fonction optimisée pour les ACL public function getEtablissementDossier2($id_dossier) { $select = $this->select() ->setIntegrityCheck(false) ->from("etablissementdossier", array("etablissementdossier.ID_ETABLISSEMENT")) - ->where("etablissementdossier.ID_DOSSIER = ?", $id_dossier); + ->joinLeftUsing(array('e' => 'etablissement'), 'ID_ETABLISSEMENT') + ->where("etablissementdossier.ID_DOSSIER = ?", $id_dossier) + ->where("e.DATESUPPRESSION_ETABLISSEMENT IS NULL"); return $this->fetchAll($select)->toArray(); } @@ -89,7 +92,7 @@ public function searchLibelleEtab( $etablissementLibelle ) return $this->getAdapter()->fetchAll($select); } - //Fonction qui r�cup�re toutes les c�llules concern�es par le dossier + //Fonction qui récupère toutes les cellules concernées par le dossier public function getCelluleListe($id_dossier) { $select = "SELECT cellulelibelle.*, MAX(cellulelibelle.date_cellulelibelle) @@ -140,7 +143,7 @@ public function getCommissionV2($idDossier){ ->join(array("c" => "commission") , "d.COMMISSION_DOSSIER = c.ID_COMMISSION") ->join(array("ct" => "commissiontype"), "c.ID_COMMISSIONTYPE = ct.ID_COMMISSIONTYPE") ->where("d.ID_DOSSIER = ?",$idDossier); - + return $this->getAdapter()->fetchRow($select); } @@ -169,6 +172,7 @@ public function getDossiersEtablissement($etablissement, $type = null) ->join("dossier", "etablissementdossier.ID_DOSSIER = dossier.ID_DOSSIER", array("ID_DOSSIER","LIBELLE_DOSSIER", "OBJET_DOSSIER", "DESCRIPTIFGEN_DOSSIER", "DATESECRETARIAT_DOSSIER")) ->join("dossiertype", "dossier.TYPE_DOSSIER = dossiertype.ID_DOSSIERTYPE", "VISITEBOOL_DOSSIERTYPE") ->where("etablissementdossier.ID_ETABLISSEMENT = $etablissement") + ->where("dossier.DATESUPPRESSION_DOSSIER IS NULL") ->order("dossier.DATESECRETARIAT_DOSSIER DESC"); if($type == "1" || $type == "0") @@ -206,6 +210,7 @@ public function getDossierEtab($idEtablissement,$idDossier) FROM dossierlie WHERE ID_DOSSIER1 = ".$idDossier." ) + AND dossier.DATESUPPRESSION_DOSSIER IS NULL ORDER BY dossier.DATEINSERT_DOSSIER ;"; //echo $select; @@ -370,4 +375,18 @@ public function getPreventionnistesDossier($id_dossier) //echo $select; return $this->getAdapter()->fetchAll($select); } + + // Retourne la liste de tout les dossiers d'un Etablissement + public function getDossiersEtab($etablissement) + { + $select = " + SELECT dossier.ID_DOSSIER + from dossier + join etablissementdossier ON etablissementdossier.ID_DOSSIER = dossier.ID_DOSSIER + where etablissementdossier.ID_ETABLISSEMENT = '".$etablissement."' + and dossier.DATESUPPRESSION_DOSSIER IS NULL; + "; + + return $this->getAdapter()->fetchAll($select); + } } diff --git a/application/models/DbTable/Etablissement.php b/application/models/DbTable/Etablissement.php index 552286f3..08486e40 100755 --- a/application/models/DbTable/Etablissement.php +++ b/application/models/DbTable/Etablissement.php @@ -106,7 +106,8 @@ public function getByUser($id_user) ->joinLeft("etablissementinformationspreventionniste", "etablissementinformationspreventionniste.ID_ETABLISSEMENTINFORMATIONS = etablissementinformations.ID_ETABLISSEMENTINFORMATIONS", null) ->where("DATE_ETABLISSEMENTINFORMATIONS = (select max(DATE_ETABLISSEMENTINFORMATIONS) from etablissementinformations where ID_ETABLISSEMENT = e.ID_ETABLISSEMENT ) ") ->where("etablissementinformationspreventionniste.ID_UTILISATEUR = " . $id_user) - ->where("etablissementinformations.DATE_ETABLISSEMENTINFORMATIONS = ( SELECT MAX(DATE_ETABLISSEMENTINFORMATIONS) FROM etablissementinformations WHERE etablissementinformations.ID_ETABLISSEMENT = e.ID_ETABLISSEMENT ) OR etablissementinformations.DATE_ETABLISSEMENTINFORMATIONS IS NULL"); + ->where("etablissementinformations.DATE_ETABLISSEMENTINFORMATIONS = ( SELECT MAX(DATE_ETABLISSEMENTINFORMATIONS) FROM etablissementinformations WHERE etablissementinformations.ID_ETABLISSEMENT = e.ID_ETABLISSEMENT ) OR etablissementinformations.DATE_ETABLISSEMENTINFORMATIONS IS NULL") + ->where("e.DATESUPPRESSION_ETABLISSEMENT IS NULL"); return ( $this->fetchAll( $select ) != null ) ? $this->fetchAll( $select )->toArray() : null; } @@ -118,8 +119,10 @@ public function getInformations($id_etablissement) $select = $DB_information->select() ->setIntegrityCheck(false) ->from("etablissementinformations") - ->where("ID_ETABLISSEMENT = '$id_etablissement'") - ->where("DATE_ETABLISSEMENTINFORMATIONS = (select max(DATE_ETABLISSEMENTINFORMATIONS) from etablissementinformations where ID_ETABLISSEMENT = '$id_etablissement' ) "); + ->joinLeft("etablissement", "etablissement.ID_ETABLISSEMENT = etablissementinformations.ID_ETABLISSEMENT") + ->where("etablissementinformations.ID_ETABLISSEMENT = '$id_etablissement'") + ->where("DATE_ETABLISSEMENTINFORMATIONS = (select max(DATE_ETABLISSEMENTINFORMATIONS) from etablissementinformations where ID_ETABLISSEMENT = '$id_etablissement' ) ") + ->where("etablissement.DATESUPPRESSION_ETABLISSEMENT IS NULL"); return $DB_information->fetchRow($select); } @@ -131,6 +134,7 @@ public function getLibelle( $id_etablissement ) $select ->from(array("e" => "etablissement"), null) ->join("etablissementinformations", "e.ID_ETABLISSEMENT = etablissementinformations.ID_ETABLISSEMENT", "LIBELLE_ETABLISSEMENTINFORMATIONS") ->where("etablissementinformations.DATE_ETABLISSEMENTINFORMATIONS = ( SELECT MAX(etablissementinformations.DATE_ETABLISSEMENTINFORMATIONS) FROM etablissementinformations WHERE etablissementinformations.ID_ETABLISSEMENT = e.ID_ETABLISSEMENT )") + ->where("e.DATESUPPRESSION_ETABLISSEMENT IS NULL") ->order("etablissementinformations.LIBELLE_ETABLISSEMENTINFORMATIONS ASC") ->where("e.ID_ETABLISSEMENT = ?", $id_etablissement); @@ -144,6 +148,7 @@ public function getPeriodicite( $id_etablissement ) $select ->from(array("e" => "etablissement"), null) ->join("etablissementinformations", "e.ID_ETABLISSEMENT = etablissementinformations.ID_ETABLISSEMENT", "PERIODICITE_ETABLISSEMENTINFORMATIONS") ->where("etablissementinformations.DATE_ETABLISSEMENTINFORMATIONS = ( SELECT MAX(etablissementinformations.DATE_ETABLISSEMENTINFORMATIONS) FROM etablissementinformations WHERE etablissementinformations.ID_ETABLISSEMENT = e.ID_ETABLISSEMENT )") + ->where("e.DATESUPPRESSION_ETABLISSEMENT IS NULL") ->order("etablissementinformations.LIBELLE_ETABLISSEMENTINFORMATIONS ASC") ->where("e.ID_ETABLISSEMENT = ?", $id_etablissement); @@ -162,6 +167,7 @@ public function getGenre( $id_etablissement ) ->join("etablissementinformations", "e.ID_ETABLISSEMENT = etablissementinformations.ID_ETABLISSEMENT", "ID_GENRE") ->join("genre", "etablissementinformations.ID_GENRE = genre.ID_GENRE", "LIBELLE_GENRE") ->where("etablissementinformations.DATE_ETABLISSEMENTINFORMATIONS = ( SELECT MAX(etablissementinformations.DATE_ETABLISSEMENTINFORMATIONS) FROM etablissementinformations WHERE etablissementinformations.ID_ETABLISSEMENT = e.ID_ETABLISSEMENT )") + ->where("e.DATESUPPRESSION_ETABLISSEMENT IS NULL") ->where("e.ID_ETABLISSEMENT = ?", $id_etablissement); return ( $this->fetchRow( $select ) != null ) ? $this->fetchRow( $select )->toArray() : null; @@ -174,8 +180,10 @@ public function getParent( $id_etablissement ) ->from("etablissementlie", null) ->joinLeft("etablissementinformations", "etablissementinformations.ID_ETABLISSEMENT = etablissementlie.ID_ETABLISSEMENT") ->joinLeft("categorie", "categorie.ID_CATEGORIE = etablissementinformations.ID_CATEGORIE") + ->joinLeft("etablissement", "etablissement.ID_ETABLISSEMENT = etablissementinformations.ID_ETABLISSEMENT") ->where("etablissementlie.ID_FILS_ETABLISSEMENT = '$id_etablissement'") - ->where("DATE_ETABLISSEMENTINFORMATIONS = (select max(DATE_ETABLISSEMENTINFORMATIONS) from etablissementinformations where ID_ETABLISSEMENT = etablissementlie.ID_ETABLISSEMENT ) "); + ->where("DATE_ETABLISSEMENTINFORMATIONS = (select max(DATE_ETABLISSEMENTINFORMATIONS) from etablissementinformations where ID_ETABLISSEMENT = etablissementlie.ID_ETABLISSEMENT ) ") + ->where("etablissement.DATESUPPRESSION_ETABLISSEMENT IS NULL"); return ( $this->fetchRow( $select ) != null ) ? $this->fetchRow( $select )->toArray() : null; } @@ -333,18 +341,16 @@ public function getDossierDonnantAvis($id_etablissement) { $select = $this->select() ->setIntegrityCheck(false) - ->from("dossier", array("ID_DOSSIER", "DATECOMM_DOSSIER", "DATEVISITE_DOSSIER")) + ->from("dossier", array("ID_DOSSIER", "DATECOMM_DOSSIER", "DATEVISITE_DOSSIER", "AVIS_DOSSIER_COMMISSION")) ->join("etablissementdossier", "etablissementdossier.ID_DOSSIER = dossier.ID_DOSSIER") ->join("dossiernature", "dossiernature.ID_DOSSIER = etablissementdossier.ID_DOSSIER", null) ->where("etablissementdossier.ID_ETABLISSEMENT = ?", $id_etablissement) ->where("dossiernature.ID_NATURE in (?)", array(19, 7, 17, 16, 21, 23, 24, 47, 26, 28, 29, 48)) + ->where("dossier.AVIS_DOSSIER_COMMISSION IS NOT NULL") + ->where("dossier.AVIS_DOSSIER_COMMISSION > 0") ->order("IFNULL(dossier.DATECOMM_DOSSIER, dossier.DATEVISITE_DOSSIER) DESC"); return $this->fetchRow($select); } - - - - } diff --git a/application/models/DbTable/EtablissementAdresse.php b/application/models/DbTable/EtablissementAdresse.php index 5aab6125..9b132e9a 100755 --- a/application/models/DbTable/EtablissementAdresse.php +++ b/application/models/DbTable/EtablissementAdresse.php @@ -121,5 +121,4 @@ public function getVoies( $code_insee, $q = null ) return $this->fetchAll($select)->toArray(); } - - } + } \ No newline at end of file diff --git a/application/models/DbTable/EtablissementDossier.php b/application/models/DbTable/EtablissementDossier.php index 0097d7b7..6f0928d9 100755 --- a/application/models/DbTable/EtablissementDossier.php +++ b/application/models/DbTable/EtablissementDossier.php @@ -4,13 +4,15 @@ class Model_DbTable_EtablissementDossier extends Zend_Db_Table_Abstract protected $_name="etablissementdossier"; protected $_primary = "ID_ETABLISSEMENTDOSSIER"; - public function getEtablissementListe($idDossier) - { - $select = $this->select() - ->setIntegrityCheck(false) - ->from(array('ed' => 'etablissementdossier')) - ->where("ID_DOSSIER = ?", $idDossier); + public function getEtablissementListe($idDossier) + { + $select = $this->select() + ->setIntegrityCheck(false) + ->from(array('ed' => 'etablissementdossier')) + ->joinLeftUsing(array('e' => 'etablissement'), 'ID_ETABLISSEMENT') + ->where("ID_DOSSIER = ?", $idDossier) + ->where("e.DATESUPPRESSION_ETABLISSEMENT IS NULL"); - return $this->getAdapter()->fetchAll($select); - } + return $this->getAdapter()->fetchAll($select); + } } diff --git a/application/models/DbTable/Groupe.php b/application/models/DbTable/Groupe.php index 1dcf06a5..076261e6 100755 --- a/application/models/DbTable/Groupe.php +++ b/application/models/DbTable/Groupe.php @@ -4,9 +4,9 @@ class Model_DbTable_Groupe extends Zend_Db_Table_Abstract { protected $_name="groupe"; // Nom de la base protected $_primary = "ID_GROUPE"; // Cl primaire - + protected $_dependentTables = array('Model_DbTable_GroupePrivilege'); - + public function delete($id_groupe) { parent::delete("ID_GROUPE = " . $id_groupe); diff --git a/application/models/DbTable/GroupePrivilege.php b/application/models/DbTable/GroupePrivilege.php index 961803cb..49569ae8 100755 --- a/application/models/DbTable/GroupePrivilege.php +++ b/application/models/DbTable/GroupePrivilege.php @@ -3,7 +3,7 @@ class Model_DbTable_GroupePrivilege extends Zend_Db_Table_Abstract { protected $_name = "groupe-privileges"; - + protected $_referenceMap = array( 'Groupe' => array( 'columns' => array('ID_GROUPE'), diff --git a/application/models/DbTable/Periodicite.php b/application/models/DbTable/Periodicite.php index a6107afd..57dd9b26 100755 --- a/application/models/DbTable/Periodicite.php +++ b/application/models/DbTable/Periodicite.php @@ -11,8 +11,8 @@ public function gn4($categorie, $type, $local_sommeil) $select = $this->select() ->setIntegrityCheck(false) ->from("periodicite", "PERIODICITE_PERIODICITE") - ->where("ID_CATEGORIE = ?", $categorie) - ->where("ID_TYPE = ?", $type) + ->where("ID_CATEGORIE = ?", (int) $categorie) + ->where("ID_TYPE = ?", (int) $type) ->where("LOCALSOMMEIL_PERIODICITE = ?", $local_sommeil); // Retourne le r�sultat @@ -27,8 +27,8 @@ public function gn4ForEtablissement($etablissement) if (!in_array($informations['ID_GENRE'], array(2, 5))) { return null; } - - return $this->gn4($informations['ID_CATEGORIE'], $informations['ID_TYPE'], $informations['LOCALSOMMEIL_ETABLISSEMENTINFORMATIONS'] ? 1 : 0); + $type = $informations['ID_GENRE'] == 2 ? $informations['ID_TYPE'] : $informations['ID_CLASSE']; + return $this->gn4($informations['ID_CATEGORIE'], $type, $informations['LOCALSOMMEIL_ETABLISSEMENTINFORMATIONS'] ? 1 : 0); } public function apply() diff --git a/application/models/DbTable/PrescriptionType.php b/application/models/DbTable/PrescriptionType.php index 304a2482..cba34499 100755 --- a/application/models/DbTable/PrescriptionType.php +++ b/application/models/DbTable/PrescriptionType.php @@ -3,7 +3,7 @@ class Model_DbTable_PrescriptionType extends Zend_Db_Table_Abstract { protected $_name="prescriptiontype"; // Nom de la base - protected $_primary = "ID_PRESCRIPTIONTYPE"; // Cl primaire + protected $_primary = "ID_PRESCRIPTIONTYPE"; // Cl� primaire public function getPrescriptionType($categorie,$texte,$article) { @@ -22,14 +22,16 @@ public function getPrescriptionTypeByWords($tabMotCles) { $select = $this->select() ->setIntegrityCheck(false) - ->from(array("pt" => "prescriptiontype")); - //->join(array("pta" => "prescriptiontypeassoc") , "pt.ID_PRESCRIPTIONTYPE = pta.ID_PRESCRIPTIONTYPE") - //->join(array("pal" => "prescriptionarticleliste"), "pal.ID_ARTICLE = pta.ID_ARTICLE") - //->join(array("ptl" => "prescriptiontexteliste"), "ptl.ID_TEXTE = pta.ID_TEXTE"); + ->from(array("pt" => "prescriptiontype")) + ->join(array("pta" => "prescriptiontypeassoc") , "pt.ID_PRESCRIPTIONTYPE = pta.ID_PRESCRIPTIONTYPE") + ->join(array("pal" => "prescriptionarticleliste"), "pal.ID_ARTICLE = pta.ID_ARTICLE") + ->join(array("ptl" => "prescriptiontexteliste"), "ptl.ID_TEXTE = pta.ID_TEXTE"); - foreach($tabMotCles as $val => $ue) + foreach($tabMotCles as $ue) { - $select->where("pt.PRESCRIPTIONTYPE_LIBELLE like '%".$ue."%'"); + $select->orWhere("pt.PRESCRIPTIONTYPE_LIBELLE like ?", "%".$ue."%"); + $select->orWhere("ptl.LIBELLE_TEXTE like ?", "%".$ue."%"); + $select->orWhere("pal.LIBELLE_ARTICLE like ?", "%".$ue."%"); } //echo $select->__toString(); return $this->getAdapter()->fetchAll($select); diff --git a/application/models/DbTable/Search.php b/application/models/DbTable/Search.php index fc65a9b3..fa654fe8 100755 --- a/application/models/DbTable/Search.php +++ b/application/models/DbTable/Search.php @@ -76,6 +76,7 @@ public function setItem( $item ) ->joinLeft(array("adressecommunesite" => "adressecommune"), "etablissementadressesite.NUMINSEE_COMMUNE = adressecommunesite.NUMINSEE_COMMUNE", "LIBELLE_COMMUNE AS LIBELLE_COMMUNE_ADRESSE_SITE") ->joinLeft(array("etablissementadressecell" => "etablissementadresse"), "etablissementadressecell.ID_ETABLISSEMENT = (SELECT ID_ETABLISSEMENT FROM etablissementlie WHERE ID_FILS_ETABLISSEMENT = e.ID_ETABLISSEMENT LIMIT 1)", "ID_RUE AS ID_RUE_CELL") ->joinLeft(array("adressecommunecell" => "adressecommune"), "etablissementadressecell.NUMINSEE_COMMUNE = adressecommunecell.NUMINSEE_COMMUNE", "LIBELLE_COMMUNE AS LIBELLE_COMMUNE_ADRESSE_CELLULE") + ->where("e.DATESUPPRESSION_ETABLISSEMENT IS NULL") ->order("CAST(etablissementinformations.LIBELLE_ETABLISSEMENTINFORMATIONS AS UNSIGNED)") ->order("etablissementinformations.LIBELLE_ETABLISSEMENTINFORMATIONS") ->group("e.ID_ETABLISSEMENT"); @@ -131,6 +132,7 @@ public function setItem( $item ) )", "LIBELLE_ETABLISSEMENTINFORMATIONS" ) + ->where("d.DATESUPPRESSION_DOSSIER IS NULL") ->group("d.ID_DOSSIER"); break; @@ -145,6 +147,7 @@ public function setItem( $item ) ->joinLeft("etablissementinformations", "etablissementinformations.ID_ETABLISSEMENTINFORMATIONS = etablissementinformationspreventionniste.ID_ETABLISSEMENTINFORMATIONS") ->where("etablissementinformations.DATE_ETABLISSEMENTINFORMATIONS = ( SELECT MAX(infos.DATE_ETABLISSEMENTINFORMATIONS) FROM etablissementinformations as infos WHERE etablissementinformations.ID_ETABLISSEMENT = infos.ID_ETABLISSEMENT ) OR etablissementinformations.DATE_ETABLISSEMENTINFORMATIONS IS NULL") ->where("u.ACTIF_UTILISATEUR = 1") + ->order(array("utilisateurinformations.NOM_UTILISATEURINFORMATIONS", "utilisateurinformations.PRENOM_UTILISATEURINFORMATIONS")) ->group("u.ID_UTILISATEUR"); break; diff --git a/application/models/DbTable/Statistiques.php b/application/models/DbTable/Statistiques.php index 69c151a7..b4be9272 100755 --- a/application/models/DbTable/Statistiques.php +++ b/application/models/DbTable/Statistiques.php @@ -84,7 +84,7 @@ public function listeDesERPVisitePeriodique($dateDebut, $dateFin) AND dossiernature.ID_NATURE in (21,26) AND dossier.TYPE_DOSSIER in (2,3) GROUP BY etablissement.ID_ETABLISSEMENT)"), - "ARRONDISSEMENT" => Zend_Db_Expr("(SELECT `groupement`.LIBELLE_GROUPEMENT FROM `groupement` INNER JOIN `groupementcommune` ON groupementcommune.ID_GROUPEMENT = groupement.ID_GROUPEMENT INNER JOIN `groupementtype` ON groupementtype.ID_GROUPEMENTTYPE = groupement.ID_GROUPEMENTTYPE WHERE (groupementcommune.NUMINSEE_COMMUNE = adressecommune.NUMINSEE_COMMUNE AND groupementtype.ID_GROUPEMENTTYPE = 2) LIMIT 1)") + "ARRONDISSEMENT" => new Zend_Db_Expr("(SELECT `groupement`.LIBELLE_GROUPEMENT FROM `groupement` INNER JOIN `groupementcommune` ON groupementcommune.ID_GROUPEMENT = groupement.ID_GROUPEMENT INNER JOIN `groupementtype` ON groupementtype.ID_GROUPEMENTTYPE = groupement.ID_GROUPEMENTTYPE WHERE (groupementcommune.NUMINSEE_COMMUNE = adressecommune.NUMINSEE_COMMUNE AND groupementtype.ID_GROUPEMENTTYPE = 2) LIMIT 1)") )) ->join("etablissementinformations", "e.ID_ETABLISSEMENT = etablissementinformations.ID_ETABLISSEMENT", array( "LIBELLE_ETABLISSEMENTINFORMATIONS", diff --git a/application/models/DbTable/Utilisateur.php b/application/models/DbTable/Utilisateur.php index b90a02e9..8c25d581 100755 --- a/application/models/DbTable/Utilisateur.php +++ b/application/models/DbTable/Utilisateur.php @@ -12,15 +12,18 @@ public function getDroits($id_user) $model_groupes = new Model_DbTable_Groupe; // Récupération du groupe de l'user - if($auth->ID_UTILISATEUR != $id_user) + if ((is_array($auth) && $auth['ID_UTILISATEUR'] != $id_user) + || (is_object($auth) && $auth->ID_UTILISATEUR != $id_user)) { $id_groupe = $this->find($id_user)->current()->ID_GROUPE; - else - $id_groupe = $auth->ID_GROUPE; + } else { + $id_groupe = is_array($auth) ? $auth['ID_GROUPE'] : $auth->ID_GROUPE; + } // On retourne les droits de l'user return $model_groupes->getDroits($id_groupe); } + public function getUsersWithInformations($group = null) { $this->select = $this->select()->setIntegrityCheck(false); @@ -45,17 +48,19 @@ public function getUsersWithInformations($group = null) return $this->fetchAll($select)->toArray(); } - public function isRegistered($login) + public function isRegistered($id_user, $login) { $select = $this->select() - ->setIntegrityCheck(false) ->from("utilisateur") - ->where("USERNAME_UTILISATEUR = ?", $login) - ->limit(1); + ->where("USERNAME_UTILISATEUR = ?", $login); + if ($id_user !== null) { + $select->where("ID_UTILISATEUR <> ?", $id_user); + } + $select->limit(1); $result = $this->fetchRow($select); - return ( $result != null ) ? true : false; + return $result != null; } public function getId($login) @@ -244,4 +249,77 @@ public function getGroupPrivileges($user) return $privileges; } + + /** + * Retourne une liste d'utilisateur ayant les droits + * de recevoir les type d'alerte (changement de statut, avis, catégorie) + * et étant concerné par la commune ou le groupement de commune de l'établissement + * + * @param int $idChangement L'id du type de changement + * @param array $ets L'établissement concerné par le changement + * @return array Liste d'utilisateur + */ + public function findUtilisateursForAlerte($idChangement, $ets) + { + switch($idChangement) { + case "1": + $privilege = "alerte_statut"; + break; + case "2": + $privilege = "alerte_avis"; + break; + case "3": + $privilege = "alerte_classement"; + break; + default: + $privilege = "alerte_statut"; + } + + $numinsee = ""; + if (count($ets['adresses']) > 0) { + $numinsee = $ets['adresses'][0]['NUMINSEE_COMMUNE']; + } + + $selectPrivilegeQuery = $this->select()->setIntegrityCheck(false) + ->from(array('p' => 'privileges'), array('p.id_privilege')) + ->where('name = ?', $privilege) + ->limit(1); + + $selectCommune = $this->select()->setIntegrityCheck(false) + ->from(array('u' => 'utilisateur'), array('ID_UTILISATEUR')) + ->join(array('ui' => 'utilisateurinformations'), + 'ui.ID_UTILISATEURINFORMATIONS = u.ID_UTILISATEURINFORMATIONS', + array('ui.NOM_UTILISATEURINFORMATIONS', 'ui.PRENOM_UTILISATEURINFORMATIONS', + 'ui.MAIL_UTILISATEURINFORMATIONS')) + ->join(array('g' => 'groupe'), 'g.ID_GROUPE = u.ID_GROUPE', null) + ->join(array('gp' => 'groupe-privileges'), 'gp.ID_GROUPE = g.ID_GROUPE', null) + ->where('ui.MAIL_UTILISATEURINFORMATIONS IS NOT NULL') + ->where('ui.MAIL_UTILISATEURINFORMATIONS <> ?', '') + ->where('gp.id_privilege = (' . $selectPrivilegeQuery . ')') + ->where('u.NUMINSEE_COMMUNE = ?', $numinsee) + ->group('u.ID_UTILISATEUR'); + + $selectGroupement = $this->select()->setIntegrityCheck(false) + ->from(array('u' => 'utilisateur'), array('ID_UTILISATEUR')) + ->join(array('ui' => 'utilisateurinformations'), + 'ui.ID_UTILISATEURINFORMATIONS = u.ID_UTILISATEURINFORMATIONS', + array('ui.NOM_UTILISATEURINFORMATIONS', 'ui.PRENOM_UTILISATEURINFORMATIONS', + 'ui.MAIL_UTILISATEURINFORMATIONS')) + ->join(array('g' => 'groupe'), 'g.ID_GROUPE = u.ID_GROUPE', null) + ->join(array('gp' => 'groupe-privileges'), 'gp.ID_GROUPE = g.ID_GROUPE', null) + ->join(array('ug' => 'utilisateurgroupement'), 'ug.ID_UTILISATEUR = u.ID_UTILISATEUR', null) + ->join(array('gc' => 'groupementcommune'), 'gc.ID_GROUPEMENT = ug.ID_GROUPEMENT', null) + ->where('ui.MAIL_UTILISATEURINFORMATIONS IS NOT NULL') + ->where('ui.MAIL_UTILISATEURINFORMATIONS <> ?', '') + ->where('gp.id_privilege = (' . $selectPrivilegeQuery . ')') + ->where('gc.NUMINSEE_COMMUNE = ?', $numinsee) + ->group('u.ID_UTILISATEUR'); + + $selectUnion = $this->select() + ->union(array($selectCommune, $selectGroupement)); + + + return $this->fetchAll($selectUnion)->toArray(); + } + } diff --git a/application/modules/api/Bootstrap.php b/application/modules/api/Bootstrap.php index b2c6ad35..65e3685f 100755 --- a/application/modules/api/Bootstrap.php +++ b/application/modules/api/Bootstrap.php @@ -4,13 +4,13 @@ class Api_Bootstrap extends Zend_Application_Module_Bootstrap { /** * @inheritdoc - */ + */ public function run() { // Chargement et activation des plugins // Contrôle du referer pour les requêtes aux api Zend_Controller_Front::getInstance()->registerPlugin(new Api_Plugin_RefererCheck); - + Zend_Controller_Front::getInstance()->registerPlugin(new Plugin_ACL); // On continue le chargement par défaut parent::run(); } diff --git a/application/modules/api/configs/routes.xml b/application/modules/api/configs/routes.xml index 0cf12034..b5a97539 100755 --- a/application/modules/api/configs/routes.xml +++ b/application/modules/api/configs/routes.xml @@ -151,6 +151,18 @@ + + + + calendar + + + + + + + + diff --git a/application/modules/api/controllers/CalendarController.php b/application/modules/api/controllers/CalendarController.php new file mode 100755 index 00000000..ccdd077e --- /dev/null +++ b/application/modules/api/controllers/CalendarController.php @@ -0,0 +1,23 @@ +_getParam('commission')) { + $idCommission = $this->_getParam('commission'); + } + + $headers = array("Content-Type: text/Calendar; charset=utf-8"); + + $this->view->layout()->disableLayout(); + $this->_helper->viewRenderer->setNoRender(true); + $server = new SDIS62_Rest_Server(); + $server->setClass("Api_Service_Calendar"); + $server->setHeaders($headers); + $server->setJsonResponse(false); + $server->handle($this->_request->getParams()); + } +} \ No newline at end of file diff --git a/application/modules/api/plugins/RefererCheck.php b/application/modules/api/plugins/RefererCheck.php index 6446ba58..6093c0ef 100755 --- a/application/modules/api/plugins/RefererCheck.php +++ b/application/modules/api/plugins/RefererCheck.php @@ -11,11 +11,11 @@ public function preDispatch(Zend_Controller_Request_Abstract $request) { // Récupération de la white-list $whitelist = new Zend_Config_Ini(APPLICATION_PATH . DS . 'modules' . DS . 'api' . DS . 'configs' . DS . 'whitelist.ini'); - + // Contrôle de l'IP de celui qui fait la requête à notre whitelist if(in_array($_SERVER['REMOTE_ADDR'], $whitelist->toArray())) { return; - } + } else { // Repoint the request to the default error handler $request->setModuleName('default')->setControllerName('error')->setActionName('error'); diff --git a/application/modules/api/services/Calendar.php b/application/modules/api/services/Calendar.php new file mode 100755 index 00000000..b13d12f3 --- /dev/null +++ b/application/modules/api/services/Calendar.php @@ -0,0 +1,394 @@ +getParam('bootstrap')->getResource('cache'); + $isAllowedToViewAll = unserialize($cache->load('acl'))->isAllowed( + Zend_Auth::getInstance()->getIdentity()['group']['LIBELLE_GROUPE'], + "commission", + "calendar_view_all" + ); + $dossierEvent = $this->createRequestForWebcalEvent($userid, + $commission, + $isAllowedToViewAll); + $calendrierNom = "Prévarisc"; + if ($commission) { + $dbCommission = new Model_DbTable_Commission; + $resultLibelle = $dbCommission->getLibelleCommissions($commission); + if (count($resultLibelle) > 0) { + $calendrierNom .= " " . $resultLibelle[0]['LIBELLE_COMMISSION']; + } + } + + // Le refresh est par défaut à 5 minutes + $refreshTime = (getenv('PREVARISC_CALENDAR_REFRESH_TIME') + && getenv('PREVARISC_CALENDAR_REFRESH_TIME') !== '') ? + getenv('PREVARISC_CALENDAR_REFRESH_TIME') : 'PT5M'; + + $calendar = new VObject\Component\VCalendar(array( + "NAME" => $calendrierNom, + "X-WR-CALNAME" => $calendrierNom, + "REFRESH-INTERVAL;VALUE=DURATION" => $refreshTime, + "X-PUBLISHED-TTL" => $refreshTime + )); + + $vtimezone = $this->getVTimezoneComponent($calendar); + $calendar->add($vtimezone); + + foreach ($dossierEvent as $commissionEvent) { + $event = $this->createICSEvent($commissionEvent); + if ($event) { + $calendar->add("VEVENT", $event); + } + } + + echo $calendar->serialize(); + } + + private function getVTimezoneComponent($calendar) + { + $vtimezone = new VObject\Component\VTimeZone($calendar, "VTIMEZONE"); + $daylight = new VObject\Component($calendar, "DAYLIGHT", [ + "DTSTART" => new DateTime("16010325T020000"), + "RRULE" => "FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3", + "TZOFFSETFROM" => "+0100", + "TZOFFSETTO" => "+0200" + ]); + $standard = new VObject\Component($calendar, "STANDARD", [ + "DTSTART" => new DateTime("16011028T030000"), + "RRULE" => "FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10", + "TZOFFSETFROM" => "+0200", + "TZOFFSETTO" => "+0100" + ]); + $vtimezone->TZID = date_default_timezone_get(); + $vtimezone->add($standard); + $vtimezone->add($daylight); + + return $vtimezone; + } + + /** + * [createRequestForWebcalEvent description] + * @return string La requête générée + */ + private function createRequestForWebcalEvent($userid, $commission, $isAllowedToViewAll) + { + $today = new \DateTime(); + $yearBefore = $today->modify("-1 year")->format("Y"); + + $dbDateCommission = new Model_DbTable_DateCommission; + + if (!$isAllowedToViewAll) { + $userid = null; + $commission = null; + } + + return $dbDateCommission->getEventInCommission( + $userid, + $commission, + $yearBefore, + null, + $isAllowedToViewAll + ); + } + + + private function createICSEvent($commissionEvent) + { + $event = null; + + if (is_array($commissionEvent)) { + if (isset($commissionEvent["ID_ETABLISSEMENT"])) { + $etsService = new Service_Etablissement; + $ets = $etsService->get($commissionEvent["ID_ETABLISSEMENT"]); + + $etsLibelleArray = array(); + foreach ($ets['parents'] as $parent) { + $etsLibelleArray[] = trim($parent['LIBELLE_ETABLISSEMENTINFORMATIONS']); + } + + $etsLibelleArray[] = trim($ets['informations']['LIBELLE_ETABLISSEMENTINFORMATIONS']); + $etsLibelle = implode(" - ", $etsLibelleArray); + } else { + $etsLibelle = ''; + } + $commune = $ets && count($ets["adresses"]) > 0 ? $ets["adresses"][0]["LIBELLE_COMMUNE"] : ''; + // Cas d'une commission en salle + if ($commissionEvent["ID_COMMISSIONTYPEEVENEMENT"] === 1) { + if ($commissionEvent["TYPE_DOSSIER"] === 3) { + $libelleSum = $commissionEvent["LIBELLE_DATECOMMISSION"]; + } else { + $libelleSum = $commissionEvent["OBJET_DOSSIER"]; + } + $summary = sprintf("#%s %s (%s) : %s %s - %s", + $ets ? $ets['general']['NUMEROID_ETABLISSEMENT'] : '', + $etsLibelle, + $commune, + $commissionEvent["LIBELLE_DOSSIERTYPE"], + $commissionEvent["LIBELLE_DOSSIERNATURE"], + trim($libelleSum)); + $geo = sprintf("Commission en salle de %s", $commissionEvent["LIBELLE_COMMISSION"]); + // Cas d'une visite d'une commission ou d'un groupe de visite + } else { + $summary = sprintf('#%s %s : %s', + $ets ? $ets['general']['NUMEROID_ETABLISSEMENT'] : '', + $etsLibelle, + $commissionEvent["LIBELLE_DATECOMMISSION"] + ); + $adresse = $ets && count($ets["adresses"]) > 0 ? $ets["adresses"][0] : null; + if ($adresse) { + $geo = sprintf("%s %s %s, %s %s", + $adresse["NUMERO_ADRESSE"], + $adresse["LIBELLE_RUETYPE"], + $adresse["LIBELLE_RUE"], + $adresse["CODEPOSTAL_COMMUNE"], + $adresse["LIBELLE_COMMUNE"] + ); + } else { + $geo = ''; + } + } + $dateStartHour = $commissionEvent["HEURE_DEB_AFFECT"] ? + "HEURE_DEB_AFFECT" : "HEUREDEB_COMMISSION"; + $dateEndHour = $commissionEvent["HEURE_FIN_AFFECT"] ? + "HEURE_FIN_AFFECT" : "HEUREFIN_COMMISSION"; + $dtStart = new \DateTime(sprintf("%s %s", + $commissionEvent["DATE_COMMISSION"], + $commissionEvent[$dateStartHour]), + new DateTimeZone(date_default_timezone_get())); + + $dtEnd = new \DateTime(sprintf("%s %s", + $commissionEvent["DATE_COMMISSION"], + $commissionEvent[$dateEndHour]), + new DateTimeZone(date_default_timezone_get())); + + $event = array( + "SUMMARY" => substr($summary, 0, 255), + "LOCATION" => $geo, + "DESCRIPTION" => $this->getEventCorps($commissionEvent, $ets), + "DTSTART" => $dtStart, + "DTEND" => $dtEnd + ); + } + + return $event; + } + + private function getAvisEtablissement($event, $ets = null) + { + if ($ets) { + $servEtab = new Service_Etablissement; + $avisDoss = $servEtab->getAvisEtablissement( + $ets['general']['ID_ETABLISSEMENT'], + $ets['general']['ID_DOSSIER_DONNANT_AVIS'] + ); + if ($ets['presence_avis_differe'] && $avisDoss === "avisDiff") { + $avis = "Dossier avec avis differé"; + } elseif ($ets['avis'] === 1) { + $avis = "Favorable"; + if ($ets['informations']["ID_GENRE"] === 3) { + $avis .= " à l'exploitation"; + } + } elseif ($ets['avis'] === 2) { + $avis = "Défavorable"; + if ($ets['informations']["ID_GENRE"] === 3) { + $avis .= " à l'exploitation"; + } + } else { + $avis = "Avis d'exploitation indisponible"; + } + } else { + $avis = "Avis d'exploitation indisponible"; + } + + return $avis; + } + + + private function getEventCorps($commissionEvent, $ets = null) + { + $corpus = "Contacts du dossier :".self::LF; + + if ($ets) { + $servEtab = new Service_Etablissement; + $dossierService = new Service_Dossier; + $contactsDossier = $dossierService->getAllContacts( + $commissionEvent["ID_DOSSIER"]); + $contactsEts = $servEtab->getAllContacts($ets['general']['ID_ETABLISSEMENT']); + $contacts = array_merge($contactsDossier, $contactsEts); + if (count($contacts) > 0) { + foreach ($contacts as $contact) { + $corpus .= $this->formatUtilisateurInformations($contact); + } + } else { + $corpus .= "Aucun contact".self::LF; + } + } else { + $corpus .= "Aucun contact".self::LF; + } + + $corpus .= self::LF.self::LF; + + $adresseService = new Service_Adresse; + $maire = $adresseService->getMaire($commissionEvent["NUMINSEE_COMMUNE"]); + if ($maire && count($maire) > 0) { + $corpus .= sprintf("Coordonnées de la mairie :%s%s%s", + self::LF, + $this->formatUtilisateurInformations($maire), + self::LF.self::LF + ); + } else { + $corpus .= "Aucune coordonées pour la mairie.".self::LF.self::LF; + } + + if ($commissionEvent["ID_DOSSIERTYPE"] === 1) { + if ($commissionEvent["TYPESERVINSTRUC_DOSSIER"] === "servInstCommune") { + $serviceInstruct = $maire; + } else { + $dbGroupement = new Model_DbTable_Groupement; + $serviceInstruct = $dbGroupement->getByLibelle( + $commissionEvent["SERVICEINSTRUC_DOSSIER"]); + $serviceInstruct = count($serviceInstruct) > 0 ? + $serviceInstruct[0] : null; + } + if ($maire && count($maire) > 0) { + $corpus .= sprintf("Coordonnées du service instructeur :%s%s%s", + self::LF, + $this->formatUtilisateurInformations($serviceInstruct) + .self::LF.self::LF + ); + } else { + $corpus .= "Aucune coordonées pour le service instructeur.".self::LF.self::LF; + } + } + + $lastVisitestr = $ets && $ets["last_visite"] ? $ets["last_visite"] : 'Aucune date.'; + $corpus .= sprintf("Date de la dernière visite périodique : %s%s", + $lastVisitestr, + self::LF.self::LF + ); + + $corpus .= sprintf("Avis d'exploitation de l'établissement : %s%s", + $this->getAvisEtablissement($commissionEvent, $ets), + self::LF.self::LF.self::LF); + + /* Ajout Grade, prenom, nom préventionniste dans calendrier dossier detail */ + $dossierService = new Service_Dossier; + $preventionnistes = $dossierService->getPreventionniste($commissionEvent["ID_DOSSIER"]); + + $preventionniste = $this->formatPrevisionniste($preventionnistes); + + $corpus .= "Préventionniste(s) du dossier : ".self::LF; + $corpus .= sprintf("%s%s", + $preventionniste, + self::LF.self::LF + ); + return $corpus; + } + + private function formatPrevisionniste($preventionnistes) + { + $result = ""; + // Si plusieurs préventionnistes liés au dossier + if(count($preventionnistes) > 1) + { + for($i = 0 ; $i < count($preventionnistes) ; $i++) + { + if($this->isPreventionnisteExist($preventionnistes, $i)) + { + $result .= sprintf("- %s%s%s%s", + $preventionnistes[$i]['GRADE_UTILISATEURINFORMATIONS'], + $preventionnistes[$i]['PRENOM_UTILISATEURINFORMATIONS'], + $preventionnistes[$i]['NOM_UTILISATEURINFORMATIONS'], + self::LF.self::LF + ); + } else + { + $result .= sprintf("- %s%s", + " Informations du prévisionniste incomplètes ou absentes", + self::LF.self::LF + ); + } + } + } + else + { + if($this->isPreventionnisteExist($preventionnistes, 0)) + { + $result = sprintf("- %s%s%s%s", + $preventionnistes[0]['GRADE_UTILISATEURINFORMATIONS'] . " ", + $preventionnistes[0]['PRENOM_UTILISATEURINFORMATIONS'] . " ", + $preventionnistes[0]['NOM_UTILISATEURINFORMATIONS'], + self::LF.self::LF.self::LF + ); + } else + { + $result .= sprintf("- %s%s", + "- Informations du prévisionniste incomplètes ou absentes", + self::LF.self::LF + ); + } + } + return $result; + } + + // Vérifie que toutes les informations liés au préventionnistes, grade / prenom / nom, est non null + private function isPreventionnisteExist($preventionnistes, $index) + { + if(empty($preventionnistes[$index]['GRADE_UTILISATEURINFORMATIONS']) || + empty($preventionnistes[$index]['PRENOM_UTILISATEURINFORMATIONS']) || + empty($preventionnistes[$index]['NOM_UTILISATEURINFORMATIONS'])) + { + return false; + } else { + return true; + } + } + + private function formatUtilisateurInformations($user) + { + $str = ""; + if ($user && is_array($user)) { + if ($user["NOM_UTILISATEURINFORMATIONS"]) { + $str .= sprintf("- %s : %s %s", + $user["LIBELLE_FONCTION"], + $user["NOM_UTILISATEURINFORMATIONS"], + $user["PRENOM_UTILISATEURINFORMATIONS"]); + if ($user["NUMEROADRESSE_UTILISATEURINFORMATIONS"] + && $user["RUEADRESSE_UTILISATEURINFORMATIONS"] + && $user["NUMEROADRESSE_UTILISATEURINFORMATIONS"] + && $user["CPADRESSE_UTILISATEURINFORMATIONS"] + && $user["VILLEADRESSE_UTILISATEURINFORMATIONS"]) { + $str .= sprintf(", %s %s, %s %s", + $user["NUMEROADRESSE_UTILISATEURINFORMATIONS"], + $user["RUEADRESSE_UTILISATEURINFORMATIONS"], + $user["CPADRESSE_UTILISATEURINFORMATIONS"], + $user["VILLEADRESSE_UTILISATEURINFORMATIONS"] + ); + } + if ($user["TELFIXE_UTILISATEURINFORMATIONS"]) { + $str .= sprintf(", %s", + $user["TELFIXE_UTILISATEURINFORMATIONS"]); + } + if ($user["TELFAX_UTILISATEURINFORMATIONS"]) { + $str .= sprintf(", %s", + $user["TELFAX_UTILISATEURINFORMATIONS"]); + } + if ($user["MAIL_UTILISATEURINFORMATIONS"]) { + $str .= sprintf(", %s", + $user["MAIL_UTILISATEURINFORMATIONS"]); + } + $str .= "\n"; + } + } + + return $str; + } +} \ No newline at end of file diff --git a/application/modules/api/services/Search.php b/application/modules/api/services/Search.php index fbaf128b..7a2d9a51 100755 --- a/application/modules/api/services/Search.php +++ b/application/modules/api/services/Search.php @@ -25,7 +25,7 @@ class Api_Service_Search public function etablissements($label = null, $identifiant = null, $genres = null, $categories = null, $classes = null, $familles = null, $types_activites = null, $avis_favorable = null, $statuts = null, $local_sommeil = null, $lon = null, $lat = null, $parent = null, $count = 10, $page = 1) { $service_search = new Service_Search; - $results = $service_search->etablissements($label, $identifiant, $genres, $categories, $classes, $familles, $types_activites, $avis_favorable, $statuts, $local_sommeil, $lon, $lat, $parent, null, null, $count, $page); + $results = $service_search->etablissements($label, $identifiant, $genres, $categories, $classes, $familles, $types_activites, $avis_favorable, $statuts, $local_sommeil, $lon, $lat, $parent, null, null, null, $count, $page); return $results; } diff --git a/application/navigation.xml b/application/navigation.xml index c3908430..613fe2e5 100755 --- a/application/navigation.xml +++ b/application/navigation.xml @@ -518,6 +518,15 @@ + + + changement + index + alerte_email + alerte_statut + alerte_avis + alerte_classement + @@ -527,17 +536,22 @@ calendrierdescommissions commission - + calendrier-des-commissions index lecture_commission - + calendrier-des-commissions exportoutlook + + + calendrier-des-commissions + syncoutlook + calendrier-des-commissions @@ -696,6 +710,14 @@ index view_doss + + dossier + delete + + dossier verrou @@ -863,7 +885,7 @@ textesapplicables view_doss - + dossier edit-textes-applicables @@ -962,6 +984,12 @@ index view_ets + + etablissement + delete + suppression + delete_etablissement + etablissement @@ -1071,51 +1099,43 @@ historique view_ets + + + etablissement + alerteform + view_ets + - - - - Listing - - - - Listing - etablissements - - - - Listing - dossiers - - - - search + search search etablissement + search_ets search dossier + search_dossiers - - + search - utilisateur - - + display-ajax-search-etablissement + search_ets + + search - display-ajax-search - + display-ajax-search-dossier + search_dossiers + @@ -1133,7 +1153,7 @@ statistiques ccdsa-liste-erp-en-exploitation-connus-soumis-a-controle - + statistiques liste-erp-avec-visite-periodique-sur-un-an @@ -1151,9 +1171,9 @@ - session - - + session + + session @@ -1169,9 +1189,9 @@ - about - - + about + + about diff --git a/application/plugins/ACL.php b/application/plugins/ACL.php index 060aaede..126e22dc 100755 --- a/application/plugins/ACL.php +++ b/application/plugins/ACL.php @@ -67,8 +67,7 @@ public static function getAcl() { public function preDispatch(Zend_Controller_Request_Abstract $request) { // Si l'utilisateur est connecté avec l'application mobile, on utilise le partage d'un token - if($request->getParam('key') === getenv('PREVARISC_SECURITY_KEY')) - { + if($request->getParam('key') === getenv('PREVARISC_SECURITY_KEY')) { return ; } @@ -82,10 +81,11 @@ public function preDispatch(Zend_Controller_Request_Abstract $request) } // Initialize phpCAS - phpCAS::client(getenv('PREVARISC_CAS_VERSION') ? : CAS_VERSION_2_0, getenv('PREVARISC_CAS_HOST'), (int) getenv('PREVARISC_CAS_PORT'), getenv('PREVARISC_CAS_CONTEXT'), false); - - phpCAS::setLang(PHPCAS_LANG_FRENCH); + if (!phpCAS::isInitialized()) { + phpCAS::client(getenv('PREVARISC_CAS_VERSION') ? : CAS_VERSION_2_0, getenv('PREVARISC_CAS_HOST'), (int) getenv('PREVARISC_CAS_PORT'), getenv('PREVARISC_CAS_CONTEXT'), false); + phpCAS::setLang(PHPCAS_LANG_FRENCH); + } if (getenv('PREVARISC_CAS_NO_SERVER_VALIDATION') == 1) { phpCAS::setNoCasServerValidation(); } diff --git a/application/plugins/SimpleFileDataStore.php b/application/plugins/SimpleFileDataStore.php index 78782eae..01eb7462 100644 --- a/application/plugins/SimpleFileDataStore.php +++ b/application/plugins/SimpleFileDataStore.php @@ -136,21 +136,33 @@ public function getFormattedFilename($piece_jointe, $linkedObjectType, $linkedOb '%TYPE_OBJET%' => $linkedObjectType, '%CODE_TYPE_OBJET%' => strtoupper(substr($linkedObjectType, 0, 3)), '%SHORT_CODE_TYPE_OBJET%' => strtoupper(substr($linkedObjectType, 0, 1)), + '%NUMEROID_ETABLISSEMENT%' => null, ); switch($linkedObjectType) { case 'etablissement': $service = new Service_Etablissement; $etablissement = $service->get($linkedObjectId); - $tokens['%NUMEROID_ETABLISSEMENT%'] = $etablissement['general']['NUMEROID_ETABLISSEMENT'] ? $etablissement['general']['NUMEROID_ETABLISSEMENT'] : $linkedObjectId; + $tokens[] = $etablissement['general']['NUMEROID_ETABLISSEMENT'] ? $etablissement['general']['NUMEROID_ETABLISSEMENT'] : $linkedObjectId; break; case 'dossier': $db = new Model_DbTable_EtablissementDossier; $dossiers = $db->getEtablissementListe($linkedObjectId); - if ($dossiers && count($dossiers) > 0) { - $service = new Service_Etablissement; - $etablissement = $service->get($dossiers[0]['ID_ETABLISSEMENT']); - $tokens['%NUMEROID_ETABLISSEMENT%'] = $etablissement['general']['NUMEROID_ETABLISSEMENT'] ? $etablissement['general']['NUMEROID_ETABLISSEMENT'] : $linkedObjectId; + $default_numeroid = array(); + if ($dossiers) { + foreach($dossiers as $dossier) { + $service = new Service_Etablissement; + $etablissement = $service->get($dossier['ID_ETABLISSEMENT']); + $numero_id = $etablissement['general']['NUMEROID_ETABLISSEMENT'] ? $etablissement['general']['NUMEROID_ETABLISSEMENT'] : $linkedObjectId; + if (stripos($piece_jointe['DESCRIPTION_PIECEJOINTE'], $numero_id) !== false) { + $tokens['%NUMEROID_ETABLISSEMENT%'] = $numero_id; + break; + } + $default_numeroid[] = $numero_id; + } + if (!$tokens['%NUMEROID_ETABLISSEMENT%']) { + $tokens['%NUMEROID_ETABLISSEMENT%'] = implode("_", $default_numeroid); + } } else { $tokens['%NUMEROID_ETABLISSEMENT%'] = $linkedObjectId; diff --git a/application/services/Adresse.php b/application/services/Adresse.php index 3891df1c..f9085920 100755 --- a/application/services/Adresse.php +++ b/application/services/Adresse.php @@ -57,16 +57,18 @@ public function getVoies($code_insee, $q = '') /** * Retourne le maire de la commune concernée - * + * * @param int $numinsee le numéro insee de la commune * @return array les informations de la fiche contact du maire */ - public function getMaire($numinsee) { + public function getMaire($numinsee) + { $select = new Zend_Db_Select(Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('db')); - $select->from("adressecommune") - ->join("utilisateurinformations", "utilisateurinformations.ID_UTILISATEURINFORMATIONS = adressecommune.ID_UTILISATEURINFORMATIONS") - ->where("adressecommune.NUMINSEE_COMMUNE = ?", $numinsee) + $select->from(array('ac' => "adressecommune")) + ->join(array('ui' => "utilisateurinformations"), "ui.ID_UTILISATEURINFORMATIONS = ac.ID_UTILISATEURINFORMATIONS") + ->join(array('f' => 'fonction'), 'ui.ID_FONCTION = f.ID_FONCTION') + ->where("ac.NUMINSEE_COMMUNE = ?", $numinsee) ->limit(1); return $select->query()->fetch(); diff --git a/application/services/Alerte.php b/application/services/Alerte.php new file mode 100644 index 00000000..9d3361d7 --- /dev/null +++ b/application/services/Alerte.php @@ -0,0 +1,16 @@ +Alerter'; + + public function getLink($idTypeChangement, $idEtablissement = null) + { + $etabData = ""; + if ($idEtablissement) { + $etabData = sprintf(' data-ets="%s"', $idEtablissement); + } + + return sprintf(self::ALERTE_LINK, $idTypeChangement, $etabData); + } +} \ No newline at end of file diff --git a/application/services/Changement.php b/application/services/Changement.php new file mode 100644 index 00000000..87a92cd4 --- /dev/null +++ b/application/services/Changement.php @@ -0,0 +1,200 @@ + array( + "description" => "L'activité principale de l'établissement", + "model" => "informations", + "champ" => "LIBELLE_TYPEACTIVITE_PRINCIPAL" + ), + "{categorieEtablissement}" => array( + "description" => "La catégorie de l'etablissement", + "model" => "informations", + "champ" => "LIBELLE_CATEGORIE" + ), + "{etablissementAvis}" => array( + "description" => "L'avis de l'établissement", + "model" => "avis", + "champ" => "" + ), + "{etablissementLibelle}" => array( + "description" => "Le libelle de l'établissement", + "model" => "informations", + "champ" => "LIBELLE_ETABLISSEMENTINFORMATIONS" + ), + "{etablissementNumeroId}" => array( + "description" => "Le numéro Id de l'établissement", + "model" => "general", + "champ" => "NUMEROID_ETABLISSEMENT" + ), + "{etablissementStatut}" => array( + "description" => "Le statut (Ouvert ou Fermé) de l'établissement", + "model" => "informations", + "champ" => "LIBELLE_STATUT" + ), + "{typePrincipalEtablissement}" => array( + "description" => "Le type principal de l'établissement", + "model" => "informations", + "champ" => "LIBELLE_TYPE_PRINCIPAL" + ) + + ); + + /** + * Retourne tous les enregistrement contenus dans la table changement + * + * @return array Le résultat + */ + public function getAll() + { + $dbChangement = new Model_DbTable_Changement; + + return $dbChangement->findAll(); + } + + /** + * Retourne un changement via son Id précisé en argument + * + * @param int $idChangement L'id du changement à retourner + * @return array Le résultat + */ + public function get($idChangement) + { + $dbChangement = new Model_DbTable_Changement; + + return $dbChangement->find($idChangement)->current(); + } + + /** + * Sauvegarde les modifications apportées aux messages d'alerte + * par défaut + * + * @param array $data Les données envoyés en post + * @return void + */ + public function save($data) + { + if (is_array($data)) { + foreach ($data as $key => $message) { + $idChangement = explode('_', $key)[0]; + $changement = $this->get($idChangement); + $changement->MESSAGE_CHANGEMENT = $message; + $changement->save(); + } + } + } + + /** + * Retourne le tableau de balises + * + * @return array Les balises définies dans cette classe + */ + public function getBalises() + { + return self::BALISES; + } + + /** + * Retourne l'objet du mail de changement formaté + * + * @param int $idChangement Id du changement + * @param array $ets Etablissement concerné + * @return string L'objet formaté + */ + public function getObjet($idChangement, $ets) + { + switch($idChangement) { + case "1": + $objet = sprintf("Passage au statut \"%s\"", + $ets['informations']['LIBELLE_STATUT']); + break; + case "2": + $objet = sprintf("Passage en avis \"%s\"", + $this->getAvis($ets)); + break; + case "3": + $objet = sprintf("Changement de classement \"%s - %s %s\"", + $ets['informations']['LIBELLE_CATEGORIE'], + $ets['informations']['LIBELLE_TYPE_PRINCIPAL'], + $ets['informations']['LIBELLE_TYPEACTIVITE_PRINCIPAL'] + ); + break; + default: + $objet = ""; + } + + $commune = ""; + if (count($ets['adresses']) > 0) { + $commune = $ets['adresses'][0]['LIBELLE_COMMUNE']; + } + + $libelleInfos = $ets['informations']['LIBELLE_ETABLISSEMENTINFORMATIONS']; + if (count($ets['parents']) > 0) { + $libelleInfos = sprintf("%s %s", + $ets['parents'][0]['LIBELLE_ETABLISSEMENTINFORMATIONS'], + $libelleInfos + ); + } + + return sprintf("%s (%s) - %s", + $libelleInfos, + $commune, + $objet); + } + + /** + * Convertit les balises dans le message avec les bonnes valeurs + * + * @param string $message Le message a envoyer avec des balises + * @return string Le message convertit + */ + public function convertMessage($message, $ets) + { + $params = array(); + foreach(self::BALISES as $balise => $content) { + $replacementstr = ""; + if ($content['model'] === "avis") { + $replacementstr = $this->getAvis($ets); + } elseif (array_key_exists($content['model'], $ets) + && array_key_exists($content['champ'], $ets[$content['model']])) { + $replacementstr = $ets[$content['model']][$content['champ']]; + } + $params[$balise] = $replacementstr; + } + + return strtr($message, $params); + } + + /** + * Retourne l'avis d'un établissement formaté + * + * @param array $ets L'établissement + * @return string L'avis de l'établissement + */ + public function getAvis($ets) + { + $avis = ''; + $serviceEts = new Service_Etablissement; + $avisType = $serviceEts->getAvisEtablissement( + $ets['general']['ID_ETABLISSEMENT'], $ets['general']['ID_DOSSIER_DONNANT_AVIS']); + + if ($ets['presence_avis_differe'] == true && $avisType == "avisDiff") { + $avis = "Présence d'un dossier avec avis differé"; + } elseif ($ets['avis'] != null) { + if($ets['avis'] == 1 && $avisType == "avisDoss") { + $avis = "Favorable" . ($ets['informations']['ID_GENRE'] == 3 ? '' : " à l'exploitation"); + } elseif ($ets['avis'] == 2 && $avisType == "avisDoss") { + $avis = "Défavorable" . ($ets['informations']['ID_GENRE'] == 3 ? '' : " à l'exploitation"); + } + } else { + $avis = "Avis d'exploitation indisponible"; + } + + return $avis; + } +} \ No newline at end of file diff --git a/application/services/Dossier.php b/application/services/Dossier.php old mode 100644 new mode 100755 index 088664e6..b6b46771 --- a/application/services/Dossier.php +++ b/application/services/Dossier.php @@ -197,15 +197,19 @@ public function saveTextesApplicables($id_dossier, array $textes_applicables) //On récupère le premier établissements afin de mettre à jour ses textes applicables lorsque l'on est dans une visite if (2 == $type || 3 == $type) { $tabEtablissement = $dbDossier->getEtablissementDossier($id_dossier); - $id_etablissement = $tabEtablissement[0]['ID_ETABLISSEMENT']; + $id_etablissement = isset($tabEtablissement[0]) ? $tabEtablissement[0]['ID_ETABLISSEMENT'] : null; } foreach ($textes_applicables as $id_texte_applicable => $is_active) { if (!$is_active) { - if ($dossierTexteApplicable->find($id_texte_applicable, $id_dossier)->current() !== null) { - $dossierTexteApplicable->find($id_texte_applicable, $id_dossier)->current()->delete(); - if (2 == $type || 3 == $type) { - $etsTexteApplicable->find($id_texte_applicable, $id_etablissement)->current()->delete(); + $texte_applicable = $dossierTexteApplicable->find($id_texte_applicable, $id_dossier)->current(); + if ($texte_applicable !== null) { + $texte_applicable->delete(); + if ((2 == $type || 3 == $type) && $id_etablissement) { + $texte_applicable = $etsTexteApplicable->find($id_texte_applicable, $id_etablissement)->current(); + if ($texte_applicable !== null) { + $texte_applicable->delete(); + } } } } else { @@ -214,7 +218,7 @@ public function saveTextesApplicables($id_dossier, array $textes_applicables) $row->ID_TEXTESAPPL = $id_texte_applicable; $row->ID_DOSSIER = $id_dossier; $row->save(); - if (2 == $type || 3 == $type) { + if ((2 == $type || 3 == $type) && $id_etablissement) { $exist = $etsTexteApplicable->find($id_texte_applicable,$id_etablissement)->current(); if (! $exist) { $row = $etsTexteApplicable->createRow(); @@ -321,7 +325,7 @@ public function deleteContact($id_dossier, $id_contact) */ public function getPrescriptions($id_dossier,$type) { - /* + /* suivant la valeur de $type 0 = rappel réglementaire 1 = a l'exploitation @@ -422,7 +426,7 @@ public function savePrescription($post) } $nbPresc = 1; - $listeExploit = $dbPrescDossier->recupPrescDossier($post['id_dossier'], 1); + $listeExploit = $dbPrescDossier->recupPrescDossier($post['id_dossier'], 1); foreach($listeExploit as $prescDossier){ $prescCount = $dbPrescDossier->find($prescDossier['ID_PRESCRIPTION_DOSSIER'])->current(); $prescCount->NUM_PRESCRIPTION_DOSSIER = $nbPresc; @@ -487,7 +491,7 @@ public function savePrescription($post) } $nbPresc = 1; - $listeExploit = $dbPrescDossier->recupPrescDossier($post['id_dossier'], 1); + $listeExploit = $dbPrescDossier->recupPrescDossier($post['id_dossier'], 1); foreach($listeExploit as $prescDossier){ $prescCount = $dbPrescDossier->find($prescDossier['ID_PRESCRIPTION_DOSSIER'])->current(); $prescCount->NUM_PRESCRIPTION_DOSSIER = $nbPresc; @@ -515,7 +519,7 @@ public function savePrescription($post) $prescEdit->LIBELLE_PRESCRIPTION_DOSSIER = $post['PRESCRIPTION_LIBELLE']; $prescEdit->TYPE_PRESCRIPTION_DOSSIER = $post['TYPE_PRESCRIPTION_DOSSIER']; $prescEdit->save(); - + $nombreAssoc = count($post['texte']); for ($i = 0; $i< $nombreAssoc; $i ++) { $newAssoc = $dbPrescDossierAssoc->createRow(); @@ -645,13 +649,15 @@ public function savePrescriptionRegl($idDossier, $prescriptionRegl) foreach($prescriptionRegl as $val => $ue){ $prescEdit = $dbPrescDossier->createRow(); $prescEdit->ID_DOSSIER = $idDossier; - $prescEdit->LIBELLE_PRESCRIPTION_DOSSIER = $ue[0]['PRESCRIPTIONREGL_LIBELLE']; + if (array_key_exists(0, $ue) && array_key_exists('PRESCRIPTIONREGL_LIBELLE', $ue[0])) { + $prescEdit->LIBELLE_PRESCRIPTION_DOSSIER = $ue[0]['PRESCRIPTIONREGL_LIBELLE']; + } $prescEdit->TYPE_PRESCRIPTION_DOSSIER = 0; $prescEdit->NUM_PRESCRIPTION_DOSSIER = $j++; $prescEdit->save(); $nombreAssoc = count($ue); - for ($i = 0; $i< $nombreAssoc; $i ++) { + for ($i = 0; $i < $nombreAssoc; $i++) { $newAssoc = $dbPrescDossierAssoc->createRow(); $newAssoc->NUM_PRESCRIPTION_DOSSIERASSOC = $i + 1; $newAssoc->ID_PRESCRIPTION_DOSSIER = $prescEdit->ID_PRESCRIPTION_DOSSIER; @@ -661,16 +667,18 @@ public function savePrescriptionRegl($idDossier, $prescriptionRegl) } } } - + public function changePosPrescription($tabId){ $DBprescDossier = new Model_DbTable_PrescriptionDossier(); $numPresc = 1; foreach ($tabId as $idPrescDoss) { - $updatePrescDossier = $DBprescDossier->find($idPrescDoss)->current(); - $updatePrescDossier->NUM_PRESCRIPTION_DOSSIER = $numPresc; - $updatePrescDossier->save(); - $numPresc++; + if ($idPrescDoss) { + $updatePrescDossier = $DBprescDossier->find($idPrescDoss)->current(); + $updatePrescDossier->NUM_PRESCRIPTION_DOSSIER = $numPresc; + $updatePrescDossier->save(); + $numPresc++; + } } } @@ -722,10 +730,10 @@ public function getEtabInfos($id_dossier = null, $id_etablissement = null){ } } - + public function isDossierDonnantAvis($dossier, $idNature) { - - return + + return //Cas d'une étude uniquement dans le cas d'une levée de reserve in_array($idNature, array(19, 7, 17, 16)) && $dossier->DATECOMM_DOSSIER //Cas d'une viste uniquement dans le cas d'une VP, inopinée, avant ouverture ou controle @@ -733,33 +741,31 @@ public function isDossierDonnantAvis($dossier, $idNature) { //Cas d'un groupe deviste uniquement dans le cas d'une VP, inopinée, avant ouverture ou controle || in_array($idNature, array(26, 28, 29, 48)) && $dossier->DATECOMM_DOSSIER; } - + public function getDateDossier($dossier) { - $date = $dossier->DATEINSERT_DOSSIER; - if($dossier->TYPE_DOSSIER == 1 || $dossier->TYPE_DOSSIER == 3){ if($dossier->DATECOMM_DOSSIER != NULL && $dossier->DATECOMM_DOSSIER != ''){ $date = $dossier->DATECOMM_DOSSIER; } - + } else if($dossier->TYPE_DOSSIER == 2) { if($dossier->DATEVISITE_DOSSIER != NULL && $dossier->DATEVISITE_DOSSIER != ''){ $date = $dossier->DATEVISITE_DOSSIER; } } - + return new Zend_Date($date, Zend_Date::DATES); } - + public function saveDossierDonnantAvis($nouveauDossier, $listeEtab, $cache, $repercuterAvis = false) { $dbEtab = new Model_DbTable_Etablissement(); $DBdossier = new Model_DbTable_Dossier(); $service_etablissement = new Service_Etablissement(); $updatedEtab = array(); - + foreach ($listeEtab as $val => $ue) { $etabToEdit = $dbEtab->find($ue['ID_ETABLISSEMENT'])->current(); $MAJEtab = 0; @@ -784,7 +790,7 @@ public function saveDossierDonnantAvis($nouveauDossier, $listeEtab, $cache, $rep $etabToEdit->ID_DOSSIER_DONNANT_AVIS = $nouveauDossier->ID_DOSSIER; $etabToEdit->save(); $updatedEtab[] = $etabToEdit; - + if ($repercuterAvis) { $etablissementInfos = $service_etablissement->get($ue['ID_ETABLISSEMENT']); foreach ($etablissementInfos["etablissement_lies"] as $etabEnfant) { @@ -798,19 +804,62 @@ public function saveDossierDonnantAvis($nouveauDossier, $listeEtab, $cache, $rep } } } - + foreach($updatedEtab as $etablissement) { $cache->remove(sprintf('etablissement_id_%d', $etablissement['ID_ETABLISSEMENT'])); if ($parent = $dbEtab->getParent($etablissement['ID_ETABLISSEMENT'])) { $cache->remove(sprintf('etablissement_id_%d', $parent['ID_ETABLISSEMENT'])); } } - + return $updatedEtab; } - + public function getCommission($idDossier) { $dbDossier = new Model_DbTable_Dossier; return $dbDossier->getCommissionV2($idDossier); } + + + public function delete($idDossier, $date = null, $uniqueEtab = false) + { + if (!$date) { + $date = new DateTime(); + } + $DB_dossier = new Model_DbTable_Dossier(); + + $dossier = $DB_dossier->find($idDossier)->current(); + $deleteDossier = true; + if ($uniqueEtab) { + $DB_etsDossier = new Model_DbTable_EtablissementDossier(); + $deleteDossier = !(count($DB_etsDossier->getEtablissementListe($idDossier)) > 1); + } + if ($deleteDossier) { + $dossier->DATESUPPRESSION_DOSSIER = $date->format('Y-m-d'); + + //suppression de la date de passage en commission + $dbAffectDossier = new Model_DbTable_DossierAffectation(); + $affectDossier = $dbAffectDossier->deleteDateDossierAffect($idDossier); + + $dossier->save(); + } + } + + public function deleteByEtab($idEtablissement) + { + $date = new DateTime(); + $DB_dossier = new Model_DbTable_Dossier(); + + $dossiers = $DB_dossier->getDossiersEtab($idEtablissement); + + foreach ($dossiers as $dossier) { + $this->delete($dossier['ID_DOSSIER'], $date, true); + } + } + + public function getPreventionniste($idDossier) { + $DB_prev = new Model_DbTable_DossierPreventionniste; + + return $DB_prev->getPrevDossier($idDossier); + } } diff --git a/application/services/Etablissement.php b/application/services/Etablissement.php index d205a8d1..2bf3efa7 100755 --- a/application/services/Etablissement.php +++ b/application/services/Etablissement.php @@ -2,6 +2,8 @@ class Service_Etablissement implements Service_Interface_Etablissement { + const STATUT_CHANGE = 1; + const CLASSEMENT_CHANGE = 3; /** * Récupération d'un établissement * @@ -39,13 +41,13 @@ public function get($id_etablissement) $general = $model_etablissement->find($id_etablissement)->current(); // Si l'établissement n'existe pas, on généère une erreur - if($general === null) { + if($general === null + || null !== $general['DATESUPPRESSION_ETABLISSEMENT']) { throw new Exception("L'établissement n'existe pas."); } // On récupère la dernière fiche d'informations de l'établissement $informations = $model_etablissement->getInformations($id_etablissement); - // Si l'établissement n'existe pas, on généère une erreur if($informations === null) { throw new Exception("La fiche d'informations de l'établissement n'existe pas."); @@ -99,7 +101,7 @@ public function get($id_etablissement) $tmp_date = new Zend_Date($tmp_date->get( Zend_Date::WEEKDAY." ".Zend_Date::DAY_SHORT." ".Zend_Date::MONTH_NAME_SHORT." ".Zend_Date::YEAR ), Zend_Date::DATES); $tmp_date->add($informations->PERIODICITE_ETABLISSEMENTINFORMATIONS, Zend_Date::MONTH); $next_visite = $tmp_date->get(Zend_Date::MONTH_NAME." ".Zend_Date::YEAR ); - } + } } else { $last_visite = null; } @@ -163,7 +165,7 @@ public function get($id_etablissement) else if ($informations->ID_GENRE == 3 && $parent_direct) { // la catégorie d'une cellule est celle de l'établissement parent $informations->ID_CATEGORIE = $parent_direct['ID_CATEGORIE']; - + $donnees_pratiques = array( 'NBPREV_ETABLISSEMENT' => $general->NBPREV_ETABLISSEMENT, 'DUREEVISITE_ETABLISSEMENT' => $general->DUREEVISITE_ETABLISSEMENT @@ -187,19 +189,18 @@ public function get($id_etablissement) } else if($etablissement['ID_STATUT'] != 2) { continue; } - + if ($informations['PERIODICITE_ETABLISSEMENTINFORMATIONS'] === null) { $informations['PERIODICITE_ETABLISSEMENTINFORMATIONS'] = $etablissement['PERIODICITE_ETABLISSEMENTINFORMATIONS']; } else if ($informations['PERIODICITE_ETABLISSEMENTINFORMATIONS'] > $etablissement['PERIODICITE_ETABLISSEMENTINFORMATIONS']) { $informations['PERIODICITE_ETABLISSEMENTINFORMATIONS'] = $etablissement['PERIODICITE_ETABLISSEMENTINFORMATIONS']; } - + } } else if ($informations->ID_GENRE == 3 && $etablissement_parents) { $informations['PERIODICITE_ETABLISSEMENTINFORMATIONS'] = end($etablissement_parents)['PERIODICITE_ETABLISSEMENTINFORMATIONS']; } - - + $commission = @$DB_commission->find($informations->ID_COMMISSION)->current(); $etablissement = array( 'general' => $general->toArray(), @@ -320,16 +321,28 @@ public function getHistorique($id_etablissement) } // On traite le cas particulier des dossiers - $key = "avis"; $dossiers = $this->getDossiers($id_etablissement); $dossiers_merged = $dossiers['etudes']; $dossiers_merged = array_merge($dossiers_merged, $dossiers['visites']); $dossiers_merged = array_merge($dossiers_merged, $dossiers['autres']); - + + // on filtre les dossiers ne donnant pas avis + foreach($dossiers_merged as $key => $dossier) { + if(!in_array($dossier['AVIS_DOSSIER_COMMISSION'], array(1, 2))) { + unset($dossiers_merged[$key]); + } + else if(!in_array($dossier['ID_DOSSIERNATURE'], array(7, 16, 17, 19, 21, 23, 24, 47, 26, 28, 29, 48)) ) { + unset($dossiers_merged[$key]); + } + else if(!$dossier['DATECOMM_DOSSIER'] && !$dossier['DATEVISITE_DOSSIER']) { + unset($dossiers_merged[$key]); + } + } + @usort($dossiers_merged, function($a, $b) { - $date_a = @new Zend_Date($a['DATEVISITE_DOSSIER'] != null ? $a['DATEVISITE_DOSSIER'] : $a['DATECOMM_DOSSIER'], Zend_Date::DATES); - $date_b = @new Zend_Date($b['DATEVISITE_DOSSIER'] != null ? $b['DATEVISITE_DOSSIER'] : $b['DATECOMM_DOSSIER'], Zend_Date::DATES); + $date_a = @new Zend_Date($a['DATECOMM_DOSSIER'] != null ? $a['DATECOMM_DOSSIER'] : $a['DATEVISITE_DOSSIER'], Zend_Date::DATES); + $date_b = @new Zend_Date($b['DATECOMM_DOSSIER'] != null ? $b['DATECOMM_DOSSIER'] : $b['DATEVISITE_DOSSIER'], Zend_Date::DATES); if ($date_a == $date_b || $a === null || $b === null) { return 0; @@ -342,20 +355,16 @@ public function getHistorique($id_etablissement) } }); + $key = "avis"; foreach($dossiers_merged as $dossier) { $dossier = (object) $dossier; $tmp = ( array_key_exists($key, $historique) ) ? $historique[$key][ count($historique[$key])-1 ] : null; - $value = null; + $value = $dossier->AVIS_DOSSIER_COMMISSION == 1 ? "Favorable" : "Défavorable"; $author = null; - - if($dossier->AVIS_DOSSIER_COMMISSION && ($dossier->AVIS_DOSSIER_COMMISSION == 1 || $dossier->AVIS_DOSSIER_COMMISSION == 2)) { - if( in_array($dossier->ID_DOSSIERNATURE, array(7, 16, 17, 19, 21, 23, 24, 47, 26, 28, 29, 48)) ) { - $value = $dossier->AVIS_DOSSIER_COMMISSION == 1 ? "Favorable" : "Défavorable"; - } - } - + if ( $value != null && (!isset( $historique[$key] ) || $tmp["valeur"] != $value )) { - $date = new Zend_Date($dossier->DATEVISITE_DOSSIER != null ? $dossier->DATEVISITE_DOSSIER : $dossier->DATECOMM_DOSSIER, Zend_Date::DATES); + + $date = new Zend_Date($dossier->DATECOMM_DOSSIER != null ? $dossier->DATECOMM_DOSSIER : $dossier->DATEVISITE_DOSSIER, Zend_Date::DATES); if ($tmp != null) { $historique[$key][ count($historique[$key])-1 ]["fin"] = $date->get( Zend_Date::DAY_SHORT." ".Zend_Date::MONTH_NAME_SHORT." ".Zend_Date::YEAR ); } @@ -508,7 +517,7 @@ public function getDescriptifs($id_etablissement) case "DEFENSE": $title = "Défense incendie"; break; case "RISQUES": $title = "Risques"; break; } - + $champs_descriptif_technique[$title][array_key_exists($key, $translation_champs_des_tech) ? $translation_champs_des_tech[$key] : $key] = array( 'value' => $value, 'type' => $dbtable_info_etablissement['metadata'][$key]['DATA_TYPE'], @@ -606,6 +615,47 @@ public function ficheExiste($id_etablissement, $date) return (null != ($row = $DB_information->fetchRow("ID_ETABLISSEMENT = '" . $id_etablissement . "' AND DATE_ETABLISSEMENTINFORMATIONS = '" . $date . "'"))) ? true : false; } + + public function checkAlerte($ets, $postData) + { + $alerte = false; + + if ($ets && $postData) { + + if ($ets["informations"]["ID_STATUT"] != $postData["ID_STATUT"]) { + $alerte = self::STATUT_CHANGE; + } + + + if ($ets["informations"]["ID_CATEGORIE"] != $postData["ID_CATEGORIE"] + || $ets["informations"]["ID_TYPE"] != $postData["ID_TYPE"] + || $ets["informations"]["ID_TYPEACTIVITE"] != $postData["ID_TYPEACTIVITE"] + || $this->compareActivitesSecondaires($ets, $postData)) { + $alerte = self::CLASSEMENT_CHANGE; + } + + } + + return $alerte; + } + + private function compareActivitesSecondaires($ets, $postData) + { + $result = false; + + foreach($ets['types_activites_secondaires'] as $typesASecondaires) { + if ( ! array_key_exists($typesASecondaires[ + 'ID_ETABLISSEMENTINFORMATIONSTYPESACTIVITESSECONDAIRES'], + $postData['TYPES_ACTIVITES_SECONDAIRES'])) { + $result = true; + break; + } + } + + return $result; + } + + /** * Sauvegarde d'un établissement * @@ -635,7 +685,7 @@ public function save($id_genre, array $data, $id_etablissement = null, $date = ' try { - $data['LOCALSOMMEIL_ETABLISSEMENTINFORMATIONS'] = (!isset($data['LOCALSOMMEIL_ETABLISSEMENTINFORMATIONS']) && $data['LOCALSOMMEIL_ETABLISSEMENTINFORMATIONS'] == null) ? 0 : $data['LOCALSOMMEIL_ETABLISSEMENTINFORMATIONS']; + $data['LOCALSOMMEIL_ETABLISSEMENTINFORMATIONS'] = isset($data['LOCALSOMMEIL_ETABLISSEMENTINFORMATIONS']) && $data['LOCALSOMMEIL_ETABLISSEMENTINFORMATIONS'] !== null ? $data['LOCALSOMMEIL_ETABLISSEMENTINFORMATIONS'] : 0; $etablissement = $id_etablissement == null ? $DB_etablissement->createRow() : $DB_etablissement->find($id_etablissement)->current(); @@ -731,9 +781,11 @@ public function save($id_genre, array $data, $id_etablissement = null, $date = ' break; // Camping - case 7: - $informations->EFFECTIFPUBLIC_ETABLISSEMENTINFORMATIONS = (int) $data['EFFECTIFPUBLIC_ETABLISSEMENTINFORMATIONS']; - $informations->EFFECTIFPERSONNEL_ETABLISSEMENTINFORMATIONS = (int) $data['EFFECTIFPERSONNEL_ETABLISSEMENTINFORMATIONS']; + case 7: + $informations->EFFECTIFCARAVANE__ETABLISSEMENTINFORMATIONS = (int) $data['EFFECTIFCARAVANE__ETABLISSEMENTINFORMATIONS']; + $informations->EFFECTIFHABITATION_ETABLISSEMENTINFORMATIONS = (int) $data['EFFECTIFHABITATION_ETABLISSEMENTINFORMATIONS']; + $informations->EFFECTIFEMPLACEMENTNU_ETABLISSEMENTINFORMATIONS = (int) $data['EFFECTIFEMPLACEMENTNU_ETABLISSEMENTINFORMATIONS']; + $informations->EFFECTIFDIVERS_ETABLISSEMENTINFORMATIONS = (int) $data['EFFECTIFDIVERS_ETABLISSEMENTINFORMATIONS']; break; // Manifestation temporaire @@ -849,14 +901,14 @@ public function save($id_genre, array $data, $id_etablissement = null, $date = ' foreach($data['ID_FILS_ETABLISSEMENT'] as $id_etablissement_enfant) { if($id_etablissement_enfant > 0) { $genre_enfant = $DB_etablissement->getInformations($id_etablissement_enfant)->ID_GENRE; - if($id_genre == 1 && ($genre_enfant != 2 && $genre_enfant != 4 && $genre_enfant != 5 && $genre_enfant != 6)) { - throw new Exception('L\'établissement enfant n\'est pas compatible (Un site ne ne peut contenir que des établissements)', 500); + if($id_genre == 1 && !in_array($genre_enfant, array(2,4,5,6,7,8,9))) { + throw new Exception('L\'établissement enfant n\'est pas compatible (Un site ne ne peut contenir que des établissements, habitations, EIC, camping, manifestation, IOP)', 500); } - elseif($id_genre == 2 && $genre_enfant != 3) { - throw new Exception('L\'établissement enfant n\'est pas compatible (Un établissement ne ne peut contenir que des cellules)', 500); + elseif(in_array($id_genre, array(2,5)) && $genre_enfant != 3) { + throw new Exception('L\'établissement enfant n\'est pas compatible (Un établissement ou IGH ne ne peut contenir que des cellules)', 500); } elseif($genre_enfant == 1){ - throw new Exception('L\'établissement enfant n\'est pas compatible (Un site ne peut pas être un établissement enfant)', 500); + throw new Exception('L\'établissement enfant n\'est pas compatible (Un site ne peut être enfant)', 500); } elseif($genre_enfant == null) { throw new Exception('L\'établissement enfant n\'est pas compatible', 500); @@ -876,11 +928,11 @@ public function save($id_genre, array $data, $id_etablissement = null, $date = ' if(array_key_exists("ID_PERE", $data) && !empty($data['ID_PERE'])) { $genre_pere = $DB_etablissement->getInformations($data['ID_PERE'])->ID_GENRE; - if($id_genre == 2 && $genre_pere != 1) { + if(in_array($id_genre, array(2,4,5,6,7,8,9)) && $genre_pere != 1) { throw new Exception('Le père n\'est pas compatible (Un établissement a comme père un site)', 500); } - elseif($id_genre == 3 && $genre_pere != 2) { - throw new Exception('Le père n\'est pas compatible (Les cellules ont comme père un établissement)', 500); + elseif($id_genre == 3 && !in_array($genre_pere, array(2, 5))) { + throw new Exception('Le père n\'est pas compatible (Les cellules ont comme père un établissement ou IGH)', 500); } elseif($id_genre == 1) { throw new Exception('Le type n\'est pas compatible (Un site ne peut pas avoir de père)', 500); @@ -991,14 +1043,6 @@ public function getDefaultValues($genre, $numinsee = null, $type = null, $catego } break; - // Habitation - case 4: - // Préventionnistes du site ou des groupements de communes - if($numinsee !== null || ($id_etablissement_pere !== null && $id_etablissement_pere != '')) { - $results['preventionnistes'] = $model_prev->getPrev($numinsee === null ? '' : $numinsee, $id_etablissement_pere === null ? '' : $id_etablissement_pere); - } - break; - // IGH case 5: // Périodicité en fonction de la classe @@ -1027,8 +1071,8 @@ public function getDefaultValues($genre, $numinsee = null, $type = null, $catego } break; - // EIC - case 6: + // Autres genres + default: // Préventionnistes du site ou des groupements de communes if($numinsee !== null || $id_etablissement_pere !== null) { $results['preventionnistes'] = $model_prev->getPrev($numinsee === null ? '' : $numinsee, $id_etablissement_pere === null ? '' : $id_etablissement_pere); @@ -1066,6 +1110,11 @@ public function addPJ($id_etablissement, $file, $name = '', $description = '', $ $extension = strtolower(strrchr($file['name'], ".")); + // Extension du fichier + if (in_array($extension, array('.php', '.php4', '.php5', '.sh', '.ksh', '.csh'))) { + throw new Exception("Ce type de fichier n'est pas autorisé en upload"); + } + $DBpieceJointe = new Model_DbTable_PieceJointe; $piece_jointe = array( @@ -1323,10 +1372,10 @@ public function getAvisEtablissement($id_etablissement, $id_dossier_donnant_avis $infosDossierDonnantAvis = $DBdossier->find($idDossierDonnantAvis)->current(); $dateInsertDossierDonnantAvis = $infosDossierDonnantAvis['DATEINSERT_DOSSIER']; $dateInsertDossierDonnantAvis = new Zend_Date($dateInsertDossierDonnantAvis, Zend_Date::DATES); - + $search = new Model_DbTable_Search; $dossierDiff = $search->setItem("dossier")->setCriteria("e.ID_ETABLISSEMENT", $id_etablissement)->setCriteria("d.DIFFEREAVIS_DOSSIER", 1)->order("DATEINSERT_DOSSIER DESC")->run()->getAdapter()->getItems(0, 1)->toArray(); - + //Si l'etablissement ne comporte pas d'avis différé on prend l'avis correspondant à ID_DOSSIERDONNANTAVIS if(count($dossierDiff) > 0){ $dateInsertDossierDiffere = $dossierDiff[0]['DATEINSERT_DOSSIER']; @@ -1342,9 +1391,18 @@ public function getAvisEtablissement($id_etablissement, $id_dossier_donnant_avis return "avisDiff"; } } - + public function getDossierDonnantAvis($idEtablissement) { $DBEtab = new Model_DbTable_Etablissement; return $DBEtab->getDossierDonnantAvis($idEtablissement); } + + public function delete($idEtablissement) { + $date = new DateTime(); + $DB_Etab = new Model_DbTable_Etablissement; + + $etablissement = $DB_Etab->find($idEtablissement)->current(); + $etablissement->DATESUPPRESSION_ETABLISSEMENT = $date->format('Y-m-d'); + $etablissement->save(); + } } diff --git a/application/services/Mail.php b/application/services/Mail.php new file mode 100644 index 00000000..64789e69 --- /dev/null +++ b/application/services/Mail.php @@ -0,0 +1,111 @@ +sendMail($message, $objet, null, $destinataires, true); + } + + + public function sendMail($message, $objet = null, $to = null, $bcc = null, $isHTML = false) + { + $sent = true; + if (getenv("PREVARISC_MAIL_ENABLED") && getenv('PREVARISC_MAIL_ENABLED') == 1) { + $mail = new Zend_Mail('utf-8'); + + if ($isHTML) { + $mail->setBodyHtml($message); + } else { + $mail->setBodyText($message); + } + + if ($objet) { + $mail->setSubject($objet); + } + + if ($to) { + if (is_array($to)) { + foreach ($to as $dest) { + $mail->addTo($dest); + } + } else { + $mail->addTo($to); + } + } + + if ($bcc) { + if (is_array($bcc)) { + foreach($bcc as $cc) { + $mail->addBcc($cc); + } + } else { + $mail->addBcc($bcc); + } + } + + try { + $mail = $mail->send(); + } catch (Zend_Mail_Transport_Exception $zmte) { + $sent = $zmte; + } catch (Zend_Mail_Protocol_Exception $zmpe) { + $sent = $zmpe; + } + } else { + $sent = false; + } + + return $sent; + } + + +} + +?> \ No newline at end of file diff --git a/application/services/Prescriptions.php b/application/services/Prescriptions.php index bc879dbe..103df963 100644 --- a/application/services/Prescriptions.php +++ b/application/services/Prescriptions.php @@ -195,7 +195,8 @@ public function savePrescription($post, $idPrescription = null){ } } //FIN savePrescription - public function getPrescriptions($type,$mode = null){ + public function getPrescriptions($type, $mode = null) + { $dbPrescRegl = new Model_DbTable_PrescriptionRegl(); $listePrescDossier = $dbPrescRegl->recupPrescRegl($type,$mode); //Zend_Debug::dump($listePrescDossier); @@ -205,13 +206,15 @@ public function getPrescriptions($type,$mode = null){ $prescriptionArray = array(); foreach ($listePrescDossier as $val => $ue) { - $assoc = $dbPrescReglAssoc->getPrescriptionReglAssoc($ue['ID_PRESCRIPTIONREGL']); - array_push($prescriptionArray, $assoc); + $assoc = $dbPrescReglAssoc->getPrescriptionReglAssoc($ue['ID_PRESCRIPTIONREGL']); + array_push($prescriptionArray, $assoc); } + return $prescriptionArray; } //FIN getPrescriptions - public function getPrescriptionInfo($idPrescription,$type){ + public function getPrescriptionInfo($idPrescription,$type) + { if($type == 'rappel-reg'){ $dbPrescAssoc = new Model_DbTable_PrescriptionReglAssoc(); return $dbPrescAssoc->getPrescriptionReglAssoc($idPrescription); diff --git a/application/services/Search.php b/application/services/Search.php index a8396efc..fc660ca3 100755 --- a/application/services/Search.php +++ b/application/services/Search.php @@ -20,11 +20,12 @@ class Service_Search * @param int $parent * @param string $city * @param int $street_id + * @param string $number * @param int $count Par défaut 10, max 1000 * @param int $page par défaut = 1 * @return array */ - public function etablissements($label = null, $identifiant = null, $genres = null, $categories = null, $classes = null, $familles = null, $types_activites = null, $avis_favorable = null, $statuts = null, $local_sommeil = null, $lon = null, $lat = null, $parent = null, $city = null, $street_id = null, $count = 10, $page = 1) + public function etablissements($label = null, $identifiant = null, $genres = null, $categories = null, $classes = null, $familles = null, $types_activites = null, $avis_favorable = null, $statuts = null, $local_sommeil = null, $lon = null, $lat = null, $parent = null, $city = null, $street_id = null, $number = null, $count = 10, $page = 1) { // Récupération de la ressource cache à partir du bootstrap $cache = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('cacheSearch'); @@ -43,13 +44,15 @@ public function etablissements($label = null, $identifiant = null, $genres = nul "NB_ENFANTS" => new Zend_Db_Expr("( SELECT COUNT(etablissementlie.ID_FILS_ETABLISSEMENT) FROM etablissement INNER JOIN etablissementlie ON etablissement.ID_ETABLISSEMENT = etablissementlie.ID_ETABLISSEMENT - WHERE etablissement.ID_ETABLISSEMENT = e.ID_ETABLISSEMENT)"), + WHERE etablissement.ID_ETABLISSEMENT = e.ID_ETABLISSEMENT + AND etablissement.DATESUPPRESSION_ETABLISSEMENT IS NULL)"), "PRESENCE_ECHEANCIER_TRAVAUX" => new Zend_Db_Expr("(SELECT COUNT(dossierlie.ID_DOSSIER1) FROM dossier INNER JOIN etablissementdossier ON dossier.ID_DOSSIER = etablissementdossier.ID_DOSSIER INNER JOIN dossierlie ON dossier.ID_DOSSIER = dossierlie.ID_DOSSIER2 INNER JOIN dossiernature ON dossierlie.ID_DOSSIER1 = dossiernature.ID_DOSSIER - WHERE dossiernature.ID_NATURE = 46 AND etablissementdossier.ID_ETABLISSEMENT = e.ID_ETABLISSEMENT)"))) + WHERE dossiernature.ID_NATURE = 46 AND etablissementdossier.ID_ETABLISSEMENT = e.ID_ETABLISSEMENT + AND dossier.DATESUPPRESSION_DOSSIER IS NULL)"))) //->join(array("etablissementinformations" => new Zend_Db_Expr("(SELECT MAX(etablissementinformations.DATE_ETABLISSEMENTINFORMATIONS), etablissementinformations.* FROM etablissementinformations group by ID_ETABLISSEMENT)")), "e.ID_ETABLISSEMENT = etablissementinformations.ID_ETABLISSEMENT") ->join("etablissementinformations", "e.ID_ETABLISSEMENT = etablissementinformations.ID_ETABLISSEMENT AND etablissementinformations.DATE_ETABLISSEMENTINFORMATIONS = ( SELECT MAX(etablissementinformations.DATE_ETABLISSEMENTINFORMATIONS) FROM etablissementinformations WHERE etablissementinformations.ID_ETABLISSEMENT = e.ID_ETABLISSEMENT )") ->joinLeft("dossier", "e.ID_DOSSIER_DONNANT_AVIS = dossier.ID_DOSSIER", array("DATEVISITE_DOSSIER", "DATECOMM_DOSSIER", "DATEINSERT_DOSSIER", "DIFFEREAVIS_DOSSIER")) @@ -60,14 +63,14 @@ public function etablissements($label = null, $identifiant = null, $genres = nul ->joinLeft("etablissementlie", "e.ID_ETABLISSEMENT = etablissementlie.ID_FILS_ETABLISSEMENT", array("pere" => "ID_ETABLISSEMENT", "ID_FILS_ETABLISSEMENT")) //->joinLeft("etablissementinformationspreventionniste", "etablissementinformationspreventionniste.ID_ETABLISSEMENTINFORMATIONS = etablissementinformations.ID_ETABLISSEMENTINFORMATIONS", null) //->joinLeft("utilisateur", "utilisateur.ID_UTILISATEUR = etablissementinformationspreventionniste.ID_UTILISATEUR", "ID_UTILISATEUR") - ->joinLeft("etablissementadresse", "e.ID_ETABLISSEMENT = etablissementadresse.ID_ETABLISSEMENT", array("NUMINSEE_COMMUNE", "LON_ETABLISSEMENTADRESSE", "LAT_ETABLISSEMENTADRESSE", "ID_ADRESSE", "ID_RUE")) + ->joinLeft("etablissementadresse", "e.ID_ETABLISSEMENT = etablissementadresse.ID_ETABLISSEMENT", array("NUMINSEE_COMMUNE", "LON_ETABLISSEMENTADRESSE", "LAT_ETABLISSEMENTADRESSE", "ID_ADRESSE", "ID_RUE", "NUMERO_ADRESSE")) ->joinLeft("adressecommune", "etablissementadresse.NUMINSEE_COMMUNE = adressecommune.NUMINSEE_COMMUNE", "LIBELLE_COMMUNE AS LIBELLE_COMMUNE_ADRESSE_DEFAULT") ->joinLeft("adresserue", "adresserue.ID_RUE = etablissementadresse.ID_RUE", "LIBELLE_RUE") ->joinLeft(array("etablissementadressesite" => "etablissementadresse"), "etablissementadressesite.ID_ETABLISSEMENT = (SELECT ID_FILS_ETABLISSEMENT FROM etablissementlie WHERE ID_ETABLISSEMENT = e.ID_ETABLISSEMENT LIMIT 1)", "ID_RUE AS ID_RUE_SITE") ->joinLeft(array("adressecommunesite" => "adressecommune"), "etablissementadressesite.NUMINSEE_COMMUNE = adressecommunesite.NUMINSEE_COMMUNE", "LIBELLE_COMMUNE AS LIBELLE_COMMUNE_ADRESSE_SITE") ->joinLeft(array("etablissementadressecell" => "etablissementadresse"), "etablissementadressecell.ID_ETABLISSEMENT = (SELECT ID_ETABLISSEMENT FROM etablissementlie WHERE ID_FILS_ETABLISSEMENT = e.ID_ETABLISSEMENT LIMIT 1)", "ID_RUE AS ID_RUE_CELL") ->joinLeft(array("adressecommunecell" => "adressecommune"), "etablissementadressecell.NUMINSEE_COMMUNE = adressecommunecell.NUMINSEE_COMMUNE", "LIBELLE_COMMUNE AS LIBELLE_COMMUNE_ADRESSE_CELLULE") - + ->where("e.DATESUPPRESSION_ETABLISSEMENT IS NULL") // Vincent MICHEL le 12/11/2014 : retrait de cette clause qui tue les performances // sur la recherche. Je n'ai pas vu d'impact sur le retrait du group by. // Cyprien DEMAEGDT le 03/08/2015 : rétablissement de la clause pour résoudre le @@ -134,20 +137,33 @@ public function etablissements($label = null, $identifiant = null, $genres = nul $this->setCriteria($select, "ID_STATUT", $statuts); } - // Critères : statuts + // Critères : local à sommeil if($local_sommeil !== null) { $this->setCriteria($select, "LOCALSOMMEIL_ETABLISSEMENTINFORMATIONS", $local_sommeil); } + // Critères : numéro de rue + if($number !== null) { + $clauses = array(); + $clauses[] = "etablissementadresse.NUMERO_ADRESSE = ".$select->getAdapter()->quote($number); + if($genres == null || in_array('1', $genres)) { + $clauses[] = "etablissementadressesite.NUMERO_ADRESSE = ". $select->getAdapter()->quote($number); + } + if($genres == null || in_array('3', $genres)) { + $clauses[] = "etablissementadressecell.NUMERO_ADRESSE = ". $select->getAdapter()->quote($number); + } + $select->where('('.implode(' OR ', $clauses).')'); + } + // Critère : commune et rue if($street_id !== null) { $clauses = array(); - $clauses[] = "etablissementadresse.ID_RUE = ".$select->getAdapter()->quote($street_id); + $clauses[] = "etablissementadresse.ID_RUE = ". $select->getAdapter()->quote($street_id); if($genres == null || in_array('1', $genres)) { - $clauses[] = "etablissementadressesite.ID_RUE = ".$select->getAdapter()->quote($street_id); + $clauses[] = "etablissementadressesite.ID_RUE = ". $select->getAdapter()->quote($street_id); } if($genres == null || in_array('3', $genres)) { - $clauses[] = "etablissementadressecell.ID_RUE = ".$select->getAdapter()->quote($street_id); + $clauses[] = "etablissementadressecell.ID_RUE = ". $select->getAdapter()->quote($street_id); } $select->where('('.implode(' OR ', $clauses).')'); } @@ -176,7 +192,7 @@ public function etablissements($label = null, $identifiant = null, $genres = nul // Performance optimisation : avoid sorting on big queries, and sort only if // there is at least one where part - if (count($select->getPart(Zend_Db_Select::WHERE)) > 0) { + if (count($select->getPart(Zend_Db_Select::WHERE)) > 1) { $select->order("etablissementinformations.LIBELLE_ETABLISSEMENTINFORMATIONS ASC"); } @@ -262,6 +278,7 @@ public function dossiers($types = null, $objet = null, $num_doc_urba = null, $pa ->joinLeft("datecommission","datecommission.ID_DATECOMMISSION = dossieraffectation.ID_DATECOMMISSION_AFFECT",null) ->joinLeft("dossierpreventionniste","dossierpreventionniste.ID_DOSSIER = d.ID_DOSSIER",null) ->joinLeft(array("ea" => "etablissementadresse"),"ea.ID_ETABLISSEMENT = e.ID_ETABLISSEMENT",null) + ->where("d.DATESUPPRESSION_DOSSIER IS NULL") ->group("d.ID_DOSSIER") ; @@ -356,7 +373,7 @@ public function dossiers($types = null, $objet = null, $num_doc_urba = null, $pa // Performance optimisation : avoid sorting on big queries, and sort only if // there is at least one where part - if (count($select->getPart(Zend_Db_Select::WHERE)) > 0) { + if (count($select->getPart(Zend_Db_Select::WHERE)) > 1) { $select->order("d.DATEINSERT_DOSSIER DESC"); } diff --git a/application/services/User.php b/application/services/User.php index 985875b5..dec8eeed 100755 --- a/application/services/User.php +++ b/application/services/User.php @@ -113,7 +113,7 @@ public function save($data, $avatar = null, $id_user = null) $db->beginTransaction(); try { - if ($id_user === null && $DB_user->isRegistered($data['USERNAME_UTILISATEUR'])) { + if ($DB_user->isRegistered($id_user, $data['USERNAME_UTILISATEUR'])) { throw new Exception("Nom d'utilisateur déjà enregistré. Veuillez en choisir un autre."); } $user = $id_user == null ? $DB_user->createRow() : $DB_user->find($id_user)->current(); @@ -136,9 +136,16 @@ public function save($data, $avatar = null, $id_user = null) $user->NUMINSEE_COMMUNE = array_key_exists('NUMINSEE_COMMUNE', $data) ? $data['NUMINSEE_COMMUNE'] : null; $user->ID_GROUPE = $data['ID_GROUPE']; $user->ACTIF_UTILISATEUR = $data['ACTIF_UTILISATEUR']; + $user->FAILED_LOGIN_ATTEMPTS_UTILISATEUR = $data['FAILED_LOGIN_ATTEMPTS_UTILISATEUR']; + $user->IP_UTILISATEUR = $data['IP_UTILISATEUR']; $user->ID_UTILISATEURINFORMATIONS = $informations->ID_UTILISATEURINFORMATIONS; if(array_key_exists('PASSWD_INPUT', $data)) { + if (getenv('PREVARISC_ENFORCE_SECURITY') == 1 && $data['PASSWD_INPUT'] != '') { + if (!preg_match('/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*\W)[a-zA-Z\d\W]{8,}$/', $data['PASSWD_INPUT'])) + throw new Exception("Votre mot de passe doit contenir au moins 8 caractères " + . "dont 1 minuscule, 1 majuscule, 1 chiffre et 1 caractère spécial."); + } $user->PASSWD_UTILISATEUR = $data['PASSWD_INPUT'] == '' ? null : md5($user->USERNAME_UTILISATEUR . getenv('PREVARISC_SECURITY_SALT') . $data['PASSWD_INPUT']); } @@ -343,4 +350,62 @@ public function getGroupPrivileges($user) $privileges = $model_user->getGroupPrivileges($user); return $privileges; } + + /** + * Récupération des utilisateurs pour les alertes + * + * @param int $idChangement L'id du type changement + * @param array $etablissement L'établissement concerné par le changement + * @return array La liste des utilisateurs + */ + public function getUtilisateursForAlterte($idChangement, $etablissement) + { + $dbUtilisateur = new Model_DbTable_Utilisateur; + + return $dbUtilisateur->findUtilisateursForAlerte($idChangement, $etablissement); + } + + /** + * Log les problèmes de login à un compte utilisateur + * @param array $user array définissant l'utilisateur + */ + public function logFailedLogin($user) { + + if (!$user || !isset($user['ID_UTILISATEUR']) || !isset($user['FAILED_LOGIN_ATTEMPTS_UTILISATEUR'])) { + return ; + } + + $dbUtilisateur = new Model_DbTable_Utilisateur; + $dbUser = $dbUtilisateur->find($user['ID_UTILISATEUR']); + if (!$dbUser) return ; + $dbUser = $dbUser->current(); + $dbUser->FAILED_LOGIN_ATTEMPTS_UTILISATEUR++; + $dbUser->save(); + $cache = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('cache'); + $cache->remove('user_id_' . $user['ID_UTILISATEUR']); + $user['FAILED_LOGIN_ATTEMPTS_UTILISATEUR']++; + return $user; + } + + public function resetFailedLogin($user) { + if (!$user + || !isset($user['ID_UTILISATEUR']) + || !isset($user['FAILED_LOGIN_ATTEMPTS_UTILISATEUR']) + ) { + return ; + } + $dbUtilisateur = new Model_DbTable_Utilisateur; + $dbUser = $dbUtilisateur->find($user['ID_UTILISATEUR']); + if (!$dbUser) return ; + $dbUser = $dbUser->current(); + $dbUser->FAILED_LOGIN_ATTEMPTS_UTILISATEUR = 0; + $dbUser->IP_UTILISATEUR = filter_input(INPUT_SERVER, 'REMOTE_ADDR'); + $dbUser->save(); + $cache = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('cache'); + $cache->remove('user_id_' . $user['ID_UTILISATEUR']); + $user['FAILED_LOGIN_ATTEMPTS_UTILISATEUR'] = 0; + $user['IP_UTILISATEUR'] = filter_input(INPUT_SERVER, 'REMOTE_ADDR'); + return $user; + } + } diff --git a/application/views/scripts/admin/index.phtml b/application/views/scripts/admin/index.phtml index b66443e4..38310395 100755 --- a/application/views/scripts/admin/index.phtml +++ b/application/views/scripts/admin/index.phtml @@ -14,19 +14,10 @@

    -
    Clé IGN
    -
    -

    key_ign != null ? $this->key_ign : 'Aucune clé' ?>

    -
    - -
    Clé Google MAP
    -
    -

    key_googlemap != null ? $this->key_googlemap : 'Aucune clé' ?>

    -
    -
    Authentification

    authentification ?>

    +

    Renforcement de la sécurité : enforce_security ? 'activé' : 'Désactivé' ?>

    Base utilisée
    @@ -44,6 +35,27 @@

    Désactivé

    + +
    Clé IGN
    +
    +

    key_ign != null ? $this->key_ign : 'Aucune clé' ?>

    +
    + +
    Clé Google MAP
    +
    +

    key_googlemap != null ? $this->key_googlemap : 'Aucune clé' ?>

    +
    + +
    Carte Geoconcept
    +
    + geoconcept_url): ?> + geoconcept_infos as $key => $info): ?> +

    + + +

    Désactivé

    + +
    HTTP API
    diff --git a/application/views/scripts/calendrier-des-commissions/dialogcomm.phtml b/application/views/scripts/calendrier-des-commissions/dialogcomm.phtml index 02cac8cf..dd18eafb 100755 --- a/application/views/scripts/calendrier-des-commissions/dialogcomm.phtml +++ b/application/views/scripts/calendrier-des-commissions/dialogcomm.phtml @@ -8,7 +8,7 @@ }); /**APPLIQUER DES CLASSES JQUERY SUR LES INPUT DATE ET HEURE - **/ + **/ $('.time').live('focus', function() { $(this).timeEntry($.timeEntry.regional['fr']); }); @@ -46,7 +46,7 @@ error: function(){ return false; } - }); + }); }else{ //Dans le cas d'une création on ajoute simplement la ligne $.ajax({ @@ -77,7 +77,7 @@ }); $(".cancelAddDate").live('click',function(){ - //Annulation de l'ajout de date + //Annulation de l'ajout de date $("#addDate").attr('value',''); $("#divAddDate").hide(); $("#dialogComm").buttonShow(); @@ -100,12 +100,12 @@ $("#dialogComm").buttonShow(); $("#dialogComm").reapeatHide(); }); - - $("#annule_periodicite").live('click',function(){ + + $("#annule_periodicite").live('click',function(){ $("#dialogComm").buttonShow(); $("#dialogComm").reapeatHide(); }); - + $("#valid_periodicite").live('click',function(){ //alert(''); }); @@ -117,7 +117,7 @@ //alert(action+" - "+type+" - "+$("#listeDates ul").length); if(action == 'add'){ $("#addReapeat").hide(); - //$("#repeat").attr('checked',false); + //$("#repeat").attr('checked',false); $("#planification").hide(); }else if(action == 'supp'){ if(type == 'edit'){ @@ -150,7 +150,7 @@ $.fn.reapeatShow = function(){ $("#addReapeat").show(); $("#planification").show(); - $("#listeDates").countLigne('new'); + $("#listeDates").countLigne('new'); }; })(jQuery); @@ -173,7 +173,7 @@ if(isset($this->do) && $this->do == 'edit'){ ".afficheTypeDateComm($this->typeComLibelle)."

    - ".afficheTabListeDates($this->listeDates)." + ".afficheTabListeDates($this->listeDates)."
    ".divAddDate()."
    @@ -185,7 +185,7 @@ if(isset($this->do) && $this->do == 'edit'){ }else if(isset($this->do) && $this->do == 'newComm'){ /** *** - ***AFFICHAGE BOITE DIALOGUE PERMETTANT LA CREATION DES COMMISSIONS + ***AFFICHAGE BOITE DIALOGUE PERMETTANT LA CREATION DES COMMISSIONS *** **/ diff --git a/application/views/scripts/calendrier-des-commissions/generationodj.phtml b/application/views/scripts/calendrier-des-commissions/generationodj.phtml index f8d1855e..8f854f0e 100755 --- a/application/views/scripts/calendrier-des-commissions/generationodj.phtml +++ b/application/views/scripts/calendrier-des-commissions/generationodj.phtml @@ -98,7 +98,7 @@ foreach($this->informationsMembre as $val => $membre){ $odf = new Odf(REAL_DATA_PATH.DIRECTORY_SEPARATOR."uploads".DIRECTORY_SEPARATOR."courriers".DIRECTORY_SEPARATOR.$nomFichier); $model_groupement = new Model_DbTable_Groupement(); - $infosGroupement = $model_groupement->get($membre->ID_GROUPEMENT); + $infosGroupement = $model_groupement->get($membre['infosFiles'][0]['ID_GROUPEMENT']); $grpLoop = $odf->setSegment('grpLoop'); diff --git a/application/views/scripts/calendrier-des-commissions/generationpv.phtml b/application/views/scripts/calendrier-des-commissions/generationpv.phtml index a76ef867..af894db6 100755 --- a/application/views/scripts/calendrier-des-commissions/generationpv.phtml +++ b/application/views/scripts/calendrier-des-commissions/generationpv.phtml @@ -22,13 +22,13 @@ function addPrescription($listePrescription,$type,$odf){ try{ $prescription = $odf->listeExploitation; } catch (Exception $e) { - + } }else if ($type == 2){ try{ $prescription = $odf->listeAmelioration; } catch (Exception $e) { - + } } @@ -71,25 +71,29 @@ function addPrescription($listePrescription,$type,$odf){ } if($cpt) { - if($type != 0){ - $prescription->setVars('num', $listePrescription[$i][0]['NUM_PRESCRIPTION_DOSSIER'], true, 'UTF-8'); - } + addChamp($prescription, 'num', $listePrescription[$i][0]['NUM_PRESCRIPTION_DOSSIER']); if( $listePrescription[$i][0]['LIBELLE_PRESCRIPTION_DOSSIER'] == '') { - $prescription->setVars('libelle', $listePrescription[$i][0]['PRESCRIPTIONTYPE_LIBELLE'], true, 'UTF-8'); + addChamp($prescription, 'libelle', $listePrescription[$i][0]['PRESCRIPTIONTYPE_LIBELLE']); }else{ - $prescription->setVars('libelle', $listePrescription[$i][0]['LIBELLE_PRESCRIPTION_DOSSIER'], true, 'UTF-8'); + addChamp($prescription, 'libelle', $listePrescription[$i][0]['LIBELLE_PRESCRIPTION_DOSSIER']); } $cpt = false; } $nbCpt--; } - $prescription->setVars('textearticle',$textearticle,true,'UTF-8'); + addChamp($prescription, 'textearticle', $textearticle); $prescription->merge(); } + } else { + addChamp($prescription, 'num', ""); + addChamp($prescription, 'libelle', ""); + addChamp($prescription, 'textearticle', ""); + $prescription->merge(); } + } } diff --git a/application/views/scripts/calendrier-des-commissions/index.phtml b/application/views/scripts/calendrier-des-commissions/index.phtml index bce777f3..fb0efb67 100755 --- a/application/views/scripts/calendrier-des-commissions/index.phtml +++ b/application/views/scripts/calendrier-des-commissions/index.phtml @@ -1,17 +1,38 @@ placeholder('lateral_navigation')->captureStart(); // Capture du 'lateral_navigation' ?>
    +
    Numéro
    +
    + +
    @@ -188,7 +193,7 @@ } else { $(container).find(".load").show(); - $.post("/search/display-ajax-search", {items: 'etablissement', parent: $(this).attr("id")}, function(html) { + $.post("/search/display-ajax-search-etablissement", {parent: $(this).attr("id")}, function(html) { $(container).toggleClass("active").find(".load").hide(); $(container).after("
  • " + html + "
  • ").next().slideDown(); }); @@ -206,12 +211,14 @@ $("input[name='city']").val(""); $("input[name='street']").val(""); + $("input[name='number']").val(""); }); // Auto complétion de la ville $("form#zone_de_recherche_modal input[name='commune_ac']").autocomplete("/api/1.0/adresse/get_communes", { - minChars: 3, + minChars: 2, + cacheLength: 0, parse: function(data) { return $.map(data["response"], function(row) {return {data: row,value: row.LIBELLE_COMMUNE,result: row.LIBELLE_COMMUNE}}); }, @@ -221,15 +228,19 @@ }).result(function(e, item) { $("input[name='code_insee']").val( item.NUMINSEE_COMMUNE ); $("input[name='voie_ac']").removeAttr('disabled'); + $("input[name='numero_ac']").removeAttr('disabled'); }).click(function() { $(this).val(""); $("input[name='voie_ac']").val("").attr("disabled", true).blur(); $("input[name='voie']").val("").blur(); + $("input[name='numero_ac']").val("").attr("disabled", true).blur(); + $("input[name='numero_voie']").val("").blur(); }); // Auto complétion de la rue $("form#zone_de_recherche_modal input[name='voie_ac']").autocomplete('/api/1.0/adresse/get_voies', { - minChars: 3, + minChars: 2, + cacheLength: 0, extraParams: { code_insee: function(){ return $("input[name='code_insee']").val() } }, parse: function(data) { return $.map(data["response"], function(row) { return {data: row,value: row.LIBELLE_RUE,result: row.LIBELLE_RUE} }); @@ -239,10 +250,14 @@ } }).result(function(e, item) { $("input[name='voie']").val( item.ID_RUE ); + $("input[name='numero_ac']").removeAttr('disabled'); }).click(function() { $(this).val(""); + $("input[name='numero_ac']").val("").attr("disabled", true).blur(); + $("input[name='numero_voie']").val("").blur(); }); + // Validation de la zone de recherche $('form#zone_de_recherche_modal a.submit').click(function() { var text = 'Département'; @@ -251,13 +266,18 @@ var text = $("input[name='commune_ac']").val(); if($("input[name='voie_ac']").val() != '') { var text = $("input[name='commune_ac']").val() + ', ' + $("input[name='voie_ac']").val(); + if($("input[name='numero_ac']").val() != '') { + var text = $("input[name='commune_ac']").val() + ', ' + $("input[name='voie_ac']").val() + ', ' + $("input[name='numero_ac']").val(); + } } } + $("input[name='zone_de_recherche_text']").val(text); $(".zone_de_recherche_text").text(text); $("input[name='city']").val($("input[name='code_insee']").val()); $("input[name='street']").val($("input[name='voie']").val()); + $("input[name='number']").val($("input[name='numero_ac']").val()); $('form#zone_de_recherche_modal').modal('hide'); }); }); diff --git a/application/views/scripts/session/logout.phtml b/application/views/scripts/session/logout.phtml new file mode 100644 index 00000000..dbcf7198 --- /dev/null +++ b/application/views/scripts/session/logout.phtml @@ -0,0 +1,7 @@ +

    + Déconnexion réussie ! +

    + +

    + Vous pouvez refermer cet onglet. +

    \ No newline at end of file diff --git a/application/views/scripts/tableau-des-periodicites/index.phtml b/application/views/scripts/tableau-des-periodicites/index.phtml index 24970c03..249b570d 100755 --- a/application/views/scripts/tableau-des-periodicites/index.phtml +++ b/application/views/scripts/tableau-des-periodicites/index.phtml @@ -84,8 +84,8 @@

    - Appliquer sur TOUS les établissements -

    + Appliquer sur TOUS les établissements +

    diff --git a/application/views/scripts/users/edit.phtml b/application/views/scripts/users/edit.phtml index 387363da..6f831beb 100755 --- a/application/views/scripts/users/edit.phtml +++ b/application/views/scripts/users/edit.phtml @@ -2,20 +2,20 @@
    - add) : ?> -
    - -
    -

    Ajout d'un utilisateur

    - - -

    Modification de l'utilisateur user['infos']["NOM_UTILISATEURINFORMATIONS"] . ' ' . $this->user['infos']["PRENOM_UTILISATEURINFORMATIONS"] ?>

    - + add) : ?> +
    + +
    +

    Ajout d'un utilisateur

    + + +

    Modification de l'utilisateur user['infos']["NOM_UTILISATEURINFORMATIONS"] . ' ' . $this->user['infos']["PRENOM_UTILISATEURINFORMATIONS"] ?>

    +
    Photo
    @@ -35,16 +35,23 @@
    Mot de passe
    -

    - add ) : ?> - - params["LDAP_ACTIF"]) : ?> Connexion via le LDAP ? - - - Changer le mot de passe - params["LDAP_ACTIF"]) : ?> Connexion via le LDAP ? user["PASSWD_UTILISATEUR"] == null) echo "checked"?> /> - +

    + add ) : ?> + + params["LDAP_ACTIF"]) : ?> Connexion via LDAP/CAS/NTLM ? + + + Changer le mot de passe + params["LDAP_ACTIF"]) : ?> Connexion via LDAP/CAS/NTLM ? user["PASSWD_UTILISATEUR"] == null) echo "checked"?> /> + +

    + +

    + Le mot de passe doit contenir au moins 8 caractères + dont 1 minuscule, 1 majuscule, 1 chiffre et 1 caractère spécial.

    + +
    Groupe
    @@ -60,11 +67,26 @@
    Utilisateur actif ?
    -

    - - user) || $this->user['ACTIF_UTILISATEUR'] ) echo "checked" ?> /> +

    + + user) || $this->user['ACTIF_UTILISATEUR'] ) echo "checked" ?> />

    + +
    Dernière IP authentifiée
    +
    +

    + +

    +
    + +
    Connexions en échec
    +
    + ' /> + user["FAILED_LOGIN_ATTEMPTS_UTILISATEUR"] >= 2): ?> + Débloquer les connexions autres qu'avec l'IP ci-dessus. + +

    Informations de l'utilisateur

    @@ -194,41 +216,50 @@ diff --git a/composer.json b/composer.json index 1af0bf0c..67fed709 100755 --- a/composer.json +++ b/composer.json @@ -20,8 +20,9 @@ "cybermonde/odtphp": "^1.0", "michelf/php-markdown": "^1.0", "kdubuc/gd_resize": "^1.0", - "SDIS62/toolbox": "^1.0", + "SDIS62/toolbox": "dev-master", "sebastian/git": "^2.0", + "sabre/vobject": "~4", "jasig/phpcas": "^1.3" }, diff --git a/docs/documentation_installation.md b/docs/documentation_installation.md index 9e9dd445..4c4ff7d8 100755 --- a/docs/documentation_installation.md +++ b/docs/documentation_installation.md @@ -61,12 +61,21 @@ PREVARISC_DB_HOST | Adresse de la base de données | Adresse IP PREVARISC_DB_USERNAME | Nom d'utilisateur à utiliser lors de la connexion à la base de données | Chaine de caractères PREVARISC_DB_PASSWORD | Mot de passe de connexion à la base de données | Chaine de caractères PREVARISC_DB_DBNAME | Nom de la base de données | Chaine de caractères +PREVARISC_MAIL_ENABLED | [FACULTATIF] Activation de la gestion du système d'alerte par mail | 1 ou 0 +PREVARISC_MAIL_TRANSPORT | [FACULTATIF] Système de transport des mails | "smtp" ou "Sendmail" +PREVARISC_MAIL_HOST | [FACULTATIF] IP du serveur mails | Chaîne de charactères +PREVARISC_MAIL_USERNAME | [FACULTATIF] Nom d'utilisateur ayant les droits de connexion au serveur Mail (peut-être vide si aucune authentification nécessaire) | Chaîne de caractères +PREVARISC_MAIL_PASSWORD | [FACULTATIF] Mot de passe de l'utilisateur ayant les droits de connexion au serveur Mail | Chaîne de caractères +SetEnv PREVARISC_MAIL_PORT | [FACULTATIF] Le port du serveur mail | Nombres (exmple : "25") +PREVARISC_MAIL_SENDER | [FACULTATIF] Adresse email apparaissant sur les mails envoyés par l'application | Chaîne de caractères (format email, par exemple : "no-reply@sdis.fr") +PREVARISC_MAIL_SENDER_NAME | [FACULTATIF] Nom associé à l'email définit précédemment et apparaissant sur les mails envoyés par l'application | Chaîne de caractères (exemple : "Prévarisc") PREVARISC_CACHE_LIFETIME | Durée de vie du cache, actif si valeur > 0 | Valeur numérique (secondes) PREVARISC_CACHE_ADAPTER | Adapter backend de cache du cache lié à la factory Zend_Cache, default "APC" | Chaine de caractères PREVARISC_CACHE_HOST | Adresse IP du cache backend | Adresse IP PREVARISC_CACHE_PORT | Port du cache backend | Valeur numérique PREVARISC_CACHE_DIR | Répertoire des fichiers de cache si cache filesystem | Répertoire PREVARISC_SECURITY_SALT | Chaine utilisée pour le cryptage des mots de passe utilisateur | Chaine alphanumérique de longueur 32 (exemple : 7aec3ab8e8d025c19e8fc8b6e0d75227 salt utilisé par défaut) +PREVARISC_CALENDAR_REFRESH_TIME | [FACULTATIF] L'intervale de temps entre chaque rafraichissement de la synchronisation des calendriers | durée en format ISO 8601 (exemple : "PT5M" utilisé par défaut pour un rafraichissement tous les 5 minutes) PREVARISC_LDAP_ENABLED | [FACULTATIF] Activation de la connexion des utilisateurs via LDAP | 1 ou 0 PREVARISC_LDAP_HOST | [FACULTATIF] Adresse du serveur LDAP | Adresse IP PREVARISC_LDAP_USERNAME | [FACULTATIF] Nom d'utilisateur à utiliser lors de la connexion au LDAP | Chaine de caractères @@ -100,7 +109,11 @@ PREVARISC_CAS_CONTEXT | [FACULTATIF] Le contexte, ou URI CAS, ex : 'cas' | Chain PREVARISC_CAS_NO_SERVER_VALIDATION | [FACULTATIF] Désactive la vérification du certificat du serveur CAS | Chaine de caractères PREVARISC_CAS_VERSION | [FACULTATIF] Permet de préciser la version du protocol cas, 2.0 par défaut | 1.0, 2.0, 3.0 PREVARISC_NTLM_ENABLED | [FACULTATIF] Permet d'activer l'authentification NTLM | 0 ou 1 pour l'activer - +PREVARISC_PLUGIN_GEOCONCEPT_URL | [FACULTATIF] URL du serveur Geoconcept couche WMTS | Chaine de caractères +PREVARISC_PLUGIN_GEOCONCEPT_LAYER | [FACULTATIF] Nom de la couche WMTS de base | Chaine de caractères +PREVARISC_PLUGIN_GEOCONCEPT_APP_ID | [FACULTATIF] App id si couches derrière authentification | Chaine de caractères +PREVARISC_PLUGIN_GEOCONCEPT_TOKEN | [FACULTATIF] Token si couches derrière authentification| Chaine de caractères +PREVARISC_PLUGIN_GEOCONCEPT_GEOCODER | [FACULTATIF] URL du géocoder | Chaine de caractères * Taper :```/etc/init.d/apache2 restart``` diff --git a/public/css/geoconcept/htc.css b/public/css/geoconcept/htc.css new file mode 100644 index 00000000..505c19ca --- /dev/null +++ b/public/css/geoconcept/htc.css @@ -0,0 +1,20 @@ +.dynmap{border:solid 1px lightgrey}.olDragDown{cursor:url(img/grabbing.cur),default}div.olMap{cursor:url(img/grab.cur),default}div.olMapViewport{-ms-touch-action:none}.mapslider{position:absolute;-webkit-border-radius:4px;border-radius:4px 4px 4px 4px;left:4px;z-index:100;height:137px;width:15px;top:2px;cursor:pointer;background-color:rgba(255,255,255,0.6);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#77FFFFFF,endColorstr=#77FFFFFF);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#77FFFFFF, endColorstr=#77FFFFFF)"} +.mapslider .track_vertical{height:97px;width:12px;position:absolute;top:18px;left:1px;overflow:hidden;background:url(./mapsprites.png) no-repeat}.mapslider .handle_vertical{left:0;width:12px;height:7px;z-index:102;overflow:hidden;background:url(./mapsprites.png) no-repeat 0 -144px}.mapsliderZoomOut{width:11px;height:12px;top:107px;left:2px;background:url(./mapsprites.png) no-repeat 0 -112px;position:relative;cursor:pointer} +.mapsliderZoomIn{width:11px;height:12px;top:2px;left:2px;background:url(./mapsprites.png) no-repeat 0 -128px;position:relative;cursor:pointer}.olHandlerBoxZoomBox{border:2px solid red;position:absolute;background-color:white;opacity:.50;font-size:1px;filter:alpha(opacity = 50)}.olHandlerBoxSelectFeature{border:2px solid blue;position:absolute;background-color:white;opacity:.50;font-size:1px;filter:alpha(opacity = 50)} +.mapobject{position:absolute;border:0;left:-500px;cursor:pointer;line-height:0;font-size:1px}.mapobjectname{position:absolute;border:solid 1px white;cursor:pointer;left:-500px;width:auto;height:auto;padding:1px;color:white;background-color:#b00;font-weight:bold;font-size:14px;text-align:center}.mapsheet{position:absolute;left:-500px;top:-500px;width:auto;height:auto;cursor:default;background:white;border:solid 1px #000080;padding:5px;visibility:hidden;opacity:.9;white-space:nowrap} +.mapglobalview{position:absolute;background-color:white;border-left:solid 1px #999;border-bottom:solid 1px #999;border-right:0;border-top:0;cursor:pointer;overflow:hidden}.mapglobalviewico{position:absolute;height:10px;width:10px;right:0;z-index:100;cursor:pointer;background:url(./mapsprites.png) no-repeat 0 -160px} +.mapglobalviewico2{position:absolute;height:10px;width:10px;right:0;z-index:100;cursor:pointer;background:url(./mapsprites.png) no-repeat 0 -176px}.minidiv{position:absolute;background-color:white;cursor:pointer}.pandiv{position:absolute;border:solid 2px yellow;z-index:1000;cursor:move;opacity:.3;filter:alpha(opacity = 30);background-color:black;line-height:0;font-size:1px} +.mapScale{position:absolute;background:url(./mapsprites.png) repeat-x 0 -192px;border:solid 0 #999;-webkit-border-top-right-radius:3px;border-top-right-radius:3px;z-index:100;height:25px;width:180px;font-size:12px;font-family:Verdana,Arial,Helvetica;color:black}.mapScaleText1{position:absolute;width:5px;left:5px} +.mapScaleText2{position:absolute;width:50px}.mapScaleLegend{position:absolute;background-color:black;left:5px;top:15px}.mapScaleFullBlock{position:absolute;background-color:white;height:5px;line-height:0;font-size:1px}.mapScaleEmptyBlock{position:absolute;background-color:#444;height:5px;line-height:0;font-size:1px} +.mapLayerInfo{position:relative;height:20px;background:url(./mapsprites.png) repeat-x 0 -192px;width:225px}.mapGroupInfo{position:relative;height:20px;background:url(./mapsprites.png) repeat-x 0 -192px;cursor:pointer}.mapLayerInfo div{position:absolute}.mapLayerName{padding-left:36px;cursor:pointer} +.mapLayerCheckbox{cursor:pointer;background:url(./mapsprites.png) no-repeat -30px -160px;width:16px;height:15px;left:18px;top:2px}.mapLayerUncheckbox{cursor:pointer;background:url(./mapsprites.png) no-repeat -30px -175px;width:16px;height:15px;left:18px;top:2px}.mapLayerSlider{top:2px;right:30px;width:50px;height:20px;z-index:100} +.layertrack_horizontal{top:6px;width:50px;height:4px;background:url(./mapsprites.png) no-repeat 0 -220px;cursor:pointer}.layerhandle_horizontal{width:5px;height:12px;top:-4px;background:url(./mapsprites.png) no-repeat -15px -144px;cursor:pointer}.mapLayerDown{right:15px;top:3px;cursor:pointer;background:url(./mapsprites.png) no-repeat -15px -160px;width:10px;height:10px} +.mapLayerUp{right:5px;top:3px;cursor:pointer;background:url(./mapsprites.png) no-repeat -15px -175px;width:10px;height:10px}.mapLayerNode{position:absolute;width:18px;height:20px;cursor:pointer;background:url(./mapsprites.png) no-repeat -15px -85px}.mapGroupMinus{position:absolute;width:18px;height:20px;cursor:pointer;background:url(./mapsprites.png) no-repeat -15px -104px;z-index:2} +.mapGroupPlus{position:absolute;width:18px;height:20px;cursor:pointer;background:url(./mapsprites.png) no-repeat -15px -122px;z-index:2}.mapGroupName{padding-left:20px;font-weight:bold}.olTileImage{-moz-transform:translateZ(0);-o-transform:translateZ(0);-ms-transform:translateZ(0);transform:translateZ(0);-moz-backface-visibility:hidden;-ms-backface-visibility:hidden;backface-visibility:hidden;-moz-perspective:1000;-ms-perspective:1000;perspective:1000} +.olLayerGrid .olTileImage{-webkit-transition:opacity .2s linear;-moz-transition:opacity .2s linear;-o-transition:opacity .2s linear;transition:opacity .2s linear}.gcuiAnchoredContent{padding:15px}.gcuiPopupGroupDiv .olPopupCloseBox{width:14px;height:14px;background:url(./mapsprites.png) no-repeat -36px -40px;cursor:pointer} +.anchorDivBottoml{content:"";border-width:20px 0 0 20px;border-style:solid;border-color:#075698 transparent;display:block;width:0}.anchorDivBottomr{content:"";border-width:20px 0 0 20px;border-style:solid;border-color:#075698 transparent;display:block;width:0} +.anchorDivTopl{content:"";border-width:0 0 20px 20px;border-style:solid;border-color:#2e88c4 transparent;display:block;width:0}.anchorDivTopImg{display:block;width:20px;height:20px;background:url(./mapsprites.png) no-repeat -30px -20px}.anchorDivBottomImg{display:block;width:20px;height:20px;background:url(./mapsprites.png) no-repeat -30px 0} +.anchorDivTopr{content:"";border-width:0 0 20px 20px;border-style:solid;border-color:#2e88c4 transparent;display:block;width:0}.gcuiPopupGroupDiv{color:#fff;background:#075698;background:-webkit-gradient(linear,0 0,0 100%,from(#2e88c4),to(#075698));background:-moz-linear-gradient(#2e88c4,#075698);background:-o-linear-gradient(#2e88c4,#075698);background:linear-gradient(#2e88c4,#075698);-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px} +.olControlLoadingPanel{background-image:url(ajax-loader.gif);position:relative;width:24px;height:24px;background-position:center;background-repeat:no-repeat;display:none}@media print{.mapslider{display:none}}.GCUIControlOverviewMapMinimizeButton{right:0;top:0;z-index:10000;cursor:pointer;height:10px;width:10px;background:url(./mapsprites.png) no-repeat 0 -160px} +.GCUIControlOverviewMapMaximizeButton{right:0;top:0;z-index:10000;cursor:pointer;height:10px;width:10px;background:url(./mapsprites.png) no-repeat 0 -176px}#OpenLayers_Control_minimizeDiv_innerImage{display:none}#GCUIControlOverviewMapMaximizeButton_innerImage{display:none}.GCUIControlOverviewMapExtentRectangle{opacity:.3;background-color:black;border:solid 2px yellow} +.GCUIControlOverviewMapRectReplacement{opacity:.3;background-color:black;border:solid 2px yellow}.GCUIControlOverviewMap{border:solid 1px grey} \ No newline at end of file diff --git a/public/css/geoconcept/img/grab.cur b/public/css/geoconcept/img/grab.cur new file mode 100644 index 00000000..22a4cde6 Binary files /dev/null and b/public/css/geoconcept/img/grab.cur differ diff --git a/public/css/geoconcept/img/grabbing.cur b/public/css/geoconcept/img/grabbing.cur new file mode 100644 index 00000000..42c1b97e Binary files /dev/null and b/public/css/geoconcept/img/grabbing.cur differ diff --git a/public/css/geoconcept/mapsprites.png b/public/css/geoconcept/mapsprites.png new file mode 100644 index 00000000..b466ce5c Binary files /dev/null and b/public/css/geoconcept/mapsprites.png differ diff --git a/public/css/main.css b/public/css/main.css index 8272b2af..a0d182f1 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -49,6 +49,12 @@ body.login input[type='submit'] { margin: 0 auto; } +.login .errors { + list-style: none; + margin-left: 0; + font-style: italic; +} + h2{ font-size: 20px; } @@ -412,6 +418,10 @@ a.thumbnail + a.thumbnail { margin-left: 5px; } +.thumbnail img { + width: 100%; +} + /* 8.Etablissements */ #ligne_informations { @@ -1148,6 +1158,85 @@ a.list-group-item-danger.active:focus { } /* Fix provenant d'un problème IE11 / bootstrap*/ -#geoportail-container img { +#geoportail-container img, #geoconcept-container img { max-width: none; -} \ No newline at end of file +} +#geoconcept-container label { + display: inline; +} + +#geoconcept-container .mapLayerControl { + right: 0; + background-color: #ccc; + border: 1px solid #ccc; +} + +a.alerte-link:hover { + cursor: pointer; +} + +.alerte-link i { + margin-right: 5px; +} + +.table-balises { + width: 100%; +} + +.table-balises, .table-balises th, .table-balises td { + border: 1px solid #ccc; +} + +.table-balises th, .table-balises td { + padding: 5px 10px; +} + +.td-balise { + color: #666; + font-style: italic; + width: 40%; +} + +.mail-objet-input { + width: 85%; +} + +#formAlerte hr { + margin: 10px 0; +} + +.remove-dst { + font-size: 10px; +} + +#mail-no-bcc { + display: none; +} + +#mail-no-bcc p { + font-style: italic; +} +.highlight{ + background-color: yellow; +} + +#listePrescriptionTypeSearch > li, +#listePrescriptionType > li { + border: 1px solid #ddd; + border-left: 0 none; + border-right: 0 none; + list-style-type:none; +} + +#listePrescriptionTypeSearch .noresult { + border: 0 none; +} + +dl.champ_effectif_camping dt { + width: 225px; + padding-right: 20px; +} + +dl.champ_effectif_camping dd input { + width: 139px; +} diff --git a/public/index.php b/public/index.php index fa1ce29e..aa96d105 100755 --- a/public/index.php +++ b/public/index.php @@ -66,10 +66,22 @@ ), 'security' => array( 'salt' => getenv('PREVARISC_SECURITY_SALT'), + 'session_max_lifetime' => getenv('PREVARISC_SESSION_MAX_LIFETIME'), ), 'phpSettings' => array( 'display_startup_errors' => getenv('PREVARISC_DEBUG_ENABLED'), 'display_errors' => getenv('PREVARISC_DEBUG_ENABLED'), + ), + 'mail' => array( + 'enabled' => getenv('PREVARISC_MAIL_ENABLED'), + 'transport' => getenv('PREVARISC_MAIL_ENABLED') ? getenv('PREVARISC_MAIL_TRANSPORT') : '', + 'host' => getenv('PREVARISC_MAIL_ENABLED') ? getenv('PREVARISC_MAIL_HOST') : '', + 'port' => getenv('PREVARISC_MAIL_ENABLED') ? getenv('PREVARISC_MAIL_PORT') : '', + 'authentication' => getenv('PREVARISC_MAIL_ENABLED') && getenv('PREVARISC_MAIL_USERNAME') !== '', + 'username' => getenv('PREVARISC_MAIL_ENABLED') ? getenv('PREVARISC_MAIL_USERNAME') : '', + 'password' => getenv('PREVARISC_MAIL_ENABLED') ? getenv('PREVARISC_MAIL_PASSWORD') : '', + 'sender' => getenv('PREVARISC_MAIL_ENABLED') ? getenv('PREVARISC_MAIL_SENDER') : '', + 'sender_name' => getenv('PREVARISC_MAIL_ENABLED') ? getenv('PREVARISC_MAIL_SENDER_NAME') : '' ) )); diff --git a/public/js/dossier/dossierGeneral.js b/public/js/dossier/dossierGeneral.js index f197152c..36fa43a8 100755 --- a/public/js/dossier/dossierGeneral.js +++ b/public/js/dossier/dossierGeneral.js @@ -35,6 +35,18 @@ $(document).ready(function(){ $("#OBJET_DOSSIER").css("border-color","black"); } }); + + $(".docManquant").blur(function() { + if($(".docManquant").val() != '') { + $(".docManquant").css("border-color","black"); + } + }); + + $("[name='dateDocManquant[]'").blur(function() { + if($("[name='dateDocManquant[]'").val() != '') { + $("[name='dateDocManquant[]'").css("border-color","black"); + } + }); //Permet de vider un input d'une date pour que celle-ci ne s'affiche plus $(".suppDate").live('click',function(){ diff --git a/public/js/geoconcept/OpenLayers.js b/public/js/geoconcept/OpenLayers.js new file mode 100644 index 00000000..669778d9 --- /dev/null +++ b/public/js/geoconcept/OpenLayers.js @@ -0,0 +1,1443 @@ +/* + + OpenLayers.js -- OpenLayers Map Viewer Library + + Copyright (c) 2006-2013 by OpenLayers Contributors + Published under the 2-clause BSD license. + See http://openlayers.org/dev/license.txt for the full text of the license, and http://openlayers.org/dev/authors.txt for full list of contributors. + + Includes compressed code under the following licenses: + + (For uncompressed versions of the code used, please see the + OpenLayers Github repository: ) + +*/ + +/** + * Contains XMLHttpRequest.js + * Copyright 2007 Sergey Ilinsky (http://www.ilinsky.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +/** + * OpenLayers.Util.pagePosition is based on Yahoo's getXY method, which is + * Copyright (c) 2006, Yahoo! Inc. + * All rights reserved. + * + * Redistribution and use of this software in source and binary forms, with or + * without modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of Yahoo! Inc. nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission of Yahoo! Inc. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +var OpenLayers={VERSION_NUMBER:"Release 2.13.1",singleFile:!0,_getScriptLocation:function(){for(var a=/(^|(.*?\/))(OpenLayers[^\/]*?\.js)(\?|$)/,b=document.getElementsByTagName("script"),c,d="",e=0,f=b.length;ethis.right)this.right=a.right;if(null==this.top||a.top>this.top)this.top=a.top}},extendXY:function(a,b){this.centerLonLat=null;if(null==this.left||athis.right)this.right=a;if(null==this.top||b>this.top)this.top=b},containsLonLat:function(a,b){"boolean"===typeof b&&(b={inclusive:b});b=b||{};var c=this.contains(a.lon,a.lat,b.inclusive),d=b.worldBounds;d&&!c&&(c=d.getWidth(), +d=Math.round((a.lon-(d.left+d.right)/2)/c),c=this.containsLonLat({lon:a.lon-d*c,lat:a.lat},{inclusive:b.inclusive}));return c},containsPixel:function(a,b){return this.contains(a.x,a.y,b)},contains:function(a,b,c){null==c&&(c=!0);if(null==a||null==b)return!1;a=OpenLayers.Util.toFloat(a);b=OpenLayers.Util.toFloat(b);var d=!1;return d=c?a>=this.left&&a<=this.right&&b>=this.bottom&&b<=this.top:a>this.left&&athis.bottom&&b=c.bottom&&a.top<=c.top||c.top>a.bottom&&c.top=c.left&&a.left<=c.right||c.left>=a.left&&c.left<=a.right,f=a.right>=c.left&&a.right<=c.right||c.right>=a.left&&c.right<=a.right,d=(a.bottom>=c.bottom&&a.bottom<=c.top||c.bottom>= +a.bottom&&c.bottom<=a.top||d)&&(e||f);if(b.worldBounds&&!d){var g=b.worldBounds,e=g.getWidth(),f=!g.containsBounds(c),g=!g.containsBounds(a);f&&!g?(a=a.add(-e,0),d=c.intersectsBounds(a,{inclusive:b.inclusive})):g&&!f&&(c=c.add(-e,0),d=a.intersectsBounds(c,{inclusive:b.inclusive}))}return d},containsBounds:function(a,b,c){null==b&&(b=!1);null==c&&(c=!0);var d=this.contains(a.left,a.bottom,c),e=this.contains(a.right,a.bottom,c),f=this.contains(a.left,a.top,c);a=this.contains(a.right,a.top,c);return b? +d||e||f||a:d&&e&&f&&a},determineQuadrant:function(a){var b="",c=this.getCenterLonLat(),b=b+(a.lat=a.right&&e.right>a.right;)e=e.add(-f,0);c=e.left+c;ca.left&&e.right-d>a.right)&&(e=e.add(-f,0))}return e},CLASS_NAME:"OpenLayers.Bounds"}); +OpenLayers.Bounds.fromString=function(a,b){var c=a.split(",");return OpenLayers.Bounds.fromArray(c,b)};OpenLayers.Bounds.fromArray=function(a,b){return!0===b?new OpenLayers.Bounds(a[1],a[0],a[3],a[2]):new OpenLayers.Bounds(a[0],a[1],a[2],a[3])};OpenLayers.Bounds.fromSize=function(a){return new OpenLayers.Bounds(0,a.h,a.w,0)};OpenLayers.Bounds.oppositeQuadrant=function(a){var b;b=""+("t"==a.charAt(0)?"b":"t");return b+="l"==a.charAt(1)?"r":"l"};OpenLayers.Element={visible:function(a){return"none"!=OpenLayers.Util.getElement(a).style.display},toggle:function(){for(var a=0,b=arguments.length;aa.right;)b.lon-=a.getWidth()}return b},CLASS_NAME:"OpenLayers.LonLat"}); +OpenLayers.LonLat.fromString=function(a){a=a.split(",");return new OpenLayers.LonLat(a[0],a[1])};OpenLayers.LonLat.fromArray=function(a){var b=OpenLayers.Util.isArray(a);return new OpenLayers.LonLat(b&&a[0],b&&a[1])};OpenLayers.Pixel=OpenLayers.Class({x:0,y:0,initialize:function(a,b){this.x=parseFloat(a);this.y=parseFloat(b)},toString:function(){return"x="+this.x+",y="+this.y},clone:function(){return new OpenLayers.Pixel(this.x,this.y)},equals:function(a){var b=!1;null!=a&&(b=this.x==a.x&&this.y==a.y||isNaN(this.x)&&isNaN(this.y)&&isNaN(a.x)&&isNaN(a.y));return b},distanceTo:function(a){return Math.sqrt(Math.pow(this.x-a.x,2)+Math.pow(this.y-a.y,2))},add:function(a,b){if(null==a||null==b)throw new TypeError("Pixel.add cannot receive null values"); +return new OpenLayers.Pixel(this.x+a,this.y+b)},offset:function(a){var b=this.clone();a&&(b=this.add(a.x,a.y));return b},CLASS_NAME:"OpenLayers.Pixel"});OpenLayers.Size=OpenLayers.Class({w:0,h:0,initialize:function(a,b){this.w=parseFloat(a);this.h=parseFloat(b)},toString:function(){return"w="+this.w+",h="+this.h},clone:function(){return new OpenLayers.Size(this.w,this.h)},equals:function(a){var b=!1;null!=a&&(b=this.w==a.w&&this.h==a.h||isNaN(this.w)&&isNaN(this.h)&&isNaN(a.w)&&isNaN(a.h));return b},CLASS_NAME:"OpenLayers.Size"});OpenLayers.Console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){},userError:function(a){alert(a)},assert:function(){},dir:function(){},dirxml:function(){},trace:function(){},group:function(){},groupEnd:function(){},time:function(){},timeEnd:function(){},profile:function(){},profileEnd:function(){},count:function(){},CLASS_NAME:"OpenLayers.Console"}; +(function(){for(var a=document.getElementsByTagName("script"),b=0,c=a.length;bparseFloat(h)?(a.style.filter="alpha(opacity="+100*h+")",a.style.opacity=h):1==parseFloat(h)&&(a.style.filter="",a.style.opacity="")}; +OpenLayers.Util.createDiv=function(a,b,c,d,e,f,g,h){var k=document.createElement("div");d&&(k.style.backgroundImage="url("+d+")");a||(a=OpenLayers.Util.createUniqueID("OpenLayersDiv"));e||(e="absolute");OpenLayers.Util.modifyDOMElement(k,a,b,c,e,f,g,h);return k}; +OpenLayers.Util.createImage=function(a,b,c,d,e,f,g,h){var k=document.createElement("img");a||(a=OpenLayers.Util.createUniqueID("OpenLayersDiv"));e||(e="relative");OpenLayers.Util.modifyDOMElement(k,a,b,c,e,f,null,g);h&&(k.style.display="none",b=function(){k.style.display="";OpenLayers.Event.stopObservingElement(k)},OpenLayers.Event.observe(k,"load",b),OpenLayers.Event.observe(k,"error",b));k.style.alt=a;k.galleryImg="no";d&&(k.src=d);return k};OpenLayers.IMAGE_RELOAD_ATTEMPTS=0; +OpenLayers.Util.alphaHackNeeded=null;OpenLayers.Util.alphaHack=function(){if(null==OpenLayers.Util.alphaHackNeeded){var a=navigator.appVersion.split("MSIE"),a=parseFloat(a[1]),b=!1;try{b=!!document.body.filters}catch(c){}OpenLayers.Util.alphaHackNeeded=b&&5.5<=a&&7>a}return OpenLayers.Util.alphaHackNeeded}; +OpenLayers.Util.modifyAlphaImageDiv=function(a,b,c,d,e,f,g,h,k){OpenLayers.Util.modifyDOMElement(a,b,c,d,f,null,null,k);b=a.childNodes[0];e&&(b.src=e);OpenLayers.Util.modifyDOMElement(b,a.id+"_innerImage",null,d,"relative",g);OpenLayers.Util.alphaHack()&&("none"!=a.style.display&&(a.style.display="inline-block"),null==h&&(h="scale"),a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+b.src+"', sizingMethod='"+h+"')",0<=parseFloat(a.style.opacity)&&1>parseFloat(a.style.opacity)&& +(a.style.filter+=" alpha(opacity="+100*a.style.opacity+")"),b.style.filter="alpha(opacity=0)")};OpenLayers.Util.createAlphaImageDiv=function(a,b,c,d,e,f,g,h,k){var l=OpenLayers.Util.createDiv();k=OpenLayers.Util.createImage(null,null,null,null,null,null,null,k);k.className="olAlphaImg";l.appendChild(k);OpenLayers.Util.modifyAlphaImageDiv(l,a,b,c,d,e,f,g,h);return l};OpenLayers.Util.upperCaseObject=function(a){var b={},c;for(c in a)b[c.toUpperCase()]=a[c];return b}; +OpenLayers.Util.applyDefaults=function(a,b){a=a||{};var c="function"==typeof window.Event&&b instanceof window.Event,d;for(d in b)if(void 0===a[d]||!c&&b.hasOwnProperty&&b.hasOwnProperty(d)&&!a.hasOwnProperty(d))a[d]=b[d];!c&&(b&&b.hasOwnProperty&&b.hasOwnProperty("toString")&&!a.hasOwnProperty("toString"))&&(a.toString=b.toString);return a}; +OpenLayers.Util.getParameterString=function(a){var b=[],c;for(c in a){var d=a[c];if(null!=d&&"function"!=typeof d){if("object"==typeof d&&d.constructor==Array){for(var e=[],f,g=0,h=d.length;ge&&(e="0"+e);e+="\u00b0";0<=c.indexOf("dm")&&(10>d&&(d="0"+d),e+=d+"'",0<=c.indexOf("dms")&&(10>f&&(f="0"+f),e+=f+'"'));return e="lon"==b?e+(0>a?OpenLayers.i18n("W"):OpenLayers.i18n("E")):e+(0>a?OpenLayers.i18n("S"):OpenLayers.i18n("N"))};OpenLayers.Format=OpenLayers.Class({options:null,externalProjection:null,internalProjection:null,data:null,keepData:!1,initialize:function(a){OpenLayers.Util.extend(this,a);this.options=a},destroy:function(){},read:function(a){throw Error("Read not implemented.");},write:function(a){throw Error("Write not implemented.");},CLASS_NAME:"OpenLayers.Format"});OpenLayers.Format.CSWGetRecords=function(a){a=OpenLayers.Util.applyDefaults(a,OpenLayers.Format.CSWGetRecords.DEFAULTS);var b=OpenLayers.Format.CSWGetRecords["v"+a.version.replace(/\./g,"_")];if(!b)throw"Unsupported CSWGetRecords version: "+a.version;return new b(a)};OpenLayers.Format.CSWGetRecords.DEFAULTS={version:"2.0.2"};OpenLayers.Control=OpenLayers.Class({id:null,map:null,div:null,type:null,allowSelection:!1,displayClass:"",title:"",autoActivate:!1,active:null,handlerOptions:null,handler:null,eventListeners:null,events:null,initialize:function(a){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,"");OpenLayers.Util.extend(this,a);this.events=new OpenLayers.Events(this);if(this.eventListeners instanceof Object)this.events.on(this.eventListeners);null==this.id&&(this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+ +"_"))},destroy:function(){this.events&&(this.eventListeners&&this.events.un(this.eventListeners),this.events.destroy(),this.events=null);this.eventListeners=null;this.handler&&(this.handler.destroy(),this.handler=null);if(this.handlers){for(var a in this.handlers)this.handlers.hasOwnProperty(a)&&"function"==typeof this.handlers[a].destroy&&this.handlers[a].destroy();this.handlers=null}this.map&&(this.map.removeControl(this),this.map=null);this.div=null},setMap:function(a){this.map=a;this.handler&& +this.handler.setMap(a)},draw:function(a){null==this.div&&(this.div=OpenLayers.Util.createDiv(this.id),this.div.className=this.displayClass,this.allowSelection||(this.div.className+=" olControlNoSelect",this.div.setAttribute("unselectable","on",0),this.div.onselectstart=OpenLayers.Function.False),""!=this.title&&(this.div.title=this.title));null!=a&&(this.position=a.clone());this.moveTo(this.position);return this.div},moveTo:function(a){null!=a&&null!=this.div&&(this.div.style.left=a.x+"px",this.div.style.top= +a.y+"px")},activate:function(){if(this.active)return!1;this.handler&&this.handler.activate();this.active=!0;this.map&&OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active");this.events.triggerEvent("activate");return!0},deactivate:function(){return this.active?(this.handler&&this.handler.deactivate(),this.active=!1,this.map&&OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active"),this.events.triggerEvent("deactivate"), +!0):!1},CLASS_NAME:"OpenLayers.Control"});OpenLayers.Control.TYPE_BUTTON=1;OpenLayers.Control.TYPE_TOGGLE=2;OpenLayers.Control.TYPE_TOOL=3;OpenLayers.Event={observers:!1,KEY_SPACE:32,KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(a){return a.target||a.srcElement},isSingleTouch:function(a){return a.touches&&1==a.touches.length},isMultiTouch:function(a){return a.touches&&1Math.floor(a.pageY)||0===a.pageX&&Math.floor(d)>Math.floor(a.pageX))d-=c,e-=b;else if(ethis.duration&&this.stop()},CLASS_NAME:"OpenLayers.Tween"});OpenLayers.Easing={CLASS_NAME:"OpenLayers.Easing"};OpenLayers.Easing.Linear={easeIn:function(a,b,c,d){return c*a/d+b},easeOut:function(a,b,c,d){return c*a/d+b},easeInOut:function(a,b,c,d){return c*a/d+b},CLASS_NAME:"OpenLayers.Easing.Linear"}; +OpenLayers.Easing.Expo={easeIn:function(a,b,c,d){return 0==a?b:c*Math.pow(2,10*(a/d-1))+b},easeOut:function(a,b,c,d){return a==d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b},easeInOut:function(a,b,c,d){return 0==a?b:a==d?b+c:1>(a/=d/2)?c/2*Math.pow(2,10*(a-1))+b:c/2*(-Math.pow(2,-10*--a)+2)+b},CLASS_NAME:"OpenLayers.Easing.Expo"}; +OpenLayers.Easing.Quad={easeIn:function(a,b,c,d){return c*(a/=d)*a+b},easeOut:function(a,b,c,d){return-c*(a/=d)*(a-2)+b},easeInOut:function(a,b,c,d){return 1>(a/=d/2)?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b},CLASS_NAME:"OpenLayers.Easing.Quad"};OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,titleRegEx:/\+title=[^\+]*/,initialize:function(a,b){OpenLayers.Util.extend(this,b);this.projCode=a;"object"==typeof Proj4js&&(this.proj=new Proj4js.Proj(a))},getCode:function(){return this.proj?this.proj.srsCode:this.projCode},getUnits:function(){return this.proj?this.proj.units:null},toString:function(){return this.getCode()},equals:function(a){var b=!1;a&&(a instanceof OpenLayers.Projection||(a=new OpenLayers.Projection(a)),"object"== +typeof Proj4js&&this.proj.defData&&a.proj.defData?b=this.proj.defData.replace(this.titleRegEx,"")==a.proj.defData.replace(this.titleRegEx,""):a.getCode&&(b=this.getCode(),a=a.getCode(),b=b==a||!!OpenLayers.Projection.transforms[b]&&OpenLayers.Projection.transforms[b][a]===OpenLayers.Projection.nullTransform));return b},destroy:function(){delete this.proj;delete this.projCode},CLASS_NAME:"OpenLayers.Projection"});OpenLayers.Projection.transforms={}; +OpenLayers.Projection.defaults={"EPSG:4326":{units:"degrees",maxExtent:[-180,-90,180,90],yx:!0},"CRS:84":{units:"degrees",maxExtent:[-180,-90,180,90]},"EPSG:900913":{units:"m",maxExtent:[-2.003750834E7,-2.003750834E7,2.003750834E7,2.003750834E7]}}; +OpenLayers.Projection.addTransform=function(a,b,c){if(c===OpenLayers.Projection.nullTransform){var d=OpenLayers.Projection.defaults[a];d&&!OpenLayers.Projection.defaults[b]&&(OpenLayers.Projection.defaults[b]=d)}OpenLayers.Projection.transforms[a]||(OpenLayers.Projection.transforms[a]={});OpenLayers.Projection.transforms[a][b]=c}; +OpenLayers.Projection.transform=function(a,b,c){if(b&&c)if(b instanceof OpenLayers.Projection||(b=new OpenLayers.Projection(b)),c instanceof OpenLayers.Projection||(c=new OpenLayers.Projection(c)),b.proj&&c.proj)a=Proj4js.transform(b.proj,c.proj,a);else{b=b.getCode();c=c.getCode();var d=OpenLayers.Projection.transforms;if(d[b]&&d[b][c])d[b][c](a)}return a};OpenLayers.Projection.nullTransform=function(a){return a}; +(function(){function a(a){a.x=180*a.x/d;a.y=180/Math.PI*(2*Math.atan(Math.exp(a.y/d*Math.PI))-Math.PI/2);return a}function b(a){a.x=a.x*d/180;var b=Math.log(Math.tan((90+a.y)*Math.PI/360))/Math.PI*d;a.y=Math.max(-2.003750834E7,Math.min(b,2.003750834E7));return a}function c(c,d){var e=OpenLayers.Projection.addTransform,f=OpenLayers.Projection.nullTransform,g,p,q,r,s;g=0;for(p=d.length;gb?b=0:b>this.layers.length&&(b=this.layers.length);if(c!=b){this.layers.splice(c,1);this.layers.splice(b,0,a);for(var c=0,d=this.layers.length;c=this.minPx.x+h?Math.round(a):0;b=f<=this.maxPx.y-k&&f>=this.minPx.y+k?Math.round(b):0;if(a||b){this.dragging||(this.dragging=!0,this.events.triggerEvent("movestart")); +this.center=null;a&&(this.layerContainerOriginPx.x-=a,this.minPx.x-=a,this.maxPx.x-=a);b&&(this.layerContainerOriginPx.y-=b,this.minPx.y-=b,this.maxPx.y-=b);this.applyTransform();d=0;for(e=this.layers.length;dc)if(this.fractionalZoom)a=this.getZoomForResolution(c);else for(var d=a|0,e=b.length;dthis.restrictedExtent.getWidth()?a=new OpenLayers.LonLat(g.lon,a.lat):f.leftthis.restrictedExtent.right&& +(a=a.add(this.restrictedExtent.right-f.right,0));f.getHeight()>this.restrictedExtent.getHeight()?a=new OpenLayers.LonLat(a.lon,g.lat):f.bottomthis.restrictedExtent.top&&(a=a.add(0,this.restrictedExtent.top-f.top))}}e=e||this.isValidZoomLevel(b)&&b!=this.getZoom();f=this.isValidLonLat(a)&&!a.equals(this.center);if(e||f||d){d||this.events.triggerEvent("movestart",{zoomChanged:e});f&&(!e&&this.center&&this.centerLayerContainer(a), +this.center=a.clone());a=e?this.getResolutionForZoom(b):this.getResolution();if(e||null==this.layerContainerOrigin){this.layerContainerOrigin=this.getCachedCenter();this.layerContainerOriginPx.x=0;this.layerContainerOriginPx.y=0;this.applyTransform();var f=this.getMaxExtent({restricted:!0}),h=f.getCenterLonLat(),g=this.center.lon-h.lon,h=h.lat-this.center.lat,k=Math.round(f.getWidth()/a),l=Math.round(f.getHeight()/a);this.minPx={x:(this.size.w-k)/2-g/a,y:(this.size.h-l)/2-h/a};this.maxPx={x:this.minPx.x+ +Math.round(f.getWidth()/a),y:this.minPx.y+Math.round(f.getHeight()/a)}}e&&(this.zoom=b,this.resolution=a);a=this.getExtent();this.baseLayer.visibility&&(this.baseLayer.moveTo(a,e,c.dragging),c.dragging||this.baseLayer.events.triggerEvent("moveend",{zoomChanged:e}));a=this.baseLayer.getExtent();for(b=this.layers.length-1;0<=b;--b)f=this.layers[b],f===this.baseLayer||f.isBaseLayer||(g=f.calculateInRange(),f.inRange!=g&&((f.inRange=g)||f.display(!1),this.events.triggerEvent("changelayer",{layer:f,property:"visibility"})), +g&&f.visibility&&(f.moveTo(a,e,c.dragging),c.dragging||f.events.triggerEvent("moveend",{zoomChanged:e})));this.events.triggerEvent("move");d||this.events.triggerEvent("moveend");if(e){b=0;for(c=this.popups.length;b=this.down.xy.distanceTo(a.xy))&&this.touch&&this.down.touches.length===this.last.touches.length){a=0;for(var c=this.down.touches.length;athis.pixelTolerance){b=!1;break}}return b},getTouchDistance:function(a,b){return Math.sqrt(Math.pow(a.clientX-b.clientX,2)+Math.pow(a.clientY-b.clientY, +2))},passesDblclickTolerance:function(a){a=!0;this.down&&this.first&&(a=this.down.xy.distanceTo(this.first.xy)<=this.dblclickTolerance);return a},clearTimer:function(){null!=this.timerId&&(window.clearTimeout(this.timerId),this.timerId=null);null!=this.rightclickTimerId&&(window.clearTimeout(this.rightclickTimerId),this.rightclickTimerId=null)},delayedCall:function(a){this.timerId=null;a&&this.callback("click",[a])},getEventInfo:function(a){var b;if(a.touches){var c=a.touches.length;b=Array(c);for(var d, +e=0;ethis.minRatio&&b<=this.maxRatio&&this.ovmap.getExtent().containsBounds(a)},updateOverview:function(){var a=this.map.getResolution(),b=this.ovmap.getResolution(),c=b/a;c>this.maxRatio?b=this.minRatio*a:c<=this.minRatio&&(b=this.maxRatio*a);this.ovmap.getProjection()!=this.map.getProjection()?(a=this.map.center.clone(),a.transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject())):a=this.map.center;this.ovmap.setCenter(a, +this.ovmap.getZoomForResolution(b*this.resolutionFactor));this.updateRectToMap()},createMap:function(){var a=OpenLayers.Util.extend({controls:[],maxResolution:"auto",fallThrough:!1},this.mapOptions);this.ovmap=new OpenLayers.Map(this.mapDiv,a);this.ovmap.viewPortDiv.appendChild(this.extentRectangle);OpenLayers.Event.stopObserving(window,"unload",this.ovmap.unloadDestroy);this.ovmap.addLayers(this.layers);this.ovmap.zoomToMaxExtent();this.wComp=(this.wComp=parseInt(OpenLayers.Element.getStyle(this.extentRectangle, +"border-left-width"))+parseInt(OpenLayers.Element.getStyle(this.extentRectangle,"border-right-width")))?this.wComp:2;this.hComp=(this.hComp=parseInt(OpenLayers.Element.getStyle(this.extentRectangle,"border-top-width"))+parseInt(OpenLayers.Element.getStyle(this.extentRectangle,"border-bottom-width")))?this.hComp:2;this.handlers.drag=new OpenLayers.Handler.Drag(this,{move:this.rectDrag,done:this.updateMapToRect},{map:this.ovmap});this.handlers.click=new OpenLayers.Handler.Click(this,{click:this.mapDivClick}, +{single:!0,"double":!1,stopSingle:!0,stopDouble:!0,pixelTolerance:1,map:this.ovmap});this.handlers.click.activate();this.rectEvents=new OpenLayers.Events(this,this.extentRectangle,null,!0);this.rectEvents.register("mouseover",this,function(a){this.handlers.drag.active||this.map.dragging||this.handlers.drag.activate()});this.rectEvents.register("mouseout",this,function(a){this.handlers.drag.dragging||this.handlers.drag.deactivate()});if(this.ovmap.getProjection()!=this.map.getProjection()){var a=this.map.getProjectionObject().getUnits()|| +this.map.units||this.map.baseLayer.units,b=this.ovmap.getProjectionObject().getUnits()||this.ovmap.units||this.ovmap.baseLayer.units;this.resolutionFactor=a&&b?OpenLayers.INCHES_PER_UNIT[a]/OpenLayers.INCHES_PER_UNIT[b]:1}},updateRectToMap:function(){var a;a=this.ovmap.getProjection()!=this.map.getProjection()?this.map.getExtent().transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject()):this.map.getExtent();(a=this.getRectBoundsFromMapBounds(a))&&this.setRectPxBounds(a)},updateMapToRect:function(){var a= +this.getMapBoundsFromRectBounds(this.rectPxBounds);this.ovmap.getProjection()!=this.map.getProjection()&&(a=a.transform(this.ovmap.getProjectionObject(),this.map.getProjectionObject()));this.map.panTo(a.getCenterLonLat())},setRectPxBounds:function(a){var b=Math.max(a.top,0),c=Math.max(a.left,0),d=Math.min(a.top+Math.abs(a.getHeight()),this.ovmap.size.h-this.hComp);a=Math.min(a.left+a.getWidth(),this.ovmap.size.w-this.wComp);var e=Math.max(a-c,0),f=Math.max(d-b,0);e=this.minResolution&&a<=this.maxResolution);return a},setIsBaseLayer:function(a){a!=this.isBaseLayer&&(this.isBaseLayer= +a,null!=this.map&&this.map.events.triggerEvent("changebaselayer",{layer:this}))},initResolutions:function(){var a,b,c,d={},e=!0;a=0;for(b=this.RESOLUTION_PROPERTIES.length;a=a||"number"!==typeof d&&"number"!==typeof c)){b=Array(a);var e=2;"number"==typeof c&&"number"==typeof d&&(e=Math.pow(d/c,1/(a-1)));var f;if("number"===typeof d)for(f=0;f=a&&(f=h,e=c),h<=a){g=h;break}c=f-g;c=0f)break;f=e}else if(this.resolutions[c]=a.count&& +this.removeGMapElements()}OpenLayers.Layer.EventPane.prototype.destroy.apply(this,arguments)},removeGMapElements:function(){var a=OpenLayers.Layer.Google.cache[this.map.id];if(a){var b=this.mapObject&&this.getMapContainer();b&&b.parentNode&&b.parentNode.removeChild(b);(b=a.termsOfUse)&&b.parentNode&&b.parentNode.removeChild(b);(a=a.poweredBy)&&a.parentNode&&a.parentNode.removeChild(a);this.mapObject&&(window.google&&google.maps&&google.maps.event&&google.maps.event.clearListeners)&&google.maps.event.clearListeners(this.mapObject, +"tilesloaded")}},removeMap:function(a){this.visibility&&this.mapObject&&this.setGMapVisibility(!1);var b=OpenLayers.Layer.Google.cache[a.id];b&&(1>=b.count?(this.removeGMapElements(),delete OpenLayers.Layer.Google.cache[a.id]):--b.count);delete this.termsOfUse;delete this.poweredBy;delete this.mapObject;delete this.dragObject;OpenLayers.Layer.EventPane.prototype.removeMap.apply(this,arguments)},getOLBoundsFromMapObjectBounds:function(a){var b=null;null!=a&&(b=a.getSouthWest(),a=a.getNorthEast(),this.sphericalMercator? +(b=this.forwardMercator(b.lng(),b.lat()),a=this.forwardMercator(a.lng(),a.lat())):(b=new OpenLayers.LonLat(b.lng(),b.lat()),a=new OpenLayers.LonLat(a.lng(),a.lat())),b=new OpenLayers.Bounds(b.lon,b.lat,a.lon,a.lat));return b},getWarningHTML:function(){return OpenLayers.i18n("googleWarning")},getMapObjectCenter:function(){return this.mapObject.getCenter()},getMapObjectZoom:function(){return this.mapObject.getZoom()},getLongitudeFromMapObjectLonLat:function(a){return this.sphericalMercator?this.forwardMercator(a.lng(), +a.lat()).lon:a.lng()},getLatitudeFromMapObjectLonLat:function(a){return this.sphericalMercator?this.forwardMercator(a.lng(),a.lat()).lat:a.lat()},getXFromMapObjectPixel:function(a){return a.x},getYFromMapObjectPixel:function(a){return a.y},CLASS_NAME:"OpenLayers.Layer.Google"});OpenLayers.Layer.Google.cache={}; +OpenLayers.Layer.Google.v2={termsOfUse:null,poweredBy:null,dragObject:null,loadMapObject:function(){this.type||(this.type=G_NORMAL_MAP);var a,b,c,d=OpenLayers.Layer.Google.cache[this.map.id];if(d)a=d.mapObject,b=d.termsOfUse,c=d.poweredBy,++d.count;else{var d=this.map.viewPortDiv,e=document.createElement("div");e.id=this.map.id+"_GMap2Container";e.style.position="absolute";e.style.width="100%";e.style.height="100%";d.appendChild(e);try{a=new GMap2(e),b=e.lastChild,d.appendChild(b),b.style.zIndex= +"1100",b.style.right="",b.style.bottom="",b.className="olLayerGoogleCopyright",c=e.lastChild,d.appendChild(c),c.style.zIndex="1100",c.style.right="",c.style.bottom="",c.className="olLayerGooglePoweredBy gmnoprint"}catch(f){throw f;}OpenLayers.Layer.Google.cache[this.map.id]={mapObject:a,termsOfUse:b,poweredBy:c,count:1}}this.mapObject=a;this.termsOfUse=b;this.poweredBy=c;-1===OpenLayers.Util.indexOf(this.mapObject.getMapTypes(),this.type)&&this.mapObject.addMapType(this.type);"function"==typeof a.getDragObject? +this.dragObject=a.getDragObject():this.dragPanMapObject=null;!1===this.isBaseLayer&&this.setGMapVisibility("none"!==this.div.style.display)},onMapResize:function(){if(this.visibility&&this.mapObject.isLoaded())this.mapObject.checkResize();else{if(!this._resized)var a=this,b=GEvent.addListener(this.mapObject,"load",function(){GEvent.removeListener(b);delete a._resized;a.mapObject.checkResize();a.moveTo(a.map.getCenter(),a.map.getZoom())});this._resized=!0}},setGMapVisibility:function(a){var b=OpenLayers.Layer.Google.cache[this.map.id]; +if(b){var c=this.mapObject.getContainer();!0===a?(this.mapObject.setMapType(this.type),c.style.display="",this.termsOfUse.style.left="",this.termsOfUse.style.display="",this.poweredBy.style.display="",b.displayed=this.id):(b.displayed===this.id&&delete b.displayed,b.displayed||(c.style.display="none",this.termsOfUse.style.display="none",this.termsOfUse.style.left="-9999px",this.poweredBy.style.display="none"))}},getMapContainer:function(){return this.mapObject.getContainer()},getMapObjectBoundsFromOLBounds:function(a){var b= +null;null!=a&&(b=this.sphericalMercator?this.inverseMercator(a.bottom,a.left):new OpenLayers.LonLat(a.bottom,a.left),a=this.sphericalMercator?this.inverseMercator(a.top,a.right):new OpenLayers.LonLat(a.top,a.right),b=new GLatLngBounds(new GLatLng(b.lat,b.lon),new GLatLng(a.lat,a.lon)));return b},setMapObjectCenter:function(a,b){this.mapObject.setCenter(a,b)},dragPanMapObject:function(a,b){this.dragObject.moveBy(new GSize(-a,b))},getMapObjectLonLatFromMapObjectPixel:function(a){return this.mapObject.fromContainerPixelToLatLng(a)}, +getMapObjectPixelFromMapObjectLonLat:function(a){return this.mapObject.fromLatLngToContainerPixel(a)},getMapObjectZoomFromMapObjectBounds:function(a){return this.mapObject.getBoundsZoomLevel(a)},getMapObjectLonLatFromLonLat:function(a,b){var c;this.sphericalMercator?(c=this.inverseMercator(a,b),c=new GLatLng(c.lat,c.lon)):c=new GLatLng(b,a);return c},getMapObjectPixelFromXY:function(a,b){return new GPoint(a,b)}};OpenLayers.Format.XML=OpenLayers.Class(OpenLayers.Format,{namespaces:null,namespaceAlias:null,defaultPrefix:null,readers:{},writers:{},xmldom:null,initialize:function(a){window.ActiveXObject&&(this.xmldom=new ActiveXObject("Microsoft.XMLDOM"));OpenLayers.Format.prototype.initialize.apply(this,[a]);this.namespaces=OpenLayers.Util.extend({},this.namespaces);this.namespaceAlias={};for(var b in this.namespaces)this.namespaceAlias[this.namespaces[b]]=b},destroy:function(){this.xmldom=null;OpenLayers.Format.prototype.destroy.apply(this, +arguments)},setNamespace:function(a,b){this.namespaces[a]=b;this.namespaceAlias[b]=a},read:function(a){var b=a.indexOf("<");0this.value;break;case OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO:b=a<=this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO:b= +a>=this.value;break;case OpenLayers.Filter.Comparison.BETWEEN:b=a>=this.lowerBoundary&&a<=this.upperBoundary;break;case OpenLayers.Filter.Comparison.LIKE:b=RegExp(this.value,"gi").test(a);break;case OpenLayers.Filter.Comparison.IS_NULL:b=null===a}return b},value2regex:function(a,b,c){if("."==a)throw Error("'.' is an unsupported wildCard character for OpenLayers.Filter.Comparison");a=a?a:"*";b=b?b:".";this.value=this.value.replace(RegExp("\\"+(c?c:"!")+"(.|$)","g"),"\\$1");this.value=this.value.replace(RegExp("\\"+ +b,"g"),".");this.value=this.value.replace(RegExp("\\"+a,"g"),".*");this.value=this.value.replace(RegExp("\\\\.\\*","g"),"\\"+a);return this.value=this.value.replace(RegExp("\\\\\\.","g"),"\\"+b)},regex2value:function(){var a=this.value,a=a.replace(/!/g,"!!"),a=a.replace(/(\\)?\\\./g,function(a,c){return c?a:"!."}),a=a.replace(/(\\)?\\\*/g,function(a,c){return c?a:"!*"}),a=a.replace(/\\\\/g,"\\");return a=a.replace(/\.\*/g,"*")},clone:function(){return OpenLayers.Util.extend(new OpenLayers.Filter.Comparison, +this)},CLASS_NAME:"OpenLayers.Filter.Comparison"});OpenLayers.Filter.Comparison.EQUAL_TO="==";OpenLayers.Filter.Comparison.NOT_EQUAL_TO="!=";OpenLayers.Filter.Comparison.LESS_THAN="<";OpenLayers.Filter.Comparison.GREATER_THAN=">";OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO="<=";OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO=">=";OpenLayers.Filter.Comparison.BETWEEN="..";OpenLayers.Filter.Comparison.LIKE="~";OpenLayers.Filter.Comparison.IS_NULL="NULL";OpenLayers.Format.Filter=OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC,{defaultVersion:"1.0.0",CLASS_NAME:"OpenLayers.Format.Filter"});OpenLayers.Filter.Function=OpenLayers.Class(OpenLayers.Filter,{name:null,params:null,CLASS_NAME:"OpenLayers.Filter.Function"});OpenLayers.Date={dateRegEx:/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))|Z)?$/,toISOString:function(){return"toISOString"in Date.prototype?function(a){return a.toISOString()}:function(a){return isNaN(a.getTime())?"Invalid Date":a.getUTCFullYear()+"-"+OpenLayers.Number.zeroPad(a.getUTCMonth()+1,2)+"-"+OpenLayers.Number.zeroPad(a.getUTCDate(),2)+"T"+OpenLayers.Number.zeroPad(a.getUTCHours(),2)+":"+OpenLayers.Number.zeroPad(a.getUTCMinutes(), +2)+":"+OpenLayers.Number.zeroPad(a.getUTCSeconds(),2)+"."+OpenLayers.Number.zeroPad(a.getUTCMilliseconds(),3)+"Z"}}(),parse:function(a){var b;if((a=a.match(this.dateRegEx))&&(a[1]||a[7])){b=parseInt(a[1],10)||0;var c=parseInt(a[2],10)-1||0,d=parseInt(a[3],10)||1;b=new Date(Date.UTC(b,c,d));if(c=a[7]){var d=parseInt(a[4],10),e=parseInt(a[5],10),f=parseFloat(a[6]),g=f|0,f=Math.round(1E3*(f-g));b.setUTCHours(d,e,g,f);"Z"!==c&&(c=parseInt(c,10),a=parseInt(a[8],10)||0,a=-1E3*(60*60*c+60*a),b=new Date(b.getTime()+ +a))}}else b=new Date("invalid");return b}};OpenLayers.Format.Filter.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{ogc:"http://www.opengis.net/ogc",gml:"http://www.opengis.net/gml",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},defaultPrefix:"ogc",schemaLocation:null,initialize:function(a){OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},read:function(a){var b={};this.readers.ogc.Filter.apply(this,[a,b]);return b.filter},readers:{ogc:{_expression:function(a){for(var b="",c=a.firstChild;c;c= +c.nextSibling)switch(c.nodeType){case 1:a=this.readNode(c);a.property?b+="${"+a.property+"}":void 0!==a.value&&(b+=a.value);break;case 3:case 4:b+=c.nodeValue}return b},Filter:function(a,b){var c={fids:[],filters:[]};this.readChildNodes(a,c);0":"PropertyIsGreaterThan","<=":"PropertyIsLessThanOrEqualTo",">=":"PropertyIsGreaterThanOrEqualTo","..":"PropertyIsBetween","~":"PropertyIsLike",NULL:"PropertyIsNull",BBOX:"BBOX",DWITHIN:"DWITHIN",WITHIN:"WITHIN",CONTAINS:"CONTAINS",INTERSECTS:"INTERSECTS",FID:"_featureIds"},CLASS_NAME:"OpenLayers.Format.Filter.v1"});OpenLayers.Geometry=OpenLayers.Class({id:null,parent:null,bounds:null,initialize:function(){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){this.bounds=this.id=null},clone:function(){return new OpenLayers.Geometry},setBounds:function(a){a&&(this.bounds=a.clone())},clearBounds:function(){this.bounds=null;this.parent&&this.parent.clearBounds()},extendBounds:function(a){this.getBounds()?this.bounds.extend(a):this.setBounds(a)},getBounds:function(){null==this.bounds&&this.calculateBounds(); +return this.bounds},calculateBounds:function(){},distanceTo:function(a,b){},getVertices:function(a){},atPoint:function(a,b,c){var d=!1;null!=this.getBounds()&&null!=a&&(b=null!=b?b:0,c=null!=c?c:0,d=(new OpenLayers.Bounds(this.bounds.left-b,this.bounds.bottom-c,this.bounds.right+b,this.bounds.top+c)).containsLonLat(a));return d},getLength:function(){return 0},getArea:function(){return 0},getCentroid:function(){return null},toString:function(){return OpenLayers.Format&&OpenLayers.Format.WKT?OpenLayers.Format.WKT.prototype.write(new OpenLayers.Feature.Vector(this)): +Object.prototype.toString.call(this)},CLASS_NAME:"OpenLayers.Geometry"});OpenLayers.Geometry.fromWKT=function(a){var b;if(OpenLayers.Format&&OpenLayers.Format.WKT){var c=OpenLayers.Geometry.fromWKT.format;c||(c=new OpenLayers.Format.WKT,OpenLayers.Geometry.fromWKT.format=c);a=c.read(a);if(a instanceof OpenLayers.Feature.Vector)b=a.geometry;else if(OpenLayers.Util.isArray(a)){b=a.length;for(var c=Array(b),d=0;d=f&&0<=n&&1>=n)&&(d?(h=a.x1+f*h,n=a.y1+f*k,e=new OpenLayers.Geometry.Point(h,n)):e=!0));if(c)if(e){if(d)a:for(a=[a,b],b=0;2>b;++b)for(f=a[b],k=1;3>k;++k)if(h=f["x"+k],n=f["y"+k],d=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(n-e.y,2)),db;++b)for(h=a[b],n=a[(b+1)%2],k=1;3>k;++k)if(f={x:h["x"+k],y:h["y"+k]},g=OpenLayers.Geometry.distanceToSegment(f,n),g.distance=m||(1<=m?(e=g,f=h):(e+=m*k,f+=m*l));return{distance:Math.pow(e-c,2)+Math.pow(f-d,2),x:e,y:f,along:m}};OpenLayers.Geometry.Point=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,initialize:function(a,b){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=parseFloat(a);this.y=parseFloat(b)},clone:function(a){null==a&&(a=new OpenLayers.Geometry.Point(this.x,this.y));OpenLayers.Util.applyDefaults(a,this);return a},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x,this.y)},distanceTo:function(a,b){var c=!(b&&!1===b.edge)&&b&&b.details,d,e,f,g,h;a instanceof +OpenLayers.Geometry.Point?(e=this.x,f=this.y,g=a.x,h=a.y,d=Math.sqrt(Math.pow(e-g,2)+Math.pow(f-h,2)),d=c?{x0:e,y0:f,x1:g,y1:h,distance:d}:d):(d=a.distanceTo(this,b),c&&(d={x0:d.x1,y0:d.y1,x1:d.x0,y1:d.y0,distance:d.distance}));return d},equals:function(a){var b=!1;null!=a&&(b=this.x==a.x&&this.y==a.y||isNaN(this.x)&&isNaN(this.y)&&isNaN(a.x)&&isNaN(a.y));return b},toShortString:function(){return this.x+", "+this.y},move:function(a,b){this.x+=a;this.y+=b;this.clearBounds()},rotate:function(a,b){a*= +Math.PI/180;var c=this.distanceTo(b),d=a+Math.atan2(this.y-b.y,this.x-b.x);this.x=b.x+c*Math.cos(d);this.y=b.y+c*Math.sin(d);this.clearBounds()},getCentroid:function(){return new OpenLayers.Geometry.Point(this.x,this.y)},resize:function(a,b,c){this.x=b.x+a*(void 0==c?1:c)*(this.x-b.x);this.y=b.y+a*(this.y-b.y);this.clearBounds();return this},intersects:function(a){var b=!1;return b="OpenLayers.Geometry.Point"==a.CLASS_NAME?this.equals(a):a.intersects(this)},transform:function(a,b){a&&b&&(OpenLayers.Projection.transform(this, +a,b),this.bounds=null);return this},getVertices:function(a){return[this]},CLASS_NAME:"OpenLayers.Geometry.Point"});OpenLayers.Geometry.Collection=OpenLayers.Class(OpenLayers.Geometry,{components:null,componentTypes:null,initialize:function(a){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.components=[];null!=a&&this.addComponents(a)},destroy:function(){this.components.length=0;this.components=null;OpenLayers.Geometry.prototype.destroy.apply(this,arguments)},clone:function(){for(var a=eval("new "+this.CLASS_NAME+"()"),b=0,c=this.components.length;bf)break;if(!(k.x2Math.max(g,h)||Math.max(l,m)h&&(k>l.y1&&kl.y2))break;e=c?{distance:e.distance,x0:e.x,y0:e.y,x1:h,y1:k}:e.distance}else if(a instanceof OpenLayers.Geometry.LineString){var g=this.getSortedSegments(),h=a.getSortedSegments(),p,q,r=h.length,s={point:!0},m=0,n=g.length;a:for(;mb.length)return this;var c=function(a,b,d,k){for(var l=0,m=0,n=b,p;nl&&(l=p,m=n)}l>k&&m!=b&&(e.push(m),c(a,b,m,k),c(a,m,d,k))},d=b.length-1,e=[];e.push(0);for(e.push(d);b[0].equals(b[d]);)d--,e.push(d);c(b,0,d,a);a=[];e.sort(function(a,b){return a-b});for(d=0;d=a)return this.components[0].clone();if(2=g&&c<=h||g>=h&&c<=g&&c>=h)){l=-1;break}}else{k=b((a-f)*((h-g)/(f-e))+h,14);if(k== +c&&(e=e&&a<=f||e>f&&a<=e&&a>=f)){l=-1;break}k<=c||g!=h&&(kMath.max(g,h))||(e=e&&af&&a=f)&&++l}return-1==l?1:!!(l&1)},intersects:function(a){var b=!1;if("OpenLayers.Geometry.Point"==a.CLASS_NAME)b=this.containsPoint(a);else if("OpenLayers.Geometry.LineString"==a.CLASS_NAME)b=a.intersects(this);else if("OpenLayers.Geometry.LinearRing"==a.CLASS_NAME)b=OpenLayers.Geometry.LineString.prototype.intersects.apply(this,[a]);else for(var c=0,d=a.components.length;c< +d&&!(b=a.components[c].intersects(this));++c);return b},getVertices:function(a){return!0===a?[]:this.components.slice(0,this.components.length-1)},CLASS_NAME:"OpenLayers.Geometry.LinearRing"});OpenLayers.Geometry.Polygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LinearRing"],getArea:function(){var a=0;if(this.components&&0a?"0"+a:a}return'"'+a.getFullYear()+ +"-"+b(a.getMonth()+1)+"-"+b(a.getDate())+"T"+b(a.getHours())+":"+b(a.getMinutes())+":"+b(a.getSeconds())+'"'}},CLASS_NAME:"OpenLayers.Format.JSON"});OpenLayers.Format.GeoJSON=OpenLayers.Class(OpenLayers.Format.JSON,{ignoreExtraDims:!1,read:function(a,b,c){b=b?b:"FeatureCollection";var d=null,e=null,e="string"==typeof a?OpenLayers.Format.JSON.prototype.read.apply(this,[a,c]):a;if(!e)OpenLayers.Console.error("Bad JSON: "+a);else if("string"!=typeof e.type)OpenLayers.Console.error("Bad GeoJSON - no type: "+a);else if(this.isValidType(e,b))switch(b){case "Geometry":try{d=this.parseGeometry(e)}catch(f){OpenLayers.Console.error(f)}break;case "Feature":try{d= +this.parseFeature(e),d.type="Feature"}catch(g){OpenLayers.Console.error(g)}break;case "FeatureCollection":switch(d=[],e.type){case "Feature":try{d.push(this.parseFeature(e))}catch(h){d=null,OpenLayers.Console.error(h)}break;case "FeatureCollection":a=0;for(b=e.features.length;ad&&(e=~e);a[c]=e}return this.encodeUnsignedIntegers(a)},decodeSignedIntegers:function(a){a=this.decodeUnsignedIntegers(a);for(var b=a.length,c=0;c>1):d>>1}return a},encodeUnsignedIntegers:function(a){for(var b="",c=a.length,d=0;dg?(b.push(c),d=c=0):d+=5}return b},encodeFloat:function(a,b){a=Math.round(a*(b||1E5));return this.encodeSignedInteger(a)},decodeFloat:function(a,b){return this.decodeSignedInteger(a)/(b||1E5)},encodeSignedInteger:function(a){var b=a<<1;0>a&&(b=~b);return this.encodeUnsignedInteger(b)},decodeSignedInteger:function(a){a=this.decodeUnsignedInteger(a);return a&1?~(a>>1):a>>1},encodeUnsignedInteger:function(a){for(var b,c="";32<= +a;)b=(32|a&31)+63,c+=String.fromCharCode(b),a>>=5;return c+=String.fromCharCode(a+63)},decodeUnsignedInteger:function(a){for(var b=0,c=0,d=a.length,e=0;ef)break;c+=5}return b},CLASS_NAME:"OpenLayers.Format.EncodedPolyline"});OpenLayers.Control.Panel=OpenLayers.Class(OpenLayers.Control,{controls:null,autoActivate:!0,defaultControl:null,saveState:!1,allowDepress:!1,activeState:null,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,[a]);this.controls=[];this.activeState={}},destroy:function(){this.map&&this.map.events.unregister("buttonclick",this,this.onButtonClick);OpenLayers.Control.prototype.destroy.apply(this,arguments);for(var a,b=this.controls.length-1;0<=b;b--)a=this.controls[b],a.events&& +a.events.un({activate:this.iconOn,deactivate:this.iconOff}),a.panel_div=null;this.activeState=null},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){for(var a,b=0,c=this.controls.length;bthis.layer.opacity&&(a.filter="alpha(opacity="+100*this.layer.opacity+")");a.position="absolute"; +this.layerAlphaHack&&(a.paddingTop=a.height,a.height="0",a.width="100%");this.frame&&this.frame.appendChild(this.imgDiv)}return this.imgDiv},setImage:function(a){this.imgDiv=a},initImage:function(){if(this.url||this.imgDiv){this.events.triggerEvent("beforeload");this.layer.div.appendChild(this.getTile());this.events.triggerEvent(this._loadEvent);var a=this.getImage(),b=a.getAttribute("src")||"";this.url&&OpenLayers.Util.isEquivalentUrl(b,this.url)?this._loadTimeout=window.setTimeout(OpenLayers.Function.bind(this.onImageLoad, +this),0):(this.stopLoading(),this.crossOriginKeyword&&a.removeAttribute("crossorigin"),OpenLayers.Event.observe(a,"load",OpenLayers.Function.bind(this.onImageLoad,this)),OpenLayers.Event.observe(a,"error",OpenLayers.Function.bind(this.onImageError,this)),this.imageReloadAttempts=0,this.setImgSrc(this.url))}else this.isLoading=!1},setImgSrc:function(a){var b=this.imgDiv;a?(b.style.visibility="hidden",b.style.opacity=0,this.crossOriginKeyword&&("data:"!==a.substr(0,5)?b.setAttribute("crossorigin",this.crossOriginKeyword): +b.removeAttribute("crossorigin")),b.src=a):(this.stopLoading(),this.imgDiv=null,b.parentNode&&b.parentNode.removeChild(b))},getTile:function(){return this.frame?this.frame:this.getImage()},createBackBuffer:function(){if(this.imgDiv&&!this.isLoading){var a;this.frame?(a=this.frame.cloneNode(!1),a.appendChild(this.imgDiv)):a=this.imgDiv;this.imgDiv=null;return a}},onImageLoad:function(){var a=this.imgDiv;this.stopLoading();a.style.visibility="inherit";a.style.opacity=this.layer.opacity;this.isLoading= +!1;this.canvasContext=null;this.events.triggerEvent("loadend");!0===this.layerAlphaHack&&(a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+a.src+"', sizingMethod='scale')")},onImageError:function(){var a=this.imgDiv;null!=a.src&&(this.imageReloadAttempts++,this.imageReloadAttempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS?this.setImgSrc(this.layer.getURL(this.bounds)):(OpenLayers.Element.addClass(a,"olImageLoadError"),this.events.triggerEvent("loaderror"),this.onImageLoad()))},stopLoading:function(){OpenLayers.Event.stopObservingElement(this.imgDiv); +window.clearTimeout(this._loadTimeout);delete this._loadTimeout},getCanvasContext:function(){if(OpenLayers.CANVAS_SUPPORTED&&this.imgDiv&&!this.isLoading){if(!this.canvasContext){var a=document.createElement("canvas");a.width=this.size.w;a.height=this.size.h;this.canvasContext=a.getContext("2d");this.canvasContext.drawImage(this.imgDiv,0,0)}return this.canvasContext}},CLASS_NAME:"OpenLayers.Tile.Image"}); +OpenLayers.Tile.Image.IMAGE=function(){var a=new Image;a.className="olTileImage";a.galleryImg="no";return a}();OpenLayers.Layer.Grid=OpenLayers.Class(OpenLayers.Layer.HTTPRequest,{tileSize:null,tileOriginCorner:"bl",tileOrigin:null,tileOptions:null,tileClass:OpenLayers.Tile.Image,grid:null,singleTile:!1,ratio:1.5,buffer:0,transitionEffect:"resize",numLoadingTiles:0,serverResolutions:null,loading:!1,backBuffer:null,gridResolution:null,backBufferResolution:null,backBufferLonLat:null,backBufferTimerId:null,removeBackBufferDelay:null,className:null,gridLayout:null,rowSign:null,transitionendEvents:["transitionend", +"webkitTransitionEnd","otransitionend","oTransitionEnd"],initialize:function(a,b,c,d){OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,arguments);this.grid=[];this._removeBackBuffer=OpenLayers.Function.bind(this.removeBackBuffer,this);this.initProperties();this.rowSign="t"===this.tileOriginCorner.substr(0,1)?1:-1},initProperties:function(){void 0===this.options.removeBackBufferDelay&&(this.removeBackBufferDelay=this.singleTile?0:2500);void 0===this.options.className&&(this.className=this.singleTile? +"olLayerGridSingleTile":"olLayerGrid")},setMap:function(a){OpenLayers.Layer.HTTPRequest.prototype.setMap.call(this,a);OpenLayers.Element.addClass(this.div,this.className)},removeMap:function(a){this.removeBackBuffer()},destroy:function(){this.removeBackBuffer();this.clearGrid();this.tileSize=this.grid=null;OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this,arguments)},clearGrid:function(){if(this.grid){for(var a=0,b=this.grid.length;ab)break;b=d;f=e}a=f}return a},getServerZoom:function(){var a=this.getServerResolution();return this.serverResolutions?OpenLayers.Util.indexOf(this.serverResolutions,a):this.map.getZoomForResolution(a)+(this.zoomOffset||0)},applyBackBuffer:function(a){null!==this.backBufferTimerId&&this.removeBackBuffer();var b=this.backBuffer;if(!b){b= +this.createBackBuffer();if(!b)return;a===this.gridResolution?this.div.insertBefore(b,this.div.firstChild):this.map.baseLayer.div.parentNode.insertBefore(b,this.map.baseLayer.div);this.backBuffer=b;var c=this.grid[0][0].bounds;this.backBufferLonLat={lon:c.left,lat:c.top};this.backBufferResolution=this.gridResolution}for(var c=this.backBufferResolution/a,d=b.childNodes,e,f=d.length-1;0<=f;--f)e=d[f],e.style.top=(c*e._i*e._h|0)+"px",e.style.left=(c*e._j*e._w|0)+"px",e.style.width=Math.round(c*e._w)+ +"px",e.style.height=Math.round(c*e._h)+"px";a=this.getViewPortPxFromLonLat(this.backBufferLonLat,a);c=this.map.layerContainerOriginPx.y;b.style.left=Math.round(a.x-this.map.layerContainerOriginPx.x)+"px";b.style.top=Math.round(a.y-c)+"px"},createBackBuffer:function(){var a;if(0=a.bottom-h*this.buffer||n-d.w*(a-1))this.shiftColumn(!0,d);else if(c<-d.w*a)this.shiftColumn(!1,d);else if(b>-d.h*(a-1))this.shiftRow(!0,d);else if(b<-d.h*a)this.shiftRow(!1,d);else break}},shiftRow:function(a,b){var c=this.grid,d=a?0:c.length-1,e=a?-1:1;this.gridLayout.startrow+=e*this.rowSign;for(var f=c[d],g=c[a?"pop":"shift"](),h=0,k=g.length;ha;){var e=this.grid.pop();c=0;for(d=e.length;c +b;)e=this.grid[c],f=e.pop(),this.destroyTile(f)},onMapResize:function(){this.singleTile&&(this.clearGrid(),this.setTileSize())},getTileBounds:function(a){var b=this.maxExtent,c=this.getResolution(),d=c*this.tileSize.w,c=c*this.tileSize.h,e=this.getLonLatFromViewPortPx(a);a=b.left+d*Math.floor((e.lon-b.left)/d);b=b.bottom+c*Math.floor((e.lat-b.bottom)/c);return new OpenLayers.Bounds(a,b,a+d,b+c)},CLASS_NAME:"OpenLayers.Layer.Grid"});OpenLayers.Format.ArcXML=OpenLayers.Class(OpenLayers.Format.XML,{fontStyleKeys:"antialiasing blockout font fontcolor fontsize fontstyle glowing interval outline printmode shadow transparency".split(" "),request:null,response:null,initialize:function(a){this.request=new OpenLayers.Format.ArcXML.Request;this.response=new OpenLayers.Format.ArcXML.Response;if(a)if("feature"==a.requesttype){this.request.get_image=null;var b=this.request.get_feature.query;this.addCoordSys(b.featurecoordsys,a.featureCoordSys); +this.addCoordSys(b.filtercoordsys,a.filterCoordSys);a.polygon?(b.isspatial=!0,b.spatialfilter.polygon=a.polygon):a.envelope&&(b.isspatial=!0,b.spatialfilter.envelope={minx:0,miny:0,maxx:0,maxy:0},this.parseEnvelope(b.spatialfilter.envelope,a.envelope))}else"image"==a.requesttype?(this.request.get_feature=null,b=this.request.get_image.properties,this.parseEnvelope(b.envelope,a.envelope),this.addLayers(b.layerlist,a.layers),this.addImageSize(b.imagesize,a.tileSize),this.addCoordSys(b.featurecoordsys, +a.featureCoordSys),this.addCoordSys(b.filtercoordsys,a.filterCoordSys)):this.request=null;OpenLayers.Format.XML.prototype.initialize.apply(this,[a])},parseEnvelope:function(a,b){b&&4==b.length&&(a.minx=b[0],a.miny=b[1],a.maxx=b[2],a.maxy=b[3])},addLayers:function(a,b){for(var c=0,d=b.length;cg.where.length)continue;var h=null,h="boolean"==typeof g.spatialfilter&&g.spatialfilter?this.createElementNS("","SPATIALQUERY"):this.createElementNS("","QUERY");h.setAttribute("where",g.where);"number"==typeof g.accuracy&&0g.featurelimit&&h.setAttribute("featurelimit", +g.featurelimit);"string"==typeof g.subfields&&"#ALL#"!=g.subfields&&h.setAttribute("subfields",g.subfields);"string"==typeof g.joinexpression&&0arguments.length&&(k=!0);this._async=k;var r=this, +s=this.readyState,t;h&&k&&(t=function(){s!=b.DONE&&(e(r),r.abort())},window.attachEvent("onunload",t));b.onopen&&b.onopen.apply(this,arguments);4b.UNSENT&&(this._aborted=!0);this._object.abort();e(this);this.readyState=b.UNSENT;delete this._data};b.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders()};b.prototype.getResponseHeader=function(a){return this._object.getResponseHeader(a)};b.prototype.setRequestHeader=function(a,b){this._headers||(this._headers={});this._headers[a]=b;return this._object.setRequestHeader(a,b)}; +b.prototype.addEventListener=function(a,b,c){for(var d=0,e;e=this._listeners[d];d++)if(e[0]==a&&e[1]==b&&e[2]==c)return;this._listeners.push([a,b,c])};b.prototype.removeEventListener=function(a,b,c){for(var d=0,e;(e=this._listeners[d])&&(e[0]!=a||e[1]!=b||e[2]!=c);d++);e&&this._listeners.splice(d,1)};b.prototype.dispatchEvent=function(a){a={type:a.type,target:this,currentTarget:this,eventPhase:2,bubbles:a.bubbles,cancelable:a.cancelable,timeStamp:a.timeStamp,stopPropagation:function(){},preventDefault:function(){}, +initEvent:function(){}};"readystatechange"==a.type&&this.onreadystatechange&&(this.onreadystatechange.handleEvent||this.onreadystatechange).apply(this,[a]);for(var b=0,c;c=this._listeners[b];b++)c[0]!=a.type||c[2]||(c[1].handleEvent||c[1]).apply(this,[a])};b.prototype.toString=function(){return"[object XMLHttpRequest]"};b.toString=function(){return"[XMLHttpRequest]"};window.Function.prototype.apply||(window.Function.prototype.apply=function(a,b){b||(b=[]);a.__func=this;a.__func(b[0],b[1],b[2],b[3], +b[4]);delete a.__func});OpenLayers.Request||(OpenLayers.Request={});OpenLayers.Request.XMLHttpRequest=b})();OpenLayers.ProxyHost="";OpenLayers.Request||(OpenLayers.Request={}); +OpenLayers.Util.extend(OpenLayers.Request,{DEFAULT_CONFIG:{method:"GET",url:window.location.href,async:!0,user:void 0,password:void 0,params:null,proxy:OpenLayers.ProxyHost,headers:{},data:null,callback:function(){},success:null,failure:null,scope:null},URL_SPLIT_REGEX:/([^:]*:)\/\/([^:]*:?[^@]*@)?([^:\/\?]*):?([^\/\?]*)/,events:new OpenLayers.Events(this),makeSameOrigin:function(a,b){var c=0!==a.indexOf("http"),d=!c&&a.match(this.URL_SPLIT_REGEX);if(d){var e=window.location,c=d[1]==e.protocol&&d[3]== +e.hostname,d=d[4],e=e.port;if(80!=d&&""!=d||"80"!=e&&""!=e)c=c&&d==e}c||b&&(a="function"==typeof b?b(a):b+encodeURIComponent(a));return a},issue:function(a){var b=OpenLayers.Util.extend(this.DEFAULT_CONFIG,{proxy:OpenLayers.ProxyHost});a=a||{};a.headers=a.headers||{};a=OpenLayers.Util.applyDefaults(a,b);a.headers=OpenLayers.Util.applyDefaults(a.headers,b.headers);var b=!1,c;for(c in a.headers)a.headers.hasOwnProperty(c)&&"x-requested-with"===c.toLowerCase()&&(b=!0);!1===b&&(a.headers["X-Requested-With"]= +"XMLHttpRequest");var d=new OpenLayers.Request.XMLHttpRequest,e=OpenLayers.Util.urlAppend(a.url,OpenLayers.Util.getParameterString(a.params||{})),e=OpenLayers.Request.makeSameOrigin(e,a.proxy);d.open(a.method,e,a.async,a.user,a.password);for(var f in a.headers)d.setRequestHeader(f,a.headers[f]);var g=this.events,h=this;d.onreadystatechange=function(){d.readyState==OpenLayers.Request.XMLHttpRequest.DONE&&!1!==g.triggerEvent("complete",{request:d,config:a,requestUrl:e})&&h.runCallbacks({request:d,config:a, +requestUrl:e})};!1===a.async?d.send(a.data):window.setTimeout(function(){0!==d.readyState&&d.send(a.data)},0);return d},runCallbacks:function(a){var b=a.request,c=a.config,d=c.scope?OpenLayers.Function.bind(c.callback,c.scope):c.callback,e;c.success&&(e=c.scope?OpenLayers.Function.bind(c.success,c.scope):c.success);var f;c.failure&&(f=c.scope?OpenLayers.Function.bind(c.failure,c.scope):c.failure);"file:"==OpenLayers.Util.createUrlObject(c.url).protocol&&b.responseText&&(b.status=200);d(b);if(!b.status|| +200<=b.status&&300>b.status)this.events.triggerEvent("success",a),e&&e(b);b.status&&(200>b.status||300<=b.status)&&(this.events.triggerEvent("failure",a),f&&f(b))},GET:function(a){a=OpenLayers.Util.extend(a,{method:"GET"});return OpenLayers.Request.issue(a)},POST:function(a){a=OpenLayers.Util.extend(a,{method:"POST"});a.headers=a.headers?a.headers:{};"CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(a.headers)||(a.headers["Content-Type"]="application/xml");return OpenLayers.Request.issue(a)},PUT:function(a){a= +OpenLayers.Util.extend(a,{method:"PUT"});a.headers=a.headers?a.headers:{};"CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(a.headers)||(a.headers["Content-Type"]="application/xml");return OpenLayers.Request.issue(a)},DELETE:function(a){a=OpenLayers.Util.extend(a,{method:"DELETE"});return OpenLayers.Request.issue(a)},HEAD:function(a){a=OpenLayers.Util.extend(a,{method:"HEAD"});return OpenLayers.Request.issue(a)},OPTIONS:function(a){a=OpenLayers.Util.extend(a,{method:"OPTIONS"});return OpenLayers.Request.issue(a)}});OpenLayers.Layer.ArcIMS=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{ClientVersion:"9.2",ServiceName:""},featureCoordSys:"4326",filterCoordSys:"4326",layers:null,async:!0,name:"ArcIMS",isBaseLayer:!0,DEFAULT_OPTIONS:{tileSize:new OpenLayers.Size(512,512),featureCoordSys:"4326",filterCoordSys:"4326",layers:null,isBaseLayer:!0,async:!0,name:"ArcIMS"},initialize:function(a,b,c){this.tileSize=new OpenLayers.Size(512,512);this.params=OpenLayers.Util.applyDefaults({ServiceName:c.serviceName}, +this.DEFAULT_PARAMS);this.options=OpenLayers.Util.applyDefaults(c,this.DEFAULT_OPTIONS);OpenLayers.Layer.Grid.prototype.initialize.apply(this,[a,b,this.params,c]);this.transparent&&(this.isBaseLayer||(this.isBaseLayer=!1),"image/jpeg"==this.format&&(this.format=OpenLayers.Util.alphaHack()?"image/gif":"image/png"));null===this.options.layers&&(this.options.layers=[])},getURL:function(a){var b="";a=this.adjustBounds(a);a=new OpenLayers.Format.ArcXML(OpenLayers.Util.extend(this.options,{requesttype:"image", +envelope:a.toArray(),tileSize:this.tileSize}));a=new OpenLayers.Request.POST({url:this.getFullRequestString(),data:a.write(),async:!1});null!=a&&(b=a.responseXML,b&&b.documentElement||(b=a.responseText),b=(new OpenLayers.Format.ArcXML).read(b),b=this.getUrlOrImage(b.image.output));return b},getURLasync:function(a,b,c){a=this.adjustBounds(a);a=new OpenLayers.Format.ArcXML(OpenLayers.Util.extend(this.options,{requesttype:"image",envelope:a.toArray(),tileSize:this.tileSize}));OpenLayers.Request.POST({url:this.getFullRequestString(), +async:!0,data:a.write(),callback:function(a){var e=a.responseXML;e&&e.documentElement||(e=a.responseText);a=(new OpenLayers.Format.ArcXML).read(e);b.call(c,this.getUrlOrImage(a.image.output))},scope:this})},getUrlOrImage:function(a){var b="";a.url?b=a.url:a.data&&(b="data:image/"+a.type+";base64,"+a.data);return b},setLayerQuery:function(a,b){for(var c=0;cOpenStreetMap contributors",sphericalMercator:!0,wrapDateLine:!0,tileOptions:null,initialize:function(a,b,c){OpenLayers.Layer.XYZ.prototype.initialize.apply(this,arguments);this.tileOptions= +OpenLayers.Util.extend({crossOriginKeyword:"anonymous"},this.options&&this.options.tileOptions)},clone:function(a){null==a&&(a=new OpenLayers.Layer.OSM(this.name,this.url,this.getOptions()));return a=OpenLayers.Layer.XYZ.prototype.clone.apply(this,[a])},CLASS_NAME:"OpenLayers.Layer.OSM"});OpenLayers.Renderer=OpenLayers.Class({container:null,root:null,extent:null,locked:!1,size:null,resolution:null,map:null,featureDx:0,initialize:function(a,b){this.container=OpenLayers.Util.getElement(a);OpenLayers.Util.extend(this,b)},destroy:function(){this.map=this.resolution=this.size=this.extent=this.container=null},supported:function(){return!1},setExtent:function(a,b){this.extent=a.clone();if(this.map.baseLayer&&this.map.baseLayer.wrapDateLine){var c=a.getWidth()/this.map.getExtent().getWidth(); +a=a.scale(1/c);this.extent=a.wrapDateLine(this.map.getMaxExtent()).scale(c)}b&&(this.resolution=null);return!0},setSize:function(a){this.size=a.clone();this.resolution=null},getResolution:function(){return this.resolution=this.resolution||this.map.getResolution()},drawFeature:function(a,b){null==b&&(b=a.style);if(a.geometry){var c=a.geometry.getBounds();if(c){var d;this.map.baseLayer&&this.map.baseLayer.wrapDateLine&&(d=this.map.getMaxExtent());c.intersectsBounds(this.extent,{worldBounds:d})?this.calculateFeatureDx(c, +d):b={display:"none"};c=this.drawGeometry(a.geometry,b,a.id);if("none"!=b.display&&b.label&&!1!==c){d=a.geometry.getCentroid();if(b.labelXOffset||b.labelYOffset){var e=isNaN(b.labelXOffset)?0:b.labelXOffset,f=isNaN(b.labelYOffset)?0:b.labelYOffset,g=this.getResolution();d.move(e*g,f*g)}this.drawText(a.id,b,d)}else this.removeText(a.id);return c}}},calculateFeatureDx:function(a,b){this.featureDx=0;if(b){var c=b.getWidth();this.featureDx=Math.round(((a.left+a.right)/2-(this.extent.left+this.extent.right)/ +2)/c)*c}},drawGeometry:function(a,b,c){},drawText:function(a,b,c){},removeText:function(a){},clear:function(){},getFeatureIdFromEvent:function(a){},eraseFeatures:function(a){OpenLayers.Util.isArray(a)||(a=[a]);for(var b=0,c=a.length;bh.length||(a=this.getLocalXY(a),e=a[0],g=a[1],isNaN(e)||isNaN(g)))){this.canvas.lineCap="round";this.canvas.lineJoin="round";this.hitDetection&&(this.hitContext.lineCap="round",this.hitContext.lineJoin="round");if(b.graphicName in this.cachedSymbolBounds)d=this.cachedSymbolBounds[b.graphicName];else{d=new OpenLayers.Bounds;for(a=0;a=this.map.Z_INDEX_BASE.Feature?this.layer.setZIndex(a):this.map.setLayerZIndex(this.layer,this.map.getLayerIndex(this.layer))},CLASS_NAME:"OpenLayers.Control.ModifyFeature"}); +OpenLayers.Control.ModifyFeature.RESHAPE=1;OpenLayers.Control.ModifyFeature.RESIZE=2;OpenLayers.Control.ModifyFeature.ROTATE=4;OpenLayers.Control.ModifyFeature.DRAG=8;OpenLayers.Layer.Bing=OpenLayers.Class(OpenLayers.Layer.XYZ,{key:null,serverResolutions:[156543.03390625,78271.516953125,39135.7584765625,19567.87923828125,9783.939619140625,4891.9698095703125,2445.9849047851562,1222.9924523925781,611.4962261962891,305.74811309814453,152.87405654907226,76.43702827453613,38.218514137268066,19.109257068634033,9.554628534317017,4.777314267158508,2.388657133579254,1.194328566789627,0.5971642833948135,0.29858214169740677,0.14929107084870338,0.07464553542435169],attributionTemplate:'
    ${copyrights}Terms of Use
    ', +metadata:null,protocolRegex:/^http:/i,type:"Road",culture:"en-US",metadataParams:null,tileOptions:null,protocol:~window.location.href.indexOf("http")?"":"http:",initialize:function(a){a=OpenLayers.Util.applyDefaults({sphericalMercator:!0},a);OpenLayers.Layer.XYZ.prototype.initialize.apply(this,[a.name||"Bing "+(a.type||this.type),null,a]);this.tileOptions=OpenLayers.Util.extend({crossOriginKeyword:"anonymous"},this.options.tileOptions);this.loadMetadata()},loadMetadata:function(){this._callbackId= +"_callback_"+this.id.replace(/\./g,"_");window[this._callbackId]=OpenLayers.Function.bind(OpenLayers.Layer.Bing.processMetadata,this);var a=OpenLayers.Util.applyDefaults({key:this.key,jsonp:this._callbackId,include:"ImageryProviders"},this.metadataParams),a=this.protocol+"//dev.virtualearth.net/REST/v1/Imagery/Metadata/"+this.type+"?"+OpenLayers.Util.getParameterString(a),b=document.createElement("script");b.type="text/javascript";b.src=a;b.id=this._callbackId;document.getElementsByTagName("head")[0].appendChild(b)}, +initLayer:function(){var a=this.metadata.resourceSets[0].resources[0],b=a.imageUrl.replace("{quadkey}","${quadkey}"),b=b.replace("{culture}",this.culture),b=b.replace(this.protocolRegex,this.protocol);this.url=[];for(var c=0;c=n.zoomMin)&&(b+=f.attribution+" ");a=a.brandLogoUri.replace(this.protocolRegex,this.protocol);this.attribution=OpenLayers.String.format(this.attributionTemplate,{type:this.type.toLowerCase(), +logo:a,copyrights:b});this.map&&this.map.events.triggerEvent("changelayer",{layer:this,property:"attribution"})}},setMap:function(){OpenLayers.Layer.XYZ.prototype.setMap.apply(this,arguments);this.map.events.register("moveend",this,this.updateAttribution)},clone:function(a){null==a&&(a=new OpenLayers.Layer.Bing(this.options));return a=OpenLayers.Layer.XYZ.prototype.clone.apply(this,[a])},destroy:function(){this.map&&this.map.events.unregister("moveend",this,this.updateAttribution);OpenLayers.Layer.XYZ.prototype.destroy.apply(this, +arguments)},CLASS_NAME:"OpenLayers.Layer.Bing"});OpenLayers.Layer.Bing.processMetadata=function(a){this.metadata=a;this.initLayer();a=document.getElementById(this._callbackId);a.parentNode.removeChild(a);window[this._callbackId]=void 0;delete this._callbackId};OpenLayers.StyleMap=OpenLayers.Class({styles:null,extendDefault:!0,initialize:function(a,b){this.styles={"default":new OpenLayers.Style(OpenLayers.Feature.Vector.style["default"]),select:new OpenLayers.Style(OpenLayers.Feature.Vector.style.select),temporary:new OpenLayers.Style(OpenLayers.Feature.Vector.style.temporary),"delete":new OpenLayers.Style(OpenLayers.Feature.Vector.style["delete"])};if(a instanceof OpenLayers.Style)this.styles["default"]=a,this.styles.select=a,this.styles.temporary=a,this.styles["delete"]= +a;else if("object"==typeof a)for(var c in a)if(a[c]instanceof OpenLayers.Style)this.styles[c]=a[c];else if("object"==typeof a[c])this.styles[c]=new OpenLayers.Style(a[c]);else{this.styles["default"]=new OpenLayers.Style(a);this.styles.select=new OpenLayers.Style(a);this.styles.temporary=new OpenLayers.Style(a);this.styles["delete"]=new OpenLayers.Style(a);break}OpenLayers.Util.extend(this,b)},destroy:function(){for(var a in this.styles)this.styles[a].destroy();this.styles=null},createSymbolizer:function(a, +b){a||(a=new OpenLayers.Feature.Vector);this.styles[b]||(b="default");a.renderIntent=b;var c={};this.extendDefault&&"default"!=b&&(c=this.styles["default"].createSymbolizer(a));return OpenLayers.Util.extend(c,this.styles[b].createSymbolizer(a))},addUniqueValueRules:function(a,b,c,d){var e=[],f;for(f in c)e.push(new OpenLayers.Rule({symbolizer:c[f],context:d,filter:new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO,property:b,value:f})}));this.styles[a].addRules(e)},CLASS_NAME:"OpenLayers.StyleMap"});OpenLayers.Layer.Vector=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:!1,isFixed:!1,features:null,filter:null,selectedFeatures:null,unrenderedFeatures:null,reportError:!0,style:null,styleMap:null,strategies:null,protocol:null,renderers:["SVG","VML","Canvas"],renderer:null,rendererOptions:null,geometryType:null,drawn:!1,ratio:1,initialize:function(a,b){OpenLayers.Layer.prototype.initialize.apply(this,arguments);this.renderer&&this.renderer.supported()||this.assignRenderer();this.renderer&&this.renderer.supported()|| +(this.renderer=null,this.displayError());this.styleMap||(this.styleMap=new OpenLayers.StyleMap);this.features=[];this.selectedFeatures=[];this.unrenderedFeatures={};if(this.strategies)for(var c=0,d=this.strategies.length;cb?this.callback("down",[a,this.cumulative?Math.max(-this.maxDelta, +b):-1]):this.callback("up",[a,this.cumulative?Math.min(this.maxDelta,b):1]))},activate:function(a){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var b=this.wheelListener;OpenLayers.Event.observe(window,"DOMMouseScroll",b);OpenLayers.Event.observe(window,"mousewheel",b);OpenLayers.Event.observe(document,"mousewheel",b);return!0}return!1},deactivate:function(a){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){var b=this.wheelListener;OpenLayers.Event.stopObserving(window, +"DOMMouseScroll",b);OpenLayers.Event.stopObserving(window,"mousewheel",b);OpenLayers.Event.stopObserving(document,"mousewheel",b);return!0}return!1},CLASS_NAME:"OpenLayers.Handler.MouseWheel"});OpenLayers.Symbolizer=OpenLayers.Class({zIndex:0,initialize:function(a){OpenLayers.Util.extend(this,a)},clone:function(){return new (eval(this.CLASS_NAME))(OpenLayers.Util.extend({},this))},CLASS_NAME:"OpenLayers.Symbolizer"});OpenLayers.Symbolizer.Raster=OpenLayers.Class(OpenLayers.Symbolizer,{initialize:function(a){OpenLayers.Symbolizer.prototype.initialize.apply(this,arguments)},CLASS_NAME:"OpenLayers.Symbolizer.Raster"});OpenLayers.Rule=OpenLayers.Class({id:null,name:null,title:null,description:null,context:null,filter:null,elseFilter:!1,symbolizer:null,symbolizers:null,minScaleDenominator:null,maxScaleDenominator:null,initialize:function(a){this.symbolizer={};OpenLayers.Util.extend(this,a);this.symbolizers&&delete this.symbolizer;this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){for(var a in this.symbolizer)this.symbolizer[a]=null;this.symbolizer=null;delete this.symbolizers},evaluate:function(a){var b= +this.getContext(a),c=!0;if(this.minScaleDenominator||this.maxScaleDenominator)var d=a.layer.map.getScale();this.minScaleDenominator&&(c=d>=OpenLayers.Style.createLiteral(this.minScaleDenominator,b));c&&this.maxScaleDenominator&&(c=dthis.maxZIndex&&(this.maxZIndex=b)},getNextElement:function(a){a+=1;if(aa.left&&f.righta.left&&f.lefta.length)throw Error("At least two point features have to be added to create a line from");for(var c=Array(a.length-1),d,e,f,g=0,h=a.length;gthis.opacity&&a.setOpacity(this.opacity);this.map&&this.map.getExtent()&&(a.map=this.map,this.drawMarker(a))},removeMarker:function(a){this.markers&&this.markers.length&&(OpenLayers.Util.removeItem(this.markers,a),a.erase())},clearMarkers:function(){if(null!=this.markers)for(;0=a.maxResolution)return null;for(var c= +{node:this.getGeoTolerance(a.nodeTolerance,c),vertex:this.getGeoTolerance(a.vertexTolerance,c),edge:this.getGeoTolerance(a.edgeTolerance,c)},d=Math.max(c.node,c.vertex,c.edge),e={rank:Number.POSITIVE_INFINITY,dist:Number.POSITIVE_INFINITY},f=!1,g=a.layer.features,h,k,l,m,n,p,q=this.precedence.length,r=new OpenLayers.LonLat(b.x,b.y),s=0,t=g.length;s=this.maxDepth)return!1;var c=OpenLayers.Util.extend({},b);c.depth++;for(var d=0,e=a.length;d=e.length)){switch(e.length){case 1:f=e[0];break;case 2:f=e[0];e=e[1];f=3==f.nodeType||4==f.nodeType?f:e;break;default:f=e[1]}if(3==f.nodeType||4==f.nodeType)if(d=d.prefix?d.nodeName.split(":")[1]:d.nodeName,f=OpenLayers.Util.getXmlNodeValue(f))f=f.replace(this.regExes.trimSpace,""),b[d]=f}return b},parseExtendedData:function(a){var b={},c,d,e,f,g=a.getElementsByTagName("Data");c=0;for(d=g.length;cc.status?(c=this.parseResponse(c,b.readOptions))&&!1!==c.success?(b.readOptions&&"object"==b.readOptions.output?OpenLayers.Util.extend(a,c):a.features=c,a.code=OpenLayers.Protocol.Response.SUCCESS):(a.code=OpenLayers.Protocol.Response.FAILURE,a.error=c):a.code=OpenLayers.Protocol.Response.FAILURE;b.callback.call(b.scope,a)}},parseResponse:function(a,b){var c=a.responseXML;c&&c.documentElement||(c=a.responseText);if(!c||0>=c.length)return null;c=null!==this.readFormat?this.readFormat.read(c): +this.format.read(c,b);if(!this.featureNS){var d=this.readFormat||this.format;this.featureNS=d.featureNS;d.autoConfig=!1;this.geometryName||this.setGeometryName(d.geometryName)}return c},commit:function(a,b){b=OpenLayers.Util.extend({},b);OpenLayers.Util.applyDefaults(b,this.options);var c=new OpenLayers.Protocol.Response({requestType:"commit",reqFeatures:a});c.priv=OpenLayers.Request.POST({url:b.url,headers:b.headers,data:this.format.write(a,b),callback:this.createCallback(this.handleCommit,c,b)}); +return c},handleCommit:function(a,b){if(b.callback){var c=a.priv,d=c.responseXML;d&&d.documentElement||(d=c.responseText);c=this.format.read(d)||{};a.insertIds=c.insertIds||[];c.success?a.code=OpenLayers.Protocol.Response.SUCCESS:(a.code=OpenLayers.Protocol.Response.FAILURE,a.error=c);b.callback.call(b.scope,a)}},filterDelete:function(a,b){b=OpenLayers.Util.extend({},b);OpenLayers.Util.applyDefaults(b,this.options);new OpenLayers.Protocol.Response({requestType:"commit"});var c=this.format.createElementNSPlus("wfs:Transaction", +{attributes:{service:"WFS",version:this.version}}),d=this.format.createElementNSPlus("wfs:Delete",{attributes:{typeName:(b.featureNS?this.featurePrefix+":":"")+b.featureType}});b.featureNS&&d.setAttribute("xmlns:"+this.featurePrefix,b.featureNS);var e=this.format.writeNode("ogc:Filter",a);d.appendChild(e);c.appendChild(d);c=OpenLayers.Format.XML.prototype.write.apply(this.format,[c]);return OpenLayers.Request.POST({url:this.url,callback:b.callback||function(){},data:c})},abort:function(a){a&&a.priv.abort()}, +CLASS_NAME:"OpenLayers.Protocol.WFS.v1"});OpenLayers.Handler.Feature=OpenLayers.Class(OpenLayers.Handler,{EVENTMAP:{click:{"in":"click",out:"clickout"},mousemove:{"in":"over",out:"out"},dblclick:{"in":"dblclick",out:null},mousedown:{"in":null,out:null},mouseup:{"in":null,out:null},touchstart:{"in":"click",out:"clickout"}},feature:null,lastFeature:null,down:null,up:null,clickTolerance:4,geometryTypes:null,stopClick:!0,stopDown:!0,stopUp:!1,initialize:function(a,b,c,d){OpenLayers.Handler.prototype.initialize.apply(this,[a,c,d]);this.layer= +b},touchstart:function(a){this.startTouch();return OpenLayers.Event.isMultiTouch(a)?!0:this.mousedown(a)},touchmove:function(a){OpenLayers.Event.preventDefault(a)},mousedown:function(a){if(OpenLayers.Event.isLeftClick(a)||OpenLayers.Event.isSingleTouch(a))this.down=a.xy;return this.handle(a)?!this.stopDown:!0},mouseup:function(a){this.up=a.xy;return this.handle(a)?!this.stopUp:!0},click:function(a){return this.handle(a)?!this.stopClick:!0},mousemove:function(a){if(!this.callbacks.over&&!this.callbacks.out)return!0; +this.handle(a);return!0},dblclick:function(a){return!this.handle(a)},geometryTypeMatches:function(a){return null==this.geometryTypes||-1=this.map.Z_INDEX_BASE.Feature?this.layer.setZIndex(a):this.map.setLayerZIndex(this.layer,this.map.getLayerIndex(this.layer))},CLASS_NAME:"OpenLayers.Handler.Feature"});OpenLayers.Layer.Vector.RootContainer=OpenLayers.Class(OpenLayers.Layer.Vector,{displayInLayerSwitcher:!1,layers:null,display:function(){},getFeatureFromEvent:function(a){for(var b=this.layers,c,d=0;df;)d=c.selectedFeatures[f],a&&a.except==d?++f:this.unselect(d)},clickFeature:function(a){this.hover||(-1c&&(d=!1);return d},CLASS_NAME:"OpenLayers.Handler.Point"});OpenLayers.Handler.Path=OpenLayers.Class(OpenLayers.Handler.Point,{line:null,maxVertices:null,doubleTouchTolerance:20,freehand:!1,freehandToggle:"shiftKey",timerId:null,redoStack:null,createFeature:function(a){a=this.layer.getLonLatFromViewPortPx(a);a=new OpenLayers.Geometry.Point(a.lon,a.lat);this.point=new OpenLayers.Feature.Vector(a);this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString([this.point.geometry]));this.callback("create",[this.point.geometry,this.getSketch()]); +this.point.geometry.clearBounds();this.layer.addFeatures([this.line,this.point],{silent:!0})},destroyFeature:function(a){OpenLayers.Handler.Point.prototype.destroyFeature.call(this,a);this.line=null},destroyPersistedFeature:function(){var a=this.layer;a&&2this.nbPoints&&this.points.pop()},end:function(a){for(var b,c=(new Date).getTime(),d=0,e=this.points.length,f;dthis.delay)break;b=f}if(b&&(d=(new Date).getTime()-b.tick,c=Math.sqrt(Math.pow(a.x-b.xy.x,2)+Math.pow(a.y-b.xy.y,2)),d=c/d,!(0==d||d=-this.deceleration*a+c&&(OpenLayers.Animation.stop(this.timerId),this.timerId=null,n=!0);a=m-g;p=l-h;g=m;h=l;b(a,p,n)}},this))},CLASS_NAME:"OpenLayers.Kinetic"});OpenLayers.Format.WPSExecute=OpenLayers.Class(OpenLayers.Format.XML,OpenLayers.Format.Filter.v1_1_0,{namespaces:{ows:"http://www.opengis.net/ows/1.1",gml:"http://www.opengis.net/gml",wps:"http://www.opengis.net/wps/1.0.0",wfs:"http://www.opengis.net/wfs",ogc:"http://www.opengis.net/ogc",wcs:"http://www.opengis.net/wcs",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},regExes:{trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g},VERSION:"1.0.0", +schemaLocation:"http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd",schemaLocationAttr:function(a){},write:function(a){var b;window.ActiveXObject?this.xmldom=b=new ActiveXObject("Microsoft.XMLDOM"):b=document.implementation.createDocument("","",null);a=this.writeNode("wps:Execute",a,b);this.setAttributeNS(a,this.namespaces.xsi,"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[a])},read:function(a){"string"==typeof a&&(a= +OpenLayers.Format.XML.prototype.read.apply(this,[a]));a&&9==a.nodeType&&(a=a.documentElement);var b={};this.readNode(a,b);return b},writers:{wps:{Execute:function(a){var b=this.createElementNSPlus("wps:Execute",{attributes:{version:this.VERSION,service:"WPS"}});this.writeNode("ows:Identifier",a.identifier,b);this.writeNode("wps:DataInputs",a.dataInputs,b);this.writeNode("wps:ResponseForm",a.responseForm,b);return b},ResponseForm:function(a){var b=this.createElementNSPlus("wps:ResponseForm",{});a.rawDataOutput&& +this.writeNode("wps:RawDataOutput",a.rawDataOutput,b);a.responseDocument&&this.writeNode("wps:ResponseDocument",a.responseDocument,b);return b},ResponseDocument:function(a){var b=this.createElementNSPlus("wps:ResponseDocument",{attributes:{storeExecuteResponse:a.storeExecuteResponse,lineage:a.lineage,status:a.status}});if(a.outputs)for(var c=0,d=a.outputs.length;c';k&&(l+='');l+=g;k&&(l+="");l+="";l+='
    ';l+=h;l+="
    ";e.popupContentHTML=l}f=new OpenLayers.Feature(this,f,e);this.features.push(f); +e=f.createMarker();e.events.register("click",f,this.markerClick);this.addMarker(e)}}this.events.triggerEvent("loadend")},markerClick:function(a){var b=this==this.layer.selectedFeature;this.layer.selectedFeature=b?null:this;for(var c=0,d=this.layer.map.popups.length;c1/3&&e<2/3?d="c":e>=2/3&&(d="r");f<=1/3?d+="b":f>1/3&&f<2/3?d+="m":f>=2/3&&(d+="t");c.labelAlign=d;OpenLayers.Util.applyDefaults(b,c)},AnchorPoint:function(a,b){this.readChildNodes(a,b)},AnchorPointX:function(a,b){var c=this.readers.ogc._expression.call(this,a);c&&(b.labelAnchorPointX=c)},AnchorPointY:function(a,b){var c=this.readers.ogc._expression.call(this,a);c&&(b.labelAnchorPointY=c)},Displacement:function(a, +b){this.readChildNodes(a,b)},DisplacementX:function(a,b){var c=this.readers.ogc._expression.call(this,a);c&&(b.labelXOffset=c)},DisplacementY:function(a,b){var c=this.readers.ogc._expression.call(this,a);c&&(b.labelYOffset=c)},LinePlacement:function(a,b){this.readChildNodes(a,b)},PerpendicularOffset:function(a,b){var c=this.readers.ogc._expression.call(this,a);c&&(b.labelPerpendicularOffset=c)},Label:function(a,b){var c=this.readers.ogc._expression.call(this,a);c&&(b.label=c)},Font:function(a,b){this.readChildNodes(a, +b)},Halo:function(a,b){var c={};this.readChildNodes(a,c);b.haloRadius=c.haloRadius;b.haloColor=c.fillColor;b.haloOpacity=c.fillOpacity},Radius:function(a,b){var c=this.readers.ogc._expression.call(this,a);null!=c&&(b.haloRadius=c)},RasterSymbolizer:function(a,b){var c={};this.readChildNodes(a,c);this.multipleSymbolizers?(c.zIndex=this.featureTypeCounter,b.symbolizers.push(new OpenLayers.Symbolizer.Raster(c))):b.symbolizer.Raster=OpenLayers.Util.applyDefaults(c,b.symbolizer.Raster)},Geometry:function(a, +b){b.geometry={};this.readChildNodes(a,b.geometry)},ColorMap:function(a,b){b.colorMap=[];this.readChildNodes(a,b.colorMap)},ColorMapEntry:function(a,b){var c=a.getAttribute("quantity"),d=a.getAttribute("opacity");b.push({color:a.getAttribute("color"),quantity:null!==c?parseFloat(c):void 0,label:a.getAttribute("label")||void 0,opacity:null!==d?parseFloat(d):void 0})},LineSymbolizer:function(a,b){var c={};this.readChildNodes(a,c);this.multipleSymbolizers?(c.zIndex=this.featureTypeCounter,b.symbolizers.push(new OpenLayers.Symbolizer.Line(c))): +b.symbolizer.Line=OpenLayers.Util.applyDefaults(c,b.symbolizer.Line)},PolygonSymbolizer:function(a,b){var c={fill:!1,stroke:!1};this.multipleSymbolizers||(c=b.symbolizer.Polygon||c);this.readChildNodes(a,c);this.multipleSymbolizers?(c.zIndex=this.featureTypeCounter,b.symbolizers.push(new OpenLayers.Symbolizer.Polygon(c))):b.symbolizer.Polygon=c},PointSymbolizer:function(a,b){var c={fill:!1,stroke:!1,graphic:!1};this.multipleSymbolizers||(c=b.symbolizer.Point||c);this.readChildNodes(a,c);this.multipleSymbolizers? +(c.zIndex=this.featureTypeCounter,b.symbolizers.push(new OpenLayers.Symbolizer.Point(c))):b.symbolizer.Point=c},Stroke:function(a,b){b.stroke=!0;this.readChildNodes(a,b)},Fill:function(a,b){b.fill=!0;this.readChildNodes(a,b)},CssParameter:function(a,b){var c=a.getAttribute("name"),d=this.cssMap[c];b.label&&("fill"===c?d="fontColor":"fill-opacity"===c&&(d="fontOpacity"));d&&(c=this.readers.ogc._expression.call(this,a))&&(b[d]=c)},Graphic:function(a,b){b.graphic=!0;var c={};this.readChildNodes(a,c); +for(var d="stroke strokeColor strokeWidth strokeOpacity strokeLinecap fill fillColor fillOpacity graphicName rotation graphicFormat".split(" "),e,f,g=0,h=d.length;g=-this.MAX_PIXEL&&a<=this.MAX_PIXEL&&b>=-this.MAX_PIXEL&&b<=this.MAX_PIXEL},setExtent:function(a,b){var c=OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments),d=this.getResolution(),e=-a.left/d,d=a.top/d;if(b)return this.left=e,this.top=d,this.rendererRoot.setAttributeNS(null, +"viewBox","0 0 "+this.size.w+" "+this.size.h),this.translate(this.xOffset,0),!0;(e=this.translate(e-this.left+this.xOffset,d-this.top))||this.setExtent(a,!0);return c&&e},translate:function(a,b){if(this.inValidRange(a,b,!0)){var c="";if(a||b)c="translate("+a+","+b+")";this.root.setAttributeNS(null,"transform",c);this.translationParameters={x:a,y:b};return!0}return!1},setSize:function(a){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);this.rendererRoot.setAttributeNS(null,"width",this.size.w); +this.rendererRoot.setAttributeNS(null,"height",this.size.h)},getNodeType:function(a,b){var c=null;switch(a.CLASS_NAME){case "OpenLayers.Geometry.Point":c=b.externalGraphic?"image":this.isComplexSymbol(b.graphicName)?"svg":"circle";break;case "OpenLayers.Geometry.Rectangle":c="rect";break;case "OpenLayers.Geometry.LineString":c="polyline";break;case "OpenLayers.Geometry.LinearRing":c="polygon";break;case "OpenLayers.Geometry.Polygon":case "OpenLayers.Geometry.Curve":c="path"}return c},setStyle:function(a, +b,c){b=b||a._style;c=c||a._options;var d=b.title||b.graphicTitle;if(d){a.setAttributeNS(null,"title",d);var e=a.getElementsByTagName("title");0k;)f.removeChild(f.lastChild);for(var l=0;ld)k=(c-g)/(h-f),h=0>h?-d:d,c=g+(h-f)*k;if(c<-e||c>e)k=(h-f)/(c-g),c=0>c?-e:e,h=f+(c-g)*k;return h+","+c},getShortString:function(a){var b=this.getResolution(),c=(a.x-this.featureDx)/b+this.left;a=this.top-a.y/b;return this.inValidRange(c, +a)?c+","+a:!1},getPosition:function(a){return{x:parseFloat(a.getAttributeNS(null,"cx")),y:parseFloat(a.getAttributeNS(null,"cy"))}},importSymbol:function(a){this.defs||(this.defs=this.createDefs());var b=this.container.id+"-"+a,c=document.getElementById(b);if(null!=c)return c;var d=OpenLayers.Renderer.symbol[a];if(!d)throw Error(a+" is not a valid symbol name");a=this.nodeFactory(b,"symbol");var e=this.nodeFactory(null,"polygon");a.appendChild(e);for(var c=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE, +0,0),f=[],g,h,k=0;k"+this.contentDiv.innerHTML+"",b=this.map?this.map.div:document.body,c=OpenLayers.Util.getRenderedDimensions(a, +null,{displayClass:this.displayClass,containerElement:b}),d=this.getSafeContentSize(c),e=null;d.equals(c)?e=c:(c={w:d.wa.w-this.map.paddingForPopups.right&&(c.x=a.w-this.map.paddingForPopups.right-this.size.w); +b.ya.h-this.map.paddingForPopups.bottom&&(c.y=a.h-this.map.paddingForPopups.bottom-this.size.h);this.map.pan(b.x-c.x,b.y-c.y)},registerEvents:function(){this.events=new OpenLayers.Events(this,this.div,null,!0);this.events.on({mousedown:this.onmousedown,mousemove:this.onmousemove,mouseup:this.onmouseup,click:this.onclick,mouseout:this.onmouseout,dblclick:this.ondblclick,touchstart:function(a){OpenLayers.Event.stop(a,!0)}, +scope:this})},onmousedown:function(a){this.mousedown=!0;OpenLayers.Event.stop(a,!0)},onmousemove:function(a){this.mousedown&&OpenLayers.Event.stop(a,!0)},onmouseup:function(a){this.mousedown&&(this.mousedown=!1,OpenLayers.Event.stop(a,!0))},onclick:function(a){OpenLayers.Event.stop(a,!0)},onmouseout:function(a){this.mousedown=!1},ondblclick:function(a){OpenLayers.Event.stop(a,!0)},CLASS_NAME:"OpenLayers.Popup"});OpenLayers.Popup.WIDTH=200;OpenLayers.Popup.HEIGHT=200;OpenLayers.Popup.COLOR="white"; +OpenLayers.Popup.OPACITY=1;OpenLayers.Popup.BORDER="0px";OpenLayers.Control.ScaleLine=OpenLayers.Class(OpenLayers.Control,{maxWidth:100,topOutUnits:"km",topInUnits:"m",bottomOutUnits:"mi",bottomInUnits:"ft",eTop:null,eBottom:null,geodesic:!1,draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.eTop||(this.eTop=document.createElement("div"),this.eTop.className=this.displayClass+"Top",this.div.appendChild(this.eTop),this.eTop.style.visibility=""==this.topOutUnits||""==this.topInUnits?"hidden":"visible",this.eBottom=document.createElement("div"), +this.eBottom.className=this.displayClass+"Bottom",this.div.appendChild(this.eBottom),this.eBottom.style.visibility=""==this.bottomOutUnits||""==this.bottomInUnits?"hidden":"visible");this.map.events.register("moveend",this,this.update);this.update();return this.div},getBarLen:function(a){var b=parseInt(Math.log(a)/Math.log(10)),b=Math.pow(10,b);a=parseInt(a/b);return(5Math.abs(n)?1:l/n,h=(1E-5>Math.abs(m)?1:k/m)/l):(m=Math.sqrt(m*m+n*n),l=Math.sqrt(k*k+l*l)/m);a._moving=!0;a.box.geometry.rotate(-a.rotation,f);delete a._moving;a.box.geometry.resize(l,f,h);a.box.geometry.rotate(a.rotation,f);a.transformFeature({scale:l, +ratio:h});a.irregular&&!a._setfeature&&(k=f.clone(),k.x+=1E-5>Math.abs(d-f.x)?0:this.x-d,k.y+=1E-5>Math.abs(e-f.y)?0:this.y-e,a.box.geometry.move(this.x-d,this.y-e),a.transformFeature({center:k}))}},f=function(b,c){var d=this.x,e=this.y;OpenLayers.Geometry.Point.prototype.move.call(this,b,c);if(!a._moving){var f=a.dragControl.handlers.drag.evt,f=f&&f.shiftKey?45:1,g=a.center,h=this.x-g.x,k=this.y-g.y;this.x=d;this.y=e;d=Math.atan2(k-c,h-b);d=Math.atan2(k,h)-d;d*=180/Math.PI;a._angle=(a._angle+d)% +360;d=a.rotation%f;if(Math.abs(a._angle)>=f||0!==d)d=Math.round(a._angle/f)*f-d,a._angle=0,a.box.geometry.rotate(d,g),a.transformFeature({rotation:d})}},g=Array(8),h=Array(4),k,l,m,n="sw s se e ne n nw w".split(" "),p=0;8>p;++p)k=this.box.geometry.components[p],l=new OpenLayers.Feature.Vector(k.clone(),{role:n[p]+"-resize"},"string"==typeof this.renderIntent?null:this.renderIntent),0==p%2&&(m=new OpenLayers.Feature.Vector(k.clone(),{role:n[p]+"-rotate"},"string"==typeof this.rotationHandleSymbolizer? +null:this.rotationHandleSymbolizer),m.geometry.move=f,k._rotationHandle=m,h[p/2]=m),k.move=b,k.resize=c,k.rotate=d,l.geometry.move=e,k._handle=l,g[p]=l;this.rotationHandles=h;this.handles=g},createControl:function(){var a=this;this.dragControl=new OpenLayers.Control.DragFeature(this.layer,{documentDrag:!0,moveFeature:function(b){this.feature===a.feature&&(this.feature=a.box);OpenLayers.Control.DragFeature.prototype.moveFeature.apply(this,arguments)},onDrag:function(b,c){b===a.box&&a.transformFeature({center:a.center})}, +onStart:function(b,c){var d=!a.geometryTypes||-1!==OpenLayers.Util.indexOf(a.geometryTypes,b.geometry.CLASS_NAME),e=OpenLayers.Util.indexOf(a.handles,b),e=e+OpenLayers.Util.indexOf(a.rotationHandles,b);b!==a.feature&&(b!==a.box&&-2==e&&d)&&a.setFeature(b)},onComplete:function(b,c){a.events.triggerEvent("transformcomplete",{feature:a.feature})}})},drawHandles:function(){for(var a=this.layer,b=0;8>b;++b)this.rotate&&0===b%2&&a.drawFeature(this.rotationHandles[b/2],this.rotationHandleSymbolizer),a.drawFeature(this.handles[b], +this.renderIntent)},transformFeature:function(a){if(!this._setfeature){this.scale*=a.scale||1;this.ratio*=a.ratio||1;var b=this.rotation;this.rotation=(this.rotation+(a.rotation||0))%360;if(!1!==this.events.triggerEvent("beforetransform",a)){var c=this.feature,d=c.geometry,e=this.center;d.rotate(-b,e);a.scale||a.ratio?d.resize(a.scale,e,a.ratio):a.center&&c.move(a.center.getBounds().getCenterLonLat());d.rotate(this.rotation,e);this.layer.drawFeature(c);c.toState(OpenLayers.State.UPDATE);this.events.triggerEvent("transform", +a)}}this.layer.drawFeature(this.box,this.renderIntent);this.drawHandles()},destroy:function(){for(var a,b=0;8>b;++b)a=this.box.geometry.components[b],a._handle.destroy(),a._handle=null,a._rotationHandle&&a._rotationHandle.destroy(),a._rotationHandle=null;this.rotationHandles=this.rotationHandleSymbolizer=this.handles=this.feature=this.center=null;this.box.destroy();this.layer=this.box=null;this.dragControl.destroy();this.dragControl=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)}, +CLASS_NAME:"OpenLayers.Control.TransformFeature"});OpenLayers.Handler.Box=OpenLayers.Class(OpenLayers.Handler,{dragHandler:null,boxDivClassName:"olHandlerBoxZoomBox",boxOffsets:null,initialize:function(a,b,c){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.dragHandler=new OpenLayers.Handler.Drag(this,{down:this.startBox,move:this.moveBox,out:this.removeBox,up:this.endBox},{keyMask:this.keyMask})},destroy:function(){OpenLayers.Handler.prototype.destroy.apply(this,arguments);this.dragHandler&&(this.dragHandler.destroy(),this.dragHandler= +null)},setMap:function(a){OpenLayers.Handler.prototype.setMap.apply(this,arguments);this.dragHandler&&this.dragHandler.setMap(a)},startBox:function(a){this.callback("start",[]);this.zoomBox=OpenLayers.Util.createDiv("zoomBox",{x:-9999,y:-9999});this.zoomBox.className=this.boxDivClassName;this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE.Popup-1;this.map.viewPortDiv.appendChild(this.zoomBox);OpenLayers.Element.addClass(this.map.viewPortDiv,"olDrawBox")},moveBox:function(a){var b=this.dragHandler.start.x, +c=this.dragHandler.start.y,d=Math.abs(b-a.x),e=Math.abs(c-a.y),f=this.getBoxOffsets();this.zoomBox.style.width=d+f.width+1+"px";this.zoomBox.style.height=e+f.height+1+"px";this.zoomBox.style.left=(a.x=this.resFactor||a<=1/this.resFactor);return a},calculateBounds:function(a){a||(a=this.getMapBounds());var b=a.getCenterLonLat(),c=a.getWidth()*this.ratio;a=a.getHeight()*this.ratio;this.bounds=new OpenLayers.Bounds(b.lon-c/2,b.lat-a/2,b.lon+c/2,b.lat+a/2)},triggerRead:function(a){!this.response||a&&!0===a.noAbort|| +(this.layer.protocol.abort(this.response),this.layer.events.triggerEvent("loadend"));var b={filter:this.createFilter()};this.layer.events.triggerEvent("loadstart",b);this.response=this.layer.protocol.read(OpenLayers.Util.applyDefaults({filter:b.filter,callback:this.merge,scope:this},a))},createFilter:function(){var a=new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.BBOX,value:this.bounds,projection:this.layer.projection});this.layer.filter&&(a=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND, +filters:[this.layer.filter,a]}));return a},merge:function(a){this.layer.destroyFeatures();if(a.success()){var b=a.features;if(b&&0 + + Copyright 2005 Sabre Airline Solutions + + Licensed under the Apache License, Version 2.0 (the "License"); you + may not use this file except in compliance with the License. You + may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied. See the License for the specific language governing + permissions and limitations under the License. +*/ +OpenLayers.Marker.Box=OpenLayers.Class(OpenLayers.Marker,{bounds:null,div:null,initialize:function(a,b,c){this.bounds=a;this.div=OpenLayers.Util.createDiv();this.div.style.overflow="hidden";this.events=new OpenLayers.Events(this,this.div);this.setBorder(b,c)},destroy:function(){this.div=this.bounds=null;OpenLayers.Marker.prototype.destroy.apply(this,arguments)},setBorder:function(a,b){a||(a="red");b||(b=2);this.div.style.border=b+"px solid "+a},draw:function(a,b){OpenLayers.Util.modifyDOMElement(this.div, +null,a,b);return this.div},onScreen:function(){var a=!1;this.map&&(a=this.map.getExtent().containsBounds(this.bounds,!0,!0));return a},display:function(a){this.div.style.display=a?"":"none"},CLASS_NAME:"OpenLayers.Marker.Box"});OpenLayers.Format.Text=OpenLayers.Class(OpenLayers.Format,{defaultStyle:null,extractStyles:!0,initialize:function(a){a=a||{};!1!==a.extractStyles&&(a.defaultStyle={externalGraphic:OpenLayers.Util.getImageLocation("marker.png"),graphicWidth:21,graphicHeight:25,graphicXOffset:-10.5,graphicYOffset:-12.5});OpenLayers.Format.prototype.initialize.apply(this,[a])},read:function(a){a=a.split("\n");for(var b,c=[],d=0;d"+e.attributes.title+"

    "+e.attributes.description+"

    ");d.overflow=e.attributes.overflow||"auto";d=new OpenLayers.Feature(this,f,d);this.features.push(d);f=d.createMarker();null!=e.attributes.title&&null!=e.attributes.description&&f.events.register("click",d,this.markerClick);this.addMarker(f)}this.events.triggerEvent("loadend")},markerClick:function(a){var b=this==this.layer.selectedFeature;this.layer.selectedFeature= +b?null:this;for(var c=0,d=this.layer.map.popups.length;c=a?Math.round(a/1E3)+"K":95E4<=a?Math.round(a/1E6)+"M":Math.round(a),this.element.innerHTML=OpenLayers.i18n("Scale = 1 : ${scaleDenom}",{scaleDenom:a}))},CLASS_NAME:"OpenLayers.Control.Scale"});OpenLayers.Layer.MapGuide=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:!0,useHttpTile:!1,singleTile:!1,useOverlay:!1,useAsyncOverlay:!0,TILE_PARAMS:{operation:"GETTILEIMAGE",version:"1.2.0"},SINGLE_TILE_PARAMS:{operation:"GETMAPIMAGE",format:"PNG",locale:"en",clip:"1",version:"1.0.0"},OVERLAY_PARAMS:{operation:"GETDYNAMICMAPOVERLAYIMAGE",format:"PNG",locale:"en",clip:"1",version:"2.0.0"},FOLDER_PARAMS:{tileColumnsPerFolder:30,tileRowsPerFolder:30,format:"png",querystring:null},defaultSize:new OpenLayers.Size(300, +300),tileOriginCorner:"tl",initialize:function(a,b,c,d){OpenLayers.Layer.Grid.prototype.initialize.apply(this,arguments);if(null==d||null==d.isBaseLayer)this.isBaseLayer="true"!=this.transparent&&!0!=this.transparent;d&&null!=d.useOverlay&&(this.useOverlay=d.useOverlay);this.singleTile?this.useOverlay?(OpenLayers.Util.applyDefaults(this.params,this.OVERLAY_PARAMS),this.useAsyncOverlay||(this.params.version="1.0.0")):OpenLayers.Util.applyDefaults(this.params,this.SINGLE_TILE_PARAMS):(this.useHttpTile? +OpenLayers.Util.applyDefaults(this.params,this.FOLDER_PARAMS):OpenLayers.Util.applyDefaults(this.params,this.TILE_PARAMS),this.setTileSize(this.defaultSize))},clone:function(a){null==a&&(a=new OpenLayers.Layer.MapGuide(this.name,this.url,this.params,this.getOptions()));return a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a])},getURL:function(a){var b;b=a.getCenterLonLat();var c=this.map.getSize();this.singleTile?(a={setdisplaydpi:OpenLayers.DOTS_PER_INCH,setdisplayheight:c.h*this.ratio,setdisplaywidth:c.w* +this.ratio,setviewcenterx:b.lon,setviewcentery:b.lat,setviewscale:this.map.getScale()},this.useOverlay&&!this.useAsyncOverlay&&(b={},b=OpenLayers.Util.extend(b,a),b.operation="GETVISIBLEMAPEXTENT",b.version="1.0.0",b.session=this.params.session,b.mapName=this.params.mapName,b.format="text/xml",b=this.getFullRequestString(b),OpenLayers.Request.GET({url:b,async:!1})),b=this.getFullRequestString(a)):(c=this.map.getResolution(),b=Math.floor((a.left-this.maxExtent.left)/c),b=Math.round(b/this.tileSize.w), +a=Math.floor((this.maxExtent.top-a.top)/c),a=Math.round(a/this.tileSize.h),b=this.useHttpTile?this.getImageFilePath({tilecol:b,tilerow:a,scaleindex:this.resolutions.length-this.map.zoom-1}):this.getFullRequestString({tilecol:b,tilerow:a,scaleindex:this.resolutions.length-this.map.zoom-1}));return b},getFullRequestString:function(a,b){var c=null==b?this.url:b;"object"==typeof c&&(c=c[Math.floor(Math.random()*c.length)]);var d=c,e=OpenLayers.Util.extend({},this.params),e=OpenLayers.Util.extend(e,a), +f=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(c)),g;for(g in e)g.toUpperCase()in f&&delete e[g];e=OpenLayers.Util.getParameterString(e);e=e.replace(/,/g,"+");""!=e&&(f=c.charAt(c.length-1),d="&"==f||"?"==f?d+e:-1==c.indexOf("?")?d+("?"+e):d+("&"+e));return d},getImageFilePath:function(a,b){var c=null==b?this.url:b;"object"==typeof c&&(c=c[Math.floor(Math.random()*c.length)]);var d="",e="";0>a.tilerow&&(d="-");d=0==a.tilerow?d+"0":d+Math.floor(Math.abs(a.tilerow/this.params.tileRowsPerFolder))* +this.params.tileRowsPerFolder;0>a.tilecol&&(e="-");e=0==a.tilecol?e+"0":e+Math.floor(Math.abs(a.tilecol/this.params.tileColumnsPerFolder))*this.params.tileColumnsPerFolder;d="/S"+Math.floor(a.scaleindex)+"/"+this.params.basemaplayergroupname+"/R"+d+"/C"+e+"/"+a.tilerow%this.params.tileRowsPerFolder+"_"+a.tilecol%this.params.tileColumnsPerFolder+"."+this.params.format;this.params.querystring&&(d+="?"+this.params.querystring);return c+d},CLASS_NAME:"OpenLayers.Layer.MapGuide"});OpenLayers.Control.Measure=OpenLayers.Class(OpenLayers.Control,{callbacks:null,displaySystem:"metric",geodesic:!1,displaySystemUnits:{geographic:["dd"],english:["mi","ft","in"],metric:["km","m"]},partialDelay:300,delayedTrigger:null,persist:!1,immediate:!1,initialize:function(a,b){OpenLayers.Control.prototype.initialize.apply(this,[b]);var c={done:this.measureComplete,point:this.measurePartial};this.immediate&&(c.modify=this.measureImmediate);this.callbacks=OpenLayers.Util.extend(c,this.callbacks); +this.handlerOptions=OpenLayers.Util.extend({persist:this.persist},this.handlerOptions);this.handler=new a(this,this.callbacks,this.handlerOptions)},deactivate:function(){this.cancelDelay();return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},cancel:function(){this.cancelDelay();this.handler.cancel()},setImmediate:function(a){(this.immediate=a)?this.callbacks.modify=this.measureImmediate:delete this.callbacks.modify},updateHandler:function(a,b){var c=this.active;c&&this.deactivate(); +this.handler=new a(this,this.callbacks,b);c&&this.activate()},measureComplete:function(a){this.cancelDelay();this.measure(a,"measure")},measurePartial:function(a,b){this.cancelDelay();b=b.clone();this.handler.freehandMode(this.handler.evt)?this.measure(b,"measurepartial"):this.delayedTrigger=window.setTimeout(OpenLayers.Function.bind(function(){this.delayedTrigger=null;this.measure(b,"measurepartial")},this),this.partialDelay)},measureImmediate:function(a,b,c){c&&!this.handler.freehandMode(this.handler.evt)&& +(this.cancelDelay(),this.measure(b.geometry,"measurepartial"))},cancelDelay:function(){null!==this.delayedTrigger&&(window.clearTimeout(this.delayedTrigger),this.delayedTrigger=null)},measure:function(a,b){var c,d;-1k?0:k)+"px";d.div.style.height=(0>l?0:l)+"px";d.div.style.left=null!=e?e+"px":"";d.div.style.bottom=null!=f?f+"px":"";d.div.style.right=null!=g?g+"px":"";d.div.style.top=null!=h?h+"px":"";d.image.style.left=c.position.x+"px";d.image.style.top=c.position.y+"px"}this.contentDiv.style.left=this.padding.left+"px";this.contentDiv.style.top=this.padding.top+"px"}},CLASS_NAME:"OpenLayers.Popup.Framed"});OpenLayers.Popup.FramedCloud=OpenLayers.Class(OpenLayers.Popup.Framed,{contentDisplayClass:"olFramedCloudPopupContent",autoSize:!0,panMapIfOutOfView:!0,imageSize:new OpenLayers.Size(1276,736),isAlphaImage:!1,fixedRelativePosition:!1,positionBlocks:{tl:{offset:new OpenLayers.Pixel(44,0),padding:new OpenLayers.Bounds(8,40,8,9),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,51,22,0),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null, +50,0,0),position:new OpenLayers.Pixel(-1238,0)},{size:new OpenLayers.Size("auto",19),anchor:new OpenLayers.Bounds(0,32,22,null),position:new OpenLayers.Pixel(0,-631)},{size:new OpenLayers.Size(22,18),anchor:new OpenLayers.Bounds(null,32,0,null),position:new OpenLayers.Pixel(-1238,-632)},{size:new OpenLayers.Size(81,35),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(0,-688)}]},tr:{offset:new OpenLayers.Pixel(-45,0),padding:new OpenLayers.Bounds(8,40,8,9),blocks:[{size:new OpenLayers.Size("auto", +"auto"),anchor:new OpenLayers.Bounds(0,51,22,0),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,50,0,0),position:new OpenLayers.Pixel(-1238,0)},{size:new OpenLayers.Size("auto",19),anchor:new OpenLayers.Bounds(0,32,22,null),position:new OpenLayers.Pixel(0,-631)},{size:new OpenLayers.Size(22,19),anchor:new OpenLayers.Bounds(null,32,0,null),position:new OpenLayers.Pixel(-1238,-631)},{size:new OpenLayers.Size(81,35),anchor:new OpenLayers.Bounds(0, +0,null,null),position:new OpenLayers.Pixel(-215,-687)}]},bl:{offset:new OpenLayers.Pixel(45,0),padding:new OpenLayers.Bounds(8,9,8,40),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,21,22,32),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,21,0,32),position:new OpenLayers.Pixel(-1238,0)},{size:new OpenLayers.Size("auto",21),anchor:new OpenLayers.Bounds(0,0,22,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22, +21),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-1238,-629)},{size:new OpenLayers.Size(81,33),anchor:new OpenLayers.Bounds(null,null,0,0),position:new OpenLayers.Pixel(-101,-674)}]},br:{offset:new OpenLayers.Pixel(-44,0),padding:new OpenLayers.Bounds(8,9,8,40),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,21,22,32),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,21,0,32),position:new OpenLayers.Pixel(-1238, +0)},{size:new OpenLayers.Size("auto",21),anchor:new OpenLayers.Bounds(0,0,22,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22,21),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-1238,-629)},{size:new OpenLayers.Size(81,33),anchor:new OpenLayers.Bounds(0,null,null,0),position:new OpenLayers.Pixel(-311,-674)}]}},minSize:new OpenLayers.Size(105,10),maxSize:new OpenLayers.Size(1200,660),initialize:function(a,b,c,d,e,f,g){this.imageSrc=OpenLayers.Util.getImageLocation("cloud-popup-relative.png"); +OpenLayers.Popup.Framed.prototype.initialize.apply(this,arguments);this.contentDiv.className=this.contentDisplayClass},CLASS_NAME:"OpenLayers.Popup.FramedCloud"});OpenLayers.Tile.Image.IFrame={useIFrame:null,blankImageUrl:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAQAIBRAA7",draw:function(){if(OpenLayers.Tile.Image.prototype.shouldDraw.call(this)){var a=this.layer.getURL(this.bounds),b=this.useIFrame;this.useIFrame=null!==this.maxGetUrlLength&&!this.layer.async&&a.length>this.maxGetUrlLength;a=b&&!this.useIFrame;b=!b&&this.useIFrame;if(a||b)this.imgDiv&&this.imgDiv.parentNode===this.frame&&this.frame.removeChild(this.imgDiv),this.imgDiv= +null,a&&this.frame.removeChild(this.frame.firstChild)}return OpenLayers.Tile.Image.prototype.draw.apply(this,arguments)},getImage:function(){if(!0===this.useIFrame){if(!this.frame.childNodes.length){var a=document.createElement("div"),b=a.style;b.position="absolute";b.width="100%";b.height="100%";b.zIndex=1;b.backgroundImage="url("+this.blankImageUrl+")";this.frame.appendChild(a)}a=this.id+"_iFrame";9>parseFloat(navigator.appVersion.split("MSIE")[1])?(b=document.createElement('"); - });*/ - map.addLayer(layer); - //map.addControl(infoFeature); - //infoFeature.activate(); - } +// for (var i = 0 ; i < wmsLayers.length ; i++) { +// console.log(wmsLayers[i].URL_COUCHECARTO); +// // ajout de la couche sur la carte +// var layer = new OpenLayers.Layer.WMS( +// wmsLayers[i].NOM_COUCHECARTO, +// wmsLayers[i].URL_COUCHECARTO.replace('\{key\}', ignKey), { +// layers: wmsLayers[i].LAYERS_COUCHECARTO, +// format: wmsLayers[i].FORMAT_COUCHECARTO, +// transparent: wmsLayers[i].TRANSPARENT_COUCHECARTO === 1 ? 'true' : 'false' +// }, { +// projection: 'EPSG:4326', +// singleTile: false, +// opacity: 1, +// visibility: true +// } +// ); + +// /*var infoFeature = new OpenLayers.Control.WMSGetFeatureInfo({ +// url: wmsLayers[i].URL_COUCHECARTO, +// title: 'Identify features by clicking', +// layers: [layer], +// queryVisible: true +// }); + +// infoFeature.events.register("getfeatureinfo", map, function(event) { +// var $response = $(event.text); +// var time = (new Date()).getTime(); +// $('#wms').append(""); +// });*/ +// map.addLayer(layer); +// //map.addControl(infoFeature); +// //infoFeature.activate(); +// } +// } - // Suppression des markers par défaut - var vectorLayers = map.getLayersByClass('OpenLayers.Layer.Vector'); - if (vectorLayers.length > 0) { - var vectorLayer = vectorLayers[0]; - if (vectorLayer.features.length > 0) { - vectorLayer.features[0].destroy(); - } - } +// // Suppression des markers par défaut +// var vectorLayers = map.getLayersByClass('OpenLayers.Layer.Vector'); +// if (vectorLayers.length > 0) { +// var vectorLayer = vectorLayers[0]; +// if (vectorLayer.features.length > 0) { +// vectorLayer.features[0].destroy(); +// } +// } - // Ajout des POI avec les adresses sur la carte - var epsg4326 = new OpenLayers.Projection("EPSG:4326"); //WGS 1984 projection - var projectTo = map.getProjectionObject(); //The map projection (Spherical Mercator) +// // Ajout des POI avec les adresses sur la carte +// var epsg4326 = new OpenLayers.Projection("EPSG:4326"); //WGS 1984 projection +// var projectTo = map.getProjectionObject(); //The map projection (Spherical Mercator) - var vectorLayer = new OpenLayers.Layer.Vector("Etablissement"); +// var vectorLayer = new OpenLayers.Layer.Vector("Etablissement"); - // Define markers as "features" of the vector layer: - for (var i = 0 ; i < points.length ; i++) { +// // Define markers as "features" of the vector layer: +// for (var i = 0 ; i < points.length ; i++) { - var feature = new OpenLayers.Feature.Vector( - new OpenLayers.Geometry.Point(points[i].lon, points[i].lat).transform(epsg4326, projectTo), - {description:points[i].description} , - {externalGraphic: '/images/red-dot.png', graphicHeight: 30, graphicWidth: 30, graphicXOffset:-15, graphicYOffset:-30 } - ); - vectorLayer.addFeatures(feature); - } +// var feature = new OpenLayers.Feature.Vector( +// new OpenLayers.Geometry.Point(points[i].lon, points[i].lat).transform(epsg4326, projectTo), +// {description:points[i].description} , +// {externalGraphic: '/images/red-dot.png', graphicHeight: 30, graphicWidth: 30, graphicXOffset:-15, graphicYOffset:-30 } +// ); +// vectorLayer.addFeatures(feature); +// } - map.addLayer(vectorLayer); +// map.addLayer(vectorLayer); - //Add a selector control to the vectorLayer with popup functions - var controls = { - selector: new OpenLayers.Control.SelectFeature(vectorLayer, { onSelect: createPopup, onUnselect: destroyPopup }) - }; +// //Add a selector control to the vectorLayer with popup functions +// var controls = { +// selector: new OpenLayers.Control.SelectFeature(vectorLayer, { onSelect: createPopup, onUnselect: destroyPopup }) +// }; - function createPopup(feature) { - feature.popup = new OpenLayers.Popup.FramedCloud("pop", - feature.geometry.getBounds().getCenterLonLat(), - null, - '
    '+feature.attributes.description+'
    ', - null, - true, - function() { controls['selector'].unselectAll(); } - ); - //feature.popup.closeOnMove = true; - map.addPopup(feature.popup); - } +// function createPopup(feature) { +// feature.popup = new OpenLayers.Popup.FramedCloud("pop", +// feature.geometry.getBounds().getCenterLonLat(), +// null, +// '
    '+feature.attributes.description+'
    ', +// null, +// true, +// function() { controls['selector'].unselectAll(); } +// ); +// //feature.popup.closeOnMove = true; +// map.addPopup(feature.popup); +// } - function destroyPopup(feature) { - feature.popup.destroy(); - feature.popup = null; - } +// function destroyPopup(feature) { +// feature.popup.destroy(); +// feature.popup = null; +// } - map.addControl(controls['selector']); - controls['selector'].activate(); +// map.addControl(controls['selector']); +// controls['selector'].activate(); - if (onView !== undefined) { - onView(); +// if (onView !== undefined) { +// onView(); +// } +// } +// }) +// ); + +// return viewer; +// } + +function initViewer(divId, ignKey, adresse) { // Voir pour update avec des listen+addLayers + viewer = Gp.Map.load( + divId, // identifiant du conteneur HTML + { + apiKey : ignKey, + // chargement de la cartographie en 2D + viewMode : "2d", + // niveau de zoom de la carte (de 1 à 21) + zoom : 16, + // centrage de la carte + center : { + location : adresse, + projection : "EPSG:4326" + }, + layersOptions : { + // COUCHE DE BASE + "ORTHOIMAGERY.ORTHOPHOTOS" : {}, + "GEOGRAPHICALGRIDSYSTEMS.MAPS.SCAN-EXPRESS.STANDARD": { + opacity : 0 + } + }, + // Outils additionnels à proposer sur la carte + controlsOptions : { + "layerSwitcher" : {}, + "search" : {}, + "orientation" : {}, + "graphicscale" : {}, + "mouseposition" : {}, + "graticule" : {}, + "getfeatureinfo" : { + layers : [ + { + "ORTHOIMAGERY.ORTHOPHOTOS" : {}, + "GEOGRAPHICALGRIDSYSTEMS.MAPS.SCAN-EXPRESS.STANDARD" : {}, + } + ], + options : { + auto : true, + active: true, + defaultInfoFormat: "text/html", + defaultEvent: "singleclick", + cursorStyle: "pointer" } } - }) - ); - + } + }); + return viewer; - } - -function putMarkerAt(map, point, sourceProjection) { - var vectorLayers = map.getLayersByClass('OpenLayers.Layer.Vector'); - if (vectorLayers.length > 0) { - var vectorLayer = vectorLayers[0]; - if (vectorLayer.features.length > 0) { - vectorLayer.features[0].destroy(); - } - var lonlat = point.transform( - sourceProjection, vectorLayer.projection.toString() - ); - point = new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat); - vectorLayer.addFeatures([new OpenLayers.Feature.Vector(point, {}, {externalGraphic: '/images/red-dot.png', graphicHeight: 30, graphicWidth: 30, graphicXOffset:-15, graphicYOffset:-30 })]); +function putMarkerAt(viewer, center, nbCouches) { + if(viewer.getLayers().getLength() != nbCouches) { + var toRemove = viewer.getLayers().item(viewer.getLayers().getLength()-1); + viewer.removeLayer(toRemove); } + var coordinates = ol.proj.fromLonLat([center[0],center[1]]); + var point = new ol.geom.Point(coordinates); + var marker = new ol.Feature(point); + var vectorSource = new ol.source.Vector({ + features: [marker] + }); + var styleMarker = new ol.style.Style({ + image: new ol.style.Icon({ + src: "/images/red-dot.png" + }) + }); + var vectorLayer = new ol.layer.Vector({ + source: vectorSource, + style: styleMarker + }); + viewer.addLayer(vectorLayer); } + +// function putMarkerAt(map, point, sourceProjection) { +// var vectorLayers = map.getLayersByClass('OpenLayers.Layer.Vector'); +// if (vectorLayers.length > 0) { +// var vectorLayer = vectorLayers[0]; +// for(var j = 0 ; j < vectorLayer.features.length ; j++) { +// vectorLayer.features[j].destroy(); +// } +// var lonlat = point.transform( +// sourceProjection, vectorLayer.projection.toString() +// ); +// point = new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat); +// vectorLayer.addFeatures([new OpenLayers.Feature.Vector(point, {}, {externalGraphic: '/images/red-dot.png', graphicHeight: 30, graphicWidth: 30, graphicXOffset:-15, graphicYOffset:-30 })]); +// } +// } diff --git a/public/js/plugins/advlist/plugin.min.js b/public/js/plugins/advlist/plugin.min.js new file mode 100644 index 00000000..1e1c6680 --- /dev/null +++ b/public/js/plugins/advlist/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("advlist",function(a){function b(a,b){var c=[];return tinymce.each(b.split(/[ ,]/),function(a){c.push({text:a.replace(/\-/g," ").replace(/\b\w/g,function(a){return a.toUpperCase()}),data:"default"==a?"":a})}),c}function c(b,c){a.undoManager.transact(function(){var d,e=a.dom,f=a.selection;d=e.getParent(f.getNode(),"ol,ul"),d&&d.nodeName==b&&c!==!1||a.execCommand("UL"==b?"InsertUnorderedList":"InsertOrderedList"),c=c===!1?g[b]:c,g[b]=c,d=e.getParent(f.getNode(),"ol,ul"),d&&(e.setStyle(d,"listStyleType",c?c:null),d.removeAttribute("data-mce-style")),a.focus()})}function d(b){var c=a.dom.getStyle(a.dom.getParent(a.selection.getNode(),"ol,ul"),"listStyleType")||"";b.control.items().each(function(a){a.active(a.settings.data===c)})}var e,f,g={};e=b("OL",a.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman")),f=b("UL",a.getParam("advlist_bullet_styles","default,circle,disc,square")),a.addButton("numlist",{type:"splitbutton",tooltip:"Numbered list",menu:e,onshow:d,onselect:function(a){c("OL",a.control.settings.data)},onclick:function(){c("OL",!1)}}),a.addButton("bullist",{type:"splitbutton",tooltip:"Bullet list",menu:f,onshow:d,onselect:function(a){c("UL",a.control.settings.data)},onclick:function(){c("UL",!1)}})}); \ No newline at end of file diff --git a/public/js/plugins/anchor/plugin.min.js b/public/js/plugins/anchor/plugin.min.js new file mode 100644 index 00000000..0dd4774b --- /dev/null +++ b/public/js/plugins/anchor/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("anchor",function(a){function b(){var b=a.selection.getNode(),c="",d="A"==b.tagName&&""===a.dom.getAttrib(b,"href");d&&(c=b.name||b.id||""),a.windowManager.open({title:"Anchor",body:{type:"textbox",name:"name",size:40,label:"Name",value:c},onsubmit:function(c){var e=c.data.name;d?b.id=e:(a.selection.collapse(!0),a.execCommand("mceInsertContent",!1,a.dom.createHTML("a",{id:e})))}})}a.addCommand("mceAnchor",b),a.addButton("anchor",{icon:"anchor",tooltip:"Anchor",onclick:b,stateSelector:"a:not([href])"}),a.addMenuItem("anchor",{icon:"anchor",text:"Anchor",context:"insert",onclick:b})}); \ No newline at end of file diff --git a/public/js/plugins/autolink/plugin.min.js b/public/js/plugins/autolink/plugin.min.js new file mode 100644 index 00000000..4972b936 --- /dev/null +++ b/public/js/plugins/autolink/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("autolink",function(a){function b(a){e(a,-1,"(",!0)}function c(a){e(a,0,"",!0)}function d(a){e(a,-1,"",!1)}function e(a,b,c){function d(a,b){if(0>b&&(b=0),3==a.nodeType){var c=a.data.length;b>c&&(b=c)}return b}function e(a,b){1!=a.nodeType||a.hasChildNodes()?h.setStart(a,d(a,b)):h.setStartBefore(a)}function f(a,b){1!=a.nodeType||a.hasChildNodes()?h.setEnd(a,d(a,b)):h.setEndAfter(a)}var h,i,j,k,l,m,n,o,p,q;if("A"!=a.selection.getNode().tagName){if(h=a.selection.getRng(!0).cloneRange(),h.startOffset<5){if(o=h.endContainer.previousSibling,!o){if(!h.endContainer.firstChild||!h.endContainer.firstChild.nextSibling)return;o=h.endContainer.firstChild.nextSibling}if(p=o.length,e(o,p),f(o,p),h.endOffset<5)return;i=h.endOffset,k=o}else{if(k=h.endContainer,3!=k.nodeType&&k.firstChild){for(;3!=k.nodeType&&k.firstChild;)k=k.firstChild;3==k.nodeType&&(e(k,0),f(k,k.nodeValue.length))}i=1==h.endOffset?2:h.endOffset-1-b}j=i;do e(k,i>=2?i-2:0),f(k,i>=1?i-1:0),i-=1,q=h.toString();while(" "!=q&&""!==q&&160!=q.charCodeAt(0)&&i-2>=0&&q!=c);h.toString()==c||160==h.toString().charCodeAt(0)?(e(k,i),f(k,j),i+=1):0===h.startOffset?(e(k,0),f(k,j)):(e(k,i),f(k,j)),m=h.toString(),"."==m.charAt(m.length-1)&&f(k,j-1),m=h.toString(),n=m.match(g),n&&("www."==n[1]?n[1]="http://www.":/@$/.test(n[1])&&!/^mailto:/.test(n[1])&&(n[1]="mailto:"+n[1]),l=a.selection.getBookmark(),a.selection.setRng(h),a.execCommand("createlink",!1,n[1]+n[2]),a.selection.moveToBookmark(l),a.nodeChanged())}}var f,g=/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i;return a.settings.autolink_pattern&&(g=a.settings.autolink_pattern),a.on("keydown",function(b){return 13==b.keyCode?d(a):void 0}),tinymce.Env.ie?void a.on("focus",function(){if(!f){f=!0;try{a.execCommand("AutoUrlDetect",!1,!0)}catch(b){}}}):(a.on("keypress",function(c){return 41==c.keyCode?b(a):void 0}),void a.on("keyup",function(b){return 32==b.keyCode?c(a):void 0}))}); \ No newline at end of file diff --git a/public/js/plugins/autoresize/plugin.min.js b/public/js/plugins/autoresize/plugin.min.js new file mode 100644 index 00000000..a56d0d50 --- /dev/null +++ b/public/js/plugins/autoresize/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("autoresize",function(a){function b(){return a.plugins.fullscreen&&a.plugins.fullscreen.isFullscreen()}function c(d){var g,h,i,j,k,l,m,n,o,p,q,r,s=tinymce.DOM;if(h=a.getDoc()){if(i=h.body,j=h.documentElement,k=e.autoresize_min_height,!i||d&&"setcontent"===d.type&&d.initial||b())return void(i&&j&&(i.style.overflowY="auto",j.style.overflowY="auto"));m=a.dom.getStyle(i,"margin-top",!0),n=a.dom.getStyle(i,"margin-bottom",!0),o=a.dom.getStyle(i,"padding-top",!0),p=a.dom.getStyle(i,"padding-bottom",!0),q=a.dom.getStyle(i,"border-top-width",!0),r=a.dom.getStyle(i,"border-bottom-width",!0),l=i.offsetHeight+parseInt(m,10)+parseInt(n,10)+parseInt(o,10)+parseInt(p,10)+parseInt(q,10)+parseInt(r,10),(isNaN(l)||0>=l)&&(l=tinymce.Env.ie?i.scrollHeight:tinymce.Env.webkit&&0===i.clientHeight?0:i.offsetHeight),l>e.autoresize_min_height&&(k=l),e.autoresize_max_height&&l>e.autoresize_max_height?(k=e.autoresize_max_height,i.style.overflowY="auto",j.style.overflowY="auto"):(i.style.overflowY="hidden",j.style.overflowY="hidden",i.scrollTop=0),k!==f&&(g=k-f,s.setStyle(a.iframeElement,"height",k+"px"),f=k,tinymce.isWebKit&&0>g&&c(d))}}function d(b,e,f){tinymce.util.Delay.setEditorTimeout(a,function(){c({}),b--?d(b,e,f):f&&f()},e)}var e=a.settings,f=0;a.settings.inline||(e.autoresize_min_height=parseInt(a.getParam("autoresize_min_height",a.getElement().offsetHeight),10),e.autoresize_max_height=parseInt(a.getParam("autoresize_max_height",0),10),a.on("init",function(){var b,c;b=a.getParam("autoresize_overflow_padding",1),c=a.getParam("autoresize_bottom_margin",50),b!==!1&&a.dom.setStyles(a.getBody(),{paddingLeft:b,paddingRight:b}),c!==!1&&a.dom.setStyles(a.getBody(),{paddingBottom:c})}),a.on("nodechange setcontent keyup FullscreenStateChanged",c),a.getParam("autoresize_on_init",!0)&&a.on("init",function(){d(20,100,function(){d(5,1e3)})}),a.addCommand("mceAutoResize",c))}); \ No newline at end of file diff --git a/public/js/plugins/autosave/plugin.min.js b/public/js/plugins/autosave/plugin.min.js new file mode 100644 index 00000000..11de44d9 --- /dev/null +++ b/public/js/plugins/autosave/plugin.min.js @@ -0,0 +1 @@ +tinymce._beforeUnloadHandler=function(){var a;return tinymce.each(tinymce.editors,function(b){b.plugins.autosave&&b.plugins.autosave.storeDraft(),!a&&b.isDirty()&&b.getParam("autosave_ask_before_unload",!0)&&(a=b.translate("You have unsaved changes are you sure you want to navigate away?"))}),a},tinymce.PluginManager.add("autosave",function(a){function b(a,b){var c={s:1e3,m:6e4};return a=/^(\d+)([ms]?)$/.exec(""+(a||b)),(a[2]?c[a[2]]:1)*parseInt(a,10)}function c(){var a=parseInt(n.getItem(k+"time"),10)||0;return(new Date).getTime()-a>m.autosave_retention?(d(!1),!1):!0}function d(b){n.removeItem(k+"draft"),n.removeItem(k+"time"),b!==!1&&a.fire("RemoveDraft")}function e(){!j()&&a.isDirty()&&(n.setItem(k+"draft",a.getContent({format:"raw",no_events:!0})),n.setItem(k+"time",(new Date).getTime()),a.fire("StoreDraft"))}function f(){c()&&(a.setContent(n.getItem(k+"draft"),{format:"raw"}),a.fire("RestoreDraft"))}function g(){l||(setInterval(function(){a.removed||e()},m.autosave_interval),l=!0)}function h(){var b=this;b.disabled(!c()),a.on("StoreDraft RestoreDraft RemoveDraft",function(){b.disabled(!c())}),g()}function i(){a.undoManager.beforeChange(),f(),d(),a.undoManager.add()}function j(b){var c=a.settings.forced_root_block;return b=tinymce.trim("undefined"==typeof b?a.getBody().innerHTML:b),""===b||new RegExp("^<"+c+"[^>]*>((\xa0| |[ ]|]*>)+?|)|
    $","i").test(b)}var k,l,m=a.settings,n=tinymce.util.LocalStorage;k=m.autosave_prefix||"tinymce-autosave-{path}{query}-{id}-",k=k.replace(/\{path\}/g,document.location.pathname),k=k.replace(/\{query\}/g,document.location.search),k=k.replace(/\{id\}/g,a.id),m.autosave_interval=b(m.autosave_interval,"30s"),m.autosave_retention=b(m.autosave_retention,"20m"),a.addButton("restoredraft",{title:"Restore last draft",onclick:i,onPostRender:h}),a.addMenuItem("restoredraft",{text:"Restore last draft",onclick:i,onPostRender:h,context:"file"}),a.settings.autosave_restore_when_empty!==!1&&(a.on("init",function(){c()&&j()&&f()}),a.on("saveContent",function(){d()})),window.onbeforeunload=tinymce._beforeUnloadHandler,this.hasDraft=c,this.storeDraft=e,this.restoreDraft=f,this.removeDraft=d,this.isEmpty=j}); \ No newline at end of file diff --git a/public/js/plugins/bbcode/plugin.min.js b/public/js/plugins/bbcode/plugin.min.js new file mode 100644 index 00000000..4548e5e6 --- /dev/null +++ b/public/js/plugins/bbcode/plugin.min.js @@ -0,0 +1 @@ +!function(){tinymce.create("tinymce.plugins.BBCodePlugin",{init:function(a){var b=this,c=a.getParam("bbcode_dialect","punbb").toLowerCase();a.on("beforeSetContent",function(a){a.content=b["_"+c+"_bbcode2html"](a.content)}),a.on("postProcess",function(a){a.set&&(a.content=b["_"+c+"_bbcode2html"](a.content)),a.get&&(a.content=b["_"+c+"_html2bbcode"](a.content))})},getInfo:function(){return{longname:"BBCode Plugin",author:"Ephox Corp",authorurl:"http://www.tinymce.com",infourl:"http://www.tinymce.com/wiki.php/Plugin:bbcode"}},_punbb_html2bbcode:function(a){function b(b,c){a=a.replace(b,c)}return a=tinymce.trim(a),b(/(.*?)<\/a>/gi,"[url=$1]$2[/url]"),b(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),b(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),b(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),b(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),b(/(.*?)<\/span>/gi,"[color=$1]$2[/color]"),b(/(.*?)<\/font>/gi,"[color=$1]$2[/color]"),b(/(.*?)<\/span>/gi,"[size=$1]$2[/size]"),b(/(.*?)<\/font>/gi,"$1"),b(//gi,"[img]$1[/img]"),b(/(.*?)<\/span>/gi,"[code]$1[/code]"),b(/(.*?)<\/span>/gi,"[quote]$1[/quote]"),b(/(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),b(/(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),b(/(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),b(/(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),b(/(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),b(/(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),b(/<\/(strong|b)>/gi,"[/b]"),b(/<(strong|b)>/gi,"[b]"),b(/<\/(em|i)>/gi,"[/i]"),b(/<(em|i)>/gi,"[i]"),b(/<\/u>/gi,"[/u]"),b(/(.*?)<\/span>/gi,"[u]$1[/u]"),b(//gi,"[u]"),b(/]*>/gi,"[quote]"),b(/<\/blockquote>/gi,"[/quote]"),b(/
    /gi,"\n"),b(//gi,"\n"),b(/
    /gi,"\n"),b(/

    /gi,""),b(/<\/p>/gi,"\n"),b(/ |\u00a0/gi," "),b(/"/gi,'"'),b(/</gi,"<"),b(/>/gi,">"),b(/&/gi,"&"),a},_punbb_bbcode2html:function(a){function b(b,c){a=a.replace(b,c)}return a=tinymce.trim(a),b(/\n/gi,"
    "),b(/\[b\]/gi,""),b(/\[\/b\]/gi,""),b(/\[i\]/gi,""),b(/\[\/i\]/gi,""),b(/\[u\]/gi,""),b(/\[\/u\]/gi,""),b(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'$2'),b(/\[url\](.*?)\[\/url\]/gi,'$1'),b(/\[img\](.*?)\[\/img\]/gi,''),b(/\[color=(.*?)\](.*?)\[\/color\]/gi,'$2'),b(/\[code\](.*?)\[\/code\]/gi,'$1 '),b(/\[quote.*?\](.*?)\[\/quote\]/gi,'$1 '),a}}),tinymce.PluginManager.add("bbcode",tinymce.plugins.BBCodePlugin)}(); \ No newline at end of file diff --git a/public/js/plugins/charmap/plugin.min.js b/public/js/plugins/charmap/plugin.min.js new file mode 100644 index 00000000..9fd639ef --- /dev/null +++ b/public/js/plugins/charmap/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("charmap",function(a){function b(){return[["160","no-break space"],["173","soft hyphen"],["34","quotation mark"],["162","cent sign"],["8364","euro sign"],["163","pound sign"],["165","yen sign"],["169","copyright sign"],["174","registered sign"],["8482","trade mark sign"],["8240","per mille sign"],["181","micro sign"],["183","middle dot"],["8226","bullet"],["8230","three dot leader"],["8242","minutes / feet"],["8243","seconds / inches"],["167","section sign"],["182","paragraph sign"],["223","sharp s / ess-zed"],["8249","single left-pointing angle quotation mark"],["8250","single right-pointing angle quotation mark"],["171","left pointing guillemet"],["187","right pointing guillemet"],["8216","left single quotation mark"],["8217","right single quotation mark"],["8220","left double quotation mark"],["8221","right double quotation mark"],["8218","single low-9 quotation mark"],["8222","double low-9 quotation mark"],["60","less-than sign"],["62","greater-than sign"],["8804","less-than or equal to"],["8805","greater-than or equal to"],["8211","en dash"],["8212","em dash"],["175","macron"],["8254","overline"],["164","currency sign"],["166","broken bar"],["168","diaeresis"],["161","inverted exclamation mark"],["191","turned question mark"],["710","circumflex accent"],["732","small tilde"],["176","degree sign"],["8722","minus sign"],["177","plus-minus sign"],["247","division sign"],["8260","fraction slash"],["215","multiplication sign"],["185","superscript one"],["178","superscript two"],["179","superscript three"],["188","fraction one quarter"],["189","fraction one half"],["190","fraction three quarters"],["402","function / florin"],["8747","integral"],["8721","n-ary sumation"],["8734","infinity"],["8730","square root"],["8764","similar to"],["8773","approximately equal to"],["8776","almost equal to"],["8800","not equal to"],["8801","identical to"],["8712","element of"],["8713","not an element of"],["8715","contains as member"],["8719","n-ary product"],["8743","logical and"],["8744","logical or"],["172","not sign"],["8745","intersection"],["8746","union"],["8706","partial differential"],["8704","for all"],["8707","there exists"],["8709","diameter"],["8711","backward difference"],["8727","asterisk operator"],["8733","proportional to"],["8736","angle"],["180","acute accent"],["184","cedilla"],["170","feminine ordinal indicator"],["186","masculine ordinal indicator"],["8224","dagger"],["8225","double dagger"],["192","A - grave"],["193","A - acute"],["194","A - circumflex"],["195","A - tilde"],["196","A - diaeresis"],["197","A - ring above"],["198","ligature AE"],["199","C - cedilla"],["200","E - grave"],["201","E - acute"],["202","E - circumflex"],["203","E - diaeresis"],["204","I - grave"],["205","I - acute"],["206","I - circumflex"],["207","I - diaeresis"],["208","ETH"],["209","N - tilde"],["210","O - grave"],["211","O - acute"],["212","O - circumflex"],["213","O - tilde"],["214","O - diaeresis"],["216","O - slash"],["338","ligature OE"],["352","S - caron"],["217","U - grave"],["218","U - acute"],["219","U - circumflex"],["220","U - diaeresis"],["221","Y - acute"],["376","Y - diaeresis"],["222","THORN"],["224","a - grave"],["225","a - acute"],["226","a - circumflex"],["227","a - tilde"],["228","a - diaeresis"],["229","a - ring above"],["230","ligature ae"],["231","c - cedilla"],["232","e - grave"],["233","e - acute"],["234","e - circumflex"],["235","e - diaeresis"],["236","i - grave"],["237","i - acute"],["238","i - circumflex"],["239","i - diaeresis"],["240","eth"],["241","n - tilde"],["242","o - grave"],["243","o - acute"],["244","o - circumflex"],["245","o - tilde"],["246","o - diaeresis"],["248","o slash"],["339","ligature oe"],["353","s - caron"],["249","u - grave"],["250","u - acute"],["251","u - circumflex"],["252","u - diaeresis"],["253","y - acute"],["254","thorn"],["255","y - diaeresis"],["913","Alpha"],["914","Beta"],["915","Gamma"],["916","Delta"],["917","Epsilon"],["918","Zeta"],["919","Eta"],["920","Theta"],["921","Iota"],["922","Kappa"],["923","Lambda"],["924","Mu"],["925","Nu"],["926","Xi"],["927","Omicron"],["928","Pi"],["929","Rho"],["931","Sigma"],["932","Tau"],["933","Upsilon"],["934","Phi"],["935","Chi"],["936","Psi"],["937","Omega"],["945","alpha"],["946","beta"],["947","gamma"],["948","delta"],["949","epsilon"],["950","zeta"],["951","eta"],["952","theta"],["953","iota"],["954","kappa"],["955","lambda"],["956","mu"],["957","nu"],["958","xi"],["959","omicron"],["960","pi"],["961","rho"],["962","final sigma"],["963","sigma"],["964","tau"],["965","upsilon"],["966","phi"],["967","chi"],["968","psi"],["969","omega"],["8501","alef symbol"],["982","pi symbol"],["8476","real part symbol"],["978","upsilon - hook symbol"],["8472","Weierstrass p"],["8465","imaginary part"],["8592","leftwards arrow"],["8593","upwards arrow"],["8594","rightwards arrow"],["8595","downwards arrow"],["8596","left right arrow"],["8629","carriage return"],["8656","leftwards double arrow"],["8657","upwards double arrow"],["8658","rightwards double arrow"],["8659","downwards double arrow"],["8660","left right double arrow"],["8756","therefore"],["8834","subset of"],["8835","superset of"],["8836","not a subset of"],["8838","subset of or equal to"],["8839","superset of or equal to"],["8853","circled plus"],["8855","circled times"],["8869","perpendicular"],["8901","dot operator"],["8968","left ceiling"],["8969","right ceiling"],["8970","left floor"],["8971","right floor"],["9001","left-pointing angle bracket"],["9002","right-pointing angle bracket"],["9674","lozenge"],["9824","black spade suit"],["9827","black club suit"],["9829","black heart suit"],["9830","black diamond suit"],["8194","en space"],["8195","em space"],["8201","thin space"],["8204","zero width non-joiner"],["8205","zero width joiner"],["8206","left-to-right mark"],["8207","right-to-left mark"]]}function c(a){return tinymce.util.Tools.grep(a,function(a){return i(a)&&2==a.length})}function d(a){return i(a)?[].concat(c(a)):"function"==typeof a?a():[]}function e(b){var c=a.settings;return c.charmap&&(b=d(c.charmap)),c.charmap_append?[].concat(b).concat(d(c.charmap_append)):b}function f(){return e(b())}function g(b){a.fire("insertCustomChar",{chr:b}).chr,a.execCommand("mceInsertContent",!1,b)}function h(){function b(a){for(;a;){if("TD"==a.nodeName)return a;a=a.parentNode}}var c,d,e,h;c='';var i=f(),j=Math.min(i.length,25),k=Math.ceil(i.length/j);for(e=0;k>e;e++){for(c+="",d=0;j>d;d++){var l=e*j+d;if(l
    '+(m?String.fromCharCode(parseInt(m[0],10)):" ")+"
    "}else c+="
    "}c+="";var n={type:"container",html:c,onclick:function(a){var c=a.target;/^(TD|DIV)$/.test(c.nodeName)&&b(c).firstChild&&(g(tinymce.trim(c.innerText||c.textContent)),a.ctrlKey||h.close())},onmouseover:function(a){var c=b(a.target);c&&c.firstChild?(h.find("#preview").text(c.firstChild.firstChild.data),h.find("#previewTitle").text(c.title)):(h.find("#preview").text(" "),h.find("#previewTitle").text(" "))}};h=a.windowManager.open({title:"Special character",spacing:10,padding:10,items:[n,{type:"container",layout:"flex",direction:"column",align:"center",spacing:5,minWidth:160,minHeight:160,items:[{type:"label",name:"preview",text:" ",style:"font-size: 40px; text-align: center",border:1,minWidth:140,minHeight:80},{type:"label",name:"previewTitle",text:" ",style:"text-align: center",border:1,minWidth:140,minHeight:80}]}],buttons:[{text:"Close",onclick:function(){h.close()}}]})}var i=tinymce.util.Tools.isArray;return a.addCommand("mceShowCharmap",h),a.addButton("charmap",{icon:"charmap",tooltip:"Special character",cmd:"mceShowCharmap"}),a.addMenuItem("charmap",{icon:"charmap",text:"Special character",cmd:"mceShowCharmap",context:"insert"}),{getCharMap:f,insertChar:g}}); \ No newline at end of file diff --git a/public/js/plugins/code/plugin.min.js b/public/js/plugins/code/plugin.min.js new file mode 100644 index 00000000..d6331f87 --- /dev/null +++ b/public/js/plugins/code/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("code",function(a){function b(){var b=a.windowManager.open({title:"Source code",body:{type:"textbox",name:"code",multiline:!0,minWidth:a.getParam("code_dialog_width",600),minHeight:a.getParam("code_dialog_height",Math.min(tinymce.DOM.getViewPort().h-200,500)),spellcheck:!1,style:"direction: ltr; text-align: left"},onSubmit:function(b){a.focus(),a.undoManager.transact(function(){a.setContent(b.data.code)}),a.selection.setCursorLocation(),a.nodeChanged()}});b.find("#code").value(a.getContent({source_view:!0}))}a.addCommand("mceCodeEditor",b),a.addButton("code",{icon:"code",tooltip:"Source code",onclick:b}),a.addMenuItem("code",{icon:"code",text:"Source code",context:"tools",onclick:b})}); \ No newline at end of file diff --git a/public/js/plugins/codesample/css/prism.css b/public/js/plugins/codesample/css/prism.css new file mode 100644 index 00000000..28622b52 --- /dev/null +++ b/public/js/plugins/codesample/css/prism.css @@ -0,0 +1,138 @@ +/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript */ +/** + * prism.js default theme for JavaScript, CSS and HTML + * Based on dabblet (http://dabblet.com) + * @author Lea Verou + */ + +code[class*="language-"], +pre[class*="language-"] { + color: black; + text-shadow: 0 1px white; + font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + line-height: 1.5; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, +code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { + text-shadow: none; + background: #b3d4fc; +} + +pre[class*="language-"]::selection, pre[class*="language-"] ::selection, +code[class*="language-"]::selection, code[class*="language-"] ::selection { + text-shadow: none; + background: #b3d4fc; +} + +@media print { + code[class*="language-"], + pre[class*="language-"] { + text-shadow: none; + } +} + +/* Code blocks */ +pre[class*="language-"] { + padding: 1em; + margin: .5em 0; + overflow: auto; +} + +:not(pre) > code[class*="language-"], +pre[class*="language-"] { + background: #f5f2f0; +} + +/* Inline code */ +:not(pre) > code[class*="language-"] { + padding: .1em; + border-radius: .3em; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: slategray; +} + +.token.punctuation { + color: #999; +} + +.namespace { + opacity: .7; +} + +.token.property, +.token.tag, +.token.boolean, +.token.number, +.token.constant, +.token.symbol, +.token.deleted { + color: #905; +} + +.token.selector, +.token.attr-name, +.token.string, +.token.char, +.token.builtin, +.token.inserted { + color: #690; +} + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string { + color: #a67f59; + background: hsla(0, 0%, 100%, .5); +} + +.token.atrule, +.token.attr-value, +.token.keyword { + color: #07a; +} + +.token.function { + color: #DD4A68; +} + +.token.regex, +.token.important, +.token.variable { + color: #e90; +} + +.token.important, +.token.bold { + font-weight: bold; +} +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} + diff --git a/public/js/plugins/codesample/plugin.min.js b/public/js/plugins/codesample/plugin.min.js new file mode 100644 index 00000000..574fe6b9 --- /dev/null +++ b/public/js/plugins/codesample/plugin.min.js @@ -0,0 +1 @@ +!function(a,b){"use strict";function c(a,b){for(var c,d=[],f=0;fa.length)break a;if(!(q instanceof e)){k.lastIndex=0;var r=k.exec(q);if(r){m&&(n=r[1].length);var s=r.index-1+n,r=r[0].slice(n),t=r.length,u=s+t,v=q.slice(0,s+1),w=q.slice(u+1),x=[p,1];v&&x.push(v);var y=new e(h,l?c.tokenize(r,l):r,o);x.push(y),w&&x.push(w),Array.prototype.splice.apply(f,x)}}}}}return f},hooks:{all:{},add:function(a,b){var d=c.hooks.all;d[a]=d[a]||[],d[a].push(b)},run:function(a,b){var d=c.hooks.all[a];if(d&&d.length)for(var e,f=0;e=d[f++];)e(b)}}},d=c.Token=function(a,b,c){this.type=a,this.content=b,this.alias=c};return d.stringify=function(a,b,e){if("string"==typeof a)return a;if("Array"===c.util.type(a))return a.map(function(c){return d.stringify(c,b,a)}).join("");var f={type:a.type,content:d.stringify(a.content,b,e),tag:"span",classes:["token",a.type],attributes:{},language:b,parent:e};if("comment"==f.type&&(f.attributes.spellcheck="true"),a.alias){var g="Array"===c.util.type(a.alias)?a.alias:[a.alias];Array.prototype.push.apply(f.classes,g)}c.hooks.run("wrap",f);var h="";for(var i in f.attributes)h+=(h?" ":"")+i+'="'+(f.attributes[i]||"")+'"';return"<"+f.tag+' class="'+f.classes.join(" ")+'" '+h+">"+f.content+""},b.document?void 0:b.addEventListener?(b.addEventListener("message",function(a){var d=JSON.parse(a.data),e=d.language,f=d.code,g=d.immediateClose;b.postMessage(c.highlight(f,c.languages[e],e)),g&&b.close()},!1),b.Prism):b.Prism}();return"undefined"!=typeof module&&module.exports&&(module.exports=c),"undefined"!=typeof global&&(global.Prism=c),c.languages.markup={comment://,prolog:/<\?[\w\W]+?\?>/,doctype://,cdata://i,tag:{pattern:/<\/?[^\s>\/=.]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},c.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),c.languages.xml=c.languages.markup,c.languages.html=c.languages.markup,c.languages.mathml=c.languages.markup,c.languages.svg=c.languages.markup,c.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},c.languages.css.atrule.inside.rest=c.util.clone(c.languages.css),c.languages.markup&&(c.languages.insertBefore("markup","tag",{style:{pattern:/[\w\W]*?<\/style>/i,inside:{tag:{pattern:/|<\/style>/i,inside:c.languages.markup.tag.inside},rest:c.languages.css},alias:"language-css"}}),c.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:c.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:c.languages.css}},alias:"language-css"}},c.languages.markup.tag)),c.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/},c.languages.javascript=c.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i}),c.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[.+?]|\\.|[^\/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}}),c.languages.insertBefore("javascript","class-name",{"template-string":{pattern:/`(?:\\`|\\?[^`])*`/,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:c.languages.javascript}},string:/[\s\S]+/}}}),c.languages.markup&&c.languages.insertBefore("markup","tag",{script:{pattern:/[\w\W]*?<\/script>/i,inside:{tag:{pattern:/|<\/script>/i,inside:c.languages.markup.tag.inside},rest:c.languages.javascript},alias:"language-javascript"}}),c.languages.js=c.languages.javascript,c.languages.c=c.languages.extend("clike",{keyword:/\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,operator:/\-[>-]?|\+\+?|!=?|<>?=?|==?|&&?|\|?\||[~^%?*\/]/,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)[ful]*\b/i}),c.languages.insertBefore("c","string",{macro:{pattern:/(^\s*)#\s*[a-z]+([^\r\n\\]|\\.|\\(?:\r\n?|\n))*/im,lookbehind:!0,alias:"property",inside:{string:{pattern:/(#\s*include\s*)(<.+?>|("|')(\\?.)+?\3)/,lookbehind:!0}}}}),delete c.languages.c["class-name"],delete c.languages.c["boolean"],c.languages.csharp=c.languages.extend("clike",{keyword:/\b(abstract|as|async|await|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|override|params|private|protected|public|readonly|ref|return|sbyte|sealed|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|virtual|void|volatile|while|add|alias|ascending|async|await|descending|dynamic|from|get|global|group|into|join|let|orderby|partial|remove|select|set|value|var|where|yield)\b/,string:[/@("|')(\1\1|\\\1|\\?(?!\1)[\s\S])*\1/,/("|')(\\?.)*?\1/],number:/\b-?(0x[\da-f]+|\d*\.?\d+)\b/i}),c.languages.insertBefore("csharp","keyword",{preprocessor:{pattern:/(^\s*)#.*/m,lookbehind:!0}}),c.languages.cpp=c.languages.extend("c",{keyword:/\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,"boolean":/\b(true|false)\b/,operator:/[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/}),c.languages.insertBefore("cpp","keyword",{"class-name":{pattern:/(class\s+)[a-z0-9_]+/i,lookbehind:!0}}),c.languages.java=c.languages.extend("clike",{keyword:/\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/,number:/\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+(?:e[+-]?\d+)?[df]?\b/i,operator:{pattern:/(^|[^.])(?:\+[+=]?|-[-=]?|!=?|<>?>?=?|==?|&[&=]?|\|[|=]?|\*=?|\/=?|%=?|\^=?|[?:~])/m,lookbehind:!0}}),c.languages.php=c.languages.extend("clike",{keyword:/\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i,constant:/\b[A-Z0-9_]{2,}\b/,comment:{pattern:/(^|[^\\])(?:\/\*[\w\W]*?\*\/|\/\/.*)/,lookbehind:!0}}),c.languages.insertBefore("php","class-name",{"shell-comment":{pattern:/(^|[^\\])#.*/,lookbehind:!0,alias:"comment"}}),c.languages.insertBefore("php","keyword",{delimiter:/\?>|<\?(?:php)?/i,variable:/\$\w+\b/i,"package":{pattern:/(\\|namespace\s+|use\s+)[\w\\]+/,lookbehind:!0,inside:{punctuation:/\\/}}}),c.languages.insertBefore("php","operator",{property:{pattern:/(->)[\w]+/,lookbehind:!0}}),c.languages.markup&&(c.hooks.add("before-highlight",function(a){"php"===a.language&&(a.tokenStack=[],a.backupCode=a.code,a.code=a.code.replace(/(?:<\?php|<\?)[\w\W]*?(?:\?>)/gi,function(b){return a.tokenStack.push(b),"{{{PHP"+a.tokenStack.length+"}}}"}))}),c.hooks.add("before-insert",function(a){"php"===a.language&&(a.code=a.backupCode,delete a.backupCode)}),c.hooks.add("after-highlight",function(a){if("php"===a.language){for(var b,d=0;b=a.tokenStack[d];d++)a.highlightedCode=a.highlightedCode.replace("{{{PHP"+(d+1)+"}}}",c.highlight(b,a.grammar,"php").replace(/\$/g,"$$$$"));a.element.innerHTML=a.highlightedCode}}),c.hooks.add("wrap",function(a){"php"===a.language&&"markup"===a.type&&(a.content=a.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/g,'$1'))}),c.languages.insertBefore("php","comment",{markup:{pattern:/<[^?]\/?(.*?)>/,inside:c.languages.markup},php:/\{\{\{PHP[0-9]+\}\}\}/})),c.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0},string:/"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(?:\\?.)*?\1/,"function":{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_][a-zA-Z0-9_]*(?=\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)[a-z0-9_]+/i,lookbehind:!0},keyword:/\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/,"boolean":/\b(?:True|False)\b/,number:/\b-?(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,operator:/[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/,punctuation:/[{}[\];(),.:]/},function(a){a.languages.ruby=a.languages.extend("clike",{comment:/#(?!\{[^\r\n]*?\}).*/,keyword:/\b(alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/});var b={pattern:/#\{[^}]+\}/,inside:{delimiter:{pattern:/^#\{|\}$/,alias:"tag"},rest:a.util.clone(a.languages.ruby)}};a.languages.insertBefore("ruby","keyword",{regex:[{pattern:/%r([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1[gim]{0,3}/,inside:{interpolation:b}},{pattern:/%r\((?:[^()\\]|\\[\s\S])*\)[gim]{0,3}/,inside:{interpolation:b}},{pattern:/%r\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}[gim]{0,3}/,inside:{interpolation:b}},{pattern:/%r\[(?:[^\[\]\\]|\\[\s\S])*\][gim]{0,3}/,inside:{interpolation:b}},{pattern:/%r<(?:[^<>\\]|\\[\s\S])*>[gim]{0,3}/,inside:{interpolation:b}},{pattern:/(^|[^\/])\/(?!\/)(\[.+?]|\\.|[^\/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}],variable:/[@$]+[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/,symbol:/:[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/}),a.languages.insertBefore("ruby","number",{builtin:/\b(Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|File|Fixnum|Fload|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,constant:/\b[A-Z][a-zA-Z_0-9]*(?:[?!]|\b)/}),a.languages.ruby.string=[{pattern:/%[qQiIwWxs]?([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1/,inside:{interpolation:b}},{pattern:/%[qQiIwWxs]?\((?:[^()\\]|\\[\s\S])*\)/,inside:{interpolation:b}},{pattern:/%[qQiIwWxs]?\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/,inside:{interpolation:b}},{pattern:/%[qQiIwWxs]?\[(?:[^\[\]\\]|\\[\s\S])*\]/,inside:{interpolation:b}},{pattern:/%[qQiIwWxs]?<(?:[^<>\\]|\\[\s\S])*>/,inside:{interpolation:b}},{pattern:/("|')(#\{[^}]+\}|\\(?:\r?\n|\r)|\\?.)*?\1/,inside:{interpolation:b}}]}(c),c}),d("tinymce/codesampleplugin/Utils",[],function(){function a(a){return a&&"PRE"==a.nodeName&&-1!==a.className.indexOf("language-")}function b(a){return function(b,c){return a(c)}}return{isCodeSample:a,trimArg:b}}),d("tinymce/codesampleplugin/Dialog",["tinymce/dom/DOMUtils","tinymce/codesampleplugin/Utils","tinymce/codesampleplugin/Prism"],function(a,b,c){function d(a,b,d){a.undoManager.transact(function(){var f=e(a);d=h.encode(d),f?(a.dom.setAttrib(f,"class","language-"+b),f.innerHTML=d,c.highlightElement(f),a.selection.select(f)):(a.insertContent('

    '+d+"
    "),a.selection.select(a.$("#__new").removeAttr("id")[0]))})}function e(a){var c=a.selection.getNode();return b.isCodeSample(c)?c:null}function f(a){var b=e(a);return b?b.textContent:""}function g(a){var b,c=e(a);return c?(b=c.className.match(/language-(\w+)/),b?b[1]:""):""}var h=a.DOM,i=[{text:"HTML/XML",value:"markup"},{text:"JavaScript",value:"javascript"},{text:"CSS",value:"css"},{text:"PHP",value:"php"},{text:"Ruby",value:"ruby"},{text:"Python",value:"python"},{text:"Java",value:"java"},{text:"C",value:"c"},{text:"C#",value:"csharp"},{text:"C++",value:"cpp"}];return{open:function(a){a.windowManager.open({title:"Insert/Edit code sample",minWidth:Math.min(h.getViewPort().w,800),minHeight:Math.min(h.getViewPort().h,650),layout:"fit",body:[{type:"listbox",name:"language",label:"Language",maxWidth:200,value:g(a),values:i},{type:"textbox",name:"code",multiline:!0,spellcheck:!1,ariaLabel:"Code view",flex:1,style:"direction: ltr; text-align: left",classes:"monospace",value:f(a)}],onSubmit:function(b){d(a,b.data.language,b.data.code)}})}}}),d("tinymce/codesampleplugin/Plugin",["tinymce/Env","tinymce/PluginManager","tinymce/codesampleplugin/Prism","tinymce/codesampleplugin/Dialog","tinymce/codesampleplugin/Utils"],function(a,b,c,d,e){var f,g=e.trimArg;b.add("codesample",function(b,h){function i(){var a;f||(f=!0,a=b.dom.create("link",{rel:"stylesheet",href:h+"/css/prism.css"}),b.getDoc().getElementsByTagName("head")[0].appendChild(a))}var j=b.$;a.ceFalse&&(b.on("PreProcess",function(a){j("pre[contenteditable=false]",a.node).filter(g(e.isCodeSample)).each(function(a,b){var c=j(b),d=b.textContent;c.attr("class",j.trim(c.attr("class"))),c.removeAttr("contentEditable"),c.empty().append(j("").each(function(){this.textContent=d}))})}),b.on("SetContent",function(){var a=j("pre").filter(g(e.isCodeSample)).filter(function(a,b){return"false"!==b.contentEditable});a.length&&b.undoManager.transact(function(){a.each(function(a,d){j(d).find("br").each(function(a,c){c.parentNode.replaceChild(b.getDoc().createTextNode("\n"),c)}),d.contentEditable=!1,d.innerHTML=b.dom.encode(d.textContent),c.highlightElement(d),d.className=j.trim(d.className)})})}),b.addCommand("codesample",function(){d.open(b)}),b.addButton("codesample",{cmd:"codesample",title:"Insert/Edit code sample"}),b.on("init",i))})}),f(["tinymce/codesampleplugin/Prism","tinymce/codesampleplugin/Utils","tinymce/codesampleplugin/Dialog","tinymce/codesampleplugin/Plugin"])}(this); \ No newline at end of file diff --git a/public/js/plugins/colorpicker/plugin.min.js b/public/js/plugins/colorpicker/plugin.min.js new file mode 100644 index 00000000..66ea69c2 --- /dev/null +++ b/public/js/plugins/colorpicker/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("colorpicker",function(a){function b(b,c){function d(a){var b=new tinymce.util.Color(a),c=b.toRgb();f.fromJSON({r:c.r,g:c.g,b:c.b,hex:b.toHex().substr(1)}),e(b.toHex())}function e(a){f.find("#preview")[0].getEl().style.background=a}var f=a.windowManager.open({title:"Color",items:{type:"container",layout:"flex",direction:"row",align:"stretch",padding:5,spacing:10,items:[{type:"colorpicker",value:c,onchange:function(){var a=this.rgb();f&&(f.find("#r").value(a.r),f.find("#g").value(a.g),f.find("#b").value(a.b),f.find("#hex").value(this.value().substr(1)),e(this.value()))}},{type:"form",padding:0,labelGap:5,defaults:{type:"textbox",size:7,value:"0",flex:1,spellcheck:!1,onchange:function(){var a,b,c=f.find("colorpicker")[0];return a=this.name(),b=this.value(),"hex"==a?(b="#"+b,d(b),void c.value(b)):(b={r:f.find("#r").value(),g:f.find("#g").value(),b:f.find("#b").value()},c.value(b),void d(b))}},items:[{name:"r",label:"R",autofocus:1},{name:"g",label:"G"},{name:"b",label:"B"},{name:"hex",label:"#",value:"000000"},{name:"preview",type:"container",border:1}]}]},onSubmit:function(){b("#"+this.toJSON().hex)}});d(c)}a.settings.color_picker_callback||(a.settings.color_picker_callback=b)}); \ No newline at end of file diff --git a/public/js/plugins/contextmenu/plugin.min.js b/public/js/plugins/contextmenu/plugin.min.js new file mode 100644 index 00000000..c25e98b2 --- /dev/null +++ b/public/js/plugins/contextmenu/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("contextmenu",function(a){var b,c=a.settings.contextmenu_never_use_native;a.on("contextmenu",function(d){var e,f=a.getDoc();if(!d.ctrlKey||c){if(d.preventDefault(),tinymce.Env.mac&&tinymce.Env.webkit&&2==d.button&&f.caretRangeFromPoint&&a.selection.setRng(f.caretRangeFromPoint(d.x,d.y)),e=a.settings.contextmenu||"link image inserttable | cell row column deletetable",b)b.show();else{var g=[];tinymce.each(e.split(/[ ,]/),function(b){var c=a.menuItems[b];"|"==b&&(c={text:b}),c&&(c.shortcut="",g.push(c))});for(var h=0;h'}),a+=""}),a+=""}var d=[["cool","cry","embarassed","foot-in-mouth"],["frown","innocent","kiss","laughing"],["money-mouth","sealed","smile","surprised"],["tongue-out","undecided","wink","yell"]];a.addButton("emoticons",{type:"panelbutton",panel:{role:"application",autohide:!0,html:c,onclick:function(b){var c=a.dom.getParent(b.target,"a");c&&(a.insertContent(''+c.getAttribute('),this.hide())}},tooltip:"Emoticons"})}); \ No newline at end of file diff --git a/public/js/plugins/example/dialog.html b/public/js/plugins/example/dialog.html new file mode 100644 index 00000000..565f06f5 --- /dev/null +++ b/public/js/plugins/example/dialog.html @@ -0,0 +1,8 @@ + + + +

    Custom dialog

    + Input some text: + + + \ No newline at end of file diff --git a/public/js/plugins/example/plugin.min.js b/public/js/plugins/example/plugin.min.js new file mode 100644 index 00000000..88687c7d --- /dev/null +++ b/public/js/plugins/example/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("example",function(a,b){a.addButton("example",{text:"My button",icon:!1,onclick:function(){a.windowManager.open({title:"Example plugin",body:[{type:"textbox",name:"title",label:"Title"}],onsubmit:function(b){a.insertContent("Title: "+b.data.title)}})}}),a.addMenuItem("example",{text:"Example plugin",context:"tools",onclick:function(){a.windowManager.open({title:"TinyMCE site",url:b+"/dialog.html",width:600,height:400,buttons:[{text:"Insert",onclick:function(){var b=a.windowManager.getWindows()[0];a.insertContent(b.getContentWindow().document.getElementById("content").value),b.close()}},{text:"Close",onclick:"close"}]})}})}); \ No newline at end of file diff --git a/public/js/plugins/example_dependency/plugin.min.js b/public/js/plugins/example_dependency/plugin.min.js new file mode 100644 index 00000000..e61bf473 --- /dev/null +++ b/public/js/plugins/example_dependency/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("example_dependency",function(){},["example"]); \ No newline at end of file diff --git a/public/js/plugins/fullpage/plugin.min.js b/public/js/plugins/fullpage/plugin.min.js new file mode 100644 index 00000000..1ea5c360 --- /dev/null +++ b/public/js/plugins/fullpage/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("fullpage",function(a){function b(){var b=c();a.windowManager.open({title:"Document properties",data:b,defaults:{type:"textbox",size:40},body:[{name:"title",label:"Title"},{name:"keywords",label:"Keywords"},{name:"description",label:"Description"},{name:"robots",label:"Robots"},{name:"author",label:"Author"},{name:"docencoding",label:"Encoding"}],onSubmit:function(a){d(tinymce.extend(b,a.data))}})}function c(){function b(a,b){var c=a.attr(b);return c||""}var c,d,f=e(),g={};return g.fontface=a.getParam("fullpage_default_fontface",""),g.fontsize=a.getParam("fullpage_default_fontsize",""),c=f.firstChild,7==c.type&&(g.xml_pi=!0,d=/encoding="([^"]+)"/.exec(c.value),d&&(g.docencoding=d[1])),c=f.getAll("#doctype")[0],c&&(g.doctype=""),c=f.getAll("title")[0],c&&c.firstChild&&(g.title=c.firstChild.value),k(f.getAll("meta"),function(a){var b,c=a.attr("name"),d=a.attr("http-equiv");c?g[c.toLowerCase()]=a.attr("content"):"Content-Type"==d&&(b=/charset\s*=\s*(.*)\s*/gi.exec(a.attr("content")),b&&(g.docencoding=b[1]))}),c=f.getAll("html")[0],c&&(g.langcode=b(c,"lang")||b(c,"xml:lang")),g.stylesheets=[],tinymce.each(f.getAll("link"),function(a){"stylesheet"==a.attr("rel")&&g.stylesheets.push(a.attr("href"))}),c=f.getAll("body")[0],c&&(g.langdir=b(c,"dir"),g.style=b(c,"style"),g.visited_color=b(c,"vlink"),g.link_color=b(c,"link"),g.active_color=b(c,"alink")),g}function d(b){function c(a,b,c){a.attr(b,c?c:void 0)}function d(a){g.firstChild?g.insert(a,g.firstChild):g.append(a)}var f,g,h,j,m,n=a.dom;f=e(),g=f.getAll("head")[0],g||(j=f.getAll("html")[0],g=new l("head",1),j.firstChild?j.insert(g,j.firstChild,!0):j.append(g)),j=f.firstChild,b.xml_pi?(m='version="1.0"',b.docencoding&&(m+=' encoding="'+b.docencoding+'"'),7!=j.type&&(j=new l("xml",7),f.insert(j,f.firstChild,!0)),j.value=m):j&&7==j.type&&j.remove(),j=f.getAll("#doctype")[0],b.doctype?(j||(j=new l("#doctype",10),b.xml_pi?f.insert(j,f.firstChild):d(j)),j.value=b.doctype.substring(9,b.doctype.length-1)):j&&j.remove(),j=null,k(f.getAll("meta"),function(a){"Content-Type"==a.attr("http-equiv")&&(j=a)}),b.docencoding?(j||(j=new l("meta",1),j.attr("http-equiv","Content-Type"),j.shortEnded=!0,d(j)),j.attr("content","text/html; charset="+b.docencoding)):j&&j.remove(),j=f.getAll("title")[0],b.title?(j?j.empty():(j=new l("title",1),d(j)),j.append(new l("#text",3)).value=b.title):j&&j.remove(),k("keywords,description,author,copyright,robots".split(","),function(a){var c,e,g=f.getAll("meta"),h=b[a];for(c=0;c"))}function e(){return new tinymce.html.DomParser({validate:!1,root_name:"#document"}).parse(i)}function f(b){function c(a){return a.replace(/<\/?[A-Z]+/g,function(a){return a.toLowerCase()})}var d,f,h,l,m=b.content,n="",o=a.dom;if(!b.selection&&!("raw"==b.format&&i||b.source_view&&a.getParam("fullpage_hide_in_source_view"))){0!==m.length||b.source_view||(m=tinymce.trim(i)+"\n"+tinymce.trim(m)+"\n"+tinymce.trim(j)),m=m.replace(/<(\/?)BODY/gi,"<$1body"),d=m.indexOf("",d),i=c(m.substring(0,d+1)),f=m.indexOf("\n"),h=e(),k(h.getAll("style"),function(a){a.firstChild&&(n+=a.firstChild.value)}),l=h.getAll("body")[0],l&&o.setAttribs(a.getBody(),{style:l.attr("style")||"",dir:l.attr("dir")||"",vLink:l.attr("vlink")||"",link:l.attr("link")||"",aLink:l.attr("alink")||""}),o.remove("fullpage_styles");var p=a.getDoc().getElementsByTagName("head")[0];n&&(o.add(p,"style",{id:"fullpage_styles"},n),l=o.get("fullpage_styles"),l.styleSheet&&(l.styleSheet.cssText=n));var q={};tinymce.each(p.getElementsByTagName("link"),function(a){"stylesheet"==a.rel&&a.getAttribute("data-mce-fullpage")&&(q[a.href]=a)}),tinymce.each(h.getAll("link"),function(a){var b=a.attr("href");q[b]||"stylesheet"!=a.attr("rel")||o.add(p,"link",{rel:"stylesheet",text:"text/css",href:b,"data-mce-fullpage":"1"}),delete q[b]}),tinymce.each(q,function(a){a.parentNode.removeChild(a)})}}function g(){var b,c="",d="";return a.getParam("fullpage_default_xml_pi")&&(c+='\n'),c+=a.getParam("fullpage_default_doctype",""),c+="\n\n\n",(b=a.getParam("fullpage_default_title"))&&(c+=""+b+"\n"),(b=a.getParam("fullpage_default_encoding"))&&(c+='\n'),(b=a.getParam("fullpage_default_font_family"))&&(d+="font-family: "+b+";"),(b=a.getParam("fullpage_default_font_size"))&&(d+="font-size: "+b+";"),(b=a.getParam("fullpage_default_text_color"))&&(d+="color: "+b+";"),c+="\n\n"}function h(b){b.selection||b.source_view&&a.getParam("fullpage_hide_in_source_view")||(b.content=tinymce.trim(i)+"\n"+tinymce.trim(b.content)+"\n"+tinymce.trim(j))}var i,j,k=tinymce.each,l=tinymce.html.Node;a.addCommand("mceFullPageProperties",b),a.addButton("fullpage",{title:"Document properties",cmd:"mceFullPageProperties"}),a.addMenuItem("fullpage",{text:"Document properties",cmd:"mceFullPageProperties",context:"file"}),a.on("BeforeSetContent",f),a.on("GetContent",h)}); \ No newline at end of file diff --git a/public/js/plugins/fullscreen/plugin.min.js b/public/js/plugins/fullscreen/plugin.min.js new file mode 100644 index 00000000..841d633f --- /dev/null +++ b/public/js/plugins/fullscreen/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("fullscreen",function(a){function b(){var a,b,c=window,d=document,e=d.body;return e.offsetWidth&&(a=e.offsetWidth,b=e.offsetHeight),c.innerWidth&&c.innerHeight&&(a=c.innerWidth,b=c.innerHeight),{w:a,h:b}}function c(){var a=tinymce.DOM.getViewPort();return{x:a.x,y:a.y}}function d(a){scrollTo(a.x,a.y)}function e(){function e(){m.setStyle(p,"height",b().h-(o.clientHeight-p.clientHeight))}var n,o,p,q,r=document.body,s=document.documentElement;l=!l,o=a.getContainer(),n=o.style,p=a.getContentAreaContainer().firstChild,q=p.style,l?(k=c(),f=q.width,g=q.height,q.width=q.height="100%",i=n.width,j=n.height,n.width=n.height="",m.addClass(r,"mce-fullscreen"),m.addClass(s,"mce-fullscreen"),m.addClass(o,"mce-fullscreen"),m.bind(window,"resize",e),e(),h=e):(q.width=f,q.height=g,i&&(n.width=i),j&&(n.height=j),m.removeClass(r,"mce-fullscreen"),m.removeClass(s,"mce-fullscreen"),m.removeClass(o,"mce-fullscreen"),m.unbind(window,"resize",h),d(k)),a.fire("FullscreenStateChanged",{state:l})}var f,g,h,i,j,k,l=!1,m=tinymce.DOM;return a.settings.inline?void 0:(a.on("init",function(){a.addShortcut("Meta+Alt+F","",e)}),a.on("remove",function(){h&&m.unbind(window,"resize",h)}),a.addCommand("mceFullScreen",e),a.addMenuItem("fullscreen",{text:"Fullscreen",shortcut:"Meta+Alt+F",selectable:!0,onClick:function(){e(),a.focus()},onPostRender:function(){var b=this;a.on("FullscreenStateChanged",function(a){b.active(a.state)})},context:"view"}),a.addButton("fullscreen",{tooltip:"Fullscreen",shortcut:"Meta+Alt+F",onClick:e,onPostRender:function(){var b=this;a.on("FullscreenStateChanged",function(a){b.active(a.state)})}}),{isFullscreen:function(){return l}})}); \ No newline at end of file diff --git a/public/js/plugins/hr/plugin.min.js b/public/js/plugins/hr/plugin.min.js new file mode 100644 index 00000000..25abb0c1 --- /dev/null +++ b/public/js/plugins/hr/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("hr",function(a){a.addCommand("InsertHorizontalRule",function(){a.execCommand("mceInsertContent",!1,"
    ")}),a.addButton("hr",{icon:"hr",tooltip:"Horizontal line",cmd:"InsertHorizontalRule"}),a.addMenuItem("hr",{icon:"hr",text:"Horizontal line",cmd:"InsertHorizontalRule",context:"insert"})}); \ No newline at end of file diff --git a/public/js/plugins/image/plugin.min.js b/public/js/plugins/image/plugin.min.js new file mode 100644 index 00000000..90de1a41 --- /dev/null +++ b/public/js/plugins/image/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("image",function(a){function b(a,b){function c(a,c){d.parentNode&&d.parentNode.removeChild(d),b({width:a,height:c})}var d=document.createElement("img");d.onload=function(){c(Math.max(d.width,d.clientWidth),Math.max(d.height,d.clientHeight))},d.onerror=function(){c()};var e=d.style;e.visibility="hidden",e.position="fixed",e.bottom=e.left=0,e.width=e.height="auto",document.body.appendChild(d),d.src=a}function c(a,b,c){function d(a,c){return c=c||[],tinymce.each(a,function(a){var e={text:a.text||a.title};a.menu?e.menu=d(a.menu):(e.value=a.value,b(e)),c.push(e)}),c}return d(a,c||[])}function d(b){return function(){var c=a.settings.image_list;"string"==typeof c?tinymce.util.XHR.send({url:c,success:function(a){b(tinymce.util.JSON.parse(a))}}):"function"==typeof c?c(b):b(c)}}function e(d){function e(){var a,b,c,d;a=l.find("#width")[0],b=l.find("#height")[0],a&&b&&(c=a.value(),d=b.value(),l.find("#constrain")[0].checked()&&o&&p&&c&&d&&(o!=c?(d=Math.round(c/o*d),isNaN(d)||b.value(d)):(c=Math.round(d/p*c),isNaN(c)||a.value(c))),o=c,p=d)}function f(){function b(b){function c(){b.onload=b.onerror=null,a.selection&&(a.selection.select(b),a.nodeChanged())}b.onload=function(){s.width||s.height||!u||t.setAttribs(b,{width:b.clientWidth,height:b.clientHeight}),c()},b.onerror=c}var c,d;j(),e(),s=tinymce.extend(s,l.toJSON()),s.alt||(s.alt=""),s.title||(s.title=""),""===s.width&&(s.width=null),""===s.height&&(s.height=null),s.style||(s.style=null),s={src:s.src,alt:s.alt,title:s.title,width:s.width,height:s.height,style:s.style,caption:s.caption,"class":s["class"]},a.undoManager.transact(function(){function e(b){return a.schema.getTextBlockElements()[b.nodeName]}if(!s.src)return void(m&&(t.remove(m),a.focus(),a.nodeChanged()));if(""===s.title&&(s.title=null),m?t.setAttribs(m,s):(s.id="__mcenew",a.focus(),a.selection.setContent(t.createHTML("img",s)),m=t.get("__mcenew"),t.setAttrib(m,"id",null)),a.editorUpload.uploadImagesAuto(),s.caption===!1&&t.is(m.parentNode,"figure.image")&&(c=m.parentNode,t.insertAfter(m,c),t.remove(c)),s.caption!==!0)b(m);else if(!t.is(m.parentNode,"figure.image")){d=m,m=m.cloneNode(!0),c=t.create("figure",{"class":"image"}),c.appendChild(m),c.appendChild(t.create("figcaption",{contentEditable:!0},"Caption")),c.contentEditable=!1;var f=t.getParent(d,e);f?t.split(f,d,c):t.replace(c,d),a.selection.select(c)}})}function g(a){return a&&(a=a.replace(/px$/,"")),a}function h(c){var d,e,f,g=c.meta||{};q&&q.value(a.convertURL(this.value(),"src")),tinymce.each(g,function(a,b){l.find("#"+b).value(a)}),g.width||g.height||(d=a.convertURL(this.value(),"src"),e=a.settings.image_prepend_url,f=new RegExp("^(?:[a-z]+:)?//","i"),e&&!f.test(d)&&d.substring(0,e.length)!==e&&(d=e+d),this.value(d),b(a.documentBaseURI.toAbsolute(this.value()),function(a){a.width&&a.height&&u&&(o=a.width,p=a.height,l.find("#width").value(o),l.find("#height").value(p))}))}function i(a){if(a.margin){var b=a.margin.split(" ");switch(b.length){case 1:a["margin-top"]=a["margin-top"]||b[0],a["margin-right"]=a["margin-right"]||b[0],a["margin-bottom"]=a["margin-bottom"]||b[0],a["margin-left"]=a["margin-left"]||b[0];break;case 2:a["margin-top"]=a["margin-top"]||b[0],a["margin-right"]=a["margin-right"]||b[1],a["margin-bottom"]=a["margin-bottom"]||b[0],a["margin-left"]=a["margin-left"]||b[1];break;case 3:a["margin-top"]=a["margin-top"]||b[0],a["margin-right"]=a["margin-right"]||b[1],a["margin-bottom"]=a["margin-bottom"]||b[2],a["margin-left"]=a["margin-left"]||b[1];break;case 4:a["margin-top"]=a["margin-top"]||b[0],a["margin-right"]=a["margin-right"]||b[1],a["margin-bottom"]=a["margin-bottom"]||b[2],a["margin-left"]=a["margin-left"]||b[3]}delete a.margin}return a}function j(){function b(a){return a.length>0&&/^[0-9]+$/.test(a)&&(a+="px"),a}if(a.settings.image_advtab){var c=l.toJSON(),d=t.parseStyle(c.style);d=i(d),c.vspace&&(d["margin-top"]=d["margin-bottom"]=b(c.vspace)),c.hspace&&(d["margin-left"]=d["margin-right"]=b(c.hspace)),c.border&&(d["border-width"]=b(c.border)),l.find("#style").value(t.serializeStyle(t.parseStyle(t.serializeStyle(d))))}}function k(){if(a.settings.image_advtab){var b=l.toJSON(),c=t.parseStyle(b.style);l.find("#vspace").value(""),l.find("#hspace").value(""),c=i(c),(c["margin-top"]&&c["margin-bottom"]||c["margin-right"]&&c["margin-left"])&&(c["margin-top"]===c["margin-bottom"]?l.find("#vspace").value(g(c["margin-top"])):l.find("#vspace").value(""),c["margin-right"]===c["margin-left"]?l.find("#hspace").value(g(c["margin-right"])):l.find("#hspace").value("")),c["border-width"]&&l.find("#border").value(g(c["border-width"])),l.find("#style").value(t.serializeStyle(t.parseStyle(t.serializeStyle(c))))}}var l,m,n,o,p,q,r,s={},t=a.dom,u=a.settings.image_dimensions!==!1;m=a.selection.getNode(),n=t.getParent(m,"figure.image"),n&&(m=t.select("img",n)[0]),m&&("IMG"!=m.nodeName||m.getAttribute("data-mce-object")||m.getAttribute("data-mce-placeholder"))&&(m=null),m&&(o=t.getAttrib(m,"width"),p=t.getAttrib(m,"height"),s={src:t.getAttrib(m,"src"),alt:t.getAttrib(m,"alt"),title:t.getAttrib(m,"title"),"class":t.getAttrib(m,"class"),width:o,height:p,caption:!!n}),d&&(q={type:"listbox",label:"Image list",values:c(d,function(b){b.value=a.convertURL(b.value||b.url,"src")},[{text:"None",value:""}]),value:s.src&&a.convertURL(s.src,"src"),onselect:function(a){var b=l.find("#alt");(!b.value()||a.lastControl&&b.value()==a.lastControl.text())&&b.value(a.control.text()),l.find("#src").value(a.control.value()).fire("change")},onPostRender:function(){q=this}}),a.settings.image_class_list&&(r={name:"class",type:"listbox",label:"Class",values:c(a.settings.image_class_list,function(b){b.value&&(b.textStyle=function(){return a.formatter.getCssText({inline:"img",classes:[b.value]})})})});var v=[{name:"src",type:"filepicker",filetype:"image",label:"Source",autofocus:!0,onchange:h},q];a.settings.image_description!==!1&&v.push({name:"alt",type:"textbox",label:"Image description"}),a.settings.image_title&&v.push({name:"title",type:"textbox",label:"Image Title"}),u&&v.push({type:"container",label:"Dimensions",layout:"flex",direction:"row",align:"center",spacing:5,items:[{name:"width",type:"textbox",maxLength:5,size:3,onchange:e,ariaLabel:"Width"},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:5,size:3,onchange:e,ariaLabel:"Height"},{name:"constrain",type:"checkbox",checked:!0,text:"Constrain proportions"}]}),v.push(r),a.settings.image_caption&&tinymce.Env.ceFalse&&v.push({name:"caption",type:"checkbox",label:"Caption"}),a.settings.image_advtab?(m&&(m.style.marginLeft&&m.style.marginRight&&m.style.marginLeft===m.style.marginRight&&(s.hspace=g(m.style.marginLeft)),m.style.marginTop&&m.style.marginBottom&&m.style.marginTop===m.style.marginBottom&&(s.vspace=g(m.style.marginTop)),m.style.borderWidth&&(s.border=g(m.style.borderWidth)),s.style=a.dom.serializeStyle(a.dom.parseStyle(a.dom.getAttrib(m,"style")))),l=a.windowManager.open({title:"Insert/edit image",data:s,bodyType:"tabpanel",body:[{title:"General",type:"form",items:v},{title:"Advanced",type:"form",pack:"start",items:[{label:"Style",name:"style",type:"textbox",onchange:k},{type:"form",layout:"grid",packV:"start",columns:2,padding:0,alignH:["left","right"],defaults:{type:"textbox",maxWidth:50,onchange:j},items:[{label:"Vertical space",name:"vspace"},{label:"Horizontal space",name:"hspace"},{label:"Border",name:"border"}]}]}],onSubmit:f})):l=a.windowManager.open({title:"Insert/edit image",data:s,body:v,onSubmit:f})}a.on("preInit",function(){function b(a){var b=a.attr("class");return b&&/\bimage\b/.test(b)}function c(a){return function(c){function d(b){b.attr("contenteditable",a?"true":null)}for(var e,f=c.length;f--;)e=c[f],b(e)&&(e.attr("contenteditable",a?"false":null),tinymce.each(e.getAll("figcaption"),d))}}a.parser.addNodeFilter("figure",c(!0)),a.serializer.addNodeFilter("figure",c(!1))}),a.addButton("image",{icon:"image",tooltip:"Insert/edit image",onclick:d(e),stateSelector:"img:not([data-mce-object],[data-mce-placeholder]),figure.image"}),a.addMenuItem("image",{icon:"image",text:"Insert/edit image",onclick:d(e),context:"insert",prependToContext:!0}),a.addCommand("mceImage",d(e))}); \ No newline at end of file diff --git a/public/js/plugins/imagetools/plugin.min.js b/public/js/plugins/imagetools/plugin.min.js new file mode 100644 index 00000000..6a29b2aa --- /dev/null +++ b/public/js/plugins/imagetools/plugin.min.js @@ -0,0 +1 @@ +!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;g>i;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;c>f;++f)e.push(d(a[f]));b.apply(null,b)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("1",tinymce.PluginManager),h("2",tinymce.Env),h("3",tinymce.util.Promise),h("4",tinymce.util.URI),h("5",tinymce.util.Tools),h("6",tinymce.util.Delay),g("j",[],function(){function a(a,b){return c(document.createElement("canvas"),a,b)}function b(a){return a.getContext("2d")}function c(a,b,c){return a.width=b,a.height=c,a}return{create:a,resize:c,get2dContext:b}}),g("k",[],function(){function a(a){return a.naturalWidth||a.width}function b(a){return a.naturalHeight||a.height}return{getWidth:a,getHeight:b}}),g("l",[],function(){function a(a,b){return function(){a.apply(b,arguments)}}function b(b){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof b)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],h(b,a(d,this),a(e,this))}function c(a){var b=this;return null===this._state?void this._deferreds.push(a):void i(function(){var c=b._state?a.onFulfilled:a.onRejected;if(null===c)return void(b._state?a.resolve:a.reject)(b._value);var d;try{d=c(b._value)}catch(e){return void a.reject(e)}a.resolve(d)})}function d(b){try{if(b===this)throw new TypeError("A promise cannot be resolved with itself.");if(b&&("object"==typeof b||"function"==typeof b)){var c=b.then;if("function"==typeof c)return void h(a(c,b),a(d,this),a(e,this))}this._state=!0,this._value=b,f.call(this)}catch(g){e.call(this,g)}}function e(a){this._state=!1,this._value=a,f.call(this)}function f(){for(var a=0,b=this._deferreds.length;b>a;a++)c.call(this,this._deferreds[a]);this._deferreds=null}function g(a,b,c,d){this.onFulfilled="function"==typeof a?a:null,this.onRejected="function"==typeof b?b:null,this.resolve=c,this.reject=d}function h(a,b,c){var d=!1;try{a(function(a){d||(d=!0,b(a))},function(a){d||(d=!0,c(a))})}catch(e){if(d)return;d=!0,c(e)}}if(window.Promise)return window.Promise;var i=b.immediateFn||"function"==typeof setImmediate&&setImmediate||function(a){setTimeout(a,1)},j=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};return b.prototype["catch"]=function(a){return this.then(null,a)},b.prototype.then=function(a,d){var e=this;return new b(function(b,f){c.call(e,new g(a,d,b,f))})},b.all=function(){var a=Array.prototype.slice.call(1===arguments.length&&j(arguments[0])?arguments[0]:arguments);return new b(function(b,c){function d(f,g){try{if(g&&("object"==typeof g||"function"==typeof g)){var h=g.then;if("function"==typeof h)return void h.call(g,function(a){d(f,a)},c)}a[f]=g,0===--e&&b(a)}catch(i){c(i)}}if(0===a.length)return b([]);for(var e=a.length,f=0;fd;d++)a[d].then(b,c)})},b}),g("m",[],function(){function a(a){var b=document.createElement("a");return b.href=a,b.pathname}function b(b){var c=a(b).split("."),d=c[c.length-1],e={jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png"};return d&&(d=d.toLowerCase()),e[d]}return{guessMimeType:b}}),g("c",["l","j","m","k"],function(a,b,c,d){function e(b){return new a(function(a){function c(){b.removeEventListener("load",c),a(b)}b.complete?a(b):b.addEventListener("load",c)})}function f(a){return e(a).then(function(a){var c,e;return e=b.create(d.getWidth(a),d.getHeight(a)),c=b.get2dContext(e),c.drawImage(a,0,0),e})}function g(a){return e(a).then(function(a){var b=a.src;return 0===b.indexOf("blob:")?i(b):0===b.indexOf("data:")?j(b):f(a).then(function(a){return j(a.toDataURL(c.guessMimeType(b)))})})}function h(b){return new a(function(a){function c(){d.removeEventListener("load",c),a(d)}var d=new Image;d.addEventListener("load",c),d.src=URL.createObjectURL(b),d.complete&&c()})}function i(b){return new a(function(a){var c=new XMLHttpRequest;c.open("GET",b,!0),c.responseType="blob",c.onload=function(){200==this.status&&a(this.response)},c.send()})}function j(b){return new a(function(a){var c,d,e,f,g,h;if(b=b.split(","),f=/data:([^;]+)/.exec(b[0]),f&&(g=f[1]),c=atob(b[1]),window.WebKitBlobBuilder){for(h=new WebKitBlobBuilder,d=new ArrayBuffer(c.length),e=0;ec?a=c:b>a&&(a=b),a}function b(){return[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1]}function c(a,b){var c,d,e,f,g=[],h=new Array(10);for(c=0;5>c;c++){for(d=0;5>d;d++)g[d]=b[d+5*c];for(d=0;5>d;d++){for(f=0,e=0;5>e;e++)f+=a[d+5*e]*g[e];h[d+5*c]=f}}return h}function d(b,c){return c=a(c,0,1),b.map(function(b,d){return d%6===0?b=1-(1-b)*c:b*=c,a(b,0,1)})}function e(b,d){var e;return d=a(d,-1,1),d*=100,0>d?e=127+d/100*127:(e=d%1,e=0===e?l[d]:l[Math.floor(d)]*(1-e)+l[Math.floor(d)+1]*e,e=127*e+127),c(b,[e/127,0,0,0,.5*(127-e),0,e/127,0,0,.5*(127-e),0,0,e/127,0,.5*(127-e),0,0,0,1,0,0,0,0,0,1])}function f(b,d){var e,f,g,h;return d=a(d,-1,1),e=1+(d>0?3*d:d),f=.3086,g=.6094,h=.082,c(b,[f*(1-e)+e,g*(1-e),h*(1-e),0,0,f*(1-e),g*(1-e)+e,h*(1-e),0,0,f*(1-e),g*(1-e),h*(1-e)+e,0,0,0,0,0,1,0,0,0,0,0,1])}function g(b,d){var e,f,g,h,i;return d=a(d,-180,180)/180*Math.PI,e=Math.cos(d),f=Math.sin(d),g=.213,h=.715,i=.072,c(b,[g+e*(1-g)+f*-g,h+e*-h+f*-h,i+e*-i+f*(1-i),0,0,g+e*-g+.143*f,h+e*(1-h)+.14*f,i+e*-i+f*-.283,0,0,g+e*-g+f*-(1-g),h+e*-h+f*h,i+e*(1-i)+f*i,0,0,0,0,0,1,0,0,0,0,0,1])}function h(b,d){return d=a(255*d,-255,255),c(b,[1,0,0,0,d,0,1,0,0,d,0,0,1,0,d,0,0,0,1,0,0,0,0,0,1])}function i(b,d,e,f){return d=a(d,0,2),e=a(e,0,2),f=a(f,0,2),c(b,[d,0,0,0,0,0,e,0,0,0,0,0,f,0,0,0,0,0,1,0,0,0,0,0,1])}function j(b,e){return e=a(e,0,1),c(b,d([.393,.769,.189,0,0,.349,.686,.168,0,0,.272,.534,.131,0,0,0,0,0,1,0,0,0,0,0,1],e))}function k(b,e){return e=a(e,0,1),c(b,d([.33,.34,.33,0,0,.33,.34,.33,0,0,.33,.34,.33,0,0,0,0,0,1,0,0,0,0,0,1],e))}var l=[0,.01,.02,.04,.05,.06,.07,.08,.1,.11,.12,.14,.15,.16,.17,.18,.2,.21,.22,.24,.25,.27,.28,.3,.32,.34,.36,.38,.4,.42,.44,.46,.48,.5,.53,.56,.59,.62,.65,.68,.71,.74,.77,.8,.83,.86,.89,.92,.95,.98,1,1.06,1.12,1.18,1.24,1.3,1.36,1.42,1.48,1.54,1.6,1.66,1.72,1.78,1.84,1.9,1.96,2,2.12,2.25,2.37,2.5,2.62,2.75,2.87,3,3.2,3.4,3.6,3.8,4,4.3,4.7,4.9,5,5.5,6,6.5,6.8,7,7.3,7.5,7.8,8,8.4,8.7,9,9.4,9.6,9.8,10];return{identity:b,adjust:d,multiply:c,adjustContrast:e,adjustBrightness:h,adjustSaturation:f,adjustHue:g,adjustColors:i,adjustSepia:j,adjustGrayscale:k}}),g("a",["j","k","c","n"],function(a,b,c,d){function e(d,e){return c.blobToImage(d).then(function(d){function f(a,b){var c,d,e,f,g,h=a.data,i=b[0],j=b[1],k=b[2],l=b[3],m=b[4],n=b[5],o=b[6],p=b[7],q=b[8],r=b[9],s=b[10],t=b[11],u=b[12],v=b[13],w=b[14],x=b[15],y=b[16],z=b[17],A=b[18],B=b[19];for(g=0;gc?a=c:b>a&&(a=b),a}var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;for(g=Math.round(Math.sqrt(c.length)),h=Math.floor(g/2),e=a.data,f=b.data,t=a.width,u=a.height,j=0;u>j;j++)for(i=0;t>i;i++){for(k=l=m=0,o=0;g>o;o++)for(n=0;g>n;n++)p=d(i+n-h,0,t-1),q=d(j+o-h,0,u-1),r=4*(q*t+p),s=c[o*g+n],k+=e[r]*s,l+=e[r+1]*s,m+=e[r+2]*s;r=4*(j*t+i),f[r]=d(k,0,255),f[r+1]=d(l,0,255),f[r+2]=d(m,0,255)}return b}var g,h,i=a.create(b.getWidth(d),b.getHeight(d)),j=a.get2dContext(i);return j.drawImage(d,0,0),k(d),g=j.getImageData(0,0,i.width,i.height),h=j.getImageData(0,0,i.width,i.height),h=f(g,h,e),j.putImageData(h,0,0),c.canvasToBlob(i)})}function g(d){return function(e,f){return c.blobToImage(e).then(function(e){function g(a,b){var c,d=a.data;for(c=0;ce?360+e:e,90!=e&&270!=e||b.resize(g,g.height,g.width),90!=e&&180!=e||(j=g.width),270!=e&&180!=e||(k=g.height),i.translate(j,k),i.rotate(e*Math.PI/180),i.drawImage(f,0,0),h(f),a.canvasToBlob(g,d.type)})}function e(d,e){return a.blobToImage(d).then(function(d){var f=b.create(c.getWidth(d),c.getHeight(d)),g=b.get2dContext(f);return"v"==e?(g.scale(1,-1),g.drawImage(d,0,-f.height)):(g.scale(-1,1),g.drawImage(d,-f.width,0)),h(d),a.canvasToBlob(f)})}function f(c,d,e,f,g){return a.blobToImage(c).then(function(c){var i=b.create(f,g),j=b.get2dContext(i);return j.drawImage(c,-d,-e),h(c),a.canvasToBlob(i)})}function g(c,d,e){return a.blobToImage(c).then(function(f){var g=b.create(d,e),i=b.get2dContext(g);return i.drawImage(f,0,0,d,e),h(f),a.canvasToBlob(g,c.type)})}var h=a.revokeImageUrl;return{rotate:d,flip:e,crop:f,resize:g}}),g("7",["a","b"],function(a,b){var c=function(b){return a.invert(b)},d=function(b){return a.sharpen(b)},e=function(b){return a.emboss(b)},f=function(b,c){return a.gamma(b,c)},g=function(b,c){return a.exposure(b,c)},h=function(b,c,d,e){return a.colorize(b,c,d,e)},i=function(b,c){return a.brightness(b,c)},j=function(b,c){return a.hue(b,c)},k=function(b,c){return a.saturate(b,c)},l=function(b,c){return a.contrast(b,c)},m=function(b,c){return a.grayscale(b,c)},n=function(b,c){return a.sepia(b,c)},o=function(a,c){return b.flip(a,c)},p=function(a,c,d,e,f){return b.crop(a,c,d,e,f)},q=function(a,c,d){return b.resize(a,c,d)},r=function(a,c){return b.rotate(a,c)};return{invert:c,sharpen:d,emboss:e,brightness:i,hue:j,saturate:k,contrast:l,grayscale:m,sepia:n,colorize:h,gamma:f,exposure:g,flip:o,crop:p,resize:q,rotate:r}}),g("8",["c"],function(a){var b=function(b){return a.blobToImage(b)},c=function(b){return a.imageToBlob(b)},d=function(b){return a.blobToDataUri(b)},e=function(b){return a.blobToBase64(b)};return{blobToImage:b,imageToBlob:c,blobToDataUri:d,blobToBase64:e}}),h("d",tinymce.dom.DOMUtils),h("e",tinymce.ui.Factory),h("f",tinymce.ui.Form),h("g",tinymce.ui.Container),h("o",tinymce.ui.Control),h("p",tinymce.ui.DragHelper),h("q",tinymce.geom.Rect),h("s",tinymce.dom.DomQuery),h("t",tinymce.util.Observable),g("r",["s","p","q","5","t"],function(a,b,c,d,e){var f=0;return function(g,h,i,j){function k(a,b){return{x:b.x+a.x,y:b.y+a.y,w:b.w,h:b.h}}function l(a,b){return{x:b.x-a.x,y:b.y-a.y,w:b.w,h:b.h}}function m(){return l(i,g)}function n(){function e(a){var d;return new b(A,{document:j.ownerDocument,handle:A+"-"+a.name,start:function(){d=g},drag:function(b){var e,f,h,j,k;e=d.x,f=d.y,h=d.w,j=d.h,e+=b.deltaX*a.deltaX,f+=b.deltaY*a.deltaY,h+=b.deltaX*a.deltaW,j+=b.deltaY*a.deltaH,20>h&&(h=20),20>j&&(j=20),k=g=c.clamp({x:e,y:f,w:h,h:j},i,"move"==a.name),k=l(i,k),v.fire("updateRect",{rect:k}),s(k)}})}a('
    ').appendTo(j),d.each(y,function(b){a("#"+A,j).append('