]> git.wh0rd.org - tt-rss.git/blob - classes/dlg.php
move some more functions out of functions.php; fix opml.php failing due to redeclared...
[tt-rss.git] / classes / dlg.php
1 <?php
2 class Dlg extends Handler_Protected {
3 private $param;
4
5 function before($method) {
6 if (parent::before($method)) {
7 header("Content-Type: text/xml; charset=utf-8");
8 $this->param = db_escape_string($_REQUEST["param"]);
9 print "<dlg>";
10 return true;
11 }
12 return false;
13 }
14
15 function after() {
16 print "</dlg>";
17 }
18
19 function importOpml() {
20 header("Content-Type: text/html"); # required for iframe
21
22 print __("If you have imported labels and/or filters, you might need to reload preferences to see your new data.") . "</p>";
23
24 print "<div class=\"prefFeedOPMLHolder\">";
25 $owner_uid = $_SESSION["uid"];
26
27 db_query($this->link, "BEGIN");
28
29 print "<ul class='nomarks'>";
30
31 $opml = new Opml($this->link, $_REQUEST);
32
33 $opml->opml_import($_SESSION["uid"]);
34
35 db_query($this->link, "COMMIT");
36
37 print "</ul>";
38 print "</div>";
39
40 print "<div align='center'>";
41 print "<button dojoType=\"dijit.form.Button\"
42 onclick=\"dijit.byId('opmlImportDlg').execute()\">".
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
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
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
71 print "</div>";
72
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
83 print "<tr class=\"placeholder\" id=\"FCATR-0\">"; #odd
84
85 print "<td width='5%' align='center'><input
86 id='FCATC-0'
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
111 print "<tr class=\"placeholder\" $this_row_id>";
112
113 $edit_title = htmlspecialchars($line["title"]);
114
115 print "<td width='5%' align='center'><input
116 onclick='toggleSelectRow2(this);'
117 id='FCATC-$profile_id'
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
171 $url_path = Opml::opml_publish_url($this->link);
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
234 print "<div class=\"dlgSec\">".__("Feed or site URL")."</div>";
235 print "<div class=\"dlgSecCont\">";
236
237 print "<div style='float : right'>
238 <img style='display : none'
239 id='feed_add_spinner' src='".
240 theme_image($this->link, 'images/indicator_white.gif')."'></div>";
241
242 print "<input style=\"font-size : 16px; width : 20em;\"
243 placeHolder=\"".__("Feed or site URL")."\"
244 dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"feed\" id=\"feedDlg_feedUrl\">";
245
246 print "<hr/>";
247
248 if (get_pref($this->link, 'ENABLE_FEED_CATS')) {
249 print __('Place in category:') . " ";
250 print_feed_cat_select($this->link, "cat", false, 'dojoType="dijit.form.Select"');
251 }
252
253 print "</div>";
254
255 print '<div id="feedDlg_feedsContainer" style="display : none">
256
257 <div class="dlgSec">' . __('Available feeds') . '</div>
258 <div class="dlgSecCont">'.
259 '<select id="feedDlg_feedContainerSelect"
260 dojoType="dijit.form.Select" size="3">
261 <script type="dojo/method" event="onChange" args="value">
262 dijit.byId("feedDlg_feedUrl").attr("value", value);
263 </script>
264 </select>'.
265 '</div></div>';
266
267 print "<div id='feedDlg_loginContainer' style='display : none'>
268
269 <div class=\"dlgSec\">".__("Authentication")."</div>
270 <div class=\"dlgSecCont\">".
271
272 " <input dojoType=\"dijit.form.TextBox\" name='login'\"
273 placeHolder=\"".__("Login")."\"
274 style=\"width : 10em;\"> ".
275 " <input
276 placeHolder=\"".__("Password")."\"
277 dojoType=\"dijit.form.TextBox\" type='password'
278 style=\"width : 10em;\" name='pass'\">
279 </div></div>";
280
281
282 print "<div style=\"clear : both\">
283 <input type=\"checkbox\" name=\"need_auth\" dojoType=\"dijit.form.CheckBox\" id=\"feedDlg_loginCheck\"
284 onclick='checkboxToggleElement(this, \"feedDlg_loginContainer\")'>
285 <label for=\"feedDlg_loginCheck\">".
286 __('This feed requires authentication.')."</div>";
287
288 print "</form>";
289
290 print "<div class=\"dlgButtons\">
291 <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').execute()\">".__('Subscribe')."</button>";
292
293 if (!(defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER)) {
294 print "<button dojoType=\"dijit.form.Button\" onclick=\"return feedBrowser()\">".__('More feeds')."</button>";
295 }
296
297 print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').hide()\">".__('Cancel')."</button>
298 </div>";
299
300 //return;
301 }
302
303 function feedBrowser() {
304 if (defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER) return;
305
306 $browser_search = db_escape_string($_REQUEST["search"]);
307
308 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
309 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"updateFeedBrowser\">";
310
311 print "<div dojoType=\"dijit.Toolbar\">
312 <div style='float : right'>
313 <img style='display : none'
314 id='feed_browser_spinner' src='".
315 theme_image($this->link, 'images/indicator_white.gif')."'>
316 <input name=\"search\" dojoType=\"dijit.form.TextBox\" size=\"20\" type=\"search\"
317 onchange=\"dijit.byId('feedBrowserDlg').update()\" value=\"$browser_search\">
318 <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').update()\">".__('Search')."</button>
319 </div>";
320
321 print " <select name=\"mode\" dojoType=\"dijit.form.Select\" onchange=\"dijit.byId('feedBrowserDlg').update()\">
322 <option value='1'>" . __('Popular feeds') . "</option>
323 <option value='2'>" . __('Feed archive') . "</option>
324 </select> ";
325
326 print __("limit:");
327
328 print " <select dojoType=\"dijit.form.Select\" name=\"limit\" onchange=\"dijit.byId('feedBrowserDlg').update()\">";
329
330 foreach (array(25, 50, 100, 200) as $l) {
331 $issel = ($l == $limit) ? "selected=\"1\"" : "";
332 print "<option $issel value=\"$l\">$l</option>";
333 }
334
335 print "</select> ";
336
337 print "</div>";
338
339 $owner_uid = $_SESSION["uid"];
340
341 require_once "feedbrowser.php";
342
343 print "<ul class='browseFeedList' id='browseFeedList'>";
344 print make_feed_browser($this->link, $search, 25);
345 print "</ul>";
346
347 print "<div align='center'>
348 <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').execute()\">".__('Subscribe')."</button>
349 <button dojoType=\"dijit.form.Button\" style='display : none' id='feed_archive_remove' onclick=\"dijit.byId('feedBrowserDlg').removeFromArchive()\">".__('Remove')."</button>
350 <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').hide()\" >".__('Cancel')."</button></div>";
351
352 }
353
354 function search() {
355 $this->params = explode(":", db_escape_string($_REQUEST["param"]), 2);
356
357 $active_feed_id = sprintf("%d", $this->params[0]);
358 $is_cat = $this->params[1] != "false";
359
360 print "<div class=\"dlgSec\">".__('Look for')."</div>";
361
362 print "<div class=\"dlgSecCont\">";
363
364 print "<input dojoType=\"dijit.form.ValidationTextBox\"
365 style=\"font-size : 16px; width : 20em;\"
366 required=\"1\" name=\"query\" type=\"search\" value=''>";
367
368 print "<hr/>".__('Limit search to:')." ";
369
370 print "<select name=\"search_mode\" dojoType=\"dijit.form.Select\">
371 <option value=\"all_feeds\">".__('All feeds')."</option>";
372
373 $feed_title = getFeedTitle($this->link, $active_feed_id);
374
375 if (!$is_cat) {
376 $feed_cat_title = getFeedCatTitle($this->link, $active_feed_id);
377 } else {
378 $feed_cat_title = getCategoryTitle($this->link, $active_feed_id);
379 }
380
381 if ($active_feed_id && !$is_cat) {
382 print "<option selected=\"1\" value=\"this_feed\">$feed_title</option>";
383 } else {
384 print "<option disabled=\"1\" value=\"false\">".__('This feed')."</option>";
385 }
386
387 if ($is_cat) {
388 $cat_preselected = "selected=\"1\"";
389 }
390
391 if (get_pref($this->link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 || $is_cat)) {
392 print "<option $cat_preselected value=\"this_cat\">$feed_cat_title</option>";
393 } else {
394 //print "<option disabled>".__('This category')."</option>";
395 }
396
397 print "</select>";
398
399 print "</div>";
400
401 print "<div class=\"dlgButtons\">";
402
403 if (!SPHINX_ENABLED) {
404 print "<div style=\"float : left\">
405 <a class=\"visibleLink\" target=\"_blank\" href=\"http://tt-rss.org/wiki/SearchSyntax\">Search syntax</a>
406 </div>";
407 }
408
409 print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').execute()\">".__('Search')."</button>
410 <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').hide()\">".__('Cancel')."</button>
411 </div>";
412 }
413
414 function editArticleTags() {
415
416 print __("Tags for this article (separated by commas):")."<br>";
417
418 $tags = get_article_tags($this->link, $this->param);
419
420 $tags_str = join(", ", $tags);
421
422 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$this->param\">";
423 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
424 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setArticleTags\">";
425
426 print "<table width='100%'><tr><td>";
427
428 print "<textarea dojoType=\"dijit.form.SimpleTextarea\" rows='4'
429 style='font-size : 12px; width : 100%' id=\"tags_str\"
430 name='tags_str'>$tags_str</textarea>
431 <div class=\"autocomplete\" id=\"tags_choices\"
432 style=\"display:none\"></div>";
433
434 print "</td></tr></table>";
435
436 print "<div class='dlgButtons'>";
437
438 print "<button dojoType=\"dijit.form.Button\"
439 onclick=\"dijit.byId('editTagsDlg').execute()\">".__('Save')."</button> ";
440 print "<button dojoType=\"dijit.form.Button\"
441 onclick=\"dijit.byId('editTagsDlg').hide()\">".__('Cancel')."</button>";
442 print "</div>";
443
444 }
445
446 function printTagCloud() {
447 print "<title>".__('Tag Cloud')."</title>";
448 print "<content><![CDATA[";
449
450 print "<div class=\"tagCloudContainer\">";
451
452 // from here: http://www.roscripts.com/Create_tag_cloud-71.html
453
454 $query = "SELECT tag_name, COUNT(post_int_id) AS count
455 FROM ttrss_tags WHERE owner_uid = ".$_SESSION["uid"]."
456 GROUP BY tag_name ORDER BY count DESC LIMIT 50";
457
458 $result = db_query($this->link, $query);
459
460 $tags = array();
461
462 while ($line = db_fetch_assoc($result)) {
463 $tags[$line["tag_name"]] = $line["count"];
464 }
465
466 if( count($tags) == 0 ){ return; }
467
468 ksort($tags);
469
470 $max_size = 32; // max font size in pixels
471 $min_size = 11; // min font size in pixels
472
473 // largest and smallest array values
474 $max_qty = max(array_values($tags));
475 $min_qty = min(array_values($tags));
476
477 // find the range of values
478 $spread = $max_qty - $min_qty;
479 if ($spread == 0) { // we don't want to divide by zero
480 $spread = 1;
481 }
482
483 // set the font-size increment
484 $step = ($max_size - $min_size) / ($spread);
485
486 // loop through the tag array
487 foreach ($tags as $key => $value) {
488 // calculate font-size
489 // find the $value in excess of $min_qty
490 // multiply by the font-size increment ($size)
491 // and add the $min_size set above
492 $size = round($min_size + (($value - $min_qty) * $step));
493
494 $key_escaped = str_replace("'", "\\'", $key);
495
496 echo "<a href=\"javascript:viewfeed('$key_escaped') \" style=\"font-size: " .
497 $size . "px\" title=\"$value articles tagged with " .
498 $key . '">' . $key . '</a> ';
499 }
500
501
502
503 print "</div>";
504
505 print "<div align='center'>";
506 print "<button dojoType=\"dijit.form.Button\"
507 onclick=\"return closeInfoBox()\">".
508 __('Close this window')."</button>";
509 print "</div>";
510
511 print "]]></content>";
512 }
513
514 function printTagSelect() {
515
516 print "<title>" . __('Select item(s) by tags') . "</title>";
517 print "<content><![CDATA[";
518
519 print __("Match:"). "&nbsp;" .
520 "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" checked value=\"any\" name=\"tag_mode\" id=\"tag_mode_any\">";
521 print "<label for=\"tag_mode_any\">".__("Any")."</label>";
522 print "&nbsp;";
523 print "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" value=\"all\" name=\"tag_mode\" id=\"tag_mode_all\">";
524 print "<label for=\"tag_mode_all\">".__("All tags.")."</input>";
525
526 print "<select id=\"all_tags\" name=\"all_tags\" title=\"" . __('Which Tags?') . "\" multiple=\"multiple\" size=\"10\" style=\"width : 100%\">";
527 $result = db_query($this->link, "SELECT DISTINCT tag_name FROM ttrss_tags WHERE owner_uid = ".$_SESSION['uid']."
528 AND LENGTH(tag_name) <= 30 ORDER BY tag_name ASC");
529
530 while ($row = db_fetch_assoc($result)) {
531 $tmp = htmlspecialchars($row["tag_name"]);
532 print "<option value=\"" . str_replace(" ", "%20", $tmp) . "\">$tmp</option>";
533 }
534
535 print "</select>";
536
537 print "<div align='right'>";
538 print "<button dojoType=\"dijit.form.Button\" onclick=\"viewfeed(get_all_tags($('all_tags')),
539 get_radio_checked($('tag_mode')));\">" . __('Display entries') . "</button>";
540 print "&nbsp;";
541 print "<button dojoType=\"dijit.form.Button\"
542 onclick=\"return closeInfoBox()\">" .
543 __('Close this window') . "</button>";
544 print "</div>";
545
546 print "]]></content>";
547 }
548
549 function generatedFeed() {
550
551 print "<title>".__('View as RSS')."</title>";
552 print "<content><![CDATA[";
553
554 $this->params = explode(":", $this->param, 3);
555 $feed_id = db_escape_string($this->params[0]);
556 $is_cat = (bool) $this->params[1];
557
558 $key = get_feed_access_key($this->link, $feed_id, $is_cat);
559
560 $url_path = htmlspecialchars($this->params[2]) . "&key=" . $key;
561
562 print "<div class=\"dialogNotice\">" . __("You can view this feed as RSS using the following URL:") . "</div>";
563
564 print "<div class=\"tagCloudContainer\">";
565 print "<a id='gen_feed_url' href='$url_path' target='_blank'>$url_path</a>";
566 print "</div>";
567
568 print "<div align='center'>";
569
570 print "<button dojoType=\"dijit.form.Button\" onclick=\"return genUrlChangeKey('$feed_id', '$is_cat')\">".
571 __('Generate new URL')."</button> ";
572
573 print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">".
574 __('Close this window')."</button>";
575
576 print "</div>";
577 print "]]></content>";
578
579 //return;
580 }
581
582 function newVersion() {
583
584 $version_data = check_for_update($this->link);
585 $version = $version_data['version'];
586 $id = $version_data['version_id'];
587
588 print "<div class='tagCloudContainer'>";
589
590 print T_sprintf("New version of Tiny Tiny RSS is available (%s).",
591 "<b>$version</b>");
592
593 print "</div>";
594
595 $details = "http://tt-rss.org/redmine/versions/$id";
596 $download = "http://tt-rss.org/#Download";
597
598 print "<p align='center'>".__("You can update using built-in updater in the Preferences or by using update.php")."</p>";
599
600 print "<div style='text-align : center'>";
601 print "<button dojoType=\"dijit.form.Button\"
602 onclick=\"return window.open('$details')\">".__("Details")."</button>";
603 print "<button dojoType=\"dijit.form.Button\"
604 onclick=\"return window.open('$download')\">".__("Download")."</button>";
605 print "<button dojoType=\"dijit.form.Button\"
606 onclick=\"return dijit.byId('newVersionDlg').hide()\">".
607 __('Close this window')."</button>";
608 print "</div>";
609
610 }
611
612 function customizeCSS() {
613 $value = get_pref($this->link, "USER_STYLESHEET");
614
615 $value = str_replace("<br/>", "\n", $value);
616
617 print "<div class=\"dialogNotice\">";
618 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");
619 print "</div>";
620
621 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
622 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setpref\">";
623 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"key\" value=\"USER_STYLESHEET\">";
624
625 print "<table width='100%'><tr><td>";
626 print "<textarea dojoType=\"dijit.form.SimpleTextarea\"
627 style='font-size : 12px; width : 100%; height: 200px;'
628 placeHolder='body#ttrssMain { font-size : 14px; };'
629 name='value'>$value</textarea>";
630 print "</td></tr></table>";
631
632 print "<div class='dlgButtons'>";
633 print "<button dojoType=\"dijit.form.Button\"
634 onclick=\"dijit.byId('cssEditDlg').execute()\">".__('Save')."</button> ";
635 print "<button dojoType=\"dijit.form.Button\"
636 onclick=\"dijit.byId('cssEditDlg').hide()\">".__('Cancel')."</button>";
637 print "</div>";
638
639 }
640
641 function addInstance() {
642 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-instances\">";
643 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"add\">";
644
645 print "<div class=\"dlgSec\">".__("Instance")."</div>";
646
647 print "<div class=\"dlgSecCont\">";
648
649 /* URL */
650
651 print __("URL:") . " ";
652
653 print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\"
654 placeHolder=\"".__("Instance URL")."\"
655 regExp='^(http|https)://.*'
656 style=\"font-size : 16px; width: 20em\" name=\"access_url\">";
657
658 print "<hr/>";
659
660 $access_key = sha1(uniqid(rand(), true));
661
662 /* Access key */
663
664 print __("Access key:") . " ";
665
666 print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\"
667 placeHolder=\"".__("Access key")."\" regExp='\w{40}'
668 style=\"width: 20em\" name=\"access_key\" id=\"instance_add_key\"
669 value=\"$access_key\">";
670
671 print "<p class='insensitive'>" . __("Use one access key for both linked instances.");
672
673 print "</div>";
674
675 print "<div class=\"dlgButtons\">
676 <div style='float : left'>
677 <button dojoType=\"dijit.form.Button\"
678 onclick=\"return dijit.byId('instanceAddDlg').regenKey()\">".
679 __('Generate new key')."</button>
680 </div>
681 <button dojoType=\"dijit.form.Button\"
682 onclick=\"return dijit.byId('instanceAddDlg').execute()\">".
683 __('Create link')."</button>
684 <button dojoType=\"dijit.form.Button\"
685 onclick=\"return dijit.byId('instanceAddDlg').hide()\"\">".
686 __('Cancel')."</button></div>";
687
688 return;
689 }
690
691 function batchSubscribe() {
692 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
693 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"batchaddfeeds\">";
694
695 print "<table width='100%'><tr><td>
696 ".__("Add one valid RSS feed per line (no feed detection is done)")."
697 </td><td align='right'>";
698 if (get_pref($this->link, 'ENABLE_FEED_CATS')) {
699 print __('Place in category:') . " ";
700 print_feed_cat_select($this->link, "cat", false, 'dojoType="dijit.form.Select"');
701 }
702 print "</td></tr><tr><td colspan='2'>";
703 print "<textarea
704 style='font-size : 12px; width : 100%; height: 200px;'
705 placeHolder=\"".__("Feeds to subscribe, One per line")."\"
706 dojoType=\"dijit.form.SimpleTextarea\" required=\"1\" name=\"feeds\"></textarea>";
707
708 print "</td></tr><tr><td colspan='2'>";
709
710 print "<div id='feedDlg_loginContainer' style='display : none'>
711 " .
712 " <input dojoType=\"dijit.form.TextBox\" name='login'\"
713 placeHolder=\"".__("Login")."\"
714 style=\"width : 10em;\"> ".
715 " <input
716 placeHolder=\"".__("Password")."\"
717 dojoType=\"dijit.form.TextBox\" type='password'
718 style=\"width : 10em;\" name='pass'\">".
719 "</div>";
720
721 print "</td></tr><tr><td colspan='2'>";
722
723 print "<div style=\"clear : both\">
724 <input type=\"checkbox\" name=\"need_auth\" dojoType=\"dijit.form.CheckBox\" id=\"feedDlg_loginCheck\"
725 onclick='checkboxToggleElement(this, \"feedDlg_loginContainer\")'>
726 <label for=\"feedDlg_loginCheck\">".
727 __('Feeds require authentication.')."</div>";
728
729 print "</form>";
730
731 print "</td></tr></table>";
732
733 print "<div class=\"dlgButtons\">
734 <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('batchSubDlg').execute()\">".__('Subscribe')."</button>
735 <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('batchSubDlg').hide()\">".__('Cancel')."</button>
736 </div>";
737 }
738
739 }
740 ?>