]>
git.wh0rd.org - tt-rss.git/blob - classes/dlg.php
2 class Dlg
extends Handler_Protected
{
5 function before ( $method ) {
6 if ( parent
:: before ( $method )) {
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 print "<ul class='nomarks'>" ;
49 $opml = new Opml ( $this -> link
, $_REQUEST );
51 $opml -> opml_import ( $_SESSION [ "uid" ]);
56 print "<div align='center'>" ;
57 print "<button dojoType= \" dijit.form.Button \"
58 onclick= \" dijit.byId('opmlImportDlg').execute() \" >" .
59 __ ( 'Close this window' ). "</button>" ;
67 function editPrefProfiles () {
68 print "<div dojoType= \" dijit.Toolbar \" >" ;
70 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
71 "<span>" . __ ( 'Select' ). "</span>" ;
72 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
73 print "<div onclick= \" selectTableRows('prefFeedProfileList', 'all') \"
74 dojoType= \" dijit.MenuItem \" >" . __ ( 'All' ). "</div>" ;
75 print "<div onclick= \" selectTableRows('prefFeedProfileList', 'none') \"
76 dojoType= \" dijit.MenuItem \" >" . __ ( 'None' ). "</div>" ;
79 print "<div style= \" float : right \" >" ;
81 print "<input name= \" newprofile \" dojoType= \" dijit.form.ValidationTextBox \"
83 <button dojoType= \" dijit.form.Button \"
84 onclick= \" dijit.byId('profileEditDlg').addProfile() \" >" .
85 __ ( 'Create profile' ). "</button></div>" ;
89 $result = db_query ( $this -> link
, "SELECT title,id FROM ttrss_settings_profiles
90 WHERE owner_uid = " . $_SESSION [ "uid" ]. " ORDER BY title" );
92 print "<div class= \" prefFeedCatHolder \" >" ;
94 print "<form id= \" profile_edit_form \" onsubmit= \" return false \" >" ;
96 print "<table width= \" 100% \" class= \" prefFeedProfileList \"
97 cellspacing= \" 0 \" id= \" prefFeedProfileList \" >" ;
99 print "<tr class= \" placeholder \" id= \" FCATR-0 \" >" ; #odd
101 print "<td width='5%' align='center'><input
103 onclick='toggleSelectRow2(this);'
104 dojoType= \" dijit.form.CheckBox \"
105 type= \" checkbox \" ></td>" ;
107 if (! $_SESSION [ "profile" ]) {
108 $is_active = __ ( "(active)" );
114 __ ( "Default profile" ) . " $is_active </span></td>" ;
120 while ( $line = db_fetch_assoc ( $result )) {
122 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
124 $profile_id = $line [ "id" ];
125 $this_row_id = "id= \" FCATR- $profile_id\" " ;
127 print "<tr class= \" placeholder \" $this_row_id >" ;
129 $edit_title = htmlspecialchars ( $line [ "title" ]);
131 print "<td width='5%' align='center'><input
132 onclick='toggleSelectRow2(this);'
133 id='FCATC- $profile_id '
134 dojoType= \" dijit.form.CheckBox \"
135 type= \" checkbox \" ></td>" ;
137 if ( $_SESSION [ "profile" ] == $line [ "id" ]) {
138 $is_active = __ ( "(active)" );
143 print "<td><span dojoType= \" dijit.InlineEditBox \"
144 width= \" 300px \" autoSave= \" false \"
145 profile-id= \" $profile_id\" >" . $edit_title .
146 "<script type= \" dojo/method \" event= \" onChange \" args= \" item \" >
150 content: {op: 'rpc', method: 'saveprofile',
152 id: this.srcNodeRef.getAttribute('profile-id')},
153 load: function(response) {
154 elem.attr('value', response);
158 </span> $is_active </td>" ;
169 print "<div class='dlgButtons'>
170 <div style='float : left'>
171 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('profileEditDlg').removeSelected() \" >" .
172 __ ( 'Remove selected profiles' ). "</button>
173 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('profileEditDlg').activateProfile() \" >" .
174 __ ( 'Activate profile' ). "</button>
177 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('profileEditDlg').hide() \" >" .
178 __ ( 'Close this window' ). "</button>" ;
183 function pubOPMLUrl () {
184 print "<title>" . __ ( 'Public OPML URL' ). "</title>" ;
185 print "<content><![CDATA[" ;
187 $url_path = opml_publish_url ( $this -> link
);
189 print __ ( "Your Public OPML URL is:" );
191 print "<div class= \" tagCloudContainer \" >" ;
192 print "<a id='pub_opml_url' href=' $url_path ' target='_blank'> $url_path </a>" ;
195 print "<div align='center'>" ;
197 print "<button dojoType= \" dijit.form.Button \" onclick= \" return opmlRegenKey() \" >" .
198 __ ( 'Generate new URL' ). "</button> " ;
200 print "<button dojoType= \" dijit.form.Button \" onclick= \" return closeInfoBox() \" >" .
201 __ ( 'Close this window' ). "</button>" ;
204 print "]]></content>" ;
209 function explainError () {
210 print "<title>" . __ ( 'Notice' ). "</title>" ;
211 print "<content><![CDATA[" ;
213 print "<div class= \" errorExplained \" >" ;
215 if ( $this -> param
== 1 ) {
216 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." );
218 $stamp = ( int ) file_get_contents ( LOCK_DIRECTORY
. "/update_daemon.stamp" );
220 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
224 if ( $this -> param
== 3 ) {
225 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." );
227 $stamp = ( int ) file_get_contents ( LOCK_DIRECTORY
. "/update_daemon.stamp" );
229 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
235 print "<div align='center'>" ;
237 print "<button onclick= \" return closeInfoBox() \" >" .
238 __ ( 'Close this window' ). "</button>" ;
241 print "]]></content>" ;
246 function quickAddFeed () {
247 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
248 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" addfeed \" >" ;
250 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
251 print "<div class= \" dlgSecCont \" >" ;
253 print "<div style='float : right'>
254 <img style='display : none'
255 id='feed_add_spinner' src='" .
256 theme_image ( $this -> link
, 'images/indicator_white.gif' ). "'></div>" ;
258 print "<input style= \" font-size : 16px; width : 20em; \"
259 placeHolder= \" " . __ ( "Feed URL" ). " \"
260 dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \" name= \" feed \" id= \" feedDlg_feedUrl \" >" ;
264 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
265 print __ ( 'Place in category:' ) . " " ;
266 print_feed_cat_select ( $this -> link
, "cat" , false , 'dojoType="dijit.form.Select"' );
271 print '<div id="feedDlg_feedsContainer" style="display : none">
273 <div class="dlgSec">' . __ ( 'Available feeds' ) . '</div>
274 <div class="dlgSecCont">' .
275 '<select id="feedDlg_feedContainerSelect"
276 dojoType="dijit.form.Select" size="3">
277 <script type="dojo/method" event="onChange" args="value">
278 dijit.byId("feedDlg_feedUrl").attr("value", value);
283 print "<div id='feedDlg_loginContainer' style='display : none'>
285 <div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>
286 <div class= \" dlgSecCont \" >" .
288 " <input dojoType= \" dijit.form.TextBox \" name='login' \"
289 placeHolder= \" " . __ ( "Login" ). " \"
290 style= \" width : 10em; \" > " .
292 placeHolder= \" " . __ ( "Password" ). " \"
293 dojoType= \" dijit.form.TextBox \" type='password'
294 style= \" width : 10em; \" name='pass' \" >" .
295 " <p class='insensitive'>" . __ ( "OAuth will be used automatically for Twitter feeds." ). "</p>
299 print "<div style= \" clear : both \" >
300 <input type= \" checkbox \" name= \" need_auth \" dojoType= \" dijit.form.CheckBox \" id= \" feedDlg_loginCheck \"
301 onclick='checkboxToggleElement(this, \" feedDlg_loginContainer \" )'>
302 <label for= \" feedDlg_loginCheck \" >" .
303 __ ( 'This feed requires authentication.' ). "</div>" ;
307 print "<div class= \" dlgButtons \" >
308 <button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('feedAddDlg').execute() \" >" . __ ( 'Subscribe' ). "</button>" ;
310 if (!( defined ( '_DISABLE_FEED_BROWSER' ) && _DISABLE_FEED_BROWSER
)) {
311 print "<button dojoType= \" dijit.form.Button \" onclick= \" return feedBrowser() \" >" . __ ( 'More feeds' ). "</button>" ;
314 print "<button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('feedAddDlg').hide() \" >" . __ ( 'Cancel' ). "</button>
320 function feedBrowser () {
321 if ( defined ( '_DISABLE_FEED_BROWSER' ) && _DISABLE_FEED_BROWSER
) return ;
323 $browser_search = db_escape_string ( $_REQUEST [ "search" ]);
325 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
326 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" updateFeedBrowser \" >" ;
328 print "<div dojoType= \" dijit.Toolbar \" >
329 <div style='float : right'>
330 <img style='display : none'
331 id='feed_browser_spinner' src='" .
332 theme_image ( $this -> link
, 'images/indicator_white.gif' ). "'>
333 <input name= \" search \" dojoType= \" dijit.form.TextBox \" size= \" 20 \" type= \" search \"
334 onchange= \" dijit.byId('feedBrowserDlg').update() \" value= \" $browser_search\" >
335 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedBrowserDlg').update() \" >" . __ ( 'Search' ). "</button>
338 print " <select name= \" mode \" dojoType= \" dijit.form.Select \" onchange= \" dijit.byId('feedBrowserDlg').update() \" >
339 <option value='1'>" . __ ( 'Popular feeds' ) . "</option>
340 <option value='2'>" . __ ( 'Feed archive' ) . "</option>
345 print " <select dojoType= \" dijit.form.Select \" name= \" limit \" onchange= \" dijit.byId('feedBrowserDlg').update() \" >" ;
347 foreach ( array ( 25 , 50 , 100 , 200 ) as $l ) {
348 $issel = ( $l == $limit ) ?
"selected= \" 1 \" " : "" ;
349 print "<option $issel value= \" $l\" > $l </option>" ;
356 $owner_uid = $_SESSION [ "uid" ];
358 print "<ul class='browseFeedList' id='browseFeedList'>" ;
359 print make_feed_browser ( $this -> link
, $search , 25 );
362 print "<div align='center'>
363 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedBrowserDlg').execute() \" >" . __ ( 'Subscribe' ). "</button>
364 <button dojoType= \" dijit.form.Button \" style='display : none' id='feed_archive_remove' onclick= \" dijit.byId('feedBrowserDlg').removeFromArchive() \" >" . __ ( 'Remove' ). "</button>
365 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('feedBrowserDlg').hide() \" >" . __ ( 'Cancel' ). "</button></div>" ;
370 $this -> params
= explode ( ":" , db_escape_string ( $_REQUEST [ "param" ]), 2 );
372 $active_feed_id = sprintf ( " %d " , $this -> params
[ 0 ]);
373 $is_cat = $this -> params
[ 1 ] != "false" ;
375 print "<div class= \" dlgSec \" >" . __ ( 'Look for' ). "</div>" ;
377 print "<div class= \" dlgSecCont \" >" ;
379 if (! SPHINX_ENABLED
) {
381 print "<input dojoType= \" dijit.form.ValidationTextBox \"
382 style= \" font-size : 16px; width : 12em; \"
383 required= \" 1 \" name= \" query \" type= \" search \" value=''>" ;
385 print " " . __ ( 'match on' ). " " ;
387 $search_fields = array (
388 "title" => __ ( "Title" ),
389 "content" => __ ( "Content" ),
390 "both" => __ ( "Title or content" ));
392 print_select_hash ( "match_on" , 3 , $search_fields ,
393 'dojoType="dijit.form.Select"' );
395 print "<input dojoType= \" dijit.form.ValidationTextBox \"
396 style= \" font-size : 16px; width : 20em; \"
397 required= \" 1 \" name= \" query \" type= \" search \" value=''>" ;
401 print "<hr/>" . __ ( 'Limit search to:' ). " " ;
403 print "<select name= \" search_mode \" dojoType= \" dijit.form.Select \" >
404 <option value= \" all_feeds \" >" . __ ( 'All feeds' ). "</option>" ;
406 $feed_title = getFeedTitle ( $this -> link
, $active_feed_id );
409 $feed_cat_title = getFeedCatTitle ( $this -> link
, $active_feed_id );
411 $feed_cat_title = getCategoryTitle ( $this -> link
, $active_feed_id );
414 if ( $active_feed_id && ! $is_cat ) {
415 print "<option selected= \" 1 \" value= \" this_feed \" > $feed_title </option>" ;
417 print "<option disabled= \" 1 \" value= \" false \" >" . __ ( 'This feed' ). "</option>" ;
421 $cat_preselected = "selected= \" 1 \" " ;
424 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' ) && ( $active_feed_id > 0 ||
$is_cat )) {
425 print "<option $cat_preselected value= \" this_cat \" > $feed_cat_title </option>" ;
427 //print "<option disabled>".__('This category')."</option>";
434 print "<div class= \" dlgButtons \" >" ;
436 if (! SPHINX_ENABLED
) {
437 print "<div style= \" float : left \" >
438 <a class= \" visibleLink \" target= \" _blank \" href= \" http://tt-rss.org/redmine/wiki/tt-rss/SearchSyntax \" >Search syntax</a>
442 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('searchDlg').execute() \" >" . __ ( 'Search' ). "</button>
443 <button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('searchDlg').hide() \" >" . __ ( 'Cancel' ). "</button>
447 function inactiveFeeds () {
449 if ( DB_TYPE
== "pgsql" ) {
450 $interval_qpart = "NOW() - INTERVAL '3 months'" ;
452 $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)" ;
455 $result = db_query ( $this -> link
, "SELECT ttrss_feeds.title, ttrss_feeds.site_url,
456 ttrss_feeds.feed_url, ttrss_feeds.id, MAX(updated) AS last_article
457 FROM ttrss_feeds, ttrss_entries, ttrss_user_entries WHERE
458 (SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE
459 ttrss_entries.id = ref_id AND
460 ttrss_user_entries.feed_id = ttrss_feeds.id) < $interval_qpart
461 AND ttrss_feeds.owner_uid = " . $_SESSION [ "uid" ]. " AND
462 ttrss_user_entries.feed_id = ttrss_feeds.id AND
463 ttrss_entries.id = ref_id
464 GROUP BY ttrss_feeds.title, ttrss_feeds.id, ttrss_feeds.site_url, ttrss_feeds.feed_url
465 ORDER BY last_article" );
467 print "<div class= \" dialogNotice \" >" . __ ( "These feeds have not been updated with new content for 3 months (oldest first):" ) . "</div>" ;
469 print "<div dojoType= \" dijit.Toolbar \" >" ;
470 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
471 "<span>" . __ ( 'Select' ). "</span>" ;
472 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
473 print "<div onclick= \" selectTableRows('prefInactiveFeedList', 'all') \"
474 dojoType= \" dijit.MenuItem \" >" . __ ( 'All' ). "</div>" ;
475 print "<div onclick= \" selectTableRows('prefInactiveFeedList', 'none') \"
476 dojoType= \" dijit.MenuItem \" >" . __ ( 'None' ). "</div>" ;
477 print "</div></div>" ;
478 print "</div>" ; #toolbar
480 print "<div class= \" inactiveFeedHolder \" >" ;
482 print "<table width= \" 100% \" cellspacing= \" 0 \" id= \" prefInactiveFeedList \" >" ;
486 while ( $line = db_fetch_assoc ( $result )) {
488 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
489 $feed_id = $line [ "id" ];
490 $this_row_id = "id= \" FUPDD- $feed_id\" " ;
492 # class needed for selectTableRows()
493 print "<tr class= \" placeholder \" $this_row_id >" ;
495 $edit_title = htmlspecialchars ( $line [ "title" ]);
497 # id needed for selectTableRows()
498 print "<td width='5%' align='center'><input
499 onclick='toggleSelectRow2(this);' dojoType= \" dijit.form.CheckBox \"
500 type= \" checkbox \" id= \" FUPDC- $feed_id\" ></td>" ;
503 print "<a class= \" visibleLink \" href= \" # \" " .
504 "title= \" " . __ ( "Click to edit feed" ). " \" " .
505 "onclick= \" editFeed(" . $line [ "id" ]. ") \" >" .
506 htmlspecialchars ( $line [ "title" ]). "</a>" ;
508 print "</td><td class= \" insensitive \" align='right'>" ;
509 print make_local_datetime ( $this -> link
, $line [ 'last_article' ], false );
519 print "<div class='dlgButtons'>" ;
520 print "<div style='float : left'>" ;
521 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('inactiveFeedsDlg').removeSelected() \" >"
522 . __ ( 'Unsubscribe from selected feeds' ). "</button> " ;
525 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('inactiveFeedsDlg').hide() \" >" .
526 __ ( 'Close this window' ). "</button>" ;
532 function feedsWithErrors () {
533 print "<div class= \" dialogNotice \" >" . __ ( "These feeds have not been updated because of errors:" ) . "</div>" ;
535 $result = db_query ( $this -> link
, "SELECT id,title,feed_url,last_error,site_url
536 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION [ "uid" ]);
538 print "<div dojoType= \" dijit.Toolbar \" >" ;
539 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
540 "<span>" . __ ( 'Select' ). "</span>" ;
541 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
542 print "<div onclick= \" selectTableRows('prefErrorFeedList', 'all') \"
543 dojoType= \" dijit.MenuItem \" >" . __ ( 'All' ). "</div>" ;
544 print "<div onclick= \" selectTableRows('prefErrorFeedList', 'none') \"
545 dojoType= \" dijit.MenuItem \" >" . __ ( 'None' ). "</div>" ;
546 print "</div></div>" ;
547 print "</div>" ; #toolbar
549 print "<div class= \" inactiveFeedHolder \" >" ;
551 print "<table width= \" 100% \" cellspacing= \" 0 \" id= \" prefErrorFeedList \" >" ;
555 while ( $line = db_fetch_assoc ( $result )) {
557 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
558 $feed_id = $line [ "id" ];
559 $this_row_id = "id= \" FUPDD- $feed_id\" " ;
561 # class needed for selectTableRows()
562 print "<tr class= \" placeholder \" $this_row_id >" ;
564 $edit_title = htmlspecialchars ( $line [ "title" ]);
566 # id needed for selectTableRows()
567 print "<td width='5%' align='center'><input
568 onclick='toggleSelectRow2(this);' dojoType= \" dijit.form.CheckBox \"
569 type= \" checkbox \" id= \" FUPDC- $feed_id\" ></td>" ;
572 print "<a class= \" visibleLink \" href= \" # \" " .
573 "title= \" " . __ ( "Click to edit feed" ). " \" " .
574 "onclick= \" editFeed(" . $line [ "id" ]. ") \" >" .
575 htmlspecialchars ( $line [ "title" ]). "</a>: " ;
577 print "<span class= \" insensitive \" >" ;
578 print htmlspecialchars ( $line [ "last_error" ]);
590 print "<div class='dlgButtons'>" ;
591 print "<div style='float : left'>" ;
592 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('errorFeedsDlg').removeSelected() \" >"
593 . __ ( 'Unsubscribe from selected feeds' ). "</button> " ;
596 print "<button dojoType= \" dijit.form.Button \" onclick= \" dijit.byId('errorFeedsDlg').hide() \" >" .
597 __ ( 'Close this window' ). "</button>" ;
602 function editArticleTags () {
604 print __ ( "Tags for this article (separated by commas):" ). "<br>" ;
606 $tags = get_article_tags ( $this -> link
, $this -> param
);
608 $tags_str = join ( ", " , $tags );
610 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" id \" value= \" $this ->param \" >" ;
611 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
612 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" setArticleTags \" >" ;
614 print "<table width='100%'><tr><td>" ;
616 print "<textarea dojoType= \" dijit.form.SimpleTextarea \" rows='4'
617 style='font-size : 12px; width : 100%' id= \" tags_str \"
618 name='tags_str'> $tags_str </textarea>
619 <div class= \" autocomplete \" id= \" tags_choices \"
620 style= \" display:none \" ></div>" ;
622 print "</td></tr></table>" ;
624 print "<div class='dlgButtons'>" ;
626 print "<button dojoType= \" dijit.form.Button \"
627 onclick= \" dijit.byId('editTagsDlg').execute() \" >" . __ ( 'Save' ). "</button> " ;
628 print "<button dojoType= \" dijit.form.Button \"
629 onclick= \" dijit.byId('editTagsDlg').hide() \" >" . __ ( 'Cancel' ). "</button>" ;
634 function printTagCloud () {
635 print "<title>" . __ ( 'Tag Cloud' ). "</title>" ;
636 print "<content><![CDATA[" ;
638 print "<div class= \" tagCloudContainer \" >" ;
640 // from here: http://www.roscripts.com/Create_tag_cloud-71.html
642 $query = "SELECT tag_name, COUNT(post_int_id) AS count
643 FROM ttrss_tags WHERE owner_uid = " . $_SESSION [ "uid" ]. "
644 GROUP BY tag_name ORDER BY count DESC LIMIT 50" ;
646 $result = db_query ( $this -> link
, $query );
650 while ( $line = db_fetch_assoc ( $result )) {
651 $tags [ $line [ "tag_name" ]] = $line [ "count" ];
654 if ( count ( $tags ) == 0 ){ return ; }
658 $max_size = 32 ; // max font size in pixels
659 $min_size = 11 ; // min font size in pixels
661 // largest and smallest array values
662 $max_qty = max ( array_values ( $tags ));
663 $min_qty = min ( array_values ( $tags ));
665 // find the range of values
666 $spread = $max_qty - $min_qty ;
667 if ( $spread == 0 ) { // we don't want to divide by zero
671 // set the font-size increment
672 $step = ( $max_size - $min_size ) / ( $spread );
674 // loop through the tag array
675 foreach ( $tags as $key => $value ) {
676 // calculate font-size
677 // find the $value in excess of $min_qty
678 // multiply by the font-size increment ($size)
679 // and add the $min_size set above
680 $size = round ( $min_size +
(( $value - $min_qty ) * $step ));
682 $key_escaped = str_replace ( "'" , " \\ '" , $key );
684 echo "<a href= \" javascript:viewfeed(' $key_escaped ') \" style= \" font-size: " .
685 $size . "px \" title= \" $value articles tagged with " .
686 $key . '">' . $key . '</a> ' ;
693 print "<div align='center'>" ;
694 print "<button dojoType= \" dijit.form.Button \"
695 onclick= \" return closeInfoBox() \" >" .
696 __ ( 'Close this window' ). "</button>" ;
699 print "]]></content>" ;
702 function printTagSelect () {
704 print "<title>" . __ ( 'Select item(s) by tags' ) . "</title>" ;
705 print "<content><![CDATA[" ;
707 print __ ( "Match:" ). " " .
708 "<input class= \" noborder \" dojoType= \" dijit.form.RadioButton \" type= \" radio \" checked value= \" any \" name= \" tag_mode \" > Any " ;
709 print "<input class= \" noborder \" dojoType= \" dijit.form.RadioButton \" type= \" radio \" value= \" all \" name= \" tag_mode \" > All " ;
712 print "<select id= \" all_tags \" name= \" all_tags \" title= \" " . __ ( 'Which Tags?' ) . " \" multiple= \" multiple \" size= \" 10 \" style= \" width : 100% \" >" ;
713 $result = db_query ( $this -> link
, "SELECT DISTINCT tag_name FROM ttrss_tags WHERE owner_uid = " . $_SESSION [ 'uid' ]. "
714 AND LENGTH(tag_name) <= 30 ORDER BY tag_name ASC" );
716 while ( $row = db_fetch_assoc ( $result )) {
717 $tmp = htmlspecialchars ( $row [ "tag_name" ]);
718 print "<option value= \" " . str_replace ( " " , " %20 " , $tmp ) . " \" > $tmp </option>" ;
723 print "<div align='right'>" ;
724 print "<button dojoType= \" dijit.form.Button \" onclick= \" viewfeed(get_all_tags($('all_tags')),
725 get_radio_checked($('tag_mode'))); \" >" . __ ( 'Display entries' ) . "</button>" ;
727 print "<button dojoType= \" dijit.form.Button \"
728 onclick= \" return closeInfoBox() \" >" .
729 __ ( 'Close this window' ) . "</button>" ;
732 print "]]></content>" ;
735 function generatedFeed () {
737 print "<title>" . __ ( 'View as RSS' ). "</title>" ;
738 print "<content><![CDATA[" ;
740 $this -> params
= explode ( ":" , $this -> param
, 3 );
741 $feed_id = db_escape_string ( $this -> params
[ 0 ]);
742 $is_cat = ( bool ) $this -> params
[ 1 ];
744 $key = get_feed_access_key ( $this -> link
, $feed_id , $is_cat );
746 $url_path = htmlspecialchars ( $this -> params
[ 2 ]) . "&key=" . $key ;
748 print "<div class= \" dialogNotice \" >" . __ ( "You can view this feed as RSS using the following URL:" ) . "</div>" ;
750 print "<div class= \" tagCloudContainer \" >" ;
751 print "<a id='gen_feed_url' href=' $url_path ' target='_blank'> $url_path </a>" ;
754 print "<div align='center'>" ;
756 print "<button dojoType= \" dijit.form.Button \" onclick= \" return genUrlChangeKey(' $feed_id ', ' $is_cat ') \" >" .
757 __ ( 'Generate new URL' ). "</button> " ;
759 print "<button dojoType= \" dijit.form.Button \" onclick= \" return closeInfoBox() \" >" .
760 __ ( 'Close this window' ). "</button>" ;
763 print "]]></content>" ;
768 function newVersion () {
770 $version_data = check_for_update ( $this -> link
);
771 $version = $version_data [ 'version' ];
772 $id = $version_data [ 'version_id' ];
774 print "<div class='tagCloudContainer'>" ;
776 print T_sprintf ( "New version of Tiny Tiny RSS is available ( %s )." ,
781 $details = "http://tt-rss.org/redmine/versions/show/ $id " ;
782 $download = "http://tt-rss.org/#Download" ;
784 print "<p align='center'>" . __ ( "You can update using built-in updater in the Preferences or by using update.php" ). "</p>" ;
786 print "<div style='text-align : center'>" ;
787 print "<button dojoType= \" dijit.form.Button \"
788 onclick= \" return window.open(' $details ') \" >" . __ ( "Details" ). "</button>" ;
789 print "<button dojoType= \" dijit.form.Button \"
790 onclick= \" return window.open(' $download ') \" >" . __ ( "Download" ). "</button>" ;
791 print "<button dojoType= \" dijit.form.Button \"
792 onclick= \" return dijit.byId('newVersionDlg').hide() \" >" .
793 __ ( 'Close this window' ). "</button>" ;
798 function customizeCSS () {
799 $value = get_pref ( $this -> link
, "USER_STYLESHEET" );
801 $value = str_replace ( "<br/>" , " \n " , $value );
803 print "<div class= \" dialogNotice \" >" ;
804 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" );
807 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
808 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" setpref \" >" ;
809 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" key \" value= \" USER_STYLESHEET \" >" ;
811 print "<table width='100%'><tr><td>" ;
812 print "<textarea dojoType= \" dijit.form.SimpleTextarea \"
813 style='font-size : 12px; width : 100%; height: 200px;'
814 placeHolder='body#ttrssMain { font-size : 14px; };'
815 name='value'> $value </textarea>" ;
816 print "</td></tr></table>" ;
818 print "<div class='dlgButtons'>" ;
819 print "<button dojoType= \" dijit.form.Button \"
820 onclick= \" dijit.byId('cssEditDlg').execute() \" >" . __ ( 'Save' ). "</button> " ;
821 print "<button dojoType= \" dijit.form.Button \"
822 onclick= \" dijit.byId('cssEditDlg').hide() \" >" . __ ( 'Cancel' ). "</button>" ;
827 function addInstance () {
828 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" pref-instances \" >" ;
829 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" add \" >" ;
831 print "<div class= \" dlgSec \" >" . __ ( "Instance" ). "</div>" ;
833 print "<div class= \" dlgSecCont \" >" ;
837 print __ ( "URL:" ) . " " ;
839 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
840 placeHolder= \" " . __ ( "Instance URL" ). " \"
841 regExp='^(http|https)://.*'
842 style= \" font-size : 16px; width: 20em \" name= \" access_url \" >" ;
846 $access_key = sha1 ( uniqid ( rand (), true ));
850 print __ ( "Access key:" ) . " " ;
852 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
853 placeHolder= \" " . __ ( "Access key" ). " \" regExp='\w{40}'
854 style= \" width: 20em \" name= \" access_key \" id= \" instance_add_key \"
855 value= \" $access_key\" >" ;
857 print "<p class='insensitive'>" . __ ( "Use one access key for both linked instances." );
861 print "<div class= \" dlgButtons \" >
862 <div style='float : left'>
863 <button dojoType= \" dijit.form.Button \"
864 onclick= \" return dijit.byId('instanceAddDlg').regenKey() \" >" .
865 __ ( 'Generate new key' ). "</button>
867 <button dojoType= \" dijit.form.Button \"
868 onclick= \" return dijit.byId('instanceAddDlg').execute() \" >" .
869 __ ( 'Create link' ). "</button>
870 <button dojoType= \" dijit.form.Button \"
871 onclick= \" return dijit.byId('instanceAddDlg').hide() \"\" >" .
872 __ ( 'Cancel' ). "</button></div>" ;
877 function dataImport () {
878 header ( "Content-Type: text/html" ); # required for iframe
880 print "<div style='text-align : center'>" ;
882 if ( is_file ( $_FILES [ 'export_file' ][ 'tmp_name' ])) {
884 perform_data_import ( $this -> link
, $_FILES [ 'export_file' ][ 'tmp_name' ], $_SESSION [ 'uid' ]);
887 print "<p>" . T_sprintf ( "Could not upload file. You might need to adjust upload_max_filesize
888 in PHP.ini (current value = %s )" , ini_get ( "upload_max_filesize" )) . " or use CLI import tool.</p>" ;
892 print "<button dojoType= \" dijit.form.Button \"
893 onclick= \" dijit.byId('dataImportDlg').hide() \" >" .
894 __ ( 'Close this window' ). "</button>" ;
900 function batchSubscribe () {
901 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" rpc \" >" ;
902 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" method \" value= \" batchaddfeeds \" >" ;
904 print "<table width='100%'><tr><td>
905 " . __ ( "Add one valid RSS feed per line (no feed detection is done)" ). "
906 </td><td align='right'>" ;
907 if ( get_pref ( $this -> link
, 'ENABLE_FEED_CATS' )) {
908 print __ ( 'Place in category:' ) . " " ;
909 print_feed_cat_select ( $this -> link
, "cat" , false , 'dojoType="dijit.form.Select"' );
911 print "</td></tr><tr><td colspan='2'>" ;
913 style='font-size : 12px; width : 100%; height: 200px;'
914 placeHolder= \" " . __ ( "Feeds to subscribe, One per line" ). " \"
915 dojoType= \" dijit.form.SimpleTextarea \" required= \" 1 \" name= \" feeds \" ></textarea>" ;
917 print "</td></tr><tr><td colspan='2'>" ;
919 print "<div id='feedDlg_loginContainer' style='display : none'>
921 " <input dojoType= \" dijit.form.TextBox \" name='login' \"
922 placeHolder= \" " . __ ( "Login" ). " \"
923 style= \" width : 10em; \" > " .
925 placeHolder= \" " . __ ( "Password" ). " \"
926 dojoType= \" dijit.form.TextBox \" type='password'
927 style= \" width : 10em; \" name='pass' \" >" .
928 " <p class='insensitive'>" . __ ( "OAuth will be used automatically for Twitter feeds." ). "</p>
931 print "</td></tr><tr><td colspan='2'>" ;
933 print "<div style= \" clear : both \" >
934 <input type= \" checkbox \" name= \" need_auth \" dojoType= \" dijit.form.CheckBox \" id= \" feedDlg_loginCheck \"
935 onclick='checkboxToggleElement(this, \" feedDlg_loginContainer \" )'>
936 <label for= \" feedDlg_loginCheck \" >" .
937 __ ( 'Feeds require authentication.' ). "</div>" ;
941 print "</td></tr></table>" ;
943 print "<div class= \" dlgButtons \" >
944 <button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('batchSubDlg').execute() \" >" . __ ( 'Subscribe' ). "</button>
945 <button dojoType= \" dijit.form.Button \" onclick= \" return dijit.byId('batchSubDlg').hide() \" >" . __ ( 'Cancel' ). "</button>