* Fixed reference to parent site in Archive
* Fixed _children.filter in Archive * Added missing permission checks * Modified global defineConstants() method to return the getter function instead of automatically defining it with given argument * Added HopObject.macro_macro() method to display userland macro code * Removed colorpicker (will be replaced by third-party library) * Removed obsolete global constants and functions * Overhauled and tested global userland macros like story_macro(), image_macro() etc. * Implemented global list_macro() to replace any special listFoobar_macro() methods * Moved global autoLogin() method into User prototype * Overhauled global randomize_macro() * Renamed global evalURL() method to validateUrl() as well as evalEmail() to validateEmail() * Re-added accidentally removed subskins to Members.skin * Fixed some skin names which were changed recently * Remove delete_action() from Membership * Fixed foreign key of images collection in Membership * Removed global username_macro() and replaced it with appropriate membership macros * Moved contents of systemscripts.skin into javascript.skin in Root prototype * Removed main_css_action(), main_js_action() and sitecounter_macro() methods from Root * Added accessname to sites collection in Root * Upgraded jQuery to version 1.2.1 * Replaced call for global history_macro() with corresponding list_macro() call * Renamed "public" collection of Stories prototype to "featured" * Moved a lot of styles from Root's style.skin to the one in Site * Added comments collection to Site * Moved embed.skin as subskin #embed into Site.skin * Fixed some minor issues in Story.js (removed check for creator before setting the story's mode) * Defined cookie names as constants of User which can be overriden via app.properties userCookie and hashCookie * Moved a lot of code into compatibility module
This commit is contained in:
parent
ded7f5fcea
commit
df9017ab77
38 changed files with 1154 additions and 1736 deletions
|
@ -22,11 +22,11 @@
|
|||
// $URL$
|
||||
//
|
||||
|
||||
defineConstants(Site, "getStatus", "blocked", "regular", "trusted");
|
||||
defineConstants(Site, "getModes", "closed", "restricted", "public", "open");
|
||||
defineConstants(Site, "getPageModes", "days", "stories");
|
||||
defineConstants(Site, "getCommentsModes", "disabled", "enabled");
|
||||
defineConstants(Site, "getArchiveModes", "closed", "public");
|
||||
Site.getStatus = defineConstants(Site, "blocked", "regular", "trusted");
|
||||
Site.getModes = defineConstants(Site, "closed", "restricted", "public", "open");
|
||||
Site.getPageModes = defineConstants(Site, "days", "stories");
|
||||
Site.getCommentsModes = defineConstants(Site, "disabled", "enabled");
|
||||
Site.getArchiveModes = defineConstants(Site, "closed", "public");
|
||||
|
||||
this.handleMetadata("archiveMode");
|
||||
this.handleMetadata("commentsMode");
|
||||
|
@ -88,7 +88,7 @@ Site.prototype.getPermission = function(action) {
|
|||
case "rss.xml":
|
||||
case "tags":
|
||||
return this.status !== Site.BLOCKED &&
|
||||
User.require(User.REGULAR) &&
|
||||
!User.require(User.BLOCKED) &&
|
||||
Site.require(Site.PUBLIC) ||
|
||||
Site.require(Site.RESTRICTED) &&
|
||||
Membership.require(Membership.SUBSCRIBER) ||
|
||||
|
@ -98,12 +98,12 @@ Site.prototype.getPermission = function(action) {
|
|||
case "edit":
|
||||
case "referrers":
|
||||
return this.status !== Site.BLOCKED &&
|
||||
User.require(User.REGULAR) &&
|
||||
!User.require(User.BLOCKED) &&
|
||||
Membership.require(Membership.OWNER) ||
|
||||
User.require(User.PRIVILEGED);
|
||||
case "subscribe":
|
||||
return this.status !== Site.BLOCKED &&
|
||||
User.require(User.REGULAR) &&
|
||||
!User.require(User.BLOCKED) &&
|
||||
Site.require(Site.PUBLIC) &&
|
||||
!Membership.require(Membership.SUBSCRIBER);
|
||||
case "unsubscribe":
|
||||
|
@ -201,10 +201,10 @@ Site.prototype.update = function(data) {
|
|||
mode: data.mode || Site.PRIVATE,
|
||||
webHookUrl: data.webHookUrl,
|
||||
webHookEnabled: data.webHookEnabled ? true : false,
|
||||
pageMode: data.pageMode || 'days',
|
||||
pageMode: data.pageMode || Site.DAYS,
|
||||
pageSize: parseInt(data.pageSize, 10) || 3,
|
||||
commentsMode: data.commentsMode,
|
||||
archiveMode: data.archiveMode,
|
||||
commentsMode: data.commentsMode || Site.DISABLED,
|
||||
archiveMode: data.archiveMode || Site.CLOSED,
|
||||
timeZone: data.timeZone,
|
||||
longDateFormat: data.longDateFormat,
|
||||
shortDateFormat: data.shortDateFormat,
|
||||
|
@ -228,8 +228,8 @@ Site.remove = function(site) {
|
|||
};
|
||||
|
||||
Site.prototype.main_css_action = function() {
|
||||
res.dependsOn(this.modifytime);
|
||||
res.dependsOn(res.handlers.layout.modifytime);
|
||||
res.dependsOn(this.modified);
|
||||
res.dependsOn(res.handlers.layout.modified);
|
||||
res.dependsOn(res.handlers.layout.skins.getSkinSource("Site", "style"));
|
||||
res.digest();
|
||||
res.contentType = "text/css";
|
||||
|
@ -238,13 +238,13 @@ Site.prototype.main_css_action = function() {
|
|||
};
|
||||
|
||||
Site.prototype.main_js_action = function() {
|
||||
res.dependsOn(this.modifytime);
|
||||
res.dependsOn(res.handlers.layout.modifytime);
|
||||
res.dependsOn(this.modified);
|
||||
res.dependsOn(res.handlers.layout.modified);
|
||||
res.dependsOn(res.handlers.layout.skins.getSkinSource("Site", "javascript"));
|
||||
res.digest();
|
||||
res.contentType = "text/javascript";
|
||||
this.renderSkin("javascript");
|
||||
root.renderSkin("systemscripts");
|
||||
root.renderSkin("javascript");
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -523,7 +523,7 @@ Site.prototype.getMacroHandler = function(name) {
|
|||
Site.prototype.list_macro = function(param, type) {
|
||||
switch (type) {
|
||||
case "stories":
|
||||
if (this.stories["public"].size() < 1) {
|
||||
if (this.stories.featured.size() < 1) {
|
||||
this.renderSkin("Site#welcome");
|
||||
if (session.user) {
|
||||
if (session.user === this.creator) {
|
||||
|
@ -567,39 +567,6 @@ Site.prototype.age_macro = function(param) {
|
|||
return;
|
||||
};
|
||||
|
||||
Site.prototype.history_macro = function(param, type) {
|
||||
param.limit = Math.min(param.limit || 10, 20);
|
||||
type || (type = param.show);
|
||||
var stories = this.stories.recent;
|
||||
var size = stories.size();
|
||||
var counter = i = 0;
|
||||
var item;
|
||||
while (counter < param.limit && i < size) {
|
||||
if (i % param.limit === 0) {
|
||||
stories.prefetchChildren(i, param.limit);
|
||||
}
|
||||
item = stories.get(i);
|
||||
i += 1;
|
||||
switch (item.constructor) {
|
||||
case Story:
|
||||
if (type === "comments") {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case Comment:
|
||||
if (type === "stories" || item.story.mode === Story.PRIVATE ||
|
||||
item.story.commentsMode === Story.CLOSED ||
|
||||
this.commentsMode === Site.CLOSED) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
item.renderSkin("Story#history");
|
||||
counter += 1;
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
||||
Site.prototype.referrers_macro = function() {
|
||||
var date = new Date;
|
||||
date.setDate(date.getDate() - 1);
|
||||
|
@ -810,70 +777,6 @@ Site.prototype.searchCreatetime_macro = function() {
|
|||
return;
|
||||
};
|
||||
|
||||
/** FIXME: to be removed!
|
||||
* function saves new properties of site
|
||||
* @param Obj Object containing the form values
|
||||
* @param Obj User-Object modifying this site
|
||||
* @throws Exception
|
||||
*/
|
||||
Site.prototype.evalPreferences = function(data, user) {
|
||||
res.debug(data);
|
||||
//res.abort();
|
||||
|
||||
return;
|
||||
|
||||
|
||||
this.title = stripTags(param.title);
|
||||
this.email = param.email;
|
||||
if (this.online && !param.online)
|
||||
this.lastoffline = new Date();
|
||||
this.online = param.online ? 1 : 0;
|
||||
this.enableping = param.enableping ? 1 : 0;
|
||||
|
||||
// store new preferences
|
||||
var prefs = new HopObject();
|
||||
for (var i in param) {
|
||||
if (i.startsWith("properties_"))
|
||||
prefs[i.substring(12)] = param[i];
|
||||
}
|
||||
prefs.days = !isNaN(parseInt(param.properties_days, 10)) ? parseInt(param.properties_days, 10) : 3;
|
||||
prefs.discussions = param.properties_discussions ? 1 : 0;
|
||||
prefs.usercontrib = param.properties_usercontrib ? 1 : 0;
|
||||
prefs.archive = param.properties_archive ? 1 : 0;
|
||||
// store selected locale
|
||||
if (param.locale) {
|
||||
var loc = param.locale.split("_");
|
||||
prefs.language = loc[0];
|
||||
prefs.country = loc.length == 2 ? loc[1] : null;
|
||||
}
|
||||
prefs.timezone = param.timezone;
|
||||
prefs.longdateformat = param.longdateformat;
|
||||
prefs.shortdateformat = param.shortdateformat;
|
||||
|
||||
// layout
|
||||
this.layout = param.layout ? this.layouts.get(param.layout) : null;
|
||||
|
||||
// e-mail notification
|
||||
prefs.notify_create = parseInt(param.notify_create, 10) || null;
|
||||
prefs.notify_update = parseInt(param.notify_update, 10) || null;
|
||||
prefs.notify_upload = parseInt(param.notify_upload, 10) || null;
|
||||
|
||||
// store preferences
|
||||
this.properties.setAll(prefs);
|
||||
// call the evalPreferences method of every module
|
||||
for (var i in app.modules)
|
||||
this.applyModuleMethod(app.modules[i], "evalPreferences", param);
|
||||
|
||||
|
||||
// reset cached locale, timezone and dateSymbols
|
||||
this.cache.locale = null;
|
||||
this.cache.timezone = null;
|
||||
this.cache.dateSymbols = null;
|
||||
|
||||
this.modifytime = new Date();
|
||||
this.modifier = modifier;
|
||||
};
|
||||
|
||||
Site.prototype.getLayouts = function() {
|
||||
var result = [];
|
||||
this.layouts.forEach(function() {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<% #main %>
|
||||
<% list tobi/comments %>
|
||||
<% site.list stories %>
|
||||
|
||||
<% #preview %>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<meta http-equiv="Content-Type" content="text/html" />
|
||||
<meta name="MSSmartTagsPreventParsing" content="TRUE" />
|
||||
<script type="text/javascript"
|
||||
src="<% file /jquery-1.1.3.1.pack.js url %>"></script>
|
||||
src="<% file /jquery-1.2.1.min.js url %>"></script>
|
||||
<script type="text/javascript" src="<% site.href main.js %>"></script>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
title="CSS Stylesheet" href="<% site.href main.css %>" />
|
||||
|
@ -67,8 +67,8 @@
|
|||
<div class="boxheader">calendar</div>
|
||||
<div class="box"><% site.calendar %></div>
|
||||
|
||||
<div class="boxheader">recent comments</div>
|
||||
<div class="box"><% site.history comments %></div>
|
||||
<div class="boxheader">recent postings</div>
|
||||
<div class="box"><% list postings skin=Story#history %></div>
|
||||
|
||||
<div class="boxline"></div><br />
|
||||
<div class="box"><% image /rss.png | site.link rss.xml %><br />
|
||||
|
|
|
@ -313,3 +313,61 @@ ul.skinmgrTree li div {
|
|||
margin-left:20px;
|
||||
margin-bottom:5px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Admin styles */
|
||||
|
||||
.pageTitle {
|
||||
font-family:<% layout.value titlefont %>;
|
||||
font-size:<% layout.value titlesize %>;
|
||||
font-weight:bold;
|
||||
color:<% layout.value titlecolor %>;
|
||||
padding-bottom:10pt;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-family: <% layout.value smallfont %>;
|
||||
font-size: 7pt;
|
||||
padding: 2px;
|
||||
color: #ffffff;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.regular {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.blocked {
|
||||
background-color: #000000;
|
||||
}
|
||||
|
||||
.trusted, .User {
|
||||
background-color: #0000cc;
|
||||
}
|
||||
|
||||
.closed {
|
||||
background-color: #cc0000;
|
||||
}
|
||||
|
||||
.public, .Site {
|
||||
background-color: #006600;
|
||||
}
|
||||
|
||||
.Root, .privileged {
|
||||
background-color: #ffcc00;
|
||||
}
|
||||
|
||||
.flagLight {
|
||||
font-family:<% layout.value smallfont %>;
|
||||
font-size:7pt;
|
||||
padding:2px;
|
||||
color:#333333;
|
||||
}
|
||||
|
||||
.sysmgrListitem {
|
||||
margin-top:15px;
|
||||
border-top:1px solid #dddddd;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue