Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WW-4520 - Add prefix for CSS classes. #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/src/main/resources/org/apache/struts2/static/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ StrutsUtils.showValidationErrors = function(form, errors) {
if (errors.errors) {
var l, errorList = document.createElement("ul");

errorList.setAttribute("class", "errorMessage");
errorList.setAttribute("className", "errorMessage"); // ie hack cause ie does not support setAttribute
errorList.setAttribute("class", "struts-errorMessage");
errorList.setAttribute("className", "struts-errorMessage"); // ie hack cause ie does not support setAttribute

for ( l = 0; l < errors.errors.length; l++) {
var item = document.createElement("li");
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/template/archive/ajax/form.vm
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@
#if ($parameters.cssStyle) style="$!struts.htmlEncode($parameters.cssStyle)" #end
onSubmit="return false;"
>
<table class="wwFormTable">
<table class="struts-wwFormTable">
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<input type="checkbox" name="$!struts.htmlEncode($parameters.name)" value="$!struts.htmlEncode($itemKey)"
#parse("/$parameters.templateDir/simple/scripting-events.vm")
id="$!struts.htmlEncode($parameters.name)-$itemCount" #if( $tag.contains($parameters.nameValue, $itemKey) ) checked="checked" #end />
<label for="$!struts.htmlEncode($parameters.name)-$itemCount" class="checkboxLabel">$!struts.htmlEncode($itemValue)</label><br />
<label for="$!struts.htmlEncode($parameters.name)-$itemCount" class="struts-checkboxLabel">$!struts.htmlEncode($itemValue)</label><br />
#set ($trash = $stack.pop())
#end
#else
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/template/archive/xhtml/checkbox.vm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="middle">#parse("$!{tag.templateDir}/simple/checkbox.vm")</td>
<td width="100%" valign="middle"><label #if ($parameters.id) for="$!struts.htmlEncode($parameters.id)"#end#if ($hasFieldErrors) class="checkboxErrorLabel"#else class="checkboxLabel"#end>$!struts.htmlEncode($parameters.label)</label></td>
<td width="100%" valign="middle"><label #if ($parameters.id) for="$!struts.htmlEncode($parameters.id)"#end#if ($hasFieldErrors) class="struts-checkboxErrorLabel"#else class="struts-checkboxLabel"#end>$!struts.htmlEncode($parameters.label)</label></td>
</tr>
</table>
#parse("/$parameters.templateDir/xhtml/controlfooter.vm")
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
## if the label position is top,
## then give the label it's own row in the table
<tr>
#if ($parameters.labelposition && $parameters.labelposition == 'top')<td align="left" valign="top" colspan="2">#else<td align="right" valign="top">#end#if ($parameters.label)<label #if ($parameters.id) for="$!struts.htmlEncode($parameters.id)"#end#if ($hasFieldErrors) class="errorLabel"#else class="label"#end>#if ($parameters.required)<span class="required">*</span>#end$!struts.htmlEncode($parameters.label):</label>#end</td>
#if ($parameters.labelposition && $parameters.labelposition == 'top')<td align="left" valign="top" colspan="2">#else<td align="right" valign="top">#end#if ($parameters.label)<label #if ($parameters.id) for="$!struts.htmlEncode($parameters.id)"#end#if ($hasFieldErrors) class="struts-errorLabel"#else class="label"#end>#if ($parameters.required)<span class="required">*</span>#end$!struts.htmlEncode($parameters.label):</label>#end</td>
## add the extra row
#if ($parameters.labelposition && $parameters.labelposition == 'top')
</tr>
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/template/archive/xhtml/form.vm
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
<script src="${base}/struts/template/xhtml/validation.js"></script>
#end
#parse("/$parameters.templateDir/simple/form.vm")
<table class="wwFormTable">
<table class="struts-wwFormTable">
12 changes: 6 additions & 6 deletions core/src/main/resources/template/css_xhtml/checkbox.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ lables
<#if parameters.id??>
errorFor="${parameters.id}"<#rt/>
</#if>
class="errorMessage">
class="struts-errorMessage">
${error?html}
</div><#t/>
</#list>
Expand All @@ -54,9 +54,9 @@ lables
for="${parameters.id?html}"<#rt/>
</#if>
<#if hasFieldErrors>
class="checkboxErrorLabel"<#rt/>
class="struts-checkboxErrorLabel"<#rt/>
<#else>
class="label"<#rt/>
class="struts-label"<#rt/>
</#if>
>${parameters.label?html}</label><#rt/>
</span>
Expand All @@ -70,7 +70,7 @@ lables
<#if parameters.id??>id="wwctrl_${parameters.id}"<#rt/></#if> class="wwctrl">

<#if parameters.required?default(false)>
<span class="required">*</span><#t/>
<span class="struts-required">*</span><#t/>
</#if>

<#include "/${parameters.templateDir}/simple/checkbox.ftl" />
Expand All @@ -92,9 +92,9 @@ lables
for="${parameters.id?html}"<#rt/>
</#if>
<#if hasFieldErrors>
class="checkboxErrorLabel"<#rt/>
class="struts-checkboxErrorLabel"<#rt/>
<#else>
class="checkboxLabel"<#rt/>
class="struts-checkboxLabel"<#rt/>
</#if>
>${parameters.label?html}</label><#rt/>
</#if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ${parameters.after?if_exists}<#t/>
<#if parameters.id??>
errorFor="${parameters.id}"<#rt/>
</#if>
class="errorMessage">
class="struts-errorMessage">
${error?html}
</div><#t/>
</#list>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<#if parameters.id??>
errorFor="${parameters.id}"<#rt/>
</#if>
class="errorMessage">
class="struts-errorMessage">
${error?html}
</div><#t/>
</#list>
Expand All @@ -60,13 +60,13 @@
for="${parameters.id?html}" <#t/>
</#if>
<#if hasFieldErrors>
class="errorLabel"<#t/>
class="struts-errorLabel"<#t/>
<#else>
class="label"<#t/>
class="struts-label"<#t/>
</#if>
><#t/>
<#if parameters.required?default(false)>
<span class="required">*</span><#t/>
<span class="struts-required">*</span><#t/>
</#if>
${parameters.label?html}${parameters.labelseparator!":"?html}
<#include "/${parameters.templateDir}/xhtml/tooltip.ftl" />
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/template/css_xhtml/reset.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<#else>
<span <#rt/>
</#if>
class="formButton"<#t/>
class="struts-formButton"<#t/>
<#if parameters.id??>
id="wwctrl_${parameters.id}"<#rt/>
</#if>
Expand Down
28 changes: 14 additions & 14 deletions core/src/main/resources/template/css_xhtml/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@
* under the License.
*/

.wwFormTable {}
.label {
.struts-wwFormTable {}
.struts-label {
font-style:italic;
float:left;
width:30%
}
.errorLabel {font-style:italic; color:red; }
.errorMessage {font-weight:bold; color:red; }
.checkboxLabel {}
.checkboxErrorLabel {color:red; }
.required {color:red;}
.struts-errorLabel {font-style:italic; color:red; }
.struts-errorMessage {font-weight:bold; color:red; }
.struts-checkboxLabel {}
.struts-checkboxErrorLabel {color:red; }
.struts-required {color:red;}

.tdTransferSelect {text-align:center; vertical-align:middle;}
.tdLabelTop {text-align:left; vertical-align:top;}
.tdCheckboxLabel {text-align:right; vertical-align:top;}
.tdCheckboxInput {text-align:left; vertical-align:top;}
.tdCheckboxErrorMessage {text-align:left; vertical-align:top;}
.tdErrorMessage {text-align:center; vertical-align:top;}
.formButton {text-align:right;}
.struts-tdTransferSelect {text-align:center; vertical-align:middle;}
.struts-tdLabelTop {text-align:left; vertical-align:top;}
.struts-tdCheckboxLabel {text-align:right; vertical-align:top;}
.struts-tdCheckboxInput {text-align:left; vertical-align:top;}
.struts-tdCheckboxErrorMessage {text-align:left; vertical-align:top;}
.struts-tdErrorMessage {text-align:center; vertical-align:top;}
.struts-formButton {text-align:right;}
2 changes: 1 addition & 1 deletion core/src/main/resources/template/css_xhtml/submit.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<#else>
<span <#rt/>
</#if>
class="formButton"<#t/>
class="struts-formButton"<#t/>
<#if parameters.id??>
id="wwctrl_${parameters.id}"<#rt/>
</#if>
Expand Down
10 changes: 5 additions & 5 deletions core/src/main/resources/template/css_xhtml/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function clearErrorLabelsCSS(form) {
for (i = 0; i < labels.length; i++) {
var label = labels[i];
if (label) {
if(label.getAttribute("class") === "errorLabel"){
if(label.getAttribute("class") === "struts-errorLabel"){
label.setAttribute("class", "label");//standard way.. works for ie mozilla
label.setAttribute("className", "label"); //ie hack cause ie does not support setAttribute
}
Expand Down Expand Up @@ -130,17 +130,17 @@ function addErrorCSS(e, errorText) {

var label = enclosingDiv.getElementsByTagName("label")[0];
if (label) {
label.setAttribute("class", "errorLabel"); //standard way.. works for ie mozilla
label.setAttribute("className", "errorLabel"); //ie hack cause ie does not support setAttribute
label.setAttribute("class", "struts-errorLabel"); //standard way.. works for ie mozilla
label.setAttribute("className", "struts-errorLabel"); //ie hack cause ie does not support setAttribute
}

var firstCtrNode = findWWCtrlNode(enclosingDiv); // either wwctrl_ or wwlbl_

var error = document.createTextNode(errorText);
var errorDiv = document.createElement("div");

errorDiv.setAttribute("class", "errorMessage");//standard way.. works for ie mozilla
errorDiv.setAttribute("className", "errorMessage");//ie hack cause ie does not support setAttribute
errorDiv.setAttribute("class", "struts-errorMessage");//standard way.. works for ie mozilla
errorDiv.setAttribute("className", "struts-errorMessage");//ie hack cause ie does not support setAttribute
errorDiv.setAttribute("errorFor", elem.id);
errorDiv.appendChild(error);
if(!firstCtrNode && navigator.appName === 'Microsoft Internet Explorer') {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/template/simple/actionerror.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<#if parameters.cssClass??>
class="${parameters.cssClass?html}"<#rt/>
<#else>
class="errorMessage"<#rt/>
class="struts-errorMessage"<#rt/>
</#if>
<#if parameters.cssStyle??>
style="${parameters.cssStyle?html}"<#rt/>
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/template/simple/checkboxlist.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<#else>
for="${parameters.name?html}-${itemCount}"<#rt/>
</#if>
class="checkboxLabel">${itemValue?html}</label>
class="struts-checkboxLabel">${itemValue?html}</label>
</@s.iterator>
<#else>
&nbsp;
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/resources/template/simple/fielderror.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<#if parameters.cssClass?has_content>
class="${parameters.cssClass?html}"<#rt/>
<#else>
class="errorMessage"<#rt/>
class="struts-errorMessage"<#rt/>
</#if>
<#if parameters.cssStyle?has_content>
style="${parameters.cssStyle?html}"<#rt/>
Expand All @@ -64,7 +64,7 @@
<#if parameters.cssClass?has_content>
class="${parameters.cssClass?html}"<#rt/>
<#else>
class="errorMessage"<#rt/>
class="struts-errorMessage"<#rt/>
</#if>
<#if parameters.cssStyle?has_content>
style="${parameters.cssStyle?html}"<#rt/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@


</td>
<td class="tdTransferSelect">
<td class="struts-tdTransferSelect">
<#assign addLabel=(parameters.addLabel!"->")?html /><#t/>
<input type="button"
<#if parameters.buttonCssClass?has_content><#t/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</#if>

</td>
<td class="tdTransferSelect">
<td class="struts-tdTransferSelect">
<#if parameters.allowAddToLeft?default(true)><#t/>
<#assign addToLeftLabel = parameters.addToLeftLabel?default("<-")?html/><#t/>
<#if parameters.doubleHeaderKey??><#t/>
Expand Down
30 changes: 15 additions & 15 deletions core/src/main/resources/template/xhtml/checkbox.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
errorFor="${parameters.id}"<#rt/>
</#if>
>
<td class="tdCheckboxErrorMessage" colspan="2"><#rt/>
<span class="errorMessage">${error?html}</span><#t/>
<td class="struts-tdCheckboxErrorMessage" colspan="2"><#rt/>
<span class="struts-errorMessage">${error?html}</span><#t/>
</td><#lt/>
</tr>
</#list>
Expand All @@ -47,17 +47,17 @@
for="${parameters.id?html}"<#rt/>
</#if>
<#if hasFieldErrors>
class="checkboxErrorLabel"<#rt/>
class="struts-checkboxErrorLabel"<#rt/>
<#else>
class="checkboxLabel"<#rt/>
class="struts-checkboxLabel"<#rt/>
</#if>
>
<#if parameters.required?default(false) && parameters.requiredPosition?default("right") != 'right'>
<span class="required">*</span><#t/>
<span class="struts-required">*</span><#t/>
</#if>
${parameters.label?html}<#t/>
<#if parameters.required?default(false) && parameters.requiredPosition?default("right") == 'right'>
<span class="required">*</span><#t/>
<span class="struts-required">*</span><#t/>
</#if>
:<#t/>
<#if parameters.tooltip??>
Expand All @@ -72,24 +72,24 @@ ${parameters.label?html}<#t/>
<#include "/${parameters.templateDir}/simple/checkbox.ftl" />
<#else>
<tr>
<td class="tdCheckboxLabel">
<td class="struts-tdCheckboxLabel">
<#if labelpos?default("") == 'left'>
<#if parameters.label??> <label<#t/>
<#if parameters.id??>
for="${parameters.id?html}"<#rt/>
</#if>
<#if hasFieldErrors>
class="checkboxErrorLabel"<#rt/>
class="struts-checkboxErrorLabel"<#rt/>
<#else>
class="checkboxLabel"<#rt/>
class="struts-checkboxLabel"<#rt/>
</#if>
>
<#if parameters.required?default(false) && parameters.requiredPosition?default("right") != 'right'>
<span class="required">*</span><#t/>
<span class="struts-required">*</span><#t/>
</#if>
${parameters.label?html}<#t/>
<#if parameters.required?default(false) && parameters.requiredPosition?default("right") == 'right'>
<span class="required">*</span><#t/>
<span class="struts-required">*</span><#t/>
</#if>
:<#t/>
<#if parameters.tooltip??>
Expand All @@ -100,14 +100,14 @@ ${parameters.label?html}<#t/>
</#if>
<#if labelpos?default("") == 'right'>
<#if parameters.required?default(false)>
<span class="required">*</span><#t/>
<span class="struts-required">*</span><#t/>
</#if>
<#if parameters.tooltip??>
<#include "/${parameters.templateDir}/${parameters.expandTheme}/tooltip.ftl" />
</#if>
</#if>
</td>
<td class="tdCheckboxInput">
<td class="struts-tdCheckboxInput">

<#if labelpos?default("") != 'top'>
<#include "/${parameters.templateDir}/simple/checkbox.ftl" />
Expand All @@ -118,9 +118,9 @@ ${parameters.label?html}<#t/>
for="${parameters.id?html}"<#rt/>
</#if>
<#if hasFieldErrors>
class="checkboxErrorLabel"<#rt/>
class="struts-checkboxErrorLabel"<#rt/>
<#else>
class="checkboxLabel"<#rt/>
class="struts-checkboxLabel"<#rt/>
</#if>
>${parameters.label?html}</label><#rt/>
</#if>
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/template/xhtml/control.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* under the License.
*/
-->
<table class="${parameters.cssClass?default('wwFormTable')?html}"<#rt/>
<table class="${parameters.cssClass?default('struts-wwFormTable')?html}"<#rt/>
<#if parameters.cssStyle??> style="${parameters.cssStyle?html}"<#rt/>
</#if>
>
4 changes: 2 additions & 2 deletions core/src/main/resources/template/xhtml/controlfooter.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ ${parameters.after?if_exists}<#t/>
<#if hasFieldErrors>
<#list fieldErrors[parameters.name] as error>
<tr errorFor="${parameters.id}">
<td class="tdErrorMessage" colspan="2"><#rt/>
<span class="errorMessage">${error?html}</span><#t/>
<td class="struts-tdErrorMessage" colspan="2"><#rt/>
<span class="struts-errorMessage">${error?html}</span><#t/>
</td><#lt/>
</tr>
</#list>
Expand Down
Loading