From: vincent@cubedesigners.com Date: Mon, 7 Dec 2015 12:45:52 +0000 (+0000) Subject: #fluidbook-prod Add XiTi support for (HTML5 version only) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=9142e8dadb74c1003ae31e8c9cd7ba227b9f0972;p=cubeextranet.git #fluidbook-prod Add XiTi support for (HTML5 version only) --- diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index 1c42efa1f..4e4e2af3e 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -197,8 +197,10 @@ class wsBookParametres extends wsParametres { $this->fields['stats_exclude_ip'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __('Exclure les IP suivantes des statistiques'), 'grade' => 3, 'hint' => sprintf(__('Indiquer une adresse ip de la forme %s par ligne'), 'www.xxx.yyy.zzz')); $this->fields['googleAnalytics'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Code Google Analytics'), 'size' => 10); $this->fields['googleAnalyticsCustom'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __('Code Google Analytics personnalisé')); + $this->fields['xiti'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __('Code XiTi global')); + $this->fields['xiti_page'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __('Modèle code xiti (pour tags relatifs aux pages)')); $this->forms['stats'] = array('label' => __('Statistiques'), - 'fieldsnames' => array('stats', 'stats_score', 'stats_exclude_ip', '|', 'googleAnalytics', 'googleAnalyticsCustom')); + 'fieldsnames' => array('stats', 'stats_score', 'stats_exclude_ip', '|', 'googleAnalytics', 'googleAnalyticsCustom', '|', 'xiti', 'xiti_page')); $this->fields['displayChaptersIcon'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Affiche l'icône du sommaire"), 'grade' => 1); $this->fields['displayChaptersLine'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Affiche une ligne entre le label et le numéro de page"), 'grade' => 5); diff --git a/inc/ws/Util/class.ws.links.php b/inc/ws/Util/class.ws.links.php index 82e373fef..dc5dce484 100644 --- a/inc/ws/Util/class.ws.links.php +++ b/inc/ws/Util/class.ws.links.php @@ -11,6 +11,7 @@ * @author Vincent */ class wsLinks { + protected static $_testLinkCache = null; public static function linksToExcel($links, $rulers, $pages = null) { set_time_limit(0); @@ -38,6 +39,8 @@ class wsLinks { PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings); */ + $comments = array(); + $xls = new PHPExcel(); $s = $xls->setActiveSheetIndex(0); $s->setTitle('Links'); @@ -50,6 +53,7 @@ class wsLinks { $s->getStyleByColumnAndRow($i, 1)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); $i++; } + // Links $j = 2; foreach ($links as $l) { @@ -73,6 +77,18 @@ class wsLinks { $l[$id] = 'physical'; } } + if ($id == 'to' && in_array($l['type'], array(2))) { + $comment = false; + if (!Zend_Uri_Http::check($l[$id])) { + $comment = 'Invalid URI'; + } else { + $comment = self::testLink($l[$id]); + } + if ($comment) { + $s->getComment(PHPExcel_Cell::stringFromColumnIndex($j - 1) . $i)->getText()->createTextRun($comment); + } + + } $value = $l[$id]; } else { $value = ''; @@ -86,7 +102,6 @@ class wsLinks { } $j++; } - // Rulers $s = $xls->createSheet(); $s->setTitle('Rulers'); @@ -123,6 +138,16 @@ class wsLinks { return $xls; } + public static function testLink($uri) { + $client = new Zend_Http_Client($uri); + try { + $client->request('head'); + } catch (Exception $e) { + return $e->getMessage(); + } + return false; + } + public static function setDocumentLinks($document_id, $links, $rulers, $user, $comments, $time) { global $core; $c = $core->con->openCursor('document_links_versions'); @@ -291,6 +316,4 @@ class wsLinks { } } -} - -?> +} \ No newline at end of file diff --git a/inc/ws/Util/html5/class.ws.html5.links.php b/inc/ws/Util/html5/class.ws.html5.links.php index 7f061fc71..0f7e4ac94 100644 --- a/inc/ws/Util/html5/class.ws.html5.links.php +++ b/inc/ws/Util/html5/class.ws.html5.links.php @@ -107,6 +107,9 @@ class wsHTML5Link { case 6: return self::getMultimediaInstance($id, $init, $compiler); break; + case 23: + return new statsTagLink($id, $init, $compiler); + break; default: return null; } @@ -924,6 +927,18 @@ class inpesPopinLink extends htmlMultimediaLink { } +class statsTagLink extends wsHTML5Link { + public function __construct($id, $init, &$compiler) { + parent::__construct($id, $init, $compiler); + $this->width = 1; + $this->height = 1; + } + + public function getHTMLContent() { + return str_replace('%tag%', $this->to, $this->compiler->book->parametres->xiti_page); + } +} + class flfLink extends wescoLink { public function getURL() { diff --git a/swf/_src/WSComposer.as3proj b/swf/_src/WSComposer.as3proj index f03a947f6..b7643243a 100644 --- a/swf/_src/WSComposer.as3proj +++ b/swf/_src/WSComposer.as3proj @@ -6,8 +6,8 @@ - - + +