Hiding a field

From ISPWiki

Jump to: navigation, search

The article bellow describes the procedure that you need to follow to delete a button, line, column, etc. from the interface. You won't be able to undo this. Consider the example on how to hide a button that is used for switching to User panel.

Describe this button in xml and add the if attribute, which specifies that this button will be displayed, if the specified condition is met. As we want to hide this button, the condition must never be met. Create a /usr/local/ispmgr/etc/ispmgr_mod_myhide.xml file with the following content

<?xml version="1.0" encoding="UTF-8"?>
    <metadata name="user">
            <toolbtn name="su" if="myhide"/>

and restart ISPmanager (killall ispmgr)

You can view the names of the modules and buttons in ispmgr.xml The if attribute can have any value that does not exist in ISPmanager.

The procedures described above can be applied to all the software products from our company. The prefixes in file names will differ, e.g. for BILLmanager you need to change ispmgr into billmgr.

Removing "unnecessary" functionality

Even though a button or field was hidden, the user still may continue using it and view the hidden fields via API.

Disable the functionality

To deny the user.su function, add the followings into the <mgrdata> tag

<handler name="hideaction.pl" type="cgi">
    <event before="yes">user.su</event>

The event handler addon/hideaction.pl:

print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<doc><skipaction/></doc>\n";

Hide a field from the table

The following example hides the owner field from the user list. Unlike the example mentioned above, the xml type is used here enabling to handle the result of the ISPmanager function:

<handler name="dropcol.pl" type="xml">
    <event after="yes">user</event>

The event handler addon/dropcol.pl:

use XML::LibXML;
my $d = XML::LibXML->new->parse_string(join "", <STDIN>);
for my $dead ($d->findnodes(q{//elem/owner})) {
print $d->toString;
Was this helpful? Yes | No
Personal tools