diff options
Diffstat (limited to 'views/admin')
| -rw-r--r-- | views/admin/form/checkbox.phtml | 29 | ||||
| -rw-r--r-- | views/admin/form/text.phtml | 5 | ||||
| -rw-r--r-- | views/admin/form/upload.phtml | 31 |
3 files changed, 64 insertions, 1 deletions
diff --git a/views/admin/form/checkbox.phtml b/views/admin/form/checkbox.phtml index fcf63e6..b1f7bda 100644 --- a/views/admin/form/checkbox.phtml +++ b/views/admin/form/checkbox.phtml @@ -17,7 +17,11 @@ <label>
<div class="wpsg_field_wrap">
+
+ <?php if (!isset($this->view['field_config']['noHidden'])) { ?>
<input type="hidden" name="<?php echo $this->view['field_name']; ?>" value="0" />
+ <?php } ?>
+
<input type="checkbox" id="<?php echo $this->view['field_id']; ?>" name="<?php echo $this->view['field_name']; ?>" value="<?php echo wpsg_getStr($this->view['field_config']['value'], '1'); ?>" <?php echo (($this->view['field_checked'] > 0)?'checked="checked"':''); ?> />
<?php echo $this->view['field_label']; ?>
@@ -33,6 +37,31 @@ </div>
+ <?php if (wpsg_isTrue($this->view['field_config']['inlineEdit'])) { ?>
+ <script type="text/javascript">/* <![CDATA[ */
+
+ jQuery(document).ready(function() {
+
+ jQuery('#<?php echo $this->view['field_id']; ?>').on('change', function() {
+
+ var value = '0';
+ if (jQuery(this).prop('checked')) value = '1';
+
+ jQuery.ajax( {
+ url: '<?php echo $this->view['field_config']['inlineEdit_url']; ?>',
+ data: {
+ 'name': '<?php echo $this->view['field_name']; ?>',
+ 'value': value
+ }
+ } );
+
+ } );
+
+ } );
+
+ /* ]]> */</script>
+ <?php } ?>
+
<div class="clearfix wpsg_clear"></div>
</div>
\ No newline at end of file diff --git a/views/admin/form/text.phtml b/views/admin/form/text.phtml index 450c2ea..90a2b4c 100644 --- a/views/admin/form/text.phtml +++ b/views/admin/form/text.phtml @@ -17,7 +17,7 @@ </div>
</div>
- <?php if (isset($this->view['field_config']['inlineEdit']) && $this->view['field_config']['inlineEdit']) { ?>
+ <?php if (wpsg_isTrue($this->view['field_config']['inlineEdit'])) { ?>
<script type="text/javascript">/* <![CDATA[ */
jQuery(document).ready(function() {
@@ -27,6 +27,9 @@ 'type': '<?php echo $this->view['field_config']['inlineEdit_type']; ?>',
'placement': 'bottom'
<?php } ?>
+ <?php if (wpsg_isSizedArray($this->view['field_config']['inlineEdit_source'])) { ?>
+ ,'data': <?php echo json_encode($this->view['field_config']['inlineEdit_source']); ?>
+ <?php } ?>
} );
} );
diff --git a/views/admin/form/upload.phtml b/views/admin/form/upload.phtml index dd0591b..8e3c47e 100644 --- a/views/admin/form/upload.phtml +++ b/views/admin/form/upload.phtml @@ -28,6 +28,37 @@ </div>
+ <?php if (wpsg_isTrue($this->view['field_config']['ajax_upload'])) { ?>
+ <script type="text/javascript">/* <![CDATA[ */
+
+ jQuery(document).ready(function() {
+
+ jQuery('#<?php echo $this->view['field_id']; ?>').on('change', function() {
+
+ var data = new FormData();
+ data.append('file', this.files[0]);
+
+ jQuery.ajax( {
+ url: '<?php echo $this->view['field_config']['ajax_upload_url']; ?>',
+ data: data,
+ type: 'POST',
+ processData: false,
+ contentType: false,
+ success: function(data) {
+
+ <?php if (wpsg_isSizedString($this->view['field_config']['ajax_success'])) { ?>
+ <?php echo $this->view['field_config']['ajax_success']; ?>(data);
+ <?php } ?>
+
+ }
+ } );
+ } );
+
+ } );
+
+ /* ]]> */</script>
+ <?php } ?>
+
<div class="clearfix wpsg_clear"></div>
</div>
|
