Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
4732373f
Commit
4732373f
authored
Oct 06, 2009
by
Richard Mansfield
Browse files
Use filebrowser element to select folders in folder blocktype
Signed-off-by:
Richard Mansfield
<
richardm@catalyst.net.nz
>
parent
ebf29cfa
Changes
4
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/file/blocktype/folder/lib.php
View file @
4732373f
...
...
@@ -80,8 +80,10 @@ class PluginBlocktypeFolder extends PluginBlocktype {
public
static
function
instance_config_form
(
$instance
,
$istemplate
)
{
$configdata
=
$instance
->
get
(
'configdata'
);
safe_require
(
'artefact'
,
'file'
);
$instance
->
set
(
'artefactplugin'
,
'file'
);
return
array
(
self
::
artefact
choo
ser_element
((
isset
(
$configdata
[
'artefactid'
]))
?
$configdata
[
'artefactid'
]
:
null
),
'
artefact
id'
=>
self
::
filebrow
ser_element
(
$instance
,
(
isset
(
$configdata
[
'artefactid'
]))
?
array
(
$configdata
[
'artefactid'
]
)
:
null
),
);
}
...
...
@@ -118,6 +120,18 @@ class PluginBlocktypeFolder extends PluginBlocktype {
return
'parent, title'
;
}
public
static
function
filebrowser_element
(
&
$instance
,
$default
=
array
())
{
$element
=
ArtefactTypeFileBase
::
blockconfig_filebrowser_element
(
$instance
,
$default
);
$element
[
'title'
]
=
get_string
(
'file'
,
'artefact.file'
);
$element
[
'name'
]
=
'artefactid'
;
$element
[
'config'
][
'selectone'
]
=
true
;
$element
[
'config'
][
'selectfolders'
]
=
true
;
$element
[
'filters'
]
=
array
(
'artefacttype'
=>
array
(
'folder'
),
);
return
$element
;
}
public
static
function
default_copy_type
()
{
return
'full'
;
}
...
...
htdocs/artefact/file/form/elements/filebrowser.php
View file @
4732373f
...
...
@@ -216,6 +216,7 @@ function pieform_element_filebrowser_build_filelist($form, $element, $folder, $h
$userid
=
(
$group
||
$institution
)
?
null
:
$USER
->
get
(
'id'
);
$editable
=
(
int
)
$element
[
'config'
][
'edit'
];
$selectable
=
(
int
)
$element
[
'config'
][
'select'
];
$selectfolders
=
(
int
)
$element
[
'config'
][
'selectfolders'
];
$publishing
=
(
int
)
!
empty
(
$element
[
'config'
][
'publishing'
]);
$querybase
=
$element
[
'page'
]
.
(
strpos
(
$element
[
'page'
],
'?'
)
===
false
?
'?'
:
'&'
);
$prefix
=
$form
->
get_name
()
.
'_'
.
$element
[
'name'
];
...
...
@@ -227,6 +228,7 @@ function pieform_element_filebrowser_build_filelist($form, $element, $folder, $h
$smarty
->
assign
(
'highlight'
,
$highlight
);
$smarty
->
assign
(
'editable'
,
$editable
);
$smarty
->
assign
(
'selectable'
,
$selectable
);
$smarty
->
assign
(
'selectfolders'
,
$selectfolders
);
$smarty
->
assign
(
'publishing'
,
$publishing
);
$smarty
->
assign
(
'filelist'
,
$filedata
);
$smarty
->
assign
(
'querybase'
,
$querybase
);
...
...
htdocs/artefact/file/theme/raw/form/filebrowser.tpl
View file @
4732373f
...
...
@@ -92,7 +92,7 @@
</div>
<div
id=
"
{
$prefix
}
_filelist_container"
>
{
include
file
=
"artefact:file:form/filelist.tpl"
prefix
=
$prefix
filelist
=
$filelist
editable
=
$config.edit
selectable
=
$config.select
highlight
=
$highlight
edit
=
$edit
querybase
=
$querybase
groupinfo
=
$groupinfo
owner
=
$tabs.owner
ownerid
=
$tabs.ownerid
}
{
include
file
=
"artefact:file:form/filelist.tpl"
prefix
=
$prefix
filelist
=
$filelist
editable
=
$config.edit
selectable
=
$config.select
highlight
=
$highlight
edit
=
$edit
querybase
=
$querybase
groupinfo
=
$groupinfo
owner
=
$tabs.owner
ownerid
=
$tabs.ownerid
selectfolders
=
$config.selectfolders
}
</div>
{* Edit form used when js is available *}
...
...
htdocs/artefact/file/theme/raw/form/filelist.tpl
View file @
4732373f
...
...
@@ -44,7 +44,7 @@
{
if
!
isset
(
$file
->
can_edit
)
||
$file
->
can_edit
!==
0
}
<input
type=
"submit"
class=
"submit btn-edit s"
name=
"
{
$prefix
}
_edit[
{
$file
->
id
}
]"
value=
"
{
str
tag
=
edit
}
"
/>
<input
type=
"submit"
class=
"submit btn-del s"
name=
"
{
$prefix
}
_delete[
{
$file
->
id
}
]"
value=
"
{
str
tag
=
delete
}
"
/>
{/
if
}
{/
if
}
{
if
$selectable
&&
$file
->
artefacttype
!=
'folder'
&&
$publishable
}
{
if
$selectable
&&
(
$file
->
artefacttype
!=
'folder'
||
$selectfolders
)
&&
$publishable
&&
!
$file
->
isparent
}
<input
type=
"submit"
class=
"select small"
name=
"
{
$prefix
}
_select[
{
$file
->
id
}
]"
id=
"
{
$prefix
}
_select_
{
$file
->
id
}
"
value=
"
{
str
tag
=
select
}
"
/>
{/
if
}
</td>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment