]>
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 "modules/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 "modules/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 <input class= \" button \"
150 type= \" submit \" onclick= \" return activatePrefProfile() \"
151 value= \" " . __ ( 'Activate' ). " \" >
154 print "<input class= \" button \"
155 type= \" submit \" onclick= \" return closeInfoBox() \"
156 value= \" " . __ ( 'Close this window' ). " \" >" ;
158 print "</div></div>" ;
163 if ( $id == "pubUrl" ) {
165 print "<div id= \" infoBoxTitle \" >" . __ ( 'Published Articles' ). "</div>" ;
166 print "<div class= \" infoBoxContents \" >" ;
168 $url_path = article_publish_url ( $link );
170 print __ ( "Your Published articles feed URL is:" );
172 print "<div class= \" tagCloudContainer \" >" ;
173 print "<a id='pub_feed_url' href=' $url_path ' target='_blank'> $url_path </a>" ;
176 print "<div align='center'>" ;
178 print "<button onclick= \" return pubRegenKey() \" >" .
179 __ ( 'Generate new URL' ). "</button> " ;
181 print "<input class= \" button \"
182 type= \" submit \" onclick= \" return closeInfoBox() \"
183 value= \" " . __ ( 'Close this window' ). " \" >" ;
185 print "</div></div>" ;
190 if ( $id == "explainError" ) {
192 print "<div id= \" infoBoxTitle \" >" . __ ( 'Notice' ). "</div>" ;
193 print "<div class= \" infoBoxContents \" >" ;
195 print "<div class= \" errorExplained \" >" ;
198 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." );
200 $stamp = ( int ) read_stampfile ( "update_daemon.stamp" );
202 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
207 $msg = check_for_update ( $link );
210 print __ ( "You are running the latest version of Tiny Tiny RSS. The fact that you are seeing this dialog is probably a bug." );
218 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." );
220 $stamp = ( int ) read_stampfile ( "update_daemon.stamp" );
222 print "<p>" . __ ( "Last update:" ) . " " . date ( "Y.m.d, G:i" , $stamp );
228 print "<div align='center'>" ;
230 print "<input class= \" button \"
231 type= \" submit \" onclick= \" return visitOfficialSite() \"
232 value= \" " . __ ( 'Visit official site' ). " \" > " ;
234 print "<input class= \" button \"
235 type= \" submit \" onclick= \" return closeInfoBox() \"
236 value= \" " . __ ( 'Close this window' ). " \" >" ;
238 print "</div></div>" ;
243 if ( $id == "quickAddFeed" ) {
245 print "<div id= \" infoBoxTitle \" >" . __ ( 'Subscribe to Feed' ). "</div>" ;
246 print "<div class= \" infoBoxContents \" >" ;
248 print "<form id='feed_add_form' onsubmit='return false'>" ;
250 print "<input type= \" hidden \" name= \" op \" value= \" rpc \" >" ;
251 print "<input type= \" hidden \" name= \" subop \" value= \" addfeed \" >" ;
252 //print "<input type=\"hidden\" name=\"from\" value=\"tt-rss\">";
254 print "<div class= \" dlgSec \" >" . __ ( "Feed" ). "</div>" ;
255 print "<div class= \" dlgSecCont \" >" ;
257 print __ ( "URL:" ) . " " ;
259 print "<input size= \" 40 \"
260 onkeypress= \" return filterCR(event, subscribeToFeed) \"
261 name= \" feed \" id= \" feed_url \" ></td></tr>" ;
265 if ( get_pref ( $link , 'ENABLE_FEED_CATS' )) {
266 print __ ( 'Place in category:' ) . " " ;
267 print_feed_cat_select ( $link , "cat" );
272 print "<div id='fadd_login_container' style='display:none'>
274 <div class= \" dlgSec \" >" . __ ( "Authentication" ). "</div>
275 <div class= \" dlgSecCont \" >" .
277 __ ( 'Login:' ) . " <input name='login' size= \" 20 \"
278 onkeypress= \" return filterCR(event, subscribeToFeed) \" > " .
279 __ ( 'Password:' ) . "<input type='password'
280 name='pass' size= \" 20 \"
281 onkeypress= \" return filterCR(event, subscribeToFeed) \" >
285 print "<div style= \" clear : both \" >
286 <input type= \" checkbox \" id= \" fadd_login_check \"
287 onclick='checkboxToggleElement(this, \" fadd_login_container \" )'>
288 <label for= \" fadd_login_check \" >" .
289 __ ( 'This feed requires authentication.' ). "</div>" ;
293 print "<div class= \" dlgButtons \" >
294 <button class= \" button \" id= \" fadd_submit_btn \"
295 onclick= \" return subscribeToFeed() \" >" . __ ( 'Subscribe' ). "</button>
296 <button onclick= \" return browseFeeds() \" >" . __ ( 'More feeds' ). "</button>
297 <button onclick= \" return closeInfoBox() \" >" . __ ( 'Cancel' ). "</button></div>" ;
302 if ( $id == "feedBrowser" ) {
304 print "<div id= \" infoBoxTitle \" >" . __ ( 'Feed Browser' ). "</div>" ;
306 print "<div class= \" infoBoxContents \" >" ;
308 $browser_search = db_escape_string ( $_REQUEST [ "search" ]);
310 print "<form onsubmit='return false;' display='inline'
311 name='feed_browser' id='feed_browser'>" ;
313 print "<input type= \" hidden \" name= \" op \" value= \" rpc \" >" ;
314 print "<input type= \" hidden \" name= \" subop \" value= \" updateFeedBrowser \" >" ;
317 <div style='float : right'>
318 <img style='display : none'
319 id='feed_browser_spinner' src='" .
320 theme_image ( $link , 'images/indicator_white.gif' ). "'>
321 <input name= \" search \" size= \" 20 \" type= \" search \"
322 onchange= \" javascript:updateFeedBrowser() \" value= \" $browser_search\" >
323 <button onclick= \" javascript:updateFeedBrowser() \" >" . __ ( 'Search' ). "</button>
326 print " <select name= \" mode \" onchange= \" updateFeedBrowser() \" >
327 <option value='1'>" . __ ( 'Popular feeds' ) . "</option>
328 <option value='2'>" . __ ( 'Feed archive' ) . "</option>
333 print " <select name= \" limit \" onchange='updateFeedBrowser()'>" ;
335 foreach ( array ( 25 , 50 , 100 , 200 ) as $l ) {
336 $issel = ( $l == $limit ) ?
"selected" : "" ;
337 print "<option $issel > $l </option>" ;
344 $owner_uid = $_SESSION [ "uid" ];
346 /* print __('Select:')."
347 <a href=\"javascript:selectPrefRows('fbrowse', true)\">".__('All')."</a>,
348 <a href=\"javascript:selectPrefRows('fbrowse', false)\">".__('None')."</a>"; */
350 print "<ul class='browseFeedList' id='browseFeedList'>" ;
351 print_feed_browser ( $link , $search , 25 );
354 print "<div align='center'>
355 <button onclick= \" feedBrowserSubscribe() \" >" . __ ( 'Subscribe' ). "</button>
356 <button style='display : none' id='feed_archive_remove' onclick= \" feedArchiveRemove() \" >" . __ ( 'Remove' ). "</button>
357 <button onclick= \" closeInfoBox() \" >" . __ ( 'Cancel' ). "</button></div>" ;
363 if ( $id == "search" ) {
365 print "<div id= \" infoBoxTitle \" >" . __ ( 'Search' ). "</div>" ;
366 print "<div class= \" infoBoxContents \" >" ;
368 print "<form id='search_form' onsubmit='return false'>" ;
370 #$active_feed_id = db_escape_string($_REQUEST["param"]);
372 $params = split ( ":" , db_escape_string ( $_REQUEST [ "param" ]));
374 $active_feed_id = sprintf ( " %d " , $params [ 0 ]);
375 $is_cat = $params [ 1 ] == "true" ;
377 print "<div class= \" dlgSec \" >" . __ ( 'Look for' ). "</div>" ;
379 print "<div class= \" dlgSecCont \" >" ;
381 print "<input name= \" query \" size= \" 20 \" type= \" search \" value=''>" ;
383 print " " . __ ( 'match on' ). " " ;
385 $search_fields = array (
386 "title" => __ ( "Title" ),
387 "content" => __ ( "Content" ),
388 "both" => __ ( "Title or content" ));
390 print_select_hash ( "match_on" , 3 , $search_fields );
393 print "<br/>" . __ ( 'Limit search to:' ). " " ;
395 print "<select name= \" search_mode \" >
396 <option value= \" all_feeds \" >" . __ ( 'All feeds' ). "</option>" ;
398 $feed_title = getFeedTitle ( $link , $active_feed_id );
401 $feed_cat_title = getFeedCatTitle ( $link , $active_feed_id );
403 $feed_cat_title = getCategoryTitle ( $link , $active_feed_id );
406 if ( $active_feed_id && ! $is_cat ) {
407 print "<option selected value= \" this_feed \" > $feed_title </option>" ;
409 print "<option disabled>" . __ ( 'This feed' ). "</option>" ;
413 $cat_preselected = "selected" ;
416 if ( get_pref ( $link , 'ENABLE_FEED_CATS' ) && ( $active_feed_id > 0 ||
$is_cat )) {
417 print "<option $cat_preselected value= \" this_cat \" > $feed_cat_title </option>" ;
419 //print "<option disabled>".__('This category')."</option>";
428 print "<div class= \" dlgButtons \" >
429 <button onclick= \" javascript:search() \" >" . __ ( 'Search' ). "</button>
430 <button onclick= \" javascript:searchCancel() \" >" . __ ( 'Cancel' ). "</button>
439 if ( $id == "quickAddFilter" ) {
441 $active_feed_id = db_escape_string ( $_REQUEST [ "param" ]);
443 print "<div id= \" infoBoxTitle \" >" . __ ( 'Create Filter' ). "</div>" ;
444 print "<div class= \" infoBoxContents \" >" ;
446 print "<form id= \" filter_add_form \" onsubmit='return false'>" ;
448 print "<input type= \" hidden \" name= \" op \" value= \" pref-filters \" >" ;
449 print "<input type= \" hidden \" name= \" quiet \" value= \" 1 \" >" ;
450 print "<input type= \" hidden \" name= \" subop \" value= \" add \" >" ;
452 $result = db_query ( $link , "SELECT id,description
453 FROM ttrss_filter_types ORDER BY description" );
455 $filter_types = array ();
457 while ( $line = db_fetch_assoc ( $result )) {
458 //array_push($filter_types, $line["description"]);
459 $filter_types [ $line [ "id" ]] = __ ( $line [ "description" ]);
462 print "<div class= \" dlgSec \" >" . __ ( "Match" ). "</div>" ;
464 print "<div class= \" dlgSecCont \" >" ;
466 print "<span id= \" filter_dlg_date_mod_box \" style= \" display : none \" >" ;
467 print __ ( "Date" ) . " " ;
469 $filter_params = array (
470 "before" => __ ( "before" ),
471 "after" => __ ( "after" ));
473 print_select_hash ( "filter_date_modifier" , "before" , $filter_params );
475 print " </span>" ;
477 print "<input onkeypress= \" return filterCR(event, createFilter) \"
478 name= \" reg_exp \" size= \" 30 \" value= \" $reg_exp\" >" ;
480 print "<span id= \" filter_dlg_date_chk_box \" style= \" display : none \" >" ;
481 print " <input class= \" button \"
482 type= \" submit \" onclick= \" return filterDlgCheckDate() \"
483 value= \" " . __ ( 'Check it' ). " \" >" ;
486 print "<br/> " . __ ( "on field" ) . " " ;
487 print_select_hash ( "filter_type" , 1 , $filter_types ,
488 'onchange="filterDlgCheckType(this)"' );
492 print __ ( "in" ) . " " ;
493 print_feed_select ( $link , "feed_id" , $active_feed_id );
497 print "<div class= \" dlgSec \" >" . __ ( "Perform Action" ). "</div>" ;
499 print "<div class= \" dlgSecCont \" >" ;
501 print "<select name= \" action_id \"
502 onchange= \" filterDlgCheckAction(this) \" >" ;
504 $result = db_query ( $link , "SELECT id,description FROM ttrss_filter_actions
507 while ( $line = db_fetch_assoc ( $result )) {
508 printf ( "<option value=' %d '> %s </option>" , $line [ "id" ], __ ( $line [ "description" ]));
513 print "<span id= \" filter_dlg_param_box \" style= \" display : none \" >" ;
514 print " " . __ ( "with parameters:" ) . " " ;
515 print "<input size= \" 20 \"
516 onkeypress= \" return filterCR(event, createFilter) \"
517 name= \" action_param \" >" ;
519 print_label_select ( $link , "action_param_label" , $action_param );
523 print " " ; // tiny layout hack
527 print "<div class= \" dlgSec \" >" . __ ( "Options" ). "</div>" ;
528 print "<div class= \" dlgSecCont \" >" ;
530 print "<div style= \" line-height : 100% \" >" ;
532 print "<input type= \" checkbox \" name= \" enabled \" id= \" enabled \" checked= \" 1 \" >
533 <label for= \" enabled \" >" . __ ( 'Enabled' ). "</label><br/>" ;
535 print "<input type= \" checkbox \" name= \" inverse \" id= \" inverse \" >
536 <label for= \" inverse \" >" . __ ( 'Inverse match' ). "</label>" ;
543 print "<div class= \" dlgButtons \" >" ;
545 print "<button onclick= \" return createFilter() \" >" .
546 __ ( 'Create' ). "</button> " ;
548 print "<button onclick= \" return closeInfoBox() \" >" . __ ( 'Cancel' ).
553 // print "</td></tr></table>";
558 if ( $id == "feedUpdateErrors" ) {
560 print "<div id= \" infoBoxTitle \" >" . __ ( 'Update Errors' ). "</div>" ;
561 print "<div class= \" infoBoxContents \" >" ;
563 print __ ( "These feeds have not been updated because of errors:" );
565 $result = db_query ( $link , "SELECT id,title,feed_url,last_error
566 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION [ "uid" ]);
568 print "<ul class='feedErrorsList'>" ;
570 while ( $line = db_fetch_assoc ( $result )) {
571 print "<li><b>" . $line [ "title" ] . "</b> (" . $line [ "feed_url" ] . "): " .
572 "<em>" . $line [ "last_error" ] . "</em>" ;
577 print "<div align='center'>" ;
579 print "<input class= \" button \"
580 type= \" submit \" onclick= \" return closeInfoBox() \"
581 value= \" " . __ ( 'Close' ). " \" >" ;
588 if ( $id == "editArticleTags" ) {
590 print "<div id= \" infoBoxTitle \" >" . __ ( 'Edit Tags' ). "</div>" ;
591 print "<div class= \" infoBoxContents \" >" ;
593 print "<form id= \" tag_edit_form \" onsubmit='return false'>" ;
595 print __ ( "Tags for this article (separated by commas):" ). "<br>" ;
597 $tags = get_article_tags ( $link , $param );
599 $tags_str = join ( ", " , $tags );
601 print "<table width='100%'>" ;
603 print "<tr><td colspan='2'><input type= \" hidden \" name= \" id \" value= \" $param\" ></td></tr>" ;
605 print "<tr><td colspan='2'><textarea rows='4' class='iedit' id='tags_str'
606 name='tags_str'> $tags_str </textarea>
607 <div class= \" autocomplete \" id= \" tags_choices \"
608 style= \" display:none \" ></div>
615 print "<div align='right'>" ;
617 print "<button onclick= \" return editTagsSave() \" >" . __ ( 'Save' ). "</button> " ;
618 print "<button onclick= \" return closeInfoBox() \" >" . __ ( 'Cancel' ). "</button>" ;
625 if ( $id == "printTagCloud" ) {
626 print "<div id= \" infoBoxTitle \" >" . __ ( 'Tag Cloud' ). "</div>" ;
627 print "<div class= \" infoBoxContents \" >" ;
629 print __ ( "Showing most popular tags " ). " (<a
630 href='javascript:toggleTags(true)'>" . __ ( 'more tags' ). "</a>):<br/>" ;
632 print "<div class= \" tagCloudContainer \" >" ;
634 printTagCloud ( $link );
638 print "<div align='center'>" ;
639 print "<button onclick= \" return closeInfoBox() \" >" .
640 __ ( 'Close this window' ). "</button>" ;
648 /* if ($id == "offlineDownload") {
649 print "<div id=\"infoBoxTitle\">".__('Download articles')."</div>";
650 print "<div class=\"infoBoxContents\">";
652 print "<form name='download_ops_form' id='download_ops_form'>";
654 print "<div class=\"dlgSec\">".__("Download")."</div>";
656 print "<div class=\"dlgSecCont\">";
664 print_select_hash("amount", 50, $amount);
666 print " " . __("latest articles for offline reading.");
670 print "<input checked='yes' type='checkbox' name='unread_only' id='unread_only'>";
671 print "<label for='unread_only'>".__('Only include unread articles')."</label>";
677 print "<div class=\"dlgButtons\">
678 <input class=\"button\"
679 type=\"submit\" onclick=\"return initiate_offline_download(0, this)\" value=\"".__('Download')."\">
680 <input class=\"button\"
681 type=\"submit\" onclick=\"return closeInfoBox()\"
682 value=\"".__('Cancel')."\"></div>";
690 print "<div id='infoBoxTitle'>Internal Error</div>
691 <div id='infoBoxContents'>
692 <p>Unknown dialog <b> $id </b></p>