Permalink
Browse files

Tweaks to reloading and copy forward of some form changes re login

  • Loading branch information...
1 parent b040b21 commit f4581b5a7ab6f0ba7ffa971019603e6f7e6161e5 @cliftonc committed Sep 8, 2011
View
@@ -70,29 +70,26 @@ function CalipsoEventEmitter(options) {
// Clear all existing listeners
this.init = function() {
-
- this.hook.removeAllListeners();
- this.emitter.removeAllListeners();
-
- if(self.hook && self.hook.listenerTree['*'] && self.hook.listenerTree['*']['calipso']) {
- for(listener in self.hook.listenerTree['*']['calipso']) {
- var listenerFns = self.hook.listenerTree['*']['calipso'][listener]._listeners;
- if(typeof listenerFns === "object") {
- listenerFns.forEach(function(fn) {
- self.hook.off('*::calipso::' + listener,fn);
- });
- } else {
- if(typeof listenerFns === "function") {
- self.hook.off('*::calipso::' + listener,listenerFns);
- } else {
- console.log("Unknown listenerfn: " + typeof listenerFns)
- }
-
- }
- }
+ // Clear down the event emitters
+ for(var event in self.events) {
+
+ self.emitter.removeAllListeners("PRE_" + event);
+ self.emitter.removeAllListeners("POST_" + event);
+
+ self.hook.removeAllListeners("*::calipso::PRE_" + event);
+ self.hook.removeAllListeners("*::calipso::POST_" + event);
- }
+ if(self.events[event].keys) {
+ self.events[event].keys.forEach(function(key) {
+ self.emitter.removeAllListeners(key + "_" + event);
+ self.hook.removeAllListeners("calipso::" + key + "_" + event);
+ });
+ // Clear keys for custom events
+ self.events[event].keys = [];
+ }
+
+ }
}
@@ -140,6 +137,12 @@ function CalipsoEventEmitter(options) {
} else {
self.emitter.on(key + "_" + event,fn);
}
+
+ // Add it to the set of keys
+ this.events[event].keys = this.events[event].keys || [];
+ this.events[event].keys.push(key);
+
+ // Register
this.events[event].customListeners[listener] = this.events[event].customListeners[listener] || [];
this.events[event].customListeners[listener].push({name:fn.name, hookio:this.events[event].hookio});
this.events[event].customListeners['#'] += 1;
@@ -199,7 +202,7 @@ function CalipsoEventEmitter(options) {
var cb = function() {};
}
- if(this.events[event] && this.events[event].enabled) {
+ if(this.events[event] && this.events[event].enabled) {
if(this.events[event].hookio && calipso.app.isCluster) {
this.hook.emit('calipso::' + key + "_" + event, data);
cb(data);
View
@@ -614,7 +614,8 @@ CalipsoForm.prototype.render_tag_checkbox = function(field, value) {
// Undefined
if(value === undefined) value = false;
- return '<input type="checkbox"'
+ var hiddenCheckbox = "<input type='hidden' name='" + field.name + "' value='off' />";
+ var checkbox = '<input type="checkbox"'
+ ' class="checkbox'+ (field.labelFirst ? '' : ' checkable') + (field.cls ? field.cls : "") + '"'
+ ' name="' + field.name + '"'
+ ' id="' + field.name + '"'
@@ -623,6 +624,9 @@ CalipsoForm.prototype.render_tag_checkbox = function(field, value) {
+ (field.readonly ? ' disabled="disabled"' : '')
+ this.tagClose
+ (field.readonly ? '<input type="hidden" name="' + field.name + '" value="' + (value ? 'on' : 'off') + '" />' : ''); // Hidden field with value
+
+ return hiddenCheckbox + checkbox;
+
};
/**
View
@@ -484,9 +484,6 @@ function configureLogging(options) {
calipso.debug = winston.debug;
calipso.error = winston.error;
- // Output what our log levels are set to in debug
- calipso.debug(logMsg);
-
}
/**
File renamed without changes.
@@ -512,10 +512,6 @@ function installDone(req,res,next) {
*/
function showAdmin(req, res, template, block, next) {
- //res.menu.admin.secondary.push({ name: req.t('Configuration'),url: '/admin/core/config',regexp: /admin\/config/});
- //res.menu.admin.secondary.push({ name: req.t('Languages'),url: '/admin/core/languages',regexp: /admin\/admin/});
- //res.menu.admin.secondary.push({ name: req.t('Cache'),url: '/admin/core/cache',regexp: /admin\/cache/});
-
calipso.theme.renderItem(req, res, template, block, {},next);
}
@@ -19,7 +19,6 @@
var dbUri = $(".database-uri").val();
var postData = {"dbUri":dbUri};
- console.log(dbUri);
$.ajax({
type: "POST",
@@ -47,7 +47,7 @@ function init(module, app, next) {
function defineRoutes() {
module.router.addRoute(/.*/, loginForm, { end: false, template: 'login', block: 'user.login' }, this.parallel());
- module.router.addRoute('GET /login', loginPage, { end: false, template: 'loginPage', block: 'login' }, this.parallel());
+ module.router.addRoute('GET /login', loginPage, { end: false, template: 'loginPage', block: 'content.login' }, this.parallel());
module.router.addRoute('POST /user/login',loginUser,null,this.parallel());
module.router.addRoute('GET /user/list',listUsers,{end:false,admin:true,template:'list',block:'content.user.list'},this.parallel());
module.router.addRoute('GET /user/logout',logoutUser,null,this.parallel());
@@ -184,7 +184,7 @@ function loginForm(req, res, template, block, next) {
var userForm = {
id:'login-form',cls:'login',title:'Log In',type:'form',method:'POST',action:'/user/login',
fields:[
- {label:'Username', name:'user[username]', type:'text'},
+ {label:'Username', name:'user[username]', type:'textbox'},
{label:'Password', name:'user[password]', type:'password'}
],
buttons:[
@@ -207,7 +207,7 @@ function loginPage(req, res, template, block, next) {
var userForm = {
id:'login-form',cls:'login',title:'Log In',type:'form',method:'POST',action:'/user/login',
fields:[
- {label:'Username', name:'user[username]', type:'text'},
+ {label:'Username', name:'user[username]', type:'textbox'},
{label:'Password', name:'user[password]', type:'password'}
],
buttons:[

0 comments on commit f4581b5

Please sign in to comment.