mirror of
https://github.com/silverstripe/silverstripe-dms
synced 2024-10-22 14:05:56 +02:00
FIX: Resolve issues with find by page documentlist
This commit is contained in:
parent
e2edeb5bf7
commit
d73b13afd5
@ -18,7 +18,8 @@ class DMSDocumentAddController extends LeftAndMain {
|
||||
private static $allowed_actions = array (
|
||||
'getEditForm',
|
||||
'documentautocomplete',
|
||||
'linkdocument'
|
||||
'linkdocument',
|
||||
'documentlist'
|
||||
);
|
||||
|
||||
/**
|
||||
@ -212,24 +213,30 @@ class DMSDocumentAddController extends LeftAndMain {
|
||||
}
|
||||
|
||||
public function documentlist() {
|
||||
$page = DataObject::get_by_id('SiteTree', (int) $_GET['pageID']);
|
||||
if($page && $page->Documents()) {
|
||||
if(!isset($_GET['pageID'])) {
|
||||
return $this->httpError(400);
|
||||
}
|
||||
|
||||
$page = SiteTree::get()->byId($_GET['pageID']);
|
||||
|
||||
if($page && $page->Documents()->count() > 0) {
|
||||
$list = '<ul>';
|
||||
|
||||
foreach($page->Documents() as $document) {
|
||||
$list .= '<li><a class="add-document" data-document-id="' . $document->ID . '">';
|
||||
$list .= $document->ID . ' - ' . Convert::raw2xml($document->Title);
|
||||
$list .= '</a></li>';
|
||||
$list .= sprintf(
|
||||
'<li><a class="add-document" data-document-id="%s">%s</a></li>',
|
||||
$document->ID,
|
||||
$document->ID . ' - '. Convert::raw2xml($document->Title)
|
||||
);
|
||||
}
|
||||
|
||||
$list .= '</ul>';
|
||||
|
||||
return $list;
|
||||
} else {
|
||||
return '<p>There are no documents attached to the selected page.</p>';
|
||||
}
|
||||
|
||||
return sprintf('<p>%s</p>',
|
||||
_t('DMSDocumentAddController.NODOCUMENTS', 'There are no documents attached to the selected page.')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
@ -18,7 +18,8 @@
|
||||
.ss-add .document-add-existing .treedropdownfield-toggle-panel-link.treedropdownfield-open-tree { background: #fff; border: 1px solid #B3B3B3; border-bottom: none; border-bottom-right-radius: 0; }
|
||||
.ss-add .document-add-existing .treedropdownfield-title { width: auto; }
|
||||
.ss-add .document-add-existing .treedropdownfield-toggle-panel-link a { display: inline-block; top: 4px; position: relative; }
|
||||
.ss-add .document-add-existing .document-list { position: absolute; z-index: 9999; width: 510px; border: 1px solid #DDD; border-top: none; background: #ffffff; display: none; box-shadow: 0 2px 4px 1px #DDD; max-height: 300px; border-radius: 6px; background-clip: padding-box; overflow: scroll; }
|
||||
.ss-add .document-add-existing .document-list { width: 510px; border: 1px solid #DDD; border-top: none; background: #ffffff; display: none; box-shadow: 0 2px 4px 1px #DDD; max-height: 300px; border-radius: 6px; background-clip: padding-box; overflow: scroll; }
|
||||
.ss-add .document-add-existing .document-list p { padding: 10px 10px 0; }
|
||||
.ss-add .document-add-existing .document-list ul { padding: 4px 0; }
|
||||
.ss-add .document-add-existing .document-list ul li { line-height: 18px; }
|
||||
.ss-add .document-add-existing .document-list ul li a { display: block; padding: 4px 8px; border: 1px solid #FFF; color: black; }
|
||||
|
@ -81,7 +81,7 @@
|
||||
$('.document-add-existing input[name=PageSelector]').entwine({
|
||||
onchange: function(event) {
|
||||
var doclist = $(this).closest('.document-add-existing').find('.document-list');
|
||||
doclist.html('<span>Loading...</span>');
|
||||
doclist.html('<p>Loading...</p>');
|
||||
doclist.show();
|
||||
doclist.load(
|
||||
'admin/pages/adddocument/documentlist?pageID=' + $(this).val()
|
||||
|
@ -104,14 +104,14 @@ $gf_colour_zebra: #F0F4F7;
|
||||
.treedropdownfield-title {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.treedropdownfield-toggle-panel-link a {
|
||||
display: inline-block;
|
||||
top: 4px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.document-list {
|
||||
position: absolute;
|
||||
z-index: 9999;
|
||||
width: 510px;
|
||||
border: 1px solid #DDD;
|
||||
border-top:none;
|
||||
@ -122,16 +122,24 @@ $gf_colour_zebra: #F0F4F7;
|
||||
border-radius: 6px;
|
||||
background-clip: padding-box;
|
||||
overflow:scroll;
|
||||
ul{
|
||||
|
||||
p {
|
||||
padding: 10px 10px 0;
|
||||
}
|
||||
|
||||
ul {
|
||||
padding: 4px 0;
|
||||
li{
|
||||
|
||||
li {
|
||||
line-height:18px;
|
||||
a{
|
||||
|
||||
a {
|
||||
display: block;
|
||||
padding: 4px 8px;
|
||||
border: 1px solid #FFF;
|
||||
color: black;
|
||||
&:hover{
|
||||
|
||||
&:hover {
|
||||
border: 1px solid #CCC;
|
||||
border-radius: 4px;
|
||||
background: rgba(203, 203, 203, 0.4);
|
||||
|
Loading…
Reference in New Issue
Block a user