Author: xlawrence
Date: Wed May 16 10:06:32 2007
New Revision: 662
URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D662&repname=
=3Dcorporate_portal_templates_v2
Log:
Improve form generator template:
- added support of file inputs
- added option to enable/disable sending of E-Mails
- added option to enable/disable display of posted values in live mode
- use display tag in order to present the posted values
Added:
branches/JAHIA-5-0-SP-BRANCH/src/jsp/form_generator/eventlistener.inc
branches/JAHIA-5-0-SP-BRANCH/src/jsp/img/mail_out.gif (with props)
branches/JAHIA-5-0-SP-BRANCH/src/jsp/img/warning.gif (with props)
Modified:
branches/JAHIA-5-0-SP-BRANCH/src/java/jahiatemplates/Corporate_portal_t=
emplates_v2.properties
branches/JAHIA-5-0-SP-BRANCH/src/java/jahiatemplates/Corporate_portal_t=
emplates_v2_en.properties
branches/JAHIA-5-0-SP-BRANCH/src/java/jahiatemplates/Corporate_portal_t=
emplates_v2_fr.properties
branches/JAHIA-5-0-SP-BRANCH/src/jsp/css/edit.css
branches/JAHIA-5-0-SP-BRANCH/src/jsp/css/template_css.jsp
branches/JAHIA-5-0-SP-BRANCH/src/jsp/eventlistener.jsp
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/java/jahiatemplates/Corporate_po=
rtal_templates_v2.properties
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/src/java/jahiatemplates/Corporate_portal_templates_v2.properties&re=
v=3D662&repname=3Dcorporate_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/java/jahiatemplates/Corporate_portal_t=
emplates_v2.properties (original)
+++ branches/JAHIA-5-0-SP-BRANCH/src/java/jahiatemplates/Corporate_portal_t=
emplates_v2.properties Wed May 16 10:06:32 2007
@@ -237,6 +237,7 @@
selectBox =3D Select Box
checkboxes =3D Check boxes
submitButton =3D Sumbit button
+fileUpload =3D File Upload
=
form.sender =3D Sender
form.recipients =3D Recipients, separated by comas
@@ -253,6 +254,10 @@
form.defaultValueRequired =3D Default value is required for this type
form.storePostedValues =3D Store posted values
form.create =3D Create your form
+form.sendMail =3D Send an E-Mail of the posted values
+form.mailWillBeSentIf =3D An E-Mail will be sent if the mail server has be=
en configured by the administrator
+form.mailDisabled =3D Sending E-Mail messages is currently disabled
+form.showPostedValues =3D Show posted values in live mode
=
blog.postedBy =3D Posted by
blog.at =3D at
Modified: branches/JAHIA-5-0-SP-BRANCH/src/java/jahiatemplates/Corporate_po=
rtal_templates_v2_en.properties
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/src/java/jahiatemplates/Corporate_portal_templates_v2_en.properties=
&rev=3D662&repname=3Dcorporate_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/java/jahiatemplates/Corporate_portal_t=
emplates_v2_en.properties (original)
+++ branches/JAHIA-5-0-SP-BRANCH/src/java/jahiatemplates/Corporate_portal_t=
emplates_v2_en.properties Wed May 16 10:06:32 2007
@@ -237,6 +237,7 @@
selectBox =3D Select Box
checkboxes =3D Check boxes
submitButton =3D Sumbit button
+fileUpload =3D File Upload
=
form.sender =3D Sender
form.recipients =3D Recipients, separated by comas
@@ -253,6 +254,10 @@
form.defaultValueRequired =3D Default value is required for this type
form.storePostedValues =3D Store posted values
form.create =3D Create your form
+form.sendMail =3D Send an E-Mail of the posted values
+form.mailWillBeSentIf =3D An E-Mail will be sent if the mail server has be=
en configured by the administrator
+form.mailDisabled =3D Sending E-Mail messages is currently disabled
+form.showPostedValues =3D Show posted values in live mode
=
blog.postedBy =3D Posted by
blog.at =3D at
Modified: branches/JAHIA-5-0-SP-BRANCH/src/java/jahiatemplates/Corporate_po=
rtal_templates_v2_fr.properties
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/src/java/jahiatemplates/Corporate_portal_templates_v2_fr.properties=
&rev=3D662&repname=3Dcorporate_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/java/jahiatemplates/Corporate_portal_t=
emplates_v2_fr.properties (original)
+++ branches/JAHIA-5-0-SP-BRANCH/src/java/jahiatemplates/Corporate_portal_t=
emplates_v2_fr.properties Wed May 16 10:06:32 2007
@@ -219,6 +219,10 @@
form.storePostedValues =3D Enregistrer le contenu du formulaire dans Jahia
form.title =3D Titre
form.type =3D Type
+form.sendMail =3D Envoyer un courriel des valeurs renseign=C3=A9es
+form.mailWillBeSentIf =3D Un courriel sera envoy=C3=A9 si le serveur de me=
ssagerie a =C3=A9t=C3=A9 configur=C3=A9 par l'administrateur
+form.mailDisabled =3D L'envoi de courriels est pour le moment d=C3=A9sacti=
v=C3=A9
+form.showPostedValues =3D Montrer toutes les valeurs renseign=C3=A9es en m=
ode en ligne
groupsContainer=3DListe de groupes
hourlyRate=3DTarif horaire
junior=3Djunior
@@ -549,6 +553,7 @@
start=3DDemarrage
street=3DAdresse
submitButton =3D Bouton Envoyer
+fileUpload =3D D=C3=A9poser Fichier
survey.addAnswer =3D Veuillez ajouter une r=C3=A9ponse possible.
survey.addQuestion =3D Veuillez ajouter une question...
survey.addSeparator =3D Vous devez ajouter un =C3=A9l=C3=A9ment de type <e=
m>separator</em> =C3=A0 la fin de votre enqu=C3=AAte pour ajouter le bouton=
Envoyer.
Modified: branches/JAHIA-5-0-SP-BRANCH/src/jsp/css/edit.css
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/src/jsp/css/edit.css&rev=3D662&repname=3Dcorporate_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/css/edit.css (original)
+++ branches/JAHIA-5-0-SP-BRANCH/src/jsp/css/edit.css Wed May 16 10:06:32 2=
007
@@ -70,4 +70,20 @@
float:left;
display:block;
color:#666666;
+}
+.mailMessage {
+ background: url(../img/mail_out.gif) no-repeat;
+ padding: 0 0 5px 20px;
+ clear:both;
+ float:left;
+ display:block;
+ color:#666666;
+}
+.mailDisabled {
+ background: url(../img/warning.gif) no-repeat;
+ padding: 0 0 5px 20px;
+ clear:both;
+ float:left;
+ display:block;
+ color:#666666;
}
\ No newline at end of file
Modified: branches/JAHIA-5-0-SP-BRANCH/src/jsp/css/template_css.jsp
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/src/jsp/css/template_css.jsp&rev=3D662&repname=3Dcorporate_portal_t=
emplates_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/css/template_css.jsp (original)
+++ branches/JAHIA-5-0-SP-BRANCH/src/jsp/css/template_css.jsp Wed May 16 10=
:06:32 2007
@@ -453,3 +453,21 @@
span.compareAddedDifference,div#navigation span.compareAddedDifference,div=
#topmenu span.compareAddedDifference{background:aqua !important;border-bott=
om:none !important;color:#000 !important;display:inline !important;margin:0=
!important;padding:0 !important;}
span.compareChangedDifference,div#navigation span.compareChangedDifference=
,div#topmenu span.compareChangedDifference{background:lime !important;borde=
r-bottom:none !important;color:#000 !important;display:inline !important;ma=
rgin:0 !important;padding:0 !important;}
span.compareDeletedDifference,div#navigation a span.compareDeletedDifferen=
ce,div#topmenu span.compareDeletedDifference{background:red !important;bord=
er-bottom:none !important;color:#000 !important;display:inline !important;m=
argin:0 !important;padding:0 !important;text-decoration:line-through !impor=
tant;}
+
+
+/* Form Generator Display Tag
+----------------------------------------------- */
+.formResultListing a,table.files a{color:#402808;display:block;padding-bot=
tom:2px;}
+table.formResultListing{font-size:11px;margin:10px 0 !important;padding:0;=
width:670px;display:block;}
+table.formResultListing th, table.formResultListing td{padding:2px 10px 2p=
x 4px !important;text-align:left;vertical-align:top;}
+table.formResultListing thead tr{background:#faf1c3;}
+table.formResultListing th.sorted{background:#f6e896;font-weight:700;}
+table.formResultListing th a,table.formResultListing th a:visited{color:#0=
00;}
+table.formResultListing th a:hover{color:#000;text-decoration:underline;}
+table.formResultListing th.sorted a,table.formResultListing th.sortable a{=
background:right top;display:block;width:100%;}
+table.formResultListing th.sortable a{padding-left: 12px; background:url(<=
content:serverHttpPath/>/jsp/jahia/engines/images/arrow_off.png) no-repeat;=
padding-right:5px;}
+table.formResultListing th.order1 a{background:url(<content:serverHttpPath=
/>/jsp/jahia/engines/images/arrow_down.png) no-repeat;padding-right:5px;}
+table.formResultListing th.order2 a{background:url(<content:serverHttpPath=
/>/jsp/jahia/engines/images/arrow_up.png) no-repeat;padding-right:5px;}
+table.formResultListing tr.odd{background:#ecf7ce;}
+table.formResultListing tr.even{background:#fff;}
+div.formResultListing span.pagebanner {width:670px; display:block;} =
\ No newline at end of file
Modified: branches/JAHIA-5-0-SP-BRANCH/src/jsp/eventlistener.jsp
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/src/jsp/eventlistener.jsp&rev=3D662&repname=3Dcorporate_portal_temp=
lates_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/eventlistener.jsp (original)
+++ branches/JAHIA-5-0-SP-BRANCH/src/jsp/eventlistener.jsp Wed May 16 10:06=
:32 2007
@@ -28,6 +28,7 @@
<%@ page import=3D"org.jahia.engines.shared.*" %>
<%@ page import=3D"org.jahia.params.*" %>
<%@ page import=3D"org.jahia.registries.*" %>
+<%@ page import=3D"org.jahia.resourcebundle.*" %>
<%@ page import=3D"org.jahia.services.categories.*" %>
<%@ page import=3D"org.jahia.services.containers.*" %>
<%@ page import=3D"org.jahia.services.database.*" %>
@@ -71,6 +72,7 @@
<%@ include file=3D"blogs/eventlistener.inc"%>
<%@ include file=3D"news/eventlistener.inc"%>
<%@ include file=3D"doc/eventlistener.inc"%>
+ <%@ include file=3D"form_generator/eventlistener.inc"%>
<%
}
%>
\ No newline at end of file
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=3D662&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 Wed=
May 16 10:06:32 2007
@@ -14,7 +14,7 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---%><content:declareContainerList name=3D"forms" title=3D"List of forms">
+--%><content:declareContainerList name=3D"forms" title=3D"List of forms" c=
ontainerListType=3D"<%=3DJahiaContainerDefinition.SINGLE_TYPE%>">
<content:declareContainer>
<content:declareField name=3D"sender" title=3D"Sender" type=3D"SharedS=
mallText"
titleKey=3D"form.sender" bundleKey=3D"<%=3DresBundleID%>"/>
@@ -28,6 +28,10 @@
titleKey=3D"form.Subject" bundleKey=3D"<%=3DresBundleID%>"/>
<content:declareField name=3D"storePostedValues" title=3D"Store posted=
values" type=3D"Boolean"
titleKey=3D"form.storePostedValues" bundleKey=3D"<%=3DresBundleID%=
>" value=3D"false"/>
+ <content:declareField name=3D"showPostedValues" title=3D"Show posted v=
alues in Live mode" type=3D"Boolean"
+ titleKey=3D"form.showPostedValues" bundleKey=3D"<%=3DresBundleID%>=
" value=3D"false"/> =
+ <content:declareField name=3D"sendMail" title=3D"Send E-Mail after sub=
mit" type=3D"Boolean"
+ titleKey=3D"form.sendMail" bundleKey=3D"<%=3DresBundleID%>" value=
=3D"false"/> =
<content:declareField name=3D"displayTextAfterPost"
title=3D"Text to display after a post" type=3D"BigText"
titleKey=3D"form.displayTextAfterPost" bundleKey=3D"<%=3DresBundle=
ID%>"
@@ -42,7 +46,7 @@
titleKey=3D"form.isMandatory" bundleKey=3D"<%=3DresBundleID%>"=
/>
<%
String formTypes[] =3D {"singleLine","smallTextarea","largeTextare=
a",
- "radioButtons","selectBox","checkboxes","submitButton" };
+ "radioButtons","selectBox","checkboxes","fileUpload","submitBu=
tton" };
%>
<content:declareField name=3D"type" title=3D"Type" type=3D"SharedS=
mallText"
titleKey=3D"form.type" bundleKey=3D"<%=3DresBundleID%>"
@@ -60,6 +64,5 @@
</content:declareContainer>
</content:declareContainerList>
=
-
</content:declareContainer>
</content:declareContainerList>
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=3D662&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 We=
d May 16 10:06:32 2007
@@ -17,7 +17,7 @@
--%><%
//JahiaContainerList forms =3D jData.containers().getContainerList( "forms=
" );
=
-if (forHasBeenPosted & emptyMandatoryFields.isEmpty()) {
+if (forHasBeenPosted && emptyMandatoryFields.isEmpty()) {
%>
<%=3DdisplayTextAfterPostValue%>
<%
@@ -36,10 +36,12 @@
String recipientsCC =3D form.getFieldValue("recipientsCC","");
String subject =3D form.getFieldValue("subject","");
storePostedValues =3D "true".equals(form.getFieldValue("storeP=
ostedValues","false"));
+ boolean sendMail =3D "true".equals(form.getFieldValue("sendMai=
l","false"));
+ boolean showPostedValues =3D isEditMode || "true".equals(form.=
getFieldValue("showPostedValues","false"));
JahiaPage pageRedirected =3D (JahiaPage) form.getFieldObject("=
pageRedirected" );
isFormOK =3D ! ("".equals(sender) || "".equals( recipients ));
=
- if (jData.gui().isEditMode()) {
+ if (isEditMode) {
%><div class=3D"step1">
<span class=3D"from">
<%if ("".equals(sender)) { %><span style=3D"color:red;=
">
@@ -69,8 +71,20 @@
<span class=3D"subject" ><%=3Dsubject%></span>
<%
}
- %></div><%
- }
+ %>
+ =
+ =
+ <% if (sendMail) { %>
+ <span class=3D"mailMessage" >
+ <content:resourceBundle
resourceBundle=3D"jahiatemplates=
.Corporate_portal_templates_v2"
+ resourceName=3D"form.mailWillBeSentIf"/>
=
+ <% } else { %>
+ <span class=3D"mailDisabled" >
+ <content:resourceBundle
resourceBundle=3D"jahiatemplates.=
Corporate_portal_templates_v2"
+ resourceName=3D"form.mailDisabled"/>
+ <% } %>
+ </span></div>
+ <% }
=
if (isFormOK) {
%><div class=3D"step2">
@@ -129,8 +143,13 @@
<td>
<%
if (ResourceBundleMarker.drawMarker(resBun=
dleID,"smallTextarea","").equals(type)) {
- if (formIdStr !=3D null) {
- String postedValue =3D request.get=
Parameter("field_" + currentField.getID());
+ if (formIdStr !=3D null) { =
=
+ final String postedValue;
+ if (fupload =3D=3D null) {
+
postedValue =3D
request.getParameter("field_=
" + currentField.getID());
+
} else {
+
postedValue =3D
fupload.getParameterValues("=
field_" + currentField.getID())[0]; =
+
} =
if (postedValue !=3D null) {
logger.debug("Set default valu=
e for field [" + fieldTitle + "] to [" + postedValue + "]");
defaultValue =3D postedValue;
@@ -142,7 +161,12 @@
<%
} else if (ResourceBundleMarker.drawMarker=
(resBundleID,"largeTextarea","").equals(type)) {
if (formIdStr !=3D null) {
- String postedValue =3D request.get=
Parameter("field_" + currentField.getID());
+ final String postedValue;
+ if (fupload =3D=3D null) {
+
postedValue =3D
request.getParameter("field_=
" + currentField.getID());
+
} else {
+
postedValue =3D
fupload.getParameterValues("=
field_" + currentField.getID())[0]; =
+
} =
if (postedValue !=3D null) {
logger.debug("Set default valu=
e for field [" + fieldTitle + "] to [" + postedValue + "]");
defaultValue =3D postedValue;
@@ -155,7 +179,12 @@
} else if (ResourceBundleMarker.drawMarker=
(resBundleID,"radioButtons","").equals(type)) {
if (! "".equals(defaultValue)) {
String[] values =3D defaultValue.s=
plit(":");
- String postedValue =3D request.get=
Parameter("field_" + currentField.getID());
+ final String postedValue;
+ if (fupload =3D=3D null) {
+
postedValue =3D
request.getParameter("field_=
" + currentField.getID());
+
} else {
+
postedValue =3D
fupload.getParameterValues("=
field_" + currentField.getID())[0]; =
+
} =
for (int x=3D0; x<values.length; x=
++) {
%>
<input type=3D"radio" name=3D"=
field_<%=3DcurrentField.getID()%>" value=3D"<%=3Dvalues[x]%>"
@@ -169,7 +198,7 @@
<%
}
} else {
- if (jData.gui().isEditMode()) {
+ if (isEditMode) {
%><span style=3D"color:red;"><=
content:resourceBundle
resourceBundle=3D"jahiatemplat=
es.Corporate_portal_templates_v2"
resourceName=3D"form.defaultVa=
lueRequired"/></span><%
@@ -177,7 +206,12 @@
}
} else if (ResourceBundleMarker.drawMarker=
(resBundleID,"checkboxes","").equals(type)) {
if (! "".equals(defaultValue)) {
- String[] postedValues =3D request.=
getParameterValues("field_" + currentField.getID());
+ final String[] postedValues;
+ if (fupload =3D=3D null) {
+
postedValues =3D
request.getParameterValues(=
"field_" + currentField.getID());
+
} else {
+
postedValues =3D
fupload.getParameterValues(=
"field_" + currentField.getID()); =
+
} =
Vector postedValuesVector =3D new =
Vector();
if (postedValues !=3D null) {
for (int i =3D 0; i < postedV=
alues.length; i++){
@@ -195,9 +229,10 @@
<%
}
} else {
- if (jData.gui().isEditMode()) {
- %><span style=3D"color:red;">D=
efault value is
- required for this type</sp=
an><%
+ if (isEditMode) {
+ %><span style=3D"color:red;"><=
content:resourceBundle
+ resourceBundle=3D"jahiatemplat=
es.Corporate_portal_templates_v2"
+ resourceName=3D"form.defaultVa=
lueRequired"/></span><%
}
}
} else if (ResourceBundleMarker.drawMarker=
(resBundleID,"selectBox","").equals(type)) {
@@ -205,7 +240,12 @@
%>
<select name=3D"field_<%=3Dcurrent=
Field.getID()%>">
<%
- String[] postedValues =3D request.=
getParameterValues("field_" + currentField.getID());
+ final String[] postedValues;
+ if (fupload =3D=3D null) {
+
postedValues =3D
request.getParameterValues(=
"field_" + currentField.getID());
+
} else {
+
postedValues =3D
fupload.getParameterValues(=
"field_" + currentField.getID()); =
+
} =
Vector postedValuesVector =3D new =
Vector();
if (postedValues !=3D null) {
for (int i =3D 0; i < postedV=
alues.length; i++){
@@ -226,14 +266,30 @@
</select>
<%
} else {
- if (jData.gui().isEditMode()) {
- %><span style=3D"color:red;">D=
efault value is
- required for this type</sp=
an><%
+ if (isEditMode) {
+ %><span style=3D"color:red;"><c=
ontent:resourceBundle
+ resourceBundle=3D"jahiatemplat=
es.Corporate_portal_templates_v2"
+ resourceName=3D"form.defaultVa=
lueRequired"/></span><%
}
}
- %>
+ =
+ } else if (ResourceBundleMarker.drawMarker=
(resBundleID,"fileUpload","").equals(type)) { =
+ if (! "".equals(defaultValue)) { =
+ %>
+ <script
type=3D"text/javascript"> =
=
+
document.submitToContainerList.encty=
pe =3D "multipart/form-data";
+
document.submitToContainerList.encoding =3D "multi=
part/form-data";
+ </script>
+ <input size=3D"80"
type=3D"file" name=3D=
"field_<%=3DcurrentField.getID()%>" />
+ <% =
+ } else {
+ if (isEditMode) {
+ %><span style=3D"color:red;"><cont=
ent:resourceBundle
+ resourceBundle=3D"jahiatemplat=
es.Corporate_portal_templates_v2"
+ resourceName=3D"form.defaultVa=
lueRequired"/></span><%
+ }
+ }
=
- <%
} else if (ResourceBundleMarker.drawMarker=
(resBundleID,"submitButton","").equals(type)) {
if ("".equals(defaultValue)){
defaultValue =3D "Submit";
@@ -244,7 +300,12 @@
<%
} else {
if (formIdStr !=3D null) {
- String postedValue =3D request.get=
Parameter("field_" + currentField.getID());
+ final String postedValue;
+ if (fupload =3D=3D null) {
+
postedValue =3D
request.getParameter("field_=
" + currentField.getID());
+
} else {
+
postedValue =3D
fupload.getParameterValues("=
field_" + currentField.getID())[0]; =
+
}
if (postedValue !=3D null) {
logger.debug("Set default valu=
e for field [" + fieldTitle + "] to [" + postedValue + "]");
defaultValue =3D postedValue;
@@ -264,56 +325,86 @@
</table>
</form>
<%
- if (storePostedValues) {
- // display tables
- %>
- <table class=3D"forms">
- <tr class=3D"title">
- <%
- fieldsEnum =3D fields.getContainers();
- Vector fieldNames =3D new Vector();
- List ids =3D new ArrayList();
- while (fieldsEnum.hasMoreElements()) {
- JahiaContainer currentField =3D (JahiaContaine=
r) fieldsEnum.nextElement();
- Map allValues =3D new HashMap();
- String type =3D currentField.getFieldValue("ty=
pe","");
- if (! ResourceBundleMarker.drawMarker(resBundl=
eID,"submitButton","").equals(type)) {
- String fieldTitle =3D currentField.getFiel=
dValue("fieldTitle","");
- JahiaContainerList list =3D currentField.g=
etContainerList("values");
- Enumeration values =3D list.getContainers(=
);
- while (values.hasMoreElements()) {
- JahiaContainer c=3D (JahiaContainer)va=
lues.nextElement();
- allValues.put(c.getFieldValue("id"),c.=
getFieldValue("value"));
- if (!ids.contains(c.getFieldValue("id"=
))) ids.add(c.getFieldValue("id"));
- }
- fieldNames.add(allValues);
- %>
- <td><%=3DfieldTitle%></td>
- <%
- }
- }
- %>
- </tr>
- <%
- for (Iterator iterator =3D ids.iterator();iter=
ator.hasNext();) {
- String id =3D (String) iterator.next();
- %><tr><%
- for (Iterator iterator2 =3D fieldNames.ite=
rator();iterator2.hasNext();) {
- Map v =3D (Map) iterator2.next();
- %><td><%=3Dv.get(id)!=3Dnull?v.get(id)=
:""%></td><%
- }
- %></tr><%
- } =
+ =
+ ContainerListBean fieldsBean =3D new ContainerListBean=
(fields,jParams);
+
jData.gui().html().drawBeginActionMenu(fieldsBean , null,
+ contextUrl + "/img/actions/note_add.gif",
false, "",=
"jahiatemplates.Corporate_portal_templates_v2",
+ "add", out);
+ =
+ if (showPostedValues) { =
+ fieldsEnum =3D fields.getContainers();
+ final Map valuesByRow =3D new HashMap();
+ final List theContainers =3D new ArrayList();
+ while (fieldsEnum.hasMoreElements()) {
+ final JahiaContainer currentField =3D
(JahiaContain=
er) fieldsEnum.nextElement();
+ final String type =3D currentField.getFieldValue=
("type","");
+ if (! ResourceBundleMarker.drawMarker(resBundleI=
D,"submitButton","").equals(type)) {
+ theContainers.add(currentField);
+ }
+ =
+ final JahiaContainerList list =3D currentField.g=
etContainerList("values");
+ final Enumeration values =3D list.getContainers(=
); =
+ =
+ while (values.hasMoreElements()) {
+ final JahiaContainer c =3D (JahiaContainer)va=
lues.nextElement();
+ final String key =3D
c.getFieldValue("id");
+ List rowValues =3D (List)
valuesByRow.get(key);
+ if (rowValues =3D=3D null) {
+ rowValues =3D new
ArrayList(fields.size()); =
+ }
+ =
+ final String value =3D
c.getFieldValue("value"=
);
+ if (value =3D=3D null) {
+ rowValues.add("");
+ } else {
+ rowValues.add(value);
+ }
+ =
+ valuesByRow.put(key, rowValues);
+ } =
+ }
+ =
+ request.setAttribute( "formResultList", new ArrayList=
(valuesByRow.values()));
+ final org.jahia.utils.displaytag.CaseInsensitiveComp=
arator comparator =3D
+ new org.jahia.utils.displaytag.CaseInsensitive=
Comparator(jData.getProcessingContext().getLocale());
+ =
+ %> =
+ <br/> <br/> =
+ <div class=3D"formResultListing"> =
+ <display:table name=3D"formResultList" class=3D"formR=
esultListing" pagesize=3D"15" id=3D"formResultListID"
+ requestURI=3D'<%=3DbypassUrl%>'
defaultsort=3D"1">
+ <% =
+ final List rowValues =3D (List)
pageContext.getAt=
tribute("formResultListID");
+ final Iterator columns =3D
theContainers.iterator=
();
+ int i=3D0;
+ while (columns.hasNext()) {
+
final JahiaContainer currentField =3D
(JahiaContainer) colu=
mns.next(); =
+
String theValue =3D "";
+
try { =
+
theValue =3D (String)
rowValues.get(i); =
+
if
(theValue.startsWith(contextPath)) {
+
final
StringBuffer buff =3D new StringBuffer(); =
+
buff.append("<a href=3D\"");
+
buff.append(theValue);
+
buff.append("\">");
+
buff.append(org.jahia.engines.filemanager.TableEntry.j=
avascriptDecode(theValue));
+
buff.append("</a>"); =
+
theValue =3D buff.toString();
+
}
+
} catch (Exception e) {
+
} =
%>
- </table>
+ <display:column
title=3D"<%=3DcurrentField.getFie=
ldValue("fieldTitle","")%>" sortable=3D"true" comparator=3D"<%=3D comparato=
r %>" >
+ <%=3DtheValue%>
+ </display:column>
+ <% i++; %>
+ <% } %> =
+ </display:table> =
+ </div> =
<%
}
}
- ContainerListBean fieldsBean =3D new ContainerListBean(fie=
lds,jParams);
- jData.gui().html().drawBeginActionMenu(fieldsBean , null,
- contextUrl + "/img/actions/note_add.gif", false, "","j=
ahiatemplates.Corporate_portal_templates_v2",
- "add", out);
- %></div><%
+ %></div><% =
}
}
if (t =3D=3D 0) {
Added: branches/JAHIA-5-0-SP-BRANCH/src/jsp/form_generator/eventlistener.inc
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/branches/JAHIA=
-5-0-SP-BRANCH/src/jsp/form_generator/eventlistener.inc&rev=3D662&repname=
=3Dcorporate_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/eventlistener.inc (=
added)
+++ branches/JAHIA-5-0-SP-BRANCH/src/jsp/form_generator/eventlistener.inc W=
ed May 16 10:06:32 2007
@@ -0,0 +1,42 @@
+<%--
+Copyright 2002-2006 Jahia Ltd
+
+Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (JCDD=
L), =
+Version 1.0 (the "License"), or (at your option) any later version; you ma=
y =
+not use this file except in compliance with the License. You should have =
+received a copy of the License along with this program; if not, you may ob=
tain =
+a copy of the License at =
+
+ http://www.jahia.org/license/
+
+Unless required by applicable law or agreed to in writing, software =
+distributed under the License is distributed on an "AS IS" BASIS, =
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. =
+See the License for the specific language governing permissions and =
+limitations under the License.
+--%>
+
+<% =
+if ( "fields".equals(theContainer.getDefinition().getName()) ){
+ final String type =3D theContainer.getFieldValue("type", "");
+ final String defaultValue =3D
theContainer.getFieldValue("defaultValue"=
,"");
+ final String resBundleID =3D "CORPORATE_PORTAL_TEMPLATES_V2";
+ if ( "addContainerEngineBeforeSave".equals(eventName) && =
+
ResourceBundleMarker.drawMarker(resBundleID,"fileUpload","").equals(=
type) &&
+ "".equals(defaultValue)) {
+ logger.debug("Start eventlistener for event addContainerEngineBefore=
Save for 'fields' Container List");
+ =
+ JahiaField theField =3D theContainer.getField("defaultValue");
+ theField.setValue("/shared/forms/" + theContainer.getFieldValue("fie=
ldTitle",""));
+ feh.addUpdatedField(theField.getID(), theField.getLanguageCode());
+ updatedFields.add(new Integer(theField.getID()));
+ =
+ logger.debug ("Flushing Output Cache");
+ try {
+ ServicesRegistry.getInstance().getCacheService().getHtmlCacheI=
nstance().flush();
+ } catch (final Throwable t) {
+ logger.error("Error while trying to flush HTML cache", t);
+ }
+ }
+}
+%>
\ No newline at end of file
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=3D662&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 We=
d May 16 10:06:32 2007
@@ -15,7 +15,16 @@
See the License for the specific language governing permissions and
limitations under the License.
--%><%
-String formIdStr =3D request.getParameter("formId");
+final String formIdStr;
+final org.jahia.tools.files.FileUpload fupload;
+if (ProcessingContext.isMultipartRequest(request)) {
+ fupload =3D jData.params().getFileUpload();
+ formIdStr =3D fupload.getParameterValues("formId")[0]; =
+} else {
+ formIdStr =3D request.getParameter("formId");
+ fupload =3D null;
+}
+
boolean forHasBeenPosted =3D false;
String displayTextAfterPostValue =3D "";
if (formIdStr !=3D null) {
@@ -31,6 +40,8 @@
String recipientsCC =3D form.getFieldValue("recipientsCC","");
String subject =3D form.getFieldValue("subject","");
storePostedValues =3D "true".equals(form.getFieldValue("storePostedVal=
ues","false"));
+ boolean sendMail =3D "true".equals(form.getFieldValue("sendMail","fals=
e"));
+ boolean showPostedValues =3D "true".equals(form.getFieldValue("showPos=
tedValues","false"));
String alertText =3D form.getFieldValue("alertText","");
displayTextAfterPostValue =3D form.getFieldValue("displayTextAfterPost=
",
getResourceBundle("form.displayTextAfterPostValue",
@@ -42,24 +53,42 @@
logger.debug("recipientsCC: " + recipientsCC);
logger.debug("subject: " + subject);
logger.debug("displayTextAfterPostValue: " + displayTextAfterPostValue=
);
-
-
+ logger.debug("storePostedValues: " + storePostedValues);
+ logger.debug("sendMail: " + sendMail);
=
StringBuffer mailBody =3D new StringBuffer();
// get all values posted
JahiaContainerList fields =3D form.getContainerList( "fields" );
- String id =3D ""+System.currentTimeMillis();
+ String id =3D String.valueOf(System.currentTimeMillis());
if (fields !=3D null) {
Vector filesContainerFields =3D new Vector();
Enumeration fieldsEnum =3D fields.getContainers();
while (fieldsEnum.hasMoreElements()) {
JahiaContainer currentField =3D (JahiaContainer) fieldsEnum.ne=
xtElement();
String type =3D currentField.getFieldValue("type","");
+ =
+ String path =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 (! ResourceBundleMarker.drawMarker(resBundleID,"submitButto=
n","").equals(type)) {
String fieldTitle =3D currentField.getFieldValue("fieldTit=
le","");
String isMandatoryStr =3D currentField.getFieldValue("isMa=
ndatory","false");
boolean isMandatory =3D "true".equals(isMandatoryStr);
- String[] postedValues =3D request.getParameterValues("fiel=
d_" + currentField.getID());
+ final String[] postedValues;
+ if (isFileUploadType) {
+ postedValues =3D new String[] {(path =3D=3D
null ? "" : =
path)}; =
+ } else {
+ if (fupload =3D=3D null) {
+ postedValues =3D
request.getParameterValues("field_" +=
currentField.getID());
+ } else {
+ postedValues =3D
fupload.getParameterValues("field_" +=
currentField.getID()); =
+ }
+ }
StringBuffer postedValuesSB =3D new StringBuffer("");
if (postedValues !=3D null) {
for (int i =3D 0; i < postedValues.length; i++){
@@ -70,46 +99,61 @@
}
}
logger.debug("-- " + fieldTitle + ": " + postedValuesSB.to=
String());
- mailBody.append(fieldTitle + " : " + postedValuesSB.toStri=
ng() + "\n");
+ 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");
+ }
if (isMandatory && "".equals(postedValuesSB.toString())) {
logger.debug("Field [" + fieldTitle + "] is mandatory"=
);
emptyMandatoryFields.add(new Integer(currentField.getI=
D()));
}
if (storePostedValues) {
- JahiaContainerList storePostedForm =3D currentField.ge=
tContainerList( "values");
+ JahiaContainerList storePostedForm =3D currentField.ge=
tContainerList("values");
if ( storePostedForm !=3Dnull && storePostedForm.getID=
()=3D=3D0 ) {
logger.debug("storePostedForm !=3Dnull && storePos=
tedForm.getID()=3D=3D0");
ContainerListBean storePostedFormBean =3D new Cont=
ainerListBean(storePostedForm,jParams);
- org.jahia.registries.ServicesRegistry.getInstance(=
).getJahiaContainersService().
+ ServicesRegistry.getInstance().getJahiaContainersS=
ervice().
saveContainerListInfo(storePostedForm, jPa=
rams.getContentPage().getAclID(), jParams);
storePostedForm =3D storePostedFormBean.getJahiaCo=
ntainerList();
}
ContainerListBean storePostedFormBean =3D new Containe=
rListBean(storePostedForm,jParams);
pageContext.setAttribute("storePostedFormBean",storePo=
stedFormBean);
=
- if (forHasBeenPosted & emptyMandatoryFields.isEmpty())=
{
+ if (forHasBeenPosted && emptyMandatoryFields.isEmpty()=
) {
Map map =3D new HashMap();
- Map oldMap =3D jData.getProcessingContext().getPar=
ameterMap();
- map.put("value",request.getParameterValues("field_=
" + currentField.getID()));
+ final Map oldMap;
+ if (fupload =3D=3D null) {
+ oldMap =3D
jData.getProcessingContext().getParameter=
Map();
+ } else {
+ oldMap =3D
fupload.getParameterMap();
+ }
+ =
+ if (isFileUploadType) {
+ map.put("value", new String[] {(path
=3D=3D null=
? "" : path)}); =
+ } else {
+ if (fupload =3D=3D null) {
+
map.put("value",request.getParameterValues("field_=
" + currentField.getID()));
+ } else {
+
map.put("value",fupload.getParameterValues("field_=
" + currentField.getID()));
+ } =
+ }
map.put("id",new String[] {id});
jData.getProcessingContext().setParameterMap(map);
%>
<content:formContentMapperHandler listName=3D'stor=
ePostedFormBean'
- submitMarker=3D"formId" immediatePublication=
=3D"true"/>
+ submitMarker=3D"formId" immediatePublication=
=3D"<%=3DshowPostedValues%>"/>
<%
jData.getProcessingContext().setParameterMap(oldMa=
p);
}
}
}
}
- if (storePostedValues) {
-
-
- }
}
if (emptyMandatoryFields.isEmpty()) {
//Send the mail
- if (forHasBeenPosted) {
+ if (forHasBeenPosted && sendMail) {
sender =3D JahiaTools.html2text(sender);
recipients =3D JahiaTools.html2text(recipients);
recipientsCC =3D JahiaTools.html2text(recipientsCC);
Added: branches/JAHIA-5-0-SP-BRANCH/src/jsp/img/mail_out.gif
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/branches/JAHIA=
-5-0-SP-BRANCH/src/jsp/img/mail_out.gif&rev=3D662&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
Binary file - no diff available.
Added: branches/JAHIA-5-0-SP-BRANCH/src/jsp/img/warning.gif
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/branches/JAHIA=
-5-0-SP-BRANCH/src/jsp/img/warning.gif&rev=3D662&repname=3Dcorporate_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
Binary file - no diff available.
_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list