Commit 80ee6635 authored by claes's avatar claes

html-files for web op window

parent 219a5df1
......@@ -36,6 +36,7 @@ extern "C" {
#include "glow_growwidget.h"
#include "ge_graph.h"
#include "ge_util.h"
#include "ge_msg.h"
extern "C" {
......@@ -101,12 +102,19 @@ int Graph::generate_web( ldh_tSesContext ldhses)
char link_URL[80];
char link_text[80];
char *s;
ofstream fp;
ofstream fp_login;
ofstream fp_start;
ofstream fp_menu;
ofstream fp_ow;
ofstream fp_ows;
char fname[120];
char menu_file_name[80];
char codebase[200];
pwr_tEnum web_target;
char target_str[80];
char sname[80];
ge_get_systemname( sname);
// Get codebase for applets from global config file
cnf_get_value( "appletCodebase", codebase);
......@@ -231,9 +239,9 @@ int Graph::generate_web( ldh_tSesContext ldhses)
strcpy( fname, "$pwrp_web/pwr_login.html");
dcli_translate_filename( fname, fname);
fp.open( fname);
fp_login.open( fname);
fp <<
fp_login <<
"<!-- Generated by Ge -->" << endl <<
"<!-- Do not edit this file -->" << endl <<
"</html>" << endl <<
......@@ -250,16 +258,16 @@ int Graph::generate_web( ldh_tSesContext ldhses)
" <param name=\"scriptable\" value=\"false\">" << endl <<
" </body>" << endl <<
"</html>" << endl;
fp.close();
fp_login.close();
// Generate html-file for start page
sprintf( fname, "$pwrp_web/%s.html", name);
dcli_translate_filename( fname, fname);
fp.open( fname);
fp_start.open( fname);
fp <<
fp_start <<
"<! Generated by Ge >" << endl <<
"<html>" << endl <<
" <head>" << endl <<
......@@ -269,28 +277,28 @@ int Graph::generate_web( ldh_tSesContext ldhses)
" <frameset cols=\"20%,80%\">" << endl <<
" <frame name=\"left\" src=\"" << menu_file_name << "\">" << endl;
if ( strcmp( start_URL, "") != 0)
fp <<
fp_start <<
" <frame name=\"right\" src=\"" << start_URL << "\">" << endl;
else
fp <<
fp_start <<
" <frame NAME=\"right\">" << endl;
fp <<
fp_start <<
" </frameset>" << endl <<
"" << endl <<
"</html>" << endl;
fp.close();
fp_start.close();
// Generate menu file
sprintf( fname, "$pwrp_web/%s", menu_file_name);
dcli_translate_filename( fname, fname);
fp.open( fname);
fp_menu.open( fname);
fp <<
fp_menu <<
"<html>" << endl <<
" <head>" << endl <<
" <link rel=\"stylesheet\" type=\"text/css\" href=\"" << style_sheet << "\">" << endl <<
" <link rel=\"stylesheet\" type=\"text/css\" href=\"" << style_sheet << "\">" << endl <<
" <title>Menu</title>" << endl <<
" </head>" << endl <<
" <body>" << endl <<
......@@ -300,22 +308,22 @@ int Graph::generate_web( ldh_tSesContext ldhses)
"" << endl;
if ( enable_login) {
fp <<
fp_menu <<
" <a href=\"pwr_login.html\" target=\"right\">Login</a><br>" << endl;
}
if ( enable_navigator) {
fp <<
fp_menu <<
" <a href=\"javascript:open_applet('pwr_navigator.html','Navigator',1,400,600)\">Navigator</a><br>" << endl;
}
if ( enable_alarmlist) {
fp <<
fp_menu <<
" <a href=\"javascript:open_applet('pwr_events.html','AlarmandEventlist',1,600,600)\">Alarm and Event list</a><br>" << endl;
}
if ( enable_login || enable_navigator) {
fp <<
fp_menu <<
" <hr>" << endl;
}
......@@ -332,7 +340,7 @@ int Graph::generate_web( ldh_tSesContext ldhses)
sts = ldh_GetObjectPar( ldhses, webgraph_objid, "RtBody", "Name",
&value_p, &size);
if (EVEN(sts)) return sts;
strcpy( graph_name, value_p);
cdh_ToLower( graph_name, value_p);
XtFree( value_p);
// Attribute WebTarget
......@@ -355,7 +363,7 @@ int Graph::generate_web( ldh_tSesContext ldhses)
switch ( web_target) {
case graph_eWebTarget_ParentWindow :
strcpy( target_str, "_parent");
fp <<
fp_menu <<
" <a href=\"" << graph_name << ".html\" target=\"" << target_str << "\">" << graph_text << "</a><br>" << endl;
break;
case graph_eWebTarget_SeparateWindow :
......@@ -370,7 +378,7 @@ int Graph::generate_web( ldh_tSesContext ldhses)
resize = 1;
}
fp <<
fp_menu <<
" <a href=\"javascript:open_applet('" << graph_name << ".html','" <<
graph_text << "'," << resize << "," << width+20 << "," << height+20
<< ")\">" << graph_text << "</a><br>" << endl;
......@@ -378,7 +386,7 @@ graph_text << "'," << resize << "," << width+20 << "," << height+20
}
default:
strcpy( target_str, "right");
fp <<
fp_menu <<
" <a href=\"" << graph_name << ".html\" target=\"" << target_str << "\">" << graph_text << "</a><br>" << endl;
}
......@@ -386,7 +394,7 @@ graph_text << "'," << resize << "," << width+20 << "," << height+20
sts = ldh_GetNextSibling( ldhses, webgraph_objid, &webgraph_objid);
}
fp <<
fp_menu <<
" <hr>" << endl <<
"" << endl;
......@@ -431,26 +439,78 @@ graph_text << "'," << resize << "," << width+20 << "," << height+20
strcpy( target_str, "right");
}
fp <<
fp_menu <<
" <a href=\"" << link_URL << "\" target=\"" << target_str << "\">" << link_text << "</a><br>" << endl;
}
sts = ldh_GetNextSibling( ldhses, weblink_objid, &weblink_objid);
}
fp <<
fp_menu <<
" </body>" << endl <<
"</html>" << endl;
// Function for opening a window without menues and toolbar
fp <<
fp_menu <<
"<script language=\"JavaScript\">" << endl <<
"function open_applet(url,name,resizable,width,height)" << endl <<
"{" << endl <<
" var win = window.open(url, name, 'resizable='+resizable+',menubar=no,scrollbars=no,location=no,toolbar=no,width='+width+',height='+height+',directories=no');" << endl <<
"}" << endl <<
"</script>" << endl;
fp.close();
fp_menu.close();
// Generate html-file for opwindow applet
sprintf( fname, "$pwrp_web/%s_opwin_menu.html", name);
dcli_translate_filename( fname, fname);
fp_ow.open( fname);
fp_ow <<
"<!-- Generated by Ge -->" << endl <<
"<!-- Do not edit this file -->" << endl <<
"</html>" << endl <<
" <head>" << endl <<
" <title>" << title << "</title>" << endl <<
" </head>" << endl <<
" <body>" << endl <<
" <object classid=\"clsid:8AD9C840-044E-11D1-B3E9-00805F499D93\"" << endl <<
" width=100% height=100% codebase=\"" << codebase << "\">" << endl <<
" <param name = code value=jpwr.jop.JopOpWindowApplet.class >" << endl <<
" <param name =\"archive\" value=\"pwr_rt_client.jar,pwr_jop.jar,pwrp_" << sname << "_web.jar\">" << endl <<
" <param name=\"type\" value=\"application/x-java-applet;version=1.3\">" << endl <<
" <param name=\"scriptable\" value=\"false\">" << endl <<
" <embed type=\"application/x-java-applet;version=1.3\" " << endl <<
" code = jpwr.jop.JopOpWindowApplet.class " << endl <<
" archive=\"pwr_jop.jar,pwr_rt_client.jar,pwrp_" << sname << "_web.jar\" " << endl <<
" width = 100% height = 100% scriptable=false " << endl <<
" pluginspage=\"http://java.sun.com/products/plugin/1.3/plugin-install.html\">" << endl <<
" </body>" << endl <<
"</html>" << endl;
fp_ow.close();
// Generate html-file for start page for opwindow applet
sprintf( fname, "$pwrp_web/%s_opwin.html", name);
dcli_translate_filename( fname, fname);
fp_ows.open( fname);
fp_ows <<
"<!-- Generated by Ge -->" << endl <<
"<!-- Do not edit this file -->" << endl <<
"<html>" << endl <<
" <head>" << endl <<
" <title>" << title << "</title>" << endl <<
" </head>" << endl <<
" <frameset cols=\"20%,80%\">" << endl <<
" <frame name=\"left\" src=\"" << name << "_opwin_menu.html\">" << endl <<
" <frame name=\"right\" src=\"xtt_help_index.html\">" << endl <<
" </frameset>" << endl <<
"</html>" << endl;
fp_ows.close();
// Copy default css-file to pwrp_web
system( "cp $pwr_exe/pwr_css.css $pwrp_web/");
......@@ -464,7 +524,7 @@ graph_text << "'," << resize << "," << width+20 << "," << height+20
sts = dcli_search_file( "$pwrp_exe/xtt_help.dat", fname,
DCLI_DIR_SEARCH_END);
printf( "-- Web startpage generated $pwrp_web/%s.html\n", name);
printf( "-- Web startpages generated $pwrp_web/%s.html and %s_opwin.html\n", name, name);
#endif
return 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment