コード例 #1
0
    public void InitAppPages()
    {
        AppPages.Items.Clear();
        XmlUtil x_util = new XmlUtil();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        string[] pages = x_util.GetAppPageNames(State, State["SelectedApp"].ToString());

        foreach (string page in pages)
        {
            AppPages.Items.Add(new RadComboBoxItem(page, page));
        }
        if (pages.Length == 0)
             State["SelectedAppPage"] = null;

        if ( State["SelectedAppPage"] == null)
        {
            AppPages.SelectedIndex = 0;
             State["SelectedAppPage"] = AppPages.SelectedValue;

        }
        else
            AppPages.SelectedValue =  State["SelectedAppPage"].ToString();

        if (State["SelectedAppPage"] != null)
            PageName.Text = State["SelectedAppPage"].ToString();
    }
コード例 #2
0
    public Controls_GoToPage(string selected_page)
    {
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        XmlUtil x_util = new XmlUtil();
        string[] pages = x_util.GetAppPageNames(State, State["SelectedApp"].ToString());

        gotopage.Items.Clear();
        foreach (string name in pages)
        {
            Telerik.Web.UI.RadComboBoxItem item = new Telerik.Web.UI.RadComboBoxItem(name, name);
            gotopage.Items.Add(item);
            if (name == selected_page)
                item.Selected = true;
        }
    }
コード例 #3
0
 protected void Save_Click(object sender, EventArgs e)
 {
     Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
     if (PageName.Value.Length == 0)
     {
         Message.Text = "Enter an Page Name";
         return;
     }
     else if (!Check.ValidateObjectNameNoSpace(Message, PageName.Value))
     {
         return;
     }
     XmlUtil x_util = new XmlUtil();
     string[] pages = x_util.GetAppPageNames(State, State["SelectedApp"].ToString());
     foreach (string page in pages)
     {
         if (PageName.Value == page)
         {
             Message.Text = "The New Page Name has already been used. Try another name";
             return;
         }
     }
     Message.Text = "Saved.";
 }
コード例 #4
0
    protected bool CheckPageName(string app, string page_name)
    {
        try
        {
            ClearMessages();
            if (page_name.Length == 0)
            {
                Message.Text = "Enter Page Name";
                return false;
            }

            //check for valid name
            if (!Check.ValidateObjectName(Message, page_name))
            {
                return false;
            }

            //check for previous name
            XmlUtil x_util = new XmlUtil();
            Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
            string[] page_names = x_util.GetAppPageNames(State, app);
            foreach (string name in page_names)
            {
                if (name == page_name)
                {
                    Message.Text = "The page name " + page_name + " already exists.";
                    return false;
                }
            }

            return true;
        }
        catch (Exception ex)
        {
            Util util = new Util();
            Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
            util.LogError(State, ex);
            Message.Text = "Internal Error: " + ex.Message + ": " + ex.StackTrace;
            return false;
        }
    }
コード例 #5
0
    protected void AddGoToPage(RadTreeNode DatabaseCommandRoot, string prefix)
    {
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        /*//Code to Stop double addition of command in production that cannot be seen in Debug
        if (State["AddedDeviceActionAlready"] != null)
        {
            if (DateTime.Now.AddSeconds(-3.0) < (DateTime)State["AddedDeviceActionAlready"])
            {
                RefreshCommandsView();
                return;
            }
        }

        State["AddedDeviceActionAlready"] = DateTime.Now;  //for next time
        //End code segment
        */
        ArrayList DBCommands = (ArrayList)State["DBCommands"];
        if (DBCommands == null)
            DBCommands = new ArrayList();

        if (DBCommands.Count > 0)
        {
            Hashtable prev_CommandEntry = (Hashtable)DBCommands[DBCommands.Count - 1];
            if (prefix == null)
            {
                if (prev_CommandEntry["command"].ToString().ToLower() == "if")
                {
                    Message.Text = "Only a 'Then' command can follow an 'If' condition.";
                    Message.ForeColor = Color.Maroon;
                    RefreshCommandsView();
                    return;
                }
            }
            else if (prefix == "Then")
            {
                if (prev_CommandEntry["command"].ToString().ToLower().StartsWith("then"))
                {
                    Message.Text = "Only one 'Then' command can follow an 'If' condition.";
                    Message.ForeColor = Color.Maroon;
                    RefreshCommandsView();
                    return;
                }
                else if (prev_CommandEntry["command"].ToString().ToLower() != "if")
                {
                    Message.Text = "A 'Then' command must follow an 'If' condition.";
                    Message.ForeColor = Color.Maroon;
                    RefreshCommandsView();
                    return;
                }
            }
            else if (prefix == "Else")
            {
                if (prev_CommandEntry["command"].ToString().ToLower().StartsWith("else"))
                {
                    Message.Text = "Only one 'Else' command can follow an 'If' condition.";
                    Message.ForeColor = Color.Maroon;
                    RefreshCommandsView();
                    return;
                }
                else if (!prev_CommandEntry["command"].ToString().ToLower().StartsWith("then"))
                {
                    Message.Text = "An 'Else' command must follow a 'Then' command.";
                    Message.ForeColor = Color.Maroon;
                    RefreshCommandsView();
                    return;
                }
            }
        }

        Hashtable newCommandEntry = new Hashtable();
        if (prefix == null)
            newCommandEntry["command"] = "Go To Page";
        else
            newCommandEntry["command"] = prefix + " Go To Page";

        XmlUtil x_util = new XmlUtil();
        string[] pages = x_util.GetAppPageNames(State, State["SelectedApp"].ToString());
        newCommandEntry["page"] = pages[0];
        if (newCommandEntry["page"] == null)
        {
            Message.Text = "You need to first initialize your Google Docs connection by clicking on 'Connect to Your Google Docs'";
            Message.ForeColor = Color.Maroon;
            return;
        }

        DBCommands.Add(newCommandEntry);

        State["DBCommands"] = DBCommands;

        RefreshCommandsView();
    }
コード例 #6
0
    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);
        }
    }
コード例 #7
0
    protected void ExportDesign_Click(object sender, EventArgs e)
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (util.CheckSessionTimeout(State, Response, "../Default.aspx")) return;

        try
        {
            XmlUtil x_util = new XmlUtil();

            //get PDF file path
            string path = Server.MapPath("../..") + @"\temp_files";
            string file_name = State["SelectedApp"].ToString() + ".pdf";
            file_name = file_name.Replace(" ", "_");
            string save_file_path = path + @"\" + State["Username"].ToString() + "." + file_name;

            //open PDF doc
            var doc = new Document(PageSize.LETTER);
            PdfWriter.GetInstance(doc, new FileStream(save_file_path, FileMode.Create));
            doc.Open();

            //get pages
            string[] pages = x_util.GetAppPageNames(State, State["SelectedApp"].ToString());

            //push content to PDF
            foreach (string page in pages)
            {
                //get page image
                string url = util.GetAppPageImage(State, State["PageViewAppID"].ToString(), page);

                string[] fields = x_util.GetAppPageFields(State, State["SelectedApp"].ToString(), page);
                 StringBuilder fields_string = new StringBuilder();
                bool isFirst = true;
                foreach (string field in fields)
                {
                    if (isFirst)
                        isFirst = false;
                    else
                        fields_string.Append(", ");
                    fields_string.Append(field);

                }

                doc.Add(new Paragraph("Page: " + page));
                if (fields.Length == 0)
                {
                    doc.Add(new Paragraph("There are no fields on this page"));
                    doc.NewPage();
                    continue;
                }
                doc.Add(new Paragraph("Fields: " + fields_string.ToString()));
                doc.Add(new Paragraph(" "));

                try
                {
                    iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(new Uri(url));

                    image.Border = Rectangle.BOX;
                    image.BorderColor = BaseColor.BLACK;
                    image.BorderWidth = 1f;

                    if (State["SelectedDeviceType"].ToString() == Constants.IPAD ||
                        State["SelectedDeviceType"].ToString() == Constants.ANDROID_TABLET)
                        image.ScaleToFit(450f, 600f);
                    else
                        image.ScaleToFit(320f, 460f);

                    doc.Add(image);
                }
                catch (Exception ex0)
                { } //bad image url exception - skip
                doc.NewPage();

            }
            doc.Close();

            doPopup.Text = "../../temp_files/" + State["Username"].ToString() + "." +file_name;
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message + ": " + ex.StackTrace);
        }
    }
コード例 #8
0
    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);
        }
    }
コード例 #9
0
ファイル: Init.cs プロジェクト: dcolonvizi/ViziAppsPortal
    public void InitAppPages(Hashtable State, RadComboBox AppPages, bool includeCurrentPage)
    {
        AppPages.Items.Clear();

        if(State["SelectedApp"] == null || State["SelectedApp"].ToString().Contains("->"))
            return;

        XmlUtil x_util = new XmlUtil();
        string[] pages = x_util.GetAppPageNames(State, State["SelectedApp"].ToString());

        foreach (string page in pages)
        {
            if (!includeCurrentPage && State["SelectedAppPage"] != null && State["SelectedAppPage"].ToString() == page)
                continue;

            AppPages.Items.Add(new RadComboBoxItem(page, page));
        }
        AppPages.SelectedIndex = 0;
    }