Author: kwright
Date: Fri Oct 25 07:23:30 2013
New Revision: 1535650

URL: http://svn.apache.org/r1535650
Log:
Add edit page for auth groups.

Added:
    
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/editgroup.jsp
   (with props)
Modified:
    
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/execute.jsp
    
manifoldcf/branches/CONNECTORS-792/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties
    
manifoldcf/branches/CONNECTORS-792/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_ja_JP.properties

Added: 
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/editgroup.jsp
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/editgroup.jsp?rev=1535650&view=auto
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/editgroup.jsp
 (added)
+++ 
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/editgroup.jsp
 Fri Oct 25 07:23:30 2013
@@ -0,0 +1,300 @@
+<%@ include file="adminHeaders.jsp" %>
+<%
+
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You 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.
+*/
+
+    // The contract of this edit page is as follows.  It is either called 
directly, in which case it is expected to be creating
+    // a connection or beginning the process of editing an existing 
connection, or it is called via redirection from execute.jsp, in which case
+    // the connection object being edited will be placed in the thread context 
under the name "GroupObject".
+    try
+    {
+       // Get the group manager
+       IAuthorityGroupManager authGroupManager = 
AuthorityGroupManagerFactory.make(threadContext);
+       
+       // Figure out what the current tab name is.
+       String tabName = variableContext.getParameter("tabname");
+       if (tabName == null || tabName.length() == 0)
+               tabName = 
Messages.getString(pageContext.getRequest().getLocale(),"editgroup.Name");
+
+       String groupName = null;
+       IAuthorityGroup group = 
(IAuthorityGroup)threadContext.get("GroupObject");
+       if (group == null)
+       {
+               // We did not go through execute.jsp
+               // We might have received an argument specifying the connection 
name.
+               groupName = variableContext.getParameter("groupname");
+               // If the groupname is not null, load the connection 
description and prepopulate everything with what comes from it.
+               if (groupName != null && groupName.length() > 0)
+               {
+                       group = authGroupManager.load(groupName);
+               }
+       }
+
+       // Setup default fields
+       boolean isNew = true;
+       String description = "";
+       
+       if (group != null)
+       {
+               // Set up values
+               isNew = group.getIsNew();
+               groupName = group.getName();
+               description = group.getDescription();
+       }
+       else
+               groupName = null;
+
+       if (groupName == null)
+               groupName = "";
+
+       // Initialize tabs array
+       ArrayList tabsArray = new ArrayList();
+
+       // Set up the predefined tabs
+       
tabsArray.add(Messages.getString(pageContext.getRequest().getLocale(),"editgroup.Name"));
+%>
+
+<?xml version="1.0" encoding="utf-8"?>
+
+<html xmlns="http://www.w3.org/1999/xhtml";>
+<head>
+       <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+       <link rel="StyleSheet" href="style.css" type="text/css" media="screen"/>
+       <title>
+               
<%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editgroup.ApacheManifoldCFEditAuthorityGroup")%>
+       </title>
+
+       <script type="text/javascript">
+       <!--
+       // Use this method to repost the form and pick a new tab
+       function SelectTab(newtab)
+       {
+               if (checkForm())
+               {
+                       document.editgroup.tabname.value = newtab;
+                       document.editgroup.submit();
+               }
+       }
+
+       // Use this method to repost the form,
+       // and set the anchor request.
+       function postFormSetAnchor(anchorValue)
+       {
+               if (checkForm())
+               {
+                       if (anchorValue != "")
+                               document.group.action = 
document.editgroup.action + "#" + anchorValue;
+                       document.editgroup.submit();
+               }
+       }
+
+       // Use this method to repost the form
+       function postForm()
+       {
+               if (checkForm())
+               {
+                       document.editgroup.submit();
+               }
+       }
+
+       function Save()
+       {
+               if (checkForm())
+               {
+                       // Can't submit until all required fields have been set.
+                       // Some of these don't live on the current tab, so 
don't set
+                       // focus.
+
+                       // Check our part of the form, for save
+                       if (editgroup.groupname.value == "")
+                       {
+                               
alert("<%=Messages.getBodyJavascriptString(pageContext.getRequest().getLocale(),"editgroup.AuthorityGroupMustHaveAName")%>");
+                               
SelectTab("<%=Messages.getBodyJavascriptString(pageContext.getRequest().getLocale(),"editgroup.Name")%>");
+                               document.editgroup.groupname.focus();
+                               return;
+                       }
+                       if (window.checkConfigForSave)
+                       {
+                               if (!checkConfigForSave())
+                                       return;
+                       }
+                       document.editgroup.op.value="Save";
+                       document.editgroup.submit();
+               }
+       }
+
+       function Continue()
+       {
+               document.editgroup.op.value="Continue";
+               postForm();
+       }
+
+       function Cancel()
+       {
+               document.editgroup.op.value="Cancel";
+               document.editgroup.submit();
+       }
+
+       function checkForm()
+       {
+               if (!checkConnectionCount())
+                       return false;
+               if (window.checkConfig)
+                       return checkConfig();
+               return true;
+       }
+
+       //-->
+       </script>
+</head>
+
+<body class="standardbody">
+
+    <table class="page">
+      <tr><td colspan="2" class="banner"><jsp:include page="banner.jsp" 
flush="true"/></td></tr>
+      <tr><td class="navigation"><jsp:include page="navigation.jsp" 
flush="true"/></td>
+       <td class="darkwindow">
+
+
+       <form class="standardform" name="editconnection" action="execute.jsp" 
method="POST" enctype="multipart/form-data">
+         <input type="hidden" name="op" value="Continue"/>
+         <input type="hidden" name="type" value="authority"/>
+         <input type="hidden" name="tabname" 
value='<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(tabName)%>'/>
+         <input type="hidden" name="isnewconnection" 
value='<%=(isNew?"true":"false")%>'/>
+           <table class="tabtable">
+             <tr class="tabrow">
+<%
+       int tabNum = 0;
+       while (tabNum < tabsArray.size())
+       {
+               String tab = (String)tabsArray.get(tabNum++);
+               if (tab.equals(tabName))
+               {
+%>
+                     <td 
class="activetab"><nobr><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(tab)%></nobr></td>
+<%
+               }
+               else
+               {
+%>
+                     <td class="passivetab"><nobr><a 
href="javascript:void(0);" 
alt='<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(tab)+" 
"+Messages.getAttributeString(pageContext.getRequest().getLocale(),"editgroup.tab")%>'
 onclick='<%="javascript:SelectTab(\""+tab+"\");return 
false;"%>'><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(tab)%></a></nobr></td>
+<%
+               }
+       }
+%>
+                     <td class="remaindertab">
+<%
+       if (description.length() > 0)
+       {
+%>
+                         
<nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editgroup.EditGroup")%>
 '<%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(description)%>'</nobr>
+<%
+       }
+       else
+       {
+%>
+                         
<nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editgroup.EditAGroup")%></nobr>
+<%
+       }
+%>
+                     </td>
+             </tr>
+             <tr class="tabbodyrow">
+               <td class="tabbody" 
colspan='<%=Integer.toString(tabsArray.size()+1)%>'>
+
+<%
+
+       // Name tab
+       if 
(tabName.equals(Messages.getString(pageContext.getRequest().getLocale(),"editgroup.Name")))
+       {
+%>
+                   <table class="displaytable">
+                       <tr><td class="separator" colspan="5"><hr/></td></tr>
+                       <tr>
+                               <td 
class="description"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editgroup.NameColon")%></nobr></td>
+                               <td class="value" colspan="4">
+<%
+           // If the group doesn't exist yet, we are allowed to change the 
name.
+           if (isNew)
+           {
+%>
+                                       <input type="text" size="32" 
name="groupname" 
value='<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(groupName)%>'/>
+<%
+           }
+           else
+           {
+%>
+                                       
<%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(groupName)%>
+                                       <input type="hidden" name="groupname" 
value='<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(groupName)%>'/>
+<%
+           }
+%>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td 
class="description"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editgroup.DescriptionColon")%></nobr></td>
+                               <td class="value" colspan="4">
+                                       <input type="text" size="50" 
name="description" 
value='<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(description)%>'/>
+                               </td>
+                       </tr>
+                   </table>
+<%
+       }
+       else
+       {
+               // Hiddens for the Name tab
+%>
+                   <input type="hidden" name="groupname" 
value='<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(groupName)%>'/>
+                   <input type="hidden" name="description" 
value='<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(description)%>'/>
+<%
+       }
+%>
+                   <table class="displaytable">
+                       <tr><td class="separator" colspan="4"><hr/></td></tr>
+                       <tr><td class="message" colspan="4"><nobr>
+                           <input type="button" 
value="<%=Messages.getAttributeString(pageContext.getRequest().getLocale(),"editgroup.Save")%>"
 onClick="javascript:Save()" 
alt="<%=Messages.getAttributeString(pageContext.getRequest().getLocale(),"editgroup.SaveThisAuthorityGroup")%>"/>
+                           &nbsp;<input type="button" 
value="<%=Messages.getAttributeString(pageContext.getRequest().getLocale(),"editgroup.Cancel")%>"
 onClick="javascript:Cancel()" 
alt="<%=Messages.getAttributeString(pageContext.getRequest().getLocale(),"editgroup.CancelAuthorityGroupEditing")%>"/></nobr></td>
+                       </tr>
+                   </table>
+               </td>
+             </tr>
+           </table>
+       </form>
+       </td>
+      </tr>
+    </table>
+
+</body>
+
+</html>
+
+<%
+    }
+    catch (ManifoldCFException e)
+    {
+       e.printStackTrace();
+       variableContext.setParameter("text",e.getMessage());
+       variableContext.setParameter("target","listauthorities.jsp");
+%>
+       <jsp:forward page="error.jsp"/>
+<%
+    }
+%>
+

Propchange: 
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/editgroup.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/editgroup.jsp
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: 
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/execute.jsp
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/execute.jsp?rev=1535650&r1=1535649&r2=1535650&view=diff
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/execute.jsp
 (original)
+++ 
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/execute.jsp
 Fri Oct 25 07:23:30 2013
@@ -45,6 +45,7 @@
                // Make a few things we will need
                // Get the job manager handle
                IJobManager manager = JobManagerFactory.make(threadContext);
+               IAuthorityGroupManager authGroupManager = 
AuthorityGroupManagerFactory.make(threadContext);
                IRepositoryConnectionManager connManager = 
RepositoryConnectionManagerFactory.make(threadContext);
                IAuthorityConnectionManager authConnManager = 
AuthorityConnectionManagerFactory.make(threadContext);
                IMappingConnectionManager mappingConnManager = 
MappingConnectionManagerFactory.make(threadContext);
@@ -212,6 +213,105 @@
 <%
                        }
                }
+               else if (type != null && op != null && type.equals("group"))
+               {
+                       // -- Group editing operations --
+                       if (op.equals("Save") || op.equals("Continue"))
+                       {
+                               try
+                               {
+                                       // Set up a connection object that is a 
merge of an existing connection object plus what was posted.
+                                       IAuthorityGroup group = null;
+                                       boolean isNew = true;
+                                       String x = 
variableContext.getParameter("isnewconnection");
+                                       if (x != null)
+                                               isNew = x.equals("true");
+
+                                       String groupName = 
variableContext.getParameter("groupname");
+                                       // If the groupname is not null, load 
the group and prepopulate everything with what comes from it.
+                                       if (groupName != null && 
groupName.length() > 0 && !isNew)
+                                       {
+                                               group = 
authGroupManager.load(groupName);
+                                       }
+                                       
+                                       if (group == null)
+                                       {
+                                               group = 
authGroupManager.create();
+                                               if (groupName != null && 
groupName.length() > 0)
+                                                       
group.setName(groupName);
+                                       }
+
+                                       // Gather all the data from the form.
+                                       group.setIsNew(isNew);
+                                       x = 
variableContext.getParameter("description");
+                                       if (x != null)
+                                               group.setDescription(x);
+
+                                       if (op.equals("Continue"))
+                                       {
+                                               
threadContext.save("GroupObject",group);
+%>
+                                               <jsp:forward 
page="editgroup.jsp"/>
+<%
+                                       }
+                                       else if (op.equals("Save"))
+                                       {
+                                               authGroupManager.save(group);
+                                               
variableContext.setParameter("groupname",groupName);
+%>
+                                               <jsp:forward 
page="viewgroup.jsp"/>
+<%
+                                       }
+                               }
+                               catch (ManifoldCFException e)
+                               {
+                                       e.printStackTrace();
+                                       
variableContext.setParameter("text",e.getMessage());
+                                       
variableContext.setParameter("target","listgroups.jsp");
+%>
+                                       <jsp:forward page="error.jsp"/>
+<%
+                               }
+                       }
+                       else if (op.equals("Delete"))
+                       {
+                               try
+                               {
+                                       String groupName = 
variableContext.getParameter("groupname");
+                                       if (groupName == null)
+                                               throw new 
ManifoldCFException("Missing group name parameter");
+                                       authGroupManager.delete(groupName);
+%>
+                                       <jsp:forward page="listgroups.jsp"/>
+<%
+                               }
+                               catch (ManifoldCFException e)
+                               {
+                                       e.printStackTrace();
+                                       
variableContext.setParameter("text",e.getMessage());
+                                       
variableContext.setParameter("target","listgroups.jsp");
+%>
+                                       <jsp:forward page="error.jsp"/>
+<%
+                               }
+                       }
+                       else if (op.equals("Cancel"))
+                       {
+%>
+                               <jsp:forward page="listgroups.jsp"/>
+<%
+                       }
+                       else
+                       {
+                               // Error
+                               variableContext.setParameter("text","Illegal 
parameter to authority group execution page");
+                               
variableContext.setParameter("target","listgroups.jsp");
+%>
+                               <jsp:forward page="error.jsp"/>
+<%
+                       }
+
+               }
                else if (type != null && op != null && type.equals("authority"))
                {
                        // -- Authority editing operations --

Modified: 
manifoldcf/branches/CONNECTORS-792/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-792/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties?rev=1535650&r1=1535649&r2=1535650&view=diff
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-792/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties
 (original)
+++ 
manifoldcf/branches/CONNECTORS-792/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties
 Fri Oct 25 07:23:30 2013
@@ -175,6 +175,19 @@ listmappers.Edit=Edit
 listmappers.Delete=Delete
 listmappers.uninstalled=(uninstalled)
 
+editgroup.Name=Name
+editgroup.ApacheManifoldCFEditAuthorityGroup=Apache ManifoldCF: Edit Authority 
Group
+editgroup.AuthorityGroupMustHaveAName=Authority group must have a name
+editgroup.tab=tab
+editgroup.EditGroup=Edit group
+editgroup.EditAGroup=Edit a group
+editgroup.NameColon=Name:
+editgroup.DescriptionColon=Description:
+editgroup.Save=Save
+editgroup.SaveThisAuthorityGroup=Save this authority gorup
+editgroup.Cancel=Cancel
+editgroup.CancelAuthorityGroupEditing=Cancel authority group editing
+
 editauthority.ApacheManifoldCFEditAuthority=Apache ManifoldCF: Edit Authority
 editauthority.EditAnAuthority=Edit an Authority
 editauthority.NameColon=Name:

Modified: 
manifoldcf/branches/CONNECTORS-792/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_ja_JP.properties
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-792/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_ja_JP.properties?rev=1535650&r1=1535649&r2=1535650&view=diff
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-792/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_ja_JP.properties
 (original)
+++ 
manifoldcf/branches/CONNECTORS-792/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_ja_JP.properties
 Fri Oct 25 07:23:30 2013
@@ -175,6 +175,19 @@ listmappers.Edit=編集
 listmappers.Delete=削除
 listmappers.uninstalled=(アンインストール)
 
+editgroup.Name=Name
+editgroup.ApacheManifoldCFEditAuthorityGroup=Apache ManifoldCF: Edit Authority 
Group
+editgroup.AuthorityGroupMustHaveAName=Authority group must have a name
+editgroup.tab=tab
+editgroup.EditGroup=Edit group
+editgroup.EditAGroup=Edit a group
+editgroup.NameColon=Name:
+editgroup.DescriptionColon=Description:
+editgroup.Save=Save
+editgroup.SaveThisAuthorityGroup=Save this authority gorup
+editgroup.Cancel=Cancel
+editgroup.CancelAuthorityGroupEditing=Cancel authority group editing
+
 editauthority.ApacheManifoldCFEditAuthority=Apache ManifoldCF:権限の編集
 editauthority.EditAnAuthority=権限を編集
 editauthority.NameColon=名前:


Reply via email to