dlg.php 24 KB

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