Add ulrsrc attribute when create new documents
This commit is contained in:
parent
e94fa64836
commit
efcf28abc2
@ -222,11 +222,38 @@ class DocumentController extends Controller {
|
|||||||
$content = file_get_contents(dirname(__DIR__) . self::ODT_TEMPLATE_PATH);
|
$content = file_get_contents(dirname(__DIR__) . self::ODT_TEMPLATE_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$discovery_parsed = null;
|
||||||
|
try {
|
||||||
|
$discovery = $this->getDiscovery();
|
||||||
|
|
||||||
|
$loadEntities = libxml_disable_entity_loader(true);
|
||||||
|
$discovery_parsed = simplexml_load_string($discovery);
|
||||||
|
libxml_disable_entity_loader($loadEntities);
|
||||||
|
|
||||||
|
if ($discovery_parsed === false) {
|
||||||
|
$this->cache->remove('discovery.xml');
|
||||||
|
$wopiRemote = $this->settings->getAppValue('richdocuments', 'wopi_url');
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => $this->l10n->t('Collabora Online: discovery.xml from "%s" is not a well-formed XML string.', array($wopiRemote)),
|
||||||
|
'hint' => $this->l10n->t('Please contact the "%s" administrator.', array($wopiRemote))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ResponseException $e) {
|
||||||
|
return array(
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => $e->getMessage()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if ($content && $view->file_put_contents($path, $content)){
|
if ($content && $view->file_put_contents($path, $content)){
|
||||||
$info = $view->getFileInfo($path);
|
$info = $view->getFileInfo($path);
|
||||||
$response = array(
|
$response = array(
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'fileid' => $info['fileid']
|
'fileid' => $info['fileid'],
|
||||||
|
'urlsrc' => $this->getWopiSrcUrl($discovery_parsed, $mimetype, 'edit')
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$response = array(
|
$response = array(
|
||||||
|
@ -463,6 +463,8 @@ var documentsMain = {
|
|||||||
{ mimetype : mimetype },
|
{ mimetype : mimetype },
|
||||||
function(response){
|
function(response){
|
||||||
if (response && response.fileid){
|
if (response && response.fileid){
|
||||||
|
docElem.attr('data-id', response.fileid);
|
||||||
|
docElem.find('a').attr('urlsrc', response.urlsrc);
|
||||||
documentsMain.prepareSession();
|
documentsMain.prepareSession();
|
||||||
documentsMain.joinSession(response.fileid);
|
documentsMain.joinSession(response.fileid);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user