NextCall pasteXml() { var cfd = new ContentFormDefinition(); cfd.AddPropertyLongString("xml", "Paste the entire definition file here as XML:", null, null, new LongStringPropertySettings() { Height = 300, Focus = true, Layout = PropertyLayout.TwoRows }); var diag = new WMContentForm(DialogueIcon.None, "Import and merge new onology", 500, 320, cfd); return new NextCall(diag, onCompletePaste); }
NextCall edit(WorkflowMethod invoker) { WFContext.Caption = "Editing webfram settings..."; WFContext.InBackgroundMode = true; ContentFormDefinition cfd = new ContentFormDefinition(); try { { var settings = new ShortStringPropertySettings(); settings.Enabled = false; cfd.AddPropertyShortString("guid", "This server GUID", WAFRuntime.WebFarm.ThisServer.Guid.ToString(), null, settings); } { var settings = new ShortStringPropertySettings(); settings.Enabled = false; cfd.AddPropertyShortString("name", "This server Name", WAFRuntime.WebFarm.ThisServer.Name, null, settings); } } catch { } { var settings = new LongStringPropertySettings(); settings.Width = Unit.Percentage(100); settings.Height = Unit.Percentage(99); settings.Layout = PropertyLayout.NoTitle; cfd.AddPropertyLongString("xmlText", null, WAFRuntime.WebFarm.GetConfig(), null, settings); } WMContentForm diag = new WMContentForm(DialogueIcon.None, "Web farm settings:", 720, 400, cfd, new string[] { "Save", "Refresh", "Restart all servers", "Close" }, false); return new NextCall(diag, onComplete); }
public override NextCall Invoke(WorkflowMethod invoker) { WFContext.Caption = "Editing definitions..."; WFContext.InBackgroundMode = true; ContentFormDefinition cfd = new ContentFormDefinition(); LongStringPropertySettings settings = new LongStringPropertySettings(); settings.Width = Unit.Percentage(100); settings.Height = Unit.Percentage(99); settings.Layout = PropertyLayout.NoTitle; settings.Enabled = false; string xmlText = File.ReadAllText(WAFContext.PathCustomDefinitions + "ContentDefinitionsNoIds.xml"); cfd.AddPropertyLongString("xmlText", null, xmlText, null, settings); WMContentForm diag = new WMContentForm(DialogueIcon.None, "Please select and copy this text:", 720, 400, cfd, new string[] { "Close" }, false); return new NextCall(diag); }
NextCall editIds() { ContentFormDefinition cfd = new ContentFormDefinition(); StringBuilder sb = new StringBuilder(); foreach (var id in _nodeIds) { sb.Append(id); sb.Append("; "); } cfd.AddPropertyLongString("ids", "Node IDs or Guids", sb.ToString(), null, new LongStringPropertySettings() { Height = 100, Layout = PropertyLayout.TwoRows, Focus = true }); var diag = new WMContentForm(DialogueIcon.Question, "Please specify the nodes to export", 600, 120, cfd, new string[] { "Export", "Pick IDs", "Verify IDs", "Convert to Guids", "Convert to Node IDs" }, true); return new NextCall(diag, onAnswer); }
public override NextCall Invoke(WorkflowMethod invoker) { var cfd = new ContentFormDefinition(); string name; if (Session.Access.IsStored) { name = Session.GetUser().Name; } else { name = Utils.GetFriendlyName(Session.Access.UserType.ToString()); } ShortStringPropertySettings s = new ShortStringPropertySettings(); cfd.AddPropertyShortString("from", "From", name, null, s); s.Focus = true; cfd.AddPropertyLongString("message", "Message"); var q = new WMContentForm(DialogueIcon.Question, "Please type message to send:", 400, 100, cfd); return new NextCall(q, onComplete); }
NextCall edit(WorkflowMethod invoker) { WFContext.Caption = "Editing definitions..."; WFContext.InBackgroundMode = true; ContentFormDefinition cfd = new ContentFormDefinition(); LongStringPropertySettings settings = new LongStringPropertySettings(); settings.Width = Unit.Percentage(100); settings.Height = Unit.Percentage(99); settings.Layout = PropertyLayout.NoTitle; cfd.AddPropertyLongString("xmlText", null, _xmlText, null, settings); WMContentForm diag = new WMContentForm(DialogueIcon.None, "The content of the temporary definition file:", 720, 400, cfd, new string[] { "Save...", "Validate hot...", "Validate full...", "Hot rebuild...", "Full rebuild...", "Close" }, false); return new NextCall(diag, onComplete); }
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); }
NextCall edit(WorkflowMethod invoker) { WFContext.Caption = "Editing webfram settings..."; WFContext.InBackgroundMode = true; ContentFormDefinition cfd = new ContentFormDefinition(); { cfd.AddPropertyHeading("", " ", 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> </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; \"> </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); }