From 32d2230ef5d5f7dc46c6cf5ce2b28e8da2c433c9 Mon Sep 17 00:00:00 2001 From: hns Date: Fri, 31 May 2002 14:14:37 +0000 Subject: [PATCH] Updated code to new session/app/req/res object layout. --- Application/main.hac | 4 ++-- DocApplication/main.hac | 8 ++++---- DocFunction/main.hac | 6 +++--- DocPrototype/main.hac | 6 +++--- Global/functions.js | 41 +++++++++++++++++++++-------------------- Root/main.hac | 8 +++----- 6 files changed, 36 insertions(+), 37 deletions(-) diff --git a/Application/main.hac b/Application/main.hac index 40a43c35..016058d0 100644 --- a/Application/main.hac +++ b/Application/main.hac @@ -5,6 +5,6 @@ if ( checkAddress()==false ) return; if ( checkAuth(this)==false ) return; -res.skin="global"; -res.body = this.renderSkinAsString("main"); +res.data.body = this.renderSkinAsString("main"); +renderSkin ("global"); diff --git a/DocApplication/main.hac b/DocApplication/main.hac index cac9f238..f61fec7c 100644 --- a/DocApplication/main.hac +++ b/DocApplication/main.hac @@ -12,12 +12,12 @@ if ( req.data.action=="reload" ) { } if ( req.data.action=="index" ) { - res.body = this.renderSkinAsString("index"); + res.data.body = this.renderSkinAsString("index"); } else { - res.body = this.renderSkinAsString("main"); + res.data.body = this.renderSkinAsString("main"); } -res.skin = "api"; -res.title = "Application " + this.name; +res.data.title = "Application " + this.name; +renderSkin("api"); diff --git a/DocFunction/main.hac b/DocFunction/main.hac index ef413f29..6faae50d 100644 --- a/DocFunction/main.hac +++ b/DocFunction/main.hac @@ -1,8 +1,8 @@ if ( checkAddress()==false ) return; if ( checkAuth(this)==false ) return; -res.body = this.renderSkinAsString("main"); -res.skin = "api"; -res.title = "Application " + this.name; +res.data.body = this.renderSkinAsString("main"); +res.data.title = "Application " + this.name; +renderSkin("api"); diff --git a/DocPrototype/main.hac b/DocPrototype/main.hac index ef413f29..77ebcb02 100644 --- a/DocPrototype/main.hac +++ b/DocPrototype/main.hac @@ -1,8 +1,8 @@ if ( checkAddress()==false ) return; if ( checkAuth(this)==false ) return; -res.body = this.renderSkinAsString("main"); -res.skin = "api"; -res.title = "Application " + this.name; +res.data.body = this.renderSkinAsString("main"); +res.data.title = "Application " + this.name; +renderSkin ("api"); diff --git a/Global/functions.js b/Global/functions.js index 97d90318..14c917ad 100644 --- a/Global/functions.js +++ b/Global/functions.js @@ -3,19 +3,19 @@ /** * scheduler function, runs global.appStat every minute */ -function scheduler() { +function scheduler() { appStat(); return 60000; } /** - * initializes app.requestStat storage on startup, - * creates app.addressFilter + * initializes app.data.requestStat storage on startup, + * creates app.data.addressFilter */ -function onStart() { - app.requestStat = new HopObject(); - app.addressFilter = createAddressFilter(); +function onStart() { + app.data.requestStat = new HopObject(); + app.data.addressFilter = createAddressFilter(); } /** @@ -36,29 +36,29 @@ function createAddressFilter() { var result = tryEval("filter.addAddress(str);"); } if ( result.error==null ) { - app.__app__.logEvent( "allowed address for app manage: " + str ); + app.log( "allowed address for app manage: " + str ); } } } else { - app.__app__.logEvent("no addresses allowed for app manage, all access will be denied"); + app.log("no addresses allowed for app manage, all access will be denied"); } return filter; } /** - * updates the request stats in app.requestStat every 5 minutes + * updates the request stats in app.data.requestStat every 5 minutes */ function appStat() { - if ( app.requestStat==null ) { - app.requestStat = new HopObject(); + if ( app.data.requestStat==null ) { + app.data.requestStat = new HopObject(); } - if( (new Date()-300000) < app.requestStat.lastRun ) { + if( (new Date()-300000) < app.data.requestStat.lastRun ) { return; } var arr = root.getApplications(); for ( var i=0; i