Ejemplo n.º 1
0
 NextCall directlyViaHttp(WorkflowMethod invoker)
 {
     ContentFormDefinition cfd = new ContentFormDefinition();
     if (downloadError != null) {
         cfd.AddPropertyHeading(null, "<br /><font color=red>" + HttpUtility.HtmlEncode(downloadError) + "</font><br /><br />", false, true, true);
     } else {
         cfd.AddPropertyHeading(null, "<br /><br />", false, true, true);
     }
     downloadError = null;
     cfd.AddPropertyShortString("url", "Site URL", Session.GetSetting<string>("MergeDef.Url", PersistenceScope.Application, "http://"), true);
     cfd.AddPropertyShortString("username", "Admin Username");
     cfd.AddPropertyShortString("password", "Admin Password", null, null, new ShortStringPropertySettings() { ControlType = ShortStringControlType.Password });
     var diag = new WMContentForm(DialogueIcon.None, "Please provide connection details:", 400, 130, cfd);
     return new NextCall(diag, onDirectlyViaHttpAnswer);
 }
Ejemplo n.º 2
0
 public override NextCall Invoke(WorkflowMethod invoker)
 {
     _find = Session.GetSetting<string>(this.GetType().FullName + "_find", PersistenceScope.UserSession, "");
     _replace = Session.GetSetting<string>(this.GetType().FullName + "_replace", PersistenceScope.UserSession, "");
     _where = Session.GetSetting<string>(this.GetType().FullName + "_where", PersistenceScope.UserSession, "allContent");
     _caseSensitive = Session.GetSetting<bool>(this.GetType().FullName + "_caseSensitive", PersistenceScope.UserSession, false);
     _searchHtmlSource = Session.GetSetting<bool>(this.GetType().FullName + "_searchHtmlSource", PersistenceScope.UserSession, false);
     _allRevision = Session.GetSetting<bool>(this.GetType().FullName + "_allRevisions", PersistenceScope.UserSession, false);
     _allCultures = Session.GetSetting<bool>(this.GetType().FullName + "_allCultures", PersistenceScope.UserSession, false);
     _allSites = Session.GetSetting<bool>(this.GetType().FullName + "_allSites", PersistenceScope.UserSession, false);
     ContentFormDefinition cfd = new ContentFormDefinition();
     cfd.AddPropertyShortString("find", "Find", _find);
     cfd.AddPropertyShortString("replace", "Replace", _replace);
     ShortStringPropertySettings s = new ShortStringPropertySettings();
     s.ControlType = ShortStringControlType.DropDown;
     s.Items = new Dictionary<string, CsdStringSetting>();
     s.Items.Add("allContent", new CsdStringSetting("Any content"));
     s.Items.Add("selectedContent", new CsdStringSetting("Selected contents..."));
     s.Items.Add("selectTypes", new CsdStringSetting("Selected types..."));
     cfd.AddPropertyShortString("where", "Where", _where, null, s);
     cfd.AddPropertyCheckBox("caseSensitive", "Match case", _caseSensitive);
     cfd.AddPropertyCheckBox("searchHtmlSource", "HTML source", _searchHtmlSource);
     cfd.AddPropertyCheckBox("allRevisions", "All revisions", _allRevision);
     cfd.AddPropertyCheckBox("allCultures", "All languages", _allCultures);
     cfd.AddPropertyCheckBox("allSites", "All sites", _allSites);
     cfd.AddPropertyHeading("", "<br /><font color=\"gray\">WARNING: It is not possible to undo a replace operation. </font>", false, false, true);
     string[] buttons = new string[] { "Find..." };
     WMContentForm contentFormDiag = new WMContentForm(DialogueIcon.Question, "Find and replace text:", 400, 220, cfd, buttons, true);
     return new NextCall(contentFormDiag, onCompleteStep1);
 }
Ejemplo n.º 3
0
 public override NextCall Invoke(WorkflowMethod invoker)
 {
     var cfd = new ContentFormDefinition();
     cfd.AddPropertyHeading("Please provide a definition file",
          "The new ontology will be merged with the existing one, but you will be able to review all changes before they take place."
         + "<br/><br/>"
         + "IMPORTANT: Remember to do a \"Full Rebuild\" on both installations before you perform a merge. "
         + "<br/><br/>", false, false, true);
     cfd.AddPropertyCheckBox("useNames", "Do not use Guids");
     WMContentForm q = new WMContentForm(DialogueIcon.Question, null, 370, 150, cfd, new string[] { "Directly via HTTP", "Upload file", "Paste XML" }, true);
     //WMQuestion q = new WMQuestion(DialogueIcon.Question, UIButtons.Cancel,
     //    new string[] { "Directly via HTTP", "Upload file", "Paste XML" },
     //    "Please provide a definition file",
     //     "The new ontology will be merged with the existing one, but you will be able to review all changes before they take place."
     //    + Environment.NewLine + Environment.NewLine
     //    + "IMPORTANT: Remember to do a \"Full Rebuild\" on both installations before you perform a merge. "
     //    + Environment.NewLine + Environment.NewLine
     //    );
     return new NextCall(q, onAnswer);
 }
Ejemplo n.º 4
0
 public override NextCall Invoke(WorkflowMethod invoker)
 {
     ContentFormDefinition cfd = new ContentFormDefinition();
     ShortStringPropertySettings s = new ShortStringPropertySettings();
     s.ControlType = ShortStringControlType.DropDown;
     s.Items = new Dictionary<string, CsdStringSetting>();
     s.Items.Add("m1", new CsdStringSetting("1 Megapixels"));
     s.Items.Add("m2", new CsdStringSetting("2 Megapixels"));
     s.Items.Add("m3", new CsdStringSetting("3 Megapixels"));
     s.Items.Add("m4", new CsdStringSetting("4 Megapixels"));
     s.Items.Add("m6", new CsdStringSetting("6 Megapixels"));
     s.Items.Add("m8", new CsdStringSetting("8 Megapixels"));
     s.Items.Add("m10", new CsdStringSetting("10 Megapixels"));
     s.Items.Add("m15", new CsdStringSetting("15 Megapixels"));
     cfd.AddPropertyHeading(null, "<br/>Please select the maximum amount of pixels for any image:<br/><br/>", false, true, true);
     cfd.AddPropertyShortString("megapixels", "Maximum", "m4", null, s);
     return new NextCall(new WMContentForm(DialogueIcon.Question, "Rescale large images", 400, 70, cfd), onComplete);
 }
Ejemplo n.º 5
0
 public override NextCall Invoke(WorkflowMethod invoker)
 {
     string errorText = null;
     if (invoker is WMContentForm) {
         _text = ((WMContentForm)invoker).Result.Get<LongStringPropertyValue>("values").Value;
         string[] rows = _text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
         try {
             int colCodeName = -1;
             int colValue = -1;
             Dictionary<int, int> colsNameByLcId = new Dictionary<int, int>();
             Dictionary<int, int> colsDescByLcId = new Dictionary<int, int>();
             var header = rows[0].Split(new char[] { '\t', ';' }, StringSplitOptions.None);
             for (int col = 0; col < header.Length; col++) {
                 string v = header[col].Trim();
                 if (v == "CODENAME") colCodeName = col;
                 else if (v == "VALUE") colValue = col;
                 else if (v.StartsWith("NAME")) colsNameByLcId.Add(col, int.Parse(v.Substring(4)));
                 else if (v.StartsWith("DESC")) colsDescByLcId.Add(col, int.Parse(v.Substring(4)));
             }
             var newValues = new Dictionary<int, MemDefEnumerationValue>();
             for (int row = 1; row < rows.Length; row++) {
                 var e = new MemDefEnumerationValue();
                 var cols = rows[row].Split(new char[] { '\t', ';' }, StringSplitOptions.None);
                 e.CodeName = cols[colCodeName].Trim();
                 e.Value = int.Parse(cols[colValue].Trim());
                 foreach (int col in colsNameByLcId.Keys) e.NameByLCID.Add(colsNameByLcId[col], cols[col].Trim());
                 foreach (int col in colsDescByLcId.Keys) e.DescriptionByLCID.Add(colsDescByLcId[col], cols[col].Trim());
                 newValues.Add(e.Value, e);
             }
             _defEnum.Values = newValues;
             WFContext.SendClientScriptToStartupRequest(_onCompleteScript);
             return null;
         } catch (Exception error) {
             errorText = "The import failed, there are formatting errors in the text. " + error.Message + " ";
         }
     }
     ContentFormDefinition cfd = new ContentFormDefinition();
     var settings = new LongStringPropertySettings();
     settings.Height = Unit.Percentage(95);
     settings.Layout = PropertyLayout.NoTitle;
     cfd.AddPropertyHeading("", "<span style=\"color:red;\">" + errorText + "</span>Each column can be separated by a TAB or SEMICOLON. Use Excel or similar to edit large datasets. Select paste \"as text\" when pasting into excel for best formatting. You must include the first header to indicate the position of each coloum. You may add or delete language specific columns. Not all language specific columns must be filled in for each row.", false, true, true, Unit.Percentage(100), Unit.Pixel(70));
     cfd.AddPropertyLongString("values", "Values", _text, null, settings);
     return new NextCall(new WMContentForm(DialogueIcon.Info, "Values of \"" + _defEnum.CodeName + "\"", 600, 300, cfd, new string[] { "Import values..." }, true), Invoke);
 }
Ejemplo n.º 6
0
    public override NextCall Invoke(WorkflowMethod invoker)
    {
        _find = Session.GetSetting<string>(this.GetType().FullName + "_find", PersistenceScope.UserSession, "");
        _replace = Session.GetSetting<string>(this.GetType().FullName + "_replace", PersistenceScope.UserSession, "");
        _where = Session.GetSetting<string>(this.GetType().FullName + "_where", PersistenceScope.UserSession, "allContent");
        _caseSensitive = Session.GetSetting<bool>(this.GetType().FullName + "_caseSensitive", PersistenceScope.UserSession, false);
        _searchHtmlSource = Session.GetSetting<bool>(this.GetType().FullName + "_searchHtmlSource", PersistenceScope.UserSession, false);
        _allRevision = Session.GetSetting<bool>(this.GetType().FullName + "_allRevisions", PersistenceScope.UserSession, false);
        _allCultures = Session.GetSetting<bool>(this.GetType().FullName + "_allCultures", PersistenceScope.UserSession, false);
        _allSites = Session.GetSetting<bool>(this.GetType().FullName + "_allSites", PersistenceScope.UserSession, false);
        ContentFormDefinition cfd = new ContentFormDefinition();

        cfd.AddPropertyShortString("find", Local.Text("Web.WAF.Edit.ContentFind"), _find);
        cfd.AddPropertyShortString("replace",Local.Text("Web.WAF.Edit.ContentReplace"), _replace);
        ShortStringPropertySettings s = new ShortStringPropertySettings();
        s.ControlType = ShortStringControlType.DropDown;
        s.Items = new Dictionary<string, CsdStringSetting>();
        s.Items.Add("allContent", new CsdStringSetting(Local.Text("Web.WAF.Edit.ContentAnyContent")));
        s.Items.Add("selectedContent", new CsdStringSetting(Local.Text("Web.WAF.Edit.ContentSelectedContents")));
        s.Items.Add("selectTypes", new CsdStringSetting(Local.Text("Web.WAF.Edit.ContentSelectedTypes")));
        cfd.AddPropertyShortString("where",Local.Text("Web.WAF.Edit.ContentWhere"), _where, null, s);
        cfd.AddPropertyCheckBox("caseSensitive", Local.Text("Web.WAF.Edit.ContentMatchCase"), _caseSensitive);
        cfd.AddPropertyCheckBox("searchHtmlSource",  Local.Text("Web.WAF.Edit.ContentHtmlSource"), _searchHtmlSource);
        cfd.AddPropertyCheckBox("allRevisions",Local.Text("Web.WAF.Edit.ContentAllRevisions"), _allRevision);
        cfd.AddPropertyCheckBox("allCultures", Local.Text("Web.WAF.Edit.ContentAllLanguages"), _allCultures);
        cfd.AddPropertyCheckBox("allSites",Local.Text("Web.WAF.Edit.ContentAllSites"), _allSites);

        cfd.AddPropertyHeading("", "<br /><font color=\"gray\">" + Local.Text("Web.WAF.Edit.ContentWarningHtml") + "</font>", false, false, true);
        string[] buttons = new string[] {Local.Text("Web.WAF.Edit.ContentFind...")  };
        WMContentForm contentFormDiag = new WMContentForm(DialogueIcon.Question, Local.Text("Web.WAF.Edit.ContentFindAndReplace"), 400, 220, cfd, buttons, true);
        return new NextCall(contentFormDiag, onCompleteStep1);
    }
Ejemplo n.º 7
0
    NextCall edit(WorkflowMethod invoker)
    {
        WFContext.Caption = "Editing webfram settings...";
        WFContext.InBackgroundMode = true;
        ContentFormDefinition cfd = new ContentFormDefinition();
        {
            cfd.AddPropertyHeading("", "&nbsp;", false, true, true);
        }
        {
            var settings = new LongStringPropertySettings();
            settings.Width = Unit.Percentage(100);
            settings.Height = Unit.Pixel(200);
            settings.Enabled = true;
            cfd.AddPropertyLongString("config", "WebFarm.config", WAFRuntime.WebFarm.GetConfig(), null, settings);
        }
        {
            var settings = new ShortStringPropertySettings();
            settings.Enabled = false;
            cfd.AddPropertyShortString("proguid", "This process GUID", WAFRuntime.WebFarm.ThisProcessGuid.ToString(), null, settings);
            settings = new ShortStringPropertySettings();
            settings.Enabled = false;
            cfd.AddPropertyShortString("insguid", "This installation GUID", WAFRuntime.WebFarm.ThisInstallationGuid.ToString(), null, settings);
            settings = new ShortStringPropertySettings();
            settings.Enabled = false;
            cfd.AddPropertyShortString("instname", "This installation name", WAFRuntime.WebFarm.ThisInstallationName, null, settings);
        }
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("<div>&nbsp;</div>");
            sb.Append("<table cellpadding=\"0\" cellspacing=\"0\">");
            sb.Append("<tr>");
            sb.Append("<td style=\"font-size:9px; color:gray; width:220px;\">INSTALLATION</td>");
            sb.Append("<td style=\"font-size:9px; color:gray; width:120px;\">CONTACT</td>");
            sb.Append("<td style=\"font-size:9px; color:gray; width:130px; text-align:right;\">PAGEVIEWS / MINUTE</td>");
            sb.Append("<td style=\"font-size:9px; color:gray; width:140px; text-align:right;\">REQUESTS / MINUTE</td>");
            sb.Append("</tr>");
            sb.Append("<tr>");
            sb.Append("<td style=\"font-size:9px; \">&nbsp;</td>");
            sb.Append("</tr>");
            var now = DateTime.Now;
            foreach (var p in WAFRuntime.WebFarm.Processes.OrderBy(p => p.Installation.Name)) {
                sb.Append("<tr>");
                sb.Append("<td><span title=\"Installation ID: " + p.Installation.Guid + "  Process ID: " + p.Guid + "\">" + p.Installation.Name + "</span></td>");
                sb.Append("<td>" + Utils.GetTimespanString(now.Subtract(p.LastPing)) + " ago</td>");
                sb.Append("<td style=\"text-align:right;\">" + p.Installation.PageViewsPerMinute.Count.ToString("### ##0") + "</td>");
                sb.Append("<td style=\"text-align:right;\">" + p.Installation.RequestsPerMinute.Count.ToString("### ##0") + "</td>");
                sb.Append("</tr>");
            }
            sb.Append("</table>");
            cfd.AddPropertyHeading("", sb.ToString(), false, true, true);
        }

        WMContentForm diag = new WMContentForm(DialogueIcon.None, "Web farm settings:", 720, 450, cfd, new string[] { "Refresh", "Save & Restart", "Close" }, false);
        return new NextCall(diag, onComplete);
    }