Browse for Content Item Control in 6.7

I’m looking to build a custom editor control that will allow a user to browse for a content item and store the content ID (and maybe the template id, site id or folder id) in the backing repository DB field. I’m trying to implement this in order to keep all the relationship building in one editor window without making the user drop into Active Assembly or the AA Table Editor.

I think I’ve figured out the basic javascript that would be required. This code should pull up a 6.7 content browser dialog and allow me to select an item without linking to an AA slot, then print the content id to the screen. I’ll eventually wrap all this with a control type implementation in rx_Templates.xsl.


/**
 * Global variables needed for the browse dialog
 */
var ___cBackFunction = null;
var ___slotId = null;
var ___bws = null;
var ___bwsMode = ps.util.BROWSE_MODE_RTE_INLINE;
var __rxroot = "/Rhythmyx";

var myContentId = 123; /* this is the content id of the item launching the browse window */
var mySlotId = 456; /* this is the slot id which will control the available content types and templates.. should be an INLINE slot. */

var response = ps.io.Actions.getContentTypeByContentId(myContentId);
if(response.isSuccess())
{
  var cType = response.getValue().sys_contenttypeid;
  ___slotId ='["1","' + myContentId + '",null,null,null,null,null,"' 
	   + cType + '",null,"' + slotid + '",null,null,null,null,null]';
  ___cBackFunction = function(snippetId) {

    /* Replace this with code to store the Content ID in the target input field. */
    alert(snippetId.getContentId());

  };
  ___bws = window.open(ps.util.CONTENT_BROWSE_URL, "contentBrowerDialog",
	   "resizable=1;status=0,toolbar=0,scrollbars=0,menubar=0,location=0,directories=0,width=750,height=500"); 
}

Has anyone tried anything similar? Or, does anyone have a completed control implementation that accomplishes this?

I was having trouble attaching files so had to put it all in here. Here is the sample control.


<!-- 
     rx_SearchImagesBox
      -->
<psxctl:ControlMeta name="rx_SearchImagesBox" dimension="single" choiceset="none">
<psxctl:Description>The standard control for editing text:  an <input type="text"> tag.</psxctl:Description>
<psxctl:ParamList>
   <psxctl:Param name="id" datatype="String" paramtype="generic">
      <psxctl:Description>This parameter assigns a name to an element. This name must be unique in a document.</psxctl:Description>
   </psxctl:Param>
   <psxctl:Param name="class" datatype="String" paramtype="generic">
      <psxctl:Description>This parameter assigns a class name or set of class names to an element. Any number of elements may be assigned the same class name or names. Multiple class names must be separated by white space characters.  The default value is "datadisplay".</psxctl:Description>
      <psxctl:DefaultValue>datadisplay</psxctl:DefaultValue>
   </psxctl:Param>
   <psxctl:Param name="style" datatype="String" paramtype="generic">
      <psxctl:Description>This parameter specifies style information for the current element. The syntax of the value of the style attribute is determined by the default style sheet language.</psxctl:Description>
   </psxctl:Param>
   <psxctl:Param name="size" datatype="Number" paramtype="generic">
      <psxctl:Description>This parameter tells the user agent the initial width of the control. The width is given in number of characters.  The default value is 50.</psxctl:Description>      
      <psxctl:DefaultValue>10</psxctl:DefaultValue>
   </psxctl:Param>
   <psxctl:Param name="maxlength" datatype="Number" paramtype="generic">
      <psxctl:Description>This parameter specifies the maximum number of characters the user may enter. This number may exceed the specified size, in which case the user agent should offer a scrolling mechanism. The default value for This parameter is an unlimited number.</psxctl:Description>
   </psxctl:Param>
   <psxctl:Param name="tabindex" datatype="Number" paramtype="generic">
      <psxctl:Description>This parameter specifies the position of the current element in the tabbing order for the current document. This value must be a number between 0 and 32767.</psxctl:Description>
   </psxctl:Param>
   <psxctl:Param name="src" datatype="String" paramtype="img">
            <psxctl:Description>This parameter specifies the location of the image resource used for the calendar picker icon. The default value is "../sys_resources/images/cal.gif"</psxctl:Description>
            <psxctl:DefaultValue>../sys_resources/images/ewebeditpro/image.gif</psxctl:DefaultValue>
         </psxctl:Param>

   <psxctl:Param name="InlineImageSlot" datatype="String" paramtype="generic">
   <psxctl:Description>This parameter specifies the id of inline image slot. The inline search dialog box shows the content types that have at least one variant added to the inline image slot. The default value is system inline image slotid 104.</psxctl:Description>
   <psxctl:DefaultValue>103</psxctl:DefaultValue>
   </psxctl:Param>         
  
   <psxctl:Param name="related" datatype="String" paramtype="custom">.
            <psxctl:Description>The presence of this parameter will produce a help image that selects the literal value of the parameter.  This text populates both the alt text attribute as well as text in a pop-up window.</psxctl:Description>
         </psxctl:Param>
          <psxctl:Param name="formname" datatype="String" paramtype="jscript">
            <psxctl:Description>This parameter specifies the name of the form that contains this control. It is used by the calendar's JavaScript. The default value is "EditForm"</psxctl:Description>
            <psxctl:DefaultValue>EditForm</psxctl:DefaultValue>
         </psxctl:Param>
	        
         <psxctl:Param name="searchURL" datatype="String" paramtype="string">
            <psxctl:Description>This parameter specifies the html page that will contain the character map.  It defaults to a page containing a set amount of characters.  If the characters need to be limited to a certain set, make a copy of the file, rename it, strip out the desired characters, and pass a parameter that points to the new page.</psxctl:Description>
            <psxctl:DefaultValue>/Rhythmyx/ui/content/ContentBrowserDialog.jsp</psxctl:DefaultValue>
   </psxctl:Param>
             <psxctl:Param name="help" datatype="String" paramtype="generic">
    	 		   	 <psxctl:Description>This parameter specifies the help text</psxctl:Description>
    	 		   	 <psxctl:DefaultValue></psxctl:DefaultValue>
	 </psxctl:Param>
</psxctl:ParamList>

<psxctl:AssociatedFileList>
	<psxctl:FileDescriptor name="dojo.js" type="script" mimetype="text/javascript">
			            <psxctl:FileLocation>../sys_resources/dojo/dojo.js</psxctl:FileLocation>
			            <psxctl:Timestamp/>
         </psxctl:FileDescriptor>
         <psxctl:FileDescriptor name="relatedsearchlink.js" type="script" mimetype="text/javascript">
            <psxctl:FileLocation>../rx_resources/js/imagesearchlink.js</psxctl:FileLocation>
            <psxctl:Timestamp/>
         </psxctl:FileDescriptor>
      </psxctl:AssociatedFileList>

</psxctl:ControlMeta>

   <!-- read only template for rx_SearchImagesBox-->
   <xsl:template match="Control[@name='rx_SearchImagesBox' and @isReadOnly='yes']" priority="10" mode="psxcontrol">
   			<xsl:variable name="path" select="Value"/>
   			
			<xsl:choose>
				<xsl:when test="(string-length($path) = 0)">None</xsl:when>
				<xsl:otherwise>				
			
						<img>
								<xsl:attribute name="src"><xsl:value-of select="$path"/></xsl:attribute>
								</img>
					
					
				</xsl:otherwise>	
			</xsl:choose>
   </xsl:template>    

<xsl:template match="Control[@name='rx_SearchImagesBox' and @isReadOnly='no']" mode="psxcontrol">


   <input type="text" name="{@paramName}" value="{Value}">
   <xsl:if test="@accessKey!=''">
     				<xsl:attribute name="accesskey"><xsl:call-template name="getaccesskey"><xsl:with-param name="label" select="preceding-sibling::DisplayLabel"/><xsl:with-param name="sourceType" select="preceding-sibling::DisplayLabel/@sourceType"/><xsl:with-param name="paramName" select="@paramName"/><xsl:with-param name="accessKey" select="@accessKey"/></xsl:call-template></xsl:attribute>
  			</xsl:if>
 <xsl:call-template name="rx_parametersToAttributes">
   				<xsl:with-param name="controlClassName" select="'rx_EditBox'"/>
   				<xsl:with-param name="paraName" select="@paramName"/>
   				<xsl:with-param name="controlNode" select="."/>
  			</xsl:call-template>
   </input>
   <xsl:variable name="apos" select='"'"'/>
   <xsl:variable name="amp" select='"&"'/>   
   <xsl:variable name="formname">
         <xsl:choose>
            <xsl:when test="ParamList/Param[@name='formname']">
               <xsl:value-of select="ParamList/Param[@name='formname']"/>
            </xsl:when>
            <xsl:otherwise>
               <xsl:value-of select="document('')/*/psxctl:ControlMeta[@name='rx_SearchImagesBox']/psxctl:ParamList/psxctl:Param[@name='formname']/psxctl:DefaultValue"/>
            </xsl:otherwise>
         </xsl:choose>
      </xsl:variable>
      <xsl:variable name="searchURL">
         <xsl:choose>
            <xsl:when test="ParamList/Param[@name='searchURL']">
               <xsl:value-of select="ParamList/Param[@name='searchURL']"/>
            </xsl:when>
            <xsl:otherwise>
               <xsl:value-of select="document('')/*/psxctl:ControlMeta[@name='rx_SearchImagesBox']/psxctl:ParamList/psxctl:Param[@name='searchURL']/psxctl:DefaultValue"/>
            </xsl:otherwise>
         </xsl:choose>
      </xsl:variable>

      <xsl:variable name="InlineImageSlot">
         <xsl:choose>
            <xsl:when test="ParamList/Param[@name='InlineImageSlot']">
               <xsl:value-of select="ParamList/Param[@name='InlineImageSlot']"/>
            </xsl:when>
            <xsl:otherwise>
               <xsl:value-of select="document('')/*/psxctl:ControlMeta[@name='rx_SearchImagesBox']/psxctl:ParamList/psxctl:Param[@name='InlineImageSlot']/psxctl:DefaultValue"/>
            </xsl:otherwise>
         </xsl:choose>
      </xsl:variable>
       <xsl:variable name="name">
         <xsl:value-of select="@paramName"/>
      </xsl:variable>
 
<a href="#">
         
         <xsl:attribute name="onclick"><xsl:text>control_type = 'image_path';</xsl:text><xsl:value-of select="concat('createSearchBox(document.',$formname,'.',$name,',',$apos,$InlineImageSlot,$apos,')')"/></xsl:attribute>
         <img border="0" src="../rx_resources/ephox/images/image.gif" align="middle" alt="Search for Image">
            <xsl:call-template name="parametersToAttributes">
               <xsl:with-param name="controlClassName" select="'rx_SearchImagesBox'"/>
               <xsl:with-param name="controlNode" select="."/>
               <xsl:with-param name="paramType" select="."/>
            </xsl:call-template>
         </img>
      </a>
         
       <div style="margin:5px;">  
         <xsl:variable name="path" select="Value"/>
	    			
	 			<xsl:choose>
	 				<xsl:when test="(string-length($path) = 0)">None</xsl:when>
	 				<xsl:otherwise>				
	 			
	 						<img>
								<xsl:attribute name="src"><xsl:value-of select="$path"/></xsl:attribute>
								</img>
	 					
	 					
	 				</xsl:otherwise>	
			</xsl:choose>
	</div>
</xsl:template>

Here is the sample javascript


/**
 * This file holds the functions for the cusomt search button on the question answer image control.
 */

/**
 * Constant: Holds url for search page.  Called by child popup pages.
 */
var INLINE_SEARCH_PAGE = "../sys_searchSupport/getQuery.html?";

var CONTENT_BROWSE_URL = "../ui/content/ContentBrowserDialog.jsp";

/**
 * Constant: Holds url for return page.  Called by child popup pages.
 */
var INLINE_RETURN_PAGE =  "../sys_searchSupport/getResults.html?";

/**
 * Constant: Holds url for EditLive help directory.
 */
var HELP_DIR =  "../rx_resources/ephox/enduserhelp/";




 /**
  * Global variables needed for the browse dialog
  */
 var ___cBackFunction = null;
 var ___slotId = null;
 var ___bws = null;
 var ___bwsMode = null;
 var __rxroot = "/Rhythmyx"; 
 var ___serverProperties = null;
 var ___selectedContent = null;
 



/**
 * A flag indicating, whether or not the current browser type is Netscape. 
 * <code>true</code> if Netscape, false otherwise.
 */
var isNav = false;

/**
 * A flag indicating, whether or not the current browser type is Internet Explorer. 
 * <code>true</code> if Internet Explorer, false otherwise.
 */
var isIE  = false;

/**
 * A flag indicating, whether or not the OS is Macintosh. 
 * <code>true</code> if Macintosh, false otherwise.
 */
var isMac = false;

/**
 * Constant replacement for href attribute.
 */
 var PERC_HREF_ATTR = "___perchref";

/**
 * Constant replacement for src attribute.
 */
 var PERC_SRC_ATTR = "___percsrc";

/**
 * Check the browser and set appropriate member field.  
 * Assume Netscape or IE only.
 */
if (navigator.appName == "Netscape") 
{
   isNav = true;
}
else
{
   isIE = true;
}

/**
 * Check the OS and set appropriate member field.  Note: We will need this 
 * in next upgrade.
 */
if (navigator.platform == "MacPPC")
{
   isMac = true;
}
 

function trim(str)
{
   return str.replace(/^\s+|\s+$/g,"");
}

/**
 * Data Object.  Holds property values written to maintain state.
 */
var dataObject = new Object();
dataObject.returnedValue = "";
dataObject.sEditorName = "";
dataObject.wepSelectedText = "";
dataObject.searchType = "";
dataObject.windowRef = "";
dataObject.editorObject = ""; 
var putfield = new Object();


/**
* The array of all editors on the page.  There will be one entry per editor...
*
*  var editor = new Object();
*  editor.objectref = eopObject
*  editor.name = field name
*  editor.inlineLinkSlot = "";
*  editor.inlineImageSlot = "";
*  editor.inlineVariantSlot = ""; 
* 
*/
var _rxAllEditors = new Array();


/** 
* CMS Link function 
* 
*/

/**
 * Creates CMS search box for inline links and CMS Image creation:
 */
function createSearchBox(fieldObj,inlineslotid) 
{
     
   putfield = fieldObj;
   dataObject.slotid = inlineslotid; 
   launchSearchBox();
    
   
}

function launchSearchBox()
{
  
   
      var inlineslotid = dataObject.slotid;
         var ctypeid = document.forms["EditForm"].sys_contenttypeid.value;
      ___slotId ='["1",null,null,null,null,null,null,"' 
	      + ctypeid + '",null,"' 
	      + inlineslotid + '",null,null,null,null,null]';
      ___cBackFunction = contentBrowserCallback;
      ___bws = window.open(CONTENT_BROWSE_URL, "contentBrowerDialog",
		     "resizable=1;status=0,toolbar=0,scrollbars=0,menubar=0,location=0,directories=0,width=750,height=500");   

 
   
}

/**
 * callback function called by the browse dialog to handle
 * adding the selected content to EditLive at the cursor selection.
 */

function contentBrowserCallback(objectId)
{
   var oId = new ps.aa.ObjectId(objectId.toString());
   var buff = "";
   
	var response = 	 ps.io.Actions.getSnippetContent(oId, false, ___selectedContent);
	if(response.isSuccess())
      {
        var theContent = unicode2entity(response.getValue());
        var tagstart = theContent.indexOf("<") + 1;
        var tagend = minIgnoreNegative(
           theContent.indexOf(">", tagstart),
           theContent.indexOf(" ", tagstart));
            
        var prefix = theContent.substring(theContent.indexOf("src=")+5,theContent.indexOf(">")-2);
  
        buff = prefix;
        }
      else
      {
         ps.io.Actions.maybeReportActionError(response);
         return;
      }

	 
   formatOutput(putfield,buff);
   ___bws.close();
}

function stringtrim(str)
{
   return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}

function launchLegacySearchBox()
   {
   var inlineslotid = dataObject.slotid;
  
   //Update the inlinelinksearch form elements
   document.inlinelinkssearch.action = INLINE_SEARCH_PAGE;
  
   document.inlinelinkssearch.inlineslotid.value = inlineslotid;
   document.inlinelinkssearch.inlinetype.value = dataObject.searchType;
   //Open an empty window.
   var w = "";
   if(isNav)
   {
      dataObject.windowRef = window.open("", "searchitems", 
      "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1," + 
      "resizable=1,width=400,height=400,screenX=220,screenY=220");
   } 
   else
   {
      dataObject.windowRef =  window.open("", "searchitems", 
      "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1," + 
      "resizable=1,width=400,height=400, left=220, top=220");
   }   
   //Submit the inlinelinksearch form to this window
   document.inlinelinkssearch.submit();

   dataObject.windowRef.focus();
   
  
}

// Converts unicode chars into the hexidecimal reference
// entity
function unicode2entity(str)
{
   var sPos = 0;
   var ePos = -1;
   var result = "";

   while((sPos = str.indexOf("%u", sPos)) != -1)
   {
      if(ePos == -1)
      {
          ePos = 0;
          result += str.substring(ePos, sPos);
      }
      else if(sPos - ePos > 0)
      {
          result += str.substring(ePos + 1, sPos);
      }
      result += "&#x" + str.substr(sPos + 2, 4) + ";";
      sPos += 5;
      ePos = sPos;

   } 
   result += str.substring(ePos + 1);

   return result;
}
            
          
function encodeAmpersand(urlstring)
{
   var re = new RegExp("&","g");
   urlstring = urlstring.replace(re,"&");
   var re1 = new RegExp("&","g");
   urlstring = urlstring.replace(re1,"&");
   return urlstring;
}


/**
 * Formats the output then pastes into the control.
 * Netscape 4.7 & 6.23 compliant.  
 * @param returnedHTML is a string and can be <code>null</code>
 */
function formatOutput(fieldObj,returnedHTML)
{   
   dataObject.searchType = "";
  
     putfield.value = returnedHTML;
     putfield.focus();
}


function minIgnoreNegative(a, b)
{
   if(a == -1)
      return b;
   if(b == -1)
      return a;
   return Math.min(a,b);
}

/**
 * Determines if tag is a block tag.
 * @param tagname cannot be <code>null</code> or empty.
 * @return <code>true</code> if a block tag.
 */
 function isBlockTag(tagname)
 {
    if(tagname == null || tagname.length == 0)
       alert("tagname cannot be null or empty.");
    var len = ___blockTags.length;
    for(i = 0; i < len; i++)
    {
       if(___blockTags[i].toLowerCase() == tagname.toLowerCase())
          return true;
    }
      return false;
 }


/**
 * Clean up dataObject.  Set all properties to "" for the next call. 
 */
function cleanUp()
{
   dataObject.returnedValue = "";
   dataObject.sEditorName = "";
   dataObject.wepSelectedText = "";
   dataObject.searchType = "";
   dataObject.windowRef = "";

}


Thanks! I’ll try to implement this on my server and see how it looks.

Thank you, Sharyn. This code was very helpful. I did a little tweaking and a little cleanup and produced a version that meets my own needs.

For anyone else interested here’s the control code I wound up with… It’s essentially the same as Sharyn’s, but without unreachable artifact code, and instead of storing the result of a template, it stores the content id and template id (and site and folder id if you’ve selected to in the browser window) in JSON code.

Stored values will look like this:
{“contentid”:123,“templateid”:456,“siteid”:789,“folderid”:345}

Combine this with the JSONtools I posted previously, and you can treat each link as a complex data object in your template, and load whatever data you need from it.

This version also used jQuery to traverse the form elements and DOM. And to display the output of the selected template in a preview div.

To use:
By default, this control allows linking to items that would normally be available in the system inline_link_slot (slot id 103). If you wish to link to items available in a different slot, select “All Properties” for the control and enter the slot id of your inline slot for the “inlineSlot” parameter.

After that, it’s just a matter of parsing and utilizing the data within your templates.

File linklookup.js:


/**
 * This file holds the functions for the custom search button on the question answer image control.
 */

/**
 * Global variables needed for the browse dialog
 */
var ___cBackFunction = null;
var ___slotId = null;
var ___bws = null;
var ___bwsMode = null;
var __rxroot = "/Rhythmyx";
var ___serverProperties = null;
var ___selectedContent = null;


/**
 * Creates CMS search box for inline links and CMS Image creation:
 */
function launchLinkSearchBox( fieldObj, inlineslotid )
{
    // create local variable so it can be referenced by the callback.
    var field = fieldObj;
    var ctypeid = document.forms["EditForm"].sys_contenttypeid.value;

    ___slotId ='["1",null,null,null,null,null,null,"'
            + ctypeid + '",null,"' + inlineslotid + '",null,null,null,null,null]';
    ___cBackFunction = function(objectId) {
        var oId = new ps.aa.ObjectId(objectId.toString());
        var buff = '{"contentid":' + oId.getContentId() + ',"templateid":' + oId.getTemplateId();
        if( oId.getSiteId() != null ) {
            buff += ',"siteid":' + oId.getSiteId();
        }
        if( oId.getFolderId() != null ) {
            buff += ',"folderid":' + oId.getFolderId();
        }
        buff += '}';

        field.value = buff;

        ___bws.close();
        displayLinkPreview(jQuery(field).siblings('.rx_LinkLookup_preview'),buff);
    };

    ___bwsMode = ps.util.BROWSE_MODE_RTE_INLINE;
    ___bws = window.open(ps.util.CONTENT_BROWSE_URL, "contentBrowerDialog",
            "resizable=1;status=0,toolbar=0,scrollbars=0,menubar=0,location=0,directories=0,width=750,height=500");
}

function displayLinkPreview( dom, obj )
{
    var o = eval('('+obj+')');
    var sid = o.siteid != undefined ? o.siteid : 'null';
    var fid = o.folderid != undefined ? o.folderid : 'null';
    var objId = new ps.aa.ObjectId('["1",'+ o.contentid +','+ o.templateid +','+ sid +','+ fid
            +',null,null,null,null,null,null,null,null,null,null]');
    var response = ps.io.Actions.getSnippetContent(objId, false, "");
    if(response.isSuccess())
    {
        jQuery(dom).html(unicode2entity(response.getValue()));
    }
    else
    {
        ps.io.Actions.maybeReportActionError(response);
    }
}

// Converts unicode chars into the hexidecimal reference
// entity
function unicode2entity(str)
{
    var sPos = 0;
    var ePos = -1;
    var result = "";

    while((sPos = str.indexOf("%u", sPos)) != -1)
    {
        if(ePos == -1)
        {
            ePos = 0;
            result += str.substring(ePos, sPos);
        }
        else if(sPos - ePos > 0)
        {
            result += str.substring(ePos + 1, sPos);
        }
        result += "&#x" + str.substr(sPos + 2, 4) + ";";
        sPos += 5;
        ePos = sPos;

    }
    result += str.substring(ePos + 1);

    return result;
}

function minIgnoreNegative(a, b)
{
    if(a == -1)
        return b;
    if(b == -1)
        return a;
    return Math.min(a,b);
}

Excerpt from file rx_Templates.xsl:


  <!-- 
    rx_LinkLookup
  -->
  <psxctl:ControlMeta name="rx_LinkLookup" dimension="single" choiceset="none">
    <psxctl:Description>Opens a link browser dialog to link a content item without using the Active Assembly interface.</psxctl:Description>
    <psxctl:ParamList>
      <psxctl:Param name="id" datatype="String" paramtype="generic">
        <psxctl:Description>This parameter assigns a name to an element. This name must be unique in a document.</psxctl:Description>
      </psxctl:Param>
      <psxctl:Param name="class" datatype="String" paramtype="generic">
        <psxctl:Description>This parameter assigns a class name or set of class names to an element. Any number of elements may be assigned the same class name or names. Multiple class names must be separated by white space characters.  The default value is "datadisplay".</psxctl:Description>
        <psxctl:DefaultValue>datadisplay</psxctl:DefaultValue>
      </psxctl:Param>
      <psxctl:Param name="style" datatype="String" paramtype="generic">
        <psxctl:Description>This parameter specifies style information for the current element. The syntax of the value of the style attribute is determined by the default style sheet language.</psxctl:Description>
      </psxctl:Param>
      <psxctl:Param name="tabindex" datatype="Number" paramtype="generic">
        <psxctl:Description>This parameter specifies the position of the current element in the tabbing order for the current document. This value must be a number between 0 and 32767.</psxctl:Description>
      </psxctl:Param>
      <psxctl:Param name="inlineSlot" datatype="String" paramtype="generic">
        <psxctl:Description>This parameter specifies the id of inline slot. The inline search dialog box shows the content types that have at least one variant added to the inline slot. The default value is system inline image slotid 104.</psxctl:Description>
        <psxctl:DefaultValue>104</psxctl:DefaultValue>
      </psxctl:Param>         
      <psxctl:Param name="formname" datatype="String" paramtype="jscript">
        <psxctl:Description>This parameter specifies the name of the form that contains this control. It is used by the link control's JavaScript. The default value is "EditForm". Values other than EditForm may produce unreliable results.</psxctl:Description>
        <psxctl:DefaultValue>EditForm</psxctl:DefaultValue>
      </psxctl:Param>
    </psxctl:ParamList>
    
    <psxctl:AssociatedFileList>
      <psxctl:FileDescriptor name="dojo.js" type="script" mimetype="text/javascript">
        <psxctl:FileLocation>../sys_resources/dojo/dojo.js</psxctl:FileLocation>
        <psxctl:Timestamp/>
      </psxctl:FileDescriptor>
      <psxctl:FileDescriptor name="linkLookup.js" type="script" mimetype="text/javascript">
        <psxctl:FileLocation>../rx_resources/js/linkLookup.js</psxctl:FileLocation>
        <psxctl:Timestamp/>
      </psxctl:FileDescriptor>
    </psxctl:AssociatedFileList>
    
  </psxctl:ControlMeta>
  
  <!-- read only template for rx_LinkLookup-->
  <xsl:template match="Control[@name='rx_LinkLookup' and @isReadOnly='yes']" priority="10" mode="psxcontrol">
    <input type="hidden" name="{@paramName}" value="{Value}"/>
    <xsl:choose>
      <xsl:when test="(string-length(Value) = 0)">None</xsl:when>
      <xsl:otherwise>				
        <script type="text/javascript">jQuery(function(){displayLinkPreview(jQuery(<xsl:value-of select="concat('document.',$formname,'.',$name)"/>).siblings('.rx_LinkLookup_preview'),'<xsl:value-of select="Value"/>');});</script>
      </xsl:otherwise>	
    </xsl:choose>
  </xsl:template>    
  
  <xsl:template match="Control[@name='rx_LinkLookup' and @isReadOnly='no']" mode="psxcontrol">
    
    
    <input type="hidden" name="{@paramName}" value="{Value}">
      <xsl:if test="@accessKey!=''">
        <xsl:attribute name="accesskey">
          <xsl:call-template name="getaccesskey">
            <xsl:with-param name="label" select="preceding-sibling::DisplayLabel"/>
            <xsl:with-param name="sourceType" select="preceding-sibling::DisplayLabel/@sourceType"/>
            <xsl:with-param name="paramName" select="@paramName"/>
            <xsl:with-param name="accessKey" select="@accessKey"/>
          </xsl:call-template></xsl:attribute>
      </xsl:if>
      <xsl:call-template name="parametersToAttributes">
        <xsl:with-param name="controlClassName" select="'rx_EditBox'"/>
        <xsl:with-param name="controlNode" select="."/>
      </xsl:call-template>
    </input>
    <xsl:variable name="apos" select='"'"'/>
    <xsl:variable name="amp" select='"&"'/>   
    <xsl:variable name="formname">
      <xsl:choose>
        <xsl:when test="ParamList/Param[@name='formname']">
          <xsl:value-of select="ParamList/Param[@name='formname']"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="document('')/*/psxctl:ControlMeta[@name='rx_LinkLookup']/psxctl:ParamList/psxctl:Param[@name='formname']/psxctl:DefaultValue"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    
    <xsl:variable name="InlineImageSlot">
      <xsl:choose>
        <xsl:when test="ParamList/Param[@name='inlineSlot']">
          <xsl:value-of select="ParamList/Param[@name='inlineSlot']"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="document('')/*/psxctl:ControlMeta[@name='rx_LinkLookup']/psxctl:ParamList/psxctl:Param[@name='inlineSlot']/psxctl:DefaultValue"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="name">
      <xsl:value-of select="@paramName"/>
    </xsl:variable>
    
    <a href="#">
      <xsl:attribute name="onclick">
        <xsl:value-of select="concat('launchLinkSearchBox(document.',$formname,'.',$name,',',$apos,$InlineImageSlot,$apos,');')"/>
      </xsl:attribute>
      <xsl:text>Search</xsl:text>
    </a>
    
    <xsl:if test="string-length(Value) > 0">
      <xsl:text disable-output-escaping="yes"> &nbsp; </xsl:text>
      <a href="#">
        <xsl:attribute name="onclick">
          <xsl:value-of select="concat('document.',$formname,'.',$name,'.value=',$apos,$apos)"/>
          <xsl:text>;jQuery(this).siblings('.rx_LinkLookup_preview').html('None');</xsl:text>
        </xsl:attribute>
        <xsl:text>Clear</xsl:text>
      </a>
    </xsl:if>
    
    <div class="rx_LinkLookup_preview" style="margin:5px;">  
      <xsl:choose>
        <xsl:when test="(string-length(Value) = 0)">None</xsl:when>
        <xsl:otherwise>				
          <script type="text/javascript">jQuery(function(){displayLinkPreview(jQuery(<xsl:value-of select="concat('document.',$formname,'.',$name)"/>).siblings('.rx_LinkLookup_preview'),'<xsl:value-of select="Value"/>');});</script>
        </xsl:otherwise>	
      </xsl:choose>
    </div>
  </xsl:template>

  1. What would be the code if I want to have the full path of the content item to be returned. By path I mean what shows up in the textbox labelled “Path:” in the content browser window that popups up.

  2. Additionally, I would like to access a property of the content item selected. Hence for the image content type, i may need the ‘filename’ property.
    My goal is to return a string like this when the user has navigated through the inline content browser and selected an image content item:
    //[mysite]/Articles/images/image1.jpg

  3. Also, where is the documentation for all the javascript api I can call ? Where is documentation for these ?:


var oId = new ps.aa.ObjectId(objectId.toString());

and


var response = ps.io.Actions.getSnippetContent(objId, false, "");

Any help is appreciated.