Skip to content

Commit

Permalink
Merge pull request #502 from humhub/enh/360-replace-theme-variables
Browse files Browse the repository at this point in the history
Replace theme variables with CSS variables
  • Loading branch information
luke- authored Sep 12, 2024
2 parents 5e389c4 + c396234 commit 1e5b780
Show file tree
Hide file tree
Showing 64 changed files with 376 additions and 376 deletions.
30 changes: 15 additions & 15 deletions Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public static function onWallEntryLinks($event)
try {
$eventModel = static::getCalendarEvent($event->sender->object);

if(!$eventModel) {
if (!$eventModel) {
return;
}

Expand All @@ -208,11 +208,11 @@ public static function onWallEntryLinks($event)
}

/* @var $eventModel CalendarEventIF */
if($eventModel->getStartDateTime() <= new DateTime()) {
if ($eventModel->getStartDateTime() <= new DateTime()) {
return;
}

if($eventModel instanceof CalendarEventReminderIF && !RecurrenceHelper::isRecurrentRoot($eventModel)) {
if ($eventModel instanceof CalendarEventReminderIF && !RecurrenceHelper::isRecurrentRoot($eventModel)) {
$event->sender->addWidget(ReminderLink::class, ['entry' => $eventModel]);
}
} catch (\Throwable $e) {
Expand All @@ -226,13 +226,13 @@ public static function onWallEntryLinks($event)
*/
private static function getCalendarEvent($model)
{
if($model instanceof CalendarEventIF) {
if ($model instanceof CalendarEventIF) {
return $model;
}

if(method_exists($model, 'getCalendarEvent')) {
if (method_exists($model, 'getCalendarEvent')) {
$event = $model->getCalendarEvent();
if($event instanceof CalendarEventIF) {
if ($event instanceof CalendarEventIF) {
return $event;
}
}
Expand All @@ -253,9 +253,9 @@ public static function onRecordBeforeUpdate($event)
{
try {
$model = CalendarUtils::getCalendarEvent($event->sender);
if($model && ($model instanceof EditableEventIF)) {
if ($model && ($model instanceof EditableEventIF)) {
/** @var $model EditableEventIF **/
if(empty($model->getUid())) {
if (empty($model->getUid())) {
$model->setUid(CalendarUtils::generateEventUid($model));
}
}
Expand All @@ -274,17 +274,17 @@ public static function onRecordBeforeDelete($event)
try {
$model = CalendarUtils::getCalendarEvent($event->sender);

if(!$model || !($model instanceof CalendarEventReminderIF)) {
if (!$model || !($model instanceof CalendarEventReminderIF)) {
return;
}

foreach(CalendarReminder::getEntryLevelReminder($model) as $reminder) {
foreach (CalendarReminder::getEntryLevelReminder($model) as $reminder) {
$reminder->delete();
}

if($model instanceof RecurrentEventIF) {
if ($model instanceof RecurrentEventIF) {
// When deleting duplicates we want to prevent automatic exdate settings.
if(!static::$duplicateIntegrityRun) {
if (!static::$duplicateIntegrityRun) {
$model->getRecurrenceQuery()->onDelete();
}
}
Expand Down Expand Up @@ -317,7 +317,7 @@ public static function onIntegrityCheck($event)
$integrityController->showTestHeadline("Calendar Module (" . CalendarReminderSent::find()->count() . " reminder sent entries)");

foreach (CalendarReminderSent::find()->each() as $reminderSent) {
if(!Content::findOne(['id' => $reminderSent->content_id])) {
if (!Content::findOne(['id' => $reminderSent->content_id])) {
if ($integrityController->showFix("Delete calendar reminder sent" . $reminderSent->id . " without existing entry relation!")) {
$reminderSent->delete();
}
Expand All @@ -339,7 +339,7 @@ public static function onIntegrityCheck($event)
->andWhere(['<>', 'id', $duplicatedRecurrenceArr['id']]);

foreach ($duplicateQuery->each() as $duplicate) {
if(RecurrenceHelper::isRecurrentInstance($duplicate) && $duplicate->id !== $duplicatedRecurrenceArr['id']) {
if (RecurrenceHelper::isRecurrentInstance($duplicate) && $duplicate->id !== $duplicatedRecurrenceArr['id']) {
if ($integrityController->showFix('Delete duplicated recurrent event instance ' . $duplicate->id . '!')) {
$duplicate->hardDelete();
}
Expand Down Expand Up @@ -370,7 +370,7 @@ public static function onCronRun($event)
$module = Yii::$app->getModule('calendar');
$lastRunTS = $module->settings->get('lastReminderRunTS');

if(!$lastRunTS || ((time() - $lastRunTS) >= $module->getRemidnerProcessIntervalS())) {
if (!$lastRunTS || ((time() - $lastRunTS) >= $module->getRemidnerProcessIntervalS())) {
try {
$controller = $event->sender;
$controller->stdout("Running reminder process... ");
Expand Down
12 changes: 6 additions & 6 deletions controllers/AbstractConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ public function actionDeleteType($id)

public function actionEditType($id = null)
{
if($id) {
if ($id) {
$model = CalendarEntryType::find()->where(['id' => $id])->one();
$this->validateEntry($model);
} else {
$model = new CalendarEntryType($this->contentContainer);
}

if($model->load(Yii::$app->request->post()) && $model->save()) {
if ($model->load(Yii::$app->request->post()) && $model->save()) {
$this->view->saved();
return $this->htmlRedirect(URL::toConfigTypes($this->contentContainer ?? $this->getContainerFromRequest()));
}
Expand All @@ -123,11 +123,11 @@ public function actionEditCalendars($key)
{
$item = $this->calendarService->getItemType($key, $this->contentContainer);

if(!$item) {
if (!$item) {
throw new HttpException(404);
}

if($item->load(Yii::$app->request->post()) && $item->save()) {
if ($item->load(Yii::$app->request->post()) && $item->save()) {
$this->view->saved();
return $this->htmlRedirect(URL::toConfigCalendars($this->contentContainer));
}
Expand Down Expand Up @@ -155,11 +155,11 @@ public function actionResetParticipationConfig()

protected function validateEntry(CalendarEntryType $type = null)
{
if(!$type) {
if (!$type) {
throw new HttpException(404);
}

if($type->contentcontainer_id !== $this->getContentContainerId()) {
if ($type->contentcontainer_id !== $this->getContentContainerId()) {
throw new HttpException(400);
}
}
Expand Down
12 changes: 6 additions & 6 deletions controllers/FullCalendarController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public function actionUpdate($id)

$content = Content::findOne(['id' => $id]);

if(!$content) {
if (!$content) {
throw new HttpException(404);
}

if(!$content->canEdit()) {
if (!$content->canEdit()) {
throw new HttpException(403);
}

Expand All @@ -42,25 +42,25 @@ public function actionUpdate($id)

$event = CalendarUtils::getCalendarEvent($model);

if(!$event) {
if (!$event) {
throw new HttpException(400, 'Invalid model given.');
}

if(!$event->isUpdatable()) {
if (!$event->isUpdatable()) {
throw new HttpException(400, 'Event can not be updated by current user.');
}

$start = new DateTime(Yii::$app->request->post('start'));
$end = new DateTime(Yii::$app->request->post('end'));

if(!$event->isAllDay()) {
if (!$event->isAllDay()) {
$start->setTimezone(CalendarUtils::getSystemTimeZone());
$end->setTimezone(CalendarUtils::getSystemTimeZone());
}

$result = $event->updateTime($start, $end);

if(is_bool($result)) {
if (is_bool($result)) {
return $this->asJson(['success' => $result]);
}

Expand Down
8 changes: 4 additions & 4 deletions controllers/ReminderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@ public function actionSet($id)
{
$content = Content::findOne(['id' => $id]);

if(!$content) {
if (!$content) {
throw new HttpException(404);
}

if(!$content->canView()) {
if (!$content->canView()) {
throw new HttpException(403);
}

$model = CalendarUtils::getCalendarEvent($content);

if(!$model || !($model instanceof CalendarEventReminderIF)) {
if (!$model || !($model instanceof CalendarEventReminderIF)) {
throw new HttpException(400);
}

$reminderSettings = new ReminderSettings(['entry' => $model, 'user' => Yii::$app->user->getIdentity()]);

if($reminderSettings->load(Yii::$app->request->post()) && $reminderSettings->save()) {
if ($reminderSettings->load(Yii::$app->request->post()) && $reminderSettings->save()) {
return ModalClose::widget(['saved' => true]);
}

Expand Down
2 changes: 1 addition & 1 deletion controllers/rest/CalendarController.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function actionUpdate($id)
}

$calendarEntryForm = new CalendarEntryForm(['entry' => $calendarEntry]);
if(! $calendarEntryForm->entry->content->canEdit()) {
if (! $calendarEntryForm->entry->content->canEdit()) {
return $this->returnError(403, 'You are not allowed to update this calendar entry!');
}

Expand Down
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

1.6.4 (Unreleased)
-----------------------
- Enh #502: Replace theme variables with CSS variables

1.6.3 (August 23, 2024)
-----------------------
- Fix #477: Hide the settings button when module is not available for a container
Expand Down
Loading

0 comments on commit 1e5b780

Please sign in to comment.