]>
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 importOpml () {
20 header ( "Content-Type: text/html" ); # required for iframe
22 print "<div class= \" prefFeedOPMLHolder \" >" ;
23 $owner_uid = $_SESSION [ "uid" ];
25 db_query ( $this -> link
, "BEGIN" );
27 /* create Imported feeds category just in case */
29 $result = db_query ( $this -> link
, "SELECT id FROM
30 ttrss_feed_categories WHERE title = 'Imported feeds' AND
31 owner_uid = ' $owner_uid ' LIMIT 1" );
33 if ( db_num_rows ( $result ) == 0 ) {
34 db_query ( $this -> link
, "INSERT INTO ttrss_feed_categories
36 VALUES ('Imported feeds', ' $owner_uid ')" );
39 db_query ( $this -> link
, "COMMIT" );
41 /* Handle OPML import by DOMXML/DOMDocument */
43 print "<ul class='nomarks'>" ;
44 print "<li>" . __ ( "Importing using DOMDocument." ). "</li>" ;
45 require_once "opml.php" ;
46 opml_import_domdoc ( $this -> link
, $owner_uid );
50 print "<div align='center'>" ;
51 print "<button dojoType= \" dijit.form.Button \"
52 onclick= \" dijit.byId('opmlImportDlg').hide() \" >" .
53 __ ( 'Close this window' ). "</button>" ;
61 function editPrefProfiles () {
62 print "<div dojoType= \" dijit.Toolbar \" >" ;
64 print "<input name= \" newprofile \" dojoType= \" dijit.form.ValidationTextBox \"
66 <button dojoType= \" dijit.form.Button \"
67 onclick= \" dijit.byId('profileEditDlg').addProfile() \" >" .
68 __ ( 'Create profile' ). "</button></div>" ;
70 $result = db_query ( $this -> link
, "SELECT title,id FROM ttrss_settings_profiles
71 WHERE owner_uid = " . $_SESSION [ "uid" ]. " ORDER BY title" );
73 print "<div class= \" prefFeedCatHolder \" >" ;
75 print "<form id= \" profile_edit_form \" onsubmit= \" return false \" >" ;
77 print "<table width= \" 100% \" class= \" prefFeedProfileList \"
78 cellspacing= \" 0 \" id= \" prefFeedProfileList \" >" ;
80 print "<tr class= \"\" id= \" FCATR-0 \" >" ; #odd
82 print "<td width='5%' align='center'><input
83 onclick='toggleSelectRow2(this);'
84 dojoType= \" dijit.form.CheckBox \"
85 type= \" checkbox \" ></td>" ;
87 if (! $_SESSION [ "profile" ]) {
88 $is_active = __ ( "(active)" );
94 __ ( "Default profile" ) . " $is_active </span></td>" ;
100 while ( $line = db_fetch_assoc ( $result )) {
102 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
104 $profile_id = $line [ "id" ];
105 $this_row_id = "id= \" FCATR- $profile_id\" " ;
107 print "<tr class= \"\" $this_row_id >" ;
109 $edit_title = htmlspecialchars ( $line [ "title" ]);
111 print "<td width='5%' align='center'><input
112 onclick='toggleSelectRow2(this);'
113 dojoType= \" dijit.form.CheckBox \"
114 type= \" checkbox \" ></td>" ;
116 if ( $_SESSION [ "profile" ] == $line [ "id" ]) {
117 $is_active = __ ( "(active)" );
122 print "<td><span dojoType= \" dijit.InlineEditBox \"
123 width= \" 300px \" autoSave= \" false \"
124 profile-id= \" $profile_id\" >" . $edit_title .
125 "<script type= \" dojo/method \" event= \" onChange \" args= \" item \" >
129 content: {op: 'rpc', method: 'saveprofile',
131 id: this.srcNodeRef.getAttribute('profile-id')},
132 load: function(response) {
133 elem.attr('value', response);
137 </span> $is_active </td>" ;
148 print "<div class='dlgButtons'>
149 <div style='float : left'>
150 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('profileEditDlg').removeSelected() \" >" .
151 __ ( 'Remove selected profiles' ). "</button>
152 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('profileEditDlg').activateProfile() \" >" .
153 __ ( 'Activate profile' ). "</button>
156 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('profileEditDlg').hide() \" >" .
157 __ ( 'Close this window' ). "</button>" ;
162 function pubOPMLUrl () {
163 print "<title>" . __ ( 'Public OPML URL' ). "</title>" ;
164 print "<content><![CDATA[" ;
166 $url_path = opml_publish_url ( $this -> link
);
168 print __ ( "Your Public OPML URL is:" );
170 print "<div class= \" tagCloudContainer \" >" ;
171 print "<a id='pub_opml_url' href=' $url_path ' target='_blank'> $url_path </a>" ;
174 print "<div align='center'>" ;
176 print "<button dojoType= \" dijit.form.Button \" onclick= \" return opmlRegenKey() \" >" .
177 __ ( 'Generate new URL' ). "</button> " ;
179 print "<button dojoType= \" dijit.form.Button \" onclick= \" return closeInfoBox() \" >" .
180 __ ( 'Close this window' ). "</button>" ;
183 print "]]></content>" ;
188 function explainError () {
189 print "<title>" . __ ( 'Notice' ). "</title>" ;
190 print "<content><![CDATA[" ;
192 print "<div class= \" errorExplained \" >" ;
194 if ( $this -> param
== 1 ) {
195 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." );
197 $stamp = ( int ) file_get_contents ( LOCK_DIRECTORY
. "/update_daemon.stamp" );
199 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
203 if ( $this -> param
== 3 ) {
204 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." );
206 $stamp = ( int ) file_get_contents ( LOCK_DIRECTORY
. "/update_daemon.stamp" );
208 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
214 print "<div align='center'>" ;
216 print "<button onclick= \" return closeInfoBox() \" >" .
217 __ ( 'Close this window' ). "</button>" ;
220 print "]]></content>" ;
225 function quickAddFeed () {
226 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
227 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" addfeed \" >" ;
229 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
230 print "<div class= \" dlgSecCont \" >" ;
232 print "<input style= \" font-size : 16px; width : 20em; \"
233 placeHolder= \" " . __ ( "Feed URL" ). " \"
234 dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \" name= \" feed \" id= \" feedDlg_feedUrl \" >" ;
238 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
239 print __ ( 'Place in category:' ) . " " ;
240 print_feed_cat_select ( $this -> link
, "cat" , false , 'dojoType="dijit.form.Select"' );
245 print '<div id="feedDlg_feedsContainer" style="display : none">
247 <div class="dlgSec">' . __ ( 'Available feeds' ) . '</div>
248 <div class="dlgSecCont">' .
249 '<select id="feedDlg_feedContainerSelect"
250 dojoType="dijit.form.Select" size="3">
251 <script type="dojo/method" event="onChange" args="value">
252 dijit.byId("feedDlg_feedUrl").attr("value", value);
257 print "<div id='feedDlg_loginContainer' style='display : none'>
259 <div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>
260 <div class= \" dlgSecCont \" >" .
262 " <input dojoType= \" dijit.form.TextBox \" name='login' \"
263 placeHolder= \" " . __ ( "Login" ). " \"
264 style= \" width : 10em; \" > " .
266 placeHolder= \" " . __ ( "Password" ). " \"
267 dojoType= \" dijit.form.TextBox \" type='password'
268 style= \" width : 10em; \" name='pass' \" >
272 print "<div style= \" clear : both \" >
273 <input type= \" checkbox \" dojoType= \" dijit.form.CheckBox \" id= \" feedDlg_loginCheck \"
274 onclick='checkboxToggleElement(this, \" feedDlg_loginContainer \" )'>
275 <label for= \" feedDlg_loginCheck \" >" .
276 __ ( 'This feed requires authentication.' ). "</div>" ;
280 print "<div class= \" dlgButtons \" >
281 <button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('feedAddDlg').execute() \" >" . __ ( 'Subscribe' ). "</button>
282 <button dojoType= \" dijit.form.Button \" onclick= \" return feedBrowser() \" >" . __ ( 'More feeds' ). "</button>
283 <button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('feedAddDlg').hide() \" >" . __ ( 'Cancel' ). "</button>
289 function feedBrowser () {
290 $browser_search = db_escape_string ( $_REQUEST [ "search" ]);
292 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
293 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" updateFeedBrowser \" >" ;
295 print "<div dojoType= \" dijit.Toolbar \" >
296 <div style='float : right'>
297 <img style='display : none'
298 id='feed_browser_spinner' src='" .
299 theme_image ( $this -> link
, 'images/indicator_white.gif' ). "'>
300 <input name= \" search \" dojoType= \" dijit.form.TextBox \" size= \" 20 \" type= \" search \"
301 onchange= \" dijit.byId('feedBrowserDlg').update() \" value= \" $browser_search\" >
302 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedBrowserDlg').update() \" >" . __ ( 'Search' ). "</button>
305 print " <select name= \" mode \" dojoType= \" dijit.form.Select \" onchange= \" dijit.byId('feedBrowserDlg').update() \" >
306 <option value='1'>" . __ ( 'Popular feeds' ) . "</option>
307 <option value='2'>" . __ ( 'Feed archive' ) . "</option>
312 print " <select dojoType= \" dijit.form.Select \" name= \" limit \" onchange= \" dijit.byId('feedBrowserDlg').update() \" >" ;
314 foreach ( array ( 25 , 50 , 100 , 200 ) as $l ) {
315 $issel = ( $l == $limit ) ?
"selected= \" 1 \" " : "" ;
316 print "<option $issel value= \" $l\" > $l </option>" ;
323 $owner_uid = $_SESSION [ "uid" ];
325 print "<ul class='browseFeedList' id='browseFeedList'>" ;
326 print make_feed_browser ( $this -> link
, $search , 25 );
329 print "<div align='center'>
330 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedBrowserDlg').execute() \" >" . __ ( 'Subscribe' ). "</button>
331 <button dojoType= \" dijit.form.Button \" style='display : none' id='feed_archive_remove' onclick= \" dijit.byId('feedBrowserDlg').removeFromArchive() \" >" . __ ( 'Remove' ). "</button>
332 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedBrowserDlg').hide() \" >" . __ ( 'Cancel' ). "</button></div>" ;
337 $this -> params
= explode ( ":" , db_escape_string ( $_REQUEST [ "param" ]), 2 );
339 $active_feed_id = sprintf ( " %d " , $this -> params
[ 0 ]);
340 $is_cat = $this -> params
[ 1 ] != "false" ;
342 print "<div class= \" dlgSec \" >" . __ ( 'Look for' ). "</div>" ;
344 print "<div class= \" dlgSecCont \" >" ;
346 if (! SPHINX_ENABLED
) {
348 print "<input dojoType= \" dijit.form.ValidationTextBox \"
349 style= \" font-size : 16px; width : 12em; \"
350 required= \" 1 \" name= \" query \" type= \" search \" value=''>" ;
352 print " " . __ ( 'match on' ). " " ;
354 $search_fields = array (
355 "title" => __ ( "Title" ),
356 "content" => __ ( "Content" ),
357 "both" => __ ( "Title or content" ));
359 print_select_hash ( "match_on" , 3 , $search_fields ,
360 'dojoType="dijit.form.Select"' );
362 print "<input dojoType= \" dijit.form.ValidationTextBox \"
363 style= \" font-size : 16px; width : 20em; \"
364 required= \" 1 \" name= \" query \" type= \" search \" value=''>" ;
368 print "<hr/>" . __ ( 'Limit search to:' ). " " ;
370 print "<select name= \" search_mode \" dojoType= \" dijit.form.Select \" >
371 <option value= \" all_feeds \" >" . __ ( 'All feeds' ). "</option>" ;
373 $feed_title = getFeedTitle ( $this -> link
, $active_feed_id );
376 $feed_cat_title = getFeedCatTitle ( $this -> link
, $active_feed_id );
378 $feed_cat_title = getCategoryTitle ( $this -> link
, $active_feed_id );
381 if ( $active_feed_id && ! $is_cat ) {
382 print "<option selected= \" 1 \" value= \" this_feed \" > $feed_title </option>" ;
384 print "<option disabled= \" 1 \" value= \" false \" >" . __ ( 'This feed' ). "</option>" ;
388 $cat_preselected = "selected= \" 1 \" " ;
391 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' ) && ( $active_feed_id > 0 ||
$is_cat )) {
392 print "<option $cat_preselected value= \" this_cat \" > $feed_cat_title </option>" ;
394 //print "<option disabled>".__('This category')."</option>";
401 print "<div class= \" dlgButtons \" >" ;
403 if (! SPHINX_ENABLED
) {
404 print "<div style= \" float : left \" >
405 <a class= \" visibleLink \" target= \" _blank \" href= \" http://tt-rss.org/redmine/wiki/tt-rss/SearchSyntax \" >Search syntax</a>
409 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('searchDlg').execute() \" >" . __ ( 'Search' ). "</button>
410 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('searchDlg').hide() \" >" . __ ( 'Cancel' ). "</button>
414 function quickAddFilter () {
415 $active_feed_id = db_escape_string ( $_REQUEST [ "param" ]);
417 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" pref-filters \" >" ;
418 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" quiet \" value= \" 1 \" >" ;
419 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" add \" >" ;
420 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" csrf_token \" value= \" " . $_SESSION [ 'csrf_token' ]. " \" >" ;
422 $result = db_query ( $this -> link
, "SELECT id,description
423 FROM ttrss_filter_types ORDER BY description" );
425 $filter_types = array ();
427 while ( $line = db_fetch_assoc ( $result )) {
428 //array_push($filter_types, $line["description"]);
429 $filter_types [ $line [ "id" ]] = __ ( $line [ "description" ]);
432 print "<div class= \" dlgSec \" >" . __ ( "Match" ). "</div>" ;
434 print "<div class= \" dlgSecCont \" >" ;
436 print "<span id= \" filterDlg_dateModBox \" style= \" display : none \" >" ;
438 $filter_params = array (
439 "before" => __ ( "before" ),
440 "after" => __ ( "after" ));
442 print_select_hash ( "filter_date_modifier" , "before" ,
443 $filter_params , 'dojoType="dijit.form.Select"' );
445 print " </span>" ;
447 print "<input dojoType= \" dijit.form.ValidationTextBox \"
448 required= \" true \" id= \" filterDlg_regExp \"
449 style= \" font-size : 16px \"
450 name= \" reg_exp \" value= \" $reg_exp\" />" ;
452 print "<span id= \" filterDlg_dateChkBox \" style= \" display : none \" >" ;
453 print " <button dojoType= \" dijit.form.Button \"
454 onclick= \" return filterDlgCheckDate() \" >" .
455 __ ( 'Check it' ). "</button>" ;
458 print "<hr/>" . __ ( "on field" ) . " " ;
459 print_select_hash ( "filter_type" , 1 , $filter_types ,
460 'onchange="filterDlgCheckType(this)" dojoType="dijit.form.Select"' );
464 print __ ( "in" ) . " " ;
465 print_feed_select ( $this -> link
, "feed_id" , $active_feed_id ,
466 'dojoType="dijit.form.FilteringSelect"' );
470 print "<div class= \" dlgSec \" >" . __ ( "Perform Action" ). "</div>" ;
472 print "<div class= \" dlgSecCont \" >" ;
474 print "<select name= \" action_id \" dojoType= \" dijit.form.Select \"
475 onchange= \" filterDlgCheckAction(this) \" >" ;
477 $result = db_query ( $this -> link
, "SELECT id,description FROM ttrss_filter_actions
480 while ( $line = db_fetch_assoc ( $result )) {
481 printf ( "<option value=' %d '> %s </option>" , $line [ "id" ], __ ( $line [ "description" ]));
486 print "<span id= \" filterDlg_paramBox \" style= \" display : none \" >" ;
487 print " " . __ ( "with parameters:" ) . " " ;
488 print "<input dojoType= \" dijit.form.TextBox \"
489 id= \" filterDlg_actionParam \"
490 name= \" action_param \" >" ;
492 print_label_select ( $this -> link
, "action_param_label" , $action_param ,
493 'id="filterDlg_actionParamLabel" dojoType="dijit.form.Select"' );
497 print " " ; // tiny layout hack
501 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
502 print "<div class= \" dlgSecCont \" >" ;
504 print "<input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" name= \" enabled \" id= \" enabled \" checked= \" 1 \" >
505 <label for= \" enabled \" >" . __ ( 'Enabled' ). "</label><hr/>" ;
507 print "<input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" name= \" inverse \" id= \" inverse \" >
508 <label for= \" inverse \" >" . __ ( 'Inverse match' ). "</label>" ;
512 print "<div class= \" dlgButtons \" >" ;
514 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('filterEditDlg').test() \" >" .
515 __ ( 'Test' ). "</button> " ;
517 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('filterEditDlg').execute() \" >" .
518 __ ( 'Create' ). "</button> " ;
520 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('filterEditDlg').hide() \" >" .
521 __ ( 'Cancel' ). "</button>" ;
526 function inactiveFeeds () {
528 if ( DB_TYPE
== "pgsql" ) {
529 $interval_qpart = "NOW() - INTERVAL '3 months'" ;
531 $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)" ;
534 $result = db_query ( $this -> link
, "SELECT ttrss_feeds.title, ttrss_feeds.site_url,
535 ttrss_feeds.feed_url, ttrss_feeds.id, MAX(updated) AS last_article
536 FROM ttrss_feeds, ttrss_entries, ttrss_user_entries WHERE
537 (SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE
538 ttrss_entries.id = ref_id AND
539 ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart
540 AND ttrss_feeds.owner_uid = " . $_SESSION [ "uid" ]. " AND
541 ttrss_user_entries.feed_id = ttrss_feeds.id AND
542 ttrss_entries.id = ref_id
543 GROUP BY ttrss_feeds.title, ttrss_feeds.id, ttrss_feeds.site_url, ttrss_feeds.feed_url
544 ORDER BY last_article" );
546 print __ ( "These feeds have not been updated with new content for 3 months (oldest first):" );
548 print "<div class= \" inactiveFeedHolder \" >" ;
550 print "<table width= \" 100% \" cellspacing= \" 0 \" id= \" prefInactiveFeedList \" >" ;
554 while ( $line = db_fetch_assoc ( $result )) {
556 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
557 $feed_id = $line [ "id" ];
558 $this_row_id = "id= \" FUPDD- $feed_id\" " ;
560 print "<tr class= \"\" $this_row_id >" ;
562 $edit_title = htmlspecialchars ( $line [ "title" ]);
564 print "<td width='5%' align='center'><input
565 onclick='toggleSelectRow2(this);' dojoType= \" dijit.form.CheckBox \"
566 type= \" checkbox \" ></td>" ;
569 print "<a class= \" visibleLink \" href= \" # \" " .
570 "title= \" " . __ ( "Click to edit feed" ). " \" " .
571 "onclick= \" editFeed(" . $line [ "id" ]. ") \" >" .
572 htmlspecialchars ( $line [ "title" ]). "</a>" ;
574 print "</td><td class= \" insensitive \" align='right'>" ;
575 print make_local_datetime ( $this -> link
, $line [ 'last_article' ], false );
585 print "<div class='dlgButtons'>" ;
586 print "<div style='float : left'>" ;
587 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('inactiveFeedsDlg').removeSelected() \" >"
588 . __ ( 'Unsubscribe from selected feeds' ). "</button> " ;
591 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('inactiveFeedsDlg').hide() \" >" .
592 __ ( 'Close this window' ). "</button>" ;
598 function feedsWithErrors () {
599 print __ ( "These feeds have not been updated because of errors:" );
601 $result = db_query ( $this -> link
, "SELECT id,title,feed_url,last_error,site_url
602 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION [ "uid" ]);
604 print "<div class= \" inactiveFeedHolder \" >" ;
606 print "<table width= \" 100% \" cellspacing= \" 0 \" id= \" prefErrorFeedList \" >" ;
610 while ( $line = db_fetch_assoc ( $result )) {
612 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
613 $feed_id = $line [ "id" ];
614 $this_row_id = "id= \" FUPDD- $feed_id\" " ;
616 print "<tr class= \"\" $this_row_id >" ;
618 $edit_title = htmlspecialchars ( $line [ "title" ]);
620 print "<td width='5%' align='center'><input
621 onclick='toggleSelectRow2(this);' dojoType= \" dijit.form.CheckBox \"
622 type= \" checkbox \" ></td>" ;
625 print "<a class= \" visibleLink \" href= \" # \" " .
626 "title= \" " . __ ( "Click to edit feed" ). " \" " .
627 "onclick= \" editFeed(" . $line [ "id" ]. ") \" >" .
628 htmlspecialchars ( $line [ "title" ]). "</a>: " ;
630 print "<span class= \" insensitive \" >" ;
631 print htmlspecialchars ( $line [ "last_error" ]);
643 print "<div class='dlgButtons'>" ;
644 print "<div style='float : left'>" ;
645 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('errorFeedsDlg').removeSelected() \" >"
646 . __ ( 'Unsubscribe from selected feeds' ). "</button> " ;
649 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('errorFeedsDlg').hide() \" >" .
650 __ ( 'Close this window' ). "</button>" ;
655 function editArticleTags () {
657 print __ ( "Tags for this article (separated by commas):" ). "<br>" ;
659 $tags = get_article_tags ( $this -> link
, $this -> param
);
661 $tags_str = join ( ", " , $tags );
663 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" id \" value= \" $this ->param \" >" ;
664 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
665 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" setArticleTags \" >" ;
667 print "<table width='100%'><tr><td>" ;
669 print "<textarea dojoType= \" dijit.form.SimpleTextarea \" rows='4'
670 style='font-size : 12px; width : 100%' id= \" tags_str \"
671 name='tags_str'> $tags_str </textarea>
672 <div class= \" autocomplete \" id= \" tags_choices \"
673 style= \" display:none \" ></div>" ;
675 print "</td></tr></table>" ;
677 print "<div class='dlgButtons'>" ;
679 print "<button dojoType= \" dijit.form.Button \"
680 onclick= \" dijit.byId('editTagsDlg').execute() \" >" . __ ( 'Save' ). "</button> " ;
681 print "<button dojoType= \" dijit.form.Button \"
682 onclick= \" dijit.byId('editTagsDlg').hide() \" >" . __ ( 'Cancel' ). "</button>" ;
687 function printTagCloud () {
688 print "<title>" . __ ( 'Tag Cloud' ). "</title>" ;
689 print "<content><![CDATA[" ;
691 print "<div class= \" tagCloudContainer \" >" ;
693 // from here: http://www.roscripts.com/Create_tag_cloud-71.html
695 $query = "SELECT tag_name, COUNT(post_int_id) AS count
696 FROM ttrss_tags WHERE owner_uid = " . $_SESSION [ "uid" ]. "
697 GROUP BY tag_name ORDER BY count DESC LIMIT 50" ;
699 $result = db_query ( $this -> link
, $query );
703 while ( $line = db_fetch_assoc ( $result )) {
704 $tags [ $line [ "tag_name" ]] = $line [ "count" ];
707 if ( count ( $tags ) == 0 ){ return ; }
711 $max_size = 32 ; // max font size in pixels
712 $min_size = 11 ; // min font size in pixels
714 // largest and smallest array values
715 $max_qty = max ( array_values ( $tags ));
716 $min_qty = min ( array_values ( $tags ));
718 // find the range of values
719 $spread = $max_qty - $min_qty ;
720 if ( $spread == 0 ) { // we don't want to divide by zero
724 // set the font-size increment
725 $step = ( $max_size - $min_size ) / ( $spread );
727 // loop through the tag array
728 foreach ( $tags as $key => $value ) {
729 // calculate font-size
730 // find the $value in excess of $min_qty
731 // multiply by the font-size increment ($size)
732 // and add the $min_size set above
733 $size = round ( $min_size +
(( $value - $min_qty ) * $step ));
735 $key_escaped = str_replace ( "'" , " \\ '" , $key );
737 echo "<a href= \" javascript:viewfeed(' $key_escaped ') \" style= \" font-size: " .
738 $size . "px \" title= \" $value articles tagged with " .
739 $key . '">' . $key . '</a> ' ;
746 print "<div align='center'>" ;
747 print "<button dojoType= \" dijit.form.Button \"
748 onclick= \" return closeInfoBox() \" >" .
749 __ ( 'Close this window' ). "</button>" ;
752 print "]]></content>" ;
755 function printTagSelect () {
757 print "<title>" . __ ( 'Select item(s) by tags' ) . "</title>" ;
758 print "<content><![CDATA[" ;
760 print __ ( "Match:" ). " " .
761 "<input class= \" noborder \" dojoType= \" dijit.form.RadioButton \" type= \" radio \" checked value= \" any \" name= \" tag_mode \" > Any " ;
762 print "<input class= \" noborder \" dojoType= \" dijit.form.RadioButton \" type= \" radio \" value= \" all \" name= \" tag_mode \" > All " ;
765 print "<select id= \" all_tags \" name= \" all_tags \" title= \" " . __ ( 'Which Tags?' ) . " \" multiple= \" multiple \" size= \" 10 \" style= \" width : 100% \" >" ;
766 $result = db_query ( $this -> link
, "SELECT DISTINCT tag_name FROM ttrss_tags WHERE owner_uid = " . $_SESSION [ 'uid' ]. "
767 AND LENGTH(tag_name) <= 30 ORDER BY tag_name ASC" );
769 while ( $row = db_fetch_assoc ( $result )) {
770 $tmp = htmlspecialchars ( $row [ "tag_name" ]);
771 print "<option value= \" " . str_replace ( " " , " %20 " , $tmp ) . " \" > $tmp </option>" ;
776 print "<div align='right'>" ;
777 print "<button dojoType= \" dijit.form.Button \" onclick= \" viewfeed(get_all_tags($('all_tags')),
778 get_radio_checked($('tag_mode'))); \" >" . __ ( 'Display entries' ) . "</button>" ;
780 print "<button dojoType= \" dijit.form.Button \"
781 onclick= \" return closeInfoBox() \" >" .
782 __ ( 'Close this window' ) . "</button>" ;
785 print "]]></content>" ;
788 function generatedFeed () {
790 print "<title>" . __ ( 'View as RSS' ). "</title>" ;
791 print "<content><![CDATA[" ;
793 $this -> params
= explode ( ":" , $this -> param
, 3 );
794 $feed_id = db_escape_string ( $this -> params
[ 0 ]);
795 $is_cat = ( bool ) $this -> params
[ 1 ];
797 $key = get_feed_access_key ( $this -> link
, $feed_id , $is_cat );
799 $url_path = htmlspecialchars ( $this -> params
[ 2 ]) . "&key=" . $key ;
801 print __ ( "You can view this feed as RSS using the following URL:" );
803 print "<div class= \" tagCloudContainer \" >" ;
804 print "<a id='gen_feed_url' href=' $url_path ' target='_blank'> $url_path </a>" ;
807 print "<div align='center'>" ;
809 print "<button dojoType= \" dijit.form.Button \" onclick= \" return genUrlChangeKey(' $feed_id ', ' $is_cat ') \" >" .
810 __ ( 'Generate new URL' ). "</button> " ;
812 print "<button dojoType= \" dijit.form.Button \" onclick= \" return closeInfoBox() \" >" .
813 __ ( 'Close this window' ). "</button>" ;
816 print "]]></content>" ;
821 function newVersion () {
823 $version_data = check_for_update ( $this -> link
);
824 $version = $version_data [ 'version' ];
825 $id = $version_data [ 'version_id' ];
827 print "<div class='tagCloudContainer'>" ;
829 print T_sprintf ( "New version of Tiny Tiny RSS is available ( %s )." ,
834 $details = "http://tt-rss.org/redmine/versions/show/ $id " ;
835 $download = "http://tt-rss.org/#Download" ;
837 print "<div style='text-align : center'>" ;
838 print "<button dojoType= \" dijit.form.Button \"
839 onclick= \" return window.open(' $details ') \" >" . __ ( "Details" ). "</button>" ;
840 print "<button dojoType= \" dijit.form.Button \"
841 onclick= \" return window.open(' $download ') \" >" . __ ( "Download" ). "</button>" ;
842 print "<button dojoType= \" dijit.form.Button \"
843 onclick= \" return dijit.byId('newVersionDlg').hide() \" >" .
844 __ ( 'Close this window' ). "</button>" ;
849 function customizeCSS () {
850 $value = get_pref ( $this -> link
, "USER_STYLESHEET" );
852 $value = str_replace ( "<br/>" , " \n " , $value );
854 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" );
856 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
857 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" setpref \" >" ;
858 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" key \" value= \" USER_STYLESHEET \" >" ;
860 print "<table width='100%'><tr><td>" ;
861 print "<textarea dojoType= \" dijit.form.SimpleTextarea \"
862 style='font-size : 12px; width : 100%; height: 200px;'
863 placeHolder='body#ttrssMain { font-size : 14px; };'
864 name='value'> $value </textarea>" ;
865 print "</td></tr></table>" ;
867 print "<div class='dlgButtons'>" ;
868 print "<button dojoType= \" dijit.form.Button \"
869 onclick= \" dijit.byId('cssEditDlg').execute() \" >" . __ ( 'Save' ). "</button> " ;
870 print "<button dojoType= \" dijit.form.Button \"
871 onclick= \" dijit.byId('cssEditDlg').hide() \" >" . __ ( 'Cancel' ). "</button>" ;
876 function addInstance () {
877 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" pref-instances \" >" ;
878 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" add \" >" ;
880 print "<div class= \" dlgSec \" >" . __ ( "Instance" ). "</div>" ;
882 print "<div class= \" dlgSecCont \" >" ;
886 print __ ( "URL:" ) . " " ;
888 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
889 placeHolder= \" " . __ ( "Instance URL" ). " \"
890 regExp='^(http|https)://.*'
891 style= \" font-size : 16px; width: 20em \" name= \" access_url \" >" ;
895 $access_key = sha1 ( uniqid ( rand (), true ));
899 print __ ( "Access key:" ) . " " ;
901 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
902 placeHolder= \" " . __ ( "Access key" ). " \" regExp='\w{40}'
903 style= \" width: 20em \" name= \" access_key \" id= \" instance_add_key \"
904 value= \" $access_key\" >" ;
906 print "<p class='insensitive'>" . __ ( "Use one access key for both linked instances." );
910 print "<div class= \" dlgButtons \" >
911 <div style='float : left'>
912 <button dojoType= \" dijit.form.Button \"
913 onclick= \" return dijit.byId('instanceAddDlg').regenKey() \" >" .
914 __ ( 'Generate new key' ). "</button>
916 <button dojoType= \" dijit.form.Button \"
917 onclick= \" return dijit.byId('instanceAddDlg').execute() \" >" .
918 __ ( 'Create link' ). "</button>
919 <button dojoType= \" dijit.form.Button \"
920 onclick= \" return dijit.byId('instanceAddDlg').hide() \"\" >" .
921 __ ( 'Cancel' ). "</button></div>" ;