Project

General

Profile

« Previous | Next » 

Revision 2ef13b6c

Added by Stephen Beaver over 9 years ago

Fix "Save" button jQuery

View differences:

src/usr/local/www/pkg.php
206 206
<script type="text/javascript">
207 207
//<![CDATA[
208 208
events.push(function() {
209

  
209 210
	function setFilter(filtertext) {
210 211
		jQuery('#pkg_filter').val(filtertext);
211 212
		document.pkgform.submit();
212 213
	}
213 214

  
214
	<?php
215
		if ($pkg['adddeleteeditpagefields']['movable']) {
216
	?>
217
				$('#mainarea table tbody').sortable({
218
				items: 'tr.sortable',
219
					cursor: 'move',
220
					distance: 10,
221
					opacity: 0.8,
222
					helper: function(e, ui) {
223
						ui.children().each(function() {
224
							jQuery(this).width(jQuery(this).width());
225
						});
226
					return ui;
227
					},
215
<?php
216
	if ($pkg['adddeleteeditpagefields']['movable']) {
217
?>
218
		$('#mainarea table tbody').sortable({
219
		items: 'tr.sortable',
220
			cursor: 'move',
221
			distance: 10,
222
			opacity: 0.8,
223
			helper: function(e, ui) {
224
				ui.children().each(function() {
225
					jQuery(this).width(jQuery(this).width());
228 226
				});
227
			return ui;
228
			},
229
		});
230
<?php
231
	}
232
?>
233
});
229 234

  
230

  
231
			function save_changes_to_xml(xml) {
232
				var ids = $('#mainarea table tbody').sortable('serialize', {key:"ids[]"});
233
				var strloading="<?=gettext('Saving changes...')?>";
234
				if (confirm("<?=gettext("Do you really want to save changes?")?>")) {
235
					$.ajax({
236
						type: 'get',
237
						cache: false,
238
						url: "<?=$_SERVER['SCRIPT_NAME']?>",
239
						data: {xml:'<?=$xml?>', act:'update', ids: ids},
240
						beforeSend: function() {
241
							$('#savemsg').empty().html(strloading);
242
						},
243
						error: function(data) {
244
							$('#savemsg').empty().html('Error:' + data);
245
						},
246
						success: function(data) {
247
							$('#savemsg').empty().html(data);
248
						}
249
					});
235
<?php
236
if ($pkg['adddeleteeditpagefields']['movable']) {
237
?>
238
	function save_changes_to_xml(xml) {
239
		var ids = $('#mainarea table tbody').sortable('serialize', {key:"ids[]"});
240
		var strloading="<?=gettext('Saving changes...')?>";
241
		if (confirm("<?=gettext("Do you really want to save changes?")?>")) {
242
			$.ajax({
243
				type: 'get',
244
				cache: false,
245
				url: "<?=$_SERVER['SCRIPT_NAME']?>",
246
				data: {xml:'<?=$xml?>', act:'update', ids: ids},
247
				beforeSend: function() {
248
					$('#savemsg').empty().html(strloading);
249
				},
250
				error: function(data) {
251
					$('#savemsg').empty().html('Error:' + data);
252
				},
253
				success: function(data) {
254
					$('#savemsg').empty().html(data);
250 255
				}
251
			}
252
	<?php
256
			});
253 257
		}
254
	?>
255
});
258
	}
259
<?php
260
}
261
?>
262

  
256 263
//]]>
257 264
</script>
258 265

  
......
412 419
		echo "</table>";
413 420
		echo "</th></tr>";
414 421
	}
415
	
422

  
416 423
	$cols = 0;
417 424
	if ($pkg['adddeleteeditpagefields']['columnitem'] != "") {
418 425
		foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) {

Also available in: Unified diff