You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jb...@apache.org on 2007/09/11 19:13:56 UTC
svn commit: r574641 -
/geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configmanager/normal.jsp
Author: jbohn
Date: Tue Sep 11 10:13:55 2007
New Revision: 574641
URL: http://svn.apache.org/viewvc?rev=574641&view=rev
Log:
GERONIMO-3401 make expert mode stick using a session cookie and a little code cleanup
Modified:
geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configmanager/normal.jsp
Modified: geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configmanager/normal.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configmanager/normal.jsp?rev=574641&r1=574640&r2=574641&view=diff
==============================================================================
--- geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configmanager/normal.jsp (original)
+++ geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configmanager/normal.jsp Tue Sep 11 10:13:55 2007
@@ -19,6 +19,8 @@
<portlet:defineObjects/>
<script>
+var EXPERT_COOKIE = "org.apache.geronimo.configmanager.expertmode";
+
// Check to see if a component is "safe" to stop within a running server.
// Service components with names that begin with "org.apache.geronimo.configs/", for example,
// may not be safe to stop because doing so might prevent other components
@@ -125,7 +127,9 @@
// Toggle expert mode on and off with onClick
function toggleExpertMode() {
- if (document.checkExpert.expertUser.checked) {
+ if (document.checkExpert.expertMode.checked) {
+ // Set attribute/parameter to indicated expertMode is checked
+ document.cookie=EXPERT_COOKIE+"=true";
var expertActions = getSpanElementsByName('expert');
for( var i = 0; i < expertActions.length; ++i ) {
expertActions[i].style.display='block' ;
@@ -136,6 +140,8 @@
}
}
else {
+ // Set attribute/parameter to indicated expertMode is not checked
+ document.cookie=EXPERT_COOKIE+"=false";
var expertActions = getSpanElementsByName('expert');
for( var i = 0; i < expertActions.length; ++i ) {
expertActions[i].style.display='none' ;
@@ -161,12 +167,39 @@
}
return results;
}
+
+// get cookie utility routine
+function getCookie(name) {
+ var result = "";
+ var key = name + "=";
+ if (document.cookie.length > 0) {
+ start = document.cookie.indexOf(key);
+ if (start != -1) {
+ start += key.length;
+ end = document.cookie.indexOf(";", start);
+ if (end == -1) end = document.cookie.length;
+ result=document.cookie.substring(start, end);
+ }
+ }
+ return result;
+}
+
+// initialization routine to set the initial display state for expert mode correctly
+function init() {
+ if (getCookie(EXPERT_COOKIE) == 'true') {
+ document.checkExpert.expertMode.checked = true;
+ }
+ else {
+ document.checkExpert.expertMode.checked = false;
+ }
+ toggleExpertMode();
+}
</script>
<br />
<form name="checkExpert">
-<input type="checkbox" name="expertUser" onClick="toggleExpertMode();"/> Expert User (enable all actions on Geronimo Provided Components)
+<input type="checkbox" name="expertMode" onClick="toggleExpertMode();" /> Expert User (enable all actions on Geronimo Provided Components)
</form>
<br />
<table width="100%">
@@ -204,7 +237,7 @@
<td width="75" class="${backgroundClass}">
<c:if test="${moduleDetails.state.running || moduleDetails.state.failed}">
<span <c:if test="${moduleDetails.expertConfig}"> name=expert </c:if>>
- <a href="<portlet:actionURL><portlet:param name="configId" value="${moduleDetails.configId}"/><portlet:param name="action" value="stop"/></portlet:actionURL>" onClick="return promptIfUnsafeToStop('${moduleDetails.configId}','${moduleDetails.expertConfig}','${moduleDetails.type.name}');">Stop</a>
+ <a href="<portlet:actionURL><portlet:param name='configId' value='${moduleDetails.configId}'/><portlet:param name='action' value='stop'/></portlet:actionURL>" onClick="return promptIfUnsafeToStop('${moduleDetails.configId}','${moduleDetails.expertConfig}','${moduleDetails.type.name}');">Stop</a>
</span>
</c:if>
<c:if test="${moduleDetails.expertConfig && (moduleDetails.state.running || moduleDetails.state.failed)}">
@@ -213,7 +246,7 @@
</span>
</c:if>
<c:if test="${moduleDetails.state.stopped && (moduleDetails.type.name ne 'CAR')}">
- <a href="<portlet:actionURL><portlet:param name="configId" value="${moduleDetails.configId}"/><portlet:param name="action" value="start"/></portlet:actionURL>">Start</a>
+ <a href="<portlet:actionURL><portlet:param name='configId' value='${moduleDetails.configId}'/><portlet:param name='action' value='start'/></portlet:actionURL>">Start</a>
</c:if>
</td>
@@ -221,7 +254,7 @@
<td width="75" class="${backgroundClass}">
<c:if test="${moduleDetails.state.running}">
<span <c:if test="${moduleDetails.expertConfig}"> name=expert </c:if>>
- <a href="<portlet:actionURL><portlet:param name="configId" value="${moduleDetails.configId}"/><portlet:param name="action" value="restart"/></portlet:actionURL>" onClick="return promptIfUnsafeToRestart('${moduleDetails.configId}','${moduleDetails.expertConfig}','${moduleDetails.type.name}');">Restart</a>
+ <a href="<portlet:actionURL><portlet:param name='configId' value='${moduleDetails.configId}'/><portlet:param name='action' value='restart'/></portlet:actionURL>" onClick="return promptIfUnsafeToRestart('${moduleDetails.configId}','${moduleDetails.expertConfig}','${moduleDetails.type.name}');">Restart</a>
</span>
</c:if>
<c:if test="${moduleDetails.expertConfig && moduleDetails.state.running}">
@@ -229,14 +262,12 @@
<a>Restart</a>
</span>
</c:if>
- <!-- <c:if test="${moduleDetails.state.running}"> <a <c:if test="${moduleDetails.expertConfig}"> name=expert </c:if>href="<portlet:actionURL><portlet:param name="configId" value="${moduleDetails.configId}"/><portlet:param name="action" value="restart"/></portlet:actionURL>" onClick="return promptIfUnsafeToRestart('${moduleDetails.configId}','${moduleDetails.expertConfig}','${moduleDetails.type.name}');">Restart</a></c:if> -->
- <!-- <c:if test="${moduleDetails.expertConfig}"> <a name=nonexpert /> Restart</a> </c:if> -->
</td>
<!-- Uninstall action -->
<td width="75" class="${backgroundClass}">
<span <c:if test="${moduleDetails.expertConfig}"> name=expert </c:if>>
- <a href="<portlet:actionURL><portlet:param name="configId" value="${moduleDetails.configId}"/><portlet:param name="action" value="uninstall"/></portlet:actionURL>" onClick="return uninstallPrompt('${moduleDetails.configId}','${moduleDetails.expertConfig}','${moduleDetails.type.name}');">Uninstall</a>
+ <a href="<portlet:actionURL><portlet:param name='configId' value='${moduleDetails.configId}'/><portlet:param name='action' value='uninstall'/></portlet:actionURL>" onClick="return uninstallPrompt('${moduleDetails.configId}','${moduleDetails.expertConfig}','${moduleDetails.type.name}');">Uninstall</a>
</span>
<c:if test="${moduleDetails.expertConfig}">
<span name=nonexpert>
@@ -268,5 +299,5 @@
<script>
// Call to set initial expert mode actions correctly
-toggleExpertMode();
+init();
</script>