diff --git a/include/staff/dynamic-list.inc.php b/include/staff/dynamic-list.inc.php index e29c1afd29efd7929e6d14da6202a0aaa6c8d758..280d85eccf1a08609215299b7b1abdeb8b87224c 100644 --- a/include/staff/dynamic-list.inc.php +++ b/include/staff/dynamic-list.inc.php @@ -17,7 +17,7 @@ if ($list) { $info=Format::htmlchars(($errors && $_POST) ? array_merge($info,$_POST) : $info); ?> -<form action="?" method="post" id="save"> +<form action="" method="post" id="save"> <?php csrf_token(); ?> <input type="hidden" name="do" value="<?php echo $action; ?>"> <input type="hidden" name="a" value="<?php echo Format::htmlchars($_REQUEST['a']); ?>"> @@ -150,16 +150,11 @@ $info=Format::htmlchars(($errors && $_POST) ? array_merge($info,$_POST) : $info) <?php } ?> </select> <?php if ($f->isConfigurable()) { ?> - <a class="action-button" style="float:none;overflow:inherit" - href="#ajax.php/form/field-config/<?php - echo $f->get('id'); ?>" - onclick="javascript: - $('#overlay').show(); - $('#field-config .body').empty().load($(this).attr('href').substr(1)); - $('#field-config').show(); - return false; - "><i class="icon-edit"></i> <?php echo __('Config'); ?></a> - <?php } ?></td> + <a class="action-button field-config" + style="float:none;overflow:inherit" + href="#form/field-config/<?php + echo $f->get('id'); ?>"><i + class="icon-cog"></i> <?php echo __('Config'); ?></a> <?php } ?></td> <td> <input type="text" size="20" name="name-<?php echo $id; ?>" value="<?php echo Format::htmlchars($f->get('name')); @@ -258,15 +253,18 @@ $info=Format::htmlchars(($errors && $_POST) ? array_merge($info,$_POST) : $info) <td><input type="text" size="40" name="value-<?php echo $id; ?>" value="<?php echo $i->getValue(); ?>"/> <?php if ($list->hasProperties()) { ?> - <a class="action-button" style="float:none;overflow:inherit" - href="#ajax.php/list/<?php - echo $list->getId(); ?>/item/<?php echo $id ?>/properties" - onclick="javascript: - $('#overlay').show(); - $('#field-config .body').empty().load($(this).attr('href').substr(1)); - $('#field-config').show(); - return false; - "><i class="icon-edit"></i> <?php echo __('Properties'); ?></a> + <a class="action-button field-config" + style="float:none;overflow:inherit" + href="#list/<?php + echo $list->getId(); ?>/item/<?php + echo $id ?>/properties" + id="item-<?php echo $id; ?>" + ><?php + echo sprintf('<i class="icon-edit" %s></i> ', + $i->getConfiguration() + ? '': 'style="color:red; font-weight:bold;"'); + echo __('Properties'); + ?></a> <?php } @@ -335,24 +333,16 @@ $info=Format::htmlchars(($errors && $_POST) ? array_merge($info,$_POST) : $info) </p> </form> -<div style="display:none;" class="dialog draggable" id="field-config"> - <div id="popup-loading"> - <h1><i class="icon-spinner icon-spin icon-large"></i> - <?php echo __('Loading ...');?></h1> - </div> - <div class="body"></div> -</div> - <script type="text/javascript"> $(function() { - var $this = $('#popup-loading').hide(); - $(document).ajaxStart( function(event) { - console.log(1,event); - var $h1 = $this.find('h1'); - $this.show(); - $h1.css({'margin-top':$this.height()/3-$h1.height()/3}); // show Loading Div - }).ajaxStop ( function(){ - $this.hide(); // hide loading div + $('a.field-config').click( function(e) { + e.preventDefault(); + var $id = $(this).attr('id'); + var url = 'ajax.php/'+$(this).attr('href').substr(1); + $.dialog(url, [200], function (xhr) { + $('a#'+$id+' i').removeAttr('style'); + }); + return false; }); }); </script> diff --git a/include/staff/templates/dynamic-field-config.tmpl.php b/include/staff/templates/dynamic-field-config.tmpl.php index 9c1261e9ace8a02000fb188efb51f62900fc951d..fe4116707be969c5c5d4ab2e5ad3510646ce3f91 100644 --- a/include/staff/templates/dynamic-field-config.tmpl.php +++ b/include/staff/templates/dynamic-field-config.tmpl.php @@ -1,19 +1,8 @@ <h3><?php echo __('Field Configuration'); ?> — <?php echo $field->get('label') ?></h3> <a class="close" href=""><i class="icon-remove-circle"></i></a> <hr/> - <form method="post" action="ajax.php/form/field-config/<?php - echo $field->get('id'); ?>" onsubmit="javascript: - var form = $(this); - $.post(this.action, form.serialize(), function(data, status, xhr) { - if (!data.length) { - form.closest('.dialog').hide(); - $('#overlay').hide(); - } else { - form.closest('.dialog').empty().append(data); - } - }); - return false; - "> + <form method="post" action="#form/field-config/<?php + echo $field->get('id'); ?>"> <?php echo csrf_token(); $config = $field->getConfiguration(); diff --git a/include/staff/templates/list-item-properties.tmpl.php b/include/staff/templates/list-item-properties.tmpl.php index e105bea4fef479b32992bf4fbd28331924191adc..44ce0de055728a163cd805e59ec99a5a8e549fd9 100644 --- a/include/staff/templates/list-item-properties.tmpl.php +++ b/include/staff/templates/list-item-properties.tmpl.php @@ -1,19 +1,9 @@ <h3><?php echo __('Item Properties'); ?> — <?php echo $item->getValue() ?></h3> <a class="close" href=""><i class="icon-remove-circle"></i></a> <hr/> - <form method="post" action="ajax.php/list/<?php + <form method="post" action="#list/<?php echo $list->getId(); ?>/item/<?php - echo $item->getId(); ?>/properties" onsubmit="javascript: - var form = $(this); - $.post(this.action, form.serialize(), function(data, status, xhr) { - if (!data.length) { - form.closest('.dialog').hide(); - $('#overlay').hide(); - } else { - form.closest('.dialog .body').empty().append(data); - } - }); - return false;"> + echo $item->getId(); ?>/properties"> <?php echo csrf_token(); $config = $item->getConfiguration(); diff --git a/scp/js/scp.js b/scp/js/scp.js index b930f58637621d84cc4d2c8f85850d73d81d3385..953712f43b368377454b5ff028b553bb40330c96 100644 --- a/scp/js/scp.js +++ b/scp/js/scp.js @@ -538,6 +538,7 @@ $.dialog = function (url, codes, cb, options) { $popup.show(); $('div.body', $popup).load(url, function () { $('div#popup-loading', $popup).hide(); + $('#overlay').show(); $('div.body', $popup).show({ duration: 0, complete: function() { if (options.onshow) options.onshow(); }