]>
git.wh0rd.org - tt-rss.git/blob - classes/dlg.php
2 class Dlg
extends Protected_Handler
{
6 if ( parent
:: before ()) {
7 header ( "Content-Type: text/xml; charset=utf-8" );
8 $this -> param
= db_escape_string ( $_REQUEST [ "param" ]);
19 function exportData () {
21 print "<p style='text-align : center' id='export_status_message'>You need to prepare exported data first by clicking the button below.</p>" ;
23 print "<div align='center'>" ;
24 print "<button dojoType= \" dijit.form.Button \"
25 onclick= \" dijit.byId('dataExportDlg').prepare() \" >" .
26 __ ( 'Prepare data' ). "</button>" ;
28 print "<button dojoType= \" dijit.form.Button \"
29 onclick= \" dijit.byId('dataExportDlg').hide() \" >" .
30 __ ( 'Close this window' ). "</button>" ;
37 function importOpml () {
38 header ( "Content-Type: text/html" ); # required for iframe
40 print __ ( "If you have imported labels and/or filters, you might need to reload preferences to see your new data." ) . "</p>" ;
42 print "<div class= \" prefFeedOPMLHolder \" >" ;
43 $owner_uid = $_SESSION [ "uid" ];
45 db_query ( $this -> link
, "BEGIN" );
47 /* create Imported feeds category just in case */
49 $result = db_query ( $this -> link
, "SELECT id FROM
50 ttrss_feed_categories WHERE title = 'Imported feeds' AND
51 owner_uid = ' $owner_uid ' LIMIT 1" );
53 if ( db_num_rows ( $result ) == 0 ) {
54 db_query ( $this -> link
, "INSERT INTO ttrss_feed_categories
56 VALUES ('Imported feeds', ' $owner_uid ')" );
59 db_query ( $this -> link
, "COMMIT" );
61 /* Handle OPML import by DOMXML/DOMDocument */
63 print "<ul class='nomarks'>" ;
64 require_once "opml.php" ;
65 opml_import_domdoc ( $this -> link
, $owner_uid );
69 print "<div align='center'>" ;
70 print "<button dojoType= \" dijit.form.Button \"
71 onclick= \" dijit.byId('opmlImportDlg').execute() \" >" .
72 __ ( 'Close this window' ). "</button>" ;
80 function editPrefProfiles () {
81 print "<div dojoType= \" dijit.Toolbar \" >" ;
83 print "<input name= \" newprofile \" dojoType= \" dijit.form.ValidationTextBox \"
85 <button dojoType= \" dijit.form.Button \"
86 onclick= \" dijit.byId('profileEditDlg').addProfile() \" >" .
87 __ ( 'Create profile' ). "</button></div>" ;
89 $result = db_query ( $this -> link
, "SELECT title,id FROM ttrss_settings_profiles
90 WHERE owner_uid = " . $_SESSION [ "uid" ]. " ORDER BY title" );
92 print "<div class= \" prefFeedCatHolder \" >" ;
94 print "<form id= \" profile_edit_form \" onsubmit= \" return false \" >" ;
96 print "<table width= \" 100% \" class= \" prefFeedProfileList \"
97 cellspacing= \" 0 \" id= \" prefFeedProfileList \" >" ;
99 print "<tr class= \"\" id= \" FCATR-0 \" >" ; #odd
101 print "<td width='5%' align='center'><input
102 onclick='toggleSelectRow2(this);'
103 dojoType= \" dijit.form.CheckBox \"
104 type= \" checkbox \" ></td>" ;
106 if (! $_SESSION [ "profile" ]) {
107 $is_active = __ ( "(active)" );
113 __ ( "Default profile" ) . " $is_active </span></td>" ;
119 while ( $line = db_fetch_assoc ( $result )) {
121 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
123 $profile_id = $line [ "id" ];
124 $this_row_id = "id= \" FCATR- $profile_id\" " ;
126 print "<tr class= \"\" $this_row_id >" ;
128 $edit_title = htmlspecialchars ( $line [ "title" ]);
130 print "<td width='5%' align='center'><input
131 onclick='toggleSelectRow2(this);'
132 dojoType= \" dijit.form.CheckBox \"
133 type= \" checkbox \" ></td>" ;
135 if ( $_SESSION [ "profile" ] == $line [ "id" ]) {
136 $is_active = __ ( "(active)" );
141 print "<td><span dojoType= \" dijit.InlineEditBox \"
142 width= \" 300px \" autoSave= \" false \"
143 profile-id= \" $profile_id\" >" . $edit_title .
144 "<script type= \" dojo/method \" event= \" onChange \" args= \" item \" >
148 content: {op: 'rpc', method: 'saveprofile',
150 id: this.srcNodeRef.getAttribute('profile-id')},
151 load: function(response) {
152 elem.attr('value', response);
156 </span> $is_active </td>" ;
167 print "<div class='dlgButtons'>
168 <div style='float : left'>
169 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('profileEditDlg').removeSelected() \" >" .
170 __ ( 'Remove selected profiles' ). "</button>
171 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('profileEditDlg').activateProfile() \" >" .
172 __ ( 'Activate profile' ). "</button>
175 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('profileEditDlg').hide() \" >" .
176 __ ( 'Close this window' ). "</button>" ;
181 function pubOPMLUrl () {
182 print "<title>" . __ ( 'Public OPML URL' ). "</title>" ;
183 print "<content><![CDATA[" ;
185 $url_path = opml_publish_url ( $this -> link
);
187 print __ ( "Your Public OPML URL is:" );
189 print "<div class= \" tagCloudContainer \" >" ;
190 print "<a id='pub_opml_url' href=' $url_path ' target='_blank'> $url_path </a>" ;
193 print "<div align='center'>" ;
195 print "<button dojoType= \" dijit.form.Button \" onclick= \" return opmlRegenKey() \" >" .
196 __ ( 'Generate new URL' ). "</button> " ;
198 print "<button dojoType= \" dijit.form.Button \" onclick= \" return closeInfoBox() \" >" .
199 __ ( 'Close this window' ). "</button>" ;
202 print "]]></content>" ;
207 function explainError () {
208 print "<title>" . __ ( 'Notice' ). "</title>" ;
209 print "<content><![CDATA[" ;
211 print "<div class= \" errorExplained \" >" ;
213 if ( $this -> param
== 1 ) {
214 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." );
216 $stamp = ( int ) file_get_contents ( LOCK_DIRECTORY
. "/update_daemon.stamp" );
218 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
222 if ( $this -> param
== 3 ) {
223 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." );
225 $stamp = ( int ) file_get_contents ( LOCK_DIRECTORY
. "/update_daemon.stamp" );
227 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
233 print "<div align='center'>" ;
235 print "<button onclick= \" return closeInfoBox() \" >" .
236 __ ( 'Close this window' ). "</button>" ;
239 print "]]></content>" ;
244 function quickAddFeed () {
245 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
246 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" addfeed \" >" ;
248 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
249 print "<div class= \" dlgSecCont \" >" ;
251 print "<input style= \" font-size : 16px; width : 20em; \"
252 placeHolder= \" " . __ ( "Feed URL" ). " \"
253 dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \" name= \" feed \" id= \" feedDlg_feedUrl \" >" ;
257 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
258 print __ ( 'Place in category:' ) . " " ;
259 print_feed_cat_select ( $this -> link
, "cat" , false , 'dojoType="dijit.form.Select"' );
264 print '<div id="feedDlg_feedsContainer" style="display : none">
266 <div class="dlgSec">' . __ ( 'Available feeds' ) . '</div>
267 <div class="dlgSecCont">' .
268 '<select id="feedDlg_feedContainerSelect"
269 dojoType="dijit.form.Select" size="3">
270 <script type="dojo/method" event="onChange" args="value">
271 dijit.byId("feedDlg_feedUrl").attr("value", value);
276 print "<div id='feedDlg_loginContainer' style='display : none'>
278 <div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>
279 <div class= \" dlgSecCont \" >" .
281 " <input dojoType= \" dijit.form.TextBox \" name='login' \"
282 placeHolder= \" " . __ ( "Login" ). " \"
283 style= \" width : 10em; \" > " .
285 placeHolder= \" " . __ ( "Password" ). " \"
286 dojoType= \" dijit.form.TextBox \" type='password'
287 style= \" width : 10em; \" name='pass' \" >
291 print "<div style= \" clear : both \" >
292 <input type= \" checkbox \" dojoType= \" dijit.form.CheckBox \" id= \" feedDlg_loginCheck \"
293 onclick='checkboxToggleElement(this, \" feedDlg_loginContainer \" )'>
294 <label for= \" feedDlg_loginCheck \" >" .
295 __ ( 'This feed requires authentication.' ). "</div>" ;
299 print "<div class= \" dlgButtons \" >
300 <button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('feedAddDlg').execute() \" >" . __ ( 'Subscribe' ). "</button>
301 <button dojoType= \" dijit.form.Button \" onclick= \" return feedBrowser() \" >" . __ ( 'More feeds' ). "</button>
302 <button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('feedAddDlg').hide() \" >" . __ ( 'Cancel' ). "</button>
308 function feedBrowser () {
309 $browser_search = db_escape_string ( $_REQUEST [ "search" ]);
311 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
312 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" updateFeedBrowser \" >" ;
314 print "<div dojoType= \" dijit.Toolbar \" >
315 <div style='float : right'>
316 <img style='display : none'
317 id='feed_browser_spinner' src='" .
318 theme_image ( $this -> link
, 'images/indicator_white.gif' ). "'>
319 <input name= \" search \" dojoType= \" dijit.form.TextBox \" size= \" 20 \" type= \" search \"
320 onchange= \" dijit.byId('feedBrowserDlg').update() \" value= \" $browser_search\" >
321 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedBrowserDlg').update() \" >" . __ ( 'Search' ). "</button>
324 print " <select name= \" mode \" dojoType= \" dijit.form.Select \" onchange= \" dijit.byId('feedBrowserDlg').update() \" >
325 <option value='1'>" . __ ( 'Popular feeds' ) . "</option>
326 <option value='2'>" . __ ( 'Feed archive' ) . "</option>
331 print " <select dojoType= \" dijit.form.Select \" name= \" limit \" onchange= \" dijit.byId('feedBrowserDlg').update() \" >" ;
333 foreach ( array ( 25 , 50 , 100 , 200 ) as $l ) {
334 $issel = ( $l == $limit ) ?
"selected= \" 1 \" " : "" ;
335 print "<option $issel value= \" $l\" > $l </option>" ;
342 $owner_uid = $_SESSION [ "uid" ];
344 print "<ul class='browseFeedList' id='browseFeedList'>" ;
345 print make_feed_browser ( $this -> link
, $search , 25 );
348 print "<div align='center'>
349 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedBrowserDlg').execute() \" >" . __ ( 'Subscribe' ). "</button>
350 <button dojoType= \" dijit.form.Button \" style='display : none' id='feed_archive_remove' onclick= \" dijit.byId('feedBrowserDlg').removeFromArchive() \" >" . __ ( 'Remove' ). "</button>
351 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedBrowserDlg').hide() \" >" . __ ( 'Cancel' ). "</button></div>" ;
356 $this -> params
= explode ( ":" , db_escape_string ( $_REQUEST [ "param" ]), 2 );
358 $active_feed_id = sprintf ( " %d " , $this -> params
[ 0 ]);
359 $is_cat = $this -> params
[ 1 ] != "false" ;
361 print "<div class= \" dlgSec \" >" . __ ( 'Look for' ). "</div>" ;
363 print "<div class= \" dlgSecCont \" >" ;
365 if (! SPHINX_ENABLED
) {
367 print "<input dojoType= \" dijit.form.ValidationTextBox \"
368 style= \" font-size : 16px; width : 12em; \"
369 required= \" 1 \" name= \" query \" type= \" search \" value=''>" ;
371 print " " . __ ( 'match on' ). " " ;
373 $search_fields = array (
374 "title" => __ ( "Title" ),
375 "content" => __ ( "Content" ),
376 "both" => __ ( "Title or content" ));
378 print_select_hash ( "match_on" , 3 , $search_fields ,
379 'dojoType="dijit.form.Select"' );
381 print "<input dojoType= \" dijit.form.ValidationTextBox \"
382 style= \" font-size : 16px; width : 20em; \"
383 required= \" 1 \" name= \" query \" type= \" search \" value=''>" ;
387 print "<hr/>" . __ ( 'Limit search to:' ). " " ;
389 print "<select name= \" search_mode \" dojoType= \" dijit.form.Select \" >
390 <option value= \" all_feeds \" >" . __ ( 'All feeds' ). "</option>" ;
392 $feed_title = getFeedTitle ( $this -> link
, $active_feed_id );
395 $feed_cat_title = getFeedCatTitle ( $this -> link
, $active_feed_id );
397 $feed_cat_title = getCategoryTitle ( $this -> link
, $active_feed_id );
400 if ( $active_feed_id && ! $is_cat ) {
401 print "<option selected= \" 1 \" value= \" this_feed \" > $feed_title </option>" ;
403 print "<option disabled= \" 1 \" value= \" false \" >" . __ ( 'This feed' ). "</option>" ;
407 $cat_preselected = "selected= \" 1 \" " ;
410 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' ) && ( $active_feed_id > 0 ||
$is_cat )) {
411 print "<option $cat_preselected value= \" this_cat \" > $feed_cat_title </option>" ;
413 //print "<option disabled>".__('This category')."</option>";
420 print "<div class= \" dlgButtons \" >" ;
422 if (! SPHINX_ENABLED
) {
423 print "<div style= \" float : left \" >
424 <a class= \" visibleLink \" target= \" _blank \" href= \" http://tt-rss.org/redmine/wiki/tt-rss/SearchSyntax \" >Search syntax</a>
428 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('searchDlg').execute() \" >" . __ ( 'Search' ). "</button>
429 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('searchDlg').hide() \" >" . __ ( 'Cancel' ). "</button>
433 function quickAddFilter () {
434 $active_feed_id = db_escape_string ( $_REQUEST [ "param" ]);
436 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" pref-filters \" >" ;
437 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" quiet \" value= \" 1 \" >" ;
438 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" add \" >" ;
439 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" csrf_token \" value= \" " . $_SESSION [ 'csrf_token' ]. " \" >" ;
441 $result = db_query ( $this -> link
, "SELECT id,description
442 FROM ttrss_filter_types ORDER BY description" );
444 $filter_types = array ();
446 while ( $line = db_fetch_assoc ( $result )) {
447 //array_push($filter_types, $line["description"]);
448 $filter_types [ $line [ "id" ]] = __ ( $line [ "description" ]);
451 print "<div class= \" dlgSec \" >" . __ ( "Match" ). "</div>" ;
453 print "<div class= \" dlgSecCont \" >" ;
455 print "<span id= \" filterDlg_dateModBox \" style= \" display : none \" >" ;
457 $filter_params = array (
458 "before" => __ ( "before" ),
459 "after" => __ ( "after" ));
461 print_select_hash ( "filter_date_modifier" , "before" ,
462 $filter_params , 'dojoType="dijit.form.Select"' );
464 print " </span>" ;
466 print "<input dojoType= \" dijit.form.ValidationTextBox \"
467 required= \" true \" id= \" filterDlg_regExp \"
468 style= \" font-size : 16px \"
469 name= \" reg_exp \" value= \" $reg_exp\" />" ;
471 print "<span id= \" filterDlg_dateChkBox \" style= \" display : none \" >" ;
472 print " <button dojoType= \" dijit.form.Button \"
473 onclick= \" return filterDlgCheckDate() \" >" .
474 __ ( 'Check it' ). "</button>" ;
477 print "<hr/>" . __ ( "on field" ) . " " ;
478 print_select_hash ( "filter_type" , 1 , $filter_types ,
479 'onchange="filterDlgCheckType(this)" dojoType="dijit.form.Select"' );
483 print __ ( "in" ) . " " ;
485 print "<span id='filterDlg_feeds'>" ;
486 print_feed_select ( $this -> link
, "feed_id" , $active_feed_id ,
487 'dojoType="dijit.form.FilteringSelect"' );
490 print "<span id='filterDlg_cats' style='display : none'>" ;
491 print_feed_cat_select ( $this -> link
, "cat_id" , $active_cat_id ,
492 'dojoType="dijit.form.FilteringSelect"' );
497 print "<div class= \" dlgSec \" >" . __ ( "Perform Action" ). "</div>" ;
499 print "<div class= \" dlgSecCont \" >" ;
501 print "<select name= \" action_id \" dojoType= \" dijit.form.Select \"
502 onchange= \" filterDlgCheckAction(this) \" >" ;
504 $result = db_query ( $this -> link
, "SELECT id,description FROM ttrss_filter_actions
507 while ( $line = db_fetch_assoc ( $result )) {
508 printf ( "<option value=' %d '> %s </option>" , $line [ "id" ], __ ( $line [ "description" ]));
513 print "<span id= \" filterDlg_paramBox \" style= \" display : none \" >" ;
514 print " " . __ ( "with parameters:" ) . " " ;
515 print "<input dojoType= \" dijit.form.TextBox \"
516 id= \" filterDlg_actionParam \"
517 name= \" action_param \" >" ;
519 print_label_select ( $this -> link
, "action_param_label" , $action_param ,
520 'id="filterDlg_actionParamLabel" dojoType="dijit.form.Select"' );
524 print " " ; // tiny layout hack
528 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
529 print "<div class= \" dlgSecCont \" >" ;
531 print "<input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" name= \" enabled \" id= \" enabled \" checked= \" 1 \" >
532 <label for= \" enabled \" >" . __ ( 'Enabled' ). "</label><hr/>" ;
534 print "<input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" name= \" inverse \" id= \" inverse \" >
535 <label for= \" inverse \" >" . __ ( 'Inverse match' ). "</label><hr/>" ;
537 print "<input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" name= \" cat_filter \" id= \" cat_filter \" onchange= \" filterDlgCheckCat(this) \" >
538 <label for= \" cat_filter \" >" . __ ( 'Apply to category' ). "</label><hr/>" ;
543 print "<div class= \" dlgButtons \" >" ;
545 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('filterEditDlg').test() \" >" .
546 __ ( 'Test' ). "</button> " ;
548 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('filterEditDlg').execute() \" >" .
549 __ ( 'Create' ). "</button> " ;
551 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('filterEditDlg').hide() \" >" .
552 __ ( 'Cancel' ). "</button>" ;
557 function inactiveFeeds () {
559 if ( DB_TYPE
== "pgsql" ) {
560 $interval_qpart = "NOW() - INTERVAL '3 months'" ;
562 $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)" ;
565 $result = db_query ( $this -> link
, "SELECT ttrss_feeds.title, ttrss_feeds.site_url,
566 ttrss_feeds.feed_url, ttrss_feeds.id, MAX(updated) AS last_article
567 FROM ttrss_feeds, ttrss_entries, ttrss_user_entries WHERE
568 (SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE
569 ttrss_entries.id = ref_id AND
570 ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart
571 AND ttrss_feeds.owner_uid = " . $_SESSION [ "uid" ]. " AND
572 ttrss_user_entries.feed_id = ttrss_feeds.id AND
573 ttrss_entries.id = ref_id
574 GROUP BY ttrss_feeds.title, ttrss_feeds.id, ttrss_feeds.site_url, ttrss_feeds.feed_url
575 ORDER BY last_article" );
577 print __ ( "These feeds have not been updated with new content for 3 months (oldest first):" );
579 print "<div class= \" inactiveFeedHolder \" >" ;
581 print "<table width= \" 100% \" cellspacing= \" 0 \" id= \" prefInactiveFeedList \" >" ;
585 while ( $line = db_fetch_assoc ( $result )) {
587 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
588 $feed_id = $line [ "id" ];
589 $this_row_id = "id= \" FUPDD- $feed_id\" " ;
591 print "<tr class= \"\" $this_row_id >" ;
593 $edit_title = htmlspecialchars ( $line [ "title" ]);
595 print "<td width='5%' align='center'><input
596 onclick='toggleSelectRow2(this);' dojoType= \" dijit.form.CheckBox \"
597 type= \" checkbox \" ></td>" ;
600 print "<a class= \" visibleLink \" href= \" # \" " .
601 "title= \" " . __ ( "Click to edit feed" ). " \" " .
602 "onclick= \" editFeed(" . $line [ "id" ]. ") \" >" .
603 htmlspecialchars ( $line [ "title" ]). "</a>" ;
605 print "</td><td class= \" insensitive \" align='right'>" ;
606 print make_local_datetime ( $this -> link
, $line [ 'last_article' ], false );
616 print "<div class='dlgButtons'>" ;
617 print "<div style='float : left'>" ;
618 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('inactiveFeedsDlg').removeSelected() \" >"
619 . __ ( 'Unsubscribe from selected feeds' ). "</button> " ;
622 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('inactiveFeedsDlg').hide() \" >" .
623 __ ( 'Close this window' ). "</button>" ;
629 function feedsWithErrors () {
630 print __ ( "These feeds have not been updated because of errors:" );
632 $result = db_query ( $this -> link
, "SELECT id,title,feed_url,last_error,site_url
633 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION [ "uid" ]);
635 print "<div class= \" inactiveFeedHolder \" >" ;
637 print "<table width= \" 100% \" cellspacing= \" 0 \" id= \" prefErrorFeedList \" >" ;
641 while ( $line = db_fetch_assoc ( $result )) {
643 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
644 $feed_id = $line [ "id" ];
645 $this_row_id = "id= \" FUPDD- $feed_id\" " ;
647 print "<tr class= \"\" $this_row_id >" ;
649 $edit_title = htmlspecialchars ( $line [ "title" ]);
651 print "<td width='5%' align='center'><input
652 onclick='toggleSelectRow2(this);' dojoType= \" dijit.form.CheckBox \"
653 type= \" checkbox \" ></td>" ;
656 print "<a class= \" visibleLink \" href= \" # \" " .
657 "title= \" " . __ ( "Click to edit feed" ). " \" " .
658 "onclick= \" editFeed(" . $line [ "id" ]. ") \" >" .
659 htmlspecialchars ( $line [ "title" ]). "</a>: " ;
661 print "<span class= \" insensitive \" >" ;
662 print htmlspecialchars ( $line [ "last_error" ]);
674 print "<div class='dlgButtons'>" ;
675 print "<div style='float : left'>" ;
676 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('errorFeedsDlg').removeSelected() \" >"
677 . __ ( 'Unsubscribe from selected feeds' ). "</button> " ;
680 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('errorFeedsDlg').hide() \" >" .
681 __ ( 'Close this window' ). "</button>" ;
686 function editArticleTags () {
688 print __ ( "Tags for this article (separated by commas):" ). "<br>" ;
690 $tags = get_article_tags ( $this -> link
, $this -> param
);
692 $tags_str = join ( ", " , $tags );
694 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" id \" value= \" $this ->param \" >" ;
695 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
696 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" setArticleTags \" >" ;
698 print "<table width='100%'><tr><td>" ;
700 print "<textarea dojoType= \" dijit.form.SimpleTextarea \" rows='4'
701 style='font-size : 12px; width : 100%' id= \" tags_str \"
702 name='tags_str'> $tags_str </textarea>
703 <div class= \" autocomplete \" id= \" tags_choices \"
704 style= \" display:none \" ></div>" ;
706 print "</td></tr></table>" ;
708 print "<div class='dlgButtons'>" ;
710 print "<button dojoType= \" dijit.form.Button \"
711 onclick= \" dijit.byId('editTagsDlg').execute() \" >" . __ ( 'Save' ). "</button> " ;
712 print "<button dojoType= \" dijit.form.Button \"
713 onclick= \" dijit.byId('editTagsDlg').hide() \" >" . __ ( 'Cancel' ). "</button>" ;
718 function printTagCloud () {
719 print "<title>" . __ ( 'Tag Cloud' ). "</title>" ;
720 print "<content><![CDATA[" ;
722 print "<div class= \" tagCloudContainer \" >" ;
724 // from here: http://www.roscripts.com/Create_tag_cloud-71.html
726 $query = "SELECT tag_name, COUNT(post_int_id) AS count
727 FROM ttrss_tags WHERE owner_uid = " . $_SESSION [ "uid" ]. "
728 GROUP BY tag_name ORDER BY count DESC LIMIT 50" ;
730 $result = db_query ( $this -> link
, $query );
734 while ( $line = db_fetch_assoc ( $result )) {
735 $tags [ $line [ "tag_name" ]] = $line [ "count" ];
738 if ( count ( $tags ) == 0 ){ return ; }
742 $max_size = 32 ; // max font size in pixels
743 $min_size = 11 ; // min font size in pixels
745 // largest and smallest array values
746 $max_qty = max ( array_values ( $tags ));
747 $min_qty = min ( array_values ( $tags ));
749 // find the range of values
750 $spread = $max_qty - $min_qty ;
751 if ( $spread == 0 ) { // we don't want to divide by zero
755 // set the font-size increment
756 $step = ( $max_size - $min_size ) / ( $spread );
758 // loop through the tag array
759 foreach ( $tags as $key => $value ) {
760 // calculate font-size
761 // find the $value in excess of $min_qty
762 // multiply by the font-size increment ($size)
763 // and add the $min_size set above
764 $size = round ( $min_size +
(( $value - $min_qty ) * $step ));
766 $key_escaped = str_replace ( "'" , " \\ '" , $key );
768 echo "<a href= \" javascript:viewfeed(' $key_escaped ') \" style= \" font-size: " .
769 $size . "px \" title= \" $value articles tagged with " .
770 $key . '">' . $key . '</a> ' ;
777 print "<div align='center'>" ;
778 print "<button dojoType= \" dijit.form.Button \"
779 onclick= \" return closeInfoBox() \" >" .
780 __ ( 'Close this window' ). "</button>" ;
783 print "]]></content>" ;
786 function printTagSelect () {
788 print "<title>" . __ ( 'Select item(s) by tags' ) . "</title>" ;
789 print "<content><![CDATA[" ;
791 print __ ( "Match:" ). " " .
792 "<input class= \" noborder \" dojoType= \" dijit.form.RadioButton \" type= \" radio \" checked value= \" any \" name= \" tag_mode \" > Any " ;
793 print "<input class= \" noborder \" dojoType= \" dijit.form.RadioButton \" type= \" radio \" value= \" all \" name= \" tag_mode \" > All " ;
796 print "<select id= \" all_tags \" name= \" all_tags \" title= \" " . __ ( 'Which Tags?' ) . " \" multiple= \" multiple \" size= \" 10 \" style= \" width : 100% \" >" ;
797 $result = db_query ( $this -> link
, "SELECT DISTINCT tag_name FROM ttrss_tags WHERE owner_uid = " . $_SESSION [ 'uid' ]. "
798 AND LENGTH(tag_name) <= 30 ORDER BY tag_name ASC" );
800 while ( $row = db_fetch_assoc ( $result )) {
801 $tmp = htmlspecialchars ( $row [ "tag_name" ]);
802 print "<option value= \" " . str_replace ( " " , " %20 " , $tmp ) . " \" > $tmp </option>" ;
807 print "<div align='right'>" ;
808 print "<button dojoType= \" dijit.form.Button \" onclick= \" viewfeed(get_all_tags($('all_tags')),
809 get_radio_checked($('tag_mode'))); \" >" . __ ( 'Display entries' ) . "</button>" ;
811 print "<button dojoType= \" dijit.form.Button \"
812 onclick= \" return closeInfoBox() \" >" .
813 __ ( 'Close this window' ) . "</button>" ;
816 print "]]></content>" ;
819 function generatedFeed () {
821 print "<title>" . __ ( 'View as RSS' ). "</title>" ;
822 print "<content><![CDATA[" ;
824 $this -> params
= explode ( ":" , $this -> param
, 3 );
825 $feed_id = db_escape_string ( $this -> params
[ 0 ]);
826 $is_cat = ( bool ) $this -> params
[ 1 ];
828 $key = get_feed_access_key ( $this -> link
, $feed_id , $is_cat );
830 $url_path = htmlspecialchars ( $this -> params
[ 2 ]) . "&key=" . $key ;
832 print __ ( "You can view this feed as RSS using the following URL:" );
834 print "<div class= \" tagCloudContainer \" >" ;
835 print "<a id='gen_feed_url' href=' $url_path ' target='_blank'> $url_path </a>" ;
838 print "<div align='center'>" ;
840 print "<button dojoType= \" dijit.form.Button \" onclick= \" return genUrlChangeKey(' $feed_id ', ' $is_cat ') \" >" .
841 __ ( 'Generate new URL' ). "</button> " ;
843 print "<button dojoType= \" dijit.form.Button \" onclick= \" return closeInfoBox() \" >" .
844 __ ( 'Close this window' ). "</button>" ;
847 print "]]></content>" ;
852 function newVersion () {
854 $version_data = check_for_update ( $this -> link
);
855 $version = $version_data [ 'version' ];
856 $id = $version_data [ 'version_id' ];
858 print "<div class='tagCloudContainer'>" ;
860 print T_sprintf ( "New version of Tiny Tiny RSS is available ( %s )." ,
865 $details = "http://tt-rss.org/redmine/versions/show/ $id " ;
866 $download = "http://tt-rss.org/#Download" ;
868 print "<div style='text-align : center'>" ;
869 print "<button dojoType= \" dijit.form.Button \"
870 onclick= \" return window.open(' $details ') \" >" . __ ( "Details" ). "</button>" ;
871 print "<button dojoType= \" dijit.form.Button \"
872 onclick= \" return window.open(' $download ') \" >" . __ ( "Download" ). "</button>" ;
873 print "<button dojoType= \" dijit.form.Button \"
874 onclick= \" return dijit.byId('newVersionDlg').hide() \" >" .
875 __ ( 'Close this window' ). "</button>" ;
880 function customizeCSS () {
881 $value = get_pref ( $this -> link
, "USER_STYLESHEET" );
883 $value = str_replace ( "<br/>" , " \n " , $value );
885 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" );
887 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
888 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" setpref \" >" ;
889 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" key \" value= \" USER_STYLESHEET \" >" ;
891 print "<table width='100%'><tr><td>" ;
892 print "<textarea dojoType= \" dijit.form.SimpleTextarea \"
893 style='font-size : 12px; width : 100%; height: 200px;'
894 placeHolder='body#ttrssMain { font-size : 14px; };'
895 name='value'> $value </textarea>" ;
896 print "</td></tr></table>" ;
898 print "<div class='dlgButtons'>" ;
899 print "<button dojoType= \" dijit.form.Button \"
900 onclick= \" dijit.byId('cssEditDlg').execute() \" >" . __ ( 'Save' ). "</button> " ;
901 print "<button dojoType= \" dijit.form.Button \"
902 onclick= \" dijit.byId('cssEditDlg').hide() \" >" . __ ( 'Cancel' ). "</button>" ;
907 function addInstance () {
908 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" pref-instances \" >" ;
909 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" add \" >" ;
911 print "<div class= \" dlgSec \" >" . __ ( "Instance" ). "</div>" ;
913 print "<div class= \" dlgSecCont \" >" ;
917 print __ ( "URL:" ) . " " ;
919 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
920 placeHolder= \" " . __ ( "Instance URL" ). " \"
921 regExp='^(http|https)://.*'
922 style= \" font-size : 16px; width: 20em \" name= \" access_url \" >" ;
926 $access_key = sha1 ( uniqid ( rand (), true ));
930 print __ ( "Access key:" ) . " " ;
932 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
933 placeHolder= \" " . __ ( "Access key" ). " \" regExp='\w{40}'
934 style= \" width: 20em \" name= \" access_key \" id= \" instance_add_key \"
935 value= \" $access_key\" >" ;
937 print "<p class='insensitive'>" . __ ( "Use one access key for both linked instances." );
941 print "<div class= \" dlgButtons \" >
942 <div style='float : left'>
943 <button dojoType= \" dijit.form.Button \"
944 onclick= \" return dijit.byId('instanceAddDlg').regenKey() \" >" .
945 __ ( 'Generate new key' ). "</button>
947 <button dojoType= \" dijit.form.Button \"
948 onclick= \" return dijit.byId('instanceAddDlg').execute() \" >" .
949 __ ( 'Create link' ). "</button>
950 <button dojoType= \" dijit.form.Button \"
951 onclick= \" return dijit.byId('instanceAddDlg').hide() \"\" >" .
952 __ ( 'Cancel' ). "</button></div>" ;