Пример #1
0
        protected void grdDisplayColumns_ItemCreated(object sender, DataGridItemEventArgs e)
        {
            var objUpImage   = default(ImageButton);
            var objDownImage = default(ImageButton);

            switch (e.Item.ItemType)
            {
            case ListItemType.AlternatingItem:
            case ListItemType.Item:
            case ListItemType.SelectedItem:

                // Center the "visible" checkbox in its cell
                e.Item.Cells [1].Style.Add("text-align", "center");

                // imgUp
                objUpImage          = (ImageButton)e.Item.Cells [2].FindControl("imgUp");
                objUpImage.Visible  = (e.Item.ItemIndex != 0);
                objUpImage.ImageUrl = IconController.IconURL("Up", "16X16");

                // imgDown
                objDownImage          = (ImageButton)e.Item.Cells [2].FindControl("imgDown");
                objDownImage.ImageUrl = IconController.IconURL("Dn", "16X16");
                if (objUpImage.Visible == false)
                {
                    objDownImage.Style.Add("margin-left", "19px");
                }

                e.Item.CssClass = "Normal";
                break;

            case ListItemType.Header:
                e.Item.CssClass = "SubHead";
                break;
            }
        }
Пример #2
0
        protected void btnSubscribe_Click(object sender, ImageClickEventArgs e)
        {
            var objEventSubscriptionController = new EventSubscriptionController();

            if (btnSubscribe.ImageUrl == IconController.IconURL("Unchecked"))
            {
                var objEventSubscription = new EventSubscriptionInfo();
                objEventSubscription.SubscriptionID = -1;
                objEventSubscription.ModuleID       = ModuleId;
                objEventSubscription.PortalID       = PortalId;
                objEventSubscription.UserID         = UserId;
                objEventSubscriptionController.EventsSubscriptionSave(objEventSubscription);
                btnSubscribe.Visible       = true;
                lblSubscribe.Text          = Localization.GetString("lblUnsubscribe", LocalResourceFile);
                btnSubscribe.AlternateText = Localization.GetString("MenuUnsubscribe", LocalResourceFile);
                btnSubscribe.ToolTip       = Localization.GetString("MenuTTUnsubscribe", LocalResourceFile);
                btnSubscribe.ImageUrl      = IconController.IconURL("Checked");
            }
            else
            {
                objEventSubscriptionController.EventsSubscriptionDeleteUser(UserId, ModuleId);
                btnSubscribe.Visible       = true;
                lblSubscribe.Text          = Localization.GetString("lblSubscribe", LocalResourceFile);
                btnSubscribe.AlternateText = Localization.GetString("MenuSubscribe", LocalResourceFile);
                btnSubscribe.ToolTip       = Localization.GetString("MenuTTSubscribe", LocalResourceFile);
                btnSubscribe.ImageUrl      = IconController.IconURL("Unchecked");
            }
        }
Пример #3
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///     Page load, bind tree and enable controls
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [tamttt] 20/10/2004	Created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            DNNtree.NodeClick += DNNTree_NodeClick;
            cmdAddList.Click  += cmdAddList_Click;

            try
            {
                if (!Page.IsPostBack)
                {
                    //configure tree
                    DNNtree.ImageList.Add(IconController.IconURL("Folder"));
                    DNNtree.ImageList.Add(IconController.IconURL("File"));
                    DNNtree.IndentWidth        = 10;
                    DNNtree.CollapsedNodeImage = IconController.IconURL("Max", "12X12");
                    DNNtree.ExpandedNodeImage  = IconController.IconURL("Min", "12X12");

                    if (Request.QueryString["Key"] != null)
                    {
                        Mode = "ListEntries";
                        BindList(Request.QueryString["Key"]);
                    }
                    else
                    {
                        Mode = "NoList";
                    }
                    BindTree();
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Пример #4
0
        private void InitializeTreeViewContextMenu()
        {
            MainContextMenu.Items.AddRange(new[]
            {
                new DnnMenuItem
                {
                    Text     = Localization.GetString("CreateFolder", LocalResourceFile),
                    Value    = "NewFolder",
                    CssClass = "permission_ADD disabledIfFiltered",
                    ImageUrl = IconController.IconURL("FolderCreate", "16x16", "Gray")
                },
                new DnnMenuItem
                {
                    Text     = Localization.GetString("RefreshFolder", LocalResourceFile),
                    Value    = "RefreshFolder",
                    CssClass = "permission_READ permission_BROWSE",
                    ImageUrl = IconController.IconURL("FolderRefreshSync", "16x16", "Gray")
                },
                new DnnMenuItem
                {
                    Text     = Localization.GetString("RenameFolder", LocalResourceFile),
                    Value    = "RenameFolder",
                    CssClass = "permission_MANAGE",
                    ImageUrl = IconController.IconURL("FileRename", "16x16", "Black")
                },
                new DnnMenuItem
                {
                    Text     = Localization.GetString("Move", LocalResourceFile),
                    Value    = "Move",
                    CssClass = "permission_COPY",
                    ImageUrl = IconController.IconURL("FileMove", "16x16", "Black")
                },
                new DnnMenuItem
                {
                    Text     = Localization.GetString("DeleteFolder", LocalResourceFile),
                    Value    = "DeleteFolder",
                    CssClass = "permission_DELETE",
                    ImageUrl = IconController.IconURL("FileDelete", "16x16", "Black")
                },
                new DnnMenuItem
                {
                    Text     = Localization.GetString("ViewFolderProperties", LocalResourceFile),
                    Value    = "Properties",
                    CssClass = "permission_READ permission_BROWSE",
                    ImageUrl = IconController.IconURL("ViewProperties", "16x16", "CtxtMn")
                },
            });

            // Dnn Menu Item Extension Point
            foreach (var menuItem in epm.GetMenuItemExtensionPoints("DigitalAssets", "TreeViewContextMenu", Filter))
            {
                MainContextMenu.Items.Add(new DnnMenuItem
                {
                    Text     = menuItem.Text,
                    Value    = menuItem.Value,
                    CssClass = menuItem.CssClass,
                    ImageUrl = menuItem.Icon
                });
            }
        }
Пример #5
0
 private void InitializeEmptySpaceContextMenu()
 {
     EmptySpaceMenu.Items.AddRange(new[]
     {
         new DnnMenuItem
         {
             Text     = Localization.GetString("CreateFolder", LocalResourceFile),
             Value    = "NewFolder",
             CssClass = "permission_ADD",
             ImageUrl = IconController.IconURL("FolderCreate", "16x16", "Gray")
         },
         new DnnMenuItem
         {
             Text     = Localization.GetString("RefreshFolder", LocalResourceFile),
             Value    = "RefreshFolder",
             CssClass = "permission_READ permission_BROWSE",
             ImageUrl = IconController.IconURL("FolderRefreshSync", "16x16", "Gray")
         },
         new DnnMenuItem
         {
             Text     = Localization.GetString("UploadFiles.Title", LocalResourceFile),
             Value    = "UploadFiles",
             CssClass = "permission_ADD",
             ImageUrl = IconController.IconURL("UploadFiles", "16x16", "Gray")
         },
         new DnnMenuItem
         {
             Text     = Localization.GetString("ViewFolderProperties", LocalResourceFile),
             Value    = "Properties",
             CssClass = "permission_READ permission_BROWSE",
             ImageUrl = IconController.IconURL("ViewProperties", "16x16", "CtxtMn")
         },
     });
 }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Runs just before the control is rendered
        /// </summary>
        /// -----------------------------------------------------------------------------
        protected override void OnPreRender(EventArgs e)
        {
            if (_itemChanged)
            {
                //Rebind the control to the DataSource to make sure that the dependent
                //editors are updated
                DataBind();
            }
            if (String.IsNullOrEmpty(CssClass))
            {
                CssClass = "dnnForm";
            }

            //Find the Min/Max buttons
            if (GroupByMode == GroupByMode.Section && (_sections != null))
            {
                foreach (DictionaryEntry key in _sections)
                {
                    var tbl  = (Table)key.Value;
                    var icon = (Image)key.Key;
                    DNNClientAPI.EnableMinMax(icon, tbl, false, IconController.IconURL("Minus", "12X15"), IconController.IconURL("Plus", "12X15"), DNNClientAPI.MinMaxPersistanceType.Page);
                }
            }
            base.OnPreRender(e);
        }
Пример #7
0
        private static string GetFileIconUrl(string extension)
        {
            if (!string.IsNullOrEmpty(extension) && File.Exists(HttpContext.Current.Server.MapPath(IconController.IconURL("Ext" + extension, "32x32", "Standard"))))
            {
                return(IconController.IconURL("Ext" + extension, "32x32", "Standard"));
            }

            return(IconController.IconURL("ExtFile", "32x32", "Standard"));
        }
Пример #8
0
        protected string GetFolderIconUrl(int portalId, int folderMappingID)
        {
            var imageUrl = FolderMappingController.Instance.GetFolderMapping(portalId, folderMappingID).ImageUrl;

            if (File.Exists(HttpContext.Current.Server.MapPath(imageUrl)))
            {
                return(imageUrl);
            }

            return(IconController.IconURL("ExtClosedFolder", "32x32", "Standard"));
        }
        private static void LookupScriptValues(Control ctl, out string grantImagePath, out string denyImagePath, out string nullImagePath, out string lockImagePath, out string grantAltText, out string denyAltText, out string nullAltText)
        {
            grantImagePath = IconController.IconURL("Grant");
            denyImagePath  = IconController.IconURL("Deny");
            nullImagePath  = IconController.IconURL("Unchecked");
            lockImagePath  = IconController.IconURL("Lock");

            grantAltText = Localization.GetString("PermissionTypeGrant");
            denyAltText  = Localization.GetString("PermissionTypeDeny");
            nullAltText  = Localization.GetString("PermissionTypeNull");
        }
Пример #10
0
 public static string IconURL(string iconKey)
 {
     return(IconController.IconURL(iconKey));
     //switch (iconKey.ToLowerInvariant()  )
     //{
     //    case "wizard":
     //        iconKey = "icon_wizard_16px";
     //        break;
     //}
     //return String.Format("~/images/{0}.gif", iconKey);
 }
Пример #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsEditable)
     {
         string pencil = string.Format("<a href=\"{0}\" title=\"{1}\"><img src=\"{2}\" style=\"border: 0px none;\"></a>",
                                       EditUrl,
                                       Localization.GetString("cmdEdit.Text"),
                                       IconController.IconURL("Edit"));
         Label = String.Format("{0}&nbsp;{1}", pencil, Label);
     }
 }
Пример #12
0
        private void BindTree()
        {
            var ctlLists    = new ListController();
            var colLists    = ctlLists.GetListInfoCollection(string.Empty, string.Empty, PortalSettings.ActiveTab.PortalID);
            var indexLookup = new Hashtable();

            listTree.Nodes.Clear();

            foreach (ListInfo list in colLists)
            {
                String filteredNode;
                if (list.DisplayName.Contains(":"))
                {
                    var finalPeriod = list.DisplayName.LastIndexOf(".", StringComparison.InvariantCulture);
                    filteredNode = list.DisplayName.Substring(finalPeriod + 1);
                }
                else
                {
                    filteredNode = list.DisplayName;
                }
                var node = new DnnTreeNode {
                    Text = filteredNode
                };
                {
                    node.Value    = list.Key;
                    node.ToolTip  = String.Format(LocalizeString("NoEntries"), list.EntryCount);
                    node.ImageUrl = IconController.IconURL("Folder");
                }
                if (list.Level == 0)
                {
                    listTree.Nodes.Add(node);
                }
                else
                {
                    if (indexLookup[list.ParentList] != null)
                    {
                        var parentNode = (DnnTreeNode)indexLookup[list.ParentList];

                        parentNode.Nodes.Add(node);
                    }
                }

                //Add index key here to find it later, should suggest with Joe to add it to DNNTree
                if (indexLookup[list.Key] == null)
                {
                    indexLookup.Add(list.Key, node);
                }
            }
        }
Пример #13
0
        // ReSharper restore LoopCanBeConvertedToQuery

        private string GetThumbUrl(IFileInfo file)
        {
            if (IsImageFile(file.RelativePath))
            {
                return(FileManager.Instance.GetUrl(file));
            }

            var fileIcon = IconController.IconURL("Ext" + file.Extension, "32x32");

            if (!System.IO.File.Exists(Request.GetHttpContext().Server.MapPath(fileIcon)))
            {
                fileIcon = IconController.IconURL("File", "32x32");
            }
            return(fileIcon);
        }
Пример #14
0
 private void InitializeTreeViewContextMenu()
 {
     MainContextMenu.Items.AddRange(new[]
     {
         new DnnMenuItem
         {
             Text     = Localization.GetString("CreateFolder", LocalResourceFile),
             Value    = "NewFolder",
             CssClass = "permission_ADD",
             ImageUrl = IconController.IconURL("FolderCreate", "16x16", "Gray")
         },
         new DnnMenuItem
         {
             Text     = Localization.GetString("RefreshFolder", LocalResourceFile),
             Value    = "RefreshFolder",
             CssClass = "permission_READ permission_BROWSE",
             ImageUrl = IconController.IconURL("FolderRefreshSync", "16x16", "Gray")
         },
         new DnnMenuItem
         {
             Text     = Localization.GetString("RenameFolder", LocalResourceFile),
             Value    = "RenameFolder",
             CssClass = "permission_MANAGE",
             ImageUrl = IconController.IconURL("FileRename", "16x16", "Black")
         },
         new DnnMenuItem
         {
             Text     = Localization.GetString("Move", LocalResourceFile),
             Value    = "Move",
             CssClass = "permission_COPY",
             ImageUrl = IconController.IconURL("FileMove", "16x16", "Black")
         },
         new DnnMenuItem
         {
             Text     = Localization.GetString("DeleteFolder", LocalResourceFile),
             Value    = "DeleteFolder",
             CssClass = "permission_DELETE",
             ImageUrl = IconController.IconURL("FileDelete", "16x16", "Black")
         },
         new DnnMenuItem
         {
             Text     = Localization.GetString("ViewFolderProperties", LocalResourceFile),
             Value    = "Properties",
             CssClass = "permission_READ permission_BROWSE",
             ImageUrl = IconController.IconURL("ViewProperties", "16x16", "CtxtMn")
         },
     });
 }
Пример #15
0
        protected void grdSortColumns_ItemCreated(object sender, DataGridItemEventArgs e)
        {
            switch (e.Item.ItemType)
            {
            case ListItemType.AlternatingItem:
            case ListItemType.Item:
            case ListItemType.SelectedItem:

                // Localize the delete button and set image
                var deleteButton = (ImageButton)e.Item.FindControl("buttonDeleteSortOrder");
                deleteButton.ToolTip  = deleteButton.AlternateText = LocalizeString("buttonDeleteSortOrder.Text");
                deleteButton.ImageUrl = IconController.IconURL("Delete");

                break;
            }
        }
Пример #16
0
        /// <summary>
        /// Render renders the control
        /// </summary>
        /// <param name="writer">A HtmlTextWriter.</param>
        /// <history>
        ///     [cnurse]	05/03/2006	created
        /// </history>
        protected override void Render(HtmlTextWriter writer)
        {
            //Render Div container
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "dnnFormVisibility");
            writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID);
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            //Render anchor for Image
            writer.RenderBeginTag(HtmlTextWriterTag.A);

            writer.AddAttribute(HtmlTextWriterAttribute.Src, IconController.IconURL("Lock"));
            writer.RenderBeginTag(HtmlTextWriterTag.Img);

            //Close Image Tag
            writer.RenderEndTag();

            //Close Anchor
            writer.RenderEndTag();

            //Render UL for radio Button List
            writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
            writer.RenderBeginTag(HtmlTextWriterTag.Ul);

            RenderVisibility(writer, "0", UserVisibilityMode.AllUsers, Localization.GetString("Public").Trim());

            RenderVisibility(writer, "1", UserVisibilityMode.MembersOnly, Localization.GetString("MembersOnly").Trim());

            RenderVisibility(writer, "2", UserVisibilityMode.AdminOnly, Localization.GetString("AdminOnly").Trim());

            RenderVisibility(writer, "3", UserVisibilityMode.FriendsAndGroups, Localization.GetString("FriendsGroups").Trim());

            //Render UL for checjk Box List
            writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
            writer.RenderBeginTag(HtmlTextWriterTag.Ul);

            RenderRelationships(writer);
            RenderGroups(writer);

            //Close UL
            writer.RenderEndTag();

            //Close UL
            writer.RenderEndTag();

            //Close Div
            writer.RenderEndTag();
        }
Пример #17
0
        private void BindTree()
        {
            var ctlLists    = new ListController();
            var colLists    = ctlLists.GetListInfoCollection(string.Empty, string.Empty, PortalSettings.ActiveTab.PortalID);
            var indexLookup = new Hashtable();

            listTree.Nodes.Clear();

            foreach (ListInfo list in colLists)
            {
                var node = new DnnTreeNode {
                    Text = list.DisplayName.Replace(list.ParentList + ".", "")
                };
                {
                    node.Value    = list.Key;
                    node.ToolTip  = String.Format(LocalizeString("NoEntries"), list.EntryCount);
                    node.ImageUrl = IconController.IconURL("Folder");
                }
                if (list.Level == 0)
                {
                    listTree.Nodes.Add(node);
                }
                else
                {
                    if (indexLookup[list.ParentList] != null)
                    {
                        var parentNode = (DnnTreeNode)indexLookup[list.ParentList];
                        parentNode.Nodes.Add(node);
                    }
                }

                //Add index key here to find it later, should suggest with Joe to add it to DNNTree
                if (indexLookup[list.Key] == null)
                {
                    indexLookup.Add(list.Key, node);
                }
            }
        }
Пример #18
0
        /// <summary>
        /// <para>ProcessControl peforms the high level localization for a single control and optionally it's children.</para>
        /// </summary>
        /// <param name="control">Control to find the AttributeCollection on</param>
        /// <param name="affectedControls">ArrayList that hold the controls that have been localized. This is later used for the removal of the key attribute.</param>
        /// <param name="includeChildren">If true, causes this method to process children of this controls.</param>
        /// <param name="resourceFileRoot">Root Resource File.</param>
        internal void ProcessControl(Control control, ArrayList affectedControls, bool includeChildren, string resourceFileRoot)
        {
            if (!control.Visible)
            {
                return;
            }

            //Perform the substitution if a key was found
            string key = GetControlAttribute(control, affectedControls, Localization.KeyName);

            if (!string.IsNullOrEmpty(key))
            {
                //Translation starts here ....
                string value = Localization.GetString(key, resourceFileRoot);
                if (control is Label)
                {
                    var label = (Label)control;
                    if (!String.IsNullOrEmpty(value))
                    {
                        label.Text = value;
                    }
                }
                if (control is LinkButton)
                {
                    var linkButton = (LinkButton)control;
                    if (!String.IsNullOrEmpty(value))
                    {
                        MatchCollection imgMatches = Regex.Matches(value, "<(a|link|img|script|input|form).[^>]*(href|src|action)=(\\\"|'|)(.[^\\\"']*)(\\\"|'|)[^>]*>", RegexOptions.IgnoreCase);
                        foreach (Match match in imgMatches)
                        {
                            if ((match.Groups[match.Groups.Count - 2].Value.IndexOf("~", StringComparison.Ordinal) != -1))
                            {
                                string resolvedUrl = Page.ResolveUrl(match.Groups[match.Groups.Count - 2].Value);
                                value = value.Replace(match.Groups[match.Groups.Count - 2].Value, resolvedUrl);
                            }
                        }
                        linkButton.Text = value;
                        if (string.IsNullOrEmpty(linkButton.ToolTip))
                        {
                            linkButton.ToolTip = value;
                        }
                    }
                }
                if (control is HyperLink)
                {
                    var hyperLink = (HyperLink)control;
                    if (!String.IsNullOrEmpty(value))
                    {
                        hyperLink.Text = value;
                    }
                }
                if (control is ImageButton)
                {
                    var imageButton = (ImageButton)control;
                    if (!String.IsNullOrEmpty(value))
                    {
                        imageButton.AlternateText = value;
                    }
                }
                if (control is Button)
                {
                    var button = (Button)control;
                    if (!String.IsNullOrEmpty(value))
                    {
                        button.Text = value;
                    }
                }
                if (control is HtmlButton)
                {
                    var button = (HtmlButton)control;
                    if (!String.IsNullOrEmpty(value))
                    {
                        button.Attributes["Title"] = value;
                    }
                }
                if (control is HtmlImage)
                {
                    var htmlImage = (HtmlImage)control;
                    if (!String.IsNullOrEmpty(value))
                    {
                        htmlImage.Alt = value;
                    }
                }
                if (control is CheckBox)
                {
                    var checkBox = (CheckBox)control;
                    if (!String.IsNullOrEmpty(value))
                    {
                        checkBox.Text = value;
                    }
                }
                if (control is BaseValidator)
                {
                    var baseValidator = (BaseValidator)control;
                    if (!String.IsNullOrEmpty(value))
                    {
                        baseValidator.ErrorMessage = value;
                    }
                }
                if (control is Image)
                {
                    var image = (Image)control;
                    if (!String.IsNullOrEmpty(value))
                    {
                        image.AlternateText = value;
                        image.ToolTip       = value;
                    }
                }
            }

            //Translate listcontrol items here
            if (control is ListControl)
            {
                var listControl = (ListControl)control;
                for (int i = 0; i <= listControl.Items.Count - 1; i++)
                {
                    AttributeCollection attributeCollection = listControl.Items[i].Attributes;
                    key = attributeCollection[Localization.KeyName];
                    if (key != null)
                    {
                        string value = Localization.GetString(key, resourceFileRoot);
                        if (!String.IsNullOrEmpty(value))
                        {
                            listControl.Items[i].Text = value;
                        }
                    }
                    if (key != null && affectedControls != null)
                    {
                        affectedControls.Add(attributeCollection);
                    }
                }
            }


            //UrlRewriting Issue - ResolveClientUrl gets called instead of ResolveUrl
            //Manual Override to ResolveUrl
            if (control is Image)
            {
                var image = (Image)control;
                if (image.ImageUrl.IndexOf("~", StringComparison.Ordinal) != -1)
                {
                    image.ImageUrl = Page.ResolveUrl(image.ImageUrl);
                }

                //Check for IconKey
                if (string.IsNullOrEmpty(image.ImageUrl))
                {
                    string iconKey   = GetControlAttribute(control, affectedControls, IconController.IconKeyName);
                    string iconSize  = GetControlAttribute(control, affectedControls, IconController.IconSizeName);
                    string iconStyle = GetControlAttribute(control, affectedControls, IconController.IconStyleName);
                    image.ImageUrl = IconController.IconURL(iconKey, iconSize, iconStyle);
                }
            }

            //UrlRewriting Issue - ResolveClientUrl gets called instead of ResolveUrl
            //Manual Override to ResolveUrl
            if (control is HtmlImage)
            {
                var htmlImage = (HtmlImage)control;
                if (htmlImage.Src.IndexOf("~", StringComparison.Ordinal) != -1)
                {
                    htmlImage.Src = Page.ResolveUrl(htmlImage.Src);
                }

                //Check for IconKey
                if (string.IsNullOrEmpty(htmlImage.Src))
                {
                    string iconKey   = GetControlAttribute(control, affectedControls, IconController.IconKeyName);
                    string iconSize  = GetControlAttribute(control, affectedControls, IconController.IconSizeName);
                    string iconStyle = GetControlAttribute(control, affectedControls, IconController.IconStyleName);
                    htmlImage.Src = IconController.IconURL(iconKey, iconSize, iconStyle);
                }
            }

            //UrlRewriting Issue - ResolveClientUrl gets called instead of ResolveUrl
            //Manual Override to ResolveUrl
            if (control is HyperLink)
            {
                HyperLink ctrl;
                ctrl = (HyperLink)control;
                if ((ctrl.NavigateUrl.IndexOf("~", StringComparison.Ordinal) != -1))
                {
                    ctrl.NavigateUrl = Page.ResolveUrl(ctrl.NavigateUrl);
                }
                if ((ctrl.ImageUrl.IndexOf("~", StringComparison.Ordinal) != -1))
                {
                    ctrl.ImageUrl = Page.ResolveUrl(ctrl.ImageUrl);
                }

                //Check for IconKey
                if (string.IsNullOrEmpty(ctrl.ImageUrl))
                {
                    string iconKey   = GetControlAttribute(control, affectedControls, IconController.IconKeyName);
                    string iconSize  = GetControlAttribute(control, affectedControls, IconController.IconSizeName);
                    string iconStyle = GetControlAttribute(control, affectedControls, IconController.IconStyleName);
                    ctrl.ImageUrl = IconController.IconURL(iconKey, iconSize, iconStyle);
                }
            }

            //Process child controls
            if (includeChildren && control.HasControls())
            {
                var objModuleControl = control as IModuleControl;
                if (objModuleControl == null)
                {
                    PropertyInfo pi = control.GetType().GetProperty("LocalResourceFile");
                    if (pi != null && pi.GetValue(control, null) != null)
                    {
                        //If controls has a LocalResourceFile property use this
                        IterateControls(control.Controls, affectedControls, pi.GetValue(control, null).ToString());
                    }
                    else
                    {
                        //Pass Resource File Root through
                        IterateControls(control.Controls, affectedControls, resourceFileRoot);
                    }
                }
                else
                {
                    //Get Resource File Root from Controls LocalResourceFile Property
                    IterateControls(control.Controls, affectedControls, objModuleControl.LocalResourceFile);
                }
            }
        }
Пример #19
0
        /// <summary>
        /// <para>ProcessControl peforms the high level localization for a single control and optionally it's children.</para>
        /// </summary>
        /// <param name="control">Control to find the AttributeCollection on</param>
        /// <param name="affectedControls">ArrayList that hold the controls that have been localized. This is later used for the removal of the key attribute.</param>
        /// <param name="includeChildren">If true, causes this method to process children of this controls.</param>
        /// <param name="resourceFileRoot">Root Resource File.</param>
        internal void ProcessControl(Control control, ArrayList affectedControls, bool includeChildren, string resourceFileRoot)
        {
            if (!control.Visible)
            {
                return;
            }

            //Perform the substitution if a key was found
            var key = GetControlAttribute(control, affectedControls, Localization.KeyName);

            if (!string.IsNullOrEmpty(key))
            {
                //Translation starts here ....
                var value = Localization.GetString(key, resourceFileRoot);
                LocalizeControl(control, value);
            }

            //Translate listcontrol items here
            var listControl = control as ListControl;

            if (listControl != null)
            {
                for (var i = 0; i <= listControl.Items.Count - 1; i++)
                {
                    var attributeCollection = listControl.Items[i].Attributes;
                    key = attributeCollection[Localization.KeyName];
                    if (key != null)
                    {
                        var value = Localization.GetString(key, resourceFileRoot);
                        if (!String.IsNullOrEmpty(value))
                        {
                            listControl.Items[i].Text = value;
                        }
                    }
                    if (key != null && affectedControls != null)
                    {
                        affectedControls.Add(attributeCollection);
                    }
                }
            }


            //UrlRewriting Issue - ResolveClientUrl gets called instead of ResolveUrl
            //Manual Override to ResolveUrl
            var image = control as Image;

            if (image != null)
            {
                if (image.ImageUrl.IndexOf("~", StringComparison.Ordinal) != -1)
                {
                    image.ImageUrl = Page.ResolveUrl(image.ImageUrl);
                }

                //Check for IconKey
                if (string.IsNullOrEmpty(image.ImageUrl))
                {
                    var iconKey   = GetControlAttribute(control, affectedControls, IconController.IconKeyName);
                    var iconSize  = GetControlAttribute(control, affectedControls, IconController.IconSizeName);
                    var iconStyle = GetControlAttribute(control, affectedControls, IconController.IconStyleName);
                    image.ImageUrl = IconController.IconURL(iconKey, iconSize, iconStyle);
                }
            }

            //UrlRewriting Issue - ResolveClientUrl gets called instead of ResolveUrl
            //Manual Override to ResolveUrl
            var htmlImage = control as HtmlImage;

            if (htmlImage != null)
            {
                if (htmlImage.Src.IndexOf("~", StringComparison.Ordinal) != -1)
                {
                    htmlImage.Src = Page.ResolveUrl(htmlImage.Src);
                }

                //Check for IconKey
                if (string.IsNullOrEmpty(htmlImage.Src))
                {
                    var iconKey   = GetControlAttribute(control, affectedControls, IconController.IconKeyName);
                    var iconSize  = GetControlAttribute(control, affectedControls, IconController.IconSizeName);
                    var iconStyle = GetControlAttribute(control, affectedControls, IconController.IconStyleName);
                    htmlImage.Src = IconController.IconURL(iconKey, iconSize, iconStyle);
                }
            }

            //UrlRewriting Issue - ResolveClientUrl gets called instead of ResolveUrl
            //Manual Override to ResolveUrl
            var ctrl = control as HyperLink;

            if (ctrl != null)
            {
                if ((ctrl.NavigateUrl.IndexOf("~", StringComparison.Ordinal) != -1))
                {
                    ctrl.NavigateUrl = Page.ResolveUrl(ctrl.NavigateUrl);
                }
                if ((ctrl.ImageUrl.IndexOf("~", StringComparison.Ordinal) != -1))
                {
                    ctrl.ImageUrl = Page.ResolveUrl(ctrl.ImageUrl);
                }

                //Check for IconKey
                if (string.IsNullOrEmpty(ctrl.ImageUrl))
                {
                    var iconKey   = GetControlAttribute(control, affectedControls, IconController.IconKeyName);
                    var iconSize  = GetControlAttribute(control, affectedControls, IconController.IconSizeName);
                    var iconStyle = GetControlAttribute(control, affectedControls, IconController.IconStyleName);
                    ctrl.ImageUrl = IconController.IconURL(iconKey, iconSize, iconStyle);
                }
            }

            //Process child controls
            if (!includeChildren || !control.HasControls())
            {
                return;
            }
            var objModuleControl = control as IModuleControl;

            if (objModuleControl == null)
            {
                //Cache results from reflection calls for performance
                var pi = control.GetType().GetProperty("LocalResourceFile");
                if (pi != null)
                {
                    //Attempt to get property value
                    var pv = pi.GetValue(control, null);

                    //If controls has a LocalResourceFile property use this, otherwise pass the resource file root
                    IterateControls(control.Controls, affectedControls, pv == null ? resourceFileRoot : pv.ToString());
                }
                else
                {
                    //Pass Resource File Root through
                    IterateControls(control.Controls, affectedControls, resourceFileRoot);
                }
            }
            else
            {
                //Get Resource File Root from Controls LocalResourceFile Property
                IterateControls(control.Controls, affectedControls, objModuleControl.LocalResourceFile);
            }
        }
Пример #20
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// RenderEditMode renders the Edit mode of the control.
        /// </summary>
        /// <param name="writer">A HtmlTextWriter.</param>
        /// -----------------------------------------------------------------------------
        protected override void RenderEditMode(HtmlTextWriter writer)
        {
            int length = Null.NullInteger;

            if (this.CustomAttributes != null)
            {
                foreach (Attribute attribute in this.CustomAttributes)
                {
                    if (attribute is MaxLengthAttribute)
                    {
                        var lengthAtt = (MaxLengthAttribute)attribute;
                        length = lengthAtt.Length;
                        break;
                    }
                }
            }

            if (this.DictionaryValue != null)
            {
                foreach (KeyValuePair <int, string> kvp in this.DictionaryValue)
                {
                    // Render Hyperlink
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, this.Page.ClientScript.GetPostBackClientHyperlink(this, "Delete_" + kvp.Key, false));
                    writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "javascript:return confirm('" + ClientAPI.GetSafeJSString(Localization.GetString("DeleteItem")) + "');");
                    writer.AddAttribute(HtmlTextWriterAttribute.Title, Localization.GetString("cmdDelete", this.LocalResourceFile));
                    writer.RenderBeginTag(HtmlTextWriterTag.A);

                    // Render Image
                    writer.AddAttribute(HtmlTextWriterAttribute.Src, IconController.IconURL("Delete"));
                    writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                    writer.RenderBeginTag(HtmlTextWriterTag.Img);

                    // Render end of Image
                    writer.RenderEndTag();

                    // Render end of Hyperlink
                    writer.RenderEndTag();

                    this.ControlStyle.AddAttributesToRender(writer);
                    writer.AddAttribute(HtmlTextWriterAttribute.Type, "text");
                    writer.AddAttribute(HtmlTextWriterAttribute.Value, kvp.Value);
                    if (length > Null.NullInteger)
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Maxlength, length.ToString());
                    }

                    writer.AddAttribute(HtmlTextWriterAttribute.Name, this.UniqueID + "_skin" + kvp.Key);
                    writer.RenderBeginTag(HtmlTextWriterTag.Input);
                    writer.RenderEndTag();

                    writer.WriteBreak();
                }

                writer.WriteBreak();

                // Create Add Row
                // Render Hyperlink
                writer.AddAttribute(HtmlTextWriterAttribute.Href, this.Page.ClientScript.GetPostBackClientHyperlink(this, "Add", false));
                writer.AddAttribute(HtmlTextWriterAttribute.Title, Localization.GetString("cmdAdd", this.LocalResourceFile));
                writer.RenderBeginTag(HtmlTextWriterTag.A);

                // Render Image
                writer.AddAttribute(HtmlTextWriterAttribute.Src, IconController.IconURL("Add"));
                writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                writer.RenderBeginTag(HtmlTextWriterTag.Img);

                // Render end of Image
                writer.RenderEndTag();

                // Render end of Hyperlink
                writer.RenderEndTag();

                this.ControlStyle.AddAttributesToRender(writer);
                writer.AddAttribute(HtmlTextWriterAttribute.Type, "text");
                writer.AddAttribute(HtmlTextWriterAttribute.Value, Null.NullString);
                if (length > Null.NullInteger)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Maxlength, length.ToString());
                }

                writer.AddAttribute(HtmlTextWriterAttribute.Name, this.UniqueID + "_skinnew");
                writer.RenderBeginTag(HtmlTextWriterTag.Input);
                writer.RenderEndTag();
                writer.WriteBreak();
            }
        }
Пример #21
0
        public static string GetRichValue(ProfilePropertyDefinition property, string formatString, CultureInfo formatProvider)
        {
            string result = string.Empty;

            if (!string.IsNullOrEmpty(property.PropertyValue) || DisplayDataType(property).Equals("image", StringComparison.InvariantCultureIgnoreCase))
            {
                switch (DisplayDataType(property).ToLowerInvariant())
                {
                case "truefalse":
                    result = PropertyAccess.Boolean2LocalizedYesNo(Convert.ToBoolean(property.PropertyValue), formatProvider);
                    break;

                case "date":
                case "datetime":
                    if (formatString == string.Empty)
                    {
                        formatString = "g";
                    }

                    result = DateTime.Parse(property.PropertyValue, CultureInfo.InvariantCulture).ToString(formatString, formatProvider);
                    break;

                case "integer":
                    if (formatString == string.Empty)
                    {
                        formatString = "g";
                    }

                    result = int.Parse(property.PropertyValue).ToString(formatString, formatProvider);
                    break;

                case "page":
                    int tabid;
                    if (int.TryParse(property.PropertyValue, out tabid))
                    {
                        TabInfo tab = TabController.Instance.GetTab(tabid, Null.NullInteger, false);
                        if (tab != null)
                        {
                            result = string.Format("<a href='{0}'>{1}</a>", TestableGlobals.Instance.NavigateURL(tabid), tab.LocalizedTabName);
                        }
                    }

                    break;

                case "image":
                    // File is stored as a FileID
                    int fileID;
                    if (int.TryParse(property.PropertyValue, out fileID) && fileID > 0)
                    {
                        result = Globals.LinkClick(string.Format("fileid={0}", fileID), Null.NullInteger, Null.NullInteger);
                    }
                    else
                    {
                        result = IconController.IconURL("Spacer", "1X1");
                    }

                    break;

                case "richtext":
                    var objSecurity = PortalSecurity.Instance;
                    result = PropertyAccess.FormatString(objSecurity.InputFilter(HttpUtility.HtmlDecode(property.PropertyValue), PortalSecurity.FilterFlag.NoScripting), formatString);
                    break;

                default:
                    result = HttpUtility.HtmlEncode(PropertyAccess.FormatString(property.PropertyValue, formatString));
                    break;
                }
            }

            return(result);
        }
        // Upload entire file
        private void UploadWholeFile(HttpContextBase context, ICollection <FilesStatus> statuses)
        {
            for (var i = 0; i < context.Request.Files.Count; i++)
            {
                var file = context.Request.Files[i];
                if (file == null)
                {
                    continue;
                }

                var fileName = CleanUpFileName(Path.GetFileName(file.FileName));


                if (IsAllowedExtension(fileName))
                {
                    string uploadfolder = "OpenContent/Files/" + ActiveModule.ModuleID;

                    if (!string.IsNullOrEmpty(context.Request.Form["uploadfolder"]))
                    {
                        uploadfolder = context.Request.Form["uploadfolder"];
                    }
                    var userFolder = _folderManager.GetFolder(PortalSettings.PortalId, uploadfolder);
                    if (userFolder == null)
                    {
                        userFolder = _folderManager.AddFolder(PortalSettings.PortalId, uploadfolder);
                    }
                    int    suffix       = 0;
                    string baseFileName = Path.GetFileNameWithoutExtension(fileName);
                    string extension    = Path.GetExtension(fileName);
                    var    fileInfo     = _fileManager.GetFile(userFolder, fileName);
                    while (fileInfo != null)
                    {
                        suffix++;
                        fileName = baseFileName + "-" + suffix + extension;
                        fileInfo = _fileManager.GetFile(userFolder, fileName);
                    }
                    fileInfo = _fileManager.AddFile(userFolder, fileName, file.InputStream, true);
                    var fileIcon = IconController.IconURL("Ext" + fileInfo.Extension, "32x32");
                    if (!File.Exists(context.Server.MapPath(fileIcon)))
                    {
                        fileIcon = IconController.IconURL("File", "32x32");
                    }
                    statuses.Add(new FilesStatus
                    {
                        success       = true,
                        name          = fileName,
                        extension     = fileInfo.Extension,
                        type          = fileInfo.ContentType,
                        size          = file.ContentLength,
                        progress      = "1.0",
                        url           = fileInfo.ToUrl().RemoveCachebuster(),
                        thumbnail_url = fileIcon,
                        message       = "success",
                        id            = fileInfo.FileId,
                    });
                }
                else
                {
                    statuses.Add(new FilesStatus
                    {
                        success = false,
                        name    = fileName,
                        message = "File type not allowed."
                    });
                }
            }
        }
Пример #23
0
 /// <summary>
 /// Handles the NodeDataBound event of the treeCategories control (adds Tooltip)
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">instance containing the event data.</param>
 protected void treeCategories_NodeDataBound(object sender, RadTreeNodeEventArgs e)
 {
     e.Node.ToolTip  = (string)DataBinder.Eval(e.Node.DataItem, "FaqCategoryDescription");
     e.Node.Value    = DataBinder.Eval(e.Node.DataItem, "FaqCategoryId").ToString();
     e.Node.ImageUrl = IconController.IconURL("folder");
 }
Пример #24
0
 private static string GetFolderIconUrl()
 {
     return(IconController.IconURL("FolderStandard", "32x32", "Standard"));
 }
Пример #25
0
 public string IconURL(string key, string size)
 {
     return(IconController.IconURL(key, size));
 }
Пример #26
0
 public string IconURL(string key)
 {
     return(IconController.IconURL(key));
 }
Пример #27
0
        private void Page_Load(object sender, EventArgs e)
        {
            try
            {
                btnMonth.Visible = false;
                if (Settings.MonthAllowed && Parent.ID.ToLower() != "eventmonth")
                {
                    btnMonth.Visible       = true;
                    btnMonth.AlternateText = Localization.GetString("MenuMonth", LocalResourceFile);
                    btnMonth.ToolTip       = Localization.GetString("MenuMonth", LocalResourceFile);
                }
                btnWeek.Visible = false;
                if (Settings.WeekAllowed && Parent.ID.ToLower() != "eventweek")
                {
                    btnWeek.Visible       = true;
                    btnWeek.AlternateText = Localization.GetString("MenuWeek", LocalResourceFile);
                    btnWeek.ToolTip       = Localization.GetString("MenuWeek", LocalResourceFile);
                }
                btnList.Visible = false;
                if (Settings.ListAllowed && Parent.ID.ToLower() != "eventlist" &&
                    Parent.ID.ToLower() != "eventrpt")
                {
                    btnList.Visible       = true;
                    btnList.AlternateText = Localization.GetString("MenuList", LocalResourceFile);
                    btnList.ToolTip       = Localization.GetString("MenuList", LocalResourceFile);
                }
                btnEnroll.Visible = false;
                if (Settings.Eventsignup && Parent.ID.ToLower() != "eventmyenrollments")
                {
                    btnEnroll.Visible       = true;
                    btnEnroll.AlternateText = Localization.GetString("MenuMyEnrollments", LocalResourceFile);
                    btnEnroll.ToolTip       = Localization.GetString("MenuMyEnrollments", LocalResourceFile);
                }

                var socialGroupId = GetUrlGroupId();
                var groupStr      = "";
                if (socialGroupId > 0)
                {
                    groupStr = "&GroupId=" + socialGroupId;
                }
                var socialUserId = GetUrlUserId();

                hypiCal.Visible     = Settings.IcalOnIconBar;
                hypiCal.ToolTip     = Localization.GetString("MenuiCal", LocalResourceFile);
                hypiCal.NavigateUrl = "~/DesktopModules/Events/EventVCal.aspx?ItemID=0&Mid=" +
                                      Convert.ToString(ModuleId) + "&tabid=" + Convert.ToString(TabId) +
                                      groupStr;

                btnRSS.Visible     = Settings.RSSEnable;
                btnRSS.ToolTip     = Localization.GetString("MenuRSS", LocalResourceFile);
                btnRSS.NavigateUrl = "~/DesktopModules/Events/EventRSS.aspx?mid=" +
                                     Convert.ToString(ModuleId) + "&tabid=" + Convert.ToString(TabId) +
                                     groupStr;
                btnRSS.Target = "_blank";

                btnAdd.Visible        = false;
                btnModerate.Visible   = false;
                btnSettings.Visible   = false;
                btnCategories.Visible = false;
                btnLocations.Visible  = false;
                btnSubscribe.Visible  = false;
                lblSubscribe.Visible  = false;
                imgBar.Visible        = false;

                if (Request.IsAuthenticated)
                {
                    var objEventInfoHelper =
                        new EventInfoHelper(ModuleId, TabId, PortalId, Settings);

                    //Module Editor.
                    if (IsModuleEditor())
                    {
                        btnAdd.ToolTip = Localization.GetString("MenuAddEvents", LocalResourceFile);
                        if (socialGroupId > 0)
                        {
                            btnAdd.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(
                                    EditUrl("groupid", socialGroupId.ToString(), "Edit"), "?");
                            btnAdd.Visible = true;
                        }
                        else if (socialUserId > 0)
                        {
                            if (socialUserId == UserId || IsModerator())
                            {
                                btnAdd.NavigateUrl =
                                    objEventInfoHelper.AddSkinContainerControls(
                                        EditUrl("Userid", socialUserId.ToString(), "Edit"), "?");
                                btnAdd.Visible = true;
                            }
                        }
                        else
                        {
                            btnAdd.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(EditUrl("Edit"), "?");
                            btnAdd.Visible = true;
                        }
                    }
                    if (Settings.Moderateall &&
                        (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName) || IsModerator()))
                    {
                        btnModerate.Visible       = true;
                        btnModerate.AlternateText = Localization.GetString("MenuModerate", LocalResourceFile);
                        btnModerate.ToolTip       = Localization.GetString("MenuModerate", LocalResourceFile);
                    }
                    // Settings Editor.
                    if (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName) || IsSettingsEditor())
                    {
                        btnSettings.Visible = true;
                        btnSettings.ToolTip = Localization.GetString("MenuSettings", LocalResourceFile);
                        if (socialGroupId > 0)
                        {
                            btnSettings.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(
                                    EditUrl("groupid", socialGroupId.ToString(), "EventSettings"), "?");
                        }
                        else if (socialUserId > 0)
                        {
                            btnSettings.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(
                                    EditUrl("userid", socialUserId.ToString(), "EventSettings"), "?");
                        }
                        else
                        {
                            btnSettings.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(EditUrl("EventSettings"), "?");
                        }
                    }
                    // Categories Editor.
                    if (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName) || IsCategoryEditor())
                    {
                        btnCategories.Visible = true;
                        btnCategories.ToolTip = Localization.GetString("MenuCategories", LocalResourceFile);
                        if (socialGroupId > 0)
                        {
                            btnCategories.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(
                                    EditUrl("groupid", socialGroupId.ToString(), "Categories"), "?");
                        }
                        else if (socialUserId > 0)
                        {
                            btnCategories.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(
                                    EditUrl("userid", socialUserId.ToString(), "Categories"), "?");
                        }
                        else
                        {
                            btnCategories.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(EditUrl("Categories"), "?");
                        }
                    }
                    // Locations Editor.
                    if (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName) || IsLocationEditor())
                    {
                        btnLocations.Visible = true;
                        btnLocations.ToolTip = Localization.GetString("MenuLocations", LocalResourceFile);
                        if (socialGroupId > 0)
                        {
                            btnLocations.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(
                                    EditUrl("groupid", socialGroupId.ToString(), "Locations"), "?");
                        }
                        else if (socialUserId > 0)
                        {
                            btnLocations.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(
                                    EditUrl("userid", socialUserId.ToString(), "Locations"), "?");
                        }
                        else
                        {
                            btnLocations.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(EditUrl("Locations"), "?");
                        }
                    }

                    if (Settings.Neweventemails == "Subscribe")
                    {
                        btnSubscribe.Visible = true;
                        lblSubscribe.Visible = true;
                        imgBar.Visible       = true;
                        var objEventSubscriptionController = new EventSubscriptionController();
                        var objEventSubscription           =
                            objEventSubscriptionController.EventsSubscriptionGetUser(UserId, ModuleId);
                        if (ReferenceEquals(objEventSubscription, null))
                        {
                            lblSubscribe.Text          = Localization.GetString("lblSubscribe", LocalResourceFile);
                            btnSubscribe.AlternateText =
                                Localization.GetString("MenuSubscribe", LocalResourceFile);
                            btnSubscribe.ToolTip =
                                Localization.GetString("MenuTTSubscribe", LocalResourceFile);
                            btnSubscribe.ImageUrl = IconController.IconURL("Unchecked");
                        }
                        else
                        {
                            lblSubscribe.Text          = Localization.GetString("lblUnsubscribe", LocalResourceFile);
                            btnSubscribe.AlternateText =
                                Localization.GetString("MenuUnsubscribe", LocalResourceFile);
                            btnSubscribe.ToolTip =
                                Localization.GetString("MenuTTUnsubscribe", LocalResourceFile);
                            btnSubscribe.ImageUrl = IconController.IconURL("Checked");
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Пример #28
0
        private void InitializeGridContextMenu()
        {
            GridMenu.Items.AddRange(new[]
            {
                new DnnMenuItem
                {
                    Text     = Localization.GetString("Download", LocalResourceFile),
                    Value    = "Download",
                    CssClass = "permission_READ permission_BROWSE onlyFiles",
                    ImageUrl = IconController.IconURL("FileDownload", "16x16", "Black")
                },
                new DnnMenuItem
                {
                    Text     = Localization.GetString("Rename", LocalResourceFile),
                    Value    = "Rename",
                    CssClass = "permission_MANAGE singleItem",
                    ImageUrl = IconController.IconURL("FileRename", "16x16", "Black")
                },
                new DnnMenuItem
                {
                    Text     = Localization.GetString("Copy", LocalResourceFile),
                    Value    = "Copy",
                    CssClass = "permission_COPY onlyFiles",
                    ImageUrl = IconController.IconURL("FileCopy", "16x16", "Black")
                },
                new DnnMenuItem
                {
                    Text     = Localization.GetString("Move", LocalResourceFile),
                    Value    = "Move",
                    CssClass = "permission_COPY",
                    ImageUrl = IconController.IconURL("FileMove", "16x16", "Black")
                },
                new DnnMenuItem
                {
                    Text     = Localization.GetString("Delete", LocalResourceFile),
                    Value    = "Delete",
                    CssClass = "permission_DELETE",
                    ImageUrl = IconController.IconURL("FileDelete", "16x16", "Black")
                },
                new DnnMenuItem
                {
                    Text     = Localization.GetString("GetUrl", LocalResourceFile),
                    Value    = "GetUrl",
                    CssClass = "permission_READ permission_BROWSE singleItem onlyFiles",
                    ImageUrl = IconController.IconURL("FileLink", "16x16", "Black")
                },
                new DnnMenuItem
                {
                    Text     = Localization.GetString("UnzipFile", LocalResourceFile),
                    Value    = "UnzipFile",
                    CssClass = "permission_READ permission_BROWSE singleItem onlyFiles",
                    ImageUrl = IconController.IconURL("Unzip", "16x16", "Gray")
                },
                new DnnMenuItem
                {
                    Text     = Localization.GetString("ViewProperties", LocalResourceFile),
                    Value    = "Properties",
                    CssClass = "permission_READ permission_BROWSE singleItem",
                    ImageUrl = IconController.IconURL("ViewProperties", "16x16", "CtxtMn")
                },
            });

            // Dnn Menu Item Extension Point
            foreach (var menuItem in epm.GetMenuItemExtensionPoints("DigitalAssets", "GridContextMenu"))
            {
                GridMenu.Items.Add(new DnnMenuItem
                {
                    Text     = menuItem.Text,
                    Value    = menuItem.Value,
                    CssClass = menuItem.CssClass,
                    ImageUrl = menuItem.Icon
                });
            }
        }