- Timestamp:
- 11/17/11 03:43:50 (6 months ago)
- Location:
- trunk/inc
- Files:
-
- 3 edited
-
classes/BxDolForm.php (modified) (3 diffs)
-
js/classes/BxDolGrid.js (modified) (3 diffs)
-
utils.inc.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/inc/classes/BxDolForm.php
r15599 r15682 175 175 } 176 176 177 function insert ($aValsToAdd = array() ) {177 function insert ($aValsToAdd = array(), $isIgnore = false) { 178 178 $oChecker = new BxDolFormChecker($this->_sCheckerHelper); 179 179 $oChecker->setFormMethod($this->aFormAttrs['method']); 180 $sSql = $oChecker->dbInsert($this->aParams['db'], $this->aInputs, $aValsToAdd );180 $sSql = $oChecker->dbInsert($this->aParams['db'], $this->aInputs, $aValsToAdd, $isIgnore); 181 181 if (!$sSql) return false; 182 182 if (db_res ($sSql)) … … 434 434 foreach ($aInputs as $k => $a) { 435 435 if (!isset ($a['db'])) continue; 436 $valClean = $this->get ($a['name'], $a['db']['pass'], $a['db']['params']? $a['db']['params'] : array());436 $valClean = $this->get ($a['name'], $a['db']['pass'], !empty($a['db']['params']) ? $a['db']['params'] : array()); 437 437 $s .= $oDb->prepare("`{$a['name']}` = ?,", $valClean); 438 438 $aInputs[$k]['db']['value'] = $valClean; … … 444 444 } 445 445 446 function dbInsert (&$aDb, &$aInputs, $aValsToAdd = array() ) {446 function dbInsert (&$aDb, &$aInputs, $aValsToAdd = array(), $isIgnore = false) { 447 447 if (!$aDb['table']) return ''; 448 448 $sFields = $this->serializeDbValues ($aInputs, $aValsToAdd); 449 449 if (!$sFields) return ''; 450 return "INSERT INTO `{$aDb['table']}` SET $sFields";450 return "INSERT " . ($isIgnore ? 'IGNORE' : '') . " INTO `{$aDb['table']}` SET $sFields"; 451 451 } 452 452 -
trunk/inc/js/classes/BxDolGrid.js
r15675 r15682 11 11 this._sIdTable = 'bx-grid-table-' + sObject; 12 12 this._oOptions = oOptions; 13 this._sFilter = ''; 14 this._sOrderField = ''; 15 this._sOrderDir = 'ASC'; 16 this._sSearchInputText = ''; 13 this._sFilter = undefined == oOptions.filter ? '' : oOptions.filter; 14 this._sOrderField = undefined == oOptions.order_field ? '' : oOptions.order_field; 15 this._sOrderDir = undefined == oOptions.order_dir ? 'ASC' : oOptions.order_dir; 16 this._sSearchInputText = undefined == oOptions.text_search_input ? '' : oOptions.text_search_input; 17 this._oPopupOptions = {}; 18 19 if (this._sFilter.length) 20 this._sSearchInputText = this._sFilter; 21 22 $('#bx-grid-search-' + this._sObject).val(this._sSearchInputText); 17 23 18 24 this._onDataReloaded(); 19 } 20 21 BxDolGrid.prototype.setSearchInputText = function (sText) { 22 this._sSearchInputText = sText; 25 26 if (this._sOrderField.length) 27 this.setSorting (this._sOrderField, this._sOrderDir, true); 23 28 } 24 29 … … 173 178 174 179 if (typeof(isDisableLoading) == 'undefined' || !isDisableLoading) 175 bx_loading(this._sIdContainer,true);180 this.loading(true); 176 181 177 182 $.getJSON(sUrl, function (oData) { 178 179 if (typeof(isDisableLoading) == 'undefined' || !isDisableLoading) 180 bx_loading($this._sIdContainer, false); 181 182 if (oData && undefined != oData.grid) { 183 $('#' + $this._sIdContainer).html(oData.grid); 184 $this._onDataReloaded(true); 185 } 186 if (oData && undefined != oData.msg) { 187 alert(oData.msg); 188 } 189 if (oData && undefined != oData.popup) { 190 alert('TODO: popup'); 191 } 192 193 }); 194 183 $this.processJson(oData, sAction, isDisableLoading); 184 }); 185 186 } 187 188 BxDolGrid.prototype.processJson = function (oData, sAction, isDisableLoading) { 189 if (typeof(isDisableLoading) == 'undefined' || !isDisableLoading) 190 this.loading(false); 191 192 if (oData && undefined != oData.grid) { 193 $('#' + this._sIdContainer).html(oData.grid); 194 this._onDataReloaded(true); 195 } 196 if (oData && undefined != oData.msg) { 197 alert(oData.msg); 198 } 199 if (oData && undefined != oData.blink) { 200 if ('object' == typeof(oData.blink)) { 201 for(var i in oData.blink) 202 this.blink(this._sObject + '_row_' + oData.blink[i]); 203 } else { 204 this.blink(this._sObject + '_row_' + oData.blink); 205 } 206 } 207 if (oData && undefined != oData.popup) { 208 var sId = 'grid-popup-' + this._sObject + '-' + sAction; 209 $('#' + sId).remove(); 210 $('<div id="' + sId + '" style="display: none;"></div>').prependTo('body').html(oData.popup); 211 $('#' + sId).dolPopup(this._oPopupOptions); 212 } 213 } 214 215 BxDolGrid.prototype.loading = function (bShow) { 216 bx_loading(this._sIdContainer, bShow); 195 217 } 196 218 … … 236 258 var sAction = $(this).attr('bx_grid_action_independent'); 237 259 var sActionConfirm = $(this).attr('bx_grid_action_confirm'); 238 $this.action (sAction Data, sAction, {}, '', false, sActionConfirm);260 $this.action (sAction, {}, '', false, sActionConfirm); 239 261 }); 240 262 -
trunk/inc/utils.inc.php
r15675 r15682 1135 1135 } 1136 1136 1137 function bx_append_url_params ($sUrl, $ aParams) {1137 function bx_append_url_params ($sUrl, $mixedParams) { 1138 1138 $sParams = false == strpos($sUrl, '?') ? '?' : '&'; 1139 foreach($aParams as $sKey => $sValue) 1140 $sParams .= $sKey . '=' . $sValue . '&'; 1141 $sParams = substr($sParams, 0, -1); 1139 1140 if (is_array($mixedParams)) { 1141 foreach($mixedParams as $sKey => $sValue) 1142 $sParams .= $sKey . '=' . $sValue . '&'; 1143 $sParams = substr($sParams, 0, -1); 1144 } else { 1145 $sParams .= $mixedParams; 1146 } 1142 1147 return $sUrl . $sParams; 1143 1148 }
Note: See TracChangeset
for help on using the changeset viewer.