Compare commits

..

5 Commits

11 changed files with 42 additions and 26 deletions

View File

@ -352,7 +352,7 @@ app.post("/track", function (req, res) {
response.write("{\"error\":0}");
response.end();
}
};
if (body.status == 1) { //Editing
if (body.actions && body.actions[0].type == 0) { //finished edit
@ -367,14 +367,16 @@ app.post("/track", function (req, res) {
}
}
response.write("{\"error\":0}");
response.end();
} else if (body.status == 2 || body.status == 3) { //MustSave, Corrupted
processSave(body.url, body, fileName, userAddress, response, true);
} else if (body.status == 6 || body.status == 7) { //MustForceSave, CorruptedForceSave
processSave(body.url, body, fileName, userAddress, response);
} else if (body.status == 2 || body.status == 3 //MustSave, Corrupted
|| body.status == 6 || body.status == 7) { //MustForceSave, CorruptedForceSave
var newVersion = (body.status == 2 || body.status == 3);
processSave(body.url, body, fileName, userAddress, response, newVersion);
return;
}
}
response.write("{\"error\":0}");
response.end();
};
var readbody = function (request, response, fileName, userAddress) {
var content = "";
@ -385,7 +387,7 @@ app.post("/track", function (req, res) {
var body = JSON.parse(content);
processTrack(response, body, fileName, userAddress);
});
}
};
if (req.body.hasOwnProperty("status")) {
processTrack(res, req.body, fileName, userAddress);
@ -410,7 +412,7 @@ app.get("/editor", function (req, res) {
if (fileExt != null) {
var fileName = docManager.createDemo((req.query.sample ? "sample." : "new.") + fileExt, userid, name);
var redirectPath = docManager.getProtocol() + "://" + docManager.req.get("host") + "/editor?fileName=" + encodeURIComponent(fileName) + docManager.getCustomParams();
var redirectPath = docManager.getServerUrl() + "/editor?fileName=" + encodeURIComponent(fileName) + docManager.getCustomParams();
res.redirect(redirectPath);
return;
}
@ -467,7 +469,7 @@ app.get("/editor", function (req, res) {
documentType: fileUtility.getFileType(fileName),
key: key,
callbackUrl: docManager.getCallback(fileName),
isEdit: canEdit,
isEdit: canEdit && mode != "review",
mode: canEdit && mode != "view" ? "edit" : "view",
canBackToFolder: type != "embedded",
getServerUrl: docManager.getServerUrl(),

View File

@ -152,7 +152,7 @@ docManager.getFileUri = function (fileName) {
};
docManager.getlocalFileUri = function (fileName, version) {
var serverPath = docManager.getProtocol() + "://" + docManager.req.get("host");
var serverPath = docManager.getServerUrl();
var storagePath = storageFolder.length ? storageFolder + "/" : "";
var hostAddress = docManager.curUserHostAddress();
var url = serverPath + "/" + storagePath + hostAddress + "/" + encodeURIComponent(fileName);
@ -167,7 +167,7 @@ docManager.getServerUrl = function () {
};
docManager.getCallback = function (fileName) {
var server = docManager.getProtocol() + "://" + docManager.req.get("host");
var server = docManager.getServerUrl();
var hostAddress = docManager.curUserHostAddress();
var handler = "/track?useraddress=" + encodeURIComponent(hostAddress) + "&filename=" + encodeURIComponent(fileName);

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

View File

@ -288,7 +288,7 @@ footer {
background-repeat: no-repeat;
display: inline-block;
height: 16px;
max-width: 450px;
max-width: 250px;
margin-bottom: -6px;
overflow: hidden;
padding: 8px 0 1px 34px;

View File

@ -114,8 +114,9 @@
created: new Date().toDateString()
},
permissions: {
download: true,
edit: "<%= editor.isEdit %>" == "true",
download: true
review: true,
}
},
editorConfig: {
@ -138,7 +139,7 @@
comments: true,
feedback: true,
goback: {
url: ("<%= editor.type %>" == "embedded" ? null : "<%= editor.getServerUrl %>")
url: "<%= editor.getServerUrl %>"
}
},
fileChoiceUrl: "<%= editor.fileChoiceUrl %>",

View File

@ -129,7 +129,7 @@
<thead>
<tr class="tableHeader">
<td class="tableHeaderCell tableHeaderCellFileName">Filename</td>
<td colspan="2" class="tableHeaderCell contentCells-shift">Editors</td>
<td colspan="3" class="tableHeaderCell contentCells-shift">Editors</td>
<td colspan="3" class="tableHeaderCell">Viewers</td>
</tr>
</thead>
@ -137,7 +137,7 @@
<% for (var i = 0; i < storedFiles.length; i++) { %>
<tr class="tableRow" title="<%=storedFiles[i].name%>">
<td class="contentCells">
<a class="stored-edit <%= storedFiles[i].documentType%>" href="editor?fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
<a class="stored-edit <%= storedFiles[i].documentType %>" href="editor?fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
<span title="<%= storedFiles[i].url %>"><%= storedFiles[i].name %></span></a>
<a href="<%= storedFiles[i].url %>">
<img class="icon-download" src="images/download-24.png" alt="Download" title="Download" /></a>
@ -148,10 +148,16 @@
<a href="editor?fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
<img src="images/desktop-24.png" alt="Open in editor for full size screens" title="Open in editor for full size screens" /></a>
</td>
<td class="contentCells contentCells-shift contentCells-icon">
<td class="contentCells contentCells-icon">
<a href="editor?type=mobile&mode=edit&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
<img src="images/mobile-24.png" alt="Open in editor for mobile devices" title="Open in editor for mobile devices" /></a>
</td>
<td class="contentCells contentCells-shift contentCells-icon">
<% if (storedFiles[i].documentType == "text") { %>
<a href="editor?mode=review&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
<img src="images/review-24.png" alt="Open in editor for review" title="Open in editor for review" /></a>
<% } %>
</td>
<td class="contentCells contentCells-icon">
<a href="editor?mode=view&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
<img src="images/desktop-24.png" alt="Open in viewer for full size screens" title="Open in viewer for full size screens" /></a>

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

View File

@ -291,7 +291,7 @@ footer {
background-repeat: no-repeat;
display: inline-block;
height: 16px;
max-width: 450px;
max-width: 250px;
margin-bottom: -6px;
overflow: hidden;
padding: 8px 0 1px 34px;

View File

@ -174,8 +174,9 @@
},
permissions: {
edit: <?php echo (in_array(strtolower('.' . pathinfo($filename, PATHINFO_EXTENSION)), $GLOBALS['DOC_SERV_EDITED']) ? "true" : "false") ?>,
download: true,
edit: <?php echo (in_array(strtolower('.' . pathinfo($filename, PATHINFO_EXTENSION)), $GLOBALS['DOC_SERV_EDITED']) && $_GET["action"] != "review" ? "true" : "false") ?>,
review: true
}
},
editorConfig: {

View File

@ -249,8 +249,8 @@ function SendRequestToConvertService($document_uri, $from_extension, $to_extensi
if (!function_exists('simplexml_load_file')){
throw new Exception("Server can't read xml");
}
$data = simplexml_load_string($response_xml_data);
if (!$data) {
$response_data = simplexml_load_string($response_xml_data);
if (!$response_data) {
$exc = "Bad Response. Errors: ";
foreach(libxml_get_errors() as $error) {
$exc = $exc . "\t" . $error->message;
@ -258,7 +258,7 @@ function SendRequestToConvertService($document_uri, $from_extension, $to_extensi
throw new Exception ($exc);
}
return $data;
return $response_data;
}

View File

@ -163,7 +163,7 @@
<thead>
<tr class="tableHeader">
<td class="tableHeaderCell tableHeaderCellFileName">Filename</td>
<td colspan="2" class="tableHeaderCell contentCells-shift">Editors</td>
<td colspan="3" class="tableHeaderCell contentCells-shift">Editors</td>
<td colspan="3" class="tableHeaderCell">Viewers</td>
</tr>
</thead>
@ -188,10 +188,16 @@
echo ' <img src="css/images/desktop-24.png" alt="Open in editor for full size screens" title="Open in editor for full size screens" /></a>';
echo ' </a>';
echo ' </td>';
echo ' <td class="contentCells contentCells-shift contentCells-icon">';
echo ' <td class="contentCells contentCells-icon">';
echo ' <a href="doceditor.php?fileID='.urlencode($storeFile->name).'&user='.$user.'&type=mobile" target="_blank">';
echo ' <img src="css/images/mobile-24.png" alt="Open in editor for mobile devices" title="Open in editor for mobile devices" /></a>';
echo ' </a>';
echo ' <td class="contentCells contentCells-shift contentCells-icon">';
if ($storeFile->documentType == "text") {
echo ' <a href="doceditor.php?fileID='.urlencode($storeFile->name).'&user='.$user.'&action=review" target="_blank">';
echo ' <img src="css/images/review-24.png" alt="Open in editor for review" title="Open in editor for review" /></a>';
echo ' </a>';
}
echo ' </td>';
echo ' <td class="contentCells contentCells-icon">';
echo ' <a href="doceditor.php?fileID='.urlencode($storeFile->name).'&user='.$user.'&action=view" target="_blank">';