32. Araxis Merge File Comparison Report

Produced by Araxis Merge on Fri Oct 19 14:25:21 2007 UTC. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a reasonably standards compliant browser such as the latest version of Internet Explorer. For optimum results when printing this report, enable printing of background images and colours in your browser and use landscape orientation.

32.1 Files compared

#FileLocationLast Modified
1display_form.incC:\jahia\template_diff\V2_JAHIA_5_0_0\src\jsp\form_generatorFri Oct 19 14:18:35 2007 UTC
2display_form.incC:\jahia\template_diff\V2_JAHIA_5_0_3\src\jsp\form_generatorFri Oct 19 14:16:51 2007 UTC

32.2 Comparison summary

DescriptionBetween
Files 1 and 2
BlocksLines
Unchanged41279
Changed27291
Inserted1048
Removed312

32.3 Comparison options

WhitespaceAll differences in whitespace within lines are ignored
Character caseDifferences in character case are significant
Line endingsDifferences in line endings (CR and LF characters) are ignored
CR/LF charactersHidden in comparison detail

32.4 Active regular expressions

No regular expressions were active.

32.5 Comparison detail

1 <%-- 1 <%--
2 Copyright 2002-2006 Jahia Ltd 2 Copyright 2002-2006 Jahia Ltd
3  3 
4 Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (JCDDL),  4 Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (JCDDL),
5 Version 1.0 (the "License"), or (at your option) any later version; you may  5 Version 1.0 (the "License"), or (at your option) any later version; you may
6 not use this file except in compliance with the License. You should have  6 not use this file except in compliance with the License. You should have
7 received a copy of the License along with this program; if not, you may obtain  7 received a copy of the License along with this program; if not, you may obtain
8 a copy of the License at  8 a copy of the License at
9  9 
10  http://www.jahia.org/license/ 10  http://www.jahia.org/license/
11  11 
12 Unless required by applicable law or agreed to in writing, software  12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,  13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and  15 See the License for the specific language governing permissions and
16 limitations under the License. 16 limitations under the License.
17 --%><% 17 --%><%
18 //JahiaContainerList forms = jData.containers().getContainerList( "forms" ); 18 //JahiaContainerList forms = jData.containers().getContainerList( "forms" );
19  19 
20 if (forHasBeenPosted &  emptyMandatoryFields.isEmpty()) { 20 if (forHasBeenPosted && emptyMandatoryFields.isEmpty()) {
21     %> 21     %>
22     <%=displayTextAfterPostValue%>  22     <%=displayTextAfterPostValue%><br />
  23     <% if (isEditMode) { %>
  24     <a href="<%=jParams.composePageUrl(jParams.getPageID(), jParams.getLocale().toString())%>">
  25                 -> <content:resourceBundle resourceBundle="jahiatemplates.Corporate_portal_templates_v2"
  26                     resourceName="back"/>
  27     </a>               
  28     <% } %>    
23     <% 29     <%
24 } else { 30 } else {               
25     if (forms != null) { 31     if (forms != null) {
26         ContainerListBean formsBean = new ContainerListBean(forms,jParams); 32         ContainerListBean formsBean = new ContainerListBean(forms,jParams);
27         formsEnum = forms.getContainers(); 33         formsEnum = forms.getContainers();
28         boolean isFormOK = false; 34         boolean isFormOK = false;
29         int t = 0; 35         int t = 0;
  36         final String searchString = (String)request.getParameter("searchString");
  37         final boolean searchSubmitted = searchString != null && searchString.length() > 0;
  38                                 if (searchSubmitted) { 
  39                                 final FormGeneratorContainerSearcher textContainerSearcher = new FormGeneratorContainerSearcher("textValues",
  40                                                         jParams, searchString, jParams.getEntryLoadRequest(), "id");   
  41                         final FormGeneratorContainerSearcher fileContainerSearcher = new FormGeneratorContainerSearcher("fileValues",
  42                                                         jParams, searchString, jParams.getEntryLoadRequest(), "id");                                                                           
  43                         String ids = textContainerSearcher.searchContainerIds(searchString, jParams) + " " +
  44                                                                 fileContainerSearcher.searchContainerIds(searchString, jParams);       
  45                         if (ids == null ||ids.trim().length() == 0) {
  46                                         ids = String.valueOf(System.currentTimeMillis());      
  47                         }
  48                         ContainerSearcher theTextSearcher = new ContainerSearcher("textValues",
  49                                                         jParams, ids, jParams.getEntryLoadRequest());  
  50                         ContainerSearcher theFileSearcher = new ContainerSearcher("fileValues",
  51                                                         jParams, ids, jParams.getEntryLoadRequest());                                                                                  
  52                                 request.setAttribute("textValues_search_handler", theTextSearcher);
  53                                 request.setAttribute("fileValues_search_handler", theFileSearcher);
  54                                 }
  55 
30         while (formsEnum.hasMoreElements()) { 56         while (formsEnum.hasMoreElements()) {
31             t++; 57             t++;
32             JahiaContainer form = (JahiaContainer) formsEnum.nextElement(); 58             JahiaContainer form = (JahiaContainer) formsEnum.nextElement();
33             ContainerBean formBean = new ContainerBean(form,jParams); 59             ContainerBean formBean = new ContainerBean(form,jParams);
34             String sender = form.getFieldValue("sender","Please insert a sender"); 60             String sender = form.getFieldValue("sender","Please insert a sender");
35             String recipients = form.getFieldValue("recipients","Please insert a sender"); 61             String recipients = form.getFieldValue("recipients","Please insert a sender");
36             String recipientsCC = form.getFieldValue("recipientsCC",""); 62             String recipientsCC = form.getFieldValue("recipientsCC","");
37             String subject = form.getFieldValue("subject",""); 63             String subject = form.getFieldValue("subject","");
38             storePostedValues = "true".equals(form.getFieldValue("storePostedValues","false")); 64             storePostedValues = "true".equals(form.getFieldValue("storePostedValues","false"));
  65             boolean sendMail = "true".equals(form.getFieldValue("sendMail","false"));
  66             boolean showPostedValues = isEditMode || "true".equals(form.getFieldValue("showPostedValues","false"));
39             JahiaPage pageRedirected = (JahiaPage) form.getFieldObject("pageRedirected" ); 67             JahiaPage pageRedirected = (JahiaPage) form.getFieldObject("pageRedirected" );
40             isFormOK = ! ("".equals(sender) || "".equals( recipients )); 68             isFormOK = ! ("".equals(sender) || "".equals( recipients ));
41  69 
42             if (jData.gui().isEditMode()) { 70             if ( isEditMode ) {
43                 %><div class="step1"> 71                 %><div class="step1">
44                 <span class="from"> 72                 <span class="from">
45                     <%if ("".equals(sender)) { %><span style="color:red;"> 73                     <%if ("".equals(sender)) { %><span style="color:red;">
46                         <content:resourceBundle resourceBundle="jahiatemplates.Corporate_portal_templates_v2" 74                         <content:resourceBundle resourceBundle="jahiatemplates.Corporate_portal_templates_v2"
47                     resourceName="form.isMandatory"/> 75                     resourceName="form.isMandatory"/>
48                         </span><%}%> 76                         </span><%}%>
49                     <%=sender%> 77                     <%=sender%>
50                 <% 78                 <%
51                 jData.gui().html().drawBeginActionMenu(formBean , 79                 jData.gui().html().drawBeginActionMenu(formBean ,
52                     null, null, false, "", "jahiatemplates.Corporate_portal_templates_v2", null, out); 80                     null, null, false, "", "jahiatemplates.Corporate_portal_templates_v2", null, out);
53                 %> 81                 %>
54                 </span> 82                 </span>
55                 <span class="to"> 83                 <span class="to">
56                 <%if ("".equals(recipients)) { %><span style="color:red;"> 84                 <%if ("".equals(recipients)) { %><span style="color:red;">
57                         <content:resourceBundle resourceBundle="jahiatemplates.Corporate_portal_templates_v2" 85                         <content:resourceBundle resourceBundle="jahiatemplates.Corporate_portal_templates_v2"
58                     resourceName="form.isMandatory"/> 86                     resourceName="form.isMandatory"/>
59                         </span><%}%><%=recipients%></span> 87                         </span><%}%><%=recipients%></span>
60                 <% 88                 <%
61                 if (! "".equals( recipientsCC )){ 89                 if (! "".equals( recipientsCC )){
62                     %> 90                     %>
63                     <span class="tocc" ><%=recipientsCC%></span> 91                     <span class="tocc" ><%=recipientsCC%></span>
64                     <% 92                     <%
65                 } 93                 }
66                 if (! "".equals( subject )){ 94                 if (! "".equals( subject )){
67  95 
68                     %> 96                     %>
69                     <span class="subject" ><%=subject%></span> 97                     <span class="subject" ><%=subject%></span>
70                     <% 98                     <%
71                 } 99                 }
72                 %></div><% 100                 %> 
73              } 101                
  102                
  103                 <% if (sendMail) { %>
  104                                 <span class="mailMessage" >
  105                                 <content:resourceBundle resourceBundle="jahiatemplates.Corporate_portal_templates_v2"
  106                                 resourceName="form.mailWillBeSentIf"/> 
  107                 <% } else { %>
  108                                 <span class="mailDisabled" >
  109                                 <content:resourceBundle resourceBundle="jahiatemplates.Corporate_portal_templates_v2"
  110                                 resourceName="form.mailDisabled"/>
  111                 <% } %>
  112                 </span></div>
  113             <% }
74  114 
75             if (isFormOK) { 115             if (isFormOK) {
76                 %><div class="step2"> 116                 %><div class="step2">
77                 <% 117                 <%
78                 if (isEditMode) { 118                 if (isEditMode) {
79                     %><h2><content:resourceBundle resourceBundle="jahiatemplates.Corporate_portal_templates_v2" 119                     %><h2><content:resourceBundle resourceBundle="jahiatemplates.Corporate_portal_templates_v2"
80                     resourceName="form.create"/></h2><% 120                     resourceName="form.create"/></h2><%
81                 } 121                 }
82                 JahiaContainerList fields = form.getContainerList( "fields" ); 122                 JahiaContainerList fields = form.getContainerList( "fields" );
83                 if (fields != null) { 123                 if (fields != null) {
  124                                 if (fields.getID() == 0) {
  125                                                 ServicesRegistry.getInstance().getJahiaContainersService().saveContainerListInfo(fields, jParams.getContentPage().getAclID(), jParams);
  126                                                 // fields = form.getContainerList( "fields" ); wrong recast, object fields is updated (side effect) by previous method saveContainerListInfo
  127                                 }
84  128 
85                     Enumeration fieldsEnum = null; 129                     Enumeration fieldsEnum = null;
86  130 
87                     %> 131                     %>
88                     <form method="post" action="<%=bypassUrl%>"  132                     <form method="post" action="<%=bypassUrl%>" accept-charset="UTF-8"
89                             name="submitToContainerList" id="form_<%=form.getID()%>"> 133                             name="submitToContainerList" id="form_<%=form.getID()%>">
90                     <input type="hidden" name="formId" value="<%=form.getID()%>"/> 134                     <input type="hidden" name="formId" value="<%=form.getID()%>"/>
91                     <% 135                     <%
92                     if (forHasBeenPosted && ! emptyMandatoryFields.isEmpty()) { 136                     if (forHasBeenPosted && ! emptyMandatoryFields.isEmpty()) {
93                         %><strong><span style="color:red;"><content:resourceBundle resourceBundle="jahiatemplates.Corporate_portal_templates_v2" 137                         %><strong><span style="color:red;"><content:resourceBundle resourceBundle="jahiatemplates.Corporate_portal_templates_v2"
94                     resourceName="form.fieldIsMandatory"/></span></strong><br/><br/><% 138                     resourceName="form.fieldIsMandatory"/></span></strong><br/><br/><%
95                     } 139                     }
96                     %> 140                     %>
97                     <table> 141                     <table>
98                     <% 142                     <%
99  143 
100                     fieldsEnum = fields.getContainers(); 144                     fieldsEnum = fields.getContainers();
101                     while (fieldsEnum.hasMoreElements()) { 145                     while (fieldsEnum.hasMoreElements()) {
102                         JahiaContainer currentField = (JahiaContainer) fieldsEnum.nextElement(); 146                         JahiaContainer currentField = (JahiaContainer) fieldsEnum.nextElement();
103                         ContainerBean currentFieldBean = new ContainerBean(currentField,jParams); 147                         ContainerBean currentFieldBean = new ContainerBean(currentField,jParams);
104                         String fieldTitle = currentField.getFieldValue("fieldTitle",""); 148                         String fieldTitle = currentField.getFieldValue("fieldTitle","");
105                         String isMandatoryStr = currentField.getFieldValue("isMandatory","false"); 149                         String isMandatoryStr = currentField.getFieldValue("isMandatory","false");
106                         boolean isMandatory = "true".equals(isMandatoryStr); 150                         boolean isMandatory = "true".equals(isMandatoryStr);
107                         String type = currentField.getFieldValue("type",""); 151                         String type = currentField.getFieldValue("type","");
108                         String defaultValue = currentField.getFieldValue("defaultValue",""); 152                         String defaultValue = currentField.getFieldValue("defaultValue","");
109                         %> 153                         %>
110                         <tr> 154                         <tr>
111                             <td> 155                             <td>
112                                 <% 156                                 <%
113                                 if (! ResourceBundleMarker.drawMarker(resBundleID,"submitButton","").equals(type)){ 157                                 if (! ResourceBundleMarker.drawMarker(resBundleID,"submitButton","").equals(type)){
114                                     %><strong<% 158                                     %><strong<%
115                                     if (forHasBeenPosted && emptyMandatoryFields.contains(new Integer(currentField.getID()))) { 159                                     if (forHasBeenPosted && emptyMandatoryFields.contains(new Integer(currentField.getID()))) {
116                                         %> style="color:red;"<% 160                                         %> style="color:red;"<%
117                                     } 161                                     }
118                                     %>><%=fieldTitle%> <% 162                                     %>><%=fieldTitle%> <%
119                                     if (isMandatory) { 163                                     if (isMandatory) {
120                                         %> *<% 164                                         %> *<%
121                                     }%>:</strong><% 165                                     }%>:</strong><%
122                                 } 166                                 }
123                                 jData.gui().html().drawBeginActionMenu(currentFieldBean , 167                                 jData.gui().html().drawBeginActionMenu(currentFieldBean ,
124                                     null, null, false, "", 168                                     null, null, false, "",
125                                     "jahiatemplates.Corporate_portal_templates_v2", 169                                     "jahiatemplates.Corporate_portal_templates_v2",
126                                     null, out); 170                                     null, out);
127                                 %> 171                                 %>
128                             </td> 172                             </td>
129                             <td> 173                             <td>
130                                 <% 174                                 <%
131                                 if (ResourceBundleMarker.drawMarker(resBundleID,"smallTextarea","").equals(type)) { 175                                 if (ResourceBundleMarker.drawMarker(resBundleID,"smallTextarea","").equals(type)) {
132                                     if (formIdStr != null) { 176                                     if (formIdStr != null) {
133                                         String postedValue = request.getParameter("field_" + currentField.getID()); 177                                                 final String postedValue ;
  178                                                 if (fupload == null) {
  179                                                                                                                                 postedValue = request.getParameter("field_" + currentField.getID());
  180                                                                                                                 } else {
  181                                                                                                                                 postedValue = fupload.getParameterValues("field_" + currentField.getID())[0];  
  182                                                                                                                 }                      
134                                         if (postedValue != null) { 183                                         if (postedValue != null) {
135                                             logger.debug("Set default value for field [" + fieldTitle + "] to [" + postedValue + "]"); 184                                             logger.debug("Set default value for field [" + fieldTitle + "] to [" + postedValue + "]");
136                                             defaultValue = postedValue; 185                                             defaultValue = postedValue;
137                                         } 186                                         }
138                                     } 187                                     }
139                                     %> 188                                     %>
140                                     <textarea name="field_<%=currentField.getID()%>" 189                                     <textarea name="field_<%=currentField.getID()%>"
141                                         cols="40" rows="6"><%=defaultValue%></textarea> 190                                         cols="40" rows="6"><%=defaultValue%></textarea>
142                                     <% 191                                     <%
143                                 } else if (ResourceBundleMarker.drawMarker(resBundleID,"largeTextarea","").equals(type)) { 192                                 } else if (ResourceBundleMarker.drawMarker(resBundleID,"largeTextarea","").equals(type)) {
144                                     if (formIdStr != null) { 193                                     if (formIdStr != null) {
145                                          String postedValue = request.getParameter("field_" + currentField.getID()); 194                                         final String postedValue ;
  195                                                 if (fupload == null) {
  196                                                                                                                                 postedValue = request.getParameter("field_" + currentField.getID());
  197                                                                                                                 } else {
  198                                                                                                                                 postedValue = fupload.getParameterValues("field_" + currentField.getID())[0];  
  199                                                                                                                 }      
146                                         if (postedValue != null) { 200                                         if (postedValue != null) {
147                                             logger.debug("Set default value for field [" + fieldTitle + "] to [" + postedValue + "]"); 201                                             logger.debug("Set default value for field [" + fieldTitle + "] to [" + postedValue + "]");
148                                             defaultValue = postedValue; 202                                             defaultValue = postedValue;
149                                         } 203                                         }
150                                     } 204                                     }
151                                     %> 205                                     %>
152                                     <textarea name="field_<%=currentField.getID()%>" 206                                     <textarea name="field_<%=currentField.getID()%>"
153                                         cols="40" rows="20"><%=defaultValue%></textarea> 207                                         cols="40" rows="20"><%=defaultValue%></textarea>
154                                     <% 208                                     <%
155                                 } else if (ResourceBundleMarker.drawMarker(resBundleID,"radioButtons","").equals(type)) { 209                                 } else if (ResourceBundleMarker.drawMarker(resBundleID,"radioButtons","").equals(type)) {
156                                     if (! "".equals(defaultValue)) { 210                                     if (! "".equals(defaultValue)) {
157                                         String[] values = defaultValue.split(":"); 211                                         String[] values = defaultValue.split(":");
158                                          String postedValue = request.getParameter("field_" + currentField.getID()); 212                                         final String postedValue ;
  213                                                 if (fupload == null) {
  214                                                                                                                                 postedValue = request.getParameter("field_" + currentField.getID());
  215                                                                                                                 } else {
  216                                                                                                                                 postedValue = fupload.getParameterValues("field_" + currentField.getID())[0];  
  217                                                                                                                 }      
159                                         for (int x=0; x<values.length; x++) { 218                                         for (int x=0; x<values.length; x++) {
160                                             %> 219                                             %>
161                                             <input type="radio" name="field_<%=currentField.getID()%>" value="<%=values[x]%>" 220                                             <input type="radio" name="field_<%=currentField.getID()%>" value="<%=values[x]%>"
162                                             <% 221                                             <%
163                                             if (postedValue != null){ 222                                             if (postedValue != null){
164                                                 if (values[x].equals(postedValue)) { 223                                                 if (values[x].equals(postedValue)) {
165                                                     %> checked="checked"<% 224                                                     %> checked="checked"<%
166                                                 } 225                                                 }
167                                             } 226                                             }
168                                             %>> <%=values[x]%><br/> 227                                             %>> <%=values[x]%><br/>
169                                             <% 228                                             <%
170                                         } 229                                         }
171                                     } else { 230                                     } else {
172                                         if (jData.gui().isEditMode()) { 231                                         if ( isEditMode ) {
173                                             %><span style="color:red;"><content:resourceBundle 232                                             %><span style="color:red;"><content:resourceBundle
174                                             resourceBundle="jahiatemplates.Corporate_portal_templates_v2" 233                                             resourceBundle="jahiatemplates.Corporate_portal_templates_v2"
175                                             resourceName="form.defaultValueRequired"/></span><% 234                                             resourceName="form.defaultValueRequired"/></span><%
176                                         } 235                                         }
177                                     } 236                                     }
178                                 } else if (ResourceBundleMarker.drawMarker(resBundleID,"checkboxes","").equals(type)) { 237                                 } else if (ResourceBundleMarker.drawMarker(resBundleID,"checkboxes","").equals(type)) {
179                                     if (! "".equals(defaultValue)) { 238                                     if (! "".equals(defaultValue)) {
180                                          String[] postedValues = request.getParameterValues("field_" + currentField.getID()); 239                                         final String[] postedValues ;
  240                                                 if (fupload == null) {
  241                                                                                                                                 postedValues = request.getParameterValues("field_" + currentField.getID());
  242                                                                                                                 } else {
  243                                                                                                                                 postedValues = fupload.getParameterValues("field_" + currentField.getID());    
  244                                                                                                                 }      
181                                         Vector postedValuesVector = new Vector(); 245                                         Vector postedValuesVector = new Vector();
182                                         if (postedValues != null) { 246                                         if (postedValues != null) {
183                                             for (int  i = 0; i < postedValues.length; i++){ 247                                             for (int  i = 0; i < postedValues.length; i++){
184                                                 postedValuesVector.add(postedValues[i]); 248                                                 postedValuesVector.add(postedValues[i]);
185                                             } 249                                             }
186                                         } 250                                         }
187                                         String[] values = defaultValue.split(":"); 251                                         String[] values = defaultValue.split(":");
188                                         for (int x=0; x<values.length; x++) { 252                                         for (int x=0; x<values.length; x++) {
189                                             %> 253                                             %>
190                                             <input type="checkbox" name="field_<%=currentField.getID()%>" value="<%=values[x]%>" 254                                             <input type="checkbox" name="field_<%=currentField.getID()%>" value="<%=values[x]%>"
191                                             <% 255                                             <%
192                                             if (postedValuesVector.contains(values[x])){ 256                                             if (postedValuesVector.contains(values[x])){
193                                                 %> checked="checked"<% 257                                                 %> checked="checked"<%
194                                             }%>> <%=values[x]%><br/> 258                                             }%>> <%=values[x]%><br/>
195                                             <% 259                                             <%
196                                         } 260                                         }
197                                     } else { 261                                     } else {
198                                         if (jData.gui().isEditMode()) { 262                                         if ( isEditMode ) {
199                                             %><span style="color:red;">Default value is  263                                             %><span style="color:red;"><content:re sourceBundle
200                                                 requir ed for this type </span><% 264                                             resourceBundle="jahiatemplates.Corporate_portal_templates_v2"
  265                                              resou rceName="form.defaultValueRequired"/></span><%
201                                         } 266                                         }
202                                     } 267                                     }
203                                 } else if (ResourceBundleMarker.drawMarker(resBundleID,"selectBox","").equals(type)) { 268                                 } else if (ResourceBundleMarker.drawMarker(resBundleID,"selectBox","").equals(type)) {
204                                     if (! "".equals(defaultValue)) { 269                                     if (! "".equals(defaultValue)) {
205                                         %> 270                                         %>
206                                         <select name="field_<%=currentField.getID()%>"> 271                                         <select name="field_<%=currentField.getID()%>">
207                                         <% 272                                         <%
208                                          String[] postedValues = request.getParameterValues("field_" + currentField.getID()); 273                                         final String[] postedValues ;
  274                                                 if (fupload == null) {
  275                                                                                                                                 postedValues = request.getParameterValues("field_" + currentField.getID());
  276                                                                                                                 } else {
  277                                                                                                                                 postedValues = fupload.getParameterValues("field_" + currentField.getID());    
  278                                                                                                                 }      
209                                         Vector postedValuesVector = new Vector(); 279                                         Vector postedValuesVector = new Vector();
210                                         if (postedValues != null) { 280                                         if (postedValues != null) {
211                                             for (int  i = 0; i < postedValues.length; i++){ 281                                             for (int  i = 0; i < postedValues.length; i++){
212                                                 postedValuesVector.add(postedValues[i]); 282                                                 postedValuesVector.add(postedValues[i]);
213                                             } 283                                             }
214                                         } 284                                         }
215  285 
216                                         String[] values = defaultValue.split(":"); 286                                         String[] values = defaultValue.split(":");
217                                         for (int x=0; x<values.length; x++) { 287                                         for (int x=0; x<values.length; x++) {
218                                             %> 288                                             %>
219                                             <option <% 289                                             <option <%
220                                             if (postedValuesVector.contains(values[x])){ 290                                             if (postedValuesVector.contains(values[x])){
221                                                 %> selected="selected"<% 291                                                 %> selected="selected"<%
222                                             }%>><%=values[x]%></option> 292                                             }%>><%=values[x]%></option>
223                                             <% 293                                             <%
224                                         } 294                                         }
225                                         %> 295                                         %>
226                                         </select> 296                                         </select>
227                                         <% 297                                         <%
228                                     } else { 298                                     } else {
229                                         if (jData.gui().isEditMode()) { 299                                         if ( isEditMode ) {
230                                             %><span style="color:red;">Default value is  300                                             %><span style="color:red;"><content:re sourceBundle
231                                                 requir ed for this type </span><% 301                                             resourceBundle="jahiatemplates.Corporate_portal_templates_v2"
  302                                              resou rceName="form.defaultValueRequired"/></span><%
232                                         } 303                                         }
233                                     } 304                                     }
234                                     %>  
235  305 
  306                                 } else if (ResourceBundleMarker.drawMarker(resBundleID,"fileUpload","").equals(type)) {   
  307                                                 %>
  308                                                 <script type="text/javascript">                                        
  309                                                     document.submitToContainerList.enctype = "multipart/form-data";
  310                                                                                                                                         document.submitToContainerList.encoding = "multipart/form-data";
  311                                                 </script>
  312                                                 <input size="80" type="file" name="field_<%=currentField.getID()%>" />
236                                     <% 313                                     <%
237                                 } else if (ResourceBundleMarker.drawMarker(resBundleID,"submitButton","").equals( type)) { 314                                                 if (isEd itMode && "" .equals(defaultValue)) {
238                                     if (" ".equals(defau ltValue)){ 315                                          %><span style="color:red;"><content:re sourceBundl e 
239                                          defaultVa lue = "Submit"; 316                                             resourceBundle="jahiatemplates.Corporate_portal_templates_v2"
  317                                             resourceName="form.defaultPathWillBeUsed"/></span><%
240                                     } 318                                     }
  319 
  320                                 } else if (ResourceBundleMarker.drawMarker(resBundleID,"submitButton","").equals(type)) {
241                                     %> 321                                     %>
242                                     <input type="submit" name="field_<%=currentField.getID()%>" 322                                     <input type="submit" name="field_<%=currentField.getID()%>"
  323                                                 <% if ("".equals(defaultValue)) { %>
  324                                                 value="<content:resourceBundle resourceBundle="jahiatemplates.Corporate_portal_templates_v2"
  325                                                                                                                                 resourceName="poll.submit"/>"
  326                                         <% } else { %>
243                                         value="<%=defaultValue%>"/> 327                                         value="<%=defaultValue%>"/>
  328                                         <% } %>
244                                     <% 329                                     <%
245                                 } else { 330                                 } else {
246                                     if (formIdStr != null) { 331                                     if (formIdStr != null) {
247                                          String postedValue = request.getParameter("field_" + currentField.getID()); 332                                         final String postedValue ;
  333                                                 if (fupload == null) {
  334                                                                                                                                 postedValue = request.getParameter("field_" + currentField.getID());
  335                                                                                                                 } else {
  336                                                                                                                                 postedValue = fupload.getParameterValues("field_" + currentField.getID())[0];  
  337                                                                                                                 }
248                                         if (postedValue != null) { 338                                         if (postedValue != null) {
249                                             logger.debug("Set default value for field [" + fieldTitle + "] to [" + postedValue + "]"); 339                                             logger.debug("Set default value for field [" + fieldTitle + "] to [" + postedValue + "]");
250                                             defaultValue = postedValue; 340                                             defaultValue = postedValue;
251                                         } 341                                         }
252                                     } 342                                     }
253                                     %> 343                                     %>
254                                     <input type="text" name="field_<%=currentField.getID()%>" 344                                     <input type="text" name="field_<%=currentField.getID()%>"
255                                         value="<%=defaultValue%>" size="80"/> 345                                         value="<%=defaultValue%>" size="80"/>
256                                     <% 346                                     <%
257                                 } 347                                 }
258                                 %> 348                                 %>
259                             </td> 349                             </td>
260                         </tr> 350                         </tr>
261                         <% 351                         <%
262                     } 352                     }
263                     %> 353                     %>
264                     </table> 354                     </table>
265                     </form> 355                     </form>
266                     <% 356                     <%
267                     if (storePostedValues) { 357                      
268                         // display tables 358                     ContainerListBean fieldsBean = new ContainerListBean(fields,jParams);
269                         %> 359                                 jData.gui().html().drawBeginActionMenu(fieldsBean , null,
270                         <table class="forms"> 360                                 contextUrl + "/img/actions/note_add.gif", false, "","jahiatemplates.Corporate_portal_templates_v2",
271                         <tr class="title"> 361                                 "add", out);
272                            <% 362                      
  363                     if (showPostedValues) {  
273                         fieldsEnum = fields.getContainers(); 364                         fieldsEnum = fields.getContainers();
274                         Vector fieldNames  = new Vector(); 365                                 final Map valuesByRow = new HashMap();
  366                                 final Map idsByRow = new HashMap();
  367                                 final List theContainers = new ArrayList();
275                         while (fieldsEnum.hasMoreElements()) { 368                         while (fieldsEnum.hasMoreElements()) {
276                             JahiaContainer currentField = (JahiaContainer) fieldsEnum.nextElement(); 369                                         final JahiaContainer currentField = (JahiaContainer) fieldsEnum.nextElement();
277                             String type = currentField.getFieldValue("type",""); 370                           final String type = currentField.getFieldValue("type","");
278                             if (! ResourceBundleMarker.drawMarker(resBundleID,"submitButton","").equals(type)) { 371                             if (! ResourceBundleMarker.drawMarker(resBundleID,"submitButton","").equals(type)) {
279                                 String fi eldTitle = currentField.getFieldValue("fieldTitle",""); 372                                theContainers.add(currentField );
280                                 fieldNames.add("field_" + currentField.getID());  
281                                 %>  
282                                 <td><%=fieldTitle%></td>  
283                                 <%  
284                             } 373                           }
  374                          
  375                           final JahiaContainerList list;
  376                           if (ResourceBundleMarker.drawMarker(resBundleID,"fileUpload","").equals(type)) {
  377                                         list = currentField.getContainerList("fileValues");
  378                                 } else {
  379                                                 list = currentField.getContainerList("textValues");
285                         } 380                                 }
286                         %> 381                           final Enumeration values = list.getContainers(); 
287                         </tr> 382                          
288                         <% 383                           int j = 0;
289                         // get th e  values  384                             while (values.hasMoreElements()) {
290                         if (f o rm !=  nul l ) { 385                                    final JahiaContainer  c = (JahiaContainer)values.nextElement();
291                             JahiaContainerLis t storePos t edForm = jData.containe r s().getContainerList( "form_" + form.getID() ); 386                                         final String key = c.getFieldValue("id");
  387                                         List rowValues = (List) valuesByRow.get(key);
  388                                         if (rowValues == null) {
  389                                                         rowValues = new ArrayList(fields.size());      
  390                                         }
  391                                         rowValues.add(c);
  392                                         valuesByRow.put(key, rowValues);
  393                                         final Integer ID = new Integer(j);
  394                                         if (! idsByRow.containsKey(ID)) idsByRow.put(ID, key);
  395                                         j++;
  396                             }
  397                         }
  398 
  399                                                                                         request.setAttribute("idsByRow", idsByRow);
  400                         request.setAttribute( "formResultList", new ArrayList(valuesByRow.values()));
  401                       final org.jahia.utils.displaytag.CaseInsensitiveComparator comparator =
  402                             new org.jahia.ut ils.displaytag.Cas eInsensitiveCo mparator(jData.getProcessing Cont ext().getLocale() );
292  403                        
293                             if (storePostedForm != null) {  
294                                 Enumeration postedFieldsEnum = storePostedForm.getContainers();  
295                                 while (postedFieldsEnum.hasMoreElements()) {  
296                                     JahiaContainer postedFieldsContainer = (JahiaContainer) postedFieldsEnum.nextElement();  
297                                     ContainerBean postedFieldsContainerBean =  
298                                         new ContainerBean(postedFieldsContainer,jParams);  
299                                     Enumeration fieldNamesEnum = fieldNames.elements();  
300                                     %> 404                                     %>
301                                      <tr> 405                         <br/>&nbsp;<br/>               
  406                         <div class="formResultListing">        
  407                         <% int row = 0; %>     
  408                         <display:table name="formResultList" class="formResultListing" pagesize="15" id="formResultListID"
  409                                 requestURI='<%=bypassUrl%>' defaultsort="1" defaultorder="descending" >
302                                     <% 410                                     <%
303                                     while (fieldNamesEnum.hasMoreElements()) { 411                                 final List rowValues = (List) pageContext.getAttribute("formResultListID");
304                                         String fieldNa me = (String) fieldNamesEnum.nextElement ( ); 412                                 final Map map = (Map) request.ge tAttribute("idsByRow");
305                                         String fieldValue = postedFieldsContainer.getFieldValue(fieldName,""); 413                                 final String rowID = (Stri ng)map.get (new Integer(row));
306                                         logger.debug("fieldName " + fieldName + ": " + fieldValue); 414                                 final Iterator columns = theContainers.iterator();
307                                         %><td><%=fieldValu e%></td><% 415                                 int i=0;
  416                                 whi le (columns.hasNext()) {
  417                                                                                                                         final JahiaContainer currentField = (JahiaContainer) columns.next();
  418                                                                                                                         JahiaContainer currentValue = null;
  419                                                                                                                         String theValue = "";
  420                                                                                                                         boolean isFile = ResourceBundleMarker.drawMarker(resBundleID,"fileUpload","").equals(currentField.getFieldValue("type",""));
  421                                                                                                                         try {
  422                                                                                                                                         currentValue = (JahiaContainer) rowValues.get(i);
  423                                                                                                                                         if (isFile) {
  424                                                                                                                                                         theValue = currentValue.getFieldValue("fileValue");
  425                                                                                                                                         } else {
  426                                                                                                                                                         theValue = currentValue.getFieldValue("textValue");
308                                     } 427                                                                                                                                         }
309                                     if (jDat a.gui().isEditMode()) { 428                                                         if ( theValu e == null) {
310                                           %><td><% 429                                                                         theValue = "";
311                                         jData.gui().html().drawBeginActionMenu(postedFieldsContainerBean , null, 430                                         }
312                                             null, false, "","jahiatemplates.Corporate_portal_templates_v2", 431                                                                                                                                        
313                                             null, out); 432                                                                                                                                         if (isFile) {
314                                         %></td><% 433                                                                                                                                                         JahiaFileField file = (JahiaFileField) currentValue.getFieldObject("fileValue");
  434                                                                                                                                 String fileName = "null";
  435                                                                                                                                 String downloadUrl = "#";
  436                                                                                                                                 String picto = "file";
  437                                                                                                                                 if (file != null ) {
  438                                                                                                                                 downloadUrl = file.getDownloadUrl();
  439                                                                                                                                 fileName = file.getFileFieldTitle();
  440                                                                                                                                 if (fileName.equals("")){
  441                                                                                                                                         fileName = file.getRealName();
  442                                                                                                                                 }
  443                                                                                                                                 picto = getPicto(file.getRealName());
315                                     } 444                                                                                                                                 }
316                                     %></tr><% 445                                                                                                                                 if (fileName.equals("null") || fileName == null || fileName.length() == 0) {
  446                                                                                                                                                 theValue = "&nbsp;";           
  447                                                                                                                                 } else {
  448                                                                                                                                                                         final StringBuffer buff = new StringBuffer();  
  449                                                                                                                                                                         buff.append("<a class=\"");
  450                                                                                                                                                                         buff.append(picto);
  451                                                                                                                                                                         buff.append("\" href=\"");
  452                                                                                                                                                                         buff.append(downloadUrl);
  453                                                                                                                                                                         buff.append("\" title=\"");
  454                                                                                                                                                                         buff.append(fileName);
  455                                                                                                                                                                         buff.append("\">");
  456                                                                                                                                                                         buff.append(fileName);
  457                                                                                                                                                                         buff.append("</a>");   
  458                                                                                                                                                                         theValue = buff.toString();
317                                 } 459                                                                                                                                                         }
318                             } 460                                                 }
  461                                                                                                                         } catch (Exception e) {
319                         } 462                         }
  463                        
320                         %> 464                         %>
321                          </table> 465                                 <% if (i == 0) {
  466                                         %>
  467                                 <display:column title="<%=creationDateTitle%>" sortable="true" comparator="<%= comparator %>" >
  468                                                 <%=currentValue.getContentContainer().getMetadataDateValue("creationDate", jParams, "-", sdf) %>
  469                                                
  470                                                 <% if (isEditMode) { %>
  471                                                 <a href="javascript:<%=jData.gui().html().drawDeleteContainerLauncher(currentValue)%>">
  472                                                                                                                                 <img border="0" alt="delete row" src="<%=contextURL%>/img/actions/delete.gif" />
  473                                                                                                                         </a>           
  474                                                                                                                         <% } %>
  475                                 </display:column>      
  476                                 <% } %>
  477                                
  478                                 <display:column title="<%=currentField.getFieldValue("fieldTitle","")%>" sortable="true" comparator="<%= comparator %>" >
  479                                 <%=theValue%>
  480                                 <%
  481                                                 if (currentValue == null || currentValue.getID() < 1 || "".equals(currentValue.getFieldValue("id",""))) {
  482                                         final JahiaContainerList theList;
  483                                         final JahiaContainerDefinition def;
  484                                   if (isFile) {
  485                                                 theList = currentField.getContainerList("fileValues");
  486                                                 def = JahiaContainerDefinitionsRegistry.
  487                                                                                                                                                         getInstance().getDefinition(jParams.getSiteID(), "fileValues");
  488                                         } else {
  489                                                         theList = currentField.getContainerList("textValues");
  490                                                         def = JahiaContainerDefinitionsRegistry.
  491                                                                                                                                                         getInstance().getDefinition(jParams.getSiteID(), "textValues");
  492                                         }
  493 
  494                                         currentValue = new JahiaContainer(0,
  495                                                                                                                                                         jParams.getJahiaID(),
  496                                                                                                                                                         jParams.getPageID(),
  497                                                                                                                                                         theList.getID(),
  498                                                                                                                                                         0,
  499                                                                                                                                                         0,
  500                                                                                                                                                         def.getID(),
  501                                                                                                                                                         0,
  502                                                                                                                                                         EntryLoadRequest.STAGING_WORKFLOW_STATE);  
  503                                                                                                                                                        
  504                                                                                         ServicesRegistry.getInstance().getJahiaContainersService().saveContainer(currentValue, 0, jParams);
  505                                         currentValue = ServicesRegistry.getInstance().getJahiaContainersService().loadContainer(
  506                                                                                                                         currentValue.getID(), LoadFlags.ALL, jParams, EntryLoadRequest.STAGED);
  507                                                                                         currentValue.setLanguageCode(jParams.getLocale().toString());
  508                                                                                                 currentValue.fieldsStructureCheck(jParams);                            
  509                                                                                         JahiaField field = currentValue.getField("id");                
  510                                                                                         field.setValue(rowID);  
  511                                                                                         field.save(jParams);                                 
  512                               }
  513                                                                                                                         %>
  514                                                                                                                         <% if (isEditMode) { %>
  515                                                                                                                         <a href="javascript:<%=jData.gui().html().drawUpdateContainerLauncher(currentValue)%>">
  516                                                                                                                                 <img border="0" alt="update" src="<%=contextURL%>/img/actions/update.gif" />
  517                                                                                                                         </a>
  518                                                                                                                         <% } %>
  519                                                                                                                        
  520                                                                                                                         <%
  521                                   %>   
  522                                 </display:column>
  523                         <% i++; %>
  524                         <% } %>
  525                         <% row++; %>
  526                       </display:table>
  527                       <% if (valuesByRow.values().size() > 0 || searchSubmitted) { %>          
  528                         <form method="post" action="<%=bypassUrl%>" name="search" >
  529                                         <content:resourceBundle resourceBundle="jahiatemplates.Corporate_portal_templates_v2"
  530                                                                 resourceName="search"/>: <input type="text" name="searchString"/>
  531                                                                                                         <input type="submit" name="submitbutton" value="<content:resourceBundle resourceBundle="jahiatemplates.Corporate_portal_templates_v2"
  532                                                                 resourceName="poll.submit"/>"/>
  533                         </form>
  534                         <% } %>
  535                       </div>   
322                         <% 536                         <%
323                     } 537                     }
324                 } 538                 }
325                 ContainerListBean fieldsBean = new ContainerListBean(fields,jParams);  
326                 jData.gui().html().drawBeginActionMenu(fieldsBean , null,  
327                     contextUrl + "/img/actions/note_add.gif", false, "","jahiatemplates.Corporate_portal_templates_v2",  
328                     "add", out);  
329                 %></div><% 539                 %></div><%
330             } 540             }
331         } 541         }
332         if (t == 0) { 542         if (t == 0) {
333             if (! formsEnum.hasMoreElements()) { 543             if (! formsEnum.hasMoreElements()) {
334                     if  ( ! "".equals(jData.gui().html().drawAddContainerLauncher( forms )) ) { 544                  final String  launcher = jData.gui().html().drawAddContainerLauncher( forms );
  545                     if ( ! "".equals(launcher) ) {
335                         %> 546                         %>
336                         <div class="step1"> 547                         <div class="step1">
337                         <a href="javascript:<%=jData.gui().html().drawAddContainerLauncher( forms )%>"> 548                         <a href="javascript:<%= l auncher %>">
338                         <img src='<content:contextURL/>/img/actions/add.gif' alt='Add form' width='11' height='11' border='0'/> 549                         <img src='<content:contextURL/>/img/actions/add.gif' alt='Add form' width='11' height='11' border='0'/>
339                         <content:resourceBundle resourceBundle="jahiatemplates.Corporate_portal_templates_v2" 550                         <content:resourceBundle resourceBundle="jahiatemplates.Corporate_portal_templates_v2"
340                         resourceName="form.addSender"/></a> 551                         resourceName="form.addSender"/></a>
341                     </div> 552                     </div>
342                         <% 553                         <%
343                     } 554                     }
344             } 555             }
345         } 556         }
346     } 557     }
347 } 558 }
348  559 
349 %> 560 %>