SDK - Ice Classfication Browser

  • KM508253
  • 20-Sep-2008
  • 20-Sep-2008

Archived Content: This information is no longer maintained and is provided "as is" for your convenience.

Reference

Ice Classfication Browser

Ice classificaiton browser allows users to select the classification they wish to apply to the record with classification titling.

This article will walk you through the classification widget and explain how you can customize it to your own desire.

IMPORTANT: Please use Firefox (1.5.0 or above) if you want to dive in the example in this article. Use IE at your own risk.

We recommend you to get the following add-ons for this article.

Classification Query

Getting the topterm classification (JSON):

http://iceserver/simon/classification/classsubs:–

I entered it on my server and this is what I get

http://realworld:9000/simonon/search/?q=classsubs:–

[{name:”TECHNOLOGY & TELECOMMUNICATIONS”,metatype:”classification”,uri:434},{name:”STRATEGIC MANAGEMENT”,metatype:”classification”,uri:409},{name:”STAFF DEVELOPMENT”,metatype:”classification”,uri:388},{name:”PUBLICATION”,metatype:”classification”,uri:362},{name:”PROPERTY MANAGEMENT”,metatype:”classification”,uri:326},{name:”PERSONNEL”,metatype:”classification”,uri:287},{name:”OCCUPATIONAL HEALTH AND SAFETY ( OH&S )”,metatype:”classification”,uri:259},{name:”LEGAL SERVICES”,metatype:”classification”,uri:239},{name:”INFORMATION MANAGEMENT”,metatype:”classification”,uri:199},{name:”INDUSTRIAL RELATIONS”,metatype:”classification”,uri:176},{name:”GOVERNMENT RELATIONS”,metatype:”classification”,uri:153},{name:”FLEET MANAGEMENT”,metatype:”classification”,uri:132},{name:”FINANCIAL MANAGEMENT”,metatype:”classification”,uri:100},{name:”ESTABLISHMENT”,metatype:”classification”,uri:86},{name:”EQUIPMENT & STORES”,metatype:”classification”,uri:57},{name:”COMPENSATION”,metatype:”classification”,uri:37},{name:”COMMUNITY RELATIONS”,metatype:”classification”,uri:1}]

Each of the object in the curly brace {} is a classification object. Let’s take a look at the first one

{name:”TECHNOLOGY & TELECOMMUNICATIONS”,metatype:”classification”,uri:434}

This is a top term classification object. It has the name is TECHNOLOGY & TELECOMMUNICATIONS, metatype is classification, and uri is 434.

If you want to order the search result, add -sort:name after the the query. Entering this into the browser addressbar and you’ll be able to see the returned data. However, it’s not much help for our end user to see this, instead we can just write some nifty javascript function to pickup the data and format it the way that you want.

Let try to do something with the classification objects that we get from the Ice server.

getAsyncHttpStruct(”/simonon/search/?q =” + encodeURIComponent(”classsubs:– -sort:name”), function(status, objects) {alert(object.toSource();});

The getAsynceHttpStruct is defined in the \content\static\js\async.js file in ice javascript library. It use the XHTML query to get the data from the server and put the result in the ‘objects’ parameter and the status code of the query to ‘status’ parameter.

In the function(status, objects) we can get our hand to the returned search result from ice server. In our case we’re searching for all the top terms classification, so our ‘objects’ parameter in the function will contains a collection of the search results. But how do we get to each search result.

We can extend out function(status,objects) to something like this

getAsyncHttpStruct(”/simonon/search/?q=” + encodeURIComponent(”classsubs:– -sort:name”), function(status, objects){ for(var i in objects) { alert(objects[i].toSource(); } });

The above code snipset will show the dialog box containing the details(name, metatype,uri)of each individual classification in the result set. If you want more informations on the classification, you will have to make another query to the Ice server to ask for a classification with a given uri.

getAsyncHttpStruct(”/simonon/classification/uri”, function(status,object) { //do something with the classification object here, eg: access a given property... etc... });

You’ll get something like this {approver:null,onlyrecordtype:null,”acltype-update”:{value:0,name:”public”,caption:”Public”},activeto:null,”acl-delete”:[],activedescription:”Active - Classification has been active since 3/05/2005.”,title:”COMMUNITY RELATIONS”,children:[{metatype:”classification”,uri:2},{metatype:”classification”,uri:3},{metatype:”classification”,uri:4},{metatype:”classification”,uri:5},{metatype:”classification”,uri:6},{metatype:”classification”,uri:7},{metatype:”classification”,uri:8},{metatype:”classification”,uri:9},{metatype:”classification”,uri:10},{metatype:”classification”,uri:11},{metatype:”classification”,uri:12},{metatype:”classification”,uri:13},{metatype:”classification”,uri:14},{metatype:”classification”,uri:15},{metatype:”classification”,uri:16},{metatype:”classification”,uri:17},{metatype:”classification”,uri:18},{metatype:”classification”,uri:19},{metatype:”classification”,uri:20},{metatype:”classification”,uri:21},{metatype:”classification”,uri:22},{metatype:”classification”,uri:23},{metatype:”classification”,uri:24},{metatype:”classification”,uri:25},{metatype:”classification”,uri:26},{metatype:”classification”,uri:27},{metatype:”classification”,uri:28},{metatype:”classification”,uri:29},{metatype:”classification”,uri:30},{metatype:”classification”,uri:31},{metatype:”classification”,uri:32},{metatype:”classification”,uri:33},{metatype:”classification”,uri:34},{metatype:”classification”,uri:35},{metatype:”classification”,uri:36}],”acl-use”:[],notes:”“,recpatternlastnbr:”“,idnumberuncompressed:”100/”,accesscontrol:”“,security:”[No Security Level]”,activefrom:new Date(”03 May 2005”),”acltype-modifyaccess”:{value:0,name:”public”,caption:”Public”},versionstamp:new Date(1152598918000),idnumber:”100/”,notesappend:”“,name:”COMMUNITY RELATIONS”,copiedaccesscontrol:”“,childpattern:”XXX/”,”acl-modifyaccess”:[],recpattern:”“,parentclassification:null,”acltype-use”:{value:0,name:”public”,caption:”Public”},”acl-update”:[],childpatternlastnbr:”695/”,metatype:”classification”,userlabels:[],ownerloc:null,levelnumberuncompressed:”100/”,uri:1,homeloc:null,schedule:null,isapproved:true,defclass:{value:1,name:”corporate”,caption:”Corporate”},isactive:true,levelnumber:”100/”,numberingismanual:false,”acltype-delete”:{value:0,name:”public”,caption:”Public”}}

This returned object contains all the properties for that classification.

The function(status, object) is an inline javascript function (similar to the new anonymous function (http://msdn.microsoft.com/msdnmag/issues/04/05/c20/default.aspx#S5) concept in .NET 2.0)

Instead of having the alert(alert(object.toSource()) above, we can tell the browser to print the result to the new popup windows or something (I hate popup).

Getting the list children for a classification (JSON):