/// <summary>
    /// Setups grid actions.
    /// </summary>
    private void SetupGridActions()
    {
        if (IsLiveSite)
        {
            // Do not add actions on the live site
            return;
        }

        gridElem.GridActions = new UniGridActions();

        // Add edit action
        Action editAction = new Action();

        editAction.Name = "Edit";
        editAction.ExternalSourceName = EXTERNALSOURCE_EDIT;
        editAction.FontIconClass      = "icon-edit";
        editAction.FontIconStyle      = GridIconStyle.Allow;
        editAction.Caption            = "$contentmenu.edit$";
        gridElem.GridActions.Actions.Add(editAction);

        // Add view action
        Action viewAction = new Action();

        viewAction.Name = "Preview";
        viewAction.ExternalSourceName = EXTERNALSOURCE_PREVIEW;
        viewAction.FontIconClass      = "icon-eye";
        viewAction.FontIconStyle      = GridIconStyle.Allow;
        viewAction.Caption            = "$documents.navigatetodocument$";
        gridElem.GridActions.Actions.Add(viewAction);
    }
Пример #2
0
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        // Setup the modal dialog
        SetCulture();
        RegisterEscScript();

        ScriptHelper.RegisterDialogScript(this);
        ScriptHelper.RegisterWOpenerScript(this);

        // Setup the title, image, help
        PageTitle title = this.CurrentMaster.Title;

        title.HelpName = "helpTopic";

        CMS.UIControls.UniGridConfig.Action editAction = null;

        title.TitleText  = GetString("mvtvariant.list");
        title.TitleImage = GetImageUrl("Objects/OM_MVTVariant/object.png");
        // Must be set be to help icon created
        title.HelpTopicName = "mvtvariant_list";

        // Set the dark header (+ dark help icon)
        this.CurrentMaster.PanelBody.CssClass += " DialogsPageHeader";
        title.HelpIconUrl = GetImageUrl("General/HelpLargeDark.png");

        // Get Edit action button
        editAction         = listElem.Grid.GridActions.Actions[0] as CMS.UIControls.UniGridConfig.Action;
        editAction.OnClick = "OpenVariantProperties({0}); return false;";

        listElem.OnDelete += new EventHandler(listElem_OnDelete);
    }
Пример #3
0
    protected void Page_Init(object sender, EventArgs e)
    {
        // Initialize UniGrid collections
        gridElem.GridColumns = new UniGridColumns();
        gridElem.GridOptions = new UniGridOptions();
        gridElem.GridActions = new UniGridActions();

        // Add edit action
        Action editAction = new Action();

        editAction.Name = "Edit";
        editAction.ExternalSourceName = EXTERNALSOURCE_EDIT;
        editAction.Icon    = "edit.png";
        editAction.Caption = "$contentmenu.edit$";
        gridElem.GridActions.Actions.Add(editAction);

        // Add view action
        Action viewAction = new Action();

        viewAction.Name = "Preview";
        viewAction.ExternalSourceName = EXTERNALSOURCE_PREVIEW;
        viewAction.Icon    = "view.png";
        viewAction.Caption = "$documents.navigatetodocument$";
        gridElem.GridActions.Actions.Add(viewAction);

        // Add document name column
        Column documentName = new Column();

        documentName.Source                     = UniGrid.ALL;
        documentName.Sort                       = SOURCE_DOCUMENTNAME;
        documentName.ExternalSourceName         = EXTERNALSOURCE_DOCUMENTNAME;
        documentName.Caption                    = "$general.documentname$";
        documentName.Wrap                       = false;
        documentName.Tooltip                    = new ColumnTooltip();
        documentName.Tooltip.Source             = UniGrid.ALL;
        documentName.Tooltip.ExternalSourceName = EXTERNALSOURCE_DOCUMENTNAMETOOLTIP;
        documentName.Tooltip.Width              = "0";
        documentName.Tooltip.Encode             = false;

        switch (ListingType)
        {
        case ListingTypeEnum.OutdatedDocuments:
            break;

        default:
            documentName.Filter        = new ColumnFilter();
            documentName.Filter.Type   = "text";
            documentName.Filter.Source = SOURCE_DOCUMENTNAME;
            break;
        }
        switch (ListingType)
        {
        case ListingTypeEnum.All:
            documentName.Width = "80%";
            break;

        default:
            documentName.Width = "100%";
            break;
        }

        // Add filter for specific listing types
        if ((ListingType == ListingTypeEnum.MyDocuments) || (ListingType == ListingTypeEnum.CheckedOut) || (ListingType == ListingTypeEnum.RecentDocuments) ||
            (ListingType == ListingTypeEnum.PendingDocuments))
        {
            gridElem.GridOptions.DisplayFilter = true;
        }

        gridElem.GridColumns.Columns.Add(documentName);

        // Add listing type (only if combined view)
        Column listingType = new Column();

        listingType.Source             = "type";
        listingType.ExternalSourceName = "type";
        listingType.Sort    = "type";
        listingType.Wrap    = false;
        listingType.Caption = "$general.listingtype$";
        if (ListingType == ListingTypeEnum.All)
        {
            gridElem.GridColumns.Columns.Add(listingType);
        }

        switch (ListingType)
        {
        case ListingTypeEnum.DocTypeDocuments:
            break;

        default:
            // Initialize document class name column
            Column classDisplayName = new Column();
            classDisplayName.Source             = SOURCE_CLASSDISPLAYNAME;
            classDisplayName.ExternalSourceName = EXTERNALSOURCE_CLASSDISPLAYNAME;
            classDisplayName.MaxLength          = 50;
            classDisplayName.Caption            = "$general.documenttype$";
            classDisplayName.Wrap                       = false;
            classDisplayName.Tooltip                    = new ColumnTooltip();
            classDisplayName.Tooltip.Source             = SOURCE_CLASSDISPLAYNAME;
            classDisplayName.Tooltip.ExternalSourceName = EXTERNALSOURCE_CLASSDISPLAYNAMETOOLTIP;
            classDisplayName.Tooltip.Width              = "0";
            switch (ListingType)
            {
            case ListingTypeEnum.OutdatedDocuments:
                break;

            default:
                classDisplayName.Filter        = new ColumnFilter();
                classDisplayName.Filter.Type   = "text";
                classDisplayName.Filter.Source = SOURCE_CLASSDISPLAYNAME;
                break;
            }
            gridElem.GridColumns.Columns.Add(classDisplayName);
            break;
        }

        // Add timestamp column
        Column modifiedWhen = new Column();

        modifiedWhen.Source             = SOURCE_MODIFIEDWHEN;
        modifiedWhen.ExternalSourceName = EXTERNALSOURCE_MODIFIEDWHEN;
        modifiedWhen.Wrap    = false;
        modifiedWhen.Tooltip = new ColumnTooltip();
        modifiedWhen.Tooltip.ExternalSourceName = EXTERNALSOURCE_MODIFIEDWHENTOOLTIP;
        switch (ListingType)
        {
        case ListingTypeEnum.CheckedOut:
            modifiedWhen.Caption = "$general.checkouttime$";
            break;

        default:
            modifiedWhen.Caption = "$general.modified$";
            break;
        }
        gridElem.GridColumns.Columns.Add(modifiedWhen);

        // Add column with workflow information
        Column workflowStep = new Column();

        workflowStep.Caption = "$general.workflowstep$";
        workflowStep.Wrap    = false;
        switch (ListingType)
        {
        case ListingTypeEnum.All:
            workflowStep.Source             = SOURCE_WORKFLOWSTEPID;
            workflowStep.ExternalSourceName = EXTERNALSOURCE_STEPNAME;
            break;

        default:
            workflowStep.Source             = SOURCE_WORKFLOWSTEPDISPLAYNAME;
            workflowStep.ExternalSourceName = EXTERNALSOURCE_STEPDISPLAYNAME;
            break;
        }
        gridElem.GridColumns.Columns.Add(workflowStep);

        // Add version information
        switch (ListingType)
        {
        case ListingTypeEnum.WorkflowDocuments:
            Column versionNumber = new Column();
            versionNumber.Source             = SOURCE_VERSION;
            versionNumber.ExternalSourceName = EXTERNALSOURCE_VERSION;
            versionNumber.Caption            = "$general.version$";
            versionNumber.Wrap = false;
            gridElem.GridColumns.Columns.Add(versionNumber);
            break;
        }

        // Add culture column
        Column culture = new Column();

        culture.Source             = UniGrid.ALL;
        culture.ExternalSourceName = EXTERNALSOURCE_CULTURE;
        culture.Caption            = "$general.language$";
        culture.Sort = SOURCE_CULTURENAME;
        culture.Wrap = false;
        gridElem.GridColumns.Columns.Add(culture);

        // Add site name column
        Column siteName = null;

        switch (ListingType)
        {
        default:
            siteName                    = new Column();
            siteName.Source             = SOURCE_SITENAME;
            siteName.ExternalSourceName = EXTERNALSOURCE_SITENAME;
            siteName.Caption            = "$general.site$";
            siteName.Wrap               = false;
            gridElem.GridColumns.Columns.Add(siteName);
            break;

        case ListingTypeEnum.All:
            siteName                    = new Column();
            siteName.Source             = SOURCE_NODESITEID;
            siteName.ExternalSourceName = EXTERNALSOURCE_SITEID;
            siteName.Caption            = "$general.site$";
            siteName.Wrap               = false;
            gridElem.GridColumns.Columns.Add(siteName);
            break;
        }
        // Prepare columns to select
        string baseColumns = SqlHelperClass.MergeColumns(new string[] { SOURCE_CLASSNAME, SOURCE_SITENAME, SOURCE_CLASSDISPLAYNAME, SOURCE_MODIFIEDWHEN, SOURCE_WORKFLOWSTEPDISPLAYNAME, SOURCE_NODEID, SOURCE_DOCUMENTCULTURE, SOURCE_DOCUMENTNAME, SOURCE_DOCUMENTNAMEPATH, SOURCE_NODEALIASPATH, SOURCE_NODELINKEDNODEID, SOURCE_CULTURENAME });

        // Set UniGrid options
        switch (ListingType)
        {
        case ListingTypeEnum.PageTemplateDocuments:
            gridElem.Columns    = SqlHelperClass.MergeColumns(new string[] { baseColumns, SOURCE_NODESITEID, "NodeACLID", "NodeOwner" });
            gridElem.ObjectType = "cms.documentlist";
            break;

        case ListingTypeEnum.WorkflowDocuments:
            gridElem.Columns    = SqlHelperClass.MergeColumns(new string[] { baseColumns, SELECTION_COLUMN, SOURCE_VERSION });
            gridElem.ObjectType = "cms.documentlist";
            break;

        case ListingTypeEnum.All:
            gridElem.ObjectType = "cms.userdocumentslist";
            break;

        default:
            gridElem.Columns    = baseColumns;
            gridElem.ObjectType = "cms.documentlist";
            break;
        }
        switch (ListingType)
        {
        case ListingTypeEnum.OutdatedDocuments:
        case ListingTypeEnum.WorkflowDocuments:
            break;

        case ListingTypeEnum.All:
            gridElem.GridOptions.DisplayFilter = true;
            break;
        }
        switch (ListingType)
        {
        case ListingTypeEnum.WorkflowDocuments:
            gridElem.GridOptions.ShowSelection   = true;
            gridElem.GridOptions.SelectionColumn = SELECTION_COLUMN;
            break;
        }
    }
    /// <summary>
    /// Setups grid actions.
    /// </summary>
    private void SetupGridActions()
    {
        if (IsLiveSite)
        {
            // Do not add actions on the live site
            return;
        }

        gridElem.GridActions = new UniGridActions();

        // Add edit action
        Action editAction = new Action();
        editAction.Name = "Edit";
        editAction.ExternalSourceName = EXTERNALSOURCE_EDIT;
        editAction.FontIconClass = "icon-edit";
        editAction.FontIconStyle = GridIconStyle.Allow;
        editAction.Caption = "$contentmenu.edit$";
        gridElem.GridActions.Actions.Add(editAction);

        // Add view action
        Action viewAction = new Action();
        viewAction.Name = "Preview";
        viewAction.ExternalSourceName = EXTERNALSOURCE_PREVIEW;
        viewAction.FontIconClass = "icon-eye";
        viewAction.FontIconStyle = GridIconStyle.Allow;
        viewAction.Caption = "$documents.navigatetodocument$";
        gridElem.GridActions.Actions.Add(viewAction);
    }
Пример #5
0
    protected void Page_Init(object sender, EventArgs e)
    {
        // Initialize UniGrid collections
        gridElem.GridColumns = new UniGridColumns();
        gridElem.GridOptions = new UniGridOptions();
        gridElem.GridActions = new UniGridActions();

        // Add edit action
        Action editAction = new Action();
        editAction.Name = "Edit";
        editAction.ExternalSourceName = EXTERNALSOURCE_EDIT;
        editAction.Icon = "edit.png";
        editAction.Caption = "$contentmenu.edit$";
        gridElem.GridActions.Actions.Add(editAction);

        // Add view action
        Action viewAction = new Action();
        viewAction.Name = "Preview";
        viewAction.ExternalSourceName = EXTERNALSOURCE_PREVIEW;
        viewAction.Icon = "view.png";
        viewAction.Caption = "$documents.navigatetodocument$";
        gridElem.GridActions.Actions.Add(viewAction);

        // Add document name column
        Column documentName = new Column();
        documentName.Source = UniGrid.ALL;
        documentName.Sort = SOURCE_DOCUMENTNAME;
        documentName.ExternalSourceName = EXTERNALSOURCE_DOCUMENTNAME;
        documentName.Caption = "$general.documentname$";
        documentName.Wrap = false;
        documentName.Tooltip = new ColumnTooltip();
        documentName.Tooltip.Source = UniGrid.ALL;
        documentName.Tooltip.ExternalSourceName = EXTERNALSOURCE_DOCUMENTNAMETOOLTIP;
        documentName.Tooltip.Width = "0";
        documentName.Tooltip.Encode = false;

        switch (ListingType)
        {
            case ListingTypeEnum.OutdatedDocuments:
                break;

            default:
                documentName.Filter = new ColumnFilter();
                documentName.Filter.Type = "text";
                documentName.Filter.Source = SOURCE_DOCUMENTNAME;
                break;
        }
        switch (ListingType)
        {
            case ListingTypeEnum.All:
                documentName.Width = "80%";
                break;

            default:
                documentName.Width = "100%";
                break;
        }

        // Add filter for specific listing types
        if ((ListingType == ListingTypeEnum.MyDocuments) || (ListingType == ListingTypeEnum.CheckedOut) || (ListingType == ListingTypeEnum.RecentDocuments) ||
            (ListingType == ListingTypeEnum.PendingDocuments))
        {
            gridElem.GridOptions.DisplayFilter = true;
        }

        gridElem.GridColumns.Columns.Add(documentName);

        // Add listing type (only if combined view)
        Column listingType = new Column();
        listingType.Source = "type";
        listingType.ExternalSourceName = "type";
        listingType.Sort = "type";
        listingType.Wrap = false;
        listingType.Caption = "$general.listingtype$";
        if (ListingType == ListingTypeEnum.All)
        {
            gridElem.GridColumns.Columns.Add(listingType);
        }

        switch (ListingType)
        {
            case ListingTypeEnum.DocTypeDocuments:
                break;

            default:
                // Initialize document class name column
                Column classDisplayName = new Column();
                classDisplayName.Source = SOURCE_CLASSDISPLAYNAME;
                classDisplayName.ExternalSourceName = EXTERNALSOURCE_CLASSDISPLAYNAME;
                classDisplayName.MaxLength = 50;
                classDisplayName.Caption = "$general.documenttype$";
                classDisplayName.Wrap = false;
                classDisplayName.Tooltip = new ColumnTooltip();
                classDisplayName.Tooltip.Source = SOURCE_CLASSDISPLAYNAME;
                classDisplayName.Tooltip.ExternalSourceName = EXTERNALSOURCE_CLASSDISPLAYNAMETOOLTIP;
                classDisplayName.Tooltip.Width = "0";
                switch (ListingType)
                {
                    case ListingTypeEnum.OutdatedDocuments:
                        break;

                    default:
                        classDisplayName.Filter = new ColumnFilter();
                        classDisplayName.Filter.Type = "text";
                        classDisplayName.Filter.Source = SOURCE_CLASSDISPLAYNAME;
                        break;
                }
                gridElem.GridColumns.Columns.Add(classDisplayName);
                break;
        }

        // Add timestamp column
        Column modifiedWhen = new Column();
        modifiedWhen.Source = SOURCE_MODIFIEDWHEN;
        modifiedWhen.ExternalSourceName = EXTERNALSOURCE_MODIFIEDWHEN;
        modifiedWhen.Wrap = false;
        modifiedWhen.Tooltip = new ColumnTooltip();
        modifiedWhen.Tooltip.ExternalSourceName = EXTERNALSOURCE_MODIFIEDWHENTOOLTIP;
        switch (ListingType)
        {
            case ListingTypeEnum.CheckedOut:
                modifiedWhen.Caption = "$general.checkouttime$";
                break;

            default:
                modifiedWhen.Caption = "$general.modified$";
                break;
        }
        gridElem.GridColumns.Columns.Add(modifiedWhen);

        // Add column with workflow information
        Column workflowStep = new Column();
        workflowStep.Caption = "$general.workflowstep$";
        workflowStep.Wrap = false;
        switch (ListingType)
        {
            case ListingTypeEnum.All:
                workflowStep.Source = SOURCE_WORKFLOWSTEPID;
                workflowStep.ExternalSourceName = EXTERNALSOURCE_STEPNAME;
                break;

            default:
                workflowStep.Source = SOURCE_WORKFLOWSTEPDISPLAYNAME;
                workflowStep.ExternalSourceName = EXTERNALSOURCE_STEPDISPLAYNAME;
                break;
        }
        gridElem.GridColumns.Columns.Add(workflowStep);

        // Add version information
        switch (ListingType)
        {
            case ListingTypeEnum.WorkflowDocuments:
                Column versionNumber = new Column();
                versionNumber.Source = SOURCE_VERSION;
                versionNumber.ExternalSourceName = EXTERNALSOURCE_VERSION;
                versionNumber.Caption = "$general.version$";
                versionNumber.Wrap = false;
                gridElem.GridColumns.Columns.Add(versionNumber);
                break;
        }

        // Add culture column
        Column culture = new Column();
        culture.Source = UniGrid.ALL;
        culture.ExternalSourceName = EXTERNALSOURCE_CULTURE;
        culture.Caption = "$general.language$";
        culture.Sort = SOURCE_CULTURENAME;
        culture.Wrap = false;
        gridElem.GridColumns.Columns.Add(culture);

        // Add site name column
        Column siteName = null;
        switch (ListingType)
        {
            default:
                siteName = new Column();
                siteName.Source = SOURCE_SITENAME;
                siteName.ExternalSourceName = EXTERNALSOURCE_SITENAME;
                siteName.Caption = "$general.site$";
                siteName.Wrap = false;
                gridElem.GridColumns.Columns.Add(siteName);
                break;

            case ListingTypeEnum.All:
                siteName = new Column();
                siteName.Source = SOURCE_NODESITEID;
                siteName.ExternalSourceName = EXTERNALSOURCE_SITEID;
                siteName.Caption = "$general.site$";
                siteName.Wrap = false;
                gridElem.GridColumns.Columns.Add(siteName);
                break;
        }
        // Prepare columns to select
        string baseColumns = SqlHelperClass.MergeColumns(new string[] { SOURCE_CLASSNAME, SOURCE_SITENAME, SOURCE_CLASSDISPLAYNAME, SOURCE_MODIFIEDWHEN, SOURCE_WORKFLOWSTEPDISPLAYNAME, SOURCE_NODEID, SOURCE_DOCUMENTCULTURE, SOURCE_DOCUMENTNAME, SOURCE_DOCUMENTNAMEPATH, SOURCE_NODEALIASPATH, SOURCE_NODELINKEDNODEID, SOURCE_CULTURENAME });
        // Set UniGrid options
        switch (ListingType)
        {
            case ListingTypeEnum.PageTemplateDocuments:
                gridElem.Columns = SqlHelperClass.MergeColumns(new string[] { baseColumns, SOURCE_NODESITEID, "NodeACLID", "NodeOwner" });
                gridElem.ObjectType = "cms.documentlist";
                break;

            case ListingTypeEnum.WorkflowDocuments:
                gridElem.Columns = SqlHelperClass.MergeColumns(new string[] { baseColumns, SELECTION_COLUMN, SOURCE_VERSION });
                gridElem.ObjectType = "cms.documentlist";
                break;

            case ListingTypeEnum.All:
                gridElem.ObjectType = "cms.userdocumentslist";
                break;

            default:
                gridElem.Columns = baseColumns;
                gridElem.ObjectType = "cms.documentlist";
                break;
        }
        switch (ListingType)
        {
            case ListingTypeEnum.OutdatedDocuments:
            case ListingTypeEnum.WorkflowDocuments:
                break;

            case ListingTypeEnum.All:
                gridElem.GridOptions.DisplayFilter = true;
                break;
        }
        switch (ListingType)
        {
            case ListingTypeEnum.WorkflowDocuments:
                gridElem.GridOptions.ShowSelection = true;
                gridElem.GridOptions.SelectionColumn = SELECTION_COLUMN;
                break;
        }
    }
Пример #6
0
    /// <summary>
    /// Loads actions definition.
    /// </summary>
    /// <param name="actions">Configuration of the actions</param>
    private void LoadActionsDefinition(UniGridActions actions)
    {
        // Custom template field of the grid view
        TemplateField actionsColumn = new TemplateField();

        // Ensure width of the column
        if (!String.IsNullOrEmpty(actions.Width))
        {
            actionsColumn.ItemStyle.Width = new Unit(actions.Width);
        }

        // Add object menu if possible
        if ((actions.Actions.Count > 0 && !(actions.Actions.FirstOrDefault() is EmptyAction)) && ShowObjectMenu && UniGridFunctions.ShowUniGridObjectContextMenu(CMSObjectHelper.GetReadOnlyObject(ObjectType)))
        {
            actions.Actions.RemoveAll(a => a is EmptyAction);
            // Check if object menu already contained
            var menus = from action in actions.Actions.OfType<Action>()
                        where (action.Name.ToLower() == "#objectmenu") || (!String.IsNullOrEmpty(action.ContextMenu))
                        select action;

            // Add object menu of necessary
            if ((menus.Count() == 0) && !IsLiveSite)
            {
                Action action = new Action("#objectmenu");
                action.ExternalSourceName = "#objectmenu";
                actions.Actions.Add(action);
            }
        }

        // Show header?
        if (actions.ShowHeader)
        {
            if (ShowActionsMenu && string.IsNullOrEmpty(actions.ContextMenu))
            {
                actions.ContextMenu = DEFAULT_ACTIONS_MENU;
                actions.Caption = "General.OtherActions";
            }
            // Fill in the custom template field
            GridViewTemplate headerTemplate = new GridViewTemplate(ListItemType.Header, this, actions, GetString("unigrid.actions"), ImageDirectoryPath, DefaultImageDirectoryPath, Page);
            headerTemplate.ContextMenuParent = plcContextMenu;
            headerTemplate.CheckRelative = CheckRelative;
            actionsColumn.HeaderTemplate = headerTemplate;
            if (ShowActionsMenu)
            {
                if (actions.Actions.FirstOrDefault() is EmptyAction)
                {
                    actionsColumn.HeaderStyle.CssClass = "EmptyAC";
                }
                else
                {
                    actionsColumn.HeaderStyle.CssClass = "AC";
                }
            }
        }
        GridViewTemplate actionsTemplate = new GridViewTemplate(ListItemType.Item, this, actions, null, ImageDirectoryPath, DefaultImageDirectoryPath, Page);
        actionsTemplate.OnExternalDataBound += RaiseExternalDataBound;
        actionsTemplate.ContextMenuParent = plcContextMenu;
        actionsTemplate.CheckRelative = CheckRelative;
        actionsColumn.ItemTemplate = actionsTemplate;

        if (!IsLiveSite)
        {
            actionsColumn.ItemStyle.CssClass = "NW UniGridActions";
        }
        else
        {
            actionsColumn.ItemStyle.CssClass = "UniGridActions";
            actionsColumn.ItemStyle.Wrap = false;
        }

        // CSS class name
        string cssClass = actions.CssClass;
        if (cssClass != null)
        {
            actionsColumn.HeaderStyle.CssClass += " " + cssClass;
            actionsColumn.ItemStyle.CssClass += " " + cssClass;
            actionsColumn.FooterStyle.CssClass += " " + cssClass;
        }

        // Add custom column to grid view
        UniGridView.Columns.Add(actionsColumn);
    }