it/itf/static/js/itf/itf.js

90 lines
1.9 KiB
JavaScript
Raw Normal View History

2011-01-04 06:27:10 +00:00
var ITF = {};
2010-12-06 22:33:00 +00:00
2011-01-20 08:02:03 +00:00
2011-02-01 15:13:30 +00:00
ITF.login = function(data) {
app.user = data.user;
var box = app.$ui.loginBox;
box.slideUp("slow", function() {
box.$loginBtn.hide();
box.$registerBtn.hide();
box.$info.html("logged in as " + data.user.username + " ");
box.$logoutBtn.show();
box.slideDown();
});
}
ITF.logout = function(data) {
app.user = data.user;
var box = app.$ui.loginBox;
box.slideUp("slow", function() {
box.$logoutBtn.hide();
box.$info.html('');
box.$loginBtn.show();
box.$registerBtn.show();
box.slideDown();
});
// alert("logged out");
}
2011-01-19 10:10:29 +00:00
ITF.setSizes = function() {
var mp = app.$ui.middlePanel;
var winHeight = parseInt(mp.height());
2011-01-20 08:02:03 +00:00
var winWidth = parseInt(mp.width());
2011-01-19 10:10:29 +00:00
var panelHeight = parseInt(winHeight / 3);
2011-01-20 08:02:03 +00:00
var panelWidth = parseInt(winWidth / 3);
2011-01-19 10:10:29 +00:00
mp.size(0, panelHeight);
mp.size(2, panelHeight);
2011-01-20 08:02:03 +00:00
mtp = app.$ui.middleTopPanel;
mmp = app.$ui.middleMiddlePanel;
mbp = app.$ui.middleBottomPanel;
mtp.size(0, panelWidth);
mtp.size(2, panelWidth);
mmp.size(0, panelWidth);
mmp.size(2, panelWidth);
mbp.size(0, panelWidth);
mbp.size(2, panelWidth);
2011-02-01 15:13:30 +00:00
//FIXME: FIX!
var listHeight = panelHeight - 22;
app.$ui.bestpracticesBox.$listContainer.css({'height': listHeight + "px"});
2011-01-19 10:10:29 +00:00
}
function tmplToHtml(s) {
return s.replace(/\n/g, "<br />");
}
function tmplTrunc(s, count) {
return Ox.truncate(s, count, "...", "right");
}
2010-12-06 22:33:00 +00:00
/*
//FIXME: make sure to add a loading icon
Ox.Request.requests() && app.$ui.loadingIcon.start();
Ox.Event.bind('', 'requestStart', function() {
Ox.print('requestStart')
app.$ui.loadingIcon.start();
});
Ox.Event.bind('', 'requestStop', function() {
Ox.print('requestStop')
app.$ui.loadingIcon.stop();
});
*/
// $(body).append(app.$ui.wrapper);
/*
2011-01-06 05:59:08 +00:00
Ox.Box - generic box element, with a bar, some help, search, a menu, etc.
2010-12-06 22:33:00 +00:00
*/
2011-01-14 12:09:03 +00:00