Few changes need to be made on your patch .. I basically updated the 
UpdateCustomKeyAction and updatekey.jsp . Look at the attached patch.



----- Original Message -----
From: "Cliff Perry" <cpe...@redhat.com>
To: spacewalk-devel@redhat.com
Sent: Tuesday, October 12, 2010 9:45:17 PM GMT -05:00 US/Canada Eastern
Subject: Re: [Spacewalk-devel] Problem with pxt page port

Colin Coe wrote:
> Hi all
> 
> I'm having some problems porting a page.  the page is
> '/network/systems/custominfo/edit.pxt' and the problem is displaying
> the list of systems with this custom data with the correct pagination.
>  I can do it with out the pagination but the pxt file used the
> pagination so I'm attempting to as well.
> 
> Could someone have a look and comment?  I'm sure what I've done is pretty 
> close.
> 
> Thanks
> 
> CC
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Spacewalk-devel mailing list
> Spacewalk-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-devel

Colin,
I don't know enough to help directly. I assume your using one of the 
list tags for pagination?

We have several wiki pages on this which may or may not help.


https://fedorahosted.org/spacewalk/wiki/ListTag

https://fedorahosted.org/spacewalk/wiki/ListTagAdaptations
https://fedorahosted.org/spacewalk/wiki/ListTagDecorators

Cliff

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel
---
 .../systems/customkey/UpdateCustomKeyAction.java   |  103 +++++++++++++++++++
 .../WEB-INF/pages/systems/customkey/updatekey.jsp  |  106 ++++++++++++++++++++
 2 files changed, 209 insertions(+), 0 deletions(-)
 create mode 100644 java/code/src/com/redhat/rhn/frontend/action/systems/customkey/UpdateCustomKeyAction.java
 create mode 100644 java/code/webapp/WEB-INF/pages/systems/customkey/updatekey.jsp

diff --git a/java/code/src/com/redhat/rhn/frontend/action/systems/customkey/UpdateCustomKeyAction.java b/java/code/src/com/redhat/rhn/frontend/action/systems/customkey/UpdateCustomKeyAction.java
new file mode 100644
index 0000000..5bb6b6f
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/frontend/action/systems/customkey/UpdateCustomKeyAction.java
@@ -0,0 +1,103 @@
+/**
+ * Copyright (c) 2009--2010 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+package com.redhat.rhn.frontend.action.systems.customkey;
+
+import com.redhat.rhn.domain.org.CustomDataKey;
+import com.redhat.rhn.domain.org.OrgFactory;
+import com.redhat.rhn.domain.server.ServerFactory;
+import com.redhat.rhn.domain.user.User;
+import com.redhat.rhn.frontend.struts.RequestContext;
+import com.redhat.rhn.frontend.struts.RhnAction;
+import com.redhat.rhn.frontend.taglibs.list.helper.ListHelper;
+import com.redhat.rhn.frontend.taglibs.list.helper.Listable;
+
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Handles the deletion of a key.
+ */
+public class UpdateCustomKeyAction extends RhnAction implements Listable {
+
+    private final String CIKID_PARAM = "cikid";
+    private final String LABEL_PARAM = "label";
+    private final String DESC_PARAM = "description";
+    private final String CREATE_PARAM = "created";
+    private final String MODIFY_PARAM = "modified";
+    private final String CREATOR_PARAM = "creator";
+    private final String MODIFIER_PARAM = "modifier";
+
+    /** {...@inheritdoc} */
+    public ActionForward execute(ActionMapping mapping,
+            ActionForm formIn,
+            HttpServletRequest request,
+            HttpServletResponse response) {
+
+        RequestContext context = new RequestContext(request);
+
+        Long cikid = context.getParamAsLong(CIKID_PARAM);
+        CustomDataKey key = OrgFactory.lookupKeyById(cikid);
+
+        request.setAttribute(CIKID_PARAM, cikid);
+        request.setAttribute(LABEL_PARAM, key.getLabel());
+        if (context.isSubmitted()) {
+            request.setAttribute(DESC_PARAM, request.getParameter(DESC_PARAM));
+        }
+        else {
+            request.setAttribute(DESC_PARAM, key.getDescription());    
+        }
+        
+        request.setAttribute(CREATE_PARAM, key.getCreated());
+        request.setAttribute(MODIFY_PARAM, key.getModified());
+        request.setAttribute(CREATOR_PARAM, key.getCreator().getLogin());
+        request.setAttribute(MODIFIER_PARAM, key.getLastModifier().getLogin());
+
+        Map params = new HashMap();
+        params.put(CIKID_PARAM, cikid);
+        ListHelper helper = new ListHelper(this, request, params);
+        helper.execute();
+
+        if (context.wasDispatched("Update Key")) {
+            String desc = (String)request.getParameter(DESC_PARAM);
+
+            key.setDescription(desc);
+            key.setModified(new Date());
+
+            ServerFactory.saveCustomKey(key);
+
+            return mapping.findForward("updated");
+        }
+
+        return mapping.findForward("default");
+    }
+
+    public  List getResult(RequestContext context) {
+        User user  = context.getLoggedInUser();
+        Long cikid = context.getParamAsLong(CIKID_PARAM);
+        List servers = ServerFactory.lookupServersWithCustomKey(user.getId(), cikid);
+
+        return servers;
+    }
+
+}
diff --git a/java/code/webapp/WEB-INF/pages/systems/customkey/updatekey.jsp b/java/code/webapp/WEB-INF/pages/systems/customkey/updatekey.jsp
new file mode 100644
index 0000000..478f0c6
--- /dev/null
+++ b/java/code/webapp/WEB-INF/pages/systems/customkey/updatekey.jsp
@@ -0,0 +1,106 @@
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
+<%@ taglib uri="http://rhn.redhat.com/rhn"; prefix="rhn" %>
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean"; prefix="bean" %>
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-html"; prefix="html" %>
+<%@ taglib uri="http://rhn.redhat.com/tags/list"; prefix="rl" %>
+
+<html:html xhtml="true">
+<body>
+<br>
+
+
+
+<div>
+  <div class="toolbar-h1">
+    <div class="toolbar">
+      <span class="toolbar">
+        <a href="/rhn/systems/customdata/DeleteCustomKey.do?cikid=${cikid}">
+        <img src="/img/action-del.gif" alt="delete key" title="delete key" />delete key</a>
+      </span>
+    </div>
+    <img src="/img/rhn-icon-keyring.gif" alt="" /> 
+    <bean:message key="system.jsp.customkey.updatetitle"/>
+
+    <a href="/rhn/help/reference/en-US/s1-sm-systems.jsp#s2-sm-system-cust-info" target="_new" class="help-title">
+      <img src="/img/rhn-icon-help.gif" alt="Help Icon" />
+    </a>
+  </div>
+
+  <div class="page-summary">
+    <p><bean:message key="system.jsp.customkey.updatemsg"/></p>
+  </div>
+
+  <hr />
+    <rl:listset name="systemListSet" legend="system">
+  <rhn:submitted/>
+
+    <table class="details">
+      <tr>
+        <th><bean:message key="system.jsp.customkey.keylabel"/>:</th>
+        <td>${label}</td>
+      </tr>
+
+      <tr>
+        <th><bean:message key="system.jsp.customkey.description"/>:</th>
+        <td>
+          <textarea wrap="virtual" rows="6" cols="50" name="description"><c:out value="${description}" /></textarea>
+        </td>
+      </tr>
+
+      <tr>
+        <th><bean:message key="system.jsp.customkey.created"/>:</th>
+        <td>${created} by ${creator}</td>
+      </tr>
+
+      <tr>
+        <th><bean:message key="system.jsp.customkey.modified"/>:</th>
+        <td>${modified} by ${modifier}</td>
+      </tr>
+    </table>
+
+    <div align="right">
+      <hr />
+
+      <input type="submit" name="dispatch" value="${rhn:localize('Update Key')}" />
+
+      <input type="hidden" name="cikid" value="${param.cikid}" />
+    </div>
+</div>
+<div>
+  <h2><bean:message key="system.jsp.customkey.updateheader"/></h2>
+  
+        <rl:list
+            emptykey="system.jsp.customkey.noservers"
+            alphabarcolumn="name">
+          <rl:decorator name="PageSizeDecorator"/>
+
+          <!-- Name Column -->
+          <rl:column sortable="true"
+              bound="false"
+              headerkey="systemlist.jsp.system"
+              sortattr="name"
+              filterattr="name"
+              defaultsort="asc"
+              styleclass="first-column">
+            <a href="/rhn/systems/details/Overview.do?sid=${current.id}">${current.name}</a>
+          </rl:column>
+
+          <!-- Values Column -->
+            <rl:column sortable="false"
+                bound="false"
+                headerkey="cik.update.jsp.value">
+              <c:out value="${current.value}" />
+            </rl:column>		
+
+          <!-- Last Checkin Column -->
+          <rl:column sortable="false"
+                bound="false"
+                headerkey="cik.update.jsp.last_checkin"
+                styleclass="last-column">
+              <c:out value="${current.last_checkin}" />
+          </rl:column>
+        </rl:list>
+      </rl:listset>
+</div>      
+  </body>
+</html:html>
-- 
1.7.2.3

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to