Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/10/18 23:06:00 (6 years ago)
Author:
jzenisek
Message:

#2839: fixed couple of minor issues

  • changed tags in resource selector
  • added project information in job list and adapted sortation
  • fixed hand-down save by withdrawing additional offset-rights (permissions, resources),...
Location:
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectView.cs

    r15966 r15992  
    8282        nameTextBox.Text = Content.Name;
    8383        descriptionTextBox.Text = Content.Description;
    84         ownerComboBox.SelectedItem = AccessClient.Instance.UsersAndGroups.FirstOrDefault(x => x.Id == Content.OwnerUserId);
     84
     85        ownerComboBox.SelectedIndexChanged -= ownerComboBox_SelectedIndexChanged;
     86        var users = AccessClient.Instance.UsersAndGroups.OfType<LightweightUser>();
     87        if (!Content.ParentProjectId.HasValue) users = users.Where(x => x.Roles.Select(y => y.Name).Contains(HiveRoles.Administrator));
     88        ownerComboBox.DataSource = users.ToList();
     89        ownerComboBox.SelectedItem = users.FirstOrDefault(x => x.Id == Content.OwnerUserId);
     90        ownerComboBox.SelectedIndexChanged += ownerComboBox_SelectedIndexChanged;
     91
    8592        createdTextBox.Text = Content.DateCreated.ToString("ddd, dd.MM.yyyy, HH:mm:ss");
    8693        startDateTimePicker.Value = Content.StartDate;
     
    135142        finallyCallback: () => {
    136143          ownerComboBox.SelectedIndexChanged -= ownerComboBox_SelectedIndexChanged;
    137           ownerComboBox.DataSource = AccessClient.Instance.UsersAndGroups.OfType<LightweightUser>().ToList();
     144          var users = AccessClient.Instance.UsersAndGroups.OfType<LightweightUser>();
     145          if (Content != null && !Content.ParentProjectId.HasValue) users = users.Where(x => x.Roles.Select(y => y.Name).Contains(HiveRoles.Administrator));
     146          ownerComboBox.DataSource = users.ToList();
    138147          ownerComboBox.SelectedIndexChanged += ownerComboBox_SelectedIndexChanged;
    139148        });
     
    150159        finallyCallback: () => {
    151160          ownerComboBox.SelectedIndexChanged -= ownerComboBox_SelectedIndexChanged;
    152           ownerComboBox.DataSource = AccessClient.Instance.UsersAndGroups.OfType<LightweightUser>().ToList();
    153           ownerComboBox.SelectedItem = AccessClient.Instance.UsersAndGroups.FirstOrDefault(x => x.Id == persistedOwnerUserId);
     161          var users = AccessClient.Instance.UsersAndGroups.OfType<LightweightUser>();
     162          if (Content != null && !Content.ParentProjectId.HasValue) users = users.Where(x => x.Roles.Select(y => y.Name).Contains(HiveRoles.Administrator));
     163          ownerComboBox.DataSource = users.ToList();
     164          ownerComboBox.SelectedItem = users.FirstOrDefault(x => x.Id == persistedOwnerUserId);
    154165          ownerComboBox.SelectedIndexChanged += ownerComboBox_SelectedIndexChanged;
    155166          refreshButton.Enabled = true;
     
    203214    private void indefiniteCheckBox_CheckedChanged(object sender, EventArgs e) {
    204215      if (Content == null) return;
    205       var newEndDate = indefiniteCheckBox.Checked ? (DateTime?)null : Content.StartDate;
     216      var newEndDate = indefiniteCheckBox.Checked ? (DateTime?)null : endDateTimePicker.Value;
    206217      endDateTimePicker.Enabled = !indefiniteCheckBox.Checked;
    207218      if (Content.EndDate != newEndDate) {
    208219        DeregisterContentEvents();
    209220        Content.EndDate = newEndDate;
    210         endDateTimePicker.Value = newEndDate.HasValue ? newEndDate.Value : Content.StartDate;
    211221        RegisterContentEvents();
    212222      }
  • branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.cs

    r15966 r15992  
    110110      bool enabled = Content != null && !Locked && !ReadOnly;
    111111      refreshButton.Enabled = enabled;
    112       addButton.Enabled = enabled;
    113       removeButton.Enabled = enabled;
    114       saveProjectButton.Enabled = enabled;
     112      //addButton.Enabled = enabled;
     113      //removeButton.Enabled = enabled;
     114      //saveProjectButton.Enabled = enabled;
    115115      projectView.Enabled = enabled;
    116116      projectPermissionsView.Enabled = enabled;
     
    199199      Guid? parentProjectId = null;
    200200
     201      if(selectedProject == null && !IsAdmin()) {
     202        MessageBox.Show(
     203          "You are not allowed to add a root project - please select a parent project.",
     204          "HeuristicLab Hive Administrator",
     205          MessageBoxButtons.OK,
     206          MessageBoxIcon.Information);
     207        return;
     208      }
     209     
    201210      if (selectedProject != null && selectedProject.Id == Guid.Empty) {
    202211        MessageBox.Show(
     
    459468      bool projectIsNew = project != null && project.Id == Guid.Empty;
    460469      bool locked = project == null || projectIsNew;
     470
     471      // if the project is new, or:
     472      // the project does have any descendant projects and
     473      // the user is an admin or owner of a parent project
    461474      bool deleteEnabled = project != null && (
    462475        projectIsNew
    463         || HiveAdminClient.Instance.CheckOwnershipOfParentProject(project, UserInformation.Instance.User.Id)
    464         || !HiveAdminClient.Instance.ProjectDescendants[project.Id].Any());
    465 
    466       addButton.Enabled = !locked;
     476        ||  (!HiveAdminClient.Instance.ProjectDescendants[project.Id].Any()
     477              && (HiveAdminClient.Instance.CheckOwnershipOfParentProject(project, UserInformation.Instance.User.Id)
     478              || IsAdmin())
     479            )
     480      );
     481
     482      bool addEnabled = !locked;
     483      if (!IsAdmin() && project == null) addEnabled = false;
     484
     485      bool saveEnabled = project != null;
     486      if (!IsAdmin() && !project.ParentProjectId.HasValue) saveEnabled = false;
     487
     488      addButton.Enabled = addEnabled;
    467489      removeButton.Enabled = deleteEnabled;
     490      saveProjectButton.Enabled = saveEnabled;
    468491      projectPermissionsView.Locked = locked;
    469492      projectResourcesView.Locked = locked;
Note: See TracChangeset for help on using the changeset viewer.