Author: rfelden
Date: Tue Oct 16 17:12:28 2007
New Revision: 811

URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D811&repname=
=3Dcorporate_portal_templates_v2
Log:
Form generator upload field : the 'default value' has more meaning, and the=
 mail sent after a form has been posted contains a valid URL concerning fil=
e uploads

declarations.inc : added icon for PNG files

Modified:
    branches/JAHIA-5-0-SP-BRANCH/src/jsp/common/declarations.inc
    branches/JAHIA-5-0-SP-BRANCH/src/jsp/form_generator/definitions.inc
    branches/JAHIA-5-0-SP-BRANCH/src/jsp/form_generator/display_form.inc
    branches/JAHIA-5-0-SP-BRANCH/src/jsp/form_generator/process_post.inc

Modified: branches/JAHIA-5-0-SP-BRANCH/src/jsp/common/declarations.inc
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/src/jsp/common/declarations.inc&rev=3D811&repname=3Dcorporate_porta=
l_templates_v2
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/src/jsp/common/declarations.inc (original)
+++ branches/JAHIA-5-0-SP-BRANCH/src/jsp/common/declarations.inc Tue Oct 16=
 17:12:28 2007
@@ -273,11 +273,11 @@
 String extention[] =3D {"doc", "xls", "ppt", "zip", "pdf", "txt", "html",
                       "htm", "waw", "mp3", "jpg", "jpeg", "gif", "tif",
                       "avi", "mpeg", "mpa", "mpg", "mpe", "mov", "exe",
-                      "text", "rar", "tgz","dir"};
+                      "text", "rar", "tgz","dir", "png"};
 String picto[]     =3D {"doc", "xls", "ppt", "zip", "pdf", "txt", "html",
                       "html", "sound", "sound", "img", "img", "img",
                       "img", "video", "video", "video", "video",
-                      "video", "video", "exe", "txt", "zip", "tgz","dir"};
+                      "video", "video", "exe", "txt", "zip", "tgz","dir", =
"img"};
 =

 public String getPicto (String fileName)
 throws JahiaException

Modified: branches/JAHIA-5-0-SP-BRANCH/src/jsp/form_generator/definitions.i=
nc
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/src/jsp/form_generator/definitions.inc&rev=3D811&repname=3Dcorporat=
e_portal_templates_v2
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/src/jsp/form_generator/definitions.inc (or=
iginal)
+++ branches/JAHIA-5-0-SP-BRANCH/src/jsp/form_generator/definitions.inc Tue=
 Oct 16 17:12:28 2007
@@ -60,15 +60,8 @@
                                        titleKey=3D"form.value" 
bundleKey=3D"<%=3DresBundleID%>"/>
                                        <content:declareField name=3D"id" 
title=3D"Id" type=3D"SharedS=
mallText" readOnly=3D"true"
                                        titleKey=3D"form.id" 
bundleKey=3D"<%=3DresBundleID%>"/>    =

-                       </content:declareContainer>
-        </content:declareContainerList>
-        <content:declareContainerList name=3D"fileValues" aliasNames=3D"fi=
leValues"
-                       title=3D"Values" 
containerListType=3D"<%=3DJahiaContainerDefinit=
ion.SINGLE_TYPE%>">
-                       <content:declareContainer>
                                        <content:declareField 
name=3D"fileValue" title=3D"Value" type=
=3D"File"
                                        titleKey=3D"form.value" 
bundleKey=3D"<%=3DresBundleID%>"/>
-                                       <content:declareField name=3D"id" 
title=3D"Id" type=3D"SharedS=
mallText" readOnly=3D"true"
-                                       titleKey=3D"form.id" 
bundleKey=3D"<%=3DresBundleID%>"/>    =

                        </content:declareContainer>
         </content:declareContainerList>
     </content:declareContainer>

Modified: branches/JAHIA-5-0-SP-BRANCH/src/jsp/form_generator/display_form.=
inc
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/src/jsp/form_generator/display_form.inc&rev=3D811&repname=3Dcorpora=
te_portal_templates_v2
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/src/jsp/form_generator/display_form.inc (o=
riginal)
+++ branches/JAHIA-5-0-SP-BRANCH/src/jsp/form_generator/display_form.inc Tu=
e Oct 16 17:12:28 2007
@@ -304,7 +304,6 @@
                                     }
 =

                                 } else if (ResourceBundleMarker.drawMarker=
(resBundleID,"fileUpload","").equals(type)) {    =

-                                       if (! "".equals(defaultValue)) { =

                                                %>
                                                <script 
type=3D"text/javascript">       =
                                        =

                                                    
document.submitToContainerList.encty=
pe =3D "multipart/form-data";
@@ -312,13 +311,11 @@
                                                </script>
                                                <input size=3D"80" 
type=3D"file" name=3D=
"field_<%=3DcurrentField.getID()%>" />
                                     <%
-                                       } else {
-                                               if (isEditMode) {
+                                               if (isEditMode && 
"".equals(defaultValue=
)) {
                                         %><span style=3D"color:red;"><cont=
ent:resourceBundle
                                             resourceBundle=3D"jahiatemplat=
es.Corporate_portal_templates_v2"
-                                            resourceName=3D"form.defaultVa=
lueRequired"/></span><%
+                                            resourceName=3D"form.defaultPa=
thWillBeUsed"/></span><%
                                     }
-                                       }
 =

                                 } else if (ResourceBundleMarker.drawMarker=
(resBundleID,"submitButton","").equals(type)) {
                                     %>

Modified: branches/JAHIA-5-0-SP-BRANCH/src/jsp/form_generator/process_post.=
inc
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/src/jsp/form_generator/process_post.inc&rev=3D811&repname=3Dcorpora=
te_portal_templates_v2
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/src/jsp/form_generator/process_post.inc (o=
riginal)
+++ branches/JAHIA-5-0-SP-BRANCH/src/jsp/form_generator/process_post.inc Tu=
e Oct 16 17:12:28 2007
@@ -68,12 +68,21 @@
             String type =3D currentField.getFieldValue("type","");
             =

             String path =3D null;
+            String storePath =3D null ;
             final boolean isFileUploadType =3D ResourceBundleMarker.drawMa=
rker(resBundleID,"fileUpload","").equals(type);
             if (isFileUploadType) {
                        final 
org.jahia.engines.filemanager.DAVFilemanager_Engine da=
vEngine =3D org.jahia.engines.filemanager.DAVFilemanager_Engine.getInstance=
();
                        final String uploadPath =3D 
currentField.getFieldValue("defa=
ultValue","");
-                       path =3D 
davEngine.uploadAndRenameAutomatically(uploadPath, =
jData.params(), "field_" + currentField.getID());                       =

-            } =

+                       if (uploadPath.equals("")) {
+                               // uses a default path if none specified 
(generated folder)
+                               // this will be displayed next to the file 
field when in ed=
it mode
+                               path =3D 
davEngine.uploadAndRenameAutomatically("/shared/fo=
rms/missing_path", jData.params(), "field_" + currentField.getID()) ;
+                       } else {
+                               path =3D 
davEngine.uploadAndRenameAutomatically(uploadPath,=
 jData.params(), "field_" + currentField.getID());
+                       }
+                       DAVFileAccess dfa =3D new DAVFileAccess(jParams, 
jParams.get=
Site(), jParams.getUser(), path);
+                                                               storePath =3D 
dfa.getFullPath(jParams) ;
+            }
             =

             if (! ResourceBundleMarker.drawMarker(resBundleID,"submitButto=
n","").equals(type)) {
                 String fieldTitle =3D currentField.getFieldValue("fieldTit=
le","");
@@ -81,7 +90,7 @@
                 boolean isMandatory =3D "true".equals(isMandatoryStr);
                 final String[] postedValues;
                 if (isFileUploadType) {
-                               postedValues =3D new String[] {(path =3D=3D 
null ? "" : =
path)};                 =

+                               postedValues =3D new String[] {(path =3D=3D 
null ? "" : =
storePath)};                    =

                 } else {
                                if (fupload =3D=3D null) {
                                                postedValues =3D 
request.getParameterValues("field_" +=
 currentField.getID());
@@ -99,12 +108,7 @@
                     }
                 }
                 logger.debug("-- " + fieldTitle + ": " + postedValuesSB.to=
String());
-                if (isFileUploadType) {
-                               mailBody.append(fieldTitle).append(" : 
").append(request=
.getScheme()).append("://").append(request.getServerName()).    =

-                                               
append(":").append(request.getServerPort()).append(pos=
tedValuesSB.toString()).append("\n");           =

-                } else {
-                               mailBody.append(fieldTitle).append(" : 
").append(postedV=
aluesSB.toString()).append("\n");
-               }
+                mailBody.append(fieldTitle).append(" : ").append(postedVal=
uesSB.toString()).append("\n");
                 if (isMandatory && "".equals(postedValuesSB.toString())) {
                     logger.debug("Field [" + fieldTitle + "] is mandatory"=
);
                     emptyMandatoryFields.add(new Integer(currentField.getI=
D()));

_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list

Reply via email to