Merge branch 'master' of /users/git/public/pyceo
[public/pyceo-broken.git] / ceo / urwid / main.py
index b0c0331..f28b17e 100644 (file)
@@ -1,5 +1,4 @@
-import sys, random, ldap, urwid.curses_display, getpass
-from ceo import members, ldapi
+import sys, random, urwid.curses_display
 from ceo.urwid.widgets import *
 from ceo.urwid.window import *
 from ceo.urwid import newmember, renew, info, search, positions, groups, shell
@@ -43,7 +42,7 @@ def program_name():
 office_data = {
     "name" : "Office Staff",
     "group" : "office",
-    "groups" : [ "office", "cdrom", "audio", "video", "www" ],
+    "groups" : [ "cdrom", "floppy", "audio", "video", "www" ],
 }
 
 syscom_data = {
@@ -55,8 +54,10 @@ syscom_data = {
 def main_menu():
     menu = [
         ("New Member", new_member, None),
+        ("New Club Rep", new_club_user, None),
         ("Renew Membership", renew_member, None),
-        ("Create Club Account", new_club, None),
+        ("Renew Club Rep", renew_club_user, None),
+        ("New Club", new_club, None),
         ("Display Member", display_member, None),
         ("Change Shell", change_shell, None),
         ("Search", search_members, None),
@@ -86,6 +87,15 @@ def new_club(*args, **kwargs):
         (newmember.EndPage, "club"),
     ], (60, 15))
 
+def new_club_user(*args, **kwargs):
+    push_wizard("New Club Rep Account", [
+        newmember.ClubUserIntroPage,
+        newmember.InfoPage,
+        newmember.SignPage,
+        newmember.PassPage,
+        (newmember.EndPage, "clubuser"),
+    ], (60, 15))
+
 def manage_group(*args, **kwargs):
     push_wizard("Manage Club or Group Members", [
         groups.IntroPage,
@@ -101,6 +111,14 @@ def renew_member(*args, **kwargs):
         renew.EndPage,
     ])
 
+def renew_club_user(*args, **kwargs):
+    push_wizard("Renew Club Rep Account", [
+        renew.ClubUserIntroPage,
+        renew.UserPage,
+        (renew.TermPage, "clubuser"),
+        (renew.EndPage, "clubuser"),
+    ], (60, 15))
+
 def display_member(data):
     push_wizard("Display Member", [
         renew.UserPage,
@@ -147,28 +165,7 @@ def run():
     event_loop( ui )
 
 def start():
-    try:
-        print "Connecting...\n",
-        sys.stdout.flush()
-        members.connect(AuthCallback())
-        print "done."
-
-        ui.run_wrapper( run )
-    except ldap.LOCAL_ERROR, e:
-        print ldapi.format_ldaperror(e)
-        print "Hint: You may need to run 'kinit'"
-    except ldap.INSUFFICIENT_ACCESS, e:
-        print ldapi.format_ldaperror(e)
-        print "You probably aren't permitted to do whatever you just tried."
-        print "Admittedly, ceo probably shouldn't have crashed either."
-
-class AuthCallback:
-    def callback(self, error):
-        try:
-            return getpass.getpass("Password: ")
-        except KeyboardInterrupt:
-            print ""
-            sys.exit(1)
+    ui.run_wrapper( run )
 
 if __name__ == '__main__':
     start()