if (withValues.get("creator").toString().equals(""))
withValues.put("creator","Anonym");
String id = mainModule.add(withValues);
- DatabaseContentToTopics.getInstance().setTopics(id,req.getParameter("to_topic"));
+ DatabaseContentToTopics.getInstance().setTopics(id,req.getParameterValues("to_topic"));
//theLog.printDebugInfo(":: content :: inserted");
_showObject(id, req, res);
}
if (idParam == null) throw new ServletModuleException("Falscher Aufruf: (id) nicht angegeben");
HashMap withValues = getIntersectingValues(req, DatabaseContent.getInstance());
- String topic_id = req.getParameter("to_topic");
+ //String topic_id = req.getParameter("to_topic");
+ String[] topic_id = req.getParameterValues("to_topic");
String content_id = req.getParameter("id");
// withValues.put("publish_path", StringUtil.webdbDate2path((String)withValues.get("date")));
if(user != null) withValues.put("user_id", user.getId());
withValues.put("creator","Anonym");
//theLog.printDebugInfo("updating. ");
String id = mainModule.set(withValues);
- DatabaseContentToTopics.getInstance().setTopics(req.getParameter("id"),req.getParameter("to_topic"));
+ DatabaseContentToTopics.getInstance().setTopics(req.getParameter("id"),topic_id);
//theLog.printDebugInfo("update done. ");
String whereParam = req.getParameter("where");
String orderParam = req.getParameter("order");
SimpleHash mergeData = HTMLTemplateProcessor.makeSimpleHash(entContent);
EntityList topicToContent = DatabaseContentToTopics.getInstance().getTopics(entContent);
if (topicToContent!=null && topicToContent.size()>0){
- Entity topics = (EntityTopics)topicToContent.elementAt(0);
- mergeData.put("to_topic",topics.getId());
+ theLog.printDebugInfo("topicanzahl: "+topicToContent.size());
+ Entity topics = null;
+ SimpleList topicList = new SimpleList();
+ for(int i=0;i<topicToContent.size();i++){
+ topics = (EntityTopics)topicToContent.elementAt(i);
+ topicList.add(topics.getId());
+ }
+ mergeData.put("to_topic",topicList);
}
//obsolete, because of psqgl 7.1.x
//mergeData.put("content_data", entContent.getContentData());
}
- public void setTopics(EntityContent content, ArrayList topicId) {
- if (content == null && topicId == null) {
+ public void setTopics(String contentId, String[] topicId) {
+ if (contentId == null && topicId == null) {
return;
}
- String contentId = content.getId();
//first delete all row with content_id=contentId
String sql = "delete from "+ theTable +" where content_id=" + contentId;
//now insert
//first delete all row with content_id=contentId
- for (Iterator i = topicId.listIterator(); i.hasNext();) {
+ for (int i=0;i<topicId.length;i++) {
sql = "insert into "+ theTable +" (content_id,topic_id) values ("
- + contentId + "," + i.next().toString() + ")";
+ + contentId + "," + topicId[i] + ")";
try {
con = getPooledCon();
// should be a preparedStatement because is faster
<input type="hidden" name="offset" value="${offset}">
<input type="hidden" name="order" value="${order}">
<input type="hidden" name="id" value="${id}">
- <input type="hidden" name="to_topic2" value="${to_topic}">
<if new>
<input type="hidden" name="do" value="insert">
<else>
<option value="${s.key}" <if (s.key == to_feature)>selected</if>>${s.value}</option>
</list>
</select>
- <select name="to_topic">
- <list themenPopupData as t>
- <option value="${t.key}" <if (t.key == to_topic)>selected</if>>${t.value}</option>
- </list>
+ <select name="to_topic" size="5" multiple>\r
+ <list themenPopupData as t>\r
+ <option value="${t.key}" <list to_topic as to><if (t.key == to)>selected</if></list>>${t.value}</option>
+ </list>\r
</select>
</td>
</tr>
<input type="hidden" name="offset" value="${offset}">\r
<input type="hidden" name="order" value="${order}">\r
<input type="hidden" name="id" value="${id}">\r
- <input type="hidden" name="to_topic2" value="${to_topic}">\r
<if new>\r
<input type="hidden" name="do" value="insert">\r
<else>\r
<option value="${s.key}" <if (s.key == to_feature)>selected</if>>${s.value}</option>\r
</list>\r
</select>\r
- <select name="to_topic">\r
+ <select name="to_topic" size="5" multiple>\r
<list themenPopupData as t>\r
- <option value="${t.key}" <if (t.key == to_topic)>selected</if>>${t.value}</option>\r
+ <option value="${t.key}" <list to_topic as to><if (t.key == to)>selected</if></list>>${t.value}</option>
</list>\r
</select>\r
</td>\r