mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
Fixed important issue with row styling
This commit is contained in:
@@ -170,8 +170,13 @@ function UM_Rows_Refresh(){
|
||||
|
||||
sub_rows_count = row.find('.um-admin-drag-rowsub').length;
|
||||
|
||||
var origin_id = jQuery(this).attr('data-original');
|
||||
|
||||
jQuery('.um_update_order_fields').append('<input type="hidden" name="_um_row_'+c+'" id="_um_row_'+c+'" value="_um_row_'+c+'" />');
|
||||
jQuery('.um_update_order_fields').append('<input type="hidden" name="_um_roworigin_'+c+'_val" id="_um_roworigin_'+c+'_val" value="'+origin_id+'" />');
|
||||
jQuery('.um_update_order_fields').append('<input type="hidden" name="_um_rowsub_'+c+'_rows" id="_um_rowsub_'+c+'_rows" value="'+sub_rows_count+'" />');
|
||||
|
||||
jQuery(this).attr('data-original', '_um_row_'+c );
|
||||
|
||||
});
|
||||
|
||||
@@ -300,6 +305,7 @@ jQuery(document).ready(function() {
|
||||
var dragg = jQuery('.um-admin-drag-ajax');
|
||||
dragg.append( '<div class="um-admin-drag-row">' + jQuery('.um-col-demon-row').html() + '</div>' );
|
||||
dragg.find('.um-admin-drag-row:last').find('.um-admin-drag-row-icons').find('a.um-admin-drag-row-edit').attr('data-arg3', '_um_row_' + ( dragg.find('.um-admin-drag-row').length ) );
|
||||
dragg.find('.um-admin-drag-row:last').attr('data-original', '_um_row_' + ( dragg.find('.um-admin-drag-row').length ) );
|
||||
UM_update_rows();
|
||||
UM_update_subrows();
|
||||
UM_Rows_Refresh();
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
$save[ $_metakey ]['icon'] = '';
|
||||
foreach( $array['post'] as $key => $val){
|
||||
|
||||
if ( substr( $key, 0, 1) === '_' && $val != '' ) { // field attribute
|
||||
if ( substr( $key, 0, 1) === '_' ) { // field attribute
|
||||
$new_key = ltrim ($key,'_');
|
||||
|
||||
if ( $new_key == 'options' ) {
|
||||
|
||||
@@ -78,6 +78,8 @@ class UM_Admin_Builder {
|
||||
***/
|
||||
function show_builder(){
|
||||
global $ultimatemember;
|
||||
|
||||
//print_r( get_option('um_form_rowdata_' . $this->form_id ) );
|
||||
|
||||
$fields = $ultimatemember->query->get_attr('custom_fields', $this->form_id );
|
||||
|
||||
@@ -149,7 +151,7 @@ class UM_Admin_Builder {
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-admin-drag-row">
|
||||
<div class="um-admin-drag-row" data-original="<?php echo $row_id; ?>">
|
||||
|
||||
<!-- Master Row Actions -->
|
||||
<div class="um-admin-drag-row-icons">
|
||||
|
||||
@@ -32,14 +32,14 @@ class UM_Admin_DragDrop {
|
||||
unset( $fields[$key] );
|
||||
}
|
||||
}
|
||||
|
||||
update_option('um_form_rowdata_' . $form_id , $this->row_data );
|
||||
|
||||
|
||||
foreach( $_POST as $key => $value ) {
|
||||
|
||||
// adding rows
|
||||
if (0 === strpos($key, '_um_row_')) {
|
||||
|
||||
$update_args = null;
|
||||
|
||||
$row_id = str_replace( '_um_row_', '', $key );
|
||||
|
||||
$row_array = array(
|
||||
@@ -47,14 +47,23 @@ class UM_Admin_DragDrop {
|
||||
'id' => $value,
|
||||
'sub_rows' => $_POST[ '_um_rowsub_'.$row_id .'_rows' ],
|
||||
'cols' => $_POST[ '_um_rowcols_'.$row_id .'_cols' ],
|
||||
'origin' => $_POST[ '_um_roworigin_'.$row_id . '_val' ],
|
||||
);
|
||||
|
||||
if ( isset( $this->row_data[$key] ) ) {
|
||||
$row_args = array_merge( $this->row_data[$key], $row_array );
|
||||
} else {
|
||||
$row_args = $row_array;
|
||||
}
|
||||
$row_args = $row_array;
|
||||
|
||||
if ( isset( $this->row_data[ $row_array['origin'] ] ) ) {
|
||||
foreach( $this->row_data[ $row_array['origin'] ] as $k => $v ){
|
||||
if ( $k != 'position' && $k != 'metakey' ) {
|
||||
$update_args[$k] = $v;
|
||||
}
|
||||
}
|
||||
if ( isset( $update_args ) ) {
|
||||
$row_args = array_merge( $update_args, $row_array );
|
||||
}
|
||||
$this->exist_rows[] = $key;
|
||||
}
|
||||
|
||||
$fields[$key] = $row_args;
|
||||
|
||||
}
|
||||
@@ -101,6 +110,15 @@ class UM_Admin_DragDrop {
|
||||
|
||||
}
|
||||
|
||||
foreach( $this->row_data as $k => $v ) {
|
||||
if ( !in_array( $k, $this->exist_rows ) )
|
||||
unset( $this->row_data[$k] );
|
||||
}
|
||||
|
||||
update_option('um_existing_rows_' . $form_id, $this->exist_rows );
|
||||
|
||||
update_option('um_form_rowdata_' . $form_id , $this->row_data );
|
||||
|
||||
$ultimatemember->query->update_attr( 'custom_fields', $form_id, $fields );
|
||||
|
||||
}
|
||||
|
||||
+78
-110
@@ -1630,64 +1630,11 @@ class UM_Fields {
|
||||
// master rows
|
||||
foreach ( $this->rows as $row_id => $row_array ) {
|
||||
|
||||
extract($row_array);
|
||||
|
||||
$background = null;
|
||||
$padding = null;
|
||||
$margin = null;
|
||||
$borderradius = null;
|
||||
$heading_background_color = null;
|
||||
$heading_padding = null;
|
||||
$heading_text_color = null;
|
||||
$heading_borderradius = null;
|
||||
$border = null;
|
||||
$bordercolor = null;
|
||||
$borderstyle = null;
|
||||
|
||||
// row css rules
|
||||
if ( isset($row_array['padding']) ) $padding = 'padding: ' . $row_array['padding'] .';';
|
||||
if ( isset($row_array['margin']) ) {
|
||||
$margin = 'margin: ' . $row_array['margin'] .';';
|
||||
} else {
|
||||
$margin = 'margin: 0 0 30px 0;';
|
||||
}
|
||||
if ( isset($row_array['background']) ) $background = 'background-color: ' . $row_array['background'] .';';
|
||||
if ( isset($row_array['borderradius']) ) $borderradius = 'border-radius: 0px 0px ' . $row_array['borderradius'] . ' ' . $row_array['borderradius'] . ';';
|
||||
if ( isset($row_array['border']) ) $border = 'border-width: ' . $row_array['border'] . ';';
|
||||
if ( isset($row_array['bordercolor']) ) $bordercolor = 'border-color: ' . $row_array['bordercolor'] . ';';
|
||||
if ( isset($row_array['borderstyle']) ) $borderstyle = 'border-style: ' . $row_array['borderstyle'] . ';';
|
||||
|
||||
// show the heading
|
||||
if ( isset( $row_array['heading'] ) && $row_array['heading'] == 1 ) {
|
||||
|
||||
if ( isset($row_array['heading_background_color']) ) {
|
||||
$heading_background_color = 'background-color: ' . $row_array['heading_background_color'] .';';
|
||||
$heading_padding = 'padding: 10px 15px;';
|
||||
}
|
||||
|
||||
if ( isset($row_array['heading_text_color']) ) $heading_text_color = 'color: ' . $row_array['heading_text_color'] .';';
|
||||
if ( isset($row_array['borderradius']) ) $heading_borderradius = 'border-radius: ' . $row_array['borderradius'] . ' ' . $row_array['borderradius'] . ' 0px 0px;';
|
||||
|
||||
$output .= '<div class="um-row-heading" style="' . $heading_background_color . $heading_padding . $heading_text_color . $heading_borderradius . '">';
|
||||
if ( isset( $row_array['icon'] ) ) $output .= '<span class="um-row-heading-icon"><i class="'.$row_array['icon'].'"></i></span>';
|
||||
$output .= $row_array['heading_text'] .'</div>';
|
||||
|
||||
} else {
|
||||
|
||||
// no heading
|
||||
if ( isset($row_array['borderradius']) ) $borderradius = 'border-radius: ' . $row_array['borderradius'] . ';';
|
||||
|
||||
}
|
||||
|
||||
// start row
|
||||
$row_fields = $this->get_fields_by_row( $row_id );
|
||||
if ( $row_fields ) {
|
||||
|
||||
if ( !$row_fields ) return;
|
||||
$output .= $this->new_row_output( $row_id, $row_array );
|
||||
|
||||
$custom_row_class = (isset($row_array['css_class'])) ? $row_array['css_class'] : '';
|
||||
|
||||
$output .= '<div class="um-row ' . $row_id . ' ' . $custom_row_class . '" style="'. $padding . $background . $margin . $border . $borderstyle . $bordercolor . $borderradius . '">';
|
||||
|
||||
$sub_rows = ( isset( $row_array['sub_rows'] ) ) ? $row_array['sub_rows'] : 1;
|
||||
for( $c = 0; $c < $sub_rows; $c++ ) {
|
||||
|
||||
@@ -1763,6 +1710,8 @@ class UM_Fields {
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1914,63 +1863,10 @@ class UM_Fields {
|
||||
// master rows
|
||||
foreach ( $this->rows as $row_id => $row_array ) {
|
||||
|
||||
extract($row_array);
|
||||
|
||||
$background = null;
|
||||
$padding = null;
|
||||
$margin = null;
|
||||
$borderradius = null;
|
||||
$heading_background_color = null;
|
||||
$heading_padding = null;
|
||||
$heading_text_color = null;
|
||||
$heading_borderradius = null;
|
||||
$border = null;
|
||||
$bordercolor = null;
|
||||
$borderstyle = null;
|
||||
|
||||
// row css rules
|
||||
if ( isset($row_array['padding']) ) $padding = 'padding: ' . $row_array['padding'] .';';
|
||||
if ( isset($row_array['margin']) ) {
|
||||
$margin = 'margin: ' . $row_array['margin'] .';';
|
||||
} else {
|
||||
$margin = 'margin: 0 0 30px 0;';
|
||||
}
|
||||
if ( isset($row_array['background']) ) $background = 'background-color: ' . $row_array['background'] .';';
|
||||
if ( isset($row_array['borderradius']) ) $borderradius = 'border-radius: 0px 0px ' . $row_array['borderradius'] . ' ' . $row_array['borderradius'] . ';';
|
||||
if ( isset($row_array['border']) ) $border = 'border-width: ' . $row_array['border'] . ';';
|
||||
if ( isset($row_array['bordercolor']) ) $bordercolor = 'border-color: ' . $row_array['bordercolor'] . ';';
|
||||
if ( isset($row_array['borderstyle']) ) $borderstyle = 'border-style: ' . $row_array['borderstyle'] . ';';
|
||||
|
||||
// show the heading
|
||||
if ( isset( $row_array['heading'] ) && $row_array['heading'] == 1 ) {
|
||||
|
||||
if ( isset($row_array['heading_background_color']) ) {
|
||||
$heading_background_color = 'background-color: ' . $row_array['heading_background_color'] .';';
|
||||
$heading_padding = 'padding: 10px 15px;';
|
||||
}
|
||||
|
||||
if ( isset($row_array['heading_text_color']) ) $heading_text_color = 'color: ' . $row_array['heading_text_color'] .';';
|
||||
if ( isset($row_array['borderradius']) ) $heading_borderradius = 'border-radius: ' . $row_array['borderradius'] . ' ' . $row_array['borderradius'] . ' 0px 0px;';
|
||||
|
||||
$output .= '<div class="um-row-heading" style="' . $heading_background_color . $heading_padding . $heading_text_color . $heading_borderradius . '">';
|
||||
if ( isset( $row_array['icon'] ) ) $output .= '<span class="um-row-heading-icon"><i class="'.$row_array['icon'].'"></i></span>';
|
||||
$output .= $row_array['heading_text'] .'</div>';
|
||||
|
||||
} else {
|
||||
|
||||
// no heading
|
||||
if ( isset($row_array['borderradius']) ) $borderradius = 'border-radius: ' . $row_array['borderradius'] . ';';
|
||||
|
||||
}
|
||||
|
||||
// start row
|
||||
$row_fields = $this->get_fields_by_row( $row_id );
|
||||
if ( $row_fields ) {
|
||||
|
||||
if ( !$row_fields ) return;
|
||||
|
||||
$custom_row_class = (isset($row_array['css_class'])) ? $row_array['css_class'] : '';
|
||||
|
||||
$output .= '<div class="um-row ' . $row_id . ' ' . $custom_row_class . '" style="'. $padding . $background . $margin . $border . $borderstyle . $bordercolor . $borderradius . '">';
|
||||
$output .= $this->new_row_output( $row_id, $row_array );
|
||||
|
||||
$sub_rows = ( isset( $row_array['sub_rows'] ) ) ? $row_array['sub_rows'] : 1;
|
||||
for( $c = 0; $c < $sub_rows; $c++ ) {
|
||||
@@ -2047,6 +1943,8 @@ class UM_Fields {
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2054,5 +1952,75 @@ class UM_Fields {
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @begin new row in form
|
||||
***/
|
||||
function new_row_output( $row_id, $row_array ) {
|
||||
$output = null;
|
||||
extract($row_array);
|
||||
|
||||
$padding = (isset($padding))?$padding:'';
|
||||
$margin = (isset($margin))?$margin:'';
|
||||
$background = (isset($background))?$background:'';
|
||||
$borderradius = (isset($borderradius))?$borderradius:'';
|
||||
$border = (isset($border))?$border:'';
|
||||
$bordercolor = (isset($bordercolor))?$bordercolor:'';
|
||||
$borderstyle = (isset($borderstyle))?$borderstyle:'';
|
||||
$heading = (isset($heading))?$heading:'';
|
||||
$css_class = (isset($css_class))?$css_class:'';
|
||||
|
||||
$css_padding = '';
|
||||
$css_margin = '';
|
||||
$css_background = '';
|
||||
$css_borderradius = '';
|
||||
$css_border = '';
|
||||
$css_bordercolor = '';
|
||||
$css_borderstyle = '';
|
||||
$css_heading_background_color = '';
|
||||
$css_heading_padding = '';
|
||||
$css_heading_text_color = '';
|
||||
$css_heading_borderradius = '';
|
||||
|
||||
// row css rules
|
||||
if ( $padding ) $css_padding = 'padding: ' . $padding .';';
|
||||
if ( $margin ) {
|
||||
$css_margin = 'margin: ' . $margin .';';
|
||||
} else {
|
||||
$css_margin = 'margin: 0 0 30px 0;';
|
||||
}
|
||||
|
||||
if ( $background ) $css_background = 'background-color: ' . $background .';';
|
||||
if ( $borderradius ) $css_borderradius = 'border-radius: 0px 0px ' . $borderradius . ' ' . $borderradius . ';';
|
||||
if ( $border ) $css_border = 'border-width: ' . $border . ';';
|
||||
if ( $bordercolor ) $css_bordercolor = 'border-color: ' . $bordercolor . ';';
|
||||
if ( $borderstyle ) $css_borderstyle = 'border-style: ' . $borderstyle . ';';
|
||||
|
||||
// show the heading
|
||||
if ( $heading ) {
|
||||
|
||||
if ( $heading_background_color ) {
|
||||
$css_heading_background_color = 'background-color: ' . $heading_background_color .';';
|
||||
$css_heading_padding = 'padding: 10px 15px;';
|
||||
}
|
||||
|
||||
if ( $heading_text_color ) $css_heading_text_color = 'color: ' . $heading_text_color .';';
|
||||
if ( $borderradius ) $css_heading_borderradius = 'border-radius: ' . $borderradius . ' ' . $borderradius . ' 0px 0px;';
|
||||
|
||||
$output .= '<div class="um-row-heading" style="' . $css_heading_background_color . $css_heading_padding . $css_heading_text_color . $css_heading_borderradius . '">';
|
||||
if ( $icon ) $output .= '<span class="um-row-heading-icon"><i class="' . $icon . '"></i></span>';
|
||||
$output .= $heading_text .'</div>';
|
||||
|
||||
} else {
|
||||
|
||||
// no heading
|
||||
if ( $borderradius ) $css_borderradius = 'border-radius: ' . $borderradius . ';';
|
||||
|
||||
}
|
||||
|
||||
$output .= '<div class="um-row ' . $row_id . ' ' . $css_class . '" style="'. $css_padding . $css_background . $css_margin . $css_border . $css_borderstyle . $css_bordercolor . $css_borderradius . '">';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user