/* PUBLIC */ public List<Dictionary<string, string>> GetQueries() { List<Dictionary<string, string>> queries = new List<Dictionary<string, string>>(); // leaves if imput values are not all correct if (_scheduleInterval < 0 || _dbFilePath == string.Empty || _xmlFolderPath == string.Empty) return queries; db_config_page pages = new db_config_page(); // open the connection to the sqlite database pages.Open(_dbFilePath); foreach (Page page in pages.AllPages) { // get folder path string path = !page.XMLFolderPath.StartsWith("default") & page.XMLFolderPath != string.Empty ? page.XMLFolderPath.Trim() : _xmlFolderPath.Trim(); List<Frame> frames = (from f in pages.GetAllFrames(page.ID) where f.ScheduleInterval == _scheduleInterval && f.IsActive == 1 select f).ToList(); foreach (Frame frame in frames) { // add the options to the option smasher :) to get the individual strings OptionItems oi = new OptionItems(frame.Options); string frameTitle = frame.Title; string pageTitle = page.Title; string sql = oi.GetSingle("sql"); // first sql found string conn = oi.GetSingle("conn"); // first conn found string xmlFile = oi.GetSingle("xml_file"); // forst xml file found // if any of the above strins its empty, its because the user did someting very bad if (sql != string.Empty && conn != string.Empty && xmlFile != string.Empty) { // if the xml file contains ":\" its because its a c:\bla bla or d:\bla bla or someting like that. queries.Add(BuildQueryObject( sql, conn, path.EndsWith(@"\") ? path + xmlFile : path + @"\" + xmlFile, pageTitle, frameTitle )); } } } return queries; }
/******************** Mons Properties ********************/ /// <summary> /// Builds the string to be userd in meter and gauge /// </summary> /// <param name="oi"></param> /// <param name="monType"></param> private void BuildThreshold(OptionItems oi, string monType) { string color_ok = oi.GetSingle("color_ok"); if (color_ok == string.Empty) color_ok = "transparent"; string color_warning = oi.GetSingle("color_warning"); if (color_warning == string.Empty) color_warning = "yellow"; string color_critical = oi.GetSingle("color_critical"); if (color_critical == string.Empty) color_critical = "red"; if (monType == "meter") { string meter_ok = oi.GetSingle("meter_ok"); if (meter_ok == string.Empty) meter_ok = "0,20"; string meter_warning = oi.GetSingle("meter_warning"); if (meter_warning == string.Empty) meter_warning = "21,60"; string meter_critical = oi.GetSingle("meter_critical"); if (meter_critical == string.Empty) meter_critical = "61,99"; //SetThreshold("[0,20,'blue'], [40,60,'green'], [70,90,'red']"); // Meter SetThreshold("[" + meter_ok + ",'" + color_ok + "'], [" + meter_warning + ",'" + color_warning + "'], [" + meter_critical + ",'" + color_critical + "']"); // Meter } else if (monType == "gauge") { string gauge_warning = oi.GetSingle("gauge_warning_start"); if (gauge_warning == string.Empty) gauge_warning = "50"; string gauge_critical = oi.GetSingle("gauge_critical_start"); if (gauge_critical == string.Empty) gauge_critical = "80"; //SetThreshold("[50,80],[transparent, yellow, red]"); // Gauge SetThreshold("[" + gauge_warning + "," + gauge_critical + "],[" + color_ok + ", " + color_warning + ", " + color_critical + "]"); // Gauge } }
private void Startup(Frame frame) { // replace log file so that is one frame to one log ReplaceLogFile(frame.IDPage, frame.ID); OptionItems oi = new OptionItems(frame.Options); // ------ Frame css ------ ChangeCss(oi.GetSingle("css")); // ------ Title ------ headerTitle.Text = frame.Title; if (!oi.GetSingle("title_is_hidden").Equals("true")) // hide title if value is true, else will always show the title { lbTitle.InnerText = frame.Title; TitleStyle(oi.GetList("title_style")); // title style } else { lbTitleContainer.Style.Add("display", "none"); } string filterTitle = frame.Title; int pageId = frame.IDPage; ViewState["filter_title"] = filterTitle; ViewState["filter_pageid"] = pageId.ToString(); // ------ Load Javascript ------ SetTitlePosition(); /******************/ List<string> listColummns = oi.GetList("columns_to_filter"); /* List<string> listColummns = new List<string>(); listColummns.Add("SUBESTADO"); listColummns.Add("ALT_DIV"); listColummns.Add("CENARIO"); listColummns.Add("SERVICODESC"); */ /******************/ if (ViewState["list_columns_" + Generic.GetHash(filterTitle)] == null) ViewState["list_columns_" + Generic.GetHash(filterTitle)] = listColummns; bool isVertical = oi.GetSingle("vertical_filtes").Equals("true", StringComparison.CurrentCultureIgnoreCase); LoadData ld = new LoadData { PageId = pageId, Datafile = oi.GetSingle("datafile"), Datatable = oi.GetList("datatable"), DefaultFilter = oi.GetSingle("default_filter"), FileName = oi.GetSingle("xml_file"), MasterFilterId = oi.GetSingle("master_filter").Trim() }; if (ld.FileName != string.Empty || ld.Datafile != string.Empty) BuildFilters( ld, listColummns, filterTitle, isVertical ); }
private void Startup(Frame frame) { // replace log file so that is one frame to one log ReplaceLogFile(frame.IDPage, frame.ID); OptionItems oi = new OptionItems(frame.Options); // ------ Frame css ------ ChangeCss(oi.GetSingle("css")); // ------ Title ------ headerTitle.Text = frame.Title; if (!oi.GetSingle("title_is_hidden").Equals("true")) // hide title if value is true, else will always show the title { lbTitle.InnerText = frame.Title; TitleStyle(oi.GetList("title_style")); // title style // loads javascript that controls title position SetTitlePosition(); } else { lbTitleContainer.Style.Add("display", "none"); } /****************** GETTING OPTION DATA ******************/ // master/slave indicator bool isMaster = oi.GetSingle("master").ToLower().Equals("yes"); bool isSlave = oi.GetSingle("slave").ToLower().Equals("yes"); // master filter title string masterFilter = oi.GetSingle("master_filter"); // list of the labels of the inputboxs List<string> listInputData = oi.GetList("input_data"); // list of connections List<string> connList = oi.GetList("conn"); // list queries List<string> sqlList = oi.GetList("sql"); bool queryDebug = oi.GetSingle("query_debug").ToLower().Equals("yes"); // list titles List<string> titleList = oi.GetList("titles"); // list gridviews width List<string> tableWidthList = oi.GetList("table_width"); /****************** RUN CLICK EVENT ******************/ // data to be used in Run Click Event LoadTemporaryPageVariables(frame, isSlave, isMaster, listInputData, masterFilter, connList, sqlList, titleList, tableWidthList, queryDebug); /****************** INPUT BOXs ******************/ // if is not slave will build the inputboxs if (!isSlave) { BuildInputBoxs(listInputData); } /****************** GRIDVIEWs ******************/ // builds the gridviews if is master/slave and its not a postback if (!IsPostBack && (isMaster || isSlave) && masterFilter != string.Empty) { BuildGridViews(frame, masterFilter, listInputData, sqlList, connList, titleList, tableWidthList, queryDebug); } }
private void Startup(Frame frame) { // replace log file so that is one frame to one log ReplaceLogFile(frame.IDPage, frame.ID); OptionItems oi = new OptionItems(frame.Options); // ------ Frame css ------ ChangeCss(oi.GetSingle("css")); // ------ Title ------ headerTitle.Text = frame.Title; if (!oi.GetSingle("title_is_hidden").Equals("true")) // hide title if value is true, else will always show the title { lbTitle.InnerText = frame.Title; TitleStyle(oi.GetList("title_style")); // title style // set title position with javascript SetTitlePosition(); } else { lbTitleContainer.Style.Add("display", "none"); } CustomJavascript(oi.GetSingle("custom_javascript")); CustomHtml(oi.GetSingle("custom_html")); CustomCss(oi.GetSingle("custom_css")); }
public string GetUserDefaultPage(string userId, string ctrl) { JavaScriptSerializer js = new JavaScriptSerializer(); string crlHash = Generic.GetHash(Generic.GetWebConfigValue("WebServiceKey")); //if (ctrl != crlHash) return js.Serialize(""); db_config_users dcu = null; // user db_config_page dcp = null; // page try { // first validation to guarantee that user is greater than zero int auxUserId = Convert.ToInt32(userId); if (auxUserId < 0) return js.Serialize(""); dcu = new db_config_users(auxUserId); dcu.Open(); object userOptions = dcu.Get(auxUserId).UserOptions; // if user does not exist leaves if (userOptions == null) return string.Empty; OptionItems oi = new OptionItems((string)userOptions); string pageName = oi.GetSingle("default_frontoffice_page"); // if no default page leave if (pageName == string.Empty) return string.Empty; dcp = new db_config_page(pageName); dcp.Open(); string pageTitle = dcp.Get(pageName).Title; Dictionary<string, string> defPage = new Dictionary<string, string>() {{"Name", pageName}, {"Title", pageTitle}}; return js.Serialize(defPage); } catch (Exception ex) { loging.Error("FrontOffice User Webservice", "Get Default Page ", ex.Message, _logRecord); } finally { if (dcu != null) dcu.Close(); try { if(dcp != null) dcp.Close(); } catch { } } return string.Empty; }
public string GetPageType(string pageId, string ctrl) { string crlHash = Generic.GetHash(Generic.GetWebConfigValue("WebServiceKey")); if (ctrl != crlHash) return string.Empty; db_config_page dcp = null; try { int id = Convert.ToInt32(pageId); dcp = new db_config_page(id, false); dcp.Open(); Page p = dcp.Get(id); OptionItems oi = new OptionItems(p.Options); return oi.GetSingle("page_type").ToLower() == "free_draw" ? "free_draw" : "table"; } catch (Exception ex) { return ex.Message; } finally { if (dcp != null) dcp.Close(); } }
private void Startup(Frame frame) { // replace log file so that is one frame to one log ReplaceLogFile(frame.IDPage, frame.ID); OptionItems oi = new OptionItems(frame.Options); // ------ Frame css ------ ChangeCss(oi.GetSingle("css")); // ------ Title ------ headerTitle.Text = frame.Title; if (!oi.GetSingle("title_is_hidden").Equals("true")) // hide title if value is true, else will always show the title { lbTitle.InnerText = frame.Title; TitleStyle(oi.GetList("title_style")); // title style // ------ Load Javascript ------ SetTitlePosition(); // loads javascript that controls title position } else { lbTitleContainer.Style.Add("display", "none"); } // ------ Border ------ // Border is defined in draw_frames class, sets the border of the panel outside de iframe. // ------ Table ------ int rowsCount = -1; // file name is here to be used outside the try catch string filePath = string.Empty; try { /* * default filter => * * default filter from XML is this way: * default_filter = "select SUBESTADO, count as qtd group by SUBESTADO"; * * default filder from sqlite is a query * default_filder = "select * from xpto" * */ LoadData ld = new LoadData { PageId = frame.IDPage, Datafile = oi.GetSingle("datafile"), Datatable = oi.GetList("datatable"), DefaultFilter = oi.GetSingle("default_filter"), FileName = oi.GetSingle("xml_file"), MasterFilterId = oi.GetSingle("master_filter").Trim() }; // set virtual folder lbDownload.HRef = ld.GetVirtualFilePath(); // set real folder filePath = ld.GetFilePath(); mGridView.DataSource = ld.GetData(); rowsCount = ((DataView)mGridView.DataSource).Count; } catch (Exception ex) { loging.Error("table", "load data", ex.Message, ViewState["log_file"].ToString()); /** Hide when error **/ LabelCountVisible(true); LabelDownloadVisible(true); FiltersVisibility(true); } if (rowsCount >= 0) { try { /********** Css Style **********/ mGridView.CssClass = "gridview"; mGridView.AlternatingRowStyle.CssClass = "alt"; mGridView.PagerStyle.CssClass = "pgr"; /********** Sort **********/ GridView_Sort(oi.GetSingle("table_sort").Trim().ToLower().Equals("false")); /********** Paging **********/ GridView_Paging(oi.GetSingle("table_paging"), rowsCount); /********** GridviewHeader **********/ GridView_Header(oi.GetSingle("table_show_header").Trim().ToLower().Equals("false")); /********** GridView Width **********/ GridView_Width(oi.GetSingle("table_width")); /********** Filter **********/ FiltersVisibility(oi.GetSingle("filters_visible").Trim().ToLower().Equals("false")); /********** Color Markers **********/ AddColorMarkers(oi.GetList("color_markers")); //AddColorMarkers(new List<string> { }); /********** Rows Count **********/ LoadLabelCount(rowsCount); LabelCountVisible(oi.GetSingle("label_count_visible").Trim().ToLower().Equals("false")); /********** Show Xml File lastupd **********/ LabelFileLastUpdVisible(oi.GetSingle("show_xml_file_lastupd").Trim().ToLower().Equals("true")); LoadLabelFileLastUpd(filePath); /********** Downloads **********/ LabelDownloadVisible(oi.GetSingle("label_download_visible").Trim().ToLower().Equals("false")); /********** Table Color Alarms **********/ TableColorAlarms(oi.GetList("warning_text"), oi.GetList("critical_text"), oi.GetSingle("warning_color"), oi.GetSingle("critical_color")); /********** Hyperlinks **********/ CreateHyperlink(frame.IDPage, oi.GetList("hyperlinks"), oi.GetSingle("hyperlink_color")); } catch (Exception ex) { loging.Error("table", "load options", ex.Message, ViewState["log_file"].ToString()); } mGridView.DataBind(); // no fim de correr todas as opções faz o databind... } }
private void Startup(Frame frame) { // replace log file so that is one frame to one log ReplaceLogFile(frame.IDPage, frame.ID); OptionItems oi = new OptionItems(frame.Options); // ------ Frame css ------ ChangeCss(oi.GetSingle("css")); // ------ Title ------ headerTitle.Text = frame.Title; if (!oi.GetSingle("title_is_hidden").Equals("true")) // hide title if value is true, else will always show the title { lbTitle.InnerText = frame.Title; TitleStyle(oi.GetList("title_style")); // title style // ------ Load Javascript ------ SetTitlePosition(); // loads javascript that controls title position } else { lbTitleContainer.Style.Add("display", "none"); } string url = oi.GetSingle("url"); // if url does not exists does noting if (url != string.Empty) { /********** Url **********/ AddUrlToIframe(url); /********** Width, Height **********/ string newWidth = oi.GetSingle("width"); string newHeight = oi.GetSingle("height"); SetIframeSize( newWidth != string.Empty ? newWidth : (frame.Width).ToString(CultureInfo.InvariantCulture), newHeight != string.Empty ? newHeight : (frame.Height - 10).ToString(CultureInfo.InvariantCulture) ); } }
/// <summary> /// Generate header bar /// </summary> private void FillMenuBar(OptionItems foOptions) { string username = "******"; try { headerContainer.Controls.Clear(); UserLoginData user = (UserLoginData)db_config_sessions.GetUserAuthentication(); OptionItems userOi = null; db_config_master_page dcmp = new db_config_master_page(); dcmp.Open(); List<string> userFavorites = new List<string>(); // user not autenticated show just public pages if (user == null) { dcmp.SelectPublicObjectsFromDb(); } else { // user autenticated show public pages and user pages dcmp.SelectAuthenticatedObjectsFromDb(user.UserPages); userOi = new OptionItems(user.User.UserOptions); userFavorites = userOi.GetList("favorites"); // prepare username to be used in error exception. username = user.User.Name; } // set url to use when the page start SelectDefaultPage(foOptions.GetSingle("default_page"), user != null ? userOi.GetSingle("default_frontoffice_page") : ""); MenuBar mb = new MenuBar(); mb.AddHeader("Home", "frontoffice.aspx"); // just show data if is not refresh if (!IsPostBack) { mb.AddHeader("Site pages", ""); // site pages int headerId = mb.GetHeaderPosition("Site pages"); db_config_page dcp; foreach (DbConfig.MasterPage item in dcmp.AllMasterPages) { // just show pages that admin dont want to hide from you :) List<DbConfig.Page> visiblePages = (from p in dcmp.GetAllPages(item.ID) where (new OptionItems(p.Options).GetSingle("hidden_from_frontoffice").Equals("true")) == false select p).ToList(); dcp = new db_config_page(dcmp.Db, visiblePages, item.ID); if (user == null) dcp.SelectPublicObjectsFromDb(); else dcp.SelectAuthenticatedObjectsFromDb(user.UserPages); // will just add master page if it has visible pages to show, // if the master page does not have pages will not get here. if (dcp.AllPages.Count > 0) { // add master page to menu mb.AddMenuItem(headerId, item.Title, ""); int menuItemId = mb.GetMenuPosition(headerId, item.Title); // add pages to sub menus foreach (DbConfig.Page subItem in dcp.AllPages) mb.AddSubMenuItem(headerId, menuItemId, subItem.Title, "page.aspx?nm=" + subItem.Name); } dcp.Close(); } if (userFavorites.Count > 0) // favorites { mb.AddHeader("Favorites", ""); int favItemId = mb.GetHeaderPosition("Favorites"); dcp = new db_config_page(dcmp.Db, new List<DbConfig.Page>(), -1); dcp.Refresh(); foreach (string favpage in userFavorites) { if (!dcp.PageExists(favpage)) continue; DbConfig.Page p = dcp.Get(favpage); mb.AddMenuItem(favItemId, p.Title, "page.aspx?nm=" + p.Name); } dcp.Close(); } } dcmp.Close(); headerContainer.Controls.Add(mb.Get()); Generic.JavaScriptInjector("js", mb.GetLoginJavascript()); } catch (Exception ex) { throw new Exception("error: fill menu bar for user " + username + " - " + ex.Message + " ..."); } }
private void Startup() { db_config_frontoffice dcf = new db_config_frontoffice(); dcf.Open(); OptionItems oi = new OptionItems(dcf.Get.Options); ChangeCss(oi.GetSingle("css")); FillMenuBar(oi); }
private void Startup(string pageName) { db_config_page dcp = new db_config_page(pageName); dcp.Open(); DbConfig.Page page = dcp.Get(pageName); PageAuthentication pa = new PageAuthentication(page.ID); if (!pa.IsPageVisible()) Response.Redirect("frontoffice.aspx"); pageTitle.Text = page.Title; /*************** Options ****************/ OptionItems oi = new OptionItems(page.Options); ChangeAlignment(oi.GetSingle("page_alignment")); ChangeCss(oi.GetSingle("css")); ChangeBackground(oi.GetSingle("background-color")); RefreshPage(oi.GetSingle("refresh_page_interval")); /*************** draw frames ****************/ DrawFrames df = new DrawFrames(pageName, oi.GetSingle("page_type")); mPage.Controls.Add(df.GetFrames()); }
private void Startup(Frame frame) { // replace log file so that is one frame to one log ReplaceLogFile(frame.IDPage, frame.ID); OptionItems oi = new OptionItems(frame.Options); // ------ Frame css ------ ChangeCss(oi.GetSingle("css")); // ------ Title ------ headerTitle.Text = frame.Title; // hide title if value is true, else will always show the title if (!oi.GetSingle("title_is_hidden").Equals("true", StringComparison.CurrentCultureIgnoreCase)) { lbTitle.InnerText = frame.Title; TitleStyle(oi.GetList("title_style")); // title style // ------ Load Javascript ------ SetTitlePosition(); // loads javascript that controls title position } else { lbTitleContainer.Style.Add("display", "none"); } // ------ Border ------ // Border is defined in draw_frames class, sets the border of the panel outside de iframe. // ------ Chart ------ int rowsCount = -1; try { /* * default filter => * * default filter from XML is this way: * default_filter = "select SUBESTADO, count as qtd group by SUBESTADO"; * * default filder from sqlite is a query * default_filder = "select * from xpto" * */ LoadData ld = new LoadData { PageId = frame.IDPage, Datafile = oi.GetSingle("datafile"), Datatable = oi.GetList("datatable"), DefaultFilter = oi.GetSingle("default_filter"), FileName = oi.GetSingle("xml_file"), MasterFilterId = oi.GetSingle("master_filter").Trim() }; DataView dataView = ld.GetData(); rowsCount = dataView.Count; if (rowsCount > -1) WriteDataToChart(dataView); } catch (Exception ex) { throw new Exception("error loading data " + ex.Message); } if (rowsCount >= 0) { try { /********** Alterar a area onde se encontra o grafico **********/ //SetChartArea(new List<string>() { "0", "0", "0", "0" }); // tem de ser dos primeiros para os valores se adaptarem para todos... SetChartArea(oi.GetList("chart_area")); /********** Trocar o eixo de posição **********/ //SetAxis(new List<string> { "right", "left", "left", "left" }); SetAxis(oi.GetList("set_y_axis")); /********** template selector **********/ DesignTemplate(oi.GetSingle("design_template")); /********** chart antialiasing is on text antialiasing is controled by this variable **********/ AntiAliasing(oi.GetSingle("text_antialiasing").Equals("true", StringComparison.CurrentCultureIgnoreCase)); /********** Width, Height **********/ string newWidth = oi.GetSingle("width"); string newHeight = oi.GetSingle("height"); WidthHeight( newWidth != string.Empty ? Convert.ToInt32(newWidth) : frame.Width - 2, newHeight != string.Empty ? Convert.ToInt32(newHeight) : frame.Height - 30 ); /********** Util para grafico de barras e linhas **********/ ScaleBreak(oi.GetSingle("scalebreak").Equals("true", StringComparison.CurrentCultureIgnoreCase)); /********** 3D controls **********/ string inclination = oi.GetSingle("inclination"); string rotation = oi.GetSingle("rotation"); string point_depth = oi.GetSingle("point_depth"); string point_gap_depth = oi.GetSingle("point_gap_depth"); string is_clustered = oi.GetSingle("is_clustered"); Chart3D( oi.GetSingle("chart3d").Equals("true", StringComparison.CurrentCultureIgnoreCase), inclination != string.Empty ? Convert.ToInt32(inclination) : -1, rotation != string.Empty ? Convert.ToInt32(rotation) : -1, point_depth != string.Empty ? Convert.ToInt32(point_depth) : -1, point_gap_depth != string.Empty ? Convert.ToInt32(point_gap_depth) : -1, is_clustered.Equals("true", StringComparison.CurrentCultureIgnoreCase) ); /********** legend control **********/ Legend( oi.GetSingle("legend").Equals("true", StringComparison.CurrentCultureIgnoreCase), oi.GetSingle("docking"), oi.GetSingle("alignment"), oi.GetSingle("text_font"), oi.GetSingle("text_color"), oi.GetSingle("text_size"), oi.GetSingle("back_color") ); /********** grid on and off **********/ ChartGrid(oi.GetSingle("chart_grid").Equals("true", StringComparison.CurrentCultureIgnoreCase)); /********** Cores Manuais **********/ ChartSeriesColors(oi.GetList("chart_colors")); /********** chart type **********/ ChartSeriesType(oi.GetList("chart_type")); /********** enable/disable X axis angle and set this axis angle **********/ SetxAxisStyle( oi.GetSingle("x_label_angle"), oi.GetSingle("disable_x_label").Equals("true", StringComparison.CurrentCultureIgnoreCase), oi.GetSingle("x_axis_interval") ); /********** value label **********/ ShowValueAsLabel( oi.GetList("show_value_in_label"), oi.GetSingle("label_value_color"), oi.GetSingle("label_value_back_color") ); /********** just only Pie and Doughnut property **********/ PieLabelStyle(oi.GetSingle("pie_label_style").ToLower()); } catch (Exception ex) { throw new Exception("error loading options " + ex.Message); } mChart.DataBind(); // in the end do databind... } }
/**************** Iframe build ****************/ /// <summary> /// Create the frame width a panel and a iframe /// </summary> private Control BuildFrameCtrl(Frame f, string frameIdHash) { Panel pn = new Panel(); OptionItems oi = new OptionItems(f.Options); if (_pageType.ToLower().Trim() == "free_draw") { pn.Style.Add("position", "absolute"); pn.Style.Add("top", f.Y + "px"); pn.Style.Add("left", f.X + "px"); } pn.Style.Add("margin", "0"); pn.Style.Add("padding", "0"); pn.Style.Add("border", "0"); pn.Width = Unit.Pixel(f.Width); pn.Height = Unit.Pixel(f.Height); pn.BackColor = Color.Transparent; // ------ Border ------ pn = Views.Frames.GenericFrameSettings.FrameBorderStyle( pn, oi.GetList("frame_style") ); // -------------------- HtmlObjects iframe = new HtmlObjects("iframe"); iframe.Id = frameIdHash; iframe.AddStyle("border", "0"); iframe.AddAttribute("scrolling", f.Scroll); iframe.AddAttribute("width", f.Width + "px"); iframe.AddAttribute("height", f.Height + "px"); iframe.AddAttribute("src", _options.Get(f.FrameType).URL + "?fm=" + frameIdHash); pn.Controls.Add(iframe.GetObject); // for now its just to tell client that this frame is slave of some filter. LoadFrameInfoToClient( f.ID.ToString(CultureInfo.InvariantCulture), frameIdHash, oi.GetSingle("master_filter") ); return pn; }
/// <summary> /// Build the page width table style. /// </summary> /// <returns></returns> private Control BuildTableFrames() { Table tb = new Table(); TableRow row = new TableRow() { HorizontalAlign = HorizontalAlign.Center, VerticalAlign = VerticalAlign.Top }; TableCell cell = null; try { db_config_frame frames = new db_config_frame(_pageName); OptionItems oi = null; frames.Open(); frames.AllFrames.Sort(delegate(Frame a, Frame b) { int ydiff = a.Y.CompareTo(b.Y); return (ydiff != 0) ? ydiff : a.X.CompareTo(b.X); }); foreach (Frame frm in frames.AllFrames) { if (frm.IsActive != 1) continue; // if is != jumps the code below // adds new rows if frame Y position is bigger then the number of rows while (tb.Rows.Count <= frm.Y) tb.Rows.Add(new TableRow() { HorizontalAlign = HorizontalAlign.Center, VerticalAlign = VerticalAlign.Top }); oi = new OptionItems(frm.Options); cell = new TableCell() { HorizontalAlign = HorizontalAlign.Center, VerticalAlign = VerticalAlign.Top, RowSpan = SetRowSpan(oi.GetSingle("rowspan")), ColumnSpan = SetColmnSpan(oi.GetSingle("columnspan")), }; string frameIdHash = Generic.GetHash(frm.ID.ToString()); cell.Controls.Add(BuildFrameCtrl(frm, frameIdHash)); SetSessionFrame(frameIdHash, frm); // add new cell if frame X position is bigger then number of cells while (tb.Rows[frm.Y].Cells.Count <= frm.X) tb.Rows[frm.Y].Cells.Add(new TableCell()); tb.Rows[frm.Y].Cells.AddAt(frm.X, cell); } } catch (Exception ex) { throw ex; } return tb; }
private void Startup(Frame frame) { // replace log file so that is one frame to one log ReplaceLogFile(frame.IDPage, frame.ID); OptionItems oi = new OptionItems(frame.Options); // ------ Frame css ------ ChangeCss(oi.GetSingle("css")); // ------ Title ------ headerTitle.Text = frame.Title; if (!oi.GetSingle("title_is_hidden").Equals("false")) { lbTitle.InnerText = frame.Title; TitleStyle(oi.GetList("title_style")); // title style // ------ Load Javascript ------ SetTitlePosition(); // loads javascript that controls title position } else { lbTitleContainer.Style.Add("display", "none"); } /********** Select Mon type **********/ string monType = oi.GetSingle("mon_type").ToLower(); if (monType == string.Empty) monType = "meter"; SelectMon(monType); // meter / gauge /********** Width, Height **********/ string newWidth = oi.GetSingle("width"); string newHeight = oi.GetSingle("height"); CanvasSize( newWidth != string.Empty ? Convert.ToInt32(newWidth) : frame.Width - 1, newHeight != string.Empty ? Convert.ToInt32(newHeight) : frame.Height - 30 ); /********** Min/Max/Default Values **********/ /* min_value=[0]; max_value=[100]; default_value=[0]; */ MinValue(oi.GetSingle("min_value")); MaxValue(oi.GetSingle("max_value")); DefaultValue(oi.GetSingle("default_value")); /********** Refresh Interval **********/ RefreshInterval(oi.GetSingle("refresh_interval")); /********** Templates em Xml **********/ LoadXmlTemplate(oi.GetSingle("design_template")); /********** Sqlite/Xml File Control **********/ LoadData ld = new LoadData { PageId = frame.IDPage, Datafile = oi.GetSingle("datafile"), Datatable = oi.GetList("datatable"), DefaultFilter = oi.GetSingle("default_filter"), FileName = oi.GetSingle("xml_file"), }; LoadData(ld); /********** Measure Type **********/ MeasureType(oi.GetSingle("measure_type")); /********** Tick Marks **********/ SetTickMarks( oi.GetList("border_marks_values"), oi.GetList("border_marks_colors") ); /********** Set Threshold **********/ /* ok_color=[transparent]; warning_color=[yellow]; critical_color=[red]; meter_ok=[0,20]; meter_warning=[40,60]; meter_critical=[70,90]; gauge_warning_start=[70]; gauge_critical_start=[85]; */ BuildThreshold(oi, monType); /********** Change the needle size **********/ ChangeGaugeNeedleSize(oi.GetSingle("needle_size")); /********** Show Mon Value **********/ ShowValueInMon(oi.GetSingle("show_value_in_label").Equals("true", StringComparison.CurrentCultureIgnoreCase)); GetMon(); }