diff options
author | emkael <emkael@tlen.pl> | 2016-06-07 15:17:49 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-06-10 11:46:41 +0200 |
commit | 823d71ced9b4947b1a5a5ade7245d521ed490061 (patch) | |
tree | a9a6c7cb0de74ff705e8320c284de423a698f5b5 /app/php/controls | |
parent | df401552aac363655ab8f056a6c910a7611954d6 (diff) |
* renaming php directory
Diffstat (limited to 'app/php/controls')
40 files changed, 0 insertions, 1200 deletions
diff --git a/app/php/controls/AddToFilter.php b/app/php/controls/AddToFilter.php deleted file mode 100644 index 9146f3b..0000000 --- a/app/php/controls/AddToFilter.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - -Prado::using('System.Web.UI.ActiveControls.TActiveCheckBox'); - -class AddToFilter extends UrlBasedCalendarControl { - - public function setDescription($val) { - $this->setViewState('Description', TPropertyValue::ensureString($val)); - } - - public function getDescription() { - return $this->getViewState('Description'); - } - - public function setUserPreference($sender, $param) { - $user = $this->getUserToManage(); - if ($user && !$user->IsGuest) { - if ($sender->Checked) { - $this->getFacade()->addToPreference($user, $this->getCalendar()->ID); - } else { - $this->getFacade()->removeFromPreference($user, $this->getCalendar()->ID); - } - $this->Page->CallbackClient->jQuery($this->Box, 'removeAttr', 'disabled'); - } - } - - public function getUserToManage() { - return $this->getControlState('user'); - } - - public function setUserToManage($user) { - $this->setControlState('user', $user); - } - - public function getPradoScriptDependencies() { - return ['jquery']; - } - -} - -?> diff --git a/app/php/controls/AddToFilter.tpl b/app/php/controls/AddToFilter.tpl deleted file mode 100644 index a202aa7..0000000 --- a/app/php/controls/AddToFilter.tpl +++ /dev/null @@ -1,8 +0,0 @@ -<com:TActiveCheckBox ID="Box" OnCheckedChanged="setUserPreference" CssClass="addToFilterBox"> - <prop:Enabled><%= !$this->UserToManage->IsGuest %></prop:Enabled> - <prop:Checked><%= $this->Facade->isCalendarPreferred($this->UserToManage, $this->getCalendar()->ID) %></prop:Checked> - <prop:ToolTip><%= $this->UserToManage->IsGuest ? Prado::localize('log in to manage your selections') : '' %></prop:ToolTip> -</com:TActiveCheckBox> -<com:TLabel ForControl="Box"> - <prop:Text><%= $this->getDescription() %></prop:Text> -</com:TLabel> diff --git a/app/php/controls/CalendarDetails.php b/app/php/controls/CalendarDetails.php deleted file mode 100644 index 95ee563..0000000 --- a/app/php/controls/CalendarDetails.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php - -class CalendarDetails extends UrlBasedCalendarControl { - -} - -?> diff --git a/app/php/controls/CalendarDetails.tpl b/app/php/controls/CalendarDetails.tpl deleted file mode 100644 index 2fd755c..0000000 --- a/app/php/controls/CalendarDetails.tpl +++ /dev/null @@ -1,13 +0,0 @@ -<com:THeader2> - <%= $this->getCalendar()->Name %> -</com:THeader2> -<com:TImage> - <prop:ImageUrl><%= $this->getCalendar()->Image %></prop:ImageUrl> -</com:TImage> -<com:THyperLink Target="_blank"> - <prop:Text><%[ Source website ]%></prop:Text> - <prop:NavigateUrl><%= $this->getCalendar()->Website %></prop:NavigateUrl> -</com:THyperLink> -<p> - <%[ Last updated: ]%> <%= $this->getCalendar()->LastUpdated %> -</p> diff --git a/app/php/controls/CalendarGrid.php b/app/php/controls/CalendarGrid.php deleted file mode 100644 index 4ebfacd..0000000 --- a/app/php/controls/CalendarGrid.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - -Prado::using('Application.web.FacadeTemplateControl'); -Prado::using('Application.facades.EventFacade'); -Prado::using('Application.user.DbUser'); - -class CalendarGrid extends FacadeTemplateControl { - - public function setMonth($month) { - $this->setControlState('Month', $month); - } - - public function getMonth() { - return $this->getControlState('Month'); - } - - public function setYear($year) { - $this->setControlState('Year', $year); - } - - public function getYear() { - return $this->getControlState('Year'); - } - - public function setUserToDisplay(DbUser $user) { - $this->setControlState('User', $user); - } - - public function getUserToDisplay() { - return $this->getControlState('User'); - } - - private function _getGrid() { - return $this->getFacade()->getCalendarListForUser( - $this->UserToDisplay, - $this->Month, - $this->Year - ); - } - - public function onPreRender($param) { - parent::onPreRender($param); - $this->Weeks->DataSource = $this->_getGrid()->Weeks; - $this->Weeks->dataBind(); - } - - public function weekDataBind($sender, $param) { - $param->Item->Days->DataSource = $param->Item->Data; - $param->Item->Days->dataBind(); - } - - public function dayDataBind($sender, $param) { - $param->Item->Events->DataSource = $param->Item->Data->Events; - $param->Item->Events->dataBind(); - } - -} - -?> diff --git a/app/php/controls/CalendarGrid.tpl b/app/php/controls/CalendarGrid.tpl deleted file mode 100644 index 2b3ada8..0000000 --- a/app/php/controls/CalendarGrid.tpl +++ /dev/null @@ -1,28 +0,0 @@ -<com:TRepeater ID="Weeks" OnItemDataBound="weekDataBind"> - <prop:ItemTemplate> - <div class="gridWeek"> - <com:TRepeater ID="Days" OnItemDataBound="SourceTemplateControl.dayDataBind"> - <prop:ItemTemplate> - <div class="gridDay"> - <%# $this->Data->Date %> - <com:TRepeater ID="Events"> - <prop:ItemTemplate> - <com:TConditional Condition="$this->Data"> - <prop:TrueTemplate> - <com:THtmlElement TagName="div"> - <prop:CssClass>gridEvent <%# $this->Parent->Parent->Data->Date == $this->Data->DateFrom ? 'beginDate' : '' %> <%# $this->Parent->Parent->Data->Date == $this->Data->DateTo ? 'endDate' : '' %></prop:CssClass> - <%# $this->Data->Name %> - </com:THtmlElement> - </prop:TrueTemplate> - <prop:FalseTemplate> - <div class="gridItem"> </div> - </prop:FalseTemplate> - </com:TConditional> - </prop:ItemTemplate> - </com:TRepeater> - </div> - </prop:ItemTemplate> - </com:TRepeater> - </div> - </prop:ItemTemplate> -</com:TRepeater> diff --git a/app/php/controls/CalendarGroupFilter.php b/app/php/controls/CalendarGroupFilter.php deleted file mode 100644 index 6f19bcd..0000000 --- a/app/php/controls/CalendarGroupFilter.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -Prado::using('Application.web.FacadeTemplateControl'); - -Prado::using('Application.facades.CalendarFacade'); - -class CalendarGroupFilter extends FacadeTemplateControl { - - public function onPreRender($param) { - parent::onPreRender($param); - $this->Categories->DataSource = $this->Facade->getCategories(); - $this->Categories->dataBind(); - } - - public function getPradoScriptDependencies() { - return ['jquery']; - } - -} - -?> diff --git a/app/php/controls/CalendarGroupFilter.tpl b/app/php/controls/CalendarGroupFilter.tpl deleted file mode 100644 index ac82465..0000000 --- a/app/php/controls/CalendarGroupFilter.tpl +++ /dev/null @@ -1,16 +0,0 @@ -<com:TRepeater ID="Categories"> - <prop:HeaderTemplate> - <div class="selectAllGroups"> - <%[ All ]%> - <com:TCheckBox CssClass="box" Checked="True" /> - </div> - </prop:HeaderTemplate> - <prop:ItemTemplate> - <div class="selectGroup"> - <%# $this->Data->Name %> - <com:TCheckBox CssClass="box" Checked="True"> - <prop:Value><%# $this->Data->ID %></prop:Value> - </com:TCheckBox> - </div> - </prop:ItemTemplate> -</com:TRepeater> diff --git a/app/php/controls/CalendarLabel.php b/app/php/controls/CalendarLabel.php deleted file mode 100644 index 667e847..0000000 --- a/app/php/controls/CalendarLabel.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - -Prado::using('Application.controls.UrlBasedCalendarControl'); - -class CalendarLabel extends UrlBasedCalendarControl { - - public function getPradoScriptDependencies() { - return ['jquery']; - } - -} - -?> diff --git a/app/php/controls/CalendarLabel.tpl b/app/php/controls/CalendarLabel.tpl deleted file mode 100644 index 69e0147..0000000 --- a/app/php/controls/CalendarLabel.tpl +++ /dev/null @@ -1,12 +0,0 @@ -<com:TPanel CssClass="calendar"> - <prop:Attributes.data-group><%= $this->Calendar->GroupID %></prop:Attributes.data-group> - <com:THyperLink> - <prop:NavigateUrl><%= $this->Service->constructUrl('Calendar', ['calendar' => $this->Calendar->Url]) %></prop:NavigateUrl> - <prop:Text><%= $this->Calendar->Name %></prop:Text> - </com:THyperLink> - <com:AddToFilter> - <prop:Facade><%= $this->Facade %></prop:Facade> - <prop:CalendarUrl><%= $this->Calendar->Url %></prop:CalendarUrl> - <prop:UserToManage><%= $this->User %></prop:UserToManage> - </com:AddToFilter> -</com:TPanel> diff --git a/app/php/controls/CalendarScaffold.php b/app/php/controls/CalendarScaffold.php deleted file mode 100644 index 7f15a32..0000000 --- a/app/php/controls/CalendarScaffold.php +++ /dev/null @@ -1,142 +0,0 @@ -<?php - -Prado::using('Application.web.FacadeTemplateControl'); - -Prado::using('System.Web.UI.ActiveControls.TActiveDataGrid'); -Prado::using('System.Web.UI.ActiveControls.TActiveTextBox'); -Prado::using('Application.components.SafeActiveFileUpload'); - -Prado::using('Application.facades.CalendarFacade'); - -class CalendarScaffold extends FacadeTemplateControl { - - public function onPreRender($param) { - parent::onPreRender($param); - if (!$this->Page->IsPostBack && !$this->Page->IsCallBack) { - $this->_rebindData(); - } - } - - private function _rebindCalendars(array $calendars) { - $this->Calendars->DataSource = $calendars; - $this->Calendars->dataBind(); - } - - private function _rebindCategoryList(array $categories) { - foreach ($this->Calendars->Columns as $column) { - if ($column->ID === 'Category' - && $column instanceof TActiveDropDownListColumn) { - $column->ListDataSource = $categories; - } - } - } - - private function _rebindData(bool $refresh = FALSE) { - $this->_rebindCategoryList( - $this->_getCategories() - ); - $this->_rebindCalendars( - $this->_getCalendars($refresh) - ); - } - - private function _getCalendars(bool $refresh = FALSE) { - if ($refresh) { - $this->clearViewState('Calendars'); - } - $calendars = $this->getViewState( - 'Calendars', - $this->getFacade()->getAll() - ); - $this->setViewState('Calendars', $calendars); - return $calendars; - } - - private function _getCategories() { - $categories = $this->getViewState( - 'Categories', - $this->getFacade()->getCategories() - ); - $this->setViewState('Categories', $categories); - return $categories; - } - - public function editRow($sender, $param) { - $this->Calendars->EditItemIndex = $param->Item->ItemIndex; - $this->_rebindData(); - } - - private function _compileSaveData(TDataGridItem $item) { - return [ - 'CategoryID' => $item->Category->DropDownList->SelectedValue, - 'Visible' => $item->Visible->CheckBox->Checked, - 'CustomName' => $item->CustomName->TextBox->SafeText, - 'CustomUrl' => $item->CustomUrl->TextBox->SafeText, - 'CustomImage' => $item->CustomImage->Value->SafeText - ]; - } - - public function saveRow($sender, $param) { - $calendar = $this->getFacade()->get( - $sender->DataKeys[$param->Item->ItemIndex] - ); - if ($calendar) { - foreach ($calendar as $c) { - $c->saveData($this->_compileSaveData($param->Item)); - } - } else { - throw new TInvalidDataValueException( - Prado::localize('Calendar not found') - ); - } - $this->Calendars->EditItemIndex = -1; - $this->_rebindData(TRUE); - } - - public function cancelRowEdit($sender, $param) { - $this->Calendars->EditItemIndex = -1; - $this->_rebindData(); - } - - public function toggleDefaultState($sender, $param) { - $calendar = $this->getFacade()->get($sender->CustomData); - if ($calendar) { - $calendar[0]->Visible = $sender->Checked; - $calendar[0]->save(); - $this->_rebindData(TRUE); - } - } - - public function uploadRowFile($sender, $param) { - $fileType = $sender->getFileType(); - if (preg_match('/^image\//', $fileType)) { - $calendar = $this->getFacade()->get($sender->CustomData); - if ($calendar) { - $targetFile = $calendar[0]->getCustomImagePath( - $sender->getLocalName(), - $fileType - ); - if ($sender->saveAs($targetFile)) { - $sender->NamingContainer->CustomImage->Value->Text = basename( - $targetFile - ); - } - } else { - throw new TInvalidDataValueException( - Prado::localize('Calendar not found') - ); - } - } else { - throw new TInvalidDataTypeException( - Prado::localize('Invalid file type') - ); - } - } - - protected function getPradoScriptDependencies() { - return ['jquery']; - } - -} - -?> diff --git a/app/php/controls/CalendarScaffold.tpl b/app/php/controls/CalendarScaffold.tpl deleted file mode 100644 index 6a22bc2..0000000 --- a/app/php/controls/CalendarScaffold.tpl +++ /dev/null @@ -1,81 +0,0 @@ -<com:TPanel - CssClass="calendarScaffold"> - <com:TActiveDataGrid ID="Calendars" - DataKeyField="UID" - AutoGenerateColumns="false" - OnEditCommand="editRow" - OnCancelCommand="cancelRowEdit" - OnUpdateCommand="saveRow"> - <com:TActiveBoundColumn ID="Name" - ReadOnly="true" - DataField="Name"> - <prop:HeaderText><%[ Calendar ]%></prop:HeaderText> - </com:TActiveBoundColumn> - <com:TActiveHyperLinkColumn ID="Website" - Target="_blank" - DataNavigateUrlField="Website"> - <prop:HeaderText><%[ WWW ]%></prop:HeaderText> - <prop:Text><%[ [www] ]%></prop:Text> - </com:TActiveHyperLinkColumn> - <com:TActiveHyperLinkColumn ID="Url" - Target="_blank" - DataNavigateUrlField="Url"> - <prop:HeaderText><%[ ICS ]%></prop:HeaderText> - <prop:Text><%[ [ics] ]%></prop:Text> - </com:TActiveHyperLinkColumn> - <com:TActiveDropDownListColumn ID="Category" - DataTextField="Category.Name" - DataValueField="CategoryID" - ListValueField="ID" - ListTextField="Name"> - <prop:HeaderText><%[ Category ]%></prop:HeaderText> - </com:TActiveDropDownListColumn> - <com:TActiveTemplateColumn ID="Visible"> - <prop:HeaderText><%[ Default ]%></prop:HeaderText> - <prop:ItemTemplate> - <com:TActiveCheckBox - OnCheckedChanged="SourceTemplateControl.toggleDefaultState" - CssClass="visibilityToggle"> - <prop:Checked><%# $this->Parent->Data->Visible %></prop:Checked> - <prop:CustomData><%# $this->Parent->Data->UID %></prop:CustomData> - </com:TActiveCheckBox> - </prop:ItemTemplate> - <prop:EditItemTemplate> - <com:TCheckBox ID="CheckBox"> - <prop:Checked><%# $this->Parent->Data->Visible %></prop:Checked> - </com:TCheckBox> - </prop:EditItemTemplate> - </com:TActiveTemplateColumn> - <com:TActiveBoundColumn ID="CustomName" - DataField="CustomName"> - <prop:HeaderText><%[ Custom name ]%></prop:HeaderText> - </com:TActiveBoundColumn> - <com:TActiveBoundColumn ID="CustomUrl" - DataField="CustomUrl"> - <prop:HeaderText><%[ URL ]%></prop:HeaderText> - </com:TActiveBoundColumn> - <com:TActiveTemplateColumn ID="CustomImage"> - <prop:HeaderText><%[ Image ]%></prop:HeaderText> - <prop:ItemTemplate> - <com:TImage> - <prop:ImageUrl><%# $this->Parent->Data->CustomImageUrl %></prop:ImageUrl> - </com:TImage> - </prop:ItemTemplate> - <prop:EditItemTemplate> - <com:TActiveTextBox ID="Value"> - <prop:Text><%# $this->Parent->Data->CustomImage %></prop:Text> - </com:TActiveTextBox><br /> - <com:SafeActiveFileUpload - OnFileUpload="SourceTemplateControl.uploadRowFile"> - <prop:CustomData><%# $this->Parent->Data->UID %></prop:CustomData> - </com:SafeActiveFileUpload> - </prop:EditItemTemplate> - </com:TActiveTemplateColumn> - <com:TActiveEditCommandColumn - HeaderText=""> - <prop:EditText><%[ Edit ]%></prop:EditText> - <prop:UpdateText><%[ Save ]%></prop:UpdateText> - <prop:CancelText><%[ Cancel ]%></prop:CancelText> - </com:TActiveEditCommandColumn> - </com:TActiveDataGrid> -</com:TPanel> diff --git a/app/php/controls/CalendarSelection.php b/app/php/controls/CalendarSelection.php deleted file mode 100644 index e53aa36..0000000 --- a/app/php/controls/CalendarSelection.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -Prado::using('Application.controls.FacadeTemplateControl'); - -class CalendarSelection extends FacadeTemplateControl { - - public function onPreRender($param) { - parent::onPreRender($param); - if (!$this->Page->IsCallBack) { - $this->Calendars->DataSource = $this->Facade->getAll(); - $this->Calendars->dataBind(); - } - } - -} - -?> diff --git a/app/php/controls/CalendarSelection.tpl b/app/php/controls/CalendarSelection.tpl deleted file mode 100644 index d6bdd83..0000000 --- a/app/php/controls/CalendarSelection.tpl +++ /dev/null @@ -1,8 +0,0 @@ -<com:TRepeater ID="Calendars"> - <prop:ItemTemplate> - <com:CalendarLabel> - <prop:Facade><%# $this->SourceTemplateControl->Facade %></prop:Facade> - <prop:CalendarUrl><%# $this->Data->CustomUrl %></prop:CalendarUrl> - </com:CalendarLabel> - </prop:ItemTemplate> -</com:TRepeater> diff --git a/app/php/controls/EventList.php b/app/php/controls/EventList.php deleted file mode 100644 index d40e000..0000000 --- a/app/php/controls/EventList.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - -class EventList extends UrlBasedCalendarControl { - - private function _setDate($key, $date) { - $datetime = new DateTime($date, new DateTimeZone('UTC')); - if (!$datetime) { - throw new TInvalidDataValueException( - Prado::localize('Invalid date string: {date}', - ['date' => $date]) - ); - } - $this->setViewState($key, $datetime); - } - - public function setDateFrom($date) { - $this->_setDate('DateFrom', $date); - } - - public function getDateFrom() { - return $this->getViewState('DateFrom'); - } - - public function setDateTo($date) { - $this->_setDate('DateTo', $date); - } - - public function getDateTo() { - return $this->getViewState('DateTo'); - } - - public function setHeaderText($text) { - $this->setViewState('HeaderText', TPropertyValue::ensureString($text)); - } - - public function getHeaderText() { - return $this->getViewState('HeaderText'); - } - - public function setReverse($value) { - $this->setViewState('Reverse', TPropertyValue::ensureBoolean($value)); - } - - public function getReverse() { - return $this->getViewState('Reverse'); - } - - public function getEvents() { - return $this->getFacade()->getEventsForTimeframe( - $this->getCalendar(), - $this->getDateFrom() ?: new DateTime('0000-00-00'), - $this->getDateTo() ?: new DateTime('9999-99-99'), - $this->getReverse() ? 'DESC' : 'ASC' - ); - } - -} - -?> diff --git a/app/php/controls/EventList.tpl b/app/php/controls/EventList.tpl deleted file mode 100644 index 5881ce7..0000000 --- a/app/php/controls/EventList.tpl +++ /dev/null @@ -1,6 +0,0 @@ -<com:THeader3> - <%= $this->getHeaderText() %> -</com:THeader3> -<com:EventRepeater CalendarLinkVisible="false"> - <prop:Events><%= $this->getEvents() %></prop:Events> -</com:EventRepeater> diff --git a/app/php/controls/EventRepeater.php b/app/php/controls/EventRepeater.php deleted file mode 100644 index 4fb2812..0000000 --- a/app/php/controls/EventRepeater.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -Prado::using('Application.web.TemplateControl'); - -class EventRepeater extends TemplateControl { - - public function setEvents($events) { - $this->Events->DataSource = $events; - $this->Events->dataBind(); - } - - public function setCalendarLinkVisible($value) { - $this->setViewState( - 'CalendarLinkVisible', - TPropertyValue::ensureBoolean($value) - ); - } - - public function getCalendarLinkVisible() { - return $this->getViewState('CalendarLinkVisible', TRUE); - } - -} - -?> diff --git a/app/php/controls/EventRepeater.tpl b/app/php/controls/EventRepeater.tpl deleted file mode 100644 index 69aaabf..0000000 --- a/app/php/controls/EventRepeater.tpl +++ /dev/null @@ -1,12 +0,0 @@ -<com:TRepeater ID="Events"> - <prop:ItemTemplate> - <%# $this->Data->DateString %> - <%# $this->Data->Name %> - <com:THyperLink> - <prop:Visible><%# $this->SourceTemplateControl->CalendarLinkVisible %></prop:Visible> - <prop:Text>(<%# $this->Data->Calendar->Name %>)</prop:Text> - <prop:NavigateUrl><%# $this->Service->constructUrl('Calendar', ['calendar' => $this->Data->Calendar->Url]) %></prop:NavigateUrl> - </com:THyperLink> - <br /> - </prop:ItemTemplate> -</com:TRepeater> diff --git a/app/php/controls/HeaderMenu.php b/app/php/controls/HeaderMenu.php deleted file mode 100644 index 2488629..0000000 --- a/app/php/controls/HeaderMenu.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -Prado::using('Application.web.TemplateControl'); - -Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton'); - -class HeaderMenu extends TemplateControl { - - public function loginUser($sender, $param) { - $authModule = $this->Application->getModule('auth'); - $authModule->setReturnUrl($this->Request->RequestUri); - $this->Response->redirect( - $this->Service->ConstructUrl($authModule->LoginPage) - ); - } - - public function logoutUser($sender, $param) { - $this->Application->getModule('auth')->logout(); - $this->Response->redirect( - $this->Service->ConstructUrl(NULL) - ); - } - -} - -?> diff --git a/app/php/controls/HeaderMenu.tpl b/app/php/controls/HeaderMenu.tpl deleted file mode 100644 index a760588..0000000 --- a/app/php/controls/HeaderMenu.tpl +++ /dev/null @@ -1,36 +0,0 @@ -<nav role="navigation"> - <com:TActiveLinkButton OnCommand="loginUser"> - <prop:Text><%[ Login ]%></prop:Text> - <prop:Visible><%= $this->User->IsGuest %></prop:Visible> - <prop:ClientSide.OnFailure>window.location.replace('<%= $this->Service->constructUrl('Login') %>')</prop:ClientSide.OnFailure> - <prop:ClientSide.OnException>window.location.replace('<%= $this->Service->constructUrl('Login') %>')</prop:ClientSide.OnException> - </com:TActiveLinkButton> - <com:THyperLink> - <prop:Text><%[ Profile ]%></prop:Text> - <prop:NavigateUrl><%= $this->Service->constructUrl('Profile') %></prop:NavigateUrl> - <prop:Visible><%= !$this->User->IsGuest %></prop:Visible> - </com:THyperLink> - <com:THyperLink> - <prop:Text><%[ Calendar list ]%></prop:Text> - <prop:NavigateUrl><%= $this->Service->constructUrl('Select') %></prop:NavigateUrl> - </com:THyperLink> - <com:TActiveLinkButton OnCommand="logoutUser"> - <com:TTranslate> - Logout ({name}) - <com:TTranslateParameter Key="name"><%= $this->User->Name %></com:TTranslateParameter> - </com:TTranslate> - <prop:Visible><%= !$this->User->IsGuest %></prop:Visible> - <prop:ClientSide.OnFailure>window.location.reload()</prop:ClientSide.OnFailure> - <prop:ClientSide.OnException>window.location.reload()</prop:ClientSide.OnException> - </com:TActiveLinkButton> - <com:THyperLink> - <prop:Text><%[ New user ]%></prop:Text> - <prop:NavigateUrl><%= $this->Service->constructUrl('Signup') %></prop:NavigateUrl> - <prop:Visible><%= $this->User->getIsAdmin() %></prop:Visible> - </com:THyperLink> - <com:THyperLink> - <prop:Text><%[ Admin calendars ]%></prop:Text> - <prop:NavigateUrl><%= $this->Service->constructUrl('Admin') %></prop:NavigateUrl> - <prop:Visible><%= $this->User->getIsAdmin() %></prop:Visible> - </com:THyperLink> -</nav> diff --git a/app/php/controls/LoginBox.php b/app/php/controls/LoginBox.php deleted file mode 100644 index 1136a79..0000000 --- a/app/php/controls/LoginBox.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -Prado::using('Application.web.TemplateControl'); - -class LoginBox extends TemplateControl { - - public function onInit($param) { - parent::onInit($param); - if (!$this->Page->IsPostBack && !$this->User->IsGuest) { - $this->_afterLoginRedirect(); - } - } - - private function _afterLoginRedirect() { - $authModule = $this->Application->getModule('auth'); - $redirUrl = $authModule->ReturnUrl; - if (!$redirUrl - || $redirUrl == $this->Service->constructUrl($authModule->LoginPage)) { - $redirUrl = $this->Service->constructUrl(NULL); - } - $this->Response->redirect($redirUrl); - } - - public function loginUser($sender, $param) { - if ($this->Page->IsValid) { - $this->_afterLoginRedirect(); - } - } - - public function validatePassword($sender, $param) { - $param->IsValid = $this->Application->getModule('auth')->login( - $this->Login->Text, - $this->Password->Text - ); - } - -} - -?> diff --git a/app/php/controls/LoginBox.tpl b/app/php/controls/LoginBox.tpl deleted file mode 100644 index 070ab86..0000000 --- a/app/php/controls/LoginBox.tpl +++ /dev/null @@ -1,33 +0,0 @@ -<%[ Username: ]%> -<com:TTextBox ID="Login" - ValidationGroup="LoginGroup" /> -<com:TRequiredFieldValidator - ControlToValidate="Login" - Display="Dynamic" - ValidationGroup="LoginGroup"> - <prop:ErrorMessage><%[ Username cannot be empty ]%></prop:ErrorMessage> -</com:TRequiredFieldValidator> -<br /> -<%[ Password: ]%> -<com:TTextBox ID="Password" - TextMode="Password" - ValidationGroup="LoginGroup" /> -<com:TRequiredFieldValidator - ControlToValidate="Password" - Display="Dynamic" - ValidationGroup="LoginGroup"> - <prop:ErrorMessage><%[ Password cannot be empty ]%></prop:ErrorMessage> -</com:TRequiredFieldValidator> -<com:TCustomValidator - ControlToValidate="Password" - OnServerValidate="validatePassword" - Display="Dynamic" - ValidationGroup="LoginGroup"> - <prop:ErrorMessage><%[ Username and password don't match ]%></prop:ErrorMessage> -</com:TCustomValidator> -<br /> -<com:TButton - OnCommand="loginUser" - ValidationGroup="LoginGroup"> - <prop:Text><%[ Login ]%></prop:Text> -</com:TButton> diff --git a/app/php/controls/PasswordChange.php b/app/php/controls/PasswordChange.php deleted file mode 100644 index 45ce656..0000000 --- a/app/php/controls/PasswordChange.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php - -Prado::using('Application.web.FacadeTemplateControl'); - -Prado::using('Application.user.DbUser'); -Prado::using('Application.facades.UserFacade'); - -class PasswordChange extends FacadeTemplateControl { - - public function getUserToChange() { - return $this->getControlState('user'); - } - - public function setUserToChange(DbUser $user) { - if ($user->IsGuest && !$this->Page->IsCallBack) { - throw new TInvalidDataValueException( - Prado::localize( - 'Password change impossible for guest user' - ) - ); - } - $this->setControlState('user', $user); - } - - public function checkPassword($sender, $param) { - $param->IsValid = $this->getFacade()->verifyUserPassword( - $this->Password->Text, $this->UserToChange - ); - } - - public function changePassword($sender, $param) { - $this->SuccessMessage->Visible = FALSE; - if ($this->Page->IsValid) { - $this->getFacade()->changePassword( - $this->UserToChange, - $this->NewPassword->Text - ); - $this->SuccessMessage->Visible = TRUE; - } - } - -} - -?> diff --git a/app/php/controls/PasswordChange.tpl b/app/php/controls/PasswordChange.tpl deleted file mode 100644 index 4eb9a8e..0000000 --- a/app/php/controls/PasswordChange.tpl +++ /dev/null @@ -1,59 +0,0 @@ -<%[ Change password ]%><br /> -<%[ Current password: ]%> -<com:TTextBox ID="Password" - TextMode="Password" - ValidationGroup="ChangePasswordGroup" /> -<com:TRequiredFieldValidator - ControlToValidate="Password" - Display="Dynamic" - ValidationGroup="ChangePasswordGroup"> - <prop:ErrorMessage><%[ Current password cannot be empty ]%></prop:ErrorMessage> -</com:TRequiredFieldValidator> -<com:TCustomValidator - ControlToValidate="Password" - OnServerValidate="checkPassword" - Display="Dynamic" - ValidationGroup="ChangePasswordGroup"> - <prop:ErrorMessage><%[ Password is incorrect ]%></prop:ErrorMessage> -</com:TCustomValidator> -<br /> -<%[ New password: ]%> -<com:TTextBox ID="NewPassword" - TextMode="Password" - ValidationGroup="ChangePasswordGroup" /> -<com:TRequiredFieldValidator - ControlToValidate="NewPassword" - Display="Dynamic" - ValidationGroup="ChangePasswordGroup"> - <prop:ErrorMessage><%[ New password cannot be empty ]%></prop:ErrorMessage> -</com:TRequiredFieldValidator> -<br /> -<%[ Repeat password: ]%> -<com:TTextBox ID="ReNewPassword" - TextMode="Password" - ValidationGroup="ChangePasswordGroup" /> -<com:TRequiredFieldValidator - ControlToValidate="ReNewPassword" - Display="Dynamic" - ValidationGroup="ChangePasswordGroup"> - <prop:ErrorMessage><%[ New password cannot be empty ]%></prop:ErrorMessage> -</com:TRequiredFieldValidator> -<com:TCompareValidator - ControlToValidate="ReNewPassword" - ControlToCompare="NewPassword" - DataType="String" - Operator="Equal" - Display="Dynamic" - ValidationGroup="ChangePasswordGroup"> - <prop:ErrorMessage><%[ Passwords don't match ]%></prop:ErrorMessage> -</com:TCompareValidator> -<br /> -<com:TButton - OnCommand="changePassword" - ValidationGroup="ChangePasswordGroup"> - <prop:Text><%[ Change password ]%></prop:Text> -</com:TButton> -<com:TLabel ID="SuccessMessage" - Visible="false"> - <prop:Text><%[ Your password has been changed ]%></prop:Text> -</com:TLabel> diff --git a/app/php/controls/RegistrationForm.php b/app/php/controls/RegistrationForm.php deleted file mode 100644 index 46494e3..0000000 --- a/app/php/controls/RegistrationForm.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -Prado::using('Application.web.FacadeTemplateControl'); - -Prado::using('Application.facades.UserFacade'); - -class RegistrationForm extends FacadeTemplateControl { - - public function checkUsername($sender, $param) { - $param->IsValid = $this->getFacade()->checkForUsername($this->Login->SafeText); - } - - public function registerUser($sender, $param) { - if ($this->Page->IsValid) { - $this->getFacade()->registerUser( - $this->Login->SafeText, - $this->Password->Text, - $this->Admin->Checked - ); - $this->Response->redirect( - $this->Service->constructUrl(NULL) - ); - } - } - -} - -?> diff --git a/app/php/controls/RegistrationForm.tpl b/app/php/controls/RegistrationForm.tpl deleted file mode 100644 index 9defe54..0000000 --- a/app/php/controls/RegistrationForm.tpl +++ /dev/null @@ -1,66 +0,0 @@ -<%[ Username: ]%> -<com:TTextBox ID="Login" - ValidationGroup="SignupGroup" /> -<com:TRequiredFieldValidator - ControlToValidate="Login" - Display="Dynamic" - ValidationGroup="SignupGroup"> - <prop:ErrorMessage><%[ Username cannot be empty ]%></prop:ErrorMessage> -</com:TRequiredFieldValidator> -<com:TRegularExpressionValidator - ControlToValidate="Login" - RegularExpression="[a-zA-Z0-9_]{6,255}" - Display="Dynamic" - ValidationGroup="SignupGroup"> - <prop:ErrorMessage><%[ Username must contain 6-255 characters, all Latin alphanumeric or underscore ]%></prop:ErrorMessage> -</com:TRegularExpressionValidator> -<com:TCustomValidator - ControlToValidate="Login" - OnServerValidate="checkUsername" - Display="Dynamic" - ValidationGroup="SignupGroup"> - <prop:ErrorMessage><%[ Username already exists ]%></prop:ErrorMessage> -</com:TCustomValidator> -<br /> -<%[ Password: ]%> -<com:TTextBox ID="Password" - TextMode="Password" - ValidationGroup="SignupGroup" /> -<com:TRequiredFieldValidator - ControlToValidate="Password" - Display="Dynamic" - ValidationGroup="SignupGroup"> - <prop:ErrorMessage><%[ Password cannot be empty ]%></prop:ErrorMessage> -</com:TRequiredFieldValidator> -<br /> -<%[ Repeat password: ]%> -<com:TTextBox ID="RePassword" - TextMode="Password" - ValidationGroup="SignupGroup" /> -<com:TRequiredFieldValidator - ControlToValidate="RePassword" - Display="Dynamic" - ValidationGroup="SignupGroup"> - <prop:ErrorMessage><%[ Password cannot be empty ]%></prop:ErrorMessage> -</com:TRequiredFieldValidator> -<com:TCompareValidator - ControlToValidate="RePassword" - ControlToCompare="Password" - DataType="String" - Operator="Equal" - Display="Dynamic" - ValidationGroup="SignupGroup"> - <prop:ErrorMessage><%[ Passwords don't match ]%></prop:ErrorMessage> -</com:TCompareValidator> -<br /> -<%[ Admin: ]%> -<com:TCheckBox ID="Admin" - ValidationGroup="SignupGroup" /> -<br /> -<com:TButton - OnCommand="registerUser" - ValidationGroup="SignupGroup"> - <prop:Text><%[ Create ]%></prop:Text> -</com:TButton> -<com:TValidationSummary - ValidationGroup="SignupGroup" /> diff --git a/app/php/controls/TimezoneSelect.php b/app/php/controls/TimezoneSelect.php deleted file mode 100644 index 25af453..0000000 --- a/app/php/controls/TimezoneSelect.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php - -Prado::using('Application.web.FacadeTemplateControl'); - -Prado::using('Application.user.DbUser'); -Prado::using('Application.facades.UserFacade'); - -Prado::using('Application.dto.TimezoneDTO'); - -class TimezoneSelect extends FacadeTemplateControl { - - public function getUserToChange() { - return $this->getControlState('user'); - } - - public function setUserToChange(DbUser $user) { - if ($user->IsGuest && !$this->Page->IsCallBack) { - throw new TInvalidDataValueException( - Prado::localize( - 'Timezone preference change impossible for guest user' - ) - ); - } - $this->setControlState('user', $user); - } - - public function onPreRender($param) { - parent::onPreRender($param); - $this->Timezones->DataSource = $this->_getTimezones(); - $this->Timezones->DataValueField = 'Name'; - $this->Timezones->DataTextField = 'Label'; - $this->Timezones->dataBind(); - $this->Timezones->setSelectedValue( - $this->getFacade()->getTimezonePreference($this->UserToChange)->Name - ); - } - - public function saveTimezone($sender, $param) { - $this->getFacade()->setTimezonePreference( - $this->UserToChange, - $this->Timezones->SelectedValue - ); - } - - private function _getTimezones() { - $timezones = array_map( - function($tz) { - return new TimezoneDTO($tz); - }, - DateTimeZone::listIdentifiers() - ); - usort($timezones, ['TimezoneDTO', '__compare']); - return $timezones; - } - -} - -?> diff --git a/app/php/controls/TimezoneSelect.tpl b/app/php/controls/TimezoneSelect.tpl deleted file mode 100644 index ee703d6..0000000 --- a/app/php/controls/TimezoneSelect.tpl +++ /dev/null @@ -1,5 +0,0 @@ -<com:TDropDownList ID="Timezones" /> -<com:TButton - OnCommand="saveTimezone"> - <prop:Text><%[ Save timezone ]%></prop:Text> -</com:TButton> diff --git a/app/php/controls/UpcomingEvents.php b/app/php/controls/UpcomingEvents.php deleted file mode 100644 index 27fc723..0000000 --- a/app/php/controls/UpcomingEvents.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -Prado::using('Application.web.FacadeTemplateControl'); -Prado::using('Application.user.DbUser'); -Prado::using('Application.facades.EventFacade'); - -class UpcomingEvents extends FacadeTemplateControl { - - public function getUserToDisplay() { - return $this->getControlState('user'); - } - - public function setUserToDisplay(DbUser $user) { - $this->setControlState('user', $user); - } - - public function getEvents() { - return $this->_getEventsForUser($this->UserToDisplay); - } - - private function _getEventsForUser(DbUser $user) { - $utc = new DateTimeZone('UTC'); - $dateFrom = new DateTime('now', $utc); - $dateTo = new DateTime('+7 days', $utc); - return $this->getFacade()->getTimeframeListForUser( - $user, - $dateFrom, $dateTo - ); - } - -} - -?> diff --git a/app/php/controls/UpcomingEvents.tpl b/app/php/controls/UpcomingEvents.tpl deleted file mode 100644 index ac5f60c..0000000 --- a/app/php/controls/UpcomingEvents.tpl +++ /dev/null @@ -1,5 +0,0 @@ -<%[ Upcoming events: ]%> -<br /> -<com:EventRepeater ID="Events"> - <prop:Events><%= $this->getEvents() %></prop:Events> -</com:EventRepeater> diff --git a/app/php/controls/UrlBasedCalendarControl.php b/app/php/controls/UrlBasedCalendarControl.php deleted file mode 100644 index a5be82e..0000000 --- a/app/php/controls/UrlBasedCalendarControl.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -Prado::using('Application.web.FacadeTemplateControl'); -Prado::using('Application.facades.CalendarFacade'); - -class UrlBasedCalendarControl extends FacadeTemplateControl { - - public function setCalendarUrl(string $url = NULL) { - if ($url) { - $calendar = $this->getFacade()->resolveUrl($url); - if ($calendar) { - $this->setControlState('Calendar', $calendar); - return; - } - } - if ($this->getRaiseException()) { - throw new THttpException( - 404, - Prado::localize('Page not found') - ); - } else { - $this->Visible = FALSE; - } - } - - public function getCalendar() { - return $this->getControlState('Calendar'); - } - - public function setRaiseException($value) { - $this->setControlState('RaiseException', TPropertyValue::ensureBoolean($value)); - } - - public function getRaiseException() { - return $this->getControlState('RaiseException', FALSE); - } - -} - -?> diff --git a/app/php/controls/UserSelection.php b/app/php/controls/UserSelection.php deleted file mode 100644 index 233f0bf..0000000 --- a/app/php/controls/UserSelection.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -Prado::using('Application.web.FacadeTemplateControl'); -Prado::using('Application.user.DbUser'); -Prado::using('Application.facades.CalendarFacade'); - -class UserSelection extends FacadeTemplateControl { - - public function getUserToDisplay() { - return $this->getControlState('user'); - } - - public function setUserToDisplay(DbUser $user = NULL) { - $this->setControlState('user', $user); - } - - public function onPreRender($param) { - parent::onPreRender($param); - $this->Categories->setDataSource( - $this->_getUserSelection($this->UserToDisplay) - ); - $this->Categories->dataBind(); - } - - public function categoryDataBind($sender, $param) { - $param->Item->Calendars->setDataSource($param->Item->Data->Calendars); - $param->Item->Calendars->dataBind(); - } - - public function removeFromSelection($sender, $param) { - if (!$this->UserToDisplay->IsGuest) { - return $this->getFacade()->removeFromPreference( - $this->UserToDisplay, - $param->CommandParameter - ); - } - } - - private function _getUserSelection(DbUser $user) { - return $this->getFacade()->getPreferenceList($user); - } - -} - -?> diff --git a/app/php/controls/UserSelection.tpl b/app/php/controls/UserSelection.tpl deleted file mode 100644 index 8d20365..0000000 --- a/app/php/controls/UserSelection.tpl +++ /dev/null @@ -1,29 +0,0 @@ -<%[ Selected calendars: ]%> -<br /> -<com:TRepeater ID="Categories" OnItemDataBound="categoryDataBind"> - <prop:ItemTemplate> - <%# $this->Data->Name %><br /> - <com:TRepeater ID="Calendars"> - <prop:ItemTemplate> - <com:TLinkButton - Text="[X]" - OnCommand="SourceTemplateControl.removeFromSelection"> - <prop:CommandParameter><%# $this->Data->ID %></prop:CommandParameter> - <prop:Visible><%# !$this->SourceTemplateControl->UserToDisplay->IsGuest %></prop:Visible> - </com:TLinkButton> - <%# $this->Data->Name %> - <com:THyperLink> - <prop:Text><%[ (details) ]%></prop:Text> - <prop:NavigateUrl><%# $this->Service->constructUrl('Calendar', ['calendar' => $this->Data->Url]) %></prop:NavigateUrl> - </com:THyperLink> - <com:THyperLink - Text="(www)" - Target="_blank"> - <prop:NavigateUrl><%# $this->Data->Website %></prop:NavigateUrl> - </com:THyperLink> - <br /> - </prop:ItemTemplate> - </com:TRepeater> - <br /> - </prop:ItemTemplate> -</com:TRepeater> diff --git a/app/php/controls/config.xml b/app/php/controls/config.xml deleted file mode 100644 index 61d7e5b..0000000 --- a/app/php/controls/config.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<configuration> - <paths> - <using namespace="Application.controls.*" /> - </paths> -</configuration> diff --git a/app/php/controls/scripts/AddToFilter.js b/app/php/controls/scripts/AddToFilter.js deleted file mode 100644 index e6d7b39..0000000 --- a/app/php/controls/scripts/AddToFilter.js +++ /dev/null @@ -1,5 +0,0 @@ -$(document).on('ready', function() { - $('input.addToFilterBox').on('change', function() { - $(this).attr('disabled', true); - }); -}); diff --git a/app/php/controls/scripts/CalendarGroupFilter.js b/app/php/controls/scripts/CalendarGroupFilter.js deleted file mode 100644 index e6c1d73..0000000 --- a/app/php/controls/scripts/CalendarGroupFilter.js +++ /dev/null @@ -1,29 +0,0 @@ -$(document).on('ready', function() { - var selectBoxes = $('.selectGroup input.box'); - var selectAllBox = $('.selectAllGroups input.box'); - selectBoxes.on('change', function() { - var groups = []; - var allSelected = true; - $('.selectGroup input.box').each(function() { - var box = $(this); - if (box.is(':checked')) { - groups.push(box.val()); - } else { - allSelected = false; - } - }); - if (allSelected) { - selectAllBox.prop('checked', true); - } else { - selectAllBox.removeAttr('checked'); - } - $(document).trigger('Application.calendarGroupFilterChanged', {groups: groups}); - }); - selectAllBox.on('change', function() { - if ($(this).is(':checked')) { - selectBoxes.prop('checked', true).trigger('change'); - } else { - selectBoxes.removeAttr('checked').trigger('change'); - } - }); -}); diff --git a/app/php/controls/scripts/CalendarLabel.js b/app/php/controls/scripts/CalendarLabel.js deleted file mode 100644 index 8193e56..0000000 --- a/app/php/controls/scripts/CalendarLabel.js +++ /dev/null @@ -1,11 +0,0 @@ -$(document).on('Application.calendarGroupFilterChanged', function(event, args) { - var selectedGroups = args.groups || []; - $('.calendar').each(function() { - var label = $(this); - if (selectedGroups.indexOf(label.attr('data-group')) >= 0) { - label.show(); - } else { - label.hide(); - } - }); -}); diff --git a/app/php/controls/scripts/CalendarScaffold.js b/app/php/controls/scripts/CalendarScaffold.js deleted file mode 100644 index d4b8ec5..0000000 --- a/app/php/controls/scripts/CalendarScaffold.js +++ /dev/null @@ -1,8 +0,0 @@ -$('body').on( - 'click', - 'main .calendarScaffold tbody a[href^="javascript:;//"], main .calendarScaffold tbody input.visibilityToggle', - function(e) { - var loader = $('<div>').addClass('calendarScaffoldLoader'); - $('main .calendarScaffold div[id$="_Container"]').append(loader); - } -); diff --git a/app/php/controls/styles/CalendarGrid.css b/app/php/controls/styles/CalendarGrid.css deleted file mode 100644 index 4710993..0000000 --- a/app/php/controls/styles/CalendarGrid.css +++ /dev/null @@ -1,16 +0,0 @@ -div.gridWeek { - clear: both; - display: flex; - flex-flow: row nowrap; -} -div.gridDay { - width: 14%; - min-height: 8em; - flex: 1 1 auto; -} -div.gridEvent, div.gridItem { height: 1.5em; padding: 0.3em 0.5em; margin: 0.1em 0; } -div.gridEvent { overflow: hidden; white-space: nowrap; background: #ddd } -div.gridEvent.beginDate { border-top-left-radius: 1.5em; - border-bottom-left-radius: 1.5em } -div.gridEvent.endDate { border-top-right-radius: 1.5em; - border-bottom-right-radius: 1.5em } diff --git a/app/php/controls/styles/CalendarScaffold.css b/app/php/controls/styles/CalendarScaffold.css deleted file mode 100644 index 071f672..0000000 --- a/app/php/controls/styles/CalendarScaffold.css +++ /dev/null @@ -1,11 +0,0 @@ -.calendarScaffold { - position: relative; -} -.calendarScaffold .calendarScaffoldLoader { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - background: url(preloader.gif) no-repeat center 5% rgba(255,255,255,0.8); -} |