1
0

Refactor entryproperties media db button.

Hard-coded input without inline JS, external onclick handler, hide
button on no-js.

References #54
This commit is contained in:
Matthias Mees
2013-09-18 18:42:18 +02:00
parent ca208da2fb
commit e2102f6e1e
3 changed files with 7 additions and 6 deletions

View File

@ -459,12 +459,7 @@ class serendipity_event_entryproperties extends serendipity_event
<div id="ep_column_<?php echo $fieldname; ?>" class="clearfix form_area">
<label for="prop<?php echo $fieldname; ?>"><?php echo $fieldname; ?></label>
<textarea id="prop<?php echo $fieldname; ?>" name="serendipity[properties][<?php echo $fieldname; ?>]"><?php echo htmlspecialchars($value); ?></textarea>
<script>
var epColumn = document.getElementById('ep_column_<?php echo $fieldname; ?>');
var epImgBtn = document.createElement('span');
epImgBtn.innerHTML = '<input type="button" name="insImage" value="<?php echo MEDIA ; ?>" onclick="window.open(\'serendipity_admin_image_selector.php?serendipity[htmltarget]=prop<?php echo $fieldname; ?>&amp;serendipity[filename_only]=true\', \'ImageSel\', \'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1\');">';
epColumn.appendChild(epImgBtn);
</script>
<input class="customfieldMedia" type="button" name="insImage" value="<?php echo MEDIA ; ?>" data-tarea="prop<?php echo $fieldname; ?>">
</div>
<?php
}

View File

@ -863,6 +863,11 @@ var AccessifyHTML5 = function (defaults, more_fixes) {
e.preventDefault();
});
$('.customfieldMedia').click(function() {
var configitem = $(this).parent().find('textarea').attr('id');
serendipity.choose_media(configitem);
});
$('#tree_toggle_all').click(function(e) {
e.preventDefault();
serendipity.treeToggleAll();

View File

@ -1932,6 +1932,7 @@ form > .button_link:first-of-type,
.no-js .pluginmanager_grablet,
.no-js .image_resize_hint,
.no-js #serendipityScaleForm > .form_check,
.no-js .customfieldMedia,
.js .additional_info,
.installer .toggle_info,
.hidden,