Ejemplo n.º 1
0
        private string GetOpenFileScript()
        {
            string result = string.Empty;

            if (this.AutoOpenDefaultUrl && this.AbsoluteDefaultOpenUrl.IsNotEmpty())
            {
                result = "(function () { var url = '{0}'; var ctlID = '{1}'; var ctrl = $get(ctlID); ";
                //result += "  $get(ctlID).LicenseName = '{2}'; ";
                //result += "  $get(ctlID).LicenseCode = '{3}'; ";
                //result += "  if(url.endsWith('.xls')||url.endsWith('.xlsx')){";
                ////result += "     ctrl.CreateNew('Excel.Application'); ";
                //result += "  }";
                result += "  var path = ctrl.HttpDownloadFileToTempDir(url); ";
                result += "  window.setTimeout(function() { ctrl.open(path);},100); ";
                //result += "  ctrl.SetAppFocus();";
                //result += "  if(url.endsWith('.xls')||url.endsWith('.xlsx')){";
                //result += "    if(ctrl.GetApplication().ActiveSheet) {";
                //result += "	     alert(0);  ctrl.GetApplication().ActiveSheet.Activate;";
                //result += "    }";
                //result += "  }";
                result += "})();";
                result  = result.Replace("{0}", WebUtility.CheckScriptString(this.AbsoluteDefaultOpenUrl));
                result  = result.Replace("{1}", WebUtility.CheckScriptString(this.ViewerControlID));
                //result = result.Replace("{2}", OfficeViewerWrapperSettings.GetConfig().LicenseName);
                //result = result.Replace("{3}", OfficeViewerWrapperSettings.GetConfig().LicenseCode);
            }

            return(result);
        }
Ejemplo n.º 2
0
        public void Response()
        {
            HttpResponse response = HttpContext.Current.Response;

            response.Write(string.Format("<script type=\"text/javascript\">top.document.getElementById(\"processResult\").value=\"{0}\";\ntop.document.getElementById(\"processResultButton\").click();</script>",
                                         WebUtility.CheckScriptString(JSONSerializerExecute.Serialize(this), false)));
        }
Ejemplo n.º 3
0
        public void Response(ProcessProgress progress)
        {
            HttpResponse response = HttpContext.Current.Response;

            response.Write(string.Format("<script type=\"text/javascript\">top.document.getElementById(\"processInfo\").value=\"{0}\";\ntop.document.getElementById(\"processInfoChanged\").click();</script>",
                                         WebUtility.CheckScriptString(JSONSerializerExecute.Serialize(progress), false)));

            response.Flush();
        }
Ejemplo n.º 4
0
        void IMultiProcessPrepareData.ResponsePrepareDataInfo(string text)
        {
            HttpContext.Current.Response.ResponseWithScriptTag((writer) =>
            {
                writer.Write("top.document.getElementById(\"notifyText\").value = ");
                writer.WriteLine("\"" + WebUtility.CheckScriptString(text, false) + "\";");

                writer.WriteLine("top.document.getElementById(\"changeTextBtn\").click();");
            });
        }
Ejemplo n.º 5
0
        private string GetFileOpenedScript()
        {
            string result = string.Empty;

            result = "window.setTimeout(function() { $find(\"{0}\").raiseDocumentOpened();}, 0);$get(\"{1}\").SetAppFocus(); ";
            result = result.Replace("{0}", WebUtility.CheckScriptString(this.ClientID));
            result = result.Replace("{1}", WebUtility.CheckScriptString(this.ViewerControlID));

            return(result);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 关闭并返回
        /// </summary>
        /// <param name="condition"></param>
        public void RegisterReturnValue(object condition)
        {
            var builder = ConditionMapping.GetWhereSqlClauseBuilder(condition);

            var result = JSONSerializerExecute.Serialize(builder);

            Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "DeluxeSearchClientCloseDialog",
                                                    string.Format(
                                                        "window.returnValue = \"{0}\";top.close();",
                                                        WebUtility.CheckScriptString(result, false)), true);
        }
Ejemplo n.º 7
0
        private static void ResponsePrepareDataResult(object data)
        {
            string serializedData = JSONSerializerExecute.Serialize(data);

            HttpContext.Current.Response.ResponseWithScriptTag((writer) =>
            {
                writer.Write("top.document.getElementById(\"preparedData\").value = ");
                writer.WriteLine("\"" + WebUtility.CheckScriptString(serializedData, false) + "\";");

                writer.WriteLine("top.document.getElementById(\"prepareDataFinished\").click();");
            });
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 得到修改父窗口中状态变化的脚本
        /// </summary>
        /// <param name="progress"></param>
        /// <param name="addScriptTag"></param>
        /// <returns></returns>
        public static string GetChangeParentProcessInfoScript(ProcessProgress progress, bool addScriptTag)
        {
            string script = string.Format("parent.document.getElementById(\"{0}\").value=\"{1}\";\nparent.document.getElementById(\"{2}\").click();",
                                          SubmitButton.ProgressInfoHiddenID,
                                          WebUtility.CheckScriptString(JSONSerializerExecute.Serialize(progress), false),
                                          SubmitButton.ProgressInfoChangedButtonID);

            if (addScriptTag)
            {
                script = string.Format("<script type=\"text/javascript\">\n{0}\n</script>", script);
            }

            return(script);
        }
Ejemplo n.º 9
0
            public void SetSubStatusAndLog(int currentStep, int maxStep, string message)
            {
                this.AppendLog(message);
                HttpResponse    response = HttpContext.Current.Response;
                ProcessProgress progress = ProcessProgress.Current;

                progress.CurrentStep = currentStep;
                progress.MaxStep     = maxStep;
                progress.StatusText  = message;

                response.Write(string.Format("<script type=\"text/javascript\">top.document.getElementById(\"processInfo\").value=\"{0}\";\ntop.document.getElementById(\"subProcessInfoChanged\").click();</script>",
                                             WebUtility.CheckScriptString(JSONSerializerExecute.Serialize(progress), false)));
                response.Flush();
            }
Ejemplo n.º 10
0
        private static void ResponseExceptionInfo(System.Exception ex)
        {
            string stackTrace = string.Empty;

            if (WebUtility.AllowResponseExceptionStackTrace())
            {
                stackTrace = ex.StackTrace;
            }

            var errorObj = new { message = ex.Message, description = stackTrace };

            string serializedError = JSONSerializerExecute.Serialize(errorObj);

            HttpContext.Current.Response.ResponseWithScriptTag((writer) =>
            {
                writer.Write("top.document.getElementById(\"prepareDataError\").value = ");
                writer.WriteLine("\"" + WebUtility.CheckScriptString(serializedError, false) + "\";");

                writer.WriteLine("top.document.getElementById(\"raiseErrorBtn\").click();");
            });
        }
Ejemplo n.º 11
0
        protected void confirmButton_TextChanged(object sender, EventArgs e)
        {
            try
            {
                processKey.Value.IsNotEmpty().FalseThrow("流程模板的Key不能为空");
                WfProcessDescriptorManager.ExsitsProcessKey(processKey.Value).TrueThrow("Key为{0}的流程模板定义已经存在", processKey.Value);
                string dropAppName = this.dropApp.Text;
                if (dropAppName == "其它")
                {
                    dropAppName = string.Empty;
                }
                string returnValueJson = string.Format("{{\"Key\":\"{0}\",\"AppName\":\"{1}\"}}", processKey.Value, dropAppName);
                Response.Write(string.Format("<script type='text/javascript'>top.returnValue = '{0}'; top.close();</script>",
                                             WebUtility.CheckScriptString(returnValueJson)));

                Response.End();
            }
            catch (System.Exception ex)
            {
                WebUtility.ShowClientError(ex.Message, ex.StackTrace, "错误");
            }
        }
Ejemplo n.º 12
0
        private void AfterCurrent_ProcessChanged(IWfProcess process)
        {
            Table tbl = GetProcessNavTableContainer();

            this.Controls.Add(tbl);

            StringBuilder strB = new StringBuilder();

            using (StringWriter sw = new StringWriter(strB))
            {
                HtmlTextWriter newWriter = new HtmlTextWriter(sw, "\t");

                RenderContents(newWriter);
            }

            string script = string.Format("$find(\"{0}\")._refreshProcess(\"{1}\");  ",
                                          this.ClientID, WebUtility.CheckScriptString(strB.ToString(), false));

            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), this.ID,
                                                script,
                                                true);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 重载,页面渲染之前
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPreRender(EventArgs e)
        {
            if (!DesignMode)
            {
                if (Page.IsCallback == false)
                {
                    if (CurrentMode == ControlShowingMode.Dialog)
                    {
                        Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);

                        if (!Page.IsPostBack && !Page.IsCallback && !Page.IsCrossPagePostBack)
                        {
                            OnClientBeforeStart     = string.Empty;
                            OnClientFinishedProcess = string.Empty;
                            OnClientCancelProcess   = string.Empty;
                        }

                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ControlID",
                                                                    string.Format("var m_controlID = \"{0}\";", WebUtility.CheckScriptString(this.ClientID, false)),
                                                                    true);
                    }
                    else
                    {
                        if (ShowingMode == ControlShowingMode.Dialog)
                        {
                            InitShowDialogControl();
                        }
                    }
                }
            }
            base.OnPreRender(e);
        }
Ejemplo n.º 14
0
 /// <summary>
 /// 命令执行
 /// </summary>
 public override void Execute()
 {
     if (this.Feature != null)
     {
         HttpContext.Current.Response.Write(this.Feature.ToAdjustWindowScriptBlock(true));
     }
     HttpContext.Current.Response.Write(DeluxeClientScriptManager.AddScriptTags(string.Format("window.navigate(\"{0}\");", WebUtility.CheckScriptString(NavigateUrl))));
     HttpContext.Current.Response.End();
 }