summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Schwär2020-11-17 00:19:26 +0100
committerStephan Schwär2020-11-17 00:19:26 +0100
commit1abd53bfef7a461408a2b4ced0e1956294f909f5 (patch)
tree23bfb637bc55f0c978a42ac3232a89e79cd04afa
parentMerge remote-tracking branch 'origin/buxfix/searchCaseSensitive' into feature... (diff)
parent[client] Access directly to variable description (diff)
downloadtutor-module-1abd53bfef7a461408a2b4ced0e1956294f909f5.tar.gz
tutor-module-1abd53bfef7a461408a2b4ced0e1956294f909f5.tar.xz
tutor-module-1abd53bfef7a461408a2b4ced0e1956294f909f5.zip
Merge branch 'feature/search-in-description' into feature-merge
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/ImageListViewer.java29
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java16
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java15
-rw-r--r--dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbImage.java8
-rw-r--r--dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java3
5 files changed, 50 insertions, 21 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/ImageListViewer.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/ImageListViewer.java
index a758bbc0..b013e816 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/ImageListViewer.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/ImageListViewer.java
@@ -8,13 +8,7 @@ import java.util.List;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
-import javax.swing.BoxLayout;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.RowFilter;
-import javax.swing.UIManager;
+import javax.swing.*;
import javax.swing.border.TitledBorder;
import org.apache.log4j.Logger;
@@ -43,6 +37,7 @@ public class ImageListViewer extends QLabel {
protected JTextField txtSearch;
protected JComboBox<FilterType> cboFilter;
protected JLabel imageCountLabel;
+ protected JCheckBox chkSearchInDescription;
// image table
protected ImageTable imageTable;
@@ -82,6 +77,15 @@ public class ImageListViewer extends QLabel {
ImageSummaryRead image = imageTable.getModelRow(entry.getIdentifier());
if (searchFieldPattern.matcher(image.imageName).find())
return true;
+ if (chkSearchInDescription.isSelected()) {
+ String description = image.description;
+ if (description != null) {
+ if (searchFieldPattern.matcher(description).find())
+ return true;
+ } else {
+ LOGGER.debug("Description is null: cannot be searched in description");
+ }
+ }
UserInfo user = UserCache.find(image.ownerId);
if (user == null)
return false;
@@ -133,6 +137,10 @@ public class ImageListViewer extends QLabel {
filterPanel.add(txtSearch);
filterPanel.add(cboFilter);
+ // search in description
+ chkSearchInDescription = new JCheckBox("Suche in Beschreibung");
+ filterPanel.add(chkSearchInDescription);
+
// Panel for itemCount
JPanel imageCountPanel = new JPanel();
imageCountLabel = new JLabel();
@@ -178,6 +186,13 @@ public class ImageListViewer extends QLabel {
}
});
cboFilter.setSelectedItem(defaultFilter == null ? FilterType.USABLE : defaultFilter);
+
+ chkSearchInDescription.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ applyFilterOnTable();
+ }
+ });
}
/**
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java
index 653a2586..ff1a3635 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java
@@ -120,6 +120,15 @@ public class LectureListWindow extends LectureListWindowLayout {
LectureSummary lecture = tblLectures.getModelRow(entry.getIdentifier());
if (searchFieldPattern.matcher(lecture.lectureName).find())
return true;
+ if (chkSearchInDescription.isSelected()) {
+ String description = lecture.description;
+ if (description != null) {
+ if (searchFieldPattern.matcher(description).find())
+ return true;
+ } else {
+ LOGGER.debug("Description is null: cannot be searched in description");
+ }
+ }
UserInfo user = UserCache.find(lecture.ownerId);
if (user == null)
return false;
@@ -174,6 +183,13 @@ public class LectureListWindow extends LectureListWindowLayout {
}
});
+ chkSearchInDescription.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ applyFilterOnTable();
+ }
+ });
+
btnNewLecture.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java
index 31ccf5b5..90c1b47f 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java
@@ -4,15 +4,7 @@ import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.GridBagLayout;
-import javax.swing.BorderFactory;
-import javax.swing.Box;
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.UIManager;
+import javax.swing.*;
import javax.swing.border.TitledBorder;
import org.openslx.dozmod.gui.Gui;
@@ -36,6 +28,7 @@ public abstract class LectureListWindowLayout extends CompositePage {
protected final JButton btnSwitchView;
protected final JComboBox<FilterType> cboFilter;
protected final QLabel lblVisibleLectureCount;
+ protected final JCheckBox chkSearchInDescription;
protected final JTextField txtSearch;
@@ -73,6 +66,10 @@ public abstract class LectureListWindowLayout extends CompositePage {
filterPanel.add(txtSearch);
filterPanel.add(cboFilter);
+ // search in description
+ chkSearchInDescription = new JCheckBox("Suche in Beschreibung");
+ filterPanel.add(chkSearchInDescription);
+
// Panel for itemCount
JPanel lectureCountPanel = new JPanel();
lblVisibleLectureCount = new QLabel();
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbImage.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbImage.java
index 99e90099..36c3a466 100644
--- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbImage.java
+++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbImage.java
@@ -57,7 +57,7 @@ public class DbImage {
// TODO: Implement tag search functionality
try (MysqlConnection connection = Database.getConnection()) {
MysqlStatement stmt = connection.prepareStatement("SELECT"
- + " i.imagebaseid, i.latestversionid, i.displayname,"
+ + " i.imagebaseid, i.latestversionid, i.displayname, i.description,"
+ " i.osid, i.virtid, i.createtime, i.updatetime, i.ownerid,"
+ " i.sharemode, i.istemplate, i.canlinkdefault, i.candownloaddefault,"
+ " i.caneditdefault, i.canadmindefault,"
@@ -209,8 +209,8 @@ public class DbImage {
private static ImageSummaryRead resultSetToSummary(UserInfo user, ResultSet rs) throws SQLException {
ImagePermissions defaultPermissions = DbImagePermissions.fromResultSetDefault(rs);
ImageSummaryRead entry = new ImageSummaryRead(rs.getString("imagebaseid"),
- rs.getString("latestversionid"), rs.getString("displayname"), rs.getInt("osid"),
- rs.getString("virtid"), rs.getLong("createtime"), rs.getLong("updatetime"),
+ rs.getString("latestversionid"), rs.getString("displayname"), rs.getString("description"),
+ rs.getInt("osid"), rs.getString("virtid"), rs.getLong("createtime"), rs.getLong("updatetime"),
rs.getLong("uploadtime"), rs.getLong("expiretime"), rs.getString("ownerid"),
rs.getString("uploaderid"), toShareMode(rs.getString("sharemode")), rs.getLong("filesize"),
rs.getByte("isrestricted") != 0, rs.getByte("isvalid") != 0, rs.getByte("isprocessed") != 0,
@@ -248,7 +248,7 @@ public class DbImage {
protected static ImageSummaryRead getImageSummary(MysqlConnection connection, UserInfo user,
String imageBaseId) throws SQLException, TNotFoundException {
MysqlStatement stmt = connection.prepareStatement("SELECT"
- + " i.imagebaseid, i.latestversionid, i.displayname,"
+ + " i.imagebaseid, i.latestversionid, i.displayname, i.description,"
+ " i.osid, i.virtid, i.createtime, i.updatetime, i.ownerid,"
+ " i.sharemode, i.istemplate, i.canlinkdefault, i.candownloaddefault,"
+ " i.caneditdefault, i.canadmindefault,"
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java
index e0799c29..4ecb9d99 100644
--- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java
+++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java
@@ -193,6 +193,7 @@ public class DbLecture {
LectureSummary lecture = new LectureSummary();
lecture.setLectureId(rs.getString("lectureid"));
lecture.setLectureName(rs.getString("lecturename"));
+ lecture.setDescription(rs.getString("description"));
lecture.setImageVersionId(rs.getString("imageversionid"));
lecture.setImageBaseId(rs.getString("imagebaseid"));
lecture.setIsEnabled(rs.getBoolean("isenabled"));
@@ -215,7 +216,7 @@ public class DbLecture {
}
private static final String summaryBaseSql = "SELECT"
- + " l.lectureid, l.displayname AS lecturename, l.imageversionid, i.imagebaseid,"
+ + " l.lectureid, l.displayname AS lecturename, l.description, l.imageversionid, i.imagebaseid,"
+ " l.isenabled, l.starttime, l.endtime, l.lastused, l.usecount, l.ownerid, l.updaterid,"
+ " l.isexam, l.hasinternetaccess, l.hasusbaccess, l.caneditdefault, l.canadmindefault,"
+ " i.isvalid AS imgvalid, perm.canedit, perm.canadmin"