I'm writing an SDL Tridion Anguilla extension and need to pull a config component using a webdav url. The config also has a set of webdav urls and I need to fetch item Objects for these.
Frank - May be I ate a few words in my question.. I'm writing a CMS GUI extension and writing javascript. So is there something like $models.getItem(); which gives me the component or xml of the component?
In most Tridion Content Manager APIs you can read an item by either its TCM URI or its WebDAV URL.
So if you're using the Core Service, you can simply do:
var item = client.Read(webdavURL, null);
Then you can iterate over the fields (if you're using the Core Service this Fields helper class will come in handy) and do the same for each value in there.
If you need to have the mapping available to the client, you'll need to create a custom web service to make it available. Although not trivial at first, creating a WCF service is not as daunting as some people make it out to be. Especially not when you start with this example of a minimal WCF service for Tridion.
There is no functionality on the client to resolve items by WebDAVUrl. The only functionality we have is:
var item = $models.getItem(tcmUri);
item.getWebDavUrl(); // will return you WebDAVUrl, if it was loaded before
item.loadWebDavUrl(); // will make async call to load WebDAVUrl. "loadwebdavurl" or "loadwebdavurlfailed" will be fired on the item afterwards
Related
I'm using Alfresco 5.1 Community, and i'm trying to get a property of an object for example, in the user we have:
"{http://www.alfresco.org/model/content/1.0}companytelephone"
If I want to get the value of this property, how can I obtain this in javascript?
It depends where you're trying to do this, if you're doing this in a JavaScript controller for a WebScript on the Repository then you will be able to find most of the information in this Wiki page: https://wiki.alfresco.com/wiki/JavaScript_API_Cookbook
If you're doing it in the JavaScript controller of a WebScript running on Share then for most objects you'll need to request the full metadata for the node by calling a REST API on the Repository.
In the case of the user, there is a "user" object available in WebScripts running on the Share tier.
There is lots of information on getting this kind of data with some basic Googling, I'd also recommend launching the Rhino debugger via the WebScripts index page so you can try evaluating JavaScript code (this works for both the Repository and for Share).
We have a requirement that on a page publish, we need to:
Find a component presentation that has a component based upon a particular schema.
Extract certain field vales from that component and store them in a custom database table that's available to our .NET application (on the Content Delivery side).
I think this is a good candidate for either a Deployer extension or a Storage extension - but I'm a little unclear which and why having never written either?
I've ruled out the Event System as this kind of code would be located on the CM, which seems like the wrong "side" to me - my focus is on extending what happens on the CD-side after a page is published.
Read a few articles on Tridion World (this, this, this and this) and I think a storage extension would be the better choice?
Mihai's article seems to be very close to what we need, where he uses a new item type mapping:
<ItemTypes defaultStorageId="brokerdb" cached="true">
<Item typeMapping="PublishAction" cached="false" storageId="searchdb" /></ItemTypes>
But how does Tridion "know" to use this new item type when content is published, (its not one of the defined TYPE_NAMEs, which is kind of the point)?
I should clarify I'm a .NET/C# dev not a Java dev so this is probably really obvious to Java people - apologies if it is!
Cheers
Tridion will not know by default how to deploy your new entity. My advise is to create a Deployer Module (your links should give you enough information about how you can do that) that executes in post-processing phase (of the deployment process), that processes all components from the deployment/transport package, extracts the needed information and uses a custom Storage Extension to store the needed information.
Be careful: you need to set-up in config your new type but you also need to use it yourself from that Deployer Module.
Hope this helps.
Is it possible to modify/customize the Component "Info" tab details according to user. Please see the details below:
Now in above image, I want to show full path of Image like (d:\images\Chrysanthemum.jpg) "Original File:" as it was coming Tridion 2009.
Is it possible?
Unfortunately these are ReadOnly fields set by the system.
If the item was uploaded using the SDL Tridion UI, this should contain the full path of the original image (I am surprised to see only the filename without the path), however it won't tell you from which editor's machine the path was on, so it is of very little use.
What are you trying to achieve and why? Perhaps someone can suggest a different approach.
Showing extra image information, such as size and dimensions, is a great idea and a good candidate for a gui extension.
Your solution has 4 parts:
Backend, talking with the Tridion API using Core Service to get the MM Image and perform size and dimension calculations. (maybe the dimensions could be calculated in javascript?). In the Core Service write some C# code to get the image from Tridion and calculate image size.
Expose the backend call via a Web Service. I like to use ServiceStack.Net and create a very simple, thin web service on top of the C# code. If you create an asp.net web app and host the ServiceStack web service there then make sure to deploy it to a 'Web App' or Virtual Directory under the Tridion 2011 IIS site. This will help with any Post actions since it will use the same port # and not be considered cross-domain. Pluralsight has a great training video on Servicestack. Also, you can use Rest Console in the Chrome browser to test the web service.
Call web service from an HTML page with jQuery. Create a small web form, serialize it with jQuery, and call the ServiceStack web service. The jQuery response will be a JSON object with image info.
Create an ASCX control, configure Tridion to use it as a Tab extension. Copy/paste your working HTML / jQuery into the tab.
All done!
Needed to understand your inputs on: Is there a way in Tridion 2011 to Publish or Unpublish components/pages/templates in a custom resolver code. I understand we can play with the list of resolved items. (By giving a CP,etc). But is there a way to push an item in the publishing Q from a custom resolver code.
You can add or remove any number of items to be part of the existing package / transaction.
If you want it to be part of a new entry in the Publishing Queue instead, the event system seems more appropriate than a resolver. But the items you are publishing automatically won't show up in the "Items to Publish" screen if you Publish them separately, so you need to decide if that's a good thing or not.
Peter (and Nuno) have really answered your question in the best way. You should use a resolver to add the Pages or Component Presentations to the package rather than making new publish transactions. However you can publish items using the core service, so there is no reason you could not call the core service from a resolver and initiate your new publish actions that way.
However it does not sound like a good idea, perhaps you can update you question to explain why you need to do this.
I used to use the PublishEngine object in my templates to add items to the Publish Queue (see http://www.tridiondeveloper.com/the-story-of-sdl-tridion-2011-custom-resolver-and-the-allowwriteoperationsintemplates-attribute), but custom resolvers and other techniques are far superior.
I'm trying to impersonate a user in a C# TBB. is it possible to know who initiated the publish action of a component in the TBB which is a part of the component template rendering with the component?
As mentioned in below article
http://yatb.mitza.net/2012/05/publishing-from-template-code-using.html
Once you will get the Current Publish transaction you can use the properties .Creator to get the user.
To get the Current Publish Transaction you can refer
http://yatb.mitza.net/2012/05/publishing-from-template-code-using.html
In your TBB you have access to the engine.GetSession(), which returns a Session object, containing the User information, I'm sure via that you can do in your code, what you are trying to achieve.
It would be interesting to know a little more about what you are trying to archive.