Permalink
Browse files

customisation form reset confirmation (OES-28)

  • Loading branch information...
1 parent 51603f3 commit 369c2965df66181aaf39ae6623ae928d6c49f858 @denis-larka denis-larka committed Jul 27, 2012
Showing with 13 additions and 5 deletions.
  1. +2 −1 inc/lib_form.inc
  2. +7 −2 mod/admin/adminModule.class.php
  3. +2 −2 mod/admin/entity_form.inc
  4. +2 −0 www/robots.txt
View
@@ -122,8 +122,9 @@ function shn_form_submit($label, $name , $extra_opts = null)
{
global $shn_tabindex;
$class = (isset($extra_opts['class']))?"class={$extra_opts['class']}":'';
+ $optjs = (isset($extra_opts['optjs']))?"{$extra_opts['optjs']}":'';
?>
- <input type="submit" value="<?php echo $label?>" name="<?php echo $name ?>" tabindex="<?php echo ++$shn_tabindex?>" <?php echo $class ?> />
+ <input type="submit" value="<?php echo $label?>" name="<?php echo $name ?>" tabindex="<?php echo ++$shn_tabindex?>" <?php echo $class ?> <?php echo $optjs ?> />
<?php
}
@@ -79,20 +79,25 @@ public function act_field_customization()
}
//if update is sent save data
- if($_POST['update']){
- form_customization_process_entity_form($this->entity_select);
+ //OES-28. By pressing enter forms submited. if there no reset nor update - entered data will be lost.
+ //so better to save changes. update by default
+ //if($_POST['update']){
+ if('POST'==$_SERVER['REQUEST_METHOD']){
+ form_customization_process_entity_form($this->entity_select);
}
if(isset($_POST['reset']) ){
form_customization_reset_all($this->entity_select);
}
+ // OES-28
$reset_fields = form_customization_get_reset_fields();
foreach( $reset_fields as $post_value=>$table_field ){
if(isset($_POST[$post_value])){
form_customization_reset_field($this->entity_select , $table_field );
}
}
+
//include field form
include_once APPROOT.'mod/admin/entity_form.inc';
@@ -5,8 +5,8 @@ $entity_select = $_REQUEST['entity_select'];
$entity_form = array (
'update'=>array('type'=>'submit','label'=>_t('UPDATE_FORM')),
'entity_select'=>array('type'=>'hidden','extra_opts'=>array('value'=>$entity_select, 'class'=>'data_save')),
- 'reset' => array('type' => 'submit', 'label' => _t("RESET_ALL")),
- 'reset_label' => array('type' => 'submit', 'label' => _t("RESET")),
+ 'reset' => array('type' => 'submit', 'label' => _t("RESET_ALL"),'extra_opts'=>array('optjs'=>'onclick="return confirm(\'Are you sure?\')"')),
+ //OES-28 remove relet label 'reset_label' => array('type' => 'submit', 'label' => _t("RESET")),
'reset_visible_new' => array('type' => 'submit', 'label' => _t("RESET")),
'reset_visible_view' => array('type' => 'submit', 'label' => _t("RESET")) ,
'reset_visible_search' => array('type' => 'submit', 'label' => _t("RESET")) ,
View
@@ -0,0 +1,2 @@
+User-agent: *
+Disallow: /

0 comments on commit 369c296

Please sign in to comment.