mirror of
https://github.com/nextcloud/richdocuments.git
synced 2025-12-18 05:20:43 +01:00
handle the presentation leader parameter
Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
This commit is contained in:
parent
a38ab9701f
commit
13a1fb6659
8 changed files with 25 additions and 12 deletions
|
|
@ -18,7 +18,7 @@ return [
|
|||
['name' => 'document#heartbeat', 'url' => '/heartbeat', 'verb' => 'GET'],
|
||||
|
||||
['name' => 'document#editOnline', 'url' => 'editonline', 'verb' => 'GET'],
|
||||
['name' => 'document#editOnlineFollowMeSlideShow', 'url' => 'editonline/followPresentation/{fileId}', 'verb' => 'GET'],
|
||||
['name' => 'document#editOnlineFollowMeSlideShow', 'url' => 'editonline/followPresentation/{fileId}/{leaderId}', 'verb' => 'GET'],
|
||||
['name' => 'document#editOnlineTarget', 'url' => 'editonline/{fileId}/{target}', 'verb' => 'GET'],
|
||||
|
||||
// external api access
|
||||
|
|
|
|||
|
|
@ -386,7 +386,7 @@ class DocumentController extends Controller {
|
|||
#[NoCSRFRequired]
|
||||
#[NoAdminRequired]
|
||||
#[UseSession]
|
||||
public function editOnlineFollowMeSlideShow(int $fileId): RedirectResponse|TemplateResponse {
|
||||
public function editOnlineFollowMeSlideShow(int $fileId, ?string $leaderId = null): RedirectResponse|TemplateResponse {
|
||||
if (!$this->userId) {
|
||||
return $this->renderErrorPage('File not found', Http::STATUS_NOT_FOUND);
|
||||
}
|
||||
|
|
@ -398,10 +398,11 @@ class DocumentController extends Controller {
|
|||
'fileId' => $file->getId()
|
||||
]);
|
||||
|
||||
$filePath = $file->getFileInfo()->getInternalPath();
|
||||
$directoryPath = substr($filePath, 0, strrpos($filePath, '/') + 1);
|
||||
$redirectUrl = $this->urlGenerator->getAbsoluteURL('/index.php/apps/files/' . $directoryPath . $file->getId());
|
||||
$parameters = '?openfile=true&startFollowMePresentation=true';
|
||||
$filePath = $file->getPath();
|
||||
$pathPrefixLen = strlen('/' . $this->userId. '/files');
|
||||
$directoryPath = substr($filePath, $pathPrefixLen , strrpos($filePath, '/') - $pathPrefixLen + 1);
|
||||
$redirectUrl = $this->urlGenerator->getAbsoluteURL('/index.php/apps/files/files/' . $file->getId());
|
||||
$parameters = '?openfile=true&startFollowMePresentation=true&presentationLeaderId=' . $leaderId . '&dir=' . $directoryPath;
|
||||
$redirectUrl = $redirectUrl . $parameters;
|
||||
return new RedirectResponse($redirectUrl);
|
||||
} catch (NotFoundException|NotPermittedException|NoUserException) {
|
||||
|
|
|
|||
|
|
@ -38,5 +38,9 @@ class BeforeTemplateRenderedListener implements IEventListener {
|
|||
|
||||
$startFollowMePresentation = $this->request->getParam('startFollowMePresentation') === 'true';
|
||||
$this->initialStateService->provideFollowPresentation($startFollowMePresentation);
|
||||
|
||||
$presentationLeaderId = $this->request->getParam('presentationLeaderId');
|
||||
if ($presentationLeaderId)
|
||||
$this->initialStateService->providePresentationLeader($presentationLeaderId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ class OfficePresentationStarter extends ADiscoverableReferenceProvider {
|
|||
$start = $this->urlGenerator->getAbsoluteURL('/apps/' . Application::APPNAME);
|
||||
$startIndex = $this->urlGenerator->getAbsoluteURL('/index.php/apps/' . Application::APPNAME);
|
||||
|
||||
$noIndexMatch = preg_match('/^' . preg_quote($start, '/') . '\/editonline\/followPresentation\/([0-9]+)/', $referenceText) === 1;
|
||||
$indexMatch = preg_match('/^' . preg_quote($startIndex, '/') . '\/editonline\/followPresentation\/([0-9]+)/', $referenceText) === 1;
|
||||
$noIndexMatch = preg_match('/^' . preg_quote($start, '/') . '\/editonline\/followPresentation\/([0-9]+)\/(.*)$/', $referenceText) === 1;
|
||||
$indexMatch = preg_match('/^' . preg_quote($startIndex, '/') . '\/editonline\/followPresentation\/([0-9]+)\/(.*)$/', $referenceText) === 1;
|
||||
|
||||
return $noIndexMatch || $indexMatch;
|
||||
}
|
||||
|
|
@ -52,9 +52,9 @@ class OfficePresentationStarter extends ADiscoverableReferenceProvider {
|
|||
$start = $this->urlGenerator->getAbsoluteURL('/apps/' . Application::APPNAME);
|
||||
$startIndex = $this->urlGenerator->getAbsoluteURL('/index.php/apps/' . Application::APPNAME);
|
||||
|
||||
$matched = preg_match('/^' . preg_quote($start, '/') . '\/editonline\/followPresentation\/([0-9]+)/', $referenceText, $matches) === 1;
|
||||
$matched = preg_match('/^' . preg_quote($start, '/') . '\/editonline\/followPresentation\/([0-9]+)\/(.*)$/', $referenceText, $matches) === 1;
|
||||
if (!$matched) {
|
||||
$matched = preg_match('/^' . preg_quote($startIndex, '/') . '\/editonline\/followPresentation\/([0-9]+)/', $referenceText, $matches) === 1;
|
||||
$matched = preg_match('/^' . preg_quote($startIndex, '/') . '\/editonline\/followPresentation\/([0-9]+)\/(.*)$/', $referenceText, $matches) === 1;
|
||||
}
|
||||
|
||||
if (!$matched) {
|
||||
|
|
|
|||
|
|
@ -68,6 +68,10 @@ class InitialStateService {
|
|||
$this->initialState->provideInitialState('startFollowMePresentation', $startFollowMePresentation);
|
||||
}
|
||||
|
||||
public function providePresentationLeader(string $presentationLeaderId): void {
|
||||
$this->initialState->provideInitialState('presentationLeaderId', $presentationLeaderId);
|
||||
}
|
||||
|
||||
public function provideAdminSettings(): void {
|
||||
$this->initialState->provideInitialState('adminSettings', [
|
||||
'templatesAvailable' => $this->capabilitiesService->hasTemplateSource(),
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ const getWopiSrc = (fileId) => {
|
|||
return wopiurl
|
||||
}
|
||||
|
||||
const getWopiUrl = ({ fileId, readOnly, closeButton, revisionHistory, target = undefined, startPresentation = false, startFollowMePresentation = false }) => {
|
||||
const getWopiUrl = ({ fileId, readOnly, closeButton, revisionHistory, target = undefined, startPresentation = false, startFollowMePresentation = false, presentationLeaderId = '' }) => {
|
||||
// Only set the revision history parameter if the versions app is enabled
|
||||
revisionHistory = revisionHistory && window?.oc_appswebroots?.files_versions
|
||||
|
||||
|
|
@ -46,6 +46,7 @@ const getWopiUrl = ({ fileId, readOnly, closeButton, revisionHistory, target = u
|
|||
+ (target ? '&target=' + encodeURIComponent(target) : '')
|
||||
+ (startPresentation ? '&startPresentation=1' : '')
|
||||
+ (startFollowMePresentation ? '&startFollowMePresentation=1' : '')
|
||||
+ (presentationLeaderId ? '&presentationLeaderId=' + presentationLeaderId : '')
|
||||
}
|
||||
|
||||
const getDocumentUrlFromTemplate = (templateId, fileName, fileDir, fillWithTemplate) => {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js'
|
|||
import NcListItem from '@nextcloud/vue/dist/Components/NcListItem.js'
|
||||
import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
|
||||
import TableOfContentsIcon from 'vue-material-design-icons/TableOfContents.vue'
|
||||
import { getCurrentUser } from '@nextcloud/auth'
|
||||
|
||||
export default {
|
||||
name: 'FollowMePresentationPicker',
|
||||
|
|
@ -99,7 +100,7 @@ export default {
|
|||
},
|
||||
submit() {
|
||||
const fileLink = window.location.protocol + '//' + window.location.host
|
||||
+ generateUrl('/apps/richdocuments/editonline/followPresentation/{fileId}', { fileId: this.fileId })
|
||||
+ generateUrl('/apps/richdocuments/editonline/followPresentation/{fileId}/{leaderId}', { fileId: this.fileId, leaderId: getCurrentUser().uid })
|
||||
this.$emit('submit', fileLink)
|
||||
},
|
||||
async fetchReferences() {
|
||||
|
|
|
|||
|
|
@ -326,6 +326,7 @@ export default {
|
|||
Config.update('wopi_callback_url', loadState('richdocuments', 'wopi_callback_url', ''))
|
||||
Config.update('startPresentation', loadState('richdocuments', 'startPresentation', false))
|
||||
Config.update('startFollowMePresentation', loadState('richdocuments', 'startFollowMePresentation', false))
|
||||
Config.update('presentationLeaderId', loadState('richdocuments', 'presentationLeaderId', false))
|
||||
|
||||
const forceReadOnly = this.isEmbedded && !this.hasWidgetEditingEnabled
|
||||
|
||||
|
|
@ -338,6 +339,7 @@ export default {
|
|||
startPresentation: Config.get('startPresentation'),
|
||||
target: data.target,
|
||||
startFollowMePresentation: Config.get('startFollowMePresentation'),
|
||||
presentationLeaderId: Config.get('presentationLeaderId'),
|
||||
})
|
||||
this.$set(this.formData, 'action', action)
|
||||
this.$set(this.formData, 'accessToken', data.token)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue