site.creator=function(C,B,A){LOG_I("creator","Initializing creator: "+C);
site.creator.superclass.constructor.call(this,C,B,A);
};
YAHOO.lang.extend(site.creator,harsh.widget);
site.creator.prototype.resetCheckLink=function(){this.getChildDOM("checklink").style.display="";
this.getChildDOM("na").innerHTML="";
};
site.creator.prototype.begin=function(){var A=this.getChildWidget("sitebox").getValue();
var B=P._root+"/?p=p-themes&sid="+A;
harsh.url.change(B);
};
site.creator.prototype.redirectToLogin=function(B){var A=this.getChildWidget("sitebox").getValue();
if(A.length==0){alert("Please pick a site name");
return;
}YAHOO.util.Connect.asyncRequest("GET","/sitestore?m=aboutToCreate&site="+A,{success:function(){harsh.url.change("/?p=p-steplogin&id="+this.getChildWidget("sitebox").getValue()+"&source="+B);
},failure:function(){alert("Sorry! This sitename is already taken. Please choose another site name.");
},scope:this});
};
site.creator.prototype.checkValidSiteName=function(){var A=this.getChildWidget("sitebox").getValue();
this.getChildDOM("checklink").style.display="none";
this.getChildDOM("na").innerHTML="<font color='yellow'>checking ...</font>";
if(A.length==0){return;
}YAHOO.util.Connect.asyncRequest("GET","/sitestore?m=aboutToCreate&site="+A,{success:function(){LOG_I("creator","OK");
this.getChildDOM("na").innerHTML="<font color='green'>Available</font>";
},failure:function(B){this.getChildDOM("na").innerHTML=B.responseText;
},scope:this});
};
site.controller=function(C,B,A){LOG_I("controller","Initializing controller: "+C);
site.controller.superclass.constructor.call(this,C,B,A);
this.load();
};
YAHOO.lang.extend(site.controller,harsh.widget);
site.controller.prototype.load=function(){YAHOO.util.Connect.asyncRequest("GET","/controller?m=toJSON",{success:function(F){var A=harsh.json.parse(F.responseText);
var C="Total Jobs = "+A.total+"<br/>";
$("summary").innerHTML=C;
var D="<table width='100%' border='1'>";
for(var B in A.jobs){LOG_I("controller",B);
var E=A.jobs[B];
LOG_I("controller",E);
var G="<tr>";
G+="<td>"+E.spec.site+"|"+E.spec.type+"</td>";
G+="<td>"+E.status.running+"</td>";
G+="<td>"+E.status.laststarted+"</td>";
G+="<td>"+E.status.lastfinished+"</td>";
G+="<td>"+E.status.nextscheduled+"</td>";
G+="<td><a target='_blank' href='/controller?m=runNow&id="+B+"'>Run Now</a></td>";
G+="</tr>";
D+=G;
LOG_I("controller",B+" done");
}D+="</table>";
LOG_I("controller",D);
$("container").innerHTML=D;
},failure:function(){},scope:this});
};
