Example #1
0
        /// <summary>
        /// munge into one field
        /// </summary>
        /// <param name="e"></param>
        private void InjectGroups(IndexingNodeDataEventArgs e)
        {
            var node = new umbraco.NodeFactory.Node(e.NodeId);

            // Umbraco.Core.Logging.LogHelper.Info(this.GetType(), string.Format("test {0}", e.NodeId));



            try
            {
                //umbraco.cms.businesslogic.web.Access.IsProtected(int.Parse(e.Node.Attribute("id").Value), e.Node.Attribute("path").Value);
                if (umbraco.cms.businesslogic.web.Access.IsProtected(e.NodeId, node.Path))
                {
                    var groups = Access.GetAccessingMembershipRoles(node.Id, node.Path);

                    //  Umbraco.Core.Logging.LogHelper.Info(this.GetType(), string.Format("test in the succes if"));

                    e.Fields.Add("GroupAccess", String.Join(",", groups));
                    e.Fields.Add("IsPublic", "false");
                }

                else
                {
                    //    Umbraco.Core.Logging.LogHelper.Info(this.GetType(), string.Format("test in the succes else"));


                    e.Fields.Add("GroupAccess", "0");
                    e.Fields.Add("IsPublic", "true");
                }
            }
            catch (Exception ex)
            {
                Umbraco.Core.Logging.LogHelper.Info(this.GetType(), string.Format("test {0}", ex.ToString()));
            }
        }
Example #2
0
        public ZipDownloader(int projectId)
        {
            var project = new umbraco.NodeFactory.Node(projectId);
            var githubRepo = project.GetProperty("documentationGitRepo");
            var xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(string.Format("<?xml version=\"1.0\"?><configuration><sources><add url=\"{0}/zipball/master\" folder=\"\" /></sources></configuration>", githubRepo));

            Configuration = xmlDocument;
            RootFolder = HostingEnvironment.MapPath(@"~" + project.Url.Replace("/", @"\") + @"\Documentation");
            IsProjectDocumentation = true;
        }
        public ZipDownloader(int projectId)
        {
            var project     = new umbraco.NodeFactory.Node(projectId);
            var githubRepo  = project.GetProperty("documentationGitRepo");
            var xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(string.Format("<?xml version=\"1.0\"?><configuration><sources><add url=\"{0}/zipball/master\" folder=\"\" /></sources></configuration>", githubRepo));

            Configuration          = xmlDocument;
            RootFolder             = HostingEnvironment.MapPath(@"~" + project.Url.Replace("/", @"\") + @"\Documentation");
            IsProjectDocumentation = true;
        }
Example #4
0
		/// <summary>
		/// Return the property value for the current shopalias
		/// </summary>
		/// <param name="nodeId">The node unique identifier.</param>
		/// <param name="propertyAlias">The property alias.</param>
		/// <returns></returns>
		public static string GetPropertyValueForCurrentShop(int nodeId, string propertyAlias)
		{
			var store = StoreHelper.GetCurrentStore();

			propertyAlias = StoreHelper.CreateMultiStorePropertyAlias(propertyAlias, store.Alias);

			var node = new umbraco.NodeFactory.Node(nodeId);

			var property = node.GetProperty(propertyAlias);

			return property == null ? string.Empty : property.Value;
		}
Example #5
0
        /// <summary>
        /// Return the property value for the current shopalias
        /// </summary>
        /// <param name="nodeId">The node unique identifier.</param>
        /// <param name="propertyAlias">The property alias.</param>
        /// <returns></returns>
        public static string GetPropertyValueForCurrentShop(int nodeId, string propertyAlias)
        {
            var store = StoreHelper.GetCurrentStore();

            propertyAlias = StoreHelper.CreateMultiStorePropertyAlias(propertyAlias, store.Alias);

            var node = new umbraco.NodeFactory.Node(nodeId);

            var property = node.GetProperty(propertyAlias);

            return(property == null ? string.Empty : property.Value);
        }
        private void PopulateLOV(DropDownList ddl)
        {
            umbraco.NodeFactory.Node rootNode = new umbraco.NodeFactory.Node(Convert.ToInt32(LOVRootNode));
            var lov = new List <string>();

            foreach (umbraco.NodeFactory.Node page in rootNode.Children)
            {
                lov.Add(page.Name);
            }

            lov.Insert(0, "");

            ddl.DataSource = lov;
            ddl.DataBind();
        }
Example #7
0
        public static string Render(string razorScript = "", string macroScriptFileName = "", int nodeId = 0, IDictionary<string, string> macroParameters = null)
        {
            var macroEngine = new RazorMacroEngine();
            var macro = new MacroModel();

            macro.ScriptCode = razorScript;
            macro.ScriptLanguage = "cshtml";
            macro.ScriptName = macroScriptFileName;

            var node = new umbraco.NodeFactory.Node(nodeId);

            if(macroParameters != null) {
            foreach(var param in macroParameters) {
                macro.Properties.Add(new MacroPropertyModel(param.Key, param.Value));
            }
            }
            return macroEngine.Execute(macro, new umbraco.NodeFactory.Node(nodeId));
        }
        protected void LOVDropDownList_SelectedIndexChanged(object sender, EventArgs e)
        {
            var ddl = sender as DropDownList;

            if (ddl.SelectedIndex == 0)
            {
                return;
            }

            // Update the user's choice of style
            // remove existing style - leaving other values if present.
            umbraco.NodeFactory.Node rootNode = new umbraco.NodeFactory.Node(Convert.ToInt32(LOVRootNode));
            var  lovValue      = " " + LOVValueTextBox.Text + " ";
            bool valueReplaced = false;

            foreach (umbraco.NodeFactory.Node page in rootNode.Children)
            {
                //Match whole word only
                if (lovValue.Contains(" " + page.Name + " "))
                {
                    //Replace it.
                    lovValue      = lovValue.Replace(" " + page.Name + " ", " " + ddl.SelectedValue + " ");
                    valueReplaced = true;
                    break;
                }
            }

            if (!valueReplaced)
            {
                // Add selected style.
                lovValue += " " + ddl.SelectedValue;
            }

            // Bin leading spaces if no other styles present.
            LOVValueTextBox.Text = lovValue.Trim();
        }
Example #9
0
        private void InjectGroupsResource(IndexingNodeDataEventArgs e)
        {
            var node = new umbraco.NodeFactory.Node(e.NodeId);

            // Umbraco.Core.Logging.LogHelper.Info(this.GetType(), string.Format("test {0}", e.NodeId));



            try
            {
                //umbraco.cms.businesslogic.web.Access.IsProtected(int.Parse(e.Node.Attribute("id").Value), e.Node.Attribute("path").Value);
                if (umbraco.cms.businesslogic.web.Access.IsProtected(e.NodeId, node.Path))
                {
                    var groups = Access.GetAccessingMembershipRoles(node.Id, node.Path);

                    //  Umbraco.Core.Logging.LogHelper.Info(this.GetType(), string.Format("test in the succes if"));

                    e.Fields.Add("GroupAccess", String.Join(",", groups));
                    e.Fields.Add("IsPublic", "false");
                }

                else
                {
                    //    Umbraco.Core.Logging.LogHelper.Info(this.GetType(), string.Format("test in the succes else"));
                    //Resource will not have any public pages
                    //this condition will hit if the move node is not successfully inherits the restriction roles..

                    e.Fields.Add("GroupAccess", "NOTPROTECTED");
                    e.Fields.Add("IsPublic", "false");
                }
            }
            catch (Exception ex)
            {
                Umbraco.Core.Logging.LogHelper.Info(this.GetType(), string.Format("test {0}", ex.ToString()));
            }
        }
Example #10
0
        /// <summary>
        /// Used by all overloaded publish methods to do the actual "noderepresentation to xml"
        /// </summary>
        /// <param name="d"></param>
        /// <param name="xmlContentCopy"></param>
        public static XmlDocument PublishNodeDo(Document d, XmlDocument xmlContentCopy, bool updateSitemapProvider)
        {
            // check if document *is* published, it could be unpublished by an event
            if (d.Published)
            {
                int parentId = d.Level == 1 ? -1 : d.Parent.Id;
				xmlContentCopy = AppendDocumentXml(d.Id, d.Level, parentId, getPreviewOrPublishedNode(d, xmlContentCopy, false),
                                  xmlContentCopy);

                // update sitemapprovider
                if (updateSitemapProvider && SiteMap.Provider is UmbracoSiteMapProvider)
                {
                    try
                    {
                        var prov = (UmbracoSiteMapProvider)SiteMap.Provider;
                        Node n = new Node(d.Id, true);
                        if (!String.IsNullOrEmpty(n.Url) && n.Url != "/#")
                            prov.UpdateNode(n);
                        else
                        {
                            Log.Add(LogTypes.Error, d.Id, "Can't update Sitemap Provider due to empty Url in node");
                        }
                    }
                    catch (Exception ee)
                    {
                        Log.Add(LogTypes.Error, d.Id, string.Format("Error adding node to Sitemap Provider in PublishNodeDo(): {0}", ee));
                    }
                }
            }

			return xmlContentCopy;
		}
        private static string getPropertyValue(umbraco.NodeFactory.Node node, string alias)
        {
            var property = (umbraco.NodeFactory.Property)node.GetProperty(alias);

            return(property == null ? string.Empty : property.Value);
        }
 public static string GetPropertyValue(umbraco.NodeFactory.Node node, string alias)
 {
     return(getPropertyValue(node, alias));
 }