experimental article attachment ui based on dijit dropdown

This commit is contained in:
Andrew Dolgov 2012-07-09 20:48:34 +04:00
parent f360b02886
commit 749b56bdac

View file

@ -4718,13 +4718,16 @@
if (!$ctype) $ctype = __("unknown type"); if (!$ctype) $ctype = __("unknown type");
# $filename = substr($url, strrpos($url, "/")+1); $filename = substr($url, strrpos($url, "/")+1);
$entry = format_inline_player($link, $url, $ctype); # $player = format_inline_player($link, $url, $ctype);
# $entry .= " <a target=\"_blank\" href=\"" . htmlspecialchars($url) . "\">" . # $entry .= " <a target=\"_blank\" href=\"" . htmlspecialchars($url) . "\">" .
# $filename . " (" . $ctype . ")" . "</a>"; # $filename . " (" . $ctype . ")" . "</a>";
$entry = "<div onclick=\"window.open('".htmlspecialchars($url)."')\"
dojoType=\"dijit.MenuItem\">$filename ($ctype)</div>";
array_push($entries_html, $entry); array_push($entries_html, $entry);
$entry = array(); $entry = array();
@ -4736,8 +4739,6 @@
array_push($entries, $entry); array_push($entries, $entry);
} }
$rv .= "<div class=\"postEnclosures\">";
if (!get_pref($link, "STRIP_IMAGES")) { if (!get_pref($link, "STRIP_IMAGES")) {
if ($always_display_enclosures || if ($always_display_enclosures ||
!preg_match("/<img/i", $article_content)) { !preg_match("/<img/i", $article_content)) {
@ -4750,20 +4751,19 @@
$rv .= "<p><img $rv .= "<p><img
alt=\"".htmlspecialchars($entry["filename"])."\" alt=\"".htmlspecialchars($entry["filename"])."\"
src=\"" .htmlspecialchars($entry["url"]) . "\"/></p>"; src=\"" .htmlspecialchars($entry["url"]) . "\"/></p>";
} }
} }
} }
} }
if (count($entries) == 1) { $rv .= "<div dojoType=\"dijit.form.DropDownButton\">".
$rv .= __("Attachment:") . " "; "<span>" . __('Attachments')."</span>";
} else { $rv .= "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
$rv .= __("Attachments:") . " ";
}
$rv .= join(", ", $entries_html); foreach ($entries_html as $entry) { $rv .= $entry; };
$rv .= "</div>"; $rv .= "</div></div>";
} }
return $rv; return $rv;