Sotaro KARASAWA 10 лет назад
Родитель
Сommit
b678810fc9
4 измененных файлов с 36 добавлено и 0 удалено
  1. 1 0
      lib/crowi/index.js
  2. 19 0
      lib/events/page.js
  3. 5 0
      lib/models/page.js
  4. 11 0
      lib/service/notification.js

+ 1 - 0
lib/crowi/index.js

@@ -41,6 +41,7 @@ function Crowi (rootdir, env)
 
   this.events = {
     user: new (require(self.eventsDir + 'user'))(this),
+    page: new (require(self.eventsDir + 'page'))(this),
   };
 
   if (this.node_env == 'development') {

+ 19 - 0
lib/events/page.js

@@ -0,0 +1,19 @@
+var debug = require('debug')('crowi:events:page');
+var util = require('util');
+var events = require('events');
+var sprintf = require('sprintf');
+
+function PageEvent(crowi) {
+  this.crowi = crowi;
+
+  events.EventEmitter.call(this);
+}
+util.inherits(PageEvent, events.EventEmitter);
+
+PageEvent.prototype.onUpdated = function(page) {
+  var User = this.crowi.model('User');
+  var Page = this.crowi.model('Page');
+
+};
+
+module.exports = PageEvent;

+ 5 - 0
lib/models/page.js

@@ -7,6 +7,9 @@ module.exports = function(crowi) {
     , GRANT_SPECIFIED = 3
     , GRANT_OWNER = 4
     , PAGE_GRANT_ERROR = 1
+
+    , pageEvent = crowi.event('page')
+
     , pageSchema;
 
   function isPortalPath(path) {
@@ -31,6 +34,8 @@ module.exports = function(crowi) {
     updatedAt: Date
   });
 
+  pageEvent.on('updated', pageEvent.onUpdated);
+
   pageSchema.methods.isPublic = function() {
     if (!this.grant || this.grant == GRANT_PUBLIC) {
       return true;

+ 11 - 0
lib/service/notification.js

@@ -0,0 +1,11 @@
+
+function Notification() {
+}
+
+Notification.prototype.loadModules = function() {
+};
+
+Notification.prototype.onPageUpdated = function(page) {
+};
+
+module.exports = Notification;