* Updated DB mappings of File/Files getting closer to the one of Image/Images

* Disabled ip address property in LogEntry (will be removed in the long run)
 * Removed custom property from Skin (still needs some care)
 * Removed commented code
This commit is contained in:
Tobi Schäfer 2008-04-16 23:11:47 +00:00
parent 29ca787190
commit 9b4a5bc10e
17 changed files with 68 additions and 84 deletions

View file

@ -270,15 +270,22 @@ Admin.prototype.moduleSetup_macro = function(param) {
Admin.prototype.filterLog = function(data) {
data || (data = {});
var sql = "where action <> 'main' ";
switch (data.filter) {
case "1":
sql += "and context_type = 'Site' "; break;
case "2":
sql += "and context_type = 'User' "; break;
case "3":
sql += "and context_type = 'Root' "; break;
var sql = "";
if (data.filter > 0) {
sql += "where context_type = '";
switch (data.filter) {
case "1":
sql += "Site"; break;
case "2":
sql += "User"; break;
case "3":
sql += "Root"; break;
}
sql += "' and ";
} else {
sql += "where "
}
sql += "action <> 'main' ";
if (data.query) {
var parts = stripTags(data.query).split(" ");
var keyword, like;
@ -291,6 +298,7 @@ Admin.prototype.filterLog = function(data) {
}
sql += "order by created ";
(data.dir == 1) || (sql += "desc");
res.debug(sql)
this.log.subnodeRelation = sql;
return;
};

View file

@ -16,18 +16,20 @@
## See the License for the specific language governing permissions and
## limitations under the License.
##
## $Revision$
## $LastChangedBy$
## $LastChangedDate$
## $Revision:3355 $
## $LastChangedBy:piefke3000 $
## $LastChangedDate:2007-10-11 15:38:29 +0200 (Thu, 11 Oct 2007) $
## $URL$
##
_db = antville
_table = file
_id = id
_prototype = prototype
_parent = site.files
name
prototype
parent_type
parent_id
created
@ -39,16 +41,6 @@ requests.private = true
metadata = mountpoint(Metadata)
metadata_source = metadata
#alias = FILE_ALIAS
#mimetype = FILE_MIMETYPE
#name = FILE_NAME
#filesize = FILE_SIZE
#description = FILE_DESCRIPTION
#createtime = FILE_CREATETIME
#modifytime = FILE_MODIFYTIME
#requestcnt = FILE_REQUESTCNT
#requestcnt.private = true
site = object(Site)
site.local = site_id
site.foreign = id

View file

@ -23,7 +23,9 @@
##
_children = collection(File)
_children.local = id
_children.foreign = site_id
_children.order = created desc
_children.accessname = name
_children.local.1 = $id
_children.foreign.1 = parent_id
_children.local.2 = $prototype
_children.foreign.2 = parent_type
_children.order = created desc

View file

@ -93,6 +93,23 @@ jala.i18n.setLocaleGetter(function() {
return res.handlers.site.getLocale();
});
function onStart() {
// FIXME: Does database exist?
/*var db = getDBConnection("antville");
var rows = db.executeRetrieval("select min(id) as id from site");
rows.next();
var id = rows.getColumnItem("id");
//Packages.helma.main.Server.getServer().stopApplication(app.name);
rows.release();*/
// call onStart methods of modules
for (var i in app.modules) {
if (app.modules[i].onStart)
app.modules[i].onStart();
}
return;
}
function defineConstants(ctor /*, arguments */) {
var constants = [], name;
for (var i=1; i<arguments.length; i+=1) {
@ -115,23 +132,6 @@ function disableMacro(ctor, name) {
return ctor.prototype[name + "_macro"] = idle;
}
function onStart() {
// FIXME: Does database exist?
/*var db = getDBConnection("antville");
var rows = db.executeRetrieval("select min(id) as id from site");
rows.next();
var id = rows.getColumnItem("id");
//Packages.helma.main.Server.getServer().stopApplication(app.name);
rows.release();*/
// call onStart methods of modules
for (var i in app.modules) {
if (app.modules[i].onStart)
app.modules[i].onStart();
}
return;
}
function scheduler() {
flushLog();
Stories.flushRequests();

View file

@ -29,10 +29,11 @@ _prototype = prototype
_parent = parent.images, parent
name
prototype
parent_type
parent_id
created
modified
parent_id
parent_type
metadata = mountpoint(Metadata)
metadata_source = metadata

View file

@ -29,7 +29,6 @@ _children.foreign.1 = parent_id
_children.local.2 = $prototype
_children.foreign.2 = parent_type
_children.order = created desc
#_children.filter = image_f_image_parent is null
galleries = collection(Tag)
galleries.accessname = name

View file

@ -27,8 +27,6 @@ _table = layout
_id = id
_parent = site.layout
## FIXME: is name obsolete?
name
created
modified
mode

View file

@ -26,7 +26,7 @@ LogEntry.prototype.constructor = function(context, action) {
this.context_id = context._id;
this.context_type = context._prototype;
this.action = action || req.action;
this.ip = req.data.http_remotehost;
//this.ip = req.data.http_remotehost;
this.referrer = req.data.http_referer;
this.creator = session.user;
this.created = new Date;

View file

@ -31,7 +31,7 @@ context_id
context_type
action
referrer
ip
#ip
created
creator = object(User)

View file

@ -23,35 +23,35 @@
##
_children = collection(Membership)
_children.accessname = name
_children.local = id
_children.foreign = site_id
_children.accessname = name
_children.order = name asc
owners = collection(Membership)
owners.accessname = name
owners.local = id
owners.foreign = site_id
owners.accessname = name
owners.filter = role = 'Owner'
owners.order = name asc
managers = collection(Membership)
managers.accessname = name
managers.local = id
managers.foreign = site_id
managers.accessname = name
managers.filter = role = 'Manager'
managers.order = name asc
contributors = collection(Membership)
contributors.accessname = name
contributors.local = id
contributors.foreign = site_id
contributors.accessname = name
contributors.filter = role = 'Contributor'
contributors.order = name asc
subscribers = collection(Membership)
subscribers.accessname = name
subscribers.local = id
subscribers.foreign = site_id
subscribers.accessname = name
subscribers.filter = role = 'Subscriber'
subscribers.order = name asc

View file

@ -16,9 +16,9 @@
## See the License for the specific language governing permissions and
## limitations under the License.
##
## $Revision$
## $LastChangedBy$
## $LastChangedDate$
## $Revision:3355 $
## $LastChangedBy:piefke3000 $
## $LastChangedDate:2007-10-11 15:38:29 +0200 (Thu, 11 Oct 2007) $
## $URL$
##
@ -51,6 +51,6 @@ _children.foreign = poll_id
_children.order = id asc
votes = collection(Vote)
votes.accessname = creator_name
votes.local = id
votes.foreign = poll_id
votes.accessname = creator_name

View file

@ -525,9 +525,9 @@ Site.prototype.referrers_macro = function() {
date.setDate(date.getDate() - 1);
var db = getDBConnection("antville");
var query = "select referrer, count(*) as requests from log " +
"where action = 'main' and context_type = 'Site' and context_id = " +
this._id + " and created > {ts '" + date.format("yyyy-MM-dd HH:mm:ss") +
"'} group by referrer order by requests desc, referrer asc;";
"where context_type = 'Site' and context_id = " + this._id +
" and created > {ts '" + date.format("yyyy-MM-dd HH:mm:ss") +
"'} and action = 'main' group by referrer order by requests desc, referrer asc;";
var rows = db.executeRetrieval(query);
var referrer;
while (rows.next()) {

View file

@ -39,10 +39,11 @@ metadata_source = metadata
archive = mountpoint(Archive)
members = mountpoint(Members)
images = mountpoint(Images)
#layouts = mountpoint(Layouts)
files = mountpoint(Files)
stories = mountpoint(Stories)
polls = mountpoint(Polls)
tags = mountpoint(Tags)
galleries = mountpoint(Tags)
creator = object(User)
creator.local = creator_id
@ -59,6 +60,3 @@ layout.foreign = id
$tags = collection(Tag)
$tags.local = id
$tags.foreign = site_id
tags = mountpoint(Tags)
galleries = mountpoint(Tags)

View file

@ -28,7 +28,6 @@ Skin.CUSTOMIZABLE_PROTOTYPES = ["Archive", "Choice", "Comment", "File",
Skin.prototype.constructor = function(prototype, name) {
this.prototype = prototype;
this.name = name;
this.custom = false;
this.creator = this.modifier = session.user;
this.created = this.modified = new Date;
return this;
@ -281,6 +280,11 @@ Skin.prototype.getMainSkin = function() {
return createSkin(source);
}
Skin.prototype.custom_macro = function() {
// FIXME:
return false;
};
Skin.prototype.render = function() {
return renderSkin(createSkin(this.getSource()));
};

View file

@ -33,8 +33,6 @@ source
created
modified
custom = SKIN_ISCUSTOM
layout = object(Layout)
layout.local = layout_id
layout.foreign = id

View file

@ -23,22 +23,20 @@
##
_children = collection(Skin)
_children.accessname = name
_children.local = id
_children.foreign = layout_id
_children.accessname = name
_children.group = prototype
_children.loadmode = aggressive
modified = collection(Skin)
modified.local = id
modified.foreign = layout_id
modified.filter = SKIN_ISCUSTOM = 0
modified.order = prototype, name
modified.loadmode = aggressive
custom = collection(Skin)
custom.local = id
custom.foreign = layout_id
custom.filter = SKIN_ISCUSTOM = 1
custom.order = prototype, name
custom.loadmode = aggressive

View file

@ -45,20 +45,6 @@ parent_type
metadata = mountpoint(Metadata)
metadata_source = metadata
#day = TEXT_DAY
#title = TEXT_TITLE
#text = TEXT_TEXT
#rawcontent = TEXT_RAWCONTENT
#online = TEXT_ISONLINE
#editableby = TEXT_EDITABLEBY
#discussions = TEXT_HASDISCUSSIONS
#createtime = TEXT_CREATETIME
#modifytime = TEXT_MODIFYTIME
#ipaddress = TEXT_IPADDRESS
#content = mountpoint(PropertyMgr)
#content_xml = TEXT_CONTENT
site = object(Site)
site.local = site_id
site.foreign = id