Cleaned up whitespace with Sublime Text 2
This commit is contained in:
parent
f442b2a6d7
commit
3e769d3d6e
89 changed files with 1164 additions and 936 deletions
40
INSTALL
40
INSTALL
|
|
@ -3,41 +3,41 @@ If not already done so please download Helma via http://helma.org/download and
|
|||
follow the installation instruction at http://helma.org/download/installation.
|
||||
|
||||
Furthermore, Antville needs an SQL database to be installed as well. Currently
|
||||
supported products are PostgreSQL and MySQL. If not already done so please
|
||||
supported products are PostgreSQL and MySQL. If not already done so please
|
||||
install the desired database before you continue.
|
||||
|
||||
For connecting Antville to the database the corresponding JDBC driver is also
|
||||
necessary. If not already done so please copy the driver to the directory
|
||||
“lib/ext” of Helma’s installation directory. As of writing this installation
|
||||
necessary. If not already done so please copy the driver to the directory
|
||||
“lib/ext” of Helma’s installation directory. As of writing this installation
|
||||
guide the drivers could be downloaded via the following URLs:
|
||||
|
||||
* http://jdbc.postgresql.org/download.html
|
||||
* http://dev.mysql.com/downloads/connector/j/
|
||||
|
||||
Of course you can also use a packet manager like aptitude or MacPorts if the
|
||||
JDBC driver is available from there. However, you then need to create a
|
||||
|
||||
Of course you can also use a packet manager like aptitude or MacPorts if the
|
||||
JDBC driver is available from there. However, you then need to create a
|
||||
symbolic link to the driver from within Helma’s “lib/ext” directory.
|
||||
|
||||
Now unpack the Antville distribution package. Move the resulting directory
|
||||
Now unpack the Antville distribution package. Move the resulting directory
|
||||
“antville” into the directory “apps” of your Helma installation.
|
||||
|
||||
Inside the directory “antville” you will find a directory called “db”. This
|
||||
directory contains all database-related files, ie. several SQL scripts for
|
||||
creating the database needed by the application. Change to that directory.
|
||||
|
||||
Antville currently comes with scripts for PostgreSQL (postgre.sql) and for
|
||||
MySQL databases (my.sql).
|
||||
Antville currently comes with scripts for PostgreSQL (postgre.sql) and for
|
||||
MySQL databases (my.sql).
|
||||
|
||||
NOTE: Antville is preconfigured for PostgreSQL out of the box but it is easy
|
||||
NOTE: Antville is preconfigured for PostgreSQL out of the box but it is easy
|
||||
to modify the configuration to be compatible with MySQL.
|
||||
|
||||
Each of these SQL scripts creates the tables, indexes and initial records and
|
||||
also the account used by the application to communicate with the database.
|
||||
Each of these SQL scripts creates the tables, indexes and initial records and
|
||||
also the account used by the application to communicate with the database.
|
||||
|
||||
The default password of this account is “antville”, so you should change it if
|
||||
you want to secure your installation. Open the desired SQL script and scroll
|
||||
down to the “create user” (for PostgreSQL) or “grant user” (for MySQL)
|
||||
statement. Search for “password” (PostgreSQL) or “identified by” (MySQL) and
|
||||
down to the “create user” (for PostgreSQL) or “grant user” (for MySQL)
|
||||
statement. Search for “password” (PostgreSQL) or “identified by” (MySQL) and
|
||||
change the trailing value in quotes to the password of your choice.
|
||||
|
||||
Please refer to the documentation of your database on how to run the
|
||||
|
|
@ -46,8 +46,8 @@ access your database. This is done in a configuration file named
|
|||
“db.properties” which is located in the “code” directory, or – if you are going
|
||||
for MySQL – in the “db/my.compat” directory.
|
||||
|
||||
Open the desired file and ensure that the line beginning with “antville.url”
|
||||
points to the server that runs the database. By default, this is the local
|
||||
Open the desired file and ensure that the line beginning with “antville.url”
|
||||
points to the server that runs the database. By default, this is the local
|
||||
machine aka “localhost” which will be right in most cases.
|
||||
|
||||
Check that the password is set accordingly to the one you entered in the SQL
|
||||
|
|
@ -57,8 +57,8 @@ Finally, you need to tell Helma about the new application. This is done by
|
|||
adding the contents of the file “apps.properties” in the “extra” directory to
|
||||
the file “apps.properties” located in Helma’s installation directory.
|
||||
|
||||
NOTE: If you are using MySQL you need to edit and enable line 5 (the one
|
||||
defining “antville.repository.1”) of the file by removing the leading comment
|
||||
NOTE: If you are using MySQL you need to edit and enable line 5 (the one
|
||||
defining “antville.repository.1”) of the file by removing the leading comment
|
||||
symbol “#”.
|
||||
|
||||
Now start up Helma and point your browser to
|
||||
|
|
@ -68,7 +68,7 @@ Now start up Helma and point your browser to
|
|||
(assuming that Helma is running on the same machine and uses port 8080).
|
||||
|
||||
You should see Antville’s start page where you can create a first user account
|
||||
that automatically has system administration rights to your Antville
|
||||
that automatically has system administration rights to your Antville
|
||||
installation.
|
||||
|
||||
Have fun!
|
||||
|
|
@ -84,5 +84,5 @@ TL;DR
|
|||
5. Move antville directory into helma/app directory
|
||||
6. Run the desired script in antville/db for either PostgreSQL or MySQL
|
||||
7. Copy contents of antville/extra/apps.properties to helma/apps.properties
|
||||
8. If necessary, enable MySQL compatibility in apps.properties
|
||||
8. If necessary, enable MySQL compatibility in apps.properties
|
||||
9. Start up Helma and browse to http://localhost:8080/antville
|
||||
|
|
|
|||
40
README
40
README
|
|
@ -2,10 +2,10 @@
|
|||
STATUS
|
||||
======
|
||||
|
||||
Antville can be considered stable quality code. It is heavily used by several
|
||||
thousands of users at http://antville.org and several other sites (see
|
||||
http://code.google.com/p/antville/wiki/AntvilleSites). Nevertheless, there
|
||||
still could be bugs hidden somewhere in this application.
|
||||
Antville can be considered stable quality code. It is heavily used by several
|
||||
thousands of users at http://antville.org and several other sites (see
|
||||
http://code.google.com/p/antville/wiki/AntvilleSites). Nevertheless, there
|
||||
still could be bugs hidden somewhere in this application.
|
||||
|
||||
If you think you found a bug please report it at http://project.antville.org.
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ SYSTEM REQUIREMENTS
|
|||
===================
|
||||
|
||||
To run Antville you need Helma Object Publisher (http://helma.org) and a
|
||||
relational database in the backend. Antville was tested with PostgreSQL
|
||||
relational database in the backend. Antville was tested with PostgreSQL
|
||||
(http://postgresql.org) and MySQL (http://mysql.com).
|
||||
|
||||
For setting up Helma Object Publisher and the database of your choice please
|
||||
|
|
@ -76,10 +76,10 @@ development of Antville, there will also be other ways to participate.
|
|||
ABOUT ANTVILLE
|
||||
==============
|
||||
|
||||
Antville is an open source project aimed at the development of a high
|
||||
performance, feature rich weblog hosting software. It can easily host
|
||||
Antville is an open source project aimed at the development of a high
|
||||
performance, feature rich weblog hosting software. It can easily host
|
||||
up to several thousands of sites (the number of weblogs is rather
|
||||
limited by the installation owner’s choice and server power than by software
|
||||
limited by the installation owner’s choice and server power than by software
|
||||
limitations).
|
||||
|
||||
Antville is entirely written in JavaScript (ECMAScript, to be precise)
|
||||
|
|
@ -95,22 +95,22 @@ ABOUT HELMA OBJECT PUBLISHER
|
|||
|
||||
Helma Object Publisher is a web application server.
|
||||
|
||||
With Helma Object Publisher (sometimes simply referred to as Helma or
|
||||
Hop) you can define Objects and map them to a relational database
|
||||
table. These so-called HopObjects can be created, modified and deleted
|
||||
using a comfortable object/container model. Hence, no manual fiddling
|
||||
With Helma Object Publisher (sometimes simply referred to as Helma or
|
||||
Hop) you can define Objects and map them to a relational database
|
||||
table. These so-called HopObjects can be created, modified and deleted
|
||||
using a comfortable object/container model. Hence, no manual fiddling
|
||||
around with database code is necessary.
|
||||
|
||||
HopObjects are extended JavaScript objects which can be scripted using
|
||||
server-side JavaScript. Beyond the common JavaScript features, Helma
|
||||
provides special “skin” and template functionalities which facilitate
|
||||
HopObjects are extended JavaScript objects which can be scripted using
|
||||
server-side JavaScript. Beyond the common JavaScript features, Helma
|
||||
provides special “skin” and template functionalities which facilitate
|
||||
the rendering of objects via a web interface.
|
||||
|
||||
Thanks to Helma’s relational database mapping technology, HopObjects
|
||||
create a hierarchical structure, the URL space of a Helma site. The
|
||||
parts between slashes in a Helma URL represent HopObjects (similar to
|
||||
the document tree in static sites). The Helma URL space can be thought
|
||||
of as an analogy to the Document Object Model (DOM) in client-side
|
||||
Thanks to Helma’s relational database mapping technology, HopObjects
|
||||
create a hierarchical structure, the URL space of a Helma site. The
|
||||
parts between slashes in a Helma URL represent HopObjects (similar to
|
||||
the document tree in static sites). The Helma URL space can be thought
|
||||
of as an analogy to the Document Object Model (DOM) in client-side
|
||||
JavaScript.
|
||||
|
||||
Check out http://helma.org for more information.
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* @fileoverview
|
||||
* MessageParser script that extracts all gettext message macros
|
||||
* out of skin files and all calls of gettext functions
|
||||
* (that is "gettext", "ngettext" and "_") out of function
|
||||
|
|
@ -291,7 +291,7 @@ MessageParser.prototype.parseFunctionFile = function(file, encoding) {
|
|||
if (msgParam.name === "cgettext" || msgParam.name === "markgettext") {
|
||||
msgParam.args[0] = cgettext.getKey(msgParam.args[0], msgParam.args[1]);
|
||||
delete msgParam.args[1];
|
||||
}
|
||||
}
|
||||
key = Message.getKey(msgParam.args[0]);
|
||||
if (!(msg = this.messages[key])) {
|
||||
this.messages[key] = msg = new Message(msgParam.args[0], msgParam.args[1]);
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@
|
|||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* @fileoverview
|
||||
* A parser script that converts GNU Gettext .po files into plain JavaScript objects
|
||||
* for use with jala.I18n. To run it either start the build script of HopKit
|
||||
* or call it directly using the JavaScript shell of Rhino:
|
||||
* <code>java -cp rhino.jar org.mozilla.javascript.tools.shell.Main PoParser.js <input> <output> [namespace]</code>
|
||||
*
|
||||
*
|
||||
* The accepted arguments are:
|
||||
* <ul>
|
||||
* <li><code>input</code>: Either a single .po file or a directory containing multiple files</li>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ H2 is dual licensed and available under a modified version of the MPL 1.1 (Mozil
|
|||
* You can use H2 for free. You can integrate it into your application (including commercial applications), and you can distribute it.
|
||||
* Files containing only your code are not covered by this license (it is 'commercial friendly').
|
||||
* Modifications to the H2 source code must be published.
|
||||
* You don't need to provide the source code of H2 if you did not modify anything.
|
||||
* You don't need to provide the source code of H2 if you did not modify anything.
|
||||
|
||||
However, nobody is allowed to rename H2, modify it a little, and sell it as a database engine without telling the customers it is in fact H2. This happened to HSQLDB: a company called 'bungisoft' copied HSQLDB, renamed it to 'RedBase', and tried to sell it, hiding the fact that it was in fact just HSQLDB. It seems 'bungisoft' does not exist any more, but you can use the Wayback Machine and visit old web pages of http://www.bungisoft.com.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ CodeMirror.defineMode("helma-skin", function(config, parserConfig) {
|
|||
//config settings
|
||||
var macroStartRegex = parserConfig.macroStartRegex || /^<%/i,
|
||||
macroEndRegex = parserConfig.macroEndRegex || /^%>/i;
|
||||
|
||||
|
||||
//inner modes
|
||||
var htmlMixedMode;
|
||||
var macroMode = {
|
||||
|
|
@ -15,7 +15,7 @@ CodeMirror.defineMode("helma-skin", function(config, parserConfig) {
|
|||
return 'helma-macro';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//tokenizer when in html mode
|
||||
function htmlDispatch(stream, state) {
|
||||
if (stream.match(macroStartRegex, false)) {
|
||||
|
|
@ -42,7 +42,7 @@ CodeMirror.defineMode("helma-skin", function(config, parserConfig) {
|
|||
return {
|
||||
startState: function() {
|
||||
htmlMixedMode = htmlMixedMode || CodeMirror.getMode(config, "htmlmixed");
|
||||
return {
|
||||
return {
|
||||
token : parserConfig.startOpen ? macroDispatch : htmlDispatch,
|
||||
htmlState : htmlMixedMode.startState(),
|
||||
macroState : macroMode.startState()
|
||||
|
|
@ -59,7 +59,7 @@ CodeMirror.defineMode("helma-skin", function(config, parserConfig) {
|
|||
else
|
||||
return macroMode.indent(state.macroState, textAfter);
|
||||
},
|
||||
|
||||
|
||||
copyState: function(state) {
|
||||
return {
|
||||
token : state.token,
|
||||
|
|
@ -67,7 +67,7 @@ CodeMirror.defineMode("helma-skin", function(config, parserConfig) {
|
|||
macroState : CodeMirror.copyState(macroMode, state.macroState)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
electricChars: "/{}:"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@
|
|||
</div>
|
||||
|
||||
<% #welcome %>
|
||||
<p><em><% gettext Note %></em>: <% gettext 'Since you are an administrator
|
||||
of this Antville installation you are entitled to administer <a href="{0}">sites</a>
|
||||
and <a href="{1}">users</a>, view the <a href="{2}">administration log</a>
|
||||
and configure the <a href="{3}">setup</a>.' <% root.admin.href sites %>
|
||||
<p><em><% gettext Note %></em>: <% gettext 'Since you are an administrator
|
||||
of this Antville installation you are entitled to administer <a href="{0}">sites</a>
|
||||
and <a href="{1}">users</a>, view the <a href="{2}">administration log</a>
|
||||
and configure the <a href="{3}">setup</a>.' <% root.admin.href sites %>
|
||||
<% root.admin.href users %> <% root.admin.href log %> <% root.admin.href setup %>
|
||||
%></p>
|
||||
|
||||
|
|
@ -27,20 +27,20 @@ of this Antville installation you are entitled to administer <a href="{0}">sites
|
|||
<tr>
|
||||
<td class="small"><% gettext Type suffix=: %></td>
|
||||
<td>
|
||||
<% admin.dropdown name="filter" <% markgettext Any %> <% markgettext Root %>
|
||||
<% admin.dropdown name="filter" <% markgettext Any %> <% markgettext Root %>
|
||||
<% markgettext Site %> <% markgettext User %> %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="small"><% gettext Sort suffix=: %></td>
|
||||
<td><% admin.dropdown name="dir" <% markgettext Descending %>
|
||||
<td><% admin.dropdown name="dir" <% markgettext Descending %>
|
||||
<% markgettext Ascending %> %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="small"><% gettext Search suffix=: %></td>
|
||||
<td><input id="query" name="query" value="<% request.query %>" />
|
||||
<button onclick='$("#query").val(""); return false'><% gettext Reset %></button>
|
||||
<button type="submit" name="search" value="1"><% gettext Update %></button></td>
|
||||
<button type="submit" name="search" value="1"><% gettext Update %></button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
|
@ -70,7 +70,7 @@ of this Antville installation you are entitled to administer <a href="{0}">sites
|
|||
<tr>
|
||||
<td class="small"><% gettext Type suffix=: %></td>
|
||||
<td>
|
||||
<% admin.dropdown name="filter" <% markgettext Any %> <% markgettext Blocked %>
|
||||
<% admin.dropdown name="filter" <% markgettext Any %> <% markgettext Blocked %>
|
||||
<% markgettext Trusted %> <% markgettext Open %> <% markgettext Restricted %>
|
||||
<% markgettext Public %> <% markgettext Closed %> <% markgettext Deleted %> %>
|
||||
</td>
|
||||
|
|
@ -80,7 +80,7 @@ of this Antville installation you are entitled to administer <a href="{0}">sites
|
|||
<td>
|
||||
<% admin.dropdown name="order" <% markgettext "Last Update" %>
|
||||
<% markgettext "Creation Date" %> <% markgettext Name %> %>
|
||||
<% admin.dropdown name="dir" <% markgettext Descending %>
|
||||
<% admin.dropdown name="dir" <% markgettext Descending %>
|
||||
<% markgettext Ascending %> %>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -88,7 +88,7 @@ of this Antville installation you are entitled to administer <a href="{0}">sites
|
|||
<td class="small"><% gettext Search suffix=: %></td>
|
||||
<td><input id="query" name="query" value="<% request.query encoding="form" %>" />
|
||||
<button onclick='$("#query").val(""); return false'><% gettext Reset %></button>
|
||||
<button type="submit" name="search" value="1"><% gettext Update %></button></td>
|
||||
<button type="submit" name="search" value="1"><% gettext Update %></button></td>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
@ -107,14 +107,14 @@ of this Antville installation you are entitled to administer <a href="{0}">sites
|
|||
<td width="100%" valign="top">
|
||||
<div><strong><% item.title | item.link %></strong></div>
|
||||
<div><a href="<% item.href %>"><% item.href %></a></div>
|
||||
<div class="small"><% gettext "Created by {0} on {1}" <% item.creator as="link" %>
|
||||
<div class="small"><% gettext "Created by {0} on {1}" <% item.creator as="link" %>
|
||||
<% item.created short %> %><br />
|
||||
<% gettext "Last updated on" %> <% item.modified short %></div>
|
||||
</td>
|
||||
<td class="small" valign="top" align="right">
|
||||
<% admin.link edit <% gettext Edit %> <% item.id %> prefix='... ' %>
|
||||
<% if <% item.mode %> is deleted then "" else
|
||||
<% admin.link delete <% gettext Delete %> <% item.id %> prefix="... " %>
|
||||
<% if <% item.mode %> is deleted then "" else
|
||||
<% admin.link delete <% gettext Delete %> <% item.id %> prefix="... " %>
|
||||
%>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -152,11 +152,11 @@ of this Antville installation you are entitled to administer <a href="{0}">sites
|
|||
<input type="hidden" name="page" value="<% request.page %>" />
|
||||
<div class="adminHighlight">
|
||||
<p><strong><% gettext Caution! %></strong></p>
|
||||
<p><% gettext 'You are about to delete the whole site which currently contains {0}, {1}, {2}, {3} and {4}.'
|
||||
<p><% gettext 'You are about to delete the whole site which currently contains {0}, {1}, {2}, {3} and {4}.'
|
||||
<% ngettext '{0} story' '{0} stories' <% admin.count <% item.self stories %> %> %>
|
||||
<% ngettext '{0} comment' '{0} comments' <% admin.count <% item.self comments %> %> %>
|
||||
<% ngettext '{0} image' '{0} images' <% admin.count <% item.self images %> %> %>
|
||||
<% ngettext '{0} file' '{0} files' <% admin.count <% item.self files %> %> %>
|
||||
<% ngettext '{0} file' '{0} files' <% admin.count <% item.self files %> %> %>
|
||||
<% ngettext '{0} member' '{0} members' <% admin.count <% item.self members %> %> %> %></p>
|
||||
<p><strong><% gettext 'All of this will be deleted irreversibly.' %></strong></p>
|
||||
<p><% gettext 'Are you sure you want to proceed?' %></p>
|
||||
|
|
@ -181,7 +181,7 @@ of this Antville installation you are entitled to administer <a href="{0}">sites
|
|||
<td>
|
||||
<% admin.dropdown name="order" <% markgettext Registration %>
|
||||
<% markgettext Login %> <% markgettext Username %> %>
|
||||
<% admin.dropdown name="dir" <% markgettext Descending %>
|
||||
<% admin.dropdown name="dir" <% markgettext Descending %>
|
||||
<% markgettext Ascending %> %>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
Admin.SITEREMOVALGRACEPERIOD = 14; // days
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {HopObject} target
|
||||
* @param {String} method
|
||||
* @param {User} user
|
||||
|
|
@ -46,21 +46,21 @@ Admin.Job = function(target, method, user) {
|
|||
this.__defineGetter__("method", function() {
|
||||
return method;
|
||||
});
|
||||
|
||||
|
||||
this.__defineGetter__("user", function() {
|
||||
return user;
|
||||
});
|
||||
|
||||
|
||||
this.__defineGetter__("name", function() {
|
||||
return file.getName();
|
||||
});
|
||||
|
||||
|
||||
this.remove = function() {
|
||||
return file["delete"]();
|
||||
}
|
||||
|
||||
if (target && method && user) {
|
||||
file = new java.io.File.createTempFile("job-", String.EMPTY, Admin.queue.dir);
|
||||
if (target && method && user) {
|
||||
file = new java.io.File.createTempFile("job-", String.EMPTY, Admin.queue.dir);
|
||||
serialize({type: target._prototype, id: target._id, method: method, user: user._id}, file);
|
||||
} else if (target) {
|
||||
file = new java.io.File(Admin.queue.dir, target);
|
||||
|
|
@ -75,7 +75,7 @@ Admin.Job = function(target, method, user) {
|
|||
}
|
||||
|
||||
this.toString = function() {
|
||||
return ["[Job: ", method, " ", target, " by ", user, "]"].join(String.EMPTY);
|
||||
return ["[Job: ", method, " ", target, " by ", user, "]"].join(String.EMPTY);
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
@ -86,7 +86,7 @@ Admin.Job = function(target, method, user) {
|
|||
* @returns {String[]}
|
||||
* @see defineConstants
|
||||
*/
|
||||
Admin.getNotificationScopes = defineConstants(Admin, markgettext("None"),
|
||||
Admin.getNotificationScopes = defineConstants(Admin, markgettext("None"),
|
||||
markgettext("Trusted"), markgettext("Regular"));
|
||||
|
||||
/**
|
||||
|
|
@ -94,8 +94,8 @@ Admin.getNotificationScopes = defineConstants(Admin, markgettext("None"),
|
|||
* @return {String[]}
|
||||
* @see defineConstants
|
||||
*/
|
||||
Admin.getPhaseOutModes = defineConstants(Admin, markgettext("Disabled"),
|
||||
markgettext("Restricted"), markgettext("Abandoned"),
|
||||
Admin.getPhaseOutModes = defineConstants(Admin, markgettext("Disabled"),
|
||||
markgettext("Restricted"), markgettext("Abandoned"),
|
||||
markgettext("Both"));
|
||||
|
||||
/**
|
||||
|
|
@ -103,14 +103,14 @@ Admin.getPhaseOutModes = defineConstants(Admin, markgettext("Disabled"),
|
|||
* @returns {String[]}
|
||||
* @see defineConstants
|
||||
*/
|
||||
Admin.getCreationScopes = defineConstants(Admin, markgettext("Privileged"),
|
||||
Admin.getCreationScopes = defineConstants(Admin, markgettext("Privileged"),
|
||||
markgettext("Trusted"), markgettext("Regular"));
|
||||
|
||||
/**
|
||||
* Convenience method for easily queueing jobs.
|
||||
* @param {HopObject} target
|
||||
* @param {String} method
|
||||
* @param {User} user
|
||||
* @param {User} user
|
||||
* @returns {String}
|
||||
* @see Admin.Job
|
||||
*/
|
||||
|
|
@ -120,13 +120,13 @@ Admin.queue = function(target, method, user) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Admin.queue.dir = (new java.io.File(app.dir, "../jobs")).getCanonicalFile();
|
||||
Admin.queue.dir.exists() || Admin.queue.dir.mkdirs();
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Admin.dequeue = function() {
|
||||
var jobs = Admin.queue.dir.list();
|
||||
|
|
@ -158,7 +158,7 @@ Admin.dequeue = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Admin.purgeSites = function() {
|
||||
var now = new Date;
|
||||
|
|
@ -172,7 +172,7 @@ Admin.purgeSites = function() {
|
|||
this.job = job.name;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var notificationPeriod = root.phaseOutNotificationPeriod * Date.ONEDAY;
|
||||
var gracePeriod = root.phaseOutGracePeriod * Date.ONEDAY;
|
||||
|
||||
|
|
@ -181,7 +181,7 @@ Admin.purgeSites = function() {
|
|||
if (this.status === Site.TRUSTED) {
|
||||
return;
|
||||
}
|
||||
var age = now - (this.stories.size() > 0 ?
|
||||
var age = now - (this.stories.size() > 0 ?
|
||||
this.stories.get(0).modified : this.created);
|
||||
if (age - notificationPeriod > 0) {
|
||||
if (!this.notified) {
|
||||
|
|
@ -202,7 +202,7 @@ Admin.purgeSites = function() {
|
|||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var phaseOutRestrictedSites = function() {
|
||||
root.admin.restrictedSites.forEach(function() {
|
||||
if (this.status === Site.TRUSTED) {
|
||||
|
|
@ -227,7 +227,7 @@ Admin.purgeSites = function() {
|
|||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch (root.phaseOutMode) {
|
||||
case Admin.ABANDONED:
|
||||
return phaseOutAbandonedSites();
|
||||
|
|
@ -241,7 +241,7 @@ Admin.purgeSites = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Admin.purgeReferrers = function() {
|
||||
var sql = new Sql;
|
||||
|
|
@ -250,7 +250,7 @@ Admin.purgeReferrers = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Admin.commitRequests = function() {
|
||||
var requests = app.data.requests;
|
||||
|
|
@ -268,10 +268,10 @@ Admin.commitRequests = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Admin.commitEntries = function() {
|
||||
var entries = app.data.entries;
|
||||
var entries = app.data.entries;
|
||||
app.data.entries = [];
|
||||
var history = [];
|
||||
|
||||
|
|
@ -283,7 +283,7 @@ Admin.commitEntries = function() {
|
|||
|
||||
// Only log unique combinations of context, ip and referrer
|
||||
referrer = String(referrer);
|
||||
var key = item.context._prototype + "-" + item.context._id + ":" +
|
||||
var key = item.context._prototype + "-" + item.context._id + ":" +
|
||||
item.ip + ":" + referrer;
|
||||
if (history.indexOf(key) > -1) {
|
||||
continue;
|
||||
|
|
@ -293,7 +293,7 @@ Admin.commitEntries = function() {
|
|||
// Exclude requests coming from the same site
|
||||
if (item.site) {
|
||||
var href = item.site.href().toLowerCase();
|
||||
if (href.startsWith("http") &&
|
||||
if (href.startsWith("http") &&
|
||||
referrer.toLowerCase().contains(href.substr(0, href.length-1))) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -306,7 +306,7 @@ Admin.commitEntries = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Admin.invokeCallbacks = function() {
|
||||
var http = helma.Http();
|
||||
|
|
@ -341,13 +341,13 @@ Admin.invokeCallbacks = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Admin.updateHealth = function() {
|
||||
var health = Admin.health || {};
|
||||
if (!health.modified || new Date - health.modified > 5 * Date.ONEMINUTE) {
|
||||
health.modified = new Date;
|
||||
health.requestsPerUnit = app.requestCount -
|
||||
health.requestsPerUnit = app.requestCount -
|
||||
(health.currentRequestCount || 0);
|
||||
health.currentRequestCount = app.requestCount;
|
||||
health.errorsPerUnit = app.errorCount - (health.currentErrorCount || 0);
|
||||
|
|
@ -358,7 +358,7 @@ Admin.updateHealth = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Admin.updateDomains = function() {
|
||||
res.push();
|
||||
|
|
@ -397,7 +397,7 @@ Admin.prototype.constructor = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} action
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
|
@ -416,7 +416,7 @@ Admin.prototype.getPermission = function(action) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Admin.prototype.onRequest = function() {
|
||||
HopObject.prototype.onRequest.apply(this);
|
||||
|
|
@ -427,7 +427,7 @@ Admin.prototype.onRequest = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
*/
|
||||
Admin.prototype.onUnhandledMacro = function(name) {
|
||||
|
|
@ -460,7 +460,7 @@ Admin.prototype.setup_action = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} data
|
||||
*/
|
||||
Admin.prototype.update = function(data) {
|
||||
|
|
@ -491,9 +491,9 @@ Admin.prototype.log_action = function() {
|
|||
if (req.postParams.search || req.postParams.filter) {
|
||||
session.data.admin.filterLog(req.postParams);
|
||||
}
|
||||
res.data.list = renderList(session.data.admin.entries,
|
||||
res.data.list = renderList(session.data.admin.entries,
|
||||
this.renderItem, 10, req.queryParams.page);
|
||||
res.data.pager = renderPager(session.data.admin.entries,
|
||||
res.data.pager = renderPager(session.data.admin.entries,
|
||||
this.href(req.action), 10, req.queryParams.page);
|
||||
|
||||
res.data.title = gettext("Administration Log");
|
||||
|
|
@ -523,20 +523,20 @@ Admin.prototype.sites_action = function() {
|
|||
this.updateSite(req.postParams);
|
||||
res.message = gettext("The changes were saved successfully.");
|
||||
}
|
||||
res.redirect(this.href(req.action) + "?page=" + req.postParams.page +
|
||||
res.redirect(this.href(req.action) + "?page=" + req.postParams.page +
|
||||
"#" + req.postParams.id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (req.postParams.search || req.postParams.filter) {
|
||||
session.data.admin.filterSites(req.postParams);
|
||||
} else if (req.queryParams.id) {
|
||||
res.meta.item = Site.getById(req.queryParams.id);
|
||||
}
|
||||
|
||||
res.data.list = renderList(session.data.admin.sites,
|
||||
res.data.list = renderList(session.data.admin.sites,
|
||||
this.renderItem, 10, req.queryParams.page);
|
||||
res.data.pager = renderPager(session.data.admin.sites,
|
||||
res.data.pager = renderPager(session.data.admin.sites,
|
||||
this.href(req.action), 10, req.data.page);
|
||||
|
||||
res.data.title = gettext("Site Administration");
|
||||
|
|
@ -553,15 +553,15 @@ Admin.prototype.users_action = function() {
|
|||
} else if (req.postParams.save) {
|
||||
this.updateUser(req.postParams);
|
||||
res.message = gettext("The changes were saved successfully.");
|
||||
res.redirect(this.href(req.action) + "?page=" + req.postParams.page +
|
||||
res.redirect(this.href(req.action) + "?page=" + req.postParams.page +
|
||||
"#" + req.postParams.id);
|
||||
} else if (req.queryParams.id) {
|
||||
res.meta.item = User.getById(req.queryParams.id);
|
||||
}
|
||||
|
||||
res.data.list = renderList(session.data.admin.users,
|
||||
res.data.list = renderList(session.data.admin.users,
|
||||
this.renderItem, 10, req.data.page);
|
||||
res.data.pager = renderPager(session.data.admin.users,
|
||||
res.data.pager = renderPager(session.data.admin.users,
|
||||
this.href(req.action), 10, req.data.page);
|
||||
|
||||
res.data.title = gettext("User Administration");
|
||||
|
|
@ -573,7 +573,7 @@ Admin.prototype.users_action = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} data
|
||||
*/
|
||||
Admin.prototype.filterLog = function(data) {
|
||||
|
|
@ -593,7 +593,7 @@ Admin.prototype.filterLog = function(data) {
|
|||
} else {
|
||||
sql += "where "
|
||||
}
|
||||
sql += "action <> 'main' ";
|
||||
sql += "action <> 'main' ";
|
||||
if (data.query) {
|
||||
var parts = stripTags(data.query).split(" ");
|
||||
var keyword, like;
|
||||
|
|
@ -604,14 +604,14 @@ Admin.prototype.filterLog = function(data) {
|
|||
sql += "action " + like + " '" + keyword + "' ";
|
||||
}
|
||||
}
|
||||
sql += "order by created ";
|
||||
sql += "order by created ";
|
||||
(data.dir == 1) || (sql += "desc");
|
||||
this.entries.subnodeRelation = sql;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} data
|
||||
*/
|
||||
Admin.prototype.filterSites = function(data) {
|
||||
|
|
@ -660,7 +660,7 @@ Admin.prototype.filterSites = function(data) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} data
|
||||
*/
|
||||
Admin.prototype.filterUsers = function(data) {
|
||||
|
|
@ -705,7 +705,7 @@ Admin.prototype.filterUsers = function(data) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} data
|
||||
*/
|
||||
Admin.prototype.updateSite = function(data) {
|
||||
|
|
@ -713,7 +713,7 @@ Admin.prototype.updateSite = function(data) {
|
|||
if (!site) {
|
||||
throw Error(gettext("Please choose a site you want to edit."));
|
||||
}
|
||||
if (site.status !== data.status) {
|
||||
if (site.status !== data.status) {
|
||||
var current = site.status;
|
||||
site.status = data.status;
|
||||
this.log(site, "Changed status from " + current + " to " + site.status);
|
||||
|
|
@ -722,7 +722,7 @@ Admin.prototype.updateSite = function(data) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} data
|
||||
*/
|
||||
Admin.prototype.updateUser = function(data) {
|
||||
|
|
@ -742,7 +742,7 @@ Admin.prototype.updateUser = function(data) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {HopObject} item
|
||||
*/
|
||||
Admin.prototype.renderItem = function(item) {
|
||||
|
|
@ -751,14 +751,14 @@ Admin.prototype.renderItem = function(item) {
|
|||
(name === "Root") && (name = "Site");
|
||||
Admin.prototype.renderSkin("$Admin#" + name);
|
||||
if (item === res.meta.item) {
|
||||
Admin.prototype.renderSkin((req.data.action === "delete" ?
|
||||
Admin.prototype.renderSkin((req.data.action === "delete" ?
|
||||
"$Admin#delete" : "$Admin#edit") + name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {HopObject} context
|
||||
* @param {String} action
|
||||
*/
|
||||
|
|
@ -769,7 +769,7 @@ Admin.prototype.log = function(context, action) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} action
|
||||
* @param {Number} id
|
||||
|
|
@ -800,7 +800,7 @@ Admin.prototype.link_macro = function(param, action, text, id) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {HopObject} object
|
||||
*/
|
||||
|
|
@ -812,7 +812,7 @@ Admin.prototype.count_macro = function(param, object) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} name
|
||||
*/
|
||||
|
|
@ -824,7 +824,7 @@ Admin.prototype.skin_macro = function(param, name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {HopObject} object
|
||||
* @param {String} name
|
||||
|
|
@ -841,7 +841,7 @@ Admin.prototype.items_macro = function(param, object, name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
*/
|
||||
Admin.prototype.dropdown_macro = function(param /*, value1, value2, ... */) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<% #main %>
|
||||
<p class="storyTitle"><% response.title %></p>
|
||||
<% gettext "Antville supports some popular application programming
|
||||
<% gettext "Antville supports some popular application programming
|
||||
interfaces:" %>
|
||||
<ul>
|
||||
<li><a href="http://web.archive.org/web/20100409165854/http://www.blogger.com/developers/api/1_docs/">Blogger Api 1.0</a></li>
|
||||
|
|
@ -12,13 +12,13 @@
|
|||
</p>
|
||||
|
||||
<p><br /><strong><% gettext 'Callback URL' %></strong></p>
|
||||
<p><% gettext "Each Antville site provides an option in the preferences to
|
||||
define a callback URL that will be invoked each time the site content has changed.
|
||||
This way users can define custom handlers for different site events with their
|
||||
own code running behind this URL – on a server and in a programming language
|
||||
<p><% gettext "Each Antville site provides an option in the preferences to
|
||||
define a callback URL that will be invoked each time the site content has changed.
|
||||
This way users can define custom handlers for different site events with their
|
||||
own code running behind this URL – on a server and in a programming language
|
||||
of their choice." %></p>
|
||||
|
||||
<p><% gettext "The callback URL will be invoked as an HTTP POST request with
|
||||
<p><% gettext "The callback URL will be invoked as an HTTP POST request with
|
||||
the following parameters:" %>
|
||||
<ul>
|
||||
<li><code>type</code> – <% gettext 'Resource type (e.g. Story or Comment)' %></li>
|
||||
|
|
@ -31,15 +31,15 @@ the following parameters:" %>
|
|||
</ul>
|
||||
</p>
|
||||
|
||||
<p><% gettext "Antville itself provides a default callback URL invoking the basic
|
||||
<p><% gettext "Antville itself provides a default callback URL invoking the basic
|
||||
ping method of the weblogs.com API:" %>
|
||||
<div><% api.href callback | link %></div>
|
||||
</p>
|
||||
|
||||
<% #callback %>
|
||||
<p class="storyTitle"><% response.title %></p>
|
||||
<% gettext "This callback URL invokes the ping method of the {0}."
|
||||
'<a href="http://www.weblogs.com/api.html">weblogs.com API</a>' %>
|
||||
<% gettext "This callback URL invokes the ping method of the {0}."
|
||||
'<a href="http://www.weblogs.com/api.html">weblogs.com API</a>' %>
|
||||
<% gettext "The essential ECMAScript code is shown below." %>
|
||||
<pre style="overflow: auto; width: 420px; border: 1px solid #cccccc;">
|
||||
<code><% param.code %></code>
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
Api.blogger = {};
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} content
|
||||
*/
|
||||
Api.blogger._getContentParts = function(content) {
|
||||
|
|
@ -46,7 +46,7 @@ Api.blogger._getContentParts = function(content) {
|
|||
var pos = content.lastIndexOf("</title>");
|
||||
if (pos > 0) {
|
||||
result.title = content.substring(7, pos);
|
||||
result.text = content.substring (pos + 8);
|
||||
result.text = content.substring (pos + 8);
|
||||
} else {
|
||||
result.text = content;
|
||||
}
|
||||
|
|
@ -55,7 +55,7 @@ Api.blogger._getContentParts = function(content) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} appKey
|
||||
* @param {String} name
|
||||
* @param {String} password
|
||||
|
|
@ -75,11 +75,11 @@ Api.blogger.getUserInfo = function(appKey, name, password) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} appKey
|
||||
* @param {String} name
|
||||
* @param {String} password
|
||||
* @returns {Object[]} A list of objects with the properties blogid, blogName and
|
||||
* @returns {Object[]} A list of objects with the properties blogid, blogName and
|
||||
* url
|
||||
*/
|
||||
Api.blogger.getUsersBlogs = function(appKey, name, password) {
|
||||
|
|
@ -100,7 +100,7 @@ Api.blogger.getUsersBlogs = function(appKey, name, password) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} appKey
|
||||
* @param {Number} id
|
||||
* @param {String} name
|
||||
|
|
@ -116,7 +116,7 @@ Api.blogger.getRecentPosts = function(appKey, id, name, password, limit) {
|
|||
|
||||
Api.constrain(site, user);
|
||||
if (!site.stories.getPermission("main")) {
|
||||
throw Error("Permission denied for user " + user.name +
|
||||
throw Error("Permission denied for user " + user.name +
|
||||
" to get recent posts of site " + site.name);
|
||||
}
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ Api.blogger.getRecentPosts = function(appKey, id, name, password, limit) {
|
|||
postid: story._id,
|
||||
userid: story.creator.name,
|
||||
dateCreated: story.created,
|
||||
content: story.title ? "<title>" + story.title +
|
||||
content: story.title ? "<title>" + story.title +
|
||||
"</title>" + story.text : story.text
|
||||
});
|
||||
}
|
||||
|
|
@ -136,7 +136,7 @@ Api.blogger.getRecentPosts = function(appKey, id, name, password, limit) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} appKey
|
||||
* @param {Number} id
|
||||
* @param {String} name
|
||||
|
|
@ -147,15 +147,15 @@ Api.blogger.getRecentPosts = function(appKey, id, name, password, limit) {
|
|||
Api.blogger.getPost = function(appKey, id, name, password) {
|
||||
var story = Api.getStory(id);
|
||||
var user = Api.getUser(name, password);
|
||||
|
||||
|
||||
Api.constrain(story.site, user);
|
||||
if (!story.getPermission("main")) {
|
||||
throw Error("Permission denied for user " + name +
|
||||
throw Error("Permission denied for user " + name +
|
||||
" to get post #" + id);
|
||||
}
|
||||
|
||||
return {
|
||||
content: story.title ? html.elementAsString("title", story.title) +
|
||||
content: story.title ? html.elementAsString("title", story.title) +
|
||||
story.text : story.text,
|
||||
userid: story.creator.name,
|
||||
postid: story._id,
|
||||
|
|
@ -164,7 +164,7 @@ Api.blogger.getPost = function(appKey, id, name, password) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} appKey
|
||||
* @param {Number} id
|
||||
* @param {String} name
|
||||
|
|
@ -177,10 +177,10 @@ Api.blogger.getPost = function(appKey, id, name, password) {
|
|||
Api.blogger.newPost = function(appKey, id, name, password, content, publish) {
|
||||
var site = Api.getSite(id);
|
||||
var user = Api.getUser(name, password);
|
||||
|
||||
|
||||
Api.constrain(site, user);
|
||||
if (!site.stories.getPermission("create")) {
|
||||
throw Error("Permission denied for user " + user.name +
|
||||
throw Error("Permission denied for user " + user.name +
|
||||
" to add a post to site " + site.name);
|
||||
}
|
||||
|
||||
|
|
@ -197,7 +197,7 @@ Api.blogger.newPost = function(appKey, id, name, password, content, publish) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} appKey
|
||||
* @param {Number} id
|
||||
* @param {String} name
|
||||
|
|
@ -213,7 +213,7 @@ Api.blogger.editPost = function(appkey, id, name, password, content, publish) {
|
|||
|
||||
Api.constrain(story.site, user);
|
||||
if (!story.getPermission("edit")) {
|
||||
throw Error("Permission denied for user " + name +
|
||||
throw Error("Permission denied for user " + name +
|
||||
" to edit post #" + id);
|
||||
}
|
||||
|
||||
|
|
@ -229,7 +229,7 @@ Api.blogger.editPost = function(appkey, id, name, password, content, publish) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} appKey
|
||||
* @param {Number} id
|
||||
* @param {String} name
|
||||
|
|
@ -243,7 +243,7 @@ Api.blogger.deletePost = function(appKey, id, name, password) {
|
|||
|
||||
Api.constrain(story.site, user);
|
||||
if (!story.getPermission("delete")) {
|
||||
throw Error("Permission denied for user " + name +
|
||||
throw Error("Permission denied for user " + name +
|
||||
" to delete story #" + id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Site} site
|
||||
* @param {User} user
|
||||
*/
|
||||
|
|
@ -42,11 +42,11 @@ Api.dispatch = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} password
|
||||
* @throws {Error}
|
||||
* @returns {User}
|
||||
* @returns {User}
|
||||
*/
|
||||
Api.getUser = function(name, password) {
|
||||
var user = User.getByName(name);
|
||||
|
|
@ -62,7 +62,7 @@ Api.getUser = function(name, password) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @throws {Error}
|
||||
* @returns {Site}
|
||||
|
|
@ -78,7 +78,7 @@ Api.getSite = function(name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Number} id
|
||||
* @throws {Error}
|
||||
* @returns {Story}
|
||||
|
|
@ -119,7 +119,7 @@ Api.prototype.callback_action = function() {
|
|||
var remote = new Remote("http://rpc.weblogs.com/RPC2");
|
||||
var call = remote.weblogUpdates.ping(data.site, data.origin);
|
||||
if (call.error || call.result.flerror) {
|
||||
app.debug("Error invoking weblogs.com ping() method for " +
|
||||
app.debug("Error invoking weblogs.com ping() method for " +
|
||||
data.site + ": " + call.error || call.result.message);
|
||||
} else {
|
||||
app.debug(call.result);
|
||||
|
|
@ -129,7 +129,7 @@ Api.prototype.callback_action = function() {
|
|||
|
||||
if (req.isGet()) {
|
||||
res.data.title = gettext("Default Callback Url");
|
||||
res.data.body = this.renderSkinAsString("$Api#callback",
|
||||
res.data.body = this.renderSkinAsString("$Api#callback",
|
||||
{name: req.action, code: ping.toString()});
|
||||
res.handlers.site.renderSkin("Site#page");
|
||||
} else if (req.isPost()) {
|
||||
|
|
@ -140,14 +140,14 @@ Api.prototype.callback_action = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} methodName
|
||||
* @throws {Error}
|
||||
*/
|
||||
Api.prototype.main_action_xmlrpc = function(methodName) {
|
||||
if (!methodName) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
var parts = methodName.split(".");
|
||||
var method = parts[1];
|
||||
if (method && !method.startsWith("_")) {
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ Api.metaWeblog._getStruct = function(story) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Number} id
|
||||
* @param {String} name
|
||||
* @param {String} password
|
||||
|
|
@ -71,7 +71,7 @@ Api.metaWeblog.getRecentPosts = function(id, name, password, limit) {
|
|||
|
||||
Api.constrain(site, user);
|
||||
if (!site.stories.getPermission("main")) {
|
||||
throw Error("Permission denied for user " + user.name +
|
||||
throw Error("Permission denied for user " + user.name +
|
||||
" to get recent posts from site " + site.name);
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ Api.metaWeblog.getRecentPosts = function(id, name, password, limit) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Number} id
|
||||
* @param {String} name
|
||||
* @param {String} password
|
||||
|
|
@ -96,15 +96,15 @@ Api.metaWeblog.getPost = function(id, name, password) {
|
|||
var story = Api.getStory(id);
|
||||
var user = Api.getUser(name, password);
|
||||
Api.constrain(story.site, user);
|
||||
if (!story.getPermission("main")) {
|
||||
throw Error("Permission denied for user " + name +
|
||||
if (!story.getPermission("main")) {
|
||||
throw Error("Permission denied for user " + name +
|
||||
" to get post #" + id);
|
||||
}
|
||||
return Api.metaWeblog._getStruct(story);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Number} id
|
||||
* @param {String} name
|
||||
* @param {String} password
|
||||
|
|
@ -116,10 +116,10 @@ Api.metaWeblog.getPost = function(id, name, password) {
|
|||
Api.metaWeblog.newPost = function(id, name, password, content, publish) {
|
||||
var site = Api.getSite(id);
|
||||
var user = Api.getUser(name, password);
|
||||
|
||||
|
||||
Api.constrain(site, user);
|
||||
if (!site.stories.getPermission("create")) {
|
||||
throw Error("Permission denied for user " + user.name +
|
||||
throw Error("Permission denied for user " + user.name +
|
||||
" to add a post to site " + site.name);
|
||||
}
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ Api.metaWeblog.newPost = function(id, name, password, content, publish) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Number} id
|
||||
* @param {String} name
|
||||
* @param {String} password
|
||||
|
|
@ -152,8 +152,8 @@ Api.metaWeblog.editPost = function(id, name, password, content, publish) {
|
|||
|
||||
Api.constrain(story.site, user);
|
||||
if (!story.getPermission("edit")) {
|
||||
throw Error("Permission denied for user " + name +
|
||||
" to edit post #" + id);
|
||||
throw Error("Permission denied for user " + name +
|
||||
" to edit post #" + id);
|
||||
}
|
||||
|
||||
story.update({
|
||||
|
|
@ -161,7 +161,7 @@ Api.metaWeblog.editPost = function(id, name, password, content, publish) {
|
|||
text: content.description,
|
||||
status: publish ? Story.PUBLIC : Story.CLOSED,
|
||||
mode: content.flNotOnHomePage ? Story.HIDDEN : Story.FEATURED,
|
||||
commentMode: content.discussions || content.mt_allow_comments ?
|
||||
commentMode: content.discussions || content.mt_allow_comments ?
|
||||
Story.OPEN : Story.CLOSED,
|
||||
tags: content.categories
|
||||
});
|
||||
|
|
@ -171,7 +171,7 @@ Api.metaWeblog.editPost = function(id, name, password, content, publish) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Number} id
|
||||
* @param {String} name
|
||||
* @param {String} password
|
||||
|
|
@ -184,7 +184,7 @@ Api.metaWeblog.getCategories = function(id, name, password) {
|
|||
|
||||
Api.constrain(site, user);
|
||||
if (!site.stories.getPermission("main")) {
|
||||
throw Error("Permission denied for user " + user.name +
|
||||
throw Error("Permission denied for user " + user.name +
|
||||
" to get categories from site " + site.name);
|
||||
}
|
||||
|
||||
|
|
@ -201,7 +201,7 @@ Api.metaWeblog.getCategories = function(id, name, password) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Number} id
|
||||
* @param {String} name
|
||||
* @param {String} password
|
||||
|
|
@ -219,10 +219,10 @@ Api.metaWeblog.newMediaObject = function(id, name, password, media) {
|
|||
var data = {};
|
||||
if (media.type && media.type.toLowerCase().startsWith("image/")) {
|
||||
if (!site.images.getPermission("create")) {
|
||||
throw Error("Permission denied for user " + user.name +
|
||||
throw Error("Permission denied for user " + user.name +
|
||||
" to add a media object to site " + site.name);
|
||||
}
|
||||
data.file = new Packages.helma.util.MimePart(media.name,
|
||||
data.file = new Packages.helma.util.MimePart(media.name,
|
||||
media.bits, media.type);
|
||||
data.file_origin = media.name;
|
||||
data.description = media.description;
|
||||
|
|
@ -235,15 +235,15 @@ Api.metaWeblog.newMediaObject = function(id, name, password, media) {
|
|||
result.url = Image.add(data, site, user).getUrl();
|
||||
} else {
|
||||
if (!site.files.getPermission("create")) {
|
||||
throw Error("Permission denied for user " + user.name +
|
||||
throw Error("Permission denied for user " + user.name +
|
||||
" to add a media object to site " + site.name);
|
||||
}
|
||||
data.file = new Packages.helma.util.MimePart(media.name,
|
||||
data.file = new Packages.helma.util.MimePart(media.name,
|
||||
media.bits, media.type);
|
||||
data.file_origin = media.name;
|
||||
data.description = media.description;
|
||||
result.url = File.add(data, site, user).getUrl();
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
Api.mt = {};
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Number} id
|
||||
* @param {String} name
|
||||
* @param {String} password
|
||||
|
|
@ -46,7 +46,7 @@ Api.mt.getRecentPostTitles = function(id, name, password, limit) {
|
|||
|
||||
Api.constrain(site, user);
|
||||
if (!site.stories.getPermission("main")) {
|
||||
throw Error("Permission denied for user " + user.name +
|
||||
throw Error("Permission denied for user " + user.name +
|
||||
" to get recent post titles from site " + site.name);
|
||||
}
|
||||
|
||||
|
|
@ -58,14 +58,14 @@ Api.mt.getRecentPostTitles = function(id, name, password, limit) {
|
|||
postid: story._id,
|
||||
username: story.creator.name,
|
||||
dateCreated: story.created,
|
||||
title: story.getTitle()
|
||||
title: story.getTitle()
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Number} id
|
||||
* @param {String} name
|
||||
* @param {String} password
|
||||
|
|
@ -78,10 +78,10 @@ Api.mt.getCategoryList = function(id, name, password) {
|
|||
|
||||
Api.constrain(site, user);
|
||||
if (!site.stories.getPermission("main")) {
|
||||
throw Error("Permission denied for user " + user.name +
|
||||
throw Error("Permission denied for user " + user.name +
|
||||
" to access site " + site.name);
|
||||
}
|
||||
|
||||
|
||||
var result = [];
|
||||
var tags = site.getTags("tags", Tags.ALL).list();
|
||||
for each (var tag in tags) {
|
||||
|
|
@ -94,7 +94,7 @@ Api.mt.getCategoryList = function(id, name, password) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Number} id
|
||||
* @param {String} name
|
||||
* @param {String} password
|
||||
|
|
@ -107,10 +107,10 @@ Api.mt.getPostCategories = function(id, name, password) {
|
|||
|
||||
Api.constrain(story.site, user);
|
||||
if (!story.getPermission("main")) {
|
||||
throw Error("Permission denied for user " + name +
|
||||
throw Error("Permission denied for user " + name +
|
||||
" to access story #" + id);
|
||||
}
|
||||
|
||||
|
||||
var result = [];
|
||||
for each (var tag in story.getTags()) {
|
||||
result.push({
|
||||
|
|
@ -124,7 +124,7 @@ Api.mt.getPostCategories = function(id, name, password) {
|
|||
|
||||
// FIXME: How do I post a new story?
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Number} id
|
||||
* @param {String} name
|
||||
* @param {String} password
|
||||
|
|
@ -137,16 +137,16 @@ Api.mt.publishPost = function(id, name, password) {
|
|||
|
||||
Api.constrain(story.site, user);
|
||||
if (!story.getPermission("edit")) {
|
||||
throw Error("Permission denied for user " + name +
|
||||
throw Error("Permission denied for user " + name +
|
||||
" to edit story #" + id);
|
||||
}
|
||||
|
||||
story.mode = Story.FEATURED;
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Number} id
|
||||
* @param {String} name
|
||||
* @param {String} password
|
||||
|
|
@ -164,7 +164,7 @@ Api.mt.setPostCategories = function(id, name, password, categories) {
|
|||
|
||||
Api.constrain(story.site, user);
|
||||
if (!story.getPermission("edit")) {
|
||||
throw Error("Permission denied for user " + name +
|
||||
throw Error("Permission denied for user " + name +
|
||||
" to edit story #" + id);
|
||||
}
|
||||
|
||||
|
|
@ -173,7 +173,7 @@ Api.mt.setPostCategories = function(id, name, password, categories) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @returns {Array}
|
||||
*/
|
||||
Api.mt.supportedTextFilters = function() {
|
||||
|
|
@ -181,7 +181,7 @@ Api.mt.supportedTextFilters = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @returns {Array}
|
||||
*/
|
||||
Api.mt.getTrackbackPings = function() {
|
||||
|
|
@ -189,7 +189,7 @@ Api.mt.getTrackbackPings = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @returns {String[]}
|
||||
*/
|
||||
Api.mt.supportedMethods = function() {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ Archive.prototype.constructor = function(name, type, parent) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {HopObject}
|
||||
*/
|
||||
|
|
@ -64,7 +64,7 @@ Archive.prototype.getChildElement = function(name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} action
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
|
@ -102,7 +102,7 @@ Archive.prototype.main_action = function() {
|
|||
dateString = formatDate(date, pattern);
|
||||
break;
|
||||
}
|
||||
var page = gettext("Page {0} of {1}", this.getPage(),
|
||||
var page = gettext("Page {0} of {1}", this.getPage(),
|
||||
Math.ceil(this.getSize() / this.getPageSize()));
|
||||
res.data.title = gettext("Story Archive {0} ({1})", dateString, page);
|
||||
res.data.body = this.renderSkinAsString("Archive#main");
|
||||
|
|
@ -116,7 +116,7 @@ Archive.prototype.page1_action = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} action
|
||||
* @returns {String}
|
||||
*/
|
||||
|
|
@ -139,7 +139,7 @@ Archive.prototype.href = function(action) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} action
|
||||
* @param {String} text
|
||||
|
|
@ -151,7 +151,7 @@ Archive.prototype.link_macro = function(param, action, text) {
|
|||
}
|
||||
switch (action) {
|
||||
case "previous":
|
||||
var page = this.getPage() - 1; break;
|
||||
var page = this.getPage() - 1; break;
|
||||
case "next":
|
||||
var page = this.getPage() + 1; break;
|
||||
}
|
||||
|
|
@ -160,13 +160,13 @@ Archive.prototype.link_macro = function(param, action, text) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Archive.prototype.stories_macro = function() {
|
||||
var day, storyDay;
|
||||
var day, storyDay;
|
||||
var page = this.getPage();
|
||||
var pageSize = this.getPageSize();
|
||||
|
||||
|
||||
var renderStory = function(story) {
|
||||
storyDay = formatDate(story.created, 'yyyy-MM-dd');
|
||||
if (day !== storyDay) {
|
||||
|
|
@ -190,7 +190,7 @@ Archive.prototype.stories_macro = function() {
|
|||
}
|
||||
|
||||
var sql = new Sql;
|
||||
sql.retrieve(Sql.ARCHIVE, res.handlers.site._id, this.getFilter(),
|
||||
sql.retrieve(Sql.ARCHIVE, res.handlers.site._id, this.getFilter(),
|
||||
Sql.ARCHIVEORDER, pageSize, (page - 1) * pageSize);
|
||||
sql.traverse(function() {
|
||||
var story = Story.getById(this.id);
|
||||
|
|
@ -219,7 +219,7 @@ Archive.prototype.getSize = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {boolean}
|
||||
* @param {boolean}
|
||||
* @returns {String}
|
||||
*/
|
||||
Archive.prototype.getFilter = function() {
|
||||
|
|
@ -230,14 +230,14 @@ Archive.prototype.getFilter = function() {
|
|||
buffer.unshift(Number(archive.name));
|
||||
}
|
||||
} while (archive = archive.parent);
|
||||
|
||||
|
||||
if (buffer.length < 0) {
|
||||
var now = new Date;
|
||||
buffer.push(now.getDate());
|
||||
buffer.push(now.getMonth() + 1);
|
||||
buffer.push(now.getFullYear());
|
||||
}
|
||||
|
||||
|
||||
res.push();
|
||||
var sql = new Sql;
|
||||
var keys = ["year", "month", "day"];
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@
|
|||
# $URL$
|
||||
#
|
||||
|
||||
## jala.Calendar is using this collection (Archive itself is retrieving
|
||||
## stories from Stories.featured and via direct DB request)
|
||||
## jala.Calendar is using this collection (Archive itself is retrieving
|
||||
## stories from Stories.featured and via direct DB request)
|
||||
_children = collection(Story)
|
||||
_children.local = id
|
||||
_children.foreign = site_id
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<% #main %>
|
||||
<div class="pagelink">
|
||||
<% archive.link previous <% gettext "Previous page" %>
|
||||
<% archive.link previous <% gettext "Previous page" %>
|
||||
prefix='<div class="pagelinkTop">... ' suffix="</div>" %>
|
||||
</div>
|
||||
<% archive.stories %>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<% #main %>
|
||||
<tr>
|
||||
<td valign="top" width="5%">
|
||||
<input type="radio" id="<% choice.id %>" name="choice"
|
||||
<input type="radio" id="<% choice.id %>" name="choice"
|
||||
value="<% choice.id %>" <% if <% choice.selected %> is true then
|
||||
'checked="checked"'
|
||||
%> />
|
||||
|
|
@ -13,17 +13,17 @@
|
|||
<div class="choice" style="margin-top: 5px;">
|
||||
<span class="small"><% gettext Choice %> #<% param.index %>:</span>
|
||||
<div>
|
||||
<input type="text" name="title" class="formText"
|
||||
<input type="text" name="title" class="formText"
|
||||
value="<% choice.title %>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% #result %>
|
||||
<p>
|
||||
<div style="width: <% choice.votes 300 default="1" %>px;"
|
||||
<div style="width: <% choice.votes 300 default="1" %>px;"
|
||||
class="pollResultsBar"></div>
|
||||
<span class="small"><% choice.votes % | format #.#% %>
|
||||
<% ngettext "{0} vote" "{0} votes" <% choice.votes %>
|
||||
<span class="small"><% choice.votes % | format #.#% %>
|
||||
<% ngettext "{0} vote" "{0} votes" <% choice.votes %>
|
||||
prefix="(" suffix=")" %></span><br />
|
||||
<% choice.title %>
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ markgettext("Choice");
|
|||
markgettext("choice");
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Choice.add = function(title, poll) {
|
||||
HopObject.confirmConstructor(Choice);
|
||||
|
|
@ -40,9 +40,9 @@ Choice.add = function(title, poll) {
|
|||
poll.add(choice);
|
||||
return choice;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Choice.remove = function() {
|
||||
if (this.constructor === Choice) {
|
||||
|
|
@ -70,7 +70,7 @@ Choice.prototype.constructor = function(title) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Choice.prototype.selected_macro = function() {
|
||||
var votes;
|
||||
|
|
@ -83,7 +83,7 @@ Choice.prototype.selected_macro = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} variant
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@
|
|||
|
||||
<% #upload %>
|
||||
<div class="upload" style="position: relative;">
|
||||
<input type="file" id="<% param.name %>" name="<% param.name %>"
|
||||
onchange='$("#<% param.name %>_origin").val($(this).val());'
|
||||
<input type="file" id="<% param.name %>" name="<% param.name %>"
|
||||
onchange='$("#<% param.name %>_origin").val($(this).val());'
|
||||
style="position: relative; z-index: 1; visibility: hidden;" />
|
||||
<div class="text" style="position: absolute; z-index: 2; top: 0; left: 0;">
|
||||
<input type="text" name="<% param.name %>_origin"
|
||||
id="<% param.name %>_origin" value="<% param.value %>"
|
||||
<input type="text" name="<% param.name %>_origin"
|
||||
id="<% param.name %>_origin" value="<% param.value %>"
|
||||
onblur='$("#<% param.name %>").val("");' />
|
||||
<button id="<% param.name %>_control" name="<% param.name %>_control"
|
||||
<button id="<% param.name %>_control" name="<% param.name %>_control"
|
||||
type="button" onclick='$("#<% param.name %>").click();'>
|
||||
<% gettext "Browse..." %>
|
||||
</button>
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
</div>
|
||||
|
||||
<% #listItemFlag %>
|
||||
<td rowspan="2" width="10" align="center" valign="top" nowrap="nowrap"
|
||||
<td rowspan="2" width="10" align="center" valign="top" nowrap="nowrap"
|
||||
class="listItemFlag"><% param.text %></td>
|
||||
<td rowspan="2" width="5" nowrap="nowrap"></td>
|
||||
|
||||
|
|
@ -35,11 +35,11 @@
|
|||
|
||||
<% gettext "PLEASE DO NOT REPLY TO THE SENDER ADDRESS OF THIS MESSAGE." %>
|
||||
|
||||
<% gettext 'This message was automatically sent to you because you are listed as
|
||||
<% gettext 'This message was automatically sent to you because you are listed as
|
||||
recipient of notification e-mails of the corresponding site.' %>
|
||||
|
||||
<% gettext 'Thus, you will be notified whenever the site has undergone changes
|
||||
<% gettext 'Thus, you will be notified whenever the site has undergone changes
|
||||
as specified in the site preferences.' %>
|
||||
|
||||
<% gettext 'If you think you have received this e-mail in error please contact
|
||||
<% gettext 'If you think you have received this e-mail in error please contact
|
||||
the maintainer of the site.' %>
|
||||
|
|
|
|||
|
|
@ -676,7 +676,7 @@ less.Parser = function Parser(env) {
|
|||
keyword: function () {
|
||||
var k;
|
||||
|
||||
if (k = $(/^[_A-Za-z-][_A-Za-z0-9-]*/)) {
|
||||
if (k = $(/^[_A-Za-z-][_A-Za-z0-9-]*/)) {
|
||||
if (tree.colors.hasOwnProperty(k)) {
|
||||
// detect named color
|
||||
return new(tree.Color)(tree.colors[k].slice(1));
|
||||
|
|
@ -1256,7 +1256,7 @@ less.Parser = function Parser(env) {
|
|||
|
||||
mediaFeatures: function () {
|
||||
var e, features = [];
|
||||
|
||||
|
||||
do {
|
||||
if (e = $(this.mediaFeature)) {
|
||||
features.push(e);
|
||||
|
|
@ -1266,7 +1266,7 @@ less.Parser = function Parser(env) {
|
|||
if (! $(',')) { break }
|
||||
}
|
||||
} while (e);
|
||||
|
||||
|
||||
return features.length > 0 ? features : null;
|
||||
},
|
||||
|
||||
|
|
@ -2286,18 +2286,18 @@ tree.Media.prototype = {
|
|||
env.mediaBlocks = [];
|
||||
env.mediaPath = [];
|
||||
}
|
||||
|
||||
|
||||
var blockIndex = env.mediaBlocks.length;
|
||||
env.mediaPath.push(this);
|
||||
env.mediaBlocks.push(this);
|
||||
|
||||
var media = new(tree.Media)([], []);
|
||||
media.features = this.features.eval(env);
|
||||
|
||||
|
||||
env.frames.unshift(this.ruleset);
|
||||
media.ruleset = this.ruleset.eval(env);
|
||||
env.frames.shift();
|
||||
|
||||
|
||||
env.mediaBlocks[blockIndex] = media;
|
||||
env.mediaPath.pop();
|
||||
|
||||
|
|
@ -2460,7 +2460,7 @@ tree.mixin.Definition.prototype = {
|
|||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (name = this.params[i].name) {
|
||||
if (this.params[i].variadic && args) {
|
||||
varargs = [];
|
||||
|
|
@ -2792,7 +2792,7 @@ tree.Ruleset.prototype = {
|
|||
rules.push(rule.value.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rulesets = rulesets.join('');
|
||||
|
||||
|
|
|
|||
|
|
@ -45,11 +45,11 @@ Exporter.run = function(site, user) {
|
|||
if (site.export_id && (file = File.getById(site.export_id))) {
|
||||
File.remove.call(file);
|
||||
}
|
||||
|
||||
|
||||
var rssUrl = site.href("rss.xml");
|
||||
var baseDir = site.getStaticFile();
|
||||
var member = site.members.get(user.name);
|
||||
|
||||
|
||||
var xml = new helma.File(baseDir, "export.xml");
|
||||
xml.remove();
|
||||
xml.open();
|
||||
|
|
@ -98,7 +98,7 @@ Exporter.run = function(site, user) {
|
|||
// FIXME: Adding a file to a site could be a little bit simpler :/
|
||||
file = new File;
|
||||
file.site = site;
|
||||
file.update({file: {contentLength: 0}, file_origin: "file://" +
|
||||
file.update({file: {contentLength: 0}, file_origin: "file://" +
|
||||
xml.getPath(), name: site.name + "-export"});
|
||||
site.files.add(file);
|
||||
file.creator = user;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<% #xslDeclaration %>
|
||||
<?xml-stylesheet title="Xml Stylesheet" type="text/xsl"
|
||||
<?xml-stylesheet title="Xml Stylesheet" type="text/xsl"
|
||||
href="<% site.href rss.xsl %>"?>
|
||||
<!--
|
||||
................................................................................
|
||||
|
|
@ -14,10 +14,10 @@
|
|||
xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
|
||||
xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
|
||||
<xsl:output method="html" encoding="UTF-8" indent="yes"
|
||||
doctype-public="-//W3C//DTD XHTML 1.1//EN"
|
||||
doctype-public="-//W3C//DTD XHTML 1.1//EN"
|
||||
doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"/>
|
||||
<xsl:template match="/">
|
||||
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title><xsl:value-of select="/rss/channel/title"/></title>
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/**
|
||||
* @fileOverview Douglas Crockford’s JSON parser and serializer.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @name JSON
|
||||
* @namespace
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* This method produces a JSON text from a JavaScript value.
|
||||
* @name JSON.stringify
|
||||
|
|
|
|||
|
|
@ -43,18 +43,18 @@ var Sql = function(options) {
|
|||
var SqlData = function(result) {
|
||||
var columns = [];
|
||||
this.values = {};
|
||||
|
||||
|
||||
for (var i=1; i<=result.getColumnCount(); i+=1) {
|
||||
columns.push(result.getColumnName(i).toLowerCase());
|
||||
}
|
||||
|
||||
|
||||
this.next = function() {
|
||||
for each (var key in columns) {
|
||||
this.values[key] = result.getColumnItem(key);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ var Sql = function(options) {
|
|||
}
|
||||
return sql;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Executes an SQL command.
|
||||
* @param {String} sql The SQL command.
|
||||
|
|
@ -118,7 +118,7 @@ var Sql = function(options) {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves an SQL query.
|
||||
* @example sql.retrieve('select $1 from $2 order by $1', 'date', 'foo')
|
||||
|
|
@ -128,7 +128,7 @@ var Sql = function(options) {
|
|||
this.retrieve = function() {
|
||||
return log.info(query = resolve(arguments));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Traverses over the results of an SQL query.
|
||||
* @param {Function} callback The callback function executed for each record.
|
||||
|
|
@ -147,42 +147,42 @@ var Sql = function(options) {
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
*/
|
||||
this.toString = function() {
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* SQL query for retrieving the amount of records in a table.
|
||||
* @constant
|
||||
* @constant
|
||||
*/
|
||||
Sql.COUNT = "select count(*) as count from $0";
|
||||
|
||||
/**
|
||||
/**
|
||||
* SQL query for retrieving the referrers of a site or a story.
|
||||
* @constant
|
||||
* @constant
|
||||
*/
|
||||
Sql.REFERRERS = "select referrer, count(*) as requests from " +
|
||||
"log where context_type = '$0' and context_id = $1 and action = " +
|
||||
"'main' and created > now() - interval '2 days' group " +
|
||||
"by referrer order by requests desc, referrer asc";
|
||||
"by referrer order by requests desc, referrer asc";
|
||||
|
||||
/**
|
||||
/**
|
||||
* SQL command for deleting all log entries older than 2 days.
|
||||
* @constant
|
||||
* @constant
|
||||
*/
|
||||
Sql.PURGEREFERRERS = "delete from log where action = 'main' and " +
|
||||
"created < now() - interval '2 days'";
|
||||
|
||||
/**
|
||||
/**
|
||||
* SQL query for searching stories and comments.
|
||||
* @constant
|
||||
* @constant
|
||||
*/
|
||||
Sql.SEARCH = "select content.id from content, site, metadata where site.id = $0 and " +
|
||||
"site.id = content.site_id and content.status in ('public', 'shared', 'open') and " +
|
||||
|
|
@ -190,37 +190,37 @@ Sql.SEARCH = "select content.id from content, site, metadata where site.id = $0
|
|||
"lower(metadata.value) like lower('%$1%') group by content.id, content.created " +
|
||||
"order by content.created desc limit $2";
|
||||
|
||||
/**
|
||||
/**
|
||||
* SQL query for searching members.
|
||||
* @constant
|
||||
* @constant
|
||||
*/
|
||||
Sql.MEMBERSEARCH = "select name from account where name $0 '$1' " +
|
||||
"order by name asc limit $2";
|
||||
|
||||
/**
|
||||
/**
|
||||
* SQL query for retrieving all story IDs in a site’s archive.
|
||||
* @constant
|
||||
* @constant
|
||||
*/
|
||||
Sql.ARCHIVE = "select id from content where site_id = $0 and prototype = 'Story' and " +
|
||||
"status in ('public', 'shared', 'open') $1 $2 limit $3 offset $4";
|
||||
|
||||
/**
|
||||
/**
|
||||
* SQL command for retrieving the size of a site’s archive.
|
||||
* @constant
|
||||
* @constant
|
||||
*/
|
||||
Sql.ARCHIVESIZE = "select count(*) as count from content where site_id = $0 " +
|
||||
"and prototype = 'Story' and status in ('public', 'shared', 'open') $1";
|
||||
|
||||
/**
|
||||
/**
|
||||
* SQL part filtering the archive query.
|
||||
* @see Archive#getFilter
|
||||
* @constant
|
||||
* @constant
|
||||
*/
|
||||
Sql.ARCHIVEPART = " and extract($0 from created) = $1";
|
||||
|
||||
/**
|
||||
/**
|
||||
* SQL part for applying an order to the archive query.
|
||||
* @see Archive#stories_macro
|
||||
* @constant
|
||||
* @constant
|
||||
*/
|
||||
Sql.ARCHIVEORDER = "order by created desc";
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
// $URL$
|
||||
|
||||
/**
|
||||
* @fileOverview Contains redefined or additional methods for
|
||||
* @fileOverview Contains redefined or additional methods for
|
||||
* internationalization and localization.
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
<form action="<% response.action %>" method="post">
|
||||
<p class="storyTitle"><% gettext Warning! %></p>
|
||||
<p><% param.text %></p>
|
||||
<p><% gettext 'Please be aware of the fact that there is no “undo”, so if you
|
||||
<p><% gettext 'Please be aware of the fact that there is no “undo”, so if you
|
||||
click “Proceed” below the changes will be applied irreversibly.' %></p>
|
||||
<p><% gettext 'Click “Cancel” now if you are not really sure you want to
|
||||
<p><% gettext 'Click “Cancel” now if you are not really sure you want to
|
||||
proceed.' %></p>
|
||||
<% this.skin <% this.type prefix=$ suffix=#delete %> %>
|
||||
<p><button type="submit" name="proceed" value="1"><% gettext Proceed %></button>
|
||||
|
|
@ -24,7 +24,7 @@ proceed.' %></p>
|
|||
<% #notify_edit %>
|
||||
<% gettext 'Hello {0}.' <% membership.name %> %>
|
||||
|
||||
<% gettext 'User {0} has modified {1} #{2} at the site {3}:' <% this.modifier %>
|
||||
<% gettext 'User {0} has modified {1} #{2} at the site {3}:' <% this.modifier %>
|
||||
<% gettext <% this.kind %> %> <% this.id %> <% site.title %> %>
|
||||
<% this.href %>
|
||||
|
||||
|
|
|
|||
|
|
@ -24,16 +24,16 @@
|
|||
// $URL$
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the extensions of Helma’s built-in
|
||||
* @fileOverview Defines the extensions of Helma’s built-in
|
||||
* HopObject prototype.
|
||||
*/
|
||||
|
||||
app.addRepository('modules/helma/Aspects');
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {HopObject} collection
|
||||
* @param {Object} options Optional flags, e.g. to force or prevent any
|
||||
* @param {Object} options Optional flags, e.g. to force or prevent any
|
||||
* conditional checks of individual prototype’s remove() methods
|
||||
*/
|
||||
HopObject.remove = function(options) {
|
||||
|
|
@ -45,7 +45,7 @@ HopObject.remove = function(options) {
|
|||
} else if (!options) {
|
||||
item.remove();
|
||||
} else {
|
||||
throw Error("Missing static " + item.constructor.name +
|
||||
throw Error("Missing static " + item.constructor.name +
|
||||
".remove() method");
|
||||
}
|
||||
}
|
||||
|
|
@ -53,7 +53,7 @@ HopObject.remove = function(options) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {HopObject} collection
|
||||
*/
|
||||
|
|
@ -75,7 +75,7 @@ HopObject.getFromPath = function(name, collection) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Debugging method to detect direct constructor calls which
|
||||
* Debugging method to detect direct constructor calls which
|
||||
* should be replaced with static add() method.
|
||||
*/
|
||||
HopObject.confirmConstructor = function(ref) {
|
||||
|
|
@ -89,7 +89,7 @@ HopObject.confirmConstructor = function(ref) {
|
|||
} else {
|
||||
ref = (ref || this).constructor.name;
|
||||
if (!confirmed[ref]) {
|
||||
app.logger.warn('Calling unconfirmed constructor for ' +
|
||||
app.logger.warn('Calling unconfirmed constructor for ' +
|
||||
ref + ' prototype – please check!');
|
||||
}
|
||||
}
|
||||
|
|
@ -103,36 +103,36 @@ HopObject.confirmConstructor = function(ref) {
|
|||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
HopObject.prototype.onRequest = function() {
|
||||
// Checking if we are on the correct host to prevent at least some XSS issues
|
||||
if (req.action !== "notfound" && req.action !== "error" &&
|
||||
this.href().contains("://") &&
|
||||
!this.href().toLowerCase().startsWith(req.servletRequest.scheme +
|
||||
"://" + req.servletRequest.serverName.toLowerCase())) {
|
||||
if (req.action !== "notfound" && req.action !== "error" &&
|
||||
this.href().contains("://") &&
|
||||
!this.href().toLowerCase().startsWith(req.servletRequest.scheme +
|
||||
"://" + req.servletRequest.serverName.toLowerCase())) {
|
||||
res.redirect(this.href(req.action === "main" ? String.EMPTY : req.action));
|
||||
}
|
||||
|
||||
User.autoLogin();
|
||||
res.handlers.membership = User.getMembership();
|
||||
|
||||
|
||||
if (User.getCurrentStatus() === User.BLOCKED) {
|
||||
session.data.status = 403;
|
||||
session.data.error = gettext("Your account has been blocked.") + String.SPACE +
|
||||
session.data.error = gettext("Your account has been blocked.") + String.SPACE +
|
||||
gettext("Please contact an administrator for further information.");
|
||||
User.logout();
|
||||
res.redirect(root.href("error"));
|
||||
}
|
||||
|
||||
if (res.handlers.site.status === Site.BLOCKED &&
|
||||
|
||||
if (res.handlers.site.status === Site.BLOCKED &&
|
||||
!User.require(User.PRIVILEGED)) {
|
||||
session.data.status = 403;
|
||||
session.data.error = gettext("The site you requested has been blocked.") +
|
||||
String.SPACE + gettext("Please contact an administrator for further information.");
|
||||
res.redirect(root.href("error"));
|
||||
}
|
||||
|
||||
|
||||
HopObject.confirmConstructor(Layout);
|
||||
res.handlers.layout = res.handlers.site.layout || new Layout;
|
||||
res.skinpath = res.handlers.layout.getSkinPath();
|
||||
|
|
@ -146,7 +146,7 @@ HopObject.prototype.onRequest = function() {
|
|||
User.getLocation();
|
||||
res.status = 401;
|
||||
res.data.title = gettext("{0} 401 Error", root.title);
|
||||
res.data.body = root.renderSkinAsString("$Root#error", {error:
|
||||
res.data.body = root.renderSkinAsString("$Root#error", {error:
|
||||
gettext("You are not allowed to access this part of the site.")});
|
||||
res.handlers.site.renderSkin("Site#page");
|
||||
session.data.error = null;
|
||||
|
|
@ -177,7 +177,7 @@ HopObject.prototype.delete_action = function() {
|
|||
if (req.postParams.proceed) {
|
||||
try {
|
||||
var parent = this._parent;
|
||||
var url = this.constructor.remove.call(this, req.postParams) ||
|
||||
var url = this.constructor.remove.call(this, req.postParams) ||
|
||||
parent.href();
|
||||
res.message = gettext("{0} was successfully deleted.", gettext(this._prototype));
|
||||
res.redirect(User.getLocation() || url);
|
||||
|
|
@ -207,7 +207,7 @@ HopObject.prototype.touch = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
HopObject.prototype.log = function() {
|
||||
var entry = new LogEntry(this, "main");
|
||||
|
|
@ -216,15 +216,15 @@ HopObject.prototype.log = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} action
|
||||
*/
|
||||
HopObject.prototype.notify = function(action) {
|
||||
var self = this;
|
||||
var site = res.handlers.site;
|
||||
|
||||
|
||||
var getPermission = function(scope, mode, status) {
|
||||
if (scope === Admin.NONE || mode === Site.NOBODY ||
|
||||
if (scope === Admin.NONE || mode === Site.NOBODY ||
|
||||
status === Site.BLOCKED) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -237,7 +237,7 @@ HopObject.prototype.notify = function(action) {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Helper method for debugging
|
||||
var renderMatrix = function() {
|
||||
var buf = ['<table border=1 cellspacing=0>'];
|
||||
|
|
@ -247,7 +247,7 @@ HopObject.prototype.notify = function(action) {
|
|||
var perm = getPermission(scope.value, mode.value, status.value);
|
||||
buf.push('<tr style="');
|
||||
perm && buf.push('color: blue;');
|
||||
if (scope.value === root.notificationScope && mode.value ===
|
||||
if (scope.value === root.notificationScope && mode.value ===
|
||||
site.notificationMode && status.value === site.status) {
|
||||
buf.push(' background-color: yellow;');
|
||||
}
|
||||
|
|
@ -274,7 +274,7 @@ HopObject.prototype.notify = function(action) {
|
|||
site.members.forEach(function() {
|
||||
var membership = res.handlers.membership = this;
|
||||
if (getPermission(root.notificationScope, site.notificationMode, site.status)) {
|
||||
sendMail(membership.creator.email, gettext("[{0}] Notification of site changes",
|
||||
sendMail(membership.creator.email, gettext("[{0}] Notification of site changes",
|
||||
root.title), self.renderSkinAsString("$HopObject#notify_" + action));
|
||||
}
|
||||
});
|
||||
|
|
@ -296,7 +296,7 @@ HopObject.prototype.getTags = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Tag[]|String} tags
|
||||
*/
|
||||
HopObject.prototype.setTags = function(tags) {
|
||||
|
|
@ -309,7 +309,7 @@ HopObject.prototype.setTags = function(tags) {
|
|||
} else if (tags.constructor === String) {
|
||||
tags = tags.split(/\s*,\s*/);
|
||||
}
|
||||
|
||||
|
||||
var diff = {};
|
||||
var tag;
|
||||
for (var i in tags) {
|
||||
|
|
@ -326,7 +326,7 @@ HopObject.prototype.setTags = function(tags) {
|
|||
}
|
||||
diff[this.tag.name] = (tags.indexOf(this.tag.name) < 0) ? this : 0;
|
||||
});
|
||||
|
||||
|
||||
for (var tag in diff) {
|
||||
switch (diff[tag]) {
|
||||
case 0:
|
||||
|
|
@ -345,7 +345,7 @@ HopObject.prototype.setTags = function(tags) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
*/
|
||||
HopObject.prototype.addTag = function(name) {
|
||||
|
|
@ -354,7 +354,7 @@ HopObject.prototype.addTag = function(name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} tag
|
||||
*/
|
||||
HopObject.prototype.removeTag = function(tag) {
|
||||
|
|
@ -367,7 +367,7 @@ HopObject.prototype.removeTag = function(tag) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} values
|
||||
*/
|
||||
HopObject.prototype.map = function(values) {
|
||||
|
|
@ -378,7 +378,7 @@ HopObject.prototype.map = function(values) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} name
|
||||
*/
|
||||
|
|
@ -396,7 +396,7 @@ HopObject.prototype.skin_macro = function(param, name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} name
|
||||
*/
|
||||
|
|
@ -408,7 +408,7 @@ HopObject.prototype.input_macro = function(param, name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} name
|
||||
*/
|
||||
|
|
@ -420,7 +420,7 @@ HopObject.prototype.textarea_macro = function(param, name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} name
|
||||
*/
|
||||
|
|
@ -435,7 +435,7 @@ HopObject.prototype.select_macro = function(param, name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} name
|
||||
*/
|
||||
|
|
@ -458,7 +458,7 @@ HopObject.prototype.checkbox_macro = function(param, name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} name
|
||||
*/
|
||||
|
|
@ -481,7 +481,7 @@ HopObject.prototype.radiobutton_macro = function(param, name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} name
|
||||
*/
|
||||
|
|
@ -494,7 +494,7 @@ HopObject.prototype.upload_macro = function(param, name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {HopObject} [handler]
|
||||
*/
|
||||
|
|
@ -513,7 +513,7 @@ HopObject.prototype.macro_macro = function(param, handler) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
HopObject.prototype.kind_macro = function() {
|
||||
var type = this.constructor.name.toLowerCase();
|
||||
|
|
@ -526,7 +526,7 @@ HopObject.prototype.kind_macro = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {Number|String}
|
||||
*/
|
||||
|
|
@ -556,14 +556,14 @@ HopObject.prototype.self_macro = function(param, property) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
HopObject.prototype.type_macro = function() {
|
||||
return res.write(this.constructor.name);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} url
|
||||
* @param {String} text
|
||||
|
|
@ -581,7 +581,7 @@ HopObject.prototype.link_macro = function(param, url, text) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} format
|
||||
*/
|
||||
|
|
@ -594,7 +594,7 @@ HopObject.prototype.created_macro = function(param, format) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} format
|
||||
*/
|
||||
|
|
@ -607,7 +607,7 @@ HopObject.prototype.modified_macro = function(param, format) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} mode
|
||||
*/
|
||||
|
|
@ -626,7 +626,7 @@ HopObject.prototype.creator_macro = function(param, mode) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} mode
|
||||
*/
|
||||
|
|
@ -660,7 +660,7 @@ HopObject.prototype.toString = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} text
|
||||
* @param {Object} param
|
||||
* @param {String} action
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ $(function() {
|
|||
<td valign="top" class="small"><% gettext Name suffix=: %></td>
|
||||
<td>
|
||||
<% image.input name %><br />
|
||||
<span class="small"><% gettext "If you do not specify a name Antville will
|
||||
<span class="small"><% gettext "If you do not specify a name Antville will
|
||||
create one based on the name of the local or remote file, resp." %></span>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -52,11 +52,11 @@ $(function() {
|
|||
<tr class="resize">
|
||||
<td class="small"> </td>
|
||||
<td class="small">
|
||||
<% gettext "If you want to resize the image please specify your desired
|
||||
maximum width and/or maximum height in pixels. If you specify both the image
|
||||
will be resized to match both criterias, but the image ratio will be
|
||||
<% gettext "If you want to resize the image please specify your desired
|
||||
maximum width and/or maximum height in pixels. If you specify both the image
|
||||
will be resized to match both criterias, but the image ratio will be
|
||||
preserved." %><br /><br />
|
||||
<% gettext "If the width or height of your image exceeds 100 pixels Antville
|
||||
<% gettext "If the width or height of your image exceeds 100 pixels Antville
|
||||
automatically creates a thumbnail of it, too." %>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -78,14 +78,14 @@ $(function() {
|
|||
<td colspan="2" class="small">
|
||||
<strong><% gettext Macro suffix=: %></strong> <% image.macro %>
|
||||
<div class="ample"><strong><% gettext Properties suffix=: %></strong>
|
||||
<% image.contentType %>, <% image.contentLength %>,
|
||||
<% image.contentType %>, <% image.contentLength %>,
|
||||
<% image.width %>×<% image.height %> <% gettext pixels %></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="storyTitle"><% image.name %></div>
|
||||
<div class="storyDate"><% gettext "{0} on {1}" <% image.creator link %>
|
||||
<div class="storyDate"><% gettext "{0} on {1}" <% image.creator link %>
|
||||
<% image.created short %> %></div>
|
||||
</td>
|
||||
<td align="right" class="small" valign="top">
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ this.handleMetadata("width");
|
|||
Image.THUMBNAILWIDTH = 100;
|
||||
|
||||
/** @constant */
|
||||
Image.KEYS = ["name", "created", "modified", "origin", "description",
|
||||
"contentType", "contentLength", "width", "height", "thumbnailName",
|
||||
Image.KEYS = ["name", "created", "modified", "origin", "description",
|
||||
"contentType", "contentLength", "width", "height", "thumbnailName",
|
||||
"thumbnailWidth", "thumbnailHeight", "fileName", "site"];
|
||||
|
||||
/**
|
||||
|
|
@ -74,7 +74,7 @@ Image.add = function(data, parent, user) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Image.remove = function() {
|
||||
if (this.constructor === Image) {
|
||||
|
|
@ -87,7 +87,7 @@ Image.remove = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} type
|
||||
* @returns {String}
|
||||
*/
|
||||
|
|
@ -133,7 +133,7 @@ Image.getFileExtension = function(type) {
|
|||
* @property {Number} parent_id
|
||||
* @property {String} parent_type
|
||||
* @property {String} prototype
|
||||
* @property {Tag[]} tags
|
||||
* @property {Tag[]} tags
|
||||
* @property {Number} thumbnailHeight
|
||||
* @property {String} thumbnailName
|
||||
* @property {Number} thumbnailWidth
|
||||
|
|
@ -146,7 +146,7 @@ Image.prototype.constructor = function(data) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} action
|
||||
* @return {Boolean}
|
||||
*/
|
||||
|
|
@ -157,12 +157,12 @@ Image.prototype.getPermission = function(action) {
|
|||
case "main":
|
||||
return true;
|
||||
case "delete":
|
||||
return defaultGrant && this.creator === session.user ||
|
||||
return defaultGrant && this.creator === session.user ||
|
||||
Membership.require(Membership.MANAGER) ||
|
||||
User.require(User.PRIVILEGED);
|
||||
User.require(User.PRIVILEGED);
|
||||
case "edit":
|
||||
return defaultGrant && this.creator === session.user ||
|
||||
Membership.require(Membership.MANAGER) ||
|
||||
return defaultGrant && this.creator === session.user ||
|
||||
Membership.require(Membership.MANAGER) ||
|
||||
User.require(User.PRIVILEGED) &&
|
||||
this.parent_type !== "Layout" ||
|
||||
this.parent === path.layout;
|
||||
|
|
@ -171,7 +171,7 @@ Image.prototype.getPermission = function(action) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} action
|
||||
* @returns {String}
|
||||
*/
|
||||
|
|
@ -216,13 +216,13 @@ Image.prototype.edit_action = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {Object}
|
||||
*/
|
||||
Image.prototype.getFormValue = function(name) {
|
||||
var self = this;
|
||||
|
||||
|
||||
var getOrigin = function(str) {
|
||||
var origin = req.postParams.file_origin || self.origin;
|
||||
if (origin && origin.contains("://")) {
|
||||
|
|
@ -230,7 +230,7 @@ Image.prototype.getFormValue = function(name) {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if (req.isPost()) {
|
||||
if (name === "file") {
|
||||
return getOrigin();
|
||||
|
|
@ -250,14 +250,14 @@ Image.prototype.getFormValue = function(name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} data
|
||||
*/
|
||||
Image.prototype.update = function(data) {
|
||||
var origin = data.file_origin;
|
||||
|
||||
if (!origin) {
|
||||
if (this.isTransient()) {
|
||||
if (this.isTransient()) {
|
||||
throw Error(gettext("There was nothing to upload. Please be sure to choose a file."));
|
||||
}
|
||||
} else if (origin !== this.origin) {
|
||||
|
|
@ -274,36 +274,36 @@ Image.prototype.update = function(data) {
|
|||
if (!extension) {
|
||||
throw Error(gettext("This does not seem to be a (valid) JPG, PNG or GIF image file."));
|
||||
}
|
||||
|
||||
|
||||
this.origin = origin;
|
||||
var mimeName = mime.normalizeFilename(mime.name);
|
||||
this.contentLength = mime.contentLength;
|
||||
this.contentType = mime.contentType;
|
||||
|
||||
|
||||
if (!this.name) {
|
||||
var name = File.getName(data.name) || mimeName.split(".")[0];
|
||||
this.name = this.parent.images.getAccessName(name);
|
||||
}
|
||||
|
||||
var image = this.getConstraint(mime, data.maxWidth, data.maxHeight);
|
||||
this.height = image.height;
|
||||
this.height = image.height;
|
||||
this.width = image.width;
|
||||
|
||||
var thumbnail;
|
||||
if (image.width > Image.THUMBNAILWIDTH) {
|
||||
thumbnail = this.getConstraint(mime, Image.THUMBNAILWIDTH);
|
||||
this.thumbnailWidth = thumbnail.width;
|
||||
this.thumbnailHeight = thumbnail.height;
|
||||
this.thumbnailWidth = thumbnail.width;
|
||||
this.thumbnailHeight = thumbnail.height;
|
||||
} else if (this.isPersistent()) {
|
||||
this.getThumbnailFile().remove();
|
||||
// NOTE: delete operator won't work here due to getter/setter methods
|
||||
this.deleteMetadata("thumbnailName", "thumbnailWidth", "thumbnailHeight");
|
||||
}
|
||||
|
||||
// Make the image persistent before proceeding with writing files and
|
||||
// Make the image persistent before proceeding with writing files and
|
||||
// setting tags (also see Helma bug #607)
|
||||
this.isTransient() && this.persist();
|
||||
|
||||
|
||||
var fileName = this.name + extension;
|
||||
if (fileName !== this.fileName) {
|
||||
// Remove existing image files if the file name has changed
|
||||
|
|
@ -324,36 +324,36 @@ Image.prototype.update = function(data) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Image.prototype.tags_macro = function() {
|
||||
return res.write(this.getFormValue("tags"));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Image.prototype.contentLength_macro = function() {
|
||||
return res.write((this.contentLength / 1024).format("###,###") + " KB");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Image.prototype.url_macro = function() {
|
||||
return res.write(this.getUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Image.prototype.macro_macro = function() {
|
||||
return HopObject.prototype.macro_macro.call(this, null,
|
||||
return HopObject.prototype.macro_macro.call(this, null,
|
||||
this.parent.constructor === Layout ? "layout.image" : "image");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
*/
|
||||
Image.prototype.thumbnail_macro = function(param) {
|
||||
|
|
@ -371,7 +371,7 @@ Image.prototype.thumbnail_macro = function(param) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
*/
|
||||
Image.prototype.render_macro = function(param) {
|
||||
|
|
@ -386,7 +386,7 @@ Image.prototype.render_macro = function(param) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} name
|
||||
* @returns {helma.File}
|
||||
* @see Site#getStaticFile
|
||||
|
|
@ -402,7 +402,7 @@ Image.prototype.getFile = function(name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} name
|
||||
* @returns {String}
|
||||
* @see Site#getStaticUrl
|
||||
|
|
@ -447,7 +447,7 @@ Image.prototype.getJSON = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {helma.util.MimePart} mime
|
||||
* @param {Number} maxWidth
|
||||
* @param {Number} maxHeight
|
||||
|
|
@ -465,9 +465,9 @@ Image.prototype.getConstraint = function(mime, maxWidth, maxHeight) {
|
|||
factorV = maxHeight / image.height;
|
||||
}
|
||||
if (factorH !== 1 || factorV !== 1) {
|
||||
var width = Math.ceil(image.width *
|
||||
var width = Math.ceil(image.width *
|
||||
(factorH < factorV ? factorH : factorV));
|
||||
var height = Math.ceil(image.height *
|
||||
var height = Math.ceil(image.height *
|
||||
(factorH < factorV ? factorH : factorV));
|
||||
image.resize(width, height);
|
||||
if (mime.contentType.endsWith("gif")) {
|
||||
|
|
@ -483,7 +483,7 @@ Image.prototype.getConstraint = function(mime, maxWidth, maxHeight) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {helma.Image|helma.util.MimePart} data
|
||||
* @param {Object} thumbnail
|
||||
* @throws {Error}
|
||||
|
|
@ -504,7 +504,7 @@ Image.prototype.writeFiles = function(data, thumbnail) {
|
|||
}
|
||||
} catch (ex) {
|
||||
app.log(ex);
|
||||
throw Error(gettext("Could not save the image file on disk."));
|
||||
throw Error(gettext("Could not save the image file on disk."));
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ alphabeticalGalleries.local = id
|
|||
alphabeticalGalleries.foreign = site_id
|
||||
alphabeticalGalleries.filter = tag.type = 'Image' and \
|
||||
substr(tag.name, 1, 1) >= "A" and \
|
||||
substr(tag.name, 1, 1) <= "Z"
|
||||
substr(tag.name, 1, 1) <= "Z"
|
||||
alphabeticalGalleries.group = upper(substr(tag.name, 1, 1))
|
||||
alphabeticalGalleries.group.order = tag.name asc
|
||||
|
||||
|
|
@ -56,6 +56,6 @@ otherGalleries.local = id
|
|||
otherGalleries.foreign = site_id
|
||||
otherGalleries.filter = tag.type = 'Image' and \
|
||||
substr(tag.name, 1, 1) < "A" or \
|
||||
substr(tag.name, 1, 1) > "Z"
|
||||
substr(tag.name, 1, 1) > "Z"
|
||||
otherGalleries.group = tag.name
|
||||
otherGalleries.group.order = tag.name asc
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ $(function() {
|
|||
<% layout.link export <% gettext Export %> prefix=" | " %>
|
||||
<% layout.link reset <% gettext Reset %> prefix=" | " %>
|
||||
</div>
|
||||
...
|
||||
...
|
||||
<% layout.link images <% gettext Images %> %>
|
||||
<% layout.link skins <% gettext Skins %> prefix=" | " %>
|
||||
<% //layout.link sandbox <% gettext Sandbox %> prefix=" | " %>
|
||||
|
|
@ -70,6 +70,6 @@ $(function() {
|
|||
<% #value %>
|
||||
<tr>
|
||||
<td class="small"><% param.key %>:</td>
|
||||
<td><input type="text" name="value_<% param.key %>"
|
||||
<td><input type="text" name="value_<% param.key %>"
|
||||
value="<% param.value %>" size="40" /></td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ Layout.add = function(site, user) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Layout} layout
|
||||
* @param {Boolean} includeSelf
|
||||
*/
|
||||
|
|
@ -102,7 +102,7 @@ Layout.sandbox = function(value) {
|
|||
var cookie = User.COOKIE + 'LayoutSandbox';
|
||||
if (typeof value === 'undefined') {
|
||||
return req.cookies[cookie] === 'true';
|
||||
}
|
||||
}
|
||||
if (value === true) {
|
||||
res.setCookie(cookie, true);
|
||||
} else if (value === false) {
|
||||
|
|
@ -111,7 +111,7 @@ Layout.sandbox = function(value) {
|
|||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @function
|
||||
* @returns {String[]}
|
||||
* @see defineConstants
|
||||
|
|
@ -145,7 +145,7 @@ Layout.prototype.constructor = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} action
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
|
@ -169,7 +169,7 @@ Layout.prototype.getPermission = function(action) {
|
|||
// FIXME: The Layout.href method is overwritten to guarantee that
|
||||
// URLs won't contain the layout ID instead of "layout"
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} action
|
||||
* @returns {String}
|
||||
*/
|
||||
|
|
@ -199,7 +199,7 @@ Layout.prototype.main_action = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {Object}
|
||||
*/
|
||||
|
|
@ -213,7 +213,7 @@ Layout.prototype.getFormOptions = function(name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} data
|
||||
*/
|
||||
Layout.prototype.update = function(data) {
|
||||
|
|
@ -235,7 +235,7 @@ Layout.prototype.update = function(data) {
|
|||
}
|
||||
res.write("\n");
|
||||
skin.setSource(res.pop());
|
||||
Layout.sandbox(!!data.sandbox);
|
||||
Layout.sandbox(!!data.sandbox);
|
||||
this.description = data.description;
|
||||
this.mode = data.mode;
|
||||
this.touch();
|
||||
|
|
@ -318,7 +318,7 @@ Layout.prototype.import_action = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} fallback
|
||||
* @returns {Image}
|
||||
|
|
@ -339,7 +339,7 @@ Layout.prototype.getImage = function(name, fallback) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {helma.File}
|
||||
*/
|
||||
|
|
@ -360,7 +360,7 @@ Layout.prototype.getSkinPath = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Layout.prototype.reset = function() {
|
||||
var skinFiles = app.getSkinfilesInPath([app.dir]);
|
||||
|
|
@ -389,7 +389,7 @@ Layout.prototype.reset = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} skinPath
|
||||
* @returns {helma.Zip}
|
||||
*/
|
||||
|
|
@ -416,7 +416,7 @@ Layout.prototype.getArchive = function(skinPath) {
|
|||
try {
|
||||
zip.add(this.getThumbnailFile());
|
||||
} catch (ex) {
|
||||
/* Most likely the thumbnail file is identical to the image */
|
||||
/* Most likely the thumbnail file is identical to the image */
|
||||
}
|
||||
var image = new HopObject;
|
||||
for each (var key in Image.KEYS) {
|
||||
|
|
@ -424,12 +424,12 @@ Layout.prototype.getArchive = function(skinPath) {
|
|||
data.images.add(image);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
data.version = Root.VERSION.toString();
|
||||
data.origin = this.origin || this.site.href();
|
||||
data.originator = this.originator || session.user.name;
|
||||
data.originated = this.originated || new Date;
|
||||
|
||||
|
||||
// FIXME: XML encoder is losing all mixed-case properties :(
|
||||
var xml = new java.lang.String(Xml.writeToString(data));
|
||||
zip.addData(xml.getBytes("UTF-8"), "data.xml");
|
||||
|
|
@ -442,11 +442,11 @@ Layout.prototype.getArchive = function(skinPath) {
|
|||
* @returns {String}
|
||||
*/
|
||||
Layout.prototype.getConfirmText = function() {
|
||||
return gettext("You are about to reset the layout of site {0}.",
|
||||
return gettext("You are about to reset the layout of site {0}.",
|
||||
this.site.name);
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {HopObject}
|
||||
*/
|
||||
|
|
@ -454,14 +454,14 @@ Layout.prototype.getMacroHandler = function(name) {
|
|||
switch (name) {
|
||||
case "skins":
|
||||
return this[name];
|
||||
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} name
|
||||
* @param {String} mode
|
||||
|
|
@ -495,7 +495,7 @@ Layout.prototype.image_macro = function(param, name, mode) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Layout.prototype.values_macro = function() {
|
||||
var values = [];
|
||||
|
|
@ -505,7 +505,7 @@ Layout.prototype.values_macro = function() {
|
|||
values.sort(new String.Sorter("key"));
|
||||
for each (var pair in values) {
|
||||
this.renderSkin("$Layout#value", {
|
||||
key: pair.key.capitalize(),
|
||||
key: pair.key.capitalize(),
|
||||
value: pair.value
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ markgettext("log entry");
|
|||
* @property {String} context_type
|
||||
* @property {Date} created
|
||||
* @property {User} creator
|
||||
* @property {String} referrer
|
||||
* @property {String} referrer
|
||||
* @extends HopObject
|
||||
*/
|
||||
LogEntry.prototype.constructor = function(context, action) {
|
||||
|
|
@ -59,13 +59,13 @@ LogEntry.prototype.constructor = function(context, action) {
|
|||
* @returns {String}
|
||||
*/
|
||||
LogEntry.prototype.toString = function() {
|
||||
return "[LogEntry #" + this._id + ": " + (this.creator || "anonymous") +
|
||||
" requested " + this.action + " action of " + this.context_type +
|
||||
return "[LogEntry #" + this._id + ": " + (this.creator || "anonymous") +
|
||||
" requested " + this.action + " action of " + this.context_type +
|
||||
" #" + this.context_id + " on " + formatDate(this.created) + "]";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {HopObject}
|
||||
*/
|
||||
|
|
@ -78,7 +78,7 @@ LogEntry.prototype.getMacroHandler = function(name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
*/
|
||||
LogEntry.prototype.label_macro = function(param) {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
</div>
|
||||
... <% members.link main <% gettext All %> %>
|
||||
<% members.link owners <% gettext Owners %> prefix="| " %>
|
||||
<% members.link managers <% gettext Managers %> prefix="| " %>
|
||||
<% members.link managers <% gettext Managers %> prefix="| " %>
|
||||
<% members.link contributors <% gettext Contributors %> prefix="| " %>
|
||||
<% members.link subscribers <% gettext Subscribers %> prefix="| " %>
|
||||
<% response.pager %>
|
||||
|
|
@ -41,7 +41,7 @@ $(function() {
|
|||
<table border="0" cellspacing="0" cellpadding="3">
|
||||
<tr>
|
||||
<td class="small"><% gettext "Username" suffix=":" %></td>
|
||||
<td><input type="text" name="name" id="name" tabindex="1" size="20"
|
||||
<td><input type="text" name="name" id="name" tabindex="1" size="20"
|
||||
value="<% request.name encoding="form" %>" /></td>
|
||||
<td rowspan="4"> </td>
|
||||
<td class="small"><% members.link register <% gettext
|
||||
|
|
@ -56,7 +56,7 @@ $(function() {
|
|||
<tr>
|
||||
<td> </td>
|
||||
<td colspan="4" class="small"><input type="checkbox" id="remember"
|
||||
name="remember" tabindex="3" <% if <% request.remember %> is "on" then
|
||||
name="remember" tabindex="3" <% if <% request.remember %> is "on" then
|
||||
'checked="checked"' %> />
|
||||
<label for="remember"><% gettext "Remember Login" %></label></td>
|
||||
</tr>
|
||||
|
|
@ -119,7 +119,7 @@ $(function() {
|
|||
<tr>
|
||||
<td></td>
|
||||
<td><br />
|
||||
<button type="submit" id="submit" name="register"
|
||||
<button type="submit" id="submit" name="register"
|
||||
value="register"><% gettext Register %></button>
|
||||
<a href="" class="cancel"><% gettext Cancel %></a></td>
|
||||
</tr>
|
||||
|
|
@ -128,18 +128,18 @@ value="register"><% gettext Register %></button>
|
|||
|
||||
<% #reset %>
|
||||
<p class="storyTitle"><% response.title %></p>
|
||||
<p class="small"><% gettext "Enter your username and the e-mail address you
|
||||
have used when you registered. You will then receive a confirmation e-mail
|
||||
containing further instructions." %></p>
|
||||
<p class="small"><% gettext "Enter your username and the e-mail address you
|
||||
have used when you registered. You will then receive a confirmation e-mail
|
||||
containing further instructions." %></p>
|
||||
<form id="login" method="post" action="<% response.action %>">
|
||||
<div class="small"><% gettext Username suffix=: %></div>
|
||||
<div><input type="text" name="name" id="name" size="30" tabindex="1"
|
||||
<div><input type="text" name="name" id="name" size="30" tabindex="1"
|
||||
value="<% request.name encoding="form" %>" /></div>
|
||||
<div class="small"><% gettext e-mail suffix=: %></div>
|
||||
<div><input type="text" name="email" id="email" size="30" tabindex="2"
|
||||
<div><input type="text" name="email" id="email" size="30" tabindex="2"
|
||||
value="<% request.email encoding="form" %>"/></div>
|
||||
<br />
|
||||
<button type="submit" id="submit" name="reset" value="1"
|
||||
<button type="submit" id="submit" name="reset" value="1"
|
||||
tabindex="4"><% gettext "Send Request" %></button>
|
||||
<a href="" class="cancel"><% gettext Cancel %></a>
|
||||
</form>
|
||||
|
|
@ -150,12 +150,12 @@ tabindex="4"><% gettext "Send Request" %></button>
|
|||
<div class="small"><% gettext Password suffix=: %></div>
|
||||
<div><input type="password" name="password" id="password" size="15" tabindex="1" /></div>
|
||||
<div class="small"><% gettext "Confirm Password" suffix=: %></div>
|
||||
<div><input type="password" name="passwordConfirm" id="passwordConfirm"
|
||||
<div><input type="password" name="passwordConfirm" id="passwordConfirm"
|
||||
size="15" tabindex="2" /></div>
|
||||
<input type="hidden" name="user" id="user" value="<% request.user %>" />
|
||||
<input type="hidden" name="token" id="token" value="<% request.token %>" />
|
||||
<br />
|
||||
<button type="submit" id="submit" name="save" value="1"
|
||||
<button type="submit" id="submit" name="save" value="1"
|
||||
tabindex="4"><% gettext Save %></button>
|
||||
<a href="" class="cancel"><% gettext Cancel %></a>
|
||||
</form>
|
||||
|
|
@ -166,7 +166,7 @@ tabindex="4"><% gettext Save %></button>
|
|||
<div class="small"><% gettext 'You can use the asterisk * as wildcard.' %></div>
|
||||
<br />
|
||||
<form method="post" action="<% response.action %>">
|
||||
<input type="text" name="term" id="term"
|
||||
<input type="text" name="term" id="term"
|
||||
value="<% request.term encoding="form" %>" />
|
||||
<button type="submit" name="search" value="1"><% gettext Search %></button>
|
||||
<a href="<% this.href %>"><% gettext Cancel %></a>
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ contributors.order = name asc
|
|||
|
||||
subscribers = collection(Membership)
|
||||
subscribers.accessName = name
|
||||
subscribers.local = id
|
||||
subscribers.local = id
|
||||
subscribers.foreign = site_id
|
||||
subscribers.filter = role = 'subscriber'
|
||||
subscribers.order = name asc
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<% #edit %>
|
||||
<p class="storyTitle"><% response.title %></p>
|
||||
<p class="small">
|
||||
<% gettext 'To modify a membership select the desired role from the
|
||||
<% gettext 'To modify a membership select the desired role from the
|
||||
drop-down menu and click the “Save” button.' %>
|
||||
<% gettext 'An e-mail will be sent to notify the user of the update.' %>
|
||||
</p>
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
<table border="0" cellspacing="0" cellpadding="0" width="100%">
|
||||
<tr>
|
||||
<td colspan="3" class="small">
|
||||
<div class="ample"><strong><% gettext Role suffix=: %></strong>
|
||||
<div class="ample"><strong><% gettext Role suffix=: %></strong>
|
||||
<% membership.role %></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -57,15 +57,15 @@
|
|||
<table border="0" cellspacing="0" cellpadding="0" width="100%">
|
||||
<tr>
|
||||
<td colspan="3" class="small">
|
||||
<div class="ample"><strong><% gettext Role suffix=: %></strong>
|
||||
<div class="ample"><strong><% gettext Role suffix=: %></strong>
|
||||
<% membership.role %></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<div class="storyTitle"><% subscription.title default=<% gettext Untitled
|
||||
<div class="storyTitle"><% subscription.title default=<% gettext Untitled
|
||||
prefix="<em>[" suffix="]</em>" %> %></div>
|
||||
<div class="small"><% subscription.modified short prefix=<% gettext
|
||||
<div class="small"><% subscription.modified short prefix=<% gettext
|
||||
"Last updated on" suffix=" " %> %></div>
|
||||
</td>
|
||||
<td width="10"> </td>
|
||||
|
|
@ -79,15 +79,15 @@
|
|||
<% #contact %>
|
||||
<p class="storyTitle"><% response.title %></p>
|
||||
<p class="small">
|
||||
<% gettext 'Please enter your message to the user below.' %>
|
||||
<% gettext 'To prevent abuse, the sender address and the subject of the e-mail
|
||||
<% gettext 'Please enter your message to the user below.' %>
|
||||
<% gettext 'To prevent abuse, the sender address and the subject of the e-mail
|
||||
are set to predefined values.' %>
|
||||
<% gettext 'A generic disclaimer will be automatically appended to your message.' %>
|
||||
</p>
|
||||
<form method="post" action="<% response.action %>">
|
||||
<p>
|
||||
<span class="small"><% gettext Message suffix=: %></span><br />
|
||||
<textarea cols="31" rows="10" class="formText" wrap="virtual"
|
||||
<textarea cols="31" rows="10" class="formText" wrap="virtual"
|
||||
name="text"><% request.text encoding="form" %></textarea>
|
||||
</p>
|
||||
<% feature recaptcha %>
|
||||
|
|
@ -106,17 +106,17 @@
|
|||
<% #notify_contact %>
|
||||
<% request.text %>
|
||||
|
||||
<% if <% sender.role %> is null then
|
||||
<% if <% sender.role %> is null then
|
||||
<% gettext 'This message was sent to you by an anonymous user of the site {0} [1].'
|
||||
<% site.title %> %>
|
||||
else
|
||||
<% gettext 'This message was sent to you by the user {0} of the site {1} [1].'
|
||||
else
|
||||
<% gettext 'This message was sent to you by the user {0} of the site {1} [1].'
|
||||
<% sender.name %> <% site.title %> %>
|
||||
%>
|
||||
|
||||
<% gettext "PLEASE DO NOT REPLY TO THE SENDER ADDRESS OF THIS MESSAGE." %>
|
||||
<% if <% sender.role %> is null then '' else
|
||||
<% gettext 'If the user did not include contact information in the message
|
||||
<% if <% sender.role %> is null then '' else
|
||||
<% gettext 'If the user did not include contact information in the message
|
||||
itself, you can send your reply via the user’s contact form [2].' prefix="
|
||||
" suffix="
|
||||
" %><% // The ugly linebreaks are necessary to format the message nicely %>
|
||||
|
|
@ -127,14 +127,14 @@ else
|
|||
--
|
||||
|
||||
[1] <% site.href %>
|
||||
<% if <% sender.role %> is null then '' else
|
||||
<% sender.href contact prefix='[2] ' %>
|
||||
<% if <% sender.role %> is null then '' else
|
||||
<% sender.href contact prefix='[2] ' %>
|
||||
%>
|
||||
|
||||
<% #notify_register %>
|
||||
<% gettext 'Welcome to {0}, {1}!' <% root.title %> <% membership.name %> %>
|
||||
|
||||
<% gettext 'You can edit your account profile and change its password any
|
||||
<% gettext 'You can edit your account profile and change its password any
|
||||
time via the following link:' %>
|
||||
<% members.href edit %>
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ else
|
|||
<% #notify_edit %>
|
||||
<% gettext 'Hello {0}.' <% membership.name %> %>
|
||||
|
||||
<% gettext 'The user {0} has modified your membership of the site {1} at {2}.'
|
||||
<% gettext 'The user {0} has modified your membership of the site {1} at {2}.'
|
||||
<% sender.name %> <% site.title %> <% site.href %> %>
|
||||
|
||||
<% gettext 'You are now {0} of the site.' <% membership.role %> %>
|
||||
|
|
@ -155,7 +155,7 @@ else
|
|||
<% #notify_add %>
|
||||
<% gettext 'Hello {0}.' <% membership.name %> %>
|
||||
|
||||
<% gettext 'The user {0} has added your account to the list of members
|
||||
<% gettext 'The user {0} has added your account to the list of members
|
||||
of the site {1} at {2}.' <% sender.name %> <% site.title %> <% site.href %> %>
|
||||
|
||||
<% gettext 'You are now {0} of the site.' <% membership.role %> %>
|
||||
|
|
@ -166,8 +166,8 @@ else
|
|||
<% #notify_delete %>
|
||||
<% gettext 'Hello {0}.' <% membership.name %> %>
|
||||
|
||||
<% gettext 'We are sorry to inform you that the user {0} has cancelled your
|
||||
membership of the site {1} at {2}.' <% sender.name %> <% site.title %>
|
||||
<% gettext 'We are sorry to inform you that the user {0} has cancelled your
|
||||
membership of the site {1} at {2}.' <% sender.name %> <% site.title %>
|
||||
<% site.href %> %>
|
||||
|
||||
<% gettext "Best regards." %>
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ markgettext("Membership");
|
|||
markgettext("membership");
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {Site} site
|
||||
* @returns {Membership}
|
||||
|
|
@ -41,7 +41,7 @@ Membership.getByName = function(name, site) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} role
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
|
@ -57,7 +57,7 @@ Membership.require = function(role) {
|
|||
* @returns {String[]}
|
||||
* @see defineConstants
|
||||
*/
|
||||
Membership.getRoles = defineConstants(Membership, markgettext("Subscriber"),
|
||||
Membership.getRoles = defineConstants(Membership, markgettext("Subscriber"),
|
||||
markgettext("Contributor"), markgettext("Manager"), markgettext("Owner"));
|
||||
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ Membership.add = function(user, role, site) {
|
|||
return membership;
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Membership} membership
|
||||
* @param {Object} options
|
||||
*/
|
||||
|
|
@ -91,7 +91,7 @@ Membership.remove = function(options) {
|
|||
var recipient = this.creator.email;
|
||||
this.remove();
|
||||
if (!options.force) {
|
||||
this.notify(req.action, recipient,
|
||||
this.notify(req.action, recipient,
|
||||
gettext("[{0}] Notification of membership cancellation", root.title));
|
||||
}
|
||||
return;
|
||||
|
|
@ -131,7 +131,7 @@ Membership.prototype.constructor = function(user, role) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} action
|
||||
* @return {Boolean}
|
||||
*/
|
||||
|
|
@ -144,14 +144,14 @@ Membership.prototype.getPermission = function(action) {
|
|||
return true;
|
||||
case "edit":
|
||||
case "delete":
|
||||
return User.require(User.PRIVILEGED) ||
|
||||
return User.require(User.PRIVILEGED) ||
|
||||
this.role !== Membership.OWNER || this.creator !== session.user;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {Object}
|
||||
*/
|
||||
|
|
@ -174,7 +174,7 @@ Membership.prototype.edit_action = function() {
|
|||
app.log(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
res.data.action = this.href(req.action);
|
||||
res.data.title = gettext("Edit Membership: {0}", this.name);
|
||||
res.data.body = this.renderSkinAsString("$Membership#edit");
|
||||
|
|
@ -183,7 +183,7 @@ Membership.prototype.edit_action = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} data
|
||||
*/
|
||||
Membership.prototype.update = function(data) {
|
||||
|
|
@ -194,7 +194,7 @@ Membership.prototype.update = function(data) {
|
|||
} else if (data.role !== this.role) {
|
||||
this.role = data.role || Membership.SUBSCRIBER;
|
||||
this.touch();
|
||||
this.notify(req.action, this.creator.email,
|
||||
this.notify(req.action, this.creator.email,
|
||||
gettext("[{0}] Notification of membership change", root.title));
|
||||
}
|
||||
return;
|
||||
|
|
@ -213,14 +213,14 @@ Membership.prototype.contact_action = function() {
|
|||
gettext('[{0}] Message from user {1}', root.title, session.user.name) :
|
||||
gettext('[{0}] Message from anonymous user', root.title));
|
||||
res.message = gettext("Your message was sent successfully.");
|
||||
res.redirect(this._parent.getPermission() ?
|
||||
res.redirect(this._parent.getPermission() ?
|
||||
this._parent.href() : this.site.href());
|
||||
} catch(ex) {
|
||||
res.message = ex;
|
||||
app.log(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
res.data.action = this.href(req.action);
|
||||
res.data.title = gettext('Contact User: {0}', this.name);
|
||||
res.data.body = this.renderSkinAsString("$Membership#contact");
|
||||
|
|
@ -229,9 +229,9 @@ Membership.prototype.contact_action = function() {
|
|||
}
|
||||
|
||||
Membership.prototype.content_action = function() {
|
||||
res.data.list = renderList(this.content, "$Story#listItem",
|
||||
res.data.list = renderList(this.content, "$Story#listItem",
|
||||
10, req.queryParams.page);
|
||||
res.data.pager = renderPager(this.content,
|
||||
res.data.pager = renderPager(this.content,
|
||||
this.href(), 10, req.queryParams.page);
|
||||
res.data.title = gettext("Content of User: {0}", this.name);
|
||||
res.data.body = this.renderSkinAsString("$Membership#content");
|
||||
|
|
@ -239,7 +239,7 @@ Membership.prototype.content_action = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {HopObject}
|
||||
*/
|
||||
|
|
@ -252,12 +252,12 @@ Membership.prototype.getMacroHandler = function(name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} role
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
Membership.prototype.require = function(role) {
|
||||
var roles = [Membership.SUBSCRIBER, Membership.CONTRIBUTOR,
|
||||
var roles = [Membership.SUBSCRIBER, Membership.CONTRIBUTOR,
|
||||
Membership.MANAGER, Membership.OWNER];
|
||||
if (role) {
|
||||
return roles.indexOf(this.role) >= roles.indexOf(role);
|
||||
|
|
@ -266,7 +266,7 @@ Membership.prototype.require = function(role) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} action
|
||||
* @param {String} recipient
|
||||
* @param {String} subject
|
||||
|
|
@ -290,7 +290,7 @@ Membership.prototype.notify = function(action, recipient, subject) {
|
|||
* @returns {String}
|
||||
*/
|
||||
Membership.prototype.getConfirmText = function() {
|
||||
return gettext("You are about to delete the membership of user {0}.",
|
||||
return gettext("You are about to delete the membership of user {0}.",
|
||||
this.creator.name);
|
||||
}
|
||||
|
||||
|
|
@ -308,7 +308,7 @@ Membership.prototype.toString = function() {
|
|||
Membership.prototype.valueOf = Membership.prototype.toString;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Membership.prototype.status_macro = function() {
|
||||
this.renderSkin(session.user ? "Membership#status" : "Membership#login");
|
||||
|
|
@ -316,7 +316,7 @@ Membership.prototype.status_macro = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Membership.prototype.role_macro = function() {
|
||||
this.role && res.write(gettext(this.role.capitalize()));
|
||||
|
|
@ -324,7 +324,7 @@ Membership.prototype.role_macro = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} value
|
||||
* @param {Object} param
|
||||
* @returns {String}
|
||||
|
|
@ -334,6 +334,6 @@ Membership.prototype.link_filter = function(value, param) {
|
|||
if (!session.user || !session.user.url) {
|
||||
return value;
|
||||
}
|
||||
return HopObject.prototype.link_filter.call(this, value,
|
||||
return HopObject.prototype.link_filter.call(this, value,
|
||||
param, session.user.url); // || this.href());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<% #status %>
|
||||
<span class="nowrap"><% gettext "Logged in as {0}"
|
||||
<span class="nowrap"><% gettext "Logged in as {0}"
|
||||
<% membership.name | membership.link %> %></span>
|
||||
<div><% membership.role prefix='(' suffix=')' %></div>
|
||||
<% site.members.link edit <% gettext "Edit User Profile" %> prefix="... "
|
||||
<% site.members.link edit <% gettext "Edit User Profile" %> prefix="... "
|
||||
suffix="<br />" %>
|
||||
<% site.link subscribe <% gettext Subscribe context=verb %> prefix="... " suffix="<br />" %>
|
||||
<% site.members.link updated <% gettext Subscriptions %> prefix="... "
|
||||
<% site.members.link updated <% gettext Subscriptions %> prefix="... "
|
||||
suffix="<br />" %>
|
||||
<% site.members.link logout <% gettext Logout context=verb %> prefix="... " %>
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Get an object representing the type properties settings suitable for
|
||||
* Get an object representing the type properties settings suitable for
|
||||
* defining prototypes with the definePrototype() method.
|
||||
* @returns {Object} The type properties settings as object.
|
||||
* @see <a href="http://helma.org/wiki/Defining+HopObject+mappings+programmatically">Helma documentation</a>
|
||||
|
|
@ -47,10 +47,10 @@ Metadata.getTypeProperties = function() {
|
|||
/**
|
||||
* Prepare a value for writing it to the metadata database table.
|
||||
* The type of each metadata is stored along with its value.
|
||||
* The normalize() method determines the type and possibly modifies
|
||||
* The normalize() method determines the type and possibly modifies
|
||||
* the value accordingly.
|
||||
* @param {Object} value
|
||||
* @returns {Array} Compound value consisting of two elements,
|
||||
* @returns {Array} Compound value consisting of two elements,
|
||||
* the (normalized) metadata value and its type.
|
||||
*/
|
||||
Metadata.normalize = function(value) {
|
||||
|
|
@ -85,7 +85,7 @@ Metadata.normalize = function(value) {
|
|||
* @constructor
|
||||
* @description The Metadata prototype provides means to store one metadata key-value
|
||||
* pair per record in the metadata database table. Each record is assigned to a
|
||||
* parent HopObject which is fitted with convenient methods to easily retrieve
|
||||
* parent HopObject which is fitted with convenient methods to easily retrieve
|
||||
* and modify the attached metadata objects.
|
||||
* @see HopObject#handleMetadata
|
||||
* @property {HopObject} parent The HopObject the metadata belongs to.
|
||||
|
|
@ -143,7 +143,7 @@ Metadata.prototype.getValue = function() {
|
|||
|
||||
/**
|
||||
* Get a textual representation of the metadata object.
|
||||
* @returns {String} A textual representation of the metadata object.
|
||||
* @returns {String} A textual representation of the metadata object.
|
||||
*/
|
||||
Metadata.prototype.toString = function() {
|
||||
return "Metadata of " + this.parent + " (" + this.name + " = " + this.value + ")";
|
||||
|
|
|
|||
228
code/Metadata/Metadata.js.old
Normal file
228
code/Metadata/Metadata.js.old
Normal file
|
|
@ -0,0 +1,228 @@
|
|||
//
|
||||
// The Antville Project
|
||||
// http://code.google.com/p/antville
|
||||
//
|
||||
// Copyright 2001-2007 by The Antville People
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the ``License'');
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an ``AS IS'' BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// $Revision: 3858 $
|
||||
// $LastChangedBy: interface@p3k.org $
|
||||
// $LastChangedDate: 2009-11-02 17:16:41 +0100 (Mon, 02 Nov 2009) $
|
||||
// $URL: https://antville.googlecode.com/svn/trunk/code/Metadata/Metadata.js $
|
||||
//
|
||||
|
||||
/**
|
||||
* @fileoverview Defines a Metadata prototype.
|
||||
* @requires Object.js module
|
||||
*/
|
||||
|
||||
// Resolve dependencies
|
||||
app.addRepository("modules/core/Object.js");
|
||||
|
||||
Metadata.PREFIX = Metadata().__name__.toLowerCase() + "_";
|
||||
|
||||
/**
|
||||
* This prototype provides dynamic database records by storing data as
|
||||
* JavaScript object source (similar to JSON) in a dedicated database column.
|
||||
* @name Metadata
|
||||
* @constructor
|
||||
*/
|
||||
|
||||
// Save internal methods for good
|
||||
/** @ignore */
|
||||
Metadata.prototype._get = Metadata.prototype.get;
|
||||
/** @ignore */
|
||||
Metadata.prototype._set = Metadata.prototype.set;
|
||||
|
||||
/**
|
||||
* Retrieves the name of the property that contains the data for the
|
||||
* Metadata instance. The name is constructed out of the instances's mountpoint
|
||||
* and the suffix "_data".
|
||||
* @returns {String} The resulting value
|
||||
*/
|
||||
Metadata.prototype.getDataSourceName = function() {
|
||||
return Metadata.PREFIX + "source";
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the properties and values of a Metadata instance from the parent
|
||||
* node.
|
||||
* @returns {Object}
|
||||
*/
|
||||
Metadata.prototype.load = function() {
|
||||
return eval(this._parent[this.getDataSourceName()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the properties and values of a Metadata instance to the parent
|
||||
* node.
|
||||
*/
|
||||
Metadata.prototype.save = function() {
|
||||
var ref = this.cache.data || {};
|
||||
this._parent[this.getDataSourceName()] = ref.toSource();
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the value of a property of a Metadata instance. If no argument
|
||||
* is given the complete metadata structure is returned.
|
||||
* @param {String} key The name of the desired property
|
||||
* @returns {Object} The resulting value
|
||||
*/
|
||||
Metadata.prototype.get = function(key) {
|
||||
if (this.cache.data == null) {
|
||||
this.cache.data = this.load() || {};
|
||||
}
|
||||
if (arguments.length < 1) {
|
||||
return this.cache.data;
|
||||
}
|
||||
var value = this.cache.data[key];
|
||||
if (value !== undefined) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies a value into a property of a Metadata instance. If the first
|
||||
* argument is omitted the complete metadata is replaced with the second
|
||||
* argument.
|
||||
* @param {String} key The name of the desired property
|
||||
* @param {Object} value The future value of the property
|
||||
*/
|
||||
Metadata.prototype.set = function(key, value) {
|
||||
if (arguments.length > 1) {
|
||||
// Coerce Java classes into String prototypes
|
||||
if (value && !value.constructor) {
|
||||
value = String(value);
|
||||
}
|
||||
this.get()[key] = value;
|
||||
} else if (arguments.length > 0) {
|
||||
value = arguments[0];
|
||||
if (value instanceof Object === false) {
|
||||
value = value.clone({});
|
||||
}
|
||||
this.cache.data = value;
|
||||
}
|
||||
this.save();
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a property from a Metadata instance.
|
||||
* @param {String} key The name of the desired property
|
||||
*/
|
||||
Metadata.prototype.remove = function(key) {
|
||||
delete this.cache.data[key];
|
||||
this.save();
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all properties and values from a Metadata instance.
|
||||
*/
|
||||
Metadata.prototype.destroy = function() {
|
||||
delete this.cache.data;
|
||||
this.save();
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all valid keys of a Metadata instance.
|
||||
* @returns {String[]} The list of valid keys
|
||||
*/
|
||||
Metadata.prototype.keys = function() {
|
||||
var cache = this.get();
|
||||
var keys = [];
|
||||
for (var i in cache) {
|
||||
keys.push(i);
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the number of properties contained in a Metadata instance.
|
||||
* @returns {Number} The size of a Metadata instance
|
||||
*/
|
||||
Metadata.prototype.size = function() {
|
||||
return this.keys().length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Concatenates a string representation of a Metadata instance.
|
||||
* @returns {String} A string representing a Metadata object
|
||||
*/
|
||||
Metadata.prototype.toString = function() {
|
||||
res.push();
|
||||
var keys = this.keys();
|
||||
res.write("[Metadata (");
|
||||
if (keys.length < 1) {
|
||||
res.write("empty");
|
||||
} else {
|
||||
res.write(keys.length);
|
||||
res.write(" element");
|
||||
if (keys.length > 1) {
|
||||
res.write("s");
|
||||
}
|
||||
}
|
||||
res.write(")]");
|
||||
return res.pop();
|
||||
}
|
||||
|
||||
/**
|
||||
* Concatenates the source of the underlying HopObject of a Metadata
|
||||
* instance. Useful for debugging purposes.
|
||||
* @returns {String} The source of the underlying HopObject
|
||||
*/
|
||||
Metadata.prototype.toSource = function() {
|
||||
return this.get().toSource();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves all properties and values of a Metadata instance.
|
||||
* @returns {Object} The property map of a Metadata instance
|
||||
* @deprecated Use get() with no arguments instead
|
||||
*/
|
||||
Metadata.prototype.getData = function() {
|
||||
return this.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces all properties and values of a Metadata instance with those of
|
||||
* another object.
|
||||
* @param {Object} obj The replacing data
|
||||
* @deprecated Use set() with a single argument instead
|
||||
*/
|
||||
Metadata.prototype.setData = function(obj) {
|
||||
obj && this.set(obj);
|
||||
return;
|
||||
}
|
||||
|
||||
// FIXME: This is Antville-specific code and should be removed from here
|
||||
Metadata.prototype.getFormValue = function(name) {
|
||||
if (req.isPost()) {
|
||||
return req.postParams[name];
|
||||
} else {
|
||||
return this.get(name) || req.queryParams[name] || String.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {HopObject}
|
||||
*/
|
||||
Metadata.prototype.onUnhandledMacro = function(name) {
|
||||
return this.get(name);
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
</p>
|
||||
|
||||
<% #main %>
|
||||
<% if <% param.header %> is true then <% poll.skin #header suffix="<br />" %> else
|
||||
<% if <% param.header %> is true then <% poll.skin #header suffix="<br />" %> else
|
||||
<% poll.question prefix='<div class="pollTitle">' suffix="</div> %> %>
|
||||
<form method="post" action="<% poll.href %>">
|
||||
<table border="0" cellspacing="2" cellpadding="2">
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
<tr>
|
||||
<td colspan="2">
|
||||
<br />
|
||||
<button type="submit" name="vote" value="1"><% gettext Vote %></button>
|
||||
<button type="submit" name="vote" value="1"><% gettext Vote %></button>
|
||||
<% poll.link result <% gettext "Results" %> %>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -27,16 +27,16 @@
|
|||
<% poll.skin #footer %>
|
||||
|
||||
<% #results %>
|
||||
<% if <% param.header %> is true then <% poll.skin #header %> else
|
||||
<% if <% param.header %> is true then <% poll.skin #header %> else
|
||||
<% poll.question prefix=<strong> suffix="</strong> %> %>
|
||||
<% poll.loop skin="$Choice#result" %>
|
||||
<div class="small">
|
||||
<% gettext Total suffix=: %>
|
||||
<% gettext Total suffix=: %>
|
||||
<% ngettext "{0} vote" "{0} votes" <% poll.votes %> %>
|
||||
<% if <% poll.status %> is open then "" else
|
||||
<% if <% poll.closed %> is null then "" else
|
||||
<% if <% poll.closed %> is null then "" else
|
||||
<% gettext "This poll was closed by {0} on {1}"
|
||||
<% poll.modifier %> <% poll.closed short %> prefix="<br />" %>
|
||||
<% poll.modifier %> <% poll.closed short %> prefix="<br />" %>
|
||||
%>
|
||||
%>
|
||||
</div>
|
||||
|
|
@ -50,19 +50,19 @@
|
|||
<div class="listSeparator"> </div>
|
||||
<table border="0" cellspacing="0" cellpadding="0" width="100%">
|
||||
<tr>
|
||||
<% if <% poll.status %> is closed then
|
||||
<% if <% poll.status %> is closed then
|
||||
<% listItemFlag <% gettext closed %> %>
|
||||
%>
|
||||
<td colspan="3" class="small">
|
||||
<strong><% gettext Macro suffix=: %></strong> <% poll.macro %>
|
||||
<div class="ample"><strong><% gettext Status suffix=: %></strong>
|
||||
<div class="ample"><strong><% gettext Status suffix=: %></strong>
|
||||
<% ngettext "{0} vote" "{0} votes" <% poll.votes %> %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<div class="storytitle"><% poll.question %></div>
|
||||
<div class="storyDate"><% poll.creator link %>,
|
||||
<div class="storyDate"><% poll.creator link %>,
|
||||
<% poll.created short %></div>
|
||||
</td>
|
||||
<td width="10" nowrap="nowrap"> </td>
|
||||
|
|
@ -101,10 +101,10 @@ $(function() {
|
|||
<a href="" id="add"><% gettext "Add Choice" %></a>
|
||||
</div>
|
||||
<p class="small">
|
||||
<% if <% poll.created %> then <% gettext "Created by {0} on {1}"
|
||||
<% if <% poll.created %> then <% gettext "Created by {0} on {1}"
|
||||
<% poll.creator %> <% poll.created short %> %> %>
|
||||
<% if <% poll.created %> is <% poll.modified %> then "" else
|
||||
<% gettext "Last modified by {0} on {1}" <% poll.modifier link %>
|
||||
<% if <% poll.created %> is <% poll.modified %> then "" else
|
||||
<% gettext "Last modified by {0} on {1}" <% poll.modifier link %>
|
||||
<% poll.modified short %> prefix="<br />" %>
|
||||
%>
|
||||
</p>
|
||||
|
|
@ -113,8 +113,8 @@ $(function() {
|
|||
<button type="submit" name="save" value="<% poll.status default=closed %>">
|
||||
<% gettext Save %>
|
||||
</button>
|
||||
<% if <% poll.status %> is open then "" else
|
||||
<% gettext "Save and Run" prefix='<button type="submit"
|
||||
<% if <% poll.status %> is open then "" else
|
||||
<% gettext "Save and Run" prefix='<button type="submit"
|
||||
name="save" value="open"><strong>' suffix=</strong></button> %>
|
||||
%>
|
||||
<a href="" class="cancel"><% gettext Cancel %></a>
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ Poll.add = function(data, site) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Poll.remove = function() {
|
||||
if (this.constructor === Poll) {
|
||||
|
|
@ -84,7 +84,7 @@ Poll.prototype.constructor = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} action
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
|
@ -103,15 +103,15 @@ Poll.prototype.getPermission = function(action) {
|
|||
User.require(User.PRIVILEGED);
|
||||
case "rotate":
|
||||
case "delete":
|
||||
return this.creator === session.user ||
|
||||
return this.creator === session.user ||
|
||||
Membership.require(Membership.MANAGER) ||
|
||||
User.require(User.PRIVILEGED);
|
||||
User.require(User.PRIVILEGED);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {Object}
|
||||
*/
|
||||
|
|
@ -146,7 +146,7 @@ Poll.prototype.main_action = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} data
|
||||
*/
|
||||
Poll.prototype.vote = function(data) {
|
||||
|
|
@ -183,7 +183,7 @@ Poll.prototype.edit_action = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} data
|
||||
*/
|
||||
Poll.prototype.update = function(data) {
|
||||
|
|
@ -245,12 +245,12 @@ Poll.prototype.rotate_action = function() {
|
|||
* @returns {String}
|
||||
*/
|
||||
Poll.prototype.getConfirmText = function() {
|
||||
return gettext("You are about to delete a poll by user {0}.",
|
||||
return gettext("You are about to delete a poll by user {0}.",
|
||||
this.creator.name);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} action
|
||||
* @param {String} text
|
||||
|
|
@ -268,7 +268,7 @@ Poll.prototype.link_macro = function(param, action, text) {
|
|||
if (this.status === Poll.OPEN) {
|
||||
text = gettext("Stop");
|
||||
} else {
|
||||
text = this.closed ? gettext("Re-run") : gettext("Run");
|
||||
text = this.closed ? gettext("Re-run") : gettext("Run");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -276,7 +276,7 @@ Poll.prototype.link_macro = function(param, action, text) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} name
|
||||
* @see HopObject#link_macro
|
||||
|
|
@ -306,14 +306,14 @@ Poll.prototype.input_macro = function(param, name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Poll.prototype.votes_macro = function() {
|
||||
return this.votes.size();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} format
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<div class="ample">
|
||||
<% polls.link create <% gettext "Add Poll" %> prefix="... " %>
|
||||
</div>
|
||||
...
|
||||
...
|
||||
<% polls.link main <% gettext "By {0}" <% membership.name %> %> %>
|
||||
<% polls.link running <% gettext Running %> prefix=" | " %>
|
||||
<% polls.link all <% gettext All %> prefix=" | " %>
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ markgettext("polls");
|
|||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} action
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
|
@ -65,7 +65,7 @@ Polls.prototype.getPermission = function(action) {
|
|||
Polls.prototype.main_action = function() {
|
||||
var polls = User.getMembership().polls;
|
||||
res.data.list = renderList(polls, "$Poll#listItem", 10, req.queryParams.page);
|
||||
res.data.pager = renderPager(polls, this.href(req.action),
|
||||
res.data.pager = renderPager(polls, this.href(req.action),
|
||||
10, req.queryParams.page);
|
||||
res.data.title = gettext("Member Polls");
|
||||
res.data.body = this.renderSkinAsString("$Polls#main");
|
||||
|
|
@ -95,9 +95,9 @@ Polls.prototype.create_action = function() {
|
|||
}
|
||||
|
||||
Polls.prototype.running_action = function() {
|
||||
res.data.list = renderList(this.running,
|
||||
res.data.list = renderList(this.running,
|
||||
"$Poll#listItem", 10, req.queryParams.page);
|
||||
res.data.pager = renderPager(this.running,
|
||||
res.data.pager = renderPager(this.running,
|
||||
this.href(req.action), 10, req.queryParams.page);
|
||||
res.data.title = gettext("Running Polls");
|
||||
res.data.body = this.renderSkinAsString("$Polls#main");
|
||||
|
|
@ -107,7 +107,7 @@ Polls.prototype.running_action = function() {
|
|||
|
||||
Polls.prototype.all_action = function() {
|
||||
res.data.list = renderList(this, "$Poll#listItem", 10, req.queryParams.page);
|
||||
res.data.pager = renderPager(this,
|
||||
res.data.pager = renderPager(this,
|
||||
this.href(), 10, req.queryParams.page);
|
||||
res.data.title = gettext("All Polls");
|
||||
res.data.body = this.renderSkinAsString("$Polls#main");
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@
|
|||
_extends = Site
|
||||
_prototype = Root
|
||||
|
||||
## Looks like a mistake but this is necessary to avoid the behaviour described
|
||||
## Looks like a mistake but this is necessary to avoid the behaviour described
|
||||
## in bug http://helma.org/bugs/show_bug.cgi?id=430
|
||||
_parent =
|
||||
_parent =
|
||||
|
||||
api = mountpoint(Api)
|
||||
admin = mountpoint(Admin)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<% #main %>
|
||||
<p><% gettext 'Antville is an open source project aimed at the development of a
|
||||
simple site hosting system with many advanced
|
||||
<p><% gettext 'Antville is an open source project aimed at the development of a
|
||||
simple site hosting system with many advanced
|
||||
<a href="http://code.google.com/p/antville/wiki/AntvilleFeatures">features</a>.' %></p>
|
||||
<p><% gettext 'One Antville installation can easily host up to several thousands
|
||||
<p><% gettext 'One Antville installation can easily host up to several thousands
|
||||
of <a href="{0}">sites</a>.' <% site.href sites %> %></p>
|
||||
<p><% site.link create <% gettext "Create a site. It only takes a few clicks." %> %></p>
|
||||
<p>
|
||||
|
|
@ -26,7 +26,7 @@ simple site hosting system with many advanced
|
|||
<p class="navigation">
|
||||
<div><% site.link health <% gettext Health %> prefix="... " %></div>
|
||||
<div><% site.api.link main <% gettext Interfaces %> prefix="... " %></div>
|
||||
<div><% link http://code.google.com/p/antville <% gettext Development %>
|
||||
<div><% link http://code.google.com/p/antville <% gettext Development %>
|
||||
prefix="... " %></div>
|
||||
</p>
|
||||
<p class="navigation">
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<% param.path %>
|
||||
|
||||
<% #include %>
|
||||
document.writeln('<' + 'scr' + 'ipt type="text/javascript"' +
|
||||
document.writeln('<' + 'scr' + 'ipt type="text/javascript"' +
|
||||
'src="<% param.href %>"></' + 'scr' + 'ipt>');
|
||||
|
||||
<% #listItem %>
|
||||
|
|
@ -10,7 +10,7 @@ document.writeln('<' + 'scr' + 'ipt type="text/javascript"' +
|
|||
<td class="small" title="<% site.modified %>" style="text-align: right; vertical-align: baseline; white-space: nowrap;">
|
||||
<% site.modified text %>
|
||||
</td>
|
||||
<td style="vertical-align: baseline; padding-left: 10px;"><% site.title | site.link %></td>
|
||||
<td style="vertical-align: baseline; padding-left: 10px;"><% site.title | site.link %></td>
|
||||
</tr>
|
||||
|
||||
<% #opensearchdescription %>
|
||||
|
|
@ -29,7 +29,7 @@ document.writeln('<' + 'scr' + 'ipt type="text/javascript"' +
|
|||
<!--
|
||||
var win = external.menuArguments;
|
||||
var url = "<% site.url %>stories/create?content_text=";
|
||||
var link = escape('<a href="' + win.location.href + '">' +
|
||||
var link = escape('<a href="' + win.location.href + '">' +
|
||||
win.document.title + "</a>: ");
|
||||
var text = escape(win.document.selection.createRange().text);
|
||||
win.location.href = url + link + text;
|
||||
|
|
@ -46,14 +46,14 @@ REGEDIT4
|
|||
<p class="storyTitle"><% response.title %></p>
|
||||
<br />
|
||||
<form action="<% response.action %>" method="get">
|
||||
<input type="text" name="filter" value="<% request.filter encoding="form" %>"
|
||||
size="30" />
|
||||
<button type="submit" name="submit" value="1"><% gettext Filter %></button>
|
||||
<input type="text" name="filter" value="<% request.filter encoding="form" %>"
|
||||
size="30" />
|
||||
<button type="submit" name="submit" value="1"><% gettext Filter %></button>
|
||||
<button onclick="document.location='<% site.href referrers %>'; return false;">
|
||||
<% gettext Reset %></button>
|
||||
<div class="small">
|
||||
<input type="checkbox" id="includeSpam" name="includeSpam" value="checked"
|
||||
<% request.includeSpam prefix='checked="' suffix='"' encoding="form" %> />
|
||||
<input type="checkbox" id="includeSpam" name="includeSpam" value="checked"
|
||||
<% request.includeSpam prefix='checked="' suffix='"' encoding="form" %> />
|
||||
<label for="includeSpam"><% gettext 'Display the referrers unfiltered' %></label>
|
||||
</div>
|
||||
<br />
|
||||
|
|
@ -94,13 +94,13 @@ for (var i in referrers) {
|
|||
}
|
||||
document.writeln('<tr>');
|
||||
document.writeln('<td align="right" valign="top">', ref.count, '</td>');
|
||||
document.write('<td valign="top">');
|
||||
document.write('<td valign="top">');
|
||||
if ("<% membership.role %>" === "Owner") {
|
||||
document.write('<input type="checkbox" name="permanent" value="',
|
||||
document.write('<input type="checkbox" name="permanent" value="',
|
||||
ref.url, '" />');
|
||||
}
|
||||
document.writeln('</td>');
|
||||
document.writeln('<td><a href="', ref.url, '"', (isSpam ?
|
||||
document.writeln('<td><a href="', ref.url, '"', (isSpam ?
|
||||
' style="<% value "Small font color" prefix="color: " %>"' : ''),
|
||||
'>', text, '</a></td>');
|
||||
document.writeln('</tr>');
|
||||
|
|
@ -117,21 +117,21 @@ for (var i in referrers) {
|
|||
</form>
|
||||
|
||||
<% #referrer %>
|
||||
referrers.push(new Antville.Referrer("<% param.referrer %>",
|
||||
referrers.push(new Antville.Referrer("<% param.referrer %>",
|
||||
"<% param.text %>", <% param.requests %>));
|
||||
|
||||
<% #noscript %>
|
||||
<% gettext "To make spamming referrers and backlinks useless, they are displayed using client-side JavaScript. To see them, your browser needs to be set to permit the execution of JavaScript." %>
|
||||
|
||||
<% #deleted %>
|
||||
<% gettext "This site is going to be deleted completely and irreversibly after {0}."
|
||||
<% gettext "This site is going to be deleted completely and irreversibly after {0}."
|
||||
<% site.deleted | format long %> %>
|
||||
|
||||
<% #export %>
|
||||
<p class="storyTitle"><% gettext "Export Site Data" %></p>
|
||||
<div class="ample">
|
||||
<p><% if <% param.status %> is null then <% if <% file.self %> is null then '' else <% gettext "Download the file {0} or klick “Start” to create a new one."
|
||||
<% file.skin File#main %> '<small>'
|
||||
<p><% if <% param.status %> is null then <% if <% file.self %> is null then '' else <% gettext "Download the file {0} or klick “Start” to create a new one."
|
||||
<% file.skin File#main %> '<small>'
|
||||
<% file.created | format short %> '</small>' %> %> else <% param.status %> %></p>
|
||||
<form action="" method="post">
|
||||
<button type="submit" name="submit" value="<% if <% param.status %> is null then start else stop %>">
|
||||
|
|
@ -144,11 +144,11 @@ referrers.push(new Antville.Referrer("<% param.referrer %>",
|
|||
<% #import %>
|
||||
<p class="storyTitle"><% gettext 'Import Site Data' %></p>
|
||||
<div class="ample">
|
||||
<p><% if <% file.self %> is null then '' else <% gettext "The site is scheduled for importing the file {0}. The imported site data will be available within 24 hours."
|
||||
<% file.skin File#main %> '</a>' '<small>'
|
||||
<% file.created | format short %> '</small>' %> %></p>
|
||||
<p><% if <% file.self %> is null then '' else <% gettext "The site is scheduled for importing the file {0}. The imported site data will be available within 24 hours."
|
||||
<% file.skin File#main %> '</a>' '<small>'
|
||||
<% file.created | format short %> '</small>' %> %></p>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
|
||||
|
||||
<% if <% file.self %> is null then <% site.upload file prefix=<p> suffix=</p> %> %>
|
||||
<button type="submit" name="submit" value="<% if <% file.self %> is null then start else stop %>">
|
||||
<% if <% file.self %> is null then <% gettext Start %> else <% gettext Stop %> %>
|
||||
|
|
@ -223,7 +223,7 @@ $(function() {
|
|||
<tr>
|
||||
<td class="small" valign="top"><% gettext "Callback URL" suffix=: %></td>
|
||||
<td><% site.input callbackUrl size=40 %><br />
|
||||
<% site.checkbox callbackMode %>
|
||||
<% site.checkbox callbackMode %>
|
||||
<label for="callbackMode"><% gettext enabled %><label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -232,7 +232,7 @@ $(function() {
|
|||
</tr>
|
||||
<tr>
|
||||
<td class='small'><% gettext 'Bookmarklet' %>:</td>
|
||||
<td><a href="javascript: var siteUrl = '<% site.href %>'; var selection = (window.getSelection) ? window.getSelection() : document.selection.createRange(); selection = selection.text || selection; selection = selection + ''; var url='<% site.static %>../www/formica.html?s=' + encodeURIComponent(siteUrl) + '&l=' + encodeURIComponent(location.href) + '&r=' + encodeURIComponent(document.referrer) + '&w=400&h=400&c=' + encodeURIComponent(selection || document.title); window.open(url, 'formica', 'width=630, height=350'); void 0;" title="<% gettext 'Drag to Bookmarks Bar' %>"><% gettext "Post to {0}" <% site.title %> %></a></td>
|
||||
<td><a href="javascript: var siteUrl = '<% site.href %>'; var selection = (window.getSelection) ? window.getSelection() : document.selection.createRange(); selection = selection.text || selection; selection = selection + ''; var url='<% site.static %>../www/formica.html?s=' + encodeURIComponent(siteUrl) + '&l=' + encodeURIComponent(location.href) + '&r=' + encodeURIComponent(document.referrer) + '&w=400&h=400&c=' + encodeURIComponent(selection || document.title); window.open(url, 'formica', 'width=630, height=350'); void 0;" title="<% gettext 'Drag to Bookmarks Bar' %>"><% gettext "Post to {0}" <% site.title %> %></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><div class="listSeparator"> </div>
|
||||
|
|
@ -241,8 +241,8 @@ $(function() {
|
|||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="small" valign="top"><% gettext "Enter one filter {0}pattern{1} per
|
||||
line to be applied on every URL in the referrer and backlink lists."
|
||||
<td class="small" valign="top"><% gettext "Enter one filter {0}pattern{1} per
|
||||
line to be applied on every URL in the referrer and backlink lists."
|
||||
'<a href="http://en.wikipedia.org/wiki/Regular_expression">' </a> %></td>
|
||||
<td valign="top"><% site.textarea spamfilter cols="30" rows="7" %></td>
|
||||
</tr>
|
||||
|
|
@ -258,8 +258,8 @@ line to be applied on every URL in the referrer and backlink lists."
|
|||
<% #notify_block %>
|
||||
<% gettext 'Hello {0}.' <% membership.name %> %>
|
||||
|
||||
<% gettext 'The site {0} at {1} will be blocked in {2} because it is being
|
||||
restricted for too long.' <% site.title %> <%site.href %>
|
||||
<% gettext 'The site {0} at {1} will be blocked in {2} because it is being
|
||||
restricted for too long.' <% site.title %> <%site.href %>
|
||||
<% ngettext '{0} day' '{0} days' <% root.phaseOutGracePeriod %> %> %>
|
||||
|
||||
<% gettext "Best regards." %>
|
||||
|
|
@ -268,8 +268,8 @@ line to be applied on every URL in the referrer and backlink lists."
|
|||
<% #notify_delete %>
|
||||
<% gettext 'Hello {0}.' <% membership.name %> %>
|
||||
|
||||
<% gettext 'The site {0} at {1} will be deleted in {2} because it has been
|
||||
considered as abandoned.' <% site.title %> <% site.href %>
|
||||
<% gettext 'The site {0} at {1} will be deleted in {2} because it has been
|
||||
considered as abandoned.' <% site.title %> <% site.href %>
|
||||
<% ngettext '{0} day' '{0} days' <% root.phaseOutGracePeriod %> %> %>
|
||||
|
||||
<% gettext "Best regards." %>
|
||||
|
|
|
|||
|
|
@ -55,51 +55,51 @@ this.handleMetadata("title");
|
|||
* @returns {String[]}
|
||||
* @see defineConstants
|
||||
*/
|
||||
Site.getStatus = defineConstants(Site, markgettext("Blocked"),
|
||||
Site.getStatus = defineConstants(Site, markgettext("Blocked"),
|
||||
markgettext("Regular"), markgettext("Trusted"));
|
||||
/**
|
||||
* @function
|
||||
* @returns {String[]}
|
||||
* @see defineConstants
|
||||
*/
|
||||
Site.getModes = defineConstants(Site, markgettext("Deleted"),
|
||||
markgettext("Closed"), markgettext("Restricted"),
|
||||
Site.getModes = defineConstants(Site, markgettext("Deleted"),
|
||||
markgettext("Closed"), markgettext("Restricted"),
|
||||
markgettext("Public"), markgettext("Open"));
|
||||
/**
|
||||
* @function
|
||||
* @returns {String[]}
|
||||
* @see defineConstants
|
||||
*/
|
||||
Site.getPageModes = defineConstants(Site, markgettext("days") /* ,
|
||||
Site.getPageModes = defineConstants(Site, markgettext("days") /* ,
|
||||
markgettext("stories") */ );
|
||||
/**
|
||||
* @function
|
||||
* @returns {String[]}
|
||||
* @see defineConstants
|
||||
*/
|
||||
Site.getCommentModes = defineConstants(Site, markgettext("disabled"),
|
||||
Site.getCommentModes = defineConstants(Site, markgettext("disabled"),
|
||||
markgettext("enabled"));
|
||||
/**
|
||||
* @function
|
||||
* @returns {String[]}
|
||||
* @see defineConstants
|
||||
*/
|
||||
Site.getArchiveModes = defineConstants(Site, markgettext("closed"),
|
||||
Site.getArchiveModes = defineConstants(Site, markgettext("closed"),
|
||||
markgettext("public"));
|
||||
/**
|
||||
* @function
|
||||
* @returns {String[]}
|
||||
* @see defineConstants
|
||||
*/
|
||||
Site.getNotificationModes = defineConstants(Site, markgettext("Nobody"),
|
||||
markgettext("Owner"), markgettext("Manager"), markgettext("Contributor"),
|
||||
Site.getNotificationModes = defineConstants(Site, markgettext("Nobody"),
|
||||
markgettext("Owner"), markgettext("Manager"), markgettext("Contributor"),
|
||||
markgettext("Subscriber"));
|
||||
/**
|
||||
* @function
|
||||
* @returns {String[]}
|
||||
* @see defineConstants
|
||||
*/
|
||||
Site.getCallbackModes = defineConstants(Site, markgettext("disabled"),
|
||||
Site.getCallbackModes = defineConstants(Site, markgettext("disabled"),
|
||||
markgettext("enabled"));
|
||||
|
||||
/**
|
||||
|
|
@ -121,7 +121,7 @@ Site.add = function(data, user) {
|
|||
if (data.name.length > 30) {
|
||||
throw Error(gettext("The chosen name is too long. Please enter a shorter one."));
|
||||
}
|
||||
|
||||
|
||||
var name = stripTags(decodeURIComponent(data.name));
|
||||
if (name !== data.name || /[^\u00a0-\uffff\w\-]/.test(data.name)) {
|
||||
// We check if name can be used in vhost environment by allowing all Unicode characters
|
||||
|
|
@ -153,7 +153,7 @@ Site.add = function(data, user) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Site} site
|
||||
*/
|
||||
Site.remove = function() {
|
||||
|
|
@ -182,7 +182,7 @@ Site.remove = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {Site}
|
||||
*/
|
||||
|
|
@ -191,7 +191,7 @@ Site.getByName = function(name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} mode
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
|
@ -210,7 +210,7 @@ Site.require = function(mode) {
|
|||
* @property {String} commentMode The way comments of a site are displayed
|
||||
* @property {Date} created The date and time of site creation
|
||||
* @property {User} creator A reference to a user who created a site
|
||||
* @property {Date} deleted
|
||||
* @property {Date} deleted
|
||||
* @property {String} export_id
|
||||
* @property {Files} files
|
||||
* @property {Tags} galleries
|
||||
|
|
@ -225,7 +225,7 @@ Site.require = function(mode) {
|
|||
* @property {Date} modified The date and time when a site was last modified
|
||||
* @property {User} modifier A reference to a user who modified a site
|
||||
* @property {String} notificationMode The way notifications are sent from a site
|
||||
* @property {Date} notified The date and time of the last notification sent to
|
||||
* @property {Date} notified The date and time of the last notification sent to
|
||||
* the owners of a site
|
||||
* @property {String} pageMode The way stories of a site are displayed
|
||||
* @property {Number} pageSize The amount of stories to be displayed simultaneously
|
||||
|
|
@ -243,7 +243,7 @@ Site.prototype.constructor = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} action
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
|
@ -267,7 +267,7 @@ Site.prototype.getPermission = function(action) {
|
|||
case "search":
|
||||
case "stories.xml":
|
||||
return Site.require(Site.PUBLIC) ||
|
||||
(Site.require(Site.RESTRICTED) &&
|
||||
(Site.require(Site.RESTRICTED) &&
|
||||
Membership.require(Membership.CONTRIBUTOR)) ||
|
||||
((Site.require(Site.DELETED) || Site.require(Site.CLOSED)) &&
|
||||
Membership.require(Membership.OWNER)) ||
|
||||
|
|
@ -298,7 +298,7 @@ Site.prototype.getPermission = function(action) {
|
|||
}
|
||||
|
||||
Site.prototype.main_action = function() {
|
||||
res.data.body = this.renderSkinAsString(this.mode === Site.DELETED ?
|
||||
res.data.body = this.renderSkinAsString(this.mode === Site.DELETED ?
|
||||
"$Site#deleted" : "Site#main");
|
||||
res.data.title = this.getTitle();
|
||||
this.renderSkin("Site#page");
|
||||
|
|
@ -326,7 +326,7 @@ Site.prototype.edit_action = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {Object}
|
||||
*/
|
||||
|
|
@ -343,7 +343,7 @@ Site.prototype.getFormOptions = function(name) {
|
|||
case "mode":
|
||||
return Site.getModes();
|
||||
case "notificationMode":
|
||||
return Site.getNotificationModes();
|
||||
return Site.getNotificationModes();
|
||||
case "pageMode":
|
||||
return Site.getPageModes();
|
||||
case "status":
|
||||
|
|
@ -358,7 +358,7 @@ Site.prototype.getFormOptions = function(name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} data
|
||||
*/
|
||||
Site.prototype.update = function(data) {
|
||||
|
|
@ -440,7 +440,7 @@ Site.prototype.user_js_action = function() {
|
|||
res.dependsOn((new Skin("Site", "javascript")).getStaticFile().lastModified());
|
||||
res.digest();
|
||||
this.renderSkin("Site#javascript");
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
Site.prototype.backup_js_action = function() {
|
||||
|
|
@ -484,17 +484,17 @@ Site.prototype.comments_xml_action = function() {
|
|||
Site.prototype.search_xml_action = function() {
|
||||
res.contentType = "application/opensearchdescription+xml";
|
||||
this.renderSkin("$Site#opensearchdescription");
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Story[]} collection
|
||||
*/
|
||||
Site.prototype.getXml = function(collection) {
|
||||
collection || (collection = this.stories.recent);
|
||||
var now = new Date;
|
||||
var feed = new rome.SyndFeedImpl();
|
||||
var feed = new rome.SyndFeedImpl();
|
||||
feed.setFeedType("rss_2.0");
|
||||
feed.setLink(this.href());
|
||||
feed.setTitle(this.title);
|
||||
|
|
@ -520,7 +520,7 @@ Site.prototype.getXml = function(collection) {
|
|||
var entries = new java.util.ArrayList();
|
||||
var description;
|
||||
|
||||
var list = collection.constructor === Array ?
|
||||
var list = collection.constructor === Array ?
|
||||
collection : collection.list(0, 25);
|
||||
for each (var item in list) {
|
||||
entry = new rome.SyndEntryImpl();
|
||||
|
|
@ -531,14 +531,14 @@ Site.prototype.getXml = function(collection) {
|
|||
if (item.text) {
|
||||
description = new rome.SyndContentImpl();
|
||||
//description.setType("text/plain");
|
||||
// FIXME: Work-around for org.jdom.IllegalDataException caused by some ASCII control characters
|
||||
// FIXME: Work-around for org.jdom.IllegalDataException caused by some ASCII control characters
|
||||
description.setValue(item.renderSkinAsString("Story#rss").replace(/[\x00-\x1f^\x0a^\x0d]/g, function(c) {
|
||||
return "&#" + c.charCodeAt(0) + ";";
|
||||
}));
|
||||
entry.setDescription(description);
|
||||
}
|
||||
entries.add(entry);
|
||||
|
||||
|
||||
/*
|
||||
entryInfo = new rome.EntryInformationImpl();
|
||||
entryModules = new java.util.ArrayList();
|
||||
|
|
@ -563,14 +563,14 @@ Site.prototype.getXml = function(collection) {
|
|||
*/
|
||||
}
|
||||
feed.setEntries(entries);
|
||||
|
||||
|
||||
var output = new rome.SyndFeedOutput();
|
||||
//output.output(feed, res.servletResponse.writer); return;
|
||||
var xml = output.outputString(feed);
|
||||
// FIXME: Ugly hack for adding PubSubHubbub and rssCloud elements to XML
|
||||
xml = xml.replace("<rss", '<rss xmlns:atom="http://www.w3.org/2005/Atom"');
|
||||
xml = xml.replace("<channel>", '<channel>\n <cloud domain="rpc.rsscloud.org" port="5337" path="/rsscloud/pleaseNotify" registerProcedure="" protocol="http-post" />');
|
||||
xml = xml.replace("<channel>", '<channel>\n <atom:link rel="hub" href="' + getProperty("parss.hub") + '"/>');
|
||||
xml = xml.replace("<channel>", '<channel>\n <atom:link rel="hub" href="' + getProperty("parss.hub") + '"/>');
|
||||
return xml; //injectXslDeclaration(xml);
|
||||
}
|
||||
|
||||
|
|
@ -614,7 +614,7 @@ Site.prototype.search_action = function() {
|
|||
var counter = 0;
|
||||
sql.traverse(function() {
|
||||
var content = Story.getById(this.id);
|
||||
if (!content.story || (content.story.status !== Story.CLOSED &&
|
||||
if (!content.story || (content.story.status !== Story.CLOSED &&
|
||||
content.story.commentMode !== Story.CLOSED)) {
|
||||
content.renderSkin("Story#result");
|
||||
counter += 1;
|
||||
|
|
@ -623,7 +623,7 @@ Site.prototype.search_action = function() {
|
|||
res.message = ngettext("Found {0} result.", "Found {0} results.", counter);
|
||||
res.data.body = res.pop();
|
||||
}
|
||||
|
||||
|
||||
res.data.title = gettext('Search results');
|
||||
this.renderSkin("Site#page");
|
||||
return;
|
||||
|
|
@ -632,7 +632,7 @@ Site.prototype.search_action = function() {
|
|||
Site.prototype.subscribe_action = function() {
|
||||
try {
|
||||
Membership.add(session.user, Membership.SUBSCRIBER, this);
|
||||
res.message = gettext('Successfully subscribed to site {0}.',
|
||||
res.message = gettext('Successfully subscribed to site {0}.',
|
||||
this.title);
|
||||
} catch (ex) {
|
||||
app.log(ex);
|
||||
|
|
@ -675,7 +675,7 @@ Site.prototype.export_action = function() {
|
|||
res.message = gettext("Site is scheduled for export.");
|
||||
} else {
|
||||
if (job.method !== "export") {
|
||||
throw Error(gettext("There is already another job queued for this site: {0}",
|
||||
throw Error(gettext("There is already another job queued for this site: {0}",
|
||||
job.method));
|
||||
}
|
||||
}
|
||||
|
|
@ -691,7 +691,7 @@ Site.prototype.export_action = function() {
|
|||
}
|
||||
|
||||
var param = {
|
||||
status: (job && job.method === "export") ?
|
||||
status: (job && job.method === "export") ?
|
||||
gettext("A Blogger export file (.xml) will be created and available for download from here within 24 hours.") :
|
||||
null
|
||||
}
|
||||
|
|
@ -713,7 +713,7 @@ Site.prototype.import_action = function() {
|
|||
job.remove();
|
||||
this.job = null;
|
||||
} else if (job.method) {
|
||||
throw Error(gettext("There is already another job queued for this site: {0}",
|
||||
throw Error(gettext("There is already another job queued for this site: {0}",
|
||||
job.method));
|
||||
}
|
||||
}
|
||||
|
|
@ -753,7 +753,7 @@ Site.prototype.robots_txt_action = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {HopObject}
|
||||
*/
|
||||
|
|
@ -775,7 +775,7 @@ Site.prototype.getMacroHandler = function(name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Site.prototype.stories_macro = function() {
|
||||
if (this.stories.featured.size() < 1) {
|
||||
|
|
@ -795,7 +795,7 @@ Site.prototype.stories_macro = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
*/
|
||||
Site.prototype.calendar_macro = function(param) {
|
||||
|
|
@ -812,7 +812,7 @@ Site.prototype.calendar_macro = function(param) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
*/
|
||||
Site.prototype.age_macro = function(param) {
|
||||
|
|
@ -821,7 +821,7 @@ Site.prototype.age_macro = function(param) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} name
|
||||
*/
|
||||
|
|
@ -830,15 +830,15 @@ Site.prototype.static_macro = function(param, name, mode) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Site.prototype.deleted_macro = function() {
|
||||
return new Date(this.deleted.getTime() + Date.ONEDAY *
|
||||
return new Date(this.deleted.getTime() + Date.ONEDAY *
|
||||
Admin.SITEREMOVALGRACEPERIOD);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Site.prototype.referrers_macro = function() {
|
||||
var self = this;
|
||||
|
|
@ -855,7 +855,7 @@ Site.prototype.referrers_macro = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Site.prototype.spamfilter_macro = function() {
|
||||
var str = this.getMetadata("spamfilter");
|
||||
|
|
@ -875,7 +875,7 @@ Site.prototype.spamfilter_macro = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Site.prototype.diskspace_macro = function() {
|
||||
var quota = this.getQuota();
|
||||
|
|
@ -894,7 +894,7 @@ Site.prototype.getLocale = function() {
|
|||
return locale;
|
||||
} else if (this.locale) {
|
||||
var parts = this.locale.split("_");
|
||||
locale = new java.util.Locale(parts[0] || String.EMPTY,
|
||||
locale = new java.util.Locale(parts[0] || String.EMPTY,
|
||||
parts[1] || String.EMPTY, parts.splice(2).join("_"));
|
||||
} else {
|
||||
locale = java.util.Locale.getDefault();
|
||||
|
|
@ -927,8 +927,8 @@ Site.prototype.getQuota = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {Number} quota
|
||||
* @returns {float}
|
||||
* @param {Number} quota
|
||||
* @returns {float}
|
||||
*/
|
||||
Site.prototype.getDiskSpace = function(quota) {
|
||||
quota || (quota = this.getQuota());
|
||||
|
|
@ -939,11 +939,11 @@ Site.prototype.getDiskSpace = function(quota) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} href
|
||||
*/
|
||||
Site.prototype.processHref = function(href) {
|
||||
var parts, domain,
|
||||
var parts, domain,
|
||||
scheme = (req.servletRequest ? req.servletRequest.scheme : 'http') + '://';
|
||||
if (domain = getProperty('domain.' + this.name)) {
|
||||
parts = [scheme, domain, href];
|
||||
|
|
@ -958,7 +958,7 @@ Site.prototype.processHref = function(href) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} type
|
||||
* @param {String} group
|
||||
* @returns {Tag[]}
|
||||
|
|
@ -980,7 +980,7 @@ Site.prototype.getTags = function(type, group) {
|
|||
}
|
||||
switch (group) {
|
||||
case Tags.ALL:
|
||||
return handler[type];
|
||||
return handler[type];
|
||||
case Tags.OTHER:
|
||||
case Tags.ALPHABETICAL:
|
||||
return handler[group + type.titleize()];
|
||||
|
|
@ -991,7 +991,7 @@ Site.prototype.getTags = function(type, group) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} tail
|
||||
* @returns {helma.File}
|
||||
*/
|
||||
|
|
@ -1002,7 +1002,7 @@ Site.prototype.getStaticFile = function(tail) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} tail
|
||||
* @returns {String}
|
||||
*/
|
||||
|
|
@ -1016,7 +1016,7 @@ Site.prototype.getStaticUrl = function(href) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} ref
|
||||
*/
|
||||
Site.prototype.callback = function(ref) {
|
||||
|
|
@ -1031,7 +1031,7 @@ Site.prototype.callback = function(ref) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {String[]}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ name
|
|||
mode
|
||||
status
|
||||
created
|
||||
modified
|
||||
modified
|
||||
|
||||
metadata = collection(Metadata)
|
||||
metadata.local.1 = $id
|
||||
|
|
@ -85,4 +85,4 @@ entries.filter = context_type = 'Site'
|
|||
##referrers.group = referrer
|
||||
#referrers.limit = 100
|
||||
#referrers.filter = action = 'main' and context_type = 'Site' and created > \
|
||||
# date_add(now(), interval -1 day)
|
||||
# date_add(now(), interval -1 day)
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
<% site.stories %>
|
||||
|
||||
<% #preview %>
|
||||
<li><% site.title | site.link %> <span class="small">(<% site.modified short
|
||||
<li><% site.title | site.link %> <span class="small">(<% site.modified short
|
||||
prefix="Last update: " default="None so far" %>)</span></li>
|
||||
|
||||
<% #welcome %>
|
||||
<p class="storyTitle"><% gettext "Welcome to {0}." <% site.title %> %></p>
|
||||
<p><% gettext "This site was created by {0} on {1}." <% site.creator link %>
|
||||
<p><% gettext "This site was created by {0} on {1}." <% site.creator link %>
|
||||
<% site.created long %> %></p>
|
||||
|
||||
<% #navigation %>
|
||||
|
|
@ -36,9 +36,9 @@ prefix="Last update: " default="None so far" %>)</span></li>
|
|||
|
||||
<% #search %>
|
||||
<form class="nowrap" method="post" action="<% site.href search %>">
|
||||
<input type="text" size="15" name="q" class="searchbox"
|
||||
<input type="text" size="15" name="q" class="searchbox"
|
||||
value="<% request.q encoding="form" %>" />
|
||||
<button type="submit" name="search" value="1"
|
||||
<button type="submit" name="search" value="1"
|
||||
class="searchbox"><% gettext Find %></button>
|
||||
</form>
|
||||
|
||||
|
|
@ -86,29 +86,29 @@ prefix="Last update: " default="None so far" %>)</span></li>
|
|||
<% response.body %>
|
||||
</td>
|
||||
<td class="right">
|
||||
<div class="box"><% ngettext "Online for {0} day"
|
||||
<div class="box"><% ngettext "Online for {0} day"
|
||||
"Online for {0} days" <% site.age %> %><br />
|
||||
<% gettext "Last modified: {0}" <% site.modified short %> %></div>
|
||||
|
||||
|
||||
<div class="boxheader"><% gettext Status %></div>
|
||||
<div class="box"><% membership.status %></div>
|
||||
|
||||
<% root.admin.skin $Admin#navigation %>
|
||||
|
||||
|
||||
<div class="boxheader"><% gettext "Main Menu" %></div>
|
||||
<div class="box">
|
||||
<% site.skin Site#navigation %>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="boxheader"><% gettext Search %></div>
|
||||
<div class="box"><% site.skin Site#search %></div>
|
||||
|
||||
<% site.calendar prefix=<% gettext Calendar prefix='<div class="boxheader">'
|
||||
|
||||
<% site.calendar prefix=<% gettext Calendar prefix='<div class="boxheader">'
|
||||
suffix='</div><div class="box">' %> suffix="</div>" %>
|
||||
|
||||
|
||||
<div class="boxheader"><% gettext "Comments" %></div>
|
||||
<div class="box"><% list comments skin=Story#history %></div>
|
||||
|
||||
|
||||
<div class="boxline"></div><br />
|
||||
<div class="box"><% image /rss.png | site.link rss.xml %><br />
|
||||
<br />
|
||||
|
|
@ -130,8 +130,8 @@ function openPopup(img, width, height) {
|
|||
height = Math.min(height + 30, 480);
|
||||
if (imgWindow.location && !imgWindow.closed)
|
||||
imgWindow.close();
|
||||
imgWindow = window.open(img, "imgWindow" + width + height,
|
||||
"toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,width=" +
|
||||
imgWindow = window.open(img, "imgWindow" + width + height,
|
||||
"toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,width=" +
|
||||
width + ",height=" + height);
|
||||
// imgWindow.focus();
|
||||
}
|
||||
|
|
@ -182,16 +182,16 @@ td.header {
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
td.center {
|
||||
width: 70%;
|
||||
padding: 25px 20px 10px 40px;
|
||||
vertical-align: top;
|
||||
td.center {
|
||||
width: 70%;
|
||||
padding: 25px 20px 10px 40px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
td.right {
|
||||
width: 30%;
|
||||
padding: 0px 0px 10px 0px;
|
||||
vertical-align: top;
|
||||
td.right {
|
||||
width: 30%;
|
||||
padding: 0px 0px 10px 0px;
|
||||
vertical-align: top;
|
||||
border-left: 1px solid #dddddd;
|
||||
}
|
||||
|
||||
|
|
@ -229,8 +229,8 @@ small, .small {
|
|||
|
||||
/* this is for mozilla to right-align tables in boxes */
|
||||
div.box table {
|
||||
margin-left: auto;
|
||||
margin-right: 0px;
|
||||
margin-left: auto;
|
||||
margin-right: 0px;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
|
|
@ -277,7 +277,7 @@ a:hover {text-decoration: underline;}
|
|||
font-size: <% value "small font size" %>;
|
||||
padding-bottom: 0.3em;
|
||||
width: 202px;
|
||||
overflow: hidden;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.dayHeader {
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
<% response.message prefix='<div class="message">' suffix="</div>" %>
|
||||
<form method="post" action="<% response.action %>">
|
||||
<p class="small">
|
||||
<% if <% skin.name %> is "" then
|
||||
<% if <% skin.name %> is "" then
|
||||
<% skin.select prototype prefix=<% gettext Prototype suffix=": " %>
|
||||
suffix=<% skin.input name prefix=<% gettext Name suffix=": " %> %> %>
|
||||
else
|
||||
else
|
||||
<%// skin.summary prefix='<p class="small">' suffix='</p>' %>
|
||||
%>
|
||||
</p>
|
||||
|
|
@ -60,14 +60,14 @@ $(function() {
|
|||
<div class="listSeparator"> </div>
|
||||
<table cellspacing="0" cellpadding="0" width="100%">
|
||||
<tr>
|
||||
<% if <% skin.source %> is null then
|
||||
<% if <% skin.source %> is null then
|
||||
<% listItemFlag <% gettext custom %> %>
|
||||
%>
|
||||
<td class="small">
|
||||
<div class="ample"><strong><% gettext Macro suffix=: %></strong>
|
||||
<span class='macro-code'><%
|
||||
<% if <% skin.prototype %> is Global then
|
||||
<% skin.name prefix="skin " %> else
|
||||
<div class="ample"><strong><% gettext Macro suffix=: %></strong>
|
||||
<span class='macro-code'><%
|
||||
<% if <% skin.prototype %> is Global then
|
||||
<% skin.name prefix="skin " %> else
|
||||
<% skin.name prefix=<% skin.prototype suffix=".skin " | lowercase %> %> %> %></span></div>
|
||||
</td>
|
||||
<td rowspan="2" width="10" nowrap="nowrap"> </td>
|
||||
|
|
@ -80,7 +80,7 @@ $(function() {
|
|||
<tr valign="top">
|
||||
<td>
|
||||
<div class="storyTitle"><% skin.name prefix=<% skin.prototype suffix="." %> %></div>
|
||||
<div class="storyDate"><% gettext "{0} on {1}" <% skin.creator link %>
|
||||
<div class="storyDate"><% gettext "{0} on {1}" <% skin.creator link %>
|
||||
<% skin.created short %> %></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ markgettext("Skin");
|
|||
markgettext("skin");
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} group
|
||||
* @param {String} name
|
||||
* @returns {Skin}
|
||||
|
|
@ -40,7 +40,7 @@ Skin.getByName = function(group, name) {
|
|||
var skin = skinSet.get(name);
|
||||
if (skin) {
|
||||
return skin;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ Skin.add = function(prototype, name, layout) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Skin} skin
|
||||
*/
|
||||
Skin.remove = function() {
|
||||
|
|
@ -112,7 +112,7 @@ Skin.prototype.constructor = function(prototype, name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} action
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
|
@ -126,7 +126,7 @@ Skin.prototype.getPermission = function(action) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} action
|
||||
* @returns {String}
|
||||
*/
|
||||
|
|
@ -175,7 +175,7 @@ Skin.prototype.edit_action = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} data
|
||||
*/
|
||||
Skin.prototype.update = function(data) {
|
||||
|
|
@ -190,7 +190,7 @@ Skin.prototype.update = function(data) {
|
|||
throw Error(gettext("The {0} macro is missing. It is essential for accessing the site and must be present in this skin.", macro));
|
||||
}
|
||||
}
|
||||
this.setSource(data.source);
|
||||
this.setSource(data.source);
|
||||
this.touch();
|
||||
return;
|
||||
}
|
||||
|
|
@ -280,7 +280,7 @@ Skin.prototype.getTitle = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @return {Object}
|
||||
*/
|
||||
|
|
@ -345,7 +345,7 @@ Skin.prototype.setSource = function(source) {
|
|||
}
|
||||
source = res.pop();
|
||||
|
||||
var file = this.getStaticFile();
|
||||
var file = this.getStaticFile();
|
||||
if (!file.exists()) {
|
||||
file.getParentFile().mkdirs();
|
||||
file.createNewFile();
|
||||
|
|
@ -363,7 +363,7 @@ Skin.prototype.setSource = function(source) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @returns {java.io.File}
|
||||
*/
|
||||
Skin.prototype.getStaticFile = function() {
|
||||
|
|
@ -373,7 +373,7 @@ Skin.prototype.getStaticFile = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {String} prototype
|
||||
* @param {String} prototype
|
||||
* @returns {Skin}
|
||||
*/
|
||||
Skin.prototype.getMainSkin = function(prototype) {
|
||||
|
|
@ -402,14 +402,14 @@ Skin.prototype.getSubskin = function(prototype, name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Skin.prototype.render = function() {
|
||||
return renderSkin(createSkin(this.getSource()));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} source
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
|
@ -426,7 +426,7 @@ Skin.prototype.equals = function(source) {
|
|||
* @returns {String}
|
||||
*/
|
||||
Skin.prototype.getConfirmText = function() {
|
||||
return gettext("You are about to reset the skin {0}.{1}.",
|
||||
return gettext("You are about to reset the skin {0}.{1}.",
|
||||
this.prototype, this.name);
|
||||
}
|
||||
|
||||
|
|
@ -438,14 +438,14 @@ Skin.prototype.toString = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Skin.prototype.status_macro = function() {
|
||||
return this.isTransient() ? "inherited" : "modified";
|
||||
return this.isTransient() ? "inherited" : "modified";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Skin.prototype.content_macro = function() {
|
||||
return res.write(this.getSource());
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ body {
|
|||
</div>
|
||||
<div>...
|
||||
<% skins.link main <% gettext Basic %> %>
|
||||
<% skins.link modified <% gettext Modified %> prefix=" | " %>
|
||||
<% skins.link modified <% gettext Modified %> prefix=" | " %>
|
||||
<% skins.link all <% gettext All %> prefix=" | " %>
|
||||
</div>
|
||||
|
||||
|
|
@ -89,28 +89,28 @@ body {
|
|||
<br />
|
||||
<div class="ample">
|
||||
<% skins.link Site/page/edit <% gettext "Site Page" %> %>
|
||||
<div class="small"><% gettext "This skin defines the basic structure of your
|
||||
<div class="small"><% gettext "This skin defines the basic structure of your
|
||||
site. Modifying it will affect the general appearance of your site." %></div>
|
||||
</div>
|
||||
<div class="ample">
|
||||
<% skins.link Site/navigation/edit <% gettext Navigation %> %>
|
||||
<div class="small"><% gettext "This skin is used to display the navigation
|
||||
<div class="small"><% gettext "This skin is used to display the navigation
|
||||
links on the page." %></div>
|
||||
</div>
|
||||
<div class="ample">
|
||||
<% skins.link Site/main/edit <% gettext Frontpage %> %>
|
||||
<div class="small"><% gettext "This skin is used to render the front page of
|
||||
<div class="small"><% gettext "This skin is used to render the front page of
|
||||
your site." %></div>
|
||||
</div>
|
||||
<div class="ample">
|
||||
<% skins.link Site/stylesheet/edit <% gettext "CSS Stylesheet" %> %>
|
||||
<div class="small"><% gettext "This skin contains the Cascading Stylesheet
|
||||
(CSS) definitions, e.g. fonts, font sizes, colors etc. Modifying this skin
|
||||
<div class="small"><% gettext "This skin contains the Cascading Stylesheet
|
||||
(CSS) definitions, e.g. fonts, font sizes, colors etc. Modifying this skin
|
||||
will affect the general appearance of your site." %></div>
|
||||
</div>
|
||||
<div class="ample">
|
||||
<% skins.link Site/javascript/edit <% gettext JavaScript %> %>
|
||||
<div class="small"><% gettext "This skin contains additional JavaScript code
|
||||
<div class="small"><% gettext "This skin contains additional JavaScript code
|
||||
that will be included in every page." %></div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -43,13 +43,13 @@ markgettext("skins");
|
|||
* @extends HopObject
|
||||
*/
|
||||
Skins.prototype.constructor = function(name, parent) {
|
||||
this.name = name;
|
||||
this.name = name;
|
||||
this.parent = parent;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} action
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
|
@ -58,7 +58,7 @@ Skins.prototype.getPermission = function(action) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {Skins|Skin}
|
||||
*/
|
||||
|
|
@ -70,7 +70,7 @@ Skins.prototype.getChildElement = function(name) {
|
|||
return skin;
|
||||
}
|
||||
if (global[group] || group === "Global") {
|
||||
return this.getSkin(group, name);
|
||||
return this.getSkin(group, name);
|
||||
}
|
||||
}
|
||||
return new Skins(name, this);
|
||||
|
|
@ -159,7 +159,7 @@ Skins.prototype.safe_action = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} group
|
||||
* @param {String} name
|
||||
* @returns {Skin}
|
||||
|
|
@ -169,7 +169,7 @@ Skins.prototype.getSkin = function(group, name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @returns {String}
|
||||
*/
|
||||
Skins.prototype.getOutline = function() {
|
||||
|
|
@ -202,7 +202,7 @@ Skins.prototype.getOutline = function() {
|
|||
for each (var name in skin) {
|
||||
subskin = this.getSkin(prototype, name);
|
||||
html.openTag("li");
|
||||
html.link({href: subskin.href("edit")},
|
||||
html.link({href: subskin.href("edit")},
|
||||
subskin.prototype + "." + subskin.name);
|
||||
html.closeTag("li");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<div class="ample">
|
||||
<% stories.link create <% gettext "Add Story" %> prefix="... " %>
|
||||
</div>
|
||||
...
|
||||
...
|
||||
<% stories.link main <% gettext "By {0}" <% membership.name %> %> %>
|
||||
<% stories.link closed <% gettext Closed %> prefix=" | " %>
|
||||
<% stories.link all <% gettext All %> prefix=" | " %>
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ markgettext("stories");
|
|||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} action
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
|
@ -60,8 +60,8 @@ Stories.prototype.getPermission = function(action) {
|
|||
case "main":
|
||||
case "create":
|
||||
return Site.require(Site.OPEN) && session.user ||
|
||||
Membership.require(Membership.CONTRIBUTOR) ||
|
||||
User.require(User.PRIVILEGED);
|
||||
Membership.require(Membership.CONTRIBUTOR) ||
|
||||
User.require(User.PRIVILEGED);
|
||||
|
||||
case "all":
|
||||
case "top":
|
||||
|
|
@ -74,9 +74,9 @@ Stories.prototype.getPermission = function(action) {
|
|||
|
||||
Stories.prototype.main_action = function() {
|
||||
var stories = User.getMembership().stories;
|
||||
res.data.list = renderList(stories, "$Story#listItem",
|
||||
res.data.list = renderList(stories, "$Story#listItem",
|
||||
10, req.queryParams.page);
|
||||
res.data.pager = renderPager(stories,
|
||||
res.data.pager = renderPager(stories,
|
||||
this.href(), 10, req.queryParams.page);
|
||||
res.data.title = gettext("Member Stories");
|
||||
res.data.body = this.renderSkinAsString("$Stories#main");
|
||||
|
|
@ -100,7 +100,7 @@ Stories.prototype.create_action = function() {
|
|||
app.log(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
res.data.title = gettext("Add Story");
|
||||
res.data.action = this.href(req.action);
|
||||
HopObject.confirmConstructor(Story);
|
||||
|
|
@ -110,9 +110,9 @@ Stories.prototype.create_action = function() {
|
|||
}
|
||||
|
||||
Stories.prototype.closed_action = function() {
|
||||
res.data.list = renderList(this.closed,
|
||||
res.data.list = renderList(this.closed,
|
||||
"$Story#listItem", 10, req.queryParams.page);
|
||||
res.data.pager = renderPager(this.closed,
|
||||
res.data.pager = renderPager(this.closed,
|
||||
this.href(req.action), 10, req.queryParams.page);
|
||||
res.data.title = gettext("Closed Stories");
|
||||
res.data.body = this.renderSkinAsString("$Stories#main");
|
||||
|
|
@ -122,7 +122,7 @@ Stories.prototype.closed_action = function() {
|
|||
|
||||
Stories.prototype.all_action = function() {
|
||||
res.data.list = renderList(this, "$Story#listItem", 10, req.queryParams.page);
|
||||
res.data.pager = renderPager(this,
|
||||
res.data.pager = renderPager(this,
|
||||
this.href(req.action), 10, req.queryParams.page);
|
||||
res.data.title = gettext("All Stories");
|
||||
res.data.body = this.renderSkinAsString("$Stories#main");
|
||||
|
|
@ -138,7 +138,7 @@ Stories.prototype.top_action = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} type
|
||||
*/
|
||||
|
|
@ -151,14 +151,14 @@ Stories.prototype.list_macro = function(param, type) {
|
|||
position: counter
|
||||
});
|
||||
counter += 1;
|
||||
});
|
||||
});
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} group
|
||||
* @returns {Tag[]}
|
||||
* @see Site#getTags
|
||||
|
|
@ -168,7 +168,7 @@ Stories.prototype.getTags = function(group) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {String[]}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -80,14 +80,14 @@ tags.local = id
|
|||
tags.foreign = site_id
|
||||
tags.order = name asc
|
||||
tags.filter = tag.type = 'Story'
|
||||
|
||||
|
||||
alphabeticalTags = collection(Tag)
|
||||
alphabeticalTags.accessName = name
|
||||
alphabeticalTags.local = id
|
||||
alphabeticalTags.foreign = site_id
|
||||
alphabeticalTags.filter = tag.type = 'Story' and \
|
||||
substr(tag.name, 1, 1) >= "A" and \
|
||||
substr(tag.name, 1, 1) <= "Z"
|
||||
substr(tag.name, 1, 1) <= "Z"
|
||||
alphabeticalTags.group = upper(substr(tag.name, 1, 1))
|
||||
alphabeticalTags.group.order = tag.name asc
|
||||
|
||||
|
|
@ -97,6 +97,6 @@ otherTags.local = id
|
|||
otherTags.foreign = site_id
|
||||
otherTags.filter = tag.type = 'Story' and \
|
||||
substr(tag.name, 1, 1) < "A" or \
|
||||
substr(tag.name, 1, 1) > "Z"
|
||||
substr(tag.name, 1, 1) > "Z"
|
||||
otherTags.group = tag.name
|
||||
otherTags.group.order = tag.name asc
|
||||
|
|
|
|||
|
|
@ -11,15 +11,15 @@
|
|||
<div class="listSeparator"> </div>
|
||||
<table cellspacing="0" cellpadding="0" width="100%">
|
||||
<tr>
|
||||
<% if <% story.status %> is closed then
|
||||
<% if <% story.status %> is closed then
|
||||
<% listItemFlag <% gettext closed %> %>
|
||||
else <% if <% story.mode %> is hidden then
|
||||
else <% if <% story.mode %> is hidden then
|
||||
<% listItemFlag <% gettext hidden %> %> %>
|
||||
%>
|
||||
<td class="small">
|
||||
<strong><% gettext Macro suffix=: %></strong> <% story.macro %><br />
|
||||
<div class="ample"><strong><% gettext Status suffix=: %></strong>
|
||||
<% gettext <% story.status %> %><% story.tags link prefix=<% gettext in
|
||||
<% gettext <% story.status %> %><% story.tags link prefix=<% gettext in
|
||||
context=preposition prefix=" " suffix=" " %> %><% story.comments link prefix="; " %></div>
|
||||
</td>
|
||||
<td rowspan="2" width="10" nowrap="nowrap"> </td>
|
||||
|
|
@ -41,7 +41,7 @@ else <% if <% story.mode %> is hidden then
|
|||
</table>
|
||||
|
||||
<% #referrer %>
|
||||
referrers.push(new Antville.Referrer("<% param.referrer %>",
|
||||
referrers.push(new Antville.Referrer("<% param.referrer %>",
|
||||
"<% param.text %>", <% param.requests %>));
|
||||
|
||||
<% #referrers %>
|
||||
|
|
@ -85,9 +85,9 @@ for (var i in referrers) {
|
|||
document.writeln('</tr>');
|
||||
}
|
||||
document.writeln('<tr>');
|
||||
document.writeln('<td align="right" valign="top" class="small">',
|
||||
document.writeln('<td align="right" valign="top" class="small">',
|
||||
ref.count, '</td>');
|
||||
document.writeln('<td class="small"><a href="', ref.url, '">',
|
||||
document.writeln('<td class="small"><a href="', ref.url, '">',
|
||||
text, '</a></td>');
|
||||
document.writeln('</tr>');
|
||||
}
|
||||
|
|
@ -119,7 +119,7 @@ $(function() {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
input.blur(function() {
|
||||
$("#restore").hide();
|
||||
var data = {};
|
||||
|
|
|
|||
|
|
@ -81,22 +81,22 @@ Story.remove = function() {
|
|||
* @returns {String[]}
|
||||
* @see defineConstants
|
||||
*/
|
||||
Story.getStatus = defineConstants(Story, markgettext("closed"),
|
||||
Story.getStatus = defineConstants(Story, markgettext("closed"),
|
||||
markgettext("public"), markgettext("shared"), markgettext("open"));
|
||||
/**
|
||||
* @function
|
||||
* @returns {String[]}
|
||||
* @see defineConstants
|
||||
*/
|
||||
Story.getModes = defineConstants(Story, markgettext("hidden"),
|
||||
Story.getModes = defineConstants(Story, markgettext("hidden"),
|
||||
markgettext("featured"));
|
||||
/**
|
||||
* @function
|
||||
* @returns {String[]}
|
||||
* @see defineConstants
|
||||
*/
|
||||
Story.getCommentModes = defineConstants(Story, markgettext("closed"),
|
||||
/* markgettext("readonly"), markgettext("moderated"), */
|
||||
Story.getCommentModes = defineConstants(Story, markgettext("closed"),
|
||||
/* markgettext("readonly"), markgettext("moderated"), */
|
||||
markgettext("open"));
|
||||
|
||||
/**
|
||||
|
|
@ -129,7 +129,7 @@ Story.prototype.constructor = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} action
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
|
@ -140,25 +140,25 @@ Story.prototype.getPermission = function(action) {
|
|||
switch (action) {
|
||||
case ".":
|
||||
case "main":
|
||||
return this.status !== Story.CLOSED ||
|
||||
this.creator === session.user ||
|
||||
Membership.require(Membership.MANAGER) ||
|
||||
return this.status !== Story.CLOSED ||
|
||||
this.creator === session.user ||
|
||||
Membership.require(Membership.MANAGER) ||
|
||||
User.require(User.PRIVILEGED);
|
||||
case "comment":
|
||||
return this.site.commentMode === Site.ENABLED &&
|
||||
(this.commentMode === Story.OPEN ||
|
||||
this.commentMode === Story.MODERATED);
|
||||
case "delete":
|
||||
return this.creator === session.user ||
|
||||
return this.creator === session.user ||
|
||||
Membership.require(Membership.MANAGER) ||
|
||||
User.require(User.PRIVILEGED);
|
||||
User.require(User.PRIVILEGED);
|
||||
case "edit":
|
||||
case "rotate":
|
||||
return this.creator === session.user ||
|
||||
Membership.require(Membership.MANAGER) ||
|
||||
return this.creator === session.user ||
|
||||
Membership.require(Membership.MANAGER) ||
|
||||
(this.status === Story.SHARED &&
|
||||
Membership.require(Membership.CONTRIBUTOR)) ||
|
||||
(this.status === Story.OPEN &&
|
||||
Membership.require(Membership.CONTRIBUTOR)) ||
|
||||
(this.status === Story.OPEN &&
|
||||
Membership.require(Membership.SUBSCRIBER)) ||
|
||||
User.require(User.PRIVILEGED);
|
||||
}
|
||||
|
|
@ -176,7 +176,7 @@ Story.prototype.main_action = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Number} limit
|
||||
* @returns {String}
|
||||
*/
|
||||
|
|
@ -191,7 +191,7 @@ Story.prototype.getTitle = function(limit) {
|
|||
res.meta[this + ":text:" + limit] = parts.tail;
|
||||
}
|
||||
}
|
||||
return String(res.meta[key]) || "...";
|
||||
return String(res.meta[key]) || "...";
|
||||
}
|
||||
|
||||
Story.prototype.edit_action = function() {
|
||||
|
|
@ -206,7 +206,7 @@ Story.prototype.edit_action = function() {
|
|||
app.log(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
res.data.action = this.href(req.action);
|
||||
res.data.title = gettext('Edit Story');
|
||||
res.data.body = this.renderSkinAsString("Story#edit");
|
||||
|
|
@ -215,12 +215,12 @@ Story.prototype.edit_action = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} data
|
||||
*/
|
||||
Story.prototype.update = function(data) {
|
||||
var site = this.site || res.handlers.site;
|
||||
|
||||
|
||||
if (!data.title && !data.text) {
|
||||
throw Error(gettext("Please enter at least something into the “title” or “text” field."));
|
||||
}
|
||||
|
|
@ -232,7 +232,7 @@ Story.prototype.update = function(data) {
|
|||
app.log(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get difference to current content before applying changes
|
||||
var delta = this.getDelta(data);
|
||||
this.title = data.title ? data.title.trim() : String.EMPTY;
|
||||
|
|
@ -242,7 +242,7 @@ Story.prototype.update = function(data) {
|
|||
this.commentMode = data.commentMode || Story.OPEN;
|
||||
this.setCustomContent(data);
|
||||
|
||||
// FIXME: To be removed resp. moved to Stories.create_action and
|
||||
// FIXME: To be removed resp. moved to Stories.create_action and
|
||||
// Story.edit_action if work-around for Helma bug #607 fails
|
||||
// We need persistence for setting the tags
|
||||
this.isTransient() && this.persist();
|
||||
|
|
@ -256,7 +256,7 @@ Story.prototype.update = function(data) {
|
|||
site.callback(this);
|
||||
// Notification is sent in Stories.create_action()
|
||||
}
|
||||
|
||||
|
||||
this.clearCache();
|
||||
this.modifier = session.user;
|
||||
return;
|
||||
|
|
@ -304,7 +304,7 @@ Story.prototype.comment_action = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {Object}
|
||||
*/
|
||||
|
|
@ -326,7 +326,7 @@ Story.prototype.getFormValue = function(name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {String[]}
|
||||
*/
|
||||
|
|
@ -360,7 +360,7 @@ Story.prototype.setCustomContent = function(data) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
*/
|
||||
Story.prototype.isCustomContent = function(key) {
|
||||
|
|
@ -418,7 +418,7 @@ Story.prototype.getDelta = function(data) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {HopObject}
|
||||
*/
|
||||
|
|
@ -430,7 +430,7 @@ Story.prototype.getMacroHandler = function(name) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} action
|
||||
* @param {String} text
|
||||
|
|
@ -450,7 +450,7 @@ Story.prototype.link_macro = function(param, action, text) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
*/
|
||||
Story.prototype.summary_macro = function(param) {
|
||||
|
|
@ -464,11 +464,11 @@ Story.prototype.summary_macro = function(param) {
|
|||
res.write(content);
|
||||
res.write(String.SPACE);
|
||||
}
|
||||
}
|
||||
}
|
||||
summary = res.pop();
|
||||
}
|
||||
if (!summary) {
|
||||
summary = (this.title || String.EMPTY) + String.SPACE +
|
||||
summary = (this.title || String.EMPTY) + String.SPACE +
|
||||
(this.text || String.EMPTY);
|
||||
}
|
||||
var clipped = stripTags(summary).clip(param.limit, param.clipping, "\\s");
|
||||
|
|
@ -485,13 +485,13 @@ Story.prototype.summary_macro = function(param) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} mode
|
||||
*/
|
||||
Story.prototype.comments_macro = function(param, mode) {
|
||||
var story = this.story || this;
|
||||
if (story.site.commentMode === Site.DISABLED ||
|
||||
if (story.site.commentMode === Site.DISABLED ||
|
||||
story.commentMode === Site.CLOSED) {
|
||||
return;
|
||||
} else if (mode) {
|
||||
|
|
@ -500,7 +500,7 @@ Story.prototype.comments_macro = function(param, mode) {
|
|||
if (mode === "count" || mode === "size") {
|
||||
res.write(text);
|
||||
} else if (mode === "link") {
|
||||
n < 1 ? res.write(text) :
|
||||
n < 1 ? res.write(text) :
|
||||
html.link({href: this.href() + "#comments"}, text);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -508,7 +508,7 @@ Story.prototype.comments_macro = function(param, mode) {
|
|||
this.forEach(function() {
|
||||
html.openTag("a", {name: this._id});
|
||||
html.closeTag("a");
|
||||
this.renderSkin(this.parent.constructor === Story ?
|
||||
this.renderSkin(this.parent.constructor === Story ?
|
||||
"Comment#main" : "Comment#reply");
|
||||
});
|
||||
}
|
||||
|
|
@ -516,7 +516,7 @@ Story.prototype.comments_macro = function(param, mode) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} mode
|
||||
*/
|
||||
|
|
@ -536,12 +536,12 @@ Story.prototype.tags_macro = function(param, mode) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {Number} limit
|
||||
*/
|
||||
Story.prototype.referrers_macro = function(param, limit) {
|
||||
if (!User.require(User.PRIVILEGED) &&
|
||||
if (!User.require(User.PRIVILEGED) &&
|
||||
!Membership.require(Membership.OWNER)) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -569,11 +569,11 @@ Story.prototype.referrers_macro = function(param, limit) {
|
|||
if (param.referrers) {
|
||||
this.renderSkin("$Story#referrers", param);
|
||||
}
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} value
|
||||
* @param {Object} param
|
||||
* @param {String} mode
|
||||
|
|
@ -584,12 +584,12 @@ Story.prototype.format_filter = function(value, param, mode) {
|
|||
switch (mode) {
|
||||
case "plain":
|
||||
return this.url_filter(stripTags(value), param, mode);
|
||||
|
||||
|
||||
case "quotes":
|
||||
return stripTags(value).replace(/(?:\x22|\x27)/g, function(quote) {
|
||||
return "&#" + quote.charCodeAt(0) + ";";
|
||||
});
|
||||
|
||||
|
||||
case "image":
|
||||
var image = HopObject.getFromPath(value, "images");
|
||||
if (image) {
|
||||
|
|
@ -598,7 +598,7 @@ Story.prototype.format_filter = function(value, param, mode) {
|
|||
return res.pop();
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
value = this.macro_filter(format(value), param);
|
||||
return this.url_filter(value, param);
|
||||
|
|
@ -630,7 +630,7 @@ Story.prototype.macro_filter = function(value) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} value
|
||||
* @param {Object} param
|
||||
* @param {String} mode
|
||||
|
|
@ -669,6 +669,6 @@ Story.prototype.url_filter = function(value, param, mode) {
|
|||
* @returns {String}
|
||||
*/
|
||||
Story.prototype.getConfirmText = function() {
|
||||
return gettext("You are about to delete a story by user {0}.",
|
||||
return gettext("You are about to delete a story by user {0}.",
|
||||
this.creator.name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
</p>
|
||||
<p>
|
||||
<div class="small"><% gettext Text suffix=: %></div>
|
||||
<div class="backup"><% story.textarea text cols="30" rows="15"
|
||||
<div class="backup"><% story.textarea text cols="30" rows="15"
|
||||
class="formText" %></div>
|
||||
</p>
|
||||
<p>
|
||||
|
|
@ -33,10 +33,10 @@
|
|||
<p><% gettext "Comments of the story are {0}" <% story.select commentMode %> %></p>
|
||||
</fieldset></p>
|
||||
<p class="small">
|
||||
<% if <% story.creator %> is null then "" else
|
||||
<% gettext "Created by {0} on {1}" <% story.creator %> <% story.created %> %>
|
||||
<% if <% story.creator %> is null then "" else
|
||||
<% gettext "Created by {0} on {1}" <% story.creator %> <% story.created %> %>
|
||||
%>
|
||||
<% if <% story.created %> is <% story.modified %> then "" else
|
||||
<% if <% story.created %> is <% story.modified %> then "" else
|
||||
<% gettext "Last modified by {0} on {1}" <% story.modifier %>
|
||||
<% story.modified %> prefix="<br />" %>
|
||||
%>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<% #main %>
|
||||
<% if <% tag.permission edit %> is true then
|
||||
<% tag.skin $Tag#controls prefix=<div> suffix="</div><br />" %>
|
||||
<% if <% tag.permission edit %> is true then
|
||||
<% tag.skin $Tag#controls prefix=<div> suffix="</div><br />" %>
|
||||
%>
|
||||
|
||||
<div class="pagelink">
|
||||
|
|
@ -26,11 +26,11 @@
|
|||
</tr>
|
||||
|
||||
<% #controls %>
|
||||
... <a href="" onclick='var name;
|
||||
... <a href="" onclick='var name;
|
||||
if (name = prompt("<% gettext 'Please enter new name for this tag' suffix=: %>")) {
|
||||
location.href="<% tag.href action="rename" %>?name=" + name;
|
||||
}'><% gettext "Rename Tag" %></a> |
|
||||
<a href="" onclick='var name;
|
||||
<a href="" onclick='var name;
|
||||
if (confirm("<% gettext 'Are you sure you want to remove the tag {0}?' <% tag.name %> %>")) {
|
||||
location.href="<% tag.href action="delete" %>";
|
||||
}'><% gettext "Delete Tag" %></a>
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ Tag.prototype.constructor = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} action
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
|
@ -92,7 +92,7 @@ Tag.prototype.getPermission = function(action) {
|
|||
case "rename":
|
||||
return User.require(User.PRIVILEGED) ||
|
||||
Membership.require(Membership.MANAGER);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ Tag.prototype.rename_action = function() {
|
|||
tag = Tag.add(name, this.site, this.type);
|
||||
}
|
||||
if (tag !== this) {
|
||||
this.forEach(function() {
|
||||
this.forEach(function() {
|
||||
this.tag_id = tag._id;
|
||||
});
|
||||
this.remove();
|
||||
|
|
@ -139,7 +139,7 @@ Tag.prototype.rename_action = function() {
|
|||
}
|
||||
res.redirect(tag.href());
|
||||
return;
|
||||
|
||||
|
||||
// FIXME: Actually, the method should work like this but it caused a mess:
|
||||
if (req.data.name) {
|
||||
var name = this.getAccessName.call(new HopObject, File.getName(req.data.name));
|
||||
|
|
@ -164,7 +164,7 @@ Tag.prototype.delete_action = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} action
|
||||
* @returns {String}
|
||||
*/
|
||||
|
|
@ -180,7 +180,7 @@ Tag.prototype.href = function(action) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} type
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ TagHub.add = function(name, tagged, user) {
|
|||
hub.tagged = tagged;
|
||||
hub.user = user;
|
||||
tagged.tags.add(hub);
|
||||
return hub;
|
||||
return hub;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -65,7 +65,7 @@ TagHub.prototype.constructor = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {HopObject}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ Tags.ALPHABETICAL = "alphabetical";
|
|||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} action
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
|
@ -73,7 +73,7 @@ Tags.prototype.admin_action = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Number} id
|
||||
* @returns {HopObject}
|
||||
*/
|
||||
|
|
@ -83,7 +83,7 @@ Tags.prototype.getChildElement = function(id) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Tags.prototype.alphabet_macro = function() {
|
||||
if (this.get(Tags.ALL).size() < 50) {
|
||||
|
|
@ -99,7 +99,7 @@ Tags.prototype.alphabet_macro = function() {
|
|||
if (group === id) {
|
||||
res.write(text);
|
||||
} else {
|
||||
html.link({href: self.href(self.getAction()) + prefix + id}, text);
|
||||
html.link({href: self.href(self.getAction()) + prefix + id}, text);
|
||||
}
|
||||
res.write(" ");
|
||||
return;
|
||||
|
|
@ -116,7 +116,7 @@ Tags.prototype.alphabet_macro = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Tags.prototype.pager_macro = function() {
|
||||
var page = this.getPage();
|
||||
|
|
@ -131,7 +131,7 @@ Tags.prototype.pager_macro = function() {
|
|||
if (i == page) {
|
||||
res.write(i);
|
||||
} else {
|
||||
html.link({href: this.href(this.getAction()) + prefix + i}, i);
|
||||
html.link({href: this.href(this.getAction()) + prefix + i}, i);
|
||||
}
|
||||
res.write(" ");
|
||||
}
|
||||
|
|
@ -139,7 +139,7 @@ Tags.prototype.pager_macro = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
*/
|
||||
Tags.prototype.header_macro = function(param) {
|
||||
|
|
@ -151,7 +151,7 @@ Tags.prototype.header_macro = function(param) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
Tags.prototype.list_macro = function(param, skin) {
|
||||
var page = this.getPage();
|
||||
|
|
@ -174,7 +174,7 @@ Tags.prototype.list_macro = function(param, skin) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} group
|
||||
* @returns {TagHub[]}
|
||||
*/
|
||||
|
|
@ -190,7 +190,7 @@ Tags.prototype.getGroup = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} group
|
||||
*/
|
||||
Tags.prototype.setGroup = function(group) {
|
||||
|
|
@ -207,7 +207,7 @@ Tags.prototype.getPage = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Number} page
|
||||
*/
|
||||
Tags.prototype.setPage = function(page) {
|
||||
|
|
|
|||
|
|
@ -1,22 +1,22 @@
|
|||
<% #welcome %>
|
||||
<p><% gettext "The site is currently {0}." <% gettext <% site.mode %> %> %>
|
||||
<% if <% site.mode %> is closed then
|
||||
<% gettext "This means that only you and other {0} of this site have access
|
||||
to it. You can safely start to customize it or to fill it with all the
|
||||
<% if <% site.mode %> is closed then
|
||||
<% gettext "This means that only you and other {0} of this site have access
|
||||
to it. You can safely start to customize it or to fill it with all the
|
||||
content you have in mind." <% site.members.link owners <% gettext owners %> %> %>
|
||||
else <% if <% site.mode %> is restricted then "" else
|
||||
else <% if <% site.mode %> is restricted then "" else
|
||||
<% gettext "Thus, it is publicly accessible for every visitor." %> %>
|
||||
%></p>
|
||||
<p><% gettext 'The easiest way to customize your site is to change its
|
||||
<a href="{0}">preferences</a>. You can change the language and time zone
|
||||
or the main title of your site, open or close it and much more.'
|
||||
<p><% gettext 'The easiest way to customize your site is to change its
|
||||
<a href="{0}">preferences</a>. You can change the language and time zone
|
||||
or the main title of your site, open or close it and much more.'
|
||||
<% site.href edit %> %></p>
|
||||
<p><% gettext 'Of course, you can now also start to create <a href="{0}">stories</a>,
|
||||
upload some <a href="{1}">images</a> or <a href="{2}">files</a>, create
|
||||
your first <a href="{3}">poll</a> or get a glimpse of Antville’s wonderful
|
||||
customization possibilities by having a look at the <a href="{4}">layout
|
||||
section</a> where you can modify the appearance of your site according to
|
||||
your needs.' <% site.stories.href create %> <% site.images.href create %>
|
||||
<p><% gettext 'Of course, you can now also start to create <a href="{0}">stories</a>,
|
||||
upload some <a href="{1}">images</a> or <a href="{2}">files</a>, create
|
||||
your first <a href="{3}">poll</a> or get a glimpse of Antville’s wonderful
|
||||
customization possibilities by having a look at the <a href="{4}">layout
|
||||
section</a> where you can modify the appearance of your site according to
|
||||
your needs.' <% site.stories.href create %> <% site.images.href create %>
|
||||
<% site.files.href create %> <% site.polls.href create %> <% layout.href %> %></p>
|
||||
<p><% gettext "Have a lot of fun!" %></p>
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ else <% if <% site.mode %> is restricted then "" else
|
|||
<p class="storyTitle"><% response.title %></p>
|
||||
<div class="ample">...
|
||||
<% members.link updated <% gettext "Updates" %> %>
|
||||
<% members.link privileges <% gettext Privileges %> prefix="| " %>
|
||||
<% members.link privileges <% gettext Privileges %> prefix="| " %>
|
||||
<% members.link subscriptions <% gettext Subscriptions %> prefix="| " %>
|
||||
</div>
|
||||
<p><% response.list %></p>
|
||||
|
|
@ -47,7 +47,7 @@ $(function() {
|
|||
var password = $("#password").val();
|
||||
if (password) {
|
||||
$("#digest").val($.md5($.md5(password + salt) + token));
|
||||
}
|
||||
}
|
||||
var newPassword = $("#newPassword").val();
|
||||
var newPasswordConfirm = $("#newPasswordConfirm").val();
|
||||
$("input:password").val("");
|
||||
|
|
@ -80,7 +80,7 @@ $(function() {
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="small" nowrap="nowrap"><% gettext "Confirm Password" suffix=: %></td>
|
||||
<td nowrap="nowrap"><input type="password" name="newPasswordConfirm"
|
||||
<td nowrap="nowrap"><input type="password" name="newPasswordConfirm"
|
||||
id="newPasswordConfirm" size="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -90,7 +90,7 @@ $(function() {
|
|||
<tr>
|
||||
<td class="small" valign="top" nowrap="nowrap"><% gettext "Personal URL" suffix=: %></td>
|
||||
<td><% user.input url size=30 %><br />
|
||||
<span class="small"><% gettext "If you enter a URL here your user name will
|
||||
<span class="small"><% gettext "If you enter a URL here your user name will
|
||||
appear as link next to your posted items." %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -112,7 +112,7 @@ appear as link next to your posted items." %></span></td>
|
|||
<% #notify_reset %>
|
||||
<% gettext 'Hello {0}.' <% user.name %> %>
|
||||
|
||||
<% gettext "You (or someone pretending to be you) requested to reset your
|
||||
<% gettext "You (or someone pretending to be you) requested to reset your
|
||||
account password for the site {0} at {1}." <% site.title %> <% site.href %> %>
|
||||
|
||||
<% gettext "To confirm the request please click the link below." %>
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ User.add = function(data) {
|
|||
salt: session.data.token,
|
||||
status: User.REGULAR,
|
||||
url: data.url
|
||||
});
|
||||
});
|
||||
root.users.add(user);
|
||||
return user;
|
||||
}
|
||||
|
|
@ -82,7 +82,7 @@ User.remove = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {User}
|
||||
*/
|
||||
|
|
@ -95,8 +95,8 @@ User.getByName = function(name) {
|
|||
* @returns {String[]}
|
||||
* @see defineConstants
|
||||
*/
|
||||
User.getStatus = defineConstants(User, markgettext("Blocked"),
|
||||
markgettext("Regular"), markgettext("Trusted"),
|
||||
User.getStatus = defineConstants(User, markgettext("Blocked"),
|
||||
markgettext("Regular"), markgettext("Trusted"),
|
||||
markgettext("Privileged"));
|
||||
|
||||
/**
|
||||
|
|
@ -110,7 +110,7 @@ User.getSalt = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} data
|
||||
* @throws {Error}
|
||||
* @returns {User}
|
||||
|
|
@ -159,7 +159,7 @@ User.register = function(data) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} data
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
|
@ -205,7 +205,7 @@ User.isBlacklisted = function(data) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
User.autoLogin = function() {
|
||||
if (session.user) {
|
||||
|
|
@ -233,7 +233,7 @@ User.autoLogin = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} data
|
||||
* @returns {User}
|
||||
*/
|
||||
|
|
@ -264,7 +264,7 @@ User.login = function(data) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
User.logout = function() {
|
||||
session.logout();
|
||||
|
|
@ -276,7 +276,7 @@ User.logout = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} requiredStatus
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
|
@ -311,7 +311,7 @@ User.getMembership = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} url
|
||||
*/
|
||||
User.setLocation = function(url) {
|
||||
|
|
@ -362,13 +362,13 @@ User.rename = function(currentName, newName) {
|
|||
* @property {Membership[]} memberships
|
||||
* @property {Metadata} metadata
|
||||
* @property {Date} modified
|
||||
* @property {String} name
|
||||
* @property {String} name
|
||||
* @property {String} salt
|
||||
* @property {Site[]} sites
|
||||
* @property {Membership[]} subscriptions
|
||||
* @property {String} status
|
||||
* @property {Story[]} stories
|
||||
* @property {String} url
|
||||
* @property {String} url
|
||||
* @extends HopObject
|
||||
*/
|
||||
User.prototype.constructor = function(data) {
|
||||
|
|
@ -377,12 +377,12 @@ User.prototype.constructor = function(data) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
User.prototype.onLogout = function() { /* ... */ }
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} action
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
|
@ -391,12 +391,12 @@ User.prototype.getPermission = function(action) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} data
|
||||
*/
|
||||
User.prototype.update = function(data) {
|
||||
if (!data.digest && data.password) {
|
||||
data.digest = ((data.password + this.salt).md5() +
|
||||
data.digest = ((data.password + this.salt).md5() +
|
||||
session.data.token).md5();
|
||||
}
|
||||
if (data.digest) {
|
||||
|
|
@ -413,7 +413,7 @@ User.prototype.update = function(data) {
|
|||
}
|
||||
this.map({
|
||||
hash: data.hash,
|
||||
salt: session.data.token
|
||||
salt: session.data.token
|
||||
});
|
||||
}
|
||||
if (!(data.email = validateEmail(data.email))) {
|
||||
|
|
@ -429,7 +429,7 @@ User.prototype.update = function(data) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
User.prototype.touch = function() {
|
||||
this.modified = new Date;
|
||||
|
|
@ -437,7 +437,7 @@ User.prototype.touch = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} token
|
||||
* @returns {String}
|
||||
*/
|
||||
|
|
@ -447,7 +447,7 @@ User.prototype.getDigest = function(token) {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {Object}
|
||||
*/
|
||||
|
|
@ -469,7 +469,7 @@ User.prototype.email_macro = function() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Object} param
|
||||
* @param {String} type
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ File.prototype.clicks_macro = function(param) {
|
|||
} else if (this.requests < 2) {
|
||||
res.write(param.one || "one download");
|
||||
} else {
|
||||
res.write(param.more ? this.requests + " " + param.more :
|
||||
res.write(param.more ? this.requests + " " + param.more :
|
||||
this.requests + " downloads");
|
||||
}
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ var aspects = {
|
|||
args[0] = param;
|
||||
return args;
|
||||
},
|
||||
|
||||
|
||||
fixMacroParams: function(args) {
|
||||
var param = args[0];
|
||||
var id = args[1] || param.name || param.id;
|
||||
|
|
@ -49,7 +49,7 @@ var aspects = {
|
|||
delete(param.linkto);
|
||||
return [param, id, mode, url];
|
||||
},
|
||||
|
||||
|
||||
fixStoryEditorParams: function(args, func, story) {
|
||||
// IE6 sends the button text instead of the value; thus, we
|
||||
// need to check for the "editableby" property as well :/
|
||||
|
|
@ -64,18 +64,18 @@ var aspects = {
|
|||
var status = [Story.PUBLIC, Story.SHARED, Story.OPEN];
|
||||
req.postParams.status = status[req.postParams.editableby] || req.postParams.editableBy;
|
||||
}
|
||||
req.postParams.mode = (req.postParams.addToFront ?
|
||||
req.postParams.mode = (req.postParams.addToFront ?
|
||||
Story.FEATURED : Story.HIDDEN);
|
||||
req.postParams.commentMode = (req.postParams.discussions ?
|
||||
req.postParams.commentMode = (req.postParams.discussions ?
|
||||
Story.OPEN : Story.CLOSED);
|
||||
}
|
||||
req.postParams.addToFront = null;
|
||||
req.postParams.discussions = null;
|
||||
req.postParams.editableby = null;
|
||||
req.postParams.publish = null;
|
||||
req.postParams.publish = null;
|
||||
return args;
|
||||
},
|
||||
|
||||
|
||||
fixPager: function(args, func, obj) {
|
||||
var archive = res.handlers.day = obj.archive || obj;
|
||||
res.push();
|
||||
|
|
@ -245,7 +245,7 @@ Members.prototype.onCodeUpdate = function() {
|
|||
}
|
||||
return permission;
|
||||
});
|
||||
|
||||
|
||||
return helma.aspects.addBefore(this, "main_action", aspects.fixPager);
|
||||
}
|
||||
}());
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ Image.prototype.editlink_macro = function(param) {
|
|||
renderImage(this.parent.images.get(param.image), param);
|
||||
} else {
|
||||
res.write(param.text || "edit");
|
||||
}
|
||||
}
|
||||
return this.link_macro(param, "edit", res.pop());
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ Image.prototype.deletelink_macro = function(param) {
|
|||
renderImage(this.parent.images.get(param.image), param);
|
||||
} else {
|
||||
res.write(param.text || "delete");
|
||||
}
|
||||
}
|
||||
return this.link_macro(param, "delete", res.pop());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<div class="storyTitle"><% response.title %></div>
|
||||
<br />
|
||||
<div>
|
||||
<% gettext "Upload a zipped layout archive created with Antville 1.1
|
||||
<% gettext "Upload a zipped layout archive created with Antville 1.1
|
||||
to convert it to an archive working with Antville 1.2." %>
|
||||
</div>
|
||||
<br />
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ Layout.prototype.convert_action = function() {
|
|||
zip.close();
|
||||
//zip.save(java.io.File.createTempFile(prefix, ".converted.zip"));
|
||||
res.contentType = "application/zip";
|
||||
res.setHeader("Content-Disposition",
|
||||
res.setHeader("Content-Disposition",
|
||||
"attachment; filename=" + name.replace(/(\..*)$/, ".converted$1"));
|
||||
res.writeBinary(zip.getData());
|
||||
return;
|
||||
|
|
@ -62,7 +62,7 @@ Layout.convert = function(fpath) {
|
|||
result.error = proc.exitValue();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// Code copied from global convert.js file in updater app
|
||||
// ******************************************************
|
||||
var styles = {
|
||||
|
|
@ -117,7 +117,7 @@ Layout.convert = function(fpath) {
|
|||
var skin = rename($[2].capitalize(), $[4]);
|
||||
if (skin) {
|
||||
// THIS LINE DIFFERS FROM THE UPDATER APP!
|
||||
return $[1] + skin.prototype.toLowerCase() + $[3] +
|
||||
return $[1] + skin.prototype.toLowerCase() + $[3] +
|
||||
skin.prototype + "#" + skin.name;
|
||||
}
|
||||
return $[0];
|
||||
|
|
@ -137,7 +137,7 @@ Layout.convert = function(fpath) {
|
|||
// End of code copied from updater app
|
||||
|
||||
var rename = function(proto, name) {
|
||||
var allowed = ["Comment", "Day", "File", "Global", "Image",
|
||||
var allowed = ["Comment", "Day", "File", "Global", "Image",
|
||||
"MemberMgr", "Membership", "Site", "Story", "Topic"];
|
||||
if (allowed.indexOf(proto) < 0) {
|
||||
return;
|
||||
|
|
@ -147,11 +147,11 @@ Layout.convert = function(fpath) {
|
|||
case "Comment":
|
||||
name === "toplevel" && (name = "main");
|
||||
break;
|
||||
|
||||
|
||||
case "Day":
|
||||
proto = "Archive";
|
||||
break;
|
||||
|
||||
|
||||
case "MemberMgr":
|
||||
case "Membership":
|
||||
if (name === "statusloggedin") {
|
||||
|
|
@ -163,7 +163,7 @@ Layout.convert = function(fpath) {
|
|||
//return;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case "Site":
|
||||
if (name === "searchbox") {
|
||||
name = "search";
|
||||
|
|
@ -171,7 +171,7 @@ Layout.convert = function(fpath) {
|
|||
name = "stylesheet";
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case "Story":
|
||||
if (name === "dayheader") {
|
||||
name = "date";
|
||||
|
|
@ -181,18 +181,18 @@ Layout.convert = function(fpath) {
|
|||
name = "history";
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case "Topic":
|
||||
proto = "Tag";
|
||||
break;
|
||||
}
|
||||
(proto === "MemberMgr") && (proto = "Membership");
|
||||
(proto === "MemberMgr") && (proto = "Membership");
|
||||
return {
|
||||
prototype: proto,
|
||||
name: name
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
var convert2subskins = function(proto, dir) {
|
||||
res.push();
|
||||
for each (var fname in dir.list()) {
|
||||
|
|
@ -202,14 +202,14 @@ Layout.convert = function(fpath) {
|
|||
res.writeln("<% #" + skin.name + " %>");
|
||||
var source = clean(file.readAll());
|
||||
if (skin.prototype === "Site" && skin.name === "stylesheet") {
|
||||
source = source.replace(/(\.calHead)/g,
|
||||
source = source.replace(/(\.calHead)/g,
|
||||
"table.calendar thead, $1");
|
||||
source = source.replace(/(\.calDay)/g,
|
||||
source = source.replace(/(\.calDay)/g,
|
||||
"table.calendar th, table.calendar tbody td.day, $1");
|
||||
source = source.replace(/(\.calSelDay)/g,
|
||||
source = source.replace(/(\.calSelDay)/g,
|
||||
"table.calendar tbody td.selected, $1");
|
||||
source = source.replace(/(\.calFoot)/g,
|
||||
"table.calendar tfoot td, $1");
|
||||
source = source.replace(/(\.calFoot)/g,
|
||||
"table.calendar tfoot td, $1");
|
||||
}
|
||||
res.writeln(source);
|
||||
}
|
||||
|
|
@ -225,7 +225,7 @@ Layout.convert = function(fpath) {
|
|||
target.write(str);
|
||||
target.close();
|
||||
}
|
||||
|
||||
|
||||
var convertImage = function(image) {
|
||||
var result = new HopObject;
|
||||
result.name = image.alias;
|
||||
|
|
@ -240,11 +240,11 @@ Layout.convert = function(fpath) {
|
|||
if (image.thumbnail) {
|
||||
result.thumbnailName = image.thumbnail.filename + "." + image.fileext;
|
||||
result.thumbnailWidth = image.thumbnail.width;
|
||||
result.thumbnailHeight = image.thumbnail.height;
|
||||
result.thumbnailHeight = image.thumbnail.height;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
var dir = new helma.File(fpath, "images");
|
||||
for each (var fname in dir.list()) {
|
||||
var file = new helma.File(dir, fname);
|
||||
|
|
@ -270,7 +270,7 @@ Layout.convert = function(fpath) {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
var xml = Xml.read(new helma.File(fpath, "preferences.xml"));
|
||||
var file = new helma.File(fpath, "Site");
|
||||
file.makeDirectory();
|
||||
|
|
@ -281,7 +281,7 @@ Layout.convert = function(fpath) {
|
|||
res.write(values(xml.preferences));
|
||||
file.write(res.pop());
|
||||
file.close();
|
||||
|
||||
|
||||
dir = new helma.File(fpath, "skins");
|
||||
|
||||
var skin;
|
||||
|
|
@ -289,7 +289,7 @@ Layout.convert = function(fpath) {
|
|||
file = new helma.File(dir, fname);
|
||||
skin = convert2subskins(fname, file);
|
||||
}
|
||||
|
||||
|
||||
var data = new HopObject;
|
||||
data.images = new HopObject;
|
||||
|
||||
|
|
@ -306,7 +306,7 @@ Layout.convert = function(fpath) {
|
|||
data.originated = new Date;
|
||||
data.originator = session.user;
|
||||
Xml.write(data, new helma.File(fpath, "data.xml"));
|
||||
|
||||
|
||||
(new helma.File(fpath, "preferences.xml")).remove();
|
||||
(new helma.File(fpath, "imagedata")).removeDirectory();
|
||||
(new helma.File(fpath, "skins")).removeDirectory();
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ relocateProperty(Membership, "modifytime", "modified");
|
|||
relocateProperty(Membership, "user", "creator");
|
||||
|
||||
Membership.prototype.username_macro = function(param) {
|
||||
if (param.linkto && (param.linkto !== "edit" ||
|
||||
if (param.linkto && (param.linkto !== "edit" ||
|
||||
this.user !== session.user)) {
|
||||
html.link({href: this.href(param.linkto)}, this.name);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ Poll.prototype.question_macro = function(param) {
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Poll.prototype.closetime_macro = function(param, format) {
|
||||
format || (format = param.format);
|
||||
return this.closed_macro(param, format);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ Story.ALLOWED_MACROS = Story.ALLOWED_MACROS.concat([
|
|||
"spacer",
|
||||
"storylist",
|
||||
"thumbnail",
|
||||
|
||||
|
||||
"site.image",
|
||||
"site.link",
|
||||
"site.thumbnail",
|
||||
|
|
@ -88,19 +88,19 @@ Story.prototype.content_macro = function(param) {
|
|||
this.input_macro(param, options.part);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case "image":
|
||||
var part = this.getMetadata(options.part);
|
||||
part && res.write(this.format_filter(part, param, "image"));
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
var part = this.getRenderedContentPart(options.part, options.as);
|
||||
if (!part && options.fallback) {
|
||||
part = this.getRenderedContentPart(options.fallback, options.as);
|
||||
}
|
||||
if (options.limit) {
|
||||
part = part.stripTags().head(options.limit,
|
||||
part = part.stripTags().head(options.limit,
|
||||
options.clipping, options.delimiter || String.SPACE);
|
||||
}
|
||||
if (options.as === "link") {
|
||||
|
|
@ -125,13 +125,13 @@ Story.prototype.getRenderedContentPart = function(name, mode) {
|
|||
case "plaintext":
|
||||
part = this.format_filter(part, {}, "plain");
|
||||
break;
|
||||
|
||||
|
||||
case "alttext":
|
||||
part = this.format_filter(part, {}, "quotes");
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
// Enable caching; some macros (eg. poll, storylist) will set this
|
||||
// Enable caching; some macros (eg. poll, storylist) will set this
|
||||
// to false to prevent caching of a contentpart containing them.
|
||||
res.meta.cachePart = true;
|
||||
part = this.format_filter(part, {});
|
||||
|
|
@ -140,7 +140,7 @@ Story.prototype.getRenderedContentPart = function(name, mode) {
|
|||
if (res.meta.cachePart) {
|
||||
this.cache["lastRendered_" + key] = new Date();
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.cache[key];
|
||||
}
|
||||
|
||||
|
|
@ -148,7 +148,7 @@ Story.prototype.location_macro = function(param) {
|
|||
switch (this.mode) {
|
||||
case Story.FEATURED:
|
||||
res.write("site"); break;
|
||||
|
||||
|
||||
default:
|
||||
if (this.tags.size() > 0) {
|
||||
html.link({href: this.tags.get(0).tag.href()}, "topic");
|
||||
|
|
@ -195,7 +195,7 @@ Story.prototype.topic_macro = function(param) {
|
|||
Story.prototype.topicchooser_macro = function(param) {
|
||||
var site = this.site || res.handlers.site;
|
||||
var currentTopic = this.tags.size() > 0 ? this.tags.get(0).tag : null;
|
||||
var topics = (this.constructor === Story ? site.stories.tags :
|
||||
var topics = (this.constructor === Story ? site.stories.tags :
|
||||
site.images.galleries);
|
||||
var options = [], topic;
|
||||
for (var i=0; i<topics.size(); i++) {
|
||||
|
|
@ -263,7 +263,7 @@ Story.prototype.editableby_macro = function(param) {
|
|||
var selValue = this.status;
|
||||
}
|
||||
for (var i=0; i<options.length; i+=1) {
|
||||
html.radioButton({name: "editableby",
|
||||
html.radioButton({name: "editableby",
|
||||
value: options[i], selectedValue: selValue});
|
||||
res.write(" ");
|
||||
res.write(labels[i]);
|
||||
|
|
@ -293,7 +293,7 @@ Story.prototype.editlink_macro = function(param) {
|
|||
image && image.render_macro(param);
|
||||
} else {
|
||||
res.write(param.text || "edit");
|
||||
}
|
||||
}
|
||||
return this.link_macro(param, "edit", res.pop());
|
||||
}
|
||||
|
||||
|
|
@ -305,7 +305,7 @@ Story.prototype.deletelink_macro = function(param) {
|
|||
image && image.render_macro(param);
|
||||
} else {
|
||||
res.write(param.text || "delete");
|
||||
}
|
||||
}
|
||||
return this.link_macro(param, "delete", res.pop());
|
||||
}
|
||||
|
||||
|
|
@ -317,12 +317,12 @@ Story.prototype.viewlink_macro = function(param) {
|
|||
image && image.render_macro(param);
|
||||
} else {
|
||||
res.write(param.text || "view");
|
||||
}
|
||||
}
|
||||
return this.link_macro(param, ".", res.pop());
|
||||
}
|
||||
|
||||
Story.prototype.commentlink_macro = function(param) {
|
||||
if (this.commentMode === Story.OPEN &&
|
||||
if (this.commentMode === Story.OPEN &&
|
||||
this.site.commentMode === Site.ENABLED) {
|
||||
html.link({href: this.href(param.to || "comment")},
|
||||
param.text || "comment");
|
||||
|
|
@ -365,14 +365,14 @@ Story.prototype.createtime_macro = function(param) {
|
|||
}
|
||||
|
||||
Story.prototype.commentcounter_macro = function(param) {
|
||||
if (this.site.commentMode === Site.DISABLED ||
|
||||
if (this.site.commentMode === Site.DISABLED ||
|
||||
this.commentMode === Story.CLOSED ||
|
||||
this.commentMode === Story.READONLY) {
|
||||
return;
|
||||
}
|
||||
var commentCnt = this.comments.count();
|
||||
param.linkto || (param.linkto = "main");
|
||||
var linkflag = (param.as === "link" && param.as !== "text" ||
|
||||
var linkflag = (param.as === "link" && param.as !== "text" ||
|
||||
!param.as && commentCnt > 0);
|
||||
if (linkflag) {
|
||||
html.openTag("a", {href: this.href() + "#comments"});
|
||||
|
|
|
|||
|
|
@ -34,5 +34,5 @@ Topics.prototype.getChildElement = function(id) {
|
|||
Topics.prototype.href = function() {
|
||||
var mountpoint = (this._parent.constructor === Site ||
|
||||
this._parent.constructor === Root ? "tags" : "galleries");
|
||||
return this._parent[mountpoint].href();
|
||||
return this._parent[mountpoint].href();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,4 +35,4 @@ Sql.PURGEREFERRERS = "delete from log where action = 'main' and " +
|
|||
Sql.REFERRERS = "select referrer, count(*) as requests from " +
|
||||
"log where context_type = '$0' and context_id = $1 and action = " +
|
||||
"'main' and created > dateadd('day', -2, current_date()) group " +
|
||||
"by referrer order by requests desc, referrer asc";
|
||||
"by referrer order by requests desc, referrer asc";
|
||||
|
|
|
|||
|
|
@ -28,4 +28,4 @@
|
|||
antville.url = jdbc:h2:./db/antville;ifexists=true;schema=antville;mode=postgresql
|
||||
antville.driver = org.h2.Driver
|
||||
antville.user = sa
|
||||
antville.password =
|
||||
antville.password =
|
||||
|
|
|
|||
|
|
@ -35,4 +35,4 @@ Sql.PURGEREFERRERS = "delete from log where action = 'main' and " +
|
|||
Sql.REFERRERS = "select referrer, count(*) as requests from " +
|
||||
"log where context_type = '$0' and context_id = $1 and action = " +
|
||||
"'main' and created > date_add(now(), interval -1 day) group " +
|
||||
"by referrer order by requests desc, referrer asc";
|
||||
"by referrer order by requests desc, referrer asc";
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@
|
|||
## $URL$
|
||||
##
|
||||
|
||||
create database if not exists antville character set latin1
|
||||
create database if not exists antville character set latin1
|
||||
collate latin1_general_ci;
|
||||
|
||||
use antville;
|
||||
|
||||
grant select, insert, update, delete on antville.* to antville@localhost
|
||||
grant select, insert, update, delete on antville.* to antville@localhost
|
||||
identified by 'antville';
|
||||
|
||||
set foreign_key_checks = 0;
|
||||
|
|
@ -257,5 +257,5 @@ set foreign_key_checks = 1;
|
|||
|
||||
insert into layout (id, site_id, mode) values ( '1', '1', 'default');
|
||||
|
||||
insert into site (id, name, layout_id, status, mode)
|
||||
insert into site (id, name, layout_id, status, mode)
|
||||
values ('1', 'www', '1', 'trusted', 'public');
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ create user antville password 'antville';
|
|||
alter user antville admin true;
|
||||
|
||||
-- These return errors in H2 database
|
||||
create database antville owner antville;
|
||||
create database antville owner antville;
|
||||
\connect antville;
|
||||
|
||||
create schema antville authorization antville;
|
||||
|
|
@ -278,11 +278,11 @@ create index vote_poll_idx on antville.vote (poll_id, choice_id);
|
|||
|
||||
insert into antville.layout (id, site_id, mode) values ('1', '1', 'default');
|
||||
|
||||
insert into antville.site (id, name, layout_id, status, mode)
|
||||
insert into antville.site (id, name, layout_id, status, mode)
|
||||
values ('1', 'www', '1', 'trusted', 'public');
|
||||
|
||||
grant select, insert, update, delete on antville.choice, antville.content,
|
||||
antville.file, antville.image, antville.layout, antville.log,
|
||||
antville.file, antville.image, antville.layout, antville.log,
|
||||
antville.metadata, antville.membership, antville.poll, antville.site, antville.skin,
|
||||
antville.tag, antville.tag_hub, antville.account, antville.vote to antville;
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ var db = function() {
|
|||
var ResultWrapper = function(result) {
|
||||