mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-07-24 03:30:40 +02:00
* Functional last callers mod
* Notes * Some cleanup
This commit is contained in:
parent
99ea870ebc
commit
4a342ba2fa
8 changed files with 126 additions and 222 deletions
|
@ -91,6 +91,7 @@ MCIViewFactory.prototype.createFromMCI = function(mci) {
|
|||
position : { row : mci.position[0], col : mci.position[1] },
|
||||
};
|
||||
|
||||
// :TODO: These should use setPropertyValue()!
|
||||
function setOption(pos, name) {
|
||||
if(mci.args.length > pos && mci.args[pos].length > 0) {
|
||||
options[name] = mci.args[pos];
|
||||
|
|
|
@ -40,29 +40,21 @@ function login(callingMenu, formData, extraArgs) {
|
|||
});
|
||||
},
|
||||
function recordLoginHistory(callback) {
|
||||
userDb.run(
|
||||
'INSERT INTO user_login_history (user_id, user_name, timestamp) ' +
|
||||
'VALUES(?, ?, ?);', [ user.userId, user.username, now.toISOString() ], function inserted(err) {
|
||||
callback(err);
|
||||
});
|
||||
|
||||
userDb.serialize(function serialized() {
|
||||
userDb.run(
|
||||
'INSERT INTO user_login_history (user_id, user_name, timestamp) ' +
|
||||
'VALUES(?, ?, ?);', [ user.userId, user.username, now.toISOString() ]
|
||||
);
|
||||
|
||||
/*
|
||||
userDb.run(
|
||||
'DELETE FROM last_caller ' +
|
||||
'WHERE id NOT IN (' +
|
||||
' SELECT id ' +
|
||||
' FROM last_caller ' +
|
||||
' ORDER BY timestamp DESC ' +
|
||||
' LIMIT 100);');
|
||||
// keep 30 days of records
|
||||
userDb.run(
|
||||
'DELETE FROM user_login_history ' +
|
||||
'WHERE timestamp <= DATETIME("now", "-30 day");'
|
||||
);
|
||||
});
|
||||
|
||||
userDb.run(
|
||||
'DELETE FROM last_caller ' +
|
||||
'WHERE user_id IN (' +
|
||||
' SELECT user_id ' +
|
||||
' ORDER BY timestamp DESC ' +
|
||||
'LIMIT 1;')
|
||||
*/
|
||||
callback(null);
|
||||
}
|
||||
],
|
||||
function complete(err, results) {
|
||||
|
|
|
@ -114,7 +114,6 @@ TextView.prototype.getData = function() {
|
|||
};
|
||||
|
||||
TextView.prototype.setText = function(text) {
|
||||
|
||||
var widthDelta = 0;
|
||||
if(this.text && this.text !== text) {
|
||||
widthDelta = Math.abs(this.text.length - text.length);
|
||||
|
|
11
core/view.js
11
core/view.js
|
@ -67,7 +67,10 @@ function View(options) {
|
|||
this.setDimension(options.dimens);
|
||||
this.autoScale = { height : false, width : false };
|
||||
} else {
|
||||
this.dimens = { width : 0, height : 0 };
|
||||
this.dimens = {
|
||||
width : options.width || 0,
|
||||
height : 0
|
||||
};
|
||||
}
|
||||
|
||||
// :TODO: Just use styleSGRx for these, e.g. styleSGR0, styleSGR1 = norm/focus
|
||||
|
@ -214,6 +217,12 @@ View.prototype.setPropertyValue = function(propName, value) {
|
|||
*/
|
||||
break;
|
||||
|
||||
case 'resizable' :
|
||||
if(_.isBoolean(value)) {
|
||||
this.resizable = value;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'argName' : this.submitArgName = value; break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue