[ic] mini howto for ui custom table edit plus flex_select.html fix

Jonathan Clark jonc@webmaint.com
Wed, 4 Apr 2001 23:08:12 +0100


[ic 4.6.4]

Dear all, I have just worked out how to add a custom table edit to submenu
item to the ui, so I thought I would share it with you.

In doing this I have found a small bugette in flex_select.html which is
documented at the bottom and needed for you to specify specific fields and
headings instead of getting all.

have fun!

Jonathan
Webmaint.

---

Mini howto: Making mods to the ui - using the flex select / flex editor to
allow editing of an arbitary table.

You can a menu subitem to allow the editing of a table of your choice as
follows:

Edit the catalog_before.cfg to add the menu item to the appropriate top
level menu
eg. line 3 of this variable adds a new item to the Content Menu which will
be called 'My Table' to edit mytable:

Variable UI_SUBMENU_Content <<EOV
code	next_line	indicator	depends_on	page	form	name
1				__UI_BASE__/page		Page Edit
2				__UI_BASE__/genupload		File Transfer
3				__UI_BASE__/flex_select	ui_show_fields=field1
field2&ui_description_fields=FieldHead1 FieldHead2&page_title=My Table
Editor&mv_data_table=mytable	My Table
EOV

This variable 'table' has / can have the following collumns, which are tab
separated:

code - incremental numeric
next_line - set to 1 to force a new line of submenu items
indicator -  a cgi variable name which must be non-null for this subitem be
highlighted????
depends_on - a cgi variable name which must be non-null for this subitem to
appear.
exclude_on - a cgi variable name which must be non-null for this subitem not
to appear.
page - the admin page to link to.
form - name, value pairs to set on page entry. These will form part of the
url.
name - The text to show as the submenu item

flex_select page params
=======================

the following parameters can be passed to the flex_select in the form
element of the above table:

mv_table_data - required. the table you want to display / edit.
page_title - the text to be used as the page title in the browser.
page_banner - the text to appear below the menu section.
icon_name - the path/name of the image to appear before the banner, will be
prepended with __UI_IMG__.
ui_text_qualification - a FIELD=VALUE pair or VALUE used to filter the list.
 (converted into co=1/op=eq/se=VALUE/sf=FIELD for a pair, se=VALUE if just a
value)
ui_show_fields - the fields to show in the list. (see bugfix below)
ui_list_size - the number of lines to return per page (ic: ml=)
ui_sort_field - field to order the list by (ic: tf=)
ui_sort_option - the sort type (ic: to=)
ui_description_fields - the column headings to use instead of the field
names. (see bugfix below)

ui_flex_key - not worked out this one yet??

help_name - name of the help page. will be prepended with
__UI_HELP_BASE_URL__.


---

bugfix: flex_editor.html

allow the use of the ui_show_fields and ui_description_fields cgi params in
the flex editor.
[ic 4.6.4]

line 239 on was:

	if(! ($CGI->{ui_show_fields} = $meta->{field}) ) {
		$CGI->{ui_show_fields} = '*';
		$CGI->{ui_description_fields} = join ",", $ref->columns();
	}
	else {
		$CGI->{ui_show_fields} =~ s/[\0,\s]+/,/g;
		$CGI->{ui_description_fields} = $CGI->{ui_show_fields};
	}

which appears to check against a field called 'field' of the table being
displayed and so will usually set ui_show_fields to '*'.

change to:

	if(!$CGI->{ui_show_fields}) {
		$CGI->{ui_show_fields} = '*';
		$CGI->{ui_description_fields} = join ",", $ref->columns();
	}
	else {
		$CGI->{ui_show_fields} =~ s/[\0,\s]+/,/g;
		$CGI->{ui_description_fields} = $CGI->{ui_show_fields} if
(!$CGI->{ui_description_fields});
	}

that's it!