-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added untracked files and updated readme with useful info
- Loading branch information
1 parent
49b0451
commit faa31d2
Showing
1,499 changed files
with
294,576 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
[submodule "deps/node-mongodb-native"] | ||
path = deps/node-mongodb-native | ||
url = http://github.com/christkv/node-mongodb-native.git | ||
|
||
[submodule "deps/step"] | ||
path = deps/step | ||
url = http://github.com/creationix/step.git | ||
|
||
[submodule "deps/nodejs-autorestart"] | ||
path = deps/nodejs-autorestart | ||
url = http://github.com/shimondoodkin/nodejs-autorestart.git | ||
|
||
[submodule "deps/nodejs-clone-extend"] | ||
path = deps/nodejs-clone-extend | ||
url = http://github.com/shimondoodkin/nodejs-clone-extend.git | ||
|
||
[submodule "deps/nodejs-meta-templates"] | ||
path = deps/nodejs-meta-templates | ||
url = http://github.com/shimondoodkin/nodejs-meta-templates.git | ||
|
||
[submodule "deps/node-formidable"] | ||
path = deps/node-formidable | ||
url = http://github.com/felixge/node-formidable.git | ||
|
||
[submodule "deps/node-microseconds"] | ||
path = deps/node-microseconds | ||
url = http://github.com/tmpvar/node-microseconds.git | ||
|
||
[submodule "deps/jMediaelement"] | ||
path = deps/jMediaelement | ||
url = http://github.com/aFarkas/jMediaelement.git | ||
|
||
[submodule "deps/restler"] | ||
path = deps/restler | ||
url = http://github.com/ashleydev/restler.git |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
/* | ||
there is: | ||
app // application | ||
app.[lib name]=lib // dependency sharing | ||
app.models.[model name]=model object // models | ||
app.pages.[controller name]=controller object // controllers | ||
app.url_routes.[route name]=route object // application routes | ||
templates: | ||
temlates are parts of a templates object: | ||
var tempaltes_object={ | ||
load_tempalts:{temaplte_name1:"filename.html"}, | ||
prepere_templates:{temaplte_name2:function(vars,callback){var echo=""; if(callback)callback(echo);else return echo;}}, // never used actualy | ||
prepeare_data:function(currenttempaltename,callback){ var template_prepere_data={}; callback(template_prepere_data);} | ||
} | ||
there is a shared function of prepere a templates object. | ||
aftrer it is ran: | ||
the result is a tempaltes object with functions by their names: | ||
var tempaltes_object={ | ||
load_tempalts:{temaplte_name1:"filename.html"}, | ||
prepere_templates:{temaplte_name2:function(vars,callback){var echo=""; if(callback)callback(echo);else return echo;}}, // never used actualy | ||
prepeare_data:function(currenttempaltename,callback){ var template_prepere_data={}; callback(template_prepere_data);} | ||
} | ||
temaplte_name1:function(...){...} | ||
temaplte_name2:function(...){...} | ||
you use templates like this: | ||
tamplates_object.function(vars,callback); | ||
a template: | ||
structure of a tempaltes function: | ||
function(vars,callback) | ||
{ | ||
var echo=""; | ||
//my code is here | ||
if(callback) | ||
callback(echo); | ||
else | ||
return echo; | ||
} | ||
example of a tempalte and the result: | ||
template.html: | ||
hello world <?if(vars.name){?><?=vars.name?><?}?> | ||
function(vars,callback) | ||
{ | ||
var echo=""; | ||
echo +="hello world "; | ||
if(vars.name){ | ||
echo +=vars.name; | ||
} | ||
if(callback) | ||
callback(echo); | ||
else | ||
return echo; | ||
} | ||
*/ | ||
|
||
var app={};this.app = app; | ||
|
||
|
||
app.libs={}; | ||
|
||
app.autoreload = require('deps/node-hot-reload'); app.autoreload.path=__dirname; | ||
app._ = require('deps/nodejs-clone-extend/merger'); // lets do: _.extend(same,otherobjexts), _.clone(obj) - creates new reference, see source to understand // | ||
app.phpjs = require('phpjs'); // http://phpjs.org/packages/view/2693/name:806d77a73ce93d851a4620f4a788acd7 | ||
app.date = require('date'); // http://phpjs.org/packages/view/2693/name:806d77a73ce93d851a4620f4a788acd7 | ||
|
||
app.path = require('path'); | ||
app.fs = require('fs'); | ||
app.doubletemplate = require('deps/nodejs-meta-templates/doubletemplate');; | ||
app.httputils = require('httputils'); | ||
app.ObjectID = require('deps/node-mongodb-native/lib/mongodb/bson/bson').ObjectID; | ||
app.step = require('deps/step/lib/step'); | ||
app.sys = require('sys'); | ||
app.inflow = require('deps/node-inflow'); | ||
app.url = require('url'); // allaws to parse urls | ||
|
||
app.files_path=__dirname+'/files/'; | ||
app.root_path=__dirname; | ||
app.templates_path=__dirname+'/templates/'; app.doubletemplate.templates_path=app.templates_path; | ||
|
||
app.server={port:8000}; | ||
app.websocket={port:8000}; | ||
app.database={name:'test',server:'localhost',port:27017}; | ||
app.models={}; | ||
app.urls_route_before=[]; | ||
app.url_routes=[]; | ||
app.url_routes_after=[]; | ||
|
||
app.menus={}; | ||
app.collections={}; | ||
|
||
|
||
require('./basicapp_shared_templates').main(app); | ||
|
||
require('./basicfields').main(app); | ||
require('./basicmodel').main(app); | ||
|
||
require('./basicapp_loaddata').main(app); | ||
require('./basicapp_subitems').main(app); | ||
|
||
require('./basicapp_handle_request').main(app); | ||
require('./basicapp_extend_request').main(app); | ||
require('./basicapp_init').main(app); | ||
require('./basicapp_pages').main(app); | ||
require('./dbutil').main(app); | ||
|
||
/* | ||
// auto reload httputils modul during development | ||
app.autoreload.watchrel("httputils.js", function (newmodule) | ||
{ | ||
app.httputils=newmodule; | ||
}); | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
this.main=function(app) | ||
{ | ||
|
||
var cookie = { | ||
req:null, | ||
get:function() { | ||
var req = this.req; | ||
return (req.headers.cookie ? this.parse(req.headers.cookie) : {}); | ||
}, | ||
parse:function(str) { | ||
var obj = {}, | ||
pairs = str.split(/[;,] */); | ||
for (var i = 0, len = pairs.length; i < len; ++i) { | ||
var pair = pairs[i], | ||
eqlIndex = pair.indexOf('='), | ||
key = pair.substr(0, eqlIndex).trim().toLowerCase(), | ||
val = pair.substr(++eqlIndex, pair.length).trim(); | ||
// Quoted values | ||
if (val[0] === '"') { | ||
val = val.slice(1, -1); | ||
} | ||
// Only assign once | ||
if (obj[key] === undefined) { | ||
//obj[key] = querystring.unescape(val, true); | ||
obj[key] = val; | ||
} | ||
} | ||
return obj; | ||
} | ||
}; | ||
|
||
|
||
function getuser(callback){ | ||
var req = this; | ||
data = req.cookie.get(); | ||
if (data.user_id){ | ||
data.user_id = app.ObjectID.createFromHexString(data.user_id); | ||
app.models.t2_users.getall({_id:data.user_id} , function(result){ | ||
if (result.length>0){ | ||
req.user = result[0]; | ||
callback(req.user); | ||
} else { | ||
callback(false); | ||
} | ||
|
||
}); | ||
} else { | ||
callback(false); | ||
} | ||
} | ||
|
||
function redirect(res, url, callback, code ) { | ||
res.writeHead( code || 302, {'Location': url } ); | ||
res.end(); | ||
if(callback)callback(); | ||
}; | ||
|
||
function query_to_string(query){ | ||
var query_string = ''; | ||
var prefix = '?'; | ||
for (var name in query){ | ||
query_string+= prefix + name + '=' + query[name]; | ||
prefix = '&'; | ||
} | ||
return query_string; | ||
} | ||
|
||
|
||
app.extendrequest=function (req) | ||
{ | ||
req.cookie = cookie; | ||
req.cookie.req = req; | ||
req.user = null; | ||
req.getuser = getuser; | ||
req.redirect = redirect; | ||
req.query_to_string = query_to_string; | ||
/* | ||
req.sessions={} | ||
req.sessions.req=req; | ||
req.sessions.save=session.save; | ||
*/ | ||
}; | ||
} |
Oops, something went wrong.