mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-02-10 18:05:10 +08:00
Merge pull request #4 from ONLYOFFICE/feature/create-doc
Feature/create doc
This commit is contained in:
@ -384,7 +384,7 @@ app.get("/editor", function (req, res) {
|
||||
var lastname = req.query.lastname ? req.query.lastname : "Smith";
|
||||
|
||||
if (fileExt != null) {
|
||||
var fileName = docManager.createDemo((req.query.create ? "new." : "sample.") + fileExt, userid, firstname + " " + lastname);
|
||||
var fileName = docManager.createDemo((req.query.sample ? "sample." : "new.") + fileExt, userid, firstname + " " + lastname);
|
||||
|
||||
var redirectPath = docManager.getProtocol() + "://" + docManager.req.get("host") + "/editor?fileName=" + encodeURIComponent(fileName) + docManager.getCustomParams();
|
||||
res.redirect(redirectPath);
|
||||
|
||||
BIN
web/documentserver-example/nodejs/public/images/file_upload.png
Normal file
BIN
web/documentserver-example/nodejs/public/images/file_upload.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
@ -278,6 +278,18 @@ if (typeof jQuery != "undefined") {
|
||||
});
|
||||
});
|
||||
|
||||
jq("#createSample").click(function () {
|
||||
jq(".try-editor").each(function () {
|
||||
var href = jq(this).attr("href");
|
||||
if (jq("#createSample").is(":checked")) {
|
||||
href += "&sample=true";
|
||||
} else {
|
||||
href = href.replace("&sample=true", "");
|
||||
}
|
||||
jq(this).attr("href", href);
|
||||
});
|
||||
});
|
||||
|
||||
jq.dropdownToggle({
|
||||
switcherSelector: ".question",
|
||||
dropdownID: "hint"
|
||||
|
||||
@ -99,11 +99,7 @@ pre.hljs {
|
||||
margin-top: 0px;
|
||||
}
|
||||
.save-original {
|
||||
color: #929597;
|
||||
line-height: 20px;
|
||||
margin-left: 16px;
|
||||
white-space: nowrap;
|
||||
width: 272px;
|
||||
margin-left: 30px;
|
||||
}
|
||||
label .checkbox {
|
||||
margin: 0 5px 3px 0;
|
||||
@ -143,13 +139,13 @@ label .checkbox {
|
||||
|
||||
.try-editor-list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
margin: 0 0 16px;
|
||||
padding: 0;
|
||||
}
|
||||
.try-editor-list li {
|
||||
float: left;
|
||||
margin: 25px;
|
||||
width: 150px;
|
||||
margin: 0 15px;
|
||||
width: 100px;
|
||||
}
|
||||
.try-editor {
|
||||
background-color: transparent;
|
||||
@ -172,7 +168,9 @@ label .checkbox {
|
||||
.try-editor.presentation {
|
||||
background-image: url("../images/file_pptx.png");
|
||||
}
|
||||
|
||||
.create-sample {
|
||||
margin-left: 75px;
|
||||
}
|
||||
.button, .button:visited, .button:hover, .button:active {
|
||||
display: inline-block;
|
||||
font-weight: normal;
|
||||
@ -216,27 +214,40 @@ label .checkbox {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.file-upload {
|
||||
cursor: pointer;
|
||||
margin-bottom: 8px;
|
||||
padding: 0 !important;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
.upload-panel {
|
||||
border-right: 1px solid #D1D1D1;
|
||||
float: left;
|
||||
margin-right: 25px;
|
||||
}
|
||||
.file-upload span {
|
||||
.file-upload {
|
||||
background: url("../images/file_upload.png") no-repeat center 0 transparent;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
line-height: 42px;
|
||||
margin: 2px 50px;
|
||||
height: 45px;
|
||||
margin: 0 40px 16px;
|
||||
overflow: hidden;
|
||||
padding-top: 100px;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
width: 100px;
|
||||
}
|
||||
.file-upload input {
|
||||
cursor: pointer;
|
||||
font-size: 23px;
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
transform: translate(-300px, 0) scale(4);
|
||||
}
|
||||
.create-panel {
|
||||
float: left;
|
||||
}
|
||||
.upload-panel,
|
||||
.create-panel {
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
#mainProgress {
|
||||
color: #979b9f;
|
||||
@ -421,6 +432,7 @@ footer {
|
||||
cursor: default;
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
font-size: 13px;
|
||||
height: 40px;
|
||||
-khtml-user-select: none;
|
||||
user-select: none;
|
||||
-moz-user-select: none;
|
||||
@ -434,7 +446,7 @@ footer {
|
||||
text-align: left;
|
||||
}
|
||||
.contentCells {
|
||||
padding: 2px 1px 2px 5px;
|
||||
padding: 4px 1px 4px 5px;
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
font-size: 16px;
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<a href="">
|
||||
<a href="/">
|
||||
<img src ='images/logo.png' alt="ONLYOFFICE™" />
|
||||
</a>
|
||||
</header>
|
||||
@ -82,81 +82,51 @@
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<div class="file-upload button gray">
|
||||
<span>Upload file</span>
|
||||
<input type="file" id="fileupload" name="uploadedFile" data-url="upload?<%= params %>" />
|
||||
</div>
|
||||
<label class="save-original">
|
||||
<input type="checkbox" id="checkOriginalFormat" class="checkbox" />Save document in original format
|
||||
</label>
|
||||
<span class="question"></span>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<span class="try-descr">Or, you can view and edit sample documents –click on one of the links below.</span>
|
||||
|
||||
<ul class="try-editor-list">
|
||||
<li>
|
||||
<a class="try-editor document reload-page" target="_blank" href="editor?fileExt=docx<%= params %>">Sample Document</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="try-editor spreadsheet reload-page" target="_blank" href="editor?fileExt=xlsx<%= params %>">Sample Spreadsheet</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="try-editor presentation reload-page" target="_blank" href="editor?fileExt=pptx<%= params %>">Sample Presentation</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!--<div class="help-block">
|
||||
<span>Sample documents</span>
|
||||
<div class="help-block">
|
||||
<span>Upload your file or create new file</span>
|
||||
<br />
|
||||
<br />
|
||||
<div class="stored-list">
|
||||
<div id="UserFiles">
|
||||
<table cellspacing="0" cellpadding="0" width="100%">
|
||||
<thead>
|
||||
<tr class="tableHeader">
|
||||
<td class="tableHeaderCell tableHeaderCellFileName">Filename</td>
|
||||
<td colspan="2" class="tableHeaderCell contentCells-shift">Editors</td>
|
||||
<td colspan="3" class="tableHeaderCell">Viewers</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
var listDemo = [{ext:"docx", type:"text"}, {ext:"xlsx", type:"spreadsheet"}, {ext:"pptx", type:"presentation"}];
|
||||
for (var i = 0; i < listDemo.length; i++) { %>
|
||||
<tr>
|
||||
<td class="contentCells">
|
||||
<a class="stored-edit <%= listDemo[i].type %> reload-page" href="editor?fileExt=<%= listDemo[i].ext + params %>" target="_blank">
|
||||
<span>sample.docx</span></a>
|
||||
</td>
|
||||
<td class="contentCells contentCells-icon">
|
||||
<a class="reload-page" href="editor?fileExt=<%= listDemo[i].ext + params %>" target="_blank">
|
||||
<img src="images/desktop-24.png" alt="editor" /></a>
|
||||
</td>
|
||||
<td class="contentCells contentCells-shift contentCells-icon">
|
||||
<a class="reload-page" href="editor?type=mobile&fileExt=<%= listDemo[i].ext + params %>" target="_blank">
|
||||
<img src="images/mobile-24.png" alt="mobile editor" /></a>
|
||||
</td>
|
||||
<td class="contentCells contentCells-icon">
|
||||
<a class="reload-page" href="editor?mode=view&fileExt=<%= listDemo[i].ext + params %>" target="_blank">
|
||||
<img src="images/desktop-24.png" alt="viewer" /></a>
|
||||
</td>
|
||||
<td class="contentCells contentCells-icon">
|
||||
<a class="reload-page" href="editor?type=mobile&mode=view&fileExt=<%= listDemo[i].ext + params %>" target="_blank">
|
||||
<img src="images/mobile-24.png" alt="mobile viewer" /></a>
|
||||
</td>
|
||||
<td class="contentCells contentCells-icon">
|
||||
<a class="reload-page" href="editor?type=embedded&fileExt=<%= listDemo[i].ext + params %>" target="_blank">
|
||||
<img src="images/embeded-24.png" alt="embedded" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
<% } %>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="clearFix">
|
||||
<div class="upload-panel clearFix">
|
||||
<a class="file-upload">Upload
|
||||
<br />
|
||||
File
|
||||
<input type="file" id="fileupload" name="uploadedFile" data-url="upload?<%= params %>" />
|
||||
</a>
|
||||
<br />
|
||||
<label class="save-original">
|
||||
<input type="checkbox" id="checkOriginalFormat" class="checkbox" />Keep file format
|
||||
</label>
|
||||
<span class="question"></span>
|
||||
</div>
|
||||
<div class="create-panel clearFix">
|
||||
<ul class="try-editor-list clearFix">
|
||||
<li>
|
||||
<a class="try-editor document reload-page" target="_blank" href="editor?fileExt=docx<%= params %>">Create
|
||||
<br />
|
||||
Document</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="try-editor spreadsheet reload-page" target="_blank" href="editor?fileExt=xlsx<%= params %>">Create
|
||||
<br />
|
||||
Spreadsheet</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="try-editor presentation reload-page" target="_blank" href="editor?fileExt=pptx<%= params %>">Create
|
||||
<br />
|
||||
Presentation</a>
|
||||
</li>
|
||||
</ul>
|
||||
<label class="create-sample">
|
||||
<input type="checkbox" id="createSample" class="checkbox" />Create a file filled with sample content
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
</div>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<% if (storedFiles.length > 0)
|
||||
{ %>
|
||||
@ -166,17 +136,16 @@
|
||||
<br />
|
||||
<br />
|
||||
<div class="stored-list">
|
||||
<div id="UserFiles">
|
||||
<table cellspacing="0" cellpadding="0" width="100%">
|
||||
<thead>
|
||||
<tr class="tableHeader">
|
||||
<td class="tableHeaderCell tableHeaderCellFileName">Filename</td>
|
||||
<td colspan="2" class="tableHeaderCell contentCells-shift">Editors</td>
|
||||
<td colspan="3" class="tableHeaderCell">Viewers</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% for (var i = 0; i < storedFiles.length; i++) { %>
|
||||
<table cellspacing="0" cellpadding="0" width="100%">
|
||||
<thead>
|
||||
<tr class="tableHeader">
|
||||
<td class="tableHeaderCell tableHeaderCellFileName">Filename</td>
|
||||
<td colspan="2" class="tableHeaderCell contentCells-shift">Editors</td>
|
||||
<td colspan="3" class="tableHeaderCell">Viewers</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% for (var i = 0; i < storedFiles.length; i++) { %>
|
||||
<tr>
|
||||
<td class="contentCells">
|
||||
<a class="stored-edit <%= storedFiles[i].documentType%>" href="editor?fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
|
||||
@ -207,10 +176,9 @@
|
||||
<img src="images/embeded-24.png" alt="embedded" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
<% } %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<% } %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<% } %>
|
||||
|
||||
Reference in New Issue
Block a user