diff shared_view/includes/dojo/form/CheckboxSelect.tt @ 11:573272ec604b

almost comlete doxygen library
author sergey
date Thu, 15 May 2014 18:24:02 +0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shared_view/includes/dojo/form/CheckboxSelect.tt	Thu May 15 18:24:02 2014 +0400
@@ -0,0 +1,33 @@
+[%
+	BLOCK INIT;
+    	document.dojo.modules.push("dijit/form/CheckBox");
+    END;
+    IF metadata.inputType == 'password';
+    	value = '';
+    ELSE;
+    	value = metadata.inputValue;
+    END;
+    
+    selected = {};
+    
+    FOREACH item IN metadata.inputValue;
+    	selected.${item} = 1;
+    END;
+    
+    options = [];
+    valueField = "roleName";
+    labelField = "roleName";
+    
+    FOREACH item IN resource.GetDataSource(metadata.GetSchemaProperty('data-source-name')).data;
+    	options.push({
+    		label = item.$labelField,
+    		value = item.$valueField,
+    		selected = selected.${item.$labelField}
+    	});
+    END; 
+%]
+[% FOREACH option IN options %]
+	<div>
+		<input type="checkbox" name="$prefix" value="$option.value"[% IF option.selected %] checked="true"[% END %]/><span>$option.label</span>
+	</div>
+[% END %]
\ No newline at end of file