Copied to clipboard

Flag this post as spam?

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


  • Jonny Irwin 91 posts 153 karma points
    May 15, 2013 @ 11:26
    Jonny Irwin
    0

    v4.11.8 MNTP prevalues issue

    I have read the post on issues with v6 but think this is somewhat different.

     

    Deploying umbraco sites has been a constant pain to me for the last number of years.  Usync is by far the most promising solution that I have seen yet, there are just a few oddities in it that aren't quite working yet.

    Excuse the length of this post, I have just tried to be as thorough as possible.  I'm sure that you are aware of the following, but I wanted to provide a concrete example of the issue I am experiencing.

     I am running umbraco 4.11.8 with uSync 1.3.0.

    I set up 2 blank sites & on each create a MNTP called Downloadable Documents.  On the first site (source) I setup the prevalues as follows:

     Select tree type: Media

    Start node ID: SYSTEM DATA: umbraco master root
    Show thumbnails for media items: unchecked
    XPath filter type: Disable
    XPath filter: /*[name()='Folder' or name()='Image']
    Maximum node selections: -1
    Minimum node selections: 0
    Show tooltip for selected item: unchecked
    Data as CSV or XML?: CSV
    Pixel height of the tree control box: 200

     This generates the following xml in uSync:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <DataType Name="Downloadable Documents" Id="7e062c13-7c41-4ad9-b389-41d88aeef87c" Definition="bc17b6fe-d685-4a61-9dd8-59d8ee38d825">
      <PreValues>
        <PreValue Id="5" Value="media" />
        <PreValue Id="6" Value="/*[name()='Folder' or name()='Image']" />
        <PreValue Id="7" Value="-1" />
        <PreValue Id="8" Value="False" />
        <PreValue Id="9" Value="1" />
        <PreValue Id="10" Value="0" />
        <PreValue Id="11" Value="-1" />
        <PreValue Id="12" Value="False" />
        <PreValue Id="13" Value="-1" />
        <PreValue Id="14" Value="-1" />
        <PreValue Id="15" Value="" />
        <PreValue Id="16" Value="200" />
        <PreValue Id="17" Value="0" />
      </PreValues>
    </DataType>

    On the 2nd site (destination) I set the prevalues for the datatype as:

    Select tree type: Media
    Start node ID: SYSTEM DATA: umbraco master root
    Show thumbnails for media items: unchecked
    XPath filter type: Enable
    XPath filter: /*[name()='applicationForm' or name()='document']
    Maximum node selections: -1
    Minimum node selections: 0
    Show tooltip for selected item: unchecked
    Data as CSV or XML?: CSV
    Pixel height of the tree control box: 200

    This generates the xml in uSync as:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <DataType Name="Downloadable Documents" Id="7e062c13-7c41-4ad9-b389-41d88aeef87c" Definition="25725618-9558-4d3f-a98b-2023c9c52d0e">
      <PreValues>
        <PreValue Id="5" Value="media" />
        <PreValue Id="6" Value="/*[name()='applicationForm' or name()='document']" />
        <PreValue Id="7" Value="-1" />
        <PreValue Id="8" Value="True" />
        <PreValue Id="9" Value="1" />
        <PreValue Id="10" Value="1" />
        <PreValue Id="11" Value="-1" />
        <PreValue Id="12" Value="False" />
        <PreValue Id="13" Value="-1" />
        <PreValue Id="14" Value="-1" />
        <PreValue Id="15" Value="" />
        <PreValue Id="16" Value="200" />
        <PreValue Id="17" Value="0" />
      </PreValues>
    </DataType>

    Then, to do a deployment I copy the definition from the source site to the destination.  Obviously the Definition is different so I can't take the whole file and copy in the prevalues section from the surce to the destination file.

    After an app pool recycle, browsing to the datatype in the admin site shows the following error:

    Server Error in '/' Application.
    Input string was not in a correct format.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
    Exception Details: System.FormatException: Input string was not in a correct format.
    Source Error:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    Stack Trace:
    [FormatException: Input string was not in a correct format.]
      System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +10722195
       System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +145
       System.Int32.Parse(String s) +23
       umbraco.editorControls.MultiNodeTreePicker.MNTP_PrevalueEditor.<get_XPathFilterMatchType>b__12(PreValue x) +83
       umbraco.editorControls.MultiNodeTreePicker.MNTP_PrevalueEditor.GetPreValue(PropertyIndex index, Func`2 output, T defaultVal) +216
       umbraco.editorControls.MultiNodeTreePicker.MNTP_PrevalueEditor.get_XPathFilterMatchType() +147
       umbraco.editorControls.MultiNodeTreePicker.MNTP_PrevalueEditor.OnLoad(EventArgs e) +404
       System.Web.UI.Control.LoadRecursive() +54
       System.Web.UI.Control.LoadRecursive() +145
       System.Web.UI.Control.LoadRecursive() +145
       System.Web.UI.Control.LoadRecursive() +145
       System.Web.UI.Control.LoadRecursive() +145
       System.Web.UI.Control.LoadRecursive() +145
       System.Web.UI.Control.LoadRecursive() +145
       System.Web.UI.Control.LoadRecursive() +145
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18034

     

    We have a small diagnostic script that shows the fields as follows:

    Datatype Downloadable Documents has invalid property XPathFilter.  Value '-1' failed XPathAttribute validator.
    Datatype Downloadable Documents has invalid property XPathFilterType.  Value 'False' failed IntAttribute validator.
    Datatype Downloadable Documents has invalid property StartNodeXPathExpression.  Value '0' failed XPathAttribute validator.
    Datatype Downloadable Documents has invalid property ControlHeight.  Value '/*[name()='Folder' or name()='Image']' failed IntAttribute validator.

    Id: 1042
    Name: Downloadable Documents
    TreeType: media
    XPathFilter: -1
    MaxNodeCount: 1
    ShowToolTip: 1
    StoreAsCommaDelimited: -1
    XPathFilterType: False
    StartNodeId: -1
    ShowThumbnails: -1
    StartNodeSelectionType:  
    StartNodeXPathExpressionType: 200
    StartNodeXPathExpression: 0  
    ControlHeight: /*[name()='Folder' or name()='Image']
    MinNodeCount: null 

    I can see what a massive pain working with these prevalues is, based on the fact you basically have nothing to work on barring the values.

    Having a look in the uSync logic for datatype prevalues it would appear that if the value for any of the new prevalues exists at all in the old values, then no new prevalue is inserted - this means that if a checkbox, radio button etc. has a value of 1, it will be ignored if there are any other prevalues at all with 1 as its value.  As the prevalues are sorted by sort order and then id, this causes the problems as described above.

    Have you any ideas about how to change this logic, or am i doing something massively stupid?  As I said above, I am really liking uSync & think that it can be an excellent approach to deployment.

     

  • Kevin Jump 2309 posts 14673 karma points MVP 7x c-trib
    May 15, 2013 @ 11:54
    Kevin Jump
    0

    no i don't think your doing anything stupid : ) 

    yes preValues are a real pain, and the MNTP is especially good, 

    because the prevalues are stored by ID and the ID's can be diffrent on each installation it's really hard to match. the true answer is put some GUIDs in the database so things can be synced across using them

    it's a bit more invasive than i wanted uSync to be when i set about developing it, but I am reluctantly coming to the conclusion its the way to go. thats my uSync 2.0 plan which i am just starting to look at now. 

    in the mean time, your post is a really good description of hte issue, and i am going to see if their is anything i can do to make it easier, it might mean a special bit of MNTP only code, but if it works...

    Kevin

     

  • Jonny Irwin 91 posts 153 karma points
    May 15, 2013 @ 12:01
    Jonny Irwin
    0

    Thanks very much Kevin!  I had thought about something like making another section in the usyncSettings.config file for datatypes that had a fixed number of prevalues that always appear in the same order, such as the MNTP.  That way you could be semi-sure that you could just overwrite the prevalues.  Node ids being stored as prevalues being a notable exception (though we try to avoid this wherever possible anyway).

    This obviously not being a great long term solution of course...

  • Kevin Jump 2309 posts 14673 karma points MVP 7x c-trib
    May 22, 2013 @ 15:20
    Kevin Jump
    0

    I've just released a new version 1.3.2 - which now does a like for like setting of pre-values for the MNTP 

    if the MNTP control already existis, it loads it up and gets the prevalues in order, then it loads the prevalues from the XML, and compares each one in order - if they are diffrent it sets the prevalue to the value in the XML file. 

    this is diffrent from the behavior for most DataTypes because it wouldn't be able to cope with new/deleted values but for the MNTP it works perfectly.

    a new config section has been added to config/usyncsettings.config to control this. 

    <MatchedPreValues>
      <add key="7e062c13-7c41-4ad9-b389-41d88aeef87c" value="Multi Node Tree Picker" />
    </MatchedPreValues>

    if a DataType ID is in this section then uSync will do a value by value match, at the moment MNTP is the only one i think needs this. 

     

Please Sign in or register to post replies

Write your reply to:

Draft