]>
git.wh0rd.org - tt-rss.git/blob - classes/dlg.php
2 class Dlg
extends Handler_Protected
{
6 function before ( $method ) {
7 if ( parent
:: before ( $method )) {
8 header ( "Content-Type: text/html" ); # required for iframe
10 $this -> param
= $_REQUEST [ "param" ];
16 function importOpml () {
17 print __ ( "If you have imported labels and/or filters, you might need to reload preferences to see your new data." ) . "</p>" ;
19 print "<div class= \" prefFeedOPMLHolder \" >" ;
21 print "<ul class='nomarks'>" ;
23 $opml = new Opml ( $_REQUEST );
25 $opml -> opml_import ( $_SESSION [ "uid" ]);
30 print "<div align='center'>" ;
31 print "<button dojoType= \" dijit.form.Button \"
32 onclick= \" dijit.byId('opmlImportDlg').execute() \" >" .
33 __ ( 'Close this window' ). "</button>" ;
41 function pubOPMLUrl () {
42 $url_path = Opml
:: opml_publish_url ();
44 print __ ( "Your Public OPML URL is:" );
46 print "<div class= \" tagCloudContainer \" >" ;
47 print "<a id='pub_opml_url' href=' $url_path ' target='_blank'> $url_path </a>" ;
50 print "<div align='center'>" ;
52 print "<button dojoType= \" dijit.form.Button \" onclick= \" return opmlRegenKey() \" >" .
53 __ ( 'Generate new URL' ). "</button> " ;
55 print "<button dojoType= \" dijit.form.Button \" onclick= \" return closeInfoBox() \" >" .
56 __ ( 'Close this window' ). "</button>" ;
63 function explainError () {
64 print "<div class= \" errorExplained \" >" ;
66 if ( $this -> param
== 1 ) {
67 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." );
69 $stamp = ( int ) file_get_contents ( LOCK_DIRECTORY
. "/update_daemon.stamp" );
71 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
75 if ( $this -> param
== 3 ) {
76 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." );
78 $stamp = ( int ) file_get_contents ( LOCK_DIRECTORY
. "/update_daemon.stamp" );
80 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
86 print "<div align='center'>" ;
88 print "<button onclick= \" return closeInfoBox() \" >" .
89 __ ( 'Close this window' ). "</button>" ;
96 function printTagCloud () {
97 print "<div class= \" tagCloudContainer \" >" ;
99 // from here: http://www.roscripts.com/Create_tag_cloud-71.html
101 $sth = $this -> pdo
-> prepare ( "SELECT tag_name, COUNT(post_int_id) AS count
102 FROM ttrss_tags WHERE owner_uid = ?
103 GROUP BY tag_name ORDER BY count DESC LIMIT 50" );
104 $sth -> execute ([ $_SESSION [ 'uid' ]]);
108 while ( $line = $sth -> fetch ()) {
109 $tags [ $line [ "tag_name" ]] = $line [ "count" ];
112 if ( count ( $tags ) == 0 ){ return ; }
116 $max_size = 32 ; // max font size in pixels
117 $min_size = 11 ; // min font size in pixels
119 // largest and smallest array values
120 $max_qty = max ( array_values ( $tags ));
121 $min_qty = min ( array_values ( $tags ));
123 // find the range of values
124 $spread = $max_qty - $min_qty ;
125 if ( $spread == 0 ) { // we don't want to divide by zero
129 // set the font-size increment
130 $step = ( $max_size - $min_size ) / ( $spread );
132 // loop through the tag array
133 foreach ( $tags as $key => $value ) {
134 // calculate font-size
135 // find the $value in excess of $min_qty
136 // multiply by the font-size increment ($size)
137 // and add the $min_size set above
138 $size = round ( $min_size +
(( $value - $min_qty ) * $step ));
140 $key_escaped = str_replace ( "'" , " \\ '" , $key );
142 echo "<a href= \" javascript:viewfeed({feed:' $key_escaped '}) \" style= \" font-size: " .
143 $size . "px \" title= \" $value articles tagged with " .
144 $key . '">' . $key . '</a> ' ;
151 print "<div align='center'>" ;
152 print "<button dojoType= \" dijit.form.Button \"
153 onclick= \" return closeInfoBox() \" >" .
154 __ ( 'Close this window' ). "</button>" ;
159 function generatedFeed () {
161 $this -> params
= explode ( ":" , $this -> param
, 3 );
162 $feed_id = $this -> params
[ 0 ];
163 $is_cat = ( bool ) $this -> params
[ 1 ];
165 $key = get_feed_access_key ( $feed_id , $is_cat );
167 $url_path = htmlspecialchars ( $this -> params
[ 2 ]) . "&key=" . $key ;
169 print "<h2>" . __ ( "You can view this feed as RSS using the following URL:" ). "</h2>" ;
171 print "<div class= \" tagCloudContainer \" >" ;
172 print "<a id='gen_feed_url' href=' $url_path ' target='_blank'> $url_path </a>" ;
175 print "<div align='center'>" ;
177 print "<button dojoType= \" dijit.form.Button \" onclick= \" return genUrlChangeKey(' $feed_id ', ' $is_cat ') \" >" .
178 __ ( 'Generate new URL' ). "</button> " ;
180 print "<button dojoType= \" dijit.form.Button \" onclick= \" return closeInfoBox() \" >" .
181 __ ( 'Close this window' ). "</button>" ;
188 function defaultPasswordWarning () {
190 print_warning ( __ ( "You are using default tt-rss password. Please change it in the Preferences (Personal data / Authentication)." ));
192 print "<div align='center'>" ;
193 print "<button dojoType= \" dijit.form.Button \" onclick= \" gotoPreferences() \" >" .
194 __ ( 'Open Preferences' ). "</button> " ;
195 print "<button dojoType= \" dijit.form.Button \"
196 onclick= \" return closeInfoBox() \" >" .
197 __ ( 'Close this window' ). "</button>" ;