当前位置: 首页>>代码示例>>C#>>正文


C# CMSNode类代码示例

本文整理汇总了C#中CMSNode的典型用法代码示例。如果您正苦于以下问题:C# CMSNode类的具体用法?C# CMSNode怎么用?C# CMSNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CMSNode类属于命名空间,在下文中一共展示了CMSNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

        public void Run(IWorkflowInstance workflowInstance, IWorkflowRuntime runtime)
        {
            // Cast to Umbraco worklow instance.
            var umbracoWorkflowInstance = (UmbracoWorkflowInstance) workflowInstance;

            var count = 0;
            var newCmsNodes = new List<int>();

            foreach(var nodeId in umbracoWorkflowInstance.CmsNodes)
            {
                var n = new CMSNode(nodeId);
                if(!n.IsDocument()) continue;

                var d = new Document(nodeId);
                if (!DocumentTypes.Contains(d.ContentType.Id)) continue;
                
                newCmsNodes.Add(nodeId);
                count++;
            }

            umbracoWorkflowInstance.CmsNodes = newCmsNodes;

            var transition = (count > 0) ? "contains_docs" : "does_not_contain_docs";
            runtime.Transition(workflowInstance, this, transition);
        }
开发者ID:OlivierAlbertini,项目名称:workflow-for-dot-net,代码行数:25,代码来源:FilterDocumentsWorkflowTask.cs

示例2: NodeChildrenCount

        private void NodeChildrenCount(CMSNode node, bool countChildren, string[] documentAliasFilters)
        {
            if (documentAliasFilters.Length > 0)
            {
                foreach (var filter in documentAliasFilters)
                {
                    var trimmedFilter = filter.TrimStart(" ".ToCharArray());
                    trimmedFilter = trimmedFilter.TrimEnd(" ".ToCharArray());

                    if ((new Document(node.Id).ContentType.Alias == trimmedFilter || trimmedFilter == string.Empty) && ValidNode(node.Text))
                    {
                        _nodeCount += 1;
                    }
                }
            }
            else
            {
                if (ValidNode(node.Text))
                {
                    _nodeCount += 1;
                }
            }

            if (countChildren)
            {
                //store children array here because iterating over an Array property object is very inneficient.
                var children = node.Children;
                foreach (CMSNode child in children)
                {
                    NodeChildrenCount(child, countChildren, documentAliasFilters);
                }
            }

        }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:34,代码来源:UltimatePickerAutoCompleteHandler.ashx.cs

示例3: OnInit

        protected override void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);

            node = new cms.businesslogic.CMSNode(int.Parse(helper.Request("id")));

            ArrayList actionList = BusinessLogic.Actions.Action.GetAll();
            
            foreach (interfaces.IAction a in actionList)
            {
                if (a.ShowInNotifier)
                {
                   
                    CheckBox c = new CheckBox();
                    c.ID = a.Letter.ToString();
                    
                    if (base.getUser().GetNotifications(node.Path).IndexOf(a.Letter) > -1)
                        c.Checked = true;

                    uicontrols.PropertyPanel pp = new umbraco.uicontrols.PropertyPanel();
                    pp.Text = ui.Text("actions", a.Alias);
                    pp.Controls.Add(c);

                    pane_form.Controls.Add(pp);
                    
                    actions.Add(c);
                 
                }
            }
          
        }
开发者ID:ChrisNikkel,项目名称:Umbraco-CMS,代码行数:35,代码来源:notifications.aspx.cs

示例4: FindTemplateRoot

 private int FindTemplateRoot(CMSNode t)
 {
     if (t.ParentId < 0)
         return t.Id;
     else
         return FindTemplateRoot(t.Parent);
 }
开发者ID:elrute,项目名称:Triphulcas,代码行数:7,代码来源:TemplateSkinning.aspx.cs

示例5: Run

        public override void Run(IWorkflowInstance workflowInstance, IWorkflowRuntime runtime)
        {
            base.Run(workflowInstance, runtime);

            var body = Helper.Instance.RenderTemplate(RenderTemplate);
            
            IList<string> files = new List<string>();

            foreach(var nodeId in ((UmbracoWorkflowInstance) workflowInstance).CmsNodes)
            {
                var node = new CMSNode(nodeId);
                if(node.IsMedia())
                {
                    files.Add(IOHelper.MapPath((string) new Media(nodeId).getProperty("umbracoFile").Value));
                }
            }

            var f = new User(From).Email;
            foreach(var r in GetRecipients())
            {
                var mail = new MailMessage(f, r) {Subject = Subject, IsBodyHtml = true, Body = body};

                foreach(var file in files)
                {
                    var attach = new Attachment(file);
                    mail.Attachments.Add(attach);
                }

                var smtpClient = new SmtpClient();
                smtpClient.Send(mail);
            }

            runtime.Transition(workflowInstance, this, "done");
        }
开发者ID:OlivierAlbertini,项目名称:workflow-for-dot-net,代码行数:34,代码来源:TemplateEmailWithMediaWorkflowTask.cs

示例6: GetOriginalUrl

        /// <summary>
        ///   Gets the image property.
        /// </summary>
        /// <returns></returns>
        internal static string GetOriginalUrl(int nodeId, ImageResizerPrevalueEditor imagePrevalueEditor)
        {
            Property imageProperty;
            var node = new CMSNode(nodeId);
            if (node.nodeObjectType == Document._objectType)
            {
                imageProperty = new Document(nodeId).getProperty(imagePrevalueEditor.PropertyAlias);
            }
            else if (node.nodeObjectType == Media._objectType)
            {
                imageProperty = new Media(nodeId).getProperty(imagePrevalueEditor.PropertyAlias);
            }
            else
            {
                if (node.nodeObjectType != Member._objectType)
                {
                    throw new Exception("Unsupported Umbraco Node type for Image Resizer (only Document, Media and Members are supported.");
                }
                imageProperty = new Member(nodeId).getProperty(imagePrevalueEditor.PropertyAlias);
            }

            try
            {
                return imageProperty.Value.ToString();
            }
            catch
            {
                return string.Empty;
            }
        }
开发者ID:ZeeshanShafqat,项目名称:Aspose_Imaging_NET,代码行数:34,代码来源:ImageResizerHelper.cs

示例7: MakeNew

        public static void MakeNew(CMSNode Node, User User, User Translator, Language Language, string Comment,
                                   bool IncludeSubpages, bool SendEmail)
        {
            // Create pending task
            Task t = new Task();
            t.Comment = Comment;
            t.Node = Node;
            t.ParentUser = User;
            t.User = Translator;
            t.Type = new TaskType("toTranslate");
            t.Save();

            // Add log entry
            Log.Add(LogTypes.SendToTranslate, User, Node.Id,
                    "Translator: " + Translator.Name + ", Language: " + Language.FriendlyName);

            // send it
            if (SendEmail)
            {
                // Send mail
                string[] subjectVars = {HttpContext.Current.Request.ServerVariables["SERVER_NAME"], Node.Text};
                string[] bodyVars = {
                                        Translator.Name, Node.Text, User.Name,
                                        HttpContext.Current.Request.ServerVariables["SERVER_NAME"], Node.Id.ToString(),
                                        Language.FriendlyName
                                    };

                if (User.Email != "" && User.Email.Contains("@") && Translator.Email != "" &&
                    Translator.Email.Contains("@"))
                {
                    // create the mail message 
                    MailMessage mail = new MailMessage(User.Email, Translator.Email);

                    // populate the message
                    mail.Subject = ui.Text("translation", "mailSubject", subjectVars, Translator);
                    mail.IsBodyHtml = false;
                    mail.Body = ui.Text("translation", "mailBody", bodyVars, Translator);
                    try
                    {
                        SmtpClient sender = new SmtpClient(GlobalSettings.SmtpServer);
                        sender.Send(mail);
                    }
                    catch (Exception ex)
                    {
                        Log.Add(LogTypes.Error, User, Node.Id,
                                string.Format("Error sending translation e-mail:{0}", ex.ToString()));
                    }
                }
                else
                    Log.Add(LogTypes.Error, User, Node.Id,
                            "Could not send translation e-mail because either user or translator lacks e-mail in settings");
            }

            if (IncludeSubpages)
            {
                foreach (CMSNode n in Node.Children)
                    MakeNew(n, User, Translator, Language, Comment, true, false);
            }
        }
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:59,代码来源:Translation.cs

示例8: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            _currentPage = new CMSNode(int.Parse(helper.Request("id")));

            pp_translator.Text = ui.Text("translation","translator", this.getUser());
            pp_language.Text = ui.Text("translation", "translateTo", this.getUser());
            pp_includeSubs.Text = ui.Text("translation","includeSubpages", this.getUser());
            pp_comment.Text = ui.Text("comment", this.getUser());
            pane_form.Text = ui.Text("translation", "sendToTranslate", _currentPage.Text, base.getUser());
            

            if (!IsPostBack)
            {
                // default language
                var selectedLanguage = 0;

                var domains = library.GetCurrentDomains(_currentPage.Id);
                if (domains != null)
                {
                    selectedLanguage = domains[0].Language.id;
                    defaultLanguage.Text = ui.Text("defaultLanguageIs", base.getUser()) + " " + domains[0].Language.FriendlyName;
                }
                else
                {
                    defaultLanguage.Text = ui.Text("defaultLanguageIsNotAssigned", base.getUser());
                }
                
                // languages
                language.Items.Add(new ListItem(ui.Text("general", "choose", base.getUser()), ""));
                foreach (var l in cms.businesslogic.language.Language.getAll)
                {
                    var li = new ListItem();
                    li.Text = l.FriendlyName;
                    li.Value = l.id.ToString();
                    if (selectedLanguage == l.id)
                        li.Selected = true;
                    language.Items.Add(li);
                }

                // Subpages
                if (_currentPage.Children.Length == 0)
                    includeSubpages.Enabled = false;

                // Translators
                foreach (var u in BusinessLogic.User.getAll())
                    if (u.UserType.Alias.ToLower() == "translator")
                        translator.Items.Add(new ListItem(u.Name, u.Id.ToString()));

                if (translator.Items.Count == 0) {
                    feedback.Text = ui.Text("translation", "noTranslators");
                    feedback.type = uicontrols.Feedback.feedbacktype.error;
                    doTranslation.Enabled = false;
                }

                // send button
                doTranslation.Text = ui.Text("general", "ok", base.getUser());
            }
        }
开发者ID:ChrisNikkel,项目名称:Umbraco-CMS,代码行数:58,代码来源:sendToTranslation.aspx.cs

示例9: CopyPermissions

 /// <summary>
 /// Copies all  permissions to related users of the usertype
 /// </summary>
 /// <param name="userType">Type of the user.</param>
 /// <param name="node">The node.</param>
 public static void CopyPermissions(UserType userType, CMSNode node)
 {
     string permissions = userType.GetPermissions(node.Path);
         foreach (User user in userType.GetAllRelatedUsers())
         {
             if (!user.IsAdmin() && !user.Disabled)
             {
                 Permission.UpdateCruds(user, node, permissions);
                 user.initCruds();
             }
         }
 }
开发者ID:rsoeteman,项目名称:usergrouppermissions,代码行数:17,代码来源:UserTypePermissions.cs

示例10: MakeNew

 public static ContentItem MakeNew(string Name, ContentItemType cit, BusinessLogic.User u, int ParentId)
 {
     Guid newId = Guid.NewGuid();
     // Updated to match level from base node
     CMSNode n = new CMSNode(ParentId);
     int newLevel = n.Level;
     newLevel++;
     CMSNode.MakeNew(ParentId,_objectType, u.Id, newLevel,  Name, newId);
     ContentItem tmp = new ContentItem(newId);
     tmp.CreateContent(cit);
     return tmp;
 }
开发者ID:jracabado,项目名称:justEdit-,代码行数:12,代码来源:ContentItem.cs

示例11: BuildDataTypeItem

        private DataTypeItem BuildDataTypeItem(DataTypeDefinition dataTypeDefinition)
        {
            var dataTypeItem = new DataTypeItem();
            dataTypeItem.Id = dataTypeDefinition.DataType.DataTypeDefinitionId;
            dataTypeItem.ControlTypeName = dataTypeDefinition.DataType.GetType().FullName;

            var node = new CMSNode(dataTypeItem.Id);
            dataTypeItem.DataTypeName = node.Text;

            dataTypeItem.PreValueItems = this.BuildPreValues(dataTypeDefinition);
            dataTypeItem.Type = this.DetermineType(dataTypeItem);
            dataTypeItem.ModelType = DetermineModelType(dataTypeItem);
            return dataTypeItem;
        }
开发者ID:pgregorynz,项目名称:UmbCodeGen,代码行数:14,代码来源:DocumentTypeLibrary.cs

示例12: GetNodeInfo

        public NodeInfo GetNodeInfo(int id)
        {
            Authorize();

            var node = new CMSNode(id);
            return new NodeInfo()
            {
                Id = node.Id,
                Path = node.Path,
                PathAsNames = string.Join("->",
                   GetPathNames(node.Path.Split(',')
                                       .Select(x => int.Parse(x))
                                       .ToArray()))
            };
        }
开发者ID:CarlSargunar,项目名称:Umbraco-CMS,代码行数:15,代码来源:CustomTreeService.cs

示例13: Relation

		public Relation(int Id)
		{
			using (SqlDataReader dr = Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(GlobalSettings.DbDSN, CommandType.Text, "select * from umbracoRelation where id = @id", new SqlParameter("@id", Id)))
			{
				if(dr.Read())
				{
					this._id = int.Parse(dr["id"].ToString());
					this._parentNode = new CMSNode(int.Parse(dr["parentId"].ToString()));
					this._childNode = new CMSNode(int.Parse(dr["childId"].ToString()));
					this._relType = RelationType.GetById(int.Parse(dr["relType"].ToString()));
					this._comment = dr["comment"].ToString();
					this._datetime = DateTime.Parse(dr["datetime"].ToString());
				}
			}
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:15,代码来源:Relation.cs

示例14: MakeNew

        /// <summary>
        /// Creates a new Media
        /// </summary>
        /// <param name="Name">The name of the media</param>
        /// <param name="dct">The type of the media</param>
        /// <param name="u">The user creating the media</param>
        /// <param name="ParentId">The id of the folder under which the media is created</param>
        /// <returns></returns>
        public static Media MakeNew(string Name, MediaType dct, BusinessLogic.User u, int ParentId)
        {
            Guid newId = Guid.NewGuid();
            // Updated to match level from base node
            CMSNode n = new CMSNode(ParentId);
            int newLevel = n.Level;
            newLevel++;
            CMSNode.MakeNew(ParentId, _objectType, u.Id, newLevel, Name, newId);
            Media tmp = new Media(newId);
            tmp.CreateContent(dct);

            NewEventArgs e = new NewEventArgs();
            tmp.OnNew(e);

            return tmp;
        }
开发者ID:elrute,项目名称:Triphulcas,代码行数:24,代码来源:Media.cs

示例15: GetNodePermissions

 /// <summary>
 /// Returns the permissions for a node
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public static IEnumerable<Permission> GetNodePermissions(CMSNode node)
 {
     var items = new List<Permission>();
     using (IRecordsReader dr = SqlHelper.ExecuteReader("select * from umbracoUser2NodePermission where nodeId = @nodeId order by nodeId", SqlHelper.CreateParameter("@nodeId", node.Id)))
     {
         while (dr.Read())
         {
             items.Add(new Permission()
             {
                 NodeId = dr.GetInt("nodeId"),
                 PermissionId = Convert.ToChar(dr.GetString("permission")),
                 UserId = dr.GetInt("userId")
             });
         }
     }
     return items;
 }
开发者ID:Jeavon,项目名称:Umbraco-CMS,代码行数:22,代码来源:Permission.cs


注:本文中的CMSNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。