]>
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 \" >" ;
421 $result = db_query ( $this -> link
, "SELECT id,description
422 FROM ttrss_filter_types ORDER BY description" );
424 $filter_types = array ();
426 while ( $line = db_fetch_assoc ( $result )) {
427 //array_push($filter_types, $line["description"]);
428 $filter_types [ $line [ "id" ]] = __ ( $line [ "description" ]);
431 print "<div class= \" dlgSec \" >" . __ ( "Match" ). "</div>" ;
433 print "<div class= \" dlgSecCont \" >" ;
435 print "<span id= \" filterDlg_dateModBox \" style= \" display : none \" >" ;
437 $filter_params = array (
438 "before" => __ ( "before" ),
439 "after" => __ ( "after" ));
441 print_select_hash ( "filter_date_modifier" , "before" ,
442 $filter_params , 'dojoType="dijit.form.Select"' );
444 print " </span>" ;
446 print "<input dojoType= \" dijit.form.ValidationTextBox \"
447 required= \" true \" id= \" filterDlg_regExp \"
448 style= \" font-size : 16px \"
449 name= \" reg_exp \" value= \" $reg_exp\" />" ;
451 print "<span id= \" filterDlg_dateChkBox \" style= \" display : none \" >" ;
452 print " <button dojoType= \" dijit.form.Button \"
453 onclick= \" return filterDlgCheckDate() \" >" .
454 __ ( 'Check it' ). "</button>" ;
457 print "<hr/>" . __ ( "on field" ) . " " ;
458 print_select_hash ( "filter_type" , 1 , $filter_types ,
459 'onchange="filterDlgCheckType(this)" dojoType="dijit.form.Select"' );
463 print __ ( "in" ) . " " ;
464 print_feed_select ( $this -> link
, "feed_id" , $active_feed_id ,
465 'dojoType="dijit.form.FilteringSelect"' );
469 print "<div class= \" dlgSec \" >" . __ ( "Perform Action" ). "</div>" ;
471 print "<div class= \" dlgSecCont \" >" ;
473 print "<select name= \" action_id \" dojoType= \" dijit.form.Select \"
474 onchange= \" filterDlgCheckAction(this) \" >" ;
476 $result = db_query ( $this -> link
, "SELECT id,description FROM ttrss_filter_actions
479 while ( $line = db_fetch_assoc ( $result )) {
480 printf ( "<option value=' %d '> %s </option>" , $line [ "id" ], __ ( $line [ "description" ]));
485 print "<span id= \" filterDlg_paramBox \" style= \" display : none \" >" ;
486 print " " . __ ( "with parameters:" ) . " " ;
487 print "<input dojoType= \" dijit.form.TextBox \"
488 id= \" filterDlg_actionParam \"
489 name= \" action_param \" >" ;
491 print_label_select ( $this -> link
, "action_param_label" , $action_param ,
492 'id="filterDlg_actionParamLabel" dojoType="dijit.form.Select"' );
496 print " " ; // tiny layout hack
500 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
501 print "<div class= \" dlgSecCont \" >" ;
503 print "<input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" name= \" enabled \" id= \" enabled \" checked= \" 1 \" >
504 <label for= \" enabled \" >" . __ ( 'Enabled' ). "</label><hr/>" ;
506 print "<input dojoType= \" dijit.form.CheckBox \" type= \" checkbox \" name= \" inverse \" id= \" inverse \" >
507 <label for= \" inverse \" >" . __ ( 'Inverse match' ). "</label>" ;
511 print "<div class= \" dlgButtons \" >" ;
513 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('filterEditDlg').test() \" >" .
514 __ ( 'Test' ). "</button> " ;
516 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('filterEditDlg').execute() \" >" .
517 __ ( 'Create' ). "</button> " ;
519 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('filterEditDlg').hide() \" >" .
520 __ ( 'Cancel' ). "</button>" ;
525 function inactiveFeeds () {
527 if ( DB_TYPE
== "pgsql" ) {
528 $interval_qpart = "NOW() - INTERVAL '3 months'" ;
530 $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)" ;
533 $result = db_query ( $this -> link
, "SELECT ttrss_feeds.title, ttrss_feeds.site_url,
534 ttrss_feeds.feed_url, ttrss_feeds.id, MAX(updated) AS last_article
535 FROM ttrss_feeds, ttrss_entries, ttrss_user_entries WHERE
536 (SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE
537 ttrss_entries.id = ref_id AND
538 ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart
539 AND ttrss_feeds.owner_uid = " . $_SESSION [ "uid" ]. " AND
540 ttrss_user_entries.feed_id = ttrss_feeds.id AND
541 ttrss_entries.id = ref_id
542 GROUP BY ttrss_feeds.title, ttrss_feeds.id, ttrss_feeds.site_url, ttrss_feeds.feed_url
543 ORDER BY last_article" );
545 print __ ( "These feeds have not been updated with new content for 3 months (oldest first):" );
547 print "<div class= \" inactiveFeedHolder \" >" ;
549 print "<table width= \" 100% \" cellspacing= \" 0 \" id= \" prefInactiveFeedList \" >" ;
553 while ( $line = db_fetch_assoc ( $result )) {
555 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
556 $feed_id = $line [ "id" ];
557 $this_row_id = "id= \" FUPDD- $feed_id\" " ;
559 print "<tr class= \"\" $this_row_id >" ;
561 $edit_title = htmlspecialchars ( $line [ "title" ]);
563 print "<td width='5%' align='center'><input
564 onclick='toggleSelectRow2(this);' dojoType= \" dijit.form.CheckBox \"
565 type= \" checkbox \" ></td>" ;
568 print "<a class= \" visibleLink \" href= \" # \" " .
569 "title= \" " . __ ( "Click to edit feed" ). " \" " .
570 "onclick= \" editFeed(" . $line [ "id" ]. ") \" >" .
571 htmlspecialchars ( $line [ "title" ]). "</a>" ;
573 print "</td><td class= \" insensitive \" align='right'>" ;
574 print make_local_datetime ( $this -> link
, $line [ 'last_article' ], false );
584 print "<div class='dlgButtons'>" ;
585 print "<div style='float : left'>" ;
586 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('inactiveFeedsDlg').removeSelected() \" >"
587 . __ ( 'Unsubscribe from selected feeds' ). "</button> " ;
590 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('inactiveFeedsDlg').hide() \" >" .
591 __ ( 'Close this window' ). "</button>" ;
597 function feedsWithErrors () {
598 print __ ( "These feeds have not been updated because of errors:" );
600 $result = db_query ( $this -> link
, "SELECT id,title,feed_url,last_error,site_url
601 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION [ "uid" ]);
603 print "<div class= \" inactiveFeedHolder \" >" ;
605 print "<table width= \" 100% \" cellspacing= \" 0 \" id= \" prefErrorFeedList \" >" ;
609 while ( $line = db_fetch_assoc ( $result )) {
611 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
612 $feed_id = $line [ "id" ];
613 $this_row_id = "id= \" FUPDD- $feed_id\" " ;
615 print "<tr class= \"\" $this_row_id >" ;
617 $edit_title = htmlspecialchars ( $line [ "title" ]);
619 print "<td width='5%' align='center'><input
620 onclick='toggleSelectRow2(this);' dojoType= \" dijit.form.CheckBox \"
621 type= \" checkbox \" ></td>" ;
624 print "<a class= \" visibleLink \" href= \" # \" " .
625 "title= \" " . __ ( "Click to edit feed" ). " \" " .
626 "onclick= \" editFeed(" . $line [ "id" ]. ") \" >" .
627 htmlspecialchars ( $line [ "title" ]). "</a>: " ;
629 print "<span class= \" insensitive \" >" ;
630 print htmlspecialchars ( $line [ "last_error" ]);
642 print "<div class='dlgButtons'>" ;
643 print "<div style='float : left'>" ;
644 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('errorFeedsDlg').removeSelected() \" >"
645 . __ ( 'Unsubscribe from selected feeds' ). "</button> " ;
648 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('errorFeedsDlg').hide() \" >" .
649 __ ( 'Close this window' ). "</button>" ;
654 function editArticleTags () {
656 print __ ( "Tags for this article (separated by commas):" ). "<br>" ;
658 $tags = get_article_tags ( $this -> link
, $this -> param
);
660 $tags_str = join ( ", " , $tags );
662 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" id \" value= \" $this ->param \" >" ;
663 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
664 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" setArticleTags \" >" ;
666 print "<table width='100%'><tr><td>" ;
668 print "<textarea dojoType= \" dijit.form.SimpleTextarea \" rows='4'
669 style='font-size : 12px; width : 100%' id= \" tags_str \"
670 name='tags_str'> $tags_str </textarea>
671 <div class= \" autocomplete \" id= \" tags_choices \"
672 style= \" display:none \" ></div>" ;
674 print "</td></tr></table>" ;
676 print "<div class='dlgButtons'>" ;
678 print "<button dojoType= \" dijit.form.Button \"
679 onclick= \" dijit.byId('editTagsDlg').execute() \" >" . __ ( 'Save' ). "</button> " ;
680 print "<button dojoType= \" dijit.form.Button \"
681 onclick= \" dijit.byId('editTagsDlg').hide() \" >" . __ ( 'Cancel' ). "</button>" ;
686 function printTagCloud () {
687 print "<title>" . __ ( 'Tag Cloud' ). "</title>" ;
688 print "<content><![CDATA[" ;
690 print "<div class= \" tagCloudContainer \" >" ;
692 // from here: http://www.roscripts.com/Create_tag_cloud-71.html
694 $query = "SELECT tag_name, COUNT(post_int_id) AS count
695 FROM ttrss_tags WHERE owner_uid = " . $_SESSION [ "uid" ]. "
696 GROUP BY tag_name ORDER BY count DESC LIMIT 50" ;
698 $result = db_query ( $this -> link
, $query );
702 while ( $line = db_fetch_assoc ( $result )) {
703 $tags [ $line [ "tag_name" ]] = $line [ "count" ];
706 if ( count ( $tags ) == 0 ){ return ; }
710 $max_size = 32 ; // max font size in pixels
711 $min_size = 11 ; // min font size in pixels
713 // largest and smallest array values
714 $max_qty = max ( array_values ( $tags ));
715 $min_qty = min ( array_values ( $tags ));
717 // find the range of values
718 $spread = $max_qty - $min_qty ;
719 if ( $spread == 0 ) { // we don't want to divide by zero
723 // set the font-size increment
724 $step = ( $max_size - $min_size ) / ( $spread );
726 // loop through the tag array
727 foreach ( $tags as $key => $value ) {
728 // calculate font-size
729 // find the $value in excess of $min_qty
730 // multiply by the font-size increment ($size)
731 // and add the $min_size set above
732 $size = round ( $min_size +
(( $value - $min_qty ) * $step ));
734 $key_escaped = str_replace ( "'" , " \\ '" , $key );
736 echo "<a href= \" javascript:viewfeed(' $key_escaped ') \" style= \" font-size: " .
737 $size . "px \" title= \" $value articles tagged with " .
738 $key . '">' . $key . '</a> ' ;
745 print "<div align='center'>" ;
746 print "<button dojoType= \" dijit.form.Button \"
747 onclick= \" return closeInfoBox() \" >" .
748 __ ( 'Close this window' ). "</button>" ;
751 print "]]></content>" ;
754 function printTagSelect () {
756 print "<title>" . __ ( 'Select item(s) by tags' ) . "</title>" ;
757 print "<content><![CDATA[" ;
759 print __ ( "Match:" ). " " .
760 "<input class= \" noborder \" dojoType= \" dijit.form.RadioButton \" type= \" radio \" checked value= \" any \" name= \" tag_mode \" > Any " ;
761 print "<input class= \" noborder \" dojoType= \" dijit.form.RadioButton \" type= \" radio \" value= \" all \" name= \" tag_mode \" > All " ;
764 print "<select id= \" all_tags \" name= \" all_tags \" title= \" " . __ ( 'Which Tags?' ) . " \" multiple= \" multiple \" size= \" 10 \" style= \" width : 100% \" >" ;
765 $result = db_query ( $this -> link
, "SELECT DISTINCT tag_name FROM ttrss_tags WHERE owner_uid = " . $_SESSION [ 'uid' ]. "
766 AND LENGTH(tag_name) <= 30 ORDER BY tag_name ASC" );
768 while ( $row = db_fetch_assoc ( $result )) {
769 $tmp = htmlspecialchars ( $row [ "tag_name" ]);
770 print "<option value= \" " . str_replace ( " " , " %20 " , $tmp ) . " \" > $tmp </option>" ;
775 print "<div align='right'>" ;
776 print "<button dojoType= \" dijit.form.Button \" onclick= \" viewfeed(get_all_tags($('all_tags')),
777 get_radio_checked($('tag_mode'))); \" >" . __ ( 'Display entries' ) . "</button>" ;
779 print "<button dojoType= \" dijit.form.Button \"
780 onclick= \" return closeInfoBox() \" >" .
781 __ ( 'Close this window' ) . "</button>" ;
784 print "]]></content>" ;
787 function generatedFeed () {
789 print "<title>" . __ ( 'View as RSS' ). "</title>" ;
790 print "<content><![CDATA[" ;
792 $this -> params
= explode ( ":" , $this -> param
, 3 );
793 $feed_id = db_escape_string ( $this -> params
[ 0 ]);
794 $is_cat = ( bool ) $this -> params
[ 1 ];
796 $key = get_feed_access_key ( $this -> link
, $feed_id , $is_cat );
798 $url_path = htmlspecialchars ( $this -> params
[ 2 ]) . "&key=" . $key ;
800 print __ ( "You can view this feed as RSS using the following URL:" );
802 print "<div class= \" tagCloudContainer \" >" ;
803 print "<a id='gen_feed_url' href=' $url_path ' target='_blank'> $url_path </a>" ;
806 print "<div align='center'>" ;
808 print "<button dojoType= \" dijit.form.Button \" onclick= \" return genUrlChangeKey(' $feed_id ', ' $is_cat ') \" >" .
809 __ ( 'Generate new URL' ). "</button> " ;
811 print "<button dojoType= \" dijit.form.Button \" onclick= \" return closeInfoBox() \" >" .
812 __ ( 'Close this window' ). "</button>" ;
815 print "]]></content>" ;
820 function newVersion () {
822 $version_data = check_for_update ( $this -> link
);
823 $version = $version_data [ 'version' ];
824 $id = $version_data [ 'version_id' ];
826 print "<div class='tagCloudContainer'>" ;
828 print T_sprintf ( "New version of Tiny Tiny RSS is available ( %s )." ,
833 $details = "http://tt-rss.org/redmine/versions/show/ $id " ;
834 $download = "http://tt-rss.org/#Download" ;
836 print "<div style='text-align : center'>" ;
837 print "<button dojoType= \" dijit.form.Button \"
838 onclick= \" return window.open(' $details ') \" >" . __ ( "Details" ). "</button>" ;
839 print "<button dojoType= \" dijit.form.Button \"
840 onclick= \" return window.open(' $download ') \" >" . __ ( "Download" ). "</button>" ;
841 print "<button dojoType= \" dijit.form.Button \"
842 onclick= \" return dijit.byId('newVersionDlg').hide() \" >" .
843 __ ( 'Close this window' ). "</button>" ;
848 function customizeCSS () {
849 $value = get_pref ( $this -> link
, "USER_STYLESHEET" );
851 $value = str_replace ( "<br/>" , " \n " , $value );
853 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" );
855 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
856 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" setpref \" >" ;
857 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" key \" value= \" USER_STYLESHEET \" >" ;
859 print "<table width='100%'><tr><td>" ;
860 print "<textarea dojoType= \" dijit.form.SimpleTextarea \"
861 style='font-size : 12px; width : 100%; height: 200px;'
862 placeHolder='body#ttrssMain { font-size : 14px; };'
863 name='value'> $value </textarea>" ;
864 print "</td></tr></table>" ;
866 print "<div class='dlgButtons'>" ;
867 print "<button dojoType= \" dijit.form.Button \"
868 onclick= \" dijit.byId('cssEditDlg').execute() \" >" . __ ( 'Save' ). "</button> " ;
869 print "<button dojoType= \" dijit.form.Button \"
870 onclick= \" dijit.byId('cssEditDlg').hide() \" >" . __ ( 'Cancel' ). "</button>" ;
875 function addInstance () {
876 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" pref-instances \" >" ;
877 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" add \" >" ;
879 print "<div class= \" dlgSec \" >" . __ ( "Instance" ). "</div>" ;
881 print "<div class= \" dlgSecCont \" >" ;
885 print __ ( "URL:" ) . " " ;
887 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
888 placeHolder= \" " . __ ( "Instance URL" ). " \"
889 regExp='^(http|https)://.*'
890 style= \" font-size : 16px; width: 20em \" name= \" access_url \" >" ;
894 $access_key = sha1 ( uniqid ( rand (), true ));
898 print __ ( "Access key:" ) . " " ;
900 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
901 placeHolder= \" " . __ ( "Access key" ). " \" regExp='\w{40}'
902 style= \" width: 20em \" name= \" access_key \" id= \" instance_add_key \"
903 value= \" $access_key\" >" ;
905 print "<p class='insensitive'>" . __ ( "Use one access key for both linked instances." );
909 print "<div class= \" dlgButtons \" >
910 <div style='float : left'>
911 <button dojoType= \" dijit.form.Button \"
912 onclick= \" return dijit.byId('instanceAddDlg').regenKey() \" >" .
913 __ ( 'Generate new key' ). "</button>
915 <button dojoType= \" dijit.form.Button \"
916 onclick= \" return dijit.byId('instanceAddDlg').execute() \" >" .
917 __ ( 'Create link' ). "</button>
918 <button dojoType= \" dijit.form.Button \"
919 onclick= \" return dijit.byId('instanceAddDlg').hide() \"\" >" .
920 __ ( 'Cancel' ). "</button></div>" ;