This repository has been archived by the owner on Nov 25, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simple implementation of WebODF viewer. Only as viewer for the moment…
…, we have to get a way to send back the modif in a standard manner, probably by replacing the Runtime implementation.
- Loading branch information
Showing
9 changed files
with
258 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* Copyright 2007-2013 Charles du Jeu - Abstrium SAS <team (at) pyd.io> | ||
* This file is part of Pydio. | ||
* | ||
* Pydio is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Pydio is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with Pydio. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* The latest code can be found at <http://pyd.io/>. | ||
*/ | ||
Class.create("WebodfEditor", AbstractEditor, { | ||
|
||
padID:null, | ||
sessionID: null, | ||
node: null, | ||
|
||
initialize: function($super, oFormObject, options) | ||
{ | ||
$super(oFormObject, options); | ||
if(!ajaxplorer.user || ajaxplorer.user.canWrite()){ | ||
this.canWrite = true; | ||
this.actions.get("saveButton").observe('click', function(){ | ||
this.saveFile(); | ||
return false; | ||
}.bind(this)); | ||
}else{ | ||
this.canWrite = false; | ||
this.actions.get("saveButton").hide(); | ||
} | ||
// HIDE SAVE FOR THE MOMENT | ||
this.actions.get("saveButton").hide(); | ||
|
||
if(options.context.__className == "Modal"){ | ||
this.actions.get("downloadFileButton").observe('click', function(){ | ||
if(!this.currentFile) return; | ||
ajaxplorer.triggerDownload(ajxpBootstrap.parameters.get('ajxpServerAccess')+'&action=download&file='+this.currentFile); | ||
return false; | ||
}.bind(this)); | ||
}else{ | ||
this.actions.get("downloadFileButton").hide(); | ||
} | ||
}, | ||
|
||
open : function($super, nodeOrNodes){ | ||
$super(nodeOrNodes); | ||
this.node = nodeOrNodes; | ||
var fileName = nodeOrNodes.getPath(); | ||
var fileContent = ajxpBootstrap.parameters.get('ajxpServerAccess')+'&get_action=download&file='+fileName; | ||
|
||
this.contentMainContainer = this.element.down('#webodf_container'); | ||
this.contentMainContainer.src = 'plugins/editor.webodf/frame.php?token='+Connexion.SECURE_TOKEN+'&file='+fileName; | ||
|
||
this.resize(); | ||
this.element.observe('editor:close', function(){ | ||
this.contentMainContainer.src = ''; | ||
}.bind(this)); | ||
/* | ||
var conn = new Connexion(); | ||
conn.addParameter("get_action", "get_content"); | ||
conn.addParameter("file", fileName); | ||
conn.onComplete = function(transport){ | ||
var data = transport.responseJSON; | ||
this.padID = data.padID; | ||
this.sessionID = data.sessionID; | ||
$("ether_box").down("#ether_box_frame").src = data.url; | ||
fitHeightToBottom($("ether_box").down("#ether_box_frame")); | ||
}.bind(this); | ||
conn.sendAsync(); | ||
*/ | ||
|
||
if(window.ajxpMobile){ | ||
this.setFullScreen(); | ||
attachMobileScroll(this.textarea, "vertical"); | ||
} | ||
|
||
|
||
}, | ||
|
||
|
||
saveFile : function(){ | ||
if(!this.padID || !this.node) return; | ||
var conn = new Connexion(); | ||
conn.addParameter("get_action", "etherpad_save"); | ||
conn.addParameter("file", this.node.getPath()); | ||
conn.addParameter("pad_id", this.padID); | ||
conn.sendAsync(); | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
$AJXP_SECURE_TOKEN = $_GET["token"]; | ||
$AJXP_FILE_URL = $_GET["file"]; | ||
?> | ||
<html> | ||
<head> | ||
<script src="webodf/webodf.js" type="text/javascript" charset="utf-8"></script> | ||
<script type="text/javascript" charset="utf-8"> | ||
function init() | ||
{ | ||
var odfelement = document.getElementById("odf"); | ||
window.odfcanvas = new odf.OdfCanvas(odfelement); | ||
window.odfcanvas.load("http://localhost/index.php?secure_token=<?php echo $AJXP_SECURE_TOKEN; ?>&get_action=download&file=<?php echo $AJXP_FILE_URL; ?>"); | ||
//window.odfcanvas.setEditable(true); | ||
/* | ||
odfcanvas.odfContainer().save(function(err){ | ||
console.log(err); | ||
}); | ||
*/ | ||
} | ||
window.setTimeout(init, 0); | ||
</script> | ||
<style type="text/css"> | ||
.shadow_class{ | ||
box-shadow: 1px 1px 6px black; | ||
} | ||
</style> | ||
</head> | ||
<body style="background-color: rgb(85, 85, 85);"> | ||
<div id="odf" class="shadow_class"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
/* | ||
* Copyright 2007-2013 Charles du Jeu - Abstrium SAS <team (at) pyd.io> | ||
* This file is part of Pydio. | ||
* | ||
* Pydio is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Pydio is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with Pydio. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* The latest code can be found at <http://pyd.io/>. | ||
*/ | ||
$mess=array( | ||
"Open Documents Viewer" => "Open Documents Viewer", | ||
"Open Document Formats viewer - based on WebODF.js library" => "Open Document Formats viewer - based on WebODF.js library", | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
/* | ||
* Copyright 2007-2013 Charles du Jeu - Abstrium SAS <team (at) pyd.io> | ||
* This file is part of Pydio. | ||
* | ||
* Pydio is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Pydio is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with Pydio. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* The latest code can be found at <http://pyd.io/>. | ||
*/ | ||
$mess=array( | ||
"Open Documents Viewer" => "Open Documents Viewer", | ||
"Open Document Formats viewer - based on WebODF.js library" => "Open Document Formats viewer - based on WebODF.js library", | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
/* | ||
* Copyright 2007-2013 Charles du Jeu - Abstrium SAS <team (at) pyd.io> | ||
* This file is part of Pydio. | ||
* | ||
* Pydio is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Pydio is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with Pydio. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* The latest code can be found at <http://pyd.io/>. | ||
*/ | ||
|
||
$mess = array( | ||
"1" => "Open Documents Viewer", | ||
"2" => "Open Documents Viewer", | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
/* | ||
* Copyright 2007-2013 Charles du Jeu - Abstrium SAS <team (at) pyd.io> | ||
* This file is part of Pydio. | ||
* | ||
* Pydio is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Pydio is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with Pydio. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* The latest code can be found at <http://pyd.io/>. | ||
*/ | ||
|
||
$mess = array( | ||
"1" => "Visualiseur Open Documents", | ||
"2" => "Visualiser les formats Open Documents Format", | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<editor enabled="false" id="editor.webodf" openable="true" iconClass="icon-font" order="1" | ||
text="webodf.2" title="webodf.3" icon="edit.png" className="WebodfEditor" | ||
mimes="odt,ods,odp" formId="webodf_box" label="CONF_MESSAGE[Open Documents Viewer]" description="CONF_MESSAGE[Open Document Formats viewer - based on WebODF.js library]" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd"> | ||
<client_settings> | ||
<resources> | ||
<js file="plugins/editor.webodf/class.WebodfEditor.js" className="WebodfEditor" autoload="true"/> | ||
<i18n path="plugins/editor.webodf/i18n" namespace="webodf"/> | ||
</resources> | ||
</client_settings> | ||
<clientForm id="webodf_box"><![CDATA[ | ||
<div id="webodf_box" box_width="80%" box_height="90%" box_padding="0"> | ||
<div class="action_bar"> | ||
<a href="#" onclick="return false;" class="icon-save" id="saveButton" onclick="saveForm();return false;"><img src="AJXP_THEME_FOLDER/images/actions/22/filesave.png" width="22" height="22" alt="AJXP_MESSAGE[53]" border="0"><br><span message_id="53">AJXP_MESSAGE[53]</span></a> | ||
<a href="#" onclick="return false;" class="icon-download" id="downloadFileButton"><img width="22" height="22" src="AJXP_THEME_FOLDER/images/actions/22/download_manager.png" alt="AJXP_MESSAGE[88]" border="0"><br><span message_id="88">AJXP_MESSAGE[88]</span></a> | ||
</div> | ||
<iframe id="webodf_container" style="border:0; width:100%;"></iframe> | ||
</div> | ||
]]></clientForm> | ||
<dependencies> | ||
<!-- Stream Wrapper Access --> | ||
<activePlugin pluginName="access.AJXP_STREAM_PROVIDER"/> | ||
</dependencies> | ||
</editor> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<p>Preview Open Document Formats files (ODT, ODS, ODP) as generated by LibreOffice or OpenOffice.</p> | ||
<p>You first have to download and install the Webodf.js library inside the plugin folder, under /webodf/webodf.js.</p> | ||
<p>Download the compiled version of the library from KOGmbh here <a href="http://webodf.org/demo/demobrowser/webodf.js">http://webodf.org/demo/demobrowser/webodf.js</a> </p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters