');
$('#switcher').themeswitcher();
}
return "";
}
createPanelwidget("body", "configure", "Confgiguration", "");
createTabswidget("#configure_Panelcontent", "conf", [{
name : "Rules",
f_content : confTab
}, {
name : "Interface",
f_content : confTab
}]);
updateConfigData();
/*$("#themeselector").themes({compact: false});*/
}
function updateConfigData() {
$.ajax({
type : 'GET',
url : '/html/rules',
dataType : 'json',
contentType : 'application/json',
success : function(rules) {
changeConfigureTable(rules);
}
});
}
function changeConfigureTable(rules) {
var checked = {
"true" : "checked",
"false" : ""
};
function celladd(name, row) {
if(name == "enabled") {
retstr = '
';
return retstr;
}
if(name == "limit") {
return row.limit_str;
}
if(name == "value") {
if(row.editable) {
retstr = '
";
return retstr;
}
return "";
}
if(name != "id") {
return row[name];
}
}
createTable("#Rules", "rulesTable", rulesTableHeader, rules, celladd);
$("#rulesTable button").button();
}
function showJob(id, name) {
var job = {};
function general(tab_name) {
var cumulate_rendertime = 0;
$.each(job.frames, function(index, frame) {
cumulate_rendertime += frame.time;
});
var info = [new namevalue("resolution", job.resolution[0] + 'x' + job.resolution[1] + ' at ' + job.resolution[2] + '%'), new namevalue("tags", job.tags), new namevalue("result", getresult(id)), new namevalue("frames", job.frames.length), new namevalue("status", job.status), new namevalue("job name", job.name), new namevalue("type", job.type), new namevalue("render", job.subtype), new namevalue("render time", secondsToHms(job.wktime)), new namevalue("cumulate render time", secondsToHms(cumulate_rendertime))];
function cellview(name, row) {
if(name == "name") {
return '
' + row.name + ':';
}
if(name == "value") {
switch (row.name) {
case "tags":
retstr = "[ ";
for(var i = 0; i < row.value.length; i++) {
retstr = retstr + row.value[i] + " ";
}
retstr = retstr + "]";
return retstr;
case "result":
return '
load';
case "status":
return JOB_STATUS_TEXT[job.status];
case "type":
return JOB_TYPES[job.type];
case "render":
return job.render;
default:
return row.value;
}
}
}
createTable("#" + tab_name, "generalTable", ["name", "value"], info, cellview, false);
return "";
}
function files(tab_name) {
function fileJobCache() {
createFilesTable("#JobCache_Panelcontent", id, "cache");
return "";
}
function fileJobFluid() {
createFilesTable("#JobFluid_Panelcontent", id, "fluid");
return "";
}
function fileJobOther() {
createFilesTable("#JobOthers_Panelcontent", id, "other");
return "";
}
function filePath(data) {
$("#JobPath_Panelcontent").html(data[0].filepath);
}
function showFilesBlenderJob() {
createPanelwidget("#" + tab_name, "JobPath", "Job Path", function() {
return "";
});
$.getJSON("/html/blendfile_" + id, null, filePath);
if(job.totcache) {
createPanelwidget("#" + tab_name, "JobCache", "Physic cache files", fileJobCache);
}
if(job.totfluid) {
createPanelwidget("#" + tab_name, "JobFluid", "Fluid cache Files", fileJobFluid);
}
if(job.totother) {
createPanelwidget("#" + tab_name, "JobOthers", "Other Files", fileJobOther);
}
}
function showFilesVersioned() {
function cellview(name, row) {
if(name == "name") {
return '
' + row.name + ':';
}
if(name == "value") {
return row.value;
}
}
var info = [new namevalue("system", job.version_info.system.name), new namevalue("Remote Path", job.version_info.rpath), new namevalue("Working Path", job.version_info.wpath), new namevalue("Revision", job.version_info.revision), new namevalue("Render File", job.files[0].filepath)];
}
switch(job.type) {
case JOB_TYPE_BLENDER:
showFilesBlenderJob();
break;
case JOB_TYPE_VERSIONED:
showFilesVersioned();
break;
default:
return tab_name;
}
return "";
}
function frames(tab_name) {
function frameCell(name, frame) {
if(name == "no") {
return frame.number;
}
if(name == "status") {
return FRAME_STATUS_TEXT[frame.status];
}
if(frame.status) {
if(name == "render time") {
return Math.floor(frame.time) + "s";
}
if(name == "slave") {
if(frame.slave) {
return frame.slave.name;
} else {
return "none";
}
}
if(name == "log") {
return '
view log';
}
if(frame.status > 1) {
if(name == "result") {
return '
view result';
}
}
}
return "N/A";
}
createPagedTable("#" + tab_name, "framesTable", framesTableHeader, job.frames, frameCell, 10, "next frames page", "previous frames page");
return "";
}
function thumbs(tab_name) {
function img_src(img_num) {
return '/thumb_' + id + '_' + job.frames[img_num].number + '.jpg';
}
function img_info(img_num) {
return "
Job:" + job.name + '
frame:' + job.frames[img_num].number;
}
createImgViewer("#" + tab_name, img_src, job.frames.length, img_info);
}
function slaves(tab_name) {
function createBlackList(data) {
function blacklist() {
if(data.length === 0) {
return "None";
}
createPagedTable("#BlackList_Panelcontent", "blacklistTable", slaveTableHeader, data, cellSlaveTable, maxItemsperTable, "next slaves page", "previous slaves page");
return "";
}
createPanelwidget('#' + tab_name, "BlackList", "Black Listed slaves", blacklist);
}
function createSlaveList(data) {
function slavelist() {
if(data.length === 0) {
return "None";
}
createPagedTable("#SlavesList_Panelcontent", "slaveslistTable", slaveTableHeader, data, cellSlaveTable, maxItemsperTable, "next slaves page", "previous slaves page");
return "";
}
createPanelwidget('#' + tab_name, "SlavesList", "Currently assigned slaves", slavelist);
}
$.getJSON("/html/blacklist_" + id, null, createBlackList);
$.getJSON("/html/slavesjob_" + id, null, createSlaveList);
return "";
}
function onCancel(dlg) {
$(dlg).dialog("close");
$(dlg).remove();
}
function jobDialog(dlg) {
$("#showjobs").remove();
var tab_descript = [{
name : "General",
f_content : general
}, {
name : "Files",
f_content : files
}, {
name : "Frames",
f_content : frames
}, {
name : "Thumbs",
f_content : thumbs
}, {
name : "slaves",
f_content : slaves
}];
createTabswidget(dlg, "showjobs", tab_descript);
return "";
}
function retJobData(data) {
job = data[0];
$("#JobInfo" + id).remove();
DialogWidget('body', 'JobInfo' + id, "Job Information", "", "Go Back", null, onCancel, jobDialog, true, 700, 800);
$("#General a").button();
}
$.getJSON("/html/job_" + id, null, retJobData);
}