コード例 #1
0
ファイル: RestoreVersionForm.java プロジェクト: Yizina/DSpace
  private void createTable(Division main) throws WingException {
    // Get all our parameters
    String id = parameters.getParameter("versionID", null);

    Table table = main.addTable("version", 1, 1);

    Row header = table.addRow(Row.ROLE_HEADER);
    header.addCellContent(T_column1);
    header.addCellContent(T_column2);
    header.addCellContent(T_column3);
    header.addCellContent(T_column4);

    VersioningService versioningService = new DSpace().getSingletonService(VersioningService.class);
    Version version = versioningService.getVersion(context, Integer.parseInt(id));

    Row row = table.addRow();
    row.addCell().addContent(version.getVersionNumber());
    row.addCell().addContent(version.getEperson().getEmail());
    row.addCell().addContent(new DCDate(version.getVersionDate()).toString());
    row.addCell().addContent(version.getSummary());

    List fields = main.addList("fields", List.TYPE_FORM);
    Composite addComposite = fields.addItem().addComposite("summary");
    addComposite.setLabel(T_column4);
    addComposite.addTextArea("summary");
  }
コード例 #2
0
  private void renderMainPage(Division div) throws WingException {
    Table table = div.addTable("workflow-actions", 1, 1);
    table.setHead(T_info1);

    // Approve task
    Row row = table.addRow();
    row.addCellContent(T_approve_help);
    row.addCell().addButton("submit_approve").setValue(T_approve_submit);

    // Reject item
    row = table.addRow();
    row.addCellContent(T_reject_help);
    row.addCell().addButton("submit_reject").setValue(T_reject_submit);

    // Edit metadata
    row = table.addRow();
    row.addCellContent(T_edit_help);
    row.addCell().addButton("submit_edit").setValue(T_edit_submit);

    // Everyone can just cancel
    row = table.addRow();
    row.addCell(0, 2).addButton("submit_leave").setValue(T_cancel_submit);

    div.addHidden("page").setValue(ReviewAction.MAIN_PAGE);
  }
コード例 #3
0
ファイル: UploadStep.java プロジェクト: atmire/RIOXX52
  public void addBody(Body body)
      throws SAXException, WingException, UIException, SQLException, IOException,
          AuthorizeException {
    // If we are actually editing information of an uploaded file,
    // then display that body instead!
    if (this.editFile != null) {
      editFile.addBody(body);
      return;
    }

    // Get a list of all files in the original bundle
    Item item = submission.getItem();
    Collection collection = submission.getCollection();
    String actionURL =
        contextPath + "/handle/" + collection.getHandle() + "/submit/" + knot.getId() + ".continue";
    boolean disableFileEditing =
        (submissionInfo.isInWorkflow())
            && !ConfigurationManager.getBooleanProperty("workflow", "reviewer.file-edit");
    Bundle[] bundles = item.getBundles("ORIGINAL");
    Bitstream[] bitstreams = new Bitstream[0];
    if (bundles.length > 0) {
      bitstreams = bundles[0].getBitstreams();
    }

    // Part A:
    //  First ask the user if they would like to upload a new file (may be the first one)
    Division div =
        body.addInteractiveDivision(
            "submit-upload", actionURL, Division.METHOD_MULTIPART, "primary submission");
    div.setHead(T_submission_head);
    addSubmissionProgressList(div);

    List upload = null;
    if (!disableFileEditing) {
      // Only add the upload capabilities for new item submissions
      upload = div.addList("submit-upload-new", List.TYPE_FORM);
      upload.setHead(T_head);
      addRioxxVersionSection(upload, item);

      File file = upload.addItem().addFile("file");
      file.setLabel(T_file);
      file.setHelp(T_file_help);
      file.setRequired();

      // if no files found error was thrown by processing class, display it!
      if (this.errorFlag == org.dspace.submit.step.UploadStep.STATUS_NO_FILES_ERROR) {
        file.addError(T_file_error);
      }

      // if an upload error was thrown by processing class, display it!
      if (this.errorFlag == org.dspace.submit.step.UploadStep.STATUS_UPLOAD_ERROR) {
        file.addError(T_upload_error);
      }

      // if virus checking was attempted and failed in error then let the user know
      if (this.errorFlag == org.dspace.submit.step.UploadStep.STATUS_VIRUS_CHECKER_UNAVAILABLE) {
        file.addError(T_virus_checker_error);
      }

      // if virus checking was attempted and a virus found then let the user know
      if (this.errorFlag == org.dspace.submit.step.UploadStep.STATUS_CONTAINS_VIRUS) {
        file.addError(T_virus_error);
      }

      Text description = upload.addItem().addText("description");
      description.setLabel(T_description);
      description.setHelp(T_description_help);

      Button uploadSubmit = upload.addItem().addButton("submit_upload");
      uploadSubmit.setValue(T_submit_upload);
    }

    make_sherpaRomeo_submission(item, div);

    // Part B:
    //  If the user has already uploaded files provide a list for the user.
    if (bitstreams.length > 0 || disableFileEditing) {
      Table summary = div.addTable("submit-upload-summary", (bitstreams.length * 2) + 2, 7);
      summary.setHead(T_head2);

      Row header = summary.addRow(Row.ROLE_HEADER);
      header.addCellContent(T_column0); // primary bitstream
      header.addCellContent(T_column1); // select checkbox
      header.addCellContent(T_column2); // file name
      header.addCellContent(T_column3); // size
      header.addCellContent(T_column4); // description
      header.addCellContent(T_column5); // format
      header.addCellContent(T_column6); // edit button

      for (Bitstream bitstream : bitstreams) {
        int id = bitstream.getID();
        String name = bitstream.getName();
        String url = makeBitstreamLink(item, bitstream);
        long bytes = bitstream.getSize();
        String desc = bitstream.getDescription();
        String algorithm = bitstream.getChecksumAlgorithm();
        String checksum = bitstream.getChecksum();

        Row row = summary.addRow();

        // Add radio-button to select this as the primary bitstream
        Radio primary = row.addCell().addRadio("primary_bitstream_id");
        primary.addOption(String.valueOf(id));

        // If this bitstream is already marked as the primary bitstream
        // mark it as such.
        if (bundles[0].getPrimaryBitstreamID() == id) {
          primary.setOptionSelected(String.valueOf(id));
        }

        if (!disableFileEditing) {
          // Workflow users can not remove files.
          CheckBox remove = row.addCell().addCheckBox("remove");
          remove.setLabel("remove");
          remove.addOption(id);
        } else {
          row.addCell();
        }

        row.addCell().addXref(url, name);
        row.addCellContent(bytes + " bytes");
        if (desc == null || desc.length() == 0) {
          row.addCellContent(T_unknown_name);
        } else {
          row.addCellContent(desc);
        }

        BitstreamFormat format = bitstream.getFormat();
        if (format == null) {
          row.addCellContent(T_unknown_format);
        } else {
          int support = format.getSupportLevel();
          Cell cell = row.addCell();
          cell.addContent(format.getMIMEType());
          cell.addContent(" ");
          switch (support) {
            case 1:
              cell.addContent(T_supported);
              break;
            case 2:
              cell.addContent(T_known);
              break;
            case 3:
              cell.addContent(T_unsupported);
              break;
          }
        }

        Button edit = row.addCell().addButton("submit_edit_" + id);
        edit.setValue(T_submit_edit);

        Row checksumRow = summary.addRow();
        checksumRow.addCell();
        Cell checksumCell = checksumRow.addCell(null, null, 0, 6, null);
        checksumCell.addHighlight("bold").addContent(T_checksum);
        checksumCell.addContent(" ");
        checksumCell.addContent(algorithm + ":" + checksum);
      }

      if (!disableFileEditing) {
        // Workflow users can not remove files.
        Row actionRow = summary.addRow();
        actionRow.addCell();
        Button removeSeleceted =
            actionRow.addCell(null, null, 0, 6, null).addButton("submit_remove_selected");
        removeSeleceted.setValue(T_submit_remove);
      }

      upload = div.addList("submit-upload-new-part2", List.TYPE_FORM);
    }

    // Part C:
    // add standard control/paging buttons
    addControlButtons(upload);
  }
コード例 #4
0
ファイル: AccessStepUtil.java プロジェクト: UWLibrary/DSpace
  public void addTablePolicies(Division parent, DSpaceObject dso, Collection owningCollection)
      throws WingException, SQLException {
    if (!isAdvancedFormEnabled) {
      return;
    }
    Division div = parent.addDivision("access-existing-policies");
    div.setHead(T_head_policies_table);
    div.addPara(T_policies_help.parameterize(owningCollection));

    java.util.List<ResourcePolicy> resourcePolicies =
        authorizeService.findPoliciesByDSOAndType(context, dso, ResourcePolicy.TYPE_CUSTOM);

    if (resourcePolicies.isEmpty()) {
      div.addPara(T_no_policies);
      return;
    }

    int cols = resourcePolicies.size();
    if (cols == 0) cols = 1;
    Table policies = div.addTable("policies", 6, cols);
    Row header = policies.addRow(Row.ROLE_HEADER);

    header.addCellContent(T_column0); // name
    header.addCellContent(T_column1); // action
    header.addCellContent(T_column2); // group
    header.addCellContent(T_column3); // start_date
    header.addCellContent(T_column4); // end_date

    for (ResourcePolicy rp : resourcePolicies) {
      int id = rp.getID();

      String name = "";
      if (rp.getRpName() != null) name = rp.getRpName();

      String action = resourcePolicyService.getActionText(rp);

      // if it is the default policy for the Submitter don't show it.
      if (dso instanceof org.dspace.content.Item) {
        org.dspace.content.Item item = (org.dspace.content.Item) dso;
        if (rp.getEPerson() != null) {
          if (item.getSubmitter().equals(rp.getEPerson())) continue;
        }
      }

      String group = "";
      if (rp.getGroup() != null) group = rp.getGroup().getName();

      Row row = policies.addRow();

      row.addCellContent(name);
      row.addCellContent(action);
      row.addCellContent(group);

      // start
      String startDate = "";
      if (rp.getStartDate() != null) {
        startDate = DateFormatUtils.format(rp.getStartDate(), "yyyy-MM-dd");
      }
      row.addCellContent(startDate);

      // endDate
      String endDate = "";
      if (rp.getEndDate() != null) {
        endDate = DateFormatUtils.format(rp.getEndDate(), "yyyy-MM-dd");
      }
      row.addCellContent(endDate);

      Button edit = row.addCell().addButton("submit_edit_edit_policies_" + id);
      edit.setValue(T_table_submit_edit);

      Button delete = row.addCell().addButton("submit_delete_edit_policies_" + id);
      delete.setValue(T_table_submit_delete);
    }
  }