Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 122df994 authored by AVINASH GUSAIN's avatar AVINASH GUSAIN
Browse files

added new messages and guest

parent ceafde46
Loading
Loading
Loading
Loading
Loading
+107 −12
Original line number Diff line number Diff line
@@ -30,10 +30,8 @@
-		$template->addBodyText($html, $text);
 	}

 	/**

--- ./apps/dav/lib/CalDAV/Schedule/IMipPlugin.php	2022-07-07 09:56:28.335627600 +0530
+++ ./apps/dav/lib/CalDAV/Schedule/IMipPlugin-new.php	2022-07-07 09:45:48.035627600 +0530
--- ./apps/dav/lib/CalDAV/Schedule/IMipPlugin.php	2022-07-27 13:21:50.294113800 +0530
+++ ./apps/dav/lib/CalDAV/Schedule/IMipPlugin-newModified.php	2022-07-27 12:56:55.734113800 +0530
@@ -151,15 +151,6 @@
 	 */
 	public function schedule(Message $iTipMessage) {
@@ -50,7 +48,34 @@
 		$summary = $iTipMessage->message->VEVENT->SUMMARY;

 		if (parse_url($iTipMessage->sender, PHP_URL_SCHEME) !== 'mailto') {
@@ -414,7 +405,7 @@
@@ -252,9 +243,25 @@

 		$summary = ((string) $summary !== '') ? (string) $summary : $l10n->t('Untitled event');

-		$this->addSubjectAndHeading($template, $l10n, $method, $summary);
+		if( count($vevent)>1){
+			$this->addSubjectAndHeadingUpdated($template, $l10n, $method, $summary);
+
+		}else{
+			$this->addSubjectAndHeading($template, $l10n, $method, $summary);
+		}
+		if ($method === self::METHOD_CANCEL) {
+			$template->addHeadingBanner('#FFC2B9','#7D1000',$l10n->t('The invitation has been cancelled'));
+		}
+		if ($method !== self::METHOD_CANCEL && $method !== self::METHOD_REPLY && count($vevent)>1) {
+			$template->addHeadingBanner('#EFFFDB','#293618',$l10n->t('This recurring event has been updated, please review the information below:'));
+		}
+		$sequence = $vevent->SEQUENCE->getValue();
+		if ($method !== self::METHOD_CANCEL && $method !== self::METHOD_REPLY && count($vevent)==1 && ($sequence > 2)) {
+			$template->addHeadingBanner('#EFFFDB','#293618',$l10n->t('This event has been updated, please review the information below:'));
+		}
 		$this->addBulletList($template, $l10n, $vevent);

+
 		// Only add response buttons to invitation requests: Fix Issue #11230
 		if (($method == self::METHOD_REQUEST) && $this->getAttendeeRsvpOrReqForParticipant($attendee)) {

@@ -414,7 +421,7 @@
 		return false;
 	}

@@ -59,7 +84,33 @@
 	 * @param IL10N $l10n
 	 * @param VEvent $vevent
 	 */
@@ -542,21 +533,57 @@
@@ -535,28 +542,85 @@
 			$template->addHeading($l10n->t('Invitation'));
 		}
 	}
-
+	/**
+	 * @param IEMailTemplate $template
+	 * @param IL10N $l10n
+	 * @param string $method
+	 * @param string $summary
+	 */
+	private function addSubjectAndHeadingUpdated(IEMailTemplate $template, IL10N $l10n,
+										  $method, $summary) {
+		if ($method === self::METHOD_CANCEL) {
+			$template->setSubject('Canceled: ' . $summary);
+			$template->addHeading($l10n->t('Invitation canceled'));
+		} elseif ($method === self::METHOD_REPLY) {
+			$template->setSubject('Re: ' . $summary);
+			$template->addHeading($l10n->t('Invitation updated'));
+		} else {
+			$template->setSubject('Invitation: ' . $summary);
+			$template->addHeading($l10n->t('Invitation Update'));
+		}
+	}
 	/**
 	 * @param IEMailTemplate $template
 	 * @param IL10N $l10n
 	 * @param VEVENT $vevent
 	 */
 	private function addBulletList(IEMailTemplate $template, IL10N $l10n, $vevent) {
@@ -75,7 +126,9 @@
+				$lastmodified=$dtstampTime;
+				$selectedEvent = $currentevent;
+			}
+		}
 		}
-		$meetingWhen = $this->generateWhenString($l10n, $vevent);
+
+
+		if ($selectedEvent->SUMMARY) {
+
@@ -86,8 +139,7 @@
+				$template->addBodyListItemModified($selectedEvent->SUMMARY, $l10n->t('Updated Title:'),
+					$this->getAbsoluteImagePath('caldav/title.png'),'','',self::IMIP_INDENT);
+			}
 		}
-		$meetingWhen = $this->generateWhenString($l10n, $vevent);
+		}
+		$meetingWhen = $this->generateWhenString($l10n, $selectedEvent);
 		if ($meetingWhen) {
-			$template->addBodyListItem($meetingWhen, $l10n->t('Time:'),
@@ -110,7 +162,9 @@
-		if ($vevent->LOCATION) {
-			$template->addBodyListItem($vevent->LOCATION, $l10n->t('Location:'),
-				$this->getAbsoluteImagePath('caldav/location.png'),'','',self::IMIP_INDENT);
+
+		if ($selectedEvent->LOCATION) {
+
+			if(trim($selectedEvent->LOCATION)==trim($parentevent->LOCATION)){
+				$template->addBodyListItem($selectedEvent->LOCATION, $l10n->t('Location:'),
+					$this->getAbsoluteImagePath('caldav/location.png'),'','',self::IMIP_INDENT);
@@ -128,7 +182,7 @@
 			$template->addBodyListItem(sprintf('<a href="%s">%s</a>',
 					htmlspecialchars($url),
 					htmlspecialchars($url)),
@@ -565,12 +592,18 @@
@@ -565,12 +629,28 @@
 				$url,'',self::IMIP_INDENT);
 		}

@@ -148,10 +202,51 @@
+					$this->getAbsoluteImagePath('caldav/description.png'),'','',self::IMIP_INDENT);
+			}
+
+		}
+		if (isset($selectedEvent->ATTENDEE)) {
+			$finalguests='';
+			foreach ($selectedEvent->ATTENDEE as $attendee) {
+				$emailid=  substr(($attendee->getValue()),7);
+				$finalguests.=$emailid.' -'.$attendee['PARTSTAT'].', ';
+
+			}
+			$template->addBodyListItem($finalguests, $l10n->t('Guests:'),
+					$this->getAbsoluteImagePath('caldav/description.png'),'','',self::IMIP_INDENT);
 		}
 	}

@@ -723,4 +756,4 @@
@@ -659,7 +739,7 @@
 										Message $iTipMessage, $lastOccurrence) {
 		$token = $this->createInvitationToken($iTipMessage, $lastOccurrence);

-		$template->addBodyButtonGroupTentative(
+		$template->addBodyButtonGroup(
 			$l10n->t('Accept'),
 			$this->urlGenerator->linkToRouteAbsolute('dav.invitation_response.accept', [
 				'token' => $token,
@@ -667,11 +747,18 @@
 			$l10n->t('Decline'),
 			$this->urlGenerator->linkToRouteAbsolute('dav.invitation_response.decline', [
 				'token' => $token,
-			]),
-			$l10n->t('Maybe'),
-			$this->urlGenerator->getAbsoluteUrl('apps/calendar/invitation/tentative/'.$token)
+			])
 		);

+		$moreOptionsURL = $this->urlGenerator->linkToRouteAbsolute('dav.invitation_response.options', [
+			'token' => $token,
+		]);
+		$html = vsprintf('<small><a href="%s">%s</a></small>', [
+			$moreOptionsURL, $l10n->t('More options …')
+		]);
+		$text = $l10n->t('More options at %s', [$moreOptionsURL]);
+
+		$template->addBodyText($html, $text);
 	}

 	/**
@@ -716,4 +803,4 @@

 		return $token;
 	}