style feed icon and opml file upload controls

This commit is contained in:
Andrew Dolgov 2017-12-03 22:35:12 +03:00
parent 229c139c6a
commit 5f5b0de423
4 changed files with 32 additions and 9 deletions

View File

@ -1586,6 +1586,10 @@ class Feeds extends Handler_Protected {
} }
} }
static function getIconFile($feed_id) {
return ICONS_DIR . "/$feed_id.ico";
}
static function getFeedIcon($id) { static function getFeedIcon($id) {
switch ($id) { switch ($id) {
case 0: case 0:
@ -1610,8 +1614,11 @@ class Feeds extends Handler_Protected {
if ($id < LABEL_BASE_INDEX) { if ($id < LABEL_BASE_INDEX) {
return "images/label.png"; return "images/label.png";
} else { } else {
if (file_exists(ICONS_DIR . "/$id.ico")) $icon = self::getIconFile($id);
return ICONS_URL . "/$id.ico";
if ($icon && file_exists($icon)) {
return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon);
}
} }
break; break;
} }

View File

@ -726,19 +726,23 @@ class Pref_Feeds extends Handler_Protected {
print "<div class=\"dlgSecSimple\">"; print "<div class=\"dlgSecSimple\">";
print "<img class=\"feedIcon\" src=\"".Feeds::getFeedIcon($feed_id)."\">";
print "<iframe name=\"icon_upload_iframe\" print "<iframe name=\"icon_upload_iframe\"
style=\"width: 400px; height: 100px; display: none;\"></iframe>"; style=\"width: 400px; height: 100px; display: none;\"></iframe>";
print "<form style='display : block' target=\"icon_upload_iframe\" print "<form style='display : block' target=\"icon_upload_iframe\"
enctype=\"multipart/form-data\" method=\"POST\" enctype=\"multipart/form-data\" method=\"POST\"
action=\"backend.php\"> action=\"backend.php\">
<input id=\"icon_file\" size=\"10\" name=\"icon_file\" type=\"file\"> <label class=\"dijitButton\">".__("Choose file...")."
<input style=\"display: none\" id=\"icon_file\" size=\"10\" name=\"icon_file\" type=\"file\">
</label>
<input type=\"hidden\" name=\"op\" value=\"pref-feeds\"> <input type=\"hidden\" name=\"op\" value=\"pref-feeds\">
<input type=\"hidden\" name=\"feed_id\" value=\"$feed_id\"> <input type=\"hidden\" name=\"feed_id\" value=\"$feed_id\">
<input type=\"hidden\" name=\"method\" value=\"uploadicon\"><p> <input type=\"hidden\" name=\"method\" value=\"uploadicon\">
<button class=\"\" dojoType=\"dijit.form.Button\" onclick=\"return uploadFeedIcon();\" <button class=\"\" dojoType=\"dijit.form.Button\" onclick=\"return uploadFeedIcon();\"
type=\"submit\">".__('Replace')."</button> type=\"submit\">".__('Replace')."</button>
<button class=\"\" dojoType=\"dijit.form.Button\" onclick=\"return removeFeedIcon($feed_id);\" <button class=\"danger\" dojoType=\"dijit.form.Button\" onclick=\"return removeFeedIcon($feed_id);\"
type=\"submit\">".__('Remove')."</button> type=\"submit\">".__('Remove')."</button>
</form>"; </form>";
@ -1285,7 +1289,9 @@ class Pref_Feeds extends Handler_Protected {
print "<form name=\"opml_form\" style='display : block' target=\"upload_iframe\" print "<form name=\"opml_form\" style='display : block' target=\"upload_iframe\"
enctype=\"multipart/form-data\" method=\"POST\" enctype=\"multipart/form-data\" method=\"POST\"
action=\"backend.php\"> action=\"backend.php\">
<input id=\"opml_file\" name=\"opml_file\" type=\"file\">&nbsp; <label class=\"dijitButton\">".__("Choose file...")."
<input style=\"display : none\" id=\"opml_file\" name=\"opml_file\" type=\"file\">&nbsp;
</label>
<input type=\"hidden\" name=\"op\" value=\"dlg\"> <input type=\"hidden\" name=\"op\" value=\"dlg\">
<input type=\"hidden\" name=\"method\" value=\"importOpml\"> <input type=\"hidden\" name=\"method\" value=\"importOpml\">
<button dojoType=\"dijit.form.Button\" onclick=\"return opmlImport();\" type=\"submit\">" . <button dojoType=\"dijit.form.Button\" onclick=\"return opmlImport();\" type=\"submit\">" .
@ -1296,7 +1302,7 @@ class Pref_Feeds extends Handler_Protected {
$opml_export_filename = "TinyTinyRSS_".date("Y-m-d").".opml"; $opml_export_filename = "TinyTinyRSS_".date("Y-m-d").".opml";
print "<p>" . __('Filename:') . print "<p>" . __('Filename:') .
" <input type=\"text\" id=\"filename\" value=\"$opml_export_filename\" />&nbsp;" . " <input class=\"input input-text\" type=\"text\" id=\"filename\" value=\"$opml_export_filename\" />&nbsp;" .
__('Include settings') . "<input type=\"checkbox\" id=\"settings\" checked=\"1\"/>"; __('Include settings') . "<input type=\"checkbox\" id=\"settings\" checked=\"1\"/>";
print "</p><button dojoType=\"dijit.form.Button\" print "</p><button dojoType=\"dijit.form.Button\"

File diff suppressed because one or more lines are too long

View File

@ -1102,6 +1102,16 @@ body.ttrss_main {
#editTagsDlg{ #editTagsDlg{
overflow: visible; overflow: visible;
} }
#feedEditDlg img.feedIcon {
border : 1px solid #ccc;
padding : 5px;
margin : 5px;
max-width : 20px;
max-height : 20px;
height : auto;
width : auto;
}
} }