Example #1
0
      function done() {

        // Schema
        var ContentVersion = new calipso.lib.mongoose.Schema({
          contentId:{type: String}
          // All other properties are dynamically mapped, hence use of .set / .get
        });

        calipso.lib.mongoose.model('ContentVersion', ContentVersion);

        // Version event listeners
        calipso.e.post('CONTENT_CREATE',module.name,saveVersion);
        calipso.e.post('CONTENT_UPDATE',module.name,saveVersion);

        // Form alteration
        if(calipso.modules.content.fn.originalContentForm) {
          // We have already altered the form, so lets set it back before altering it
          calipso.modules.content.fn.contentForm = calipso.modules.content.fn.originalContentForm;
        }

        // Now, lets alter the form
        calipso.modules.content.fn.originalContentForm = calipso.modules.content.fn.contentForm;
        calipso.modules.content.fn.contentForm = function() {
          var form = calipso.modules.content.fn.originalContentForm();
          form.sections.push(contentVersionFormSection);
          return form;
        }

        next();

      }
Example #2
0
/**
 * Initialisation
 */
function init(module, app, next) {

  calipso.e.addEvent('USER_ROLE_CREATE');
  calipso.e.addEvent('USER_ROLE_UPDATE');
  calipso.e.addEvent('USER_ROLE_DELETE');

  calipso.permission.Helper.addPermission("admin:roles", "Roles", true);

  calipso.lib.async.map(routes, function (options, next) {
      module.router.addRoute(options, next)
    },
    function (err, data) {

      // Done adding routes
      var Role = new calipso.lib.mongoose.Schema({
        name:{type:String, required:true, unique:true},
        description:{type:String, "default":''},
        isAdmin:{type:Boolean, required:true, "default":false},
        isDefault:{type:Boolean, required:true, "default":false}
      });
      calipso.db.model('Role', Role);

      // Load roles into calipso data
      if (app.config.get('installed')) {
        storeRoles(null, null, next);
      }

    });

  // Register event listeners
  calipso.e.post('USER_ROLE_CREATE', module.name, storeRoles);
  calipso.e.post('USER_ROLE_UPDATE', module.name, storeRoles);
  calipso.e.post('USER_ROLE_DELETE', module.name, storeRoles);

}
Example #3
0
/**
 *Init
 */
function init(module, app, next) {

  // Register events for the Content Module
  calipso.e.addEvent('CONTENT_TYPE_CREATE');
  calipso.e.addEvent('CONTENT_TYPE_UPDATE');
  calipso.e.addEvent('CONTENT_TYPE_DELETE');
  calipso.e.addEvent('CONTENT_TYPE_MAP_FIELDS');

  // Register event listeners
  calipso.e.post('CONTENT_TYPE_CREATE', module.name, storeContentTypes);
  calipso.e.post('CONTENT_TYPE_UPDATE', module.name, storeContentTypes);
  calipso.e.post('CONTENT_TYPE_DELETE', module.name, storeContentTypes);

  calipso.e.post('CONTENT_TYPE_CREATE', module.name, updateContentAfterChange);
  calipso.e.post('CONTENT_TYPE_UPDATE', module.name, updateContentAfterChange);

  calipso.e.pre('CONTENT_TYPE_CREATE', module.name, compileTemplates);
  calipso.e.pre('CONTENT_TYPE_UPDATE', module.name, compileTemplates);

  // Define permissions
  calipso.permission.Helper.addPermission("admin:content:type", "Content Types", true);

  // Schemea

  

	  calipso.db.model('ContentType', ContentType);

	
 
 
  // Cache the content types in the calipso.data object
  if (app.config.get('installed')) {
    storeContentTypes(null, null, function () {
      module.initialised = true;
      next();
    });
  } else {
    module.initialised = true;
    next();
  }
  
  
  
  h.loadContentTypes();
  
  
}
Example #4
0
/**
 *Init
 */
function init(module,app,next) {

  // Register events for the Content Module
  calipso.e.addEvent('CONTENT_TYPE_CREATE');
  calipso.e.addEvent('CONTENT_TYPE_UPDATE');
  calipso.e.addEvent('CONTENT_TYPE_DELETE');

  // Register event listeners
  calipso.e.post('CONTENT_TYPE_CREATE',module.name,storeContentTypes);
  calipso.e.post('CONTENT_TYPE_UPDATE',module.name,storeContentTypes);
  calipso.e.post('CONTENT_TYPE_DELETE',module.name,storeContentTypes);

  calipso.e.post('CONTENT_TYPE_CREATE',module.name,updateContentAfterChange);
  calipso.e.post('CONTENT_TYPE_UPDATE',module.name,updateContentAfterChange);

  calipso.e.pre('CONTENT_TYPE_CREATE',module.name,compileTemplates);
  calipso.e.pre('CONTENT_TYPE_UPDATE',module.name,compileTemplates);

  // Define permissions
  calipso.permission.Helper.addPermission("admin:content:type","Content Types",true);

  // Schemea
  var ContentType = new calipso.lib.mongoose.Schema({
    contentType:{type: String, required: true, unique: true, "default": 'default', index: true},
    description:{type: String, required: true, "default": 'Default Content Type'},
    layout:{type: String, required: true, "default": 'default'},
    ispublic:{type: Boolean, required: true, "default": true},
    created: { type: Date, "default": Date.now },
    updated: { type: Date, "default": Date.now },
    fields: {type: String, "default":""},
    templateLanguage:{type: String, required: true, "default": 'html'},
    viewTemplate:{type: String, "default": ''},
    listTemplate:{type: String, "default": ''},        
  });

  calipso.db.model('ContentType', ContentType);

  // Cache the content types in the calipso.data object
  if(app.config.get('installed')) {
    storeContentTypes(null,null,function(){});
  }

  module.initialised = true;
  next();

}
Example #5
0
    function done() {

      // Define our tag clouds
      var Tag = new calipso.lib.mongoose.Schema({
        // Tag name is in _ID from MR
        "_id":{type:String},
        "value":{type:Number}
      });

      calipso.db.model('Tag', Tag);

      // Register for events
      calipso.e.post('CONTENT_CREATE', module.name, mapReduceTagCloud);
      calipso.e.post('CONTENT_UPDATE', module.name, mapReduceTagCloud);
      calipso.e.post('CONTENT_DELETE', module.name, mapReduceTagCloud);

      next();
    }
Example #6
0
      function done() {

        // Schema
        var ContentVersion = new calipso.lib.mongoose.Schema({
          contentId:{type: String}
          // All other properties are dynamically mapped, hence use of .set / .get
        });

        calipso.db.model('ContentVersion', ContentVersion);

        // Version event listeners
        calipso.e.post('CONTENT_CREATE', module.name, saveVersion);
        calipso.e.post('CONTENT_UPDATE', module.name, saveVersion);

        // Form alter of main content form
        calipso.e.custom('FORM', 'content-form', module.name, alterContentForm);

        next();

      }
Example #7
0
 mailTemplates.forEach(function (mt) {
   if (!mt.event) {
     return;
   }
   calipso.e.post(mt.event, module.name, function (e, data) {
     MailTemplate.find({event:e.substring(5)}, function (err, mts) {
       if (err || !mts) {
         calipso.debug("Email: " + mts.name + " was not sent because: " + (err || "unknown."));
       }
       sendMail(mts, data);
     });
   });
 });
Example #8
0
/**
 * Init
 */
function init(module, app, next) {

  // Register events for the Content Module
  calipso.e.addEvent('PERMISSIONS_UPDATE');

  calipso.e.post('PERMISSIONS_UPDATE',module.name,loadPermissionRoles);

  calipso.permission.Helper.addPermission("admin:permission:configuration","Manage role based permissions.");


  var PermissionRole = new calipso.lib.mongoose.Schema({
    permission:{type: String, required: true},
    role:{type: String, required: true}
  });
  calipso.db.model('PermissionRole', PermissionRole);

  loadPermissionRoles(function(err) {
    next(err);   
  });

}
Example #9
0
/*
 * Initialisation
 */
function init(module, app, next) {

  // Initialise administration events - enabled for hook.io
  calipso.e.addEvent('CONFIG_UPDATE', {enabled:true});

  // Add listener to config_update
  calipso.e.post('CONFIG_UPDATE', module.name, calipso.reloadConfig);

  calipso.permission.Helper.addPermission("admin:core:configuration", "Manage core configuration.");
  calipso.permission.Helper.addPermission("admin:module:configuration", "Manage module configuration.");
  calipso.permission.Helper.addPermission("admin:core:cache", "View and clear cache.");

  // Admin routes
  calipso.lib.step(

    function defineRoutes() {

      // Permissions
      var corePermit = "admin:core:configuration",
        modulePermit = "admin:module:configuration",
        cachePermit = "admin:core:cache";

      // Core Administration dashboard
      module.router.addRoute('GET /admin', showAdmin, {
        template:'admin',
        block:'admin.show',
        admin:true,
        permit:corePermit
      }, this.parallel());

      module.router.addRoute('GET /admin/config.json', downloadConfig, {
        admin:true,
        permit:corePermit
      }, this.parallel());

      module.router.addRoute('GET /admin/rebuildSass', rebuildSass, {
    	  template:'admin',
    	  block:'admin.show',
          admin:true,
          permit:corePermit
        }, this.parallel());
      
      // Core configuration
      module.router.addRoute('GET /admin/core/config', coreConfig, {
        block:'admin.show',
        admin:true,
        permit:corePermit
      }, this.parallel());

      module.router.addRoute('POST /admin/core/config/save', saveAdmin, {
        admin:true,
        permit:corePermit
      }, this.parallel());
      if (typeof calipso.cache.clear === "function") { // same cause same reason (cf WTF)
        module.router.addRoute('GET /admin/core/cache', showCache, {
          admin:true,
          template:'cache',
          block:'admin.cache',
          permit:cachePermit
        }, this.parallel());
  
        module.router.addRoute('GET /admin/core/cache/clear', clearCache, {
          admin:true,
          template:'cache',
          block:'admin.cache',
          permit:cachePermit
        }, this.parallel());
      }
      module.router.addRoute('GET /admin/core/languages', showLanguages, { 
        admin:true,
        template:'languages',
        block:'admin.languages',
        permit:corePermit
      }, this.parallel());

      module.router.addRoute('GET /admin/modules', modulesConfig, {
        admin:true,
        block:'admin.show',
        permit:modulePermit
      }, this.parallel());

      module.router.addRoute('POST /admin/modules/save', saveModulesConfig, {
        admin:true,
        permit:modulePermit
      }, this.parallel());

      // Default installation routers - only accessible in install mode
      module.router.addRoute('GET /admin/install', install, null, this.parallel());
      module.router.addRoute('POST /admin/install', install, null, this.parallel());
      if (!process.env.MONGO_URI) {
        module.router.addRoute('POST /admin/installTest/mongo', installMongoTest, null, this.parallel());
      }
      module.router.addRoute('POST /admin/installTest/user', installUserTest, null, this.parallel());

    }, function done() {

      next();

    });

}
Example #10
0
function registerEventListeners () {
	calipso.e.post('CIRCLE_CREATE', module.name, addActivity);
	calipso.e.post('CIRCLE_UPDATE', module.name, addActivity);
	calipso.e.post('CIRCLE_DELETE', module.name, addActivity);

	calipso.e.post('CALL_CREATE', module.name, addActivity);
	calipso.e.post('CALL_UPDATE', module.name, addActivity);
	calipso.e.post('CALL_DELETE', module.name, addActivity);

	calipso.e.post('PROJECT_CREATE', module.name, addActivity);
	calipso.e.post('PROJECT_UPDATE', module.name, addActivity);
	calipso.e.post('PROJECT_DELETE', module.name, addActivity);
	calipso.e.post('PROJECT_ITERATE', module.name, addActivity);

	calipso.e.post('USER_ACTIVATE', module.name, addActivity);
	calipso.e.post('USER_LOGIN', module.name, addActivity);

	calipso.e.post('CIRCLE_ADDED_USER', module.name, addActivity);
}