support both export versions for freemind (old and new 1.0.1)

This commit is contained in:
Claudio Barril 2014-09-07 16:06:58 -03:00
parent 3c9573c93e
commit 94e76fad9c
16 changed files with 68 additions and 26 deletions

View File

@ -21,6 +21,7 @@ package com.wisemapping.exporter;
public class ExportProperties {
private ExportFormat format;
private String baseImgPath;
private String version;
public ExportFormat getFormat() {
return format;
@ -40,6 +41,14 @@ public class ExportProperties {
return result;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
static public class GenericProperties extends ExportProperties {
private GenericProperties(ExportFormat format) {
super(format);

View File

@ -142,6 +142,7 @@ public class ExporterFactory {
}
case FREEMIND: {
final FreemindExporter exporter = new FreemindExporter();
exporter.setVersion(properties.getVersion());
exporter.export(xml.getBytes(UTF_8_CHARSET_NAME), output);
break;
}

View File

@ -49,12 +49,12 @@ import java.util.Map;
public class FreemindExporter
implements Exporter {
private static final String FREE_MIND_VERSION = "0.9.0";
private static final String POSITION_LEFT = "left";
private static final String POSITION_RIGHT = "right";
private com.wisemapping.jaxb.freemind.ObjectFactory objectFactory;
private static final String EMPTY_FONT_STYLE = ";;;;;";
private Map<String, Node> nodesMap = null;
private String version;
public void export(Mindmap map, OutputStream outputStream) throws ExportException {
export(map.getUnzipXml(), outputStream);
@ -71,7 +71,7 @@ public class FreemindExporter
mindmapMap = (com.wisemapping.jaxb.wisemap.Map) JAXBUtils.getMapObject(stream, "com.wisemapping.jaxb.wisemap");
final com.wisemapping.jaxb.freemind.Map freemindMap = objectFactory.createMap();
freemindMap.setVersion(FREE_MIND_VERSION);
freemindMap.setVersion(this.getVersion());
final List<TopicType> topics = mindmapMap.getTopic();
@ -342,4 +342,11 @@ public class FreemindExporter
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
}

View File

@ -114,13 +114,14 @@ public class MindmapController extends BaseController {
return new ModelAndView("transformViewWise", values);
}
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"application/freemind"}, params = {"download=mm"})
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"application/freemind"}, params = {"download=mm","version"})
@ResponseBody
public ModelAndView retrieveDocumentAsFreemind(@PathVariable int id) throws IOException, MapCouldNotFoundException {
public ModelAndView retrieveDocumentAsFreemind(@PathVariable int id, @RequestParam(value = "version") String version) throws IOException, MapCouldNotFoundException {
final Mindmap mindMap = findMindmapById(id);
final Map<String, Object> values = new HashMap<String, Object>();
values.put("content", mindMap.getXmlStr());
values.put("filename", mindMap.getTitle());
values.put("version", version);
return new ModelAndView("transformViewFreemind", values);
}

View File

@ -56,6 +56,7 @@ public class TransformView extends AbstractView {
final String content = (String) viewMap.get("content");
final String filename = (String) viewMap.get("filename");
final String version = (String) viewMap.get("version");
// Build format properties ...
final ExportProperties properties = ExportProperties.create(exportFormat);
@ -63,6 +64,9 @@ public class TransformView extends AbstractView {
final ExportProperties.ImageProperties imageProperties = (ExportProperties.ImageProperties) properties;
imageProperties.setSize(ExportProperties.ImageProperties.Size.LARGE);
}
if (version != null) {
properties.setVersion(version);
}
// Set format content type...
final String contentType = exportFormat.getContentType();

View File

@ -35,7 +35,8 @@ EXPORT=Exportar
SVG_EXPORT_FORMAT=Scalable Vector Graphics (SVG)
PDF_EXPORT_FORMAT=Portable Document Format (PDF)
IMG_EXPORT_FORMAT=Imatge(PNG/JPEG)
FREEMIND_EXPORT_FORMAT = Freemind (version 0.9.0)
FREEMIND_EXPORT_FORMAT_09 = Freemind (version 0.9.0)
FREEMIND_EXPORT_FORMAT = Freemind (version 1.0.1)
DELETE=Esborrar
LOGIN_ERROR=El nom d'usuari o la contrasenya no són correctes
USER_INACTIVE=Perdo, el seu compre encara no ha estar activar. Rebrà un correu amb les dades d'activació.
@ -162,7 +163,7 @@ ADD_MESSAGE=Afegir un missatge
WHO_CAN_ACCESS=Qui pot accedir
IS_OWNER=És propietari
OPTIONAL_CUSTOM_MESSAGE=Opcional\: Incloure un missatge personalitzat
IMPORT_MINDMAP_INFO=És possible importar mapes en format FreeMind 0.9 i WiseMapping. Seleccioni el fitxer a importar.
IMPORT_MINDMAP_INFO=És possible importar mapes en format FreeMind 1.0.1 i WiseMapping. Seleccioni el fitxer a importar.
VIEW=veure
YOU=Vostè
INFO_UPDATE_SUCCESS=La seva informació s'ha actualitzat correctament.

View File

@ -38,7 +38,8 @@ EXPORT=Exportieren
SVG_EXPORT_FORMAT=Skalierbare Vektor Graphik (SVG)
PDF_EXPORT_FORMAT=Portables Dokumenten Format (PDF)
IMG_EXPORT_FORMAT=Bilddatei (PNG/JPEG)
FREEMIND_EXPORT_FORMAT = Freemind (version 0.9.0)
FREEMIND_EXPORT_FORMAT_09 = Freemind (version 0.9.0)
FREEMIND_EXPORT_FORMAT = Freemind (version 1.0.1)
WISEMAPPING_EXPORT_FORMAT = WiseMapping
LAST_UPDATE=Zuletzt geändert
LAST_UPDATE_BY=Zuletzt geändert von
@ -99,7 +100,7 @@ UNEXPECTED_ERROR=Outch!!. Ein unerwarteter Fehler ist aufgetreten.
UNEXPECTED_ERROR_DETAILS=Es tut uns Leid! Es ist ein Fehler aufgetreten der es uns nicht ermöglicht Ihre Anfrage zu bearbeiten. Bitte versuchen Sie es noch einmal oder gehen Sie zur Anfangsseite.
NO_ENOUGH_PERMISSIONS=Outch!!. Diese map ist nicht mehr verfügbar.
NO_ENOUGH_PERMISSIONS_DETAILS=Sie haben nicht die erforderlichen Rechte, um sich diese map anzusehen. Diese map ist entweder privat oder wurde gelöscht.
IMPORT_MINDMAP_INFO=Sie können FreeMind 0.9 und WiseMapping maps in Ihre List von maps importieren. Wählen Sie die Datei zum Import.
IMPORT_MINDMAP_INFO=Sie können FreeMind 1.0.1 und WiseMapping maps in Ihre List von maps importieren. Wählen Sie die Datei zum Import.
PRINT=Drucken
IMPORT_MAP_ERROR=FreeMind Datei konnte nicht importiert werden. {0}
MAP_TITLE_ALREADY_EXISTS=Sie haben schon eine map mit identischem Namen.

View File

@ -40,7 +40,8 @@ EXPORT=Export
SVG_EXPORT_FORMAT=Scalable Vector Graphics (SVG)
PDF_EXPORT_FORMAT=Portable Document Format (PDF)
IMG_EXPORT_FORMAT=Image File (PNG/JPEG)
FREEMIND_EXPORT_FORMAT = Freemind (version 0.9.0)
FREEMIND_EXPORT_FORMAT_09 = Freemind (version 0.9.0)
FREEMIND_EXPORT_FORMAT = Freemind (version 1.0.1)
WISEMAPPING_EXPORT_FORMAT = WiseMapping
LAST_UPDATE=Last Update
LAST_UPDATE_BY=Last Update By
@ -103,7 +104,7 @@ UNEXPECTED_ERROR_DETAILS=We're sorry, an error has occurred and we can't process
UNEXPECTED_ERROR_SERVER_ERROR=We're sorry, an error has occurred and we can't process your request. Refresh the page and try again. If the problem persist, click below on "Raise An Issue" to open a ticket.
NO_ENOUGH_PERMISSIONS=Outch!!. This map is not available anymore.
NO_ENOUGH_PERMISSIONS_DETAILS=You do not have enough right access to see this map. This map has been changed to private or deleted.
IMPORT_MINDMAP_INFO=You can import FreeMind 0.9 and WiseMapping maps to your list of maps. Select the file you want to import.
IMPORT_MINDMAP_INFO=You can import FreeMind 1.0.1 and WiseMapping maps to your list of maps. Select the file you want to import.
PRINT=Print
IMPORT_MAP_ERROR=FreeMind file could not be imported. {0}
MAP_TITLE_ALREADY_EXISTS=You have already a map with the same name

View File

@ -35,7 +35,8 @@ EXPORT=Exportar
SVG_EXPORT_FORMAT=Scalable Vector Graphics (SVG)
PDF_EXPORT_FORMAT=Portable Document Format (PDF)
IMG_EXPORT_FORMAT=Imagen (PNG/JPEG)
FREEMIND_EXPORT_FORMAT = Freemind (version 0.9.0)
FREEMIND_EXPORT_FORMAT_09 = Freemind (version 0.9.0)
FREEMIND_EXPORT_FORMAT = Freemind (version 1.0.1)
DELETE=Borrar
LOGIN_ERROR=El nombre de usuario o la contraseña introducidos no son correctos.
USER_INACTIVE=Disculpe, su cuenta aun no ha sido activada. Usted recibirá una notificación por email tan pronto la activemos.
@ -66,7 +67,7 @@ ACCOUNT_DETAIL=Desea cambiar sus preferencias? Este es el lugar.
SVG_EXPORT_FORMAT_DETAILS=Scalable Vector Graphics (SVG) es un XML markup language para describir gráficos vectoriale de dos dimensiones. Este formato le permitira imprimir sus mapas sin perdida de calidad o resolución.
PDF_EXPORT_FORMAT_DETAILS=Obtenga su mapa como un documento (PDF) para compartirlo y usarlo en sus presentaciones.
IMG_EXPORT_FORMAT_DETAILS=Obtenga una representación gráfica de su mapa incluyendo todo los colores y formas para reusarlo en documentos o para ser archivado
FREEMIND_EXPORT_FORMAT_DETAILS = FreeMind un aplicación de escritorio gratuita de diseno de mapas mentales
FREEMIND_EXPORT_FORMAT_DETAILS = FreeMind una aplicación de escritorio gratuita de diseño de mapas mentales
TERMSOFUSE=Términos de uso
PRIVACYPOLICY= Politica de privacidad
EXPORT_DETAILS=Exporte el mapa en el formato que desee y comience a utilizarlo en sus presentaciones
@ -164,7 +165,7 @@ ADD_MESSAGE=Agregar un mensaje
WHO_CAN_ACCESS=Quienes pueden acceder
IS_OWNER=Es dueño
OPTIONAL_CUSTOM_MESSAGE=Opcional\: Incluir un mensaje personalizado
IMPORT_MINDMAP_INFO=Es posible importar mapas en formato FreeMind 0.9 y WiseMapping. Seleccione el archivo a importar.
IMPORT_MINDMAP_INFO=Es posible importar mapas en formato FreeMind 1.0.1 y WiseMapping. Seleccione el archivo a importar.
VIEW=ver
YOU=Vos
INFO_UPDATE_SUCCESS=Your info has been changed successfully

View File

@ -43,7 +43,8 @@ EXPORT=Exporter
SVG_EXPORT_FORMAT=Scalable Vector Graphics (SVG)
PDF_EXPORT_FORMAT=Portable Document Format (PDF)
IMG_EXPORT_FORMAT=Fichier Graphique (PNG/JPEG)
FREEMIND_EXPORT_FORMAT = Freemind (version 0.9.0)
FREEMIND_EXPORT_FORMAT_09 = Freemind (version 0.9.0)
FREEMIND_EXPORT_FORMAT = Freemind (version 1.0.1)
WISEMAPPING_EXPORT_FORMAT = WiseMapping
LAST_UPDATE=Date dernière modification
LAST_UPDATE_BY=Dernière modification par
@ -104,7 +105,7 @@ UNEXPECTED_ERROR=Aïe!!. Une erreur inattendue est survenue.
UNEXPECTED_ERROR_DETAILS=Désolé, une erreur s'est produite et nous ne pouvons pas exécuter votre demande. Essayez à nouveau, ou retournez à la page d'accueil.
NO_ENOUGH_PERMISSIONS=Aïe!!. Cette carte n'est plus accessible.
NO_ENOUGH_PERMISSIONS_DETAILS=Vous n'avez pas les droits d'accès suffisants pour voir cette carte. Cette carte est devenue privée, ou a été détruite.
IMPORT_MINDMAP_INFO=Vous pouvez importer des cartes FreeMind 0.9 et WiseMapping dans votre liste de cartes. Choisissez le fichier à importer.
IMPORT_MINDMAP_INFO=Vous pouvez importer des cartes FreeMind 1.0.1 et WiseMapping dans votre liste de cartes. Choisissez le fichier à importer.
PRINT=Imprimer
IMPORT_MAP_ERROR=Le fichier FreeMind n'a pas pu être importé. {0}
MAP_TITLE_ALREADY_EXISTS=Vous avez déjà une carte portant le même nom.

View File

@ -38,7 +38,8 @@ EXPORT=Esporta
SVG_EXPORT_FORMAT=Scalable Vector Graphics (SVG)
PDF_EXPORT_FORMAT=Portable Document Format (PDF)
IMG_EXPORT_FORMAT=File Immagine (PNG/JPEG)
FREEMIND_EXPORT_FORMAT = Freemind (versione 0.9.0)
FREEMIND_EXPORT_FORMAT_09 = Freemind (version 0.9.0)
FREEMIND_EXPORT_FORMAT = Freemind (version 1.0.1)
WISEMAPPING_EXPORT_FORMAT = WiseMapping
LAST_UPDATE=Ultimo Aggiornamento
LAST_UPDATE_BY=Ultimo aggiornamento da
@ -99,7 +100,7 @@ UNEXPECTED_ERROR=Oops!! Si è verificato un errore inaspettato.
UNEXPECTED_ERROR_DETAILS=Siamo spiacenti, si è verificato un errore e non possiamo procedere nella tua richiesta. Prego, provare più tardi o torna alla home page.
NO_ENOUGH_PERMISSIONS=Oops!!. Questa mappa non è più disponibile.
NO_ENOUGH_PERMISSIONS_DETAILS=Non hai sufficienti diritti per visualizzare questa mappa. Il suo stato è cambiato in Privato oppure è stata eliminata.
IMPORT_MINDMAP_INFO=Puoi importare mappe da FreeMind 0.9 e da WiseMapping sulla tua lista di mappe. Seleziona il file da importare.
IMPORT_MINDMAP_INFO=Puoi importare mappe da FreeMind 1.0.1 e da WiseMapping sulla tua lista di mappe. Seleziona il file da importare.
PRINT=Stampa
IMPORT_MAP_ERROR=Il file FreeMind non può essere importato. {0}
MAP_TITLE_ALREADY_EXISTS=Esiste già una mappa con lo stesso nome

View File

@ -36,7 +36,8 @@ EXPORT=Exportar
SVG_EXPORT_FORMAT=Gráfico Vetorial Escalável (SVG)
PDF_EXPORT_FORMAT=Formato de Documento Portável (PDF)
IMG_EXPORT_FORMAT=Arquivo de Imagem (PNG/JPEG)
FREEMIND_EXPORT_FORMAT = Exportar para o Freemind (version 0.9.0)
FREEMIND_EXPORT_FORMAT_09 = Exportar para o Freemind (version 0.9.0)
FREEMIND_EXPORT_FORMAT = Exportar para o Freemind (version 1.0.1)
WISEMAPPING_EXPORT_FORMAT = WiseMapping
LAST_UPDATE=Última Atualização
LAST_UPDATE_BY=Última Atualização
@ -97,7 +98,7 @@ UNEXPECTED_ERROR=Opa!!. Ocorreu um erro inesperado.
UNEXPECTED_ERROR_DETAILS=Lamentamos, ocorreu um erro e não podemos processar a sua solicitação. Por favor, tente novamente ou vá para a página Inicial.
NO_ENOUGH_PERMISSIONS=Opa!!. Este mapa não está mais disponível.
NO_ENOUGH_PERMISSIONS_DETAILS=Você não tem privilégios suficientes para ver este mapa. Este mapa foi alterado para privado ou deletado.
IMPORT_MINDMAP_INFO=Você pode importar mapas do FreeMind 0.9 e do WiseMapping para sua lista de mapas. Selecione o arquivo que você quer importar.
IMPORT_MINDMAP_INFO=Você pode importar mapas do FreeMind 1.0.1 e do WiseMapping para sua lista de mapas. Selecione o arquivo que você quer importar.
PRINT=Imprimir
IMPORT_MAP_ERROR=O arquivo FreeMind não pode ser importado. {0}
MAP_TITLE_ALREADY_EXISTS=Você já tem um mapa com o mesmo nome

View File

@ -99,7 +99,7 @@ UNEXPECTED_ERROR=晕!!不可预知的错误。
UNEXPECTED_ERROR_DETAILS=抱歉,突遭错误,我们无法处理你的请求。 请重试或者访问首页。
NO_ENOUGH_PERMISSIONS=晕!!此图不可访问。
NO_ENOUGH_PERMISSIONS_DETAILS=你没有权限访问这张图。此图已修改访问权限或者已删除。
IMPORT_MINDMAP_INFO=你可以导入 FreeMind 0.9 和 WiseMapping 格式的思维导图。选择你想要导入的文件。
IMPORT_MINDMAP_INFO=你可以导入 FreeMind 1.0.1 和 WiseMapping 格式的思维导图。选择你想要导入的文件。
PRINT=打印
IMPORT_MAP_ERROR=FreeMind 文件不能导入。
MAP_TITLE_ALREADY_EXISTS=已有同名称图

View File

@ -38,7 +38,8 @@ EXPORT=導出
SVG_EXPORT_FORMAT=可縮放向量圖形(SVG)
PDF_EXPORT_FORMAT=便攜檔格式(PDF)
IMG_EXPORT_FORMAT=圖像檔(PNG/JPEG)
FREEMIND_EXPORT_FORMAT = Freemind (version 0.9.0)
FREEMIND_EXPORT_FORMAT_09 = Freemind (version 0.9.0)
FREEMIND_EXPORT_FORMAT = Freemind (version 1.0.1)
WISEMAPPING_EXPORT_FORMAT = WiseMapping
LAST_UPDATE=最近更新
LAST_UPDATE_BY=最近更新者
@ -99,7 +100,7 @@ UNEXPECTED_ERROR=暈!!不可預知的錯誤。
UNEXPECTED_ERROR_DETAILS=抱歉,突遭錯誤,我們無法處理你的請求。 請重試或者訪問首頁。
NO_ENOUGH_PERMISSIONS=暈!!此圖不可訪問。
NO_ENOUGH_PERMISSIONS_DETAILS=你沒有許可權訪問這張圖。此圖已修改訪問許可權或者已刪除。
IMPORT_MINDMAP_INFO=你可以導入 FreeMind 0.9 和 WiseMapping 格式的思維導圖。選擇你想要導入的檔。
IMPORT_MINDMAP_INFO=你可以導入 FreeMind 1.0.1 和 WiseMapping 格式的思維導圖。選擇你想要導入的檔。
PRINT=列印
IMPORT_MAP_ERROR=FreeMind 檔不能導入。
MAP_TITLE_ALREADY_EXISTS=已有同名稱圖

View File

@ -26,6 +26,7 @@
var svgXml = context.method == "POST" ? window.document.getElementById('workspaceContainer').innerHTML : "";
$('svgXml').setAttribute('value', svgXml);
$('download').setAttribute('value', context.formatType);
$('version').setAttribute('value', context.version);
iframeForm.submit();
}
if (MooDialog.Request.active) {
@ -44,4 +45,5 @@
enctype="application/x-www-form-urlencoded" id="iframeExportForm">
<input name="svgXml" id="svgXml" value="" type="hidden"/>
<input name="download" id="download" type="hidden" value="mm"/>
<input name="version" id="version" type="hidden" value=""/>
</form>

View File

@ -10,11 +10,17 @@
enctype="application/x-www-form-urlencoded" id="dialogMainForm">
<input name="svgXml" id="svgXml" value="" type="hidden"/>
<input name="download" type="hidden" value="mm"/>
<input name="version" type="hidden" value=""/>
<fieldset>
<label for="freemind">
<input type="radio" id="freemind" name="exportFormat" value="mm" checked="checked"/>
<input type="radio" id="freemind" name="exportFormat" value="mm" version="1.0.1" checked="checked"/>
<strong><spring:message code="FREEMIND_EXPORT_FORMAT"/></strong><br/>
</label>
<label for="freemind09">
<input type="radio" id="freemind09" name="exportFormat" value="mm" version="0.9.0"/>
<strong><spring:message code="FREEMIND_EXPORT_FORMAT_09"/></strong><br/>
<spring:message code="FREEMIND_EXPORT_FORMAT_DETAILS"/>
</label>
@ -87,7 +93,7 @@
// No way to obtain map svg. Hide panels..
if (window.location.pathname.indexOf('exportf') != -1) {
$('#exportInfo').hide();
$('#freemind,#pdf,#svg,#odt,#txt,#xls,#mmap').click('click', function (event) {
$('#freemind,#freemind09,#pdf,#svg,#odt,#txt,#xls,#mmap').click('click', function (event) {
$('#imgFormat').hide();
});
@ -103,7 +109,6 @@
// If the map is opened, use the latest model ...
var formatType = $('#dialogMainForm input:checked').attr('value');
var form = $('#dialogMainForm');
// Restore default ..
form.attr('action', 'c/restful/maps/${mindmap.id}.' + formatType);
@ -123,6 +128,11 @@
}
var version = $('#dialogMainForm input:checked').attr('version');
if (version) {
$('#dialogMainForm input[name=version]').attr('value', version);
}
$('#dialogMainForm input[name=download]').attr('value', formatType);
if (!differ) {
form.submit();
@ -131,7 +141,7 @@
// Close dialog ...
$('#export-dialog-modal').modal('hide');
return {"action":form.attr('action'), "method":form.attr('method'), formatType:formatType};
return {"action":form.attr('action'), "method":form.attr('method'), "formatType":formatType, "version": version};
}
</script>