added an extensively customizable way of showing topics in articles
authorzapata <zapata>
Sun, 21 Sep 2003 16:40:40 +0000 (16:40 +0000)
committerzapata <zapata>
Sun, 21 Sep 2003 16:40:40 +0000 (16:40 +0000)
17 files changed:
source/default.properties
source/mircoders/servlet/ServletModuleContent.java
templates/admin/EDITFUNCTIONS.template
templates/admin/FUNCTIONS.template
templates/admin/FUNCTIONS_media.template
templates/admin/LISTFUNCTIONS.template
templates/admin/abuse.filter.template
templates/admin/comment.template
templates/admin/confirm.template
templates/admin/content.template
templates/admin/contentlist.template
templates/admin/fileedit.template
templates/admin/login.template
templates/admin/mediafolderlist.template
templates/admin/start_admin.template
templates/admin/uploadedmedia.template
web/style/admin.css

index be0990c..4b8708a 100755 (executable)
@@ -107,10 +107,12 @@ Mir.Localizer.Admin.ListOperationsFlavor=1
 
 
 # How should the topics be presented on the article edit page?
+#
 # <key>:<listtype>:<listparameter>:<condition>:<order>
+# multiple entries can be specified, can be seperated by a ,
 #
 # key:
-#     a unique key per topic category
+#     the bundle key to use for the field label
 # listtype:
 #     0 = in a multiselect list box, 1 = checkboxes, 2 = a dropdown listbox
 # listparameter:
@@ -121,18 +123,7 @@ Mir.Localizer.Admin.ListOperationsFlavor=1
 #     what sql order should the topics be ordered by
 
 Mir.Localizer.Admin.TopicLists = \
-   topic:1:3:archiv_url='bla':title   ,\
-   rest:1:3:archiv_url<>'bla':title   \
-
-# How should the topics be presented on the article edit page?
-# 0 = in a multiselect list box, 1 = checkboxes
-Mir.Localizer.Admin.TopicListFlavor=1
-
-# For the checkboxes flavour, how many columns should there be?
-Mir.Localizer.Admin.TopicListColumns=3
-
-# In which order should the topic appear?
-Mir.Localizer.Admin.TopicListOrder=title
+   content.topic:1:3::title
 
 # enable deletion of comments/articles?
 Mir.Localizer.Admin.AllowDeleteComment=1
index f7471ee..63dd5a9 100755 (executable)
@@ -33,7 +33,7 @@ package mircoders.servlet;
 import java.util.GregorianCalendar;\r
 import java.util.HashMap;\r
 import java.util.Iterator;\r
-import java.util.List;\r
+import java.util.*;\r
 import java.util.Locale;\r
 import java.util.Map;\r
 import javax.servlet.http.HttpServletRequest;\r
@@ -50,7 +50,7 @@ import mir.util.CachingRewindableIterator;
 import mir.util.HTTPRequestParser;\r
 import mir.util.JDBCStringRoutines;\r
 import mir.util.SQLQueryBuilder;\r
-import mir.util.URLBuilder;\r
+import mir.util.*;\r
 import mircoders.entity.EntityContent;\r
 import mircoders.global.MirGlobal;\r
 import mircoders.module.ModuleContent;\r
@@ -61,7 +61,7 @@ import mircoders.storage.DatabaseContentToTopics;
  *  ServletModuleContent -\r
  *  deliver html for the article admin form.\r
  *\r
- * @version $Id: ServletModuleContent.java,v 1.52.2.9 2003/09/20 10:54:18 zapata Exp $\r
+ * @version $Id: ServletModuleContent.java,v 1.52.2.10 2003/09/21 16:40:41 zapata Exp $\r
  * @author rk, mir-coders\r
  *\r
  */\r
@@ -328,35 +328,67 @@ public class ServletModuleContent extends ServletModule
       }\r
       responseData.put("article", article);\r
 \r
-/*\r
-\r
-      Map topicsMap = new HashMap();\r
+      List topicsList = new Vector();\r
 \r
-      String[] topicCategories = configuration.getStringArray("Mir.Localizer.Admin.TopicListOrder");\r
+      String[] topicCategories = configuration.getStringArray("Mir.Localizer.Admin.TopicLists");\r
 \r
-      for (int i = 0; i<topicCategories; i++) {\r
+      if (topicCategories.length==0 ) {\r
         Map categoryMap = new HashMap();\r
-\r
-        String key="";\r
-        String listtype="";\r
-        String listparameter="";\r
-\r
-                 topic:1:3:archiv_url='bla':title\r
-\r
-        topicsMap.put(key, categoryMap);\r
+        categoryMap.put("key", "topic");\r
+        categoryMap.put("listtype", "0");\r
+        categoryMap.put("listparameter", "3");\r
+        categoryMap.put("items",\r
+                        new EntityIteratorAdapter("", "title",\r
+            20, MirGlobal.localizer().dataModel().adapterModel(), "topic"));\r
+        topicsList.add(categoryMap);\r
+      }\r
+      else\r
+      {\r
+\r
+        for (int i = 0; i < topicCategories.length; i++) {\r
+          try {\r
+            Map categoryMap = new HashMap();\r
+            List parts = StringRoutines.splitString(topicCategories[i], ":");\r
+            String key = null;\r
+            String listtype = "0";\r
+            String listparameter = "5";\r
+            String where = "";\r
+            String order = "";\r
+\r
+            if (parts.size() > 0)\r
+              key = (String) parts.get(0);\r
+            if (parts.size() > 1)\r
+              listtype = (String) parts.get(1);\r
+            if (parts.size() > 2)\r
+              listparameter = (String) parts.get(2);\r
+            if (parts.size() > 3)\r
+              where = (String) parts.get(3);\r
+            if (parts.size() > 4)\r
+              order = (String) parts.get(4);\r
+\r
+            if (key != null) {\r
+              categoryMap.put("key", key);\r
+              categoryMap.put("listtype", listtype);\r
+              categoryMap.put("listparameter", listparameter);\r
+              categoryMap.put("items",\r
+                              new EntityIteratorAdapter(where, order,\r
+                  20, MirGlobal.localizer().dataModel().adapterModel(), "topic"));\r
+              topicsList.add(categoryMap);\r
+            }\r
+          }\r
+          catch (Throwable t) {\r
+            logger.error("error while preparing topics: " + t.toString());\r
+          }\r
+        }\r
       }\r
 \r
+      responseData.put("topics", topicsList);\r
 \r
-      responseData.put("topics", topicsMap);\r
-\r
-\r
-*/\r
-\r
-\r
+/*\r
       responseData.put("topics",\r
           new EntityIteratorAdapter("", configuration.getString("Mir.Localizer.Admin.TopicListOrder"),\r
           20, MirGlobal.localizer().dataModel().adapterModel(), "topic"));\r
-\r
+*/\r
       responseData.put("returnurl", requestParser.getParameter("returnurl"));\r
       responseData.put("thisurl", urlBuilder.getQuery());\r
 \r
index d9830b9..0d4c7ff 100755 (executable)
@@ -36,7 +36,7 @@
 <function EditSubmitButtonNormal(aLabel, aFieldName)>\r
   <tr>
     <td class="${TABLE_FOOT_CLASS}" colspan="2" align="right"> 
-      <input type="submit" name="${aFieldName}" value="${aLabel}">
+      <input class="majorbutton" type="submit" name="${aFieldName}" value="${aLabel}">
     </td>
   </tr>
 </function>  
index f95a6ea..0101ebf 100755 (executable)
@@ -8,6 +8,15 @@
 <function showButton(anUrl, aLabel)>
   <call showAbsoluteLinkButton(config.actionRoot+"?"+anUrl, aLabel)>
 </function>
+<function showGETButton(anUrl, aLabel)>
+  <call showAbsoluteLinkButton(config.actionRoot+"?"+anUrl, aLabel)>
+</function>
+<function showPOSTButton(anUrl, aLabel)>
+  <call showGETButton(anUrl, aLabel)>
+<comment>
+  <form method="POST" action="${utility.encodeHTML(config.actionRoot+"?"+anUrl)}"><input type="submit" class="majorbutton" value="${aLabel}"></form>
+</comment>  
+</function>
 
 
 <assign TABLE_HEAD_CLASS          "table-head">
index 5539d5d..39d73b4 100755 (executable)
@@ -54,7 +54,7 @@
     </td>
     
     <td class="listrow2">
-      <input type="submit" name="search" value="${lang("filter")}">
+      <input type="submit" class="majorbutton" name="search" value="${lang("filter")}">
     </td>
     
     <td>
index 256e652..ae40b8e 100755 (executable)
 </table>\r
 </function>\r
 
+<function ExtendedListEntry(aFields, aLinks, aLinkTitles)>
+    <if alt=="1">
+      <assign alt="0">
+      <tr class="${LIST_ROW_CLASS_ALTERNATIVE}">
+    <else>
+      <assign alt="1"> 
+      <tr class="${LIST_ROW_CLASS}">
+    </if>
+      
+    <list aFields as i>   
+      <td>
+        ${i}
+      </td>
+    </list>
+      <td>\r
+        <assign index="0">\r
+        <assign first="1">\r
+        <list aLinks as i>\r
+          <if first=="1">\r
+            <assign first="0">\r
+          <else>  \r
+            |\r
+          </if>\r
+          <a class="listcommand" href="${config.actionRoot}?${utility.encodeHTML(i)}">${aLinkTitles[index]}</a>        \r
+          <assign index=utility.increment(index)>
+        </list>\r
+      </td>
+    </tr>
+</function>\r
+
+
 <function ListEntry(aFields, aLinkPrefix, aLinks, aLinkTitles)>\r
     <if alt=="1">
       <assign alt="0">
index 0fc20dc..2597360 100755 (executable)
@@ -32,9 +32,9 @@
         <tr>
           <td class="table-foot" colspan="2" align="right"> 
           <if id>
-            <input type="submit" name="save" value="${lang("save")}">
+            <input type="submit" class="majorbutton" name="save" value="${lang("save")}">
           <else>
-            <input type="submit" name="save" value="${lang("insert")}">
+            <input type="submit" class="majorbutton" name="save" value="${lang("insert")}">
           </if> 
           </td>
         </tr>
index deb5feb..0c72751 100755 (executable)
@@ -35,7 +35,7 @@
         </if>
 
         <list comment.operations as op>
-          <call showButton(
+          <call showPOSTButton(
             "module=Localizer&do=commentoperation&operation="+op+"&id="+comment.id+"&returnurl="+utility.encodeURI(thisurl), 
             lang("comment.operation."+op))>
         </list>
@@ -45,9 +45,9 @@
     <td align="right" valign="top">
       ${lang("comment.published")} <input type="checkbox" name="is_published" value="1" <if comment.is_published=="1"> checked</if>>
       <if new=="1">
-        <input type="submit" name="save" value="${lang("insert")}">
+        <input type="submit" class="majorbutton" name="save" value="${lang("insert")}">
       <else>
-        <input type="submit" name="save" value="${lang("save")}">
+        <input type="submit" class="majorbutton" name="save" value="${lang("save")}">
       </if> 
     </td>
   </tr>
@@ -94,9 +94,9 @@
           <td colspan="2" align="right" class="table-foot" > 
             <span class="text">
               <if new=="1">
-                <input type="submit" name="save" value="${lang("insert")}">
+                <input type="submit" class="majorbutton" name="save" value="${lang("insert")}">
               <else>
-                <input type="submit" name="save" value="${lang("save")}">
+                <input type="submit" class="majorbutton" name="save" value="${lang("save")}">
               </if> 
             </span>
           </td>
index 38d307f..9598857 100755 (executable)
@@ -16,8 +16,8 @@
              <input type="hidden" name="id" value="${id}">
              <input type="hidden" name="okurl" value="${okurl}">
              <input type="hidden" name="cancelurl" value="${cancelurl}">
-             <input type="submit" name="cancel" value="${lang("cancel")}">
-             <input type="submit" name="confirm" value="${lang("delete")}"><br>
+             <input type="submit" class="majorbutton" name="cancel" value="${lang("cancel")}">
+             <input type="submit" class="majorbutton" name="confirm" value="${lang("delete")}"><br>
              <br>
             <b><span class="text-alert">${lang("confirm.text")}</span></b>
         </p>
index 665ae7b..b28ec63 100755 (executable)
   <tr>
     <td align="left" valign="top">
       <if new=="0">
-        <call showButton(
+        <call showGETButton(
           "module=Comment&do=articlecomments&articleid="+article.id+"&returnurl="+utility.encodeURI(thisurl),
           lang("content.comments"))>
         <call showAbsoluteLinkButton(
           article.publicurl,
           lang("preview"))>
         <list article.operations as op>
-          <call showButton(
+          <call showPOSTButton(
             "module=Localizer&do=articleoperation&operation="+op+"&articleid="+article.id+"&returnurl="+utility.encodeURI(thisurl), 
             lang("content.operation."+op))>
         </list>
@@ -41,9 +41,9 @@
       ${lang("content.published")} :
       <input type="checkbox" name="is_published" value="1"<if article.is_published!="0" && article.is_published!=""> checked</if>>
       <if new=="1">
-        <input type="submit" name="save" value="${lang("insert")}">
+        <input type="submit" class="majorbutton" name="save" value="${lang("insert")}">
       <else>
-        <input type="submit" name="save" value="${lang("save")}">
+        <input type="submit" class="majorbutton" name="save" value="${lang("save")}">
       </if>
     </td>
   </tr>
   <call PulldownTableRow (lang("content.articletype"), "to_article_type", articletypes, "id", "name", article.to_article_type, "articletypes.")>
   <call PulldownTableRow (lang("content.language"), "to_language", languages, "id", "name", article.to_language, "")>
   
+  
+  <list topics as r>
   <tr>
     <td align="right" valign="top" class="table-left">
-      ${lang("content.topic")}:
+      ${lang(r.key)}:
     </td>
-    <td class="listrow2" >
-      <if config["Mir.Localizer.Admin.TopicListFlavor"]!="0">
+    <td class="listrow2">
+      <if r.listtype=="1">
       <table border=0 cellpadding="2" cellspacing="0">
         <tr> 
-          <assign col=config["Mir.Localizer.Admin.TopicListColumns"]>
-          <list topics as t>
+          <assign col=r.listparameter>
+          <list r.items as t>
             <if col=="0">
         </tr>
         <tr>
-          <assign col=config["Mir.Localizer.Admin.TopicListColumns"]>
+          <assign col=r.listparameter>
             </if>
           <td title="${utility.encodeHTML(t.description)}">
             <input type="checkbox" name="to_topic" value="${t.id}" <list article.to_topics as to><if (t.id == to["id"])>checked</if></list>>
         </tr>
       </table>
       <else>
-      <select name="to_topic" size="7" multiple>
-               <list topics as t>
-                 <option value="${t.id}" <list article.to_topics as to><if (t.id == to["id"])>selected</if></list>>${t.title}</option>
-        </list>
-      </select>
+        <if r.listtype=="0">
+          <select name="to_topic" size="r.listparameter" multiple>
+                       <list r.items as t>
+                         <option value="${t.id}" <list article.to_topics as to><if (t.id == to["id"])>selected</if></list>>${t.title}</option>
+            </list>
+          </select>
+        <else>
+          <select name="to_topic" size="1">
+                       <list r.items as t>
+                         <option value="${t.id}" <list article.to_topics as to><if (t.id == to["id"])>selected</if></list>>${t.title}</option>
+            </list>
+          </select>
+        </if>
       </if>
     </td>
   </tr>
+  </list>
+  
   
   <call TextInputTableRow      (lang("content.title"), 40, 255, "title", article.title)>
   <call TextInputTableRowLight (lang("content.subtitle"), 40, 255, "subtitle", article.subtitle)>
   <tr>
     <td colspan="2" align="right" valign="top">
       <if new=="1">
-        <input type="submit" name="save" value="${lang("insert")}">
+        <input type="submit" class="majorbutton" name="save" value="${lang("insert")}">
       <else>
-        <input type="submit" name="save" value="${lang("save")}">
+        <input type="submit" class="majorbutton" name="save" value="${lang("save")}">
       </if>
     </td>
   </tr>
index c6c3f00..2752dc3 100755 (executable)
@@ -33,7 +33,7 @@
       <input type="hidden" name="do" value="articleoperationbatch">
       <input type="hidden" name="returnurl" value="${utility.encodeHTML(thisurl)}">
       <p class="box">
-        <input type="submit" name="save" value="${lang("save")}"> &nbsp; (${lang("commentlist.activate")})
+        <input type="submit" class="majorbutton" name="save" value="${lang("save")}"> &nbsp; (${lang("commentlist.activate")})
       </p>
   </if>    
 </if>
index 28d8c33..181bb28 100755 (executable)
   <input type="hidden" name="entry" value="${entry}">
   <input type="hidden" name="subdirectory" value="${subdirectory}">
   <input type="hidden" name="do" value="update">
-  <input type="submit" name="save" value="${lang("save")}"> &nbsp;
-  <input type="reset" value="${lang("reset")}">
+  <input type="submit" class="majorbutton" name="save" value="${lang("save")}"> &nbsp;
+  <input type="reset" class="majorbutton" value="${lang("reset")}">
   <br><br>  
   <textarea cols="120" rows="40" name="text" wrap=virtual>${utility.encodeHTML(text)}</textarea>
   <br><br>
-  <input type="submit" name="save" value="${lang("save")}"> &nbsp;
+  <input type="submit" class="majorbutton" name="save" value="${lang("save")}"> &nbsp;
   <input type="reset" value="${lang("reset")}">
 </form>
 <br>
index 0fd062c..0fc7541 100755 (executable)
@@ -58,7 +58,7 @@
       </tr>  
     <tr>
       <td colspan="2" align="right">
-        <input type="submit" value="${lang("login.submit")}">
+        <input type="submit" class="majorbutton" value="${lang("login.submit")}">
       </td>
     </tr>
     </tbody>
index 62787b7..3d7a30a 100755 (executable)
     <call showAddOrBack("1", module, "Admin", "superusermenu")>
 
     <if entities>
+    <call ListStart()>\r
+    <call ListHead([
+           lang("mediafolder.name"), 
+           lang("mediafolder.location"),
+           lang("mediafolder.comment"), ])>
+
+      <call EntityTable(entities, ["name", "place","comment"], 
+         [ ], from, to, count, "1", "1", module)>
+
+
+    <list entities as e>    
+        <call ExtendedListEntry([
+          utility.prettyEncodeHTML(e.name), 
+          utility.prettyEncodeHTML(e.place), 
+          utility.prettyEncodeHTML(e.comment)], 
+          ["module=Abuse&id="+f.id"&do=edit", "module=Abuse&id="+f.id"&do=delete"], 
+          [lang("edit"), lang("delete")])
+        >
+    </list>\r
+    <call ListEnd()>\r
+
+
       <call showPrevNextLinks(prevurl, nexturl, "left")>
       <call EntityTable(entities, ["name", "place","comment"], 
          [ lang("mediafolder.name"), 
index fd89391..2931a85 100755 (executable)
         <input type="hidden" name="do" value="edit">
         ${lang("start.content.open_by_id")}: 
         <input type="text" name="id" value="" size="7">
-        <input type="submit" value=" &gt; ">
+        <input class="majorbutton" type="submit" value=" &gt; ">
       </form>
       <form>
         <input type="hidden" name="module" value="Comment">
         <input type="hidden" name="do" value="edit">
         ${lang("start.comment.open_by_id")}: 
         <input type="text" name="id" value="" size="7">
-        <input type="submit" value=" &gt; ">
+        <input class="majorbutton" type="submit" value=" &gt; ">
       </form>
       
       
index 92dce09..4780fbd 100755 (executable)
@@ -24,7 +24,7 @@
               <b>${lang("media.nr_of_media")} :</b><br>
             </td>
             <td class="listrow2">
-              <input type="text" size="3" name="nrmedia" value="${nrmedia}">&nbsp;&nbsp;<input type="submit" value="${lang("media.nr_of_media.submit")}">
+              <input type="text" size="3" name="nrmedia" value="${nrmedia}">&nbsp;&nbsp;<input type="submit" class="majorbutton" value="${lang("media.nr_of_media.submit")}">
             </td>
           </tr>
         </table>
         <tr>
           <td colspan="2" align="right" class="table-foot">
             <if new=="1">
-              <input type="submit" name="save" value="${lang("insert")}">
+              <input type="submit" class="majorbutton" name="save" value="${lang("insert")}">
             <else>
               ${lang("media.is_published")} <input type="checkbox" name="is_published" value="1"<if uploadedmedia.is_published!="0" && uploadedmedia.is_published!=""> checked</if>>
-              &nbsp;&nbsp;<input type="submit" name="save" value="${lang("save")}">
+              &nbsp;&nbsp;<input type="submit" class="majorbutton" name="save" value="${lang("save")}">
             </if> 
           </td>
         </tr>
index 2d24349..a62a3fc 100755 (executable)
@@ -187,6 +187,11 @@ a:hover            {
 .lynx            { display:none; }
 
 .majorbutton {
+       background-color:#DDDDDD; 
+       color: #990000;
+       font-weight: bold;
+  border: 1px solid #990000;
+  bevel: 2px solid #990000;
 }
 
 .minorbutton {