Copied to clipboard

Flag this post as spam?

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


  • Dan 7 posts 27 karma points
    Aug 26, 2011 @ 14:48
    Dan
    0

    DAMP 1.0 in custom page

    Hello,

    I've managed to add DAMP to a custom page by following the same code to add the TinyMCE control

      DataTypeDefinition dx = DataTypeDefinition.GetDataTypeDefinition(1134);
                this._mediaPicker = (umbraco.cms.businesslogic.datatype.AbstractDataEditorControl)dx.DataType.DataEditor;
                this.plcMedia.Controls.Add(_mediaPicker);

    but am unsure on how to access the properties exposed by the IMediaPicker interface in the source code.

    Any help much appreciated.

    Dan

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Aug 26, 2011 @ 14:57
    Jeroen Breuer
    0

    Hello,

    I really want to blog about adding DAMP to a custom page, but I didn't have the time for it yet. Here are some code samples which hopefully will help you.

    //Add the [Digibiz] Select single media item datatype to the  menu image placeholder.
    _dampMenuImageDataEditor = (DAMP_DataEditor)((AbstractDataEditorControl)dampSingleMediaItemIdDatatype.DataType.DataEditor).Control;
    _dampMenuImagePrevalueEditor = (DAMP_PrevalueEditor)dampSingleMediaItemIdDatatype.DataType.PrevalueEditor;
    _dampMenuImageDataEditor.Load += new EventHandler(DampMenuImageDataEditor_Load);
    PlaceHolderMenuImage.Controls.Add(_dampMenuImageDataEditor);
    protected void DampMenuImageDataEditor_Load(object sender, EventArgs e)
    {
        int minimumNodesValue = _dampMenuImagePrevalueEditor.MinimumNodesValue;
        int maximumNodesValue = _dampMenuImagePrevalueEditor.MaximumNodesValue;
    
        //Set value from the database in the [Digibiz] Select single media item datatype.
        _dampMenuImageDataEditor.Value = MenuImageValue;
    
        //Set the validation values.
        _dampMenuImageDataEditor.CheckValidation = CheckActive.Checked;
        _dampMenuImageDataEditor.Mandatory = CheckActive.Checked;
        _dampMenuImageDataEditor.MandatoryText = "The  menu image in the  tab needs a media item";
    }

    Remember that if you store your data as media xml the values don't get updated automatically if you change the media item in the media section. It's best to only store the id in the custom section unless you want to write a custom event which updates the media xml.

    Jeroen

  • Dan 7 posts 27 karma points
    Aug 26, 2011 @ 15:00
    Dan
    0

    Many thanks for the quick reply, I'll let you know how I get on with your examples.

  • Dan 7 posts 27 karma points
    Aug 26, 2011 @ 16:13
    Dan
    0

    Ok, I'm up and running.

    It made me feel better that I was just a step away.

    DataTypeDefinition dx =DataTypeDefinition.GetDataTypeDefinition(1134);
               
    this._mediaPicker =(umbraco.cms.businesslogic.datatype.AbstractDataEditorControl)dx.DataType.DataEditor;
    this._dataEditor = (DigibizAdvancedMediaPicker.DAMP_DataEditor)this._mediaPicker.Control;
               
    this.plcMedia.Controls.Add(_dataEditor);

    Thanks again for the help.

  • Kenny Burns 173 posts 304 karma points
    Apr 22, 2013 @ 19:42
    Kenny Burns
    0

    Hi Jeroen,

    I have a DAMP control added to a custom usercontrol but can't seem to set the thumbnail width and height when the control first loads (page load). I have the following in my user control - am I missing something?

    Thanks

    Kenny

     

     _dampMenuImageDataEditor = (DAMP_DataEditor)((AbstractDataEditorControl)dampSingleMediaItemIdDatatype.DataType.DataEditor).Control;
    _dampMenuImagePrevalueEditor = (DAMP_PrevalueEditor)dampSingleMediaItemIdDatatype.DataType.PrevalueEditor;
     _dampMenuImageDataEditor.Load += new EventHandler(DampMenuImageDataEditor_Load);
    phDamp.Controls.Add(_dampMenuImageDataEditor);  
     
     protected void DampMenuImageDataEditor_Load(object sender, EventArgs e)
            {
                int minimumNodesValue = _dampMenuImagePrevalueEditor.MinimumNodesValue;
                int maximumNodesValue = _dampMenuImagePrevalueEditor.MaximumNodesValue;
                _dampMenuImageDataEditor.ThumbnailHeightValue = 100;
                _dampMenuImageDataEditor.ThumbnailWidthValue = 78;       
            }  

     

  • Ajmal 19 posts 51 karma points
    Sep 17, 2013 @ 13:55
    Ajmal
    0

    I am tryng to add DAMP in custom section of umbaraco 6.1.4 installation. The damp control is successfully rendered. but it is not working because the the javascript files needed for DAMP is not included. Can someone help specifcally which all javascript files needed for the damp to work ?

    Thanks

    Ajmal

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Sep 17, 2013 @ 14:15
    Jeroen Breuer
    0

    The javascript/css files are added with ClientDependency. See here: https://damp.codeplex.com/SourceControl/latest#DigibizAdvanceMediaPicker/DigibizAdvancedMediaPicker.ascx

    <%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
    <umb:CssInclude ID="CssIncludeDamp" runat="server" FilePath="plugins/DigibizAdvancedMediaPicker/DampStyles.css" PathNameAlias="UmbracoRoot" />
    <umb:JsInclude ID="JsIncludeDamp" runat="server" FilePath="plugins/DigibizAdvancedMediaPicker/DAMPScript.js" PathNameAlias="UmbracoRoot" />

    Jeroen

  • Ajmal 19 posts 51 karma points
    Sep 17, 2013 @ 14:52
    Ajmal
    0

    Hi Jeroen,

    I got your point, all the javascript and styles for the DAMP control is included in the usercontrol itself. But when clicked the choose link i can see this error in the console:  Uncaught ReferenceError: UmbClientMgr is not defined .

    I guess I need to refer some javascript/css files that comes with umbraco in my custom page. Any help ?

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Sep 17, 2013 @ 15:00
    Jeroen Breuer
    0

    You need to make sure your custom page inherits from the correct masterpage:

    <%@ Page Language="c#" MasterPageFile="/umbraco/masterpages/umbracoPage.Master" Title="Product details" AutoEventWireup="true" CodeBehind="Details.aspx.cs" Inherits="Sections.Products.Details" ValidateRequest="false" %>

    Than the UmbClientMgr should be available.

    Jeroen

Please Sign in or register to post replies

Write your reply to:

Draft