Esempio n. 1
0
        /// <summary>
        /// Получение меню в runtime для уровня (treeLevelInfo задан) или пустой иерархии (treeLevelInfo равен null)
        /// </summary>
        /// <param name="treeLevelInfo">описание уровня, для которого запрашивается меню, или null</param>
        /// <param name="request">параметры с клиента</param>
        /// <returns></returns>
        public XTreeMenuInfo GetMenu(XTreeLevelInfoIT treeLevelInfo, XGetTreeMenuRequest request, IXExecutionContext context)
        {
            DomainObjectDataSet dataSet = new DomainObjectDataSet(context.Connection.MetadataManager.XModel);
            DomainObjectData    xobj    = dataSet.GetLoadedStub(request.Path.PathNodes[0].ObjectType, request.Path.PathNodes[0].ObjectID);

            XTreeMenuInfo menu = new XTreeMenuInfo("@@Title", true);

            menu.CacheMode = XTreeMenuCacheMode.NoCache;
            XMenuActionItem item;

            XObjectRights rights = XSecurityManager.Instance.GetObjectRights(xobj);

            if (rights.AllowParticalOrFullChange)
            {
                item        = menu.Items.AddActionItem("Редактировать", StdActions.DoEdit);
                item.Hotkey = "VK_ENTER";
                item.Parameters.Add("RefreshFlags", "TRM_NODE+TRM_PARENTNODE");
            }

            XNewObjectRights create_rights = XSecurityManager.Instance.GetRightsOnNewObject(dataSet.CreateNew(xobj.ObjectType, true));

            if (create_rights.AllowCreate)
            {
                item        = menu.Items.AddActionItem("Создать", StdActions.DoCreate);
                item.Hotkey = "VK_INS";
                item.Parameters.Add("RefreshFlags", "TRM_TREE");
                if (rights.AllowDelete)
                {
                    menu.Items.AddSeparatorItem();
                }
            }

            if (rights.AllowDelete)
            {
                item        = menu.Items.AddActionItem("Удалить", StdActions.DoDelete);
                item.Hotkey = "VK_DEL";
                item.Parameters.Add("RefreshFlags", "TRM_TREE");
            }

            return(menu);
        }
Esempio n. 2
0
        public XResponse Execute(XGetTreeMenuRequest request, IXExecutionContext context)
        {
            XTreePageInfo treePage = XTreeController.Instance.GetPageInfo(request.MetaName);

            XTreeMenuInfo treemenu;

            if (request.IsMenuForEmptyTree)
            {
                treemenu = treePage.GetMenuForEmptyTree(request, context);
            }
            else
            {
                treemenu = treePage.GetMenu(request, context);
            }
            if (treemenu != null)
            {
                return(new XGetMenuResponse(treemenu.ToXml()));
            }
            else
            {
                return(new XGetMenuResponse(null));
            }
        }
Esempio n. 3
0
 public virtual XTreeMenuInfo GetMenuForEmptyTree(XGetTreeMenuRequest request, IXExecutionContext context, XTreePageInfoStd treePage)
 {
     return(treePage.EmptyTreeMenu.GetMenu(null, request, context));
 }
Esempio n. 4
0
 public abstract XTreeMenuInfo GetMenuForEmptyTree(XGetTreeMenuRequest request, IXExecutionContext context);