Exemplo n.º 1
0
 /// <summary>
 /// 根据权限设置控件属性
 /// </summary>
 /// <param name="cmd"></param>
 /// <param name="can"></param>
 private void setControlAction(Ext.Net.GridCommand cmd, bool can)
 {
     if (can)
     {
         return;
     }
     cmd.Disabled = !can;
     if (!can)
     {
         cmd.ToolTip.Text = "【无此权限】";
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 系统控件进行权限校验
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        private bool checkControlActionPermit(Ext.Net.GridCommand cmd)
        {
            string id = cmd.CommandName;

            return(checkControlActionPermit(id));
        }
 /// <summary>
 ///
 /// </summary>
 public GridCommand.Builder GridCommand(GridCommand component)
 {
     return(new GridCommand.Builder(component));
 }
Exemplo n.º 4
0
 private static void AddCommand(CommandColumn commandColumn, Icon icon, string command, string text)
 {
     GridCommand gridCommand = new GridCommand
     {
         Icon = icon,
         Text = text,
         CommandName = command
     };
     commandColumn.Commands.Add(gridCommand);
 }
Exemplo n.º 5
0
 private void InitGridCommand()
 {
     if ((this.EditorConfig != null) && (this.EditorConfig.Mode == EditorMode.Window))
     {
         Window window = new Window
         {
             AutoShow = false,
             Hidden = true,
             CloseAction = CloseAction.Hide,
             Closable = true,
             ConstrainHeader = true,
             Constrain = true,
             Modal = true,
             BodyPadding = 10
         };
         ComponentLoader loader = new ComponentLoader
         {
             DisableCaching = true,
             AutoLoad = false,
             Mode = LoadMode.Frame
         };
         window.Loader = loader;
         this._editWindow = window;
         this._editWindow.Loader.LoadMask.ShowMask = true;
         this._editWindow.Loader.LoadMask.Msg = "正在加载";
         this._editWindow.ID = "editWindow";
         _editWindow.Resizable = false;
         _editWindow.Icon = Ext.Net.Icon.UserAdd;
         this.Controls.Add(this._editWindow);
         CommandColumn item = (CommandColumn)this.ColumnModel.Columns.FirstOrDefault<ColumnBase>(x => (x is CommandColumn));
         GridCommand command = null;
         if (this.EnableEdit)
         {
             command = new GridCommand
             {
                 Text = "编辑",
                 Icon = Ext.Net.Icon.ApplicationEdit,
                 CommandName = "edit"
             };
         }
         GridCommand commandRemove = null;
         if (this.EnableRemove)
         {
             commandRemove = new GridCommand
             {
                 Text = "删除",
                 Icon = Ext.Net.Icon.ApplicationDelete,
                 CommandName = "delete"
             };
         }
         if (item == null)
         {
             item = new CommandColumn();
             item.DirectEvents.Command.Confirmation.ConfirmRequest = true;
             item.DirectEvents.Command.Confirmation.Message = "确认删除?";
             item.DirectEvents.Command.Confirmation.Title = "提示";
             item.DirectEvents.Command.Confirmation.BeforeConfirm = "if(command=='delete')return true;return false;";
             item.Width = 150;
             if (this.EnableEdit)
             {
                 item.Commands.Add(command);
             }
             if (this.EnableRemove)
             {
                 item.Commands.Add(commandRemove);
             }
             this.ColumnModel.Columns.Insert(0, item);
             this.InitGridCommand(item);
             if (EditorConfig.EditWindow != null)
             {
                 var replaceParamsScripts = new List<string>();
                 var scriptTpl = "url=url.replace('{0}',{1});";
                 foreach (var paras in EditorConfig.EditWindow.ExtraParams)
                 {
                     var script = string.Format(scriptTpl, "@" + paras.Name, paras.Value);
                     replaceParamsScripts.Add(script);
                 }
                 item.Listeners.Command.Handler = "if(command==\"edit\"){var url='" + EditorConfig.EditWindow.Url + "';" + string.Join(";", replaceParamsScripts) + "var editWindow=App." + _editWindow.ID + ";editWindow.show();editWindow.loader.load({url:url});editWindow.setTitle(\"" + EditorConfig.EditWindow.Title + "\");editWindow.setWidth(" + EditorConfig.EditWindow.Width + ");editWindow.setHeight(" + EditorConfig.EditWindow.Height + ");editWindow.center();}else{Ext.Msg.confirm(\"提示\",\"确认删除吗?\",function(r){if(r==\"yes\"){               }})}";
                 //item.DirectEvents.Command.ExtraParams.AddRange(this.EditorConfig.EditWindow.ExtraParams);
             }
         }
         else
         {
             GridCommand commandEdit = (GridCommand)item.Commands.FirstOrDefault<GridCommandBase>(x => (((GridCommand)x).CommandName == "edit"));
             if (commandEdit == null)
             {
                 commandEdit = command;
                 this.InitGridCommand(item);
                 if (EnableRemove)
                     item.Commands.Insert(0, commandRemove);
                 if (EnableEdit)
                     item.Commands.Insert(0, commandEdit);
                 if (EditorConfig.EditWindow != null)
                     item.DirectEvents.Command.ExtraParams.AddRange(this.EditorConfig.EditWindow.ExtraParams);
             }
         }
     }
 }
Exemplo n.º 6
0
 private void InitGridCommand()
 {
     if ((this.EditorConfig != null) && (this.EditorConfig.Mode == EditorMode.Window))
     {
         Window window = new Window
         {
             AutoShow = false,
             Hidden = true,
             CloseAction = CloseAction.Hide,
             Closable = true,
             ConstrainHeader = true,
             Constrain = true,
             Modal = true,
             BodyPadding = 10
         };
         ComponentLoader loader = new ComponentLoader
         {
             DisableCaching = true,
             AutoLoad = false,
             Mode = LoadMode.Frame
         };
         window.Loader = loader;
         this._editWindow = window;
         this._editWindow.Loader.LoadMask.ShowMask = true;
         this._editWindow.Loader.LoadMask.Msg = "正在加载";
         this._editWindow.ID = "_editWindow";
         this.Controls.Add(this._editWindow);
         CommandColumn item = (CommandColumn)this.ColumnModel.Columns.FirstOrDefault<ColumnBase>(x => (x is CommandColumn));
         GridCommand command = null;
         if (this.EnableEdit)
         {
             command = new GridCommand
             {
                 Text = "编辑",
                 Icon = Ext.Net.Icon.ApplicationEdit,
                 CommandName = "edit"
             };
         }
         GridCommand commandRemove = null;
         if (this.EnableRemove)
         {
             commandRemove = new GridCommand
             {
                 Text = "删除",
                 Icon = Ext.Net.Icon.ApplicationDelete,
                 CommandName = "delete"
             };
         }
         if (item == null)
         {
             item = new CommandColumn();
             item.DirectEvents.Command.Confirmation.ConfirmRequest = true;
             item.DirectEvents.Command.Confirmation.Message = "确认删除?";
             item.DirectEvents.Command.Confirmation.Title = "提示";
             item.DirectEvents.Command.Confirmation.BeforeConfirm = "if(command=='delete')return true;return false;";
             item.Width = 150;
             if (this.EnableEdit)
             {
                 item.Commands.Add(command);
             }
             if (this.EnableRemove)
             {
                 item.Commands.Add(commandRemove);
             }
             this.ColumnModel.Columns.Insert(0, item);
             this.InitGridCommand(item);
             if (EditorConfig.EditWindow != null)
                 item.DirectEvents.Command.ExtraParams.AddRange(this.EditorConfig.EditWindow.ExtraParams);
         }
         else
         {
             GridCommand commandEdit = (GridCommand)item.Commands.FirstOrDefault<GridCommandBase>(x => (((GridCommand)x).CommandName == "edit"));
             if (commandEdit == null)
             {
                 commandEdit = command;
                 this.InitGridCommand(item);
                 if (EnableRemove)
                     item.Commands.Insert(0, commandRemove);
                 if (EnableEdit)
                     item.Commands.Insert(0, commandEdit);
                 if (EditorConfig.EditWindow != null)
                     item.DirectEvents.Command.ExtraParams.AddRange(this.EditorConfig.EditWindow.ExtraParams);
             }
         }
     }
 }