mediaType editor / accessible via superuser functions
authorrk <rk>
Tue, 2 Dec 2003 19:55:53 +0000 (19:55 +0000)
committerrk <rk>
Tue, 2 Dec 2003 19:55:53 +0000 (19:55 +0000)
source/default.properties
source/mircoders/localizer/basic/MirBasicDataModelLocalizer.java
source/mircoders/servlet/ServletModuleMediaType.java [new file with mode: 0755]
templates/admin/mediatype.template [new file with mode: 0755]
templates/admin/mediatypelist.template [new file with mode: 0755]
templates/admin/superusermenu.template

index 53a7aeb..3600aa9 100755 (executable)
@@ -513,6 +513,10 @@ ServletModule.CommentStatus.DeleteConfirmationTemplate=confirm.template
 ServletModule.CommentStatus.EditTemplate=commentstatus.template
 ServletModule.CommentStatus.ListTemplate=commentstatuslist.template
 
+ServletModule.MediaType.DeleteConfirmationTemplate=confirm.template
+ServletModule.MediaType.EditTemplate=mediatype.template
+ServletModule.MediaType.ListTemplate=mediatypelist.template
+
 
 
 
index b096c67..053a5aa 100755 (executable)
@@ -173,9 +173,12 @@ public class MirBasicDataModelLocalizer implements MirDataModelLocalizer {
       definition = new EntityAdapterDefinition();
       constructCommentAdapterDefinition( definition );
       result.addMapping( "comment", DatabaseComment.getInstance(), definition);
+      result.addMapping( "commentStatus", DatabaseCommentStatus.getInstance(), new EntityAdapterDefinition());
 
       result.addMapping( "articleType", DatabaseArticleType.getInstance(), new EntityAdapterDefinition());
-      result.addMapping( "commentStatus", DatabaseCommentStatus.getInstance(), new EntityAdapterDefinition());
+
+      result.addMapping( "mediaType", DatabaseMediaType.getInstance(), new EntityAdapterDefinition());
+
 
       definition = new EntityAdapterDefinition();
       definition.addDBDateField("creationdate", "webdb_create", configuration.getString("Mir.DefaultTimezone"));
diff --git a/source/mircoders/servlet/ServletModuleMediaType.java b/source/mircoders/servlet/ServletModuleMediaType.java
new file mode 100755 (executable)
index 0000000..eba87e4
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * 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  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.servlet;
+
+import mir.log.LoggerWrapper;
+import mir.servlet.ServletModule;
+import mircoders.global.MirGlobal;
+import mircoders.module.ModuleMediaType;
+import mircoders.storage.DatabaseMediaType;
+
+/**
+ *
+ * <p>Title: </p>
+ * <p>Description: </p>
+ * <p>Copyright: Copyright (c) 2003</p>
+ * <p>Company: </p>
+ * @author not attributable
+ * @version 1.0
+ */
+public class ServletModuleMediaType extends ServletModule
+{
+  private static ServletModuleMediaType instance = new ServletModuleMediaType();
+  public static ServletModule getInstance() { return instance; }
+
+  private ServletModuleMediaType() {
+    logger = new LoggerWrapper("ServletModule.MediaType");
+
+    try {
+      model = MirGlobal.localizer().dataModel().adapterModel();
+      definition = "mediaType";
+      mainModule = new ModuleMediaType(DatabaseMediaType.getInstance());
+    }
+    catch (Exception e) {
+      logger.error("Initialization of ServletModuleArticleType failed!: " + e.getMessage());
+    }
+  }
+}
diff --git a/templates/admin/mediatype.template b/templates/admin/mediatype.template
new file mode 100755 (executable)
index 0000000..839b119
--- /dev/null
@@ -0,0 +1,42 @@
+<html>
+  <head>
+    <title>${config["Mir.Name"]} | ${lang("mediatype.htmltitle")}</title>
+    <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
+<head>
+<body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
+    <include "FUNCTIONS.template">
+    <include "head.template">
+  
+      <if new=="1">
+        <assign method="insert">
+      <else>
+        <assign method="update">
+      </if>
+      
+      <call EditStart(
+         ["module", "id", "do"],
+         [module, entity.id, method])>
+         
+        <call EditReadonlyTextNormal(lang("mediatype.id"), entity.id)>
+        <call EditTextNormal(lang("mediatype.name"), 40, 255, "name", entity.name)>
+       <call EditTextNormal(lang("mediatype.mimetype"), 40, 255, "mime_type", entity.mime_type)>
+       <call EditTextNormal(lang("mediatype.classname"), 40, 255, "classname", entity.classname)>
+       <call EditTextNormal(lang("mediatype.tablename"), 40, 255, "tablename", entity.tablename)>
+      
+        <if new=="1">
+          <call EditSubmitButtonNormal(lang("insert"), "save")>
+        <else>
+          <call EditSubmitButtonNormal(lang("save"), "save")>
+        </if> 
+
+      <call EditEnd()>
+      
+      <if returnurl>
+        <call showBack(returnurl)>
+      <else>
+        <call showBack("module="+module+"&amp;do=list")>
+      </if>
+
+    <include "foot.template">
+</body>
+</html>
diff --git a/templates/admin/mediatypelist.template b/templates/admin/mediatypelist.template
new file mode 100755 (executable)
index 0000000..ba64742
--- /dev/null
@@ -0,0 +1,26 @@
+<html>
+  <head>
+    <title>${config["Mir.Name"]} | ${lang("mediatypelist.htmltitle")}</title>
+    <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
+  </head>
+  <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
+    
+    <include "FUNCTIONS.template">
+    <include "head.template">
+    
+    <call showAddOrBack("1", module, "Admin", "superusermenu")>
+
+    <if entities>
+      <call showPrevNextLinks(prevurl, nexturl, "left")>
+      <call EntityTable(entities, ["id","name"], [lang("mediatype.id"), lang("mediatype.name")], from, to, count, "1", "1", module)>
+      <call showPrevNextLinks(prevurl, nexturl, "left")>
+      <call showAddOrBack("1", module, "Admin", "superusermenu")>
+    <else>
+      <P align="center">${lang("no_matches_found")}</p>
+    </if>
+
+    <include "foot.template">
+  </body>
+</html>
+
+
index 2e627f1..36d0305 100755 (executable)
@@ -16,6 +16,7 @@
     <p class="box">
     &gt; <a href="${config.actionRoot}?module=Topics&do=list">${lang("superusermenu.topics")}</a><br>
     &gt; <a href="${config.actionRoot}?module=ArticleType&do=list">${lang("superusermenu.articletypes")}</a><br>
+    &gt; <a href="${config.actionRoot}?module=MediaType&do=list">${lang("superusermenu.mediatypes")}</a><br>
     &gt; <a href="${config.actionRoot}?module=CommentStatus&do=list">${lang("superusermenu.comment_statuses")}</a><br>
     &gt; <a href="${config.actionRoot}?module=Users&do=list">${lang("superusermenu.users")}</a><br>
     &gt; <a href="${config.actionRoot}?module=Language&do=list">${lang("superusermenu.languages")}</a><br>