From: Cox, T. (NCI) <tc...@ma...> - 2002-01-28 14:22:29
|
Thank you Chris for your reply. The following is a small section of where my problem actually is: if($current_page == 0) { print "Please enter a name to edit:<br>(Use an * to perform a wildcard search)<br>"; }elsif($current_page == 1){ $input_name = param('Login Name'); $r = LDAPsearch("cn=$input_name","o=matrix"); if(!param('Login Name')){ print "Login Name field was left blank. Please go back and enter a login name to search on.<br>"; print submit(-name=>'go',-value=>'Start Page') if $current_page > 0; $flag = 1; }elsif($r->entries) { print "Current page: $page_name<br>"; print "<br>User(s) matching search request:<br>"; foreach my $entry ($r->entries){ $user = $entry->dn; push(@userList,$user); # I have tried to come up with a way to store the information in a hash but haven't had much luck } print popup_menu(-name=> 'Login Name',-size=>1, -VALUES => [ @userList ]); $flag=1; print "<p>Please select a user to continue.<br>", hidden(-name=>'page',-value=>$current_page,-override=>1), submit(-name=>'go',-value=>'Previous Page'), submit(-name=>'go',-value=>'Get Attributes'); }else{ print p("Attribute Information for: "), param('Login Name'); # At this point I need to have the selected user and attributes. } } The code above is part of a subroutine called draw_form(). After the above condition it will display the fields I want the user to be able to modify. I have a @attribute array so that the search only returns the values I want. Any thoughts are greatly appreciated. Todd -----Original Message----- From: Chris Ridd [mailto:chr...@me...] Sent: Monday, January 28, 2002 8:51 AM To: Cox, Todd (NCI); per...@li... Subject: Re: Search processing question "Cox, Todd (NCI)" <tc...@ma...> wrote: > Good morning all, > > I have a CGI program that lets an administrator search for users using the > Net::LDAP module. The psudeo code is: > > 1) Enter a string to search on (e.g. cox*) > 2) Return the result in a pick box. > 3) Re-draw the form with two tables; One with the current attribute values > of the user selected, the other with text fields to change the values. > 4) Foreach text field that has a new value change the value. > > > The problem with my program is around step two. I can get the pick box to > display the search results but I am having difficulty selecting the values > for the one DN that was selected by the administrator and passing the > current values to the first table. Presumably your search in step 1 is returning the attribute that you are trying to change. What your form basically needs to do is create a pair of fields for each value of the attribute. The first field in each pair should be a hidden field, and should contain the old value of the attribute (initialized from the search results), and the second field in each pair should be a simple text field initialized with the same value. When the user does the "Submit", compare all the 'old' values in the hidden fields with the new values in the text fields, this should give you enough information to do a minimal modify operation on the entry. The operation still isn't guaranteed to succeed of course; another client might modify the entry in between your steps 1 and 4. > I have tried building a hash of hashes while processing my search results > to store and pick later but I haven't had much luck. Does anyone have any > thoughts on a multi-form CGI using Net::LDAP? > > Todd Cox > National Cancer Institute > Rockville, MD > Cheers, Chris |