[ic] Problem with ui_sequence edit

Scott Andreas interchange-users@interchange.redhat.com
Wed Mar 13 18:23:00 2002


Hello list,

My problem is that I want to sequence checkbox list of contacts with in the
UI. So far I have the first record in the sequence showing up but the
subsequent records are not showing up so here I am posting my problem to the
list.

On my results page I have...

<!-- sequence_edit: [cgi ui_sequence_edit] -->
<!-- item_id_left: [cgi item_id_left] -->
[perl tables="contacts"]
	delete $Scratch->{ui_location};
	if($CGI->{ui_sequence_edit}) {
		my $doit;
		if($CGI->{item_id_left} =~ s/^(.*?),//) {
			$CGI->{item_id} = $1;
			$doit = 1;
		}
		elsif ($CGI->{item_id_left}) {
			$CGI->{item_id} = delete $CGI->{item_id_left};
			delete $CGI->{ui_sequence_edit};
			$doit = 1;
		}
		else {
			delete $CGI->{item_id};
			delete $CGI->{ui_sequence_edit};
		}
		return unless $doit;
		$Scratch->{ui_location}
				= $Tag->area( {
						href => '__UI_BASE__/contacts_all',
						secure => $Scratch->{page_secure},
						form => qq{
							item_id=$CGI->{item_id}
							item_id_left=$CGI->{item_id_left}
							ui_sequence_edit=$CGI->{ui_sequence_edit}
							ui_return_to=__UI_BASE__/contacts
							ui_return_to=mv_data_table=$CGI->{contacts}
							ui_return_to=ui_sequence_edit=$CGI->{ui_sequence_edit}
							ui_page_banner=Edit next key $CGI->{item_id}
						},
					});
		return;
	}

	my $tab = $CGI->{contacts} or return;
	my $db = $Db{$tab};
	if(! $db) {
		$Scratch->{ui_error} = errmsg('no %s database', $tab);
		$Scratch->{ui_location} = $Tag->area({href=>"__UI_BASE__/error",
            secure=>$Scratch->{page_secure}});
		return;
	}

	delete $Scratch->{tmp_large};
	if( $Variable->{UI_LARGE_TABLE} =~ /\b$tab\b/ or $db->config('LARGE') ) {
		$Scratch->{tmp_large} = 1;
	}

	return unless $CGI->{item_id};
	return unless delete $CGI->{deleterecords};
	return unless $Tag->if_mm('tables', '=d');

	delete $Scratch->{ui_location};
	$Config->{NoSearch} = '';

	for(grep $_, @{$CGI_array->{item_id}}) {
		$db->delete_record($_)
			or push @errors, $@;
	}
	if(@errors) {
		my $plural = @errors > 1 ? 's' : '';
		return "<FONT CLASS=error>Error$plural:<UL><LI>" .
				join ("<LI>", @errors)                    .
				"</UL></FONT><BR>";
	}
	return;
[/perl]

With form variables of

<FORM ACTION="[process]">
<INPUT TYPE=hidden NAME=mv_nextpage VALUE="@@MV_PAGE@@">
<INPUT TYPE=hidden NAME=mv_todo VALUE=back>
<INPUT TYPE=hidden NAME=ui_return_to VALUE="admin/search">
<INPUT TYPE=hidden NAME=ui_return_to VALUE="ui_sequence_edit=1">
<INPUT TYPE=checkbox NAME=item_id VALUE="[sql-code]">
.
.
.
[button text="[L]Edit checked records in sequence[/L]"]
ui_sequence_edit=[calc]
	$CGI->{item_id_left} = $CGI->{item_id};
	$CGI->{item_id_left} =~ s/\0+/,/g;
	if($CGI->{item_id_left} =~ s/^(.*?),//) {
		$CGI->{item_id} = $1;
		return 1;
	}
	else {
		delete $CGI->{item_id_left};
		return '';
	}
[/calc]
mv_nextpage=__UI_BASE__/contact_all
mv_todo=return
[/button]
</FORM>

My environment shows
'ui_hide_key' => 1,
                             'customer' => '280956',
                             'noshow' => 1,
                             'mv_data_table' => 'contacts',
                             'item_id' => '280956',
                             'ui_sequence_edit' => '1',
                             'item_id_left' => '280983,282818'

Any help would be appreciated

Thanks

J. Scott Andreas :)
IS/Programmer/WebDevelopement
Learning Services, Inc.
e-mail: sandreas@learningservicesinc.com
phone: 1-800-877-9378 ext. 146
fax: (541) 744-2056
               o
     ---   _-\<,_
      --- (_)/ (_)