]> err.no Git - sope/commitdiff
prepared blog view page
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Mon, 22 Aug 2005 15:17:53 +0000 (15:17 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Mon, 22 Aug 2005 15:17:53 +0000 (15:17 +0000)
git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1060 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

sope-appserver/samples/CoreDataBlog/GNUmakefile
sope-appserver/samples/CoreDataBlog/GNUmakefile.preamble
sope-appserver/samples/CoreDataBlog/MonthPage.m [new file with mode: 0644]
sope-appserver/samples/CoreDataBlog/MonthPage.wo/MonthPage.html [new file with mode: 0644]
sope-appserver/samples/CoreDataBlog/MonthPage.wo/MonthPage.wod [new file with mode: 0644]
sope-appserver/samples/CoreDataBlog/MonthPage.wo/MonthPage.woo [new file with mode: 0644]

index 117f54958d1b8b4082e464b39db42d1098b0f316..a1bc32ce93a2a51fb3ce83ac0625b99a8f1e59de 100644 (file)
@@ -9,11 +9,13 @@ CoreDataBlog_OBJC_FILES += \
        WOCoreDataApplication.m         \
        WOSession+CoreData.m            \
        \
-       CoreDataBlog.m          \
-       Session.m               \
-       Main.m
+       CoreDataBlog.m  \
+       Session.m       \
+       Main.m          \
+       \
+       MonthPage.m
 
-CoreDataBlog_COMPONENTS += Main.wo
+CoreDataBlog_COMPONENTS += Main.wo MonthPage.wo
 
 CoreDataBlog_COREDATA_MODELS += \
        BlogDemo_DataModel.xcdatamodel
index 2aee8626353c82b3947c61295e6401e6bd4b9ced..73536746b1389e4e1e43ae0741841ab41e6e868f 100644 (file)
@@ -24,10 +24,12 @@ ADDITIONAL_TOOL_LIBS += \
 ifneq ($(frameworks),yes)
 ADDITIONAL_TOOL_LIBS += \
        -lEOCoreData    \
+       -lNGExtensions  \
        -lEOControl     \
        -lDOM -lXmlRpc -lSaxObjC
 else
 ADDITIONAL_TOOL_LIBS += \
+       -framework NGExtensions \
        -framework EOCoreData   \
        -framework EOControl    \
        -framework XmlRpc -framework DOM -framework SaxObjC
@@ -39,6 +41,7 @@ endif
 DEP_DIRS = \
        $(SOPE_ROOT)/sope-appserver/NGObjWeb    \
        $(SOPE_ROOT)/sope-mime                  \
+       $(SOPE_ROOT)/sope-mime/NGMail           \
        $(SOPE_ROOT)/sope-core/EOCoreData       \
        $(SOPE_ROOT)/sope-core/NGStreams        \
        $(SOPE_ROOT)/sope-core/NGExtensions     \
diff --git a/sope-appserver/samples/CoreDataBlog/MonthPage.m b/sope-appserver/samples/CoreDataBlog/MonthPage.m
new file mode 100644 (file)
index 0000000..b59ba8c
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+  Copyright (C) 2005 SKYRIX Software AG
+
+  This file is part of SOPE.
+
+  SOPE is free software; you can redistribute it and/or modify it under
+  the terms of the GNU Lesser General Public License as published by the
+  Free Software Foundation; either version 2, or (at your option) any
+  later version.
+
+  SOPE 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 Lesser General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with SOPE; see the file COPYING.  If not, write to the
+  Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+  02111-1307, USA.
+*/
+
+#include <NGObjWeb/WOComponent.h>
+
+@class NSArray;
+
+@interface MonthPage : WOComponent
+{
+}
+
+@end
+
+#include "WOSession+CoreData.h"
+#include <NGExtensions/NSCalendarDate+misc.h>
+#include "common.h"
+
+@implementation MonthPage
+
+- (id)initWithContext:(id)_ctx {
+  if ((self = [super initWithContext:_ctx])) {
+  }
+  return self;
+}
+
+- (void)dealloc {
+  [super dealloc];
+}
+
+/* accessors */
+
+- (NSCalendarDate *)date {
+  return [NSCalendarDate date];
+}
+
+- (NSArray *)calMatrix {
+  return [[self date] calendarMatrixWithStartDayOfWeek:1 /* Monday */
+                     onlyCurrentMonth:NO];
+}
+
+/* actions */
+
+@end /* MonthPage */
diff --git a/sope-appserver/samples/CoreDataBlog/MonthPage.wo/MonthPage.html b/sope-appserver/samples/CoreDataBlog/MonthPage.wo/MonthPage.html
new file mode 100644 (file)
index 0000000..f1fe8e9
--- /dev/null
@@ -0,0 +1,55 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+  <head>
+    <title>SOPE CoreData Test: MonthPage</title>
+
+    <style>
+      table.calendar {
+        border-left:   1px solid #AAAAAA;
+        border-top:    1px solid #AAAAAA;
+        border-right:  1px solid black;
+        border-bottom: 1px solid black;
+      }
+      table.calendar tr td {
+        text-align: right;
+        font-size:  10pt;
+      }
+      table.calendar tr td.calendar-title {
+        text-align:  center;
+        font-weight: bold;
+      }
+      table.calendar tr td.calendar-othermonth {
+        font-style: italic;
+        color:      #888888;
+      }
+    </style>
+  </head>
+
+  <body>
+    <table class="calendar">
+      <tr>
+        <td class="calendar-title" colspan="7"><#MonthName/></td>
+      </tr>
+      <#Weeks>
+        <tr>
+          <#Week>
+            <#IsSameMonth>
+              <td><#Day/></td>
+            </#IsSameMonth>
+            <#IsOtherMonth>
+              <td class="calendar-othermonth"><#Day/></td>
+            </#IsOtherMonth>
+          </#Week>
+        </tr>
+      </#Weeks>
+    </table>
+
+
+    <h3>Posts</h3>
+    <#Posts>
+      <h4><#PostTitle/></h4>
+      <p><#PostBody/></p>
+    </#Posts>
+
+  </body>
+</html>
diff --git a/sope-appserver/samples/CoreDataBlog/MonthPage.wo/MonthPage.wod b/sope-appserver/samples/CoreDataBlog/MonthPage.wo/MonthPage.wod
new file mode 100644 (file)
index 0000000..93d8ca5
--- /dev/null
@@ -0,0 +1,45 @@
+// bind template to controller
+
+Posts: WORepetition {
+  list = postDisplayGroup.displayedObjects;
+  item = post;
+}
+
+PostTitle: WOString {
+  value          = post.title;
+  valueWhenEmpty = "[no title]";
+}
+PostBody: WOString {
+  value          = post.body;
+  valueWhenEmpty = "[no body]";
+}
+
+
+// Calendar
+
+MonthName: WOString {
+  value      = date;
+  dateformat = "%B";
+}
+
+Weeks: WORepetition {
+  list = calMatrix;
+  item = week;
+}
+Week: WORepetition {
+  list = week;
+  item = day;
+}
+Day: WOString {
+  value = day.dayOfMonth;
+}
+
+IsSameMonth: WOConditional {
+  condition = date.monthOfYear;
+  value     = day.monthOfYear;
+}
+IsOtherMonth: WOConditional {
+  condition = date.monthOfYear;
+  value     = day.monthOfYear;
+  negate    = YES;
+}
diff --git a/sope-appserver/samples/CoreDataBlog/MonthPage.wo/MonthPage.woo b/sope-appserver/samples/CoreDataBlog/MonthPage.wo/MonthPage.woo
new file mode 100644 (file)
index 0000000..0bf3f95
--- /dev/null
@@ -0,0 +1,28 @@
+{
+  variables = {
+    postDisplayGroup = {
+      class      = WODisplayGroup;
+      dataSource = {
+        class              = EOCoreDataSource;
+        editingContext     = session.defaultManagedObjectContext;
+        fetchSpecification = {
+          class      = EOFetchSpecification;
+          entityName = Post;
+          fetchLimit = 0;
+          isDeep     = YES;
+          sortOrderings = (
+            { class = EOSortOrdering; 
+              key = "creationDate";
+              selector = "compareDescending:";
+            }
+          );
+        };
+      };
+      formatForLikeQualifier       = "%@*";
+      localKeys                    = ();
+      numberOfObjectsPerBatch      = 0;
+      selectsFirstObjectAfterFetch = YES;
+      fetchesOnLoad                = YES;
+    };
+  };
+}