aboutsummaryrefslogtreecommitdiffstats
path: root/etherpad/src/plugins/urlIndexer/templates/urlBrowser.ejs
blob: a254dc17a500b92d220875b2e1081dfe18345b7d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<% /* 
Copyright 2009 Google Inc.
Copyright 2010 Pita, Peter Martischka <petermartischka@googlemail.com>

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. */ %>
<%
 template.inherit('tagBrowser.ejs');
 helpers.setHtmlTitle("EtherPad: Browse URLs by tags");
 helpers.includeCss("plugins/twitterStyleTags/tagBrowser.css");
 helpers.includeCss("plugins/twitterStyleTags/pad.css");
 helpers.addToHead('\n<link rel="alternate" href="/ep/url/?query=' + tagQuery.tagsToQuery(tags, antiTags) + '&format=rss" type="application/rss+xml" title="Query results as RSS" />\n');

 function inArray(item, arr) {
   for (var i = 0; i < arr.length; i++)
     if (arr[i] == item)
       return true;
   return false;
 }
%>

<% template.define('docBarTitle', function() { var ejs_data=''; %>
  <td id="docbarpadtitle"><span>Browse URLs by tags</span></td>
<% return ejs_data; }); %>

<% template.define('queryResult', function() { var ejs_data=''; %>
 <% for (i = 0; i < matchingUrls.length; i++) { %>
 <%
      var matchingPadId = matchingUrls[i].ID;
      var matchingPadUrl = matchingPadId;
      if (!inArray('writable', matchingUrls[i].TAGS)) {
	matchingPadId = padIdToReadonly(matchingUrls[i].ID);
	matchingPadUrl = 'ep/pad/view/' + matchingPadId + '/latest';
      }
 %>
  <dt><a href="<%= matchingUrls[i].URL %>"><%= matchingUrls[i].URL %></a><dt>
  <dd>
   <a href="<%= matchingPadUrl %>"><%= matchingPadId %></a>:
   <% for (j = 0; j < matchingUrls[i].TAGS.length; j++) { %>
    <a href="/ep/url/?query=<%= tagQuery.tagsToQuery(tags.concat([matchingUrls[i].TAGS[j]]), antiTags) %>" class="padtag" title="<%= matchingUrls[i].TAGS[j] %> matches">#<%= matchingUrls[i].TAGS[j] %></a>
   <% } %>
  </dd>
 <% } %>
<% return ejs_data; }); %>