Author: jdsn
Date: Fri Aug 29 12:03:52 2008
New Revision: 50472
URL: http://svn.opensuse.org/viewcvs/yast?rev=50472&view=rev
Log:
new function skeletons for data access, new Read function
Modified:
branches/tmp/jdsn/edu-users/src/EduUsers.ycp
branches/tmp/jdsn/edu-users/src/dialogs.ycp
Modified: branches/tmp/jdsn/edu-users/src/EduUsers.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/edu-users/src/EduUsers.ycp?rev=50472&r1=50471&r2=50472&view=diff
==============================================================================
--- branches/tmp/jdsn/edu-users/src/EduUsers.ycp (original)
+++ branches/tmp/jdsn/edu-users/src/EduUsers.ycp Fri Aug 29 12:03:52 2008
@@ -162,11 +162,76 @@
}
+
+global boolean Read()
+{
+ /* EduUsers read dialog caption */
+ string caption = _("Initializing Edu Users Configuration");
+
+ integer steps = 2;
+
+ Progress::New( caption, " ", steps, [
+ /* Progress stage 1 */
+ _("Read the settings")
+ ], [
+ /* Progress step 1 */
+ _("Reading the settings..."),
+ /* Progress finished */
+ _("Finished")
+ ],
+ ""
+ );
+
+
+ // --- READ PROCESS
+
+ /* read sysconfig */
+ if(Abort()) return false;
+ Progress::NextStage();
+
+ string gettemplates = (string) SCR::Read(.sysconfig.edu_users.EDU_TEMPLATES);
+ y2milestone("TEMPLATES: %1",gettemplates);
+ alltemplates = splitstring(gettemplates, ", ");
+ Template[`current] = alltemplates;
+ string getgroups = (string) SCR::Read(.sysconfig.edu_users.EDU_GROUPS);
+ y2milestone("GROUPS: %1",getgroups);
+ if (getgroups == nil) { getgroups = ""; }
+ allgroups = splitstring(getgroups, ", ");
+ foreach(string str, allgroups,
+ {
+ list<string> auft = splitstring(str,":");
+ if ( ! contains( [1 , 2], size(auft) ) ) { continue; }
+ // add one element, so that we have two in any case
+ auft = add(auft, "");
+ auft[0] = filterchars ( auft[0]:"err", validChars );
+ auft[1] = filterchars ( auft[1]:"err", validChars );
+ if ( auft[1]:"err"==nil ) { auft[1]=""; }
+ Group[`current] = add(Group[`current]:$[], auft[0]:"",auft[1]:"" );
+ });
+
+ readUsers(nil);
+
+ /* Error message */
+ if(false) Report::Error(_("Cannot read settings."));
+
+ sleep(200);
+
+ if(Abort()) return false;
+ /* Progress finished */
+ Progress::NextStage();
+ if(Abort()) return false;
+ modified = false;
+ return true;
+}
+
+
+
+
/**
* Read all edu-users settings
* @return true on success
*/
-global boolean Read() {
+global boolean OLDRead() {
/* EduUsers read dialog caption */
string caption = _("Initializing Edu Users Configuration");
@@ -216,6 +281,114 @@
return true;
}
+
+/**
+ * get recent users details
+ * @return map of user details
+ */
+global map getRecentUserDetailByUser(string username)
+{
+ // recent means - merge/filter the current, edit and delete maps
+ return $[];
+}
+
+
+/**
+ * get recent users details
+ * @return map of users details
+ */
+global map getRecentUsersDetails()
+{
+ // recent means - merge/filter the current, edit and delete maps
+ // FIXME for now just return the "current" map, to be filtered
+ return (map) User[`current]:$[];
+}
+
+/**
+ * get recent users
+ * @return list of user names
+ */
+global list<string> getRecentUsers()
+{
+ // recent means - merge/filter the current, edit and delete maps
+ return [];
+}
+
+
+/**
+ * get recent users by group
+ * @return list of users
+ */
+global list<string> getRecentUsersByGroup(string groupname)
+{
+ // recent means - merge/filter the current, edit and delete maps
+ return [];
+}
+
+
+/**
+ * get recent templates
+ * @return list of templates
+ */
+global list<string> getRecentTemplates()
+{
+ // recent means - merge/filter the current, edit and delete maps
+ return [];
+}
+
+
+/**
+ * get recent groups
+ * @return maplist of groups assiciated with templates
+ */
+global map getRecentGroupsTemplates()
+{
+ // recent means - merge/filter the current, edit and delete maps
+ // FIXME data has to be fetched with a filter over the current, edit and delete maps
+
+ map result = $[];
+
+ // for now still get the data from allgroups - to be fixed, see FIXME
+ foreach (string str, allgroups,
+ {
+ list<string> grp_tmpl = splitstring(str, ":");
+ if ( ! contains( [1 , 2], size(grp_tmpl) ) ) { continue; }
+ // add one element, so that we have two in any case
+ grp_tmpl = add(grp_tmpl, "");
+
+ grp_tmpl[0] = filterchars ( grp_tmpl[0]:"err", validChars );
+ grp_tmpl[1] = filterchars ( grp_tmpl[1]:"err", validChars );
+ if ( grp_tmpl[1]:"err"==nil ) { grp_tmpl[1]=""; }
+
+ result[(string)grp_tmpl[0]:"err"] = grp_tmpl[1]:"err";
+ });
+
+ return result;
+}
+
+
+/**
+ * get the templatename associated with a group
+ * @return string with groupname
+ */
+global string getRecentTemplateByGroup(string groupname)
+{
+ // recent means - merge/filter the current, edit and delete maps
+ return "";
+}
+
+
+/**
+ * get recent groups associated with a template
+ * @return list of groupnames
+ */
+global list<string> getRecentGroupsByTemplate(string templatename)
+{
+ // recent means - merge/filter the current, edit and delete maps
+ return [];
+}
+
+
/**
* get table of templates
* @return table of templates
@@ -238,43 +411,52 @@
return table_templates;
}
+
/**
- * get table of groups
- * @return table of groups
+ * get table of template items
+ * @return table of template items
*/
-global list<term> getGroupItems()
+global list<term> getTemplateItemList()
{
- integer count=0;
- list<term> table_groups = [];
- foreach (string str, allgroups,
- {
- list<string> grp_tmpl = splitstring(str, ":");
- if ( ! contains( [1 , 2], size(grp_tmpl) ) ) { continue; }
- // add one element, so that we have two in any case
- grp_tmpl = add(grp_tmpl, "");
+ list<term> result = [];
+ foreach(string templateName, getRecentTemplates(), {
+ result = add(result, `item(`id(templateName), templateName));
+ });
- grp_tmpl[0] = filterchars ( grp_tmpl[0]:"err", validChars );
- grp_tmpl[1] = filterchars ( grp_tmpl[1]:"err", validChars );
- if ( grp_tmpl[1]:"err"==nil ) { grp_tmpl[1]=""; }
+ return result;
+}
- table_groups = add(table_groups, (term)`item(`id(grp_tmpl[0]:sformat("%1",count)), grp_tmpl[0]:"err", grp_tmpl[1]:"err" ) );
- count=count+1;
+
+/**
+ * get items of group items
+ * @return table of group items with associated templates
+ */
+global list<term> getGroupItemList()
+{
+
+ list<term> result = [];
+ foreach(string groupName, string templateName, getRecentGroupsTemplates(), {
+ result = add(result, `item(`id(groupName), groupName, templateName ));
});
- return table_groups;
+ return result;
}
+
+
/**
* get table of users
* @return table of users
*/
global list<term> getUserItemList() {
- // `item(`id(`test2), "Geeko", "Green", "geeko", "Teen")
- // ];
-
- // `item(`id("login"), "Name", "Surname", "Login", "Age", "Password")
-
+ // return:
+ // [ `item(
+ // `id("login"), "Full Name", "Login", "Group"
+ // ),
+ // `item(...)
+ // ]
+ // temporary documentation: data that resides in User[`current]
// $["1000" :
// $[ "addit_data":"",
// "cn":"Peter S. Nelke",
@@ -289,23 +471,15 @@
// "userpassword":nil ]
list<term> result = [];
- //`current `change `delete
- foreach( string uidnumber, map userdetails, (map) User[`current]:$[], {
+
+ foreach( string uidnumber, map userdetails, (map) getRecentUsersDetails(), {
result = add(result, `item(`id(userdetails["uid"]:""), userdetails["cn"]:"", userdetails["uid"]:"", userdetails["groupname"]:"" ));
});
- y2milestone("UUsers %1", result);
+ // y2milestone("====> Users %1", result);
return result;
}
-global list<term> getUserItems() {
- return getUserItemList();
-}
-global term getUser()
-{
- string foo="bar";
- return `Empty();
-}
/**
Modified: branches/tmp/jdsn/edu-users/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/edu-users/src/dialogs.ycp?rev=50472&r1=50471&r2=50472&view=diff
==============================================================================
--- branches/tmp/jdsn/edu-users/src/dialogs.ycp (original)
+++ branches/tmp/jdsn/edu-users/src/dialogs.ycp Fri Aug 29 12:03:52 2008
@@ -197,14 +197,15 @@
any GroupsDialog() {
- list<term> groups = EduUsers::getGroupItems();
+ list<term> groups = EduUsers::getGroupItemList();
UI::ReplaceWidget(`id(`tabContent), `Table( `id(`edutable), `opt(`notify, `vstretch) , `header( _("Groups"), _("Templates") ), groups ) );
UI::ChangeWidget(`id(`edit), `Enabled, true);
UI::ChangeWidget(`id(`delete), `Enabled, true);
any ret = nil;
- while(true) {
+ while(true)
+ {
ret = UI::UserInput();
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org