aboutsummaryrefslogtreecommitdiffstats
path: root/etherpad
diff options
context:
space:
mode:
authorPeter Martischka <pita@pitapoison.de>2010-04-11 22:23:25 +0200
committerPeter Martischka <pita@pitapoison.de>2010-04-11 22:23:25 +0200
commit1991849233b5a7d5930308b0a7bcd4777536ac7f (patch)
tree93356c0eff84f9b445344d691bd63f76d6a68dd1 /etherpad
parent6f0061961975df9a0c3ebab68386d8d65b706959 (diff)
parent2e258bc3806724bb505a30872681a20326f4d4a6 (diff)
downloadetherpad-1991849233b5a7d5930308b0a7bcd4777536ac7f.tar.gz
etherpad-1991849233b5a7d5930308b0a7bcd4777536ac7f.tar.xz
etherpad-1991849233b5a7d5930308b0a7bcd4777536ac7f.zip
Merge branch 'master' of git://github.com/redhog/pad
Diffstat (limited to 'etherpad')
-rw-r--r--etherpad/src/etherpad/control/admin/pluginmanager.js7
-rw-r--r--etherpad/src/etherpad/control/pad/pad_control.js34
-rw-r--r--etherpad/src/etherpad/helpers.js4
-rw-r--r--etherpad/src/etherpad/pad/padutils.js37
-rw-r--r--etherpad/src/plugins/twitterStyleTags/controllers/tagBrowser.js7
-rw-r--r--etherpad/src/plugins/twitterStyleTags/hooks.js4
-rw-r--r--etherpad/src/plugins/twitterStyleTags/static/css/tagBrowser.css2
-rw-r--r--etherpad/src/plugins/twitterStyleTags/templates/tagBrowser.ejs186
-rw-r--r--etherpad/src/plugins/urlIndexer/hooks.js39
-rw-r--r--etherpad/src/plugins/urlIndexer/main.js32
-rw-r--r--etherpad/src/themes/default/templates/admin/pluginmanager.ejs163
-rw-r--r--etherpad/src/themes/default/templates/pad/pad_body2.ejs10
-rw-r--r--etherpad/src/themes/default/templates/page.ejs8
13 files changed, 254 insertions, 279 deletions
diff --git a/etherpad/src/etherpad/control/admin/pluginmanager.js b/etherpad/src/etherpad/control/admin/pluginmanager.js
index 39edc4a..c4bee5b 100644
--- a/etherpad/src/etherpad/control/admin/pluginmanager.js
+++ b/etherpad/src/etherpad/control/admin/pluginmanager.js
@@ -26,6 +26,7 @@ import("etherpad.pro.pro_utils");
import("etherpad.helpers");
import("etherpad.pro.pro_accounts.getSessionProAccount");
import("etherpad.admin.plugins");
+import("etherpad.pad.padutils");
function onRequest() {
@@ -52,8 +53,14 @@ function onRequest() {
userId: padusers.getUserId(),
});
+
+ padutils.setOptsAndCookiePrefs(request);
+ var prefs = helpers.getClientVar('cookiePrefsToSet');
+ var bodyClass = (prefs.isFullWidth ? "fullwidth" : "limwidth")
+
renderHtml("admin/pluginmanager.ejs",
{
+ prefs: prefs,
config: appjet.config,
bodyClass: 'nonpropad',
isPro: pro_utils.isProDomainRequest(),
diff --git a/etherpad/src/etherpad/control/pad/pad_control.js b/etherpad/src/etherpad/control/pad/pad_control.js
index 3d32355..2a6a1be 100644
--- a/etherpad/src/etherpad/control/pad/pad_control.js
+++ b/etherpad/src/etherpad/control/pad/pad_control.js
@@ -331,15 +331,6 @@ function render_pad(localPadId) {
var specialKey = request.params.specialKey ||
(sessions.isAnEtherpadAdmin() ? collab_server.getSpecialKey('invisible') :
null);
- if (request.params.fullScreen) { // tokbox, embedding
- opts.fullScreen = true;
- }
- if (request.params.tokbox) {
- opts.tokbox = true;
- }
- if (request.params.sidebar) {
- opts.sidebar = Boolean(Number(request.params.sidebar));
- }
helpers.addClientVars({
padId: localPadId,
@@ -365,34 +356,17 @@ function render_pad(localPadId) {
userColor: assignColorId(pad, userId),
specialKey: specialKey,
specialKeyTranslation: collab_server.translateSpecialKey(specialKey),
- opts: opts
});
});
var isProUser = (isPro && ! padusers.isGuest(userId));
- var isFullWidth = false;
- var hideSidebar = false;
- var cookiePrefs = padutils.getPrefsCookieData();
- if (cookiePrefs) {
- isFullWidth = !! cookiePrefs.fullWidth;
- hideSidebar = !! cookiePrefs.hideSidebar;
- }
- if (opts.fullScreen) {
- isFullWidth = true;
- if (opts.tokbox) {
- hideSidebar = true;
- }
- }
- if ('sidebar' in opts) {
- hideSidebar = ! opts.sidebar;
- }
- var bodyClass = (isFullWidth ? "fullwidth" : "limwidth")+
+ padutils.setOptsAndCookiePrefs(request);
+ var prefs = helpers.getClientVar('cookiePrefsToSet');
+ var bodyClass = (prefs.isFullWidth ? "fullwidth" : "limwidth") +
" "+(isPro ? "propad" : "nonpropad")+" "+
(isProUser ? "prouser" : "nonprouser");
- var cookiePrefsToSet = {fullWidth:isFullWidth, hideSidebar:hideSidebar};
- helpers.addClientVars({cookiePrefsToSet: cookiePrefsToSet});
renderHtml("pad/pad_body2.ejs",
{localPadId:localPadId,
@@ -404,7 +378,7 @@ function render_pad(localPadId) {
isProAccountHolder: isProUser,
account: getSessionProAccount(), // may be falsy
toHTML: toHTML,
- prefs: {isFullWidth:isFullWidth, hideSidebar:hideSidebar},
+ prefs: prefs,
signinUrl: '/ep/account/sign-in?cont='+
encodeURIComponent(request.url),
fullSuperdomain: pro_utils.getFullSuperdomainHost()
diff --git a/etherpad/src/etherpad/helpers.js b/etherpad/src/etherpad/helpers.js
index e16c2f7..aec3bc3 100644
--- a/etherpad/src/etherpad/helpers.js
+++ b/etherpad/src/etherpad/helpers.js
@@ -77,6 +77,10 @@ function addClientVars(vars) {
});
}
+function getClientVar(name) {
+ return _hd().clientVars[name];
+}
+
function addToHead(stuff) {
_hd().headExtra += stuff;
}
diff --git a/etherpad/src/etherpad/pad/padutils.js b/etherpad/src/etherpad/pad/padutils.js
index 2fdf579..dc4c9ab 100644
--- a/etherpad/src/etherpad/pad/padutils.js
+++ b/etherpad/src/etherpad/pad/padutils.js
@@ -25,6 +25,7 @@ import("etherpad.pro.pro_accounts");
import("etherpad.pro.pro_padmeta");
import("etherpad.pad.model");
import("etherpad.sessions.getSession");
+import("etherpad.helpers");
jimport("java.lang.System.out.println");
@@ -152,3 +153,39 @@ function getProDisplayTitle(localPadId, title) {
}
}
+
+function setOptsAndCookiePrefs(request) {
+ opts = {};
+ if (request.params.fullScreen) { // tokbox, embedding
+ opts.fullScreen = true;
+ }
+ if (request.params.tokbox) {
+ opts.tokbox = true;
+ }
+ if (request.params.sidebar) {
+ opts.sidebar = Boolean(Number(request.params.sidebar));
+ }
+ helpers.addClientVars({opts: opts});
+
+
+ var prefs = getPrefsCookieData();
+
+ var prefsToSet = {
+ fullWidth:false,
+ hideSidebar:false
+ };
+ if (prefs) {
+ prefsToSet.isFullWidth = !! prefs.fullWidth;
+ prefsToSet.hideSidebar = !! prefs.hideSidebar;
+ }
+ if (opts.fullScreen) {
+ prefsToSet.isFullWidth = true;
+ if (opts.tokbox) {
+ prefsToSet.hideSidebar = true;
+ }
+ }
+ if ('sidebar' in opts) {
+ prefsToSet.hideSidebar = ! opts.sidebar;
+ }
+ helpers.addClientVars({cookiePrefsToSet: prefsToSet});
+}
diff --git a/etherpad/src/plugins/twitterStyleTags/controllers/tagBrowser.js b/etherpad/src/plugins/twitterStyleTags/controllers/tagBrowser.js
index 793067d..7071306 100644
--- a/etherpad/src/plugins/twitterStyleTags/controllers/tagBrowser.js
+++ b/etherpad/src/plugins/twitterStyleTags/controllers/tagBrowser.js
@@ -29,6 +29,7 @@ import("etherpad.pro.pro_accounts.getSessionProAccount");
import("sqlbase.sqlbase");
import("sqlbase.sqlcommon");
import("sqlbase.sqlobj");
+import("etherpad.pad.padutils");
function tagsToQuery(tags, antiTags) {
var prefixed = [];
@@ -251,7 +252,13 @@ function onRequest() {
var isProUser = (isPro && ! padusers.isGuest(userId));
+
+ padutils.setOptsAndCookiePrefs(request);
+ var prefs = helpers.getClientVar('cookiePrefsToSet');
+ var bodyClass = (prefs.isFullWidth ? "fullwidth" : "limwidth")
+
var info = {
+ prefs: prefs,
config: appjet.config,
tagsToQuery: tagsToQuery,
padIdToReadonly: server_utils.padIdToReadonly,
diff --git a/etherpad/src/plugins/twitterStyleTags/hooks.js b/etherpad/src/plugins/twitterStyleTags/hooks.js
index 003bc32..9465ccc 100644
--- a/etherpad/src/plugins/twitterStyleTags/hooks.js
+++ b/etherpad/src/plugins/twitterStyleTags/hooks.js
@@ -23,10 +23,10 @@ function padModelWriteToDB(args) {
else
old_tags_str = '';
- var old_tags = old_tags_str != '' ? old_tags_str.split('#') : new Array();
+ // var old_tags = old_tags_str != '' ? old_tags_str.split('#') : new Array();
if (new_tags_str != old_tags_str) {
- log.info({message: 'Updating tags', new_tags:new_tags, old_tags:old_tags});
+ // log.info({message: 'Updating tags', new_tags:new_tags, old_tags:old_tags});
if (old_tags_row)
sqlobj.update("PAD_TAG_CACHE", {PAD_ID: args.padId }, {TAGS: new_tags.join('#')});
diff --git a/etherpad/src/plugins/twitterStyleTags/static/css/tagBrowser.css b/etherpad/src/plugins/twitterStyleTags/static/css/tagBrowser.css
index f3321a4..55fcda2 100644
--- a/etherpad/src/plugins/twitterStyleTags/static/css/tagBrowser.css
+++ b/etherpad/src/plugins/twitterStyleTags/static/css/tagBrowser.css
@@ -76,7 +76,7 @@ h1 {
}
#editbarinner {
- line-height: 36px;
+ line-height: 29px;
font-size: 16px;
padding-left: 6pt;
}
diff --git a/etherpad/src/plugins/twitterStyleTags/templates/tagBrowser.ejs b/etherpad/src/plugins/twitterStyleTags/templates/tagBrowser.ejs
index 1f33eb8..955d2e6 100644
--- a/etherpad/src/plugins/twitterStyleTags/templates/tagBrowser.ejs
+++ b/etherpad/src/plugins/twitterStyleTags/templates/tagBrowser.ejs
@@ -14,34 +14,10 @@ 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. */ %>
<%
+ template.inherit('page.ejs');
helpers.setHtmlTitle("EtherPad: Browse tags");
helpers.includeCss("plugins/twitterStyleTags/tagBrowser.css");
helpers.includeCss("plugins/twitterStyleTags/pad.css");
- helpers.setBodyId("padbody");
- helpers.addBodyClass("limwidth nonpropad nonprouser");
- helpers.includeCss("pad2_ejs.css");
- helpers.includeJs("undo-xpopup.js");
- helpers.includeCometJs();
- helpers.includeJQuery();
- helpers.includeJs("json2.js");
- helpers.includeJs("colorutils.js");
- helpers.includeJs("ace.js");
- helpers.includeJs("collab_client.js");
- helpers.includeJs("draggable.js");
- helpers.includeJs("pad_utils.js");
- helpers.includeJs("pad_cookie.js");
- helpers.includeJs("pad_editor.js");
- helpers.includeJs("pad_userlist.js");
- helpers.includeJs("pad_editbar.js");
- helpers.includeJs("pad_chat.js");
- helpers.includeJs("pad_docbar.js");
- helpers.includeJs("pad_impexp.js");
- helpers.includeJs("pad_savedrevs.js");
- helpers.includeJs("pad_connectionstatus.js");
- helpers.includeJs("pad_modals.js");
- helpers.includeJs("pad2.js");
- helpers.suppressGA();
- helpers.setRobotsPolicy({index: false, follow: false});
helpers.addToHead('\n<link rel="alternate" href="/ep/tag/?query=' + tagsToQuery(tags, antiTags) + '&format=rss" type="application/rss+xml" title="Query results as RSS" />\n');
function inArray(item, arr) {
@@ -51,108 +27,78 @@ limitations under the License. */ %>
return false;
}
%>
+<% template.define('docBarTitle', function() { var ejs_data=''; %>
+ <td id="docbarpadtitle"><span>Browse Tags</span></td>
+<% return ejs_data; }); %>
-<div id="padpage">
- <div id="padtop">
- <div id="topbar">
- <div id="topbarleft"><!-- --></div>
- <div id="topbarright"><!-- --></div>
- <div id="topbarcenter"><a href="/" id="topbaretherpad">EtherPad</a></div>
- <% if (isProAccountHolder) { %>
- <div id="accountnav"><%= toHTML(account.email) %><a href="/ep/account/sign-out">(sign out)</a></div>
- <% } else if (isPro) { %>
- <div id="accountnav"><a href="<%= signinUrl %>">sign in</a></div>
+<% template.define('sideBar', function() { var ejs_data=''; %>
+ <div id="padusers">
+ <% if (isProAccountEnabled()) { %>
+ <a href="/ep/pad/newpad" style="padding: 25px 0" id="home-newpad">
+ Create new pad
+ </a>
+ <a href="/ep/pro-signup/" style="padding: 25px 0" id="home-newteam">
+ Create new team
+ </a>
+ <% } else { %>
+ <a href="/ep/pad/newpad" id="home-newpad">
+ Create new pad
+ </a>
<% } %>
</div>
- <div id="docbar">
- <table border="0" cellpadding="0" cellspacing="0" width="100%" id="docbartable">
- <td><img src="/static/img/jun09/pad/roundcorner_left.gif"></td>
- <td id="docbarpadtitle"><span>Browse Tags</span></td>
- <td width="100%">&nbsp;</td>
- <td><img src="/static/img/jun09/pad/roundcorner_right.gif"></td>
- </table>
- </div>
- <div id="padmain">
- <div id="padsidebar">
- <div id="padusers">
- <% if (isProAccountEnabled()) { %>
- <a href="/ep/pad/newpad" style="padding: 25px 0" id="home-newpad">
- Create new pad
- </a>
- <a href="/ep/pro-signup/" style="padding: 25px 0" id="home-newteam">
- Create new team
- </a>
- <% } else { %>
- <a href="/ep/pad/newpad" id="home-newpad">
- Create new pad
- </a>
- <% } %>
- </div>
+ <div id="hdraggie"><!-- --></div>
- <div id="hdraggie"><!-- --></div>
+ <div id="padchat"><iframe src="<%= config['motdPage'] %>" width="100%" height="100%"></iframe></div>
+<% return ejs_data; }); %>
- <div id="padchat"><iframe src="<%= config['motdPage'] %>" width="100%" height="100%"></iframe></div>
- </div> <!-- /padsidebar -->
-
- <div id="padeditor">
- <div id="editbar" class="enabledtoolbar">
- <div id="editbarleft"><!-- --></div>
- <div id="editbarright"><!-- --></div>
-
- <div id="editbarinner">
- Query:
- <% if (tags.length == 0 && antiTags.length == 0) { %>
- Latest changed pads
- <% } else { %>
- <% for (i = 0; i < tags.length; i++) { %>
- <a href="/ep/tag/?query=<%= tagsToQuery(tags.filter(function (tag) { return tag != tags[i]}), antiTags) %>" class="padtag" title="<%= tags[i] %> matches">#<%= tags[i] %></a>
- <% } %>
- <% for (i = 0; i < antiTags.length; i++) { %>
- <a href="/ep/tag/?query=<%= tagsToQuery(tags, antiTags.filter(function (tag) { return tag != antiTags[i]})) %>" class="anti_padtag" title="<%= antiTags[i] %> matches">!#<%= antiTags[i] %></a>
- <% } %>
- <% } %>
- </div>
- </div>
- <div id="editorcontainerbox">
- <div id="editorcontainer">
- <div class="query-refiner">
- <h1>Search for pads that have the tag</h1>
- <% for (i = 0; i < newTags.length; i++) { %>
- <a href="/ep/tag/?query=<%= tagsToQuery(tags.concat([newTags[i].tagname]),antiTags) %>" class="padtag" title="<%= newTags[i].matches %> matches">#<%= newTags[i].tagname %></a>
- <% } %>
+<% template.define('editBarItemsLeft', function() { var ejs_data=''; %>
+ <td>
+ Query:
+ <% if (tags.length == 0 && antiTags.length == 0) { %>
+ Latest changed pads
+ <% } else { %>
+ <% for (i = 0; i < tags.length; i++) { %>
+ <a href="/ep/tag/?query=<%= tagsToQuery(tags.filter(function (tag) { return tag != tags[i]}), antiTags) %>" class="padtag" title="<%= tags[i] %> matches">#<%= tags[i] %></a>
+ <% } %>
+ <% for (i = 0; i < antiTags.length; i++) { %>
+ <a href="/ep/tag/?query=<%= tagsToQuery(tags, antiTags.filter(function (tag) { return tag != antiTags[i]})) %>" class="anti_padtag" title="<%= antiTags[i] %> matches">!#<%= antiTags[i] %></a>
+ <% } %>
+ <% } %>
+ </td>
+<% return ejs_data; }); %>
- <h1>Search for pads that <em>don't</em> have the tag</h1>
- <% for (i = 0; i < newTags.length; i++) { %>
- <a href="/ep/tag/?query=<%= tagsToQuery(tags,antiTags.concat([newTags[i].tagname])) %>" class="anti_padtag" title="<%= newTags[i].antimatches %> matches">!#<%= newTags[i].tagname %></a>
- <% } %>
- </div>
+<% template.define('contentArea', function() { var ejs_data=''; %>
+ <div id="editorcontainer">
+ <div class="query-refiner">
+ <h1>Search for pads that have the tag</h1>
+ <% for (i = 0; i < newTags.length; i++) { %>
+ <a href="/ep/tag/?query=<%= tagsToQuery(tags.concat([newTags[i].tagname]),antiTags) %>" class="padtag" title="<%= newTags[i].matches %> matches">#<%= newTags[i].tagname %></a>
+ <% } %>
- <dl>
- <% for (i = 0; i < matchingPads.length; i++) { %>
- <%
- var matchingPadId = matchingPads[i].ID;
- var matchingPadUrl = matchingPadId;
- if (!inArray('writable', matchingPads[i].TAGS)) {
- matchingPadId = padIdToReadonly(matchingPads[i].ID);
- matchingPadUrl = 'ep/pad/view/' + matchingPadId + '/latest';
- }
- %>
- <dt><a href="/<%= matchingPadUrl %>"><%= matchingPadId %></a><dt>
- <dd>
- <% for (j = 0; j < matchingPads[i].TAGS.length; j++) { %>
- <a href="/ep/tag/?query=<%= tagsToQuery(tags.concat([matchingPads[i].TAGS[j]]), antiTags) %>" class="padtag" title="<%= matchingPads[i].TAGS[j] %> matches">#<%= matchingPads[i].TAGS[j] %></a>
- <% } %>
- </dd>
- <% } %>
- </dl>
- </div>
- </div>
- </div><!-- /padeditor -->
+ <h1>Search for pads that <em>don't</em> have the tag</h1>
+ <% for (i = 0; i < newTags.length; i++) { %>
+ <a href="/ep/tag/?query=<%= tagsToQuery(tags,antiTags.concat([newTags[i].tagname])) %>" class="anti_padtag" title="<%= newTags[i].antimatches %> matches">!#<%= newTags[i].tagname %></a>
+ <% } %>
+ </div>
- <div id="bottomarea">
- <div id="widthprefcheck" class="widthprefunchecked"><!-- --></div>
- <div id="sidebarcheck" class="sidebarchecked"><!-- --></div>
+ <dl>
+ <% for (i = 0; i < matchingPads.length; i++) { %>
+ <%
+ var matchingPadId = matchingPads[i].ID;
+ var matchingPadUrl = matchingPadId;
+ if (!inArray('writable', matchingPads[i].TAGS)) {
+ matchingPadId = padIdToReadonly(matchingPads[i].ID);
+ matchingPadUrl = 'ep/pad/view/' + matchingPadId + '/latest';
+ }
+ %>
+ <dt><a href="/<%= matchingPadUrl %>"><%= matchingPadId %></a><dt>
+ <dd>
+ <% for (j = 0; j < matchingPads[i].TAGS.length; j++) { %>
+ <a href="/ep/tag/?query=<%= tagsToQuery(tags.concat([matchingPads[i].TAGS[j]]), antiTags) %>" class="padtag" title="<%= matchingPads[i].TAGS[j] %> matches">#<%= matchingPads[i].TAGS[j] %></a>
+ <% } %>
+ </dd>
+ <% } %>
+ </dl>
</div>
- </div>
-</div>
+<% return ejs_data; }); %>
diff --git a/etherpad/src/plugins/urlIndexer/hooks.js b/etherpad/src/plugins/urlIndexer/hooks.js
new file mode 100644
index 0000000..1429895
--- /dev/null
+++ b/etherpad/src/plugins/urlIndexer/hooks.js
@@ -0,0 +1,39 @@
+import("etherpad.log");
+import("dispatch.{Dispatcher,PrefixMatcher,forward}");
+import("sqlbase.sqlobj");
+
+REGEX_WORDCHAR = /[\u0030-\u0039\u0041-\u005A\u0061-\u007A\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\u1FFF\u3040-\u9FFF\uF900-\uFDFF\uFE70-\uFEFE\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFDC]/;
+REGEX_URLCHAR = new RegExp('('+/[-:@a-zA-Z0-9_.,~%+\/\\?=&#;()$]/.source+'|'+REGEX_WORDCHAR.source+')');
+REGEX_URL = new RegExp(/(?:(?:https?|s?ftp|ftps|file|smb|afp|nfs|(x-)?man|gopher|txmt):\/\/|mailto:)/.source+REGEX_URLCHAR.source+'*(?![:.,;])'+REGEX_URLCHAR.source, 'g');
+
+function padModelWriteToDB(args) {
+ /* Update tags for the pad */
+
+ var new_urls = args.pad.text().match(REGEX_URL);
+ if (new_urls == null) new_urls = new Array();
+ var new_urls_str = new_urls.join(' ')
+
+ var old_urls_row = sqlobj.selectSingle("PAD_URL_CACHE", { PAD_ID: args.padId });
+ var old_urls_str;
+ if (old_urls_row !== null)
+ old_urls_str = old_urls_row['URLS'];
+ else
+ old_urls_str = '';
+
+ // var old_urls = old_urls_str != '' ? old_urls_str.split(' ') : new Array();
+
+ if (new_urls_str != old_urls_str) {
+ // log.info({message: 'Updating urls', new_urls:new_urls, old_urls:old_urls});
+
+ if (old_urls_row)
+ sqlobj.update("PAD_URL_CACHE", {PAD_ID: args.padId }, {URLS: new_urls.join(' ')});
+ else
+ sqlobj.insert("PAD_URL_CACHE", {PAD_ID: args.padId, URLS: new_urls.join(' ')});
+
+ sqlobj.deleteRows("PAD_URL", {PAD_ID: args.padId});
+
+ for (i = 0; i < new_urls.length; i++) {
+ sqlobj.insert("PAD_URL", {PAD_ID: args.padId, URL: new_urls[i]});
+ }
+ }
+} \ No newline at end of file
diff --git a/etherpad/src/plugins/urlIndexer/main.js b/etherpad/src/plugins/urlIndexer/main.js
new file mode 100644
index 0000000..79bb019
--- /dev/null
+++ b/etherpad/src/plugins/urlIndexer/main.js
@@ -0,0 +1,32 @@
+import("etherpad.log");
+import("plugins.urlIndexer.hooks");
+import("sqlbase.sqlobj");
+import("sqlbase.sqlcommon");
+
+function init() {
+ this.hooks = ['padModelWriteToDB'];
+ this.description = 'Indexes URLs linked to in pads so that they can be displayed outside pads, searched for etc.';
+ this.padModelWriteToDB = hooks.padModelWriteToDB;
+
+ this.install = install;
+ this.uninstall = uninstall;
+}
+
+function install() {
+ log.info("Installing urlIndexer");
+
+ sqlobj.createTable('PAD_URL', {
+ PAD_ID: 'varchar(128) character set utf8 collate utf8_bin not null references PAD_META(ID)',
+ URL: 'varchar(1024) character set utf8 collate utf8_bin not null',
+ });
+
+ sqlobj.createTable('PAD_URL_CACHE', {
+ PAD_ID: 'varchar(128) character set utf8 collate utf8_bin unique not null references PAD_META(ID)',
+ URLS: 'text collate utf8_bin not null',
+ });
+}
+
+function uninstall() {
+ log.info("Uninstalling urlIndexer");
+}
+
diff --git a/etherpad/src/themes/default/templates/admin/pluginmanager.ejs b/etherpad/src/themes/default/templates/admin/pluginmanager.ejs
index 077d10a..cc47928 100644
--- a/etherpad/src/themes/default/templates/admin/pluginmanager.ejs
+++ b/etherpad/src/themes/default/templates/admin/pluginmanager.ejs
@@ -12,36 +12,9 @@ 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. */ %>
<%
+ template.inherit('page.ejs');
helpers.setHtmlTitle("EtherPad: Manage plugins");
-/*
- helpers.includeCss("plugins/twitterStyleTags/tagBrowser.css");
- helpers.includeCss("plugins/twitterStyleTags/pad.css"); */
- helpers.setBodyId("padbody");
- helpers.addBodyClass("limwidth nonpropad nonprouser");
- helpers.includeCss("pad2_ejs.css");
helpers.includeCss("admin/pluginmanager.css");
- helpers.includeJs("undo-xpopup.js");
- helpers.includeCometJs();
- helpers.includeJQuery();
- helpers.includeJs("json2.js");
- helpers.includeJs("colorutils.js");
- helpers.includeJs("ace.js");
- helpers.includeJs("collab_client.js");
- helpers.includeJs("draggable.js");
- helpers.includeJs("pad_utils.js");
- helpers.includeJs("pad_cookie.js");
- helpers.includeJs("pad_editor.js");
- helpers.includeJs("pad_userlist.js");
- helpers.includeJs("pad_editbar.js");
- helpers.includeJs("pad_chat.js");
- helpers.includeJs("pad_docbar.js");
- helpers.includeJs("pad_impexp.js");
- helpers.includeJs("pad_savedrevs.js");
- helpers.includeJs("pad_connectionstatus.js");
- helpers.includeJs("pad_modals.js");
- helpers.includeJs("pad2.js");
- helpers.suppressGA();
- helpers.setRobotsPolicy({index: false, follow: false});
function inArray(item, arr) {
for (var i = 0; i < arr.length; i++)
@@ -51,97 +24,51 @@ limitations under the License. */ %>
}
%>
-<div id="padpage">
- <div id="padtop">
- <div id="topbar">
- <div id="topbarleft"><!-- --></div>
- <div id="topbarright"><!-- --></div>
- <div id="topbarcenter"><a href="/" id="topbaretherpad">EtherPad</a></div>
- <% if (isProAccountHolder) { %>
- <div id="accountnav"><%= toHTML(account.email) %><a href="/ep/account/sign-out">(sign out)</a></div>
- <% } else if (isPro) { %>
- <div id="accountnav"><a href="<%= signinUrl %>">sign in</a></div>
- <% } %>
- </div>
- <div id="docbar" class="docbar-public">
- <div id="docbar">
- <table border="0" cellpadding="0" cellspacing="0" width="100%" id="docbartable">
- <tr>
- <td><img src="/static/img/jun09/pad/roundcorner_left.gif"></td>
- <td id="docbarpadtitle"><span>Plugin manager</span></td>
- <td width="100%">&nbsp;</td>
- <%
- plugins.callHookStr('docbarItemsAll', {}, '', '<td class="docbarbutton" nowrap>', '</td>');
- plugins.callHookStr('docbarItemsPluginManager', {}, '', '<td class="docbarbutton" nowrap>', '</td>');
- %>
- <td><img src="/static/img/jun09/pad/roundcorner_right.gif"></td>
- </tr>
- </table>
-
- </div>
- </div>
- <div id="padmain">
-
- <div id="padsidebar">
- <div id="padusers">
- </div>
+<% template.define('docBarTitle', function() { var ejs_data=''; %>
+ <td id="docbarpadtitle"><span>Plugin manager</span></td>
+<% return ejs_data; }); %>
- <div id="hdraggie"><!-- --></div>
- <div id="padchat"></div>
- </div> <!-- /padsidebar -->
-
- <div id="padeditor">
- <div id="editbar" class="enabledtoolbar">
- <div id="editbarleft"><!-- --></div>
- <div id="editbarright"><!-- --></div>
-
- <div id="editbarinner"></div>
- </div>
- <div id="editorcontainerbox">
- <div id="editorcontainer">
- <table>
- <tr>
- <th>Module name</th>
- <th>Status</th>
- <th></th>
- </tr>
- <% for (var plugin in plugins.pluginModules) { %>
- <tr>
- <td class="mousover_parent">
- <%= plugin %>
- <div class="mouseover_child">
- <%= plugins.pluginModules[plugin].description %>
- </div>
- </td>
- <td>
- <% if (plugins.plugins[plugin] !== undefined) { %>
- Installed
- <% } else { %>
- Not installed
- <% } %>
- </td>
- <td>
- <% if (plugins.plugins[plugin] !== undefined) { %>
- <a href="/ep/admin/pluginmanager/?plugin=<%= plugin %>&action=uninstall">Uninstall</a>
- <a href="/ep/admin/pluginmanager/?plugin=<%= plugin %>&action=reinstall">Reinstall</a>
- <% if (plugins.plugins[plugin].configLink !== undefined) { %>
- <a href="<%= plugins.plugins[plugin].configLink %>">Configure</a>
- <% } %>
- <% } else { %>
- <a href="/ep/admin/pluginmanager/?plugin=<%= plugin %>&action=install">Install</a>
- <% } %>
- </td>
- </tr>
- <% } %>
- </table>
- </div>
- </div>
- </div><!-- /padeditor -->
+<% template.define('docBarItems', function() { var ejs_data=''; %>
+ <%: plugins.callHookStr('docbarItemsPluginManager', {}, '', '<td class="docbarbutton">', '</td>'); %>
+<% return ejs_data; }); %>
- <div id="bottomarea">
- <div id="widthprefcheck" class="widthprefunchecked"><!-- --></div>
- <div id="sidebarcheck" class="sidebarchecked"><!-- --></div>
+<% template.define('contentArea', function() { var ejs_data=''; %>
+ <div id="editorcontainer">
+ <table>
+ <tr>
+ <th>Module name</th>
+ <th>Status</th>
+ <th></th>
+ </tr>
+ <% for (var plugin in plugins.pluginModules) { %>
+ <tr>
+ <td class="mousover_parent">
+ <%= plugin %>
+ <div class="mouseover_child">
+ <%= plugins.pluginModules[plugin].description %>
+ </div>
+ </td>
+ <td>
+ <% if (plugins.plugins[plugin] !== undefined) { %>
+ Installed
+ <% } else { %>
+ Not installed
+ <% } %>
+ </td>
+ <td>
+ <% if (plugins.plugins[plugin] !== undefined) { %>
+ <a href="/ep/admin/pluginmanager/?plugin=<%= plugin %>&action=uninstall">Uninstall</a>
+ <a href="/ep/admin/pluginmanager/?plugin=<%= plugin %>&action=reinstall">Reinstall</a>
+ <% if (plugins.plugins[plugin].configLink !== undefined) { %>
+ <a href="<%= plugins.plugins[plugin].configLink %>">Configure</a>
+ <% } %>
+ <% } else { %>
+ <a href="/ep/admin/pluginmanager/?plugin=<%= plugin %>&action=install">Install</a>
+ <% } %>
+ </td>
+ </tr>
+ <% } %>
+ </table>
</div>
- </div>
-</div>
+<% return ejs_data; }); %>
diff --git a/etherpad/src/themes/default/templates/pad/pad_body2.ejs b/etherpad/src/themes/default/templates/pad/pad_body2.ejs
index a19e685..5c886fb 100644
--- a/etherpad/src/themes/default/templates/pad/pad_body2.ejs
+++ b/etherpad/src/themes/default/templates/pad/pad_body2.ejs
@@ -14,9 +14,9 @@ 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. */ %>
-<% template.inherit('page.ejs') %>
-
<%
+ template.inherit('page.ejs');
+
helpers.setHtmlTitle("EtherPad: "+pageTitle);
helpers.includeJs("ace.js");
helpers.includeJs("collab_client.js");
@@ -54,6 +54,11 @@ limitations under the License. */ %>
%>
+<% template.define('docBarTitle', function() { var ejs_data=''; %>
+ <td id="docbarpadtitle"><span><%= initialTitle %></span></td>
+<% return ejs_data; }); %>
+
+
<% template.define('docBarTitleEditor', function() { var ejs_data=''; %>
<% if (isProAccountHolder) { %>
<div id="docbarrenamelink">
@@ -69,6 +74,7 @@ limitations under the License. */ %>
<% template.define('docBarItems', function() { var ejs_data=''; %>
+ <%: plugins.callHookStr('docbarItemsPad', {}, '', '<td class="docbarbutton">', '</td>'); %>
<% if (isProAccountHolder) { %>
<td id="docbarsecurity-outer" class="docbarbutton">
<a href="javascript:void(0)" id="docbarsecurity">
diff --git a/etherpad/src/themes/default/templates/page.ejs b/etherpad/src/themes/default/templates/page.ejs
index 7dd36ad..f28a75d 100644
--- a/etherpad/src/themes/default/templates/page.ejs
+++ b/etherpad/src/themes/default/templates/page.ejs
@@ -70,16 +70,12 @@ limitations under the License. */ %>
</div>
<div id="docbar">
- <%: template.use('docBarTitle'); %>
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="docbartable">
<tr>
<td><img src="/static/img/jun09/pad/roundcorner_left.gif"></td>
- <td id="docbarpadtitle"><span><%= initialTitle %></span></td>
+ <%: template.use('docBarTitle'); %>
<td width="100%">&nbsp;</td>
- <%
- plugins.callHookStr('docbarItemsAll', {}, '', '<td class="docbarbutton">', '</td>');
- plugins.callHookStr('docbarItemsPad', {}, '', '<td class="docbarbutton">', '</td>');
- %>
+ <%: plugins.callHookStr('docbarItemsAll', {}, '', '<td class="docbarbutton">', '</td>'); %>
<%: template.use('docBarItems'); %>
<td><img src="/static/img/jun09/pad/roundcorner_right_orange.gif"></td>
</tr>