Changeset 1452899
- Timestamp:
- 07/11/2016 06:44:39 PM (10 years ago)
- Location:
- admin-builder/trunk
- Files:
-
- 7 edited
-
admin_builder.php (modified) (1 diff)
-
css/style.css (modified) (1 diff)
-
inc/abFields.php (modified) (3 diffs)
-
inc/abGeneral.php (modified) (1 diff)
-
inc/abMeta.php (modified) (2 diffs)
-
js/script.js (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
admin-builder/trunk/admin_builder.php
r1449741 r1452899 4 4 Plugin URI: http://admin-builder.com 5 5 Description: A plugin that generates admin panel pages & posts,sidebars,custom admin pages with tabs, custom post types, meta boxes and fields (with unlimited textbox, textarea, checkbox, custom select (dropdown box), datepicker, timepicker, colorpicker, upload media fields, with configurable options) Based on what's exported from http://admin-builder.com 6 Version: 1.1 6 Version: 1.1.1 7 7 Author: rootabout 8 8 Author URI: http://admin-builder.com -
admin-builder/trunk/css/style.css
r1449741 r1452899 60 60 margin: 20px auto; 61 61 } 62 .groupContainer{ 63 position: relative; 64 margin:20px 0; 65 padding:20px; 66 background:#d7d7d7; 67 } 68 button.close{ 69 position: absolute; 70 right:0px; 71 top:0px; 72 padding:5px; 73 float:right; 74 margin:5px; 75 font-size: 18px; 76 color:#9e1c1c; 77 opacity: 1; 78 } 79 button.close:hover{ 80 background: #9e1c1c;; 81 opacity: 1; 82 padding:5px; 83 color:#FFF; 84 } -
admin-builder/trunk/inc/abFields.php
r1449741 r1452899 7 7 { 8 8 $sGeneral = new GeneralFunctionality(); 9 9 10 switch ($fType) { 10 11 case 'cPage': … … 232 233 $fieldHTML .= '<input type="hidden" class="abBIHidden" name="'.$fieldName.'" value="'.$fieldValue.'" />'; 233 234 break; 235 case 'textboxesDynamic': 236 // $sGeneral->showArr($fieldValue); 237 238 $oArr = (isset($field['oArr']))?$field['oArr']:array(); 239 $fieldHTML .= '<div class="hidden tbdContent">'; 240 $fieldHTML .= '<div class="groupContainer">'; 241 $fieldHTML .= '<button type="button" class="btn btn-primary close">X</button>'; 242 foreach ($oArr as $key) { 243 $fieldHTML .= $this->dtGenerate($key->label,$fieldName,null,null,$key->value); 244 } 245 $fieldHTML .= '</div>'; 246 $fieldHTML .= '</div>'; 247 248 $imgAlt = ''; 249 $fieldHTML .= '<div class="tdOutput">'; 250 // $sGeneral->showArr($fieldValue); 251 252 if(is_array($fieldValue)){ 253 // 254 $i=0; 255 256 foreach ($fieldValue as $fv) { 257 $fieldHTML .= '<div class="groupContainer">'; 258 $fieldHTML .= '<button type="button" class="btn btn-primary close">X</button>'; 259 foreach ($oArr as $key=>$val) { 260 $fieldValue = (isset($fv[$val->value]))?$fv[$val->value]:''; 261 $fieldHTML .= $this->dtGenerate($val->label,$fieldName,$fv[$val->value],$i,$val->value); 262 } 263 $fieldHTML .= '</div>'; 264 $i++; 265 } 266 } 267 268 $fieldHTML .= '</div>'; 269 $fieldHTML .= '<p><button type="button" class="tbdAdd btn btn-primary">Add Row</button><br/></p>'; 270 break; 234 271 } 235 272 ?> … … 249 286 250 287 } 288 //dynamic textbox generate 289 private function dtGenerate($label,$name,$value,$index=null,$attr=null){ 290 $arrName = $name; 291 $origNameStr = 'origName="'.$name.'" '; 292 if($index!== null && !empty($attr) && !empty($attr)){ 293 $arrName = $name.'['.$index.']['.$attr.']'; 294 } 295 296 $attrStr = ''; 297 if($attr!=null && !empty($attr)){ 298 $attrStr = 'dtArrName="'.$attr.'" '; 299 } 300 $fieldHTML = '<div class="form-group">'; 301 $fieldHTML .= '<label for="'.$name.'">'.$label.'</label>'; 302 $fieldHTML .= '<input type="text" name="'.$arrName.'" '.$origNameStr.' class="form-control" '.$attrStr.' placeholder="Please enter '.$label.'" value="'.$value.'">'; 303 $fieldHTML .= '</div>'; 304 return $fieldHTML; 305 } 251 306 } 252 307 } -
admin-builder/trunk/inc/abGeneral.php
r1449741 r1452899 22 22 //version 23 23 $dataArrSettings = $dataArr['sett']; 24 24 25 $data = stripslashes($dataArrSettings); 25 26 $dataArrSettings = json_decode($data); -
admin-builder/trunk/inc/abMeta.php
r1449741 r1452899 132 132 133 133 // set the new value to a variable 134 $new_meta_value = (isset($_POST[$fieldName]) ? $_POST[$fieldName] : ''); 135 // $this->showArr($value); 134 $new_meta_value = (isset($_POST[$fieldName]) ? $_POST[$fieldName] : '0'); 136 135 # code... 137 136 /* Get the meta key. */ … … 140 139 /* Get the meta value of the custom field key. */ 141 140 $meta_value = get_post_meta($post_id, $meta_key, true); 141 if(is_array($new_meta_value)){ 142 $tempNewMetaValue = array(); 143 foreach ($new_meta_value as $key => $value) { 144 $tempNewMetaValue[]=$value; 145 } 146 $new_meta_value = $tempNewMetaValue; 147 } 142 148 143 149 /* If a new meta value was added and there was no previous value, add it. */ 144 if ($new_meta_value != '' && '' == $meta_value) { 145 add_post_meta($post_id, $meta_key, $new_meta_value); 146 } /* If the new meta value does not match the old value, update it. */ 147 elseif ($new_meta_value !== $meta_value) { 150 if ($new_meta_value !== $meta_value) { 148 151 update_post_meta($post_id, $meta_key, $new_meta_value); 149 152 } /* If there is no new meta value but an old value exists, delete it. */ -
admin-builder/trunk/js/script.js
r1449741 r1452899 104 104 } 105 105 106 // textboxesDynamic functionality START 107 var tbdAdd = $('.tbdAdd'); //add row button 108 if(tbdAdd[0]){ 109 tbdAdd.click(function(){ 110 var tbdContent = $(this).parent().siblings('.tbdContent'); 111 var tdOutput = $(this).parent().siblings('.tdOutput'); 112 tbdContentHTML = tbdContent.html(); 113 //get the number of dynamic field groups added 114 var size = tdOutput.find('.groupContainer').size(); 115 116 var tbdContentHTMLObj = $('<div>'+tbdContentHTML+'</div>'); 117 118 //get all the inputs of the hidden html 119 var dtContInputs = tbdContentHTMLObj.find('input'); 120 //for each input 121 dtContInputs.each(function(index,i){ 122 var thisInput = $(this); 123 var inputAttr = thisInput.attr('dtArrName'); 124 if(inputAttr[0]){ 125 var thisInputName = thisInput.attr('origName'); 126 var newInputName = thisInputName+'['+size+']['+inputAttr+']'; 127 //set the new name to the input 128 thisInput.attr('name',newInputName); 129 } 130 }); 131 // console.log(size); 132 tbdContentHTML = tbdContentHTMLObj.html(); 133 tdOutput.append(tbdContentHTML); 134 }); 135 } 136 // close button for dynamic fields containers 137 var dtClose = $('.groupContainer button.close'); 138 if(dtClose[0]){ 139 dtClose.live('click',function(){ 140 var cThis = $(this);//current this 141 var cc = cThis.parent().parent(); 142 cThis.parent().remove(); 143 dtGenerateNames(cc); 144 145 }); 146 } 147 function dtGenerateNames(parObj){ 148 var groupContainers = parObj.find('.groupContainer'); 149 groupContainers.each(function(cIndex,i){ 150 var gcThis = $(this); 151 var inputs = gcThis.find('input'); 152 inputs.each(function(iIndex,i){ 153 var iThis = $(this); //this input 154 var origName = iThis.attr('origName'); 155 var dtArrName = iThis.attr('dtArrName'); 156 iThis.attr('name',origName+'['+cIndex+']['+dtArrName+']'); 157 }); 158 }); 159 } 106 160 }); -
admin-builder/trunk/readme.txt
r1449741 r1452899 5 5 Requires at least: 4.0 6 6 Tested up to: 4.5 7 Stable tag: 1.1 7 Stable tag: 1.1.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 154 154 Interpreting new export functionality for themes and plugins, integrated into the plugin. 155 155 156 = 1.1.1 = 157 Added Dynamic Textboxes functionality for custom post types and admin pages. You can create unlimited dynamic text boxes of unlimited dynamic text boxes now. 158 159 156 160 == Arbitrary section == 157 161
Note: See TracChangeset
for help on using the changeset viewer.