public HttpResponseMessage CreateMenu(System.Net.Http.Formatting.FormDataCollection form) { HttpResponseMessage msg = new HttpResponseMessage(HttpStatusCode.OK); try { string json = form.Get("menu"); string token = GetAccessToken(sAppID); string apiUri = string.Format("https://api.weixin.qq.com/cgi-bin/menu/create?access_token={0}", token); HttpClient client = new HttpClient(); string requestJson = json; StringContent content = new StringContent(requestJson, Encoding.UTF8); var response = client.PostAsync(apiUri, content); string tickJson = response.Result.Content.ReadAsStringAsync().Result; msg.Content = new StringContent(tickJson, System.Text.Encoding.UTF8, "text/html"); } catch (Exception ex) { msg.Content = new StringContent(ex.Message, System.Text.Encoding.UTF8, "text/html"); } return(msg); }
/* * // GET: api/Mattermost * public IEnumerable<string> Get() * { * return new string[] { "value1", "value2" }; * } */ /* * // GET: api/Mattermost/5 * public string Get(int id) * { * return "value"; * } */ // POST: api/Mattermost public MattermostReturnPayload PostData(System.Net.Http.Formatting.FormDataCollection formData) { string Command = ""; if (formData != null) { Command = formData.Get("command"); } MattermostReturnPayload response = new MattermostReturnPayload(); if (!String.IsNullOrEmpty(Command) && Command.Contains("sample")) { response.text = "| Component | Tests Run | Tests Failed |\n" + "|:-----------|:------------|:-----------------------------------------------|\n" + "| Server | 948 | :white_check_mark: 0 |\n" + "| Web Client | 123 | :warning: [2(see details)] |\n" + "| iOS Client | 78 | :warning: [3(see details)](http://linktologs) |\n"; } else if (!String.IsNullOrEmpty(Command) && Command.Contains("ean")) { string TargetEan = ""; string UserName = ""; if (formData != null) { TargetEan = formData.Get("text"); UserName = formData.Get("user_name"); } // Default Value response.text = "| Ean | Price | Title \n" + "|:-----------------|:-----------|:----------------\n" + "| N/A | N/A | No Ean provided \n"; if (!String.IsNullOrEmpty(TargetEan)) { string Title = ""; string Price = ""; // Title = getTitle(TargetEan); // Price = getPrice(TargetEan); response.text = "| Ean | Price | Title \n" + "|:-----------------|:-----------|:-----------n" + "| " + TargetEan.PadLeft(13, '0') + " | " + Price + " | " + Title + "\n"; System.Console.WriteLine("DEBUG: User(" + UserName + ") requested to see the data for EAN(" + TargetEan + ")."); } } // MORE SAMPLE CODE WILL BE WRITTEN HERE return(response); }
public IHttpActionResult PostAllTareas(System.Net.Http.Formatting.FormDataCollection formulario) { //is this condition true ? yes : no //chequea el null y el vacio var valorgrupoPrograma = formulario.Get("grupoPrograma") ?? "0"; //var GrupoPrograma = Int32.Parse(formulario.Get("grupoPrograma")=="" ? "0": formulario.Get("grupoPrograma")); var GrupoPrograma = Int32.Parse(valorgrupoPrograma == "" ? "0" : valorgrupoPrograma); var valorprograma = formulario.Get("programa") ?? "0"; var Programa = Int32.Parse(valorprograma == "" ? "0" : valorprograma); var valoractor = formulario.Get("actor") ?? ""; var Actor = valoractor == "" ? "" : valoractor; var valorusuarioID = formulario.Get("usuarioID") ?? "0"; var UsuarioId = Int32.Parse(valorusuarioID == "" ? "0" : valorusuarioID); // var UsuarioId = Int32.Parse(formulario.Get("usuarioID") == "" ? "0" : formulario.Get("usuarioID")); var valorusuario = formulario.Get("usuario") ?? ""; var Usuario = valorusuario == "" ? "" : valorusuario; // var Formato = Int32.Parse(formulario.Get("formato") == "" ? "0" : formulario.Get("formato")); var valorformato = formulario.Get("formato") ?? "0"; var Formato = Int32.Parse(valorformato == "" ? "0" : valorformato); CircuitosService s = new CircuitosService(); //List<Tarea> tareas = s.GetTareas(id); // string id = value.id; datos = s.GetCircuitosDatos(GrupoPrograma, Programa, Actor, UsuarioId, Usuario, Formato, datos); //datos = s.GetCircuitosDatos(0, 0, "", 0, "", 0, datos); try { return(Ok(datos)); } catch (Exception e) { Console.WriteLine("{0} Exception caught.", e); return(Ok(datos)); } }
/// <summary> /// Get menu/s for nodes in tree /// </summary> /// <param name="id"></param> /// <param name="queryStrings"></param> /// <returns></returns> protected override MenuItemCollection GetMenuForNode(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { var menu = new MenuItemCollection(); //If the node is the root node (top of tree) if (id == Constants.System.Root.ToInvariantString()) { //Add in refresh action menu.Items.Add <RefreshNode, ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), false); } return(menu); }
protected override MenuItemCollection GetMenuForNode(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { var menu = new MenuItemCollection(); // create and reload on nodes if (id == Constants.System.Root.ToInvariantString() || id == "pipelines") { menu.Items .Add <ActionNew>(GetTranslation("general/new") + " " + GetTranslation("pipeline/opportunity"), false) .NavigateToRoute("/pipelineCrm/pipelineCrmTree/edit/-1"); } else if (id.EndsWith("_pipelines")) { menu.Items .Add <ActionNew>(GetTranslation("general/new") + " " + GetTranslation("pipeline/opportunity"), false) .NavigateToRoute("/pipelineCrm/pipelineCrmTree/edit/-1?statusId=" + id.Split('_')[0]); } else if (id == "organisations") { menu.Items .Add <ActionNew>(GetTranslation("general/new") + " " + GetTranslation("pipeline/organisation"), false) .NavigateToRoute("/pipelineCrm/pipelineCrmTree/edit.organisation/-1"); } else if (id.EndsWith("_organisations")) { menu.Items .Add <ActionNew>(GetTranslation("general/new") + " " + GetTranslation("pipeline/organisation"), false) .NavigateToRoute("/pipelineCrm/pipelineCrmTree/edit.organisation/-1?typeId=" + id.Split('_')[0]); } else if (id == "contacts") { menu.Items .Add <ActionNew>(GetTranslation("general/new") + " " + GetTranslation("pipeline/contact"), false) .NavigateToRoute("/pipelineCrm/pipelineCrmTree/edit.contact/-1"); } else if (id.EndsWith("_contacts")) { menu.Items .Add <ActionNew>(GetTranslation("general/new") + " " + GetTranslation("pipeline/contact"), false) .NavigateToRoute("/pipelineCrm/pipelineCrmTree/edit.contact/-1?typeId=" + id.Split('_')[0]); } menu.Items.Add <RefreshNode, ActionRefresh>(GetTranslation(string.Format("actions/{0}", ActionRefresh.Instance.Alias))); return(menu); }
protected override Umbraco.Web.Models.Trees.TreeNodeCollection GetTreeNodes(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { throw new NotSupportedException(); }
protected override Models.Trees.TreeNodeCollection GetTreeNodes(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { string orgPath = ""; string path = ""; if (!string.IsNullOrEmpty(id) && id != "-1") { orgPath = id; path = IOHelper.MapPath(FilePath + "/" + orgPath); orgPath += "/"; } else { path = IOHelper.MapPath(FilePath); } DirectoryInfo dirInfo = new DirectoryInfo(path); DirectoryInfo[] dirInfos = dirInfo.GetDirectories(); var nodes = new TreeNodeCollection(); foreach (DirectoryInfo dir in dirInfos) { if ((dir.Attributes & FileAttributes.Hidden) == 0) { var HasChildren = dir.GetFiles().Length > 0 || dir.GetDirectories().Length > 0; var node = CreateTreeNode(orgPath + dir.Name, orgPath, queryStrings, dir.Name, "icon-folder", HasChildren); OnRenderFolderNode(ref node); if (node != null) { nodes.Add(node); } } } //this is a hack to enable file system tree to support multiple file extension look-up //so the pattern both support *.* *.xml and xml,js,vb for lookups string[] allowedExtensions = new string[0]; bool filterByMultipleExtensions = FileSearchPattern.Contains(","); FileInfo[] fileInfo; if (filterByMultipleExtensions) { fileInfo = dirInfo.GetFiles(); allowedExtensions = FileSearchPattern.ToLower().Split(','); } else { fileInfo = dirInfo.GetFiles(FileSearchPattern); } foreach (FileInfo file in fileInfo) { if ((file.Attributes & FileAttributes.Hidden) == 0) { if (filterByMultipleExtensions && Array.IndexOf <string>(allowedExtensions, file.Extension.ToLower().Trim('.')) < 0) { continue; } var node = CreateTreeNode(orgPath + file.Name, orgPath, queryStrings, file.Name, "icon-file", false); OnRenderFileNode(ref node); if (node != null) { nodes.Add(node); } } } return(nodes); }
protected override Umbraco.Web.Models.Trees.MenuItemCollection GetMenuForNode(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { var menu = new Umbraco.Web.Models.Trees.MenuItemCollection(); menu.Items.Clear(); return(menu); }
protected override Umbraco.Web.Models.Trees.MenuItemCollection GetMenuForNode(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { var textService = ApplicationContext.Services.TextService; var deleteText = textService.Localize($"actions/{ActionDelete.Instance.Alias}"); var leBlenderCourierItem = new MenuItem { Alias = "transferEditor", Name = "Transfer Editors", Icon = "umb-deploy" }; var menu = new MenuItemCollection(); if (id == Constants.System.Root.ToInvariantString()) { var createText = textService.Localize($"actions/{ActionNew.Instance.Alias}"); var sortText = textService.Localize($"actions/{ActionSort.Instance.Alias}"); var refreshNodeText = textService.Localize($"actions/{ActionRefresh.Instance.Alias}"); var deleteAll = new MenuItem { Alias = "delete", Name = "Delete All Editors", Icon = "delete" }; deleteAll.AdditionalData.Add("DeleteAll", true); // root actions leBlenderCourierItem.AdditionalData.Add("TransferAll", true); menu.Items.Add(leBlenderCourierItem); menu.Items.Add <CreateChildEntity, ActionNew>(createText); menu.Items.Add <ActionSort>(sortText); menu.Items.Add <RefreshNode, ActionRefresh>(refreshNodeText, true); menu.Items.Add(deleteAll); return(menu); } leBlenderCourierItem.Name = "Transfer Editor"; menu.Items.Add(leBlenderCourierItem); menu.Items.Add <ActionDelete>(deleteText); return(menu); }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <param name="queryStrings"></param> /// <returns></returns> protected override Umbraco.Web.Models.Trees.MenuItemCollection GetMenuForNode(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { return(null); }
protected override Umbraco.Web.Models.Trees.MenuItemCollection GetMenuForNode(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { var menu = new MenuItemCollection(); if (id == Constants.System.Root.ToInvariantString()) { // root actions menu.Items.Add <CreateChildEntity, ActionNew>(ui.Text("actions", ActionNew.Instance.Alias)); menu.Items.Add <RefreshNode, ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), true); return(menu); } else { //menu.DefaultMenuAlias = ActionDelete.Instance.Alias; menu.Items.Add <ActionDelete>(ui.Text("actions", ActionDelete.Instance.Alias)); } return(menu); }
protected override Umbraco.Web.Models.Trees.MenuItemCollection GetMenuForNode(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { //not worying about menu atm var menu = new MenuItemCollection(); return(menu); }
protected override Umbraco.Web.Models.Trees.MenuItemCollection GetMenuForNode(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { var menu = new MenuItemCollection(); if (id == "-1") { // root actions menu.Items.Add <RefreshNode, ActionRefresh>(ApplicationContext.Services.TextService.Localize(ActionRefresh.Instance.Alias), true); return(menu); } else { //var idInt = 0; if (id.IndexOf("?") > 0) { menu.Items.Add <ActionDelete>(ApplicationContext.Services.TextService.Localize(ActionDelete.Instance.Alias)); } else { menu.Items.Add <CreateChildEntity, ActionNew>(ApplicationContext.Services.TextService.Localize(ActionNew.Instance.Alias)); menu.Items.Add <RefreshNode, ActionRefresh>(ApplicationContext.Services.TextService.Localize(ActionRefresh.Instance.Alias), true); } } return(menu); }
protected override Umbraco.Web.Models.Trees.MenuItemCollection GetMenuForNode(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { var menu = new MenuItemCollection(); var currentUser = Security.CurrentUser; //var ctrl = new UserApiController(); var settings = SecurityService.GetSecuritySettingsByUserId(currentUser.Id); //ctrl.GetById(currentUser.Id); if (id == global::Umbraco.Core.Constants.System.Root.ToInvariantString()) { if (settings.CanCreateCalendar) { menu.Items.Add(new MenuItem("createCalendar", "Create Calendar") { Icon = "add" }); } if (settings.CanCreateLocations) { menu.Items.Add(new MenuItem("createLocation", "Create Location") { Icon = "add" }); } } else if (id == "calendarTree") { if (settings.CanCreateCalendar) { menu.DefaultMenuAlias = "createCalendar"; menu.Items.Add(new MenuItem("createCalendar", "Create Calendar") { Icon = "add" }); } menu.Items.Add <ActionRefresh>("Refresh"); } else if (id == "locationTree") { if (settings.CanCreateLocations) { menu.DefaultMenuAlias = "createLocation"; menu.Items.Add(new MenuItem("createLocation", "Create Location") { Icon = "add" }); } menu.Items.Add <ActionRefresh>("Refresh"); } else if (id.Contains("c-")) { if (settings.CanCreateEvents) { menu.DefaultMenuAlias = "createEvents"; menu.Items.Add(new MenuItem("createEvents", "Create") { Icon = "add" }); } if (settings.CanDeleteCalendar) { menu.Items.Add(new MenuItem("deleteCalendar", "Delete Calendar") { Icon = "delete" }); } menu.Items.Add <ActionRefresh>("Refresh"); } else if (id.Contains("l-")) { if (settings.CanDeleteLocations) { menu.Items.Add(new MenuItem("deleteLocation", "Delete Location") { Icon = "delete" }); } } else if (id.Contains("re-")) { if (settings.CanDeleteEvents) { menu.Items.Add(new MenuItem("deleteREvent", "Delete Recurring Event") { Icon = "delete" }); } } else if (id.Contains("e-")) { if (settings.CanDeleteEvents) { menu.Items.Add(new MenuItem("deleteEvent", "Delete Event") { Icon = "delete" }); } } return(menu); }
protected override Umbraco.Web.Models.Trees.TreeNodeCollection GetTreeNodes(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { //check if we're rendering the root node's children if (id == global::Umbraco.Core.Constants.System.Root.ToInvariantString()) { var tree = new TreeNodeCollection(); tree.Add(CreateTreeNode("calendarTree", id, queryStrings, "Calendar", "icon-calendar-alt", true, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/overviewCalendar/all")); tree.Add(CreateTreeNode("locationTree", id, queryStrings, "Locations", "icon-globe-alt", true, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/overviewLocation/all")); if (Security.CurrentUser.UserType.Alias.ToLower() == "admin") { tree.Add(CreateTreeNode("security", id, queryStrings, "Security", "icon-combination-lock", true)); } return(tree); } if (id == "calendarTree") { var tree = new TreeNodeCollection(); List <ECalendar> calendar = new List <ECalendar>(); if (Security.CurrentUser.UserType.Alias.ToLower() == "admin") { calendar = CalendarService.GetAllCalendar().ToList(); } else { calendar = CalendarService.GetCalendarForUser(Security.GetUserId()).ToList(); } foreach (var cal in calendar) { tree.Add(CreateTreeNode("c-" + cal.Id.ToString(), id, queryStrings, cal.Calendarname, "icon-calendar", true, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/editCalendar/" + cal.Id)); } return(tree); } if (id == "locationTree") { var tree = new TreeNodeCollection(); List <EventLocation> locations = new List <EventLocation>(); if (Security.CurrentUser.UserType.Alias.ToLower() == "admin") { locations = LocationService.GetAllLocations().ToList(); } else { locations = LocationService.GetLocationsForUser(Security.GetUserId()).ToList(); } foreach (var loc in locations) { tree.Add(CreateTreeNode("l-" + loc.Id.ToString(), id, queryStrings, loc.LocationName, "icon-map-loaction", false, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/editLocation/" + loc.Id.ToString())); } return(tree); } if (id == "security") { var us = Services.UserService; var tree = new TreeNodeCollection(); var total = 0; var users = us.GetAll(0, 1000, out total); foreach (var user in users.Where(x => x.AllowedSections.Contains("eventCalendar"))) { //Only the superadmin should change the settings for superadmin if ((Security.CurrentUser.Id != 0 && user.Id != 0) || Security.CurrentUser.Id == 0) { tree.Add(CreateTreeNode("u-" + user.Id.ToString(), id, queryStrings, user.Name, "", false, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/editUser/" + user.Id.ToString())); } } return(tree); } if (id.Contains("c-")) { List <Event> events = EventService.GetAllEvents().Where(x => x.calendarId.ToString() == id.Replace("c-", "")).ToList();//ctrl.GetAll().Where(x => x.calendarId.ToString() == id.Replace("c-","")).ToList(); var tree = new TreeNodeCollection(); foreach (var e in events) { tree.Add(CreateTreeNode("e-" + e.Id.ToString(), id, queryStrings, e.title, "icon-music", false, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/editEvent/" + e.Id)); } List <RecurringEvent> revents = RecurringEventService.GetAllEvents().Where(x => x.calendarId.ToString() == id.Replace("c-", "")).ToList();//ctrl2.GetAll().Where(x => x.calendarId.ToString() == id.Replace("c-", "")).ToList(); foreach (var e in revents) { tree.Add(CreateTreeNode("re-" + e.Id.ToString(), id, queryStrings, e.title, "icon-axis-rotation", false, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/editREvent/" + e.Id)); } return(tree); } //this tree doesn't suport rendering more than 1 level throw new NotSupportedException(); }
protected override Umbraco.Web.Models.Trees.TreeNodeCollection GetTreeNodes(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { var nodes = new TreeNodeCollection(); if (id == "-1") { IList <GridEditor> editors = Helper.GetLeBlenderGridEditors(false).ToList(); foreach (var editor in editors) { nodes.Add(this.CreateTreeNode(editor.Alias, id, queryStrings, editor.Name, editor.Icon, false)); } return(nodes); } return(nodes); }
protected override Umbraco.Web.Models.Trees.MenuItemCollection GetMenuForNode(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { var textService = ApplicationContext.Services.TextService; var createText = textService.Localize($"actions/{ActionNew.Instance.Alias}"); var sortText = textService.Localize($"actions/{ActionSort.Instance.Alias}"); var refreshNodeText = textService.Localize($"actions/{ActionRefresh.Instance.Alias}"); var deleteText = textService.Localize($"actions/{ActionDelete.Instance.Alias}"); var menu = new MenuItemCollection(); if (id == Constants.System.Root.ToInvariantString()) { // root actions menu.Items.Add <CreateChildEntity, ActionNew>(createText); menu.Items.Add <ActionSort>(sortText); menu.Items.Add <RefreshNode, ActionRefresh>(refreshNodeText, true); return(menu); } menu.Items.Add <ActionDelete>(deleteText); return(menu); }
protected override Umbraco.Web.Models.Trees.TreeNodeCollection GetTreeNodes(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { var tree = new TreeNodeCollection(); //check if we're rendering the root node var forum = CreateTreeNode("Forum", "-1", queryStrings, "Forum", "icon-whhg-forumsalt"); if (id == Constants.System.Root.ToInvariantString()) { forum.HasChildren = true; tree.Add(forum); } else if (id == "Forum") { //this is a child of the root node var settings = CreateTreeNode("1-Settings", "Forum", queryStrings, "Settings", "icon-settings"); var question = CreateTreeNode("1-Questions", "Forum", queryStrings, "Questions", "icon-whhg-question-sign"); tree.Add(settings); tree.Add(question); } else if (id.StartsWith("1-")) { //this must be a third level node, e.g. one that's under the child nodes. } return(tree); //this tree doesn't suport rendering more than 1 level throw new NotSupportedException(); }
protected override Umbraco.Web.Models.Trees.TreeNodeCollection GetTreeNodes(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { //check if we're rendering the root node's children if (id == "-1") { var nodes = new TreeNodeCollection(); nodes.Add(CreateTreeNode("people", id, queryStrings, "People", "icon-people", false, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/overviewPeople/all")); return(nodes); } //this tree doesn't suport rendering more than 2 levels throw new NotSupportedException(); }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <param name="queryStrings"></param> /// <returns></returns> protected override TreeNodeCollection GetTreeNodes(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { //check if we're rendering the root node's children if (id == Constants.System.Root.ToInvariantString()) { //Nodes that we will return var nodes = new TreeNodeCollection(); //Main Route var mainRoute = "/analytics/analyticsTree"; //Add nodes var treeNodes = new List <SectionTreeNode>(); treeNodes.Add(new SectionTreeNode() { Id = "views", Title = ui.Text("analytics", "views"), Icon = "icon-activity", Route = string.Format("{0}/view/{1}", mainRoute, "views") }); treeNodes.Add(new SectionTreeNode() { Id = "keywords", Title = ui.Text("analytics", "keywords"), Icon = "icon-tags", Route = string.Format("{0}/view/{1}", mainRoute, "keywords") }); treeNodes.Add(new SectionTreeNode() { Id = "social", Title = ui.Text("analytics", "socialNetwork"), Icon = "icon-chat-active", Route = string.Format("{0}/view/{1}", mainRoute, "social") }); treeNodes.Add(new SectionTreeNode() { Id = "os", Title = ui.Text("analytics", "operatingSystem"), Icon = "icon-windows", Route = string.Format("{0}/view/{1}", mainRoute, "os") }); treeNodes.Add(new SectionTreeNode() { Id = "screenres", Title = ui.Text("analytics", "screenResolution"), Icon = "icon-display", Route = string.Format("{0}/view/{1}", mainRoute, "screenres") }); treeNodes.Add(new SectionTreeNode() { Id = "devices", Title = ui.Text("analytics", "devices"), Icon = "icon-iphone", Route = string.Format("{0}/view/{1}", mainRoute, "devices") }); treeNodes.Add(new SectionTreeNode() { Id = "browser", Title = ui.Text("analytics", "browser"), Icon = "icon-browser-window", Route = string.Format("{0}/view/{1}", mainRoute, "browser") }); treeNodes.Add(new SectionTreeNode() { Id = "language", Title = ui.Text("analytics", "language"), Icon = "icon-chat-active", Route = string.Format("{0}/view/{1}", mainRoute, "language") }); treeNodes.Add(new SectionTreeNode() { Id = "country", Title = ui.Text("analytics", "country"), Icon = "icon-globe", Route = string.Format("{0}/view/{1}", mainRoute, "country") }); treeNodes.Add(new SectionTreeNode() { Id = "ecommerce", Title = ui.Text("analytics", "ecommerce"), Icon = "icon-shopping-basket", Route = string.Format("{0}/view/{1}", mainRoute, "ecommerce") }); treeNodes.Add(new SectionTreeNode() { Id = "settings", Title = ui.Text("analytics", "settings"), Icon = "icon-settings", Route = string.Format("{0}/edit/{1}", mainRoute, "settings") }); foreach (var item in treeNodes) { //When clicked - /App_Plugins/Diagnostics/backoffice/diagnosticsTree/edit.html //URL in address bar - /developer/diagnosticsTree/General/someID //var route = string.Format("/analytics/analyticsTree/view/{0}", item.Value); bool hasChildNodes = item.Id == "ecommerce"; var nodeToAdd = CreateTreeNode(item.Id, null, queryStrings, item.Title, item.Icon, hasChildNodes, item.Route); //Add it to the collection nodes.Add(nodeToAdd); } //Return the nodes return(nodes); } //When you click on the e-commerce node //Render these as the child nodes instead... if (id == "ecommerce") { //Main Route var mainRoute = "/analytics/analyticsTree"; var childNodes = new TreeNodeCollection(); var childTreeNodes = new List <SectionTreeNode>(); childTreeNodes.Add(new SectionTreeNode() { Id = "transactions", Title = ui.Text("analytics", "transactions"), Icon = "icon-credit-card", Route = string.Format("{0}/view/{1}", mainRoute, "transactions") }); childTreeNodes.Add(new SectionTreeNode() { Id = "productperformance", Title = ui.Text("analytics", "productPerformance"), Icon = "icon-barcode", Route = string.Format("{0}/view/{1}", mainRoute, "productperformance") }); childTreeNodes.Add(new SectionTreeNode() { Id = "salesperformance", Title = ui.Text("analytics", "salesPerformance"), Icon = "icon-bill", Route = string.Format("{0}/view/{1}", mainRoute, "salesperformance") }); foreach (var c in childTreeNodes) { var childnodeToAdd = CreateTreeNode(c.Id, null, queryStrings, c.Title, c.Icon, false, c.Route); //Add it to the collection childNodes.Add(childnodeToAdd); } return(childNodes); } //this tree doesn't suport rendering more than 1 level throw new NotSupportedException(); }
protected override Umbraco.Web.Models.Trees.TreeNodeCollection GetTreeNodes(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { var types = Helper.GetTypesWithUIOMaticAttribute(); //check if we're rendering the root node's children if (id == "-1") { var nodes = new TreeNodeCollection(); foreach (var type in types) { var attri = (UIOMaticAttribute)Attribute.GetCustomAttribute(type, typeof(UIOMaticAttribute)); if (!attri.ShowInTree) { continue; } if (attri.RenderType == Enums.UIOMaticRenderType.Tree) { var node = CreateTreeNode( type.AssemblyQualifiedName, "-1", queryStrings, attri.Name, attri.FolderIcon, true); nodes.Add(node); } else { var node = CreateTreeNode( type.AssemblyQualifiedName, "-1", queryStrings, attri.Name, attri.FolderIcon, false, "uiomatic/uioMaticTree/list/" + type.AssemblyQualifiedName); nodes.Add(node); } } return(nodes); } if (types.Any(x => x.AssemblyQualifiedName == id)) { var ctrl = new PetaPocoObjectController(); var nodes = new TreeNodeCollection(); var currentType = types.SingleOrDefault(x => x.AssemblyQualifiedName == id); var attri = (UIOMaticAttribute)Attribute.GetCustomAttribute(currentType, typeof(UIOMaticAttribute)); var itemIdPropName = "Id"; var primKeyAttri = currentType.GetCustomAttributes().Where(x => x.GetType() == typeof(PrimaryKeyAttribute)); if (primKeyAttri.Any()) { itemIdPropName = ((PrimaryKeyAttribute)primKeyAttri.First()).Value; } if (string.IsNullOrWhiteSpace(itemIdPropName)) { foreach (var property in currentType.GetProperties()) { var keyAttri = property.GetCustomAttributes().Where(x => x.GetType() == typeof(PrimaryKeyColumnAttribute)); if (keyAttri.Any()) { var columnAttri = property.GetCustomAttributes().Where(x => x.GetType() == typeof(ColumnAttribute)); itemIdPropName = property.Name; } } } foreach (dynamic item in ctrl.GetAll(id, attri.SortColumn, attri.SortOrder)) { var node = CreateTreeNode( item.GetType().GetProperty(itemIdPropName).GetValue(item, null).ToString() + "?type=" + id, id, queryStrings, item.ToString(), attri.ItemIcon, false); nodes.Add(node); } return(nodes); } //this tree doesn't suport rendering more than 2 levels throw new NotSupportedException(); }
protected override Umbraco.Web.Models.Trees.MenuItemCollection GetMenuForNode(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { var menu = new MenuItemCollection(); if (id == "-1") { // root actions menu.Items.Add <RefreshNode, ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), true); return(menu); } else { //var idInt = 0; if (id.IndexOf("?") > 0) { var currentType = Type.GetType(id.Split('?')[1].Replace("type=", "")); var attri = (UIOMaticAttribute)Attribute.GetCustomAttribute(currentType, typeof(UIOMaticAttribute)); if (!attri.ReadOnly) { menu.Items.Add <ActionDelete>(ui.Text("actions", ActionDelete.Instance.Alias)); } } else { var currentType = Type.GetType(id); var attri = (UIOMaticAttribute)Attribute.GetCustomAttribute(currentType, typeof(UIOMaticAttribute)); if (!attri.ReadOnly) { menu.Items.Add <CreateChildEntity, ActionNew>(ui.Text("actions", ActionNew.Instance.Alias)); } if (attri.RenderType == Enums.UIOMaticRenderType.Tree) { menu.Items.Add <RefreshNode, ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), true); } } } return(menu); }
protected override Umbraco.Web.Models.Trees.TreeNodeCollection GetTreeNodes(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { //check if we're rendering the root node's children if (id == Constants.System.Root.ToInvariantString()) { var ctrl = new MCFlyApiController(); var nodes = new TreeNodeCollection(); foreach (var form in ctrl.GetAll()) { var node = CreateTreeNode( form.Id.ToString(), "-1", queryStrings, form.Name, "icon-plane", false); nodes.Add(node); } return(nodes); } //this tree doesn't suport rendering more than 1 level throw new NotSupportedException(); }
protected override MenuItemCollection GetMenuForNode(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { throw new NotImplementedException(); }
protected override TreeNodeCollection GetTreeNodes(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { var ctrl = new PipelineApiController(); var nodes = new TreeNodeCollection(); var mainRoute = "/pipelineCrm/pipelineCrmTree"; bool useBoard = PipelineConfig.GetConfig().AppSettings.UseBoard; var customAreas = GetCustomAreas(); if (id == Constants.System.Root.ToInvariantString()) { nodes.Add( CreateTreeNode( "pipelines", null, queryStrings, GetTranslation("pipeline/opportunities"), "icon-dashboard", true, useBoard ? "/pipelineCrm" : "/pipelineCrm/pipelineCrmTree/browse/0" ) ); nodes.Add( CreateTreeNode( "tasks", null, queryStrings, GetTranslation("pipeline/tasks"), "icon-checkbox", false, mainRoute + "/tasks/0" ) ); nodes.Add( CreateTreeNode( "contacts", null, queryStrings, GetTranslation("pipeline/contacts"), "icon-user", true, mainRoute + "/contacts/0" ) ); nodes.Add( CreateTreeNode( "organisations", "-1", queryStrings, GetTranslation("pipeline/organisations"), "icon-company", true, mainRoute + "/organisations/0" ) ); nodes.Add( CreateTreeNode( "segments", "-1", queryStrings, GetTranslation("pipeline/segments"), "icon-users", true, mainRoute + "/segments/0" ) ); // get custom building blocks foreach (var type in customAreas) { nodes.Add( CreateTreeNode( type.Alias, "-1", queryStrings, type.Name, type.Icon, type.Folders.Any(), mainRoute + "/" + type.Url ) ); } nodes.Add( CreateTreeNode( "recyclebin", null, queryStrings, GetTranslation("general/recycleBin"), "icon-trash", true, "/pipelineCrm/pipelineCrmTree/browse/-1" ) ); nodes.Add( CreateTreeNode( "settings", null, queryStrings, GetTranslation("pipeline/settings"), "icon-settings", false, mainRoute + "/settings/0" ) ); } else if (id == "pipelines") { // list all opp statuses foreach (var status in GetStatuses()) { var newTreeNode = CreateTreeNode( status.Id.ToString() + "_pipelines", id, queryStrings, status.Name, "icon-dashboard", false, "/pipelineCrm/pipelineCrmTree/browse/" + status.Id.ToString()); nodes.Add(newTreeNode); } // get unassigned pipelines var unassigned = ctrl.GetByStatusId(0); nodes.Add( CreateTreeNode( "0", id, queryStrings, GetTranslation("pipeline/unassigned"), "icon-dashboard", false, "/pipelineCrm/pipelineCrmTree/browse/-2" ) ); } else if (id == "organisations") { // list all org types foreach (var type in GetOrgTypes()) { var newTreeNode = CreateTreeNode( type.Id.ToString() + "_organisations", id, queryStrings, type.Name, "icon-company", false, mainRoute + "/organisations/" + type.Id.ToString()); nodes.Add(newTreeNode); } // get unassigned orgs var unassigned = ctrl.GetByStatusId(0); nodes.Add( CreateTreeNode( "0", id, queryStrings, GetTranslation("pipeline/unassigned"), "icon-company", false, mainRoute + "/organisations/-2" ) ); } else if (id == "contacts") { // list all orgs foreach (var type in new ContactTypeApiController().GetAll()) { var newTreeNode = CreateTreeNode( type.Id.ToString() + "_contacts", id, queryStrings, type.Name, "icon-user", false, mainRoute + "/contacts/" + type.Id.ToString()); nodes.Add(newTreeNode); } // get contacts with no groups nodes.Add( CreateTreeNode( "0", id, queryStrings, GetTranslation("pipeline/unassigned"), "icon-user", false, mainRoute + "/contacts/-2" ) ); } // segments else if (id == "segments") { // list all segment types foreach (var type in new SegmentTypeApiController().GetAll()) { var newTreeNode = CreateTreeNode( type.Id.ToString() + "_segments", id, queryStrings, type.Name, "icon-users", false, mainRoute + "/segments/" + type.Id.ToString()); nodes.Add(newTreeNode); } } else if (id == "recyclebin") { // pipelines nodes.Add( CreateTreeNode( "0", id, queryStrings, GetTranslation("pipeline/opportunities"), "icon-dashboard", false, "/pipelineCrm/pipelineCrmTree/browse/-1" ) ); // contacts nodes.Add( CreateTreeNode( "0", id, queryStrings, GetTranslation("pipeline/contacts"), "icon-user", false, mainRoute + "/contacts/-1" ) ); // groups nodes.Add( CreateTreeNode( "0", id, queryStrings, GetTranslation("pipeline/organisations"), "icon-company", false, mainRoute + "/organisations/-1" ) ); nodes.Add( CreateTreeNode( "0", id, queryStrings, GetTranslation("pipeline/segments"), "icon-users", false, mainRoute + "/segments/-1" ) ); } else if (customAreas.Any(x => x.Alias == id)) { var area = customAreas.FirstOrDefault(x => x.Alias == id); // list all orgs foreach (var folder in area.Folders) { var newTreeNode = CreateTreeNode( folder.Url + "_" + area.Alias, id, queryStrings, folder.Name, area.Icon, false, mainRoute + "/" + folder.Url); nodes.Add(newTreeNode); } } return(nodes); //this tree doesn't suport rendering more than 1 level throw new NotSupportedException(); }
protected override TreeNodeCollection GetTreeNodes(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { //Load all created triggers as subnodes of a main node with the Connector name throw new NotImplementedException(); }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <param name="queryStrings"></param> /// <returns></returns> protected override Umbraco.Web.Models.Trees.TreeNodeCollection GetTreeNodes(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { //check if we're rendering the root node's children if (id == Constants.System.Root.ToInvariantString()) { //Nodes that we will return var nodes = new TreeNodeCollection(); //Main Route var mainRoute = "/analytics/analyticsTree"; //Add nodes var treeNodes = new List <SectionTreeNode>(); //treeNodes.Add(new SectionTreeNode() { Id = "real-time", Title = "Real Time", Icon = "icon-connection", Route = string.Format("{0}/view/{1}", mainRoute, "real-time") }); treeNodes.Add(new SectionTreeNode() { Id = "views", Title = "Views", Icon = "icon-activity", Route = string.Format("{0}/view/{1}", mainRoute, "views") }); treeNodes.Add(new SectionTreeNode() { Id = "keywords", Title = "Keywords", Icon = "icon-tags", Route = string.Format("{0}/view/{1}", mainRoute, "keywords") }); treeNodes.Add(new SectionTreeNode() { Id = "social", Title = "Social Network", Icon = "icon-chat-active", Route = string.Format("{0}/view/{1}", mainRoute, "social") }); treeNodes.Add(new SectionTreeNode() { Id = "os", Title = "Operating System", Icon = "icon-windows", Route = string.Format("{0}/view/{1}", mainRoute, "os") }); treeNodes.Add(new SectionTreeNode() { Id = "screenres", Title = "Screen Resolution", Icon = "icon-display", Route = string.Format("{0}/view/{1}", mainRoute, "screenres") }); treeNodes.Add(new SectionTreeNode() { Id = "devices", Title = "Devices", Icon = "icon-iphone", Route = string.Format("{0}/view/{1}", mainRoute, "devices") }); treeNodes.Add(new SectionTreeNode() { Id = "browser", Title = "Browser", Icon = "icon-browser-window", Route = string.Format("{0}/view/{1}", mainRoute, "browser") }); treeNodes.Add(new SectionTreeNode() { Id = "language", Title = "Language", Icon = "icon-chat-active", Route = string.Format("{0}/view/{1}", mainRoute, "language") }); treeNodes.Add(new SectionTreeNode() { Id = "country", Title = "Country", Icon = "icon-globe", Route = string.Format("{0}/view/{1}", mainRoute, "country") }); treeNodes.Add(new SectionTreeNode() { Id = "settings", Title = "Settings", Icon = "icon-settings", Route = string.Format("{0}/edit/{1}", mainRoute, "settings") }); foreach (var item in treeNodes) { //When clicked - /App_Plugins/Diagnostics/backoffice/diagnosticsTree/edit.html //URL in address bar - /developer/diagnosticsTree/General/someID //var route = string.Format("/analytics/analyticsTree/view/{0}", item.Value); var nodeToAdd = CreateTreeNode(item.Id, null, queryStrings, item.Title, item.Icon, false, item.Route); //Add it to the collection nodes.Add(nodeToAdd); } //Return the nodes return(nodes); } //this tree doesn't suport rendering more than 1 level throw new NotSupportedException(); }
protected override Umbraco.Web.Models.Trees.MenuItemCollection GetMenuForNode(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { var menu = new MenuItemCollection(); if (id == "-1") { // root actions menu.Items.Add <RefreshNode, ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), true); return(menu); } else { var idInt = 0; if (int.TryParse(id.Split('?')[0], out idInt)) { menu.Items.Add <ActionDelete>(ui.Text("actions", ActionDelete.Instance.Alias)); } else { menu.Items.Add <CreateChildEntity, ActionNew>(ui.Text("actions", ActionNew.Instance.Alias)); menu.Items.Add <RefreshNode, ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), true); } } return(menu); }