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