From: zapata Date: Fri, 13 Dec 2002 20:59:41 +0000 (+0000) Subject: full support for comment status in admin X-Git-Tag: BEFORE_MERGE_1_1~403 X-Git-Url: http://erislabs.net/gitweb/?p=mir.git;a=commitdiff_plain;h=f387144862ac9672530f6c99033fcce9ec04533e full support for comment status in admin --- diff --git a/bundles/admin_ay.properties b/bundles/admin_ay.properties index eb65ffe7..e2044e94 100755 --- a/bundles/admin_ay.properties +++ b/bundles/admin_ay.properties @@ -84,6 +84,8 @@ comment.email=email comment.url=url comment.creator=autor comment.article=del artículo +comment.html=HTML? +comment.status=Status # needs translation commentlist.htmltitle=lista de comentarios commentlist.published=publicado diff --git a/bundles/admin_de.properties b/bundles/admin_de.properties index fa49b73f..cb0e71ea 100755 --- a/bundles/admin_de.properties +++ b/bundles/admin_de.properties @@ -1,6 +1,6 @@ ########## admin ########## # language: deutsch / german -# $Id: admin_de.properties,v 1.19 2002/12/13 18:00:23 zapata Exp $ +# $Id: admin_de.properties,v 1.20 2002/12/13 21:00:03 zapata Exp $ # general yes=ja @@ -91,6 +91,9 @@ comment.email=Email comment.url=Url comment.creator=Uhrheber comment.article=zu artikel +comment.html=HTML? +comment.status=Status # needs translation +comment.language=Sprache commentlist.htmltitle=commentlist commentlist.published=publiziert diff --git a/bundles/admin_en.properties b/bundles/admin_en.properties index 45f8fffc..4f1fd477 100755 --- a/bundles/admin_en.properties +++ b/bundles/admin_en.properties @@ -1,6 +1,6 @@ ########## admin ########## # language: english -# $Id: admin_en.properties,v 1.27 2002/12/13 18:00:23 zapata Exp $ +# $Id: admin_en.properties,v 1.28 2002/12/13 21:00:03 zapata Exp $ # general yes=yes @@ -84,17 +84,20 @@ breaking.date=date breakinglist.htmltitle=Breaking news overview # comment -comment.htmltitle=comment -comment.date=date -comment.title=title -comment.published=published -comment.text=comment text -comment.address=address -comment.phone=phone -comment.email=email -comment.url=url -comment.creator=author -comment.article=for article +comment.htmltitle=Comment +comment.date=Date +comment.title=Title +comment.published=Published +comment.text=Comment text +comment.address=Address +comment.phone=Phone +comment.email=Email +comment.url=Url +comment.creator=Author +comment.article=For article +comment.html=HTML? +comment.status=Status +comment.language=Language commentlist.htmltitle=Comments commentlist.published=published diff --git a/bundles/admin_es.properties b/bundles/admin_es.properties index 1add7abc..6feb7364 100755 --- a/bundles/admin_es.properties +++ b/bundles/admin_es.properties @@ -1,6 +1,6 @@ ########## admin ########## # language: espanol / spanish -# $Id: admin_es.properties,v 1.11 2002/12/13 18:00:23 zapata Exp $ +# $Id: admin_es.properties,v 1.12 2002/12/13 21:00:03 zapata Exp $ # general yes=sí @@ -88,6 +88,9 @@ comment.email=email comment.url=url comment.creator=autor comment.article=del artículo +comment.html=es HTML? +comment.status=Status # needs translation +comment.language=Lengua commentlist.htmltitle=lista de comentarios commentlist.published=publicado diff --git a/bundles/admin_gn.properties b/bundles/admin_gn.properties index 4f87cbdf..8f79b5e4 100755 --- a/bundles/admin_gn.properties +++ b/bundles/admin_gn.properties @@ -85,6 +85,9 @@ comment.email=email comment.url=url comment.creator=autor comment.article=del artículo +comment.html=es HTML? +comment.status=Status # needs translation +comment.language=Lengua commentlist.htmltitle=lista de comentarios commentlist.published=publicado diff --git a/bundles/admin_qu.properties b/bundles/admin_qu.properties index 9c9fc9c5..939e6a1a 100755 --- a/bundles/admin_qu.properties +++ b/bundles/admin_qu.properties @@ -85,6 +85,9 @@ comment.email=email comment.url=url comment.creator=autor comment.article=del artículo +comment.html=es HTML? +comment.status=Status # needs translation +comment.language=Lengua commentlist.htmltitle=lista de comentarios commentlist.published=publicado diff --git a/bundles/admin_tr.properties b/bundles/admin_tr.properties index 547a68ef..6a2886ff 100755 Binary files a/bundles/admin_tr.properties and b/bundles/admin_tr.properties differ diff --git a/dbscripts/help_comment_status.sql b/dbscripts/help_comment_status.sql new file mode 100755 index 00000000..30efc676 --- /dev/null +++ b/dbscripts/help_comment_status.sql @@ -0,0 +1,2 @@ +INSERT INTO "comment_status" ("id", "name") +VALUES (1,'normal'); diff --git a/source/mir/entity/adapter/EntityAdapter.java b/source/mir/entity/adapter/EntityAdapter.java index e5ad90e2..ba2dca1f 100755 --- a/source/mir/entity/adapter/EntityAdapter.java +++ b/source/mir/entity/adapter/EntityAdapter.java @@ -99,7 +99,7 @@ public class EntityAdapter implements Map { } public boolean isEmpty() { - throw new UnsupportedOperationException("EntityAdapter.isEmpty()"); + return false; } public Set keySet() { diff --git a/source/mir/storage/StorageObject.java b/source/mir/storage/StorageObject.java index 32ea7744..b5752e44 100755 --- a/source/mir/storage/StorageObject.java +++ b/source/mir/storage/StorageObject.java @@ -1,256 +1,230 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * Mir is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ -/* - * Implementiert Interface für die Speicherschicht. - * Bislang gibt es in der Bibliothek nur die Möglichkeit - * in einer Datenbank zu speichern. - */ - -package mir.storage; - -import java.lang.*; -import java.util.*; -import java.sql.*; -import freemarker.template.*; -import mir.entity.*; - - -/** - * Implementiert Interface für die Speicherschicht. - * Bislang gibt es in der Bibliothek nur die Möglichkeit - * in einer Datenbank zu speichern. - * @author RK - * @version 29.6.1999 - */ -public interface StorageObject { - - /** - * Dokumentation siehe Database.java - * @param id - * @return Entity - * @exception StorageObjectException - */ - abstract public Entity selectById (String id) throws StorageObjectException; - - - - /** - * Dokumentation siehe Database.java - * @param aField - * @param aValue - * @return EntityList - * @exception StorageObjectException - */ - abstract public EntityList selectByFieldValue (String aField, String aValue) throws StorageObjectException; - - - - /** - * Dokumentation siehe Database.java - * @param whereClause - * @return EntityList - * @exception StorageObjectException - */ - abstract public EntityList selectByWhereClause (String whereClause) throws StorageObjectException; - - - - /** - * Dokumentation siehe Database.java - * @param whereClause - * @param offset - * @return EntityList - * @exception StorageObjectException - */ - abstract public EntityList selectByWhereClause (String whereClause, int offset) throws StorageObjectException; - - - - /** - * Dokumentation siehe Database.java - * @param whereClause - * @param orderBy - * @param offset - * @return EntityList - * @exception StorageObjectException - */ - abstract public EntityList selectByWhereClause (String whereClause, String orderBy, - int offset) throws StorageObjectException; - - - - /** - * Dokumentation siehe Database.java - * @param whereClause - * @param orderBy - * @param offset - * @param limit - * @return EntityList - * @exception StorageObjectException - */ - abstract public EntityList selectByWhereClause (String whereClause, String orderBy, - int offset, int limit) throws StorageObjectException; - - - - /** - * Dokumentation siehe Database.java - * @param id - * @return boolen - * @exception StorageObjectException - */ - abstract public boolean delete (String id) throws StorageObjectException; - - - - /** - * Dokumentation siehe Database.java - * @return ArrayList - * @exception StorageObjectException - */ - abstract public ArrayList getFields () throws StorageObjectException; - - - - /** - * Dokumentation siehe Database.java - * @return int[] - * @exception StorageObjectException - */ - abstract public int[] getTypes () throws StorageObjectException; - - - - /** - * Dokumentation siehe Database.java - * @return ArrayList - * @exception StorageObjectException - */ - abstract public ArrayList getLabels () throws StorageObjectException; - - - - /** - * Dokumentation siehe Database.java - * @param a - * @exception StorageObjectException - */ - abstract public void update (Entity a) throws StorageObjectException; - - - - /** - * Dokumentation siehe Database.java - * @param a - * @return String id - * @exception StorageObjectException - */ - abstract public String insert (Entity a) throws StorageObjectException; - - - - /** - * Dokumentation siehe Database.java - * @return Class Klasse der Entity - */ - abstract public Class getEntityClass(); - - - - /** - * put your documentation comment here - * @return - */ - abstract public String getIdName(); - - - - /** - * Dokumentation siehe Database.java - * @return String - */ - abstract public String getTableName(); - - - - /** - * Dokumentation siehe Database.java - * @return SimpleHash - */ - abstract public SimpleHash getHashData(); - - - - /** - * Dokumentation siehe Database.java - * @return Connection - * @exception StorageObjectException - */ - abstract public Connection getPooledCon () throws StorageObjectException; - - - - /** - * Dokumentation siehe Database.java - * @param a - * @param sql - * @return ResultSet - * @exception StorageObjectException, SQLException - */ - abstract public ResultSet executeSql (Statement a, String sql) throws StorageObjectException, - SQLException; - - - - /** - * Dokumentation siehe Database.java - * @param con - * @param stmt - */ - abstract public void freeConnection(Connection con, Statement stmt) - throws StorageObjectException; - - - - /** - * Dokumentation siehe Database.java - * @return - */ - abstract public SimpleList getPopupData () throws StorageObjectException; - - abstract public int executeUpdate(Statement a, String sql) throws StorageObjectException, SQLException ; - abstract public int executeUpdate(String sql) throws StorageObjectException, SQLException ; - abstract public int getSize(String where) throws SQLException,StorageObjectException; - -} - - - +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with the com.oreilly.servlet library, any library + * licensed under the Apache Software License, The Sun (tm) Java Advanced + * Imaging library (JAI), The Sun JIMI library (or with modified versions of + * the above that use the same license as the above), and distribute linked + * combinations including the two. You must obey the GNU General Public + * License in all respects for all of the code used other than the above + * mentioned libraries. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If you do + * not wish to do so, delete this exception statement from your version. + */ +/* + * Implementiert Interface für die Speicherschicht. + * Bislang gibt es in der Bibliothek nur die Möglichkeit + * in einer Datenbank zu speichern. + */ + +package mir.storage; + +import java.lang.*; +import java.util.*; +import java.sql.*; +import freemarker.template.*; +import mir.entity.*; + + +/** + * Implementiert Interface für die Speicherschicht. + * Bislang gibt es in der Bibliothek nur die Möglichkeit + * in einer Datenbank zu speichern. + * @author RK + * @version 29.6.1999 + */ +public interface StorageObject { + + /** + * Dokumentation siehe Database.java + * @param id + * @return Entity + * @exception StorageObjectException + */ + abstract public Entity selectById(String id) throws StorageObjectException; + + /** + * Dokumentation siehe Database.java + * @param aField + * @param aValue + * @return EntityList + * @exception StorageObjectException + */ + abstract public EntityList selectByFieldValue(String aField, String aValue) throws + StorageObjectException; + + /** + * Dokumentation siehe Database.java + * @param whereClause + * @return EntityList + * @exception StorageObjectException + */ + abstract public EntityList selectByWhereClause(String whereClause) throws + StorageObjectException; + + /** + * Dokumentation siehe Database.java + * @param whereClause + * @param offset + * @return EntityList + * @exception StorageObjectException + */ + abstract public EntityList selectByWhereClause(String whereClause, int offset) throws + StorageObjectException; + + /** + * Dokumentation siehe Database.java + * @param whereClause + * @param orderBy + * @param offset + * @return EntityList + * @exception StorageObjectException + */ + abstract public EntityList selectByWhereClause(String whereClause, + String orderBy, + int offset) throws + StorageObjectException; + + /** + * Dokumentation siehe Database.java + * @param whereClause + * @param orderBy + * @param offset + * @param limit + * @return EntityList + * @exception StorageObjectException + */ + abstract public EntityList selectByWhereClause(String whereClause, + String orderBy, + int offset, int limit) throws + StorageObjectException; + + /** + * Dokumentation siehe Database.java + * @param id + * @return boolen + * @exception StorageObjectException + */ + abstract public boolean delete(String id) throws StorageObjectException; + + /** + * Dokumentation siehe Database.java + * @return ArrayList + * @exception StorageObjectException + */ + abstract public ArrayList getFields() throws StorageObjectException; + + /** + * Dokumentation siehe Database.java + * @return int[] + * @exception StorageObjectException + */ + abstract public int[] getTypes() throws StorageObjectException; + + /** + * Dokumentation siehe Database.java + * @return ArrayList + * @exception StorageObjectException + */ + abstract public ArrayList getLabels() throws StorageObjectException; + + /** + * Dokumentation siehe Database.java + * @param a + * @exception StorageObjectException + */ + abstract public void update(Entity a) throws StorageObjectException; + + /** + * Dokumentation siehe Database.java + * @param a + * @return String id + * @exception StorageObjectException + */ + abstract public String insert(Entity a) throws StorageObjectException; + + /** + * Dokumentation siehe Database.java + * @return Class Klasse der Entity + */ + abstract public Class getEntityClass(); + + /** + * put your documentation comment here + * @return + */ + abstract public String getIdName(); + + /** + * Dokumentation siehe Database.java + * @return String + */ + abstract public String getTableName(); + + /** + * Dokumentation siehe Database.java + * @return SimpleHash + */ + abstract public SimpleHash getHashData(); + + /** + * Dokumentation siehe Database.java + * @return Connection + * @exception StorageObjectException + */ + abstract public Connection getPooledCon() throws StorageObjectException; + + /** + * Dokumentation siehe Database.java + * @param a + * @param sql + * @return ResultSet + * @exception StorageObjectException, SQLException + */ + abstract public ResultSet executeSql(Statement a, String sql) throws + StorageObjectException, + SQLException; + + /** + * Dokumentation siehe Database.java + * @param con + * @param stmt + */ + abstract public void freeConnection(Connection con, Statement stmt) throws + StorageObjectException; + + /** + * Dokumentation siehe Database.java + * @return + */ + abstract public SimpleList getPopupData() throws StorageObjectException; + + abstract public int executeUpdate(Statement a, String sql) throws + StorageObjectException, SQLException; + + abstract public int executeUpdate(String sql) throws StorageObjectException, + SQLException; + + abstract public int getSize(String where) throws SQLException, + StorageObjectException; +} + + + diff --git a/source/mircoders/localizer/basic/MirBasicDataModelLocalizer.java b/source/mircoders/localizer/basic/MirBasicDataModelLocalizer.java index 8beca896..ad90902a 100755 --- a/source/mircoders/localizer/basic/MirBasicDataModelLocalizer.java +++ b/source/mircoders/localizer/basic/MirBasicDataModelLocalizer.java @@ -90,6 +90,7 @@ public class MirBasicDataModelLocalizer implements MirDataModelLocalizer { try { anEntityAdapterDefinition.addDBDateField("creationdate", "webdb_create"); anEntityAdapterDefinition.addCalculatedField("to_content", new CommentToContentField()); + anEntityAdapterDefinition.addCalculatedField("status", new CommentToStatusField()); anEntityAdapterDefinition.addCalculatedField("description_parsed", new FilteredField("description")); anEntityAdapterDefinition.addCalculatedField("operations", @@ -115,6 +116,7 @@ public class MirBasicDataModelLocalizer implements MirDataModelLocalizer { result.addMapping( "comment", DatabaseComment.getInstance(), definition); result.addMapping( "articleType", DatabaseArticleType.getInstance(), new EntityAdapterDefinition()); + result.addMapping( "commentStatus", DatabaseCommentStatus.getInstance(), new EntityAdapterDefinition()); definition = new EntityAdapterDefinition(); definition.addDBDateField("creationdate", "webdb_create"); @@ -156,6 +158,20 @@ public class MirBasicDataModelLocalizer implements MirDataModelLocalizer { } } + protected class CommentToStatusField implements EntityAdapterDefinition.CalculatedField { + public Object getValue(EntityAdapter anEntityAdapter) { + try { + return anEntityAdapter.getToOneRelation( + "id="+anEntityAdapter.get("to_comment_status"), + "id", + "commentStatus" ); + } + catch (Throwable t) { + throw new RuntimeException(t.getMessage()); + } + } + } + protected class EntityToSimpleOperationsField implements EntityAdapterDefinition.CalculatedField { private List operations; diff --git a/source/mircoders/localizer/basic/MirBasicProducerAssistantLocalizer.java b/source/mircoders/localizer/basic/MirBasicProducerAssistantLocalizer.java index 617e8484..0c181223 100755 --- a/source/mircoders/localizer/basic/MirBasicProducerAssistantLocalizer.java +++ b/source/mircoders/localizer/basic/MirBasicProducerAssistantLocalizer.java @@ -119,10 +119,25 @@ public class MirBasicProducerAssistantLocalizer implements MirProducerAssistantL } } catch (Throwable t) { - logger.printError("initializeGenerationValueSet: Exception "+t.getMessage()); + logger.printError("initializeGenerationValueSet: Exception while collecting article types "+t.getMessage()); } - aValueSet.put("articletype", articleTypeMap); + + Map commentStatusMap = new HashMap(); + try { + i = new EntityIteratorAdapter( "", "", 20, MirGlobal.localizer().dataModel().adapterModel(), "commentStatus" ); + + while (i.hasNext()) { + EntityAdapter commentStatus = (EntityAdapter) i.next(); + + commentStatusMap.put(commentStatus.get("name"), commentStatus.get("id")); + } + } + catch (Throwable t) { + logger.printError("initializeGenerationValueSet: Exception while collecting comment statuses"+t.getMessage()); + } + aValueSet.put("commentstatus", articleTypeMap); + }; public String filterText(String aText) { diff --git a/source/mircoders/servlet/ServletModuleComment.java b/source/mircoders/servlet/ServletModuleComment.java index a94e49e6..c2040c29 100755 --- a/source/mircoders/servlet/ServletModuleComment.java +++ b/source/mircoders/servlet/ServletModuleComment.java @@ -91,12 +91,40 @@ public class ServletModuleComment extends ServletModule } } + public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException + { + String idParam = req.getParameter("id"); + + if (idParam == null) + throw new ServletModuleException("Invalid call: id not supplied "); + + showComment(idParam, req, res); + } + + public void showComment(String anId, HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleException { + try { + SimpleHash extraInfo = new SimpleHash(); + TemplateModelRoot data; + + data = (TemplateModelRoot) mainModule.getById(anId); + + extraInfo.put("languages", DatabaseLanguage.getInstance().getPopupData()); + extraInfo.put("comment_status_values", DatabaseCommentStatus.getInstance().getPopupData()); + + deliver(aRequest, aResponse, data, extraInfo, templateObjektString); + } + catch (Exception e) { + throw new ServletModuleException(e.toString()); + } + } + + public void list(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleException { HTTPRequestParser requestParser = new HTTPRequestParser(aRequest); String where = requestParser.getParameter("where"); - String order = requestParser.getParameter("order"); + String order = requestParser.getParameterWithDefault("order", "webdb_create desc"); int offset = requestParser.getIntegerWithDefault("offset", 0); returnCommentList(aRequest, aResponse, where, order, offset); diff --git a/source/mircoders/servlet/ServletModuleContent.java b/source/mircoders/servlet/ServletModuleContent.java index 4843d3ca..fda22ade 100755 --- a/source/mircoders/servlet/ServletModuleContent.java +++ b/source/mircoders/servlet/ServletModuleContent.java @@ -62,7 +62,7 @@ import mircoders.localizer.*; * ServletModuleContent - * deliver html for the article admin form. * - * @version $Id: ServletModuleContent.java,v 1.27 2002/12/13 17:57:31 zapata Exp $ + * @version $Id: ServletModuleContent.java,v 1.28 2002/12/13 20:59:42 zapata Exp $ * @author rk, mir-coders * */ @@ -250,7 +250,7 @@ public class ServletModuleContent extends ServletModule public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException { String idParam = req.getParameter("id"); - if (idParam == null) throw new ServletModuleException("Falscher Aufruf: (id) nicht angegeben"); + if (idParam == null) throw new ServletModuleException("Invalid call: id not supplied "); _showObject(idParam, req, res); } @@ -368,9 +368,11 @@ public class ServletModuleContent extends ServletModule SimpleHash extraInfo = new SimpleHash(); try { TemplateModelRoot entContent; + if (id != null) { entContent = (TemplateModelRoot)mainModule.getById(id); - } else { + } + else { SimpleHash withValues = new SimpleHash(); withValues.put("new", "1"); withValues.put("is_published", "0"); @@ -382,20 +384,8 @@ public class ServletModuleContent extends ServletModule } extraInfo.put("themenPopupData", themenModule.getTopicsAsSimpleList()); - try { - extraInfo.put("articletypePopupData", DatabaseArticleType.getInstance().getPopupData()); - } - catch (Exception e) { - logger.error("articletype could not be fetched."); - } - try { - extraInfo.put("languagePopupData", DatabaseLanguage.getInstance().getPopupData()); - } - catch (Exception e) { - logger.error("language-popup could not be fetched."); - } - - extraInfo.put("schwerpunktPopupData", schwerpunktModule.getSchwerpunktAsSimpleList()); + extraInfo.put("articletypePopupData", DatabaseArticleType.getInstance().getPopupData()); + extraInfo.put("languagePopupData", DatabaseLanguage.getInstance().getPopupData()); // code to be able to return to the list: String offsetParam, whereParam, orderParam; diff --git a/source/mircoders/servlet/ServletModuleLocalizer.java b/source/mircoders/servlet/ServletModuleLocalizer.java index 6977bdf7..c1b7d697 100755 --- a/source/mircoders/servlet/ServletModuleLocalizer.java +++ b/source/mircoders/servlet/ServletModuleLocalizer.java @@ -117,5 +117,30 @@ public class ServletModuleLocalizer extends ServletModule { } } + public void batchedarticleoperation(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleException { + String articleIdString = aRequest.getParameter("articleid"); + String operationString = aRequest.getParameter("operation"); + String returnUrlString = aRequest.getParameter("returnurl"); + + MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation; + EntityAdapter article; + EntityContent entity; + + try { + entity = (EntityContent) contentModule.getById(articleIdString); + + if (entity!=null) { + article = MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter("content", entity); + operation = MirGlobal.localizer().adminInterface().simpleArticleOperationForName(operationString); + operation.perform(article); + } + + redirect(aResponse, returnUrlString); + } + catch (Throwable e) { + e.printStackTrace(System.out); + throw new ServletModuleException(e.getMessage()); + } + } } \ No newline at end of file diff --git a/source/mircoders/storage/DatabaseArticleType.java b/source/mircoders/storage/DatabaseArticleType.java index 81f621f8..e17770bb 100755 --- a/source/mircoders/storage/DatabaseArticleType.java +++ b/source/mircoders/storage/DatabaseArticleType.java @@ -1,84 +1,83 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * Mir is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mircoders.storage; - -/** - * Title: - * Description: - * Copyright: Copyright (c) 2001 - * Company: Indymedia - * @author - * @version 1.0 - */ - -import java.lang.*; -import java.sql.*; -import java.io.*; -import java.util.*; - -import freemarker.template.*; - -import mir.storage.*; -import mir.entity.*; -import mir.misc.*; - - -public class DatabaseArticleType extends Database implements StorageObject{ - - private static DatabaseArticleType instance; - private static SimpleList articletypePopupData; - - // the following *has* to be sychronized cause this static method - // could get preemted and we could end up with 2 instances of DatabaseFoo.. - // see the "Singletons with needles and thread" article at JavaWorld -mh - public synchronized static DatabaseArticleType getInstance() - throws StorageObjectException - { - if (instance == null) { - instance = new DatabaseArticleType(); - instance.myselfDatabase = instance; - } - return instance; - } - - private DatabaseArticleType() throws StorageObjectException - { - super(); - this.hasTimestamp = false; - this.theTable="article_type"; - } - - public SimpleList getPopupData() - throws StorageObjectException { return getPopupData("name",false); } - - -} +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with the com.oreilly.servlet library, any library + * licensed under the Apache Software License, The Sun (tm) Java Advanced + * Imaging library (JAI), The Sun JIMI library (or with modified versions of + * the above that use the same license as the above), and distribute linked + * combinations including the two. You must obey the GNU General Public + * License in all respects for all of the code used other than the above + * mentioned libraries. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If you do + * not wish to do so, delete this exception statement from your version. + */ + +package mircoders.storage; + +/** + * Title: + * Description: + * Copyright: Copyright (c) 2001 + * Company: Indymedia + * @author + * @version 1.0 + */ + +import java.lang.*; +import java.sql.*; +import java.io.*; +import java.util.*; + +import freemarker.template.*; + +import mir.storage.*; +import mir.entity.*; +import mir.misc.*; + + +public class DatabaseArticleType extends Database implements StorageObject{ + + private static DatabaseArticleType instance; + private static SimpleList articletypePopupData; + + // the following *has* to be sychronized cause this static method + // could get preemted and we could end up with 2 instances of DatabaseFoo.. + // see the "Singletons with needles and thread" article at JavaWorld -mh + public synchronized static DatabaseArticleType getInstance() throws + StorageObjectException { + if (instance == null) { + instance = new DatabaseArticleType(); + instance.myselfDatabase = instance; + } + return instance; + } + + private DatabaseArticleType() throws StorageObjectException { + super(); + this.hasTimestamp = false; + this.theTable = "article_type"; + } + + public SimpleList getPopupData() throws StorageObjectException { + return getPopupData("name", false); + } + + +} diff --git a/source/mircoders/storage/DatabaseCommentStatus.java b/source/mircoders/storage/DatabaseCommentStatus.java index 86588d3a..35755216 100755 --- a/source/mircoders/storage/DatabaseCommentStatus.java +++ b/source/mircoders/storage/DatabaseCommentStatus.java @@ -74,4 +74,8 @@ public class DatabaseCommentStatus extends Database implements StorageObject{ this.hasTimestamp = false; this.theTable = "comment_status"; } + + public SimpleList getPopupData() throws StorageObjectException { + return getPopupData("name", false); + } } \ No newline at end of file diff --git a/source/mircoders/storage/DatabaseLanguage.java b/source/mircoders/storage/DatabaseLanguage.java index 5f3f1cd5..fc7131e3 100755 --- a/source/mircoders/storage/DatabaseLanguage.java +++ b/source/mircoders/storage/DatabaseLanguage.java @@ -1,89 +1,88 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * Mir is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mircoders.storage; - -/** - * Title: DatabaseLanguage - * Description: - * Copyright: Copyright (c) 2001 - * Company: Indymedia - * @author - * @version 1.0 - */ - -import java.lang.*; -import java.sql.*; -import java.io.*; -import java.util.*; - -import freemarker.template.*; - -import mir.storage.*; -import mir.entity.*; -import mir.misc.*; - - -public class DatabaseLanguage extends Database implements StorageObject{ - - private static DatabaseLanguage instance; - private static SimpleList languagePopupData; - - // the following *has* to be sychronized cause this static method - // could get preemted and we could end up with 2 instances of DatabaseFoo.. - // see the "Singletons with needles and thread" article at JavaWorld -mh - public synchronized static DatabaseLanguage getInstance() - throws StorageObjectException - { - if (instance == null) { - instance = new DatabaseLanguage(); - instance.myselfDatabase = instance; - } - return instance; - } - - private DatabaseLanguage() throws StorageObjectException - { - super(); - this.hasTimestamp = false; - this.theTable="language"; - } - - public SimpleList getPopupData() throws StorageObjectException { - SimpleList pData = null; - try { - pData = getPopupData("name",false); - } catch (StorageObjectException e) {System.err.println("FF");} - return pData; - } - - -} +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with the com.oreilly.servlet library, any library + * licensed under the Apache Software License, The Sun (tm) Java Advanced + * Imaging library (JAI), The Sun JIMI library (or with modified versions of + * the above that use the same license as the above), and distribute linked + * combinations including the two. You must obey the GNU General Public + * License in all respects for all of the code used other than the above + * mentioned libraries. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If you do + * not wish to do so, delete this exception statement from your version. + */ + +package mircoders.storage; + +/** + * Title: DatabaseLanguage + * Description: + * Copyright: Copyright (c) 2001 + * Company: Indymedia + * @author + * @version 1.0 + */ + +import java.lang.*; +import java.sql.*; +import java.io.*; +import java.util.*; + +import freemarker.template.*; + +import mir.storage.*; +import mir.entity.*; +import mir.misc.*; + + +public class DatabaseLanguage extends Database implements StorageObject{ + + private static DatabaseLanguage instance; + private static SimpleList languagePopupData; + + // the following *has* to be sychronized cause this static method + // could get preemted and we could end up with 2 instances of DatabaseFoo.. + // see the "Singletons with needles and thread" article at JavaWorld -mh + public synchronized static DatabaseLanguage getInstance() throws + StorageObjectException { + if (instance == null) { + instance = new DatabaseLanguage(); + instance.myselfDatabase = instance; + } + return instance; + } + + private DatabaseLanguage() throws StorageObjectException { + super(); + this.hasTimestamp = false; + this.theTable = "language"; + } + + public SimpleList getPopupData() throws StorageObjectException { + SimpleList pData = null; + try { + pData = getPopupData("name", false); + } + catch (StorageObjectException e) { + System.err.println("FF"); + } + return pData; + } +} diff --git a/templates/admin/comment.template b/templates/admin/comment.template index f74653d6..b375c85c 100755 --- a/templates/admin/comment.template +++ b/templates/admin/comment.template @@ -4,81 +4,134 @@ - + - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- ${lang("comment.date")}:${utility.encodeHTML(utility.encodeHTML(data.webdb_create))}
- ${lang("comment.title")}:
- ${lang("comment.creator")}:
- ${lang("comment.url")}:
- ${lang("comment.email")}:
- ${lang("comment.phone")}:
- ${lang("comment.address")}:
- ${lang("comment.text")}:
- ${lang("comment.published")} checked> - - - - - -
- - - + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ ${lang("comment.date")} + + ${utility.encodeHTML(utility.encodeHTML(data.webdb_create))} +
+ ${lang("comment.status")} + + +
+ ${lang("comment.title")} + + +
+ ${lang("comment.creator")} + + +
+ ${lang("comment.url")} + + +
+ ${lang("comment.email")} + + +
+ ${lang("comment.phone")} + + +
+ ${lang("comment.address")} + + +
+ ${lang("comment.language")} + + +
+ ${lang("comment.text")}
+ ${lang("comment.html")} checked> +
+ +
+ + ${lang("comment.published")} checked> + + + + + + +
+
+ + diff --git a/templates/admin/commentlist.template b/templates/admin/commentlist.template index 3d35d348..151a3817 100755 --- a/templates/admin/commentlist.template +++ b/templates/admin/commentlist.template @@ -93,7 +93,7 @@
- ${entry.title}
+ ${entry.status.name} - ${entry.title}
${lang("comment.creator")}: ${entry.creator}
${entry.description} diff --git a/templates/admin/content.template b/templates/admin/content.template index 741f068a..bf3403c1 100755 --- a/templates/admin/content.template +++ b/templates/admin/content.template @@ -20,7 +20,11 @@ - +
 ${lang("content.comments")} + + ${lang("content.comments")} + + ${lang("content.published")} : checked> diff --git a/templates/admin/contentlist.template b/templates/admin/contentlist.template index 9141311a..86e79221 100755 --- a/templates/admin/contentlist.template +++ b/templates/admin/contentlist.template @@ -46,10 +46,6 @@ [${op}] - -  | newswire - - class="list3"class="list4" valign="top">