- icons in comment list
authorzapata <zapata>
Wed, 9 Nov 2005 14:08:56 +0000 (14:08 +0000)
committerzapata <zapata>
Wed, 9 Nov 2005 14:08:56 +0000 (14:08 +0000)
- operations available in the ip log

build.xml
bundles/admin_en.properties
etc/producer/article.template
source/mircoders/global/Abuse.java
source/mircoders/servlet/ServletModuleLocalizer.java
templates/admin/FUNCTIONS.template
templates/admin/abuse.log.template
templates/admin/commentlist.template

index 326228c..0cb5cf3 100755 (executable)
--- a/build.xml
+++ b/build.xml
     <mkdir  dir="${build.javadoc}"/>
   </target>
 
-  <target name="prepare-binary-distribution">
+  <target name="prepare-distribution">
     <mkdir  dir="${distribution.home}"/>
-    <delete dir="${build}/binarydist"/>
-    <mkdir  dir="${build}/binarydist"/>
+    <delete dir="${build}/dist"/>
+    <mkdir  dir="${build}/dist"/>
   </target>
 
-  <target name="binary-distribution" depends="prepare-binary-distribution">
+  <target name="distribution" depends="prepare-distribution">
     <antcall target="generate-deployment-tree">
-      <param name="destination" value="${build}/binarydist"/>
+      <param name="destination" value="${build}/dist"/>
     </antcall>
 
-    <zip zipfile="${distribution.home}/binary.zip" >
-      <fileset dir="${build}/binarydist" includes="**/*" />
-    </zip>
+    <tar tarfile="${distribution.home}/mir-${version}.tar.gz" compression="gzip">
+      <tarfileset dir="${build}/binarydist" includes="**/*" />
+    </tar>
   </target>
 
   <target name="prepare-source-distribution">
index 9cfba90..bb55f11 100755 (executable)
@@ -1,6 +1,6 @@
 ########## admin ##########
 # language: english
-# $Id: admin_en.properties,v 1.48.2.25 2005/01/16 00:16:22 zapata Exp $
+# $Id: admin_en.properties,v 1.48.2.26 2005/11/09 14:08:56 zapata Exp $
 
 languagename=English
 
@@ -71,7 +71,7 @@ media.is_published=published
 media.icon=icon
 media.nr_of_media=Number of Media Items (max 20)
 media.nr_of_media.submit=define number
-media.comments=Comments 
+media.comments=Comments
 media.articles=Articles
 
 medialist.search_text_in=Search text in
@@ -120,7 +120,7 @@ comment.url=Url
 comment.creator=Author
 comment.article=Article
 comment.html=HTML
-comment.status=Status 
+comment.status=Status
 comment.language=Language
 comment.allcomments=All comments
 comment.comment=Internal Comment
@@ -487,8 +487,7 @@ abuse.log.time=Time
 abuse.log.address=IP number
 abuse.log.object=Object
 abuse.log.browser=Browser
-abuse.log.filtertype=Filter type
-abuse.log.filterexpression=Expression
+abuse.log.filtertag = Filter tag
 
 abuse.filters = Filters
 filters.movedown = down
@@ -498,8 +497,8 @@ filters.movetop = top
 
 filter.type = Type
 filter.expression = Expression
-filter.articleaction = Article 
-filter.commentaction = Comment 
+filter.articleaction = Article
+filter.commentaction = Comment
 filter.comment = Comments (internal usage)
 filter.last_hit = Last hit
 filter.htmltitle = Edit filter
index cf4695a..ebf644c 100755 (executable)
       <table cellpadding="30" cellspacing="0" border="0" width="80%"><tr><td>
         <table border="0" cellpadding="2" cellspacing="0" width="100%"><tr><td bgcolor="#669999">
           &nbsp;<!--#include virtual="/languagebar/${article.to_original.date.formatted.yyyy}/${article.to_original.date.formatted.MM}/${article.to_original.id}.shtml"-->
-        </td></tr></table> 
+        </td></tr></table>
        <br>
         <table border="0" cellpadding="2" cellspacing="0" width="100%"><tr><td bgcolor="#669999">
          &nbsp;<a href="${config.openAction}?do=opensession&sessiontype=translation&to_content=${article.to_original.id}"><font color="#dddddd">${lang("general.addtranslation")} &gt;&gt;</font></a>
index e7dc56f..329aeff 100755 (executable)
@@ -59,6 +59,8 @@ import mircoders.abuse.FilterEngine;
 import mircoders.entity.EntityComment;
 import mircoders.entity.EntityContent;
 import mircoders.localizer.MirAdminInterfaceLocalizer;
+import mircoders.module.ModuleContent;
+import mircoders.module.ModuleComment;
 
 import org.apache.commons.collections.ExtendedProperties;
 
@@ -86,10 +88,12 @@ public class Abuse {
 
   private static String cookieName = MirGlobal.config().getString("Abuse.CookieName");
   private static int cookieMaxAge = 60 * 60 * MirGlobal.config().getInt("Abuse.CookieMaxAge");
+  private EntityAdapterModel model;
 
   public Abuse(EntityAdapterModel aModel) {
     logger = new LoggerWrapper("Global.Abuse");
     filterEngine = new FilterEngine(aModel);
+    model = aModel;
 
     log = new ArrayList();
 
@@ -283,6 +287,9 @@ public class Abuse {
   }
 
   public List getLog() {
+    ModuleContent contentModule = new ModuleContent();
+    ModuleComment commentModule = new ModuleComment();
+
     synchronized (log) {
       try {
         List result = new ArrayList();
@@ -295,10 +302,18 @@ public class Abuse {
           entry.put("ip", logEntry.getIpNumber());
           entry.put("id", logEntry.getId());
           entry.put("timestamp", new GeneratorFormatAdapters.DateFormatAdapter(logEntry.getTimeStamp(), MirPropertiesConfiguration.instance().getString("Mir.DefaultTimezone")));
-          if (logEntry.getIsArticle())
+
+          if (logEntry.getIsArticle()) {
             entry.put("type", "content");
-          else
+            entry.put("object",
+                model.makeEntityAdapter("content", contentModule.getById(logEntry.getId())));
+          }
+          else {
             entry.put("type", "comment");
+            entry.put("object",
+                model.makeEntityAdapter("comment", commentModule.getById(logEntry.getId())));
+          }
+
           entry.put("browser", logEntry.getBrowserString());
           entry.put("filtertag", logEntry.getMatchingFilterTag());
 
index 3862daf..4944f23 100755 (executable)
@@ -117,6 +117,23 @@ public class ServletModuleLocalizer extends AdminServletModule {
     ServletHelper.redirect(aResponse, returnUrlString);
   }
 
+  public void operation(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc {
+    String type = aRequest.getParameter("objecttype");
+    String id = aRequest.getParameter("id");
+    String operation = aRequest.getParameter("operation");
+    String returnUrl = aRequest.getParameter("returnurl");
+
+
+    if ("comment".equals(type)) {
+      performCommentOperation(aRequest, id, operation);
+    }
+    else {
+      performArticleOperation(aRequest, id, operation);
+    }
+
+    ServletHelper.redirect(aResponse, returnUrl);
+  }
+
   public void commentoperationbatch(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc {
     String returnUrlString = aRequest.getParameter("returnurl");
 
@@ -144,6 +161,38 @@ public class ServletModuleLocalizer extends AdminServletModule {
     ServletHelper.redirect(aResponse, returnUrlString);
   }
 
+  public void operationbatch(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc {
+    String returnUrlString = aRequest.getParameter("returnurl");
+
+    String[] operations = aRequest.getParameterValues("operation");
+
+    if (operations!=null) {
+      for (int i = 0; i < operations.length; i++) {
+        if (operations[i].length() > 0) {
+          List parts = StringRoutines.splitString(operations[i], ";");
+
+          if (parts.size() != 3) {
+            getLogger().error("commentoperationbatch: operation string invalid: " +
+                         operations[i]);
+          }
+          else {
+            String type = (String) parts.get(0);
+            String id = (String) parts.get(1);
+            String operationString = (String) parts.get(2);
+
+            if ("comment".equals(type)) {
+              performCommentOperation(aRequest, id, operationString);
+            }
+            else {
+              performArticleOperation(aRequest, id, operationString);
+            }
+          }
+        }
+      }
+    }
+
+    ServletHelper.redirect(aResponse, returnUrlString);
+  }
   public void performArticleOperation(HttpServletRequest aRequest, String anId, String anOperation) {
     EntityContent entity;
 
index 0a0e882..759ad87 100755 (executable)
   </table>
 </function>  
 
+<function showCommentAttachment(aComment, aReturnUrl)>
+  <call showAttachment(0, aComment, "1", aReturnUrl)>
+</function>
+
+<function showAttachment(anIsArticle, anObject, aCanEdit, aReturnUrl)>
+    <assign objectKey="commentid">
+    <assign objectModule="Comment">
+    <list anObject.to_all_media_images as m>
+       <a href="${config.actionRoot}?module=Images&amp;do=getMedia&amp;id=${m["id"]}">
+         <img src="${config.actionRoot}?module=Images&amp;do=getIcon&amp;id=${m["id"]}"
+              alt="edit" border="0">
+       </a>
+    </list>
+    <list anObject.to_all_media_audio as m>
+       <img src="${config.docRoot}/img/${m["big_icon"]}" alt="edit" border="0">
+    </list>
+    <list anObject.to_all_media_video as m>
+       <img src="${config.docRoot}/img/${m["big_icon"]}" alt="edit" border="0">
+    </list>
+    <list anObject.to_all_media_other as m>
+       <img src="${config.docRoot}/img/${m["big_icon"]}" alt="edit" border="0">
+    </list>
+</function>
+
 
index 32da5c0..28d2ede 100755 (executable)
@@ -6,23 +6,34 @@
 
   <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
     <include "head.template">
-    
+
   <p>
     <a class="link-box" href="${config.actionRoot}?module=Abuse"> [ &lt; ] ${lang("back")}</a>&nbsp;&nbsp;
     <a class="link-box" href="${config.actionRoot}?module=Abuse&amp;do=showfilterconfiguration">${lang("abuse.showfilterconfiguration")}</a>
     <br>
   </p>
+    <if config["Mir.Localizer.Admin.ListOperationsFlavor"]!="0">
+      <form method="post" action="${config.actionRoot}">
+        <input type="hidden" name="module" value="Localizer">
+        <input type="hidden" name="do" value="operationbatch">
+        <input type="hidden" name="returnurl" value="${utility.encodeHTML(thisurl)}">
+        <p class="box">
+          <input type="submit" class="majorbutton" name="save" value="${lang("save")}">
+        </p>
+    </if>
+
+
     <table border="0" cellpadding="2" cellspacing="3">
       <tr class="darkgrey">
         <td class="table-head">${lang("abuse.log.time")}</td>
         <td class="table-head">${lang("abuse.log.address")}</td>
         <td class="table-head">${lang("abuse.log.object")}</td>
+        <td class="table-head"></td>
         <td class="table-head">${lang("abuse.log.browser")}</td>
-        <td class="table-head">${lang("abuse.log.filtertype")}</td>
-        <td class="table-head">${lang("abuse.log.filterexpression")}</td>
+        <td class="table-head">${lang("abuse.log.filtertag")}</td>
       </tr>
-      
-      <assign grey="0">      
+
+      <assign grey="0">
       <list log as l>
         <if grey=="1"><assign grey="0"><tr class="listrow1"><else><tr class="listrow2"><assign grey="1"> </if>
           <td>${l.timestamp.format(config["Mir.DefaultDateTimeFormat"])}</td>
               <a href="${config.actionRoot}?module=Comment&do=edit&id=${l.id}&returnurl=${utility.encodeURI(thisurl)}">Comment</a>
             </if>
           </td>
+          <td>
+            <if config["Mir.Localizer.Admin.ListOperationsFlavor"]=="0">
+              <list l.object.operations as op>
+                [ <a href="${config.actionRoot}?module=Localizer&do=operation&objectype=${l.type}&operation=${op}&id=${l.object.id}&returnurl=${utility.encodeURI(thisurl + "#" + l.object.id)}">${lang(l.type+".operation."+op)}</a> ]
+              </list>
+            </if>
+            <if config["Mir.Localizer.Admin.ListOperationsFlavor"]=="1">
+              <list l.object.operations as op>
+                 <input type="checkbox" name="operation" value="${l.type};${l.object.id};${op}">${lang(l.type+".operation."+op)}
+              </list>
+            </if>
+            <if config["Mir.Localizer.Admin.ListOperationsFlavor"]=="2">
+              <select name="operation">
+                <option value="" selected>&nbsp;</option>
+                <list l.object.operations as op>
+                  <option value="${l.type};${l.object.id};${op}">${lang(l.type+".operation."+op)}</option>
+                </list>
+              </select>
+            </if>
+          </td>
           <td>${utility.encodeHTML(l.browser)}</td>
-          <td><if l.hitfiltertype>${lang("abuse.filtertype."+l.hitfiltertype)}</if></td>
-          <td>${utility.encodeHTML(l.hitfilterexpression)}</td>
+          <td><if l.filtertag>${l.filtertag}</if></td>
         </tr>
       </list>
     <tr>
       <td colspan="6" class="table-foot">&nbsp;</td>
     </tr>
     </table>
+    <if config["Mir.Localizer.Admin.ListOperationsFlavor"]!="0">
+      </form>
+    </if>
 
     <p>
       <a class="link-box" href="${config.actionRoot}?module=Abuse"> [ &lt; ] ${lang("back")}</a>&nbsp;&nbsp;
index 426dc01..8edc36f 100755 (executable)
         </if>
         <br>
         ${utility.prettyEncodeHTML(utility.subString(entry.description, 0, config["Mir.Admin.ListTextLengthLimit"]))}
+
+        <br>
+          <if entry.to_all_media_images><call showCommentAttachment(entry, thisurl)></if>
+          <if entry.to_all_media_audio><call showCommentAttachment(entry, thisurl)></if>
+          <if entry.to_all_media_video><call showCommentAttachment(entry, thisurl)></if>
+          <if entry.to_all_media_other><call showCommentAttachment(entry, thisurl)></if>
+        <br>
         
         <if entry.main_url><br>URL: ${utility.encodeHTML(entry.main_url)}</if>
         <br>
         </if>
         <if entry.operations>&nbsp;|&nbsp;</if>
         <a href="${config.actionRoot}?module=Comment&do=edit&id=${entry.id}">${lang("edit")}</a>
-        <if entry.to_all_media_images>IMAGES</if>
       </td>
         
       <td valign="top">