Commits

Christian Fischer committed e7c3a71

Kalender v0.3

Comments (0)

Files changed (14)

calendar/config/eventclasses.xml

+<?xml version="1.0"?>
+<!DOCTYPE import SYSTEM "DTD/import.dtd">
+<data>	
+	<import>
+		<eventclass class="SimpleEvent" name="net.northshirebund.wbb.calendar.class.SimpleEvent"/>
+		<eventclass class="SignupEvent" name="net.northshirebund.wbb.calendar.class.SignupEvent"/>
+	</import>
+</data>

calendar/config/eventtypes.xml

-<?xml version="1.0"?>
-<!DOCTYPE import SYSTEM "DTD/import.dtd">
-<data>	
-	<import>
-		<eventtype class="SimpleEvent" name="net.northshirebund.wbb.calendar.class.SimpleEvent"/>
-		<eventtype class="SignupEvent" name="net.northshirebund.wbb.calendar.class.SignupEvent"/>
-	</import>
-</data>

calendar/config/install.sql

 
 CREATE TABLE `wcf1_calendar_event` (
   `eventID` int(10) unsigned NOT NULL auto_increment,
-  `eventType` varchar(32) NOT NULL,
+  `eventClass` varchar(32) NOT NULL,
   `userID` int(10) unsigned NOT NULL,
   `postID` int(10) unsigned NOT NULL,
   `eventTime` int(10) unsigned NOT NULL,
   `duration` varchar(255) NOT NULL,
+  `comments` mediumint(5) NOT NULL default '0',
   `signupEnabled` tinyint(1) unsigned NOT NULL default '0',
   `signupCount` mediumint(5) unsigned NOT NULL default '0',
   `signupMax` mediumint(5) unsigned NOT NULL default '0',
 -- 
 
 CREATE TABLE `wcf1_calendar_event_signup` (
-  `eventID` int(10) NOT NULL,
-  `userID` int(10) NOT NULL,
+  `eventID` int(10) unsigned NOT NULL,
+  `userID` int(10) unsigned NOT NULL,
   `signupTime` int(10) NOT NULL,
   `signupUpdateTime` int(10) NOT NULL,
   `signupMessage` text NOT NULL,
 -- --------------------------------------------------------
 
 -- 
--- Tabellenstruktur für Tabelle `wcf1_calendar_event_type`
+-- Tabellenstruktur für Tabelle `wcf1_calendar_event_class`
 -- 
 
-CREATE TABLE `wcf1_calendar_event_type` (
-  `typeID` int(10) NOT NULL auto_increment,
-  `packageID` int(10) NOT NULL,
-  `eventType` varchar(255) collate latin1_german1_ci NOT NULL,
-  `eventTypeName` varchar(255) collate latin1_german1_ci NOT NULL,
-  PRIMARY KEY  (`typeID`),
-  UNIQUE KEY `eventType` (`eventType`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+CREATE TABLE `wcf1_calendar_event_class` (
+  `eventClassID` int(10) unsigned NOT NULL auto_increment,
+  `packageID` int(10) unsigned NOT NULL,
+  `eventClass` varchar(255) NOT NULL,
+  `eventClassName` varchar(255) NOT NULL,
+  PRIMARY KEY  (`eventClassID`),
+  UNIQUE KEY `eventType` (`eventClass`)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

calendar/dist/net.northshirebund.wbb.calendar-0.3.tar

Binary file added.

calendar/dist/net.northshirebund.wbb.calendar-0.3.tar.gz

Binary file added.

calendar/dist/net.northshirebund.wbb.calendar-0.3.zip

Binary file added.

calendar/files/lib/data/calendar/events/AbstractEvent.class.php

 	public function getTabContent($key) {
 		switch($key) {
 			case 'comments': {
-				WCF::getTPL()->assign('comments', $this->getComments());
+				$pageNo  = (isset($_REQUEST['pageNo']) ? intval($_REQUEST['pageNo']) : 1);
+				$perPage = 25;
+				$items   = $this->comments;
+				$pages   = $items / $perPage;
+				
+				WCF::getTPL()->assign(array(
+						'comments'		=> $this->getComments($perPage, ($pageNo - 1) * $perPage),
+						'pageNo'		=> $pageNo,
+						'pages'			=> $pages,
+						'items'			=> $items,
+						'itemsPerPage'	=> $perPage,
+				));
+				
 				break;
 			}
 			
 	/**
 	 * get a list of all comments for this event.
 	 */
-	public function getComments() {
+	public function getComments($limit=10000, $offset=0, $order='ASC') {
+		if ($order != 'DESC') {
+			$offset++;
+		}
+		
 		$comments = array();
 		$result = WCF::getDB()->sendQuery('
 						SELECT	*, u.userID AS userID
 						FROM	wcf'.WCF_N.'_calendar_event_message em
 						JOIN	wcf'.WCF_N.'_user u USING(userID)
 						WHERE	em.eventID = '.$this->id.'
-						ORDER	BY time ASC
-						LIMIT	10000
-						OFFSET	1'
+						ORDER	BY time '.$order.'
+						LIMIT	'.$limit.'
+						OFFSET	'.$offset
 		);
 		
 		while($row = WCF::getDB()->fetchArray($result)) {

calendar/files/lib/data/calendar/events/SignupEvent.class.php

 			array(
 				array(
 						'key'		=> 'signuplist',
-						'caption'	=> WCF::getLanguage()->get('net.northshirebund.wbb.calendar.event.signup.signupList.title').' ('.$this->data['signupCount'].')',
+						'caption'	=> WCF::getLanguage()->get('net.northshirebund.wbb.calendar.event.signup.signupList.title').' ('.$this->data['signupCount'].'/'.$this->data['signupMax'].')',
 						'icon'		=> RELATIVE_WCF_DIR.'icon/calendarM.png'
 				),
 			),

calendar/files/lib/form/CalendarAddCommentForm.class.php

 	// request parameters
 	public $event = null;
 	public $comment = null;
+	public $lastComments = null;
 	
 	
 	/**
 		
 		if(isset($_REQUEST['eventID'])) {
 			$this->event = CalendarUtil::getEventById(intval($_REQUEST['eventID']));
+			$this->lastComments = $this->event->getComments(10, 0, 'DESC');
 		}
 		else {
 			require_once(WCF_DIR.'lib/system/exception/IllegalLinkException.class.php');
 	public function assignVariables() {
 		parent::assignVariables();
 		WCF::getTPL()->assign('event', $this->event);
+		WCF::getTPL()->assign('lastComments', $this->lastComments);
 		
 		return;
 	}

calendar/files/lib/page/CalendarViewEventPage.class.php

 	/**
 	 * Name of the template for the called page.
 	 */
-	public $templateName = 'calendarViewEvent';
+	public $templateName	= 'calendarViewEvent';
 	public $activeTab;
 	
 	public $event;
 						'event'			=> $this->event,
 						'tabs'			=> $this->event->getTabs(),
 						'activeTab'		=> $this->activeTab,
-						'tabContent'	=> $this->event->getTabContent($this->activeTab)
+						'tabContent'	=> $this->event->getTabContent($this->activeTab),
 		));
 		
 		return;

calendar/package.xml

     </requiredPackages>
     
     <optionalPackages>
-    	<optionalPackage build="shoutbox/wbb3modsportalbox"/>
+    	<optionalPackage build="calendar/wbb3modsportalbox"/>
     </optionalPackages>
     
     <addfiles>
 		<file name="config/groupoptions.xml"									/>
 		<file name="config/headermenu.xml"										/>
 		<file name="config/pagelocation.xml"									/>
-		<file name="config/eventtypes.xml"										/>
+		<file name="config/eventclasses.xml"									/>
     </addfiles>
     
 	<instructions type="install">

calendar/pip/CalendarEventPackageInstallationPlugin.class.php

  * @package	net.northshirebund.wbb.calendar
  */
 class CalendarEventPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin {
-	public $tagName = 'eventtypes';
-	public $tableName = 'calendar_event_type';
+	public $tagName = 'eventclasses';
+	public $tableName = 'calendar_event_class';
 	
 	/**
 	 * @see PackageInstallationPlugin::install()
 						// Insert or update items. 
 						// Update through the mysql "ON DUPLICATE KEY"-syntax. 
 						WCF::getDB()->sendQuery("
-							INSERT INTO		wcf".WCF_N."_calendar_event_type(
-											typeID,
+							INSERT INTO		wcf".WCF_N."_calendar_event_class(
+											eventClassID,
 											packageID,
 											eventClass,
 											eventClassName
 						// Delete items.
 						if (!empty($itemNames)) {
 							WCF::getDB()->sendQuery("
-									DELETE FROM	wcf".WCF_N."_calendar_event_type
+									DELETE FROM	wcf".WCF_N."_calendar_event_class
 									WHERE		packageID = ".$this->installation->getPackageID()."
 									AND			eventClass IN (".$itemNames.")"
 							);

calendar/templates/calendarAddComment.tpl

 		</div>
 	{/if}
 	
+	<a id="top"/>
 	<form enctype="multipart/form-data" method="post" action="index.php?form=CalendarAddComment&eventID={@$event->id}">
 		<div class="border content">
 			<div class="container-1">
 		{@SID_INPUT_TAG}
 	</form>
 	
+	{foreach item=comment from=$lastComments}
+		<div class="message content">
+			<div class="messageInner container-{cycle values='1,2'}">
+				<div class="messageHeader">
+					<div class="containerIcon">
+						<img src="{@RELATIVE_WCF_DIR}icon/calendarM.png" alt="" />
+					</div>
+					<div class="containerContent">
+						<p class="light smallFont">{@$comment->time|shorttime}</p>
+						<p class="light smallFont"><a href="index.php?page=User&amp;userID={@$comment->userID}{@SID_ARG_2ND}">{$comment->username}</a></p>
+					</div>
+				</div>
+				{if $comment->subject}
+					<h3>{$comment->subject}</h3>
+				{/if}
+				<div class="messageBody">
+					{@$comment->getFormattedMessage()}
+				</div>
+				<div class="messageFooter">
+					<div class="smallButtons">
+						<ul>
+							<li class="extraButton">
+								<a href="#top">
+									<img src="{@RELATIVE_WCF_DIR}icon/upS.png" alt="" title="{lang}wcf.global.scrollUp{/lang}"/>
+									<span class="hidden"> {lang}wcf.global.scrollUp{/lang}</span>
+								</a>
+							</li>
+						</ul>
+					</div>
+				</div>
+				<hr/>
+			</div>
+		</div>
+	{/foreach}
+	
 </div>
 
 {include file='footer' sandbox=false}

calendar/templates/calendarViewEvent.tpl

 <head>
 	<title>{lang}net.northshirebund.wbb.calendar.title{/lang} - {PAGE_TITLE}</title>
 	{include file="headInclude"}
+	<script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/MultiPagesLinks.class.js"></script>
 </head>
 <body>
 {include file="header" sandbox=false}
 	{if $activeTab == 'comments'}
 		<div class="border tabMenuContent">
 			{if $comments|count > 0}
-				<table class="tableList">
-					{cycle name=postCycle values="2,1" print=false}
-					{cycle name=messageCycle values="2,1" print=false}
-					{foreach item=comment from=$comments}
-						<div class="message">
-							<div class="messageInner messageLeft container-{cycle name=postCycle}">
-								<div class="messageSidebar">
-									<div class="messageAuthor">
-										<p class="userName"><a href="index.php?page=User&amp;userID={@$comment->userID}">{$comment->username}</a></p><br/>
-										{@$comment->time|shorttime}
+				{cycle name=postCycle values="2,1" print=false}
+				{cycle name=messageCycle values="2,1" print=false}
+				{foreach item=comment from=$comments}
+					<div class="message">
+						<div class="messageInner messageLeft container-{cycle name=postCycle}">
+							<div class="messageSidebar">
+								<div class="messageAuthor">
+									<p class="userName"><a href="index.php?page=User&amp;userID={@$comment->userID}">{$comment->username}</a></p><br/>
+									{@$comment->time|shorttime}
+								</div>
+							</div>
+							<div class="messageContent">
+								<div class="messageContentInner color-{cycle name=messageCycle}">
+									<h3><span>{$comment->subject}</span></h3>
+									
+									<div class="messageBody">
+										{@$comment->getFormattedMessage()}
 									</div>
-								</div>
-								<div class="messageContent">
-									<div class="messageContentInner color-{cycle name=messageCycle}">
-										<h3><span>{$comment->subject}</span></h3>
-										
-										<div class="messageBody">
-											{@$comment->getFormattedMessage()}
-										</div>
-										
-										{if $comment->editCount > 0}
-											{assign var=message value=$comment}
-											<p class="editNote smallFont light">{lang}net.northshirebund.wbb.calendar.event.editNote{/lang}</p>
-										{/if}
-										
-										<div class="messageFooterRight">
-											<div class="smallButtons">
+									
+									{if $comment->editCount > 0}
+										{assign var=message value=$comment}
+										<p class="editNote smallFont light">{lang}net.northshirebund.wbb.calendar.event.editNote{/lang}</p>
+									{/if}
+									
+									<div class="messageFooterRight">
+										<div class="smallButtons">
+											<ul>
+												<li class="extraButton">
+													<a href="#top">
+														<img title="{lang}wcf.global.scrollUp{/lang}" alt="" src="{@RELATIVE_WCF_DIR}icon/upS.png"/>
+														<span class="hidden"> {lang}wcf.global.scrollUp{/lang}</span>
+													</a>
+												</li>	
 												{if $this->getUser()->userID == $comment->userID || $this->getUser()->getPermission('mod.calendar.canEditComments')}
-													<ul>
-														<li>
-															<a href="index.php?form=CalendarEditComment&amp;postID={$comment->postID}{SID_ARG_2ND}">
-																<img src="{RELATIVE_WCF_DIR}icon/editS.png" alt=""/>
-																<span>{lang}net.northshirebund.wbb.calendar.event.edit{/lang}</span>
-															</a>
-														</li>
-													</ul>
+												<li>
+													<a href="index.php?form=CalendarEditComment&amp;postID={$comment->postID}{SID_ARG_2ND}">
+														<img src="{@RELATIVE_WCF_DIR}icon/editS.png" alt=""/>
+														<span>{lang}net.northshirebund.wbb.calendar.event.edit{/lang}</span>
+													</a>
+												</li>
 												{/if}
-											</div>
+											</ul>
 										</div>
 									</div>
 								</div>
 							</div>
 						</div>
-					{/foreach}
-				</table>
+					</div>
+				{/foreach}
 			{else}
 				{lang}net.northshirebund.wbb.calendar.event.comments.none{/lang}
 			{/if}
 		</div>
-		{if $this->getUser()->getPermission('user.calendar.canAddComments') == 1}
-			<div class="contentFooter">
-				<div class="largeButtons">
-					<ul>
-						<li><a href="index.php?form=CalendarAddComment&amp;eventID={@$event->id}{@SID_ARG_2ND}" id="replyButton"><img alt="" src="icon/threadReplyM.png"/> <span>{lang}net.northshirebund.wbb.calendar.event.comments.add{/lang}</span></a></li>
-					</ul>
-				</div>	
-			</div>
-		{/if}
+		<div class="contentFooter">
+			{assign var=eventID value=$event->id}
+			{assign var=multiplePagesLink value="index.php?page=CalendarViewEvent&eventID=$eventID&tab=$activeTab&pageNo=%d"}
+			{pages print=true assign=pagesOutput link=$multiplePagesLink|concat:SID_ARG_2ND_NOT_ENCODED}
+			
+			{if $this->getUser()->getPermission('user.calendar.canAddComments') == 1}
+			<div class="largeButtons">
+				<ul>
+					<li><a href="index.php?form=CalendarAddComment&amp;eventID={@$event->id}{@SID_ARG_2ND}" id="replyButton"><img alt="" src="icon/threadReplyM.png"/> <span>{lang}net.northshirebund.wbb.calendar.event.comments.add{/lang}</span></a></li>
+				</ul>
+			</div>	
+			{/if}
+		</div>
 	{elseif $activeTab == 'signuplist'}
 		<div class="border tabMenuContent">
 			<table class="tableList">