Skip to content

Commit

Permalink
Option 'ms_sharepoint_support' replaces ms_sharepoint_plugin and ms_s…
Browse files Browse the repository at this point in the history
…harepoint_urls
  • Loading branch information
mar10 committed Aug 13, 2018
1 parent b88cc7c commit ed9b224
Show file tree
Hide file tree
Showing 11 changed files with 190 additions and 121 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ This release contains **BREAKING CHANGES!**
- Refactor WsgiDirBrowser:
- Use Jinja2 and load static assets through own WsgiDAV provider
- Move to `addons.dir_browser` package
- Support Docker
https://cloud.docker.com/swarm/mar10/repository/docker/mar10/wsgidav/
- Option 'ms_sharepoint_support' replaces ms_sharepoint_plugin and ms_sharepoint_urls
- Support [Docker image](https://hub.docker.com/r/mar10/wsgidav/)
- MSI setup uses Cheroot/6.4 Python 3.6
- #112: Added limited support for Microsoft's Win32LastModified property.

Expand Down
64 changes: 13 additions & 51 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions doc/annotated_wsgidav.conf
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,9 @@ dir_browser = {
"response_trailer": "", # Raw HTML code, appended as footer
"davmount": False, # Send <dm:mount> response if request URL contains '?davmount'
"ms_mount": False, # Add an 'open as webfolder' link (requires Windows)
"ms_sharepoint_plugin": True, # Invoke MS Offce documents for editing using WebDAV
"ms_sharepoint_urls": False, # Prepend 'ms-word:ofe|u|' to URL for MS Offce documents
"ms_sharepoint_support": True, # Invoke MS Offce documents for editing using WebDAV
; "ms_sharepoint_plugin": False, # Invoke MS Offce documents for editing using WebDAV
; "ms_sharepoint_urls": False, # Prepend 'ms-word:ofe|u|' to URL for MS Offce documents
# "app_class": MyBrowser, # (DEPRECATED with 2.4.0) Used instead of WsgiDavDirBrowser
}

Expand Down
5 changes: 3 additions & 2 deletions doc/sample_wsgidav.conf
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,9 @@ dir_browser = {
"response_trailer": "", # Raw HTML code, appended as footer
"davmount": False, # Send <dm:mount> response if request URL contains '?davmount'
"ms_mount": False, # Add an 'open as webfolder' link (requires Windows)
"ms_sharepoint_plugin": True, # Invoke MS Offce documents for editing using WebDAV
"ms_sharepoint_urls": False, # Prepend 'ms-word:ofe|u|' to URL for MS Offce documents
"ms_sharepoint_support": True, # Invoke MS Offce documents for editing using WebDAV
; "ms_sharepoint_plugin": False, # Invoke MS Offce documents for editing using WebDAV
; "ms_sharepoint_urls": False, # Prepend 'ms-word:ofe|u|' to URL for MS Offce documents
# "app_class": MyBrowser, # (DEPRECATED with 2.4.0) Used instead of WsgiDavDirBrowser
}

Expand Down
3 changes: 1 addition & 2 deletions doc/sample_wsgidav.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"response_trailer": "",
"davmount": false,
"ms_mount": false,
"ms_sharepoint_plugin": true,
"ms_sharepoint_urls": false
"ms_sharepoint_support": true
}
}
23 changes: 15 additions & 8 deletions sample_wsgidav.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ verbose: 3

#: Set logging output format
#: (see https://docs.python.org/3/library/logging.html#logging.Formatter)
logger_format: "%(asctime)s.%(msecs)03d - <%(thread)d> %(name)-27s %(levelname)-8s: %(message)s"
logger_format: "%(asctime)s.%(msecs)03d - <%(thread)05d> %(name)-27s %(levelname)-8s: %(message)s"
logger_date_format: "%H:%M:%S"
#: Let ErrorPrinter middleware catch all exceptions to return as 500 Internal Error
Expand Down Expand Up @@ -154,13 +154,20 @@ dir_browser:
davmount: false
#: Add an 'open as webfolder' link (requires Windows IE <= 7!)
ms_mount: false
#: Invoke MS Office documents for editing using WebDAV by adding JavaScript
#: code that invokes the SharePoint plugin ActiveXObject("SharePoint.OpenDocuments")
#: (Requires MS IE)
ms_sharepoint_plugin: false
#: Prepend 'ms-word:ofe|u|' to URLs for MS Office documents
#: (This option is ignored if ms_sharepoint_plugin is true.)
ms_sharepoint_urls: true
#: Invoke MS Office documents for editing using WebDAV by adding a JavaScript
#: click handler.
#: - For IE 11 and below invokes the SharePoint ActiveXObject("SharePoint.OpenDocuments")
#: - If the custom legacy Firefox plugin is available, it will be used
#: https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ff407576(v%3Doffice.14)
#: - Otherwise the Office URL prefix is used (e.g. 'ms-word:ofe|u|http://server/path/file.docx')
ms_sharepoint_support: true
# #: Invoke MS Office documents for editing using WebDAV by adding JavaScript
# #: code that invokes the SharePoint plugin ActiveXObject("SharePoint.OpenDocuments")
# #: (Requires MS IE 8-11, but not Edge)
# ms_sharepoint_plugin: false
# #: Prepend 'ms-word:ofe|u|' to URLs for MS Office documents
# #: (This option is ignored if ms_sharepoint_plugin is true.)
# ms_sharepoint_urls: false
# ----------------------------------------------------------------------------
Expand Down
13 changes: 9 additions & 4 deletions wsgidav/addons/dir_browser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def _get_context(self, environ, davres):
assert davres.is_collection

dirConfig = environ["wsgidav.config"].get("dir_browser", {})
isReadOnly = environ["wsgidav.provider"].is_readonly()
is_readonly = environ["wsgidav.provider"].is_readonly()

context = {
"htdocs": (self.config.get("mount_path") or "") + ASSET_SHARE,
Expand All @@ -143,7 +143,7 @@ def _get_context(self, environ, davres):
"url": davres.get_href(), # util.make_complete_url(environ),
"parentUrl": util.get_uri_parent(davres.get_href()),
"config": dirConfig,
"is_readonly": isReadOnly,
"is_readonly": is_readonly,
}

trailer = dirConfig.get("response_trailer")
Expand Down Expand Up @@ -173,22 +173,27 @@ def _get_context(self, environ, davres):
for res in childList:
di = res.get_display_info()
href = res.get_href()
ofe_prefix = None
tr_classes = []
a_classes = []
if res.is_collection:
tr_classes.append("directory")

if not isReadOnly and not res.is_collection:
if not is_readonly and not res.is_collection:
ext = os.path.splitext(href)[1].lstrip(".").lower()
officeType = msOfficeExtToTypeMap.get(ext)
if officeType:
if dirConfig.get("ms_sharepoint_plugin"):
if dirConfig.get("ms_sharepoint_support"):
ofe_prefix = "ms-{}:ofe|u|".format(officeType)
a_classes.append("msoffice")
elif dirConfig.get("ms_sharepoint_plugin"):
a_classes.append("msoffice")
elif dirConfig.get("ms_sharepoint_urls"):
href = "ms-{}:ofe|u|{}".format(officeType, href)

entry = {
"href": href,
"ofe_prefix": ofe_prefix,
"aClass": " ".join(a_classes),
"trClass": " ".join(tr_classes),
"displayName": res.get_display_name(),
Expand Down
Loading

0 comments on commit ed9b224

Please sign in to comment.