Anguilla - Unable to populate item using minor verision - tridion

How to populate an item using minor version?
Am using the below code snippet.
var item = $models.getItem('tcm:222-7244-64-v1'); - Works fine.
var item = $models.getItem('tcm:222-7244-64-v1.3'); - Throws error.
I was able to get the minor version from DAL using below query as neither the CoreService nor Anguilla Framework provides it, but i need to populate the item using minor version. Could someone help me to resolve it?
select max(version)||'.'|| max(revision) as rev from items where item_reference_id='7244'

Related

Where is the IConfiguration.Get method in ASP.NET 6 (vnext) after update to beta6?

For the moment almost all blog posts covering configuration with the new ASP.NET 5 and MVC 6 using json for config is using something like this:
var token = configuration.Get<string>("AppData:CompanyName");
For example this question: How to read AppSettings values from Config.json in ASP.NET Core
But since 6 august this function is removed (if you're using bleeding edge releases) with almost no information on what to use instead.
For me this first occurred when switching to from beta5 to beta6 of Microsoft.Framework.Configuration.Json.
tl;dr;
Do it like this to get it working:
var companyName = Configuration["AppData:CompanyName"];
var branchName = Configuration["AppData:BranchName"];
// etc.
Explanation and source:
This commit removed the Get function:
https://github.com/aspnet/Configuration/commit/ddd7c42ece30f0b7bb57a91ae7a627f2f99b9cf2
Some further comments when digging in the issue can be found here:
https://github.com/aspnet/Configuration/issues/246

How to get the itemxml of a selected item in Tridion

I would like to get and display the itemxml of the selected item from the Tridion CME.
I was able to get the Itemxml from my VM server when i give the tcm id in the browser.
However, i would like to get the same information from Tridion GUI Extension.
I am able to get the selected item tcm id. Is there any way to get the itemxml using coreservice?
or is there any other way to get this?
At the moment there's no way you can get Item XML through core service. Item XML you have seen was provided to you by TCM Protocol handler that might not be there in future versions. If you want to show item XML in CME - take a look at this extention by Yoaw:
http://sdltridionworld.com/articles/sdltridion2011/tutorials/GUIextensionIn8steps.aspx
Also, keep in mind that not all properties of an item might be exposed in Xml, sometimes you have more info in Data object
Take a look at the PowerTools, it has an ItemXML viewer (written by Robert Curlette) for all items in SDL Tridion
http://code.google.com/p/tridion-2011-power-tools/wiki/ItemXML
The XML is loaded on a tab using JavaScript as follows:
ItemXmlTab.ItemXmlTab.prototype.updateView = function ItemXmlTab$updateView()
{
if (this.isSelected())
{
var xslPath = $ptUtils.expandPath("/PowerTools/Client/ItemXml/ItemXmlTab.xslt", true);
$xml.loadXsltProcessor(xslPath, function (value)
{
var xmlSource = $display.getItem().getXml();
// Filter out all spacing characters
xmlSource = xmlSource.replace(/\t|\n|\r/g, "");
var html = $xml.xsltTransform(value, $xml.getNewXmlDocument(xmlSource), null);
$dom.setOuterHTML($("#itemXml"), html);
});
}
};
You can view the source code of the extension at http://code.google.com/p/tridion-2011-power-tools/source/browse/#svn%2Ftrunk%2FPowerTools.Editor%2FPowerTools%2FClient%2FItemXml%253Fstate%253Dclosed
You can get the item XML via CoreService, but this will get you the Tridion R6 (2011) Xml format, which is not the same you would see before.
Sample code available here.
I tend to have a page "GetItemXml.aspx" on my Tcm servers that I then call with a Uri as a parameter, and then this page would return the Item Xml.
Article written by Yoav Niran (Url in the post of user978511) is perfect for your requirement.
if you are still facing any issue and in hurry to get it working just perform below steps -
1- Download the extension.
2- Apply the steps 7 and 8 of this article to configure this extension.

Component will not delete

I'm doing a bit tidy of the Content Manager and have a component that won't delete (not the same as my other question).
When I try to delete the component in question I get the following error
(8004032D) This item is in use.
Unable to delete Component (tcm:4-65020).
UtilitiesBL.AssertItemCanBeDeleted
UtilitiesBL.AssertItemCanBeDeleted
ComponentBL.Delete
Component.Delete
Request.Delete
When I use the Where Used tool on the component I get no results in the "Used In" tab, one result in the "Uses" tab, the "Blueprint Hierachy" shows it is not localized in any of my three child publications and no results in the "Published To" tab.
I have had a look in the Content Manager database to see if I can spot what is going wrong but not really found anything.
Any ideas?
Thanks in advance.
It looks like the Where Used tool in R5.3 isn't working correctly. The component in question is used in 15000 other components. I found this by using the TOM API directly.
var componentID = "tcm:4-65020";
TDS.TDSE tdse = new TDS.TDSE();
var component = (TDS.Component)tdse.GetObject(componentID, TDSDefines.EnumOpenMode.OpenModeView);
var whereUsedString = component .Info.GetListUsingItems();
Now comes the task of deleting all these links...

Anguilla - Get the version and user information

I have created a command button on the Ribbon Toolbar. When I select an component an click on "Display Info" button, an popup should open telling me about the latest version of the Component, Modified date, and the User who last modified it.
I do get the component with the following code:
var item = $models.getItem(selection.getItem(0));
How can I get the other information from here.
Part 2:
When I try to see the JS code in Firebug, I see them in one single line. I am unable to put an break point on the execute function within my code.
Any suggestions on the above points. ?
To deminify the JS, to allow you to add breakpoints, and also to allow you to use a JS console to inspect objects that are available, you can follow the instructions at http://code.google.com/p/tridion-2011-power-tools/wiki/DeactivateJSMinifier.
User information can be retrieved using the information at How to get the user Id of the currently logged user in Tridion?
I find that the only way to find anything with Anguilla is to use a JS Console like Chrome's.
Once you get the current item - like you do now - you can do stuff like:
var version = item.getVersion();
var lastModifiedDate = item.getLastModifiedDate();
var lastEditorId = item.getStaticRevisorId();
getStaticRevisorId() gives you the Tridion URI of the last user to change the item, and you can then load this to retrieve further information from it.

aptana has no code assist for very simple functionality?

using aptana studio 3, I found the following has no code assist
var myDate=new Date();
mtDate.
Anything wrong with it?
There is a bug filed for JavaScript autocomplete in Aptana Studio 3:
https://aptana.lighthouseapp.com/projects/35272/tickets/1609-javascript-code-assist-does-not-work-in-aptana-3-preview-release
You can follow it to see the progress.
One minor thing is that your variable is declared as "myDate", but you reference "mtDate". However, I confirmed that correcting the reference name only shows Object properties and not Date properties as well. A ticket was created for this item here:
https://aptana.lighthouseapp.com/projects/35272/tickets/2450-date-object-not-showing-correct-ca-in-js
And the good news is that has been resolved and will be available in the next nightly build.

Resources