protected void Page_Load(object sender, EventArgs e) { Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID]; Util util = new Util(); if (util.CheckSessionTimeout(State,Response,"Default.aspx")) return; if (!IsPostBack) { XmlUtil x_util = new XmlUtil(); if ( State["PageHtml"] == null) //get html if there is a selected app x_util.GetStagingAppXml(State); if ( State["PageHtml"] == null) //no selected app return; int left = 0; if (State["SelectedDeviceType"] != null && (State["SelectedDeviceType"].ToString() == Constants.IPAD || State["SelectedDeviceType"].ToString() == Constants.ANDROID_TABLET)) { State["BackgroundImageUrl"] = null; State["BackgroundHtml"] = null; if ( State["BackgroundColor"] == null) State["BackgroundColor"] = "#cccccc"; string background_color_div_prefix = null; if (State["SelectedDeviceType"].ToString() == Constants.IPAD) background_color_div_prefix = "<div style=\"border:0px;width:" + Constants.IPAD_SPLASH_PORTRAIT_WIDTH_S + "px;height:" + Constants.IPAD_SPLASH_PORTRAIT_HEIGHT_S + "px;vertical-align:top;background-color:" + State["BackgroundColor"].ToString() + "\" >"; else if (State["SelectedDeviceType"].ToString() == Constants.ANDROID_TABLET) background_color_div_prefix = "<div style=\"border:0px;width:" + Constants.ANDROID_TABLET_SPLASH_PORTRAIT_WIDTH_S + "px;height:" + Constants.ANDROID_TABLET_SPLASH_PORTRAIT_HEIGHT_S + "px;vertical-align:top;background-color:" + State["BackgroundColor"].ToString() + "\" >"; string background_color_div_suffix = "</div>"; html_content.Text = background_color_div_prefix + State["PageHtml"].ToString() + background_color_div_suffix; if (( State["SelectedAppPage"] == null || x_util.IsFirstAppPage(State, State["SelectedAppPage"].ToString())) ) { left = (State["SelectedDeviceType"].ToString() == Constants.IPAD) ? 731 : 763; string background = "<img src=\"images/editor_images/settings_button.png\" style=\"position:absolute;top:5px;left:" + left.ToString() + "px\"/>"; html_content.Text += background; } } else{ left = 283; if ( State["BackgroundImageUrl"] == null) State["BackgroundImageUrl"] = "https://s3.amazonaws.com/MobiFlexImages/apps/images/backgrounds/standard_w_header_iphone.jpg"; string background = "<img id=\"background_image\" src=\"" + State["BackgroundImageUrl"].ToString() + "\" style=\"position:absolute;top:0px;left:0px;height:100%;width:100%\"/>"; if ((State["SelectedAppPage"] == null || x_util.IsFirstAppPage(State, State["SelectedAppPage"].ToString())) && State["SelectedAppType"].ToString() == Constants.NATIVE_APP_TYPE) { background += "<img src=\"images/editor_images/settings_button.png\" style=\"position:absolute;top:5px;left:" + left.ToString() + "px\"/>"; } html_content.Text = background + State["PageHtml"].ToString(); State["BackgroundHtml"] = background; } } }
public Controls_PageView(string PageName) { XmlUtil x_util = new XmlUtil(); Util util = new Util(); //get page image Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID]; PageImage.ImageUrl = util.GetAppPageImage(State, State["PageViewAppID"].ToString(), PageName); PageImage.ID = PageName + "_PageImage"; PageImage.Attributes.Add("onclick", "goToPage('" + PageName + "');"); PageImage.Attributes.Add("onmouseover", "this.style.cursor='pointer';"); PageImage.Attributes.Add("onmouseout", "this.style.cursor='arrow';"); if (State["UseFullPageImage"] != null) { PageImage.Width = 320; PageImage.Height = 460; } //get page fields XmlDocument doc = x_util.GetStagingAppXml(State); RadTreeNode PageRoot = new RadTreeNode(PageName); PageRoot.CssClass = "RadTreeView"; PageRoot.ImageUrl = "../images/ascx.gif"; PageRoot.Category = "page"; PageRoot.Font.Size = FontUnit.Point(12); OnePageView.Nodes.Add(PageRoot); //do all fields XmlNode page = doc.SelectSingleNode("//pages/page/name[. ='" + PageName + "']").ParentNode; XmlNode fields = page.SelectSingleNode("fields"); if (fields != null) { //sort fields first SortedList list = new SortedList(); SortableList<StoryBoardField> nameList = new SortableList<StoryBoardField>(); foreach (XmlNode child in fields.ChildNodes) { Hashtable dict = new Hashtable(); dict["field_type"] = child.Name; XmlNode id_node = child.SelectSingleNode("id"); dict["id"] = id_node; string input_field = id_node.InnerText.Trim(); if (child.SelectSingleNode("left") != null) dict["left"] = child.SelectSingleNode("left").InnerText; else dict["left"] = "0"; if (child.SelectSingleNode("top") != null) dict["top"] = child.SelectSingleNode("top").InnerText; else dict["top"] = "0"; dict["width"] = child.SelectSingleNode("width").InnerText; dict["height"] = child.SelectSingleNode("height").InnerText; string field_type = dict["field_type"].ToString(); if (field_type == "button" || field_type == "image_button" || field_type == "table" || field_type == "switch") { if(child.SelectSingleNode("submit") != null) dict["submit"] = child.SelectSingleNode("submit").InnerText; } if (field_type == "table" ) { XmlNodeList sub_fields = child.SelectNodes("table_fields/table_field/name"); ArrayList table_list = new ArrayList(); foreach (XmlNode sub_field in sub_fields) { table_list.Add(sub_field.InnerText); } dict["sub_fields"] = table_list; } else if (field_type == "picker") { XmlNodeList sub_fields = child.SelectNodes("picker_fields/picker_field/name"); ArrayList picker_list = new ArrayList(); foreach (XmlNode sub_field in sub_fields) { picker_list.Add(sub_field.InnerText); } dict["sub_fields"] = picker_list; } list[input_field] = dict; nameList.Add(new StoryBoardField(id_node.InnerText.Trim(), Convert.ToInt32(dict["top"].ToString()), Convert.ToInt32(dict["left"].ToString()))); } nameList.Sort("Top", true); foreach (StoryBoardField input_field in nameList) { Hashtable dict = (Hashtable)list[input_field.FieldName]; string field_type = dict["field_type"].ToString(); RadTreeNode field_node = util.CreateFieldNode(PageRoot, input_field.FieldName, field_type); field_node.Value = "left:" + dict["left"].ToString() + ";top:" + dict["top"].ToString() + ";width:" + dict["width"].ToString() + ";height:" + dict["height"].ToString() ; if (dict["submit"] != null && dict["submit"].ToString().Length > 0 && dict["submit"].ToString() != ";") { field_node.BackColor = Color.PeachPuff; string[] submit = dict["submit"].ToString().Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); string target_page_name = null; //this code is compatible with both old and new syntax if (submit[0].StartsWith("post") && (submit[0].Contains("response_page:") || submit[0].Contains("response_page~"))) { target_page_name = submit[0].Substring(19); field_node.Value += ";next_page:" + target_page_name; } else if (submit[0].StartsWith("next_page")) { if (submit[0].Contains("next_page:page~")) target_page_name = submit[0].Substring(15); else target_page_name = submit[0].Substring(10); field_node.Value += ";next_page:" + target_page_name; } } if (field_type == "table" || field_type == "picker") { ArrayList sub_field_list = (ArrayList)dict["sub_fields"]; foreach (string sub_field_name in sub_field_list) { RadTreeNode sub_field_node = util.CreateFieldNode(field_node, sub_field_name, field_type); } } } } OnePageView.ExpandAllNodes(); OnePageView.OnClientMouseOver = "onPageViewMouseOver"; OnePageView.OnClientMouseOut = "onPageViewMouseOut"; }
private void LoadStoryBoard() { Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID]; Util util = new Util(); try { State["PageViewAppID"] = util.GetAppID(State); XmlUtil x_util = new XmlUtil(); XmlDocument doc = x_util.GetStagingAppXml(State); if (doc == null) return; PageTreeView.Nodes.Clear(); string[] pages = x_util.GetAppPageNames(State, State["SelectedApp"].ToString()); for (int i = 0; i < pages.Length; i++) { RadTreeNode page_node = new RadTreeNode(); page_node.CssClass = "RadTreeView"; page_node.Category = "page"; page_node.PostBack = false; Control PageControl = LoadControl("Controls/PageView.ascx", pages[i]); page_node.Controls.Add(PageControl); PageTreeView.Nodes.Add(page_node); } } catch (Exception ex) { throw new Exception(ex.Message + ": " + ex.StackTrace); } }
private void LoadStoryBoard() { Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID]; Util util = new Util(); try { string app_id = null; PageTreeView.Nodes.Clear(); if (State["SelectedApp"] == null || State["SelectedApp"].ToString().Contains("->")) { ExportDesign.Style.Value = "display:none"; if (State["SelectedApp"] == null) { string app = Request.QueryString.Get("app"); if (app == null) return; State["CustomerID"] = Request.QueryString.Get("customerid"); State["SelectedApp"] = app; app_id = util.GetAppIDFromAppName(State, app); } else return; } if (app_id == null) app_id = util.GetAppID(State); ExportDesign.Style.Value = ""; XmlUtil x_util = new XmlUtil(); XmlDocument doc = x_util.GetStagingAppXml(State); if (doc == null) return; string[] pages = x_util.GetAppPageNames(State, State["SelectedApp"].ToString()); State["PageViewAppID"] = app_id; for (int i = 0; i < pages.Length; i++) { RadTreeNode page_node = new RadTreeNode(); page_node.CssClass = "RadTreeView"; page_node.Category = "page"; page_node.PostBack = false; Control PageControl = LoadControl("../../Controls/PageView.ascx", pages[i]); page_node.Controls.Add(PageControl); PageTreeView.Nodes.Add(page_node); } } catch (Exception ex) { throw new Exception(ex.Message + ": " + ex.StackTrace); } }