aboutsummaryrefslogtreecommitdiff
path: root/views/default/widgets/editwrapper.php
blob: 058d19a61e1f53705a6a9bd95f858fadefcb6ab2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php

	/**
	 * Elgg edit widget layout
	 * 
	 * @package Elgg
	 * @subpackage Core
	 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
	 * @author Curverider Ltd
	 * @copyright Curverider Ltd 2008
	 * @link http://elgg.org/
	 */

	$guid = $vars['entity']->getGUID();

?>

<form id="widgetform<?php echo $guid; ?>" action="<?php echo $vars['url']; ?>action/widgets/save" method="post">

	<?php

		echo $vars['body'];
	
	?>

	<p>
		<label>
			<?php echo elgg_echo('access'); ?>:
			<?php echo elgg_view('input/access', array('internalname' => 'params[access_id]','value' => $vars['entity']->access_id)); ?>
		</label>
	</p>
	<p>
		<input type="hidden" name="guid" value="<?php echo $guid; ?>" />
		<input type="hidden" name="noforward" value="true" />
		<input type="submit" id="submit<?php echo $guid; ?>" value="<?php

			echo elgg_echo('save');			
		
		?>" />
	</p>

</form>

<script type="text/javascript">
$(document).ready(function() {

	$("#widgetform<?php echo $guid; ?>").submit(function () {
	
		$("#submit<?php echo $guid; ?>").attr("disabled","disabled");
		$("#submit<?php echo $guid; ?>").attr("value","<?php echo elgg_echo("saving"); ?>");
		$("#widgetcontent<?php echo $guid; ?>").html('<?php echo elgg_view('ajax/loader',array('slashes' => true)); ?>');
		$("#widget<?php echo $guid; ?> .toggle_box_edit_panel").click();
	
		var variables = $("#widgetform<?php echo $guid; ?>").serialize();
		$.post($("#widgetform<?php echo $guid; ?>").attr("action"),variables,function() {
			$("#submit<?php echo $guid; ?>").attr("disabled","");
			$("#submit<?php echo $guid; ?>").attr("value","<?php echo elgg_echo("save"); ?>");
			$("#widgetcontent<?php echo $guid; ?>").load("<?php echo $vars['url']; ?>pg/view/<?php echo $guid; ?>?shell=no&username=<?php echo page_owner_entity()->username; ?>&context=<?php echo get_context(); ?>&callback=true");
		});
		return false;
	
	});

}); 
</script>