Hans,

I noticed that you have replaced the method - which is very good.
But now I see lot of *tabs* in your code.
I am surprised to see how you can miss such things after seeing so many comments on your work.
Can you please take care of this code ASAP? - Thanks!

-            out.close();
-        }
+    public static void copyFile(File sourceLocation , File targetLocation) 
throws IOException {
+       if (sourceLocation.isDirectory()) {
+               throw new IOException("File is a directory, not a file, cannot 
copy") ;
+       } else {
+
+               InputStream in = new FileInputStream(sourceLocation);
+               OutputStream out = new FileOutputStream(targetLocation);
+
+               // Copy the bits from instream to outstream
+               byte[] buf = new byte[1024];
+               int len;
+               while ((len = in.read(buf)) > 0) {
+                       out.write(buf, 0, len);
+               }
+               in.close();
+               out.close();
+       }
    }
}

--
Regards
Ashish Vijaywargiya
HotWax Media Pvt. Ltd.
http://www.hotwaxmedia.com

Helping hand around the World ...
USA | Italy | New Zealand | India



[email protected] wrote:
Author: hansbak
Date: Fri Sep 25 13:37:35 2009
New Revision: 818850

URL: http://svn.apache.org/viewvc?rev=818850&view=rev
Log:
added a chapter how to internationalize the help files show with: http://localhost:8080/cmssite/cms/APACHE_OFBIZ_HTML#helpInternationalization
Modified:
    ofbiz/trunk/applications/commonext/documents/ApacheOfbizTechnical.xml
    ofbiz/trunk/applications/content/data/ContentHelpData.xml
    ofbiz/trunk/applications/content/data/ContentTypeData.xml
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilMisc.java

Modified: ofbiz/trunk/applications/commonext/documents/ApacheOfbizTechnical.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/commonext/documents/ApacheOfbizTechnical.xml?rev=818850&r1=818849&r2=818850&view=diff
==============================================================================
--- ofbiz/trunk/applications/commonext/documents/ApacheOfbizTechnical.xml 
(original)
+++ ofbiz/trunk/applications/commonext/documents/ApacheOfbizTechnical.xml Fri 
Sep 25 13:37:35 2009
@@ -222,6 +222,30 @@
             </orderedlist>
         </para>
     </section>
+    <section>
+        <title><anchor id="helpInternationalization"/>Internationalization of the 
help system</title>
+        <para>
+ Because the help system is making use of the content component, internationalization of the help files is very easy because + it is a basic function of the content component. If you want to make a translation of an existing help file, make a copy in the same directory + and make it unique by attaching the "_languageCode" at he end.
+            Create, as also was done for the english version a dataresource 
and content record in the data/${componentName}HelpData.xml file.
+            Then create an ContentAssoc record in 
data/${componentName}HelpData.xml file to associate this new file with the 
english file with the type
+            ALTERNATE_LOCALE. Please find below an example from the 
ContentHelpData.xml for a Dutch version of the root help file.
+            <programlisting>
+    &lt;!-- how to create alternative locales --&gt;
+ &lt;DataResource dataResourceId="HELP_ROOT_NL" localeString="nl" dataResourceTypeId="OFBIZ_FILE" + objectInfo="applications/content/data/helpdata/HELP_ROOT_NL.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" + dataResourceName="Help system root" mimeTypeId="text/xml" isPublic="Y" /&gt; + &lt;Content contentId="HELP_ROOT_NL" contentTypeId="DOCUMENT" templateDataResourceId="HELP_TEMPL" + dataResourceId="HELP_ROOT_NL" localeString="nl" statusId="CTNT_IN_PROGRESS" + contentName="Help system root in dutch" mimeTypeId="text/html"/&gt; + &lt;ContentAssoc contentId="HELP_ROOT" contentIdTo="HELP_ROOT_NL" + contentAssocTypeId="ALTERNATE_LOCALE" fromDate="2006-01-12 01:01:01"/&gt; + </programlisting> + The switching between locales is from then on completely automatic.
+        </para>
+    </section>
+ </appendix> <appendix>

Modified: ofbiz/trunk/applications/content/data/ContentHelpData.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/data/ContentHelpData.xml?rev=818850&r1=818849&r2=818850&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/data/ContentHelpData.xml (original)
+++ ofbiz/trunk/applications/content/data/ContentHelpData.xml Fri Sep 25 
13:37:35 2009
@@ -34,7 +34,9 @@
     <DataResource dataResourceId="HELP_ROOT" localeString="en" dataResourceTypeId="OFBIZ_FILE" 
objectInfo="applications/content/data/helpdata/HELP_ROOT.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Help 
system root" mimeTypeId="text/xml" isPublic="Y" />
     <Content contentId="HELP_ROOT" contentTypeId="DOCUMENT" templateDataResourceId="HELP_TEMPL" 
dataResourceId="HELP_ROOT" localeString="en" statusId="CTNT_IN_PROGRESS" contentName="Help system root" 
mimeTypeId="text/html"/>
     <DataResource dataResourceId="HELP_ROOT_NL" localeString="nl" dataResourceTypeId="OFBIZ_FILE" 
objectInfo="applications/content/data/helpdata/HELP_ROOT_NL.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" 
dataResourceName="Help system root" mimeTypeId="text/xml" isPublic="Y" />
+
     <!-- how to create alternative locales -->
+    <DataResource dataResourceId="HELP_ROOT_NL" localeString="nl" dataResourceTypeId="OFBIZ_FILE" 
objectInfo="applications/content/data/helpdata/HELP_ROOT_NL.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" 
dataResourceName="Help system root" mimeTypeId="text/xml" isPublic="Y" />
     <Content contentId="HELP_ROOT_NL" contentTypeId="DOCUMENT" templateDataResourceId="HELP_TEMPL" 
dataResourceId="HELP_ROOT_NL" localeString="nl" statusId="CTNT_IN_PROGRESS" contentName="Help system root in dutch" 
mimeTypeId="text/html"/>
     <ContentAssoc contentId="HELP_ROOT" contentIdTo="HELP_ROOT_NL" 
contentAssocTypeId="ALTERNATE_LOCALE" fromDate="2006-01-12 01:01:01"/>
Modified: ofbiz/trunk/applications/content/data/ContentTypeData.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/data/ContentTypeData.xml?rev=818850&r1=818849&r2=818850&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/data/ContentTypeData.xml (original)
+++ ofbiz/trunk/applications/content/data/ContentTypeData.xml Fri Sep 25 
13:37:35 2009
@@ -265,7 +265,4 @@
     <DataResource dataResourceId="DOCBOOK_HTML_TEMPL" dataResourceTypeId="OFBIZ_FILE" 
objectInfo="applications/content/template/docbook/html/docbook.xsl" dataTemplateTypeId="XSLT" statusId="CTNT_IN_PROGRESS" 
dataResourceName="Help template file" mimeTypeId="text/html" isPublic="Y"/>
     <DataResource dataResourceId="DOCBOOK_PDF_TEMPL" dataResourceTypeId="OFBIZ_FILE" 
objectInfo="applications/content/template/docbook/fo/docbook.xsl" dataTemplateTypeId="XSLT" statusId="CTNT_IN_PROGRESS" 
dataResourceName="Help template file" mimeTypeId="text/html" isPublic="Y"/>
- <!-- localization example file -->
-    <DataResource dataResourceId="HELP_ROOT_NL" localeString="nl" dataResourceTypeId="OFBIZ_FILE" 
objectInfo="applications/content/data/helpdata/HELP_ROOT_NL.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" 
dataResourceName="Help system root" mimeTypeId="text/xml" isPublic="Y" />
- </entity-engine-xml>

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilMisc.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilMisc.java?rev=818850&r1=818849&r2=818850&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilMisc.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilMisc.java Fri Sep 25 
13:37:35 2009
@@ -1014,23 +1014,22 @@
             this.wait(timeout);
         }
     }
- public static void copyFile(File sourceLocation , File targetLocation) throws 
IOException {
- - if (sourceLocation.isDirectory()) {
-                throw new IOException("File is a directory, not a file, cannot 
copy") ;
-        } else {
- - InputStream in = new FileInputStream(sourceLocation);
-             OutputStream out = new FileOutputStream(targetLocation);
- - // Copy the bits from instream to outstream
-            byte[] buf = new byte[1024];
-            int len;
-            while ((len = in.read(buf)) > 0) {
-                out.write(buf, 0, len);
-            }
-            in.close();
-            out.close();
-        }
+    public static void copyFile(File sourceLocation , File targetLocation) 
throws IOException {
+       if (sourceLocation.isDirectory()) {
+               throw new IOException("File is a directory, not a file, cannot 
copy") ;
+       } else {
+
+               InputStream in = new FileInputStream(sourceLocation);
+               OutputStream out = new FileOutputStream(targetLocation);
+
+               // Copy the bits from instream to outstream
+               byte[] buf = new byte[1024];
+               int len;
+               while ((len = in.read(buf)) > 0) {
+                       out.write(buf, 0, len);
+               }
+               in.close();
+               out.close();
+       }
     }
 }


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to