aboutsummaryrefslogtreecommitdiffstats
path: root/trunk
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--trunk/etherpad/src/etherpad/control/tag/tag_control.js9
-rw-r--r--trunk/etherpad/src/templates/tag/tag_search.ejs19
2 files changed, 26 insertions, 2 deletions
diff --git a/trunk/etherpad/src/etherpad/control/tag/tag_control.js b/trunk/etherpad/src/etherpad/control/tag/tag_control.js
index 3fe680c..d902b56 100644
--- a/trunk/etherpad/src/etherpad/control/tag/tag_control.js
+++ b/trunk/etherpad/src/etherpad/control/tag/tag_control.js
@@ -18,6 +18,7 @@ import("faststatic");
import("dispatch.{Dispatcher,PrefixMatcher,forward}");
import("etherpad.utils.*");
+import("etherpad.collab.server_utils");
import("etherpad.globals.*");
import("etherpad.log");
import("etherpad.pad.padusers");
@@ -196,12 +197,17 @@ function onRequest() {
var matchingPads;
if (tags.length > 0 || antiTags.length > 0) {
- var sql = "select p.ID from PAD_META as p, " + querySql.sql + " as q where p.ID = q.ID limit 10"
+ var sql = "select p.ID, p.TAGS from PAD_TAG_CACHE as p, " + querySql.sql + " as q where p.ID = q.ID limit 10"
matchingPads = sqlobj.executeRaw(sql, querySql.params);
} else {
matchingPads = [];
}
+ for (i = 0; i < matchingPads.length; i++) {
+ matchingPads[i].TAGS = matchingPads[i].TAGS.split('#');
+ }
+log.info({pads:matchingPads});
+
var isPro = pro_utils.isProDomainRequest();
var userId = padusers.getUserId();
@@ -221,6 +227,7 @@ function onRequest() {
renderHtml("tag/tag_search.ejs",
{
tagsToQuery: tagsToQuery,
+ padIdToReadonly: server_utils.padIdToReadonly,
tags: tags,
antiTags: antiTags,
newTags: newTags,
diff --git a/trunk/etherpad/src/templates/tag/tag_search.ejs b/trunk/etherpad/src/templates/tag/tag_search.ejs
index d7fe351..18e88e1 100644
--- a/trunk/etherpad/src/templates/tag/tag_search.ejs
+++ b/trunk/etherpad/src/templates/tag/tag_search.ejs
@@ -21,6 +21,13 @@ limitations under the License. */ %>
helpers.includeCometJs();
helpers.includeJs("json2.js");
helpers.addToHead('\n<style type="text/css" title="dynamicsyntax"></style>\n');
+
+ function inArray(item, arr) {
+ for (var i = 0; i < arr.length; i++)
+ if (arr[i] == item)
+ return true;
+ return false;
+ }
%>
<div id="padpage">
@@ -94,7 +101,17 @@ limitations under the License. */ %>
<h1>Matching pads</h1>
<ul>
<% for (i = 0; i < matchingPads.length; i++) { %>
- <li><a href="/<%= matchingPads[i].ID %>"><%= matchingPads[i].ID %></a></li>
+ <%
+ 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';
+ }
+ %>
+ <li>
+ <h2><a href="/<%= matchingPadUrl %>"><%= matchingPadId %></a><h2>
+ </li>
<% } %>
</ul>
</div>