]> git.wh0rd.org - tt-rss.git/blobdiff - modules/popup-dialog.php
experimental split of public calls into public.php (refs #389)
[tt-rss.git] / modules / popup-dialog.php
index 906e89f4f0b52d2aee21a2fe2d069a5f36673b60..26b2e7cf6de396ff262b7b0253e8c16ccdd2815f 100644 (file)
                        print "</div>";
 
                        print "]]></content>";
+               }
 
-                       //return;
+               if ($id == 'printTagSelect') {
+                       print "<title>" . __('Select item(s) by tags') . "</title>";
+                       print "<content><![CDATA[";
+
+                       print __("Match:"). "&nbsp;" .
+                                 "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" checked value=\"any\" name=\"tag_mode\">&nbsp;Any&nbsp;";
+                       print "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" value=\"all\" name=\"tag_mode\">&nbsp;All&nbsp;";
+                       print "&nbsp;tags.";
+
+                       print "<select id=\"all_tags\" name=\"all_tags\" title=\"" . __('Which Tags?') . "\" multiple=\"multiple\" size=\"10\" style=\"width : 100%\">";
+                       $result = db_query($link, "SELECT DISTINCT tag_name FROM ttrss_tags WHERE owner_uid = ".$_SESSION['uid']."
+                               AND LENGTH(tag_name) <= 30 ORDER BY tag_name ASC");
+
+                       while ($row = db_fetch_assoc($result)) {
+                               $tmp = htmlspecialchars($row["tag_name"]);
+                               print "<option value=\"" . str_replace(" ", "%20", $tmp) . "\">$tmp</option>";
+                       }
+
+                       print "</select>";
+
+                       print "<div align='right'>";
+                       print "<button dojoType=\"dijit.form.Button\" onclick=\"viewfeed(get_all_tags($('all_tags')),
+                               get_radio_checked($('tag_mode')));\">" . __('Display entries') . "</button>";
+                       print "&nbsp;";
+                       print "<button dojoType=\"dijit.form.Button\"
+                       onclick=\"return closeInfoBox()\">" .
+                               __('Close this window') . "</button>";
+                       print "</div>";
+
+                       print "]]></content>";
                }
 
                if ($id == "emailArticle") {
                        print __("Access key:") . " ";
 
                        print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\"
-                               placeHolder=\"".__("Access key")."\"
+                               placeHolder=\"".__("Access key")."\" regExp='\w{40}'
                                style=\"width: 20em\" name=\"access_key\" id=\"instance_add_key\"
                                value=\"$access_key\">";
 
+                       print "<p class='insensitive'>" . __("Use one access key for both linked instances.");
+
                        print "</div>";
 
                        print "<div class=\"dlgButtons\">
                                        __('Cancel')."</button></div>";
 
                        return;
+               }
 
+               if ($id == "shareArticle") {
 
+                       $result = db_query($link, "SELECT uuid, ref_id FROM ttrss_user_entries WHERE int_id = '$param'
+                               AND owner_uid = " . $_SESSION['uid']);
 
+                       if (db_num_rows($result) == 0) {
+                               print "Article not found.";
+                       } else {
 
+                               $uuid = db_fetch_result($result, 0, "uuid");
+                               $ref_id = db_fetch_result($result, 0, "ref_id");
+
+                               if (!$uuid) {
+                                       $uuid = db_escape_string(sha1(uniqid(rand(), true)));
+                                       db_query($link, "UPDATE ttrss_user_entries SET uuid = '$uuid' WHERE int_id = '$param'
+                                               AND owner_uid = " . $_SESSION['uid']);
+                               }
+
+                               print __("You can share this article by the following unique URL:");
+
+                               $url_path = get_self_url_prefix();
+                               $url_path .= "/public.php?op=share&key=$uuid";
+
+                               print "<div class=\"tagCloudContainer\">";
+                               print "<a id='pub_opml_url' href='$url_path' target='_blank'>$url_path</a>";
+                               print "</div>";
+
+                               /* if (!label_find_id($link, __('Shared'), $_SESSION["uid"]))
+                                       label_create($link, __('Shared'), $_SESSION["uid"]);
+
+                               label_add_article($link, $ref_id, __('Shared'), $_SESSION['uid']); */
+                       }
+
+                       print "<div align='center'>";
+
+                       print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('shareArticleDlg').hide()\">".
+                               __('Close this window')."</button>";
+
+                       print "</div>";
+
+                       return;
                }
 
                print "</dlg>";
+
        }
 ?>