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
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
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 \
--- /dev/null
+/*
+ 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 */
--- /dev/null
+<!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>
--- /dev/null
+// 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;
+}
--- /dev/null
+{
+ 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;
+ };
+ };
+}