示例#1
0
 /// <summary>
 /// 操作成功
 /// </summary>
 private void Macksuccess(string Floderpath, string returnPath)
 {
     try
     {
         We7.CMS.WebControls.Core.BaseControlHelper Helper = new We7.CMS.WebControls.Core.BaseControlHelper();
         Helper.CreateWidegetsIndex();
         returnPath = returnPath.Replace("\\", "~");
         Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Close", "<script>Close('" + returnPath + "');</script>");
     }
     catch (Exception ex)
     {
         //log exMessage
         ErrorMake(Floderpath);
     }
 }
示例#2
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            string widgetName           = NameTextbox.Text;           //部件description名称
            string fileName             = FilenameTextBox.Text;       //部件文件名称
            string widgetValue          = WidgetContentTextBox.Value; //部件内容
            string path                 = Constants.We7HtmlWidgetsFileFolder;
            string returnPath           = "\\" + Constants.We7HtmlWidgetFolder + "\\" + fileName + "\\" + fileName + ".ascx";
            EnumCreateHtmlWidget result = HtmlWidgetHelper.Scope.CreateCreateHtmlWidget(widgetName, fileName, widgetValue, path, (bool)ViewState["IsNew"]);

            if (EnumCreateHtmlWidget.success == result)
            {
                try
                {
                    SaveButton.Enabled        = false;
                    saveAricleButton.Disabled = true;
                    We7.CMS.WebControls.Core.BaseControlHelper Helper = new We7.CMS.WebControls.Core.BaseControlHelper();
                    Helper.CreateWidegetsIndex();
                    Messages.ShowMessage(string.Format("生成部件 {0} 成功!重新部件索引成功!", fileName + ".ascx"));
                    returnPath = returnPath.Replace("\\", "~");
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Close", "<script>Close('" + returnPath + "');</script>");
                }
                catch (Exception ex)
                {
                    SaveButton.Enabled        = true;
                    saveAricleButton.Disabled = false;
                    Messages.ShowError(string.Format("生成部件 {0} 成功!重建部件索引失败:{1}", fileName + ".ascx", ex.Message));
                }
            }
            else if (EnumCreateHtmlWidget.repeat == result)
            {
                Messages.ShowError(string.Format("存在相同的文件“{0}”!请更换名称。", fileName));
            }
            else if (EnumCreateHtmlWidget.error == result)
            {
                Messages.ShowError("未知原因引起的错误!请联系管理员。");
            }
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Close", "<script>closeBg();</script>");
        }