Template:UpdateMapStore

    Table of contents
    No headers
    dekiapi();
    var channel = $subscribe ?? 'default';
    var store = $id ?? 'data';
    <script type="text/jem">"
    	Deki.subscribe('"..channel.."', null, function(c, m, d) {
    		var prop = 'urn:custom.mindtouch.com#'  + '"..store.."';
    		Deki.Api.ReadPageProperty(null, prop, function(result) {
    			var data = eval('(' + (result.value || '{}') + ')');
    			for (var k in m) data[k] = m[k];
    			if(result.etag) {
    				Deki.Api.UpdatePageProperty(result.href, YAHOO.lang.JSON.stringify(data), result.etag, function() {
    					alert('Thank you. The information has been submitted.');
    				}, function(result) {
    					alert('An error occurred trying to update the store (status: ' + result.status + ' - ' + result.text + ')');
    				});
    			} else {
    				Deki.Api.CreatePageProperty(null, prop, YAHOO.lang.JSON.stringify(data), function() {
    					alert('Thank you. The information has been submitted.');
    				}, function(result) {
    					alert('An error occurred trying to create the store (status: ' + result.status + ' - ' + result.text + ')');
    				});
    			}
    		}, function(result) {
    			alert('An error occurred trying to read the store (status: ' + result.status + ' - ' + result.text + ')');
    		});
    	}, null);
    "</script>
    
    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by