コード例 #1
0
        private void Control_Init()
        {
            if (DataEval.IsEmptyQuery(_scriptid))
            {
                MultiView_Content.SetActiveView(View_New);
            }
            else
            {
                MultiView_Content.SetActiveView(View_Show);

                if (_isshared)
                {
                    Lib.ScriptMgr myScriptMgr = new Lib.ScriptMgr();
                    Lib.Script    myScript    = myScriptMgr.Get_Script_Content(_contentid);

                    _script_type    = StringEnum.GetStringValue(myScript.Script_Type);
                    _script_content = myScript.Script_Content;
                }

                string myCodeBlock_Script = "";

                myCodeBlock_Script = "<script type="
                                     + DataEval.QuoteText(_script_type)
                                     + " >" + "\n"
                                     + _script_content + "\n"
                                     + "</script>" + "\n";

                Literal_TextContent.Text = string.Format("<Pre>{0}</Pre>", Server.HtmlEncode(myCodeBlock_Script));
            }
        }
コード例 #2
0
        protected void btn_Delete_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                for (int i = 0; i < ListView_ItemList.Items.Count; i++)
                {
                    CheckBox chk_Selected = (CheckBox)ListView_ItemList.Items[i].FindControl("chk_Selected");
                    if (chk_Selected.Checked)
                    {
                        HiddenField hidden_ItemID = (HiddenField)ListView_ItemList.Items[i].FindControl("Hidden_ItemID");

                        Lib.ScriptMgr myScriptMgr = new Lib.ScriptMgr();
                        Lib.Script    myScript    = myScriptMgr.Get_Script_Content(hidden_ItemID.Value);

                        // Remove from Database
                        myScriptMgr.Remove_Script_Content(hidden_ItemID.Value);

                        // Remove Item from Category
                        CategoryMgr myCategoryMgr = new CategoryMgr();
                        myCategoryMgr.Delete_ComponentInCategory_Item(myScript.CategoryID, "076A591E-1BFE-47A7-8B40-D6621C7D3DF9");
                    }
                }

                Control_Init();
            }
        }
コード例 #3
0
        protected void btn_Move_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                for (int i = 0; i < ListView_ItemList.Items.Count; i++)
                {
                    CheckBox chk_Selected = (CheckBox)ListView_ItemList.Items[i].FindControl("chk_Selected");
                    if (chk_Selected.Checked)
                    {
                        HiddenField hidden_ItemID = (HiddenField)ListView_ItemList.Items[i].FindControl("Hidden_ItemID");

                        Lib.ScriptMgr myScriptMgr = new Lib.ScriptMgr();
                        Lib.Script    myScript    = myScriptMgr.Get_Script_Content(hidden_ItemID.Value);

                        if (myScript.CategoryID != CategoryTree_MoveTo.Selected_CategoryID)
                        {
                            e2Data[] UpdateData =
                            {
                                new e2Data("ScriptID",   myScript.ScriptID),
                                new e2Data("CategoryID", CategoryTree_MoveTo.Selected_CategoryID)
                            };

                            myScriptMgr.Edit_Script_Content(UpdateData);

                            // Switch Category
                            CategoryMgr myCategoryMgr = new CategoryMgr();
                            myCategoryMgr.Move_ComponentInCategory_Item(myScript.CategoryID, CategoryTree_MoveTo.Selected_CategoryID, "076A591E-1BFE-47A7-8B40-D6621C7D3DF9");
                        }
                    }
                }

                Control_Init();
            }
        }
コード例 #4
0
        private void Control_Init()
        {
            if (!DataEval.IsEmptyQuery(Request["ItemID"]))
            {
                Lib.ScriptMgr myScriptMgr = new Lib.ScriptMgr();
                Lib.Script    myScript    = myScriptMgr.Get_Script_Content(Request["ItemID"]);

                tbx_DisplayName.Text = myScript.Display_Name;

                droplist_Script_Type.SelectedValue = myScript.Script_Type.ToString();
                tbx_TextContent.Text = myScript.Script_Content;
                CategoryTree_Menu.Selected_CategoryID = myScript.CategoryID;

                _itemid                        = myScript.ScriptID;
                ViewState["ItemID"]            = _itemid;
                _source_categoryid             = myScript.CategoryID;
                ViewState["Source_CategoryID"] = _source_categoryid;
            }
            else
            {
                btn_Update.Enabled = false;
            }
        }
コード例 #5
0
        private void Control_Init()
        {
            if (_isshared)
            {
                Lib.ScriptMgr myScriptMgr = new Lib.ScriptMgr();
                Lib.Script    myScript    = myScriptMgr.Get_Script_Content(_contentid);

                _script_type    = StringEnum.GetStringValue(myScript.Script_Type);
                _script_content = myScript.Script_Content;
            }

            HtmlGenericControl myCodeBlock_ScriptTag = new HtmlGenericControl("script");

            myCodeBlock_ScriptTag.Attributes.Add("type", _script_type);

            Literal myCodeBlock_ScriptText = new Literal();

            myCodeBlock_ScriptText.Text = _script_content;

            myCodeBlock_ScriptTag.Controls.Add(myCodeBlock_ScriptText);

            PlaceHolder_Content.Controls.Add(myCodeBlock_ScriptTag);
        }
コード例 #6
0
        private void Control_Init()
        {
            #region Default setting

            //Gets your enum names and adds it to a string array
            Array enumNames = Enum.GetValues(typeof(Lib.Script_Type));

            //Creates an ArrayList
            ArrayList myScriptTypes = new ArrayList();

            //Loop through your string array and poppulates the ArrayList
            foreach (Lib.Script_Type myScriptType in enumNames)
            {
                myScriptTypes.Add(new { Value = StringEnum.GetStringValue(myScriptType), Name = myScriptType.ToString() });
            }

            //Bind the ArrayList to your DropDownList
            droplist_Script_Type.DataSource     = myScriptTypes;
            droplist_Script_Type.DataTextField  = "Name";
            droplist_Script_Type.DataValueField = "Value";
            droplist_Script_Type.DataBind();

            tbx_TextContent.Text = "";

            #endregion

            if (!DataEval.IsEmptyQuery(_scriptid))
            {
                if (_isshared)
                {
                    Lib.ScriptMgr myScriptMgr = new Lib.ScriptMgr();
                    Lib.Script    myScript    = myScriptMgr.Get_Script_Content(_contentid);

                    _script_type             = StringEnum.GetStringValue(myScript.Script_Type);
                    ViewState["Script_Type"] = _script_type;

                    _script_content             = myScript.Script_Content;
                    ViewState["Script_Content"] = _script_content;
                }

                droplist_Script_Type.SelectedValue = _script_type;
                tbx_TextContent.Text = _script_content;
            }
            else
            {
                if (_isshared)
                {
                    Lib.ScriptMgr myScriptMgr = new Lib.ScriptMgr();
                    Lib.Script    myScript    = myScriptMgr.Get_Script_Content(_contentid);

                    _script_type             = StringEnum.GetStringValue(myScript.Script_Type);
                    ViewState["Script_Type"] = _script_type;

                    _script_content             = myScript.Script_Content;
                    ViewState["Script_Content"] = _script_content;

                    droplist_Script_Type.SelectedValue = _script_type;
                    tbx_TextContent.Text = _script_content;
                }
            }

            Reset_Buttons();
            MultiView_Editor.SetActiveView(View_Editor);
        }