]>
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 == "editPrefProfiles" ) {
8 print "<div id= \" infoBoxTitle \" >" . __ ( 'Settings Profiles' ). "</div>" ;
9 print "<div class= \" infoBoxContents \" >" ;
11 print "<div><input id= \" fadd_profile \"
12 onkeypress= \" return filterCR(event, addPrefProfile) \"
14 <button onclick= \" javascript:addPrefProfile() \" >" .
15 __ ( 'Create profile' ). "</button></div>" ;
19 $result = db_query ( $link , "SELECT title,id FROM ttrss_settings_profiles
20 WHERE owner_uid = " . $_SESSION [ "uid" ]. "ORDER BY title" );
23 <a href= \" javascript:selectPrefRows('fcat', true) \" >" . __ ( 'All' ). "</a>,
24 <a href= \" javascript:selectPrefRows('fcat', false) \" >" . __ ( 'None' ). "</a>" ;
26 print "<div class= \" prefFeedCatHolder \" >" ;
28 print "<form id= \" profile_edit_form \" onsubmit= \" return false \" >" ;
30 print "<table width= \" 100% \" class= \" prefFeedCatList \"
31 cellspacing= \" 0 \" id= \" prefFeedCatList \" >" ;
33 print "<tr class= \" odd \" id= \" FCATR-0 \" >" ;
35 print "<td width='5%' align='center'><input
36 onclick='toggleSelectPrefRow(this, \" fcat \" );'
37 type= \" checkbox \" id= \" FCCHK-0 \" ></td>" ;
39 print "<td><span id= \" FCATT-0 \" >" .
40 __ ( "Default profile" ) . "</span></td>" ;
46 while ( $line = db_fetch_assoc ( $result )) {
48 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
50 $cat_id = $line [ "id" ];
51 $this_row_id = "id= \" FCATR- $cat_id\" " ;
53 print "<tr class= \" $class\" $this_row_id >" ;
55 $edit_title = htmlspecialchars ( $line [ "title" ]);
57 print "<td width='5%' align='center'><input
58 onclick='toggleSelectPrefRow(this, \" fcat \" );'
59 type= \" checkbox \" id= \" FCCHK- $cat_id\" ></td>" ;
61 if ( $_SESSION [ "profile" ] == $line [ "id" ]) {
62 $is_active = __ ( "(active)" );
67 print "<td><span id= \" FCATT- $cat_id\" >" .
68 $edit_title . "</span> $is_active </td>" ;
79 print "<div class='dlgButtons'>
80 <div style='float : left'>
81 <button onclick= \" return removeSelectedPrefProfiles() \" >" .
82 __ ( 'Remove' ). "</button>
83 <input class= \" button \"
84 type= \" submit \" onclick= \" return activatePrefProfile() \"
85 value= \" " . __ ( 'Activate' ). " \" >
88 print "<input class= \" button \"
89 type= \" submit \" onclick= \" return closeInfoBox() \"
90 value= \" " . __ ( 'Close this window' ). " \" >" ;
97 if ( $id == "pubUrl" ) {
99 print "<div id= \" infoBoxTitle \" >" . __ ( 'Published Articles' ). "</div>" ;
100 print "<div class= \" infoBoxContents \" >" ;
102 $url_path = article_publish_url ( $link );
104 print __ ( "Your Published articles feed URL is:" );
106 print "<div class= \" tagCloudContainer \" >" ;
107 print "<a id='pub_feed_url' href=' $url_path ' target='_blank'> $url_path </a>" ;
110 print "<div align='center'>" ;
112 print "<button onclick= \" return pubRegenKey() \" >" .
113 __ ( 'Generate new URL' ). "</button> " ;
115 print "<input class= \" button \"
116 type= \" submit \" onclick= \" return closeInfoBox() \"
117 value= \" " . __ ( 'Close this window' ). " \" >" ;
119 print "</div></div>" ;
124 if ( $id == "explainError" ) {
126 print "<div id= \" infoBoxTitle \" >" . __ ( 'Notice' ). "</div>" ;
127 print "<div class= \" infoBoxContents \" >" ;
129 print "<div class= \" errorExplained \" >" ;
132 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." );
134 $stamp = ( int ) read_stampfile ( "update_daemon.stamp" );
136 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
141 $msg = check_for_update ( $link );
144 print __ ( "You are running the latest version of Tiny Tiny RSS. The fact that you are seeing this dialog is probably a bug." );
152 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." );
154 $stamp = ( int ) read_stampfile ( "update_daemon.stamp" );
156 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
162 print "<div align='center'>" ;
164 print "<input class= \" button \"
165 type= \" submit \" onclick= \" return visitOfficialSite() \"
166 value= \" " . __ ( 'Visit official site' ). " \" > " ;
168 print "<input class= \" button \"
169 type= \" submit \" onclick= \" return closeInfoBox() \"
170 value= \" " . __ ( 'Close this window' ). " \" >" ;
172 print "</div></div>" ;
177 if ( $id == "quickAddFeed" ) {
179 print "<div id= \" infoBoxTitle \" >" . __ ( 'Subscribe to Feed' ). "</div>" ;
180 print "<div class= \" infoBoxContents \" >" ;
182 print "<form id='feed_add_form' onsubmit='return false'>" ;
184 print "<input type= \" hidden \" name= \" op \" value= \" rpc \" >" ;
185 print "<input type= \" hidden \" name= \" subop \" value= \" addfeed \" >" ;
186 //print "<input type=\"hidden\" name=\"from\" value=\"tt-rss\">";
188 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
189 print "<div class= \" dlgSecCont \" >" ;
191 print __ ( "URL:" ) . " " ;
193 print "<input size= \" 40 \"
194 onkeypress= \" return filterCR(event, subscribeToFeed) \"
195 name= \" feed \" id= \" feed_url \" ></td></tr>" ;
199 if ( get_pref ( $link , 'ENABLE_FEED_CATS' )) {
200 print __ ( 'Place in category:' ) . " " ;
201 print_feed_cat_select ( $link , "cat" );
206 print "<div id='fadd_login_container' style='display:none'>
208 <div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>
209 <div class= \" dlgSecCont \" >" .
211 __ ( 'Login:' ) . " <input name='login' size= \" 20 \"
212 onkeypress= \" return filterCR(event, subscribeToFeed) \" > " .
213 __ ( 'Password:' ) . "<input type='password'
214 name='pass' size= \" 20 \"
215 onkeypress= \" return filterCR(event, subscribeToFeed) \" >
219 print "<div style= \" clear : both \" >
220 <input type= \" checkbox \" id= \" fadd_login_check \"
221 onclick='checkboxToggleElement(this, \" fadd_login_container \" )'>
222 <label for= \" fadd_login_check \" >" .
223 __ ( 'This feed requires authentication.' ). "</div>" ;
227 print "<div class= \" dlgButtons \" >
228 <button class= \" button \" id= \" fadd_submit_btn \"
229 onclick= \" return subscribeToFeed() \" >" . __ ( 'Subscribe' ). "</button>
230 <button onclick= \" return browseFeeds() \" >" . __ ( 'More feeds' ). "</button>
231 <button onclick= \" return closeInfoBox() \" >" . __ ( 'Cancel' ). "</button></div>" ;
236 if ( $id == "feedBrowser" ) {
238 print "<div id= \" infoBoxTitle \" >" . __ ( 'Feed Browser' ). "</div>" ;
240 print "<div class= \" infoBoxContents \" >" ;
242 $browser_search = db_escape_string ( $_REQUEST [ "search" ]);
244 print "<form onsubmit='return false;' display='inline'
245 name='feed_browser' id='feed_browser'>" ;
247 print "<input type= \" hidden \" name= \" op \" value= \" rpc \" >" ;
248 print "<input type= \" hidden \" name= \" subop \" value= \" updateFeedBrowser \" >" ;
251 <div style='float : right'>
252 <img style='display : none'
253 id='feed_browser_spinner' src='images/indicator_white.gif'>
254 <input name= \" search \" size= \" 20 \" type= \" search \"
255 onchange= \" javascript:updateFeedBrowser() \" value= \" $browser_search\" >
256 <button onclick= \" javascript:updateFeedBrowser() \" >" . __ ( 'Search' ). "</button>
259 print " <select name= \" mode \" onchange= \" updateFeedBrowser() \" >
260 <option value='1'>" . __ ( 'Popular feeds' ) . "</option>
261 <option value='2'>" . __ ( 'Feed archive' ) . "</option>
266 print " <select name= \" limit \" onchange='updateFeedBrowser()'>" ;
268 foreach ( array ( 25 , 50 , 100 , 200 ) as $l ) {
269 $issel = ( $l == $limit ) ?
"selected" : "" ;
270 print "<option $issel > $l </option>" ;
277 $owner_uid = $_SESSION [ "uid" ];
279 /* print __('Select:')."
280 <a href=\"javascript:selectPrefRows('fbrowse', true)\">".__('All')."</a>,
281 <a href=\"javascript:selectPrefRows('fbrowse', false)\">".__('None')."</a>"; */
283 print "<ul class='browseFeedList' id='browseFeedList'>" ;
284 print_feed_browser ( $link , $search , 25 );
287 print "<div align='center'>
288 <button onclick= \" feedBrowserSubscribe() \" >" . __ ( 'Subscribe' ). "</button>
289 <button style='display : none' id='feed_archive_remove' onclick= \" feedArchiveRemove() \" >" . __ ( 'Remove' ). "</button>
290 <button onclick= \" closeInfoBox() \" >" . __ ( 'Cancel' ). "</button></div>" ;
296 if ( $id == "search" ) {
298 print "<div id= \" infoBoxTitle \" >" . __ ( 'Search' ). "</div>" ;
299 print "<div class= \" infoBoxContents \" >" ;
301 print "<form id='search_form' onsubmit='return false'>" ;
303 #$active_feed_id = db_escape_string($_REQUEST["param"]);
305 $params = split ( ":" , db_escape_string ( $_REQUEST [ "param" ]));
307 $active_feed_id = sprintf ( " %d " , $params [ 0 ]);
308 $is_cat = $params [ 1 ] == "true" ;
310 print "<div class= \" dlgSec \" >" . __ ( 'Look for' ). "</div>" ;
312 print "<div class= \" dlgSecCont \" >" ;
314 print "<input name= \" query \" size= \" 20 \" type= \" search \" value=''>" ;
316 print " " . __ ( 'match on' ). " " ;
318 $search_fields = array (
319 "title" => __ ( "Title" ),
320 "content" => __ ( "Content" ),
321 "both" => __ ( "Title or content" ));
323 print_select_hash ( "match_on" , 3 , $search_fields );
326 print "<br/>" . __ ( 'Limit search to:' ). " " ;
328 print "<select name= \" search_mode \" >
329 <option value= \" all_feeds \" >" . __ ( 'All feeds' ). "</option>" ;
331 $feed_title = getFeedTitle ( $link , $active_feed_id );
334 $feed_cat_title = getFeedCatTitle ( $link , $active_feed_id );
336 $feed_cat_title = getCategoryTitle ( $link , $active_feed_id );
339 if ( $active_feed_id && ! $is_cat ) {
340 print "<option selected value= \" this_feed \" > $feed_title </option>" ;
342 print "<option disabled>" . __ ( 'This feed' ). "</option>" ;
346 $cat_preselected = "selected" ;
349 if ( get_pref ( $link , 'ENABLE_FEED_CATS' ) && ( $active_feed_id > 0 ||
$is_cat )) {
350 print "<option $cat_preselected value= \" this_cat \" > $feed_cat_title </option>" ;
352 //print "<option disabled>".__('This category')."</option>";
361 print "<div class= \" dlgButtons \" >
362 <button onclick= \" javascript:search() \" >" . __ ( 'Search' ). "</button>
363 <button onclick= \" javascript:searchCancel() \" >" . __ ( 'Cancel' ). "</button>
372 if ( $id == "quickAddFilter" ) {
374 $active_feed_id = db_escape_string ( $_REQUEST [ "param" ]);
376 print "<div id= \" infoBoxTitle \" >" . __ ( 'Create Filter' ). "</div>" ;
377 print "<div class= \" infoBoxContents \" >" ;
379 print "<form id= \" filter_add_form \" onsubmit='return false'>" ;
381 print "<input type= \" hidden \" name= \" op \" value= \" pref-filters \" >" ;
382 print "<input type= \" hidden \" name= \" quiet \" value= \" 1 \" >" ;
383 print "<input type= \" hidden \" name= \" subop \" value= \" add \" >" ;
385 $result = db_query ( $link , "SELECT id,description
386 FROM ttrss_filter_types ORDER BY description" );
388 $filter_types = array ();
390 while ( $line = db_fetch_assoc ( $result )) {
391 //array_push($filter_types, $line["description"]);
392 $filter_types [ $line [ "id" ]] = __ ( $line [ "description" ]);
395 print "<div class= \" dlgSec \" >" . __ ( "Match" ). "</div>" ;
397 print "<div class= \" dlgSecCont \" >" ;
399 print "<span id= \" filter_dlg_date_mod_box \" style= \" display : none \" >" ;
400 print __ ( "Date" ) . " " ;
402 $filter_params = array (
403 "before" => __ ( "before" ),
404 "after" => __ ( "after" ));
406 print_select_hash ( "filter_date_modifier" , "before" , $filter_params );
408 print " </span>" ;
410 print "<input onkeypress= \" return filterCR(event, createFilter) \"
411 name= \" reg_exp \" size= \" 30 \" value= \" $reg_exp\" >" ;
413 print "<span id= \" filter_dlg_date_chk_box \" style= \" display : none \" >" ;
414 print " <input class= \" button \"
415 type= \" submit \" onclick= \" return filterDlgCheckDate() \"
416 value= \" " . __ ( 'Check it' ). " \" >" ;
419 print "<br/> " . __ ( "on field" ) . " " ;
420 print_select_hash ( "filter_type" , 1 , $filter_types ,
421 'onchange="filterDlgCheckType(this)"' );
425 print __ ( "in" ) . " " ;
426 print_feed_select ( $link , "feed_id" , $active_feed_id );
430 print "<div class= \" dlgSec \" >" . __ ( "Perform Action" ). "</div>" ;
432 print "<div class= \" dlgSecCont \" >" ;
434 print "<select name= \" action_id \"
435 onchange= \" filterDlgCheckAction(this) \" >" ;
437 $result = db_query ( $link , "SELECT id,description FROM ttrss_filter_actions
440 while ( $line = db_fetch_assoc ( $result )) {
441 printf ( "<option value=' %d '> %s </option>" , $line [ "id" ], __ ( $line [ "description" ]));
446 print "<span id= \" filter_dlg_param_box \" style= \" display : none \" >" ;
447 print " " . __ ( "with parameters:" ) . " " ;
448 print "<input size= \" 20 \"
449 onkeypress= \" return filterCR(event, createFilter) \"
450 name= \" action_param \" >" ;
452 print_label_select ( $link , "action_param_label" , $action_param );
456 print " " ; // tiny layout hack
460 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
461 print "<div class= \" dlgSecCont \" >" ;
463 print "<div style= \" line-height : 100% \" >" ;
465 print "<input type= \" checkbox \" name= \" enabled \" id= \" enabled \" checked= \" 1 \" >
466 <label for= \" enabled \" >" . __ ( 'Enabled' ). "</label><br/>" ;
468 print "<input type= \" checkbox \" name= \" inverse \" id= \" inverse \" >
469 <label for= \" inverse \" >" . __ ( 'Inverse match' ). "</label>" ;
476 print "<div class= \" dlgButtons \" >" ;
478 print "<button onclick= \" return createFilter() \" >" .
479 __ ( 'Create' ). "</button> " ;
481 print "<button onclick= \" return closeInfoBox() \" >" . __ ( 'Cancel' ).
486 // print "</td></tr></table>";
491 if ( $id == "feedUpdateErrors" ) {
493 print "<div id= \" infoBoxTitle \" >" . __ ( 'Update Errors' ). "</div>" ;
494 print "<div class= \" infoBoxContents \" >" ;
496 print __ ( "These feeds have not been updated because of errors:" );
498 $result = db_query ( $link , "SELECT id,title,feed_url,last_error
499 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION [ "uid" ]);
501 print "<ul class='feedErrorsList'>" ;
503 while ( $line = db_fetch_assoc ( $result )) {
504 print "<li><b>" . $line [ "title" ] . "</b> (" . $line [ "feed_url" ] . "): " .
505 "<em>" . $line [ "last_error" ] . "</em>" ;
510 print "<div align='center'>" ;
512 print "<input class= \" button \"
513 type= \" submit \" onclick= \" return closeInfoBox() \"
514 value= \" " . __ ( 'Close' ). " \" >" ;
521 if ( $id == "editArticleTags" ) {
523 print "<div id= \" infoBoxTitle \" >" . __ ( 'Edit Tags' ). "</div>" ;
524 print "<div class= \" infoBoxContents \" >" ;
526 print "<form id= \" tag_edit_form \" onsubmit='return false'>" ;
528 print __ ( "Tags for this article (separated by commas):" ). "<br>" ;
530 $tags = get_article_tags ( $link , $param );
532 $tags_str = join ( ", " , $tags );
534 print "<table width='100%'>" ;
536 print "<tr><td colspan='2'><input type= \" hidden \" name= \" id \" value= \" $param\" ></td></tr>" ;
538 print "<tr><td colspan='2'><textarea rows='4' class='iedit' id='tags_str'
539 name='tags_str'> $tags_str </textarea>
540 <div class= \" autocomplete \" id= \" tags_choices \"
541 style= \" display:none \" ></div>
548 print "<div align='right'>" ;
550 print "<button onclick= \" return editTagsSave() \" >" . __ ( 'Save' ). "</button> " ;
551 print "<button onclick= \" return closeInfoBox() \" >" . __ ( 'Cancel' ). "</button>" ;
558 if ( $id == "printTagCloud" ) {
559 print "<div id= \" infoBoxTitle \" >" . __ ( 'Tag Cloud' ). "</div>" ;
560 print "<div class= \" infoBoxContents \" >" ;
562 print __ ( "Showing most popular tags " ). " (<a
563 href='javascript:toggleTags(true)'>" . __ ( 'more tags' ). "</a>):<br/>" ;
565 print "<div class= \" tagCloudContainer \" >" ;
567 printTagCloud ( $link );
571 print "<div align='center'>" ;
572 print "<button onclick= \" return closeInfoBox() \" >" .
573 __ ( 'Close this window' ). "</button>" ;
581 /* if ($id == "offlineDownload") {
582 print "<div id=\"infoBoxTitle\">".__('Download articles')."</div>";
583 print "<div class=\"infoBoxContents\">";
585 print "<form name='download_ops_form' id='download_ops_form'>";
587 print "<div class=\"dlgSec\">".__("Download")."</div>";
589 print "<div class=\"dlgSecCont\">";
597 print_select_hash("amount", 50, $amount);
599 print " " . __("latest articles for offline reading.");
603 print "<input checked='yes' type='checkbox' name='unread_only' id='unread_only'>";
604 print "<label for='unread_only'>".__('Only include unread articles')."</label>";
610 print "<div class=\"dlgButtons\">
611 <input class=\"button\"
612 type=\"submit\" onclick=\"return initiate_offline_download(0, this)\" value=\"".__('Download')."\">
613 <input class=\"button\"
614 type=\"submit\" onclick=\"return closeInfoBox()\"
615 value=\"".__('Cancel')."\"></div>";
623 print "<div id='infoBoxTitle'>Internal Error</div>
624 <div id='infoBoxContents'>
625 <p>Unknown dialog <b> $id </b></p>