Esempio n. 1
0
 /// <summary>
 /// Override the render method to add the recycle bin to the end of this tree
 /// </summary>
 /// <param name="Tree"></param>
 public override void Render(ref XmlTree tree)
 {
     base.Render(ref tree);
     XmlTreeNode recycleBin = CreateRecycleBin();
     if (recycleBin != null)
         tree.Add(recycleBin);
 }
        public override void Render(ref XmlTree tree)
        {
            // Create tree node to allow sending a newsletter

            var sendNewsletter = XmlTreeNode.Create(this);

            sendNewsletter.Text = "Send Newsletter";

            sendNewsletter.Icon = "docPic.gif";

            sendNewsletter.Action = "javascript:openSendNewsletter()";

            // Add the node to the tree

            tree.Add(sendNewsletter);


            // Create tree node to allow viewing previously sent newsletters
            var previousNewsletters = XmlTreeNode.Create(this);

            previousNewsletters.Text = "Previous Newsletters";

            previousNewsletters.Icon = "docPic.gif";

            previousNewsletters.Action = "javascript:openPreviousNewsletters()";

            // Add the node to the tree
            tree.Add(previousNewsletters);

        }
Esempio n. 3
0
        /// <summary>
        /// Renders the specified tree item.
        /// </summary>
        /// <param name="Tree">The tree.</param>
        public override void Render(ref XmlTree Tree)
        {
            //get documents to render
            Document[] docs = Document.GetChildrenForTree(m_id);

            var args = new TreeEventArgs(Tree);

            OnBeforeTreeRender(docs, args);

            foreach (Document dd in docs)
            {
                List <IAction> allowedUserOptions = GetUserActionsForNode(dd);
                if (CanUserAccessNode(dd, allowedUserOptions))
                {
                    XmlTreeNode node = CreateNode(dd, allowedUserOptions);

                    OnRenderNode(ref node, dd);

                    OnBeforeNodeRender(ref Tree, ref node, EventArgs.Empty);
                    if (node != null)
                    {
                        Tree.Add(node);
                        OnAfterNodeRender(ref Tree, ref node, EventArgs.Empty);
                    }
                }
            }
            //args = new TreeEventArgs(Tree);
            OnAfterTreeRender(docs, args);
        }
Esempio n. 4
0
        private void BaseTree_BeforeNodeRender(ref XmlTree sender, ref XmlTreeNode node, EventArgs e)
        {
            if (node.TreeType.ToLower() == "content")
            {
                try
                {
                    Document document = new Document(Convert.ToInt32(node.NodeID));

                    //this changes the create action b/c of the UI.xml entry
                    if (CreateDocTypes.Contains(document.ContentType.Alias))
                    {
                        node.NodeType = "uNews";
                    }

                    if (RemoveCreateDocTypes.Contains(document.ContentType.Alias))
                    {
                        node.Menu.Remove(ActionNew.Instance);
                    }
                }

                catch (Exception e2)
                {

                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Renders the specified tree item.
        /// </summary>        
        /// <param name="Tree">The tree.</param>
        public override void Render(ref XmlTree Tree)
        {
            //get documents to render
            Document[] docs = Document.GetChildrenForTree(m_id);

            var args = new TreeEventArgs(Tree);
            OnBeforeTreeRender(docs, args);

            foreach (Document dd in docs)
            {
                List<IAction> allowedUserOptions = GetUserActionsForNode(dd);
                if (CanUserAccessNode(dd, allowedUserOptions))
                {

                    XmlTreeNode node = CreateNode(dd, allowedUserOptions);

                    OnRenderNode(ref node, dd);

                    OnBeforeNodeRender(ref Tree, ref node, EventArgs.Empty);
                    if (node != null)
                    {
                        Tree.Add(node);
                        OnAfterNodeRender(ref Tree, ref node, EventArgs.Empty);
                    }
                }
            }
            //args = new TreeEventArgs(Tree);
            OnAfterTreeRender(docs, args);
        }
Esempio n. 6
0
 private void BaseTree_BeforeNodeRender(ref XmlTree sender, ref XmlTreeNode node, EventArgs e)
 {
     if (node.Menu == null || node.NodeType.ToLower() != "content") return;
     node.Menu.Insert(3, new TranslationCreationAction());
     node.Menu.Insert(3, ContextMenuSeperator.Instance);
     node.Menu.Insert(5, ContextMenuSeperator.Instance);
 }
Esempio n. 7
0
        public override void Render(ref XmlTree tree)
        {
            List<DocumentType> docTypes;
            if (base.m_id == -1)
                docTypes = DocumentType.GetAllAsList().FindAll(delegate(DocumentType dt) { return dt.MasterContentType == 0; });
            else
                docTypes = DocumentType.GetAllAsList().FindAll(delegate(DocumentType dt) { return dt.MasterContentType == base.m_id; });

            foreach (DocumentType dt in docTypes)
            {
                XmlTreeNode xNode = XmlTreeNode.Create(this);
                xNode.NodeID = dt.Id.ToString();
                xNode.Text = dt.Text;
                xNode.Action = "javascript:openNodeType(" + dt.Id + ");";
                xNode.Icon = "settingDataType.gif";
                xNode.OpenIcon = "settingDataType.gif";
				xNode.Source = GetTreeServiceUrl(dt.Id);
				xNode.HasChildren = dt.HasChildren;
                if (dt.HasChildren) {                    
                    xNode.Icon = "settingMasterDataType.gif";
                    xNode.OpenIcon = "settingMasterDataType.gif";
                }

                OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
                if (xNode != null)
                {
                    tree.Add(xNode);
                    OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
                }
                
            }
        }
Esempio n. 8
0
        public override void Render(ref XmlTree tree)
        {
            XmlTreeNode xNode;

            xNode = XmlTreeNode.Create(this);
            xNode.Text = "Log";
            xNode.Icon = "doc.gif";
            xNode.NodeType = "uTool";
            xNode.Action = "javascript:openuToolTab('/umbraco/plugins/uTools/log.aspx')";
            tree.Add(xNode);

            xNode = XmlTreeNode.Create(this);
            xNode.Text = "Data Types";
            xNode.Icon = "developerDatatype.gif";
            xNode.NodeType = "uTool";
            xNode.Action = "javascript:openuTool('datatype.aspx')";
            tree.Add(xNode);

            xNode = XmlTreeNode.Create(this);
            xNode.Text = "Document Types";
            xNode.Icon = "settingDatatype.gif";
            xNode.NodeType = "uTool";
            xNode.Action = "javascript:openuTool('doctype.aspx')";
            tree.Add(xNode);

            //xNode = XmlTreeNode.Create(this);
            //xNode.Text = "Content";
            //xNode.Icon = "docPic.gif";
            //xNode.NodeType = "uTool";
            //xNode.Action = "javascript:openuTool('content.aspx')";
            //tree.Add(xNode);

            xNode = XmlTreeNode.Create(this);
            xNode.Text = "Templates";
            xNode.Icon = "settingTemplate.gif";
            xNode.NodeType = "uTool";
            xNode.Action = "javascript:openuTool('template.aspx')";
            tree.Add(xNode);

            xNode = XmlTreeNode.Create(this);
            xNode.Text = "Macros";
            xNode.Icon = "developerMacro.gif";
            xNode.NodeType = "uTool";
            xNode.Action = "javascript:openuTool('macro.aspx')";
            tree.Add(xNode);

            xNode = XmlTreeNode.Create(this);
            xNode.Text = "Content Cache Viewer";
            xNode.Icon = "settingXML.gif";
            xNode.NodeType = "uTool";
            xNode.Action = "javascript:openuTool('cache.aspx')";
            tree.Add(xNode);

            xNode = XmlTreeNode.Create(this);
            xNode.Text = "Media Cache Viewer";
            xNode.Icon = "mediaPhoto.gif";
            xNode.NodeType = "uTool";
            xNode.Action = "javascript:openuTool('mediacache.aspx')";
            tree.Add(xNode);
        }
Esempio n. 9
0
        /// <summary>
        /// Serializes an XmlTree object with the relevant values.
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="serializer"></param>
        /// <returns></returns>
        public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer)
        {
            XmlTree tree = obj as XmlTree;

            Dictionary <string, object> resultSet  = new Dictionary <string, object>();
            Dictionary <string, object> resultTree = new Dictionary <string, object>();

            if (tree != null)
            {
                //add a count property for the count of total nodes
                resultTree.Add("Count", tree.Count);

                List <object> nodes = new List <object>();
                foreach (XmlTreeNode node in tree.treeCollection)
                {
                    nodes.Add(node);
                }

                resultTree.Add("Nodes", nodes);
            }

            resultSet.Add("Tree", resultTree);

            return(resultSet);
        }
        public override void Populate(ref XmlTree tree, int keyId)
        {
            var reader =
                            Application.SqlHelper.ExecuteReader(
                                @"
                            SELECT Res.RaceResultId, D.Name
                            FROM Result Res INNER JOIN DriverContract DC ON Res.DriverContractId = DC.DriverContractId
                            INNER JOIN Driver D ON DC.DriverId = D.DriverId
                            WHERE Res.ResultType=1 AND Res.RaceId = @raceId
                            ORDER BY [Time]",
                                Application.SqlHelper.CreateParameter("@raceId", keyId));

            while (reader.Read())
            {

                var qNode = XmlTreeNode.Create(_baseTree);
                qNode.NodeID = reader.GetInt("RaceResultId").ToString();
                qNode.Text = reader.GetString("Name");
                qNode.Icon = "medal_silver_3.png";
                qNode.NodeType = "qualiResults";
                qNode.Action = "javascript:openQualificationResult(" + reader.GetInt("RaceResultId") + ")";
                qNode.Menu.Clear();
                qNode.Menu.Add(ActionDelete.Instance);

                tree.Add(qNode);

            }
        }
Esempio n. 11
0
        public override void Render(ref XmlTree tree)
        {
            var docTypes = Service.GetContentTypeChildren(base.m_id);

            foreach (var docType in docTypes)
            {
                var hasChildren = Service.HasChildren(docType.Id);

                XmlTreeNode xNode = XmlTreeNode.Create(this);
                xNode.NodeID = docType.Id.ToString(CultureInfo.InvariantCulture);
                xNode.Text = TranslateTreeNames.GetTranslatedName(docType.Name);
                xNode.Action = "javascript:openNodeType(" + docType.Id + ");";
                xNode.Icon = "icon-item-arrangement";
                xNode.OpenIcon = "icon-item-arrangement";
                xNode.Source = GetTreeServiceUrl(docType.Id);
                xNode.HasChildren = hasChildren;
                if (hasChildren)
                {
                    xNode.Icon = "icon-item-arrangement";
                    xNode.OpenIcon = "icon-item-arrangement";
                }

                OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
                if (xNode != null)
                {
                    tree.Add(xNode);
                    OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
                }
            }
        }
 /// <summary>
 /// Raises the <see cref="E:AfterNodeRender"/> event.
 /// </summary>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 protected virtual void OnAfterNodeRender(ref XmlTree sender, ref XmlTreeNode node, EventArgs e)
 {
     if (AfterNodeRender != null)
     {
         AfterNodeRender(ref sender, ref node, e);
     }
 }
Esempio n. 13
0
        public override void Render(ref XmlTree tree)
        {
            Hashtable ht = Cache.ReturnCacheItemsOrdred();

            foreach (string key in ht.Keys)
            {
                //each child will need to load a CacheItem instead of a Cache tree so
                //we'll create a loadCacheItem object in order to get it's serivce url and alias properties
                loadCacheItem loadCacheItemTree = new loadCacheItem(this.app);
				int itemCount = ((ArrayList)ht[key]).Count;
                XmlTreeNode xNode = XmlTreeNode.Create(loadCacheItemTree);
                xNode.NodeID = key;
				xNode.Text = key + " (" + itemCount + ")";
				xNode.Action = string.Empty;
                xNode.Source = loadCacheItemTree.GetTreeServiceUrl(key);
                xNode.Icon = "developerCacheTypes.gif";
                xNode.OpenIcon = "developerCacheTypes.gif";
				xNode.HasChildren = itemCount > 0;

                OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
                if (xNode != null)
                {
                    tree.Add(xNode);
                    OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
                }
                
            }
        }
Esempio n. 14
0
        public override void Render(ref XmlTree tree)
        {
            foreach (Task t in Task.GetTasks(currentUser(), false)) {

                if (t.Type.Alias == "toTranslate") {
                    XmlTreeNode xNode = XmlTreeNode.Create(this);
                    xNode.Menu.Clear();

                    xNode.NodeID = t.Id.ToString();
                    xNode.Text = t.Node.Text;
                    xNode.Action = "javascript:openTranslationTask(" + t.Id.ToString() + ")";
                    xNode.Icon = ".sprTreeSettingLanguage";
                    xNode.OpenIcon = ".sprTreeSettingLanguage";

                    OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
                    if (xNode != null)
                    {
                        tree.Add(xNode);
                        OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
                    }

                }

            }
        }
 void FileSystemTree_AfterNodeRender(ref XmlTree sender, ref XmlTreeNode node, EventArgs e)
 {
     if (node.TreeType == "scripts" && new Core().GetPossibleExtensions(Enums.TranslatorType.Script).Contains(Path.GetExtension(node.NodeID)))
     {
         sender.Remove(node);
     }
 }
Esempio n. 16
0
        /// <summary>
        /// Renders the specified tree item.
        /// </summary>
        /// <param name="Tree">The tree.</param>

        /*public override void Render(ref XmlTree Tree)
         * {
         *  //get documents to render
         *  Document[] docs = Document.GetChildrenForTree(m_id);
         *
         *  var args = new TreeEventArgs(Tree);
         *  OnBeforeTreeRender(docs, args);
         *
         *  foreach (Document dd in docs)
         *  {
         *      List<IAction> allowedUserOptions = GetUserActionsForNode(dd);
         *      if (CanUserAccessNode(dd, allowedUserOptions))
         *      {
         *
         *          XmlTreeNode node = CreateNode(dd, allowedUserOptions);
         *
         *          OnRenderNode(ref node, dd);
         *
         *          OnBeforeNodeRender(ref Tree, ref node, EventArgs.Empty);
         *          if (node != null)
         *          {
         *              Tree.Add(node);
         *              OnAfterNodeRender(ref Tree, ref node, EventArgs.Empty);
         *          }
         *      }
         *  }
         *  OnAfterTreeRender(docs, args);
         * }*/
        public override void Render(ref XmlTree Tree)
        {
            //get documents to render
            var entities = Services.EntityService.GetChildren(m_id, UmbracoObjectTypes.Document).ToArray();

            var args = new TreeEventArgs(Tree);

            OnBeforeTreeRender(entities, args, true);

            foreach (var entity in entities)
            {
                var            e = entity as UmbracoEntity;
                List <IAction> allowedUserOptions = GetUserActionsForNode(e);
                if (CanUserAccessNode(e, allowedUserOptions))
                {
                    XmlTreeNode node = CreateNode(e, allowedUserOptions);

                    OnRenderNode(ref node, new Document(entity, LoadMinimalDocument));

                    OnBeforeNodeRender(ref Tree, ref node, EventArgs.Empty);
                    if (node != null)
                    {
                        Tree.Add(node);
                        OnAfterNodeRender(ref Tree, ref node, EventArgs.Empty);
                    }
                }
            }
            OnAfterTreeRender(entities, args, true);
        }
Esempio n. 17
0
        public override void Render(ref XmlTree tree)
        {
            
            Dictionary.DictionaryItem[] tmp;
            if (this.id == this.StartNodeID)
                tmp = Dictionary.getTopMostItems;
            else
                tmp = new Dictionary.DictionaryItem(this.id).Children;

            foreach (Dictionary.DictionaryItem di in tmp)
            {
                XmlTreeNode xNode = XmlTreeNode.Create(this);
                xNode.NodeID = di.id.ToString(); //dictionary_ + id.. 
                xNode.Text = di.key;
                xNode.Action = string.Format("javascript:openDictionaryItem({0});", di.id);
                xNode.Icon = "settingDataType.gif";
                xNode.OpenIcon = "settingDataType.gif";
                xNode.NodeType = "DictionaryItem"; //this shouldn't be like this, it should be this.TreeAlias but the ui.config file points to this name.
                xNode.Source = this.GetTreeServiceUrl(di.id);
				xNode.HasChildren = di.hasChildren;

                OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
                if (xNode != null)
                {
                    tree.Add(xNode);
                    OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
                }
                
            }
        }
Esempio n. 18
0
        public override void Render(ref XmlTree tree)
        {
            foreach(string role in Roles.GetAllRoles()) {
//            MemberGroup[] MemberGroups = MemberGroup.GetAll;
            
//            for (int i = 0; i < MemberGroups.Length; i++)
//            {
                XmlTreeNode xNode = XmlTreeNode.Create(this);
                xNode.NodeID = role;
                xNode.Text = role;
                xNode.Action = "javascript:openMemberGroup('" + HttpContext.Current.Server.UrlEncode(role.Replace("'", "\\'")) + "');";
                xNode.Icon = "icon-users";
                if (!Member.IsUsingUmbracoRoles())
                {
                    xNode.Menu = null;
                }

                OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
                if (xNode != null)
                {
                    tree.Add(xNode);
                }
                OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
            }
        }
Esempio n. 19
0
 /// <summary>
 /// Raises the <see cref="E:BeforeNodeRender"/> event.
 /// </summary>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 protected virtual void OnBeforeNodeRender(ref XmlTree sender, ref XmlTreeNode node, EventArgs e)
 {
     if (BeforeNodeRender != null)
     {
         BeforeNodeRender(ref sender, ref node, e);
     }
 }
Esempio n. 20
0
        public override void Render(ref XmlTree tree)
        {
            var mediaTypes = Service.GetMediaTypeChildren(base.m_id);

            foreach (var mediaType in mediaTypes)
            {
                var hasChildren = Service.MediaTypeHasChildren(mediaType.Id);

                XmlTreeNode xNode = XmlTreeNode.Create(this);
                xNode.NodeID = mediaType.Id.ToString(CultureInfo.InvariantCulture);
                xNode.Text = mediaType.Name;
                xNode.Action = string.Format("javascript:openMediaType({0});", mediaType.Id);
                xNode.Icon = "settingDataType.gif";
                xNode.OpenIcon = "settingDataType.gif";
                xNode.Source = GetTreeServiceUrl(mediaType.Id);
                xNode.HasChildren = hasChildren;
                if (hasChildren)
                {
                    xNode.Icon = "settingMasterDataType.gif";
                    xNode.OpenIcon = "settingMasterDataType.gif";
                }

                OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
                if (xNode != null)
                {
                    tree.Add(xNode);
                    OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
                }
                
            }
        }
Esempio n. 21
0
        public override void Render(ref XmlTree tree)
        {
            var users = new List<User>(User.getAll());

            User currUser = UmbracoEnsuredPage.CurrentUser;

            bool currUserIsAdmin = currUser.IsAdmin();
            foreach (User u in users.OrderBy(x => x.Disabled))
            {
                if (!UmbracoConfig.For.UmbracoSettings().Security.HideDisabledUsersInBackoffice
                    || (UmbracoConfig.For.UmbracoSettings().Security.HideDisabledUsersInBackoffice && !u.Disabled))
                {

                    XmlTreeNode xNode = XmlTreeNode.Create(this);

                    // special check for ROOT user
                    if (u.Id == 0)
                    {
                        //if its the administrator, don't create a menu
                        xNode.Menu = null;
                        //if the current user is not the administrator, then don't add this node.
                        if (currUser.Id != 0)
                            continue;
                    }
                    // Special check for admins in general (only show admins to admins)
                    else if (!currUserIsAdmin && u.IsAdmin())
                    {
                        continue;
                    }





                    //xNode.IconClass = "umbraco-tree-icon-grey";

                    xNode.NodeID = u.Id.ToString();
                    xNode.Text = u.Name;
                    xNode.Action = "javascript:openUser(" + u.Id + ");";
                    xNode.Icon = "icon-user";
                    xNode.OpenIcon = "icon-user";

                    if (u.Disabled) {
                        xNode.Style.DimNode();
                    }

                    OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
                    if (xNode != null)
                    {
                        tree.Add(xNode);
                        OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
                    }
                

                }
                
                
            }
        }
Esempio n. 22
0
 public override void Render(ref XmlTree tree)
 {
     base.Render(ref tree);
     if (!string.IsNullOrEmpty(NodeKey))
     {
         return;
     }
 }
Esempio n. 23
0
        private void BaseTree_BeforeNodeRender(ref XmlTree sender, ref XmlTreeNode node, EventArgs e)
        {
            //LogHelper.Info<AddTranslationAction>(node.NodeType.ToLower());

            switch (node.NodeType.ToLower())
            {
                case "content":
                    try
                    {
                        var document = ApplicationContext.Current.Services.ContentService.GetById(Convert.ToInt32(node.NodeID));

                        var translationDocType = ApplicationContext.Current.Services.ContentTypeService.GetContentType(document.ContentType.Alias + BabelFishCreateTranslation.PropertySuffix);

                        /*
                        LogHelper.Info<AddTranslationAction>("translationDocType=>" + (translationDocType == null).ToString());
                        LogHelper.Info<AddTranslationAction>("document.ContentType=>" + (document.ContentType == null).ToString());
                        LogHelper.Info<AddTranslationAction>("translationDocType.ParentId=>" + (translationDocType.ParentId).ToString());
                        LogHelper.Info<AddTranslationAction>("document.ContentType.Id=>" + (document.ContentType.Id).ToString());
                        LogHelper.Info<AddTranslationAction>("translationDocType.PropertyTypeExists=>" + translationDocType.PropertyTypeExists(BabelFishCreateTranslation.LanguagePropertyAlias).ToString());
                        */

                        if (
                            translationDocType != null &&
                            document.ContentType != null &&
                            (translationDocType.ParentId == document.ContentType.Id) &&
                            translationDocType.PropertyTypeExists(BabelFishCreateTranslation.LanguagePropertyAlias))
                        {
                            node.Menu.Insert(7, ContextMenuSeperator.Instance);
                            node.Menu.Insert(8, ActionCreateTranslation.Instance);
                        }

                        //remove 'create' for 'BabelFishTranslationFolder'
                        if (document.ContentType.Alias == BabelFishCreateTranslation.BabelFishFolderDocTypeAlias)
                        {
                            node.Menu.Remove(ActionNew.Instance);
                        }

                        //remove 'create' for 'Translation' doctype
                        if (document.ContentType.Alias.EndsWith(BabelFishCreateTranslation.PropertySuffix))
                        {
                            node.Menu.Remove(ActionNew.Instance);

                            try
                            {
                                node.Icon = document.GetValue<string>(BabelFishCreateTranslation.LanguagePropertyAlias) + ".png";
                            }
                            catch {}
                        }
                    }
                    catch (Exception e2)
                    {
                        LogHelper.Error<AddTranslationAction>(e2.Message, e2);
                    }

                    break;
            }
        }
Esempio n. 24
0
 public override void Render(ref XmlTree tree)
 {
     for (var i = 0; i < 10; i++)
     {
         var node = XmlTreeNode.Create(this);
         node.Text = "Node " + i;
         tree.Add(node);
     }
 }
Esempio n. 25
0
        public override void Render(ref XmlTree tree)
        {
            if (this.NodeKey == string.Empty)
            {

                var seasons = _repository.GetAll().OrderBy(s => s.Year);
                foreach (var season in seasons) {
                    var node = XmlTreeNode.Create(this);
                    node.NodeID = season.Id.ToString();
                    node.Text = season.Name;
                    node.Icon = "calendar.png";
                    node.Action = "javascript:openSeasonTemplates(" + season.Id + ")";
                    node.NodeType = "season";

                    TreeService treeService = new TreeService(-1, TreeAlias, ShowContextMenu, IsDialog, DialogMode, app, string.Format("Season-{0}", season.Id));
                    node.Source = season.Races.Count() > 0 ? treeService.GetServiceUrl() : "";

                    node.Menu.Clear();
                    node.Menu.AddRange(new List<IAction> { ActionNew.Instance, ActionDelete.Instance, ContextMenuSeperator.Instance, ActionRefresh.Instance });

                    tree.Add(node);
                }

            } else {

                string keyType = this.NodeKey.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries)[0];
                int keyId = int.Parse(this.NodeKey.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries)[1]);

                switch (keyType) {
                    case "Season":

                        var season = _repository.GetById(keyId);

                        if (season != null) {

                            foreach (var race in season.Races)
                            {
                                var node = XmlTreeNode.Create(this);
                                node.NodeID = race.Id.ToString();
                                node.Text = race.Circuit.Name;
                                node.Icon = "map_go.png";
                                node.NodeType = "seasonRace";
                                node.Action = "javascript:openSeasonRace(" + race.Id + "," + season.Id + ")";

                                node.Menu.Clear();
                                if (race.GetQualificationResults().Count() == 0 && race.GetRaceResults().Count() == 0)
                                    node.Menu.Add(ActionDelete.Instance);

                                tree.Add(node);
                            }
                        }

                        break;
                }
            }
        }
Esempio n. 26
0
    private void BaseContentTreeOnAfterNodeRender(ref XmlTree sender, ref XmlTreeNode node, EventArgs eventArgs)
    {
        if (node.IsProtected.GetValueOrDefault(true) && umbraco.helper.GetCurrentUmbracoUser().UserType.Alias == "trainer")
        {
            //Writers cannot see protected pages
            //sender.
            string nodeType = node.NodeType;

        }
    }
Esempio n. 27
0
        /// <summary>
        /// This will call the normal Render method by passing the converted XmlTree to an XmlDocument.
        /// TODO: need to update this render method to do everything that the obsolete render method does and remove the obsolete method
        /// </summary>
        /// <param name="tree"></param>
        public override void Render(ref XmlTree tree)
        {
            XmlDocument xDoc = new XmlDocument();
            xDoc.LoadXml(tree.ToString(SerializedTreeType.XmlTree));
            Render(ref xDoc);
            tree = SerializableData.Deserialize(xDoc.OuterXml, typeof(XmlTree)) as XmlTree;
			//ensure that the tree type is set! this wouldn't need to be done if BaseTree was implemented properly
			foreach (XmlTreeNode node in tree)
				node.TreeType = this.TreeAlias;
        }
Esempio n. 28
0
        /// 
        /// Override the render method to create the newsletter tree
        /// 
        /// 
        public override void Render(ref XmlTree Tree)
        {
            Tree.treeCollection.Clear();

            var nodeWorkout = XmlTreeNode.Create(this);
            nodeWorkout.NodeID = "Chat" + Guid.NewGuid();
            nodeWorkout.Text = "Chat";
            nodeWorkout.Icon = "b_user.png";
            nodeWorkout.Action = string.Format("javascript:openChat({0});", 1355);
            Tree.Add(nodeWorkout);
        }
Esempio n. 29
0
        /// 
        /// Override the render method to create the newsletter tree
        /// 
        /// 
        public override void Render(ref XmlTree Tree)
        {
            Tree.treeCollection.Clear();

            var node = XmlTreeNode.Create(this);
            node.NodeID = "Topic" + Guid.NewGuid();
            node.Text = "Topic";
            node.Icon = "b_user.png";
            node.Action = string.Format("javascript:openTopic({0});", 1355);
            var data = GetTreeServiceUrl(node.NodeID);
            Tree.Add(node);
        }
 void BaseContentTree_BeforeNodeRender(ref XmlTree sender, ref XmlTreeNode node, EventArgs e)
 {
     if (node.NodeType == "content")
     {
         try
         {
             int index = node.Menu.FindIndex(delegate(IAction a) { return a.Alias == "publish"; }) + 1;
             node.Menu.Insert(index, MailingAction.Instance);
         }
         catch { }
     }
 }
Esempio n. 31
0
 public override void Render(ref XmlTree tree)
 {
     var circuits = _repository.GetAll();
     foreach(var circuit in circuits) {
         XmlTreeNode xNode = XmlTreeNode.Create(this);
         xNode.NodeID = circuit.Id.ToString();
         xNode.Text = circuit.Name + " - " + circuit.Country;
         xNode.Icon = "map.png";
         xNode.Action = "javascript:openCircuits(" + circuit.Id + ")";
         tree.Add(xNode);
     }
 }
Esempio n. 32
0
        /// <summary>
        /// This will call the normal Render method by passing the converted XmlTree to an XmlDocument.
        /// This is used only for backwards compatibility of converting normal ITrees to BasicTree's
        /// </summary>
        /// <param name="tree"></param>
        public override void Render(ref XmlTree tree)
        {
            XmlDocument xDoc = new XmlDocument();
            xDoc.LoadXml(tree.ToString(SerializedTreeType.XmlTree));
            Render(ref xDoc);
            tree = SerializableData.Deserialize(xDoc.OuterXml, typeof(XmlTree)) as XmlTree;
			
            foreach (XmlTreeNode node in tree)
            {
                //ensure that the tree type is set for each node
                node.TreeType = this.TreeAlias;
            }
        }
Esempio n. 33
0
        public override void Render(ref XmlTree tree)
        {
            var teams = _repository.GetAll();

            foreach (var team in teams) {
                XmlTreeNode xNode = XmlTreeNode.Create(this);
                xNode.NodeID = team.Id.ToString();
                xNode.Text = team.Name;
                xNode.Icon = "group.png";
                xNode.Action = "javascript:openTeams(" + team.Id + ")";
                tree.Add(xNode);
            }
        }
Esempio n. 34
0
        public override void Render(ref XmlTree tree)
        {
            var drivers = _driverRepository.GetAll();

            foreach(var driver in drivers) {
                var dNode = XmlTreeNode.Create(this);
                dNode.NodeID = driver.Id.ToString();
                dNode.Text = driver.Name;
                dNode.Icon = "user.png";
                dNode.Action = "javascript:openDrivers(" + driver.Id + ")";
                tree.Add(dNode);
            }
        }
 public override void Render(ref XmlTree tree)
 {
     var reader = Application.SqlHelper.ExecuteReader("select * from khaaaantest_Contests");
     while (reader.Read())
     {
         var node = XmlTreeNode.Create(this);
         node.NodeID = reader.GetInt("Id").ToString(CultureInfo.InvariantCulture);
         node.Text = reader.GetString("Name");
         node.Icon = "contest.png";
         node.Action = "javascript:openContest(" + reader.GetInt("Id").ToString(CultureInfo.InvariantCulture) + ")";
         tree.Add(node);
     }
 }
Esempio n. 36
0
        /// <summary>
        /// This will call the normal Render method by passing the converted XmlTree to an XmlDocument.
        /// This is used only for backwards compatibility of converting normal ITrees to BasicTree's
        /// </summary>
        /// <param name="tree"></param>
        public override void Render(ref XmlTree tree)
        {
            XmlDocument xDoc = new XmlDocument();

            xDoc.LoadXml(tree.ToString(SerializedTreeType.XmlTree));
            Render(ref xDoc);
            tree = SerializableData.Deserialize(xDoc.OuterXml, typeof(XmlTree)) as XmlTree;

            foreach (XmlTreeNode node in tree)
            {
                //ensure that the tree type is set for each node
                node.TreeType = this.TreeAlias;
            }
        }
Esempio n. 37
0
        public override void Render(ref XmlTree tree)
        {
            XmlTreeNode xNode = XmlTreeNode.Create(this);

            xNode.Text = "Error";
            xNode.Menu = null;

            OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
            if (xNode != null)
            {
                tree.Add(xNode);
                OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
            }
        }
Esempio n. 38
0
        public override void Render(ref XmlTree tree)
        {
            if (UseOptimizedRendering == false)
            {
                //We cannot run optimized mode since there are subscribers to events/methods that require document instances
                // so we'll render the original way by looking up the docs.

                var docs = new Media(m_id).Children;

                var args = new TreeEventArgs(tree);
                OnBeforeTreeRender(docs, args);

                foreach (var dd in docs)
                {
                    var e     = dd;
                    var xNode = PerformNodeRender(e.Id, e.Text, e.HasChildren, e.ContentType.IconUrl, e.ContentType.Alias, () => GetLinkValue(e, e.Id.ToString(CultureInfo.InvariantCulture)));


                    OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
                    if (xNode != null)
                    {
                        tree.Add(xNode);
                        OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
                    }
                }

                OnAfterTreeRender(docs, args);
            }
            else
            {
                //We ARE running in optmized mode, this means we will NOT be raising the BeforeTreeRender or AfterTreeRender
                // events  - we've already detected that there are not subscribers or implementations
                // to call so that is fine.

                var entities = Services.EntityService.GetChildren(m_id, UmbracoObjectTypes.Media).ToArray();

                foreach (UmbracoEntity entity in entities)
                {
                    var e     = entity;
                    var xNode = PerformNodeRender(e.Id, entity.Name, e.HasChildren, e.ContentTypeIcon, e.ContentTypeAlias, () => GetLinkValue(e));

                    OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
                    if (xNode != null)
                    {
                        tree.Add(xNode);
                        OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
                    }
                }
            }
        }
        /// <summary>
        /// Returns the serialized data for the nodeId passed in.
        /// </summary>
        /// <remarks>
        /// This may not work with ITrees that don't support the BaseTree structure with TreeService.
        /// If a tree implements other query string data to make it work, this may not function since
        /// it only relies on the 3 parameters.
        /// </remarks>
        /// <param name="alias"></param>
        /// <param name="nodeId"></param>
        /// <returns></returns>
        public string GetSerializedNodeData(string nodeId)
        {
            XmlTree xTree = new XmlTree();
            int     id;

            if (int.TryParse(nodeId, out id))
            {
                this.id = id;
            }
            else
            {
                this.NodeKey = nodeId;
            }

            this.Render(ref xTree);

            return(xTree.ToString());
        }
Esempio n. 40
0
        public override void Render(ref XmlTree tree)
        {
            foreach (umbraco.BusinessLogic.User user in umbraco.BusinessLogic.User.getAll())
            {
                if (user.Id > 0 && !user.Disabled)
                {
                    XmlTreeNode node = XmlTreeNode.Create(this);
                    node.NodeID = user.Id.ToString();
                    node.Text   = user.Name;
                    node.Action = "javascript:openUserPermissions('" + user.Id.ToString() + "');";
                    node.Icon   = "user.gif";

                    OnBeforeNodeRender(ref tree, ref node, EventArgs.Empty);
                    if (node != null)
                    {
                        tree.Add(node);
                        OnAfterNodeRender(ref tree, ref node, EventArgs.Empty);
                    }
                }
            }
        }
Esempio n. 41
0
        public override void Render(ref XmlTree tree)
        {
            List <UserType> userTypes = UserType.GetAllUserTypes();

            foreach (UserType userType in userTypes)
            {
                if (userType.Id > 1) //don't show the admin user type, they should always have full permissions
                {
                    XmlTreeNode node = XmlTreeNode.Create(this);
                    node.NodeID = userType.Id.ToString();
                    node.Action = string.Format("javascript:openUserTypes({0})", userType.Id.ToString());
                    node.Icon   = "user.gif";
                    node.Text   = userType.Alias;

                    OnBeforeNodeRender(ref tree, ref node, EventArgs.Empty);
                    if (node != null)
                    {
                        tree.Add(node);
                        OnAfterNodeRender(ref tree, ref node, EventArgs.Empty);
                    }
                }
            }
        }
Esempio n. 42
0
 protected override void OnBeforeNodeRender(ref XmlTree sender, ref XmlTreeNode node, EventArgs e)
 {
     base.OnBeforeNodeRender(ref sender, ref node, e);
     node.Style.DimNode();
 }
Esempio n. 43
0
        public override void Render(ref XmlTree tree)
        {
            string orgPath = "";
            string path    = "";

            if (!string.IsNullOrEmpty(this.NodeKey))
            {
                orgPath  = this.NodeKey;
                path     = IOHelper.MapPath(FilePath + orgPath);
                orgPath += "/";
            }
            else
            {
                path = IOHelper.MapPath(FilePath);
            }

            DirectoryInfo dirInfo = new DirectoryInfo(path);

            DirectoryInfo[] dirInfos = dirInfo.GetDirectories();

            var args = new TreeEventArgs(tree);

            OnBeforeTreeRender(dirInfo, args);

            foreach (DirectoryInfo dir in dirInfos)
            {
                if ((dir.Attributes & FileAttributes.Hidden) == 0)
                {
                    XmlTreeNode xDirNode = XmlTreeNode.Create(this);
                    xDirNode.NodeID = orgPath + dir.Name;
                    xDirNode.Menu.Clear();
                    xDirNode.Text        = dir.Name;
                    xDirNode.Action      = string.Empty;
                    xDirNode.Source      = GetTreeServiceUrl(orgPath + dir.Name);
                    xDirNode.Icon        = FolderIcon;
                    xDirNode.OpenIcon    = FolderIconOpen;
                    xDirNode.HasChildren = dir.GetFiles().Length > 0 || dir.GetDirectories().Length > 0;

                    OnRenderFolderNode(ref xDirNode);
                    OnBeforeNodeRender(ref tree, ref xDirNode, EventArgs.Empty);
                    if (xDirNode != null)
                    {
                        tree.Add(xDirNode);
                        OnAfterNodeRender(ref tree, ref xDirNode, EventArgs.Empty);
                    }
                }
            }
            FileInfo[] fileInfo = dirInfo.GetFiles(FileSearchPattern);
            foreach (FileInfo file in fileInfo)
            {
                if ((file.Attributes & FileAttributes.Hidden) == 0)
                {
                    XmlTreeNode xFileNode = XmlTreeNode.Create(this);
                    xFileNode.NodeID = orgPath + file.Name;
                    xFileNode.Text   = file.Name;
                    if (!((orgPath == "")))
                    {
                        xFileNode.Action = "javascript:openFile('" + orgPath + file.Name + "');";
                    }
                    else
                    {
                        xFileNode.Action = "javascript:openFile('" + file.Name + "');";
                    }
                    xFileNode.Icon     = "doc.gif";
                    xFileNode.OpenIcon = "doc.gif";

                    OnRenderFileNode(ref xFileNode);
                    OnBeforeNodeRender(ref tree, ref xFileNode, EventArgs.Empty);
                    if (xFileNode != null)
                    {
                        tree.Add(xFileNode);
                        OnAfterNodeRender(ref tree, ref xFileNode, EventArgs.Empty);
                    }
                }
            }
            OnAfterTreeRender(dirInfo, args);
        }
Esempio n. 44
0
        //Updated Render method for improved performance, but currently not usable because of backwards compatibility
        //with the OnBeforeTreeRender/OnAfterTreeRender events, which sends an array for legacy Media items.
        public override void Render(ref XmlTree tree)
        {
            //_timer = DisposableTimer.Start(x => LogHelper.Debug<BaseMediaTree>("Media tree loaded" + " (took " + x + "ms)"));

            var entities = Services.EntityService.GetChildren(m_id, UmbracoObjectTypes.Media).ToArray();

            var args = new TreeEventArgs(tree);

            OnBeforeTreeRender(entities, args, false);

            foreach (UmbracoEntity entity in entities)
            {
                XmlTreeNode xNode = XmlTreeNode.Create(this);
                xNode.NodeID = entity.Id.ToString(CultureInfo.InvariantCulture);
                xNode.Text   = entity.Name;

                xNode.HasChildren = entity.HasChildren;
                xNode.Source      = this.IsDialog ? GetTreeDialogUrl(entity.Id) : GetTreeServiceUrl(entity.Id);

                xNode.Icon     = entity.ContentTypeIcon;
                xNode.OpenIcon = entity.ContentTypeIcon;

                if (IsDialog == false)
                {
                    if (this.ShowContextMenu == false)
                    {
                        xNode.Menu = null;
                    }
                    xNode.Action = "javascript:openMedia(" + entity.Id + ");";
                }
                else
                {
                    xNode.Menu = this.ShowContextMenu ? new List <IAction>(new IAction[] { ActionRefresh.Instance }) : null;
                    if (this.DialogMode == TreeDialogModes.fulllink)
                    {
                        string nodeLink = GetLinkValue(entity);
                        if (string.IsNullOrEmpty(nodeLink) == false)
                        {
                            xNode.Action = "javascript:openMedia('" + nodeLink + "');";
                        }
                        else
                        {
                            if (string.Equals(entity.ContentTypeAlias, Constants.Conventions.MediaTypes.Folder, StringComparison.OrdinalIgnoreCase))
                            {
                                //#U4-2254 - Inspiration to use void from here: http://stackoverflow.com/questions/4924383/jquery-object-object-error
                                xNode.Action = "javascript:void jQuery('.umbTree #" + entity.Id.ToString(CultureInfo.InvariantCulture) + "').click();";
                            }
                            else
                            {
                                xNode.Action = null;
                                xNode.Style.DimNode();
                            }
                        }
                    }
                    else
                    {
                        xNode.Action = "javascript:openMedia('" + entity.Id.ToString(CultureInfo.InvariantCulture) + "');";
                    }
                }

                OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
                if (xNode != null)
                {
                    tree.Add(xNode);
                    OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
                }
            }

            //stop the timer and log the output
            //_timer.Dispose();

            OnAfterTreeRender(entities, args, false);
        }
Esempio n. 45
0
        /// <summary>
        /// Renders the specified tree item.
        /// </summary>
        /// <param name="Tree">The tree.</param>
        public override void Render(ref XmlTree Tree)
        {
            if (UseOptimizedRendering == false)
            {
                //We cannot run optimized mode since there are subscribers to events/methods that require document instances
                // so we'll render the original way by looking up the docs.

                //get documents to render
                var docs = Document.GetChildrenForTree(m_id);

                var args = new TreeEventArgs(Tree);
                OnBeforeTreeRender(docs, args);

                foreach (var dd in docs)
                {
                    var allowedUserOptions = GetUserActionsForNode(dd);
                    if (CanUserAccessNode(dd, allowedUserOptions))
                    {
                        var node = CreateNode(dd, allowedUserOptions);

                        OnRenderNode(ref node, dd);

                        OnBeforeNodeRender(ref Tree, ref node, EventArgs.Empty);
                        if (node != null)
                        {
                            Tree.Add(node);
                            OnAfterNodeRender(ref Tree, ref node, EventArgs.Empty);
                        }
                    }
                }
                OnAfterTreeRender(docs, args);
            }
            else
            {
                //We ARE running in optmized mode, this means we will NOT be raising the BeforeTreeRender or AfterTreeRender
                // events and NOT calling the OnRenderNode method - we've already detected that there are not subscribers or implementations
                // to call so that is fine.

                var entities = Services.EntityService.GetChildren(m_id, UmbracoObjectTypes.Document).ToArray();
                foreach (var entity in entities)
                {
                    var e = entity as UmbracoEntity;
                    var allowedUserOptions = GetUserActionsForNode(e);
                    if (CanUserAccessNode(e, allowedUserOptions))
                    {
                        var node = CreateNode(e, allowedUserOptions);

                        //in optimized mode the LoadMinimalDocument will ALWAYS be true, if it is not true then we will
                        // be rendering in non-optimized mode and this code will not get executed so we don't need to worry
                        // about performance here.
                        OnRenderNode(ref node, new Document(e, LoadMinimalDocument));

                        OnBeforeNodeRender(ref Tree, ref node, EventArgs.Empty);
                        if (node != null)
                        {
                            Tree.Add(node);
                            OnAfterNodeRender(ref Tree, ref node, EventArgs.Empty);
                        }
                    }
                }
            }
        }
        public override void Render(ref XmlTree tree)
        {
            string orgPath = "";
            string path    = "";

            if (!string.IsNullOrEmpty(this.NodeKey))
            {
                orgPath = this.NodeKey.EnsureEndsWith('/');
                path    = IOHelper.MapPath($"{FilePath.EnsureEndsWith('/')}{orgPath}");
            }
            else
            {
                path = IOHelper.MapPath(FilePath);
            }

            DirectoryInfo dirInfo = new DirectoryInfo(path);


            DirectoryInfo[] dirInfos = dirInfo.Exists ? dirInfo.GetDirectories() : new DirectoryInfo[] { };

            var args = new TreeEventArgs(tree);

            OnBeforeTreeRender(dirInfo, args);

            foreach (DirectoryInfo dir in dirInfos)
            {
                if ((dir.Attributes & FileAttributes.Hidden) == 0)
                {
                    XmlTreeNode xDirNode = XmlTreeNode.Create(this);
                    xDirNode.NodeID = orgPath + dir.Name;
                    xDirNode.Menu.Clear();
                    xDirNode.Text        = dir.Name;
                    xDirNode.Action      = string.Empty;
                    xDirNode.Source      = GetTreeServiceUrl(orgPath + dir.Name);
                    xDirNode.Icon        = FolderIcon;
                    xDirNode.OpenIcon    = FolderIconOpen;
                    xDirNode.HasChildren = dir.GetFiles().Length > 0 || dir.GetDirectories().Length > 0;

                    OnRenderFolderNode(ref xDirNode);
                    OnBeforeNodeRender(ref tree, ref xDirNode, EventArgs.Empty);
                    if (xDirNode != null)
                    {
                        tree.Add(xDirNode);
                        OnAfterNodeRender(ref tree, ref xDirNode, EventArgs.Empty);
                    }
                }
            }

            //this is a hack to enable file system tree to support multiple file extension look-up
            //so the pattern both support *.* *.xml and xml,js,vb for lookups
            string[] allowedExtensions          = new string[0];
            bool     filterByMultipleExtensions = FileSearchPattern.Contains(",");

            FileInfo[] fileInfo;

            if (filterByMultipleExtensions)
            {
                fileInfo          = dirInfo.Exists ? dirInfo.GetFiles() : new FileInfo[] {};
                allowedExtensions = FileSearchPattern.ToLower().Split(',');
            }
            else
            {
                fileInfo = dirInfo.Exists ? dirInfo.GetFiles(FileSearchPattern) : new FileInfo[] { };
            }

            foreach (FileInfo file in fileInfo)
            {
                if ((file.Attributes & FileAttributes.Hidden) == 0)
                {
                    if (filterByMultipleExtensions && Array.IndexOf <string>(allowedExtensions, file.Extension.ToLower().Trim('.')) < 0)
                    {
                        continue;
                    }

                    XmlTreeNode xFileNode = XmlTreeNode.Create(this);
                    xFileNode.NodeID = orgPath + file.Name;
                    xFileNode.Text   = file.Name;
                    if (!((orgPath == "")))
                    {
                        xFileNode.Action = "javascript:openFile('" + orgPath + file.Name + "');";
                    }
                    else
                    {
                        xFileNode.Action = "javascript:openFile('" + file.Name + "');";
                    }
                    xFileNode.Icon     = "doc.gif";
                    xFileNode.OpenIcon = "doc.gif";

                    OnRenderFileNode(ref xFileNode);
                    OnBeforeNodeRender(ref tree, ref xFileNode, EventArgs.Empty);
                    if (xFileNode != null)
                    {
                        tree.Add(xFileNode);
                        OnAfterNodeRender(ref tree, ref xFileNode, EventArgs.Empty);
                    }
                }
            }
            OnAfterTreeRender(dirInfo, args);
        }
 /// <summary>
 /// Classes need to override thid method to create the nodes for the XmlTree
 /// </summary>
 /// <param name="tree"></param>
 public abstract void Render(ref XmlTree tree);
Esempio n. 48
0
        public override void Render(ref XmlTree tree)
        {
            Media[] docs = new Media(m_id).Children;

            var args = new TreeEventArgs(tree);

            OnBeforeTreeRender(docs, args);

            foreach (Media dd in docs)
            {
                XmlTreeNode xNode = XmlTreeNode.Create(this);
                xNode.NodeID = dd.Id.ToString();
                xNode.Text   = dd.Text;

                // Check for dialog behaviour
                if (!this.IsDialog)
                {
                    if (!this.ShowContextMenu)
                    {
                        xNode.Menu = null;
                    }
                    xNode.Action = "javascript:openMedia(" + dd.Id + ");";
                }
                else
                {
                    if (this.ShowContextMenu)
                    {
                        xNode.Menu = new List <IAction>(new IAction[] { ActionRefresh.Instance });
                    }
                    else
                    {
                        xNode.Menu = null;
                    }
                    if (this.DialogMode == TreeDialogModes.fulllink)
                    {
                        string nodeLink = GetLinkValue(dd, dd.Id.ToString());
                        if (!String.IsNullOrEmpty(nodeLink))
                        {
                            xNode.Action = "javascript:openMedia('" + nodeLink + "');";
                        }
                        else
                        {
                            xNode.Action = null;
                            xNode.DimNode();
                        }
                    }
                    else
                    {
                        xNode.Action = "javascript:openMedia('" + dd.Id.ToString() + "');";
                    }
                }

                xNode.HasChildren = dd.HasChildren;
                if (this.IsDialog)
                {
                    xNode.Source = GetTreeDialogUrl(dd.Id);
                }
                else
                {
                    xNode.Source = GetTreeServiceUrl(dd.Id);
                }

                if (dd.ContentType != null)
                {
                    xNode.Icon     = dd.ContentType.IconUrl;
                    xNode.OpenIcon = dd.ContentType.IconUrl;
                }

                OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
                if (xNode != null)
                {
                    tree.Add(xNode);
                    OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
                }
            }
            OnAfterTreeRender(docs, args);
        }
Esempio n. 49
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TreeEventArgs"/> class.
 /// </summary>
 /// <param name="tree">The tree which the event is for.</param>
 public TreeEventArgs(XmlTree tree)
 {
     this.Tree = tree;
 }