From: vincent@cubedesigners.com Date: Tue, 27 Jun 2017 15:17:42 +0000 (+0000) Subject: #1505 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=968b17798fe62d57334e32c2470f2a21f4bdd837;p=cubeextranet.git #1505 --- diff --git a/inc/commons/class.common.tools.php b/inc/commons/class.common.tools.php index 00133fb7e..635b14cb0 100644 --- a/inc/commons/class.common.tools.php +++ b/inc/commons/class.common.tools.php @@ -998,6 +998,89 @@ class commonTools { } } + public static function SNCFCodes() { + //commonDroits::min(1); + global $core; + $res = commonPage::barre(); + $res .= commonPage::tMain(); + $res .= commonPage::bh(); + $res .= '
'; + $res .= ''; + $res .= ''; + $res .= ''; + $res .= ''; + $res .= '
' . __('Générer dictionnaires de liens pour fluidbook SNCF') . '
' . __("Email") . '
' . $core->typo->BoutonOK(__('Générer les dictionnaires')) . '
'; + $res .= '
'; + $res .= commonPage::bf(); + + $res .= commonPage::bMain(); + return $res; + $res .= commonPage::bMain(); + return $res; + } + + public static function makeSNCFCodes() { + $list = explode("\n", file_get_contents($_FILES['file']['tmp_name'])); + $labels = []; + $links = []; + + foreach ($list as $item) { + $item = trim($item); + if ($item == '') { + continue; + } + $labels[] = ['word' => $item, 'action' => ['type' => 'definelabel', 'action' => $item]]; + $links[] = ['word' => $item, 'action' => ['type' => 'gotolabel', 'action' => $item]]; + } + + ob_end_clean(); + + header('Content-type: application/zip'); + header('Content-Disposition: attachment; filename="sncf.zip"'); + + $zip = new ZipArchive(); + $zip->open('/tmp/sncf', ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE); + $zip->addFromString('labels.ald', self::_listToALD($labels)); + $zip->addFromString('links.ald', self::_listToALD($links)); + $zip->close(); + + echo file_get_contents('/tmp/sncf'); + + exit; + } + + public static function _listToALD($list) { + $res = '< $item) { + $res .= '/' . $k . ' [/c << /code [/t (' . self::_actionToALDCode($item['action']) . ')] + /word [/t (' . addcslashes($item['word'], "\\") . ')] +>>] + '; + } + + + $res .= ' +>>] + /Name [/t (Dictionary)] +>>] +>>'; + + return $res; + } + + public static function _actionToALDCode($action) { + if ($action['type'] == 'gotolabel') { + return '@' . $action['action']; + } elseif ($action['type'] == 'uri') { + return 'uri:' . $action['action']; + } else if ($action['type'] == 'definelabel') { + return 'uri:pagelabel:' . $action['action']; + } else if ($action['type'] == 'page') { + return $action['action'] . ',InheritZoom'; + } + } + public static function proxy() { ob_end_clean(); echo file_get_contents($_GET['url']); diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index 2c29c8c12..b56819848 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -123,7 +123,7 @@ class wsBookParametres extends wsParametres { $this->fields['tooltipTimer'] = array('type' => 'float', 'default' => 3, "editable" => true, 'label' => __("Temps maximum d'apparition des infos-bulles (en secondes)")); $this->forms['general'] = array('label' => __('Fonctionnalités générales'), - 'fieldsnames' => array('navOrder', 'tooltipTimer','preload', 'pages', 'width', 'height')); + 'fieldsnames' => array('navOrder', 'tooltipTimer', 'preload', 'pages', 'width', 'height')); //. // @@ -380,8 +380,9 @@ class wsBookParametres extends wsParametres { $this->fields['secureURL'] = array('type' => 'text', 'default' => 'http://', 'editable' => true, 'label' => __('URL de sécurisation'), 'grade' => 5, 'hint' => __('URL intérrogé pour vérifier si le visiteur à les droits pour consulter la publication')); $this->fields['secureURLRedirect'] = array('type' => 'text', 'default' => 'http://', 'editable' => true, 'label' => __('Redirection'), 'grade' => 5, 'hint' => __("Si l'authentification échoue, redirection vers cette adresse")); + $this->fields['preventRightClick'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Essayer d'empêcher le clic droit"), 'grade' => 1); $this->forms['secure'] = array('label' => __('Sécurisation'), - 'fieldsnames' => array('secureURL', 'secureURLRedirect')); + 'fieldsnames' => array('secureURL', 'secureURLRedirect', '|', 'preventRightClick')); $this->fields['seoVersion'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Générer une version pour les moteurs de recherche')); $this->fields['seoRobots'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Autoriser le parcours par les moteurs de recherche'));