working on image types editor
This commit is contained in:
parent
b1db6deb7b
commit
8954eec144
@ -79,6 +79,7 @@ class ComicPressAdmin {
|
||||
if ($plugin_page == 'comicpress/render_admin') {
|
||||
wp_enqueue_style('cp-admin', get_template_directory_uri() . '/css/cp-admin.css');
|
||||
wp_enqueue_script('cp-admin', get_template_directory_uri() . '/js/Storyline.js', array('prototype', 'scriptaculous'));
|
||||
add_action('admin_footer', array(&$this, 'admin_footer'));
|
||||
}
|
||||
|
||||
if (strpos($pagenow, "-upload") !== false) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div class="image-type-holder">
|
||||
<a class="delete-image-type">X</a>
|
||||
<a class="delete-image-type" href="#">X</a>
|
||||
<table cellspacing="0">
|
||||
<tr class="image-type-editor-name">
|
||||
<th scope="row" width="30%">Name:</th>
|
||||
@ -11,7 +11,12 @@
|
||||
</tr>
|
||||
<tr class="image-type-editor-default">
|
||||
<th scope="row">Default image type?</th>
|
||||
<td><input type="checkbox" name="cp[image_types][<?php echo $type ?>][default]" value="yes" <?php echo (!empty($info['default'])) ? 'checked="checked"' : '' ?> /></td>
|
||||
<td>
|
||||
<label>
|
||||
<input type="checkbox" name="cp[image_types][<?php echo $type ?>][default]" value="yes" <?php echo (!empty($info['default'])) ? 'checked="checked"' : '' ?> />
|
||||
<em>(<?php _e('When using a ComicPress tag without specifying a type, this one will be used', 'comicpress') ?>)</em>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="image-type-editor-dimensions">
|
||||
<th scope="row">Dimensions</th>
|
||||
@ -19,6 +24,8 @@
|
||||
<?php list($width, $height) = explode("x", $info['dimensions']) ?>
|
||||
<input type="text" name="cp[image_types][<?php echo $type ?>][dimensions][width]" value="<?php echo $width ?>" size="5" /> x
|
||||
<input type="text" name="cp[image_types][<?php echo $type ?>][dimensions][height]" value="<?php echo $height ?>" size="5" />
|
||||
<br />
|
||||
<em>(<?php _e('Leave a dimension blank to allow WordPress to calculate that dimension while scaling', 'comicpress') ?>)</em>
|
||||
</td>
|
||||
</tr>
|
||||
<?php do_action('comicpress_image_type_holder') ?>
|
||||
|
@ -25,57 +25,11 @@
|
||||
<?php include('_image-type-editor.inc'); ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<a id="add-new-image-type">Add a new image type</a>
|
||||
<a id="add-new-image-type" href="#">Add a new image type</a>
|
||||
<script type="text/javascript">ComicImageTypes.setup()</script>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3><?php _e('Admin Options', 'comicpress') ?></h3>
|
||||
<table class="widefat fixed">
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Enable editing helpers', 'comicpress') ?></th>
|
||||
<td>
|
||||
<?php
|
||||
foreach (array(
|
||||
"show_inline_comic_ordering" => __('Show inline comic ordering', 'comicpress')
|
||||
) as $key => $label) { ?>
|
||||
<label>
|
||||
<input type="checkbox"
|
||||
name="cp[helpers][<?php echo $key ?>]"
|
||||
value="yes"
|
||||
<?php echo (($this->comicpress->comicpress_options['helpers'][$key] === true) ? 'checked="checked"' : '') ?> />
|
||||
<?php echo $label ?>
|
||||
</label>
|
||||
<br />
|
||||
<?php }
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if (is_array($this->all_addons)) { ?>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Enable addons', 'comicpress') ?></th>
|
||||
<td>
|
||||
<?php
|
||||
foreach ($this->all_addons as $addon) {
|
||||
if (!empty($addon->name)) {
|
||||
$enabled = ($addon->is_addon_manager !== true);
|
||||
$checked = $enabled && $this->comicpress->comicpress_options['addons'][$addon->name];
|
||||
?>
|
||||
|
||||
<label>
|
||||
<input type="checkbox"
|
||||
name="cp[addons][<?php echo $addon->name ?>]"
|
||||
value="yes"
|
||||
<?php echo !$enabled ? 'disabled="disabled"' : '' ?>
|
||||
<?php echo $checked ? 'checked="checked"' : '' ?> />
|
||||
<?php echo $addon->name ?>
|
||||
</label><br />
|
||||
<?php }
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
<input class="button" type="submit" value="<?php _e('Submit Changes', 'comicpress') ?>" />
|
||||
</form>
|
||||
</div>
|
||||
|
@ -1,15 +1,17 @@
|
||||
var Storyline = {};
|
||||
var ComicImageTypes = {};
|
||||
|
||||
Storyline.get_order = function() {
|
||||
(function() {
|
||||
Storyline.get_order = function() {
|
||||
var order = []
|
||||
$$('#storyline-sorter .cp-category-info').each(function(info) {
|
||||
var matches = info.id.match(/category_([0-9\/]+)/);
|
||||
if (matches) { order.push(matches[1]); }
|
||||
});
|
||||
$$('input[name*=storyline_order]').pop().value = order.join(',');
|
||||
};
|
||||
};
|
||||
|
||||
Storyline.setup = function() {
|
||||
Storyline.setup = function() {
|
||||
var i = 0;
|
||||
var depths = {};
|
||||
$$('.cp-children').each(function(ch) {
|
||||
@ -31,4 +33,46 @@ Storyline.setup = function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
ComicImageTypes.setup = function() {
|
||||
$$('.image-type-holder').each(function(ith) {
|
||||
var closer = ith.select('.delete-image-type').pop();
|
||||
if (closer) {
|
||||
closer.observe('click', function(e) {
|
||||
Event.stop(e);
|
||||
if (confirm('Are you sure? Your templates may break after deleting this image type')) {
|
||||
new Effect.Fade(ith, {
|
||||
from: 1,
|
||||
to: 0,
|
||||
afterFinish: function() {
|
||||
ith.parentNode.removeChild(ith);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
var checkboxes = $$('input[name*=default][name*=image_types]');
|
||||
checkboxes.each(function(c) {
|
||||
c.observe('change', function(e) {
|
||||
checkboxes.each(function(ch) {
|
||||
if (e.target != ch) { ch.checked = false; }
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('add-new-image-type').observe('click', function(e) {
|
||||
Event.stop(e);
|
||||
new Ajax.Updater('image-type-container', ComicPressAdmin.ajax_uri, {
|
||||
method: 'get',
|
||||
parameters: {
|
||||
'cp[_nonce]': ComicPressAdmin.nonce,
|
||||
'cp[
|
||||
},
|
||||
insertion: 'bottom'
|
||||
});
|
||||
});
|
||||
};
|
||||
}())
|
||||
|
Loading…
Reference in New Issue
Block a user