Explorar el Código

changed inline edit to json response

Piotr Labudda hace 10 años
padre
commit
995b058012
Se han modificado 1 ficheros con 10 adiciones y 11 borrados
  1. 10 11
      SE/se-lib/TableAjax.php

+ 10 - 11
SE/se-lib/TableAjax.php

@@ -3686,13 +3686,7 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
 				break;
 			}
 			case 'EDIT_INLINE': {
-				$id = V::get('ID', 0, $_REQUEST, 'int');
-				$col = V::get('col', '', $_REQUEST);
-				if ($id > 0 && !empty($col)) {
-					$this->sendAjaxEditInline($id, $col, $_REQUEST);
-				} else {
-					echo '404';
-				}
+				$this->sendAjaxResponseJson('ajaxInlineEdit', $_REQUEST);
 				break;
 			}
 			case 'EDIT_INLINE_SAVE': {
@@ -3817,10 +3811,16 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
 	 * @param $rowID - $_GET['ID']
 	 * @param $fieldName - $_GET['col']
 	 */
-	private function sendAjaxEditInline($rowID, $fieldName, $args) {
+	private function ajaxInlineEdit() {
 		$DBG = ('1' == V::get('DBG', '', $_REQUEST));
+
+		$args = $_REQUEST;
+		$rowID = V::get('ID', 0, $_REQUEST, 'int');
+		$fieldName = V::get('col', '', $_REQUEST);
+
+		if ($rowID <= 0 || empty($fieldName)) throw new HttpException("404", 404);
+
 		$response = array();
-		header("Content-type: application/json");
 
 		ob_start();
 		$fieldID = $this->_acl->getFieldIdByName($fieldName);
@@ -3915,8 +3915,7 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
 
 		$response['legacy_html'] = ob_get_clean();
 		//$response['legacy_html'] = utf8_encode($response['legacy_html']);// pl chars bug
-		echo json_encode($response);
-		exit;
+		return $response;
 	}
 
 	private function ajaxEditInlineSave($args) {