since dojo dropdowns won't work in article content because of html escaping trick, replace attachment dropdown with generic html controls

This commit is contained in:
Andrew Dolgov 2013-03-28 10:56:29 +04:00
parent ba79634c2d
commit f9432f2630
2 changed files with 20 additions and 5 deletions

View file

@ -3693,13 +3693,15 @@
$rv .= "<hr clear='both'/>"; $rv .= "<hr clear='both'/>";
} }
$rv .= "<br/><div dojoType=\"dijit.form.DropDownButton\">". $rv .= "<select onchange=\"openSelectedAttachment(this)\">".
"<span>" . __('Attachments')."</span>"; "<option value=''>" . __('Attachments')."</option>";
$rv .= "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
foreach ($entries_html as $entry) { $rv .= $entry; }; foreach ($entries as $entry) {
$rv .= "<option value=\"".htmlspecialchars($entry["url"])."\">" . htmlspecialchars($entry["filename"]) . "</option>";
$rv .= "</div></div>"; };
$rv .= "</select>";
} }
return $rv; return $rv;

View file

@ -2115,3 +2115,16 @@ function displayArticleUrl(id) {
} }
} }
function openSelectedAttachment(elem) {
try {
var url = elem[elem.selectedIndex].value;
if (url) {
window.open(url);
elem.selectedIndex = 0;
}
} catch (e) {
exception_error("openSelectedAttachment", e);
}
}