]> andersk Git - moira.git/blob - clients/moira/menus.c
This is another incrementatal revision that is pretty stable, and most
[moira.git] / clients / moira / menus.c
1 #if (!defined(lint) && !defined(SABER))
2   static char rcsid_module_c[] = "$Header$";
3 #endif lint
4
5 /*      This is the file menus.c for the SMS Client, which allows a nieve
6  *      user to quickly and easily maintain most parts of the SMS database.
7  *      It Contains: All menu definitions.
8  *      
9  *      Created:        4/11/88
10  *      By:             Chris D. Peterson
11  *
12  *      $Source$
13  *      $Author$
14  *      $Header$
15  *      
16  *      Copyright 1988 by the Massachusetts Institute of Technology.
17  *
18  *      For further information on copyright and distribution 
19  *      see the file mit-copyright.h
20  */
21
22 #include <stdio.h>
23 #include <menu.h>
24
25 #include "mit-copyright.h"
26 #include "defs.h"
27 #include "f_defs.h"
28 #include "globals.h"
29
30 /* ------------------------- Second Tier Menus ------------------------- */
31
32 /* 
33  * Cluster Data Menu
34  */
35
36 Menu cluster_data_menu = {
37   NULLFUNC,
38   NULLFUNC,
39   "Cluster Data Menu",
40   4,
41   {
42     { ShowClusterData, NULLMENU, 3, {
43       {"show", "Show Data on a given Cluster"},
44       {"clus", "Cluster's Name: "},
45       {"label", "Label Identifing the data: "},
46     } },
47     { AddClusterData, NULLMENU, 4, {
48       {"add", "Add Data to a given Cluster"},
49       {"clus", "Cluster Name: "},
50       {"label", "Label Identifing the data: "},
51       {"data", "The data to be added: "},
52     } },
53     { RemoveClusterData, NULLMENU, 4, {
54       {"delete", "Remove Data to a given Cluster"},
55       {"clus", "Cluster's Name: "},
56       {"label", "Label Identifing the data: "},
57       {"data", "The data to be removed: "},
58     } }, 
59     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
60   }
61 };
62
63 /*
64  * List Information Menu
65  */
66
67 Menu list_info_menu = {
68     NULLFUNC,
69     NULLFUNC,
70     "List Information Menu",
71     5,
72     {
73         SIMPLEFUNC("member",
74                    "Show all lists to which a given member belongs",
75                    ListByMember),
76         SIMPLEFUNC("admin",
77                    "Show all items which a given member can administer",
78                    ListByAdministrator),
79         SIMPLEFUNC("groups", "Show all lists which are groups",
80                    ListAllGroups),
81         SIMPLEFUNC("public", "Show all public mailing lists",
82                    ListAllPublicMailLists),
83         SIMPLEFUNC("maillists", "Show all mailing lists",
84                    ListAllMailLists)
85     }
86 };
87
88 /*
89  * List Member Menu
90  */
91
92 Menu list_member_menu = {
93     ListmaintMemberMenuEntry,
94     ListmaintMemberMenuExit,
95     NULL,
96     7,
97     {
98         SIMPLEFUNC("add", "Add a member to this list", AddMember),
99         SIMPLEFUNC("remove", "Remove a member from this list", DeleteMember),
100         SIMPLEFUNC("all", "Show the members of this list", ListAllMembers),
101         SIMPLEFUNC("user", "Show the members of type USER", ListUserMembers),
102         SIMPLEFUNC("list", "Show the members of type LIST", ListListMembers),
103         SIMPLEFUNC("string", "Show the members of type STRING", 
104                    ListStringMembers),
105         SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
106     } 
107 };
108
109 /*
110  *  Machine To Cluster Mappings Menu
111  */
112
113 Menu mappings_menu = {
114   NULLFUNC,
115   NULLFUNC,
116   "Machine To Cluster Mappings Menu",
117   4,
118   {
119     { MachineToClusterMap, NULLMENU, 3, {
120       {"map", "Show Machine to cluster mapping"},
121       {"name", "Machine's Name: "},
122       {"cluster", "Cluster's Name: "},
123     } },
124     { AddMachineToCluster, NULLMENU, 3, {
125       {"addcluster","Add machines to a clusters"},
126       {"name","Machine's Name: "},
127       {"cluster", "Cluster's Name: "},
128     } },
129     { RemoveMachineFromCluster, NULLMENU, 3, {
130       {"remcluster", "Remove machines from clusters"},
131       {"name","Machine's Name: "},
132       {"cluster", "Cluster's Name: "},
133     } },
134     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode),
135   }
136 };
137
138 /* 
139  * Post Office Box Menu
140  */
141
142 Menu pobox_menu = {
143   NULLFUNC,
144   NULLFUNC,
145   "Post Office Box Menu",
146   4,
147   {
148     {GetUserPOBox, NULLMENU, 2, {
149       {"show", "Show a user's post office box"},
150       {"login name", "login name: "}
151     } },
152     {SetUserPOBox, NULLMENU, 2, {
153       {"set", "Set (Add or Change) a user's post office box"},
154       {"login name", "login name: "}
155     } },
156     {RemoveUserPOBox, NULLMENU, 2, {
157       {"remove", "Remove a user's post office box"},
158       {"login name", "login name: "}
159     } },
160     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
161   }
162 };
163    
164 /*
165  * Quota Menu
166  */
167  
168 Menu quota_menu = {
169   NULLFUNC,
170   NULLFUNC,
171   "Quota Menu",
172   7,
173   {
174     SIMPLEFUNC("shdef", "Show default user quota (in KB)", ShowDefaultQuota),
175     {ChangeDefaultQuota, NULLMENU, 2, {
176       {"chdef", "Change default user quota"},
177       {"quota", "New quota (in KB): "}
178     } },
179     SIMPLEFUNC("shquota", "Show a user's disk quota on a filesytem",
180                ShowUserQuota),
181     SIMPLEFUNC("addquota", "Add a new disk quota for user on a filesytem",
182                AddUserQuota),
183     SIMPLEFUNC("chquota", "Change a user's disk quota on a filesytem",
184                ChangeUserQuota),
185     SIMPLEFUNC("rmquota", "Remove a user's disk quota on a filesytem",
186                RemoveUserQuota),
187     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
188   } 
189 };
190
191 /* ------------------------- First Tier Menus ------------------------- */
192
193 /* 
194  * Cluster Menu
195  */
196
197 Menu cluster_menu = {
198   NULLFUNC,
199   NULLFUNC,
200   "Cluster Menu",
201   7,
202   {
203     { ShowClusterInfo, NULLMENU, 2, {
204       {"show", "Get cluster information"},
205       {"name", "Cluster's Name: "}
206     } },
207     { AddCluster, NULLMENU, 2, {
208       {"add", "Add a new cluster"},
209       {"name","Cluster's Name: "},
210     } },
211     { UpdateCluster, NULLMENU, 2, {
212       {"update", "Update cluster information"},
213       {"name","Cluster's Name: "},
214     } },
215     { DeleteCluster, NULLMENU, 2, {
216       {"delete", "Delete this cluster"},
217       {"name", "Cluster's Name: "}
218     } },
219     SUBMENU("mappings","Machine To Cluster Mappings Menu", &mappings_menu),
220     SUBMENU("c_data","Cluster Data Menu", &cluster_data_menu),
221     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
222   }
223 };
224
225 /* 
226  * Filesystem Menu
227  */
228
229 Menu filesys_menu = {
230   NULLFUNC, 
231   NULLFUNC, 
232   "Filesystem Menu",
233   10,
234   {
235     { GetFS, NULLMENU, 2, {
236       {"get", "Get Filesystem Name Information"},
237       {"name", "Name of Filesystem: "}
238     } },
239     { AddFS, NULLMENU, 2, {
240       {"add", "Add New Filesystem to Database"},
241       {"name", "name: "},
242     } },
243     { ChangeFS, NULLMENU, 2, {
244       {"change", "Update Filesystem Information"},
245       {"name", "name: "},
246     } },
247     { DeleteFS, NULLMENU, 2, {
248       {"delete", "Delete Filesystem"},
249       {"name", "Filesystem Name: "}
250     } },
251     { GetFSAlias, NULLMENU, 2, {
252       {"check", "Check An Association"},
253       {"name", "alias name : "}
254     } },
255     { CreateFSAlias, NULLMENU, 2, {
256       {"alias", "Associate with a Filesystem"},
257       {"name", "alias name : "},
258     } },
259     { DeleteFSAlias, NULLMENU, 2, {
260       {"unalias", "Disassociate from a Filesystem"},
261       {"name", "alias name : "},
262     } },
263     SUBMENU("quotas","Quota Menu", &quota_menu),
264     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode),
265     SIMPLEFUNC("help", "Help ..", AttachHelp)
266   }
267 };
268
269 /*
270  * Machine Menu
271  */
272
273 Menu machine_menu = {
274   NULLFUNC,
275   NULLFUNC,
276   "Machine Menu",
277   6,
278   {
279     { ShowMachineInfo, NULLMENU, 2, {
280       {"show","Get machine information"},
281       {"name","Machine's Name: "}
282     } },
283     { AddMachine, NULLMENU, 2, {
284       {"add","Add a new machine"},
285       {"name","Machine's Name: "},
286     } },
287     { UpdateMachine, NULLMENU, 2, {
288       {"update","Update machine information"},
289       {"name","Machine's Name: "},
290     } },
291     { DeleteMachine, NULLMENU, 2, {
292       {"delete","Delete this machine"},
293       {"name","Machine's Name: "}
294     } },
295     SUBMENU("mappings","Machine To Cluster Mappings Menu", &mappings_menu),
296     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
297   }
298 };
299
300 /*
301  * List Menu
302  */
303
304 Menu list_menu = {
305     NULLFUNC,
306     NULLFUNC,
307     "List Menu",
308     10,
309     {
310         { ShowListInfo, NULLMENU, 2, {
311             {"show", "Display information about a list"},
312             {"list name", "Name of list: "}
313         } },
314         { NULLFUNC, &list_member_menu, 2, {
315             {"add", "Create new List"},
316             {"list name", "Name of list: "}
317         } },
318         { UpdateList, NULLMENU, 2, {
319             {"update", "Update characteristics of a list"},
320             {"list name", "Name of list: "}
321         } },
322         { DeleteList, NULLMENU, 2, {
323             {"delete", "Delete a List"},
324             {"list name", "Name of list: "}
325         } },
326         SIMPLEFUNC("query_remove",
327                    "Interactively remove an item from all lists",
328                    InterRemoveItemFromLists),
329         { NULLFUNC, &list_member_menu, 2, {
330             {"members", "Member Menu - Change/Show Members of a List."},
331             {"list name", "Name of list: "}
332         } },
333         SUBMENU("list_info", "List Info Menu",
334                 &list_info_menu),
335         SUBMENU("quotas","Quota Menu", &quota_menu),    
336         SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode),
337         SIMPLEFUNC("help", "Print Help", ListHelp)
338     } 
339 };
340
341 /*
342  * NFS Physical Menu
343  */
344
345 Menu nfsphys_menu = {
346   NULLFUNC,
347   NULLFUNC,
348   "NFS Physical Menu",
349   6,
350   {
351     { ShowNFSService, NULLMENU, 2, {
352       { "show", "Show an NFS server" },
353       { "machine", "Machine Name: "},
354     } },
355     { AddNFSService, NULLMENU, 2, {
356       { "add", "Add NFS server" },
357       { "machine", "Machine Name: "},
358     } },
359     { UpdateNFSService, NULLMENU, 2, {
360       { "update", "Update NFS server"},
361       { "machine", "Machine Name: "},
362     } },
363     { DeleteNFSService, NULLMENU, 2, {
364       { "delete", "Delete NFS server"},
365       {"machine", "Machine Name: "},
366     } },
367     SUBMENU("quotas","Quota Menu", &quota_menu),
368     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode),
369 /*    SIMPLEFUNC("help", "Help", NFSHelp), */
370   }
371 };
372
373 /*
374  * User Menu
375  */
376
377 Menu user_menu = {
378   NULLFUNC,
379   NULLFUNC,
380   "User Menu",
381   11,
382   {
383     {ShowUserByLogin, NULLMENU, 2, {
384        {"login", "Show user information by login name"},
385        {"login name", "Desired login name: "}
386      } },
387     {ShowUserByName, NULLMENU, 3, {
388       {"name", "Show user information by name"},
389       {"first", "First name: "},
390       {"last", "Last name: "}
391     } },
392     {ShowUserByClass, NULLMENU, 2, {
393        {"class", "Show names of users in a given class"},
394        {"login name", "Desired class: "}
395      } },    
396     {UpdateUser, NULLMENU, 2, {
397       {"modify", "Change all user fields"},
398       {"login", "Login name: "}
399     } },
400 /*    SIMPLEFUNC("chpw", "Change a user's password", change_user_password), */
401     SIMPLEFUNC("adduser", "Add a new user to the database", 
402                AddNewUser),
403     SIMPLEFUNC("register", "Register a user", RegisterUser),
404     {DeleteUser, NULLMENU, 2, {
405       {"delete", "Delete user"},
406       {"login", "Login name: "}
407     } },
408     {DeleteUserByUid, NULLMENU, 2, {
409       {"udelete", "Delete user by uid"},
410       {"uid", "User ID (not MIT ID!): "}
411     } },
412     SUBMENU("pobox", "Post Office Box Menu", &pobox_menu),
413     SUBMENU("quota", "Quota Menu", &quota_menu),
414     SIMPLEFUNC("verbose", "Toggle Verbosity of Delete", ToggleVerboseMode)
415   }
416 };
417
418 /* ------------------------- Root Menu ------------------------- */
419
420 /* 
421  * Sms top menu
422  */
423
424 Menu sms_top_menu = {
425   NULLFUNC,
426   NULLFUNC,
427   "Sms Database Manipulation",
428   6,
429   {
430     SUBMENU("cluster","Cluster Menu",&cluster_menu),
431     SUBMENU("filesys","Filesystem Menu", &filesys_menu),
432     SUBMENU("list","Lists and Group Menu", &list_menu),
433     SUBMENU("machine","Machine Menu",&machine_menu),
434     SUBMENU("nfs","NFS Physical Menu", &nfsphys_menu),
435     SUBMENU("user","User Menu", &user_menu)
436   }
437 };  
438        
This page took 0.110492 seconds and 5 git commands to generate.