Bug #19797 » 0010104.patch

Administrator Admin, 2009-01-12 16:31

View differences:

t3lib/class.t3lib_tceforms_inline.php (Arbeitskopie)
1081 1081

  
1082 1082

  
1083 1083
	/**
1084
	 * Generates an error message that transferred as JSON for AJAX calls
1085
	 *
1086
	 * @param	string		$message: The error message to be shown
1087
	 * @return	array		The error message in a JSON array
1088
	 */
1089
	protected function getErrorMessageForAJAX($message) {
1090
		$jsonArray = array(
1091
			'data'	=> $message,
1092
			'scriptCall' => array(
1093
				'alert("' . $message . '");'
1094
			)
1095
		);
1096
		return $jsonArray;
1097
	}
1098

  
1099

  
1100
	/**
1084 1101
	 * Handle AJAX calls to show a new inline-record of the given table.
1085 1102
	 * Normally this method is never called from inside TYPO3. Always from outside by AJAX.
1086 1103
	 *
......
1094 1111
			// the parent table - this table embeds the current table
1095 1112
		$parent = $this->getStructureLevel(-1);
1096 1113
			// get TCA 'config' of the parent table
1114
		if (!$this->checkConfiguration($parent['config'])) {
1115
			return $this->getErrorMessageForAJAX('Wrong configuration in table ' . $parent['table']);
1116
		}
1097 1117
		$config = $parent['config'];
1118

  
1098 1119
		$collapseAll = (isset($config['appearance']['collapseAll']) && $config['appearance']['collapseAll']);
1099 1120
		$expandSingle = (isset($config['appearance']['expandSingle']) && $config['appearance']['expandSingle']);
1100 1121

  
......
1136 1157
			// render the foreign record that should passed back to browser
1137 1158
		$item = $this->renderForeignRecord($parent['uid'], $record, $config);
1138 1159
		if($item === false) {
1139
			$jsonArray = array(
1140
				'data'	=> 'Access denied',
1141
				'scriptCall' => array(
1142
					"alert('Access denied');",
1143
				)
1144
			);
1145
			return $jsonArray;
1160
			return $this->getErrorMessageForAJAX('Access denied');
1146 1161
		}
1147 1162

  
1148 1163
			// Encode TCEforms AJAX response with utf-8:
(2-2/2)