How to use the server.page.revision function in server

To help you get started, we’ve selected a few server examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TiddlySpace / tiddlyspace / src / plugins / ErrorHandler.js View on Github external
editConflictHandler: function(container, tiddler) {
		var title = tiddler.title;
		var myrev = tiddler.fields["server.page.revision"];
		// note user now needs to edit, fix problem and save. 
		// TODO: make sure this gets reset in save callback
		store.getTiddler(title).fields["server.page.revision"] = "false";

		var diffBtn = createTiddlyButton(container, msgs.reviewDiff, msgs.reviewDiffTooltip, function(ev) {
			var title = $(ev.target).data("title");
			plugin.displayDiff(ev.target, store.getTiddler(title), myrev);
		});
		var saveBtn = createTiddlyButton(container, msgs.save, msgs.saveTooltip, function(ev) {
				var title = $(ev.target).data("title");
				var tid = store.saveTiddler(store.getTiddler(title));
				autoSaveChanges(null, [tid]);
			});
		var ignoreBtn = createTiddlyButton(container, msgs.discard, msgs.discardTooltip, function(ev) {
			var title = $(ev.target).text(msgs.updating).data("title");
			plugin.resetToServerVersion(store.getTiddler(title));
		});
		$([diffBtn, ignoreBtn, saveBtn]).data("title", title);
	},
github Jermolene / TiddlyWiki5 / test / tiddlywiki.2.6.5 / source / tiddlywiki / js / FileAdaptor.js View on Github external
FileAdaptor.getTiddlerListComplete = function(context,userParams)
{
	if(context.status) {
		if(context.filter) {
			context.tiddlers = context.adaptor.store.filterTiddlers(context.filter);
		} else {
			context.tiddlers = [];
			context.adaptor.store.forEachTiddler(function(title,tiddler) {context.tiddlers.push(tiddler);});
		}
		var i;
		for(i=0; i
github Jermolene / TiddlyWiki5 / test / tiddlywiki.2.6.5 / source / tiddlywiki / js / Sync.js View on Github external
var getTiddlerListCallback = function(context,sycnItems) {
		var me = config.macros.sync;
		if(!context.status) {
			displayMessage(context.statusText);
			return false;
		}
		syncItems = context.userParams;
		var i,tiddlers = context.tiddlers;
		for(i=0; i si.tiddler.fields['server.page.revision']) {
					si.syncStatus = me.syncStatusList[si.isTouched ? 'changedBoth' : 'changedServer'];
				}
			} else {
				si.syncStatus = me.syncStatusList.notFound;
			}
			me.updateSyncStatus(si);
		}
		return true;
	};
github Steinthor / CCTiddlywiki / plugins / ccTiddlyCore / files / plugins / 001_ccTiddlyAdaptor.js View on Github external
ccTiddlyAdaptor.getTiddlerCallback = function(status,context,responseText,uri,xhr){
	        context.status = false;
	        context.statusText = ccTiddlyAdaptor.errorInFunctionMessage.format(['getTiddlerCallback']);
	        if(status){
	                var info=[]
	                try{
	                    eval('info=' + responseText);
	                }catch (ex){
	                        context.statusText = exceptionText(ex,ccTiddlyAdaptor.serverParsingErrorMessage);
	                        if(context.callback)
	                                context.callback(context,context.userParams);
	                        return;
	                }
	                context.tiddler.text = info['text'];
					context.tiddler.tags = info['tags'].split(" ");
	                context.tiddler.fields['server.page.revision'] = info['server.page.revision'];
					context.tiddler.fields['server.id'] = info['id'];
					if(info['fields'])
						context.tiddler.fields = merge(info['fields'], context.tiddler.fields);
					else
						context.tiddler.fields = context.tiddler.fields;
				    context.tiddler.modifier = info['modifier'];
	                context.tiddler.modified = Date.convertFromYYYYMMDDHHMM(info['modified']);
	                context.tiddler.created = Date.convertFromYYYYMMDDHHMM(info['created']);
	                context.status = true;
	
	        }else{
	                context.statusText = xhr.statusText;
	                if(context.callback)
	                        context.callback(context,context.userParams);
	                return;
	        }
github Steinthor / CCTiddlywiki / plugins / ccTiddlyCore / files / plugins / 001_ccTiddlyAdaptor.js View on Github external
ccTiddlyAdaptor.getTiddlerRevisionListCallback = function(status,context,responseText,uri,xhr){
		if(responseText.indexOf('1){
						var tiddler = new Tiddler(context.title);
						tiddler.modified = Date.convertFromYYYYMMDDHHMM(parts[0]);
						tiddler.fields['server.page.revision'] = String(parts[1]);
						tiddler.modifier = String(parts[2]);
						tiddler.fields['server.host'] = ccTiddlyAdaptor.minHostName(context.host);
						tiddler.fields['server.type'] = ccTiddlyAdaptor.serverType;
						context.revisions.push(tiddler);
					}
				}
			}
			context.revisions.sort(function(a,b){return a.modified
github TiddlySpace / tiddlyspace / src / plugins / TiddlySpaceRevisionView.js View on Github external
showRevision: function(place, revision, callback) {
		var context = {
			host: revision.fields["server.host"],
			workspace: revision.fields["server.workspace"]
		};
		var userParams = {
			revElem: place
		};
		var type = revision.fields["server.type"];
		var adaptor = new config.adaptors[type]();
		var revNo = revision.fields["server.page.revision"];
		adaptor.getTiddlerRevision(revision.title, revNo, context, userParams,
			function(context, userParams) {
				var tiddler = context.tiddler;
				tiddler.title += me.revSuffix
					.format([$(place).attr("revision")]);
				tiddler.fields.doNotSave = true;
				if (store.getTiddler(tiddler.title)) {
					store.deleteTiddler(tiddler.title);
				}
				store.addTiddler(tiddler);

				//now, populate the existing div
				var revElem = userParams.revElem;
				$(revElem).attr("id", story.tiddlerId(tiddler.title));
				$(revElem).attr("refresh", "tiddler");
				var getTemplate = function() {
github TiddlyWiki / TiddlyWiki / plugins / Sync.js View on Github external
var getTiddlerListCallback = function(context,sycnItems) {
		var me = config.macros.sync;
		if(!context.status) {
			displayMessage(context.statusText);
			return false;
		}
		syncItems = context.userParams;
		var i,tiddlers = context.tiddlers;
		for(i=0; i si.tiddler.fields['server.page.revision']) {
					si.syncStatus = me.syncStatusList[si.isTouched ? 'changedBoth' : 'changedServer'];
				}
			} else {
				si.syncStatus = me.syncStatusList.notFound;
			}
			me.updateSyncStatus(si);
		}
		return true;
	};
github TiddlySpace / tiddlyspace / src / plugins / TiddlySpacePublishingCommands.js View on Github external
}
		for(var fieldName in gatheredFields) {
			if(TiddlyWiki.isStandardField(fieldName)) {
				draftTiddler[fieldName] = gatheredFields[fieldName];
			} else {
				draftTiddler.fields[fieldName] = gatheredFields[fieldName];
			}
		}
		var privateBag = tiddlyspace.getCurrentBag("private");
		var privateWorkspace = tiddlyspace.getCurrentWorkspace("private");
		draftTiddler.title = draftTitle;
		draftTiddler.fields["publish.name"] = title;
		draftTiddler.fields["server.workspace"] = privateWorkspace;
		draftTiddler.fields["server.bag"] = privateBag;
		draftTiddler.fields["server.title"] = draftTitle;
		draftTiddler.fields["server.page.revision"] = "false";
		delete draftTiddler.fields["server.etag"];
		return draftTiddler;
	},
	handler: function(ev, src, title) {
github TiddlySpace / tiddlyspace / src / plugins / TiddlySpaceInit.js View on Github external
setupMarkupPreHead: function() {
		var pubWorkspace = tiddlyspace.getCurrentWorkspace("public");
		var existing = store.getTiddler("MarkupPreHead");
		if(!existing || existing.fields["server.workspace"] != pubWorkspace) {
			var tid = new Tiddler("MarkupPreHead");
			tid.text = markupPreHead.format(currentSpace.name);
			tid.tags = ["excludeLists"];
			tid.fields = $.extend({}, config.defaultCustomFields);
			tid.fields["server.workspace"] = pubWorkspace;
			tid.fields["server.page.revision"] = "false";
			tid = store.saveTiddler(tid);
			autoSaveChanges(null, [tid]);
		}
	},
	update: function(curVersion, flagTiddler) {
github saqimtiaz / TiddlyCouch / plugins / adaptor.js View on Github external
success: function(data, status, xhr) {
			context.responseData = data;
			adaptor.putTiddlerCallback(xhr.status, context,
				xhr.responseText, options.url, xhr);
		},
		error: function(xhr, error, exc) {
			adaptor.putTiddlerCallback(xhr.status, context,
				xhr.responseText, options.url, xhr);
		}
	};
	var id = fields["server.id"];
	if(id) {
		options.url += "/" + id;
		options.type = "PUT";
		payload._id = fields["server.id"];
		payload._rev = fields["server.page.revision"];
		options.data = $.toJSON(payload);
	} else {
		options.type = "POST";
	}
	return $.ajax(options);
};