From c4f3feb92ea599c8d92a2951dbbf317363bcdcdd Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 26 Aug 2012 16:53:33 -0300 Subject: [PATCH] Several fixes. --- .../persistence/XMLSerializer_Beta.js | 26 ++++++++--------- .../src/main/webapp/samples/sample2.xml | 29 +++++++++++++++++++ .../java/com/wisemapping/model/Mindmap.java | 8 +++-- .../ncontroller/MindmapController.java | 7 +++-- .../src/main/webapp/WEB-INF/app.properties | 6 +--- .../webapp/WEB-INF/classes/mail.properties | 9 ------ .../webapp/WEB-INF/wisemapping-security.xml | 1 + .../src/test/sql/mysql/v2.0-to-v3.0.sql | 28 +++++++++--------- 8 files changed, 67 insertions(+), 47 deletions(-) create mode 100644 wise-editor/src/main/webapp/samples/sample2.xml delete mode 100644 wise-webapp/src/main/webapp/WEB-INF/classes/mail.properties diff --git a/mindplot/src/main/javascript/persistence/XMLSerializer_Beta.js b/mindplot/src/main/javascript/persistence/XMLSerializer_Beta.js index 7d0c1a8d..1367a843 100644 --- a/mindplot/src/main/javascript/persistence/XMLSerializer_Beta.js +++ b/mindplot/src/main/javascript/persistence/XMLSerializer_Beta.js @@ -16,7 +16,7 @@ */ mindplot.persistence.XMLSerializer_Beta = new Class({ - toXML : function(mindmap) { + toXML:function (mindmap) { $assert(mindmap, "Can not save a null mindmap"); var document = core.Utils.createDocument(); @@ -40,7 +40,7 @@ mindplot.persistence.XMLSerializer_Beta = new Class({ return document; }, - _topicToXML : function(document, topic) { + _topicToXML:function (document, topic) { var parentTopic = document.createElement("topic"); // Set topic attributes... @@ -139,25 +139,25 @@ mindplot.persistence.XMLSerializer_Beta = new Class({ return parentTopic; }, - _iconToXML : function(document, icon) { + _iconToXML:function (document, icon) { var iconDom = document.createElement("icon"); iconDom.setAttribute('id', icon.getIconType()); return iconDom; }, - _linkToXML : function(document, link) { + _linkToXML:function (document, link) { var linkDom = document.createElement("link"); linkDom.setAttribute('url', link.getUrl()); return linkDom; }, - _noteToXML : function(document, note) { + _noteToXML:function (document, note) { var noteDom = document.createElement("note"); noteDom.setAttribute('text', note.getText()); return noteDom; }, - loadFromDom : function(dom, mapId) { + loadFromDom:function (dom, mapId) { $assert(dom, "Dom can not be null"); $assert(mapId, "mapId can not be null"); @@ -183,7 +183,7 @@ mindplot.persistence.XMLSerializer_Beta = new Class({ return mindmap; }, - _deserializeNode : function(domElem, mindmap) { + _deserializeNode:function (domElem, mindmap) { var type = (domElem.getAttribute('central') != null) ? mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE : mindplot.model.INodeModel.MAIN_TOPIC_TYPE; var topic = mindmap.createNode(type); @@ -274,19 +274,19 @@ mindplot.persistence.XMLSerializer_Beta = new Class({ return topic; }, - _deserializeIcon : function(domElem, topic) { + _deserializeIcon:function (domElem, topic) { var icon = domElem.getAttribute("id"); icon = icon.replace("images/", "icons/legacy/"); - return mindplot.TopicFeature.createModel(mindplot.TopicFeature.Icon.id, topic, {id:icon}); + return mindplot.TopicFeature.createModel(mindplot.TopicFeature.Icon.id, {id:icon}); }, - _deserializeLink : function(domElem, topic) { - return mindplot.TopicFeature.createModel(mindplot.TopicFeature.Link.id, topic, {url:domElem.getAttribute("url")}); + _deserializeLink:function (domElem, topic) { + return mindplot.TopicFeature.createModel(mindplot.TopicFeature.Link.id, {url:domElem.getAttribute("url")}); }, - _deserializeNote : function(domElem, topic) { + _deserializeNote:function (domElem, topic) { var text = domElem.getAttribute("text"); - return mindplot.TopicFeature.createModel(mindplot.TopicFeature.Note.id, topic, {text:text == null ? " " : text}); + return mindplot.TopicFeature.createModel(mindplot.TopicFeature.Note.id, {text:text == null ? " " : text}); }}); mindplot.persistence.XMLSerializer_Beta.MAP_ROOT_NODE = 'map'; \ No newline at end of file diff --git a/wise-editor/src/main/webapp/samples/sample2.xml b/wise-editor/src/main/webapp/samples/sample2.xml new file mode 100644 index 00000000..aad51a70 --- /dev/null +++ b/wise-editor/src/main/webapp/samples/sample2.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java b/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java index e2eb0dad..e2b78ef4 100644 --- a/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java +++ b/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java @@ -264,10 +264,12 @@ public class Mindmap { } public boolean hasPermissions(@NotNull Collaborator collaborator, @NotNull CollaborationRole role) { - final Collaboration collaboration = this.findCollaboration(collaborator); boolean result = false; - if (collaboration != null) { - result = collaboration.hasPermissions(role); + if (collaborator != null) { + final Collaboration collaboration = this.findCollaboration(collaborator); + if (collaboration != null) { + result = collaboration.hasPermissions(role); + } } return result; diff --git a/wise-webapp/src/main/java/com/wisemapping/ncontroller/MindmapController.java b/wise-webapp/src/main/java/com/wisemapping/ncontroller/MindmapController.java index 5362fd46..6f958808 100644 --- a/wise-webapp/src/main/java/com/wisemapping/ncontroller/MindmapController.java +++ b/wise-webapp/src/main/java/com/wisemapping/ncontroller/MindmapController.java @@ -23,6 +23,7 @@ import com.wisemapping.exceptions.WiseMappingException; import com.wisemapping.model.CollaborationRole; import com.wisemapping.model.Mindmap; import com.wisemapping.model.MindMapHistory; +import com.wisemapping.model.User; import com.wisemapping.security.Utils; import com.wisemapping.service.MindmapService; import com.wisemapping.view.MindMapBean; @@ -143,9 +144,9 @@ public class MindmapController { // Configure default locale for the editor ... final Locale locale = LocaleContextHolder.getLocale(); model.addAttribute("locale", locale.toString().toLowerCase()); - model.addAttribute("principal", Utils.getUser()); - model.addAttribute("readOnlyMode", !mindmap.hasPermissions(Utils.getUser(), CollaborationRole.EDITOR)); - + final User collaborator = Utils.getUser(); + model.addAttribute("principal", collaborator); + model.addAttribute("readOnlyMode", !mindmap.hasPermissions(collaborator, CollaborationRole.EDITOR)); return "mindmapEditor"; } diff --git a/wise-webapp/src/main/webapp/WEB-INF/app.properties b/wise-webapp/src/main/webapp/WEB-INF/app.properties index 01fe8dfc..8444223c 100755 --- a/wise-webapp/src/main/webapp/WEB-INF/app.properties +++ b/wise-webapp/src/main/webapp/WEB-INF/app.properties @@ -32,10 +32,6 @@ mail.smtp.auth=false mail.smtp.starttls.enable=false mail.smtp.quitwait=false -#------------------------ -# SSL SMTP Server Configuration -#------------------------ - #------------------------ # GMAIL SMTP Configuration #------------------------ @@ -58,7 +54,7 @@ mail.serverSendEmail=root@localhost mail.supportEmail=root@localhost # Optional: Unexpected errors will be reported to this address. -mail.errorReporterEmail=support@wisemapping.com +mail.errorReporterEmail=bug-report@wisemapping.com ################################################################################## # Users Registration Configuration diff --git a/wise-webapp/src/main/webapp/WEB-INF/classes/mail.properties b/wise-webapp/src/main/webapp/WEB-INF/classes/mail.properties deleted file mode 100644 index 8a8b0f11..00000000 --- a/wise-webapp/src/main/webapp/WEB-INF/classes/mail.properties +++ /dev/null @@ -1,9 +0,0 @@ -# Configuration file for javax.mail - -# Host whose mail services will be used -# (Default value : localhost) -mail.host=mail.wisemapping.com - -# Return address to appear on emails -# (Default value : username@host) -mail.from=webmaster@wisemapping.com \ No newline at end of file diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml index a0c0beaa..c2e525d6 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml @@ -28,6 +28,7 @@ + diff --git a/wise-webapp/src/test/sql/mysql/v2.0-to-v3.0.sql b/wise-webapp/src/test/sql/mysql/v2.0-to-v3.0.sql index d8b5fd3d..42d79f29 100644 --- a/wise-webapp/src/test/sql/mysql/v2.0-to-v3.0.sql +++ b/wise-webapp/src/test/sql/mysql/v2.0-to-v3.0.sql @@ -4,17 +4,17 @@ starred BOOL NOT NULL default 0, mindmap_properties varchar(512) CHARACTER SET utf8 ) CHARACTER SET utf8; -drop table `wisemapping`.`MINDMAP_NATIVE`; -ALTER TABLE `wisemapping`.`MINDMAP_COLABORATOR` RENAME TO `wisemapping`.`COLLABORATION`; -ALTER TABLE `wisemapping`.`COLABORATOR` RENAME TO `wisemapping`.`COLLABORATOR`; +drop table `MINDMAP_NATIVE`; +ALTER TABLE `MINDMAP_COLABORATOR` RENAME TO `COLLABORATION`; +ALTER TABLE `COLABORATOR` RENAME TO `COLLABORATOR`; -ALTER TABLE `wisemapping`.`MINDMAP` DROP COLUMN `editor_properties` , DROP COLUMN `mindMapNative_id` ; +ALTER TABLE `MINDMAP` DROP COLUMN `editor_properties` , DROP COLUMN `mindMapNative_id` ; -ALTER TABLE `wisemapping`.`MINDMAP` CHANGE COLUMN `owner_id` `creator_id` INT(11) NOT NULL +ALTER TABLE `MINDMAP` CHANGE COLUMN `owner_id` `creator_id` INT(11) NOT NULL , DROP INDEX `owner_id` , ADD INDEX `owner_id` (`creator_id` ASC) ; -ALTER TABLE `wisemapping`.`COLLABORATION` ADD COLUMN `properties_id` INT(11) NULL DEFAULT NULL AFTER `role_id` ; +ALTER TABLE `COLLABORATION` ADD COLUMN `properties_id` INT(11) NULL DEFAULT NULL AFTER `role_id` ; DROP TABLE USER_LOGIN; CREATE TABLE ACCESS_AUDITORY ( @@ -26,22 +26,22 @@ login_date date #ALTER TABLE ACCESS_AUDITORY # ADD CONSTRAINT `user_id` # FOREIGN KEY () -# REFERENCES `wisemapping`.`USER` () +# REFERENCES `USER` () # ON DELETE CASCADE # ON UPDATE NO ACTION #, ADD INDEX `user_id` () ; -ALTER TABLE `wisemapping`.`MINDMAP_HISTORY` DROP COLUMN `creator_user` , ADD COLUMN `editor_id` INT(11) NULL DEFAULT NULL AFTER `creation_date`; +ALTER TABLE `MINDMAP_HISTORY` DROP COLUMN `creator_user` , ADD COLUMN `editor_id` INT(11) NULL DEFAULT NULL AFTER `creation_date`; -ALTER TABLE `wisemapping`.`USER` ADD COLUMN `locale` VARCHAR(5) NULL AFTER `allowSendEmail` ; +ALTER TABLE `USER` ADD COLUMN `locale` VARCHAR(5) NULL AFTER `allowSendEmail` ; -ALTER TABLE `wisemapping`.`MINDMAP` DROP COLUMN `last_editor` , ADD COLUMN `last_editor_id` INT(11) NULL DEFAULT 9 AFTER `tags` ; +ALTER TABLE `MINDMAP` DROP COLUMN `last_editor` , ADD COLUMN `last_editor_id` INT(11) NULL DEFAULT 2 AFTER `tags` ; -ALTER TABLE `wisemapping`.`USER` DROP COLUMN `username` , CHANGE COLUMN `activationCode` `activation_code` BIGINT(20) NOT NULL , CHANGE COLUMN `allowSendEmail` `allow_send_email` CHAR(1) NOT NULL DEFAULT '0' ; +ALTER TABLE `USER` DROP COLUMN `username` , CHANGE COLUMN `activationCode` `activation_code` BIGINT(20) NOT NULL , CHANGE COLUMN `allowSendEmail` `allow_send_email` CHAR(1) NOT NULL DEFAULT '0' ; -INSERT INTO `wisemapping`.`MINDMAP` (`last_editor_id`) VALUES (1); +INSERT INTO `MINDMAP` (`last_editor_id`) VALUES (1); -INSERT INTO `wisemapping`.`COLLABORATOR` (`id`, `email`, `creation_date`) VALUES (8081, 'migfake@wisemapping.com', '2007-10-09'); -DELETE FROM `wisemapping`.`USER` where activation_date is null; +INSERT INTO `COLLABORATOR` (`id`, `email`, `creation_date`) VALUES (8081, 'migfake@wis.com', '2007-10-09'); +DELETE FROM `USER` where activation_date is null; DROP TABLE FEEDBACK;