File tree Expand file tree Collapse file tree 3 files changed +25
-8
lines changed Expand file tree Collapse file tree 3 files changed +25
-8
lines changed Original file line number Diff line number Diff line change 11import DOMPurify from 'dompurify' ;
22
33window . addEventListener ( 'load' , ( ) => {
4- fetch ( loris . BaseURL + " /dashboard/projectdescription" ) . then ( ( resp ) => {
4+ fetch ( loris . BaseURL + ' /dashboard/projectdescription' ) . then ( ( resp ) => {
55 if ( ! resp . ok ) {
66 throw new Error ( 'Could not get project description' ) ;
77 }
88 return resp . json ( ) ;
9- } ) . then ( ( json ) => {
10- const el = document . getElementById ( " project-description" ) ;
9+ } ) . then ( ( json ) => {
10+ const el = document . getElementById ( ' project-description' ) ;
1111 el . innerHTML = DOMPurify . sanitize ( json . Description ) ;
1212 } ) . catch ( ( e ) => console . error ( e ) ) ;
1313} ) ;
Original file line number Diff line number Diff line change 11<?php
22namespace LORIS \dashboard ;
3- use \Psr \Http \Server \RequestHandlerInterface ;
43use \Psr \Http \Message \ServerRequestInterface ;
54use \Psr \Http \Message \ResponseInterface ;
65
@@ -12,11 +11,28 @@ use \Psr\Http\Message\ResponseInterface;
1211
1312class ProjectDescription extends \LORIS \Http \Endpoint
1413{
15- public function handle (ServerRequestInterface $ request ) : ResponseInterface {
14+ /**
15+ * {@inheritDoc}
16+ *
17+ * @param ServerRequestInterface $request The incoming request
18+ *
19+ * @return ResponseInterface
20+ */
21+ public function handle (ServerRequestInterface $ request ) : ResponseInterface
22+ {
1623 $ desc = $ this ->loris ->getConfiguration ()->getSetting ('projectDescription ' );
1724 return new \LORIS \Http \Response \JSON \OK (['Description ' => $ desc ]);
1825 }
19- public function _hasAccess (\User $ user ) {
26+
27+ /**
28+ * The hasAccess call called by the Module class before loading the page.
29+ *
30+ * @param \User $user The user accessing the page
31+ *
32+ * @return bool
33+ */
34+ function _hasAccess (\User $ user )
35+ {
2036 return true ;
2137 }
2238}
Original file line number Diff line number Diff line change @@ -70,13 +70,14 @@ public function hasAccess(\User $user): bool
7070 * This function can be overridden in a module's page to load the necessary
7171 * resources to check the permissions of a user.
7272 *
73- * @param User $user The user to load the resources for
73+ * @param \ User $user The user to load the resources for
7474 * @param ServerRequestInterface $request The PSR15 Request being handled
7575 *
7676 * @return void
7777 */
7878 public function loadResources (
79- \User $ user , ServerRequestInterface $ request
79+ \User $ user ,
80+ ServerRequestInterface $ request
8081 ) : void {
8182 }
8283}
You can’t perform that action at this time.
0 commit comments