Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP:Linked Project Calendar #27

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,21 @@
* #L%
*/

import java.util.EnumMap;

import org.sigmah.client.inject.Injector;
import org.sigmah.client.page.Page;
import org.sigmah.client.page.PageRequest;
import org.sigmah.client.ui.presenter.calendar.CalendarPresenter;
import org.sigmah.client.ui.view.base.ViewInterface;
import org.sigmah.client.ui.view.orgunit.OrgUnitCalendarView;
import org.sigmah.shared.dto.calendar.CalendarType;

import com.google.inject.ImplementedBy;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
import java.util.HashMap;
import java.util.Map;
import org.sigmah.shared.dto.orgunit.OrgUnitDTO;

/**
* <p>
Expand Down Expand Up @@ -113,10 +112,19 @@ public void onBind() {
* {@inheritDoc}
*/
@Override
public void onPageRequest(final PageRequest request) {
final Map<Integer, Integer> calendars = new HashMap<Integer, Integer>();
calendars.put(1, getOrgUnit().getId());
calendars.put(2, getOrgUnit().getCalendarId());
public void onPageRequest(final PageRequest request) {
final Map<Integer, Integer> calendars = new HashMap<Integer, Integer>();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spMohanty & @osarrat Organization calendar integration is done only in one way.That means parent calendar contains child entries while child does not contain any parent entry.Is this okay or should it be both way ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is the expected behavior as expressed in issue #522 : http://www.sigmah.org/issues/view.php?id=522

Integer calendarId = 1;
calendars.put(calendarId++, getOrgUnit().getId());
calendars.put(calendarId, getOrgUnit().getCalendarId());
calendarId = calendarId + 3;
java.util.Iterator<OrgUnitDTO> iter = getOrgUnit().getChildrenOrgUnits().iterator();
while (iter.hasNext()) {
calendars.put(calendarId++, getOrgUnit().getChildrenOrgUnits().iterator().next().getId());
calendars.put(calendarId, getOrgUnit().getChildrenOrgUnits().iterator().next().getCalendarId());
iter.next();
calendarId = calendarId + 3;
}
calendarPresenter.reload(calendars);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,26 @@ public void onBind() {
@Override
public void onPageRequest(final PageRequest request) {
final Map<Integer, Integer> calendars = new HashMap<Integer, Integer>();
Integer CalendarId = 1;
calendars.put(CalendarId++, getProject().getId());
calendars.put(CalendarId++, getProject().getCalendarId());
calendars.put(CalendarId++, getProject().getPointsList().getId());
calendars.put(CalendarId++, getProject().getRemindersList().getId());
Integer calendarId = 1;
calendars.put(calendarId++, getProject().getId());
calendars.put(calendarId++, getProject().getCalendarId());
calendars.put(calendarId++, getProject().getPointsList().getId());
calendars.put(calendarId++, getProject().getRemindersList().getId());

if (!getProject().getFunded().isEmpty()) {
for (int i = 0; i < getProject().getFunded().size(); i++) {
calendars.put(CalendarId++, getProject().getFunded().get(i).getFunded().getId());
calendars.put(CalendarId++, getProject().getFunded().get(i).getFunded().getCalendarId());
calendars.put(CalendarId++, getProject().getFunded().get(i).getFunded().getPointsList().getId());
calendars.put(CalendarId++, getProject().getFunded().get(i).getFunded().getRemindersList().getId());
calendars.put(calendarId++, getProject().getFunded().get(i).getFunded().getId());
calendars.put(calendarId++, getProject().getFunded().get(i).getFunded().getCalendarId());
calendars.put(calendarId++, getProject().getFunded().get(i).getFunded().getPointsList().getId());
calendars.put(calendarId++, getProject().getFunded().get(i).getFunded().getRemindersList().getId());
}
}
if (!getProject().getFunding().isEmpty()) {
for (int i = 0; i < getProject().getFunding().size(); i++) {
calendars.put(CalendarId++, getProject().getFunding().get(i).getFunding().getId());
calendars.put(CalendarId++, getProject().getFunding().get(i).getFunding().getCalendarId());
calendars.put(CalendarId++, getProject().getFunding().get(i).getFunding().getPointsList().getId());
calendars.put(CalendarId++, getProject().getFunding().get(i).getFunding().getRemindersList().getId());
calendars.put(calendarId++, getProject().getFunding().get(i).getFunding().getId());
calendars.put(calendarId++, getProject().getFunding().get(i).getFunding().getCalendarId());
calendars.put(calendarId++, getProject().getFunding().get(i).getFunding().getPointsList().getId());
calendars.put(calendarId++, getProject().getFunding().get(i).getFunding().getRemindersList().getId());
}
}
calendarPresenter.reload(calendars);
Expand Down