protected void Page_Load(object sender, EventArgs e) { sFeature = Act.GetFeatureName(Request["feature"]); if (Request["delete"] != null) { //EPMLiveCore.CoreFunctions.deleteKey(Request["delete"]); DeleteUser(Request["delete"]); } if (sFeature != "" || sFeature != null) { MenuTemplate propertyNameListMenu = new MenuTemplate(); propertyNameListMenu.ID = "PropertyNameListMenu"; MenuItemTemplate testMenu = new MenuItemTemplate("Delete User", "/_layouts/images/delete.gif"); testMenu.ClientOnClickNavigateUrl = "users.aspx?feature=" + Request["feature"] + "&delete=%NAME%"; propertyNameListMenu.Controls.Add(testMenu); this.Controls.Add(propertyNameListMenu); ListUsers(); } else { lblFeatureName.Text = "None Selected"; } }
protected override void CreateChildControls() { base.CreateChildControls(); SPWeb web = SPContext.Current.Web; // Menu options SubMenuTemplate subMenuTemplate = new SubMenuTemplate(); subMenuTemplate.ID = "CustomSubMenu"; subMenuTemplate.Text = "Pages demo"; subMenuTemplate.Description = "Pages demo - Application page and site page"; subMenuTemplate.MenuGroupId = 1; // Id of group in menu. Value of 1 means that it will be placed in first group (with Edit Page item) subMenuTemplate.Sequence = 1; // Menu items (commands) MenuItemTemplate template1 = new MenuItemTemplate(); template1.ID = "FirstMenuItem"; template1.Text = "First Application Page"; template1.Sequence = 1; template1.ClientOnClickNavigateUrl = web.Url + FirstMenuItemUrl; MenuItemTemplate template2 = new MenuItemTemplate(); template2.ID = "SecondMenuItem"; template2.Text = "Site page"; template2.Sequence = 2; template2.ClientOnClickNavigateUrl = web.Url + SecondMenuItemUrl; // Add controls subMenuTemplate.Controls.Add(template1); subMenuTemplate.Controls.Add(template2); this.Controls.Add(subMenuTemplate); }
/// <summary> /// Crea la entrada en el menu /// A la vez se crea un control-oculto que es el que se encargará /// de realizar la acción de pegar - es el truco del invento /// </summary> protected override void CreateChildControls() { Debug.WriteLine("CreateChildControls"); if (_controlador.Aceptado()) { try { // Control que realizará la acción (oculto) var pasteAction = new PasteAction { ID = "PA" + ClientID }; Controls.Add(pasteAction); // Menu con la opción de pegar var customAction = new MenuItemTemplate { Text = GetResourceString("PasteMenuActionText"), ID = "SPSProfessional.Paste", Description = GetResourceString("PasteFileMenuActionDescription"), ImageUrl = "/_layouts/images/spspro_paste.png", Sequence = 1000, ClientOnClickScript = "javascript:SPSProfessionalActionPaste();" }; // Añadimos la opción Controls.Add(customAction); } catch (Exception ex) { Debug.WriteLine(ex); Debug.Flush(); } } Debug.WriteLine("CreateChildControls End"); }
public async Task <IActionResult> Post(MenuItemTemplate menuItemTemplate) { _context.Add(menuItemTemplate); await _context.SaveChangesAsync(); return(Ok(menuItemTemplate.Id)); }
//Удалить конкретный элемент меню public static void RemoveMenuItem(MenuItemTemplate menuItem) { if (MenuItems.Contains(menuItem)) { MenuItems.Remove(menuItem); } }
public async Task <IActionResult> Put(MenuItemTemplate menuItemTemplate) { _context.Entry(menuItemTemplate).State = EntityState.Modified; await _context.SaveChangesAsync(); return(NoContent()); }
protected void Page_Load(object sender, EventArgs e) { MenuTemplate propertyNameListMenu = new MenuTemplate(); propertyNameListMenu.ID = "PropertyNameListMenu"; MenuItemTemplate testMenu = new MenuItemTemplate("View More Information", "/_layouts/images/16doc.gif"); testMenu.ClientOnClickNavigateUrl = "viewqueue.aspx?timerjobuid=%NAME%&siteuid=%SITE%"; propertyNameListMenu.Controls.Add(testMenu); this.Controls.Add(propertyNameListMenu); if (!IsPostBack) { txtInterval.Text = CoreFunctions.getFarmSetting("PollingInterval"); txtMainThreads.Text = CoreFunctions.getFarmSetting("QueueThreads"); txtSecurityThreads.Text = CoreFunctions.getFarmSetting("SecQueueThreads"); txtRollupQueueThreads.Text = CoreFunctions.getFarmSetting("RollupQueueThreads"); txtHighPriorityQueueThreads.Text = CoreFunctions.getFarmSetting("HighQueueThreads"); txtTimesheetThreads.Text = CoreFunctions.getFarmSetting("TSQueueThreads"); } }
internal void AddMenuItem(IDictionary inst, string id, string caption, string img, string desc, string clickUrl, string clickScript, int cmdNo) { MenuItemTemplate child = new MenuItemTemplate(caption, img) { ID = id, Description = desc, PermissionContext = this.PermContext, Permissions = this.Perms }; if (string.IsNullOrEmpty(clickScript)) { child.ClientOnClickNavigateUrl = SPEncode.ScriptEncode(clickUrl); } else { child.ClientOnClickScript = clickScript; } this.Controls.Add(child); if (ProductPage.Is14) { this.ribbons.Add(new RibbonItem(child, inst, this.ClientID + id, caption, img, desc, clickUrl, clickScript, cmdNo)); this.WebPartIDs.ToString(); } }
private static void AddGetProjectsMenu(bool hasProject, bool eProject, SPListItem listItem, SPWeb web, SPList list, SubMenuTemplate menu) { if (hasProject) { MenuItemTemplate menuItemTemplate; if (eProject) { menuItemTemplate = new MenuItemTemplate { Text = listItem.Title, ClientOnClickScript = string.Format( "javascript:window.open('{0}/_layouts/epmlive/getpsproject.aspx?listID={1}&itemID={2}','', config='height=250,width=350, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, directories=no, status=no'); return false", web.ServerRelativeUrl, list.ID, listItem.ID) }; menu.Controls.Add(menuItemTemplate); } else { menuItemTemplate = new MenuItemTemplate { Text = listItem.Title, ClientOnClickScript = string.Format( "javascript:window.open('{0}/_layouts/epmlive/getproject.aspx?listID={1}&ID={2}','', config='height=100,width=350, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, directories=no, status=no'); return false", web.ServerRelativeUrl, list.ID, listItem.ID) }; menu.Controls.Add(menuItemTemplate); } } }
/// <summary> /// 绑定Gridview /// </summary> private void BindGridView() { using (db = new MMSProDBDataContext(ConfigurationManager.ConnectionStrings["mmsConString"].ConnectionString)) { BoundField bfColumn; //添加选择列 TemplateField tfieldCheckbox = new TemplateField(); tfieldCheckbox.ItemTemplate = new CheckBoxTemplate("请选择", DataControlRowType.DataRow, "StockTransferID"); tfieldCheckbox.HeaderTemplate = new CheckBoxTemplate("请选择", DataControlRowType.Header); this.gv.Columns.Add(tfieldCheckbox); SPMenuField colMenu = new SPMenuField(); colMenu.HeaderText = "单据编号"; colMenu.TextFields = "StockTransferNum"; colMenu.MenuTemplateId = "actionMenu"; colMenu.NavigateUrlFields = "StockTransferID"; //定义方式:"列名1,列名2..." colMenu.NavigateUrlFormat = "StockTransferDetailsManage.aspx?StockTransferID={0}"; colMenu.TokenNameAndValueFields = "cStockTransferID=StockTransferID"; //定义方式:"别名1=列名1,别名2=列名2...." HyperLinkField hlTask = new HyperLinkField(); hlTask.HeaderText = "任务详情"; //hlTask.DataNavigateUrlFields = new string []{ "StockTransferID" }; //hlTask.DataNavigateUrlFormatString = "javaScript:onClick=window.showModalDialog(encodeURI('../PublicPage/TaskHistoryInfo.aspx?NoticeID={0}&&TaskType=正常入库'),'0','resizable:true;dialogWidth:800px;dialogHeight:600px')"; //hlTask.DataNavigateUrlFormatString = "www.google.com?a={0}"; //hlTask.Text = "任务详情"; //hlTask.Text = "<a href=\"javaScript:onClick=window.showModalDialog(encodeURI('../PublicPage/TaskHistoryInfo.aspx?NoticeID={0}&&TaskType=正常入库'),'0','resizable:true;dialogWidth:800px;dialogHeight:600px')\">任务详情</a>"; MenuTemplate menuItemCollection = new MenuTemplate(); menuItemCollection.ID = "actionMenu"; MenuItemTemplate createMenuItem = new MenuItemTemplate("组长审批", "/_layouts/images/newitem.gif"); createMenuItem.ClientOnClickNavigateUrl = "StockTransferCreateTask.aspx?StockTransferID=%cStockTransferID%&&TaskType=物资组长审核信息&&BackUrl=" + HttpContext.Current.Request.Url.PathAndQuery; //editMenuItem.ClientOnClickScript = "if(!window.confirm('确认删除所选项?')) return false;window.location.href='StorageEdit.aspx?StorageID=%curStorageID%'";//%curStorageID%代表别名curStorageID,而StorageID代表数据库的表中的列名 //editMenuItem.ClientOnClickScript = "window.location.href='StorageEdit.aspx?StorageID=%curStorageID%&curTime=" + DateTime.Now.ToString() + "'"; menuItemCollection.Controls.Add(createMenuItem); this.Controls.Add(menuItemCollection); this.gv.Columns.Add(colMenu); foreach (var kvp in Titlelist) { bfColumn = new BoundField(); bfColumn.HeaderText = kvp.Split(':')[0]; bfColumn.DataField = kvp.Split(':')[1]; this.gv.Columns.Add(bfColumn); } this.gv.Columns.Insert(4, hlTask); this.gv.DataSource = from a in db.StockTransfer select a; this.gv.RowDataBound += new GridViewRowEventHandler(gv_RowDataBound); this.gv.DataBind(); this.gv.Columns[5].Visible = false; Panel p1 = (Panel)GetControltByMaster("Panel1"); p1.Controls.Add(this.gv); } }
protected void Page_Load(object sender, EventArgs e) { MenuTemplate propertyNameListMenu = new MenuTemplate(); propertyNameListMenu.ID = "PropertyNameListMenu"; MenuItemTemplate testMenu = new MenuItemTemplate("Edit Connection", "/_layouts/epmlive/images/integration/editcon.png"); testMenu.ClientOnClickNavigateUrl = "connection.aspx?intlistid=%INTLISTID%&LIST=" + Request["List"]; propertyNameListMenu.Controls.Add(testMenu); MenuItemTemplate testMenu2 = new MenuItemTemplate("Edit Properties", "/_layouts/images/edit.gif"); testMenu2.ClientOnClickNavigateUrl = "properties.aspx?intlistid=%INTLISTID%&LIST=" + Request["List"]; propertyNameListMenu.Controls.Add(testMenu2); MenuItemTemplate testMenu3 = new MenuItemTemplate("Edit Columns", "/_layouts/epmlive/images/integration/editcols.png"); testMenu3.ClientOnClickNavigateUrl = "columns.aspx?intlistid=%INTLISTID%&LIST=" + Request["List"]; propertyNameListMenu.Controls.Add(testMenu3); MenuItemTemplate testMenu4 = new MenuItemTemplate("View Log", "/_layouts/epmlive/images/integration/log.png"); testMenu4.ClientOnClickNavigateUrl = "log.aspx?intlistid=%INTLISTID%&LIST=" + Request["List"]; propertyNameListMenu.Controls.Add(testMenu4); MenuItemTemplate testMenu5 = new MenuItemTemplate("Delete Integration", "/_layouts/images/delete.gif"); testMenu5.ClientOnClickScript = "DeleteIntegration('%INTLISTID%');"; propertyNameListMenu.Controls.Add(testMenu5); this.Controls.Add(propertyNameListMenu); API.Integration.IntegrationCore integration = new API.Integration.IntegrationCore(Web.Site.ID, Web.ID); SPSecurity.RunWithElevatedPrivileges(delegate() { gvPlans.DataSource = integration.GetIntegrationsForList(new Guid(Request["List"])); gvPlans.DataBind(); }); }
internal MenuItemsSourceGenerator(IMenu menu, Context context, MenuItemTemplate itemTemplate) { Should.NotBeNull(menu, "menu"); Should.NotBeNull(itemTemplate, "itemTemplate"); _menu = menu; _context = context; _itemTemplate = itemTemplate; TryListenActivity(context); }
private void InitializeCustomControls() { InitToolBar(); this.spgvSubDoc = new SPGridView(); this.spgvSubDoc.AutoGenerateColumns = false; this.spgvSubDoc.Attributes.Add("style", "word-break:keep-all;word-wrap:normal"); BoundField bfColumn; foreach (var kvp in ShowTlist) { bfColumn = new BoundField(); bfColumn.HeaderText = kvp.Split(':')[0]; bfColumn.DataField = kvp.Split(':')[1]; this.spgvSubDoc.Columns.Add(bfColumn); } //添加选择列 TemplateField tfieldCheckbox = new TemplateField(); tfieldCheckbox.ItemTemplate = new CheckBoxTemplate("请选择", DataControlRowType.DataRow, "SrinSubDocID"); tfieldCheckbox.HeaderTemplate = new CheckBoxTemplate("请选择", DataControlRowType.Header); this.spgvSubDoc.Columns.Insert(0, tfieldCheckbox); SPMenuField colMenu = new SPMenuField(); colMenu.HeaderText = "清点负责人"; colMenu.TextFields = "TakerName"; colMenu.MenuTemplateId = "spmfTaker"; colMenu.NavigateUrlFields = "SrinSubDocID,Taker"; //定义方式:"列名1,列名2..." colMenu.NavigateUrlFormat = "ManageSrinSubDetails.aspx?SubDocID={0}&IsValidate=true"; colMenu.TokenNameAndValueFields = "curID=SrinSubDocID,takerID=Taker"; //定义方式:"别名1=列名1,别名2=列名2...." MenuTemplate menuItemCollection = new MenuTemplate(); menuItemCollection.ID = "spmfTaker"; MenuItemTemplate mitMaterial = new MenuItemTemplate("提交清点", "/_layouts/images/newitem.gif"); mitMaterial.ClientOnClickNavigateUrl = "SrinDispatchCenter.aspx?TaskType=物资组清点&FormID=%curID%&Executor=%takerID%"; menuItemCollection.Controls.Add(mitMaterial); this.Controls.Add(menuItemCollection); this.spgvSubDoc.Columns.Insert(1, colMenu); this.spgvSubDoc.RowDataBound += new GridViewRowEventHandler(spgvSubDoc_RowDataBound); //添加任务详情列 HyperLinkField hlfTask = new HyperLinkField(); hlfTask.HeaderText = "任务详情"; this.spgvSubDoc.Columns.Insert(8, hlfTask); }
private void AddEditAgilePlannerMenu(string projectCenter, string taskCenter, bool enableWp, SPWeb web) { if (projectCenter != string.Empty && (projectCenter == sListName || taskCenter == sListName) && enableWp) { var list = web.Lists[projectCenter]; if (list.Items.Count == 1) { var li = list.Items[0]; var menu = new MenuItemTemplate { Text = "Edit In Agile Planner", Description = "Edit your attached schedule using Agile Planner.", ImageUrl = "/_layouts/images/epmlivelogo.gif", ClientOnClickScript = string.Format( "javascript:window.open('{0}/_layouts/epmlive/agile/tasks.aspx?ID={1}&source={2}','', config='width=' + screen.width + ',height=' + screen.height + ',top=0,left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=yes'); return false;", web.ServerRelativeUrl, li.ID, HttpUtility.UrlEncode(HttpContext.Current.Request.ServerVariables["URL"])) }; Controls.Add(menu); } else if (list.Items.Count > 1) { var menuWp = new SubMenuTemplate { Text = "Edit In Agile Planner", Description = "Edit your attached schedule using Agile Planner.", ImageUrl = "/_layouts/images/epmlivelogo.gif" }; Controls.Add(menuWp); var query = new SPQuery { Query = "<OrderBy><FieldRef Name='Title'/></OrderBy>" }; foreach (SPListItem li in list.GetItems(query)) { var menu1 = new MenuItemTemplate { Text = li.Title, ClientOnClickScript = string.Format( "javascript:window.open('{0}/_layouts/epmlive/agile/tasks.aspx?ID={1}&source={2}','', config='width=' + screen.width + ',height=' + screen.height + ',top=0,left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=yes'); return false;", web.ServerRelativeUrl, li.ID, HttpUtility.UrlEncode(HttpContext.Current.Request.ServerVariables["URL"])) }; menuWp.Controls.Add(menu1); } } } }
public async Task <IActionResult> Delete(int id) { var menuItemTemplate = new MenuItemTemplate { Id = id }; _context.Remove(menuItemTemplate); await _context.SaveChangesAsync(); return(NoContent()); }
public RibbonItem(MenuItemTemplate item, IDictionary inst, string id, string caption, string img, string desc, string clickUrl, string clickScript, int cmdNo) { Item = item; Inst = inst; ID = id; Caption = caption; Desc = desc; Img = img; ClickScript = clickScript; ClickUrl = clickUrl; CmdNo = cmdNo; }
public RibbonItem(MenuItemTemplate item, IDictionary inst, string id, string caption, string img, string desc, string clickUrl, string clickScript, int cmdNo) { this.Item = item; this.Inst = inst; this.ID = id; this.Caption = caption; this.Desc = desc; this.Img = img; this.ClickScript = clickScript; this.ClickUrl = clickUrl; this.CmdNo = cmdNo; }
private static bool MenuItemUpdateActionView(IBindingMemberInfo bindingMemberInfo, IMenuItem menuItem, object content) { var actionView = menuItem.GetActionView(); if (actionView != null) { ParentObserver.GetOrAdd(actionView).Parent = null; } var selector = MenuItemActionViewSelectorMember.GetValue(menuItem, null); if (selector != null) { object template = selector.SelectTemplate(content, menuItem); if (template != null) { content = template; } } if (content == null) { menuItem.SetActionView(null); return(true); } int viewId; if (int.TryParse(content.ToString(), out viewId)) { menuItem.SetActionView(viewId); actionView = menuItem.GetActionView(); } else { actionView = content as View; if (actionView == null) { Type viewType = TypeCache <View> .Instance.GetTypeByName(content.ToString(), false, true); actionView = viewType.CreateView(GetContextFromMenuItem(menuItem)); } menuItem.SetActionView(actionView); } ParentObserver.GetOrAdd(actionView).Parent = menuItem; var bindings = MenuItemTemplate.GetActionViewBind(menuItem); if (!string.IsNullOrEmpty(bindings)) { BindingServiceProvider.BindingProvider.CreateBindingsFromString(actionView, bindings, null); } return(true); }
private static void MenuItemTemplateInitialized(MenuItemTemplate menuItemTemplate, IMenuItem menuItem, XmlPropertySetter <MenuItemTemplate, IMenuItem> setter) { setter.SetEnumProperty <ShowAsAction>(() => template => template.ShowAsAction, menuItemTemplate.ShowAsAction); if (!string.IsNullOrEmpty(menuItemTemplate.ActionViewBind)) { ServiceProvider.AttachedValueProvider.SetValue(menuItem, ActionViewBindKey, menuItemTemplate.ActionViewBind); } if (!string.IsNullOrEmpty(menuItemTemplate.ActionProviderBind)) { ServiceProvider.AttachedValueProvider.SetValue(menuItem, ActionProviderBindKey, menuItemTemplate.ActionProviderBind); } }
internal void AddMenuItems(ControlCollection controls, IDictionary ctls) { string tmp, img; IDictionary ctl, subCtls; MenuItemTemplate menuItem; SubMenuTemplate subMenu; foreach (DictionaryEntry entry in ctls) { if ((ctl = entry.Value as IDictionary) != null) { if (((subCtls = ctl ["items"] as IDictionary) != null) && (subCtls.Count > 0)) { subMenu = new SubMenuTemplate() { ID = entry.Key + string.Empty, Description = ctl ["desc"] + string.Empty, Text = ctl ["title"] + string.Empty }; if (!string.IsNullOrEmpty(img = ctl ["img"] + string.Empty)) { subMenu.ImageUrl = img; } AddMenuItems(subMenu.Controls, subCtls); controls.Add(subMenu); } else if (!string.IsNullOrEmpty(tmp = ctl ["click"] + string.Empty)) { menuItem = new MenuItemTemplate(ctl ["title"] + string.Empty) { Description = ctl ["desc"] + string.Empty, ID = entry.Key + string.Empty }; if (!string.IsNullOrEmpty(img = ctl ["img"] + string.Empty)) { menuItem.ImageUrl = img; } menuItem.ClientOnClickScript = tmp; controls.Add(menuItem); } } else { controls.Add(new MenuSeparatorTemplate() { ID = entry.Key + string.Empty }); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { MenuTemplate propertyNameListMenu = new MenuTemplate(); propertyNameListMenu.ID = "PropertyNameListMenu"; MenuItemTemplate testMenu = new MenuItemTemplate("Edit Message", "/_layouts/images/edit.gif"); testMenu.ClientOnClickNavigateUrl = "EditMessage.aspx?id=%NAME%"; propertyNameListMenu.Controls.Add(testMenu); this.Controls.Add(propertyNameListMenu); } }
protected override void CreateChildControls() { // return when user is not a forms based user IClaimsIdentity claimsIdentity = (HttpContext.Current.User != null) ? (HttpContext.Current.User.Identity as IClaimsIdentity) : null; if (claimsIdentity != null) { SPClaimProviderManager mgr = SPClaimProviderManager.Local; SPClaim sPClaim = mgr.DecodeClaimFromFormsSuffix(claimsIdentity.Name); if (SPOriginalIssuers.GetIssuerType(sPClaim.OriginalIssuer) == SPOriginalIssuerType.Windows) { return; } } string changePasswordPage = ""; SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site = new SPSite(SPContext.Current.Site.ID, SPContext.Current.Site.Zone)) { MembershipSettings setting = new MembershipSettings(site.RootWeb); if (setting == null || string.IsNullOrEmpty(setting.ChangePasswordPage)) { return; } changePasswordPage = setting.ChangePasswordPage; } }); // generate return url string source = SPUtility.OriginalServerRelativeRequestUrl; string target = Utils.GetAbsoluteURL(SPContext.Current.Web, changePasswordPage); MenuItemTemplate changePasswordItem = new MenuItemTemplate(); changePasswordItem.Text = LocalizedString.GetString("FBAPackMenus", "FBAChangePassword_Title"); changePasswordItem.Description = LocalizedString.GetString("FBAPackMenus", "FBAChangePassword_Desc"); changePasswordItem.Sequence = 1; changePasswordItem.ClientOnClickNavigateUrl = target + "?Source=" + SPHttpUtility.UrlKeyValueEncode(source); this.Controls.Add(changePasswordItem); }
private static void AddTasksMenu(SPWeb web, SPListItem listItem, SubMenuTemplate menuWP) { if (web.Site.Features[new Guid(SiteFeaturesGuid)] != null) { var menuItemTemplate = new MenuItemTemplate { Text = listItem.Title, ClientOnClickScript = string.Format( "javascript:window.open('{0}/_layouts/epmlive/tasks.aspx?ID={1}&source={2}','', config='width=' + screen.width + ',height=' + screen.height + ',top=0,left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=yes'); return false;", web.ServerRelativeUrl, listItem.ID, HttpUtility.UrlEncode(HttpContext.Current.Request.ServerVariables["URL"])) }; menuWP.Controls.Add(menuItemTemplate); } }
private IBindableApplicationBarItem CreateMenuItemFromTemplate(object item) { if (MenuItemTemplate == null) { return(null); } var content = (IBindableApplicationBarItem)MenuItemTemplate.LoadContent(); if (content == null) { throw new InvalidOperationException( "BindableApplicationBar cannot use the MenuItemsSource property without a valid MenuItemTemplate"); } content.DataContext = item; return(content); }
protected override void CreateChildControls() { string menuItemImageUrl = "/_layouts/images/PrintList/Print_34.png"; string webUrl = SPContext.Current.Web.Url; string menuItemNavigateUrl = "javascript:void window.open('{0}/_layouts/roxority_SampleZen/lprnt.aspx{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}')"; ListViewWebPart oListView = FindListView(Parent); if (oListView == null) { return; } //List Parameters string listIDString = oListView.ListName != string.Empty ? "?ListID=" + oListView.ListName : string.Empty; string viewIDString = oListView.ViewGuid != string.Empty ? "&ViewID=" + oListView.ViewGuid : string.Empty; string filterString = oListView.FilterString != string.Empty ? "&" + oListView.FilterString.Replace("\\", "_BACKSLASH_") : string.Empty; string folderString = Page.Request.QueryString ["RootFolder"] != null ? "&RootFolder=" + Page.Request.QueryString ["RootFolder"].ToString() : string.Empty; //Calendar Paramaters string calendarDateString = Page.Request.QueryString ["CalendarDate"] != null ? "&CalendarDate=" + Page.Request.QueryString ["CalendarDate"].ToString() : string.Empty; string calendarPeriodString = Page.Request.QueryString ["CalendarPeriod"] != null ? "&CalendarPeriod=" + Page.Request.QueryString ["CalendarPeriod"].ToString() : string.Empty; //Paging Parameteres string pagedString = Page.Request.QueryString ["Paged"] != null ? "&Paged=" + Page.Request.QueryString ["Paged"].ToString() : string.Empty; string pagedPrevString = Page.Request.QueryString ["PagedPrev"] != null ? "&PagedPrev=" + Page.Request.QueryString ["PagedPrev"].ToString() : string.Empty; string p_File_x0020_TypeString = Page.Request.QueryString ["p_File_x0020_Type"] != null ? "&p_File_x0020_Type=" + Page.Request.QueryString ["p_File_x0020_Type"].ToString() : string.Empty; string p_FileLeafRefString = Page.Request.QueryString ["p_FileLeafRef"] != null ? "&p_FileLeafRef=" + Page.Request.QueryString ["p_FileLeafRef"].ToString() : string.Empty; string p_FSObjTypeString = Page.Request.QueryString ["p_FSObjType"] != null ? "&p_FSObjType=" + Page.Request.QueryString ["p_FSObjType"].ToString() : string.Empty; string p_IDString = Page.Request.QueryString ["p_ID"] != null ? "&p_ID=" + Page.Request.QueryString ["p_ID"].ToString() : string.Empty; string pageFirstRowString = Page.Request.QueryString ["PageFirstRow"] != null ? "&PageFirstRow=" + Page.Request.QueryString ["PageFirstRow"].ToString() : string.Empty; string pageLastRowString = Page.Request.QueryString ["PageLastRow"] != null ? "&PageLastRow=" + Page.Request.QueryString ["PageLastRow"].ToString() : string.Empty; MenuItemTemplate menu = new MenuItemTemplate(); string navigateUrl = string.Format(menuItemNavigateUrl, webUrl, listIDString, viewIDString, folderString, filterString, calendarDateString, calendarPeriodString, pagedString, pagedPrevString, p_File_x0020_TypeString, p_FSObjTypeString, p_FileLeafRefString, p_IDString, pageFirstRowString, pageLastRowString); menu.Text = "Print List"; menu.Description = "Print the current view of this list."; menu.ClientOnClickNavigateUrl = navigateUrl; menu.ImageUrl = menuItemImageUrl; Controls.Add(menu); base.CreateChildControls(); }
public override IEnumerable <MenuItem> GetItems(string areaName, ControllerContext controllerContext) { List <MenuItem> items = new List <MenuItem>(); MenuItemTemplate template = this; Site rootSite = Site.Current.RootSite(); if (template.Name.Equals(rootSite.Name, StringComparison.OrdinalIgnoreCase)) { if (template.ItemContainers != null) { foreach (var itemContainer in template.ItemContainers) { items.AddRange(itemContainer.GetItems(areaName, controllerContext)); } } } return(items); }
private void AddPlannerMenus(SPList list, bool hasProject, bool eProject, SPWeb web, bool disablePlan) { var listItem = list.Items[0]; MenuItemTemplate menu; if (hasProject) { menu = new MenuItemTemplate { Text = "Edit With Project", Description = "Edit your attached schedule using Microsoft Office Project.", ImageUrl = "/_layouts/images/project2007logo.gif", ClientOnClickScript = string.Format( eProject ? "javascript:window.open('{0}/_layouts/epmlive/getpsproject.aspx?listID={1}&itemID={2}','', config='height=250,width=350, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, directories=no, status=no'); return false" : "javascript:window.open('{0}/_layouts/epmlive/getproject.aspx?listID={1}&ID={2}','', config='height=100,width=350, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, directories=no, status=no'); return false", web.ServerRelativeUrl, list.ID, listItem.ID) }; Controls.Add(menu); } if (!disablePlan) { if (web.Site.Features[new Guid(SiteFeaturesGuid)] != null) { menu = new MenuItemTemplate { Text = "Edit In Work Planner", Description = "Edit your attached schedule using Work Planner.", ImageUrl = "/_layouts/images/epmlivelogo.gif", ClientOnClickScript = string.Format( "javascript:window.open('{0}/_layouts/epmlive/tasks.aspx?ID={1}&source={2}','', config='width=' + screen.width + ',height=' + screen.height + ',top=0,left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=yes'); return false;", web.ServerRelativeUrl, listItem.ID, HttpUtility.UrlEncode(HttpContext.Current.Request.ServerVariables["URL"])) }; Controls.Add(menu); } } }
protected override void Refresh() { for (int i = 0; i < _menu.Size(); i++) { MenuItemTemplate.Clear(_menu.GetItem(i)); } _menu.Clear(); IEnumerable itemsSource = ItemsSource; if (itemsSource == null) { return; } int count = 0; foreach (object item in itemsSource) { _itemTemplate.Apply(_menu, _context, item, count, count); count++; } }
private void FetchPermissions(string moduleName, MenuItemTemplate menuItemTemplate, List <Permission> permissions) { if (menuItemTemplate.ReadOnlyProperties != null) { var permissionGroup = menuItemTemplate.ReadOnlyProperties["permissionGroup"]; var permissionName = menuItemTemplate.ReadOnlyProperties["PermissionName"]; if (!string.IsNullOrEmpty(permissionName)) { permissions.Add(new Permission() { AreaName = moduleName, Group = permissionGroup, Name = permissionName, DisplayName = permissionName }); } } foreach (var item in menuItemTemplate.ItemContainers) { if (item is MenuItemTemplate) { FetchPermissions(moduleName, (MenuItemTemplate)item, permissions); } } }
internal void AddMenuItem(IDictionary inst, string id, string caption, string img, string desc, string clickUrl, string clickScript, int cmdNo) { MenuItemTemplate item = new MenuItemTemplate(caption, img); item.ID = id; item.Description = desc; item.PermissionContext = PermContext; item.Permissions = Perms; if (string.IsNullOrEmpty(clickScript)) { item.ClientOnClickNavigateUrl = SPEncode.ScriptEncode(clickUrl); } else { item.ClientOnClickScript = clickScript; } Controls.Add(item); if (ProductPage.Is14) { ribbons.Add(new RibbonItem(item, inst, ClientID + id, caption, img, desc, clickUrl, clickScript, cmdNo)); WebPartIDs.ToString(); } }
private static bool MenuItemUpdateActionProvider(IBindingMemberInfo bindingMemberInfo, IMenuItem menuItem, object content) { var selector = MenuItemActionProviderSelectorMember.GetValue(menuItem, null); if (selector != null) { object template = selector.SelectTemplate(content, menuItem); if (template != null) { content = template; } } if (content == null) { menuItem.SetActionProvider(null); return(true); } var actionProvider = content as ActionProvider; if (actionProvider == null) { Type viewType = TypeCache <ActionProvider> .Instance.GetTypeByName(content.ToString(), false, true); actionProvider = (ActionProvider)Activator.CreateInstance(viewType, GetContextFromMenuItem(menuItem)); } //TODO WRAPPER??? menuItem.SetActionProvider(actionProvider); BindingExtensions.AttachedParentMember.SetValue(actionProvider, menuItem); var bindings = MenuItemTemplate.GetActionProviderBind(menuItem); if (!string.IsNullOrEmpty(bindings)) { BindingServiceProvider.BindingProvider.CreateBindingsFromString(actionProvider, bindings, null); } return(true); }
/// <summary> /// Create all your controls here for rendering. /// Try to avoid using the RenderWebPart() method. /// </summary> protected override void CreateChildControls() { if (!_error) { try { //Getting the Public URL to handle http & https url issues string _publicURL = GetPublicUrl(); _publicURL = ""; base.CreateChildControls(); gvTaskList = new SPGridView(); gvTaskList.Width = Unit.Percentage(100); gvTaskList.AutoGenerateColumns = false; gvTaskList.BorderStyle = BorderStyle.Dotted; //Adding Title Field SPMenuField nameMenu = new SPMenuField(); nameMenu.HeaderText = "Title"; nameMenu.TextFields = "Title"; nameMenu.MenuTemplateId = "TaskListMenu"; nameMenu.NavigateUrlFields = "Task Ref"; nameMenu.TokenNameAndValueFields = "Task Ref=Task Ref"; //nameMenu.NavigateUrlFormat = _publicURL + "/{0}"; nameMenu.SortExpression = "Due Date"; //Adding Due Date Field BoundField dueDate = new BoundField(); dueDate.DataField = "Due Date"; dueDate.HeaderText = "Due Date"; dueDate.SortExpression = "Due Date"; //Adding Due Date Field BoundField documentAuthor = new BoundField(); documentAuthor.DataField = "Document Author"; documentAuthor.HeaderText = "Document Author"; documentAuthor.SortExpression = "Document Author"; //Adding DropDown Menu for 'Evidence Log' TaskListMenu = new MenuTemplate(); TaskListMenu.ID = "TaskListMenu"; MenuItemTemplate evidenceLogMenu = new MenuItemTemplate("Open", "/_layouts/images/actionseditpage.gif"); evidenceLogMenu.ClientOnClickNavigateUrl = "%Task Ref%"; //Adding Controls to Control Collection TaskListMenu.Controls.Add(evidenceLogMenu); this.Controls.Add(TaskListMenu); gvTaskList.Columns.Add(nameMenu); gvTaskList.Columns.Add(dueDate); gvTaskList.Columns.Add(documentAuthor); this.Controls.Add(gvTaskList); gvTaskList.PagerTemplate = null; } catch (Exception ex) { HandleException(ex); } } }