# HG changeset patch # User Robert Casties # Date 1528470215 -7200 # Node ID af1018d064438edef27ea826a924e3c8d81332d8 # Parent c63d39034b600fabbe7c908cd4fdf2d44c592097 PublicByAuthor feature with new "Select by public and MAMS" works now! diff -r c63d39034b60 -r af1018d06443 src/main/java/de/mpiwg/itgroup/ismi/merge/PublicByAuthorBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/merge/PublicByAuthorBean.java Fri Jun 08 15:32:27 2018 +0200 +++ b/src/main/java/de/mpiwg/itgroup/ismi/merge/PublicByAuthorBean.java Fri Jun 08 17:03:35 2018 +0200 @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import javax.faces.event.ActionEvent; @@ -57,6 +58,7 @@ selectedPersonSubjectMap = new HashMap>(); makeSubjectTree(); + updateSubjectTexts(); logger.info("PublicByAuthorBean.reset() Done."); } @@ -70,9 +72,6 @@ subjectList = new ArrayList(); subjectEntity = new HashMap(); subjectParents = new HashMap>(); - subjectTexts = new HashMap>(); - subjectPublicTexts = new HashMap>(); - subjectPrivateTexts = new HashMap>(); /* * get all subjects */ @@ -107,28 +106,41 @@ } } while (++cnt < 5); subjectParents.put(subjectName, parents); - /* - * find subject's texts - */ - ArrayList textList = new ArrayList(); - ArrayList pubTextList = new ArrayList(); - ArrayList privTextList = new ArrayList(); - for (Relation textRel : subject.getTargetRelations(has_subject, TEXT)) { - Long textId = textRel.getSourceId(); - Entity text = getWrapper().getEntityByIdWithContent(textId); - textList.add(text); - if (text.getIsPublic()) { - pubTextList.add(text); - } else { - privTextList.add(text); - } - } - subjectTexts.put(subjectName, textList); - subjectPublicTexts.put(subjectName, pubTextList); - subjectPrivateTexts.put(subjectName, privTextList); } } - + + /** + * update subjectTexts, subjectPublicTexts and subjectPrivateTexts. + * + */ + private void updateSubjectTexts() { + subjectTexts = new HashMap>(); + subjectPublicTexts = new HashMap>(); + subjectPrivateTexts = new HashMap>(); + for (Entry subjectItem : subjectEntity.entrySet()) { + String subjectName = subjectItem.getKey(); + Entity subject = subjectItem.getValue(); + /* + * find subject's texts + */ + ArrayList textList = new ArrayList(); + ArrayList pubTextList = new ArrayList(); + ArrayList privTextList = new ArrayList(); + for (Relation textRel : subject.getTargetRelations(has_subject, TEXT)) { + Long textId = textRel.getSourceId(); + Entity text = getWrapper().getEntityByIdWithContent(textId); + textList.add(text); + if (text.getIsPublic()) { + pubTextList.add(text); + } else { + privTextList.add(text); + } + } + subjectTexts.put(subjectName, textList); + subjectPublicTexts.put(subjectName, pubTextList); + subjectPrivateTexts.put(subjectName, privTextList); + } + } public void actionReset() { reset(); @@ -282,6 +294,7 @@ /* * go through all texts for the subject */ + int pubCnt = 0; List texts = subjectTexts.get(subject); for (Entity text : texts) { if (text.isLightweight()) { @@ -316,6 +329,7 @@ List entities = PrivacityUtils.setTextAndMorePrivacity(text, true, textMsg, getWrapper()); // save only public state getWrapper().saveEntityListAsNodeWithoutContent(entities, null); + pubCnt += 1; } catch (Exception e) { logger.error(e); } @@ -324,6 +338,12 @@ logger.debug(msg); } } + if (pubCnt == 0) { + addGeneralMsg("No text matched your criteria."); + } else { + addGeneralMsg(pubCnt+" texts with MAMS number < "+maxMamsNr+" were made public!"); + } + updateSubjectTexts(); return null; } diff -r c63d39034b60 -r af1018d06443 src/main/webapp/clean/components/publicMamsSubjects.xhtml --- a/src/main/webapp/clean/components/publicMamsSubjects.xhtml Fri Jun 08 15:32:27 2018 +0200 +++ b/src/main/webapp/clean/components/publicMamsSubjects.xhtml Fri Jun 08 17:03:35 2018 +0200 @@ -34,8 +34,8 @@ + actionListener="#{Session.publicByAuthor.actionMakeMamsSubjectAndRelatedPublic}" + render="selectSubjectPanel2" style="margin-bottom:0.5em"/>
#{Session.publicByAuthor.subjectPublicTexts.get(subject).size()} diff -r c63d39034b60 -r af1018d06443 src/main/webapp/clean/makeTextsPublic.xhtml --- a/src/main/webapp/clean/makeTextsPublic.xhtml Fri Jun 08 15:32:27 2018 +0200 +++ b/src/main/webapp/clean/makeTextsPublic.xhtml Fri Jun 08 17:03:35 2018 +0200 @@ -38,7 +38,7 @@ + render="mainPanel,selectSubjectPanel,selectSubjectPanel2" /> diff -r c63d39034b60 -r af1018d06443 src/main/webapp/resources/css/ismi-db/popupPanel.css --- a/src/main/webapp/resources/css/ismi-db/popupPanel.css Fri Jun 08 15:32:27 2018 +0200 +++ b/src/main/webapp/resources/css/ismi-db/popupPanel.css Fri Jun 08 17:03:35 2018 +0200 @@ -1,9 +1,9 @@ .ismi-pp-cntr { - position: fixed; - top: 50%; - left: 50%; + position: absolute; + top: 20%; + left: 20%; z-index: 100; @@ -12,11 +12,8 @@ border-radius: 0; cursor: default; - /* default values*/ - width: 300px; height: 100px; margin-top: -80px; margin-left: -150px; - + width: 300px; height: 100px; /* - width: 300px; height: 100px; margin-top: -50px; margin-left: -150px; */ diff -r c63d39034b60 -r af1018d06443 src/main/webapp/templates/main_template.xhtml --- a/src/main/webapp/templates/main_template.xhtml Fri Jun 08 15:32:27 2018 +0200 +++ b/src/main/webapp/templates/main_template.xhtml Fri Jun 08 17:03:35 2018 +0200 @@ -40,11 +40,9 @@ + rows="0"> -
-
@@ -64,7 +62,7 @@ -
+
@@ -79,7 +77,7 @@ + rows="0">