r2071 + status messages encoding in the URI: upgrade the functions and do the "OK...
authorDenis Ovsienko <infrastation@yandex.ru>
Sun, 20 Jul 2008 19:31:52 +0000 (19:31 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Sun, 20 Jul 2008 19:31:52 +0000 (19:31 +0000)
inc/functions.php
inc/interface.php
inc/navigation.php
inc/ophandlers.php

index ef57deb..4e4cff3 100644 (file)
@@ -1570,28 +1570,36 @@ function getTagFilterStr ($tagfilter = array())
        return $ret;
 }
 
-function buildWideRedirectURL ($log, $p = NULL, $t = NULL)
+function buildWideRedirectURL ($log, $nextpage = NULL, $nexttab = NULL)
 {
        global $root, $page, $pageno, $tabno;
-       if ($p === NULL)
-               $p = $pageno;
-       if ($t === NULL)
-               $t = $tabno;
-       $url = "${root}?page=${p}&tab=${t}";
-       if (isset ($page[$p]['bypass']))
-               $url .= '&' . $page[$p]['bypass'] . '=' . $_REQUEST[$page[$p]['bypass']];
+       if ($nextpage === NULL)
+               $nextpage = $pageno;
+       if ($nexttab === NULL)
+               $nexttab = $tabno;
+       $url = "${root}?page=${nextpage}&tab=${nexttab}";
+       if (isset ($page[$nextpage]['bypass']))
+               $url .= '&' . $page[$nextpage]['bypass'] . '=' . $_REQUEST[$page[$nextpage]['bypass']];
        $url .= "&log=" . urlencode (base64_encode (serialize ($log)));
        return $url;
 }
 
-function buildRedirectURL_OK ($text, $p = NULL, $t = NULL)
+function buildRedirectURL_OK ($args = array(), $nextpage = NULL, $nexttab = NULL)
 {
-       return buildWideRedirectURL (array (array ('code' => 'success', 'message' => $text)), $p, $t);
+       global $msgcode, $pageno, $tabno, $op;
+       if ($nextpage === NULL)
+               $nextpage = $pageno;
+       if ($nexttab === NULL)
+               $nexttab = $tabno;
+       $code = $msgcode[$pageno][$tabno][$op]['OK'];
+       $log = array ('v' => 2);
+       $log['m'][] = count ($args) ? array ('c' => $code, 'a' => $args) : array ('c' => $code);
+       return buildWideRedirectURL ($log, $nextpage, $nexttab);
 }
 
-function buildRedirectURL_ERR ($text, $p = NULL, $t = NULL)
+function buildRedirectURL_ERR ($text, $nextpage = NULL, $nexttab = NULL)
 {
-       return buildWideRedirectURL (array (array ('code' => 'error', 'message' => $text)), $p, $t);
+       return buildWideRedirectURL (array (array ('code' => 'error', 'message' => $text)), $nextpage, $nexttab);
 }
 
 function validTagName ($s, $allow_autotag = FALSE)
index 13c0751..b6d989c 100644 (file)
@@ -1244,10 +1244,135 @@ function renderIPv4ForObject ($object_id = 0)
 
 }
 
+// Log structure versions:
+// 1: the whole structure is a list of code-message pairs
+// 2 and later: there's a "v" field set, which indicates the version
+// 2: there's a "m" list set to hold message code and optional arguments
 function printLog ($log)
 {
-       foreach ($log as $record)
-               echo "<div class=msg_${record['code']}>${record['message']}</div>";
+       switch (TRUE)
+       {
+               case !isset ($log['v']):
+                       foreach ($log as $key => $record)
+                               if ($key != 'v')
+                                       echo "<div class=msg_${record['code']}>${record['message']}</div>";
+                       break;
+               case $log['v'] == 2:
+                       $msginfo = array
+                       (
+                               1 => array ('code' => 'success', 'format' => '%u new records done, %u already existed'),
+                               2 => array ('code' => 'success', 'format' => 'NATv4 rule was successfully added.'),
+                               3 => array ('code' => 'success', 'format' => 'NATv4 rule was successfully deleted.'),
+                               4 => array ('code' => 'success', 'format' => 'NATv4 rule was successfully updated'),
+                               5 => array ('code' => 'success', 'format' => 'Port %s was added successfully'),
+                               6 => array ('code' => 'success', 'format' => 'Port %s was updated successfully'),
+                               7 => array ('code' => 'success', 'format' => 'Port %s was deleted successfully'),
+                               8 => array ('code' => 'success', 'format' => 'Port %s successfully linked with port %s at object %s'),
+                               9 => array ('code' => 'success', 'format' => 'Port %s was successfully unlinked from %s@%s'),
+                               10 => array ('code' => 'success', 'format' => 'Added %u ports, updated %u ports, encountered %u errors.'),
+                               11 => array ('code' => 'success', 'format' => 'Reservation removed.'),
+                               12 => array ('code' => 'success', 'format' => 'allocation updated'),
+                               13 => array ('code' => 'success', 'format' => 'allocated'),
+                               14 => array ('code' => 'success', 'format' => 'deallocated'),
+                               15 => array ('code' => 'success', 'format' => 'Reset succeeded.'),
+                               16 => array ('code' => 'success', 'format' => 'Update done'),
+                               17 => array ('code' => 'success', 'format' => 'Update(s) succeeded.'),
+                               18 => array ('code' => 'success', 'format' => 'Load balancer was successfully added'),
+                               19 => array ('code' => 'success', 'format' => 'Load balancer was successfully deleted'),
+                               20 => array ('code' => 'success', 'format' => 'Load balancer info was successfully updated'),
+                               21 => array ('code' => 'success', 'format' => 'Generation complete'),
+                               22 => array ('code' => 'success', 'format' => 'Chained %u tags'),
+                               23 => array ('code' => 'success', 'format' => 'IPv4 prefix successfully added'),
+                               24 => array ('code' => 'success', 'format' => 'IPv4 prefix deleted'),
+                               25 => array ('code' => 'success', 'format' => 'IPv4 prefix updated'),
+                               26 => array ('code' => 'success', 'format' => '%u IP address(es) were successfully updated'),
+                               27 => array ('code' => 'success', 'format' => 'IPv4 address updated'),
+                               28 => array ('code' => 'success', 'format' => 'Virtual service was successfully created'),
+                               29 => array ('code' => 'success', 'format' => 'Virtual service was successfully deleted'),
+                               30 => array ('code' => 'success', 'format' => 'Virtual service was successfully updated'),
+                               31 => array ('code' => 'success', 'format' => 'RS pool was successfully created'),
+                               32 => array ('code' => 'success', 'format' => 'RS pool was successfully deleted'),
+                               33 => array ('code' => 'success', 'format' => 'RS pool was successfully updated'),
+                               34 => array ('code' => 'success', 'format' => 'Real server was successfully added'),
+                               35 => array ('code' => 'success', 'format' => 'Real server was successfully deleted'),
+                               36 => array ('code' => 'success', 'format' => 'Real server was successfully updated'),
+                               37 => array ('code' => 'success', 'format' => 'Successfully added %u real servers'),
+                               38 => array ('code' => 'success', 'format' => '%u real server(s) were successfully (de)activated'),
+                               39 => array ('code' => 'success', 'format' => 'User account %s updated.'),
+                               40 => array ('code' => 'success', 'format' => 'User account %s created.'),
+                               41 => array ('code' => 'success', 'format' => 'User account disabled.'),
+                               42 => array ('code' => 'success', 'format' => 'User account enabled.'),
+                               43 => array ('code' => 'success', 'format' => 'Saved successfully.'),
+                               44 => array ('code' => 'success', 'format' => '%s failures and %s successfull changes.'),
+                               45 => array ('code' => 'success', 'format' => "Attribute '%s' created."),
+                               46 => array ('code' => 'success', 'format' => 'Rename successful.'),
+                               47 => array ('code' => 'success', 'format' => 'Attribute was deleted.'),
+                               48 => array ('code' => 'success', 'format' => 'Supplement succeeded.'),
+                               49 => array ('code' => 'success', 'format' => 'Reduction succeeded.'),
+                               50 => array ('code' => 'success', 'format' => 'Reduction succeeded.'),
+                               51 => array ('code' => 'success', 'format' => 'Update succeeded.'),
+                               52 => array ('code' => 'success', 'format' => 'Supplement succeeded.'),
+                               53 => array ('code' => 'success', 'format' => 'Chapter was deleted.'),
+                               54 => array ('code' => 'success', 'format' => 'Chapter was updated.'),
+                               55 => array ('code' => 'success', 'format' => 'Chapter was added.'),
+                               56 => array ('code' => 'success', 'format' => 'Update succeeded.'),
+                               57 => array ('code' => 'success', 'format' => 'Reset complete'),
+                               58 => array ('code' => 'success', 'format' => "Successfully deleted tag ."),
+                               59 => array ('code' => 'success', 'format' => "Created tag '%s'."),
+                               60 => array ('code' => 'success', 'format' => "Updated tag '%s'."),
+                               61 => array ('code' => 'success', 'format' => 'Password changed successfully.')
+                       );
+                       // Handle the arguments. Is there any better way to do it?
+                       foreach ($log['m'] as $record)
+                       {
+                               if (isset ($record['a']))
+                                       switch (count ($record['a']))
+                                       {
+                                               case 1:
+                                                       $msgtext = sprintf
+                                                       (
+                                                               $msginfo[$record['c']]['format'],
+                                                               $record['a'][0]
+                                                       );
+                                                       break;
+                                               case 2:
+                                                       $msgtext = sprintf
+                                                       (
+                                                               $msginfo[$record['c']]['format'],
+                                                               $record['a'][0],
+                                                               $record['a'][1]
+                                                       );
+                                                       break;
+                                               case 3:
+                                                       $msgtext = sprintf
+                                                       (
+                                                               $msginfo[$record['c']]['format'],
+                                                               $record['a'][0],
+                                                               $record['a'][1],
+                                                               $record['a'][2]
+                                                       );
+                                                       break;
+                                               case 4:
+                                               default:
+                                                       $msgtext = sprintf
+                                                       (
+                                                               $msginfo[$record['c']]['format'],
+                                                               $record['a'][0],
+                                                               $record['a'][1],
+                                                               $record['a'][2],
+                                                               $record['a'][3]
+                                                       );
+                                                       break;
+                                       }
+                               else
+                                       $msgtext = $msginfo[$record['c']]['format'];
+                               echo '<div class=msg_' . $msginfo[$record['c']]['code'] . ">${msgtext}</div>";
+                       }
+                       break;
+               default:
+                       echo '<div class=msg_error>' . __FUNCTION__ . ': internal error</div>';
+                       break;
+       }
 }
 
 /*
index cdca0ff..da60f4a 100644 (file)
@@ -12,6 +12,7 @@ $ophandler = array();
 $tabhandler = array();
 $tabextraclass = array();
 $delayauth = array();
+$msgcode = array();
 
 $page['index']['title'] = 'Main page';
 $page['index']['handler'] = 'renderIndex';
@@ -45,6 +46,7 @@ $tabhandler['row']['default'] = 'renderRow';
 $tabhandler['row']['newrack'] = 'renderNewRackForm';
 $tabhandler['row']['tagroller'] = 'renderTagRollerForRow';
 $ophandler['row']['tagroller']['rollTags'] = 'rollTags';
+$msgcode['row']['tagroller']['rollTags']['OK'] = 1;
 
 $page['rack']['title_handler'] = 'dynamic_title_rack';
 $page['rack']['bypass'] = 'rack_id';
@@ -134,6 +136,27 @@ $ophandler['object']['editrspvs']['addLB'] = 'addLoadBalancer';
 $ophandler['object']['editrspvs']['delLB'] = 'deleteLoadBalancer';
 $ophandler['object']['editrspvs']['updLB'] = 'updateLoadBalancer';
 $delayauth['object']['livevlans']['setPortVLAN'] = TRUE;
+$msgcode['object']['nat4']['addNATv4Rule']['OK'] = 2;
+$msgcode['object']['nat4']['delNATv4Rule']['OK'] = 3;
+$msgcode['object']['nat4']['updNATv4Rule']['OK'] = 4;
+$msgcode['object']['ports']['addPort']['OK'] = 5;
+$msgcode['object']['ports']['editPort']['OK'] = 6;
+$msgcode['object']['ports']['delPort']['OK'] = 7;
+$msgcode['object']['ports']['linkPort']['OK'] = 8;
+$msgcode['object']['ports']['unlinkPort']['OK'] = 9;
+$msgcode['object']['ports']['addMultiPorts']['OK'] = 10;
+$msgcode['object']['ports']['useup']['OK'] = 11;
+$msgcode['object']['ipv4']['updIPv4Allocation']['OK'] = 12;
+$msgcode['object']['ipv4']['addIPv4Allocation']['OK'] = 13;
+$msgcode['object']['ipv4']['delIPv4Allocation']['OK'] = 14;
+$msgcode['object']['edit']['clearSticker']['OK'] = 15;
+$msgcode['object']['edit']['update']['OK'] = 16;
+$msgcode['object']['edit']['updateStickers']['OK'] = 17;
+$msgcode['object']['editrspvs']['addLB']['OK'] = 18;
+$msgcode['object']['editrspvs']['delLB']['OK'] = 19;
+$msgcode['object']['editrspvs']['updLB']['OK'] = 20;
+$msgcode['object']['autoports']['generate']['OK'] = 21;
+$msgcode['object']['tags']['saveTags']['OK'] = 22;
 
 $page['ipv4space']['title'] = 'IPv4 space';
 $page['ipv4space']['parent'] = 'index';
@@ -143,6 +166,8 @@ $tabhandler['ipv4space']['default'] = 'renderAddressspace';
 $tabhandler['ipv4space']['newrange'] = 'renderAddNewRange';
 $ophandler['ipv4space']['newrange']['addIPv4Prefix'] = 'addIPv4Prefix';
 $ophandler['ipv4space']['newrange']['delIPv4Prefix'] = 'delIPv4Prefix';
+$msgcode['ipv4space']['newrange']['addIPv4Prefix']['OK'] = 23;
+$msgcode['ipv4space']['newrange']['delIPv4Prefix']['OK'] = 24;
 
 $page['iprange']['title_handler'] = 'dynamic_title_iprange';
 $page['iprange']['parent'] = 'ipv4space';
@@ -162,6 +187,8 @@ $trigger['iprange']['tags'] = 'trigger_tags';
 $ophandler['iprange']['properties']['editRange'] = 'editRange';
 $ophandler['iprange']['liveptr']['importPTRData'] = 'importPTRData';
 $ophandler['iprange']['tags']['saveTags'] = 'saveIPv4PrefixTags';
+$msgcode['iprange']['properties']['editRange']['OK'] = 25;
+$msgcode['iprange']['liveptr']['importPTRData']['OK'] = 26;
 
 $page['ipaddress']['title_handler'] = 'dynamic_title_ipaddress';
 $page['ipaddress']['parent'] = 'iprange';
@@ -180,6 +207,7 @@ $ophandler['ipaddress']['properties']['editAddress'] = 'editAddress';
 $ophandler['ipaddress']['assignment']['delIPv4Allocation'] = 'delIPv4Allocation';
 $ophandler['ipaddress']['assignment']['updIPv4Allocation'] = 'updIPv4Allocation';
 $ophandler['ipaddress']['assignment']['addIPv4Allocation'] = 'addIPv4Allocation';
+$msgcode['ipaddress']['properties']['editAddress']['OK'] = 27;
 
 $page['ipv4slb']['title'] = 'IPv4 SLB';
 $page['ipv4slb']['parent'] = 'index';
@@ -194,6 +222,9 @@ $tabhandler['ipv4vslist']['edit'] = 'renderVSListEditForm';
 $ophandler['ipv4vslist']['edit']['add'] = 'addVService';
 $ophandler['ipv4vslist']['edit']['del'] = 'deleteVService';
 $ophandler['ipv4vslist']['edit']['upd'] = 'updateVService';
+$msgcode['ipv4vslist']['edit']['add']['OK'] = 28;
+$msgcode['ipv4vslist']['edit']['del']['OK'] = 29;
+$msgcode['ipv4vslist']['edit']['upd']['OK'] = 30;
 
 $page['ipv4vs']['title_handler'] = 'dynamic_title_vservice';
 $page['ipv4vs']['parent'] = 'ipv4vslist';
@@ -215,6 +246,7 @@ $ophandler['ipv4vs']['editlblist']['addLB'] = 'addLoadBalancer';
 $ophandler['ipv4vs']['editlblist']['delLB'] = 'deleteLoadBalancer';
 $ophandler['ipv4vs']['editlblist']['updLB'] = 'updateLoadBalancer';
 $trigger['ipv4vs']['tags'] = 'trigger_tags';
+$msgcode['ipv4vs']['editlblist'] = $msgcode['object']['editrspvs'];
 
 $page['ipv4rsplist']['title'] = 'RS pools';
 $page['ipv4rsplist']['parent'] = 'ipv4slb';
@@ -225,6 +257,9 @@ $tabhandler['ipv4rsplist']['edit'] = 'editRSPools';
 $ophandler['ipv4rsplist']['edit']['add'] = 'addRSPool';
 $ophandler['ipv4rsplist']['edit']['del'] = 'deleteRSPool';
 $ophandler['ipv4rsplist']['edit']['upd'] = 'updateRSPool';
+$msgcode['ipv4rsplist']['edit']['add']['OK'] = 31;
+$msgcode['ipv4rsplist']['edit']['del']['OK'] = 32;
+$msgcode['ipv4rsplist']['edit']['upd']['OK'] = 33;
 
 $page['ipv4rsp']['title_handler'] = 'dynamic_title_rspool';
 $page['ipv4rsp']['parent'] = 'ipv4rsplist';
@@ -256,6 +291,12 @@ $ophandler['ipv4rsp']['editlblist']['updLB'] = 'updateLoadBalancer';
 $ophandler['ipv4rsp']['rsinservice']['upd'] = 'updateRSInService';
 $ophandler['ipv4rsp']['tags']['saveTags'] = 'saveIPv4RSPoolTags';
 $ophandler['ipv4rsp']['edit']['updIPv4RSP'] = 'updateRSPool';
+$msgcode['ipv4rsp']['editrslist']['addRS']['OK'] = 34;
+$msgcode['ipv4rsp']['editrslist']['delRS']['OK'] = 35;
+$msgcode['ipv4rsp']['editrslist']['updRS']['OK'] = 36;
+$msgcode['ipv4rsp']['editrslist']['addMany']['OK'] = 37;
+$msgcode['ipv4rsp']['editlblist'] = $msgcode['object']['editrspvs'];
+$msgcode['ipv4rsp']['rsinservice']['upd']['OK'] = 38;
 
 $page['rservers']['title'] = 'Real servers';
 $page['rservers']['parent'] = 'ipv4slb';
@@ -284,6 +325,10 @@ $ophandler['userlist']['edit']['updateUser'] = 'updateUser';
 $ophandler['userlist']['edit']['createUser'] = 'createUser';
 $ophandler['userlist']['edit']['disableUser'] = 'disableUser';
 $ophandler['userlist']['edit']['enableUser'] = 'enableUser';
+$msgcode['userlist']['edit']['updateUser']['OK'] = 39;
+$msgcode['userlist']['edit']['createUser']['OK'] = 40;
+$msgcode['userlist']['edit']['disableUser']['OK'] = 41;
+$msgcode['userlist']['edit']['enableUser']['OK'] = 42;
 
 $page['user']['title_handler'] = 'dynamic_title_user';
 $page['user']['parent'] = 'userlist';
@@ -304,6 +349,7 @@ $tab['perms']['edit'] = 'Edit';
 $tabhandler['perms']['default'] = 'renderRackCodeViewer';
 $tabhandler['perms']['edit'] = 'renderRackCodeEditor';
 $ophandler['perms']['edit']['saveRackCode'] = 'saveRackCode';
+$msgcode['perms']['edit']['saveRackCode']['OK'] = 43;
 
 $page['portmap']['title'] = 'Port compatibility map';
 $page['portmap']['parent'] = 'config';
@@ -312,6 +358,7 @@ $tab['portmap']['edit'] = 'Change';
 $tabhandler['portmap']['default'] = 'renderPortMapViewer';
 $tabhandler['portmap']['edit'] = 'renderPortMapEditor';
 $ophandler['portmap']['edit']['save'] = 'savePortMap';
+$msgcode['portmap']['edit']['save']['OK'] = 44;
 
 $page['attrs']['title'] = 'Attributes';
 $page['attrs']['parent'] = 'config';
@@ -326,6 +373,11 @@ $ophandler['attrs']['editattrs']['upd'] = 'changeAttribute';
 $ophandler['attrs']['editattrs']['del'] = 'deleteAttribute';
 $ophandler['attrs']['editmap']['add'] = 'supplementAttrMap';
 $ophandler['attrs']['editmap']['del'] = 'reduceAttrMap';
+$msgcode['attrs']['editattrs']['add']['OK'] = 45;
+$msgcode['attrs']['editattrs']['upd']['OK'] = 46;
+$msgcode['attrs']['editattrs']['del']['OK'] = 47;
+$msgcode['attrs']['editmap']['add']['OK'] = 48;
+$msgcode['attrs']['editmap']['del']['OK'] = 49;
 
 $page['dict']['title'] = 'Dictionary';
 $page['dict']['parent'] = 'config';
@@ -341,6 +393,12 @@ $ophandler['dict']['edit']['add'] = 'supplementDictionary';
 $ophandler['dict']['chapters']['del'] = 'delChapter';
 $ophandler['dict']['chapters']['upd'] = 'updateChapter';
 $ophandler['dict']['chapters']['add'] = 'addChapter';
+$msgcode['dict']['edit']['del']['OK'] = 50;
+$msgcode['dict']['edit']['upd']['OK'] = 51;
+$msgcode['dict']['edit']['add']['OK'] = 52;
+$msgcode['dict']['chapters']['del']['OK'] = 53;
+$msgcode['dict']['chapters']['upd']['OK'] = 54;
+$msgcode['dict']['chapters']['add']['OK'] = 55;
 
 $page['ui']['title'] = 'User interface';
 $page['ui']['parent'] = 'config';
@@ -352,6 +410,8 @@ $tabhandler['ui']['edit'] = 'renderUIConfigEditForm';
 $tabhandler['ui']['reset'] = 'renderUIResetForm';
 $ophandler['ui']['edit']['upd'] = 'updateUI';
 $ophandler['ui']['reset']['go'] = 'resetUIConfig';
+$msgcode['ui']['edit']['upd']['OK'] = 56;
+$msgcode['ui']['reset']['go']['OK'] = 57;
 
 $page['tagtree']['title'] = 'Tag tree';
 $page['tagtree']['parent'] = 'config';
@@ -362,6 +422,9 @@ $tabhandler['tagtree']['edit'] = 'renderTagTreeEditor';
 $ophandler['tagtree']['edit']['destroyTag'] = 'destroyTag';
 $ophandler['tagtree']['edit']['createTag'] = 'createTag';
 $ophandler['tagtree']['edit']['updateTag'] = 'updateTag';
+$msgcode['tagtree']['edit']['destroyTag']['OK'] = 58;
+$msgcode['tagtree']['edit']['createTag']['OK'] = 59;
+$msgcode['tagtree']['edit']['updateTag']['OK'] = 60;
 
 $page['myaccount']['title'] = 'My account';
 $page['myaccount']['parent'] = 'config';
@@ -373,6 +436,7 @@ $tabhandler['myaccount']['default'] = 'renderMyAccount';
 $tabhandler['myaccount']['mypassword'] = 'renderMyPasswordEditor';
 $tabhandler['myaccount']['myrealname'] = 'dragon';
 $ophandler['myaccount']['mypassword']['changeMyPassword'] = 'changeMyPassword';
+$msgcode['myaccount']['mypassword']['changeMyPassword']['OK'] = 61;
 
 $page['reports']['title'] = 'Reports';
 $page['reports']['parent'] = 'index';
index 52ad8ae..edabbcb 100644 (file)
@@ -105,7 +105,7 @@ function addPortForwarding ()
        );
 
        if ($error == '')
-               return buildRedirectURL_OK ('NATv4 rule was successfully added.');
+               return buildRedirectURL_OK();
        else
                return buildRedirectURL_ERR ($error);
 }
@@ -129,7 +129,7 @@ function delPortForwarding ()
                $_REQUEST['proto']
        );
        if ($error == '')
-               return buildRedirectURL_OK ('NATv4 rule was successfully deleted.');
+               return buildRedirectURL_OK();
        else
                return buildRedirectURL_ERR ($error);
 }
@@ -155,7 +155,7 @@ function updPortForwarding ()
                $_REQUEST['description']
        );
        if ($error == '')
-               return buildRedirectURL_OK ('NATv4 rule was successfully updated');
+               return buildRedirectURL_OK();
        else
                return buildRedirectURL_ERR ($error);
 }
@@ -170,7 +170,7 @@ function addPortForObject ()
        if ($error != '')
                return buildRedirectURL_ERR ($error);
        else
-               return buildRedirectURL_OK ("Port ${_REQUEST['port_name']} was added successfully");
+               return buildRedirectURL_OK (array ($_REQUEST['port_name']));
 }
 
 function editPortForObject ()
@@ -189,46 +189,47 @@ function editPortForObject ()
        if ($error != '')
                return buildRedirectURL_ERR ($error);
        else
-               return buildRedirectURL_OK ("Port ${_REQUEST['name']} was updated successfully");
+               return buildRedirectURL_OK (array ($_REQUEST['name']));
 }
 
 function delPortFromObject ()
 {
        assertUIntArg ('port_id', __FUNCTION__);
-       $port_name = $_REQUEST['port_name'];
        $error = delObjectPort ($_REQUEST['port_id']);
 
        if ($error != '')
                return buildRedirectURL_ERR ($error);
        else
-               return buildRedirectURL_OK ("Port ${_REQUEST['port_name']} was deleted successfully");
+               return buildRedirectURL_OK (array ($_REQUEST['port_name']));
 }
 
 function linkPortForObject ()
 {
        assertUIntArg ('port_id', __FUNCTION__);
        assertUIntArg ('remote_port_id', __FUNCTION__);
-       $object_id = $_REQUEST['object_id'];
-       $port_name = $_REQUEST['port_name'];
-       $remote_port_name = $_REQUEST['remote_port_name'];
-       $remote_object_name = $_REQUEST['remote_object_name'];
+       assertStringArg ('port_name', __FUNCTION__, TRUE);
+       assertStringArg ('remote_port_name', __FUNCTION__, TRUE);
+       assertStringArg ('remote_object_name', __FUNCTION__, TRUE);
 
        $error = linkPorts ($_REQUEST['port_id'], $_REQUEST['remote_port_id']);
        if ($error != '')
                return buildRedirectURL_ERR ($error);
        else
-               return buildRedirectURL_OK ("Port $port_name successfully linked with port $remote_port_name at object $remote_object_name");
+               return buildRedirectURL_OK (array ($_REQUEST['port_name'], $_REQUEST['remote_port_name'], $_REQUEST['remote_object_name']));
 }
 
 function unlinkPortForObject ()
 {
        assertUIntArg ('port_id', __FUNCTION__);
+       assertStringArg ('port_name', __FUNCTION__, TRUE);
+       assertStringArg ('remote_port_name', __FUNCTION__, TRUE);
+       assertStringArg ('remote_object_name', __FUNCTION__, TRUE);
 
        $error = unlinkPort ($_REQUEST['port_id']);
        if ($error != '')
                return buildRedirectURL_ERR ($error);
        else
-               return buildRedirectURL_OK ("Port ${_REQUEST['port_name']} was successfully unlinked from ${_REQUEST['remote_port_name']}@${_REQUEST['remote_object_name']}");
+               return buildRedirectURL_OK (array ($_REQUEST['port_name'], $_REQUEST['remote_port_name'], $_REQUEST['remote_object_name']));
 }
 
 function addMultiPorts ()
@@ -339,7 +340,7 @@ http://www.cisco.com/en/US/products/hw/routers/ps274/products_tech_note09186a008
                                $error_count++;
                }
        }
-       return buildRedirectURL_OK ("Added ${added_count} ports, updated ${updated_count} ports, encountered ${error_count} errors.");
+       return buildRedirectURL_OK (array ($added_count, $updated_count, $error_count));
 }
 
 function updIPv4Allocation ()
@@ -353,7 +354,7 @@ function updIPv4Allocation ()
        if ($error != '')
                return buildRedirectURL_ERR ($error);
        else
-               return buildRedirectURL_OK ('allocation updated');
+               return buildRedirectURL_OK();
 }
 
 function delIPv4Allocation ()
@@ -365,7 +366,7 @@ function delIPv4Allocation ()
        if ($error != '')
                return buildRedirectURL_ERR ($error);
        else
-               return buildRedirectURL_OK ('deallocated');
+               return buildRedirectURL_OK();
 }
 
 function addIPv4Allocation ()
@@ -391,7 +392,7 @@ function addIPv4Allocation ()
        if ($error != '')
                return buildRedirectURL_ERR ($error);
        else
-               return buildRedirectURL_OK ('allocated');
+               return buildRedirectURL_OK();
 }
 
 function addIPv4Prefix ()
@@ -405,7 +406,7 @@ function addIPv4Prefix ()
        if ($error != '')
                return buildRedirectURL_ERR ($error);
        else
-               return buildRedirectURL_OK ('IPv4 prefix successfully added');
+               return buildRedirectURL_OK();
 }
 
 function delIPv4Prefix ()
@@ -415,7 +416,7 @@ function delIPv4Prefix ()
        if ($error != '')
                return buildRedirectURL_ERR ($error);
        else
-               return buildRedirectURL_OK ('IPv4 prefix deleted');
+               return buildRedirectURL_OK();
 }
 
 function editRange ()
@@ -427,7 +428,7 @@ function editRange ()
        if ($error != '')
                return buildRedirectURL_ERR ($error);
        else
-               return buildRedirectURL_OK ('IPv4 prefix updated');
+               return buildRedirectURL_OK();
 }
 
 function editAddress ()
@@ -443,7 +444,7 @@ function editAddress ()
        if ($error != '')
                return buildRedirectURL_ERR ($error);
        else
-               return buildRedirectURL_OK ('IPv4 address updated');
+               return buildRedirectURL_OK();
 }
 
 function createUser ()
@@ -455,7 +456,7 @@ function createUser ()
        $password = hash (PASSWORD_HASH, $_REQUEST['password']);
        $result = commitCreateUserAccount ($username, $_REQUEST['realname'], $password);
        if ($result == TRUE)
-               return buildRedirectURL_OK ("User account ${username} created.");
+               return buildRedirectURL_OK (array ($username));
        else
                return buildRedirectURL_ERR ("Error creating user account ${username}.");
 }
@@ -476,7 +477,7 @@ function updateUser ()
                $new_password = hash (PASSWORD_HASH, $new_password);
        $result = commitUpdateUserAccount ($_REQUEST['user_id'], $username, $_REQUEST['realname'], $new_password);
        if ($result == TRUE)
-               return buildRedirectURL_OK ("User account ${username} updated.");
+               return buildRedirectURL_OK (array ($username));
        else
                return buildRedirectURL_ERR ("Error updating user account ${username}.");
 }
@@ -485,7 +486,7 @@ function enableUser ()
 {
        assertUIntArg ('user_id', __FUNCTION__);
        if (commitEnableUserAccount ($_REQUEST['user_id'], 'yes') == TRUE)
-               return buildRedirectURL_OK ('User account enabled.');
+               return buildRedirectURL_OK();
        else
                return buildRedirectURL_ERR ('Error enabling user account.');
 }
@@ -498,7 +499,7 @@ function disableUser ()
        else
                $result = commitEnableUserAccount ($_REQUEST['user_id'], 'no');
        if ($result == TRUE)
-               return buildRedirectURL_OK ('User account disabled.');
+               return buildRedirectURL_OK();
        else
                return buildRedirectURL_ERR ('Error disabling user account.');
 }
@@ -544,7 +545,7 @@ function savePortMap ()
                                                break;
                                }
        if ($error_count == 0)
-               return buildRedirectURL_OK ("${error_count} failures and ${success_count} successfull changes.");
+               return buildRedirectURL_OK (array ($error_count, $success_count));
        else
                return buildRedirectURL_ERR ("${error_count} failures and ${success_count} successfull changes.");
 }
@@ -555,7 +556,7 @@ function updateDictionary ()
        assertUIntArg ('dict_key', __FUNCTION__);
        assertStringArg ('dict_value', __FUNCTION__);
        if (commitUpdateDictionary ($_REQUEST['chapter_no'], $_REQUEST['dict_key'], $_REQUEST['dict_value']) === TRUE)
-               return buildRedirectURL_OK ('Update succeeded.');
+               return buildRedirectURL_OK();
        else
                return buildRedirectURL_ERR ('Update failed!');
 }
@@ -565,7 +566,7 @@ function supplementDictionary ()
        assertUIntArg ('chapter_no', __FUNCTION__);
        assertStringArg ('dict_value', __FUNCTION__);
        if (commitSupplementDictionary ($_REQUEST['chapter_no'], $_REQUEST['dict_value']) === TRUE)
-               return buildRedirectURL_OK ('Supplement succeeded.');
+               return buildRedirectURL_OK();
        else
                return buildRedirectURL_ERR ('Supplement failed!');
 }
@@ -575,7 +576,7 @@ function reduceDictionary ()
        assertUIntArg ('chapter_no', __FUNCTION__);
        assertUIntArg ('dict_key', __FUNCTION__);
        if (commitReduceDictionary ($_REQUEST['chapter_no'], $_REQUEST['dict_key']) === TRUE)
-               return buildRedirectURL_OK ('Reduction succeeded.');
+               return buildRedirectURL_OK();
        else
                return buildRedirectURL_ERR ('Reduction failed!');
 }
@@ -584,7 +585,7 @@ function addChapter ()
 {
        assertStringArg ('chapter_name', __FUNCTION__);
        if (commitAddChapter ($_REQUEST['chapter_name']) === TRUE)
-               return buildRedirectURL_OK ('Chapter was added.');
+               return buildRedirectURL_OK();
        else
                return buildRedirectURL_ERR ('Error adding chapter.');
 }
@@ -594,7 +595,7 @@ function updateChapter ()
        assertUIntArg ('chapter_no', __FUNCTION__);
        assertStringArg ('chapter_name', __FUNCTION__);
        if (commitUpdateChapter ($_REQUEST['chapter_no'], $_REQUEST['chapter_name']) === TRUE)
-               return buildRedirectURL_OK ('Chapter was updated.');
+               return buildRedirectURL_OK();
        else
                return buildRedirectURL_ERR ('Error updating chapter.');
 }
@@ -603,7 +604,7 @@ function delChapter ()
 {
        assertUIntArg ('chapter_no', __FUNCTION__);
        if (commitDeleteChapter ($_REQUEST['chapter_no']))
-               return buildRedirectURL_OK ('Chapter was deleted.');
+               return buildRedirectURL_OK();
        else
                return buildRedirectURL_ERR ('Error deleting chapter.');
 }
@@ -613,7 +614,7 @@ function changeAttribute ()
        assertUIntArg ('attr_id', __FUNCTION__);
        assertStringArg ('attr_name', __FUNCTION__);
        if (commitUpdateAttribute ($_REQUEST['attr_id'], $_REQUEST['attr_name']))
-               return buildRedirectURL_OK ('Rename successful.');
+               return buildRedirectURL_OK();
        else
                return buildRedirectURL_ERR ('Error renaming attribute.');
 }
@@ -623,7 +624,7 @@ function createAttribute ()
        assertStringArg ('attr_name', __FUNCTION__);
        assertStringArg ('attr_type', __FUNCTION__);
        if (commitAddAttribute ($_REQUEST['attr_name'], $_REQUEST['attr_type']))
-               return buildRedirectURL_OK ("Attribute '${_REQUEST['attr_name']}' created.");
+               return buildRedirectURL_OK (array ($_REQUEST['attr_name']));
        else
                return buildRedirectURL_ERR ('Error creating attribute.');
 }
@@ -632,7 +633,7 @@ function deleteAttribute ()
 {
        assertUIntArg ('attr_id', __FUNCTION__);
        if (commitDeleteAttribute ($_REQUEST['attr_id']))
-               return buildRedirectURL_OK ('Attribute was deleted.');
+               return buildRedirectURL_OK();
        else
                return buildRedirectURL_ERR ('Error deleting attribute.');
 }
@@ -643,7 +644,7 @@ function supplementAttrMap ()
        assertUIntArg ('objtype_id', __FUNCTION__);
        assertUIntArg ('chapter_no', __FUNCTION__);
        if (commitSupplementAttrMap ($_REQUEST['attr_id'], $_REQUEST['objtype_id'], $_REQUEST['chapter_no']) === TRUE)
-               return buildRedirectURL_OK ('Supplement succeeded.');
+               return buildRedirectURL_OK();
        else
                return buildRedirectURL_ERR ('Supplement failed!');
 }
@@ -653,7 +654,7 @@ function reduceAttrMap ()
        assertUIntArg ('attr_id', __FUNCTION__);
        assertUIntArg ('objtype_id', __FUNCTION__);
        if (commitReduceAttrMap ($_REQUEST['attr_id'], $_REQUEST['objtype_id']) === TRUE)
-               return buildRedirectURL_OK ('Reduction succeeded.');
+               return buildRedirectURL_OK();
        else
                return buildRedirectURL_ERR ("Reduction failed!");
 }
@@ -663,7 +664,7 @@ function clearSticker ()
        assertUIntArg ('attr_id', __FUNCTION__);
        assertUIntArg ('object_id', __FUNCTION__);
        if (commitResetAttrValue ($_REQUEST['object_id'], $_REQUEST['attr_id']) === TRUE)
-               return buildRedirectURL_OK ('Reset succeeded.');
+               return buildRedirectURL_OK();
        else
                return buildRedirectURL_ERR ('Reset failed!');
 }
@@ -695,7 +696,7 @@ function updateObject ()
        // Invalidate thumb cache of all racks objects could occupy.
        foreach (getResidentRacksData ($_REQUEST['object_id'], FALSE) as $rack_id)
                resetThumbCache ($rack_id);
-       return buildRedirectURL_OK ('Update done');
+       return buildRedirectURL_OK();
 }
 
 function updateStickers ()
@@ -745,14 +746,14 @@ function updateStickers ()
        if (in_array (FALSE, $result))
                return buildRedirectURL_ERR ('One or more update(s) failed!');
 
-       return buildRedirectURL_OK ('Update(s) succeeded.');
+       return buildRedirectURL_OK();
 }
 
 function useupPort ()
 {
        assertUIntArg ('port_id', __FUNCTION__);
        if (commitUseupPort ($_REQUEST['port_id']) === TRUE)
-               return buildRedirectURL_OK ('Reservation removed.');
+               return buildRedirectURL_OK();
        else
                return buildRedirectURL_ERR ('Error removing reservation!');
 }
@@ -782,7 +783,7 @@ function updateUI ()
        if ($error != '')
                return buildRedirectURL_ERR ('Update failed with error: ' . $error);
 
-       return buildRedirectURL_OK ('Update succeeded.');
+       return buildRedirectURL_OK();
 }
 
 function resetUIConfig()
@@ -810,7 +811,7 @@ function resetUIConfig()
        setConfigVar ('SHOW_AUTOMATIC_TAGS','no');
        setConfigVar ('DEFAULT_OBJECT_TYPE','4');
        setConfigVar ('IPV4_AUTO_RELEASE','1');
-       return buildRedirectURL_OK ('Reset complete');
+       return buildRedirectURL_OK();
 }
 
 // Add single record.
@@ -829,7 +830,7 @@ function addRealServer ()
        ))
                return buildRedirectURL_ERR ('addRStoRSPool() failed');
        else
-               return buildRedirectURL_OK ('Real server was successfully added');
+               return buildRedirectURL_OK();
 }
 
 // Parse textarea submitted and try adding a real server for each line.
@@ -879,7 +880,7 @@ function addRealServers ()
                }
        }
        if ($nbad == 0 and $ngood > 0)
-               return buildRedirectURL_OK ("Successfully added ${ngood} real servers");
+               return buildRedirectURL_OK (array ($ngood));
        else
                return buildRedirectURL_ERR ("Added ${ngood} real servers and encountered ${nbad} errors");
 }
@@ -907,7 +908,7 @@ function addVService ()
        if ($error != '')
                return buildRedirectURL_ERR ($error);
        else
-               return buildRedirectURL_OK ('Virtual service was successfully created');
+               return buildRedirectURL_OK();
 }
 
 function deleteRealServer ()
@@ -916,7 +917,7 @@ function deleteRealServer ()
        if (!commitDeleteRS ($_REQUEST['id']))
                return buildRedirectURL_ERR ('commitDeleteRS() failed');
        else
-               return buildRedirectURL_OK ('Real server was successfully deleted');
+               return buildRedirectURL_OK();
 }
 
 function deleteLoadBalancer ()
@@ -931,7 +932,7 @@ function deleteLoadBalancer ()
        ))
                return buildRedirectURL_ERR ('commitDeleteLB() failed');
        else
-               return buildRedirectURL_OK ('Load balancer was successfully deleted');
+               return buildRedirectURL_OK();
 }
 
 function deleteVService ()
@@ -940,7 +941,7 @@ function deleteVService ()
        if (!commitDeleteVS ($_REQUEST['vs_id']))
                return buildRedirectURL_ERR ('commitDeleteVS() failed');
        else
-               return buildRedirectURL_OK ('Virtual service was successfully deleted');
+               return buildRedirectURL_OK();
 }
 
 function updateRealServer ()
@@ -957,7 +958,7 @@ function updateRealServer ()
        ))
                return buildRedirectURL_ERR ('commitUpdateRS() failed');
        else
-               return buildRedirectURL_OK ('Real server was successfully updated');
+               return buildRedirectURL_OK();
 }
 
 function updateLoadBalancer ()
@@ -976,7 +977,7 @@ function updateLoadBalancer ()
        ))
                return buildRedirectURL_ERR ('commitUpdateLB() failed');
        else
-               return buildRedirectURL_OK ('Load balancer info was successfully updated');
+               return buildRedirectURL_OK();
 }
 
 function updateVService ()
@@ -999,7 +1000,7 @@ function updateVService ()
        ))
                return buildRedirectURL_ERR ('commitUpdateVS() failed');
        else
-               return buildRedirectURL_OK ('Virtual service was successfully updated');
+               return buildRedirectURL_OK();
 }
 
 function addLoadBalancer ()
@@ -1018,7 +1019,7 @@ function addLoadBalancer ()
        ))
                return buildRedirectURL_ERR ('addLBtoRSPool() failed');
        else
-               return buildRedirectURL_OK ('Load balancer was successfully added');
+               return buildRedirectURL_OK();
 }
 
 function addRSPool ()
@@ -1036,7 +1037,7 @@ function addRSPool ()
        if ($error != '')
                return buildRedirectURL_ERR ($error);
        else
-               return buildRedirectURL_OK ('RS pool was successfully created');
+               return buildRedirectURL_OK();
 }
 
 function deleteRSPool ()
@@ -1045,7 +1046,7 @@ function deleteRSPool ()
        if (!commitDeleteRSPool ($_REQUEST['pool_id']))
                return buildRedirectURL_ERR ('commitDeleteRSPool() failed');
        else
-               return buildRedirectURL_OK ('RS pool was successfully deleted');
+               return buildRedirectURL_OK();
 }
 
 function updateRSPool ()
@@ -1057,7 +1058,7 @@ function updateRSPool ()
        if (!commitUpdateRSPool ($_REQUEST['pool_id'], $_REQUEST['name'], $_REQUEST['vsconfig'], $_REQUEST['rsconfig']))
                return buildRedirectURL_ERR ('commitUpdateRSPool() failed');
        else
-               return buildRedirectURL_OK ('RS pool was successfully updated');
+               return buildRedirectURL_OK();
 }
 
 function updateRSInService ()
@@ -1082,7 +1083,7 @@ function updateRSInService ()
                }
        }
        if (!$nbad)
-               return buildRedirectURL_OK ($ngood . " real server(s) were successfully (de)activated");
+               return buildRedirectURL_OK (array ($ngood));
        else
                return buildRedirectURL_ERR ("Encountered ${nbad} errors, (de)activated ${ngood} real servers");
 }
@@ -1109,7 +1110,7 @@ function importPTRData ()
                        $nbad++;
        }
        if (!$nbad)
-               return buildRedirectURL_OK ($ngood . " IP address(es) were successfully updated");
+               return buildRedirectURL_OK (array ($ngood));
        else
                return buildRedirectURL_ERR ("Encountered ${nbad} errors, updated ${ngood} IP address(es)");
 }
@@ -1121,7 +1122,7 @@ function generateAutoPorts ()
        $info = getObjectInfo ($_REQUEST['object_id']);
        // Navigate away in case of success, stay at the place otherwise.
        if (executeAutoPorts ($_REQUEST['object_id'], $info['objtype_id']))
-               return buildRedirectURL_OK ('Generation complete', $pageno, 'ports');
+               return buildRedirectURL_OK (array(), $pageno, 'ports');
        else
                return buildRedirectURL_ERR ('executeAutoPorts() failed');
 }
@@ -1146,7 +1147,7 @@ function saveEntityTags ($realm, $bypass)
        if ($n_errors)
                return buildRedirectURL_ERR ("Tried chaining ${n_succeeds} tags, but experienced ${n_errors} errors.");
        else
-               return buildRedirectURL_OK ("Chained ${n_succeeds} tags");
+               return buildRedirectURL_OK (array ($n_succeeds));
 }
 
 function saveObjectTags ()
@@ -1183,7 +1184,7 @@ function destroyTag ()
 {
        assertUIntArg ('tag_id', __FUNCTION__);
        if (($ret = commitDestroyTag ($_REQUEST['tag_id'])) == '')
-               return buildRedirectURL_OK ('Successfully deleted tag.');
+               return buildRedirectURL_OK();
        else
                return buildRedirectURL_ERR ("Error deleting tag: '${ret}'");
 }
@@ -1200,7 +1201,7 @@ function createTag ()
        if (($parent_id = $_REQUEST['parent_id']) <= 0)
                $parent_id = 'NULL';
        if (($ret = commitCreateTag ($tagname, $parent_id)) == '')
-               return buildRedirectURL_OK ("Created tag '${tagname}'.");
+               return buildRedirectURL_OK (array ($tagname));
        else
                return buildRedirectURL_ERR ("Could not create tag '${tagname}' because of error '${ret}'");
 }
@@ -1216,7 +1217,7 @@ function updateTag ()
        if (($parent_id = $_REQUEST['parent_id']) <= 0)
                $parent_id = 'NULL';
        if (($ret = commitUpdateTag ($_REQUEST['tag_id'], $tagname, $parent_id)) == '')
-               return buildRedirectURL_OK ("Updated tag '${tagname}'.");
+               return buildRedirectURL_OK (array ($tagname));
        else
                return buildRedirectURL_ERR ("Could not update tag '${tagname}' because of error '${ret}'");
 }
@@ -1243,7 +1244,7 @@ function rollTags ()
                                $ndupes++;
                        // FIXME: do something likewise for all object inside current rack
                }
-       return buildRedirectURL_OK ("${nnew} new records done, ${ndupes} already existed");
+       return buildRedirectURL_OK();
 }
 
 function changeMyPassword ()
@@ -1259,7 +1260,7 @@ function changeMyPassword ()
        if ($_REQUEST['newpassword1'] != $_REQUEST['newpassword2'])
                return buildRedirectURL_ERR ('New passwords don\'t match.');
        if (commitUpdateUserAccount ($accounts[$remote_username]['user_id'], $accounts[$remote_username]['user_name'], $accounts[$remote_username]['user_realname'], hash (PASSWORD_HASH, $_REQUEST['newpassword1'])))
-               return buildRedirectURL_OK ('Password changed successfully.');
+               return buildRedirectURL_OK();
        else
                return buildRedirectURL_ERR ('Password change failed.');
 }
@@ -1274,7 +1275,7 @@ function saveRackCode ()
                return buildRedirectURL_ERR ('Verification failed: ' . $parseTree['load']);
        saveScript ('RackCodeCache', '');
        if (saveScript ('RackCode', $newcode))
-               return buildRedirectURL_OK ('Saved successfully.');
+               return buildRedirectURL_OK();
        else
                return buildRedirectURL_ERR ('Save failed.');
 }