1201 lines
39 KiB
Plaintext
1201 lines
39 KiB
Plaintext
/*
|
|
* Copyright 1992-1999 Silicon Graphics, Inc.
|
|
* All Rights Reserved.
|
|
*
|
|
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
|
|
* the contents of this file may not be disclosed to third parties, copied or
|
|
* duplicated in any form, in whole or in part, without the prior written
|
|
* permission of Silicon Graphics, Inc.
|
|
*
|
|
* RESTRICTED RIGHTS LEGEND:
|
|
* Use, duplication or disclosure by the Government is subject to restrictions
|
|
* as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
|
|
* and Computer Software clause at DFARS 252.227-7013, and/or in similar or
|
|
* successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
|
|
* rights reserved under the Copyright Laws of the United States.
|
|
*/
|
|
|
|
#include "ui.h"
|
|
|
|
/* This function reads from the database and brings up the different parameters
|
|
for the select action
|
|
*/
|
|
|
|
static const char szErrMsgEventMonDead[] = "Event monitoring daemon is not running\n";
|
|
|
|
void action_parameters(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
|
|
ssdb_Error_Handle error_handle,CMDPAIR *cmdp)
|
|
{
|
|
ssdb_Request_Handle req_handle;
|
|
int number_of_records,rec_sequence;
|
|
const char **vector;
|
|
char common_string[2];
|
|
int action_id,key,multiselect,common_int;
|
|
|
|
create_help(hError,"setup_actions_update");
|
|
if(!get_variable(hError,cmdp,INTTYPE,"multiselect",common_string,&multiselect,100))
|
|
return;
|
|
if(!get_variable(hError,cmdp,INTTYPE,"actionid",common_string,&action_id,101))
|
|
return;
|
|
|
|
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
|
|
"select action_id,timeoutval,dsmthrottle,dsmfrequency,action,retrycount,userstring,action_desc "
|
|
"from event_action where action_id = '%d'",action_id)))
|
|
{
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
return;
|
|
}
|
|
|
|
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
|
|
{
|
|
@ <b>There are no actions in the database.</b>
|
|
ssdbFreeRequest(error_handle,req_handle);
|
|
return ;
|
|
}
|
|
|
|
/* Create the java pieces here */
|
|
@ <HTML>
|
|
@ <HEAD>
|
|
@ <TITLE>SGI Embedded Support Partner - ver.1.0</TITLE>
|
|
|
|
if (!(read_java_scritps("##ACTION_PARAM","##ACTION_PARAM_END")))
|
|
{
|
|
ssdbFreeRequest(error_handle,req_handle);
|
|
sscError(hError,"Error reading java script for this operation\n");
|
|
return ;
|
|
}
|
|
|
|
@ </HEAD>
|
|
@ <body bgcolor="#ffffcc">
|
|
@ <a href="/$sss/$nocache"></a>
|
|
@ <form onSubmit="return verifyData(this)" method=POST name =action_updt action="/$sss/rg/libsemserver~UPDTACTCONFIRM">
|
|
@table border=0 cellpadding=0 cellspacing=0 width=100%
|
|
@row
|
|
@cell bgcolor="#cccc99" width=15
|
|
@
|
|
@endcell
|
|
@cell bgcolor="#cccc99"
|
|
@ SETUP > Actions > Update
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell colspan=2
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell align=right colspan=2
|
|
@ <input TYPE=button onClick="showMap()" Value=" Help ">
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell colspan=2
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
@cell
|
|
vector = ssdbGetRow(error_handle,req_handle);
|
|
@table border=0 cellpadding=0 cellspacing=0
|
|
@row valign=top
|
|
@cell
|
|
@ Action description:
|
|
@endcell
|
|
@cell
|
|
@
|
|
@endcell
|
|
@cell colspan=2
|
|
@format "%s" vector[7]
|
|
@endcell
|
|
@endrow
|
|
@row valign=top
|
|
@cell
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@ Actual action command string:
|
|
@endcell
|
|
@cell
|
|
@
|
|
@endcell
|
|
@cell
|
|
@format "<INPUT TYPE=TEXT NAME=act_str size=30 value = \"%s\">" vector[4]
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row valign=top
|
|
@cell
|
|
@ Enter a username to execute the action:
|
|
@endcell
|
|
@cell
|
|
@
|
|
@endcell
|
|
@cell
|
|
@format "<INPUT TYPE=TEXT NAME=user_name size=10 value = %s>" vector[6]
|
|
@endcell
|
|
@endrow
|
|
@row valign=top
|
|
@cell
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row valign=top
|
|
@cell
|
|
@ Enter action timeout (in multiples of 5)
|
|
@endcell
|
|
@cell
|
|
@
|
|
@endcell
|
|
@cell
|
|
@format "<INPUT TYPE=TEXT NAME=action_timeout size=10 value =%d> seconds" atoi(vector[1])
|
|
@endcell
|
|
@endrow
|
|
@row valign=top
|
|
@cell
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row valign=top
|
|
@cell
|
|
@ Enter the number of times that the event must be registered before an action will be taken:
|
|
@endcell
|
|
@cell
|
|
@
|
|
@endcell
|
|
@cell
|
|
@format "<INPUT TYPE=TEXT NAME=dsmthrottle size=10 value =%d>" atoi(vector[2])
|
|
@endcell
|
|
@endrow
|
|
@row valign=top
|
|
@cell
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row valign=top
|
|
@cell
|
|
@ Enter the number of retry times (up to 23; more than 4 not recommended):
|
|
@endcell
|
|
@cell
|
|
@
|
|
@endcell
|
|
@cell
|
|
@format "<INPUT TYPE=TEXT NAME=retryt size=10 value =%d>" atoi(vector[5])
|
|
@endcell
|
|
@endrow
|
|
ssdbFreeRequest(error_handle,req_handle);
|
|
@endtable
|
|
@ <p><INPUT TYPE="SUBMIT" VALUE=" Accept "> <input type="BUTTON" value=" Clear " onClick="clearForm(this.form)">
|
|
@format "<input type=\"hidden\" name =\"actionid\" value = %d>" action_id
|
|
@format "<input type=\"hidden\" name =\"multiselect\" value = 1>"
|
|
@endcell
|
|
@endrow
|
|
@endtable
|
|
@ </FORM>
|
|
@ </BODY>
|
|
@ </HTML>
|
|
}
|
|
|
|
/* This function is dual purpose. With multiselect 1, the function is used for
|
|
update and with multiselect 0, the function is used to add a new action
|
|
*/
|
|
|
|
void update_action_params(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
|
|
ssdb_Error_Handle error_handle,CMDPAIR *cmdp)
|
|
{
|
|
ssdb_Request_Handle req_handle;
|
|
const char **vector;
|
|
char user_name[32],action_description[80],action_name[255],sys_id[32],common_string[2],act_str[255];
|
|
int number_of_records,actionid, key,action_timeout,dsmthrottle,dsmfrequency,retryt,multiselect,common_int,last_id;
|
|
|
|
if(!get_variable(hError,cmdp,INTTYPE,"multiselect",common_string,&multiselect,102))
|
|
return;
|
|
if (multiselect)
|
|
if(!get_variable(hError,cmdp,INTTYPE,"actionid",common_string,&actionid,103))
|
|
return;
|
|
|
|
if(!get_variable(hError,cmdp,INTTYPE,"action_timeout",common_string,&action_timeout,104))
|
|
return;
|
|
|
|
if(!get_variable(hError,cmdp,INTTYPE,"dsmthrottle",common_string,&dsmthrottle,105))
|
|
return;
|
|
|
|
/*if(!get_variable(hError,cmdp,INTTYPE,"dsmfrequency",common_string,&dsmfrequency,106))
|
|
return; */
|
|
|
|
if(!get_variable(hError,cmdp,INTTYPE,"retryt",common_string,&retryt,107))
|
|
return;
|
|
if(!get_variable(hError,cmdp,CHARTYPE,"user_name",user_name,&common_int,108))
|
|
return;
|
|
|
|
if (!multiselect)
|
|
{
|
|
if(!get_variable(hError,cmdp,CHARTYPE,"action_description",action_description,&common_int,110))
|
|
return;
|
|
if(!get_variable(hError,cmdp,CHARTYPE,"action_name",action_name,&common_int,111))
|
|
return;
|
|
if(!get_variable(hError,cmdp,CHARTYPE,"sys_id",sys_id,&common_int,112))
|
|
return;
|
|
}
|
|
|
|
/* lock the table */
|
|
|
|
if(!(ssdbLockTable(error_handle,connection,"event_action")))
|
|
{
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
return;
|
|
}
|
|
|
|
|
|
/* Update fucntion here. Get additional parameter for update of actions */
|
|
if (multiselect)
|
|
{
|
|
if(!get_variable(hError,cmdp,CHARTYPE,"act_str",act_str,&common_int,109))
|
|
return;
|
|
|
|
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_UPDATE,
|
|
"update event_action set dsmthrottle=%d,retrycount=%d,timeoutval=%d,userstring=\"%s\",action=\"%s\""
|
|
" where action_id = %d",dsmthrottle,retryt,action_timeout,user_name,act_str,actionid)))
|
|
{
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
if (!ssdbUnLockTable(error_handle,connection))
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
return;
|
|
}
|
|
}
|
|
/* Insert a new action */
|
|
else
|
|
{
|
|
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_INSERT,
|
|
"insert into event_action values ('%s',NULL,'',%d,0,\"%s\",%d,%d,\"%s\",\"%s\",0,0)",
|
|
sys_id,dsmthrottle,action_description,retryt,action_timeout,user_name,action_name)))
|
|
{
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
if (!ssdbUnLockTable(error_handle,connection))
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
return;
|
|
}
|
|
}
|
|
|
|
ssdbFreeRequest(error_handle,req_handle);
|
|
if (!ssdbUnLockTable(error_handle,connection))
|
|
{
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
return;
|
|
}
|
|
|
|
/* Let the event manager know that there was a configuration change */
|
|
|
|
if(configure_rule("UPDATE -1"))
|
|
{
|
|
ssdbFreeRequest(error_handle,req_handle);
|
|
sscError(hError, (char*) szErrMsgEventMonDead );
|
|
return;
|
|
}
|
|
|
|
/* Select the new values from the db for the confirmation screen.
|
|
In the case of insertion of new action, get the last inserted
|
|
id() as the event_action id's are automatically generated
|
|
*/
|
|
if (multiselect)
|
|
{
|
|
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
|
|
"select action_desc,action,userstring,timeoutval,dsmthrottle,dsmfrequency,retrycount "
|
|
"from event_action where action_id = %d",actionid)))
|
|
{
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
if (!ssdbUnLockTable(error_handle,connection))
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
|
|
"select last_insert_id()")))
|
|
{
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
if (!ssdbUnLockTable(error_handle,connection))
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
return;
|
|
}
|
|
|
|
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
|
|
{
|
|
@ <b>Last inserted ID read failed</b>
|
|
if (!ssdbUnLockTable(error_handle,connection))
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
ssdbFreeRequest(error_handle,req_handle);
|
|
return ;
|
|
}
|
|
|
|
vector = ssdbGetRow(error_handle,req_handle);
|
|
if(vector)
|
|
{
|
|
last_id = atoi(vector[0]);
|
|
ssdbFreeRequest(error_handle,req_handle);
|
|
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
|
|
"select action_desc,action,userstring,timeoutval,dsmthrottle,dsmfrequency,retrycount "
|
|
"from event_action where action_id = %d",last_id)))
|
|
{
|
|
sscError(hError,"Database API Error: \"%s\n\n",ssdbGetLastErrorString(error_handle));
|
|
if (!ssdbUnLockTable(error_handle,connection))
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
|
|
{
|
|
@ <b>There are no actions in the database.</b>
|
|
ssdbFreeRequest(error_handle,req_handle);
|
|
if (!ssdbUnLockTable(error_handle,connection))
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
return ;
|
|
}
|
|
else
|
|
{
|
|
@ <HTML>
|
|
@ <HEAD>
|
|
@ <TITLE>SGI Embedded Support Partner - ver.1.0</TITLE>
|
|
@ </HEAD>
|
|
@ <body bgcolor="#ffffcc">
|
|
@ <form onSubmit="return verifyData(this)" method=POST name =action_updt action="">
|
|
@table border=0 cellpadding=0 cellspacing=0 width=100%
|
|
@row
|
|
@cell bgcolor="#cccc99" width=15
|
|
@
|
|
@endcell
|
|
@cell bgcolor="#cccc99"
|
|
if(multiselect)
|
|
@ SETUP > Actions > Update
|
|
else
|
|
@ SETUP > Actions > Add
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell colspan=2
|
|
@ <p>
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
@cell
|
|
vector = ssdbGetRow(error_handle,req_handle);
|
|
@table border=0 cellpadding=0 cellspacing=0
|
|
@row valign=top
|
|
@cell
|
|
@ Action description:
|
|
@endcell
|
|
@cell
|
|
@ :
|
|
@endcell
|
|
@cell colspan=2
|
|
@format "%s" vector[0]
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row valign=top
|
|
@cell
|
|
@ Action command string
|
|
@endcell
|
|
@cell
|
|
@ :
|
|
@endcell
|
|
@cell colspan=2
|
|
@format "%s" vector[1]
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@ A username to execute the action
|
|
@endcell
|
|
@cell
|
|
@ :
|
|
@endcell
|
|
@cell colspan=2
|
|
@format "%s" vector[2]
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@ Action timeout
|
|
@endcell
|
|
@cell
|
|
@ :
|
|
@endcell
|
|
@cell colspan=2
|
|
@format "%d seconds" atoi(vector[3])
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@ Number of times the event must be registered before an action will be taken
|
|
@endcell
|
|
@cell
|
|
@ :
|
|
@endcell
|
|
@cell colspan=2
|
|
@format "%d" atoi(vector[4])
|
|
@endcell
|
|
@endrow
|
|
/*@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@ Delay time between the event and an action
|
|
@endcell
|
|
@cell
|
|
@ :
|
|
@endcell
|
|
@cell colspan=2
|
|
@format "%d seconds" atoi(vector[5])
|
|
@endcell
|
|
@endrow */
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@ Retry times
|
|
@endcell
|
|
@cell
|
|
@ :
|
|
@endcell
|
|
@cell colspan=2
|
|
@format "%d" atoi(vector[6])
|
|
@endcell
|
|
@endrow
|
|
ssdbFreeRequest(error_handle,req_handle);
|
|
@endtable
|
|
@endcell
|
|
@endrow
|
|
@endtable
|
|
@ </FORM>
|
|
@ </BODY>
|
|
@ </HTML>
|
|
}
|
|
}
|
|
|
|
void delete_action(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
|
|
ssdb_Error_Handle error_handle,CMDPAIR *cmdp)
|
|
{
|
|
ssdb_Request_Handle req_handle;
|
|
int number_of_records,key,deletebutton,action_id,common_int;
|
|
char actionbuffer[80], sys_id[32],common_string[2];
|
|
|
|
if (!get_variable(hError,cmdp,INTTYPE,"actionid",common_string,&action_id,113))
|
|
return;
|
|
if(!get_variable(hError,cmdp,CHARTYPE,"sys_id",sys_id,&common_int,114))
|
|
return;
|
|
if(!get_variable(hError,cmdp,CHARTYPE,"action_desc",actionbuffer,&common_int,115))
|
|
return;
|
|
if(!get_variable(hError,cmdp,INTTYPE,"proceeddel",common_string,&deletebutton,116))
|
|
return;
|
|
|
|
if (deletebutton)
|
|
{
|
|
if (!(ssdbLockTable(error_handle,connection,"actions_taken,event_action,event_actionref")))
|
|
{
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
return;
|
|
}
|
|
|
|
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_DELETE,
|
|
"delete from event_actionref where action_id = %d and sys_id = '%s'",action_id,sys_id)))
|
|
{
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
if (!ssdbUnLockTable(error_handle,connection))
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
return;
|
|
}
|
|
ssdbFreeRequest(error_handle,req_handle);
|
|
|
|
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_DELETE,
|
|
"delete from actions_taken where action_id = %d and sys_id = '%s'",action_id,sys_id)))
|
|
{
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
if (!ssdbUnLockTable(error_handle,connection))
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
return;
|
|
}
|
|
ssdbFreeRequest(error_handle,req_handle);
|
|
|
|
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_DELETE,
|
|
"delete from event_action where action_id = %d and sys_id = '%s'",action_id,sys_id)))
|
|
{
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
if (!ssdbUnLockTable(error_handle,connection))
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
return;
|
|
}
|
|
ssdbFreeRequest(error_handle,req_handle);
|
|
|
|
if (!ssdbUnLockTable(error_handle,connection))
|
|
{
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
return;
|
|
}
|
|
|
|
if(configure_rule("UPDATE -1"))
|
|
{
|
|
sscError(hError, (char*) szErrMsgEventMonDead );
|
|
return;
|
|
}
|
|
}
|
|
@ <HTML>
|
|
@ <HEAD>
|
|
@ <TITLE>SGI Embedded Support Partner - ver.1.0</TITLE>
|
|
@ </HEAD>
|
|
@ <body bgcolor="#ffffcc">
|
|
@ <a href="/$sss/$nocache"></a>
|
|
@table border=0 cellpadding=0 cellspacing=0 width=100%
|
|
@row
|
|
@cell bgcolor="#cccc99" width=15
|
|
@
|
|
@endcell
|
|
@cell bgcolor="#cccc99"
|
|
@ SETUP > Actions > Delete
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell colspan=2
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
@cell
|
|
if (deletebutton)
|
|
{
|
|
@ The following action has been deleted from the SGI Embedded Support Partner database:
|
|
@format "<ul><li>%s</ul>" actionbuffer
|
|
}
|
|
else
|
|
@ Request for deletion cancelled.
|
|
@endcell
|
|
@endrow
|
|
@endtable
|
|
@ </form> </body> </html>
|
|
}
|
|
|
|
int deletelistset(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
|
|
ssdb_Error_Handle error_handle,CMDPAIR *cmdp)
|
|
{
|
|
ssdb_Request_Handle req_handle;
|
|
int key,number_of_records,rec_sequence,action_id,common_int,row_num,balance_rows,total_pages,pageno,firstpage,lastpage,bottom;
|
|
const char **vector;
|
|
char actionbuffer[80],sys_id[32],common_string[2];
|
|
|
|
if(!get_variable(hError,cmdp,CHARTYPE,"sys_id",sys_id,&common_int,117))
|
|
return 0;
|
|
if(!get_variable(hError,cmdp,INTTYPE,"actionid",common_string,&action_id,118))
|
|
return 0;
|
|
if(!get_variable(hError,cmdp,INTTYPE,"row_num",common_string,&row_num,119))
|
|
return 0;
|
|
|
|
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
|
|
"select action_desc from event_action where action_id = %d and sys_id = '%s'",action_id,sys_id)))
|
|
{
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
return 0;
|
|
}
|
|
|
|
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
|
|
{
|
|
@ There are no records for this operation
|
|
ssdbFreeRequest(error_handle,req_handle);
|
|
return (number_of_records);
|
|
}
|
|
|
|
|
|
vector = ssdbGetRow(error_handle,req_handle);
|
|
if (vector)
|
|
strcpy (actionbuffer, vector[0]);
|
|
else
|
|
strcpy (actionbuffer,"Unknown");
|
|
ssdbFreeRequest(error_handle,req_handle);
|
|
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
|
|
"select DISTINCT event_type.type_desc from event_type,event_actionref "
|
|
"where event_actionref.action_id = %d "
|
|
"and event_actionref.type_id = event_type.type_id "
|
|
"and event_actionref.sys_id = '%s' "
|
|
"order by event_type.type_id",action_id,sys_id)))
|
|
{
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
return 0;
|
|
}
|
|
|
|
|
|
number_of_records = getnumrecords(hError,error_handle,req_handle);
|
|
create_help (hError,"setup_actions_delete");
|
|
|
|
@ <HTML>
|
|
@ <HEAD>
|
|
@ <TITLE>SGI Embedded Support Partner - ver.1.0</TITLE>
|
|
|
|
if (!(read_java_scritps("##DELETELISTSET","##DELETELISTSET_END")))
|
|
{
|
|
sscError(hError,"Error reading java script for this operation\n");
|
|
ssdbFreeRequest(error_handle,req_handle);
|
|
return 0;
|
|
}
|
|
|
|
@ </HEAD>
|
|
@ <body bgcolor="#ffffcc" vlink="#333300" link="#333300">
|
|
@ <form method=POST name =action_updt action="/$sss/rg/libsemserver~DELETEACTION">
|
|
@table border=0 cellpadding=0 cellspacing=0 width=100%
|
|
@row
|
|
@cell bgcolor="#cccc99" width=15
|
|
@
|
|
@endcell
|
|
@cell bgcolor="#cccc99"
|
|
@ SETUP > Actions > Delete
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell colspan=2
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell align=right colspan=2
|
|
@ <input TYPE=button onClick="showMap()" Value=" Help ">
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell colspan=2
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
|
|
@cell
|
|
if (number_of_records)
|
|
{
|
|
|
|
@format "The following events will be affected as a result of <b>%s</b> action deletion:" actionbuffer
|
|
@ <p>
|
|
@table BORDER=0 CELLSPACING = 0 CELLPADDING=0
|
|
@row
|
|
@cell align=right
|
|
total_pages = number_of_records/10;
|
|
if (number_of_records%10)
|
|
total_pages++;
|
|
pageno = row_num/10;
|
|
pageno++;
|
|
@format "Page %d of %d" pageno total_pages
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@table border=4 cellpadding=6 cellspacing=1
|
|
@row align=center
|
|
@cell
|
|
@ <b>No</b>
|
|
@endcell
|
|
@cell
|
|
@ <b>Event Description</b>
|
|
@endcell
|
|
@endrow
|
|
balance_rows = row_num + 10;
|
|
if (balance_rows > number_of_records)
|
|
balance_rows = number_of_records;
|
|
ssdbRequestSeek(error_handle,req_handle,row_num,0);
|
|
for (rec_sequence = row_num; rec_sequence < balance_rows; rec_sequence++)
|
|
{
|
|
@row
|
|
vector = ssdbGetRow(error_handle,req_handle);
|
|
if (vector)
|
|
{
|
|
@cell
|
|
@format "%d" rec_sequence
|
|
@endcell
|
|
@cell
|
|
@format "%s" vector[0]
|
|
@endcell
|
|
}
|
|
@endrow
|
|
}
|
|
@endtable
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
@endrow
|
|
if(total_pages > 1)
|
|
{
|
|
@row
|
|
@cell align=center
|
|
firstpage = ((pageno-1)/10)*10+1;
|
|
lastpage = firstpage+9;
|
|
if (lastpage >= total_pages)
|
|
lastpage = total_pages;
|
|
if (firstpage > 1)
|
|
{
|
|
@format "<a href=\"/$sss/rg/libsemserver~deletelistset?row_num=%d&sys_id=%s&actionid=%d\"><img src=\"/images/double_arrow_left.gif\" border=0 alt=\"first page\"></a> " 0 sys_id action_id
|
|
@format "<a href=\"/$sss/rg/libsemserver~deletelistset?row_num=%d&sys_id=%s&actionid=%d\"><img src=\"/images/arrow_left.gif\" border=0 alt=\"previous 10 pages\"></a> " (firstpage-11)*10 sys_id action_id
|
|
}
|
|
|
|
for (rec_sequence = firstpage; rec_sequence <= lastpage; rec_sequence++)
|
|
{
|
|
if (rec_sequence == pageno)
|
|
@format "<b><font color=\"#ff3300\">%d</b></font> " rec_sequence
|
|
else
|
|
@format "<a href=\"/$sss/rg/libsemserver~deletelistset?row_num=%d&sys_id=%s&actionid=%d\"><b>%d</b></a> " 10*(rec_sequence-1) sys_id action_id rec_sequence
|
|
}
|
|
if (lastpage < total_pages)
|
|
{
|
|
if(number_of_records%10 == 0)
|
|
bottom = number_of_records -10;
|
|
else
|
|
bottom = number_of_records -(number_of_records%10);
|
|
@format "<a href=\"/$sss/rg/libsemserver~deletelistset?row_num=%d&sys_id=%s&actionid=%d\"><img src=\"/images/arrow_right.gif\" border=0 alt=\"next 10 pages\"></a> " (firstpage+9)*10 sys_id action_id
|
|
@format "<a href=\"/$sss/rg/libsemserver~deletelistset?row_num=%d&sys_id=%s&actionid=%d\"><img src=\"/images/double_arrow_right.gif\" border=0 alt=\"last page\"></a> " bottom sys_id action_id
|
|
}
|
|
@endcell
|
|
@endrow
|
|
}
|
|
|
|
@endtable
|
|
@ <p>Would you like to proceed with the deletion?
|
|
}
|
|
else
|
|
{
|
|
@format "There are no events for the action <b>%s</b>. Would you like to proceed with the deletion?" actionbuffer
|
|
}
|
|
@ <p>
|
|
@ <input type="SUBMIT" value=" Proceed with deletion " onClick="proceed(this)">
|
|
@
|
|
@ <input type="SUBMIT" value=" Stop deletion " onClick="canceldel(this)">
|
|
@format "<input type=\"hidden\" name= action_desc value =\"%s\">" actionbuffer
|
|
@format "<input type=\"hidden\" name= actionid value = %d>" action_id
|
|
@format "<input type=\"hidden\" name= sys_id value =\"%s\">" sys_id
|
|
@ <input type="hidden" name= proceeddel value = "">
|
|
@endcell
|
|
@endrow
|
|
@endtable
|
|
@ </form> </body> </html>
|
|
ssdbFreeRequest(error_handle,req_handle);
|
|
return 1;
|
|
}
|
|
|
|
void view_action_page(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
|
|
ssdb_Error_Handle error_handle,CMDPAIR *cmdp)
|
|
{
|
|
ssdb_Request_Handle req_handle;
|
|
int key,number_of_records,rec_sequence,multiselect,action_select,common_int,pageno;
|
|
const char **vector;
|
|
char actionbuffer[80],sys_id[32],common_string[2];
|
|
|
|
if(!get_variable(hError,cmdp,CHARTYPE,"sys_id",sys_id,&common_int,120))
|
|
return;
|
|
if(!get_variable(hError,cmdp,INTTYPE,"action_select",common_string,&action_select,121))
|
|
return;
|
|
|
|
if(!action_select)
|
|
create_help(hError,"screens_action_setup");
|
|
|
|
@ <HTML> <HEAD> <TITLE>SGI Embedded Support Partner - ver.1.0</TITLE>
|
|
if(!action_select)
|
|
{
|
|
if (!(read_java_scritps("##ACTIONSETUP","##ACTIONSETUP_END")))
|
|
{
|
|
sscError(hError,"Error reading java script for this operation\n");
|
|
return ;
|
|
}
|
|
}
|
|
@ </HEAD>
|
|
@ <body bgcolor="#ffffcc" vlink="#333300" link="#333300">
|
|
if (!action_select)
|
|
@ <form onSubmit="return verify_submitvals()" method=POST name=Action action="/$sss/rg/libsemserver~ACTION_REPORT_BY_ACTION">
|
|
else
|
|
@ <form onSubmit="return verify_submitvals()" method=POST action="/$sss/rg/libsemserver~ACTION_LIST">
|
|
|
|
@table border=0 cellpadding=0 cellspacing=0 width=100%
|
|
@row
|
|
@cell bgcolor="#cccc99" width=15
|
|
@
|
|
@endcell
|
|
@cell bgcolor="#cccc99"
|
|
if (!action_select)
|
|
@ SETUP > Actions > View Current Setup > View Action Setup
|
|
else
|
|
@ SETUP > Actions > View Current Setup > View Available Actions List
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell colspan=2
|
|
@
|
|
@endcell
|
|
@endrow
|
|
if(!action_select)
|
|
{
|
|
@row
|
|
@cell align=right colspan=2
|
|
@ <input TYPE=button onClick="showMap()" Value=" Help ">
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell colspan=2
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@ <p>
|
|
@endcell
|
|
@cell
|
|
@ Choose an action whose description you want to view:<p>
|
|
create_action_list(hError,session,connection,error_handle,cmdp);
|
|
@endcell
|
|
@endrow
|
|
}
|
|
else
|
|
{
|
|
@row
|
|
@cell
|
|
@ <p>
|
|
@endcell
|
|
@cell
|
|
view_action_list(hError,session,connection,error_handle,cmdp);
|
|
@format "<input TYPE=\"hidden\" name=sys_id value=\"%s\">" sys_id
|
|
@endcell
|
|
@endrow
|
|
}
|
|
@endtable
|
|
@ </form></body></html>
|
|
}
|
|
void action_report_by_action(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
|
|
ssdb_Error_Handle error_handle,CMDPAIR *cmdp)
|
|
{
|
|
ssdb_Request_Handle req_handle;
|
|
int key,number_of_records,rec_sequence,multiselect,actionid,common_int;
|
|
const char **vector;
|
|
char common_string[2];
|
|
|
|
if(!get_variable(hError,cmdp,INTTYPE,"actionid",common_string,&actionid,122))
|
|
return;
|
|
|
|
@ <HTML><HEAD><TITLE>SGI Embedded Support Partner - ver.1.0</TITLE></head>
|
|
@ <body bgcolor="#ffffcc">
|
|
@ <form method=POST action="/$sss/rg/libsemserver">
|
|
@table border=0 cellpadding=0 cellspacing=0 width=100%
|
|
@row
|
|
@cell bgcolor="#cccc99" width=15
|
|
@
|
|
@endcell
|
|
@cell bgcolor="#cccc99"
|
|
@ SETUP > Actions > View Current Setup > View Action Setup
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell colspan=2
|
|
@ <p>
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
@cell
|
|
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
|
|
"select action_desc,action,userstring,timeoutval,dsmthrottle,dsmfrequency,retrycount "
|
|
"from event_action where action_id = %d",actionid)))
|
|
{
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
return;
|
|
}
|
|
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
|
|
{
|
|
@ <B>There are no actions in the database.</B>
|
|
ssdbFreeRequest(error_handle,req_handle);
|
|
return ;
|
|
}
|
|
else
|
|
{
|
|
@table border=0 cellpadding=0 cellspacing=0
|
|
vector = ssdbGetRow(error_handle,req_handle);
|
|
if(vector)
|
|
{
|
|
@row valign=top
|
|
@cell
|
|
@ Action command string
|
|
@endcell
|
|
@cell
|
|
@ :
|
|
@endcell
|
|
@cell colspan=2
|
|
@format "%s" vector[1]
|
|
@endcell
|
|
@endrow
|
|
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row valign=top
|
|
@cell
|
|
@ Action description:
|
|
@endcell
|
|
@cell
|
|
@ :
|
|
@endcell
|
|
@cell colspan=2
|
|
@format "%s" vector[0]
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@ Execute this action as
|
|
@endcell
|
|
@cell
|
|
@ :
|
|
@endcell
|
|
@cell colspan=2
|
|
@format "%s" vector[2]
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@ Action timeout
|
|
@endcell
|
|
@cell
|
|
@ :
|
|
@endcell
|
|
@cell colspan=2
|
|
@format "%d seconds" atoi(vector[3])
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@ Number of times the event must be registered before an action will be taken
|
|
@endcell
|
|
@cell
|
|
@ :
|
|
@endcell
|
|
@cell colspan=2
|
|
@format "%d" atoi(vector[4])
|
|
@endcell
|
|
@endrow
|
|
/*@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@ Delay time between the event and an action
|
|
@endcell
|
|
@cell
|
|
@ :
|
|
@endcell
|
|
@cell colspan=2
|
|
@format "%d seconds" atoi(vector[5])
|
|
@endcell
|
|
@endrow */
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@ Retry times
|
|
@endcell
|
|
@cell
|
|
@ :
|
|
@endcell
|
|
@cell colspan=2
|
|
@format "%d" atoi(vector[6])
|
|
@endcell
|
|
@endrow
|
|
}
|
|
ssdbFreeRequest(error_handle,req_handle);
|
|
@endtable
|
|
@endcell
|
|
@endrow
|
|
@endtable
|
|
@ </FORM></BODY></HTML>
|
|
}
|
|
}
|
|
|
|
void view_action_list(sscErrorHandle hError, mySession *session,ssdb_Connection_Handle connection,
|
|
ssdb_Error_Handle error_handle,CMDPAIR *cmdp)
|
|
{
|
|
|
|
ssdb_Request_Handle req_handle;
|
|
int key,number_of_records,rec_sequence,common_int,row_num,balance_rows,total_pages,pageno,firstpage,lastpage,bottom;
|
|
const char **vector;
|
|
char sys_id[32],common_string[2];
|
|
|
|
if(!get_variable(hError,cmdp,CHARTYPE,"sys_id",sys_id,&common_int,123))
|
|
return;
|
|
if(!get_variable(hError,cmdp,INTTYPE,"row_num",common_string,&row_num,124))
|
|
return;
|
|
|
|
if (!(req_handle = ssdbSendRequest(error_handle,connection,SSDB_REQTYPE_SELECT,
|
|
"select action_desc,action from event_action where private=0 and sys_id = '%s'",sys_id)))
|
|
{
|
|
sscError(hError,"Database API Error: \"%s\"\n\n",ssdbGetLastErrorString(error_handle));
|
|
return;
|
|
}
|
|
|
|
if ((number_of_records = getnumrecords(hError,error_handle,req_handle)) == 0)
|
|
{
|
|
@ <b>There are no actions in the database.</b>
|
|
ssdbFreeRequest(error_handle,req_handle);
|
|
return ;
|
|
}
|
|
else
|
|
{
|
|
@table BORDER=0 CELLSPACING = 0 CELLPADDING=0
|
|
@row
|
|
@cell align=right
|
|
total_pages = number_of_records/10;
|
|
if (number_of_records%10)
|
|
total_pages++;
|
|
pageno = row_num/10;
|
|
pageno++;
|
|
@format "Page %d of %d" pageno total_pages
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@table BORDER=4 CELLSPACING = 1 CELLPADDING=6
|
|
@row ALIGN=CENTER
|
|
@cell align=right
|
|
@ <b>No.</b>
|
|
@endcell
|
|
@cell
|
|
@ <b>Action Description</b>
|
|
@endcell
|
|
@cell
|
|
@ <b>Action Command String</b>
|
|
@endcell
|
|
@endrow
|
|
balance_rows = row_num + 10;
|
|
if (balance_rows > number_of_records)
|
|
balance_rows = number_of_records;
|
|
ssdbRequestSeek(error_handle,req_handle,row_num,0);
|
|
for (rec_sequence = row_num; rec_sequence < balance_rows; rec_sequence++)
|
|
{
|
|
@row valign=top
|
|
vector = ssdbGetRow(error_handle,req_handle);
|
|
if(vector)
|
|
{
|
|
@cell
|
|
@format "%d" rec_sequence+1
|
|
@endcell
|
|
@cell
|
|
@format "%s" vector[0]
|
|
@endcell
|
|
@cell
|
|
@format "%s" vector[1]
|
|
@endcell
|
|
}
|
|
@endrow
|
|
}
|
|
ssdbFreeRequest(error_handle,req_handle);
|
|
@endtable;
|
|
}
|
|
@endcell
|
|
@endrow
|
|
@row
|
|
@cell
|
|
@
|
|
@endcell
|
|
@endrow
|
|
if(total_pages > 1)
|
|
{
|
|
@row
|
|
@cell align=center
|
|
firstpage = ((pageno-1)/10)*10+1;
|
|
lastpage = firstpage+9;
|
|
if (lastpage >= total_pages)
|
|
lastpage = total_pages;
|
|
if (firstpage > 1)
|
|
{
|
|
@format "<a href=\"/$sss/rg/libsemserver~ACTION_VIEW_CONT?row_num=%d&sys_id=%s&action_select=1\"><img src=\"/images/double_arrow_left.gif\" border=0 alt=\"first page\"></a> " 0 sys_id
|
|
@format "<a href=\"/$sss/rg/libsemserver~ACTION_VIEW_CONT?row_num=%d&sys_id=%s&action_select=1\"><img src=\"/images/arrow_left.gif\" border=0 alt=\"previous 10 pages\"></a> " (firstpage-11)*10 sys_id
|
|
}
|
|
|
|
for (rec_sequence = firstpage; rec_sequence <= lastpage; rec_sequence++)
|
|
{
|
|
if (rec_sequence == pageno)
|
|
@format "<b><font color=\"#ff3300\">%d</b></font> " rec_sequence
|
|
else
|
|
@format "<a href=\"/$sss/rg/libsemserver~ACTION_VIEW_CONT?row_num=%d&sys_id=%s&action_select=1\"><b>%d</b></a> " 10*(rec_sequence-1) sys_id rec_sequence
|
|
}
|
|
if (lastpage < total_pages)
|
|
{
|
|
if(number_of_records%10 == 0)
|
|
bottom = number_of_records -10;
|
|
else
|
|
bottom = number_of_records - (number_of_records%10);
|
|
@format "<a href=\"/$sss/rg/libsemserver~ACTION_VIEW_CONT?row_num=%d&sys_id=%s&action_select=1\"><img src=\"/images/arrow_right.gif\" border=0 alt=\"next 10 pages\"></a> " (firstpage+9)*10 sys_id
|
|
@format "<a href=\"/$sss/rg/libsemserver~ACTION_VIEW_CONT?row_num=%d&sys_id=%s&action_select=1\"><img src=\"/images/double_arrow_right.gif\" border=0 alt=\"last page\"></a> " bottom sys_id
|
|
}
|
|
@endcell
|
|
@endrow
|
|
}
|
|
@endtable
|
|
}
|