]>
git.wh0rd.org - tt-rss.git/blob - modules/popup-dialog.php
2 function module_popup_dialog ( $link ) {
4 $param = db_escape_string ( $_REQUEST [ "param" ]);
6 if ( $id == "explainError" ) {
8 print "<div id= \" infoBoxTitle \" >" . __ ( 'Notice' ). "</div>" ;
9 print "<div class= \" infoBoxContents \" >" ;
11 print "<div class= \" errorExplained \" >" ;
14 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." );
16 $stamp = ( int ) read_stampfile ( "update_daemon.stamp" );
18 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
23 $msg = check_for_update ( $link );
26 print __ ( "You are running the latest version of Tiny Tiny RSS. The fact that you are seeing this dialog is probably a bug." );
34 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." );
36 $stamp = ( int ) read_stampfile ( "update_daemon.stamp" );
38 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
44 print "<div align='center'>" ;
46 print "<input class= \" button \"
47 type= \" submit \" onclick= \" return visitOfficialSite() \"
48 value= \" " . __ ( 'Visit official site' ). " \" > " ;
50 print "<input class= \" button \"
51 type= \" submit \" onclick= \" return closeInfoBox() \"
52 value= \" " . __ ( 'Close this window' ). " \" >" ;
59 if ( $id == "quickAddFeed" ) {
61 print "<div id= \" infoBoxTitle \" >" . __ ( 'Subscribe to Feed' ). "</div>" ;
62 print "<div class= \" infoBoxContents \" >" ;
64 print "<form id='feed_add_form' onsubmit='return false'>" ;
66 print "<input type= \" hidden \" name= \" op \" value= \" pref-feeds \" >" ;
67 print "<input type= \" hidden \" name= \" subop \" value= \" add \" >" ;
68 print "<input type= \" hidden \" name= \" from \" value= \" tt-rss \" >" ;
70 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
71 print "<div class= \" dlgSecCont \" >" ;
73 print __ ( "URL:" ) . " " ;
75 print "<input size= \" 40 \"
76 onkeypress= \" return filterCR(event, subscribeToFeed) \"
77 name= \" feed_url \" ></td></tr>" ;
81 if ( get_pref ( $link , 'ENABLE_FEED_CATS' )) {
82 print __ ( 'Place in category:' ) . " " ;
83 print_feed_cat_select ( $link , "cat_id" );
88 print "<div id='fadd_login_container' style='display:none'>
90 <div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>
91 <div class= \" dlgSecCont \" >" .
93 __ ( 'Login:' ) . " <input name='auth_login' size= \" 20 \"
94 onkeypress= \" return filterCR(event, subscribeToFeed) \" > " .
95 __ ( 'Password:' ) . "<input type='password'
96 name='auth_pass' size= \" 20 \"
97 onkeypress= \" return filterCR(event, subscribeToFeed) \" >
101 print "<div style= \" clear : both \" >
102 <input type= \" checkbox \" id= \" fadd_login_check \"
103 onclick='checkboxToggleElement(this, \" fadd_login_container \" )'>
104 <label for= \" fadd_login_check \" >" .
105 __ ( 'This feed requires authentication.' ). "</div>" ;
109 print "<div class= \" dlgButtons \" >
110 <button class= \" button \" id= \" fadd_submit_btn \"
111 onclick= \" return subscribeToFeed() \" >" . __ ( 'Subscribe' ). "</button>
112 <button onclick= \" return browseFeeds() \" >" . __ ( 'More feeds' ). "</button>
113 <button onclick= \" return closeInfoBox() \" >" . __ ( 'Cancel' ). "</button></div>" ;
118 if ( $id == "search" ) {
120 print "<div id= \" infoBoxTitle \" >" . __ ( 'Search' ). "</div>" ;
121 print "<div class= \" infoBoxContents \" >" ;
123 print "<form id='search_form' onsubmit='return false'>" ;
125 #$active_feed_id = db_escape_string($_REQUEST["param"]);
127 $params = split ( ":" , db_escape_string ( $_REQUEST [ "param" ]));
129 $active_feed_id = sprintf ( " %d " , $params [ 0 ]);
130 $is_cat = $params [ 1 ] == "true" ;
132 print "<div class= \" dlgSec \" >" . __ ( 'Look for' ). "</div>" ;
134 print "<div class= \" dlgSecCont \" >" ;
136 print "<input name= \" query \" size= \" 20 \" type= \" search \" value=''>" ;
138 print " " . __ ( 'match on' ). " " ;
140 $search_fields = array (
141 "title" => __ ( "Title" ),
142 "content" => __ ( "Content" ),
143 "both" => __ ( "Title or content" ));
145 print_select_hash ( "match_on" , 3 , $search_fields );
148 print "<br/>" . __ ( 'Limit search to:' ). " " ;
150 print "<select name= \" search_mode \" >
151 <option value= \" all_feeds \" >" . __ ( 'All feeds' ). "</option>" ;
153 $feed_title = getFeedTitle ( $link , $active_feed_id );
156 $feed_cat_title = getFeedCatTitle ( $link , $active_feed_id );
158 $feed_cat_title = getCategoryTitle ( $link , $active_feed_id );
161 if ( $active_feed_id && ! $is_cat ) {
162 print "<option selected value= \" this_feed \" > $feed_title </option>" ;
164 print "<option disabled>" . __ ( 'This feed' ). "</option>" ;
168 $cat_preselected = "selected" ;
171 if ( get_pref ( $link , 'ENABLE_FEED_CATS' ) && ( $active_feed_id > 0 ||
$is_cat )) {
172 print "<option $cat_preselected value= \" this_cat \" > $feed_cat_title </option>" ;
174 //print "<option disabled>".__('This category')."</option>";
183 print "<div class= \" dlgButtons \" >
184 <button disabled='true' onclick= \" javascript:search() \" >" . __ ( 'Search' ). "</button>
185 <button onclick= \" javascript:searchCancel() \" >" . __ ( 'Cancel' ). "</button>
194 if ( $id == "quickAddFilter" ) {
196 $active_feed_id = db_escape_string ( $_REQUEST [ "param" ]);
198 print "<div id= \" infoBoxTitle \" >" . __ ( 'Create Filter' ). "</div>" ;
199 print "<div class= \" infoBoxContents \" >" ;
201 print "<form id= \" filter_add_form \" onsubmit='return false'>" ;
203 print "<input type= \" hidden \" name= \" op \" value= \" pref-filters \" >" ;
204 print "<input type= \" hidden \" name= \" quiet \" value= \" 1 \" >" ;
205 print "<input type= \" hidden \" name= \" subop \" value= \" add \" >" ;
207 $result = db_query ( $link , "SELECT id,description
208 FROM ttrss_filter_types ORDER BY description" );
210 $filter_types = array ();
212 while ( $line = db_fetch_assoc ( $result )) {
213 //array_push($filter_types, $line["description"]);
214 $filter_types [ $line [ "id" ]] = __ ( $line [ "description" ]);
217 print "<div class= \" dlgSec \" >" . __ ( "Match" ). "</div>" ;
219 print "<div class= \" dlgSecCont \" >" ;
221 print "<span id= \" filter_dlg_date_mod_box \" style= \" display : none \" >" ;
222 print __ ( "Date" ) . " " ;
224 $filter_params = array (
225 "before" => __ ( "before" ),
226 "after" => __ ( "after" ));
228 print_select_hash ( "filter_date_modifier" , "before" , $filter_params );
230 print " </span>" ;
232 print "<input onkeypress= \" return filterCR(event, createFilter) \"
233 name= \" reg_exp \" size= \" 30 \" value= \" $reg_exp\" >" ;
235 print "<span id= \" filter_dlg_date_chk_box \" style= \" display : none \" >" ;
236 print " <input class= \" button \"
237 type= \" submit \" onclick= \" return filterDlgCheckDate() \"
238 value= \" " . __ ( 'Check it' ). " \" >" ;
241 print "<br/> " . __ ( "on field" ) . " " ;
242 print_select_hash ( "filter_type" , 1 , $filter_types ,
243 'onchange="filterDlgCheckType(this)"' );
247 print __ ( "in" ) . " " ;
248 print_feed_select ( $link , "feed_id" , $active_feed_id );
252 print "<div class= \" dlgSec \" >" . __ ( "Perform Action" ). "</div>" ;
254 print "<div class= \" dlgSecCont \" >" ;
256 print "<select name= \" action_id \"
257 onchange= \" filterDlgCheckAction(this) \" >" ;
259 $result = db_query ( $link , "SELECT id,description FROM ttrss_filter_actions
262 while ( $line = db_fetch_assoc ( $result )) {
263 printf ( "<option value=' %d '> %s </option>" , $line [ "id" ], __ ( $line [ "description" ]));
268 print "<span id= \" filter_dlg_param_box \" style= \" display : none \" >" ;
269 print " " . __ ( "with parameters:" ) . " " ;
270 print "<input size= \" 20 \"
271 onkeypress= \" return filterCR(event, createFilter) \"
272 name= \" action_param \" >" ;
274 print_label_select ( $link , "action_param_label" , $action_param );
278 print " " ; // tiny layout hack
282 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
283 print "<div class= \" dlgSecCont \" >" ;
285 print "<div style= \" line-height : 100% \" >" ;
287 print "<input type= \" checkbox \" name= \" enabled \" id= \" enabled \" checked= \" 1 \" >
288 <label for= \" enabled \" >" . __ ( 'Enabled' ). "</label><br/>" ;
290 print "<input type= \" checkbox \" name= \" inverse \" id= \" inverse \" >
291 <label for= \" inverse \" >" . __ ( 'Inverse match' ). "</label>" ;
298 print "<div class= \" dlgButtons \" >" ;
300 print "<button onclick= \" return createFilter() \" >" .
301 __ ( 'Create' ). "</button> " ;
303 print "<button onclick= \" return closeInfoBox() \" >" . __ ( 'Cancel' ).
308 // print "</td></tr></table>";
313 if ( $id == "feedUpdateErrors" ) {
315 print "<div id= \" infoBoxTitle \" >" . __ ( 'Update Errors' ). "</div>" ;
316 print "<div class= \" infoBoxContents \" >" ;
318 print __ ( "These feeds have not been updated because of errors:" );
320 $result = db_query ( $link , "SELECT id,title,feed_url,last_error
321 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION [ "uid" ]);
323 print "<ul class='feedErrorsList'>" ;
325 while ( $line = db_fetch_assoc ( $result )) {
326 print "<li><b>" . $line [ "title" ] . "</b> (" . $line [ "feed_url" ] . "): " .
327 "<em>" . $line [ "last_error" ] . "</em>" ;
332 print "<div align='center'>" ;
334 print "<input class= \" button \"
335 type= \" submit \" onclick= \" return closeInfoBox() \"
336 value= \" " . __ ( 'Close' ). " \" >" ;
343 if ( $id == "editArticleTags" ) {
345 print "<div id= \" infoBoxTitle \" >" . __ ( 'Edit Tags' ). "</div>" ;
346 print "<div class= \" infoBoxContents \" >" ;
348 print "<form id= \" tag_edit_form \" onsubmit='return false'>" ;
350 print __ ( "Tags for this article (separated by commas):" ). "<br>" ;
352 $tags = get_article_tags ( $link , $param );
354 $tags_str = join ( ", " , $tags );
356 print "<table width='100%'>" ;
358 print "<tr><td colspan='2'><input type= \" hidden \" name= \" id \" value= \" $param\" ></td></tr>" ;
360 print "<tr><td colspan='2'><textarea rows='4' class='iedit' id='tags_str'
361 name='tags_str'> $tags_str </textarea>
362 <div class= \" autocomplete \" id= \" tags_choices \"
363 style= \" display:none \" ></div>
366 /* print "<tr><td>".__('Add existing tag:')."</td>";
368 $result = db_query($link, "SELECT DISTINCT tag_name FROM ttrss_tags
369 WHERE owner_uid = '".$_SESSION["uid"]."' ORDER BY tag_name");
371 $found_tags = array();
373 array_push($found_tags, '');
375 while ($line = db_fetch_assoc($result)) {
376 array_push($found_tags, truncate_string($line["tag_name"], 20));
379 print "<td align='right'>";
381 print_select("found_tags", '', $found_tags, "onchange=\"javascript:editTagsInsert()\"");
391 print "<div align='right'>" ;
393 print "<input class= \" button \"
394 type= \" submit \" onclick= \" return editTagsSave() \"
395 value= \" " . __ ( 'Save' ). " \" > " ;
397 print "<input class= \" button \"
398 type= \" submit \" onclick= \" return closeInfoBox() \"
399 value= \" " . __ ( 'Cancel' ). " \" >" ;
407 if ( $id == "printTagCloud" ) {
408 print "<div id= \" infoBoxTitle \" >" . __ ( 'Tag cloud' ). "</div>" ;
409 print "<div class= \" infoBoxContents \" >" ;
411 print __ ( "Showing most popular tags " ). " (<a
412 href='javascript:toggleTags(true)'>" . __ ( 'more tags' ). "</a>):<br/>" ;
414 print "<div class= \" tagCloudContainer \" >" ;
416 printTagCloud ( $link );
420 print "<div align='center'>" ;
421 print "<input class= \" button \"
422 type= \" submit \" onclick= \" return closeInfoBox() \"
423 value= \" " . __ ( 'Close this window' ). " \" >" ;
431 /* if ($id == "offlineDownload") {
432 print "<div id=\"infoBoxTitle\">".__('Download articles')."</div>";
433 print "<div class=\"infoBoxContents\">";
435 print "<form name='download_ops_form' id='download_ops_form'>";
437 print "<div class=\"dlgSec\">".__("Download")."</div>";
439 print "<div class=\"dlgSecCont\">";
447 print_select_hash("amount", 50, $amount);
449 print " " . __("latest articles for offline reading.");
453 print "<input checked='yes' type='checkbox' name='unread_only' id='unread_only'>";
454 print "<label for='unread_only'>".__('Only include unread articles')."</label>";
460 print "<div class=\"dlgButtons\">
461 <input class=\"button\"
462 type=\"submit\" onclick=\"return initiate_offline_download(0, this)\" value=\"".__('Download')."\">
463 <input class=\"button\"
464 type=\"submit\" onclick=\"return closeInfoBox()\"
465 value=\"".__('Cancel')."\"></div>";
473 print "<div id='infoBoxTitle'>Internal Error</div>
474 <div id='infoBoxContents'>
475 <p>Unknown dialog <b> $id </b></p>