Copied to clipboard

Flag this post as spam?

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


  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Nov 22, 2010 @ 15:49
    Jeroen Breuer
    0

    Doesn't work with Digibiz Email Form with TinyMCE datatype

    Hello,

    I'm trying to use this package in combination with the Digibiz Email Form with TinyMCE datatype which I created, but I get the following exception:

    No Document exists with Version '7bbe2db0-5f37-4e2b-9297-0842e9e8cce5' 
    
    Stack Trace:
    
    [ArgumentException: No Document exists with Version '7bbe2db0-5f37-4e2b-9297-0842e9e8cce5']
       umbraco.cms.businesslogic.web.Document.setupNode() +1062
       umbraco.cms.businesslogic.CMSNode..ctor(Int32 Id) +89
       umbraco.cms.businesslogic.Content..ctor(Int32 id) +44
       umbraco.cms.businesslogic.web.Document..ctor(Int32 id, Guid Version) +60
       umbraco.page..ctor(Int32 Id, Guid Version) +307
       umbraco.editorControls.tinyMCE3.webcontrol.TinyMCEWebControl.parseMacrosToHtml(String input) +268
       umbraco.editorControls.tinyMCE3.webcontrol.TinyMCEWebControl.OnPreRender(EventArgs e) +124
       System.Web.UI.Control.PreRenderRecursiveInternal() +103
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
    

    My datatype inherits from the TinyMCE datatype so that's what's probably causing the error. What's the best way to solve this? You replaced the TinyMCE editor with a normal textarea. Perhaps I could do the same for my datatype. If you open this project for colab I could help you solve this bug.

    Jeroen

     

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Nov 22, 2010 @ 17:53
    Jeroen Breuer
    0

    Because twitter was too short I'll explain it here :)

    The GUID of my Data Type is 5d5b2b6e-51bd-4e0a-a1d6-0b82c2ae051f. What might be a problem is that I want the TinyMCE editor to be replaced by a textarea, but the datatype also has multiple other fields which I don't want to be replaced. The whole idea of my package was to have multiple e-mail fields in a single datatype with mandatory fields that depend on eachother. If this will be troublesome what do you suggest? Currently I can't edit any standard values because the pages crashes because of my data type. Simply disabling it might also be fine if that's the easiest :).

    Jeroen

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Nov 22, 2010 @ 23:00
    Jeroen Breuer
    0

    Hi Morten,

    Could you also please explain why the TinyMCE editor doesn't work in your package? I've added it to data types and to custom pages and it always worked. Here is some info how I added it to a custom page: http://our.umbraco.org/forum/developers/extending-umbraco/6863-Datatype-on-normal-page-or-UserControl. If you look at the last post of the first page you can see how I added it.

    Jeroen

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Nov 24, 2010 @ 10:31
    Jeroen Breuer
    0

    Hi Morten,

    A small update again. It appears this bug I'm having with TinyMCE also happens when you try to add it to a media or member type. Here are the work items:

    http://umbraco.codeplex.com/workitem/29032
    http://umbraco.codeplex.com/workitem/29258

    The error is the same so I think it's related. Thought that might be useful for you :).

    Jeroen

  • Niels Hartvig 1951 posts 2391 karma points c-trib
    Nov 24, 2010 @ 11:04
    Niels Hartvig
    1

    We'll fix this for JUNO!

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    Nov 24, 2010 @ 11:26
    Morten Christensen
    1

    Hi Jeroen,

    Sorry about the late reply, I know you are eager to find out what is going on. Unfortunately, I've come down with some kind of influenza and not really on top of the world.

    The two issues you added to codeplex is related to the same problem that I have encountered with the Standard Value packages, and the problem occurs because Media and Member is not a Document. When upgrading the Standard Values package I was through two full rewrites because I couldn't get it to work as I wanted it two. The rendering of the datatypes on a Document was failing and after a lot of debugging I found out that my problem occured, because the rendering of the TineMCE control is being rendered as a page, which it assumes is a Document with a Document Version. I was a bit puzzled because it worked fine in version 4.0.x of Umbraco, so I compared the source code and found that a check for the returned document version had been introduced.

    If you look up the methods from the stack trace, which you added to both workitems you should be able to see the problem. I'll try and explain:

    When using the TinyMCE control you will hit this method, which parses a Macro to HTML:

    private string parseMacrosToHtml(string input) {
    ....
    // Page for macro rendering
    page p = new page(nodeId, versionId);
    ...
    }

    As you can see in the snippet above this method starts of by create a page-object from a nodeId and a versionId. My Standard Values package is "emulating" a Document - its not a real Document, because I don't want it to appear in the Content tree. I don't know enough about Media and Member types to say it for sure, but my guess is that they don't have a version id either (please feel free to correct me if I'm wrong - it might be because the versions of media and member are handled differently then a Document).

    But if we go on to the constructor of the page-object you will see that it starts off by creating a Document object using the same nodeId and versionId as above:

    public page(int Id, Guid Version)
    {
    pageID = Id;

    // create document object
    Document d = new Document(Id, Version);
    ....
    }

    so far so good, but keep in mind that the version id is not likely to be valid as we are now dealing with a Document-object.
    Creating a Document-object will ultimately trigger the following method:

    protected override void setupNode()
    {
    base.setupNode();

    using (var dr =
    SqlHelper.ExecuteReader("select published, documentUser, coalesce(templateId, cmsDocumentType.templateNodeId) as templateId, text, releaseDate, expireDate, updateDate from cmsDocument inner join cmsContent on cmsDocument.nodeId = cmsContent.Nodeid left join cmsDocumentType on cmsDocumentType.contentTypeNodeId = cmsContent.contentType and cmsDocumentType.IsDefault = 1 where versionId = @versionId",
    SqlHelper.CreateParameter("@versionId", Version)))
    {
    if (dr.Read())
    {
    _creator = User;
    _writer = User.GetUser(dr.GetInt("documentUser"));

    if (!dr.IsNull("templateId"))
    _template = dr.GetInt("templateId");
    if (!dr.IsNull("releaseDate"))
    _release = dr.GetDateTime("releaseDate");
    if (!dr.IsNull("expireDate"))
    _expire = dr.GetDateTime("expireDate");
    if (!dr.IsNull("updateDate"))
    _updated = dr.GetDateTime("updateDate");
    }
    else
    {
    throw new ArgumentException(string.Format("No Document exists with Version '{0}'", Version));
    }
    }

    _published = HasPublishedVersion();
    }

    and here we have the problem: throw new ArgumentException(string.Format("No Document exists with Version '{0}'", Version));
    This ArgumentException was, as far I as I can tell from the source code introduced in version 4.5.x, and the only reason why using the TinyMCE control on anything but a Document doesn't work anymore. Or you could say that the only reason why it previously worked was because this check (ArgumentException) wasn't implemented.

    Hope this explains the problem. Only thing I can so with your datatype is to have it rendered as a multiline textfield like I do with the standard TinyMCE control, so it doesn't make the Standard Values view throw exceptions. Its the best I can do at the moment. Alternatively you can add your own custom standard values from somewhere else using events. Feel free to use the source code from my package as you'd like.

    Best regards,

    Morten Christensen

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Nov 24, 2010 @ 11:33
    Jeroen Breuer
    0

    Hi Morten,

    Thanks for explaining! I think I'll first wait and see if this problem still occurs in Umbraco 4.6 JUNO because if it works in media and member types (which also don't use versioning) it hopefully will also work for this package. 

    You can probably use the normal TinyMCE editor again in Umbraco 4.6 JUNO so you could update your package for this.

    Jeroen

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Feb 12, 2011 @ 17:34
    Jeroen Breuer
    0

    Hi Morten,

    I've tested Digibiz Email Form with TinyMCE datatype with Standard values on Umbraco 4.6 and it works :). This means you can also use the TinyMCE editor again in you're package. Time to update it ;).

    Jeroen

Please Sign in or register to post replies

Write your reply to:

Draft