- currentDate = new Date();
- dt = pad(currentDate.getDate()) + '-' +
- pad((currentDate.getMonth() + 1)) + '-' +
- pad(currentDate.getFullYear()) + ' ' +
- pad(currentDate.getHours()) + ':' +
- pad(currentDate.getMinutes()) + ':' +
- pad(currentDate.getSeconds());
-
- metadata = node.getMetadata();
- metadata.add({key: 'creator', value: creator});
- metadata.add({key: 'date', value: dt});
+ metadata = node.getMetadata();
+ metadata.add({key: 'creator', value: creator});
+ metadata.add({key: 'date', value: datetime.currentStrfmt()});
+ return node;
+ }, {
+ success: execCallback
+ });
+ } else if(params.wlxmlClass === 'link') {
+ dialog = Dialog.create({
+ title: gettext('Create link'),
+ executeButtonText: gettext('Apply'),
+ cancelButtonText: gettext('Cancel'),
+ fields: [
+ {label: gettext('Link'), name: 'href', type: 'input'}
+ ]
+ });
+ dialog.on('execute', function(event) {
+ doc.transaction(function() {
+ var node = insertion();
+ node.setAttr('href', event.formData.href);
+ event.success();
+ return node;
+ }, {
+ success: execCallback
+ });
+ });
+ dialog.show();
+ } else {
+ doc.transaction(function() {
+ return insertion();
+ }, {success: execCallback});