var box_type={initialize:function(_1,_2){
_1=io.getBox(_1);
var _3=io.getContents(_1);
if(_3){
for(key in _2){
if(typeof (_2[key])=="string"){
var _4=Number(_2[key]);
if(isNaN(_4)){
_1.io.type.data[key]=_2[key];
}else{
_1.io.type.data[key]=_4;
}
}
}
if(_1.io.type.handler){
_1.io.type.handler.initialize(_1);
}
io.fadeIn(_1);
_1.io.initialized=true;
if(dojo.hasClass(_1,"new")){
if(_1==io.site){
}
dojo.removeClass(_1,"new");
io.frame.fitParent(_1);
}
return true;
}
console.warn("io.type.initialize() no type content in "+_1.id);
return false;
},disconnect:function(_5){
var _6=io.getContents(_5);
if(_6&&_5.io.initialized){
while(_5.io.type.events.touchstart.length>0){
dojo.disconnect(_5.io.type.events.touchstart.pop());
}
while(_5.io.type.events.touchmove.length>0){
dojo.disconnect(_5.io.type.events.touchmove.pop());
}
while(_5.io.type.events.touchend.length>0){
dojo.disconnect(_5.io.type.events.touchend.pop());
}
if(_5.io.type.handler){
_5.io.type.handler.disconnect(_5);
}
}
},getContentsChild:function(_7){
var _8=false;
_7=io.getBox(_7);
if(_7){
var _9=io.getContents(_7);
if(_9){
if(found=dojo.query(">."+_7.io.type.name,_9)){
_8=found[0];
}
}
}
return _8;
},edit:function(_a){
_a=io.getBox(_a);
if(_a){
if((_a.io.type.name!="containers_site")&&(_a.io.type.name!="containers_page")&&(_a.io.type.name!="containers_group")&&(_a.io.type.name!="images_image")){
io.request("edit",_a,_a.io.type.name,{recordid:_a.io.type.data.recordid},io.type.receive);
}
}
},update:function(_b){
_b=io.getBox(_b);
if(_b){
io.request("get",_b,false,false,io.type.receive);
}
},save:function(_c){
_c=io.getBox(_c);
if(_c){
var _d=io.getContents(_c);
if(_d){
_c.io.type.handler.save(_c);
io.request("save",_c,_c.io.type.name,_c.io.type.data,io.type.receive);
}
}
},receive:function(_e){
var _f=dojo.fromJson(_e);
console.warn("io.type.receive() "+_f.objecttype+" type data received for box "+_f.objectid);
if(!io.typeLoaded(_f.objecttype)){
console.warn("io.type.receive() type handler not found for "+_f.objecttype);
io.loadType(_f.objecttype);
return false;
}
var _10="box_"+_f.request.objectid;
var box=dojo.byId(_10);
if(box){
if(_f.request.command=="get"){
io.type.disconnect(box);
io.type.initialize(box,_f.data);
}else{
if(_f.request.command=="edit"){
dojo.place(_f.data,box.io.contents,"replace");
box.io.contents=io.getContents(box);
box.io.type.handler.edit(box);
}else{
if((_f.request.command=="save")||(_f.request.command=="render")){
box.io.type.handler.disconnect(box);
dojo.place(_f.data,box.io.contents,"replace");
box.io.contents=io.getContents(box);
box.io.type.state.editor=false;
box.io.type.handler.initialize(box);
dojo.query(".link",box).forEach(function(_11,_12,arr){
var _13=_11.parentNode.innerHTML;
_13=_13.replaceString("<A","<DIV");
_13=_13.replaceString("</A","</DIV");
_13=_13.replaceString("<a","<DIV");
_13=_13.replaceString("</a","</DIV");
_11.parentNode.innerHTML=_13;
});
}
}
}
}else{
console.warn("io.type.receive() box for received type data not found: ");
}
return false;
},getOptionHandler:function(box,_14){
box=io.getBox(box);
var obj=false;
if(box){
if(_14=="getsettings"){
obj=box.io.type.handler.settings;
}else{
if(_14=="getlist"){
obj=box.io.type.handler.list;
}else{
if(_14=="getaccess"){
obj=box.io.type.handler.access;
}else{
if(_14=="gethistory"){
obj=box.io.type.handler.undo;
}else{
if(_14=="getinfo"){
obj=box.io.type.handler.info;
}
}
}
}
}
}
return obj;
}};
io.type=box_type;


