]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Sun, 28 Aug 2011 17:45:14 +0000 (17:45 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Sun, 28 Aug 2011 17:45:14 +0000 (17:45 +0000)
14 files changed:
.htaccess
fluidbook/tools/FWSTK_Resources/dist/FWSTK_Resources.jar
fluidbook/tools/FWSTK_Resources/nbproject/private/private.properties
fluidbook/tools/FWSTK_Resources/src/org/apache/pdfbox/resources/LayoutStripper.properties
fluidbook/tools/fwstk/nbproject/build-impl.xml
fluidbook/tools/fwstk/nbproject/genfiles.properties
fluidbook/tools/fwstk/nbproject/project.properties
fluidbook/tools/fwstk/nbproject/project.xml
fluidbook/tools/fwstk/src/org/apache/pdfbox/util/PDFStreamEngine.java
inc/ws/Controlleur/class.ws.url.php
inc/ws/DAO/class.ws.dao.book.php
inc/ws/Metier/class.ws.document.php
inc/ws/Util/html5/class.ws.html5.compiler.php
inc/ws/_common.php

index 2f639c659148e89076f5c7dbc91506ff330d9e24..5f9dff0ad88b7c84f054dd0ccf3adbc6c845cb51 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -55,5 +55,8 @@ AddCharset UTF-8 log
 \r
        RewriteRule ^viewerhu/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/js/(.+)$ fluidbook/compile/_html5/js/$4 [L]      \r
        RewriteRule ^viewerhu/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/(.+)$ fluidbook/books/html5/$1/$4 [L]\r
+\r
+       RewriteRule ^viewerht/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/js/(.+)$ fluidbook/compile/_html5/js/$4 [L]      \r
+       RewriteRule ^viewerht/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/(.+)$ fluidbook/books/html5/$1/$4 [L]\r
        \r
 </IfModule>
\ No newline at end of file
index 47c9f1356656d613734df7f7ee73a61823cb1724..04d781ae03ba332aae4b05a7b41012e446dd7953 100644 (file)
Binary files a/fluidbook/tools/FWSTK_Resources/dist/FWSTK_Resources.jar and b/fluidbook/tools/FWSTK_Resources/dist/FWSTK_Resources.jar differ
index bac0930bddf6317e577bc14e719ab75eed9a23f3..5b986322ccca40c8f75781af8cfd250627244e53 100644 (file)
@@ -1,2 +1,2 @@
 compile.on.save=true\r
-user.properties.file=C:\\Users\\Vincent\\.netbeans\\7.0\\build.properties\r
+user.properties.file=C:\\Users\\Cube\\.netbeans\\7.0\\build.properties\r
index f40d9848b8ff2b481744df88fae674ea68825fc1..1c84790a94def5c0e91539af6759381a8d228d4d 100644 (file)
@@ -21,11 +21,11 @@ b#=org.apache.pdfbox.util.operator.pagedrawer.CloseFillNonZeroAndStrokePath
 B#=org.apache.pdfbox.util.operator.pagedrawer.FillNonZeroAndStrokePath\r
 b*#=org.apache.pdfbox.util.operator.pagedrawer.CloseFillEvenOddAndStrokePath\r
 B*#=org.apache.pdfbox.util.operator.pagedrawer.FillEvenOddAndStrokePath\r
-#BDC org.apache.pdfbox.util.operator.NotImplemented ##Begin Marked Content -- section 10.5\r
+BDC# org.apache.pdfbox.util.operator.NotImplemented ##Begin Marked Content -- section 10.5\r
 BI#=org.apache.pdfbox.util.operator.pagedrawer.BeginInlineImage\r
-#BMC org.apache.pdfbox.util.operator.NotImplemented ##Begin Marked Content -- section 10.5\r
+BMC# org.apache.pdfbox.util.operator.NotImplemented ##Begin Marked Content -- section 10.5\r
 BT=org.apache.pdfbox.util.operator.BeginText\r
-#BX org.apache.pdfbox.util.operator.NotImplemented\r
+BX# org.apache.pdfbox.util.operator.NotImplemented\r
 c#=org.apache.pdfbox.util.operator.pagedrawer.CurveTo\r
 cm=org.apache.pdfbox.util.operator.Concatenate\r
 CS=org.apache.pdfbox.util.operator.SetStrokingColorSpace\r
index e0ac685fb6800f33c5c90589ea5efb5e1626b010..ba8fe7e7e5e44c77e45bc7584008eb6121912d6c 100644 (file)
@@ -54,6 +54,43 @@ is divided into following sections:
         <property file="nbproject/project.properties"/>\r
     </target>\r
     <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">\r
+        <j2seproject1:property name="platform.home" value="platforms.${platform.active}.home"/>\r
+        <j2seproject1:property name="platform.bootcp" value="platforms.${platform.active}.bootclasspath"/>\r
+        <j2seproject1:property name="platform.compiler" value="platforms.${platform.active}.compile"/>\r
+        <j2seproject1:property name="platform.javac.tmp" value="platforms.${platform.active}.javac"/>\r
+        <condition property="platform.javac" value="${platform.home}/bin/javac">\r
+            <equals arg1="${platform.javac.tmp}" arg2="$${platforms.${platform.active}.javac}"/>\r
+        </condition>\r
+        <property name="platform.javac" value="${platform.javac.tmp}"/>\r
+        <j2seproject1:property name="platform.java.tmp" value="platforms.${platform.active}.java"/>\r
+        <condition property="platform.java" value="${platform.home}/bin/java">\r
+            <equals arg1="${platform.java.tmp}" arg2="$${platforms.${platform.active}.java}"/>\r
+        </condition>\r
+        <property name="platform.java" value="${platform.java.tmp}"/>\r
+        <j2seproject1:property name="platform.javadoc.tmp" value="platforms.${platform.active}.javadoc"/>\r
+        <condition property="platform.javadoc" value="${platform.home}/bin/javadoc">\r
+            <equals arg1="${platform.javadoc.tmp}" arg2="$${platforms.${platform.active}.javadoc}"/>\r
+        </condition>\r
+        <property name="platform.javadoc" value="${platform.javadoc.tmp}"/>\r
+        <condition property="platform.invalid" value="true">\r
+            <or>\r
+                <contains string="${platform.javac}" substring="$${platforms."/>\r
+                <contains string="${platform.java}" substring="$${platforms."/>\r
+                <contains string="${platform.javadoc}" substring="$${platforms."/>\r
+            </or>\r
+        </condition>\r
+        <fail unless="platform.home">Must set platform.home</fail>\r
+        <fail unless="platform.bootcp">Must set platform.bootcp</fail>\r
+        <fail unless="platform.java">Must set platform.java</fail>\r
+        <fail unless="platform.javac">Must set platform.javac</fail>\r
+        <fail if="platform.invalid">\r
+ The J2SE Platform is not correctly set up.\r
+ Your active platform is: ${platform.active}, but the corresponding property "platforms.${platform.active}.home" is not found in the project's properties files. \r
+ Either open the project in the IDE and setup the Platform with the same name or add it manually.\r
+ For example like this:\r
+     ant -Duser.properties.file=&lt;path_to_property_file&gt; jar (where you put the property "platforms.${platform.active}.home" in a .properties file)\r
+  or ant -Dplatforms.${platform.active}.home=&lt;path_to_JDK_home&gt; jar (where no properties file is used) \r
+  </fail>\r
         <available file="${manifest.file}" property="manifest.available"/>\r
         <condition property="splashscreen.available">\r
             <and>\r
@@ -185,15 +222,6 @@ is divided into following sections:
         <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">\r
             <length length="0" string="${endorsed.classpath}" when="greater"/>\r
         </condition>\r
-        <condition else="false" property="jdkBug6558476">\r
-            <and>\r
-                <matches pattern="1\.[56]" string="${java.specification.version}"/>\r
-                <not>\r
-                    <os family="unix"/>\r
-                </not>\r
-            </and>\r
-        </condition>\r
-        <property name="javac.fork" value="${jdkBug6558476}"/>\r
         <property name="jar.index" value="false"/>\r
         <property name="jar.index.metainf" value="${jar.index}"/>\r
         <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>\r
@@ -239,7 +267,7 @@ is divided into following sections:
                 <property location="${build.dir}/empty" name="empty.dir"/>\r
                 <mkdir dir="${empty.dir}"/>\r
                 <mkdir dir="@{apgeneratedsrcdir}"/>\r
-                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">\r
+                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">\r
                     <src>\r
                         <dirset dir="@{gensrcdir}" erroronmissingdir="false">\r
                             <include name="*"/>\r
@@ -278,7 +306,7 @@ is divided into following sections:
             <sequential>\r
                 <property location="${build.dir}/empty" name="empty.dir"/>\r
                 <mkdir dir="${empty.dir}"/>\r
-                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">\r
+                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">\r
                     <src>\r
                         <dirset dir="@{gensrcdir}" erroronmissingdir="false">\r
                             <include name="*"/>\r
@@ -335,7 +363,7 @@ is divided into following sections:
             <attribute default="**" name="testincludes"/>\r
             <sequential>\r
                 <property name="junit.forkmode" value="perTest"/>\r
-                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">\r
+                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" jvm="${platform.java}" showoutput="true" tempdir="${build.dir}">\r
                     <batchtest todir="${build.test.results.dir}"/>\r
                     <classpath>\r
                         <path path="${run.test.classpath}"/>\r
@@ -407,6 +435,9 @@ is divided into following sections:
                     <classpath>\r
                         <path path="@{classpath}"/>\r
                     </classpath>\r
+                    <bootclasspath>\r
+                        <path path="${platform.bootcp}"/>\r
+                    </bootclasspath>\r
                 </nbjpdastart>\r
             </sequential>\r
         </macrodef>\r
@@ -422,7 +453,9 @@ is divided into following sections:
         </macrodef>\r
     </target>\r
     <target name="-init-debug-args">\r
-        <property name="version-output" value="java version &quot;${ant.java.version}"/>\r
+        <exec executable="${platform.java}" outputproperty="version-output">\r
+            <arg value="-version"/>\r
+        </exec>\r
         <condition property="have-jdk-older-than-1.4">\r
             <or>\r
                 <contains string="${version-output}" substring="java version &quot;1.0"/>\r
@@ -447,7 +480,7 @@ is divided into following sections:
             <attribute default="${debug.classpath}" name="classpath"/>\r
             <element name="customize" optional="true"/>\r
             <sequential>\r
-                <java classname="@{classname}" dir="${work.dir}" fork="true">\r
+                <java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}">\r
                     <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>\r
                     <jvmarg line="${debug-args-line}"/>\r
                     <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>\r
@@ -472,7 +505,7 @@ is divided into following sections:
             <attribute default="${run.classpath}" name="classpath"/>\r
             <element name="customize" optional="true"/>\r
             <sequential>\r
-                <java classname="@{classname}" dir="${work.dir}" fork="true">\r
+                <java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}">\r
                     <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>\r
                     <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>\r
                     <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>\r
@@ -655,7 +688,7 @@ is divided into following sections:
             <path path="${run.classpath}"/>\r
             <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>\r
         </pathconvert>\r
-        <echo level="info">java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>\r
+        <echo level="info">${platform.java} -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>\r
     </target>\r
     <target depends="init" if="do.archive" name="-do-jar-with-libraries-create-manifest" unless="manifest.available">\r
         <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>\r
@@ -682,7 +715,7 @@ is divided into following sections:
         <j2seproject3:copylibs manifest="${tmp.manifest.file}"/>\r
         <echo level="info">To run this application from the command line without Ant, try:</echo>\r
         <property location="${dist.jar}" name="dist.jar.resolved"/>\r
-        <echo level="info">java -jar "${dist.jar.resolved}"</echo>\r
+        <echo level="info">${platform.java} -jar "${dist.jar.resolved}"</echo>\r
     </target>\r
     <target depends="-do-jar-with-libraries-pack" if="do.archive" name="-do-jar-with-libraries-delete-manifest">\r
         <delete>\r
@@ -832,16 +865,15 @@ is divided into following sections:
             -->\r
     <target depends="init" if="have.sources" name="-javadoc-build">\r
         <mkdir dir="${dist.javadoc.dir}"/>\r
-        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">\r
+        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" executable="${platform.javadoc}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">\r
             <classpath>\r
                 <path path="${javac.classpath}"/>\r
             </classpath>\r
-            <fileset dir="${src.src.dir}" excludes="*.java,${excludes}" includes="${includes}">\r
+            <fileset dir="${src.src.dir}" excludes="${excludes}" includes="${includes}">\r
                 <filename name="**/*.java"/>\r
             </fileset>\r
             <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">\r
                 <include name="**/*.java"/>\r
-                <exclude name="*.java"/>\r
             </fileset>\r
         </javadoc>\r
         <copy todir="${dist.javadoc.dir}">\r
index 00af3e9f51cd07dd8e94266e641db7e69f2e7061..c18a0bf72cbba98a8d9ea15560736172f02ef233 100644 (file)
@@ -1,8 +1,8 @@
-build.xml.data.CRC32=5afba316\r
+build.xml.data.CRC32=0fe54e23\r
 build.xml.script.CRC32=ef618d2d\r
-build.xml.stylesheet.CRC32=28e38971@1.44.1.45\r
+build.xml.stylesheet.CRC32=28e38971@1.43.1.45\r
 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.\r
 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.\r
-nbproject/build-impl.xml.data.CRC32=5afba316\r
-nbproject/build-impl.xml.script.CRC32=f0904f14\r
-nbproject/build-impl.xml.stylesheet.CRC32=0ae3a408@1.44.1.45\r
+nbproject/build-impl.xml.data.CRC32=0fe54e23\r
+nbproject/build-impl.xml.script.CRC32=34b388b3\r
+nbproject/build-impl.xml.stylesheet.CRC32=0c01fd8e@1.43.1.45\r
index e1d9e82f1d2a10e18975226fe1f02854848a50e3..2bb20f19cead100858b11c6d2a32efc408c09766 100644 (file)
@@ -85,7 +85,7 @@ main.class=com.fluidbook.fwstk.Main
 manifest.file=manifest.mf\r
 meta.inf.dir=${src.dir}/META-INF\r
 mkdist.disabled=false\r
-platform.active=default_platform\r
+platform.active=JDK_1.7\r
 run.classpath=\\r
     ${build.classes.dir}:\\r
     ${javac.classpath}\r
index a70a3bf29431378f33d371fe067865f62a63519c..38eb6a1e35c4121bb8fcb1ab0c5af13aa69e7610 100644 (file)
@@ -4,6 +4,7 @@
     <configuration>\r
         <data xmlns="http://www.netbeans.org/ns/j2se-project/3">\r
             <name>fwstk</name>\r
+            <explicit-platform explicit-source-supported="true"/>\r
             <source-roots>\r
                 <root id="src.src.dir"/>\r
             </source-roots>\r
index 35039c2fd67fddfbbf0bf9afe0415a8bd98f127d..b58fc466850f9f4e9dc18bb333c199c091c4fb58 100644 (file)
@@ -143,9 +143,7 @@ public class PDFStreamEngine {
                                                        (OperatorProcessor) klass.newInstance();
                                        registerOperatorProcessor(operator, processor);
                                } catch (Exception e) {
-                                       throw new WrappedIOException(
-                                                       "OperatorProcessor class " + processorClassName
-                                                       + " could not be instantiated", e);
+                                       
                                }
                        }
                }
index ef586ea8ce66f69884000a2697a985924cefed56..89e8d773f9719698c3cc34600553cf62c57990e5 100644 (file)
@@ -128,7 +128,7 @@ class wsUrl {
                                } else {\r
                                        $res .= '<td class="bouton"><a class="popupFSBar" rel="toolbar=yes" rev="viewer_' . $book->book_id . '" href="' . SITE_PATH . 'viewer/' . $book->book_id . '_' . $book->hash . '/">' . $btVoir . '</a></td>';\r
                                }\r
-                               $res .= '<td class="bouton"><a class="popupFSBar" rel="toolbar=yes" rev="editor_' . $book->book_id . '" href="' . SITE_PATH . 'editor/' . $book->book_id . '">' . $btEdit . '</a></td>';\r
+                               $res .= '<td class="bouton"><a class="popupFSBar" rel="toolbar=yes" rev="editor_' . $book->book_id . '" href="' . SITE_PATH . 'editor/' . $book->book_id . '_' . $book->hash . '">' . $btEdit . '</a></td>';\r
                        } else {\r
                                $res.='<td></td><td></td>';\r
                        }\r
@@ -431,14 +431,17 @@ class wsUrl {
                global $core;\r
 \r
                $args = cubePage::getArgs($args);\r
-               $book_id = $args[0];\r
+               $e = explode('_', $args[0]);\r
+               $book_id = $e[0];\r
+               $hash = isset($e[1]) ? $e[1] : '';\r
+\r
 \r
                self::checkDocumentVersionOfBook($book_id);\r
 \r
                if ($book_id == 'new') {\r
                        $dao = new wsDAOBook($core->con);\r
                        $book = $dao->creeEmpty($core->user->utilisateur_id, $core->user->lang);\r
-                       http::redirect(SITE_PATH . 'editor/' . $book->book_id);\r
+                       http::redirect(SITE_PATH . 'editor/' . $book->book_id . '_' . $book->hash);\r
                }\r
 \r
                $res = '<html><head><style type="text/css">';\r
@@ -449,7 +452,7 @@ html{height:100%}' . "\n";
                $res .= '<title>' . __('Edition de la publication') . ' #' . $args[0] . '</title>';\r
                $res .= '</head>';\r
                $res .= '<body onload="this.focus();">';\r
-               $res .= self::editComposition($args);\r
+               $res .= self::editComposition($book_id, $hash);\r
                $res .= '</body>';\r
                $res .= '</html>';\r
                echo $res;\r
@@ -537,9 +540,11 @@ html{height:100%}' . "\n";
                exit;\r
        }\r
 \r
-       public static function editComposition($args) {\r
+       public static function editComposition($book_id,$hash) {\r
+\r
                $fv = array(session_name() => session_id(),\r
-                       'book_id' => $args[0]);\r
+                       'book_id' => $book_id,\r
+                       'hash' => $hash);\r
 \r
                $mtime = filemtime(ROOT . '/swf/composer.swf');\r
                return cubeMedia::flash2(WEBROOT . '/swf/composer.swf?junk=' . $mtime, '100%', '100%', $fv, 'composerSwf', 'swfPanel', 10, '#d2d3c7', '', 'false', 'noscale', 'normal', array(), false, true, false);\r
@@ -621,6 +626,22 @@ html{height:100%}' . "\n";
                self::commonHTML5Viewer($book_id, $hash, 'u');\r
        }\r
 \r
+       public static function viewerht($args) {\r
+               commonDroits::min(5);\r
+               $args = cubePage::getArgs($args);\r
+\r
+               $e = explode('_', $args[0]);\r
+               if (count($e) == 2 || $e[2] < TIME - 10) {\r
+                       $e[2] = TIME;\r
+                       http::redirect(SITE_PATH . 'viewerht/' . implode('_', $e) . '/');\r
+                       exit;\r
+               }\r
+\r
+               $book_id = $e[0];\r
+               $hash = $e[1];\r
+               self::commonHTML5Viewer($book_id, $hash, 't');\r
+       }\r
+\r
        public static function commonHTML5Viewer($book_id, $hash, $version='') {\r
                global $core;\r
                self::checkDocumentVersionOfBook($book_id);\r
@@ -633,9 +654,14 @@ html{height:100%}' . "\n";
                }\r
 \r
                if (!$dao->isUpToDate($book_id)) {\r
-                       $dao->compile($book_id);\r
-                       $dao->touchCompile($book_id);\r
+                       if ($version == 'u' || $version == 't') {\r
+                               $dao->compileHTML5($book_id);\r
+                       } else {\r
+                               $dao->compile($book_id);\r
+                               $dao->touchCompile($book_id);\r
+                       }\r
                }\r
+\r
                echo file_get_contents(WS_BOOKS . '/html5/' . $book_id . '/index' . $version . '.html');\r
                exit;\r
        }\r
index b9d50160f9d766796d674a6e4a9b09c4d4b131ae..b9617e1b08f7346bdca9a39fe1b3c592c8ebd0aa 100644 (file)
@@ -906,7 +906,7 @@ class wsDAOBook extends commonDAO {
                return $res;\r
        }\r
 \r
-       protected function compileHTML5($book_id) {\r
+       public function compileHTML5($book_id) {\r
                $htmlCompiler = new wsHTML5Compiler($book_id);\r
                $htmlCompiler->compile();\r
        }\r
index 7e4e4a82a8615cd9d2316c6c2d7d2eaee9bed9b5..5287da6f77d2fd39be6ffc15aae544fb99a473a2 100644 (file)
@@ -634,8 +634,8 @@ class wsDocument extends cubeMetier {
                // Then make HD background shots\r
                $resolutions = array(36 => 90, 72 => 80, 150 => 75);\r
                foreach ($resolutions as $r => $q) {\r
-                       $texts = false;\r
-                       $this->makeShotPNM($page, 'html/h' . $r . '-', $r, $q, 4, null, $texts);\r
+                       $this->makeShotPNM($page, 'html/h' . $r . '-', $r, $q, 4, null, false);\r
+                       $this->makeShotPNM($page, 'html/t' . $r . '-', $r, $q, 4, null, true);\r
                }\r
                // Then get layout infos from swf\r
                file_put_contents($this->out . '/html/s' . $page . '.layout', $this->dumpSWF($page));\r
index 49a8c184dbd7b65724a3ac808cf9451f8ecc54db..b09b38e92ba92e057f9bacbe4293cfdc621e165c 100644 (file)
@@ -22,6 +22,15 @@ class wsHTML5Compiler {
                'js/libs/fluidbook/fluidbook.nav.js',
                'js/libs/fluidbook/fluidbook.js',
                'js/main.js');
+       protected static $testJsFiles = array(
+               'js/libs/cube/fb.js',
+               'js/libs/modernizr.js',
+               'js/libs/jquery/jquery.js',
+               'js/libs/jquery/jquery.transform.js',
+               'js/libs/jquery/jquery.mousewheel.js',
+               'js/libs/jquery/jquery.hashchange.js',
+               'js/tester.js'
+       );
        protected $layouts = array();
        protected $cssSize = array();
        protected $cssColor = array();
@@ -57,6 +66,7 @@ class wsHTML5Compiler {
        protected $optimalWidth = 567;
        protected $optimalHeight = 709;
        protected $additionalConfig = array();
+       protected $fontScale = 1;
 
        function __construct($book_id) {
                global $core;
@@ -89,9 +99,6 @@ class wsHTML5Compiler {
                        }
                }
 
-               $imagesize = getimagesize(WS_DOCS . '/' . $this->pages[1]['document_id'] . '/html/h72-' . $this->pages[1]['document_page'] . '.jpg');
-               $this->pdf2htmlRatio = round($imagesize[0] / $this->layouts[1]['width'], 2);
-
                $daoDoc = new wsDAODocument($core->con);
                $firstDoc = $daoDoc->selectById($this->pages[1]['document_id']);
                $size = $firstDoc->generalInfos['size'];
@@ -99,6 +106,10 @@ class wsHTML5Compiler {
                $this->width = round($size[0], 2);
                $this->height = round($size[1], 2);
 
+
+               $imagesize = getimagesize(WS_DOCS . '/' . $this->pages[1]['document_id'] . '/html/h72-' . $this->pages[1]['document_page'] . '.jpg');
+               $this->pdf2htmlRatio = round($imagesize[0] / $this->width, 2);
+
                $this->cssScale = min($this->optimalWidth / $this->width, $this->optimalHeight / $this->height);
 
                $this->cssWidth = $this->width * $this->cssScale;
@@ -117,6 +128,16 @@ class wsHTML5Compiler {
                return $p + 1;
        }
 
+       protected function sortPage($layout) {
+               $lines = array();
+               foreach ($layout->l as $line) {
+                       $lines[] = $line;
+               }
+               usort($lines, array($this, 'compareLines'));
+
+               return $lines;
+       }
+
        protected function compareLines($a, $b) {
                if ((float) $a['y'] > (float) $b['y']) {
                        return 1;
@@ -126,15 +147,12 @@ class wsHTML5Compiler {
        }
 
        public function compile() {
+
+
                foreach ($this->layouts as $page => $layout) {
-                       $this->div[$page] = array();
+                       $lines = $this->sortPage($layout);
                        $document_id = $this->pages[$page]['document_id'];
-                       $lines = array();
-                       foreach ($layout->l as $line) {
-                               $lines[] = $line;
-                       }
-                       usort($lines, array($this, 'compareLines'));
-
+                       $this->div[$page] = array();
                        foreach ($lines as $line) {
                                $this->div[$page][] = $this->addLine($line, $document_id);
                        }
@@ -209,13 +227,28 @@ class wsHTML5Compiler {
                $scripts[] = '<script type="text/javascript" src="data/datas.js"></script>';
                $script = implode("\n\t\t", $scripts);
 
+               $scripts=array();
+               foreach (self::$testJsFiles as $js) {
+                       $scripts[] = '<script type="text/javascript" src="' . $js . '"></script>';
+               }
+               $scripts[] = '<script type="text/javascript" src="data/datas.js"></script>';
+               $script_test = implode("\n\t\t", $scripts);
+
                $vars = array('titre', 'credits', 'ga', 'style', 'script');
                foreach ($vars as $v) {
                        $uhtml = str_replace('<!-- $' . $v . ' -->', $$v, $uhtml);
                }
 
+               $thtml=file_get_contents(WS_COMPILE_ASSETS . '/_html5/tester.html');
+               
+                               $vars = array('titre', 'credits', 'ga', 'style', 'script_test');
+               foreach ($vars as $v) {
+                       $thtml = str_replace('<!-- $' . $v . ' -->', $$v, $thtml);
+               }
+
                file_put_contents($this->vdir . '/index.html', $html);
                file_put_contents($this->vdir . '/indexu.html', $uhtml);
+               file_put_contents($this->vdir . '/indext.html', $thtml);
        }
 
        protected function writeLangs() {
@@ -365,6 +398,7 @@ class wsHTML5Compiler {
                foreach ($this->pages as $page => $infos) {
                        foreach (self::$resolutions as $r) {
                                copy(WS_DOCS . '/' . $infos['document_id'] . '/html/h' . $r . '-' . $infos['document_page'] . '.jpg', $this->vdir . '/data/background/' . $r . '/p' . $page . '.jpg');
+                               copy(WS_DOCS . '/' . $infos['document_id'] . '/html/t' . $r . '-' . $infos['document_page'] . '.jpg', $this->vdir . '/data/background/' . $r . '/t' . $page . '.jpg');
                        }
                        copy(WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.jpg', $this->vdir . '/data/thumbnails/p' . $page . '.jpg');
                }
@@ -372,15 +406,55 @@ class wsHTML5Compiler {
 
        protected function writePage($page) {
                $res = '';
+               $page = $this->sortPageLines($page);
                foreach ($page as $line) {
                        $res .= $this->writeLine($line);
                }
                return $res;
        }
 
+       protected function sortPageLines($page) {
+               $cols = array();
+               // On groupe par x pour tenter de regrouper les paragraphes
+               foreach ($page as $line) {
+                       if (!count($line['groups'])) {
+                               continue;
+                       }
+                       $x = (string) $line['groups'][0]['x'];
+                       if (!isset($cols[$x])) {
+                               $cols[$x] = array();
+                       }
+                       $cols[$x][] = $line;
+               }
+               // On trie les colonnes
+               usort($cols, array('wsHTML5Compiler', 'sortCols'));
+               // Maintenant, on Ã©crase tout Ã§a
+               $res = array();
+               foreach ($cols as $c) {
+                       foreach ($c as $line) {
+                               $res[] = $line;
+                       }
+               }
+               return $res;
+       }
+
+       protected function sortCols($a, $b) {
+               if ($a[0]['y'] > $b[0]['y']) {
+                       return 1;
+               } else if ($a[0]['y'] < $b[0]['y']) {
+                       return -1;
+               } else if ($a[0]['groups'][0]['x'] > $b[0]['groups'][0]['x']) {
+                       return 1;
+               } else if ($a[0]['groups'][0]['x'] < $b[0]['groups'][0]['x']) {
+                       return -1;
+               }
+               return 0;
+       }
+
        protected function writeLine($line) {
                $res = '';
                foreach ($line['groups'] as $group) {
+
                        $res.=$this->writeGroup($group, $line);
                }
                return $res;
@@ -393,6 +467,8 @@ class wsHTML5Compiler {
 
                $group['y'] = $this->getCSSY(($group['y'] + $line['y']) * $this->multiply);
                $group['x'] = $this->getCSSX(($group['x']) * $this->multiply);
+               $group['letterspacing'] = $this->getCSSLetterSpacing($group['letterspacing'] * $this->multiply);
+               $group['wordspacing'] = $this->getCSSWordSpacing($group['wordspacing'] * $this->multiply);
 
                $class = array('g');
                if (!is_null($group['color'])) {
@@ -422,9 +498,7 @@ class wsHTML5Compiler {
                $class = implode(' ', $class);
 
                $res = '<div class="' . $class . '">';
-               foreach ($group['spans'] as $span) {
-                       $res.=$this->writeSpan($span);
-               }
+               $res.=$group['text'];
                $res.='</div>';
                return $res;
        }
@@ -616,11 +690,11 @@ class wsHTML5Compiler {
                }
 
                foreach ($this->cssLetterSpacing as $letterspacing => $index) {
-                       $res[] = '.l' . $index . '{letter-spacing:' . $letterspacing . 'em}';
+                       $res[] = '.l' . $index . '{letter-spacing:' . $letterspacing . 'px}';
                }
 
                foreach ($this->cssWordSpacing as $wordspacing => $index) {
-                       $res[] = '.w' . $index . '{word-spacing:' . $wordspacing . 'em}';
+                       $res[] = '.w' . $index . '{word-spacing:' . $wordspacing . 'px}';
                }
 
                foreach ($this->cssX as $x => $index) {
@@ -647,7 +721,7 @@ class wsHTML5Compiler {
                }
 
                foreach ($this->cssFont as $font => $index) {
-                       $res[] = "@font-face{font-family:F" . $index . ";src:url('F" . $index . ".woff') format('woff'),url('F" . $index . ".ttf') format('truetype'),url('F" . $index . ".svg#" . $font . "') format('svg')}";
+                       $res[] = "@font-face{font-family:F" . $index . ";src:url('F" . $index . ".ttf') format('truetype'),url('F" . $index . ".woff') format('woff'),url('F" . $index . ".svg#" . $font . "') format('svg')}";
                        $res[] = '.f' . $index . '{font-family:F' . $index . ',Arial,Helvetica}';
                }
 
@@ -698,9 +772,6 @@ class wsHTML5Compiler {
                }
 
                usort($tab, array('wsHTML5Compiler', 'sortSpans'));
-               if ($debug) {
-                       //fb($tab);
-               }
 
                $currentGroup = null;
                $lastParent = null;
@@ -726,10 +797,6 @@ class wsHTML5Compiler {
                if (!is_null($currentGroup)) {
                        cubeXML::append($l, $currentGroup);
                }
-
-               if ($debug) {
-                       fb($l);
-               }
                return $l;
        }
 
@@ -750,136 +817,129 @@ class wsHTML5Compiler {
                if ($alpha == 0) {
                        return false;
                }
-
-               $first = true;
-               $letterSpacing = 0;
-               $letterCount = 0;
-               $wordSpacing = 0;
-               $wordCount = 0;
-
                $res = array();
-               $spans = array();
-
-               foreach ($group->s as $span) {
-                       if ($first && trim((string) $span) == '') {
-                               continue;
-                       }
-                       if ($first) {
-                               $pos = $x = $span['x'];
-                               $pos+=$span['width'];
-                               $first = false;
-                       } else {
-                               if ((float) $span['x'] < (float) $newSpan['x']) {
-                                       // On change de groupe
-                                       $ls = $ws = 0;
-                                       if ($letterCount > 0) {
-                                               $ls = $letterSpacing / $letterCount;
-                                       }
-                                       if ($wordCount > 0) {
-                                               $ws = $wordSpacing / $wordCount;
-                                       }
+               $groups = $this->separateGroups($group);
 
-                                       $res[] = array(
-                                               'color' => $this->getCSSColor($group['color']),
-                                               'size' => $this->getCSSSize($group['size']),
-                                               'font' => $this->getCSSFont((string) $group['font'], $document_id),
-                                               'letterspacing' => $this->getCSSLetterSpacing($ls),
-                                               'wordspacing' => $this->getCSSLetterSpacing($ws),
-                                               'y' => 0,
-                                               'x' => $x,
-                                               'spans' => $spans);
-
-                                       $spans = array();
-                                       $pos = $x = $span['x'];
-                                       $pos+=$span['width'];
-                               } else {
-
-                                       $diff = $span['x'] - $pos;
-                                       if ($diff > $group['size'] / 4) {
-                                               $space = round($diff / $group['size'], 4);
-                                               if ($space > 2) {
-                                                       // On change de groupe
-                                                       $ls = $ws = 0;
-                                                       if ($letterCount > 0) {
-                                                               $ls = $letterSpacing / $letterCount;
-                                                       }
-                                                       if ($wordCount > 0) {
-                                                               $ws = $wordSpacing / $wordCount;
-                                                       }
-                                                       $res[] = array(
-                                                               'color' => $this->getCSSColor($group['color']),
-                                                               'size' => $this->getCSSSize($group['size']),
-                                                               'font' => $this->getCSSFont($group['font'], $document_id),
-                                                               'letterspacing' => $this->getCSSLetterSpacing($ls),
-                                                               'wordspacing' => $this->getCSSLetterSpacing($ws),
-                                                               'y' => 0,
-                                                               'x' => $x,
-                                                               'spans' => $spans);
-
-                                                       $spans = array();
-                                                       $pos = $x = $span['x'];
-                                                       $pos+=$span['width'];
-                                               } else {
-
-                                                       $newSpan = $this->addSpan('<span style="width:' . $space . 'em;"> </span>', true);
-                                                       array_push($spans, $newSpan);
-                                               }
-                                       }
-                               }
-                       }
+               foreach ($groups as $g) {
+                       $first = true;
+                       $letterSpacing = 0;
+                       $letters = 0;
+                       $wordSpacing = 0;
+                       $spaces = 0;
 
+                       $lastWidth = 0;
+                       $nextX = 0;
+                       $text = '';
 
-                       $newSpan = $this->addSpan($span);
-                       $pos = $span['x'] + $span['width'];
+                       foreach ($g['spans'] as $span) {
+                               $char = $span['text'];
 
-                       array_push($spans, $newSpan);
-                       $copy = (string) $span;
-                       $len = mb_strlen($copy);
-                       str_replace(' ', '-', $copy, $w);
-                       $l = $len - $w;
+                               if ($first && trim($char) == "") {
+                                       continue;
+                               }
+                               if ($first) {
+                                       $x = floatval($span['x']);
+                                       $first = false;
+                               }
 
-                       $letterCount+=$l;
-                       $wordCount+=$w;
+                               $text.=$char;
+                       }
 
-                       $letterSpacing+=$l * (float) $span['letterspacing'];
-                       $wordSpacing+=$w * (float) $span['wordspacing'];
-               }
 
-               if (count($spans)) {
-                       $ls = $ws = 0;
-                       if ($letterCount > 0) {
-                               $ls = $letterSpacing / $letterCount;
-                       }
-                       if ($wordCount > 0) {
-                               $ws = $wordSpacing / $wordCount;
-                       }
+                       $ws = floatval($group['wordspacing']);
+                       $ls = floatval($group['letterspacing']);
+                       $size = floatval($group['size']);
 
                        $res[] = array(
                                'color' => $this->getCSSColor($group['color']),
                                'size' => $this->getCSSSize($group['size']),
                                'font' => $this->getCSSFont($group['font'], $document_id),
-                               'letterspacing' => $this->getCSSLetterSpacing($ls),
-                               'wordspacing' => $this->getCSSLetterSpacing($ws),
+                               'letterspacing' => $ls * $size,
+                               'wordspacing' => $ws * $size,
                                'y' => 0,
                                'x' => $x,
-                               'spans' => $spans);
+                               'text' => $text);
                }
-
                return $res;
        }
 
-       protected function addSpan($span, $space=false) {
-               $text = (string) $span;
-               return array('text' => $text, 'space' => $space, 'x' => $span['x']);
+       protected function separateGroups($group) {
+               $res = array();
+
+               $first = true;
+               $currentGroup = array('spans' => array());
+               $nextX = 0;
+               $x = 0;
+
+               $spaceWidth = $group['space'];
+               $size = floatval($group['size']);
+               $letterSpacing = floatval($group['letterspacing']) * $size;
+               $wordSpacing = floatval($group['wordspacing']) * $size + $letterSpacing;
+
+               $lastIsSpace = true;
+
+               foreach ($group->s as $span) {
+                       $char = (string) $span;
+
+                       if ($first && trim($char) == "") {
+                               continue;
+                       }
+                       if ($first) {
+                               $x = floatval($span['x']);
+                               $first = false;
+                       }
+                       $sox = floatval($span['x']);
+                       $sx = $sox - $x;
+                       $sw = floatval($span['width']);
+
+                       $diff = $sx - $nextX;
+
+                       $s = $char;
+
+                       if ($lastIsSpace) {
+                               if ($diff > $wordSpacing) {
+                                       $diff-=$wordSpacing;
+                                       $diff = round($diff * $this->multiply, 2);
+                                       if ($diff != 0) {
+                                               $s = '<span class="gap" style="margin-left:' . $diff . 'px">' . $s . '</span>';
+                                       }
+                               }
+                       } else {
+                               if ($diff < $letterSpacing) {
+                                       $diff-=$letterSpacing;
+                                       $diff = round($diff * $this->multiply, 2);
+                                       if ($diff != 0) {
+                                               $s = '<span class="gap" style="margin-left:' . $diff . 'px">' . $s . '</span>';
+                                       }
+                               } else if ($diff > $letterSpacing) {
+                                       $diff-=$letterSpacing;
+                                       $diff = round($diff * $this->multiply, 2);
+                                       if ($diff != 0) {
+                                               $s = '<span class="gap" style="margin-left:' . $diff . 'px">' . $s . '</span>';
+                                       }
+                               }
+                       }
+
+                       $newSpan = array('text' => $s, 'x' => $sox);
+                       $currentGroup['spans'][] = $newSpan;
+
+
+                       $nextX = $sx + $sw;
+                       $lastIsSpace = substr($char, -1) == " ";
+               }
+               $res[] = $currentGroup;
+               return $res;
        }
 
-       protected function getCSSSize($size) {
+       protected function getCSSSize(
+       $size) {
                $size = $this->normalizeFloatValue($size);
                $size*=$this->multiply;
                return $this->getIndex($size, $this->cssSize);
        }
 
-       protected function getCSSFont($font, $document_id) {
+       protected function getCSSFont(
+       $font, $document_id) {
                $font = (string) $font;
                if (!isset($this->fontDocs[$font])) {
                        $this->fontDocs[$font] = array();
@@ -1046,7 +1106,8 @@ class wsHTML5Compiler {
                        } elseif ($alpha == 1) {
                                return '#' . substr($color, 2, 6);
                        }
-                       return 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $alpha . ')';
+                       return 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $alpha
+                                       . ')';
                }
        }
 
index 18585940b86e3e6d9c100fd66f89708696842419..e66a211d410dbbe9032c09e6ec40eb88d6e5576f 100644 (file)
@@ -18,6 +18,7 @@ $core->url->register('vieweru', 'vieweru', '^vieweru/(.*)$', array('wsUrl', 'vie
 $core->url->register('viewerp', 'viewerp', '^viewerp/(.*)$', array('wsUrl', 'viewerp'));\r
 $core->url->register('viewerh', 'viewerh', '^viewerh/(.*)$', array('wsUrl', 'viewerh'));\r
 $core->url->register('viewerhu', 'viewerhu', '^viewerhu/(.*)$', array('wsUrl', 'viewerhu'));\r
+$core->url->register('viewerht', 'viewerht', '^viewerht/(.*)$', array('wsUrl', 'viewerht'));\r
 \r
 if (DEV) {\r
        $tools = ROOT . '/../inc/tools/';\r