Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ivan Ponomarenko 20 posts 105 karma points
    Jun 12, 2015 @ 09:48
    Ivan Ponomarenko
    0

    Cannot parse the current macro in RTE

    Hi all, I use some of the macros in a RTE. And with frequent reference to the page (in the admin panel "Content"), which is a macro inserted into a RTE, itself ceases to be loaded and written "Loading ...". I use Google Chrome, clearing the cache does not solve the problem for a long time. In other browsers the same problem.

    Who knows how to solve this problem?

    Perfectly state: enter image description here Trouble: enter image description here More details: enter image description here

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jun 16, 2015 @ 10:01
    Jan Skovgaard
    0

    Hi Ivan

    What is the exact version of Umbraco 7 where you're seeing this issue?

    What does your macro do? Could you post the code, which is used in it?

    Looking forward to hearing from you.

    /Jan

  • Ivan Ponomarenko 20 posts 105 karma points
    Jun 16, 2015 @ 10:18
    Ivan Ponomarenko
    0

    Hi Jan

    Thx for the reply.

    Version Umbraco 7.2.5

    Macro code:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @using System.Text;
    @{
        string courseTitle1 = "";
        string tableHTML = string.Empty;
        var color = "";
        try
        {
            var modulesOverview = CurrentPage.AncestorsOrSelf().Where("DocumentTypeAlias ==\"Tlv_unitoverview\"").First();
            var modulesFolder = modulesOverview.Children.Where("DocumentTypeAlias == \"Tlv_unitmodulesfolder\"");
            var coursesFolder = modulesOverview.Children.Where("DocumentTypeAlias == \"Tlv_unitcoursefolder\"");
            var modules = modulesFolder[0].Children.Where("DocumentTypeAlias == \"Tlv_unitmodule\" && showInTable == true");
            var courses = coursesFolder[0].Children.Where("DocumentTypeAlias == \"TLV_UnitCourseBase\"");
            color = modulesOverview.themeColor;
            if (modules.Count() > 0)
            {
                List<string> moduleCourses = new List<string>();
                Dictionary<string, string> mCoursesUrls = new Dictionary<string, string>();
                foreach (var course in courses)
                {
                    string courseTitle = !string.IsNullOrWhiteSpace(course.title) ? course.title : course.name;
                    if (!moduleCourses.Contains(courseTitle))
                    {
                        moduleCourses.Add(courseTitle);
                        string courseUrl = "";
                        if (course.hasDetailsView)
                        {
                            courseUrl = course.Url;
                        }
                        mCoursesUrls.Add(courseTitle, courseUrl);
                    }
                }
                if (moduleCourses.Count > 0)
                {
                    string[,] valMatrix = new string[modules.Count(), moduleCourses.Count() + 1];
    
                    for (int i = 0; i < modules.Count(); i++)
                    {
                        string mouleTitle = !string.IsNullOrWhiteSpace(modules[i].title) ? modules[i].title : modules[i].name;
                        string moduleUrl = "";
                        if (modules[i].hasDetailsView)
                        {
                            moduleUrl = modules[i].Url;
                        }
                        valMatrix[i, 0] = mouleTitle + "|" + moduleUrl;
    
                        string[] selContentIds = modules[i].courses.ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                        foreach (string selContent in selContentIds)
                        {
                            var c = Umbraco.Content(Convert.ToInt32(selContent));
                            if (c != null && !string.IsNullOrWhiteSpace(c.ToString()))
                            {
                                var cType = Umbraco.Content(c.ParentId);
                                string courseTitle = !string.IsNullOrWhiteSpace(cType.title) ? cType.title : cType.name;
                                var index = moduleCourses.FindIndex(x => x.ToLower() == courseTitle.ToLower());
                                if (index != -1)
                                {
                                    valMatrix[i, index + 1] = c.Url;
                                }
                            }
                        }
                    }
                    StringBuilder htmlBuilder = new StringBuilder();
                    //------HEADER ROW-----------
                    htmlBuilder.Append("<tr>");
                    for (int i = 0; i < moduleCourses.Count + 1; i++)
                    {
                        if (i == 0)
                        {
                            htmlBuilder.Append("<th><p>" + ViewBag.ModulesColTitle + "</p></th>");
                        }
                        else
                        {
                            if (string.IsNullOrEmpty(mCoursesUrls[moduleCourses[i - 1]]))
                            {
                                htmlBuilder.Append("<th><p>" + moduleCourses[i - 1] + "</p></th>");
                            }
                            else
                            {
                                htmlBuilder.Append("<th><a href=\"" + mCoursesUrls[moduleCourses[i - 1]] + "\"><span>" + moduleCourses[i - 1] + "</span></a></th>");
                            }
                        }
                    }
                    htmlBuilder.Append("</tr>");
                    for (int i = 0; i < modules.Count(); i++)
                    {
                        htmlBuilder.Append("<tr>");
                        for (int j = 0; j < moduleCourses.Count + 1; j++)
                        {
                            var skipRow = false;
                            if (j == 0)
                            {
                                if (!string.IsNullOrEmpty(valMatrix[i, j]))
                                {
                                    string[] vals = valMatrix[i, j].Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                                    if (vals.Length > 0)
                                    {
                                        if (vals.Length == 2)
                                        {
                                            htmlBuilder.Append("<td><a href=\"" + vals[1] + "\">" + vals[0] + "</a></td>");
                                        }
                                        else
                                        {
                                            htmlBuilder.Append("<td><p>" + vals[0] + "</p></td>");
                                        }
                                    }
                                    else
                                    {
                                        skipRow = true;
                                    }
                                }
                                else
                                {
                                    skipRow = true;
                                }
                            }
                            else if (!skipRow)
                            {
                                if (!string.IsNullOrEmpty(valMatrix[i, j]))
                                {
                                    htmlBuilder.Append("<td><a class=\"check_link " + @color + "\" href=\"" + valMatrix[i, j] + "\"></a></td>");
                                }
                                else
                                {
                                    htmlBuilder.Append("<td><a class=\"check_link disabled\" href=\"javascript:void(0)\"></a></td>");
                                }
                            }
                        }
                        htmlBuilder.Append("</tr>");
                    }
                    tableHTML = htmlBuilder.ToString();
                }
            }
        }
        catch (Exception ex)
        {
            tableHTML = ex.Message;
        }
    }
    <hr class="m20" />
    <div class="wrap-table">
        <table class="h3_table @color">
            <tr class="first_row">
                <th></th>
                <th colspan="3"><p>@ViewBag.CoursesColsDescription</p></th>
            </tr>
            @Html.Raw(tableHTML)
        </table>
    </div>
    
  • Jay Dobson 75 posts 121 karma points
    Jun 24, 2016 @ 14:59
    Jay Dobson
    0

    Jan,

    Have you resolved this? This just started happening to my company on the production server just last week. From what I was told, it was working fine up 'til then and nobody has made any updates other than to content nodes.

    Thanks,

    Jay

  • Ivan Ponomarenko 20 posts 105 karma points
    Jun 24, 2016 @ 15:34
    Ivan Ponomarenko
    0

    Hi Jay, I didn't resolve this problem, and at this time i can't reproduce it.

    /Ivan

  • Jeremy Coulson 61 posts 143 karma points
    Oct 13, 2017 @ 19:46
    Jeremy Coulson
    0

    Hello. Has anyone else encountered and solved this? I have a ton of suddenly broken rich text editors around our site preventing me from updating content.

  • Rasmus Pommer Andersen 1 post 71 karma points
    Mar 02, 2018 @ 08:09
    Rasmus Pommer Andersen
    0

    As no one has replied with a solution to this i would like to contribute what the reason was when i got this error.

    In the solution i was working on the problem occurred due to a Macro having been inserted within another, but empty macro in a rich text editor. It made it not able to parse the macro and halted the proper loading of the next RTE on the page.

  • Tom Madden 252 posts 454 karma points MVP 4x c-trib
    Jan 09, 2019 @ 11:09
    Tom Madden
    0

    just came across this issue today. In our case I found a number of macros in the RTE which didn't have a macroAlias parameter.

    The site had been reskinned and a number of macros were not part of the design so they were deleted, however they had been used in a couple of places in the site.

    t

Please Sign in or register to post replies

Write your reply to:

Draft