dlg.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754
  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($this->link, $_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='images/indicator_white.gif'></div>";
  170. print "<input style=\"font-size : 16px; width : 20em;\"
  171. placeHolder=\"".__("Feed or site URL")."\"
  172. dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"feed\" id=\"feedDlg_feedUrl\">";
  173. print "<hr/>";
  174. if (get_pref($this->link, 'ENABLE_FEED_CATS')) {
  175. print __('Place in category:') . " ";
  176. print_feed_cat_select($this->link, "cat", false, 'dojoType="dijit.form.Select"');
  177. }
  178. print "</div>";
  179. print '<div id="feedDlg_feedsContainer" style="display : none">
  180. <div class="dlgSec">' . __('Available feeds') . '</div>
  181. <div class="dlgSecCont">'.
  182. '<select id="feedDlg_feedContainerSelect"
  183. dojoType="dijit.form.Select" size="3">
  184. <script type="dojo/method" event="onChange" args="value">
  185. dijit.byId("feedDlg_feedUrl").attr("value", value);
  186. </script>
  187. </select>'.
  188. '</div></div>';
  189. print "<div id='feedDlg_loginContainer' style='display : none'>
  190. <div class=\"dlgSec\">".__("Authentication")."</div>
  191. <div class=\"dlgSecCont\">".
  192. " <input dojoType=\"dijit.form.TextBox\" name='login'\"
  193. placeHolder=\"".__("Login")."\"
  194. style=\"width : 10em;\"> ".
  195. " <input
  196. placeHolder=\"".__("Password")."\"
  197. dojoType=\"dijit.form.TextBox\" type='password'
  198. style=\"width : 10em;\" name='pass'\">
  199. </div></div>";
  200. print "<div style=\"clear : both\">
  201. <input type=\"checkbox\" name=\"need_auth\" dojoType=\"dijit.form.CheckBox\" id=\"feedDlg_loginCheck\"
  202. onclick='checkboxToggleElement(this, \"feedDlg_loginContainer\")'>
  203. <label for=\"feedDlg_loginCheck\">".
  204. __('This feed requires authentication.')."</div>";
  205. print "</form>";
  206. print "<div class=\"dlgButtons\">
  207. <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').execute()\">".__('Subscribe')."</button>";
  208. if (!(defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER)) {
  209. print "<button dojoType=\"dijit.form.Button\" onclick=\"return feedBrowser()\">".__('More feeds')."</button>";
  210. }
  211. print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').hide()\">".__('Cancel')."</button>
  212. </div>";
  213. //return;
  214. }
  215. function feedBrowser() {
  216. if (defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER) return;
  217. $browser_search = db_escape_string($this->link, $_REQUEST["search"]);
  218. print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
  219. print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"updateFeedBrowser\">";
  220. print "<div dojoType=\"dijit.Toolbar\">
  221. <div style='float : right'>
  222. <img style='display : none'
  223. id='feed_browser_spinner' src='images/indicator_white.gif'>
  224. <input name=\"search\" dojoType=\"dijit.form.TextBox\" size=\"20\" type=\"search\"
  225. onchange=\"dijit.byId('feedBrowserDlg').update()\" value=\"$browser_search\">
  226. <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').update()\">".__('Search')."</button>
  227. </div>";
  228. print " <select name=\"mode\" dojoType=\"dijit.form.Select\" onchange=\"dijit.byId('feedBrowserDlg').update()\">
  229. <option value='1'>" . __('Popular feeds') . "</option>
  230. <option value='2'>" . __('Feed archive') . "</option>
  231. </select> ";
  232. print __("limit:");
  233. print " <select dojoType=\"dijit.form.Select\" name=\"limit\" onchange=\"dijit.byId('feedBrowserDlg').update()\">";
  234. foreach (array(25, 50, 100, 200) as $l) {
  235. $issel = ($l == $limit) ? "selected=\"1\"" : "";
  236. print "<option $issel value=\"$l\">$l</option>";
  237. }
  238. print "</select> ";
  239. print "</div>";
  240. $owner_uid = $_SESSION["uid"];
  241. require_once "feedbrowser.php";
  242. print "<ul class='browseFeedList' id='browseFeedList'>";
  243. print make_feed_browser($this->link, $search, 25);
  244. print "</ul>";
  245. print "<div align='center'>
  246. <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').execute()\">".__('Subscribe')."</button>
  247. <button dojoType=\"dijit.form.Button\" style='display : none' id='feed_archive_remove' onclick=\"dijit.byId('feedBrowserDlg').removeFromArchive()\">".__('Remove')."</button>
  248. <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').hide()\" >".__('Cancel')."</button></div>";
  249. }
  250. function search() {
  251. $this->params = explode(":", db_escape_string($this->link, $_REQUEST["param"]), 2);
  252. $active_feed_id = sprintf("%d", $this->params[0]);
  253. $is_cat = $this->params[1] != "false";
  254. print "<div class=\"dlgSec\">".__('Look for')."</div>";
  255. print "<div class=\"dlgSecCont\">";
  256. print "<input dojoType=\"dijit.form.ValidationTextBox\"
  257. style=\"font-size : 16px; width : 20em;\"
  258. required=\"1\" name=\"query\" type=\"search\" value=''>";
  259. print "<hr/>".__('Limit search to:')." ";
  260. print "<select name=\"search_mode\" dojoType=\"dijit.form.Select\">
  261. <option value=\"all_feeds\">".__('All feeds')."</option>";
  262. $feed_title = getFeedTitle($this->link, $active_feed_id);
  263. if (!$is_cat) {
  264. $feed_cat_title = getFeedCatTitle($this->link, $active_feed_id);
  265. } else {
  266. $feed_cat_title = getCategoryTitle($this->link, $active_feed_id);
  267. }
  268. if ($active_feed_id && !$is_cat) {
  269. print "<option selected=\"1\" value=\"this_feed\">$feed_title</option>";
  270. } else {
  271. print "<option disabled=\"1\" value=\"false\">".__('This feed')."</option>";
  272. }
  273. if ($is_cat) {
  274. $cat_preselected = "selected=\"1\"";
  275. }
  276. if (get_pref($this->link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 || $is_cat)) {
  277. print "<option $cat_preselected value=\"this_cat\">$feed_cat_title</option>";
  278. } else {
  279. //print "<option disabled>".__('This category')."</option>";
  280. }
  281. print "</select>";
  282. print "</div>";
  283. print "<div class=\"dlgButtons\">";
  284. if (!SPHINX_ENABLED) {
  285. print "<div style=\"float : left\">
  286. <a class=\"visibleLink\" target=\"_blank\" href=\"http://tt-rss.org/wiki/SearchSyntax\">Search syntax</a>
  287. </div>";
  288. }
  289. print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').execute()\">".__('Search')."</button>
  290. <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').hide()\">".__('Cancel')."</button>
  291. </div>";
  292. }
  293. function editArticleTags() {
  294. print __("Tags for this article (separated by commas):")."<br>";
  295. $tags = get_article_tags($this->link, $this->param);
  296. $tags_str = join(", ", $tags);
  297. print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$this->param\">";
  298. print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
  299. print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setArticleTags\">";
  300. print "<table width='100%'><tr><td>";
  301. print "<textarea dojoType=\"dijit.form.SimpleTextarea\" rows='4'
  302. style='font-size : 12px; width : 100%' id=\"tags_str\"
  303. name='tags_str'>$tags_str</textarea>
  304. <div class=\"autocomplete\" id=\"tags_choices\"
  305. style=\"display:none\"></div>";
  306. print "</td></tr></table>";
  307. print "<div class='dlgButtons'>";
  308. print "<button dojoType=\"dijit.form.Button\"
  309. onclick=\"dijit.byId('editTagsDlg').execute()\">".__('Save')."</button> ";
  310. print "<button dojoType=\"dijit.form.Button\"
  311. onclick=\"dijit.byId('editTagsDlg').hide()\">".__('Cancel')."</button>";
  312. print "</div>";
  313. }
  314. function printTagCloud() {
  315. print "<title>".__('Tag Cloud')."</title>";
  316. print "<content><![CDATA[";
  317. print "<div class=\"tagCloudContainer\">";
  318. // from here: http://www.roscripts.com/Create_tag_cloud-71.html
  319. $query = "SELECT tag_name, COUNT(post_int_id) AS count
  320. FROM ttrss_tags WHERE owner_uid = ".$_SESSION["uid"]."
  321. GROUP BY tag_name ORDER BY count DESC LIMIT 50";
  322. $result = db_query($this->link, $query);
  323. $tags = array();
  324. while ($line = db_fetch_assoc($result)) {
  325. $tags[$line["tag_name"]] = $line["count"];
  326. }
  327. if( count($tags) == 0 ){ return; }
  328. ksort($tags);
  329. $max_size = 32; // max font size in pixels
  330. $min_size = 11; // min font size in pixels
  331. // largest and smallest array values
  332. $max_qty = max(array_values($tags));
  333. $min_qty = min(array_values($tags));
  334. // find the range of values
  335. $spread = $max_qty - $min_qty;
  336. if ($spread == 0) { // we don't want to divide by zero
  337. $spread = 1;
  338. }
  339. // set the font-size increment
  340. $step = ($max_size - $min_size) / ($spread);
  341. // loop through the tag array
  342. foreach ($tags as $key => $value) {
  343. // calculate font-size
  344. // find the $value in excess of $min_qty
  345. // multiply by the font-size increment ($size)
  346. // and add the $min_size set above
  347. $size = round($min_size + (($value - $min_qty) * $step));
  348. $key_escaped = str_replace("'", "\\'", $key);
  349. echo "<a href=\"javascript:viewfeed('$key_escaped') \" style=\"font-size: " .
  350. $size . "px\" title=\"$value articles tagged with " .
  351. $key . '">' . $key . '</a> ';
  352. }
  353. print "</div>";
  354. print "<div align='center'>";
  355. print "<button dojoType=\"dijit.form.Button\"
  356. onclick=\"return closeInfoBox()\">".
  357. __('Close this window')."</button>";
  358. print "</div>";
  359. print "]]></content>";
  360. }
  361. function printTagSelect() {
  362. print "<title>" . __('Select item(s) by tags') . "</title>";
  363. print "<content><![CDATA[";
  364. print __("Match:"). "&nbsp;" .
  365. "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" checked value=\"any\" name=\"tag_mode\" id=\"tag_mode_any\">";
  366. print "<label for=\"tag_mode_any\">".__("Any")."</label>";
  367. print "&nbsp;";
  368. print "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" value=\"all\" name=\"tag_mode\" id=\"tag_mode_all\">";
  369. print "<label for=\"tag_mode_all\">".__("All tags.")."</input>";
  370. print "<select id=\"all_tags\" name=\"all_tags\" title=\"" . __('Which Tags?') . "\" multiple=\"multiple\" size=\"10\" style=\"width : 100%\">";
  371. $result = db_query($this->link, "SELECT DISTINCT tag_name FROM ttrss_tags WHERE owner_uid = ".$_SESSION['uid']."
  372. AND LENGTH(tag_name) <= 30 ORDER BY tag_name ASC");
  373. while ($row = db_fetch_assoc($result)) {
  374. $tmp = htmlspecialchars($row["tag_name"]);
  375. print "<option value=\"" . str_replace(" ", "%20", $tmp) . "\">$tmp</option>";
  376. }
  377. print "</select>";
  378. print "<div align='right'>";
  379. print "<button dojoType=\"dijit.form.Button\" onclick=\"viewfeed(get_all_tags($('all_tags')),
  380. get_radio_checked($('tag_mode')));\">" . __('Display entries') . "</button>";
  381. print "&nbsp;";
  382. print "<button dojoType=\"dijit.form.Button\"
  383. onclick=\"return closeInfoBox()\">" .
  384. __('Close this window') . "</button>";
  385. print "</div>";
  386. print "]]></content>";
  387. }
  388. function generatedFeed() {
  389. print "<title>".__('View as RSS')."</title>";
  390. print "<content><![CDATA[";
  391. $this->params = explode(":", $this->param, 3);
  392. $feed_id = db_escape_string($this->link, $this->params[0]);
  393. $is_cat = (bool) $this->params[1];
  394. $key = get_feed_access_key($this->link, $feed_id, $is_cat);
  395. $url_path = htmlspecialchars($this->params[2]) . "&key=" . $key;
  396. print "<div class=\"dialogNotice\">" . __("You can view this feed as RSS using the following URL:") . "</div>";
  397. print "<div class=\"tagCloudContainer\">";
  398. print "<a id='gen_feed_url' href='$url_path' target='_blank'>$url_path</a>";
  399. print "</div>";
  400. print "<div align='center'>";
  401. print "<button dojoType=\"dijit.form.Button\" onclick=\"return genUrlChangeKey('$feed_id', '$is_cat')\">".
  402. __('Generate new URL')."</button> ";
  403. print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">".
  404. __('Close this window')."</button>";
  405. print "</div>";
  406. print "]]></content>";
  407. //return;
  408. }
  409. function newVersion() {
  410. $version_data = check_for_update($this->link);
  411. $version = $version_data['version'];
  412. $id = $version_data['version_id'];
  413. if ($version && $id) {
  414. print "<div class='tagCloudContainer'>";
  415. print T_sprintf("New version of Tiny Tiny RSS is available (%s).",
  416. "<b>$version</b>");
  417. print "</div>";
  418. $details = "http://tt-rss.org/redmine/versions/$id";
  419. $download = "http://tt-rss.org/#Download";
  420. print "<p align='center'>".__("You can update using built-in updater in the Preferences or by using update.php")."</p>";
  421. print "<div style='text-align : center'>";
  422. print "<button dojoType=\"dijit.form.Button\"
  423. onclick=\"return window.open('$details')\">".__("Details")."</button>";
  424. print "<button dojoType=\"dijit.form.Button\"
  425. onclick=\"return window.open('$download')\">".__("Download")."</button>";
  426. print "<button dojoType=\"dijit.form.Button\"
  427. onclick=\"return dijit.byId('newVersionDlg').hide()\">".
  428. __('Close this window')."</button>";
  429. } else {
  430. print "<div class='tagCloudContainer'>";
  431. print "<p align='center'>".__("Error receiving version information or no new version available.")."</p>";
  432. print "</div>";
  433. print "<div style='text-align : center'>";
  434. print "<button dojoType=\"dijit.form.Button\"
  435. onclick=\"return dijit.byId('newVersionDlg').hide()\">".
  436. __('Close this window')."</button>";
  437. print "</div>";
  438. }
  439. print "</div>";
  440. }
  441. function customizeCSS() {
  442. $value = get_pref($this->link, "USER_STYLESHEET");
  443. $value = str_replace("<br/>", "\n", $value);
  444. print "<div class=\"dialogNotice\">";
  445. 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");
  446. print "</div>";
  447. print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
  448. print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setpref\">";
  449. print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"key\" value=\"USER_STYLESHEET\">";
  450. print "<table width='100%'><tr><td>";
  451. print "<textarea dojoType=\"dijit.form.SimpleTextarea\"
  452. style='font-size : 12px; width : 100%; height: 200px;'
  453. placeHolder='body#ttrssMain { font-size : 14px; };'
  454. name='value'>$value</textarea>";
  455. print "</td></tr></table>";
  456. print "<div class='dlgButtons'>";
  457. print "<button dojoType=\"dijit.form.Button\"
  458. onclick=\"dijit.byId('cssEditDlg').execute()\">".__('Save')."</button> ";
  459. print "<button dojoType=\"dijit.form.Button\"
  460. onclick=\"dijit.byId('cssEditDlg').hide()\">".__('Cancel')."</button>";
  461. print "</div>";
  462. }
  463. function addInstance() {
  464. print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-instances\">";
  465. print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"add\">";
  466. print "<div class=\"dlgSec\">".__("Instance")."</div>";
  467. print "<div class=\"dlgSecCont\">";
  468. /* URL */
  469. print __("URL:") . " ";
  470. print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\"
  471. placeHolder=\"".__("Instance URL")."\"
  472. regExp='^(http|https)://.*'
  473. style=\"font-size : 16px; width: 20em\" name=\"access_url\">";
  474. print "<hr/>";
  475. $access_key = sha1(uniqid(rand(), true));
  476. /* Access key */
  477. print __("Access key:") . " ";
  478. print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\"
  479. placeHolder=\"".__("Access key")."\" regExp='\w{40}'
  480. style=\"width: 20em\" name=\"access_key\" id=\"instance_add_key\"
  481. value=\"$access_key\">";
  482. print "<p class='insensitive'>" . __("Use one access key for both linked instances.");
  483. print "</div>";
  484. print "<div class=\"dlgButtons\">
  485. <div style='float : left'>
  486. <button dojoType=\"dijit.form.Button\"
  487. onclick=\"return dijit.byId('instanceAddDlg').regenKey()\">".
  488. __('Generate new key')."</button>
  489. </div>
  490. <button dojoType=\"dijit.form.Button\"
  491. onclick=\"return dijit.byId('instanceAddDlg').execute()\">".
  492. __('Create link')."</button>
  493. <button dojoType=\"dijit.form.Button\"
  494. onclick=\"return dijit.byId('instanceAddDlg').hide()\"\">".
  495. __('Cancel')."</button></div>";
  496. return;
  497. }
  498. function batchSubscribe() {
  499. print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
  500. print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"batchaddfeeds\">";
  501. print "<table width='100%'><tr><td>
  502. ".__("Add one valid RSS feed per line (no feed detection is done)")."
  503. </td><td align='right'>";
  504. if (get_pref($this->link, 'ENABLE_FEED_CATS')) {
  505. print __('Place in category:') . " ";
  506. print_feed_cat_select($this->link, "cat", false, 'dojoType="dijit.form.Select"');
  507. }
  508. print "</td></tr><tr><td colspan='2'>";
  509. print "<textarea
  510. style='font-size : 12px; width : 100%; height: 200px;'
  511. placeHolder=\"".__("Feeds to subscribe, One per line")."\"
  512. dojoType=\"dijit.form.SimpleTextarea\" required=\"1\" name=\"feeds\"></textarea>";
  513. print "</td></tr><tr><td colspan='2'>";
  514. print "<div id='feedDlg_loginContainer' style='display : none'>
  515. " .
  516. " <input dojoType=\"dijit.form.TextBox\" name='login'\"
  517. placeHolder=\"".__("Login")."\"
  518. style=\"width : 10em;\"> ".
  519. " <input
  520. placeHolder=\"".__("Password")."\"
  521. dojoType=\"dijit.form.TextBox\" type='password'
  522. style=\"width : 10em;\" name='pass'\">".
  523. "</div>";
  524. print "</td></tr><tr><td colspan='2'>";
  525. print "<div style=\"clear : both\">
  526. <input type=\"checkbox\" name=\"need_auth\" dojoType=\"dijit.form.CheckBox\" id=\"feedDlg_loginCheck\"
  527. onclick='checkboxToggleElement(this, \"feedDlg_loginContainer\")'>
  528. <label for=\"feedDlg_loginCheck\">".
  529. __('Feeds require authentication.')."</div>";
  530. print "</form>";
  531. print "</td></tr></table>";
  532. print "<div class=\"dlgButtons\">
  533. <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('batchSubDlg').execute()\">".__('Subscribe')."</button>
  534. <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('batchSubDlg').hide()\">".__('Cancel')."</button>
  535. </div>";
  536. }
  537. }
  538. ?>