General XMetaL Discussion
XMetaL Community Forum › General XMetaL Discussion › Getting CRCL Resource locator from file path
-
markposton July 30, 2010 at 11:15 am
Getting CRCL Resource locator from file path
July 30, 2010 at 11:15 amParticipants 2Replies 3Last Activity 12 years, 6 months agoHi,
I am wanting to get the CMS locator for the active document.
I am trying this:
repoService.getCRCLLocator(ActiveDocument.Name);
but I seem to get an empty response back.
Is this the correct method to use?
Regards
markmurray August 3, 2010 at 9:03 pm
Reply to: Getting CRCL Resource locator from file path
August 3, 2010 at 9:03 pmI believe you can use:
Application.ActiveDocument.CRLocator
If it is null, the document was opened from the file system, if it is not null the document was opend from the repository and it contains the CRCL Resource Locator.
markposton August 4, 2010 at 1:56 pm
Reply to: Getting CRCL Resource locator from file path
August 4, 2010 at 1:56 pmThanks for the tip.
I get returned back an object but can't see how to get the actual locator. The Programmer's guide has nothing documented except that it's an internal use only property.
The only examples I can find of this in the JS code in XMetaL is:
CRLocator.CRinstanceID which returns an integer, and
CRLocator.resourceId which returns the path to the active doc, not the CMS locator.There seems to be some other methods to get the locator from the file path but not sure how to use these either.
The reason I want to do this is to provide some functionality to return metadata from the CMS for the active doc. I therefore need to send a request back into my CMS to get this metadata.
Cheers
Mark
murray August 4, 2010 at 8:06 pm
Reply to: Getting CRCL Resource locator from file path
August 4, 2010 at 8:06 pmThe following code works for me. Note that it will do nothing if the file was opened from the file system because Application.ActiveDocument.CRLocator will be null. However if the file was opened from the repository it should display the repository id of the active document.
// XMetaL Script Language JSCRIPT:
if( Application.ActiveDocument.CRLocator )
{
Application.Alert( Application.ActiveDocument.CRLocator.resourceID );
} -
AuthorPosts
- You must be logged in to reply to this topic.