static int xtttbl_show_func( void *client_data, void *client_flag) { XttTbl *xtttbl = (XttTbl *)client_data; char arg1_str[80]; int arg1_sts; arg1_sts = dcli_get_qualifier( "dcli_arg1", arg1_str, sizeof(arg1_str)); if ( strncmp( arg1_str, "USER", strlen( arg1_str)) == 0) { char msg[120]; char priv_str[80]; if ( strcmp( xtttbl->user, "") == 0) { user_RtPrivToString( xtttbl->priv, priv_str, sizeof(priv_str)); sprintf( msg, "Not logged in (%s)", priv_str); xtttbl->message('I', msg); } else { user_RtPrivToString( xtttbl->priv, priv_str, sizeof(priv_str)); sprintf( msg, "User %s (%s)", xtttbl->user, priv_str); xtttbl->message('I', msg); } } else xtttbl->message('E',"Syntax error"); return 1; }
int XttTbl::sevhist_get_select_cb( void* ctx, pwr_tOid* oid, char* aname, char* oname) { XttTbl* xtttbl = (XttTbl*)ctx; ItemBase* item; if (!xtttbl->tblnav->get_select(&item)) { xtttbl->message('E', "Select an storage item"); return 0; } switch (item->type) { case tblnav_eItemType_Local: case tblnav_eItemType_TreeLocal: { TblNav_sevhistobject* hi = &((ItemLocal*)item)->item; if (hi->attrnum > 1) return 0; *oid = hi->oid; strcpy(aname, hi->objectattrlist[0].aname); strcpy(oname, hi->oname); break; } default: return 0; } return 1; }
void XttTblGtk::activate_print(GtkWidget* w, gpointer data) { XttTbl* xtt = (XttTbl*)data; if (!xtt->is_authorized()) return; xtt->activate_print(); }
void XttTblGtk::activate_list_layout(GtkWidget* w, gpointer data) { XttTbl* xtt = (XttTbl*)data; if (!xtt->is_authorized()) return; xtt->tblnav->show_list(); }
void XttTblGtk::activate_delete_item(GtkWidget* w, gpointer data) { XttTbl* xtt = (XttTbl*)data; if (!xtt->is_authorized(pwr_mPrv_SevAdmin)) return; xtt->activate_delete_item(); }
static void xtttbl_login_success_bc( void *ctx) { XttTbl *xtttbl = (XttTbl *)ctx; char msg[80]; CoLogin::get_login_info( 0, 0, xtttbl->user, (unsigned long *)&xtttbl->priv, 0); sprintf( msg, "User %s logged in", xtttbl->user); xtttbl->cologin = 0; xtttbl->message('I', msg); }
static int xtttbl_ccm_errormessage_func( char *msg, int severity, void *client_data) { XttTbl *xtttbl = (XttTbl *) client_data; if ( EVEN(severity)) xtttbl->message( 'I', msg); else xtttbl->message( 'E', msg); return 1; }
void XttTblGtk::valchanged_cmd_input(GtkWidget* w, gpointer data) { XttTbl* xtt = (XttTbl*)data; int sts; char *text, *textutf8; textutf8 = gtk_editable_get_chars(GTK_EDITABLE(w), 0, -1); text = g_convert(textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL); g_free(textutf8); sts = xtt->command(text); g_object_set(w, "visible", FALSE, NULL); xtt->set_prompt(""); xtt->command_open = 0; xtt->tblnav->set_inputfocus(); }
void XttTbl::delete_item_yes(void* ctx, void* data) { XttTbl* tbl = (XttTbl*)ctx; // sevcli_sHistItem *hi = (sevcli_sHistItem *)data; TblNav_sevhistobject* hi = (TblNav_sevhistobject*)data; pwr_tStatus sts; printf("Deleting %s\n", hi->oname); sevcli_delete_item(&sts, tbl->sevcli, hi->oid, hi->objectattrlist[0].aname); if (EVEN(sts)) { tbl->message('E', "Delete error"); return; } tbl->tblnav->delete_item(hi); tbl->message('I', "Item deleted"); }
static int xtttbl_open_func( void *client_data, void *client_flag) { XttTbl *xtttbl = (XttTbl *)client_data; char arg1_str[80]; int arg1_sts; arg1_sts = dcli_get_qualifier( "dcli_arg1", arg1_str, sizeof(arg1_str)); if ( strncmp( arg1_str, "GRAPH", strlen( arg1_str)) == 0) { } else xtttbl->message('E',"Syntax error"); return XTTTBL__SUCCESS; }
static int xtttbl_logout_func( void *client_data, void *client_flag) { XttTbl *xtttbl = (XttTbl *)client_data; char msg[80]; if ( strcmp( xtttbl->base_user, "") == 0) { sprintf( msg, "User %s logged out", xtttbl->user); xtttbl->message('I', msg); } else { sprintf( msg, "Returned to user %s", xtttbl->base_user); xtttbl->message('I', msg); } strcpy( xtttbl->user, xtttbl->base_user); xtttbl->priv = xtttbl->base_priv; return 1; }
void XttTblGtk::activate_command(GtkWidget* w, gpointer data) { XttTbl* xtt = (XttTbl*)data; if (!xtt->is_authorized()) return; if (xtt->command_open) { g_object_set(((XttTblGtk*)xtt)->cmd_input, "visible", FALSE, NULL); xtt->set_prompt(""); xtt->command_open = 0; return; } gtk_editable_delete_text(GTK_EDITABLE(((XttTblGtk*)xtt)->cmd_input), 0, -1); g_object_set(((XttTblGtk*)xtt)->cmd_input, "visible", TRUE, NULL); xtt->message(' ', ""); gtk_widget_grab_focus(((XttTblGtk*)xtt)->cmd_input); xtt->set_prompt("xtt >"); xtt->command_open = 1; }
static int xtttbl_login_func( void *client_data, void *client_flag) { XttTbl *xtttbl = (XttTbl *)client_data; int sts; char arg1_str[80]; char arg2_str[80]; char systemgroup[80]; unsigned int priv; char msg[80]; // sts = gdh_GetObjectInfo ( "pwrNode-System.SystemGroup", &systemgroup, // sizeof(systemgroup)); // if ( EVEN(sts)) return sts; sts = xtttbl->read_bootfile( 0, systemgroup); if ( EVEN( dcli_get_qualifier( "dcli_arg1", arg1_str, sizeof(arg1_str)))) { xtttbl->cologin = xtttbl->login_new( "PwR Login", systemgroup, xtttbl_login_success_bc, xtttbl_login_cancel_bc, &sts); return 1; } if ( EVEN( dcli_get_qualifier( "dcli_arg2", arg2_str, sizeof(arg2_str)))) { xtttbl->message('E',"Syntax error"); return 1; } cdh_ToLower( arg1_str, arg1_str); cdh_ToLower( arg2_str, arg2_str); sts = user_CheckUser( systemgroup, arg1_str, UserList::pwcrypt(arg2_str), &priv); if ( EVEN(sts)) xtttbl->message('E',"Login failure"); else { strcpy( xtttbl->user, arg1_str); xtttbl->priv = priv; sprintf( msg, "User %s logged in", arg1_str); xtttbl->message('I', msg); } return sts; }
void XttTblGtk::activate_login(GtkWidget* w, gpointer data) { XttTbl* xtt = (XttTbl*)data; xtt->open_login(); }
void XttTblGtk::activate_logout(GtkWidget* w, gpointer data) { XttTbl* xtt = (XttTbl*)data; xtt->logout(); }
int xtttbl_externcmd_func( char *cmd, void *client_data) { XttTbl *xtttbl = (XttTbl *) client_data; return xtttbl->command( cmd); }
void XttTblGtk::activate_zoom_reset(GtkWidget* w, gpointer data) { XttTbl* xtt = (XttTbl*)data; xtt->activate_zoom_reset(); }
static int xtttbl_help_func( void *client_data, void *client_flag) { XttTbl *xtttbl = (XttTbl *)client_data; int sts; char arg_str[80]; char file_str[80]; char bookmark_str[80]; char key[80]; char return_str[80]; int pop; int width, height; int nr; if ( ODD( dcli_get_qualifier( "/INDEX", file_str, sizeof(file_str)))) { if ( ODD( dcli_get_qualifier( "/HELPFILE", file_str, sizeof(file_str)))) { sts = CoXHelp::dhelp_index( navh_eHelpFile_Other, file_str); if ( EVEN(sts)) xtttbl->message('E', "Unable to find file"); } else { if ( ODD( dcli_get_qualifier( "/BASE", 0, 0))) sts = CoXHelp::dhelp_index( navh_eHelpFile_Base, NULL); else sts = CoXHelp::dhelp_index( navh_eHelpFile_Project, NULL); } return 1; } if ( ODD( dcli_get_qualifier( "/VERSION", 0, 0))) { sts = CoXHelp::dhelp( "version", "", navh_eHelpFile_Other, "$pwr_exe/xtt_version_help.dat", 0); if ( EVEN(sts)) xtttbl->message('E', "No help on this subject"); return sts; } int strict = 0; if ( EVEN( dcli_get_qualifier( "dcli_arg1", arg_str, sizeof(arg_str)))) { sts = CoXHelp::dhelp( "help command", "", navh_eHelpFile_Base, NULL, strict); return 1; } if ( EVEN( dcli_get_qualifier( "/BOOKMARK", bookmark_str, sizeof(bookmark_str)))) strcpy( bookmark_str, ""); strcpy( key, arg_str); if ( ODD( dcli_get_qualifier( "dcli_arg2", arg_str, sizeof(arg_str)))) { strcat( key, " "); strcat( key, arg_str); if ( ODD( dcli_get_qualifier( "dcli_arg3", arg_str, sizeof(arg_str)))) { strcat( key, " "); strcat( key, arg_str); if ( ODD( dcli_get_qualifier( "dcli_arg3", arg_str, sizeof(arg_str)))) { strcat( key, " "); strcat( key, arg_str); if ( ODD( dcli_get_qualifier( "dcli_arg4", arg_str, sizeof(arg_str)))) { strcat( key, " "); strcat( key, arg_str); } } } } if ( ! ODD( dcli_get_qualifier( "/RETURNCOMMAND", return_str, sizeof(return_str)))) strcpy( return_str, ""); if ( ODD( dcli_get_qualifier( "/WIDTH", arg_str, sizeof(arg_str)))) { // convert to integer nr = sscanf( arg_str, "%d", &width); if ( nr != 1) { xtttbl->message('E', "Width syntax error"); return XTTTBL__HOLDCOMMAND; } } else width = 0; if ( ODD( dcli_get_qualifier( "/HEIGHT", arg_str, sizeof(arg_str)))) { // convert to integer nr = sscanf( arg_str, "%d", &height); if ( nr != 1) { xtttbl->message('E', "Height syntax error"); return XTTTBL__HOLDCOMMAND; } } else height = 0; pop = ODD( dcli_get_qualifier( "/POPNAVIGATOR", 0, 0)); if ( ODD( dcli_get_qualifier( "/HELPFILE", file_str, sizeof(file_str)))) { sts = CoXHelp::dhelp( key, bookmark_str, navh_eHelpFile_Other, file_str, strict); if ( EVEN(sts)) xtttbl->message('E', "No help on this subject"); } else if ( ODD( dcli_get_qualifier( "/BASE", 0, 0))) { sts = CoXHelp::dhelp( key, bookmark_str, navh_eHelpFile_Base, 0, strict); if ( EVEN(sts)) xtttbl->message('E', "No help on this subject"); } else { sts = CoXHelp::dhelp( key, bookmark_str, navh_eHelpFile_Base, 0, strict); if ( EVEN(sts)) { sts = CoXHelp::dhelp( key, bookmark_str, navh_eHelpFile_Project, 0, strict); if ( EVEN(sts)) xtttbl->message('E', "No help on this subject"); } } return 1; }