]>
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 == "importOpml" ) {
7 print "<div id= \" infoBoxTitle \" >" . __ ( 'OPML Import' ). "</div>" ;
8 print "<div class= \" infoBoxContents \" >" ;
10 print "<div class= \" prefFeedCatHolder \" >" ;
12 $owner_uid = $_SESSION [ "uid" ];
14 db_query ( $link , "BEGIN" );
16 /* create Imported feeds category just in case */
18 $result = db_query ( $link , "SELECT id FROM
19 ttrss_feed_categories WHERE title = 'Imported feeds' AND
20 owner_uid = ' $owner_uid ' LIMIT 1" );
22 if ( db_num_rows ( $result ) == 0 ) {
23 db_query ( $link , "INSERT INTO ttrss_feed_categories
25 VALUES ('Imported feeds', ' $owner_uid ')" );
28 db_query ( $link , "COMMIT" );
30 /* Handle OPML import by DOMXML/DOMDocument */
32 if ( function_exists ( 'domxml_open_file' )) {
33 print "<ul class='nomarks'>" ;
34 print "<li>" . __ ( "Importing using DOMXML." ). "</li>" ;
35 require_once "opml_domxml.php" ;
36 opml_import_domxml ( $link , $owner_uid );
38 } else if ( PHP_VERSION
>= 5 ) {
39 print "<ul class='nomarks'>" ;
40 print "<li>" . __ ( "Importing using DOMDocument." ). "</li>" ;
41 require_once "opml_domdoc.php" ;
42 opml_import_domdoc ( $link , $owner_uid );
45 print_error ( __ ( "DOMXML extension is not found. It is required for PHP versions below 5." ));
50 print "<div align='center'>" ;
52 print "<button onclick= \" return opmlImportDone() \" >" .
53 __ ( 'Close this window' ). "</button>" ;
57 print "<script type= \" text/javascript \" >" ;
58 print "parent.opmlImportHandler(this)" ;
66 if ( $id == "editPrefProfiles" ) {
68 print "<div id= \" infoBoxTitle \" >" . __ ( 'Settings Profiles' ). "</div>" ;
69 print "<div class= \" infoBoxContents \" >" ;
71 print "<div><input id= \" fadd_profile \"
72 onkeypress= \" return filterCR(event, addPrefProfile) \"
74 <button onclick= \" javascript:addPrefProfile() \" >" .
75 __ ( 'Create profile' ). "</button></div>" ;
79 $result = db_query ( $link , "SELECT title,id FROM ttrss_settings_profiles
80 WHERE owner_uid = " . $_SESSION [ "uid" ]. " ORDER BY title" );
83 <a href= \" javascript:selectPrefRows('fcat', true) \" >" . __ ( 'All' ). "</a>,
84 <a href= \" javascript:selectPrefRows('fcat', false) \" >" . __ ( 'None' ). "</a>" ;
86 print "<div class= \" prefFeedCatHolder \" >" ;
88 print "<form id= \" profile_edit_form \" onsubmit= \" return false \" >" ;
90 print "<table width= \" 100% \" class= \" prefFeedCatList \"
91 cellspacing= \" 0 \" id= \" prefFeedCatList \" >" ;
93 print "<tr class= \" odd \" id= \" FCATR-0 \" >" ;
95 print "<td width='5%' align='center'><input
96 onclick='toggleSelectPrefRow(this, \" fcat \" );'
97 type= \" checkbox \" id= \" FCCHK-0 \" ></td>" ;
99 if (! $_SESSION [ "profile" ]) {
100 $is_active = __ ( "(active)" );
105 print "<td><span id= \" FCATT-0 \" >" .
106 __ ( "Default profile" ) . " $is_active </span></td>" ;
112 while ( $line = db_fetch_assoc ( $result )) {
114 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
116 $cat_id = $line [ "id" ];
117 $this_row_id = "id= \" FCATR- $cat_id\" " ;
119 print "<tr class= \" $class\" $this_row_id >" ;
121 $edit_title = htmlspecialchars ( $line [ "title" ]);
123 print "<td width='5%' align='center'><input
124 onclick='toggleSelectPrefRow(this, \" fcat \" );'
125 type= \" checkbox \" id= \" FCCHK- $cat_id\" ></td>" ;
127 if ( $_SESSION [ "profile" ] == $line [ "id" ]) {
128 $is_active = __ ( "(active)" );
133 print "<td><span id= \" FCATT- $cat_id\" >" .
134 $edit_title . "</span> $is_active </td>" ;
145 print "<div class='dlgButtons'>
146 <div style='float : left'>
147 <button onclick= \" return removeSelectedPrefProfiles() \" >" .
148 __ ( 'Remove' ). "</button>
149 <button onclick= \" return activatePrefProfile() \" >" .
150 __ ( 'Activate' ). "</button>
153 print "<button onclick= \" return closeInfoBox() \" >" .
154 __ ( 'Close this window' ). "</button>" ;
156 print "</div></div>" ;
161 if ( $id == "pubUrl" ) {
163 print "<div id= \" infoBoxTitle \" >" . __ ( 'Published Articles' ). "</div>" ;
164 print "<div class= \" infoBoxContents \" >" ;
166 $url_path = article_publish_url ( $link );
168 print __ ( "Your Published articles feed URL is:" );
170 print "<div class= \" tagCloudContainer \" >" ;
171 print "<a id='pub_feed_url' href=' $url_path ' target='_blank'> $url_path </a>" ;
174 print "<div align='center'>" ;
176 print "<button onclick= \" return pubRegenKey() \" >" .
177 __ ( 'Generate new URL' ). "</button> " ;
179 print "<input class= \" button \"
180 type= \" submit \" onclick= \" return closeInfoBox() \"
181 value= \" " . __ ( 'Close this window' ). " \" >" ;
183 print "</div></div>" ;
188 if ( $id == "pubOPMLUrl" ) {
190 print "<div id= \" infoBoxTitle \" >" . __ ( 'Public OPML URL' ). "</div>" ;
191 print "<div class= \" infoBoxContents \" >" ;
193 $url_path = opml_publish_url ( $link );
195 print __ ( "Your Public OPML URL is:" );
197 print "<div class= \" tagCloudContainer \" >" ;
198 print "<a id='pub_opml_url' href=' $url_path ' target='_blank'> $url_path </a>" ;
201 print "<div align='center'>" ;
203 print "<button onclick= \" return opmlRegenKey() \" >" .
204 __ ( 'Generate new URL' ). "</button> " ;
206 print "<input class= \" button \"
207 type= \" submit \" onclick= \" return closeInfoBox() \"
208 value= \" " . __ ( 'Close this window' ). " \" >" ;
210 print "</div></div>" ;
215 if ( $id == "explainError" ) {
217 print "<div id= \" infoBoxTitle \" >" . __ ( 'Notice' ). "</div>" ;
218 print "<div class= \" infoBoxContents \" >" ;
220 print "<div class= \" errorExplained \" >" ;
223 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." );
225 $stamp = ( int ) read_stampfile ( "update_daemon.stamp" );
227 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
232 $msg = check_for_update ( $link );
235 print __ ( "You are running the latest version of Tiny Tiny RSS. The fact that you are seeing this dialog is probably a bug." );
243 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." );
245 $stamp = ( int ) read_stampfile ( "update_daemon.stamp" );
247 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
253 print "<div align='center'>" ;
255 print "<input class= \" button \"
256 type= \" submit \" onclick= \" return closeInfoBox() \"
257 value= \" " . __ ( 'Close this window' ). " \" >" ;
259 print "</div></div>" ;
264 if ( $id == "quickAddFeed" ) {
266 print "<div id= \" infoBoxTitle \" >" . __ ( 'Subscribe to Feed' ). "</div>" ;
267 print "<div class= \" infoBoxContents \" >" ;
269 print "<form id='feed_add_form' onsubmit='return false'>" ;
271 print "<input type= \" hidden \" name= \" op \" value= \" rpc \" >" ;
272 print "<input type= \" hidden \" name= \" subop \" value= \" addfeed \" >" ;
273 //print "<input type=\"hidden\" name=\"from\" value=\"tt-rss\">";
275 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
276 print "<div class= \" dlgSecCont \" >" ;
278 print __ ( "URL:" ) . " " ;
280 print "<input size= \" 40 \"
281 onkeypress= \" return filterCR(event, subscribeToFeed) \"
282 name= \" feed \" id= \" feed_url \" ></td></tr>" ;
286 if ( get_pref ( $link , 'ENABLE_FEED_CATS' )) {
287 print __ ( 'Place in category:' ) . " " ;
288 print_feed_cat_select ( $link , "cat" );
293 print "<div id='fadd_login_container' style='display:none'>
295 <div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>
296 <div class= \" dlgSecCont \" >" .
298 __ ( 'Login:' ) . " <input name='login' size= \" 20 \"
299 onkeypress= \" return filterCR(event, subscribeToFeed) \" > " .
300 __ ( 'Password:' ) . "<input type='password'
301 name='pass' size= \" 20 \"
302 onkeypress= \" return filterCR(event, subscribeToFeed) \" >
306 print "<div style= \" clear : both \" >
307 <input type= \" checkbox \" id= \" fadd_login_check \"
308 onclick='checkboxToggleElement(this, \" fadd_login_container \" )'>
309 <label for= \" fadd_login_check \" >" .
310 __ ( 'This feed requires authentication.' ). "</div>" ;
314 print "<div class= \" dlgButtons \" >
315 <button class= \" button \" id= \" fadd_submit_btn \"
316 onclick= \" return subscribeToFeed() \" >" . __ ( 'Subscribe' ). "</button>
317 <button onclick= \" return displayDlg('feedBrowser') \" >" . __ ( 'More feeds' ). "</button>
318 <button onclick= \" return closeInfoBox() \" >" . __ ( 'Cancel' ). "</button></div>" ;
323 if ( $id == "feedBrowser" ) {
325 print "<div id= \" infoBoxTitle \" >" . __ ( 'Feed Browser' ). "</div>" ;
327 print "<div class= \" infoBoxContents \" >" ;
329 $browser_search = db_escape_string ( $_REQUEST [ "search" ]);
331 print "<form onsubmit='return false;' display='inline'
332 name='feed_browser' id='feed_browser'>" ;
334 print "<input type= \" hidden \" name= \" op \" value= \" rpc \" >" ;
335 print "<input type= \" hidden \" name= \" subop \" value= \" updateFeedBrowser \" >" ;
338 <div style='float : right'>
339 <img style='display : none'
340 id='feed_browser_spinner' src='" .
341 theme_image ( $link , 'images/indicator_white.gif' ). "'>
342 <input name= \" search \" size= \" 20 \" type= \" search \"
343 onchange= \" javascript:updateFeedBrowser() \" value= \" $browser_search\" >
344 <button onclick= \" javascript:updateFeedBrowser() \" >" . __ ( 'Search' ). "</button>
347 print " <select name= \" mode \" onchange= \" updateFeedBrowser() \" >
348 <option value='1'>" . __ ( 'Popular feeds' ) . "</option>
349 <option value='2'>" . __ ( 'Feed archive' ) . "</option>
354 print " <select name= \" limit \" onchange='updateFeedBrowser()'>" ;
356 foreach ( array ( 25 , 50 , 100 , 200 ) as $l ) {
357 $issel = ( $l == $limit ) ?
"selected" : "" ;
358 print "<option $issel > $l </option>" ;
365 $owner_uid = $_SESSION [ "uid" ];
367 /* print __('Select:')."
368 <a href=\"javascript:selectPrefRows('fbrowse', true)\">".__('All')."</a>,
369 <a href=\"javascript:selectPrefRows('fbrowse', false)\">".__('None')."</a>"; */
371 print "<ul class='browseFeedList' id='browseFeedList'>" ;
372 print_feed_browser ( $link , $search , 25 );
375 print "<div align='center'>
376 <button onclick= \" feedBrowserSubscribe() \" >" . __ ( 'Subscribe' ). "</button>
377 <button style='display : none' id='feed_archive_remove' onclick= \" feedArchiveRemove() \" >" . __ ( 'Remove' ). "</button>
378 <button onclick= \" closeInfoBox() \" >" . __ ( 'Cancel' ). "</button></div>" ;
384 if ( $id == "search" ) {
386 print "<div id= \" infoBoxTitle \" >" . __ ( 'Search' ). "</div>" ;
387 print "<div class= \" infoBoxContents \" >" ;
389 print "<form id='search_form' onsubmit='return false'>" ;
391 #$active_feed_id = db_escape_string($_REQUEST["param"]);
393 $params = split ( ":" , db_escape_string ( $_REQUEST [ "param" ]));
395 $active_feed_id = sprintf ( " %d " , $params [ 0 ]);
396 $is_cat = $params [ 1 ] == "true" ;
398 print "<div class= \" dlgSec \" >" . __ ( 'Look for' ). "</div>" ;
400 print "<div class= \" dlgSecCont \" >" ;
402 print "<input onkeypress= \" return filterCR(event, search) \"
403 name= \" query \" size= \" 20 \" type= \" search \" value=''>" ;
405 print " " . __ ( 'match on' ). " " ;
407 $search_fields = array (
408 "title" => __ ( "Title" ),
409 "content" => __ ( "Content" ),
410 "both" => __ ( "Title or content" ));
412 print_select_hash ( "match_on" , 3 , $search_fields );
415 print "<br/>" . __ ( 'Limit search to:' ). " " ;
417 print "<select name= \" search_mode \" >
418 <option value= \" all_feeds \" >" . __ ( 'All feeds' ). "</option>" ;
420 $feed_title = getFeedTitle ( $link , $active_feed_id );
423 $feed_cat_title = getFeedCatTitle ( $link , $active_feed_id );
425 $feed_cat_title = getCategoryTitle ( $link , $active_feed_id );
428 if ( $active_feed_id && ! $is_cat ) {
429 print "<option selected value= \" this_feed \" > $feed_title </option>" ;
431 print "<option disabled>" . __ ( 'This feed' ). "</option>" ;
435 $cat_preselected = "selected" ;
438 if ( get_pref ( $link , 'ENABLE_FEED_CATS' ) && ( $active_feed_id > 0 ||
$is_cat )) {
439 print "<option $cat_preselected value= \" this_cat \" > $feed_cat_title </option>" ;
441 //print "<option disabled>".__('This category')."</option>";
450 print "<div class= \" dlgButtons \" >
451 <button onclick= \" javascript:search() \" >" . __ ( 'Search' ). "</button>
452 <button onclick= \" javascript:closeInfoBox(true) \" >" . __ ( 'Cancel' ). "</button>
461 if ( $id == "quickAddFilter" ) {
463 $active_feed_id = db_escape_string ( $_REQUEST [ "param" ]);
465 print "<div id= \" infoBoxTitle \" >" . __ ( 'Create Filter' ). "</div>" ;
466 print "<div class= \" infoBoxContents \" >" ;
468 print "<form id= \" filter_add_form \" onsubmit='return false'>" ;
470 print "<input type= \" hidden \" name= \" op \" value= \" pref-filters \" >" ;
471 print "<input type= \" hidden \" name= \" quiet \" value= \" 1 \" >" ;
472 print "<input type= \" hidden \" name= \" subop \" value= \" add \" >" ;
474 $result = db_query ( $link , "SELECT id,description
475 FROM ttrss_filter_types ORDER BY description" );
477 $filter_types = array ();
479 while ( $line = db_fetch_assoc ( $result )) {
480 //array_push($filter_types, $line["description"]);
481 $filter_types [ $line [ "id" ]] = __ ( $line [ "description" ]);
484 print "<div class= \" dlgSec \" >" . __ ( "Match" ). "</div>" ;
486 print "<div class= \" dlgSecCont \" >" ;
488 print "<span id= \" filter_dlg_date_mod_box \" style= \" display : none \" >" ;
489 print __ ( "Date" ) . " " ;
491 $filter_params = array (
492 "before" => __ ( "before" ),
493 "after" => __ ( "after" ));
495 print_select_hash ( "filter_date_modifier" , "before" , $filter_params );
497 print " </span>" ;
499 print "<input onkeypress= \" return filterCR(event, createFilter) \"
500 name= \" reg_exp \" size= \" 30 \" value= \" $reg_exp\" >" ;
502 print "<span id= \" filter_dlg_date_chk_box \" style= \" display : none \" >" ;
503 print " <input class= \" button \"
504 type= \" submit \" onclick= \" return filterDlgCheckDate() \"
505 value= \" " . __ ( 'Check it' ). " \" >" ;
508 print "<br/> " . __ ( "on field" ) . " " ;
509 print_select_hash ( "filter_type" , 1 , $filter_types ,
510 'onchange="filterDlgCheckType(this)"' );
514 print __ ( "in" ) . " " ;
515 print_feed_select ( $link , "feed_id" , $active_feed_id );
519 print "<div class= \" dlgSec \" >" . __ ( "Perform Action" ). "</div>" ;
521 print "<div class= \" dlgSecCont \" >" ;
523 print "<select name= \" action_id \"
524 onchange= \" filterDlgCheckAction(this) \" >" ;
526 $result = db_query ( $link , "SELECT id,description FROM ttrss_filter_actions
529 while ( $line = db_fetch_assoc ( $result )) {
530 printf ( "<option value=' %d '> %s </option>" , $line [ "id" ], __ ( $line [ "description" ]));
535 print "<span id= \" filter_dlg_param_box \" style= \" display : none \" >" ;
536 print " " . __ ( "with parameters:" ) . " " ;
537 print "<input size= \" 20 \"
538 onkeypress= \" return filterCR(event, createFilter) \"
539 name= \" action_param \" >" ;
541 print_label_select ( $link , "action_param_label" , $action_param );
545 print " " ; // tiny layout hack
549 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
550 print "<div class= \" dlgSecCont \" >" ;
552 print "<div style= \" line-height : 100% \" >" ;
554 print "<input type= \" checkbox \" name= \" enabled \" id= \" enabled \" checked= \" 1 \" >
555 <label for= \" enabled \" >" . __ ( 'Enabled' ). "</label><br/>" ;
557 print "<input type= \" checkbox \" name= \" inverse \" id= \" inverse \" >
558 <label for= \" inverse \" >" . __ ( 'Inverse match' ). "</label>" ;
565 print "<div class= \" dlgButtons \" >" ;
567 print "<button onclick= \" return createFilter() \" >" .
568 __ ( 'Create' ). "</button> " ;
570 print "<button onclick= \" return closeInfoBox() \" >" . __ ( 'Cancel' ).
575 // print "</td></tr></table>";
580 if ( $id == "feedUpdateErrors" ) {
582 print "<div id= \" infoBoxTitle \" >" . __ ( 'Update Errors' ). "</div>" ;
583 print "<div class= \" infoBoxContents \" >" ;
585 print __ ( "These feeds have not been updated because of errors:" );
587 $result = db_query ( $link , "SELECT id,title,feed_url,last_error
588 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION [ "uid" ]);
590 print "<ul class='feedErrorsList'>" ;
592 while ( $line = db_fetch_assoc ( $result )) {
593 print "<li><b>" . $line [ "title" ] . "</b> (" . $line [ "feed_url" ] . "): " .
594 "<em>" . $line [ "last_error" ] . "</em>" ;
599 print "<div align='center'>" ;
601 print "<button onclick= \" return closeInfoBox() \" >" .
602 __ ( 'Close this window' ). "</button>" ;
609 if ( $id == "editArticleTags" ) {
611 print "<div id= \" infoBoxTitle \" >" . __ ( 'Edit Tags' ). "</div>" ;
612 print "<div class= \" infoBoxContents \" >" ;
614 print "<form id= \" tag_edit_form \" onsubmit='return false'>" ;
616 print __ ( "Tags for this article (separated by commas):" ). "<br>" ;
618 $tags = get_article_tags ( $link , $param );
620 $tags_str = join ( ", " , $tags );
622 print "<table width='100%'>" ;
624 print "<tr><td colspan='2'><input type= \" hidden \" name= \" id \" value= \" $param\" ></td></tr>" ;
626 print "<tr><td colspan='2'><textarea rows='4' class='iedit' id='tags_str'
627 name='tags_str'> $tags_str </textarea>
628 <div class= \" autocomplete \" id= \" tags_choices \"
629 style= \" display:none \" ></div>
636 print "<div align='right'>" ;
638 print "<button onclick= \" return editTagsSave() \" >" . __ ( 'Save' ). "</button> " ;
639 print "<button onclick= \" return closeInfoBox() \" >" . __ ( 'Cancel' ). "</button>" ;
646 if ( $id == "printTagCloud" ) {
647 print "<div id= \" infoBoxTitle \" >" . __ ( 'Tag Cloud' ). "</div>" ;
648 print "<div class= \" infoBoxContents \" >" ;
650 print __ ( "Showing most popular tags " ). " (<a
651 href='javascript:toggleTags(true)'>" . __ ( 'more tags' ). "</a>):<br/>" ;
653 print "<div class= \" tagCloudContainer \" >" ;
655 printTagCloud ( $link );
659 print "<div align='center'>" ;
660 print "<button onclick= \" return closeInfoBox() \" >" .
661 __ ( 'Close this window' ). "</button>" ;
669 /* if ($id == "offlineDownload") {
670 print "<div id=\"infoBoxTitle\">".__('Download articles')."</div>";
671 print "<div class=\"infoBoxContents\">";
673 print "<form name='download_ops_form' id='download_ops_form'>";
675 print "<div class=\"dlgSec\">".__("Download")."</div>";
677 print "<div class=\"dlgSecCont\">";
685 print_select_hash("amount", 50, $amount);
687 print " " . __("latest articles for offline reading.");
691 print "<input checked='yes' type='checkbox' name='unread_only' id='unread_only'>";
692 print "<label for='unread_only'>".__('Only include unread articles')."</label>";
698 print "<div class=\"dlgButtons\">
699 <input class=\"button\"
700 type=\"submit\" onclick=\"return initiate_offline_download(0, this)\" value=\"".__('Download')."\">
701 <input class=\"button\"
702 type=\"submit\" onclick=\"return closeInfoBox()\"
703 value=\"".__('Cancel')."\"></div>";
711 print "<div id='infoBoxTitle'>Internal Error</div>
712 <div id='infoBoxContents'>
713 <p>Unknown dialog <b> $id </b></p>