]>
git.wh0rd.org - tt-rss.git/blob - modules/pref-instances.php
2 function module_pref_instances ( $link ) {
4 $subop = $_REQUEST [ 'subop' ];
6 if ( $subop == "edit" ) {
8 $id = db_escape_string ( $_REQUEST [ "id" ]);
10 $result = db_query ( $link , "SELECT * FROM ttrss_linked_instances WHERE
13 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" id \" value= \" $id\" >" ;
14 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" op \" value= \" pref-instances \" >" ;
15 print "<input dojoType= \" dijit.form.TextBox \" style= \" display : none \" name= \" subop \" value= \" editSave \" >" ;
17 print "<div class= \" dlgSec \" >" . __ ( "Instance" ). "</div>" ;
19 print "<div class= \" dlgSecCont \" >" ;
23 $access_url = htmlspecialchars ( db_fetch_result ( $result , 0 , "access_url" ));
25 print __ ( "URL:" ) . " " ;
27 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
28 placeHolder= \" " . __ ( "Instance URL" ). " \"
29 regExp='^(http|https)://.*'
30 style= \" font-size : 16px; width: 20em \" name= \" access_url \"
31 value= \" $access_url\" >" ;
35 $access_key = htmlspecialchars ( db_fetch_result ( $result , 0 , "access_key" ));
39 print __ ( "Access key:" ) . " " ;
41 print "<input dojoType= \" dijit.form.ValidationTextBox \" required= \" 1 \"
42 placeHolder= \" " . __ ( "Access key" ). " \"
43 style= \" width: 20em \" name= \" access_key \" id= \" instance_edit_key \"
44 value= \" $access_key\" >" ;
48 print "<div class= \" dlgButtons \" >
49 <div style='float : left'>
50 <button dojoType= \" dijit.form.Button \"
51 onclick= \" return dijit.byId('instanceEditDlg').regenKey() \" >" .
52 __ ( 'Generate new key' ). "</button>
54 <button dojoType= \" dijit.form.Button \"
55 onclick= \" return dijit.byId('instanceEditDlg').execute() \" >" .
57 <button dojoType= \" dijit.form.Button \"
58 onclick= \" return dijit.byId('instanceEditDlg').hide() \"\" >" .
59 __ ( 'Cancel' ). "</button></div>" ;
64 if ( $subop == "editSave" ) {
65 $id = db_escape_string ( $_REQUEST [ "id" ]);
66 $access_url = db_escape_string ( $_REQUEST [ "access_url" ]);
67 $access_key = db_escape_string ( $_REQUEST [ "access_key" ]);
69 db_query ( $link , "UPDATE ttrss_linked_instances SET
70 access_key = ' $access_key ', access_url = ' $access_url '
76 print "<div id= \" pref-instance-wrap \" dojoType= \" dijit.layout.BorderContainer \" gutters= \" false \" >" ;
77 print "<div id= \" pref-instance-header \" dojoType= \" dijit.layout.ContentPane \" region= \" top \" >" ;
79 print "<div id= \" pref-instance-toolbar \" dojoType= \" dijit.Toolbar \" >" ;
81 $sort = db_escape_string ( $_REQUEST [ "sort" ]);
83 if (! $sort ||
$sort == "undefined" ) {
87 print "<div dojoType= \" dijit.form.DropDownButton \" >" .
88 "<span>" . __ ( 'Select' ). "</span>" ;
89 print "<div dojoType= \" dijit.Menu \" style= \" display: none; \" >" ;
90 print "<div onclick= \" selectTableRows('prefInstanceList', 'all') \"
91 dojoType= \" dijit.MenuItem \" >" . __ ( 'All' ). "</div>" ;
92 print "<div onclick= \" selectTableRows('prefInstanceList', 'none') \"
93 dojoType= \" dijit.MenuItem \" >" . __ ( 'None' ). "</div>" ;
96 print "<button dojoType= \" dijit.form.Button \" onclick= \" addInstance() \" >" . __ ( 'Link instance' ). "</button>" ;
97 print "<button dojoType= \" dijit.form.Button \" onclick= \" editSelectedInstance() \" >" . __ ( 'Edit' ). "</button>" ;
98 print "<button dojoType= \" dijit.form.Button \" onclick= \" removeSelectedInstances() \" >" . __ ( 'Remove' ). "</button>" ;
100 print "</div>" ; #toolbar
102 $result = db_query ( $link , "SELECT * FROM ttrss_linked_instances
105 print "<p class= \" insensitive \" style='margin-left : 1em;'>" . __ ( "You can connect other instances of Tiny Tiny RSS to this one to share Popular feeds. Link to this instance of Tiny Tiny RSS by using this URL:" );
107 print " <a href= \" # \" onclick= \" alert('" . htmlspecialchars ( get_self_url_prefix ()). "') \" >(display url)</a>" ;
109 print "<p><table width='100%' id='prefInstanceList' class='prefInstanceList' cellspacing='0'>" ;
111 print "<tr class= \" title \" >
112 <td align='center' width= \" 5% \" > </td>
113 <td width=''><a href= \" # \" onclick= \" updateInstanceList('access_url') \" >" . __ ( 'Instance URL' ). "</a></td>
114 <td width='20%'><a href= \" # \" onclick= \" updateUsersList('last_connected') \" >" . __ ( 'Last connected' ). "</a></td>
119 while ( $line = db_fetch_assoc ( $result )) {
120 $class = ( $lnum %
2 ) ?
"even" : "odd" ;
123 $this_row_id = "id= \" LIRR- $id\" " ;
125 $line [ "last_connected" ] = make_local_datetime ( $link , $line [ "last_connected" ], false );
127 print "<tr class= \" $class\" $this_row_id >" ;
129 print "<td align='center'><input onclick='toggleSelectRow(this);'
130 type= \" checkbox \" id= \" LICHK- $id\" ></td>" ;
132 $onclick = "onclick='editInstance( $id , event)' title='" . __ ( 'Click to edit' ). "'" ;
134 print "<td $onclick >" . htmlspecialchars ( $line [ 'access_url' ]) . "</td>" ;
135 print "<td $onclick >" . htmlspecialchars ( $line [ 'last_connected' ]) . "</td>" ;
144 print "</div>" ; #pane
145 print "</div>" ; #container