]>
Commit | Line | Data |
---|---|---|
3f363052 | 1 | <?php |
9da07c8a | 2 | class Dlg extends Handler_Protected { |
3f363052 | 3 | private $param; |
46da73c2 | 4 | |
17f9d200 JK |
5 | function before($method) { |
6 | if (parent::before($method)) { | |
3f363052 | 7 | header("Content-Type: text/xml; charset=utf-8"); |
3972bf59 | 8 | $this->param = db_escape_string($this->link, $_REQUEST["param"]); |
3f363052 AD |
9 | print "<dlg>"; |
10 | return true; | |
11 | } | |
12 | return false; | |
13 | } | |
46da73c2 | 14 | |
3f363052 AD |
15 | function after() { |
16 | print "</dlg>"; | |
17 | } | |
18 | ||
19 | function importOpml() { | |
20 | header("Content-Type: text/html"); # required for iframe | |
46da73c2 | 21 | |
34aa9e20 AD |
22 | print __("If you have imported labels and/or filters, you might need to reload preferences to see your new data.") . "</p>"; |
23 | ||
3f363052 AD |
24 | print "<div class=\"prefFeedOPMLHolder\">"; |
25 | $owner_uid = $_SESSION["uid"]; | |
26 | ||
27 | db_query($this->link, "BEGIN"); | |
28 | ||
d75409bf | 29 | print "<ul class='nomarks'>"; |
3f363052 | 30 | |
d75409bf | 31 | $opml = new Opml($this->link, $_REQUEST); |
3f363052 | 32 | |
d75409bf | 33 | $opml->opml_import($_SESSION["uid"]); |
3f363052 | 34 | |
b77d0c4a AD |
35 | db_query($this->link, "COMMIT"); |
36 | ||
c4c74732 | 37 | print "</ul>"; |
3f363052 AD |
38 | print "</div>"; |
39 | ||
40 | print "<div align='center'>"; | |
41 | print "<button dojoType=\"dijit.form.Button\" | |
34aa9e20 | 42 | onclick=\"dijit.byId('opmlImportDlg').execute()\">". |
3f363052 AD |
43 | __('Close this window')."</button>"; |
44 | print "</div>"; | |
45 | ||
46 | print "</div>"; | |
47 | ||
48 | //return; | |
49 | } | |
50 | ||
51 | function editPrefProfiles() { | |
52 | print "<div dojoType=\"dijit.Toolbar\">"; | |
53 | ||
ddb575c7 AD |
54 | print "<div dojoType=\"dijit.form.DropDownButton\">". |
55 | "<span>" . __('Select')."</span>"; | |
56 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; | |
57 | print "<div onclick=\"selectTableRows('prefFeedProfileList', 'all')\" | |
58 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; | |
59 | print "<div onclick=\"selectTableRows('prefFeedProfileList', 'none')\" | |
60 | dojoType=\"dijit.MenuItem\">".__('None')."</div>"; | |
61 | print "</div></div>"; | |
62 | ||
63 | print "<div style=\"float : right\">"; | |
64 | ||
3f363052 AD |
65 | print "<input name=\"newprofile\" dojoType=\"dijit.form.ValidationTextBox\" |
66 | required=\"1\"> | |
67 | <button dojoType=\"dijit.form.Button\" | |
68 | onclick=\"dijit.byId('profileEditDlg').addProfile()\">". | |
69 | __('Create profile')."</button></div>"; | |
70 | ||
ddb575c7 AD |
71 | print "</div>"; |
72 | ||
3f363052 AD |
73 | $result = db_query($this->link, "SELECT title,id FROM ttrss_settings_profiles |
74 | WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title"); | |
75 | ||
76 | print "<div class=\"prefFeedCatHolder\">"; | |
77 | ||
78 | print "<form id=\"profile_edit_form\" onsubmit=\"return false\">"; | |
79 | ||
80 | print "<table width=\"100%\" class=\"prefFeedProfileList\" | |
81 | cellspacing=\"0\" id=\"prefFeedProfileList\">"; | |
82 | ||
ddb575c7 | 83 | print "<tr class=\"placeholder\" id=\"FCATR-0\">"; #odd |
3f363052 AD |
84 | |
85 | print "<td width='5%' align='center'><input | |
ddb575c7 | 86 | id='FCATC-0' |
3f363052 AD |
87 | onclick='toggleSelectRow2(this);' |
88 | dojoType=\"dijit.form.CheckBox\" | |
89 | type=\"checkbox\"></td>"; | |
90 | ||
91 | if (!$_SESSION["profile"]) { | |
92 | $is_active = __("(active)"); | |
93 | } else { | |
94 | $is_active = ""; | |
95 | } | |
96 | ||
97 | print "<td><span>" . | |
98 | __("Default profile") . " $is_active</span></td>"; | |
99 | ||
100 | print "</tr>"; | |
101 | ||
102 | $lnum = 1; | |
103 | ||
104 | while ($line = db_fetch_assoc($result)) { | |
105 | ||
106 | $class = ($lnum % 2) ? "even" : "odd"; | |
107 | ||
108 | $profile_id = $line["id"]; | |
109 | $this_row_id = "id=\"FCATR-$profile_id\""; | |
110 | ||
ddb575c7 | 111 | print "<tr class=\"placeholder\" $this_row_id>"; |
3f363052 AD |
112 | |
113 | $edit_title = htmlspecialchars($line["title"]); | |
114 | ||
115 | print "<td width='5%' align='center'><input | |
116 | onclick='toggleSelectRow2(this);' | |
ddb575c7 | 117 | id='FCATC-$profile_id' |
3f363052 AD |
118 | dojoType=\"dijit.form.CheckBox\" |
119 | type=\"checkbox\"></td>"; | |
120 | ||
121 | if ($_SESSION["profile"] == $line["id"]) { | |
122 | $is_active = __("(active)"); | |
123 | } else { | |
124 | $is_active = ""; | |
125 | } | |
126 | ||
127 | print "<td><span dojoType=\"dijit.InlineEditBox\" | |
128 | width=\"300px\" autoSave=\"false\" | |
129 | profile-id=\"$profile_id\">" . $edit_title . | |
130 | "<script type=\"dojo/method\" event=\"onChange\" args=\"item\"> | |
131 | var elem = this; | |
132 | dojo.xhrPost({ | |
133 | url: 'backend.php', | |
134 | content: {op: 'rpc', method: 'saveprofile', | |
135 | value: this.value, | |
136 | id: this.srcNodeRef.getAttribute('profile-id')}, | |
137 | load: function(response) { | |
138 | elem.attr('value', response); | |
139 | } | |
140 | }); | |
141 | </script> | |
142 | </span> $is_active</td>"; | |
143 | ||
144 | print "</tr>"; | |
145 | ||
146 | ++$lnum; | |
147 | } | |
148 | ||
149 | print "</table>"; | |
150 | print "</form>"; | |
151 | print "</div>"; | |
152 | ||
153 | print "<div class='dlgButtons'> | |
154 | <div style='float : left'> | |
155 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').removeSelected()\">". | |
156 | __('Remove selected profiles')."</button> | |
157 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').activateProfile()\">". | |
158 | __('Activate profile')."</button> | |
159 | </div>"; | |
160 | ||
161 | print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').hide()\">". | |
162 | __('Close this window')."</button>"; | |
163 | print "</div>"; | |
164 | ||
165 | } | |
166 | ||
167 | function pubOPMLUrl() { | |
168 | print "<title>".__('Public OPML URL')."</title>"; | |
169 | print "<content><![CDATA["; | |
170 | ||
50832719 | 171 | $url_path = Opml::opml_publish_url($this->link); |
3f363052 AD |
172 | |
173 | print __("Your Public OPML URL is:"); | |
174 | ||
175 | print "<div class=\"tagCloudContainer\">"; | |
176 | print "<a id='pub_opml_url' href='$url_path' target='_blank'>$url_path</a>"; | |
177 | print "</div>"; | |
178 | ||
179 | print "<div align='center'>"; | |
180 | ||
181 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return opmlRegenKey()\">". | |
182 | __('Generate new URL')."</button> "; | |
183 | ||
184 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">". | |
185 | __('Close this window')."</button>"; | |
186 | ||
187 | print "</div>"; | |
188 | print "]]></content>"; | |
189 | ||
190 | //return; | |
191 | } | |
192 | ||
193 | function explainError() { | |
194 | print "<title>".__('Notice')."</title>"; | |
195 | print "<content><![CDATA["; | |
196 | ||
197 | print "<div class=\"errorExplained\">"; | |
198 | ||
199 | if ($this->param == 1) { | |
200 | print __("Update daemon is enabled in configuration, but daemon process is not running, which prevents all feeds from updating. Please start the daemon process or contact instance owner."); | |
201 | ||
202 | $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); | |
203 | ||
204 | print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp); | |
205 | ||
206 | } | |
207 | ||
208 | if ($this->param == 3) { | |
209 | print __("Update daemon is taking too long to perform a feed update. This could indicate a problem like crash or a hang. Please check the daemon process or contact instance owner."); | |
210 | ||
211 | $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); | |
212 | ||
213 | print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp); | |
214 | ||
215 | } | |
216 | ||
217 | print "</div>"; | |
218 | ||
219 | print "<div align='center'>"; | |
220 | ||
221 | print "<button onclick=\"return closeInfoBox()\">". | |
222 | __('Close this window')."</button>"; | |
223 | ||
224 | print "</div>"; | |
225 | print "]]></content>"; | |
226 | ||
227 | //return; | |
228 | } | |
229 | ||
230 | function quickAddFeed() { | |
231 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; | |
232 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"addfeed\">"; | |
233 | ||
17525d01 | 234 | print "<div class=\"dlgSec\">".__("Feed or site URL")."</div>"; |
3f363052 AD |
235 | print "<div class=\"dlgSecCont\">"; |
236 | ||
23d2471c AD |
237 | print "<div style='float : right'> |
238 | <img style='display : none' | |
2a3b6de0 | 239 | id='feed_add_spinner' src='images/indicator_white.gif'></div>"; |
23d2471c | 240 | |
3f363052 | 241 | print "<input style=\"font-size : 16px; width : 20em;\" |
17525d01 | 242 | placeHolder=\"".__("Feed or site URL")."\" |
3f363052 AD |
243 | dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"feed\" id=\"feedDlg_feedUrl\">"; |
244 | ||
245 | print "<hr/>"; | |
246 | ||
247 | if (get_pref($this->link, 'ENABLE_FEED_CATS')) { | |
248 | print __('Place in category:') . " "; | |
249 | print_feed_cat_select($this->link, "cat", false, 'dojoType="dijit.form.Select"'); | |
250 | } | |
251 | ||
252 | print "</div>"; | |
253 | ||
254 | print '<div id="feedDlg_feedsContainer" style="display : none"> | |
255 | ||
256 | <div class="dlgSec">' . __('Available feeds') . '</div> | |
257 | <div class="dlgSecCont">'. | |
258 | '<select id="feedDlg_feedContainerSelect" | |
259 | dojoType="dijit.form.Select" size="3"> | |
260 | <script type="dojo/method" event="onChange" args="value"> | |
261 | dijit.byId("feedDlg_feedUrl").attr("value", value); | |
262 | </script> | |
263 | </select>'. | |
264 | '</div></div>'; | |
265 | ||
266 | print "<div id='feedDlg_loginContainer' style='display : none'> | |
267 | ||
268 | <div class=\"dlgSec\">".__("Authentication")."</div> | |
269 | <div class=\"dlgSecCont\">". | |
270 | ||
271 | " <input dojoType=\"dijit.form.TextBox\" name='login'\" | |
272 | placeHolder=\"".__("Login")."\" | |
273 | style=\"width : 10em;\"> ". | |
274 | " <input | |
275 | placeHolder=\"".__("Password")."\" | |
276 | dojoType=\"dijit.form.TextBox\" type='password' | |
17525d01 | 277 | style=\"width : 10em;\" name='pass'\"> |
3f363052 AD |
278 | </div></div>"; |
279 | ||
280 | ||
281 | print "<div style=\"clear : both\"> | |
aa60999b | 282 | <input type=\"checkbox\" name=\"need_auth\" dojoType=\"dijit.form.CheckBox\" id=\"feedDlg_loginCheck\" |
3f363052 AD |
283 | onclick='checkboxToggleElement(this, \"feedDlg_loginContainer\")'> |
284 | <label for=\"feedDlg_loginCheck\">". | |
285 | __('This feed requires authentication.')."</div>"; | |
286 | ||
287 | print "</form>"; | |
288 | ||
289 | print "<div class=\"dlgButtons\"> | |
c39befac AD |
290 | <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').execute()\">".__('Subscribe')."</button>"; |
291 | ||
292 | if (!(defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER)) { | |
293 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return feedBrowser()\">".__('More feeds')."</button>"; | |
294 | } | |
295 | ||
296 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').hide()\">".__('Cancel')."</button> | |
3f363052 AD |
297 | </div>"; |
298 | ||
299 | //return; | |
300 | } | |
301 | ||
302 | function feedBrowser() { | |
c39befac AD |
303 | if (defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER) return; |
304 | ||
3972bf59 | 305 | $browser_search = db_escape_string($this->link, $_REQUEST["search"]); |
3f363052 AD |
306 | |
307 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; | |
308 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"updateFeedBrowser\">"; | |
309 | ||
310 | print "<div dojoType=\"dijit.Toolbar\"> | |
311 | <div style='float : right'> | |
312 | <img style='display : none' | |
2a3b6de0 | 313 | id='feed_browser_spinner' src='images/indicator_white.gif'> |
3f363052 AD |
314 | <input name=\"search\" dojoType=\"dijit.form.TextBox\" size=\"20\" type=\"search\" |
315 | onchange=\"dijit.byId('feedBrowserDlg').update()\" value=\"$browser_search\"> | |
316 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').update()\">".__('Search')."</button> | |
317 | </div>"; | |
318 | ||
319 | print " <select name=\"mode\" dojoType=\"dijit.form.Select\" onchange=\"dijit.byId('feedBrowserDlg').update()\"> | |
320 | <option value='1'>" . __('Popular feeds') . "</option> | |
321 | <option value='2'>" . __('Feed archive') . "</option> | |
322 | </select> "; | |
323 | ||
324 | print __("limit:"); | |
325 | ||
326 | print " <select dojoType=\"dijit.form.Select\" name=\"limit\" onchange=\"dijit.byId('feedBrowserDlg').update()\">"; | |
327 | ||
328 | foreach (array(25, 50, 100, 200) as $l) { | |
329 | $issel = ($l == $limit) ? "selected=\"1\"" : ""; | |
330 | print "<option $issel value=\"$l\">$l</option>"; | |
331 | } | |
332 | ||
333 | print "</select> "; | |
334 | ||
335 | print "</div>"; | |
336 | ||
337 | $owner_uid = $_SESSION["uid"]; | |
338 | ||
55c7f092 AD |
339 | require_once "feedbrowser.php"; |
340 | ||
3f363052 AD |
341 | print "<ul class='browseFeedList' id='browseFeedList'>"; |
342 | print make_feed_browser($this->link, $search, 25); | |
343 | print "</ul>"; | |
344 | ||
345 | print "<div align='center'> | |
346 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').execute()\">".__('Subscribe')."</button> | |
347 | <button dojoType=\"dijit.form.Button\" style='display : none' id='feed_archive_remove' onclick=\"dijit.byId('feedBrowserDlg').removeFromArchive()\">".__('Remove')."</button> | |
348 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').hide()\" >".__('Cancel')."</button></div>"; | |
349 | ||
350 | } | |
351 | ||
352 | function search() { | |
3972bf59 | 353 | $this->params = explode(":", db_escape_string($this->link, $_REQUEST["param"]), 2); |
3f363052 AD |
354 | |
355 | $active_feed_id = sprintf("%d", $this->params[0]); | |
356 | $is_cat = $this->params[1] != "false"; | |
357 | ||
358 | print "<div class=\"dlgSec\">".__('Look for')."</div>"; | |
359 | ||
360 | print "<div class=\"dlgSecCont\">"; | |
361 | ||
a8c18025 AD |
362 | print "<input dojoType=\"dijit.form.ValidationTextBox\" |
363 | style=\"font-size : 16px; width : 20em;\" | |
364 | required=\"1\" name=\"query\" type=\"search\" value=''>"; | |
3f363052 AD |
365 | |
366 | print "<hr/>".__('Limit search to:')." "; | |
367 | ||
368 | print "<select name=\"search_mode\" dojoType=\"dijit.form.Select\"> | |
369 | <option value=\"all_feeds\">".__('All feeds')."</option>"; | |
370 | ||
371 | $feed_title = getFeedTitle($this->link, $active_feed_id); | |
372 | ||
373 | if (!$is_cat) { | |
374 | $feed_cat_title = getFeedCatTitle($this->link, $active_feed_id); | |
375 | } else { | |
376 | $feed_cat_title = getCategoryTitle($this->link, $active_feed_id); | |
377 | } | |
378 | ||
379 | if ($active_feed_id && !$is_cat) { | |
380 | print "<option selected=\"1\" value=\"this_feed\">$feed_title</option>"; | |
381 | } else { | |
382 | print "<option disabled=\"1\" value=\"false\">".__('This feed')."</option>"; | |
383 | } | |
384 | ||
385 | if ($is_cat) { | |
386 | $cat_preselected = "selected=\"1\""; | |
387 | } | |
388 | ||
389 | if (get_pref($this->link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 || $is_cat)) { | |
390 | print "<option $cat_preselected value=\"this_cat\">$feed_cat_title</option>"; | |
391 | } else { | |
392 | //print "<option disabled>".__('This category')."</option>"; | |
393 | } | |
394 | ||
395 | print "</select>"; | |
396 | ||
397 | print "</div>"; | |
398 | ||
399 | print "<div class=\"dlgButtons\">"; | |
400 | ||
401 | if (!SPHINX_ENABLED) { | |
402 | print "<div style=\"float : left\"> | |
e8438e8f | 403 | <a class=\"visibleLink\" target=\"_blank\" href=\"http://tt-rss.org/wiki/SearchSyntax\">Search syntax</a> |
3f363052 AD |
404 | </div>"; |
405 | } | |
406 | ||
407 | print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').execute()\">".__('Search')."</button> | |
408 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').hide()\">".__('Cancel')."</button> | |
409 | </div>"; | |
410 | } | |
411 | ||
3f363052 AD |
412 | function editArticleTags() { |
413 | ||
414 | print __("Tags for this article (separated by commas):")."<br>"; | |
415 | ||
416 | $tags = get_article_tags($this->link, $this->param); | |
417 | ||
418 | $tags_str = join(", ", $tags); | |
419 | ||
420 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$this->param\">"; | |
421 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; | |
422 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setArticleTags\">"; | |
423 | ||
424 | print "<table width='100%'><tr><td>"; | |
425 | ||
426 | print "<textarea dojoType=\"dijit.form.SimpleTextarea\" rows='4' | |
427 | style='font-size : 12px; width : 100%' id=\"tags_str\" | |
428 | name='tags_str'>$tags_str</textarea> | |
429 | <div class=\"autocomplete\" id=\"tags_choices\" | |
430 | style=\"display:none\"></div>"; | |
431 | ||
432 | print "</td></tr></table>"; | |
433 | ||
434 | print "<div class='dlgButtons'>"; | |
435 | ||
436 | print "<button dojoType=\"dijit.form.Button\" | |
437 | onclick=\"dijit.byId('editTagsDlg').execute()\">".__('Save')."</button> "; | |
438 | print "<button dojoType=\"dijit.form.Button\" | |
439 | onclick=\"dijit.byId('editTagsDlg').hide()\">".__('Cancel')."</button>"; | |
440 | print "</div>"; | |
441 | ||
442 | } | |
443 | ||
444 | function printTagCloud() { | |
445 | print "<title>".__('Tag Cloud')."</title>"; | |
446 | print "<content><![CDATA["; | |
447 | ||
448 | print "<div class=\"tagCloudContainer\">"; | |
449 | ||
79178062 AD |
450 | // from here: http://www.roscripts.com/Create_tag_cloud-71.html |
451 | ||
452 | $query = "SELECT tag_name, COUNT(post_int_id) AS count | |
453 | FROM ttrss_tags WHERE owner_uid = ".$_SESSION["uid"]." | |
454 | GROUP BY tag_name ORDER BY count DESC LIMIT 50"; | |
455 | ||
456 | $result = db_query($this->link, $query); | |
457 | ||
458 | $tags = array(); | |
459 | ||
460 | while ($line = db_fetch_assoc($result)) { | |
461 | $tags[$line["tag_name"]] = $line["count"]; | |
462 | } | |
463 | ||
464 | if( count($tags) == 0 ){ return; } | |
465 | ||
466 | ksort($tags); | |
467 | ||
468 | $max_size = 32; // max font size in pixels | |
469 | $min_size = 11; // min font size in pixels | |
470 | ||
471 | // largest and smallest array values | |
472 | $max_qty = max(array_values($tags)); | |
473 | $min_qty = min(array_values($tags)); | |
474 | ||
475 | // find the range of values | |
476 | $spread = $max_qty - $min_qty; | |
477 | if ($spread == 0) { // we don't want to divide by zero | |
478 | $spread = 1; | |
479 | } | |
480 | ||
481 | // set the font-size increment | |
482 | $step = ($max_size - $min_size) / ($spread); | |
483 | ||
484 | // loop through the tag array | |
485 | foreach ($tags as $key => $value) { | |
486 | // calculate font-size | |
487 | // find the $value in excess of $min_qty | |
488 | // multiply by the font-size increment ($size) | |
489 | // and add the $min_size set above | |
490 | $size = round($min_size + (($value - $min_qty) * $step)); | |
491 | ||
492 | $key_escaped = str_replace("'", "\\'", $key); | |
493 | ||
494 | echo "<a href=\"javascript:viewfeed('$key_escaped') \" style=\"font-size: " . | |
495 | $size . "px\" title=\"$value articles tagged with " . | |
496 | $key . '">' . $key . '</a> '; | |
497 | } | |
498 | ||
499 | ||
3f363052 AD |
500 | |
501 | print "</div>"; | |
502 | ||
503 | print "<div align='center'>"; | |
504 | print "<button dojoType=\"dijit.form.Button\" | |
505 | onclick=\"return closeInfoBox()\">". | |
506 | __('Close this window')."</button>"; | |
507 | print "</div>"; | |
508 | ||
509 | print "]]></content>"; | |
510 | } | |
511 | ||
512 | function printTagSelect() { | |
46da73c2 | 513 | |
3f363052 AD |
514 | print "<title>" . __('Select item(s) by tags') . "</title>"; |
515 | print "<content><![CDATA["; | |
516 | ||
517 | print __("Match:"). " " . | |
7b28a986 AD |
518 | "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" checked value=\"any\" name=\"tag_mode\" id=\"tag_mode_any\">"; |
519 | print "<label for=\"tag_mode_any\">".__("Any")."</label>"; | |
520 | print " "; | |
521 | print "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" value=\"all\" name=\"tag_mode\" id=\"tag_mode_all\">"; | |
522 | print "<label for=\"tag_mode_all\">".__("All tags.")."</input>"; | |
3f363052 AD |
523 | |
524 | print "<select id=\"all_tags\" name=\"all_tags\" title=\"" . __('Which Tags?') . "\" multiple=\"multiple\" size=\"10\" style=\"width : 100%\">"; | |
525 | $result = db_query($this->link, "SELECT DISTINCT tag_name FROM ttrss_tags WHERE owner_uid = ".$_SESSION['uid']." | |
526 | AND LENGTH(tag_name) <= 30 ORDER BY tag_name ASC"); | |
527 | ||
528 | while ($row = db_fetch_assoc($result)) { | |
529 | $tmp = htmlspecialchars($row["tag_name"]); | |
530 | print "<option value=\"" . str_replace(" ", "%20", $tmp) . "\">$tmp</option>"; | |
531 | } | |
532 | ||
533 | print "</select>"; | |
534 | ||
535 | print "<div align='right'>"; | |
536 | print "<button dojoType=\"dijit.form.Button\" onclick=\"viewfeed(get_all_tags($('all_tags')), | |
537 | get_radio_checked($('tag_mode')));\">" . __('Display entries') . "</button>"; | |
538 | print " "; | |
539 | print "<button dojoType=\"dijit.form.Button\" | |
540 | onclick=\"return closeInfoBox()\">" . | |
541 | __('Close this window') . "</button>"; | |
542 | print "</div>"; | |
543 | ||
544 | print "]]></content>"; | |
545 | } | |
546 | ||
3f363052 | 547 | function generatedFeed() { |
46da73c2 | 548 | |
3f363052 AD |
549 | print "<title>".__('View as RSS')."</title>"; |
550 | print "<content><![CDATA["; | |
551 | ||
552 | $this->params = explode(":", $this->param, 3); | |
3972bf59 | 553 | $feed_id = db_escape_string($this->link, $this->params[0]); |
3f363052 AD |
554 | $is_cat = (bool) $this->params[1]; |
555 | ||
556 | $key = get_feed_access_key($this->link, $feed_id, $is_cat); | |
557 | ||
558 | $url_path = htmlspecialchars($this->params[2]) . "&key=" . $key; | |
559 | ||
ca6a0741 | 560 | print "<div class=\"dialogNotice\">" . __("You can view this feed as RSS using the following URL:") . "</div>"; |
3f363052 AD |
561 | |
562 | print "<div class=\"tagCloudContainer\">"; | |
563 | print "<a id='gen_feed_url' href='$url_path' target='_blank'>$url_path</a>"; | |
564 | print "</div>"; | |
565 | ||
566 | print "<div align='center'>"; | |
567 | ||
568 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return genUrlChangeKey('$feed_id', '$is_cat')\">". | |
569 | __('Generate new URL')."</button> "; | |
570 | ||
571 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">". | |
572 | __('Close this window')."</button>"; | |
573 | ||
574 | print "</div>"; | |
575 | print "]]></content>"; | |
576 | ||
577 | //return; | |
578 | } | |
579 | ||
580 | function newVersion() { | |
46da73c2 | 581 | |
3f363052 AD |
582 | $version_data = check_for_update($this->link); |
583 | $version = $version_data['version']; | |
584 | $id = $version_data['version_id']; | |
585 | ||
ed47e3c4 AD |
586 | if ($version && $id) { |
587 | print "<div class='tagCloudContainer'>"; | |
3f363052 | 588 | |
ed47e3c4 AD |
589 | print T_sprintf("New version of Tiny Tiny RSS is available (%s).", |
590 | "<b>$version</b>"); | |
3f363052 | 591 | |
ed47e3c4 | 592 | print "</div>"; |
3f363052 | 593 | |
ed47e3c4 AD |
594 | $details = "http://tt-rss.org/redmine/versions/$id"; |
595 | $download = "http://tt-rss.org/#Download"; | |
3f363052 | 596 | |
ed47e3c4 | 597 | print "<p align='center'>".__("You can update using built-in updater in the Preferences or by using update.php")."</p>"; |
366f06f7 | 598 | |
ed47e3c4 AD |
599 | print "<div style='text-align : center'>"; |
600 | print "<button dojoType=\"dijit.form.Button\" | |
2e828a4a | 601 | onclick=\"return window.open('$details')\">".__("See the release notes")."</button>"; |
ed47e3c4 AD |
602 | print "<button dojoType=\"dijit.form.Button\" |
603 | onclick=\"return window.open('$download')\">".__("Download")."</button>"; | |
604 | print "<button dojoType=\"dijit.form.Button\" | |
605 | onclick=\"return dijit.byId('newVersionDlg').hide()\">". | |
606 | __('Close this window')."</button>"; | |
607 | ||
608 | } else { | |
609 | print "<div class='tagCloudContainer'>"; | |
610 | ||
611 | print "<p align='center'>".__("Error receiving version information or no new version available.")."</p>"; | |
612 | ||
613 | print "</div>"; | |
614 | ||
615 | print "<div style='text-align : center'>"; | |
616 | print "<button dojoType=\"dijit.form.Button\" | |
617 | onclick=\"return dijit.byId('newVersionDlg').hide()\">". | |
618 | __('Close this window')."</button>"; | |
619 | print "</div>"; | |
620 | ||
621 | } | |
3f363052 AD |
622 | print "</div>"; |
623 | ||
624 | } | |
625 | ||
626 | function customizeCSS() { | |
627 | $value = get_pref($this->link, "USER_STYLESHEET"); | |
628 | ||
629 | $value = str_replace("<br/>", "\n", $value); | |
630 | ||
ca6a0741 | 631 | print "<div class=\"dialogNotice\">"; |
3f363052 | 632 | print T_sprintf("You can override colors, fonts and layout of your currently selected theme with custom CSS declarations here. <a target=\"_blank\" class=\"visibleLink\" href=\"%s\">This file</a> can be used as a baseline.", "tt-rss.css"); |
ca6a0741 | 633 | print "</div>"; |
3f363052 AD |
634 | |
635 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; | |
636 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setpref\">"; | |
637 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"key\" value=\"USER_STYLESHEET\">"; | |
638 | ||
639 | print "<table width='100%'><tr><td>"; | |
640 | print "<textarea dojoType=\"dijit.form.SimpleTextarea\" | |
641 | style='font-size : 12px; width : 100%; height: 200px;' | |
642 | placeHolder='body#ttrssMain { font-size : 14px; };' | |
643 | name='value'>$value</textarea>"; | |
644 | print "</td></tr></table>"; | |
645 | ||
646 | print "<div class='dlgButtons'>"; | |
647 | print "<button dojoType=\"dijit.form.Button\" | |
648 | onclick=\"dijit.byId('cssEditDlg').execute()\">".__('Save')."</button> "; | |
649 | print "<button dojoType=\"dijit.form.Button\" | |
650 | onclick=\"dijit.byId('cssEditDlg').hide()\">".__('Cancel')."</button>"; | |
651 | print "</div>"; | |
652 | ||
653 | } | |
654 | ||
3f363052 AD |
655 | function addInstance() { |
656 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-instances\">"; | |
657 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"add\">"; | |
658 | ||
659 | print "<div class=\"dlgSec\">".__("Instance")."</div>"; | |
660 | ||
661 | print "<div class=\"dlgSecCont\">"; | |
662 | ||
663 | /* URL */ | |
664 | ||
665 | print __("URL:") . " "; | |
666 | ||
667 | print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" | |
668 | placeHolder=\"".__("Instance URL")."\" | |
669 | regExp='^(http|https)://.*' | |
670 | style=\"font-size : 16px; width: 20em\" name=\"access_url\">"; | |
671 | ||
672 | print "<hr/>"; | |
673 | ||
674 | $access_key = sha1(uniqid(rand(), true)); | |
675 | ||
676 | /* Access key */ | |
677 | ||
678 | print __("Access key:") . " "; | |
679 | ||
680 | print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" | |
681 | placeHolder=\"".__("Access key")."\" regExp='\w{40}' | |
682 | style=\"width: 20em\" name=\"access_key\" id=\"instance_add_key\" | |
683 | value=\"$access_key\">"; | |
684 | ||
685 | print "<p class='insensitive'>" . __("Use one access key for both linked instances."); | |
686 | ||
687 | print "</div>"; | |
688 | ||
689 | print "<div class=\"dlgButtons\"> | |
690 | <div style='float : left'> | |
691 | <button dojoType=\"dijit.form.Button\" | |
692 | onclick=\"return dijit.byId('instanceAddDlg').regenKey()\">". | |
693 | __('Generate new key')."</button> | |
694 | </div> | |
695 | <button dojoType=\"dijit.form.Button\" | |
696 | onclick=\"return dijit.byId('instanceAddDlg').execute()\">". | |
697 | __('Create link')."</button> | |
698 | <button dojoType=\"dijit.form.Button\" | |
699 | onclick=\"return dijit.byId('instanceAddDlg').hide()\"\">". | |
700 | __('Cancel')."</button></div>"; | |
701 | ||
702 | return; | |
703 | } | |
704 | ||
33f0fdd0 AD |
705 | function batchSubscribe() { |
706 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; | |
707 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"batchaddfeeds\">"; | |
708 | ||
709 | print "<table width='100%'><tr><td> | |
710 | ".__("Add one valid RSS feed per line (no feed detection is done)")." | |
711 | </td><td align='right'>"; | |
712 | if (get_pref($this->link, 'ENABLE_FEED_CATS')) { | |
713 | print __('Place in category:') . " "; | |
714 | print_feed_cat_select($this->link, "cat", false, 'dojoType="dijit.form.Select"'); | |
715 | } | |
716 | print "</td></tr><tr><td colspan='2'>"; | |
717 | print "<textarea | |
718 | style='font-size : 12px; width : 100%; height: 200px;' | |
719 | placeHolder=\"".__("Feeds to subscribe, One per line")."\" | |
720 | dojoType=\"dijit.form.SimpleTextarea\" required=\"1\" name=\"feeds\"></textarea>"; | |
721 | ||
722 | print "</td></tr><tr><td colspan='2'>"; | |
723 | ||
724 | print "<div id='feedDlg_loginContainer' style='display : none'> | |
725 | " . | |
726 | " <input dojoType=\"dijit.form.TextBox\" name='login'\" | |
727 | placeHolder=\"".__("Login")."\" | |
728 | style=\"width : 10em;\"> ". | |
729 | " <input | |
730 | placeHolder=\"".__("Password")."\" | |
731 | dojoType=\"dijit.form.TextBox\" type='password' | |
732 | style=\"width : 10em;\" name='pass'\">". | |
7ac3f735 | 733 | "</div>"; |
33f0fdd0 AD |
734 | |
735 | print "</td></tr><tr><td colspan='2'>"; | |
736 | ||
737 | print "<div style=\"clear : both\"> | |
738 | <input type=\"checkbox\" name=\"need_auth\" dojoType=\"dijit.form.CheckBox\" id=\"feedDlg_loginCheck\" | |
739 | onclick='checkboxToggleElement(this, \"feedDlg_loginContainer\")'> | |
740 | <label for=\"feedDlg_loginCheck\">". | |
741 | __('Feeds require authentication.')."</div>"; | |
742 | ||
743 | print "</form>"; | |
744 | ||
745 | print "</td></tr></table>"; | |
746 | ||
747 | print "<div class=\"dlgButtons\"> | |
748 | <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('batchSubDlg').execute()\">".__('Subscribe')."</button> | |
749 | <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('batchSubDlg').hide()\">".__('Cancel')."</button> | |
750 | </div>"; | |
751 | } | |
752 | ||
3f363052 AD |
753 | } |
754 | ?> |