15
15
16
16
namespace PKP \components \forms \context ;
17
17
18
+ use APP \core \Application ;
19
+ use PKP \db \DAORegistry ;
18
20
use PKP \components \forms \FieldRichTextarea ;
19
21
use PKP \components \forms \FieldSelect ;
20
22
use PKP \components \forms \FieldText ;
@@ -51,6 +53,23 @@ public function __construct($action, $locales, $context, $imageUploadUrl)
51
53
return strcmp ($ a ['label ' ], $ b ['label ' ]);
52
54
});
53
55
56
+ // Add list of links to public
57
+ $ request = Application::get ()->getRequest ();
58
+ $ context = $ request ->getContext ();
59
+ $ libraryFileDao = DAORegistry::getDAO ('LibraryFileDAO ' );
60
+ $ contextId = $ context ->getId ();
61
+ $ files = $ libraryFileDao ->getByContextId ($ contextId );
62
+ $ linkList = [];
63
+
64
+ while ($ file = $ files ->next ()) {
65
+ if ($ file ->getPublicAccess ()){
66
+ $ linkList [] = [
67
+ "title " => $ file ->getLocalizedName (),
68
+ "value " => $ request ->getDispatcher ()->url (Application::get ()->getRequest (), Application::ROUTE_PAGE , null , 'libraryFiles ' , 'downloadPublic ' , [$ file ->getId ()])
69
+ ];
70
+ }
71
+ }
72
+
54
73
$ this ->addGroup ([
55
74
'id ' => 'identity ' ,
56
75
'label ' => __ ('manager.setup.identity ' ),
@@ -96,6 +115,7 @@ public function __construct($action, $locales, $context, $imageUploadUrl)
96
115
'toolbar ' => 'bold italic superscript subscript | link | blockquote bullist numlist | image | code ' ,
97
116
'plugins ' => ['link ' ,'lists ' ,'image ' ,'code ' ],
98
117
'uploadUrl ' => $ imageUploadUrl ,
118
+ 'linkList ' => $ linkList ,
99
119
'value ' => $ context ->getData ('editorialHistory ' ),
100
120
]))
101
121
->addGroup ([
@@ -107,17 +127,19 @@ public function __construct($action, $locales, $context, $imageUploadUrl)
107
127
'description ' => __ ('manager.setup.contextSummary.description ' ),
108
128
'isMultilingual ' => true ,
109
129
'groupId ' => 'about ' ,
130
+ 'linkList ' => $ linkList ,
110
131
'value ' => $ context ->getData ('description ' ),
111
132
]))
112
133
->addField (new FieldRichTextarea ('about ' , [
113
134
'label ' => __ ('manager.setup.contextAbout ' ),
114
135
'description ' => __ ('manager.setup.contextAbout.description ' ),
115
136
'isMultilingual ' => true ,
116
137
'size ' => 'large ' ,
117
- 'groupId ' => 'about ' ,
138
+ 'groupId ' => 'about ' ,
118
139
'toolbar ' => 'bold italic superscript subscript | link | blockquote bullist numlist | image | code ' ,
119
140
'plugins ' => ['link ' ,'lists ' ,'image ' ,'code ' ],
120
141
'uploadUrl ' => $ imageUploadUrl ,
142
+ 'linkList ' => $ linkList ,
121
143
'value ' => $ context ->getData ('about ' ),
122
144
]));
123
145
}
0 commit comments