Bug #17468 » 0005956_v2.patch

Administrator Admin, 2007-08-05 13:57

View differences:

t3lib/class.t3lib_tceforms.php (Arbeitskopie)
282 282
	var $palettesRendered=array();				// During rendering of forms this will keep track of which palettes has already been rendered (so they are not rendered twice by mistake)
283 283
	var $hiddenFieldListArr = array();			// This array of fields will be set as hidden-fields instead of rendered normally! For instance palette fields edited in the top frame are set as hidden fields since the main form has to submit the values. The top frame actually just sets the value in the main form!
284 284
	var $requiredFields=array();				// Used to register input-field names, which are required. (Done during rendering of the fields). This information is then used later when the JavaScript is made.
285
	var $requiredDataTimeFields=array();		// Used to register input-field names, which are required an have a date/time as requirement. The information of this array is merged with $this->requiredFields later.
285 286
	var $requiredElements=array();				// Used to register the min and max number of elements for selectorboxes where that apply (in the "group" type for instance)
286 287
	var $renderDepth=0;							// Keeps track of the rendering depth of nested records.
287 288
	var $savedSchemes=array();					// Color scheme buffer.
......
1046 1047
		$size = t3lib_div::intInRange($config['size']?$config['size']:30,5,$this->maxInputWidth);
1047 1048
		$evalList = t3lib_div::trimExplode(',',$config['eval'],1);
1048 1049

  
1049

  
1050 1050
		if($this->renderReadonly || $config['readOnly'])  {
1051 1051
			$itemFormElValue = $PA['itemFormElValue'];
1052 1052
			if (in_array('date',$evalList))	{
......
1066 1066

  
1067 1067
		if (in_array('required',$evalList))	{
1068 1068
			$this->requiredFields[$table.'_'.$row['uid'].'_'.$field]=$PA['itemFormElName'];
1069
				// Mark this field for date/time disposal:
1070
			foreach ($evalList as $evalItem) {
1071
				if ($evalItem == 'date' || $evalItem == 'datetime' || $evalItem == 'time') {
1072
					$this->requiredDataTimeFields[$PA['itemFormElName']] = true;
1073
					break;
1074
				}
1075
			}
1069 1076
		}
1070 1077

  
1071 1078
		$paramsList = "'".$PA['itemFormElName']."','".implode(',',$evalList)."','".trim($config['is_in'])."',".(isset($config['checkbox'])?1:0).",'".$config['checkbox']."'";
......
4659 4666
				$field = $match[2];
4660 4667
				$elements[$record][$field]['required'] = 1;
4661 4668
				$elements[$record][$field]['requiredImg'] = $itemImgName;
4669
				if ($this->requiredDataTimeFields[$itemName]) {
4670
					$elements[$record][$field]['isDateTime'] = 1;
4671
				}
4662 4672
			}
4663 4673
		}
4664 4674
			// range:
t3lib/jsfunc.evalfield.js (Arbeitskopie)
77 77
	var theEvalType = this.split(evallist, ",", index);
78 78
	var newValue=value;
79 79
	while (theEvalType) {
80
		newValue = evalFunc.output(theEvalType, value, FObj);
80
		if (theEvalType != 'required') {
81
			newValue = evalFunc.output(theEvalType, value, FObj);
82
		}
81 83
		index++;
82 84
		theEvalType = this.split(evallist, ",", index);
83 85
	}
typo3/jsfunc.tbe_editor.js (Arbeitskopie)
44 44
					'requiredImg':	''
45 45
				}
46 46
			}
47
		
48 47
		},
49 48
	*/
50
	
49

  
51 50
	elements: {},
52 51
	recentUpdatedElements: {},
53 52
	actionChecks: { submit:	[] },
54
	
53

  
55 54
	formname: '',
56 55
	formnameUENC: '',
57 56
	loadTime: 0,
......
62 61
	prependFormFieldNames: 'data',
63 62
	prependFormFieldNamesUENC: 'data',
64 63
	prependFormFieldNamesCnt: 0,
65
	
64

  
66 65
	isPalettedoc: null,
67 66
	doSaveFieldName: 0,
68
	
67

  
69 68
	labels: {},
70 69
	images: {
71 70
		req: new Image(),
......
87 86
	getElement: function(record, field, type) {
88 87
		var result = null;
89 88
		var element;
90
		
89

  
91 90
		if (TBE_EDITOR.elements && TBE_EDITOR.elements[record] && TBE_EDITOR.elements[record][field]) {
92 91
			element = TBE_EDITOR.elements[record][field];
93 92
			if (type) {
......
96 95
				result = element;
97 96
			}
98 97
		}
99
		
98

  
100 99
		return result;
101 100
	},
102 101
	checkElements: function(type, recentUpdated, record, field) {
......
111 110
				if (elementData) {
112 111
					if (!TBE_EDITOR.checkElementByType(type, elementName, elementData)) result = 0;
113 112
				}
114
				
113

  
115 114
			} else {
116 115
				var elementFieldList, elRecIndex, elRecCnt, elFldIndex, elFldCnt;
117 116
				var elementRecordList = $H(source).keys();
......
129 128
				}
130 129
			}
131 130
		}
132
		
131

  
133 132
		return result;
134 133
	},
135 134
	checkElementByType: function(type, elementName, elementData) {
136 135
		var result = 1;
137
		
136

  
138 137
		if (type) {
139 138
			if (type == 'required') {
140
				if (!document[TBE_EDITOR.formname][elementName].value) {
139
				var value = document[TBE_EDITOR.formname][elementName].value;
140
				if (!value || value == '0' && elementData.isDateTime) {
141 141
					result = 0;
142 142
					TBE_EDITOR.setImage('req_'+elementData.requiredImg, TBE_EDITOR.images.req);
143 143
				}
......
156 156
				}
157 157
			}
158 158
		}
159
		
159

  
160 160
		return result;
161 161
	},
162 162
	addActionChecks: function(type, checks) {
163 163
		TBE_EDITOR.actionChecks[type].push(checks);
164 164
	},
165
	
165

  
166 166
	// Regular TCEforms JSbottom scripts:
167 167
	loginRefreshed: function() {
168 168
		var date = new Date();
......
224 224
				TBE_EDITOR.setImage(imgReqObjName,TBE_EDITOR.images.req);
225 225
			}
226 226
		}
227
		
227

  
228 228
		if (TBE_EDITOR.isPalettedoc) { TBE_EDITOR.setOriginalFormFieldValue(theField) };
229 229
	},
230 230
	setOriginalFormFieldValue: function(theField) {
......
274 274
		if (!TBE_EDITOR.checkElements('required', false)) { OK = 0; }
275 275
		// $reqRangeCheck
276 276
		if (!TBE_EDITOR.checkElements('range', false)) { OK = 0; }
277
				
277

  
278 278
		if (OK || sendAlert==-1) {
279 279
			return true;
280 280
		} else {
(3-3/5)