]>
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 if (! $_SESSION [ "profile" ]) {
40 $is_active = __ ( "(active)" );
45 print "<td><span id= \" FCATT-0 \" >" .
46 __ ( "Default profile" ) . " $is_active </span></td>" ;
52 while ( $line = db_fetch_assoc ( $result )) {
54 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
56 $cat_id = $line [ "id" ];
57 $this_row_id = "id= \" FCATR- $cat_id\" " ;
59 print "<tr class= \" $class\" $this_row_id >" ;
61 $edit_title = htmlspecialchars ( $line [ "title" ]);
63 print "<td width='5%' align='center'><input
64 onclick='toggleSelectPrefRow(this, \" fcat \" );'
65 type= \" checkbox \" id= \" FCCHK- $cat_id\" ></td>" ;
67 if ( $_SESSION [ "profile" ] == $line [ "id" ]) {
68 $is_active = __ ( "(active)" );
73 print "<td><span id= \" FCATT- $cat_id\" >" .
74 $edit_title . "</span> $is_active </td>" ;
85 print "<div class='dlgButtons'>
86 <div style='float : left'>
87 <button onclick= \" return removeSelectedPrefProfiles() \" >" .
88 __ ( 'Remove' ). "</button>
89 <input class= \" button \"
90 type= \" submit \" onclick= \" return activatePrefProfile() \"
91 value= \" " . __ ( 'Activate' ). " \" >
94 print "<input class= \" button \"
95 type= \" submit \" onclick= \" return closeInfoBox() \"
96 value= \" " . __ ( 'Close this window' ). " \" >" ;
103 if ( $id == "pubUrl" ) {
105 print "<div id= \" infoBoxTitle \" >" . __ ( 'Published Articles' ). "</div>" ;
106 print "<div class= \" infoBoxContents \" >" ;
108 $url_path = article_publish_url ( $link );
110 print __ ( "Your Published articles feed URL is:" );
112 print "<div class= \" tagCloudContainer \" >" ;
113 print "<a id='pub_feed_url' href=' $url_path ' target='_blank'> $url_path </a>" ;
116 print "<div align='center'>" ;
118 print "<button onclick= \" return pubRegenKey() \" >" .
119 __ ( 'Generate new URL' ). "</button> " ;
121 print "<input class= \" button \"
122 type= \" submit \" onclick= \" return closeInfoBox() \"
123 value= \" " . __ ( 'Close this window' ). " \" >" ;
125 print "</div></div>" ;
130 if ( $id == "explainError" ) {
132 print "<div id= \" infoBoxTitle \" >" . __ ( 'Notice' ). "</div>" ;
133 print "<div class= \" infoBoxContents \" >" ;
135 print "<div class= \" errorExplained \" >" ;
138 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." );
140 $stamp = ( int ) read_stampfile ( "update_daemon.stamp" );
142 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
147 $msg = check_for_update ( $link );
150 print __ ( "You are running the latest version of Tiny Tiny RSS. The fact that you are seeing this dialog is probably a bug." );
158 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." );
160 $stamp = ( int ) read_stampfile ( "update_daemon.stamp" );
162 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
168 print "<div align='center'>" ;
170 print "<input class= \" button \"
171 type= \" submit \" onclick= \" return visitOfficialSite() \"
172 value= \" " . __ ( 'Visit official site' ). " \" > " ;
174 print "<input class= \" button \"
175 type= \" submit \" onclick= \" return closeInfoBox() \"
176 value= \" " . __ ( 'Close this window' ). " \" >" ;
178 print "</div></div>" ;
183 if ( $id == "quickAddFeed" ) {
185 print "<div id= \" infoBoxTitle \" >" . __ ( 'Subscribe to Feed' ). "</div>" ;
186 print "<div class= \" infoBoxContents \" >" ;
188 print "<form id='feed_add_form' onsubmit='return false'>" ;
190 print "<input type= \" hidden \" name= \" op \" value= \" rpc \" >" ;
191 print "<input type= \" hidden \" name= \" subop \" value= \" addfeed \" >" ;
192 //print "<input type=\"hidden\" name=\"from\" value=\"tt-rss\">";
194 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
195 print "<div class= \" dlgSecCont \" >" ;
197 print __ ( "URL:" ) . " " ;
199 print "<input size= \" 40 \"
200 onkeypress= \" return filterCR(event, subscribeToFeed) \"
201 name= \" feed \" id= \" feed_url \" ></td></tr>" ;
205 if ( get_pref ( $link , 'ENABLE_FEED_CATS' )) {
206 print __ ( 'Place in category:' ) . " " ;
207 print_feed_cat_select ( $link , "cat" );
212 print "<div id='fadd_login_container' style='display:none'>
214 <div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>
215 <div class= \" dlgSecCont \" >" .
217 __ ( 'Login:' ) . " <input name='login' size= \" 20 \"
218 onkeypress= \" return filterCR(event, subscribeToFeed) \" > " .
219 __ ( 'Password:' ) . "<input type='password'
220 name='pass' size= \" 20 \"
221 onkeypress= \" return filterCR(event, subscribeToFeed) \" >
225 print "<div style= \" clear : both \" >
226 <input type= \" checkbox \" id= \" fadd_login_check \"
227 onclick='checkboxToggleElement(this, \" fadd_login_container \" )'>
228 <label for= \" fadd_login_check \" >" .
229 __ ( 'This feed requires authentication.' ). "</div>" ;
233 print "<div class= \" dlgButtons \" >
234 <button class= \" button \" id= \" fadd_submit_btn \"
235 onclick= \" return subscribeToFeed() \" >" . __ ( 'Subscribe' ). "</button>
236 <button onclick= \" return browseFeeds() \" >" . __ ( 'More feeds' ). "</button>
237 <button onclick= \" return closeInfoBox() \" >" . __ ( 'Cancel' ). "</button></div>" ;
242 if ( $id == "feedBrowser" ) {
244 print "<div id= \" infoBoxTitle \" >" . __ ( 'Feed Browser' ). "</div>" ;
246 print "<div class= \" infoBoxContents \" >" ;
248 $browser_search = db_escape_string ( $_REQUEST [ "search" ]);
250 print "<form onsubmit='return false;' display='inline'
251 name='feed_browser' id='feed_browser'>" ;
253 print "<input type= \" hidden \" name= \" op \" value= \" rpc \" >" ;
254 print "<input type= \" hidden \" name= \" subop \" value= \" updateFeedBrowser \" >" ;
257 <div style='float : right'>
258 <img style='display : none'
259 id='feed_browser_spinner' src='images/indicator_white.gif'>
260 <input name= \" search \" size= \" 20 \" type= \" search \"
261 onchange= \" javascript:updateFeedBrowser() \" value= \" $browser_search\" >
262 <button onclick= \" javascript:updateFeedBrowser() \" >" . __ ( 'Search' ). "</button>
265 print " <select name= \" mode \" onchange= \" updateFeedBrowser() \" >
266 <option value='1'>" . __ ( 'Popular feeds' ) . "</option>
267 <option value='2'>" . __ ( 'Feed archive' ) . "</option>
272 print " <select name= \" limit \" onchange='updateFeedBrowser()'>" ;
274 foreach ( array ( 25 , 50 , 100 , 200 ) as $l ) {
275 $issel = ( $l == $limit ) ?
"selected" : "" ;
276 print "<option $issel > $l </option>" ;
283 $owner_uid = $_SESSION [ "uid" ];
285 /* print __('Select:')."
286 <a href=\"javascript:selectPrefRows('fbrowse', true)\">".__('All')."</a>,
287 <a href=\"javascript:selectPrefRows('fbrowse', false)\">".__('None')."</a>"; */
289 print "<ul class='browseFeedList' id='browseFeedList'>" ;
290 print_feed_browser ( $link , $search , 25 );
293 print "<div align='center'>
294 <button onclick= \" feedBrowserSubscribe() \" >" . __ ( 'Subscribe' ). "</button>
295 <button style='display : none' id='feed_archive_remove' onclick= \" feedArchiveRemove() \" >" . __ ( 'Remove' ). "</button>
296 <button onclick= \" closeInfoBox() \" >" . __ ( 'Cancel' ). "</button></div>" ;
302 if ( $id == "search" ) {
304 print "<div id= \" infoBoxTitle \" >" . __ ( 'Search' ). "</div>" ;
305 print "<div class= \" infoBoxContents \" >" ;
307 print "<form id='search_form' onsubmit='return false'>" ;
309 #$active_feed_id = db_escape_string($_REQUEST["param"]);
311 $params = split ( ":" , db_escape_string ( $_REQUEST [ "param" ]));
313 $active_feed_id = sprintf ( " %d " , $params [ 0 ]);
314 $is_cat = $params [ 1 ] == "true" ;
316 print "<div class= \" dlgSec \" >" . __ ( 'Look for' ). "</div>" ;
318 print "<div class= \" dlgSecCont \" >" ;
320 print "<input name= \" query \" size= \" 20 \" type= \" search \" value=''>" ;
322 print " " . __ ( 'match on' ). " " ;
324 $search_fields = array (
325 "title" => __ ( "Title" ),
326 "content" => __ ( "Content" ),
327 "both" => __ ( "Title or content" ));
329 print_select_hash ( "match_on" , 3 , $search_fields );
332 print "<br/>" . __ ( 'Limit search to:' ). " " ;
334 print "<select name= \" search_mode \" >
335 <option value= \" all_feeds \" >" . __ ( 'All feeds' ). "</option>" ;
337 $feed_title = getFeedTitle ( $link , $active_feed_id );
340 $feed_cat_title = getFeedCatTitle ( $link , $active_feed_id );
342 $feed_cat_title = getCategoryTitle ( $link , $active_feed_id );
345 if ( $active_feed_id && ! $is_cat ) {
346 print "<option selected value= \" this_feed \" > $feed_title </option>" ;
348 print "<option disabled>" . __ ( 'This feed' ). "</option>" ;
352 $cat_preselected = "selected" ;
355 if ( get_pref ( $link , 'ENABLE_FEED_CATS' ) && ( $active_feed_id > 0 ||
$is_cat )) {
356 print "<option $cat_preselected value= \" this_cat \" > $feed_cat_title </option>" ;
358 //print "<option disabled>".__('This category')."</option>";
367 print "<div class= \" dlgButtons \" >
368 <button onclick= \" javascript:search() \" >" . __ ( 'Search' ). "</button>
369 <button onclick= \" javascript:searchCancel() \" >" . __ ( 'Cancel' ). "</button>
378 if ( $id == "quickAddFilter" ) {
380 $active_feed_id = db_escape_string ( $_REQUEST [ "param" ]);
382 print "<div id= \" infoBoxTitle \" >" . __ ( 'Create Filter' ). "</div>" ;
383 print "<div class= \" infoBoxContents \" >" ;
385 print "<form id= \" filter_add_form \" onsubmit='return false'>" ;
387 print "<input type= \" hidden \" name= \" op \" value= \" pref-filters \" >" ;
388 print "<input type= \" hidden \" name= \" quiet \" value= \" 1 \" >" ;
389 print "<input type= \" hidden \" name= \" subop \" value= \" add \" >" ;
391 $result = db_query ( $link , "SELECT id,description
392 FROM ttrss_filter_types ORDER BY description" );
394 $filter_types = array ();
396 while ( $line = db_fetch_assoc ( $result )) {
397 //array_push($filter_types, $line["description"]);
398 $filter_types [ $line [ "id" ]] = __ ( $line [ "description" ]);
401 print "<div class= \" dlgSec \" >" . __ ( "Match" ). "</div>" ;
403 print "<div class= \" dlgSecCont \" >" ;
405 print "<span id= \" filter_dlg_date_mod_box \" style= \" display : none \" >" ;
406 print __ ( "Date" ) . " " ;
408 $filter_params = array (
409 "before" => __ ( "before" ),
410 "after" => __ ( "after" ));
412 print_select_hash ( "filter_date_modifier" , "before" , $filter_params );
414 print " </span>" ;
416 print "<input onkeypress= \" return filterCR(event, createFilter) \"
417 name= \" reg_exp \" size= \" 30 \" value= \" $reg_exp\" >" ;
419 print "<span id= \" filter_dlg_date_chk_box \" style= \" display : none \" >" ;
420 print " <input class= \" button \"
421 type= \" submit \" onclick= \" return filterDlgCheckDate() \"
422 value= \" " . __ ( 'Check it' ). " \" >" ;
425 print "<br/> " . __ ( "on field" ) . " " ;
426 print_select_hash ( "filter_type" , 1 , $filter_types ,
427 'onchange="filterDlgCheckType(this)"' );
431 print __ ( "in" ) . " " ;
432 print_feed_select ( $link , "feed_id" , $active_feed_id );
436 print "<div class= \" dlgSec \" >" . __ ( "Perform Action" ). "</div>" ;
438 print "<div class= \" dlgSecCont \" >" ;
440 print "<select name= \" action_id \"
441 onchange= \" filterDlgCheckAction(this) \" >" ;
443 $result = db_query ( $link , "SELECT id,description FROM ttrss_filter_actions
446 while ( $line = db_fetch_assoc ( $result )) {
447 printf ( "<option value=' %d '> %s </option>" , $line [ "id" ], __ ( $line [ "description" ]));
452 print "<span id= \" filter_dlg_param_box \" style= \" display : none \" >" ;
453 print " " . __ ( "with parameters:" ) . " " ;
454 print "<input size= \" 20 \"
455 onkeypress= \" return filterCR(event, createFilter) \"
456 name= \" action_param \" >" ;
458 print_label_select ( $link , "action_param_label" , $action_param );
462 print " " ; // tiny layout hack
466 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
467 print "<div class= \" dlgSecCont \" >" ;
469 print "<div style= \" line-height : 100% \" >" ;
471 print "<input type= \" checkbox \" name= \" enabled \" id= \" enabled \" checked= \" 1 \" >
472 <label for= \" enabled \" >" . __ ( 'Enabled' ). "</label><br/>" ;
474 print "<input type= \" checkbox \" name= \" inverse \" id= \" inverse \" >
475 <label for= \" inverse \" >" . __ ( 'Inverse match' ). "</label>" ;
482 print "<div class= \" dlgButtons \" >" ;
484 print "<button onclick= \" return createFilter() \" >" .
485 __ ( 'Create' ). "</button> " ;
487 print "<button onclick= \" return closeInfoBox() \" >" . __ ( 'Cancel' ).
492 // print "</td></tr></table>";
497 if ( $id == "feedUpdateErrors" ) {
499 print "<div id= \" infoBoxTitle \" >" . __ ( 'Update Errors' ). "</div>" ;
500 print "<div class= \" infoBoxContents \" >" ;
502 print __ ( "These feeds have not been updated because of errors:" );
504 $result = db_query ( $link , "SELECT id,title,feed_url,last_error
505 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION [ "uid" ]);
507 print "<ul class='feedErrorsList'>" ;
509 while ( $line = db_fetch_assoc ( $result )) {
510 print "<li><b>" . $line [ "title" ] . "</b> (" . $line [ "feed_url" ] . "): " .
511 "<em>" . $line [ "last_error" ] . "</em>" ;
516 print "<div align='center'>" ;
518 print "<input class= \" button \"
519 type= \" submit \" onclick= \" return closeInfoBox() \"
520 value= \" " . __ ( 'Close' ). " \" >" ;
527 if ( $id == "editArticleTags" ) {
529 print "<div id= \" infoBoxTitle \" >" . __ ( 'Edit Tags' ). "</div>" ;
530 print "<div class= \" infoBoxContents \" >" ;
532 print "<form id= \" tag_edit_form \" onsubmit='return false'>" ;
534 print __ ( "Tags for this article (separated by commas):" ). "<br>" ;
536 $tags = get_article_tags ( $link , $param );
538 $tags_str = join ( ", " , $tags );
540 print "<table width='100%'>" ;
542 print "<tr><td colspan='2'><input type= \" hidden \" name= \" id \" value= \" $param\" ></td></tr>" ;
544 print "<tr><td colspan='2'><textarea rows='4' class='iedit' id='tags_str'
545 name='tags_str'> $tags_str </textarea>
546 <div class= \" autocomplete \" id= \" tags_choices \"
547 style= \" display:none \" ></div>
554 print "<div align='right'>" ;
556 print "<button onclick= \" return editTagsSave() \" >" . __ ( 'Save' ). "</button> " ;
557 print "<button onclick= \" return closeInfoBox() \" >" . __ ( 'Cancel' ). "</button>" ;
564 if ( $id == "printTagCloud" ) {
565 print "<div id= \" infoBoxTitle \" >" . __ ( 'Tag Cloud' ). "</div>" ;
566 print "<div class= \" infoBoxContents \" >" ;
568 print __ ( "Showing most popular tags " ). " (<a
569 href='javascript:toggleTags(true)'>" . __ ( 'more tags' ). "</a>):<br/>" ;
571 print "<div class= \" tagCloudContainer \" >" ;
573 printTagCloud ( $link );
577 print "<div align='center'>" ;
578 print "<button onclick= \" return closeInfoBox() \" >" .
579 __ ( 'Close this window' ). "</button>" ;
587 /* if ($id == "offlineDownload") {
588 print "<div id=\"infoBoxTitle\">".__('Download articles')."</div>";
589 print "<div class=\"infoBoxContents\">";
591 print "<form name='download_ops_form' id='download_ops_form'>";
593 print "<div class=\"dlgSec\">".__("Download")."</div>";
595 print "<div class=\"dlgSecCont\">";
603 print_select_hash("amount", 50, $amount);
605 print " " . __("latest articles for offline reading.");
609 print "<input checked='yes' type='checkbox' name='unread_only' id='unread_only'>";
610 print "<label for='unread_only'>".__('Only include unread articles')."</label>";
616 print "<div class=\"dlgButtons\">
617 <input class=\"button\"
618 type=\"submit\" onclick=\"return initiate_offline_download(0, this)\" value=\"".__('Download')."\">
619 <input class=\"button\"
620 type=\"submit\" onclick=\"return closeInfoBox()\"
621 value=\"".__('Cancel')."\"></div>";
629 print "<div id='infoBoxTitle'>Internal Error</div>
630 <div id='infoBoxContents'>
631 <p>Unknown dialog <b> $id </b></p>