[rhmessaging-commits] rhmessaging commits: r3642 - in mgmt/trunk/cumin/python/cumin: usergrid and 1 other directory.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Wed Sep 23 11:01:12 EDT 2009


Author: justi9
Date: 2009-09-23 11:01:11 -0400 (Wed, 23 Sep 2009)
New Revision: 3642

Added:
   mgmt/trunk/cumin/python/cumin/usergrid/widgets.py
   mgmt/trunk/cumin/python/cumin/usergrid/widgets.strings
Removed:
   mgmt/trunk/cumin/python/cumin/usergrid/main.strings
Modified:
   mgmt/trunk/cumin/python/cumin/grid/slot.py
   mgmt/trunk/cumin/python/cumin/usergrid/main.py
Log:
 * Add a user-scope slots listing

 * Move the widget code to its own file

 * Remove obsolete template junk


Modified: mgmt/trunk/cumin/python/cumin/grid/slot.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/slot.py	2009-09-22 18:57:58 UTC (rev 3641)
+++ mgmt/trunk/cumin/python/cumin/grid/slot.py	2009-09-23 15:01:11 UTC (rev 3642)
@@ -45,6 +45,10 @@
             s.qmf_update_time > now() - interval '60 minutes'
             """
 
+    def render_title(self, session):
+        count = self.get_item_count(session)
+        return "Slots %s" % fmt_count(count)
+
     class NameColumn(SqlTableColumn):
         def render_title(self, session, data):
             return "Name"

Modified: mgmt/trunk/cumin/python/cumin/usergrid/main.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/usergrid/main.py	2009-09-22 18:57:58 UTC (rev 3641)
+++ mgmt/trunk/cumin/python/cumin/usergrid/main.py	2009-09-23 15:01:11 UTC (rev 3642)
@@ -7,6 +7,8 @@
 
 from wooly.widgets import Link
 
+from widgets import *
+
 strings = StringCatalog(__file__)
 
 class UserGridModule(CuminModule):
@@ -15,42 +17,3 @@
         app.add_page(app.user_grid_page)
 
 module = UserGridModule()
-
-class MainPage(CuminPage, ModeSet):
-    def __init__(self, app, name):
-        super(MainPage, self).__init__(app, name)
-
-        self.main = MainView(app, "main")
-        self.add_mode(self.main)
-        self.set_default_frame(self.main)
-
-    def render_title(self, session):
-        return "User Grid"
-
-class MainView(CuminMainView):
-    def __init__(self, app, name):
-        super(MainView, self).__init__(app, name)
-
-        self.overview = OverviewFrame(app, "overview")
-        self.add_tab(self.overview)
-
-        self.submission = UserSubmissionSet(app, "submissions")
-        self.add_tab(self.submission)
-
-class OverviewFrame(Widget):
-    def render_title(self, session):
-        return "Overview"
-
-class UserSubmissionSet(SubmissionSet):
-    def __init__(self, app, name):
-        super(UserSubmissionSet, self).__init__(app, name)
-
-        self.scheduler_col.visible = False
-        self.submitter_col.visible = False
-
-    def render_sql_where(self, session):
-        pass
-        #return "where m.name = %(name)s"
-
-    def get_sql_values(self, session):
-        return {"name": session.user_session.subject.name}

Deleted: mgmt/trunk/cumin/python/cumin/usergrid/main.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/usergrid/main.strings	2009-09-22 18:57:58 UTC (rev 3641)
+++ mgmt/trunk/cumin/python/cumin/usergrid/main.strings	2009-09-23 15:01:11 UTC (rev 3642)
@@ -1,83 +0,0 @@
-[UserMainFrame.css]
-#head {
-    padding: 0;
-    min-height: 2.75em;
-    background: #f9f9ff url("resource?name=shade.png") repeat-x scroll bottom center;
-}
-
-#logo {
-    float: left;
-    margin: 0.25em 1em;
-}
-
-#tabs {
-    padding: 0 0 0 2em;
-    position: relative;
-    top: 1.175em;
-}
-
-#tabs li {
-    display: inline;
-}
-
-#tabs li a {
-    padding: 0.275em 0.5em;
-    border-top: 1px solid #ccc;
-    border-right: 1px solid #ccc;
-    border-left: 1px solid #e7e7e7;
-    -moz-border-radius: 0.35em 0.35em 0 0;
-    -webkit-border-radius: 0.35em 0.35em 0 0;
-    color: #333;
-    background-color: #f7f7f7;
-    line-height: 1.6em;
-}
-
-#tabs li:first-child a {
-    border-left: 1px solid #ccc;
-}
-
-#tabs li a.selected {
-    background-color: #fff;
-    position: relative;
-    z-index: 2;
-}
-
-#user {
-    padding: 0.25em 0.5em;
-    float: right;
-    font-size: 0.9em;
-}
-
-#actions {
-    padding: 0.25em 0.5em;
-    float: right;
-    font-size: 0.9em;
-}
-
-#body {
-  border-top: 1px solid #ccc;
-  padding: 0.75em 1em;
-  position: relative;
-  z-index: 1;
-  min-height: 20em;
-}
-
-[UserMainFrame.html]
-<div id="head">
-  <div id="user">
-    Hi, {user_name}
-    <strong>&#183;</strong>
-    <a id="logout" onclick="wooly.clearUpdates()" href="{logout_href}">Log Out</a>
-  </div>
-
-  <img id="logo" src="resource?name=rhlogo-32.png"/>
-
-  <ul id="tabs">{tabs}</ul>
-</div>
-
-<div id="body">{content}</div>
-
-<div id="foot"/>
-
-[UserMainFrame.frame_html]
-<li><a href="{frame_href}">{frame_title}</a></li>

Added: mgmt/trunk/cumin/python/cumin/usergrid/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/usergrid/widgets.py	                        (rev 0)
+++ mgmt/trunk/cumin/python/cumin/usergrid/widgets.py	2009-09-23 15:01:11 UTC (rev 3642)
@@ -0,0 +1,80 @@
+from wooly import *
+from wooly.widgets import *
+
+from cumin.widgets import *
+from cumin.util import *
+from cumin.grid.submission import *
+from cumin.grid.slot import *
+
+from wooly.widgets import Link
+
+from widgets import *
+
+strings = StringCatalog(__file__)
+
+class UserAttribute(Attribute):
+    def get(self, session):
+        return session.user_session.subject
+
+class MainPage(CuminPage, ModeSet):
+    def __init__(self, app, name):
+        super(MainPage, self).__init__(app, name)
+
+        self.user = UserAttribute(app, "user")
+        self.add_attribute(self.user)
+
+        self.main = MainView(app, "main", self.user)
+        self.add_mode(self.main)
+        self.set_default_frame(self.main)
+
+    def render_title(self, session):
+        return "User Grid"
+
+class MainView(CuminMainView):
+    def __init__(self, app, name, user):
+        super(MainView, self).__init__(app, name)
+
+        self.overview = OverviewFrame(app, "overview", user)
+        self.add_tab(self.overview)
+
+        self.submissions = UserSubmissionSet(app, "submissions", user)
+        self.add_tab(self.submissions)
+
+        self.slots = UserSlotSet(app, "slots", user)
+        self.add_tab(self.slots)
+
+class OverviewFrame(Widget):
+    def __init__(self, app, name, user):
+        super(OverviewFrame, self).__init__(app, name)
+
+    def render_title(self, session):
+        return "Overview"
+
+class UserSubmissionSet(SubmissionSet):
+    def __init__(self, app, name, user):
+        super(UserSubmissionSet, self).__init__(app, name)
+
+        self.user = user
+
+        self.scheduler_col.visible = False
+        self.submitter_col.visible = False
+
+    def render_sql_where(self, session):
+        pass # XXX return "where m.name = %(name)s"
+
+    def get_sql_values(self, session):
+        user = self.user.get(session)
+        return {"name": user.name}
+
+class UserSlotSet(SlotSet):
+    def __init__(self, app, name, user):
+        super(UserSlotSet, self).__init__(app, name)
+
+        self.user = user
+
+    def render_sql_where(self, session):
+        return "where s.remote_user like %(name)s"
+
+    def get_sql_values(self, session):
+        user = self.user.get(session)
+        return {"name": "%s%%" % user.name}

Added: mgmt/trunk/cumin/python/cumin/usergrid/widgets.strings
===================================================================



More information about the rhmessaging-commits mailing list