portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jf...@apache.org
Subject cvs commit: jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/resources PAMResources_ja.properties PAMResources.properties
Date Tue, 14 Sep 2004 18:09:58 GMT
jford       2004/09/14 11:09:58

  Modified:    applications/pam/src/webapp/WEB-INF/view portlet-detail.jsp
               applications/pam/src/java/org/apache/jetspeed/portlets/pam
                        PortletApplicationDetail.java
               applications/pam/src/java/org/apache/jetspeed/portlets/pam/resources
                        PAMResources_ja.properties PAMResources.properties
  Log:
  Added support for content type
  
  Revision  Changes    Path
  1.9       +1 -1      jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/view/portlet-detail.jsp
  
  Index: portlet-detail.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/view/portlet-detail.jsp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- portlet-detail.jsp	14 Sep 2004 15:51:04 -0000	1.8
  +++ portlet-detail.jsp	14 Sep 2004 18:09:58 -0000	1.9
  @@ -1 +1 @@
  -<%--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--%>
<c:set var="portlet_tabs" value="${requestScope.portlet_tabs}"/>

<c:set var="selectedPortletTab" value="${requestScope.selected_portlet_tab}"/>

<span class="portlet-section-header">Selected Portlet</span>
<c:out value="${selectedPDef.name}"/>
<div id="portlet_tabs">

	<c:set var="tab_items" value="${portlet_tabs}"/>
	<c:set var="currentTab" value="${selectedPortletTab}"/>
	<c:set var="url_param_name" value="selected_portlet_tab"/>
	<%@ include file="tabs.jsp"%>
</div>

<br />

<c:if test="${selectedPortletTab.id == 'pd_details'}">
	<table>
		<tr>
			<td>
				<fmt:message key="pam.details.expiration_cache"/>
			</td>
			<td>
				<c:out value="${selectedPDef.expirationCache}"/>
			</td>
		</tr>
		</tr>
			<td>
				<fmt:message key="pam.details.id"/>
			</td>
			<td>
				<c:out value="${selectedPDef.portletIdentifier}"/>
			</td>
		</tr>
		</tr>
			<td>
				<fmt:message key="pam.details.unique_name"/>
			</td>
			<td>
				<c:out value="${selectedPDef.uniqueName}"/>
			</td>
		</tr>
		</tr>
			<td>
				<fmt:message key="pam.details.preference_validator"/>
			</td>
			<td>
				<c:out value="${selectedPDef.preferenceValidatorClassname}"/>
			</td>
		</tr>
		</tr>
			<td>
				<fmt:message key="pam.details.class_name"/>
			</td>
			<td>
				<c:out value="${selectedPDef.className}"/>
			</td>
		</tr>
	</table>
</c:if>

<c:if test="${selectedPortletTab.id == 'pd_metadata'}">
	<div id="portlet_metadata">
			
		<c:set var="md" value="${selectedPDef.metadata}"/>
		<c:set var="action_prefix" value="portlet."/>
		<portlet:actionURL var="edit_metadata_link" >			
		</portlet:actionURL>
		
		<%@ include file="metadata-detail.jsp" %>
	</div>
</c:if>

<c:if test="${selectedPortletTab.id == 'pd_preferences'}">
	<c:set var="prefSet" value="${selectedPDef.preferenceSet}"/>
	<%
		PreferenceSetComposite comp = (PreferenceSetComposite)pageContext.findAttribute("prefSet");
		Iterator prefIter = comp.iterator();
		pageContext.setAttribute("prefIter", prefIter);
	%>
	
	<portlet:actionURL var="edit_preferenece_link" >
    </portlet:actionURL>
	
	<form action="<c:out value="${edit_preferenece_link}"/>">
		<input type="hidden" name="portlet_action" value=""/>
		<table border="1">
			<tr>
				<th>&nbsp;</th>
				<th><fmt:message key="pam.details.name"/></th>
				<th><fmt:message key="pam.details.value"/></th>
			</tr>
			<tr>
				<td colspan="3">&nbsp;</td>
			</td>
		<c:forEach var="pref" items="${prefIter}">
			<tr>
				<td>
					<input type="checkbox" name="pref_remove_id" value="<c:out value="${pref.name}"/>"/>
				</td>
				<td>
					<c:out value="${pref.name}"/>
					<input type="hidden" name="pref_edit_id" value="<c:out value="${pref.name}"/>"/>
				</td>
				<td>
					<table>
					<c:forEach var="value" items="${pref.values}" varStatus="status">
						<tr>
							<td>
								<input type="text" name="<c:out value="${pref.name}"/>:<c:out value="${status.index}"/>" value="<c:out value="${value}"/>"/>
							</td>
						</tr>
					</c:forEach>
					</table>
				</tr>
			</tr>
		</c:forEach>
		</table>
		
		<input type="submit" value="<fmt:message key="pam.details.edit"/>" onClick="this.form.portlet_action.value = 'portlet.edit_preference'"/>
		<input type="submit" value="<fmt:message key="pam.details.remove"/>" onClick="this.form.portlet_action.value = 'portlet.remove_preference'"/>
	</form>
	
	<hr />
	
	
	<form action="<c:out value="${edit_preferenece_link}"/>">
		<input type="hidden" name="portlet_action" value="portlet.add_preference"/>
		<table>
			<tr>
				<td>
					<fmt:message key="pam.details.name"/>
				</td>
				<td>
					<input type="text" name="name"/>
				</td>
				<%--TODO add combo box of existing keys--%>
			</tr>
			<tr>
				<td>
					<fmt:message key="pam.details.value"/>
				</td>
				<td>
					<input type="text" name="value"/>
				</td>
			</tr>
			<%--
			<tr>
				<td>
					<fmt:message key="pam.details.type"/>
				</td>
				<td>
					<select>
						<option value="string">String</option>
						<option value="int">Int</option>
					</select>
				</td>
			</tr>
			--%>
		</table>
		<input type="submit" value="<fmt:message key="pam.details.add_preference"/>"/>
	</form>
</c:if>

<c:if test="${selectedPortletTab.id == 'pd_languages'}">
	<c:set var="langSet" value="${selectedPDef.languageSet}"/>
	
	<portlet:actionURL var="edit_language_link" >
    </portlet:actionURL>
	
	<form action="<c:out value="${edit_language_link}"/>">
		<input type="hidden" name="portlet_action" value=""/>
	<table border="1">
		<tr>
			<th>&nbsp;</th>
			<th><fmt:message key="pam.details.title"/></th>
			<th><fmt:message key="pam.details.short_title"/></th>
			<th><fmt:message key="pam.details.keyword"/></th>
			<th><fmt:message key="pam.details.locale"/></th>
		</tr>
	<c:forEach var="lang" items="${langSet.innerCollection}" varStatus="status">
		<tr>
			<td>
				<input type="checkbox" name="language_remove_id" value="<c:out value="${status.index}"/>"/>
				<input type="hidden" name="language_edit_id" value="<c:out value="${status.index}"/>"/>
			</td>
			<td>
				<input type="text" name="title:<c:out value="${status.index}"/>" value="<c:out value="${lang.title}"/>"/>
			</td>
			<td>
				<input type="text" name="short_title:<c:out value="${status.index}"/>" value="<c:out value="${lang.shortTitle}"/>"/>
			</td>
			<td>
				<table>
				<c:forEach var="keyword" items="${lang.keywords}" varStatus="keywordStatus">
					<tr>
						<td>
							<input type="text" name="keyword:<c:out value="${status.index}"/>:<c:out value="${keywordStatus.index}"/>" value="<c:out value="${keyword}"/>"/>
						</td>
					</tr>
				</c:forEach>
				</table>
				<%--
				<input type="text" name="keyword:<c:out value="${status.index}"/>" value="<c:forEach var="keyword" items="${lang.keywords}" varStatus="keywordStatus"><c:out value="${keyword}"/>,</c:forEach>"/>
				--%>
			</td>
			<td>
				<c:out value="${lang.locale}"/>
			</td>
		</tr>
	</c:forEach>
	</table>
	
		<input type="submit" value="<fmt:message key="pam.details.edit"/>" onClick="this.form.portlet_action.value = 'portlet.edit_language'"/>
		<input type="submit" value="<fmt:message key="pam.details.remove"/>" onClick="this.form.portlet_action.value = 'portlet.remove_language'"/>
	</form>
	
	<form action="<c:out value="${edit_language_link}"/>">
		<input type="hidden" name="portlet_action" value="portlet.add_language"/>
		
		<table>
			<tr>
				<td>
					<fmt:message key="pam.details.title"/>
				</td>
				<td>
					<input type="text" name="title" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.title.description"/>
				</td>
			</tr>
			<tr>
				<td>
					<fmt:message key="pam.details.short_title"/>
				</td>
				<td>
					<input type="text" name="short_title" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.short_title.description"/>
				</td>
			</tr>
			<tr>
				<td>
					<fmt:message key="pam.details.keyword"/>
				</td>
				<td>
					<input type="text" name="keyword" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.keyword.description"/>
				</td>
			</tr>
			<tr>
				<td>
					<fmt:message key="pam.details.locale"/>
				</td>
				<td>
					<input type="text" name="locale" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.locale.description"/>
				</td>
			</tr>
		</table>
		
		<input type="submit" value="<fmt:message key="pam.details.add_language"/>"/>
	</form>
</c:if>

<c:if test="${selectedPortletTab.id == 'pd_parameters'}">
	<c:set var="paramSet" value="${selectedPDef.initParameterSet}"/>
	
	<portlet:actionURL var="edit_parameter_link" >
    </portlet:actionURL>
	
	<%--
		TODO:  if needed, place iterator into page context
		see prefs section
	--%>
	
	<form action="<c:out value="${edit_parameter_link}"/>">
		<input type="hidden" name="portlet_action" value=""/>
	
	<table>
	<c:forEach var="theparam" items="${paramSet.innerCollection}">
		<tr>
			<td>
				<input type="checkbox" name="parameter_remove_id" value="<c:out value="${theparam.name}"/>" />
			</td>
			<td>
				<input type="hidden" name="parameter_edit_id" value="<c:out value="${theparam.name}"/>" />
				<c:out value="${theparam.name}"/>
			</td>
			<td>
				<input type="text" name="<c:out value="${theparam.name}"/>:value" value="<c:out value="${theparam.value}"/>"/>
			</td>
			<%--
				TODO handle descriptions
			--%>
		</tr>
	</c:forEach>
	</table>
	
		<input type="submit" value="<fmt:message key="pam.details.edit"/>" onClick="this.form.portlet_action.value = 'portlet.edit_parameter'"/>
		<input type="submit" value="<fmt:message key="pam.details.remove"/>" onClick="this.form.portlet_action.value = 'portlet.remove_parameter'"/>
	
	</form>
	
	<form action="<c:out value="${edit_parameter_link}"/>">
		<input type="hidden" name="portlet_action" value="portlet.add_parameter"/>
		<table>
			<tr>
				<td>
					<fmt:message key="pam.details.name"/>
				</td>
				<td>
					<input type="text" name="name" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.name.description"/>
				</td>
			</tr>
			<tr>
				<td>
					<fmt:message key="pam.details.value"/>
				</td>
				<td>
					<input type="text" name="value" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.value.description"/>
				</td>
			</tr>
			<tr>
				<td>
					<fmt:message key="pam.details.description"/>
				</td>
				<td>
					<input type="text" name="description" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.description.description"/>
				</td>
			</tr>
			<tr>
				<td>
					<fmt:message key="pam.details.locale"/>
				</td>
				<td>
					<input type="text" name="locale" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.locale.description"/>
				</td>
			</tr>
		</table>
		<input type="submit" value="<fmt:message key="pam.details.add_parameter"/>"/>
	</form>
	
</c:if>
<c:if test="${selectedPortletTab.id == 'pd_security'}">
	<c:set var="roleSet" value="${selectedPDef.initSecurityRoleRefSet}"/>
	
	<portlet:actionURL var="edit_security_link" >
    </portlet:actionURL>

	<c:if test="${! empty roleSet.innerCollection}">
	<form action="<c:out value="${edit_security_link}"/>">
		<input type="hidden" name="portlet_action" value=""/>	
	
		<table border="1">
			<tr>
				<th>&nbsp;</th>
				<th><fmt:message key="pam.details.role_name"/></th>
				<th><fmt:message key="pam.details_role_link"/></th>
			</tr>
		<c:forEach var="therole" items="${roleSet.innerCollection}">
			<tr>
				<td>
					<input type="checkbox" name="security_remove_id" value="<c:out value="${therole.roleName}"/>"/>
				</td>
				<td>
					<input type="hidden" name="security_edit_id" value="<c:out value="${therole.roleName}"/>"/>
					<input type="text" name="<c:out value="${therole.roleName}"/>:name" value="<c:out value="${therole.roleName}"/>"/>
				</td>
				<td>
					<input type="text" name="<c:out value="${therole.roleName}"/>:link" value="<c:out value="${therole.roleLink}"/>"/>
				</td>
			</tr>
		</c:forEach>
		</table>
	
		<input type="submit" value="<fmt:message key="pam.details.edit"/>" onClick="this.form.portlet_action.value = 'portlet.edit_security'"/>
		<input type="submit" value="<fmt:message key="pam.details.remove"/>" onClick="this.form.portlet_action.value = 'portlet.remove_security'"/>
	
	</form>
	</c:if>

	<form action="<c:out value="${edit_security_link}"/>">
		<input type="hidden" name="portlet_action" value="portlet.add_security"/>
		<table>
			<tr>
				<td>
					<fmt:message key="pam.details.role_name"/>
				</td>
				<td>
					<input type="text" name="name" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.role_name.description"/>
				</td>
			</tr>
			<tr>
				<td>
					<fmt:message key="pam.details.role_link"/>
				</td>
				<td>
					<input type="text" name="link" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.role_link.description"/>
				</td>
			</tr>
		</table>
		<input type="submit" value="<fmt:message key="pam.details.add_security"/>"/>
	</form>

</c:if>

<c:if test="${selectedPortletTab.id == 'pd_content_type'}">
	<c:set var="contentTypeSet" value="${selectedPDef.contentTypeSet}"/>
	<c:forEach var="contentType" items="${contentTypeSet.innerCollection}">
		<c:out value="${contentType.contentType}"/> | 
		
		<c:forEach var="mode" items="${contentType.portletModes}">
			<c:out value="${mode}"/>, 
		</c:forEach>
		
		<br />
	</c:forEach>
</c:if>
  \ No newline at end of file
  +<%--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--%>
<c:set var="portlet_tabs" value="${requestScope.portlet_tabs}"/>

<c:set var="selectedPortletTab" value="${requestScope.selected_portlet_tab}"/>

<span class="portlet-section-header">Selected Portlet</span>
<c:out value="${selectedPDef.name}"/>
<div id="portlet_tabs">

	<c:set var="tab_items" value="${portlet_tabs}"/>
	<c:set var="currentTab" value="${selectedPortletTab}"/>
	<c:set var="url_param_name" value="selected_portlet_tab"/>
	<%@ include file="tabs.jsp"%>
</div>

<br />

<c:if test="${selectedPortletTab.id == 'pd_details'}">
	<table>
		<tr>
			<td>
				<fmt:message key="pam.details.expiration_cache"/>
			</td>
			<td>
				<c:out value="${selectedPDef.expirationCache}"/>
			</td>
		</tr>
		</tr>
			<td>
				<fmt:message key="pam.details.id"/>
			</td>
			<td>
				<c:out value="${selectedPDef.portletIdentifier}"/>
			</td>
		</tr>
		</tr>
			<td>
				<fmt:message key="pam.details.unique_name"/>
			</td>
			<td>
				<c:out value="${selectedPDef.uniqueName}"/>
			</td>
		</tr>
		</tr>
			<td>
				<fmt:message key="pam.details.preference_validator"/>
			</td>
			<td>
				<c:out value="${selectedPDef.preferenceValidatorClassname}"/>
			</td>
		</tr>
		</tr>
			<td>
				<fmt:message key="pam.details.class_name"/>
			</td>
			<td>
				<c:out value="${selectedPDef.className}"/>
			</td>
		</tr>
	</table>
</c:if>

<c:if test="${selectedPortletTab.id == 'pd_metadata'}">
	<div id="portlet_metadata">
			
		<c:set var="md" value="${selectedPDef.metadata}"/>
		<c:set var="action_prefix" value="portlet."/>
		<portlet:actionURL var="edit_metadata_link" >			
		</portlet:actionURL>
		
		<%@ include file="metadata-detail.jsp" %>
	</div>
</c:if>

<c:if test="${selectedPortletTab.id == 'pd_preferences'}">
	<c:set var="prefSet" value="${selectedPDef.preferenceSet}"/>
	<%
		PreferenceSetComposite comp = (PreferenceSetComposite)pageContext.findAttribute("prefSet");
		Iterator prefIter = comp.iterator();
		pageContext.setAttribute("prefIter", prefIter);
	%>
	
	<portlet:actionURL var="edit_preferenece_link" >
    </portlet:actionURL>
	
	<form action="<c:out value="${edit_preferenece_link}"/>">
		<input type="hidden" name="portlet_action" value=""/>
		<table border="1">
			<tr>
				<th>&nbsp;</th>
				<th><fmt:message key="pam.details.name"/></th>
				<th><fmt:message key="pam.details.value"/></th>
			</tr>
			<tr>
				<td colspan="3">&nbsp;</td>
			</td>
		<c:forEach var="pref" items="${prefIter}">
			<tr>
				<td>
					<input type="checkbox" name="pref_remove_id" value="<c:out value="${pref.name}"/>"/>
				</td>
				<td>
					<c:out value="${pref.name}"/>
					<input type="hidden" name="pref_edit_id" value="<c:out value="${pref.name}"/>"/>
				</td>
				<td>
					<table>
					<c:forEach var="value" items="${pref.values}" varStatus="status">
						<tr>
							<td>
								<input type="text" name="<c:out value="${pref.name}"/>:<c:out value="${status.index}"/>" value="<c:out value="${value}"/>"/>
							</td>
						</tr>
					</c:forEach>
					</table>
				</tr>
			</tr>
		</c:forEach>
		</table>
		
		<input type="submit" value="<fmt:message key="pam.details.edit"/>" onClick="this.form.portlet_action.value = 'portlet.edit_preference'"/>
		<input type="submit" value="<fmt:message key="pam.details.remove"/>" onClick="this.form.portlet_action.value = 'portlet.remove_preference'"/>
	</form>
	
	<hr />
	
	
	<form action="<c:out value="${edit_preferenece_link}"/>">
		<input type="hidden" name="portlet_action" value="portlet.add_preference"/>
		<table>
			<tr>
				<td>
					<fmt:message key="pam.details.name"/>
				</td>
				<td>
					<input type="text" name="name"/>
				</td>
				<%--TODO add combo box of existing keys--%>
			</tr>
			<tr>
				<td>
					<fmt:message key="pam.details.value"/>
				</td>
				<td>
					<input type="text" name="value"/>
				</td>
			</tr>
			<%--
			<tr>
				<td>
					<fmt:message key="pam.details.type"/>
				</td>
				<td>
					<select>
						<option value="string">String</option>
						<option value="int">Int</option>
					</select>
				</td>
			</tr>
			--%>
		</table>
		<input type="submit" value="<fmt:message key="pam.details.add_preference"/>"/>
	</form>
</c:if>

<c:if test="${selectedPortletTab.id == 'pd_languages'}">
	<c:set var="langSet" value="${selectedPDef.languageSet}"/>
	
	<portlet:actionURL var="edit_language_link" >
    </portlet:actionURL>
	
	<form action="<c:out value="${edit_language_link}"/>">
		<input type="hidden" name="portlet_action" value=""/>
	<table border="1">
		<tr>
			<th>&nbsp;</th>
			<th><fmt:message key="pam.details.title"/></th>
			<th><fmt:message key="pam.details.short_title"/></th>
			<th><fmt:message key="pam.details.keyword"/></th>
			<th><fmt:message key="pam.details.locale"/></th>
		</tr>
	<c:forEach var="lang" items="${langSet.innerCollection}" varStatus="status">
		<tr>
			<td>
				<input type="checkbox" name="language_remove_id" value="<c:out value="${status.index}"/>"/>
				<input type="hidden" name="language_edit_id" value="<c:out value="${status.index}"/>"/>
			</td>
			<td>
				<input type="text" name="title:<c:out value="${status.index}"/>" value="<c:out value="${lang.title}"/>"/>
			</td>
			<td>
				<input type="text" name="short_title:<c:out value="${status.index}"/>" value="<c:out value="${lang.shortTitle}"/>"/>
			</td>
			<td>
				<table>
				<c:forEach var="keyword" items="${lang.keywords}" varStatus="keywordStatus">
					<tr>
						<td>
							<input type="text" name="keyword:<c:out value="${status.index}"/>:<c:out value="${keywordStatus.index}"/>" value="<c:out value="${keyword}"/>"/>
						</td>
					</tr>
				</c:forEach>
				</table>
				<%--
				<input type="text" name="keyword:<c:out value="${status.index}"/>" value="<c:forEach var="keyword" items="${lang.keywords}" varStatus="keywordStatus"><c:out value="${keyword}"/>,</c:forEach>"/>
				--%>
			</td>
			<td>
				<c:out value="${lang.locale}"/>
			</td>
		</tr>
	</c:forEach>
	</table>
	
		<input type="submit" value="<fmt:message key="pam.details.edit"/>" onClick="this.form.portlet_action.value = 'portlet.edit_language'"/>
		<input type="submit" value="<fmt:message key="pam.details.remove"/>" onClick="this.form.portlet_action.value = 'portlet.remove_language'"/>
	</form>
	
	<form action="<c:out value="${edit_language_link}"/>">
		<input type="hidden" name="portlet_action" value="portlet.add_language"/>
		
		<table>
			<tr>
				<td>
					<fmt:message key="pam.details.title"/>
				</td>
				<td>
					<input type="text" name="title" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.title.description"/>
				</td>
			</tr>
			<tr>
				<td>
					<fmt:message key="pam.details.short_title"/>
				</td>
				<td>
					<input type="text" name="short_title" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.short_title.description"/>
				</td>
			</tr>
			<tr>
				<td>
					<fmt:message key="pam.details.keyword"/>
				</td>
				<td>
					<input type="text" name="keyword" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.keyword.description"/>
				</td>
			</tr>
			<tr>
				<td>
					<fmt:message key="pam.details.locale"/>
				</td>
				<td>
					<input type="text" name="locale" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.locale.description"/>
				</td>
			</tr>
		</table>
		
		<input type="submit" value="<fmt:message key="pam.details.add_language"/>"/>
	</form>
</c:if>

<c:if test="${selectedPortletTab.id == 'pd_parameters'}">
	<c:set var="paramSet" value="${selectedPDef.initParameterSet}"/>
	
	<portlet:actionURL var="edit_parameter_link" >
    </portlet:actionURL>
	
	<%--
		TODO:  if needed, place iterator into page context
		see prefs section
	--%>
	
	<form action="<c:out value="${edit_parameter_link}"/>">
		<input type="hidden" name="portlet_action" value=""/>
	
	<table>
	<c:forEach var="theparam" items="${paramSet.innerCollection}">
		<tr>
			<td>
				<input type="checkbox" name="parameter_remove_id" value="<c:out value="${theparam.name}"/>" />
			</td>
			<td>
				<input type="hidden" name="parameter_edit_id" value="<c:out value="${theparam.name}"/>" />
				<c:out value="${theparam.name}"/>
			</td>
			<td>
				<input type="text" name="<c:out value="${theparam.name}"/>:value" value="<c:out value="${theparam.value}"/>"/>
			</td>
			<%--
				TODO handle descriptions
			--%>
		</tr>
	</c:forEach>
	</table>
	
		<input type="submit" value="<fmt:message key="pam.details.edit"/>" onClick="this.form.portlet_action.value = 'portlet.edit_parameter'"/>
		<input type="submit" value="<fmt:message key="pam.details.remove"/>" onClick="this.form.portlet_action.value = 'portlet.remove_parameter'"/>
	
	</form>
	
	<form action="<c:out value="${edit_parameter_link}"/>">
		<input type="hidden" name="portlet_action" value="portlet.add_parameter"/>
		<table>
			<tr>
				<td>
					<fmt:message key="pam.details.name"/>
				</td>
				<td>
					<input type="text" name="name" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.name.description"/>
				</td>
			</tr>
			<tr>
				<td>
					<fmt:message key="pam.details.value"/>
				</td>
				<td>
					<input type="text" name="value" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.value.description"/>
				</td>
			</tr>
			<tr>
				<td>
					<fmt:message key="pam.details.description"/>
				</td>
				<td>
					<input type="text" name="description" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.description.description"/>
				</td>
			</tr>
			<tr>
				<td>
					<fmt:message key="pam.details.locale"/>
				</td>
				<td>
					<input type="text" name="locale" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.locale.description"/>
				</td>
			</tr>
		</table>
		<input type="submit" value="<fmt:message key="pam.details.add_parameter"/>"/>
	</form>
	
</c:if>
<c:if test="${selectedPortletTab.id == 'pd_security'}">
	<c:set var="roleSet" value="${selectedPDef.initSecurityRoleRefSet}"/>
	
	<portlet:actionURL var="edit_security_link" >
    </portlet:actionURL>

	<c:if test="${! empty roleSet.innerCollection}">
	<form action="<c:out value="${edit_security_link}"/>">
		<input type="hidden" name="portlet_action" value=""/>	
	
		<table border="1">
			<tr>
				<th>&nbsp;</th>
				<th><fmt:message key="pam.details.role_name"/></th>
				<th><fmt:message key="pam.details.role_link"/></th>
			</tr>
		<c:forEach var="therole" items="${roleSet.innerCollection}">
			<tr>
				<td>
					<input type="checkbox" name="security_remove_id" value="<c:out value="${therole.roleName}"/>"/>
				</td>
				<td>
					<input type="hidden" name="security_edit_id" value="<c:out value="${therole.roleName}"/>"/>
					<input type="text" name="<c:out value="${therole.roleName}"/>:name" value="<c:out value="${therole.roleName}"/>"/>
				</td>
				<td>
					<input type="text" name="<c:out value="${therole.roleName}"/>:link" value="<c:out value="${therole.roleLink}"/>"/>
				</td>
			</tr>
		</c:forEach>
		</table>
	
		<input type="submit" value="<fmt:message key="pam.details.edit"/>" onClick="this.form.portlet_action.value = 'portlet.edit_security'"/>
		<input type="submit" value="<fmt:message key="pam.details.remove"/>" onClick="this.form.portlet_action.value = 'portlet.remove_security'"/>
	
	</form>
	</c:if>

	<form action="<c:out value="${edit_security_link}"/>">
		<input type="hidden" name="portlet_action" value="portlet.add_security"/>
		<table>
			<tr>
				<td>
					<fmt:message key="pam.details.role_name"/>
				</td>
				<td>
					<input type="text" name="name" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.role_name.description"/>
				</td>
			</tr>
			<tr>
				<td>
					<fmt:message key="pam.details.role_link"/>
				</td>
				<td>
					<input type="text" name="link" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.role_link.description"/>
				</td>
			</tr>
		</table>
		<input type="submit" value="<fmt:message key="pam.details.add_security"/>"/>
	</form>

</c:if>

<c:if test="${selectedPortletTab.id == 'pd_content_type'}">
	<c:set var="contentTypeSet" value="${selectedPDef.contentTypeSet}"/>
	
	<portlet:actionURL var="edit_content_type_link" >
    </portlet:actionURL>

	<c:if test="${! empty contentTypeSet.innerCollection}">
	<form action="<c:out value="${edit_content_type_link}"/>">
		<input type="hidden" name="portlet_action" value=""/>
		<table border="1">
			<tr>
				<th>&nbsp;</th>
				<th><fmt:message key="pam.details.content_type"/></th>
				<td><fmt:message key="pam.details.modes"/></th>
			</tr>
		<c:forEach var="contentType" items="${contentTypeSet.innerCollection}">
			<tr>
				<td>
					<input type="checkbox" name="content_type_remove_id" value="<c:out value="${contentType.contentType}"/>"/>
				</td>
				<td>
					
					<c:out value="${contentType.contentType}"/>
				</td>
				<td>			
					<c:forEach var="mode" items="${contentType.portletModes}">
						<c:out value="${mode}"/>, 
					</c:forEach>
				</td>			
			</tr>
		</c:forEach>
		</table>
		
		<input type="submit" value="<fmt:message key="pam.details.edit"/>" onClick="this.form.portlet_action.value = 'portlet.edit_content_type'"/>
		<input type="submit" value="<fmt:message key="pam.details.remove"/>" onClick="this.form.portlet_action.value = 'portlet.remove_content_type'"/>
	</form>
	</c:if>
	
	<form action="<c:out value="${edit_content_type_link}"/>">
		<input type="hidden" name="portlet_action" value="portlet.add_content_type"/>
		<table>
			<tr>
				<td>
					<fmt:message key="pam.details.content_type"/>
				</td>
				<td>
					<%--TODO:  this could be a select box--%>
					<input type="text" name="content_type" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.content_type.description"/>
				</td>
			</tr>
			<tr>
				<td>
					<fmt:message key="pam.details.portlet_mode"/>
				</td>
				<td>
					<select name="mode" multiple="true">
						<option value="view"><fmt:message key="pam.details.porltet_mode.view"/></option>
						<option value="edit"><fmt:message key="pam.details.porltet_mode.edit"/></option>
						<option value="help"><fmt:message key="pam.details.porltet_mode.help"/></option>
					</select>
				</td>
				<td>
					<fmt:message key="pam.details.portlet_mode.description"/>
				</td>
			</tr>
			<tr>
				<td>
					<fmt:message key="pam.details.custom_mode"/>
				</td>
				<td>
					<%--TODO:  this could be a select box--%>
					<input type="text" name="custom_modes" value=""/>
				</td>
				<td>
					<fmt:message key="pam.details.custom_modes.description"/>
				</td>
			</tr>
		</table>
		<input type="submit" value="<fmt:message key="pam.details.add_content_type"/>"/>
	</form>
</c:if>
  \ No newline at end of file
  
  
  
  1.15      +2 -2      jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationDetail.java
  
  Index: PortletApplicationDetail.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationDetail.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- PortletApplicationDetail.java	14 Sep 2004 15:51:04 -0000	1.14
  +++ PortletApplicationDetail.java	14 Sep 2004 18:09:58 -0000	1.15
  @@ -1,9 +1,9 @@
   /*
 * Copyright 2000-2004 The Apache Software Foundation.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.jetspeed.portlets.pam;
   
  -import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Locale;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletConfig;
import javax.portlet.PortletContext;
import javax.portlet.PortletException;
import javax.portlet.PortletSession;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.apache.jetspeed.portlet.ServletPortlet;
import org.apache.jetspeed.portlets.pam.beans.PortletApplicationBean;
import org.apache.jetspeed.portlets.pam.beans.TabBean;
import org.apache.jetspeed.components.persistence.store.PersistenceStore;
import org.apache.jetspeed.components.portletregistry.PortletRegistryComponent;
import org.apache.jetspeed.om.common.GenericMetadata;
import org.apache.jetspeed.om.common.LocalizedField;
import org.apache.jetspeed.om.common.MutableLanguage;
import org.apache.jetspeed.om.common.ParameterComposite;
import org.apache.jetspeed.om.common.SecurityRoleRefComposite;
import org.apache.jetspeed.om.common.UserAttribute;
import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
import org.apache.jetspeed.om.common.preference.PreferenceComposite;
import org.apache.jetspeed.om.impl.LanguageImpl;
import org.apache.jetspeed.om.impl.SecurityRoleRefImpl;
import org.apache.jetspeed.om.impl.UserAttributeImpl;
import org.apache.pluto.om.portlet.PortletDefinition;
/**
 * This portlet is a browser over all the portlet applications in the system.
 *
 * @author <a href="mailto:jford@apache.com">Jeremy Ford</a>
 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
 * @version $Id$
 */
public class PortletApplicationDetail extends ServletPortlet
{
    private static final String PORTLET_ACTION = "portlet_action";
    private final String VIEW_PA = "portletApplication"; 
    private final String VIEW_PD = "portletDefinition";
    
    private static final String PORTLET_APP_ACTION_PREFIX = "portlet_app.";
    private static final String PORTLET_ACTION_PREFIX = "portlet.";

    private PortletContext context;
    private PortletRegistryComponent registry;
    private LinkedHashMap paTabMap = new LinkedHashMap();
    private LinkedHashMap pdTabMap = new LinkedHashMap();
    
    public void init(PortletConfig config)
    throws PortletException 
    {
        super.init(config);
        context = getPortletContext();
        registry = (PortletRegistryComponent)context.getAttribute(PortletApplicationResources.CPS_REGISTRY_COMPONENT);
        if (null == registry)
        {
            throw new PortletException("Failed to find the Portlet Registry on portlet initialization");
        }
        
        TabBean tb1 = new TabBean("pa_details");
        TabBean tb2 = new TabBean("pa_metadata");
        TabBean tb3 = new TabBean("pa_portlets");
        TabBean tb4 = new TabBean("pa_user_attribtues");
        
        paTabMap.put(tb1.getId(), tb1);
        paTabMap.put(tb2.getId(), tb2);
        paTabMap.put(tb3.getId(), tb3);
        paTabMap.put(tb4.getId(), tb4);
        
        TabBean tb_1 = new TabBean("pd_details");
        TabBean tb_2 = new TabBean("pd_metadata");
        TabBean tb_3 = new TabBean("pd_preferences");
        TabBean tb_4 = new TabBean("pd_languages");
        TabBean tb_5 = new TabBean("pd_parameters");
        TabBean tb_6 = new TabBean("pd_security");
        TabBean tb_7 = new TabBean("pd_content_type");
        
        pdTabMap.put(tb_1.getId(), tb_1);
        pdTabMap.put(tb_2.getId(), tb_2);
        pdTabMap.put(tb_3.getId(), tb_3);
        pdTabMap.put(tb_4.getId(), tb_4);
        pdTabMap.put(tb_5.getId(), tb_5);
        pdTabMap.put(tb_6.getId(), tb_6);
        pdTabMap.put(tb_7.getId(), tb_7);
    }
    
    public void doView(RenderRequest request, RenderResponse response)
  +import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.StringTokenizer;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletConfig;
import javax.portlet.PortletContext;
import javax.portlet.PortletException;
import javax.portlet.PortletSession;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.apache.jetspeed.portlet.ServletPortlet;
import org.apache.jetspeed.portlets.pam.beans.PortletApplicationBean;
import org.apache.jetspeed.portlets.pam.beans.TabBean;
import org.apache.jetspeed.components.persistence.store.PersistenceStore;
import org.apache.jetspeed.components.portletregistry.PortletRegistryComponent;
import org.apache.jetspeed.om.common.GenericMetadata;
import org.apache.jetspeed.om.common.LocalizedField;
import org.apache.jetspeed.om.common.MutableLanguage;
import org.apache.jetspeed.om.common.ParameterComposite;
import org.apache.jetspeed.om.common.SecurityRoleRefComposite;
import org.apache.jetspeed.om.common.UserAttribute;
import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
import org.apache.jetspeed.om.common.preference.PreferenceComposite;
import org.apache.jetspeed.om.impl.LanguageImpl;
import org.apache.jetspeed.om.impl.SecurityRoleRefImpl;
import org.apache.jetspeed.om.impl.UserAttributeImpl;
import org.apache.jetspeed.om.portlet.impl.ContentTypeImpl;
import org.apache.pluto.om.common.SecurityRoleRef;
import org.apache.pluto.om.portlet.ContentType;
import org.apache.pluto.om.portlet.PortletDefinition;
/**
 * This portlet is a browser over all the portlet applications in the system.
 *
 * @author <a href="mailto:jford@apache.com">Jeremy Ford</a>
 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
 * @version $Id$
 */
public class PortletApplicationDetail extends ServletPortlet
{
    private static final String PORTLET_ACTION = "portlet_action";
    private final String VIEW_PA = "portletApplication"; 
    private final String VIEW_PD = "portletDefinition";
    
    private static final String PORTLET_APP_ACTION_PREFIX = "portlet_app.";
    private static final String PORTLET_ACTION_PREFIX = "portlet.";

    private PortletContext context;
    private PortletRegistryComponent registry;
    private LinkedHashMap paTabMap = new LinkedHashMap();
    private LinkedHashMap pdTabMap = new LinkedHashMap();
    
    public void init(PortletConfig config)
    throws PortletException 
    {
        super.init(config);
        context = getPortletContext();
        registry = (PortletRegistryComponent)context.getAttribute(PortletApplicationResources.CPS_REGISTRY_COMPONENT);
        if (null == registry)
        {
            throw new PortletException("Failed to find the Portlet Registry on portlet initialization");
        }
        
        TabBean tb1 = new TabBean("pa_details");
        TabBean tb2 = new TabBean("pa_metadata");
        TabBean tb3 = new TabBean("pa_portlets");
        TabBean tb4 = new TabBean("pa_user_attribtues");
        
        paTabMap.put(tb1.getId(), tb1);
        paTabMap.put(tb2.getId(), tb2);
        paTabMap.put(tb3.getId(), tb3);
        paTabMap.put(tb4.getId(), tb4);
        
        TabBean tb_1 = new TabBean("pd_details");
        TabBean tb_2 = new TabBean("pd_metadata");
        TabBean tb_3 = new TabBean("pd_preferences");
        TabBean tb_4 = new TabBean("pd_languages");
        TabBean tb_5 = new TabBean("pd_parameters");
        TabBean tb_6 = new TabBean("pd_security");
        TabBean tb_7 = new TabBean("pd_content_type");
        
        pdTabMap.put(tb_1.getId(), tb_1);
        pdTabMap.put(tb_2.getId(), tb_2);
        pdTabMap.put(tb_3.getId(), tb_3);
        pdTabMap.put(tb_4.getId(), tb_4);
        pdTabMap.put(tb_5.getId(), tb_5);
        pdTabMap.put(tb_6.getId(), tb_6);
        pdTabMap.put(tb_7.getId(), tb_7);
    }
    
    public void doView(RenderRequest request, RenderResponse response)
       throws PortletException, IOException
       {
        response.setContentType("text/html");
        
        MutablePortletApplication pa = (MutablePortletApplication)
                request.getPortletSession().getAttribute(PortletApplicationResources.PAM_CURRENT_PA, 
                                                         PortletSession.APPLICATION_SCOPE);
        
        if (null != pa)
        {
            request.setAttribute(VIEW_PA, new PortletApplicationBean(pa));
            
            PortletDefinition pdef = (PortletDefinition) request.getPortletSession().getAttribute(PortletApplicationResources.REQUEST_SELECT_PORTLET, PortletSession.APPLICATION_SCOPE);
            
            request.setAttribute(VIEW_PD, pdef);
            
            request.setAttribute("tabs", paTabMap.values());
            request.setAttribute("portlet_tabs", pdTabMap.values());
            
            TabBean selectedTab = (TabBean) request.getPortletSession().getAttribute(PortletApplicationResources.REQUEST_SELECT_TAB, PortletSession.APPLICATION_SCOPE);
            if(selectedTab == null)
            {
                selectedTab = (TabBean) paTabMap.values().iterator().next();
            }
            
            //this supports tabs for portlets
            if(selectedTab.getId().equals("pa_portlets"))
            {
                TabBean selectedPortletTab = (TabBean) request.getPortletSession().getAttribute("selected_portlet_tab");
                if(selectedPortletTab == null)
                {
                    selectedPortletTab = (TabBean) pdTabMap.values().iterator().next();
                }
                request.setAttribute("selected_portlet_tab", selectedPortletTab);
            }
            
            request.setAttribute(PortletApplicationResources.REQUEST_SELECT_TAB, selectedTab);
            
        }
           super.doView(request, response);
       }
  -    
    public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException
	{
        //System.out.println("PorletApplicationDetail: processAction()");
        MutablePortletApplication pa = (MutablePortletApplication)
    	actionRequest.getPortletSession().getAttribute(PortletApplicationResources.PAM_CURRENT_PA, 
                                             PortletSession.APPLICATION_SCOPE);
        
        String selectedPortlet = actionRequest.getParameter(PortletApplicationResources.REQUEST_SELECT_PORTLET);
        if(selectedPortlet != null)
        {
	        PortletDefinition pdef = pa.getPortletDefinitionByName(selectedPortlet);
	        actionRequest.getPortletSession().setAttribute(PortletApplicationResources.REQUEST_SELECT_PORTLET, pdef, PortletSession.APPLICATION_SCOPE);
        }
        
        String selectedTab = actionRequest.getParameter(PortletApplicationResources.REQUEST_SELECT_TAB);
        if(selectedTab != null)
        {
            TabBean tab = (TabBean) paTabMap.get(selectedTab);
            actionRequest.getPortletSession().setAttribute(PortletApplicationResources.REQUEST_SELECT_TAB, tab, PortletSession.APPLICATION_SCOPE);
        }
        
        String selectedPortletTab = actionRequest.getParameter("selected_portlet_tab");
        if(selectedPortletTab != null)
        {
            TabBean tab = (TabBean) pdTabMap.get(selectedPortletTab);
            actionRequest.getPortletSession().setAttribute("selected_portlet_tab", tab);
        }
        
        String action = actionRequest.getParameter(PORTLET_ACTION);
        if(action != null)
        {
            
            if(isAppAction(action))
            {
                action = getAction(PORTLET_APP_ACTION_PREFIX, action);
                
                if(action.endsWith("metadata"))
                {
                    processMetadataAction(actionRequest, actionResponse, pa.getMetadata(), action);
                }
                else if(action.endsWith("user_attribute"))
                {
                    processUserAttributeAction(actionRequest, actionResponse, pa, action);
                }
            }
            else if(isPortletAction(action))
            {
                action = getAction(PORTLET_ACTION_PREFIX, action);
                PortletDefinitionComposite pdef = (PortletDefinitionComposite) actionRequest.getPortletSession().getAttribute(PortletApplicationResources.REQUEST_SELECT_PORTLET, PortletSession.APPLICATION_SCOPE);
                
                if(action.endsWith("metadata"))
                {
                    processMetadataAction(actionRequest, actionResponse, pdef.getMetadata(), action);
                }
                else if(action.endsWith("portlet"))
                {
                    processPortletAction(actionRequest, actionResponse, pa, pdef, action);
                }
                else if(action.endsWith("preference"))
                {
                    processPreferenceAction(actionRequest, actionResponse, pa, pdef, action);
                }
                else if(action.endsWith("language"))
                {
                    processLanguage(actionRequest, actionResponse, pa, pdef, action);
                }
                else if(action.endsWith("parameter"))
                {
                    processParameter(actionRequest, actionResponse, pa, pdef, action);
                }
                else if(action.endsWith("security"))
                {
                    processSecurity(actionRequest, actionResponse, pa, pdef, action);
                }
            }
        }
	}

    private boolean isAppAction(String action)
    {
        return action.startsWith(PORTLET_APP_ACTION_PREFIX);
    }
    
    private boolean isPortletAction(String action)
    {
        return action.startsWith(PORTLET_ACTION_PREFIX);
    }
    
    private String getAction(String prefix, String action)
    {
        return action.substring(prefix.length());
    }
    
    /**
     * @param actionRequest
     * @param actionResponse
     * @param pa
     * @param action
     */
    private void processUserAttributeAction(ActionRequest actionRequest, ActionResponse actionResponse, MutablePortletApplication pa, String action) throws PortletException, IOException
    {
        if(action.equals("edit_user_attribute"))
        {
            registry.getPersistenceStore().getTransaction().begin();
            
            Iterator userAttrIter = pa.getUserAttributes().iterator();
            while (userAttrIter.hasNext())
            {
                UserAttribute userAttr = (UserAttribute) userAttrIter.next();
                
                String userAttrName = userAttr.getName();
                String description = actionRequest.getParameter(userAttrName + ":description");
                if(!userAttr.getDescription().equals(description))
                {
                    userAttr.setDescription(description);
                }
            }
            
            registry.getPersistenceStore().getTransaction().commit();
        }
        else if(action.equals("add_user_attribute"))
        {
            String userAttrName = actionRequest.getParameter("user_attr_name");
            String userAttrDesc = actionRequest.getParameter("user_attr_desc");
            if(userAttrName != null)
            {
                registry.getPersistenceStore().getTransaction().begin();
            
                //TODO: should this come from a factory??
                UserAttribute userAttribute = new UserAttributeImpl();
                userAttribute.setName(userAttrName);
                userAttribute.setDescription(userAttrDesc);
                pa.addUserAttribute(userAttribute);
	            
	            registry.getPersistenceStore().getTransaction().commit();
            }
        }
        else if(action.equals("remove_user_attribute"))
        {
            String[] userAttrNames = actionRequest.getParameterValues("user_attr_id");

            if(userAttrNames != null)
            {
                registry.getPersistenceStore().getTransaction().begin();
                                
	            Iterator userAttrIter = pa.getUserAttributes().iterator();
	            while (userAttrIter.hasNext())
	            {
	                UserAttribute userAttr = (UserAttribute) userAttrIter.next();
	                for(int i=0; i<userAttrNames.length; i++)
	                {
	                    String userAttrName = userAttrNames[i];
	                    if(userAttr.getName().equals(userAttrName))
	                    {
	                        userAttrIter.remove();
	                        break;
	                    }
	                }
	            }
	            
	            registry.getPersistenceStore().getTransaction().commit();
                
            }
        }
    }

    /**
     * @param actionRequest
     * @param actionResponse
     * @param pa
     * @param action
     * @throws PortletException
     * @throws IOException
     */
    private void processMetadataAction(ActionRequest actionRequest, ActionResponse actionResponse, GenericMetadata md, String action) throws PortletException, IOException
    {
        if(action.equals("edit_metadata"))
        {
            Iterator fieldsIter = md.getFields().iterator();
            
            registry.getPersistenceStore().getTransaction().begin();
            
            while (fieldsIter.hasNext())
            {
                LocalizedField field = (LocalizedField) fieldsIter.next();
                String id = field.getId().toString();
                String value = actionRequest.getParameter(id + ":value");
                if(value != null)
                {
                    if(!value.equals(field.getValue()))
                    {
                        field.setValue(value);
                    }
                }
            }
            
            registry.getPersistenceStore().getTransaction().commit();
        }
        else if(action.equals("remove_metadata"))
        {
            Iterator fieldsIter = md.getFields().iterator();
            String[] ids = actionRequest.getParameterValues("metadata_id");
            
            if(ids != null)
            {
	            registry.getPersistenceStore().getTransaction().begin();
	            while (fieldsIter.hasNext())
	            {
	                LocalizedField field = (LocalizedField) fieldsIter.next();
	                String id = field.getId().toString();

                    for(int i=0; i<ids.length; i++)
                    {
                        String mid = ids[i];
                        if(mid.equals(id))
                        {
                            fieldsIter.remove();
                            break;
                        }
                    }
                }
            }
            registry.getPersistenceStore().getTransaction().commit();
        }
        else if(action.equals("add_metadata"))
        {
            PersistenceStore store = registry.getPersistenceStore();
            System.out.println("Transcation is open: " + store.getTransaction().isOpen());
            store.getTransaction().begin();
            System.out.println("Transcation is open: " + store.getTransaction().isOpen());
            String name = actionRequest.getParameter("name");
            String value = actionRequest.getParameter("value");
            String localeParam = actionRequest.getParameter("locale");
            if(localeParam == null)
            {
                localeParam = "en"; //need to default better
            }
            Locale locale = new Locale(localeParam);
            
            md.addField(locale, name, value);
            
            store.getTransaction().commit();
        }
    }
    
    private void processPortletAction(ActionRequest actionRequest, ActionResponse actionResponse, MutablePortletApplication pa, PortletDefinitionComposite portlet, String action) throws PortletException, IOException
    {
        if(action.equals("edit_portlet"))
        {

        }
        else if(action.equals("remove_portlet"))
        {
            //TODO should this be allowed??
        }
        else if(action.equals("add_portlet"))
        {
            //TODO should this be allowed??
        }
    }
    
    /**
     * @param actionRequest
     * @param actionResponse
     * @param pa
     * @param pdef
     * @param action
     */
    private void processPreferenceAction(ActionRequest actionRequest, ActionResponse actionResponse, MutablePortletApplication pa, PortletDefinitionComposite portlet, String action)
    {
        if(action.equals("add_preference"))
        {
            registry.getPersistenceStore().getTransaction().begin();
            
            String name = actionRequest.getParameter("name");
            String value = actionRequest.getParameter("value");
            
            PreferenceComposite pref = (PreferenceComposite) portlet.getPreferenceSet().get(name);
            if(pref == null)
            {
                portlet.addPreference(name, new String[] { value });
            }
            else
            {
                pref.addValue(value);
            }
            
            registry.getPersistenceStore().getTransaction().commit();
        }
        else if(action.equals("edit_preference"))
        {
            registry.getPersistenceStore().getTransaction().begin();
            
            String[] prefNames = actionRequest.getParameterValues("pref_edit_id");
            for (int i = 0; i < prefNames.length; i++)
            {
                String prefName = prefNames[i];
                PreferenceComposite prefComp = (PreferenceComposite) portlet.getPreferenceSet().get(prefName);
                String[] values = prefComp.getValueArray();
                for (int j = 0; j < values.length; j++)
                {
                    String value = values[j];
                    String newValue = actionRequest.getParameter(prefName + ":" + j);
                    if(!value.equals(newValue))
                    {
                        prefComp.setValueAt(j, newValue);
                    }
                }
            }
            
            registry.getPersistenceStore().getTransaction().commit();
        }
        else if(action.equals("remove_preference"))
        {
            registry.getPersistenceStore().getTransaction().begin();
            
            String[] prefNames = actionRequest.getParameterValues("pref_remove_id");
            
            Iterator prefIter = portlet.getPreferenceSet().iterator();
            while (prefIter.hasNext())
            {
                PreferenceComposite pref = (PreferenceComposite) prefIter.next();
                String name = pref.getName();
                
                for(int i=0; i<prefNames.length; i++)
                {
                    String prefName = prefNames[i];
                    if(name.equals(prefName))
                    {
                        prefIter.remove();
                        break;
                    }
                }
            }
            
            registry.getPersistenceStore().getTransaction().commit();
        }
    }
    
    /**
     * @param actionRequest
     * @param actionResponse
     * @param pa
     * @param pdef
     * @param action
     */
    private void processLanguage(ActionRequest actionRequest, ActionResponse actionResponse, MutablePortletApplication pa, PortletDefinitionComposite portlet, String action)
    {
         if(action.equals("add_language"))
         {
             registry.getPersistenceStore().getTransaction().begin();

             String title = actionRequest.getParameter("title");
             String shortTitle = actionRequest.getParameter("short_title");
             String keywords = actionRequest.getParameter("keyword");
             String locale = actionRequest.getParameter("locale");

             LanguageImpl language = new LanguageImpl();
             language.setTitle(title);
             language.setShortTitle(shortTitle);
             language.setKeywords(keywords);
             language.setLocale(new Locale(locale));
             portlet.addLanguage(language);

             registry.getPersistenceStore().getTransaction().commit();
         }
         else if(action.equals("remove_language"))
         {
             String[] removeIds = actionRequest.getParameterValues("language_remove_id");

             if(removeIds != null)
             {
                 registry.getPersistenceStore().getTransaction().begin();

                 int id = 0;
                 Iterator langIter = portlet.getLanguageSet().iterator();
                 while (langIter.hasNext())
                 {
                     langIter.next();

                     int currentId = id++;
                     for(int i=0; i<removeIds.length; i++)
                     {
                         String removeId = removeIds[i];
                         String tempId = "" + currentId;
                         if(removeId.equals(tempId))
                         {
                             langIter.remove();
                             break;
                         }
                     }
                 }

                 registry.getPersistenceStore().getTransaction().commit();
	         }
         }
         else if(action.equals("edit_language"))
         {
             String[] editIds = actionRequest.getParameterValues("language_edit_id");

             if(editIds != null)
             {
                 registry.getPersistenceStore().getTransaction().begin();

                 //technically, the size and set of edit ids should be 
                 //equal to the size and set of the language set

                 int id = 0;
                 Iterator langIter = portlet.getLanguageSet().iterator();
                 while (langIter.hasNext())
                 {
                     String title = actionRequest.getParameter("title:" + id);
                     String shortTitle = actionRequest.getParameter("short_title:" + id);

                     //must cast to interface to avoid class loader issues
                     MutableLanguage lang = (MutableLanguage) langIter.next();

                     if(!lang.getTitle().equals(title))
                     {
                         lang.setTitle(title);
                     }

                     //TODO:  is there a better way to do this?
                     //setting the keywords like this will cause all the old keywords
                     //to be delted from the db and re-inserted
                     
                     Iterator keywordIter = lang.getKeywords();
                     int keywordIndex = 0;
                     ArrayList keywordList = new ArrayList();
                     
                     while (keywordIter.hasNext())
                     {
                         String keyword = (String) keywordIter.next();
                         String keywordParam = actionRequest.getParameter("keyword:" + id + ":" + keywordIndex);

                         if(keywordParam != null && keywordParam.length() > 0)
                         {
                             keywordList.add(keywordParam);
                         }

                         keywordIndex++;
                     }

                     lang.setKeywords(keywordList);
                     
                     if(!lang.getShortTitle().equals(shortTitle))
                     {
                         lang.setShortTitle(shortTitle);
                     }

                     registry.getPersistenceStore().getTransaction().commit();
                 }
             }
         }
    }
    
    /**
     * @param actionRequest
     * @param actionResponse
     * @param pa
     * @param pdef
     * @param action
     */
    private void processParameter(ActionRequest actionRequest, ActionResponse actionResponse, MutablePortletApplication pa, PortletDefinitionComposite portlet, String action)
    {
        if(action.equals("add_parameter"))
        {
            registry.getPersistenceStore().getTransaction().begin();
            
            String name = actionRequest.getParameter("name");
            String value = actionRequest.getParameter("value");
            String description = actionRequest.getParameter("description");
            String locale = actionRequest.getParameter("locale");
            
            portlet.addInitParameter(name, value, description, new Locale(locale));
            
            registry.getPersistenceStore().getTransaction().commit();
        }
        else if(action.equals("edit_parameter"))
        {
            registry.getPersistenceStore().getTransaction().begin();
            
            String[] paramIds = actionRequest.getParameterValues("parameter_edit_id");
            
            if(paramIds != null)
            {
                for(int i=0; i<paramIds.length; i++)
                {
                    String paramId = paramIds[i];
                    ParameterComposite param = (ParameterComposite) portlet.getInitParameterSet().get(paramId);
                    
                    String value = actionRequest.getParameter(paramId + ":value");
                    //String description[] = actionRequest.getParameterValues(paramId + ":description");
                    
                    
                    param.setValue(value);
                }
            }
            
            registry.getPersistenceStore().getTransaction().commit();
        }
        else if(action.equals("remove_parameter"))
        {
            registry.getPersistenceStore().getTransaction().begin();
            
            String[] paramIds = actionRequest.getParameterValues("parameter_remove_id");
            
            if(paramIds != null)
            {
	            Iterator paramIter = portlet.getInitParameterSet().iterator();
	            while (paramIter.hasNext())
	            {
	                ParameterComposite param = (ParameterComposite) paramIter.next();
	                
	                for(int i=0; i<paramIds.length; i++)
	                {
	                    String paramId = paramIds[i];
	                    if(param.getName().equals(paramId))
	                    {
	                        paramIter.remove();
	                        break;
	                    }
	                }
	            }
            }
            
            registry.getPersistenceStore().getTransaction().commit();
        }
    }
    
    /**
     * @param actionRequest
     * @param actionResponse
     * @param pa
     * @param pdef
     * @param action
     */
    private void processSecurity(ActionRequest actionRequest, ActionResponse actionResponse, MutablePortletApplication pa, PortletDefinitionComposite portlet, String action)
    {
        if(action.equals("add_security"))
        {
            String name = actionRequest.getParameter("name");
            String link = actionRequest.getParameter("link");
            
            if(name != null && link != null)
            {
	            registry.getPersistenceStore().getTransaction().begin();
	            
	            SecurityRoleRefImpl securityRoleRef = new SecurityRoleRefImpl();
	            securityRoleRef.setRoleName(name);
	            securityRoleRef.setRoleLink(link);
	            //securityRoleRef.addDescription(description);
	            portlet.addSecurityRoleRef(securityRoleRef);
	            
	            registry.getPersistenceStore().getTransaction().commit();
            }
        }
        else if(action.equals("edit_security"))
        {
            registry.getPersistenceStore().getTransaction().begin();
            
            Iterator securityIter = portlet.getInitSecurityRoleRefSet().iterator();
            while (securityIter.hasNext())
            {
                SecurityRoleRefComposite secRef = (SecurityRoleRefComposite) securityIter.next();
                String name = secRef.getRoleName();
                
                //TODO:  should this be editable
                String newName = actionRequest.getParameter(name + ":name");
                String link = actionRequest.getParameter(name + ":link");
                
                if(!secRef.getRoleLink().equals(link))
                {
                    secRef.setRoleLink(link);
                }
            }
            
            
            registry.getPersistenceStore().getTransaction().commit();
        }
        else if(action.equals("remove_security"))
        {
            registry.getPersistenceStore().getTransaction().begin();
            
            String[] securityIds = actionRequest.getParameterValues("security_remove_id");
            if(securityIds != null)
            {
                Iterator securityIter = portlet.getInitSecurityRoleRefSet().iterator();
                while (securityIter.hasNext())
                {
                    SecurityRoleRefComposite secRef = (SecurityRoleRefComposite) securityIter.next();
                    for(int i=0; i<securityIds.length; i++)
                    {
                        String id = securityIds[i];
                        if(secRef.getRoleName().equals(id))
                        {
                            securityIter.remove();
                            break;
                        }
                    }
                }
            }
            
            registry.getPersistenceStore().getTransaction().commit();
        }
    }
  +    
    public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException
	{
        //System.out.println("PorletApplicationDetail: processAction()");
        MutablePortletApplication pa = (MutablePortletApplication)
    	actionRequest.getPortletSession().getAttribute(PortletApplicationResources.PAM_CURRENT_PA, 
                                             PortletSession.APPLICATION_SCOPE);
        
        String selectedPortlet = actionRequest.getParameter(PortletApplicationResources.REQUEST_SELECT_PORTLET);
        if(selectedPortlet != null)
        {
	        PortletDefinition pdef = pa.getPortletDefinitionByName(selectedPortlet);
	        actionRequest.getPortletSession().setAttribute(PortletApplicationResources.REQUEST_SELECT_PORTLET, pdef, PortletSession.APPLICATION_SCOPE);
        }
        
        String selectedTab = actionRequest.getParameter(PortletApplicationResources.REQUEST_SELECT_TAB);
        if(selectedTab != null)
        {
            TabBean tab = (TabBean) paTabMap.get(selectedTab);
            actionRequest.getPortletSession().setAttribute(PortletApplicationResources.REQUEST_SELECT_TAB, tab, PortletSession.APPLICATION_SCOPE);
        }
        
        String selectedPortletTab = actionRequest.getParameter("selected_portlet_tab");
        if(selectedPortletTab != null)
        {
            TabBean tab = (TabBean) pdTabMap.get(selectedPortletTab);
            actionRequest.getPortletSession().setAttribute("selected_portlet_tab", tab);
        }
        
        String action = actionRequest.getParameter(PORTLET_ACTION);
        if(action != null)
        {
            
            if(isAppAction(action))
            {
                action = getAction(PORTLET_APP_ACTION_PREFIX, action);
                
                if(action.endsWith("metadata"))
                {
                    processMetadataAction(actionRequest, actionResponse, pa.getMetadata(), action);
                }
                else if(action.endsWith("user_attribute"))
                {
                    processUserAttributeAction(actionRequest, actionResponse, pa, action);
                }
            }
            else if(isPortletAction(action))
            {
                action = getAction(PORTLET_ACTION_PREFIX, action);
                PortletDefinitionComposite pdef = (PortletDefinitionComposite) actionRequest.getPortletSession().getAttribute(PortletApplicationResources.REQUEST_SELECT_PORTLET, PortletSession.APPLICATION_SCOPE);
                
                if(action.endsWith("metadata"))
                {
                    processMetadataAction(actionRequest, actionResponse, pdef.getMetadata(), action);
                }
                else if(action.endsWith("portlet"))
                {
                    processPortletAction(actionRequest, actionResponse, pa, pdef, action);
                }
                else if(action.endsWith("preference"))
                {
                    processPreferenceAction(actionRequest, actionResponse, pa, pdef, action);
                }
                else if(action.endsWith("language"))
                {
                    processLanguage(actionRequest, actionResponse, pa, pdef, action);
                }
                else if(action.endsWith("parameter"))
                {
                    processParameter(actionRequest, actionResponse, pa, pdef, action);
                }
                else if(action.endsWith("security"))
                {
                    processSecurity(actionRequest, actionResponse, pa, pdef, action);
                }
                else if(action.endsWith("content_type"))
                {
                    processContentType(actionRequest, actionResponse, pa, pdef, action);
                }
            }
        }
	}

    private boolean isAppAction(String action)
    {
        return action.startsWith(PORTLET_APP_ACTION_PREFIX);
    }
    
    private boolean isPortletAction(String action)
    {
        return action.startsWith(PORTLET_ACTION_PREFIX);
    }
    
    private String getAction(String prefix, String action)
    {
        return action.substring(prefix.length());
    }
    
    /**
     * @param actionRequest
     * @param actionResponse
     * @param pa
     * @param action
     */
    private void processUserAttributeAction(ActionRequest actionRequest, ActionResponse actionResponse, MutablePortletApplication pa, String action) throws PortletException, IOException
    {
        if(action.equals("edit_user_attribute"))
        {
            registry.getPersistenceStore().getTransaction().begin();
            
            Iterator userAttrIter = pa.getUserAttributes().iterator();
            while (userAttrIter.hasNext())
            {
                UserAttribute userAttr = (UserAttribute) userAttrIter.next();
                
                String userAttrName = userAttr.getName();
                String description = actionRequest.getParameter(userAttrName + ":description");
                if(!userAttr.getDescription().equals(description))
                {
                    userAttr.setDescription(description);
                }
            }
            
            registry.getPersistenceStore().getTransaction().commit();
        }
        else if(action.equals("add_user_attribute"))
        {
            String userAttrName = actionRequest.getParameter("user_attr_name");
            String userAttrDesc = actionRequest.getParameter("user_attr_desc");
            if(userAttrName != null)
            {
                registry.getPersistenceStore().getTransaction().begin();
            
                //TODO: should this come from a factory??
                UserAttribute userAttribute = new UserAttributeImpl();
                userAttribute.setName(userAttrName);
                userAttribute.setDescription(userAttrDesc);
                pa.addUserAttribute(userAttribute);
	            
	            registry.getPersistenceStore().getTransaction().commit();
            }
        }
        else if(action.equals("remove_user_attribute"))
        {
            String[] userAttrNames = actionRequest.getParameterValues("user_attr_id");

            if(userAttrNames != null)
            {
                registry.getPersistenceStore().getTransaction().begin();
                                
	            Iterator userAttrIter = pa.getUserAttributes().iterator();
	            while (userAttrIter.hasNext())
	            {
	                UserAttribute userAttr = (UserAttribute) userAttrIter.next();
	                for(int i=0; i<userAttrNames.length; i++)
	                {
	                    String userAttrName = userAttrNames[i];
	                    if(userAttr.getName().equals(userAttrName))
	                    {
	                        userAttrIter.remove();
	                        break;
	                    }
	                }
	            }
	            
	            registry.getPersistenceStore().getTransaction().commit();
                
            }
        }
    }

    /**
     * @param actionRequest
     * @param actionResponse
     * @param pa
     * @param action
     * @throws PortletException
     * @throws IOException
     */
    private void processMetadataAction(ActionRequest actionRequest, ActionResponse actionResponse, GenericMetadata md, String action) throws PortletException, IOException
    {
        if(action.equals("edit_metadata"))
        {
            Iterator fieldsIter = md.getFields().iterator();
            
            registry.getPersistenceStore().getTransaction().begin();
            
            while (fieldsIter.hasNext())
            {
                LocalizedField field = (LocalizedField) fieldsIter.next();
                String id = field.getId().toString();
                String value = actionRequest.getParameter(id + ":value");
                if(value != null)
                {
                    if(!value.equals(field.getValue()))
                    {
                        field.setValue(value);
                    }
                }
            }
            
            registry.getPersistenceStore().getTransaction().commit();
        }
        else if(action.equals("remove_metadata"))
        {
            Iterator fieldsIter = md.getFields().iterator();
            String[] ids = actionRequest.getParameterValues("metadata_id");
            
            if(ids != null)
            {
	            registry.getPersistenceStore().getTransaction().begin();
	            while (fieldsIter.hasNext())
	            {
	                LocalizedField field = (LocalizedField) fieldsIter.next();
	                String id = field.getId().toString();

                    for(int i=0; i<ids.length; i++)
                    {
                        String mid = ids[i];
                        if(mid.equals(id))
                        {
                            fieldsIter.remove();
                            break;
                        }
                    }
                }
            }
            registry.getPersistenceStore().getTransaction().commit();
        }
        else if(action.equals("add_metadata"))
        {
            PersistenceStore store = registry.getPersistenceStore();
            System.out.println("Transcation is open: " + store.getTransaction().isOpen());
            store.getTransaction().begin();
            System.out.println("Transcation is open: " + store.getTransaction().isOpen());
            String name = actionRequest.getParameter("name");
            String value = actionRequest.getParameter("value");
            String localeParam = actionRequest.getParameter("locale");
            if(localeParam == null)
            {
                localeParam = "en"; //need to default better
            }
            Locale locale = new Locale(localeParam);
            
            md.addField(locale, name, value);
            
            store.getTransaction().commit();
        }
    }
    
    private void processPortletAction(ActionRequest actionRequest, ActionResponse actionResponse, MutablePortletApplication pa, PortletDefinitionComposite portlet, String action) throws PortletException, IOException
    {
        if(action.equals("edit_portlet"))
        {

        }
        else if(action.equals("remove_portlet"))
        {
            //TODO should this be allowed??
        }
        else if(action.equals("add_portlet"))
        {
            //TODO should this be allowed??
        }
    }
    
    /**
     * @param actionRequest
     * @param actionResponse
     * @param pa
     * @param pdef
     * @param action
     */
    private void processPreferenceAction(ActionRequest actionRequest, ActionResponse actionResponse, MutablePortletApplication pa, PortletDefinitionComposite portlet, String action)
    {
        if(action.equals("add_preference"))
        {
            registry.getPersistenceStore().getTransaction().begin();
            
            String name = actionRequest.getParameter("name");
            String value = actionRequest.getParameter("value");
            
            PreferenceComposite pref = (PreferenceComposite) portlet.getPreferenceSet().get(name);
            if(pref == null)
            {
                portlet.addPreference(name, new String[] { value });
            }
            else
            {
                pref.addValue(value);
            }
            
            registry.getPersistenceStore().getTransaction().commit();
        }
        else if(action.equals("edit_preference"))
        {
            registry.getPersistenceStore().getTransaction().begin();
            
            String[] prefNames = actionRequest.getParameterValues("pref_edit_id");
            for (int i = 0; i < prefNames.length; i++)
            {
                String prefName = prefNames[i];
                PreferenceComposite prefComp = (PreferenceComposite) portlet.getPreferenceSet().get(prefName);
                String[] values = prefComp.getValueArray();
                for (int j = 0; j < values.length; j++)
                {
                    String value = values[j];
                    String newValue = actionRequest.getParameter(prefName + ":" + j);
                    if(!value.equals(newValue))
                    {
                        prefComp.setValueAt(j, newValue);
                    }
                }
            }
            
            registry.getPersistenceStore().getTransaction().commit();
        }
        else if(action.equals("remove_preference"))
        {
            registry.getPersistenceStore().getTransaction().begin();
            
            String[] prefNames = actionRequest.getParameterValues("pref_remove_id");
            
            Iterator prefIter = portlet.getPreferenceSet().iterator();
            while (prefIter.hasNext())
            {
                PreferenceComposite pref = (PreferenceComposite) prefIter.next();
                String name = pref.getName();
                
                for(int i=0; i<prefNames.length; i++)
                {
                    String prefName = prefNames[i];
                    if(name.equals(prefName))
                    {
                        prefIter.remove();
                        break;
                    }
                }
            }
            
            registry.getPersistenceStore().getTransaction().commit();
        }
    }
    
    /**
     * @param actionRequest
     * @param actionResponse
     * @param pa
     * @param pdef
     * @param action
     */
    private void processLanguage(ActionRequest actionRequest, ActionResponse actionResponse, MutablePortletApplication pa, PortletDefinitionComposite portlet, String action)
    {
         if(action.equals("add_language"))
         {
             registry.getPersistenceStore().getTransaction().begin();

             String title = actionRequest.getParameter("title");
             String shortTitle = actionRequest.getParameter("short_title");
             String keywords = actionRequest.getParameter("keyword");
             String locale = actionRequest.getParameter("locale");

             LanguageImpl language = new LanguageImpl();
             language.setTitle(title);
             language.setShortTitle(shortTitle);
             language.setKeywords(keywords);
             language.setLocale(new Locale(locale));
             portlet.addLanguage(language);

             registry.getPersistenceStore().getTransaction().commit();
         }
         else if(action.equals("remove_language"))
         {
             String[] removeIds = actionRequest.getParameterValues("language_remove_id");

             if(removeIds != null)
             {
                 registry.getPersistenceStore().getTransaction().begin();

                 int id = 0;
                 Iterator langIter = portlet.getLanguageSet().iterator();
                 while (langIter.hasNext())
                 {
                     langIter.next();

                     int currentId = id++;
                     for(int i=0; i<removeIds.length; i++)
                     {
                         String removeId = removeIds[i];
                         String tempId = "" + currentId;
                         if(removeId.equals(tempId))
                         {
                             langIter.remove();
                             break;
                         }
                     }
                 }

                 registry.getPersistenceStore().getTransaction().commit();
	         }
         }
         else if(action.equals("edit_language"))
         {
             String[] editIds = actionRequest.getParameterValues("language_edit_id");

             if(editIds != null)
             {
                 registry.getPersistenceStore().getTransaction().begin();

                 //technically, the size and set of edit ids should be 
                 //equal to the size and set of the language set

                 int id = 0;
                 Iterator langIter = portlet.getLanguageSet().iterator();
                 while (langIter.hasNext())
                 {
                     String title = actionRequest.getParameter("title:" + id);
                     String shortTitle = actionRequest.getParameter("short_title:" + id);

                     //must cast to interface to avoid class loader issues
                     MutableLanguage lang = (MutableLanguage) langIter.next();

                     if(!lang.getTitle().equals(title))
                     {
                         lang.setTitle(title);
                     }

                     //TODO:  is there a better way to do this?
                     //setting the keywords like this will cause all the old keywords
                     //to be delted from the db and re-inserted
                     
                     Iterator keywordIter = lang.getKeywords();
                     int keywordIndex = 0;
                     ArrayList keywordList = new ArrayList();
                     
                     while (keywordIter.hasNext())
                     {
                         String keyword = (String) keywordIter.next();
                         String keywordParam = actionRequest.getParameter("keyword:" + id + ":" + keywordIndex);

                         if(keywordParam != null && keywordParam.length() > 0)
                         {
                             keywordList.add(keywordParam);
                         }

                         keywordIndex++;
                     }

                     lang.setKeywords(keywordList);
                     
                     if(!lang.getShortTitle().equals(shortTitle))
                     {
                         lang.setShortTitle(shortTitle);
                     }

                     registry.getPersistenceStore().getTransaction().commit();
                 }
             }
         }
    }
    
    /**
     * @param actionRequest
     * @param actionResponse
     * @param pa
     * @param pdef
     * @param action
     */
    private void processParameter(ActionRequest actionRequest, ActionResponse actionResponse, MutablePortletApplication pa, PortletDefinitionComposite portlet, String action)
    {
        if(action.equals("add_parameter"))
        {
            registry.getPersistenceStore().getTransaction().begin();
            
            String name = actionRequest.getParameter("name");
            String value = actionRequest.getParameter("value");
            String description = actionRequest.getParameter("description");
            String locale = actionRequest.getParameter("locale");
            
            portlet.addInitParameter(name, value, description, new Locale(locale));
            
            registry.getPersistenceStore().getTransaction().commit();
        }
        else if(action.equals("edit_parameter"))
        {
            registry.getPersistenceStore().getTransaction().begin();
            
            String[] paramIds = actionRequest.getParameterValues("parameter_edit_id");
            
            if(paramIds != null)
            {
                for(int i=0; i<paramIds.length; i++)
                {
                    String paramId = paramIds[i];
                    ParameterComposite param = (ParameterComposite) portlet.getInitParameterSet().get(paramId);
                    
                    String value = actionRequest.getParameter(paramId + ":value");
                    //String description[] = actionRequest.getParameterValues(paramId + ":description");
                    
                    
                    param.setValue(value);
                }
            }
            
            registry.getPersistenceStore().getTransaction().commit();
        }
        else if(action.equals("remove_parameter"))
        {
            registry.getPersistenceStore().getTransaction().begin();
            
            String[] paramIds = actionRequest.getParameterValues("parameter_remove_id");
            
            if(paramIds != null)
            {
	            Iterator paramIter = portlet.getInitParameterSet().iterator();
	            while (paramIter.hasNext())
	            {
	                ParameterComposite param = (ParameterComposite) paramIter.next();
	                
	                for(int i=0; i<paramIds.length; i++)
	                {
	                    String paramId = paramIds[i];
	                    if(param.getName().equals(paramId))
	                    {
	                        paramIter.remove();
	                        break;
	                    }
	                }
	            }
            }
            
            registry.getPersistenceStore().getTransaction().commit();
        }
    }
    
    /**
     * @param actionRequest
     * @param actionResponse
     * @param pa
     * @param pdef
     * @param action
     */
    private void processSecurity(ActionRequest actionRequest, ActionResponse actionResponse, MutablePortletApplication pa, PortletDefinitionComposite portlet, String action)
    {
        if(action.equals("add_security"))
        {
            String name = actionRequest.getParameter("name");
            String link = actionRequest.getParameter("link");
            
            if(name != null && link != null)
            {
	            registry.getPersistenceStore().getTransaction().begin();
	            
	            SecurityRoleRefImpl securityRoleRef = new SecurityRoleRefImpl();
	            securityRoleRef.setRoleName(name);
	            securityRoleRef.setRoleLink(link);
	            //securityRoleRef.addDescription(description);
	            portlet.addSecurityRoleRef(securityRoleRef);
	            
	            registry.getPersistenceStore().getTransaction().commit();
            }
        }
        else if(action.equals("edit_security"))
        {
            registry.getPersistenceStore().getTransaction().begin();
            
            Iterator securityIter = portlet.getInitSecurityRoleRefSet().iterator();
            while (securityIter.hasNext())
            {
                SecurityRoleRefComposite secRef = (SecurityRoleRefComposite) securityIter.next();
                String name = secRef.getRoleName();
                
                //TODO:  should this be editable
                String newName = actionRequest.getParameter(name + ":name");
                String link = actionRequest.getParameter(name + ":link");
                
                if(!secRef.getRoleLink().equals(link))
                {
                    secRef.setRoleLink(link);
                }
            }
            
            
            registry.getPersistenceStore().getTransaction().commit();
        }
        else if(action.equals("remove_security"))
        {
            registry.getPersistenceStore().getTransaction().begin();
            
            String[] securityIds = actionRequest.getParameterValues("security_remove_id");
            if(securityIds != null)
            {
                for(int i=0; i<securityIds.length; i++)
                {
                    String id = securityIds[i];
                    SecurityRoleRef secRef = portlet.getInitSecurityRoleRefSet().get(id);
                    portlet.getInitSecurityRoleRefSet().remove(secRef);
                }
                /*
                Iterator securityIter = portlet.getInitSecurityRoleRefSet()..iterator();
                while (securityIter.hasNext())
                {
                    SecurityRoleRefComposite secRef = (SecurityRoleRefComposite) securityIter.next();
                    for(int i=0; i<securityIds.length; i++)
                    {
                        String id = securityIds[i];
                        if(secRef.getRoleName().equals(id))
                        {
                            securityIter.remove();
                            break;
                        }
                    }
                }
                */
            }
            
            registry.getPersistenceStore().getTransaction().commit();
        }
    }
    
    /**
     * @param actionRequest
     * @param actionResponse
     * @param pa
     * @param pdef
     * @param action
     */
    private void processContentType(ActionRequest actionRequest, ActionResponse actionResponse, MutablePortletApplication pa, PortletDefinitionComposite portlet, String action)
    {
        if(action.equals("add_content_type"))
        {
            String contentType = actionRequest.getParameter("content_type");
            if(contentType != null)
            {
	            registry.getPersistenceStore().getTransaction().begin();
	            
	            ContentTypeImpl contentTypeImpl = new ContentTypeImpl();
	            contentTypeImpl.setContentType(contentType);
	            
	            String[] modes = actionRequest.getParameterValues("mode");
	            if(modes != null)
	            {
	                for(int i=0; i<modes.length; i++)
	                {
	                    String mode = modes[i];
	                    contentTypeImpl.addPortletMode(mode);
	                }
	            }
	            
	            
	            String customModes = actionRequest.getParameter("custom_modes");
	            StringTokenizer tok = new StringTokenizer(customModes, ",");
	            while (tok.hasMoreTokens())
	            {
	                contentTypeImpl.addPortletMode(tok.nextToken());
	            }
	            
	            portlet.addContentType(contentTypeImpl);
	            
	            registry.getPersistenceStore().getTransaction().commit();
            }
        }
        else if(action.equals("edit_content_type"))
        {
            registry.getPersistenceStore().getTransaction().begin();
            registry.getPersistenceStore().getTransaction().commit();
        }
        else if(action.equals("remove_content_type"))
        {
            String[] contentIds = actionRequest.getParameterValues("content_type_remove_id");
            if(contentIds != null)
            {
                registry.getPersistenceStore().getTransaction().begin();
                
                Iterator contentIter = portlet.getContentTypeSet().iterator();
                while (contentIter.hasNext())
                {
                    ContentType contentType = (ContentType) contentIter.next();
                    for(int i=0; i<contentIds.length; i++)
                    {
                        String id = contentIds[i];
	                    if(contentType.getContentType().equals(id))
	                    {
	                        contentIter.remove();
	                        break;
	                    }
                    }
                }
                
                registry.getPersistenceStore().getTransaction().commit();
            }
        }
    }
   }
  
  
  
  1.5       +17 -1     jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/resources/PAMResources_ja.properties
  
  Index: PAMResources_ja.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/resources/PAMResources_ja.properties,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PAMResources_ja.properties	14 Sep 2004 15:51:04 -0000	1.4
  +++ PAMResources_ja.properties	14 Sep 2004 18:09:58 -0000	1.5
  @@ -69,6 +69,22 @@
   
   pam.details.add_security=Add Security
   
  +##Content Type View
  +pam.details.content_type=Content Type
  +pam.details.content_type.description=MimeType like text/html.  Wildcards are allowed.
  +
  +pam.details.modes=Modes
  +pam.details.portlet_mode=Portlet Mode
  +pam.details.porltet_mode.view=View
  +pam.details.porltet_mode.edit=Edit
  +pam.details.porltet_mode.help=Help
  +pam.details.portlet_mode.description=Standard portlet modes that the portlet supports
  +
  +pam.details.custom_mode=Custom Modes
  +pam.details.custom_modes.description=Custom Modes that the portlet supports
  +
  +pam.details.add_content_type=Add Content Type
  +
   ##Portlet Application Tabs
   pam.details.tabs.pa_details=\u8A73\u7D30
   pam.details.tabs.pa_metadata=\u30E1\u30BF\u30C7\u30FC\u30BF
  
  
  
  1.7       +17 -1     jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/resources/PAMResources.properties
  
  Index: PAMResources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/resources/PAMResources.properties,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PAMResources.properties	14 Sep 2004 15:51:04 -0000	1.6
  +++ PAMResources.properties	14 Sep 2004 18:09:58 -0000	1.7
  @@ -69,6 +69,22 @@
   
   pam.details.add_security=Add Security
   
  +##Content Type View
  +pam.details.content_type=Content Type
  +pam.details.content_type.description=MimeType like text/html.  Wildcards are allowed.
  +
  +pam.details.modes=Modes
  +pam.details.portlet_mode=Portlet Mode
  +pam.details.porltet_mode.view=View
  +pam.details.porltet_mode.edit=Edit
  +pam.details.porltet_mode.help=Help
  +pam.details.portlet_mode.description=Standard portlet modes that the portlet supports
  +
  +pam.details.custom_mode=Custom Modes
  +pam.details.custom_modes.description=Custom Modes that the portlet supports
  +
  +pam.details.add_content_type=Add Content Type
  +
   ##Portlet Application Tabs
   pam.details.tabs.pa_details=Details
   pam.details.tabs.pa_metadata=MetaData
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message