]> _ Git - cubeextranet.git/commitdiff
#fluidbook-prod Add XiTi support for (HTML5 version only)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 7 Dec 2015 12:45:52 +0000 (12:45 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 7 Dec 2015 12:45:52 +0000 (12:45 +0000)
inc/ws/Metier/class.ws.book.parametres.php
inc/ws/Util/class.ws.links.php
inc/ws/Util/html5/class.ws.html5.links.php
swf/_src/WSComposer.as3proj

index 1c42efa1f56cfe53b80f8e668e3958e6d86587c2..4e4e2af3e1a425accd5deeecce7aab2a4d788952 100644 (file)
@@ -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);
index 82e373fefe2f505f279df2117e35c3f1bb51e96f..dc5dce484d15ccb48fb9c53e478e6cc127b9d744 100644 (file)
@@ -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
index 7f061fc71ca77134635da5d04f5556420153dc04..0f7e4ac94faf7999b52ad5e0b669cb6aa6522aed 100644 (file)
@@ -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() {
index f03a947f6f0d3d2f893fee7fe995637e3914b262..b7643243ad0a5d72f803818ccb917342dcac8a48 100644 (file)
@@ -6,8 +6,8 @@
     <movie input="" />\r
     <movie path="..\composer.swf" />\r
     <movie fps="45" />\r
-    <movie width="4096" />\r
-    <movie height="900" />\r
+    <movie width="1280" />\r
+    <movie height="768" />\r
     <movie version="14" />\r
     <movie minorVersion="0" />\r
     <movie platform="Flash Player" />\r