Skip to content

Commit

Permalink
onlyofficeOpen as default action for Office Open XML formats #4
Browse files Browse the repository at this point in the history
  • Loading branch information
LinneyS committed Mar 1, 2017
1 parent a28a48d commit 6066322
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## owncloud-onlyoffice (1.0.1)
- fix exception when versions app is disabled
- adding protocol to document server url

- onlyofficeOpen is default action

## owncloud-onlyoffice (1.0.0)
- Initial release
10 changes: 7 additions & 3 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@
}
};

OCA.Onlyoffice.FileClick = function (context, attr) {
var fileInfoModel = context.fileInfoModel;
OCA.Onlyoffice.FileClick = function (fileName, context, attr) {
var fileInfoModel = context.fileInfoModel || context.fileList.getModelForFile(fileName);
var fileList = context.fileList;
if (!attr.conv) {
OCA.Onlyoffice.OpenEditor(fileInfoModel.id);
Expand Down Expand Up @@ -140,9 +140,13 @@
return OC.imagePath(OCA.Onlyoffice.AppName, "btn-edit");
},
actionHandler: function (fileName, context) {
OCA.Onlyoffice.FileClick(context, attr);
OCA.Onlyoffice.FileClick(fileName, context, attr);
}
});

if (attr.def && !fileList.fileActions.getDefaultFileAction(attr.mime, "file", OC.PERMISSION_READ)) {
fileList.fileActions.setDefault(attr.mime, "onlyofficeOpen");
}
});
}
);
Expand Down
8 changes: 4 additions & 4 deletions lib/appconfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ private function DropSKey() {
* @var array
*/
public $formats = [
"docx" => [ "mime" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "type" => "text", "edit" => true ],
"xlsx" => [ "mime" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "type" => "spreadsheet", "edit" => true ],
"pptx" => [ "mime" => "application/vnd.openxmlformats-officedocument.presentationml.presentation", "type" => "presentation", "edit" => true ],
"ppsx" => [ "mime" => "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "type" => "presentation", "edit" => true ],
"docx" => [ "mime" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "type" => "text", "edit" => true, "def" => true ],
"xlsx" => [ "mime" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "type" => "spreadsheet", "edit" => true, "def" => true ],
"pptx" => [ "mime" => "application/vnd.openxmlformats-officedocument.presentationml.presentation", "type" => "presentation", "edit" => true, "def" => true ],
"ppsx" => [ "mime" => "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "type" => "presentation", "edit" => true, "def" => true ],
"txt" => [ "mime" => "text/plain", "type" => "text", "edit" => true ],
"csv" => [ "mime" => "text/csv", "type" => "spreadsheet"/*, "edit" => true*/ ],
"odt" => [ "mime" => "application/vnd.oasis.opendocument.text", "type" => "text", "conv" => true ],
Expand Down

0 comments on commit 6066322

Please sign in to comment.