Skip to content
Snippets Groups Projects
Commit 32f710a8 authored by srosse's avatar srosse
Browse files

Merge OpenOLAT 11.5 to OpenOLAT default branch with 33d397ec387d0fb7d3294e194d60677f5e340d49

parents e473e277 21ceef5d
No related branches found
No related tags found
No related merge requests found
...@@ -108,6 +108,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -108,6 +108,8 @@ import org.springframework.beans.factory.annotation.Autowired;
* @author Florian Gnägi * @author Florian Gnägi
*/ */
public class FileUploadController extends FormBasicController { public class FileUploadController extends FormBasicController {
private static final String[] resizeKeys = new String[]{"resize"};
private int status = FolderCommandStatus.STATUS_SUCCESS; private int status = FolderCommandStatus.STATUS_SUCCESS;
private VFSContainer currentContainer; private VFSContainer currentContainer;
...@@ -266,11 +268,11 @@ public class FileUploadController extends FormBasicController { ...@@ -266,11 +268,11 @@ public class FileUploadController extends FormBasicController {
} }
formLayout.add(resizeCont); formLayout.add(resizeCont);
String[] keys = new String[]{"resize"};
String[] values = new String[]{translate("resize_image")}; String[] values = new String[]{translate("resize_image")};
resizeEl = uifactory.addCheckboxesHorizontal("resize_image", resizeCont, keys, values); resizeEl = uifactory.addCheckboxesHorizontal("resize_image", resizeCont, resizeKeys, values);
resizeEl.setLabel(null, null); resizeEl.setLabel(null, null);
resizeEl.select("resize", true); resizeEl.select(resizeKeys[0], true);
resizeEl.setVisible(false);
} }
// Check remaining quota // Check remaining quota
...@@ -311,19 +313,29 @@ public class FileUploadController extends FormBasicController { ...@@ -311,19 +313,29 @@ public class FileUploadController extends FormBasicController {
fileEl.reset(); fileEl.reset();
fileEl.setDeleteEnabled(false); fileEl.setDeleteEnabled(false);
fileEl.clearError(); fileEl.clearError();
} else if(metaDataCtr != null) { resizeEl.setVisible(false);
} else {
String filename = fileEl.getUploadFileName(); String filename = fileEl.getUploadFileName();
if(filename == null) { if(metaDataCtr != null) {
metaDataCtr.getFilenameEl().setExampleKey("mf.filename.warning", null); if(filename == null) {
} else if(!FileUtils.validateFilename(filename)) { metaDataCtr.getFilenameEl().setExampleKey("mf.filename.warning", null);
String suffix = FileUtils.getFileSuffix(filename); } else if(!FileUtils.validateFilename(filename)) {
if(suffix != null && suffix.length() > 0) { String suffix = FileUtils.getFileSuffix(filename);
filename = filename.substring(0, filename.length() - suffix.length() - 1); if(suffix != null && suffix.length() > 0) {
filename = filename.substring(0, filename.length() - suffix.length() - 1);
}
filename = FileUtils.normalizeFilename(filename) + "." + suffix;
metaDataCtr.getFilenameEl().setExampleKey("mf.filename.warning", null);
} }
filename = FileUtils.normalizeFilename(filename) + "." + suffix; metaDataCtr.setFilename(filename);
metaDataCtr.getFilenameEl().setExampleKey("mf.filename.warning", null); }
boolean isImg = false;
if(resizeImg && filename != null) {
isImg = imageExtPattern.matcher(filename.toLowerCase()).find();
} }
metaDataCtr.setFilename(filename); resizeEl.setVisible(isImg);
resizeEl.select(resizeKeys[0], true);
} }
} }
super.formInnerEvent(ureq, source, event); super.formInnerEvent(ureq, source, event);
......
...@@ -25,34 +25,11 @@ ...@@ -25,34 +25,11 @@
</div> </div>
#end #end
#if($resizeImg) $r.render("resize_image_wrapper")
<div id="resize_image_wrapper" style="display:none;">
$r.render("resize_image_wrapper")
</div>
#end
#if ($showMetadata) #if ($showMetadata)
$r.render("metadata") $r.render("metadata")
#end #end
$r.render("buttons") $r.render("buttons")
</fieldset> </fieldset>
#if($resizeImg)
<script type="text/javascript">
/* <![CDATA[ */
jQuery(function() {
jQuery('.o_realchooser').on("change", function() {
var re = new RegExp('[.](jpeg)|(jpg)|(png)$');
var name = jQuery(this).val();
if(name != null && name.toLowerCase().match(re)) {
jQuery('#resize_image_wrapper').show();
} else {
jQuery('#resize_image_wrapper').hide();
}
});
});
/* ]]> */
</script>
#end
</div> </div>
\ No newline at end of file
...@@ -80,13 +80,12 @@ public abstract class FeedNotificationsHandler implements NotificationsHandler { ...@@ -80,13 +80,12 @@ public abstract class FeedNotificationsHandler implements NotificationsHandler {
try { try {
RepositoryEntry re = repoManager.lookupRepositoryEntry( RepositoryEntry re = repoManager.lookupRepositoryEntry(
OresHelper.createOLATResourceableInstance(p.getResName(), p.getResId()), false); OresHelper.createOLATResourceableInstance(p.getResName(), p.getResId()), false);
if (re.getAccess() == RepositoryEntry.DELETED || re.getRepositoryEntryStatus().isClosed() || re.getRepositoryEntryStatus().isUnpublished()) {
return notificationsManager.getNoSubscriptionInfo();
}
String displayName = re.getDisplayname(); String displayName = re.getDisplayname();
if("CourseModule".equals(p.getResName())) { if("CourseModule".equals(p.getResName())) {
if (re.getRepositoryEntryStatus().isClosed() || re.getRepositoryEntryStatus().isUnpublished()) { title = translator.translate(NOTIFICATIONS_HEADER_COURSE, new String[]{displayName});
return notificationsManager.getNoSubscriptionInfo();
} else {
title = translator.translate(NOTIFICATIONS_HEADER_COURSE, new String[]{displayName});
}
} else { } else {
title = getHeader(translator, displayName); title = getHeader(translator, displayName);
} }
......
...@@ -213,6 +213,7 @@ public class WikiPageChangeOrCreateNotificationHandler implements NotificationsH ...@@ -213,6 +213,7 @@ public class WikiPageChangeOrCreateNotificationHandler implements NotificationsH
private boolean courseStatus(ICourse course) { private boolean courseStatus(ICourse course) {
return course != null return course != null
&& course.getCourseEnvironment().getCourseGroupManager().getCourseEntry().getAccess() != RepositoryEntry.DELETED
&& !course.getCourseEnvironment().getCourseGroupManager().getCourseEntry().getRepositoryEntryStatus().isUnpublished() && !course.getCourseEnvironment().getCourseGroupManager().getCourseEntry().getRepositoryEntryStatus().isUnpublished()
&& !course.getCourseEnvironment().getCourseGroupManager().getCourseEntry().getRepositoryEntryStatus().isClosed(); && !course.getCourseEnvironment().getCourseGroupManager().getCourseEntry().getRepositoryEntryStatus().isClosed();
} }
......
...@@ -182,7 +182,7 @@ public class AuthorListController extends FormBasicController implements Activat ...@@ -182,7 +182,7 @@ public class AuthorListController extends FormBasicController implements Activat
isOlatAdmin = roles.isOLATAdmin() || roles.isInstitutionalResourceManager(); isOlatAdmin = roles.isOLATAdmin() || roles.isInstitutionalResourceManager();
hasAuthorRight = roles.isAuthor() || roles.isInstitutionalResourceManager() || roles.isOLATAdmin(); hasAuthorRight = roles.isAuthor() || roles.isInstitutionalResourceManager() || roles.isOLATAdmin();
dataSource = new AuthoringEntryDataSource(searchParams, this); dataSource = new AuthoringEntryDataSource(searchParams, this, !withSearch);
initForm(ureq); initForm(ureq);
stackPanel = new TooledStackedPanel(i18nName, getTranslator(), this); stackPanel = new TooledStackedPanel(i18nName, getTranslator(), this);
......
...@@ -63,11 +63,13 @@ public class AuthoringEntryDataSource implements FlexiTableDataSourceDelegate<Au ...@@ -63,11 +63,13 @@ public class AuthoringEntryDataSource implements FlexiTableDataSourceDelegate<Au
private final RepositoryService repositoryService; private final RepositoryService repositoryService;
private final AuthoringEntryDataSourceUIFactory uifactory; private final AuthoringEntryDataSourceUIFactory uifactory;
private Integer count; private Integer count;
private final boolean useFilters;
public AuthoringEntryDataSource(SearchAuthorRepositoryEntryViewParams searchParams, public AuthoringEntryDataSource(SearchAuthorRepositoryEntryViewParams searchParams,
AuthoringEntryDataSourceUIFactory uifactory) { AuthoringEntryDataSourceUIFactory uifactory, boolean useFilters) {
this.searchParams = searchParams; this.searchParams = searchParams;
this.uifactory = uifactory; this.uifactory = uifactory;
this.useFilters = useFilters;
acService = CoreSpringFactory.getImpl(ACService.class); acService = CoreSpringFactory.getImpl(ACService.class);
acModule = CoreSpringFactory.getImpl(AccessControlModule.class); acModule = CoreSpringFactory.getImpl(AccessControlModule.class);
...@@ -103,6 +105,8 @@ public class AuthoringEntryDataSource implements FlexiTableDataSourceDelegate<Au ...@@ -103,6 +105,8 @@ public class AuthoringEntryDataSource implements FlexiTableDataSourceDelegate<Au
} else { } else {
searchParams.setResourceTypes(null); searchParams.setResourceTypes(null);
} }
} else if(useFilters) {
searchParams.setResourceTypes(null);
} }
if(orderBy != null && orderBy.length > 0 && orderBy[0] != null) { if(orderBy != null && orderBy.length > 0 && orderBy[0] != null) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment