Add ulrsrc attribute when create new documents

pull/1/head
Henry Castro 8 years ago
parent e94fa64836
commit efcf28abc2

@ -222,11 +222,38 @@ class DocumentController extends Controller {
$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)){
$info = $view->getFileInfo($path);
$response = array(
'status' => 'success',
'fileid' => $info['fileid']
'fileid' => $info['fileid'],
'urlsrc' => $this->getWopiSrcUrl($discovery_parsed, $mimetype, 'edit')
);
} else {
$response = array(

@ -463,6 +463,8 @@ var documentsMain = {
{ mimetype : mimetype },
function(response){
if (response && response.fileid){
docElem.attr('data-id', response.fileid);
docElem.find('a').attr('urlsrc', response.urlsrc);
documentsMain.prepareSession();
documentsMain.joinSession(response.fileid);
} else {

Loading…
Cancel
Save