]>
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 "<div dojoType= \" dijit.form.DropDownButton \" >" .
84 "<span>" . __ ( 'Select' ). "</span>" ;
85 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
86 print "<div onclick= \" selectTableRows('prefFeedProfileList', 'all') \"
87 dojoType= \" dijit.MenuItem \" >" . __ ( 'All' ). "</div>" ;
88 print "<div onclick= \" selectTableRows('prefFeedProfileList', 'none') \"
89 dojoType= \" dijit.MenuItem \" >" . __ ( 'None' ). "</div>" ;
92 print "<div style= \" float : right \" >" ;
94 print "<input name= \" newprofile \" dojoType= \" dijit.form.ValidationTextBox \"
96 <button dojoType= \" dijit.form.Button \"
97 onclick= \" dijit.byId('profileEditDlg').addProfile() \" >" .
98 __ ( 'Create profile' ). "</button></div>" ;
102 $result = db_query ( $this -> link
, "SELECT title,id FROM ttrss_settings_profiles
103 WHERE owner_uid = " . $_SESSION [ "uid" ]. " ORDER BY title" );
105 print "<div class= \" prefFeedCatHolder \" >" ;
107 print "<form id= \" profile_edit_form \" onsubmit= \" return false \" >" ;
109 print "<table width= \" 100% \" class= \" prefFeedProfileList \"
110 cellspacing= \" 0 \" id= \" prefFeedProfileList \" >" ;
112 print "<tr class= \" placeholder \" id= \" FCATR-0 \" >" ; #odd
114 print "<td width='5%' align='center'><input
116 onclick='toggleSelectRow2(this);'
117 dojoType= \" dijit.form.CheckBox \"
118 type= \" checkbox \" ></td>" ;
120 if (! $_SESSION [ "profile" ]) {
121 $is_active = __ ( "(active)" );
127 __ ( "Default profile" ) . " $is_active </span></td>" ;
133 while ( $line = db_fetch_assoc ( $result )) {
135 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
137 $profile_id = $line [ "id" ];
138 $this_row_id = "id= \" FCATR- $profile_id\" " ;
140 print "<tr class= \" placeholder \" $this_row_id >" ;
142 $edit_title = htmlspecialchars ( $line [ "title" ]);
144 print "<td width='5%' align='center'><input
145 onclick='toggleSelectRow2(this);'
146 id='FCATC- $profile_id '
147 dojoType= \" dijit.form.CheckBox \"
148 type= \" checkbox \" ></td>" ;
150 if ( $_SESSION [ "profile" ] == $line [ "id" ]) {
151 $is_active = __ ( "(active)" );
156 print "<td><span dojoType= \" dijit.InlineEditBox \"
157 width= \" 300px \" autoSave= \" false \"
158 profile-id= \" $profile_id\" >" . $edit_title .
159 "<script type= \" dojo/method \" event= \" onChange \" args= \" item \" >
163 content: {op: 'rpc', method: 'saveprofile',
165 id: this.srcNodeRef.getAttribute('profile-id')},
166 load: function(response) {
167 elem.attr('value', response);
171 </span> $is_active </td>" ;
182 print "<div class='dlgButtons'>
183 <div style='float : left'>
184 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('profileEditDlg').removeSelected() \" >" .
185 __ ( 'Remove selected profiles' ). "</button>
186 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('profileEditDlg').activateProfile() \" >" .
187 __ ( 'Activate profile' ). "</button>
190 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('profileEditDlg').hide() \" >" .
191 __ ( 'Close this window' ). "</button>" ;
196 function pubOPMLUrl () {
197 print "<title>" . __ ( 'Public OPML URL' ). "</title>" ;
198 print "<content><![CDATA[" ;
200 $url_path = opml_publish_url ( $this -> link
);
202 print __ ( "Your Public OPML URL is:" );
204 print "<div class= \" tagCloudContainer \" >" ;
205 print "<a id='pub_opml_url' href=' $url_path ' target='_blank'> $url_path </a>" ;
208 print "<div align='center'>" ;
210 print "<button dojoType= \" dijit.form.Button \" onclick= \" return opmlRegenKey() \" >" .
211 __ ( 'Generate new URL' ). "</button> " ;
213 print "<button dojoType= \" dijit.form.Button \" onclick= \" return closeInfoBox() \" >" .
214 __ ( 'Close this window' ). "</button>" ;
217 print "]]></content>" ;
222 function explainError () {
223 print "<title>" . __ ( 'Notice' ). "</title>" ;
224 print "<content><![CDATA[" ;
226 print "<div class= \" errorExplained \" >" ;
228 if ( $this -> param
== 1 ) {
229 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." );
231 $stamp = ( int ) file_get_contents ( LOCK_DIRECTORY
. "/update_daemon.stamp" );
233 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
237 if ( $this -> param
== 3 ) {
238 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." );
240 $stamp = ( int ) file_get_contents ( LOCK_DIRECTORY
. "/update_daemon.stamp" );
242 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
248 print "<div align='center'>" ;
250 print "<button onclick= \" return closeInfoBox() \" >" .
251 __ ( 'Close this window' ). "</button>" ;
254 print "]]></content>" ;
259 function quickAddFeed () {
260 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
261 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" addfeed \" >" ;
263 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
264 print "<div class= \" dlgSecCont \" >" ;
266 print "<input style= \" font-size : 16px; width : 20em; \"
267 placeHolder= \" " . __ ( "Feed URL" ). " \"
268 dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \" name= \" feed \" id= \" feedDlg_feedUrl \" >" ;
272 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
273 print __ ( 'Place in category:' ) . " " ;
274 print_feed_cat_select ( $this -> link
, "cat" , false , 'dojoType="dijit.form.Select"' );
279 print '<div id="feedDlg_feedsContainer" style="display : none">
281 <div class="dlgSec">' . __ ( 'Available feeds' ) . '</div>
282 <div class="dlgSecCont">' .
283 '<select id="feedDlg_feedContainerSelect"
284 dojoType="dijit.form.Select" size="3">
285 <script type="dojo/method" event="onChange" args="value">
286 dijit.byId("feedDlg_feedUrl").attr("value", value);
291 print "<div id='feedDlg_loginContainer' style='display : none'>
293 <div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>
294 <div class= \" dlgSecCont \" >" .
296 " <input dojoType= \" dijit.form.TextBox \" name='login' \"
297 placeHolder= \" " . __ ( "Login" ). " \"
298 style= \" width : 10em; \" > " .
300 placeHolder= \" " . __ ( "Password" ). " \"
301 dojoType= \" dijit.form.TextBox \" type='password'
302 style= \" width : 10em; \" name='pass' \" >" .
303 " <p class='insensitive'>" . __ ( "OAuth will be used automatically for Twitter feeds." ). "</p>
307 print "<div style= \" clear : both \" >
308 <input type= \" checkbox \" name= \" need_auth \" dojoType= \" dijit.form.CheckBox \" id= \" feedDlg_loginCheck \"
309 onclick='checkboxToggleElement(this, \" feedDlg_loginContainer \" )'>
310 <label for= \" feedDlg_loginCheck \" >" .
311 __ ( 'This feed requires authentication.' ). "</div>" ;
315 print "<div class= \" dlgButtons \" >
316 <button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('feedAddDlg').execute() \" >" . __ ( 'Subscribe' ). "</button>
317 <button dojoType= \" dijit.form.Button \" onclick= \" return feedBrowser() \" >" . __ ( 'More feeds' ). "</button>
318 <button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('feedAddDlg').hide() \" >" . __ ( 'Cancel' ). "</button>
324 function feedBrowser () {
325 $browser_search = db_escape_string ( $_REQUEST [ "search" ]);
327 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
328 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" updateFeedBrowser \" >" ;
330 print "<div dojoType= \" dijit.Toolbar \" >
331 <div style='float : right'>
332 <img style='display : none'
333 id='feed_browser_spinner' src='" .
334 theme_image ( $this -> link
, 'images/indicator_white.gif' ). "'>
335 <input name= \" search \" dojoType= \" dijit.form.TextBox \" size= \" 20 \" type= \" search \"
336 onchange= \" dijit.byId('feedBrowserDlg').update() \" value= \" $browser_search\" >
337 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedBrowserDlg').update() \" >" . __ ( 'Search' ). "</button>
340 print " <select name= \" mode \" dojoType= \" dijit.form.Select \" onchange= \" dijit.byId('feedBrowserDlg').update() \" >
341 <option value='1'>" . __ ( 'Popular feeds' ) . "</option>
342 <option value='2'>" . __ ( 'Feed archive' ) . "</option>
347 print " <select dojoType= \" dijit.form.Select \" name= \" limit \" onchange= \" dijit.byId('feedBrowserDlg').update() \" >" ;
349 foreach ( array ( 25 , 50 , 100 , 200 ) as $l ) {
350 $issel = ( $l == $limit ) ?
"selected= \" 1 \" " : "" ;
351 print "<option $issel value= \" $l\" > $l </option>" ;
358 $owner_uid = $_SESSION [ "uid" ];
360 print "<ul class='browseFeedList' id='browseFeedList'>" ;
361 print make_feed_browser ( $this -> link
, $search , 25 );
364 print "<div align='center'>
365 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedBrowserDlg').execute() \" >" . __ ( 'Subscribe' ). "</button>
366 <button dojoType= \" dijit.form.Button \" style='display : none' id='feed_archive_remove' onclick= \" dijit.byId('feedBrowserDlg').removeFromArchive() \" >" . __ ( 'Remove' ). "</button>
367 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedBrowserDlg').hide() \" >" . __ ( 'Cancel' ). "</button></div>" ;
372 $this -> params
= explode ( ":" , db_escape_string ( $_REQUEST [ "param" ]), 2 );
374 $active_feed_id = sprintf ( " %d " , $this -> params
[ 0 ]);
375 $is_cat = $this -> params
[ 1 ] != "false" ;
377 print "<div class= \" dlgSec \" >" . __ ( 'Look for' ). "</div>" ;
379 print "<div class= \" dlgSecCont \" >" ;
381 if (! SPHINX_ENABLED
) {
383 print "<input dojoType= \" dijit.form.ValidationTextBox \"
384 style= \" font-size : 16px; width : 12em; \"
385 required= \" 1 \" name= \" query \" type= \" search \" value=''>" ;
387 print " " . __ ( 'match on' ). " " ;
389 $search_fields = array (
390 "title" => __ ( "Title" ),
391 "content" => __ ( "Content" ),
392 "both" => __ ( "Title or content" ));
394 print_select_hash ( "match_on" , 3 , $search_fields ,
395 'dojoType="dijit.form.Select"' );
397 print "<input dojoType= \" dijit.form.ValidationTextBox \"
398 style= \" font-size : 16px; width : 20em; \"
399 required= \" 1 \" name= \" query \" type= \" search \" value=''>" ;
403 print "<hr/>" . __ ( 'Limit search to:' ). " " ;
405 print "<select name= \" search_mode \" dojoType= \" dijit.form.Select \" >
406 <option value= \" all_feeds \" >" . __ ( 'All feeds' ). "</option>" ;
408 $feed_title = getFeedTitle ( $this -> link
, $active_feed_id );
411 $feed_cat_title = getFeedCatTitle ( $this -> link
, $active_feed_id );
413 $feed_cat_title = getCategoryTitle ( $this -> link
, $active_feed_id );
416 if ( $active_feed_id && ! $is_cat ) {
417 print "<option selected= \" 1 \" value= \" this_feed \" > $feed_title </option>" ;
419 print "<option disabled= \" 1 \" value= \" false \" >" . __ ( 'This feed' ). "</option>" ;
423 $cat_preselected = "selected= \" 1 \" " ;
426 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' ) && ( $active_feed_id > 0 ||
$is_cat )) {
427 print "<option $cat_preselected value= \" this_cat \" > $feed_cat_title </option>" ;
429 //print "<option disabled>".__('This category')."</option>";
436 print "<div class= \" dlgButtons \" >" ;
438 if (! SPHINX_ENABLED
) {
439 print "<div style= \" float : left \" >
440 <a class= \" visibleLink \" target= \" _blank \" href= \" http://tt-rss.org/redmine/wiki/tt-rss/SearchSyntax \" >Search syntax</a>
444 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('searchDlg').execute() \" >" . __ ( 'Search' ). "</button>
445 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('searchDlg').hide() \" >" . __ ( 'Cancel' ). "</button>
449 function quickAddFilter () {
450 $active_feed_id = db_escape_string ( $_REQUEST [ "param" ]);
452 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" pref-filters \" >" ;
453 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" quiet \" value= \" 1 \" >" ;
454 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" add \" >" ;
455 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" csrf_token \" value= \" " . $_SESSION [ 'csrf_token' ]. " \" >" ;
457 $result = db_query ( $this -> link
, "SELECT id,description
458 FROM ttrss_filter_types ORDER BY description" );
460 $filter_types = array ();
462 while ( $line = db_fetch_assoc ( $result )) {
463 //array_push($filter_types, $line["description"]);
464 $filter_types [ $line [ "id" ]] = __ ( $line [ "description" ]);
467 print "<div class= \" dlgSec \" >" . __ ( "Match" ). "</div>" ;
469 print "<div class= \" dlgSecCont \" >" ;
471 print "<span id= \" filterDlg_dateModBox \" style= \" display : none \" >" ;
473 $filter_params = array (
474 "before" => __ ( "before" ),
475 "after" => __ ( "after" ));
477 print_select_hash ( "filter_date_modifier" , "before" ,
478 $filter_params , 'dojoType="dijit.form.Select"' );
480 print " </span>" ;
482 print "<input dojoType= \" dijit.form.ValidationTextBox \"
483 required= \" true \" id= \" filterDlg_regExp \"
484 style= \" font-size : 16px \"
485 name= \" reg_exp \" value= \" $reg_exp\" />" ;
487 print "<span id= \" filterDlg_dateChkBox \" style= \" display : none \" >" ;
488 print " <button dojoType= \" dijit.form.Button \"
489 onclick= \" return filterDlgCheckDate() \" >" .
490 __ ( 'Check it' ). "</button>" ;
493 print "<hr/>" . __ ( "on field" ) . " " ;
494 print_select_hash ( "filter_type" , 1 , $filter_types ,
495 'onchange="filterDlgCheckType(this)" dojoType="dijit.form.Select"' );
499 print __ ( "in" ) . " " ;
501 print "<span id='filterDlg_feeds'>" ;
502 print_feed_select ( $this -> link
, "feed_id" , $active_feed_id ,
503 'dojoType="dijit.form.FilteringSelect"' );
506 print "<span id='filterDlg_cats' style='display : none'>" ;
507 print_feed_cat_select ( $this -> link
, "cat_id" , $active_cat_id ,
508 'dojoType="dijit.form.FilteringSelect"' );
513 print "<div class= \" dlgSec \" >" . __ ( "Perform Action" ). "</div>" ;
515 print "<div class= \" dlgSecCont \" >" ;
517 print "<select name= \" action_id \" dojoType= \" dijit.form.Select \"
518 onchange= \" filterDlgCheckAction(this) \" >" ;
520 $result = db_query ( $this -> link
, "SELECT id,description FROM ttrss_filter_actions
523 while ( $line = db_fetch_assoc ( $result )) {
524 printf ( "<option value=' %d '> %s </option>" , $line [ "id" ], __ ( $line [ "description" ]));
529 print "<span id= \" filterDlg_paramBox \" style= \" display : none \" >" ;
530 print " " . __ ( "with parameters:" ) . " " ;
531 print "<input dojoType= \" dijit.form.TextBox \"
532 id= \" filterDlg_actionParam \"
533 name= \" action_param \" >" ;
535 print_label_select ( $this -> link
, "action_param_label" , $action_param ,
536 'id="filterDlg_actionParamLabel" dojoType="dijit.form.Select"' );
540 print " " ; // tiny layout hack
544 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
545 print "<div class= \" dlgSecCont \" >" ;
547 print "<input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" name= \" enabled \" id= \" enabled \" checked= \" 1 \" >
548 <label for= \" enabled \" >" . __ ( 'Enabled' ). "</label><hr/>" ;
550 print "<input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" name= \" inverse \" id= \" inverse \" >
551 <label for= \" inverse \" >" . __ ( 'Inverse match' ). "</label><hr/>" ;
553 print "<input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" name= \" cat_filter \" id= \" cat_filter \" onchange= \" filterDlgCheckCat(this) \" >
554 <label for= \" cat_filter \" >" . __ ( 'Apply to category' ). "</label><hr/>" ;
559 print "<div class= \" dlgButtons \" >" ;
561 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('filterEditDlg').test() \" >" .
562 __ ( 'Test' ). "</button> " ;
564 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('filterEditDlg').execute() \" >" .
565 __ ( 'Create' ). "</button> " ;
567 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('filterEditDlg').hide() \" >" .
568 __ ( 'Cancel' ). "</button>" ;
573 function inactiveFeeds () {
575 if ( DB_TYPE
== "pgsql" ) {
576 $interval_qpart = "NOW() - INTERVAL '3 months'" ;
578 $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)" ;
581 $result = db_query ( $this -> link
, "SELECT ttrss_feeds.title, ttrss_feeds.site_url,
582 ttrss_feeds.feed_url, ttrss_feeds.id, MAX(updated) AS last_article
583 FROM ttrss_feeds, ttrss_entries, ttrss_user_entries WHERE
584 (SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE
585 ttrss_entries.id = ref_id AND
586 ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart
587 AND ttrss_feeds.owner_uid = " . $_SESSION [ "uid" ]. " AND
588 ttrss_user_entries.feed_id = ttrss_feeds.id AND
589 ttrss_entries.id = ref_id
590 GROUP BY ttrss_feeds.title, ttrss_feeds.id, ttrss_feeds.site_url, ttrss_feeds.feed_url
591 ORDER BY last_article" );
593 print "<div class= \" dialogNotice \" >" . __ ( "These feeds have not been updated with new content for 3 months (oldest first):" ) . "</div>" ;
595 print "<div dojoType= \" dijit.Toolbar \" >" ;
596 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
597 "<span>" . __ ( 'Select' ). "</span>" ;
598 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
599 print "<div onclick= \" selectTableRows('prefInactiveFeedList', 'all') \"
600 dojoType= \" dijit.MenuItem \" >" . __ ( 'All' ). "</div>" ;
601 print "<div onclick= \" selectTableRows('prefInactiveFeedList', 'none') \"
602 dojoType= \" dijit.MenuItem \" >" . __ ( 'None' ). "</div>" ;
603 print "</div></div>" ;
604 print "</div>" ; #toolbar
606 print "<div class= \" inactiveFeedHolder \" >" ;
608 print "<table width= \" 100% \" cellspacing= \" 0 \" id= \" prefInactiveFeedList \" >" ;
612 while ( $line = db_fetch_assoc ( $result )) {
614 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
615 $feed_id = $line [ "id" ];
616 $this_row_id = "id= \" FUPDD- $feed_id\" " ;
618 # class needed for selectTableRows()
619 print "<tr class= \" placeholder \" $this_row_id >" ;
621 $edit_title = htmlspecialchars ( $line [ "title" ]);
623 # id needed for selectTableRows()
624 print "<td width='5%' align='center'><input
625 onclick='toggleSelectRow2(this);' dojoType= \" dijit.form.CheckBox \"
626 type= \" checkbox \" id= \" FUPDC- $feed_id\" ></td>" ;
629 print "<a class= \" visibleLink \" href= \" # \" " .
630 "title= \" " . __ ( "Click to edit feed" ). " \" " .
631 "onclick= \" editFeed(" . $line [ "id" ]. ") \" >" .
632 htmlspecialchars ( $line [ "title" ]). "</a>" ;
634 print "</td><td class= \" insensitive \" align='right'>" ;
635 print make_local_datetime ( $this -> link
, $line [ 'last_article' ], false );
645 print "<div class='dlgButtons'>" ;
646 print "<div style='float : left'>" ;
647 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('inactiveFeedsDlg').removeSelected() \" >"
648 . __ ( 'Unsubscribe from selected feeds' ). "</button> " ;
651 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('inactiveFeedsDlg').hide() \" >" .
652 __ ( 'Close this window' ). "</button>" ;
658 function feedsWithErrors () {
659 print "<div class= \" dialogNotice \" >" . __ ( "These feeds have not been updated because of errors:" ) . "</div>" ;
661 $result = db_query ( $this -> link
, "SELECT id,title,feed_url,last_error,site_url
662 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION [ "uid" ]);
664 print "<div dojoType= \" dijit.Toolbar \" >" ;
665 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
666 "<span>" . __ ( 'Select' ). "</span>" ;
667 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
668 print "<div onclick= \" selectTableRows('prefErrorFeedList', 'all') \"
669 dojoType= \" dijit.MenuItem \" >" . __ ( 'All' ). "</div>" ;
670 print "<div onclick= \" selectTableRows('prefErrorFeedList', 'none') \"
671 dojoType= \" dijit.MenuItem \" >" . __ ( 'None' ). "</div>" ;
672 print "</div></div>" ;
673 print "</div>" ; #toolbar
675 print "<div class= \" inactiveFeedHolder \" >" ;
677 print "<table width= \" 100% \" cellspacing= \" 0 \" id= \" prefErrorFeedList \" >" ;
681 while ( $line = db_fetch_assoc ( $result )) {
683 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
684 $feed_id = $line [ "id" ];
685 $this_row_id = "id= \" FUPDD- $feed_id\" " ;
687 # class needed for selectTableRows()
688 print "<tr class= \" placeholder \" $this_row_id >" ;
690 $edit_title = htmlspecialchars ( $line [ "title" ]);
692 # id needed for selectTableRows()
693 print "<td width='5%' align='center'><input
694 onclick='toggleSelectRow2(this);' dojoType= \" dijit.form.CheckBox \"
695 type= \" checkbox \" id= \" FUPDC- $feed_id\" ></td>" ;
698 print "<a class= \" visibleLink \" href= \" # \" " .
699 "title= \" " . __ ( "Click to edit feed" ). " \" " .
700 "onclick= \" editFeed(" . $line [ "id" ]. ") \" >" .
701 htmlspecialchars ( $line [ "title" ]). "</a>: " ;
703 print "<span class= \" insensitive \" >" ;
704 print htmlspecialchars ( $line [ "last_error" ]);
716 print "<div class='dlgButtons'>" ;
717 print "<div style='float : left'>" ;
718 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('errorFeedsDlg').removeSelected() \" >"
719 . __ ( 'Unsubscribe from selected feeds' ). "</button> " ;
722 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('errorFeedsDlg').hide() \" >" .
723 __ ( 'Close this window' ). "</button>" ;
728 function editArticleTags () {
730 print __ ( "Tags for this article (separated by commas):" ). "<br>" ;
732 $tags = get_article_tags ( $this -> link
, $this -> param
);
734 $tags_str = join ( ", " , $tags );
736 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" id \" value= \" $this ->param \" >" ;
737 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
738 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" setArticleTags \" >" ;
740 print "<table width='100%'><tr><td>" ;
742 print "<textarea dojoType= \" dijit.form.SimpleTextarea \" rows='4'
743 style='font-size : 12px; width : 100%' id= \" tags_str \"
744 name='tags_str'> $tags_str </textarea>
745 <div class= \" autocomplete \" id= \" tags_choices \"
746 style= \" display:none \" ></div>" ;
748 print "</td></tr></table>" ;
750 print "<div class='dlgButtons'>" ;
752 print "<button dojoType= \" dijit.form.Button \"
753 onclick= \" dijit.byId('editTagsDlg').execute() \" >" . __ ( 'Save' ). "</button> " ;
754 print "<button dojoType= \" dijit.form.Button \"
755 onclick= \" dijit.byId('editTagsDlg').hide() \" >" . __ ( 'Cancel' ). "</button>" ;
760 function printTagCloud () {
761 print "<title>" . __ ( 'Tag Cloud' ). "</title>" ;
762 print "<content><![CDATA[" ;
764 print "<div class= \" tagCloudContainer \" >" ;
766 // from here: http://www.roscripts.com/Create_tag_cloud-71.html
768 $query = "SELECT tag_name, COUNT(post_int_id) AS count
769 FROM ttrss_tags WHERE owner_uid = " . $_SESSION [ "uid" ]. "
770 GROUP BY tag_name ORDER BY count DESC LIMIT 50" ;
772 $result = db_query ( $this -> link
, $query );
776 while ( $line = db_fetch_assoc ( $result )) {
777 $tags [ $line [ "tag_name" ]] = $line [ "count" ];
780 if ( count ( $tags ) == 0 ){ return ; }
784 $max_size = 32 ; // max font size in pixels
785 $min_size = 11 ; // min font size in pixels
787 // largest and smallest array values
788 $max_qty = max ( array_values ( $tags ));
789 $min_qty = min ( array_values ( $tags ));
791 // find the range of values
792 $spread = $max_qty - $min_qty ;
793 if ( $spread == 0 ) { // we don't want to divide by zero
797 // set the font-size increment
798 $step = ( $max_size - $min_size ) / ( $spread );
800 // loop through the tag array
801 foreach ( $tags as $key => $value ) {
802 // calculate font-size
803 // find the $value in excess of $min_qty
804 // multiply by the font-size increment ($size)
805 // and add the $min_size set above
806 $size = round ( $min_size +
(( $value - $min_qty ) * $step ));
808 $key_escaped = str_replace ( "'" , " \\ '" , $key );
810 echo "<a href= \" javascript:viewfeed(' $key_escaped ') \" style= \" font-size: " .
811 $size . "px \" title= \" $value articles tagged with " .
812 $key . '">' . $key . '</a> ' ;
819 print "<div align='center'>" ;
820 print "<button dojoType= \" dijit.form.Button \"
821 onclick= \" return closeInfoBox() \" >" .
822 __ ( 'Close this window' ). "</button>" ;
825 print "]]></content>" ;
828 function printTagSelect () {
830 print "<title>" . __ ( 'Select item(s) by tags' ) . "</title>" ;
831 print "<content><![CDATA[" ;
833 print __ ( "Match:" ). " " .
834 "<input class= \" noborder \" dojoType= \" dijit.form.RadioButton \" type= \" radio \" checked value= \" any \" name= \" tag_mode \" > Any " ;
835 print "<input class= \" noborder \" dojoType= \" dijit.form.RadioButton \" type= \" radio \" value= \" all \" name= \" tag_mode \" > All " ;
838 print "<select id= \" all_tags \" name= \" all_tags \" title= \" " . __ ( 'Which Tags?' ) . " \" multiple= \" multiple \" size= \" 10 \" style= \" width : 100% \" >" ;
839 $result = db_query ( $this -> link
, "SELECT DISTINCT tag_name FROM ttrss_tags WHERE owner_uid = " . $_SESSION [ 'uid' ]. "
840 AND LENGTH(tag_name) <= 30 ORDER BY tag_name ASC" );
842 while ( $row = db_fetch_assoc ( $result )) {
843 $tmp = htmlspecialchars ( $row [ "tag_name" ]);
844 print "<option value= \" " . str_replace ( " " , " %20 " , $tmp ) . " \" > $tmp </option>" ;
849 print "<div align='right'>" ;
850 print "<button dojoType= \" dijit.form.Button \" onclick= \" viewfeed(get_all_tags($('all_tags')),
851 get_radio_checked($('tag_mode'))); \" >" . __ ( 'Display entries' ) . "</button>" ;
853 print "<button dojoType= \" dijit.form.Button \"
854 onclick= \" return closeInfoBox() \" >" .
855 __ ( 'Close this window' ) . "</button>" ;
858 print "]]></content>" ;
861 function generatedFeed () {
863 print "<title>" . __ ( 'View as RSS' ). "</title>" ;
864 print "<content><![CDATA[" ;
866 $this -> params
= explode ( ":" , $this -> param
, 3 );
867 $feed_id = db_escape_string ( $this -> params
[ 0 ]);
868 $is_cat = ( bool ) $this -> params
[ 1 ];
870 $key = get_feed_access_key ( $this -> link
, $feed_id , $is_cat );
872 $url_path = htmlspecialchars ( $this -> params
[ 2 ]) . "&key=" . $key ;
874 print "<div class= \" dialogNotice \" >" . __ ( "You can view this feed as RSS using the following URL:" ) . "</div>" ;
876 print "<div class= \" tagCloudContainer \" >" ;
877 print "<a id='gen_feed_url' href=' $url_path ' target='_blank'> $url_path </a>" ;
880 print "<div align='center'>" ;
882 print "<button dojoType= \" dijit.form.Button \" onclick= \" return genUrlChangeKey(' $feed_id ', ' $is_cat ') \" >" .
883 __ ( 'Generate new URL' ). "</button> " ;
885 print "<button dojoType= \" dijit.form.Button \" onclick= \" return closeInfoBox() \" >" .
886 __ ( 'Close this window' ). "</button>" ;
889 print "]]></content>" ;
894 function newVersion () {
896 $version_data = check_for_update ( $this -> link
);
897 $version = $version_data [ 'version' ];
898 $id = $version_data [ 'version_id' ];
900 print "<div class='tagCloudContainer'>" ;
902 print T_sprintf ( "New version of Tiny Tiny RSS is available ( %s )." ,
907 $details = "http://tt-rss.org/redmine/versions/show/ $id " ;
908 $download = "http://tt-rss.org/#Download" ;
910 print "<div style='text-align : center'>" ;
911 print "<button dojoType= \" dijit.form.Button \"
912 onclick= \" return window.open(' $details ') \" >" . __ ( "Details" ). "</button>" ;
913 print "<button dojoType= \" dijit.form.Button \"
914 onclick= \" return window.open(' $download ') \" >" . __ ( "Download" ). "</button>" ;
915 print "<button dojoType= \" dijit.form.Button \"
916 onclick= \" return dijit.byId('newVersionDlg').hide() \" >" .
917 __ ( 'Close this window' ). "</button>" ;
922 function customizeCSS () {
923 $value = get_pref ( $this -> link
, "USER_STYLESHEET" );
925 $value = str_replace ( "<br/>" , " \n " , $value );
927 print "<div class= \" dialogNotice \" >" ;
928 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" );
931 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
932 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" setpref \" >" ;
933 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" key \" value= \" USER_STYLESHEET \" >" ;
935 print "<table width='100%'><tr><td>" ;
936 print "<textarea dojoType= \" dijit.form.SimpleTextarea \"
937 style='font-size : 12px; width : 100%; height: 200px;'
938 placeHolder='body#ttrssMain { font-size : 14px; };'
939 name='value'> $value </textarea>" ;
940 print "</td></tr></table>" ;
942 print "<div class='dlgButtons'>" ;
943 print "<button dojoType= \" dijit.form.Button \"
944 onclick= \" dijit.byId('cssEditDlg').execute() \" >" . __ ( 'Save' ). "</button> " ;
945 print "<button dojoType= \" dijit.form.Button \"
946 onclick= \" dijit.byId('cssEditDlg').hide() \" >" . __ ( 'Cancel' ). "</button>" ;
951 function addInstance () {
952 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" pref-instances \" >" ;
953 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" add \" >" ;
955 print "<div class= \" dlgSec \" >" . __ ( "Instance" ). "</div>" ;
957 print "<div class= \" dlgSecCont \" >" ;
961 print __ ( "URL:" ) . " " ;
963 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
964 placeHolder= \" " . __ ( "Instance URL" ). " \"
965 regExp='^(http|https)://.*'
966 style= \" font-size : 16px; width: 20em \" name= \" access_url \" >" ;
970 $access_key = sha1 ( uniqid ( rand (), true ));
974 print __ ( "Access key:" ) . " " ;
976 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
977 placeHolder= \" " . __ ( "Access key" ). " \" regExp='\w{40}'
978 style= \" width: 20em \" name= \" access_key \" id= \" instance_add_key \"
979 value= \" $access_key\" >" ;
981 print "<p class='insensitive'>" . __ ( "Use one access key for both linked instances." );
985 print "<div class= \" dlgButtons \" >
986 <div style='float : left'>
987 <button dojoType= \" dijit.form.Button \"
988 onclick= \" return dijit.byId('instanceAddDlg').regenKey() \" >" .
989 __ ( 'Generate new key' ). "</button>
991 <button dojoType= \" dijit.form.Button \"
992 onclick= \" return dijit.byId('instanceAddDlg').execute() \" >" .
993 __ ( 'Create link' ). "</button>
994 <button dojoType= \" dijit.form.Button \"
995 onclick= \" return dijit.byId('instanceAddDlg').hide() \"\" >" .
996 __ ( 'Cancel' ). "</button></div>" ;
1001 function dataImport () {
1002 header ( "Content-Type: text/html" ); # required for iframe
1004 print "<div style='text-align : center'>" ;
1006 if ( is_file ( $_FILES [ 'export_file' ][ 'tmp_name' ])) {
1008 perform_data_import ( $this -> link
, $_FILES [ 'export_file' ][ 'tmp_name' ], $_SESSION [ 'uid' ]);
1011 print "<p>" . T_sprintf ( "Could not upload file. You might need to adjust upload_max_filesize
1012 in PHP.ini (current value = %s )" , ini_get ( "upload_max_filesize" )) . " or use CLI import tool.</p>" ;
1016 print "<button dojoType= \" dijit.form.Button \"
1017 onclick= \" dijit.byId('dataImportDlg').hide() \" >" .
1018 __ ( 'Close this window' ). "</button>" ;
1024 function batchSubscribe () {
1025 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
1026 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" batchaddfeeds \" >" ;
1028 print "<table width='100%'><tr><td>
1029 " . __ ( "Add one valid RSS feed per line (no feed detection is done)" ). "
1030 </td><td align='right'>" ;
1031 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
1032 print __ ( 'Place in category:' ) . " " ;
1033 print_feed_cat_select ( $this -> link
, "cat" , false , 'dojoType="dijit.form.Select"' );
1035 print "</td></tr><tr><td colspan='2'>" ;
1037 style='font-size : 12px; width : 100%; height: 200px;'
1038 placeHolder= \" " . __ ( "Feeds to subscribe, One per line" ). " \"
1039 dojoType= \" dijit.form.SimpleTextarea \" required= \" 1 \" name= \" feeds \" ></textarea>" ;
1041 print "</td></tr><tr><td colspan='2'>" ;
1043 print "<div id='feedDlg_loginContainer' style='display : none'>
1045 " <input dojoType= \" dijit.form.TextBox \" name='login' \"
1046 placeHolder= \" " . __ ( "Login" ). " \"
1047 style= \" width : 10em; \" > " .
1049 placeHolder= \" " . __ ( "Password" ). " \"
1050 dojoType= \" dijit.form.TextBox \" type='password'
1051 style= \" width : 10em; \" name='pass' \" >" .
1052 " <p class='insensitive'>" . __ ( "OAuth will be used automatically for Twitter feeds." ). "</p>
1055 print "</td></tr><tr><td colspan='2'>" ;
1057 print "<div style= \" clear : both \" >
1058 <input type= \" checkbox \" name= \" need_auth \" dojoType= \" dijit.form.CheckBox \" id= \" feedDlg_loginCheck \"
1059 onclick='checkboxToggleElement(this, \" feedDlg_loginContainer \" )'>
1060 <label for= \" feedDlg_loginCheck \" >" .
1061 __ ( 'Feeds require authentication.' ). "</div>" ;
1065 print "</td></tr></table>" ;
1067 print "<div class= \" dlgButtons \" >
1068 <button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('batchSubDlg').execute() \" >" . __ ( 'Subscribe' ). "</button>
1069 <button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('batchSubDlg').hide() \" >" . __ ( 'Cancel' ). "</button>