[OGo-Developer] print view for task lists
Helge Hess
developer@opengroupware.org
Tue, 14 Nov 2006 10:57:36 +0100
Hi,
LSWJobs is a 'singleton' component. Only one is created per session
(its a top-level component, not a reusable one). In fact I think that
its quite possible that you either get a LSWPrintJobs or a LSWJobs
instance, depending on the load order. W/o having looked at your code
in detail.
Proper thing to do would be to create a superclass instead of a
subclass to share the code.
Greets,
Helge
On Nov 13, 2006, at 12:05, Sebastian Reitenbach wrote:
> Hi all,
>
> I added a printview to task lists, which works well for
> LSWProjectJobList, but
> not for LSWJobs. When I enter the printMode (a BOOL defined in
> LSWJobs) by
> first clicking the print button, it stays forever in print mode. So
> when I
> then click hte "Tasks" menu entry, in the Dock, it enters LSWJobs,
> but will
> open it in printMode.
> I created an enhancement report for it, with my patch:
> http://bugzilla.opengroupware.org/bugzilla/show_bug.cgi?id=1807
>
> yesterday afternoon I sat there for hours, trying to figure out,
> how to get
> the normal mode back.
>
> below are my notes, that I have made, after I created the patch.
>
> any hint on how I can I stop LSWJobs from thinking it has printMode
> = YES?
>
> kind regards
> Sebastian
>
> Preparations in Objective-C backend
> - LSWJobs.m needs to be divided into a .m and .h file, interface in
> the .h
> file, and including the .h file in the .m file
> - the LSWJobs.h file needs to declare a BOOL for printMode, and the
> LSWJobs.m
> file has to implement the print methods:
> ======================================================
> /* printing */
>
> - (BOOL)printMode {
> return self->printMode ? YES : NO;
> }
> - (void)setPrintMode:(BOOL)_printMode {
> self->printMode = _printMode;
> }
>
> - (id)printList {
> WOResponse *r;
> OGoComponent *page;
>
> page = [self pageWithName:@"LSWPrintJobs"];
> [page takeValue:self->filteredJobList
> forKey:@"filteredJobList"];
> [page takeValue:self->job forKey:@"job"];
> [page takeValue:self->subJob forKey:@"subJob"];
> [page takeValue:self->selectedAttribute
> forKey:@"selectedAttribute"];
> [page takeValue:self->tabKey forKey:@"tabKey"];
> [page takeValue:self->keywordsString forKey:@"keywordsString"];
> [page takeValue:self->timeSelection forKey:@"timeSelection"];
> [page takeValue:self->item forKey:@"item"];
> [page takeValue:self->teams forKey:@"teams"];
> [page takeValue:self->timeList forKey:@"timeList"];
> [page takeValue:self->selectedTeam forKey:@"selectedTeam"];
> r = [page generateResponse];
> [r setHeader:@"text/html" forKey:@"content-type"];
>
> return r;
> }
> ======================================================
> - LSWPrintJobs.m class needs to be created, inheriting from
> LSWJobs.h, not
> adding anything to LSWJobs, including
> ======================================================
> #include "LSWJobs.h"
>
> @interface LSWPrintJobs : LSWJobs
> {
> }
> @end
>
> #include <NGMime/NGMimeType.h>
> #include "common.h"
> @implementation LSWPrintJobs
> @end /* LSWPrintJobs */
> ======================================================
> - add the LSWPrintJobs.m file in the GNUmakefile to the files to be
> compiled
> - add the LSWPrintJobs class to the bundle-info.plist file, and add
> the print
> view there
> ======================================================
> {
> verb = print;
> type = "eo/job";
> component = LSWPrintJobs
> },
> ======================================================
> - add a LSWPrintJobs.wox file in the Templates/JobUi directory:
> ======================================================
> <?xml version='1.0' encoding="iso-8859-1" standalone="yes" ?>
> <OGo:container
> xmlns="http://www.w3.org/1999/xhtml"
> xmlns:var="http://www.skyrix.com/od/binding"
> xmlns:const="http://www.skyrix.com/od/constant"
> xmlns:OGo="http://www.opengroupware.org/ns/wox/ogo"
>>
> <!-- TODO: can we use <OGo:page-head> ? => different color/clash
> with tv -->
> <html>
> <head></head>
> <body bgcolor="white" text="black" onload="javascript:window.print
> ()">
> <var:component className="LSWJobs"
> labels="labels"
> filteredJobList="filteredJobList"
> job="job"
> subJob="subJob"
> selectedAttribute="selectedAttribute"
> tabKey="tabKey"
> keywordsString="keywordsString"
> timeSelection="timeSelection"
> item="item"
> teams="teams"
> timeList="timeList"
> selectedTeam="selectedTeam"
> const:printMode="1" />
> </body>
> </html>
> </OGo:container>
> ======================================================
> - the LSWJobs.wod template connector has to be changed:
> ======================================================
> Buttons: SkyButtonRow {
> ordering = ( print, new );
> onNew = newJob;
> new = labels.new;
> tipNew = labels.new;
>
> onPrint = printList;
> print = labels.print;
> targetPrint = "OGoPrintView";
>
> }
> IsPrintMode: WOConditional {
> condition = printMode;
> negate = NO;
> }
> IsNotPrintMode: WOConditional {
> condition = printMode;
> negate = YES;
> }
> ====================================================
> - the LSWJobs.html template has to be changed to allow printMode:
> <#IsNotPrintMode>
> ... old version ...
> </#IsNotPrintMode>
> <#IsPrintMode>
> <table width="100%" border="0" cellpadding="0" cellspacing="0">
> <tr>
> <td>
> <#TabView>
> <#TodoTab>
> <#ToDoList></#ToDoList>
> </#TodoTab>
>
> <#DelegateTab>
> <#DelegatedJobList></#DelegatedJobList>
> </#DelegateTab>
>
> <#ArchivedTab>
> <#ArchivedJobList/>
> </#ArchivedTab>
>
> <#IsPreferredExecutantEnabled>
> <#PreferredExecutantTab>
> <#PreferredExecutantList></#PreferredExecutantList>
> </#PreferredExecutantTab>
> </#IsPreferredExecutantEnabled>
> </#TabView>
> </td>
> </tr>
> </table>
> </#IsPrintMode>
> ======================================================
>
>
> --
> OpenGroupware.org Developer
> developer@opengroupware.org
> http://mail.opengroupware.org/mailman/listinfo/developer
--
Helge Hess
http://docs.opengroupware.org/Members/helge/