[yast-commit] r48620 - in /trunk/ldap-server/src: tree_structure.ycp widgets.ycp
Author: rhafer Date: Fri Jun 27 15:58:44 2008 New Revision: 48620 URL: http://svn.opensuse.org/viewcvs/yast?rev=48620&view=rev Log: - blacklist already indexed Attributs in AddIndexPopup() - return new IndexMap from AddIndexPopup() Modified: trunk/ldap-server/src/tree_structure.ycp trunk/ldap-server/src/widgets.ycp Modified: trunk/ldap-server/src/tree_structure.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/tree_structure.ycp?rev=48620&r1=48619&r2=48620&view=diff ============================================================================== --- trunk/ldap-server/src/tree_structure.ycp (original) +++ trunk/ldap-server/src/tree_structure.ycp Fri Jun 27 15:58:44 2008 @@ -1013,9 +1013,21 @@ define boolean cb_input_bdb_index() { y2milestone("cb_input_bdb_index, handlercmd: %1", handler_cmd); + integer index = (integer) widget_map[current_tree_item, "index"]:nil; if ( handler_cmd == `pb_idx_add ) { - AddIndexPopup(); + map<string, map<string, boolean> > idxMap = LdapServer::GetDatabaseIndexes( index ); + list<string> skip = []; // skip attribute that already have an index defined + foreach( string attr, map<string, boolean> idx, idxMap, + { + skip = add( skip, attr ); + } + ); + map<string,any> newIdx = AddIndexPopup(skip); + if ( size(newIdx) > 0 ) + { + } + } return true; } Modified: trunk/ldap-server/src/widgets.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/widgets.ycp?rev=48620&r1=48619&r2=48620&view=diff ============================================================================== --- trunk/ldap-server/src/widgets.ycp (original) +++ trunk/ldap-server/src/widgets.ycp Fri Jun 27 15:58:44 2008 @@ -390,8 +390,9 @@ ) ); - define boolean AddIndexPopup() + define map<string,any> AddIndexPopup( list<string> skipAttrs ) { + y2milestone("AddIndexPopup skipAttrs: %1", skipAttrs ); term content = `VBox( `Heading( _("Add Index") ), @@ -414,7 +415,9 @@ (map<string, map <string,boolean> >) SCR::Read( .ldapserver.schema.attributeTypes ); list<string> items = []; foreach(string key, map<string,boolean> idx, attrTypes, { - items = add( items, key ); + if ( nil == find( string elem, skipAttrs, ``( tolower(elem) == tolower(key) ) ) ) { + items = add( items, key ); + } } ); items = lsort(items); UI::OpenDialog( `opt(`decorated), content ); @@ -443,14 +446,19 @@ UI::ChangeWidget( `cb_idx_pres, `Enabled, false ); } + map<string,any> retval = $[]; while (true) { any ret = UI::UserInput(); y2milestone("ret = %1", ret ); + if (ret == `pb_cancel ) + { + break; + } + selectedAttr = (string) UI::QueryWidget( `cb_attrs, `Value ); + y2milestone("selected Attribute \"%1\"", selectedAttr ); if ( ret == `cb_attrs ) // Attribute selected in the Combobox { - selectedAttr = (string) UI::QueryWidget( `cb_attrs, `Value ); - y2milestone("selected Attribute \"%1\"", selectedAttr ); map <string, boolean> idxOpt = attrTypes[selectedAttr]:nil ; y2milestone("index opts: %1", idxOpt ); if ( idxOpt["equality"]:false ) @@ -471,15 +479,17 @@ } else { UI::ChangeWidget( `cb_idx_pres, `Enabled, false ); } - } else if (ret == `pb_cancel ) - { - break; } else if (ret == `pb_ok ) { + retval["name"] = selectedAttr; + retval["pres"] = UI::QueryWidget( `cb_idx_pres, `Value ); + retval["eq"] = UI::QueryWidget( `cb_idx_eq, `Value ); + retval["substr"] = UI::QueryWidget( `cb_idx_substr, `Value ); + y2milestone("new index: %1", newidx ); break; } } UI::CloseDialog(); - return true; + return retval; } } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
rhafer@svn.opensuse.org