Package org.dspace.app.xmlui.wing.element

Examples of org.dspace.app.xmlui.wing.element.Table


         
      results.setSimplePagination(resultCount,firstIndex,lastIndex,prevURL, nextURL);
    }
   
    /* Set up a table with search results (if there are any). */
    Table table = results.addTable("group-edit-search-eperson",epeople.length + 1, 1);
    Row header = table.addRow(Row.ROLE_HEADER);
    header.addCell().addContent(T_epeople_column1);
    header.addCell().addContent(T_epeople_column2);
    header.addCell().addContent(T_epeople_column3);
    header.addCell().addContent(T_epeople_column4);

    for (EPerson person : epeople)
    {
      String epersonID = String.valueOf(person.getID());
      String fullName = person.getFullName();
      String email = person.getEmail();
      String url = contextPath+"/admin/epeople?administrative-continue="+knot.getId()+"&submit_edit_eperson&epersonID="+epersonID;
     
     
     
      Row personData = table.addRow();

      personData.addCell().addContent(person.getID());
      personData.addCell().addXref(url, fullName);
      personData.addCell().addXref(url, email);
     
      // check if they are already a member of the group
      if (memberEPeopleIDs.contains(person.getID()))
      {
        // Check if they really members or just pending members
        if (group != null && group.isMember(person))
                {
                    personData.addCellContent(T_member);
                }
        else
                {
                    personData.addCell().addHighlight("warn").addContent(T_pending);
                }
      }
      else
      {
        personData.addCell().addButton("submit_add_eperson_"+epersonID).setValue(T_submit_add);
      }
    }

    if (epeople.length <= 0) {
      table.addRow().addCell(1, 4).addContent(T_no_results);
    }
  }
View Full Code Here


            }
         
      results.setSimplePagination(resultCount,firstIndex,lastIndex,prevURL, nextURL);
    }
   
        Table table = results.addTable("roup-edit-search-group",groups.length + 1, 1);
        Row header = table.addRow(Row.ROLE_HEADER);
        header.addCell().addContent(T_groups_column1);
        header.addCell().addContent(T_groups_column2);
        header.addCell().addContent(T_groups_column3);
        header.addCell().addContent(T_groups_column4);
        header.addCell().addContent(T_groups_column5)
       
        for (Group group : groups)
        {
          String groupID = String.valueOf(group.getID());
          String name = group.getName();
          String url = contextPath+"/admin/groups?administrative-continue="+knot.getId()+"&submit_edit_group&groupID="+groupID;
          int memberCount = group.getMembers().length + group.getMemberGroups().length;
         
          Row row = table.addRow();
           
          row.addCell().addContent(groupID);
          if (AuthorizeManager.isAdmin(context))
            // Only administrators can edit other groups.
            {
                row.addCell().addXref(url, name);
            }
          else
            {
                row.addCell().addContent(name);
            }
         
         
         
          row.addCell().addContent(memberCount == 0 ? "-" : String.valueOf(memberCount));
         
          Cell cell = row.addCell();
          if (FlowGroupUtils.getCollectionId(group.getName()) > -1)
          {
            Collection collection = Collection.find(context, FlowGroupUtils.getCollectionId(group.getName()) );
            if (collection != null)
            {
              String collectionName = collection.getMetadata("name");
             
              if (collectionName == null)
                    {
                        collectionName = "";
                    }
              else if (collectionName.length() > MAX_COLLECTION_NAME)
                    {
                        collectionName = collectionName.substring(0, MAX_COLLECTION_NAME - 3) + "...";
                    }
             
              cell.addContent(collectionName+" ");
             
              Highlight highlight = cell.addHighlight("fade");
              highlight.addContent("[");
              highlight.addXref(contextPath+"/handle/"+collection.getHandle(), T_groups_collection_link);
              highlight.addContent("]");
            }
          }
         
         
          // Check if the group is already a member or would create a cycle.
          if (memberGroupIDs.contains(group.getID()))
          {
            // Check if they really members or just pending members
        if (parent != null && parent.isMember(group))
                {
                    row.addCellContent(T_member);
                }
        else
                {
                    row.addCell().addHighlight("warn").addContent(T_pending);
                }
          }
          else if (isDescendant(sourceGroup, group, memberGroupIDs))
          {
            row.addCellContent(T_cycle);
          }
          else
          {
            row.addCell().addButton("submit_add_group_"+groupID).setValue(T_submit_add);
          }
           
        }
        if (groups.length <= 0) {
      table.addRow().addCell(1, 4).addContent(T_no_results);
    }
  }
View Full Code Here

        boolean changes = false;
       
        Division members = div.addDivision("group-edit-members");
        members.setHead(T_members_head);
       
        Table table = members.addTable("group-edit-members-table",memberGroupIDs.size() + memberEPeopleIDs.size() + 1, 4);
       
        Row header = table.addRow(Row.ROLE_HEADER);
        header.addCell().addContent(T_members_column1);
        header.addCell().addContent(T_members_column2);
        header.addCell().addContent(T_members_column3);
        header.addCell().addContent(T_members_column4);
       
        // get all group members, pend or actual
        @SuppressWarnings("unchecked") // the cast is correct
        List<Integer> allMemberGroupIDs = new ArrayList<Integer>(memberGroupIDs);
        for (Group group : parent.getMemberGroups())
        {
          if (!allMemberGroupIDs.contains(group.getID()))
            {
                allMemberGroupIDs.add(group.getID());
            }
        }
        // Sort them to a consistent ordering
        Collections.sort(allMemberGroupIDs);
       
        // Loop through all group ids and display them.
        for (Integer groupID : allMemberGroupIDs)
        {
          Group group = Group.find(context,groupID);
          boolean highlight = (group.getID() == highlightGroupID);
          boolean pendingAddition = !parent.isMember(group);
          boolean pendingRemoval = !memberGroupIDs.contains(groupID);
          addMemberRow(table, group, highlight,pendingAddition,pendingRemoval);  
         
          if (pendingAddition || pendingRemoval)
            {
                changes = true;
            }
        }
       
       
        // get all members, pend or actual
        @SuppressWarnings("unchecked") // the cast is correct
        List<Integer> allMemberEPeopleIDs = new ArrayList<Integer>(memberEPeopleIDs);
        for (EPerson eperson : parent.getMembers())
        {
          if (!allMemberEPeopleIDs.contains(eperson.getID()))
            {
                allMemberEPeopleIDs.add(eperson.getID());
            }
        }
        // Sort them to a consistent ordering
        Collections.sort(allMemberEPeopleIDs);
       
        for (Integer epersonID : allMemberEPeopleIDs)
        {
          EPerson eperson = EPerson.find(context, epersonID);
          boolean highlight = (eperson.getID() == highlightEPersonID);
          boolean pendingAddition = !parent.isMember(eperson);
          boolean pendingRemoval = !memberEPeopleIDs.contains(epersonID);
          addMemberRow(table,eperson,highlight,pendingAddition,pendingRemoval);
         
          if (pendingAddition || pendingRemoval)
            {
                changes = true;
            }
        }
   
        if (allMemberGroupIDs.size() <= 0 && allMemberEPeopleIDs.size() <= 0)
        {
          table.addRow().addCell(1, 4).addContent(T_members_none);
        }
       
        return changes;
  }
View Full Code Here

               

                // TABLE: Metadata
                main.addHidden("scope").setValue("*");
                int index = 1;
                Table table = main.addTable("editItemMetadata",1,1);
                table.setHead(T_head2);

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

                ChoiceAuthorityManager cmgr = ChoiceAuthorityManager.getManager();
                for(Metadatum value : values)
                {
                        String name = value.schema + "_" + value.element;
                        if (value.qualifier != null)
                        {
                            name += "_" + value.qualifier;
                        }

                        Row row = table.addRow(name,Row.ROLE_DATA,"metadata-value");

                        CheckBox remove = row.addCell().addCheckBox("remove_"+index);
                        remove.setLabel("remove");
                        remove.addOption(index);

View Full Code Here

            search.setSimplePagination(resultCount, firstIndex, lastIndex,
                    prevURL, nextURL);
        }


        Table table = search.addTable("groups-search-table", groups.length + 1,
                1);
        Row header = table.addRow(Row.ROLE_HEADER);
        header.addCell().addContent(T_search_column1);
        header.addCell().addContent(T_search_column2);
        header.addCell().addContent(T_search_column3);
        header.addCell().addContent(T_search_column4);
        header.addCell().addContent(T_search_column5);

        for (Group group : groups)
        {
            Row row;
            if (group.getID() == highlightID)
            {
                row = table.addRow(null, null, "highlight");
            }
            else
            {
                row = table.addRow();
            }

            if (group.getID() > 1)
            {
                CheckBox select = row.addCell().addCheckBox("select_group");
                select.setLabel(Integer.valueOf(group.getID()).toString());
                select.addOption(Integer.valueOf(group.getID()).toString());
            }
            else
            {
                // Don't allow the user to remove the administrative (id:1) or
                // anonymous group (id:0)
                row.addCell();
            }

            row.addCell().addContent(group.getID());
            row.addCell().addXref(baseURL + "&submit_edit&groupID="
                    + group.getID(), group.getName());

            int memberCount = group.getMembers().length
                    + group.getMemberGroups().length;
            row.addCell().addContent(memberCount == 0 ? "-" : String.valueOf(
                    memberCount));

            Cell cell = row.addCell();
            String groupName = group.getName();
            DSpaceObject collectionOrCommunity = null;
            String collectionOrCommunityName = null;
            int id;
            id = FlowGroupUtils.getCollectionId(groupName);
            if (id > -1)
            {
                Collection collection = Collection.find(context, id);
                if (collection != null)
                {
                    collectionOrCommunityName = collection.getMetadata("name");
                    collectionOrCommunity = collection;
                }
            }
            else
            {
                id = FlowGroupUtils.getCommunityId(groupName);
                if (id > -1)
                {
                    Community community = Community.find(context, id);
                    if (community != null)
                    {
                        collectionOrCommunityName = community.getMetadata("name");
                        collectionOrCommunity = community;
                    }
                }
            }
            if (collectionOrCommunity != null)
            {
                if (collectionOrCommunityName == null)
                {
                    collectionOrCommunityName = "";
                }
                else if (collectionOrCommunityName.length()
                        > MAX_COLLECTION_OR_COMMUNITY_NAME)
                {
                    collectionOrCommunityName = collectionOrCommunityName.substring(
                            0, MAX_COLLECTION_OR_COMMUNITY_NAME - 3) + "...";
                }

                cell.addContent(collectionOrCommunityName + " ");

                Highlight highlight = cell.addHighlight("fade");

                highlight.addContent("[");
                highlight.addXref(contextPath + "/handle/"
                        + collectionOrCommunity.getHandle(), T_collection_link);
                highlight.addContent("]");
            }

        }

        if (groups.length <= 0)
        {
            Cell cell = table.addRow().addCell(1, 5);
            cell.addHighlight("italic").addContent(T_no_results);
        }
        else
        {
            search.addPara().addButton("submit_delete").setValue(T_submit_delete);
View Full Code Here

    // DIVISION: bitstream-confirm-delete
    Division deleted = body.addInteractiveDivision("bitstreams-confirm-delete",contextPath+"/admin/item",Division.METHOD_POST,"primary administrative item");
    deleted.setHead(T_head1);
    deleted.addPara(T_para1);

    Table table = deleted.addTable("bitstreams-confirm-delete",bitstreams.size() + 1, 1);

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

    for (Bitstream bitstream : bitstreams)
    {
      String format = null;
      BitstreamFormat bitstreamFormat = bitstream.getFormat();
      if (bitstreamFormat != null)
            {
                format = bitstreamFormat.getShortDescription();
            }

      Row row = table.addRow();
      row.addCell().addContent(bitstream.getName());
      row.addCell().addContent(bitstream.getDescription());
      row.addCell().addContent(format);
    }
    Para buttons = deleted.addPara();
View Full Code Here

    }
   
    /* Adding a new policy link */
    main.addPara().addXref(baseURL + "&submit_add", T_add_link);
   
      Table table = main.addTable("container-policy-list",policies.size() + 1, 4);
        Row header = table.addRow(Row.ROLE_HEADER);
        header.addCell();
        header.addCell().addContent(T_head_id);
        header.addCell().addContent(T_head_action);
        header.addCell().addContent(T_head_group);

        if (policies != null)
        {
            for (ResourcePolicy policy : policies)
            {
                Row row;
                if (policy.getID() == highlightID)
                {
                    row = table.addRow(null, null, "highlight");
                }
                else
                {
                    row = table.addRow();
                }

                CheckBox select = row.addCell().addCheckBox("select_policy");
                select.setLabel(String.valueOf(policy.getID()));
                select.addOption(String.valueOf(policy.getID()));
View Full Code Here

    Division main = body.addInteractiveDivision("edit-item-policies",contextPath+"/admin/authorize",Division.METHOD_POST,"primary administrative authorization");
    main.setHead(T_main_head.parameterize(item.getHandle(),item.getID()));
    main.addPara().addHighlight("italic").addContent(T_main_para1);
    main.addPara().addHighlight("italic").addContent(T_main_para2);
   
      Table table = main.addTable("policies-confirm-delete",itemPolicies.size() + 3, 8);
        Row header = table.addRow(Row.ROLE_HEADER);
        header.addCell();
        header.addCell().addContent(T_head_id);
        header.addCell().addContent(T_head_name);
        header.addCell().addContent(T_head_action);
        header.addCell().addContent(T_head_group);
        header.addCell();
        header.addCell().addContent(T_head_start_date);
        header.addCell().addContent(T_head_end_date);


        // First, the item's policies are listed
        Row subheader = table.addRow(null,Row.ROLE_HEADER,"subheader");
        subheader.addCell(1, 7).addHighlight("bold").addContent(T_subhead_item);
        subheader.addCell().addHighlight("bold").addXref(baseURL + "&submit_add_item", T_add_itemPolicy_link);
       
        this.rowBuilder(baseURL, table, itemPolicies, item.getID(), Constants.ITEM, highlightID);
     
      // Next, one by one, we get the bundles
      for (Bundle bundle : bundles) {
        subheader = table.addRow(null,Row.ROLE_HEADER,"subheader");
        subheader.addCell(null, null, 1, 7, "indent").addHighlight("bold").addContent(T_subhead_bundle.parameterize(bundle.getName(),bundle.getID()));
        subheader.addCell().addHighlight("bold").addXref(baseURL + "&submit_add_bundle_" + bundle.getID(), T_add_bundlePolicy_link);

        ArrayList<ResourcePolicy> bundlePolicies = (ArrayList<ResourcePolicy>)AuthorizeManager.getPolicies(context, bundle);
        this.rowBuilder(baseURL, table, bundlePolicies, bundle.getID(), Constants.BUNDLE, highlightID);
       
        // And eventually to the bundle's bitstreams
        bitstreams = bundle.getBitstreams();
        for (Bitstream bitstream : bitstreams) {
          subheader = table.addRow(null,Row.ROLE_HEADER,"subheader");
            subheader.addCell(null, null, 1, 7, "doubleIndent").addContent(T_subhead_bitstream.parameterize(bitstream.getName(),bitstream.getID()));
            subheader.addCell().addXref(baseURL + "&submit_add_bitstream_" + bitstream.getID(), T_add_bitstreamPolicy_link);

            ArrayList<ResourcePolicy> bitstreamPolicies = (ArrayList<ResourcePolicy>)AuthorizeManager.getPolicies(context, bitstream);
            this.rowBuilder(baseURL, table, bitstreamPolicies, bitstream.getID(), Constants.BITSTREAM, highlightID);         
View Full Code Here

        div.addHidden("submission-continue").setValue(knot.getId());
    }

    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);

        // 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_submit_cancel);

        div.addHidden("page").setValue(ReviewAction.MAIN_PAGE);
    }
View Full Code Here

      options.addItem().addHighlight("bold").addXref(baseURL+"&submit_roles",T_options_roles);
      options.addItem().addXref(baseURL+"&submit_harvesting",T_options_harvest);
            options.addItem().addXref(baseURL+"&submit_curate",T_options_curate);
           
      // The table of admin roles
      Table rolesTable = main.addTable("roles-table", 6, 5);
      Row tableRow;
     
      // The header row
      Row tableHeader = rolesTable.addRow(Row.ROLE_HEADER);
      tableHeader.addCell().addContent(T_role_name);
      tableHeader.addCell().addContent(T_role_group);
      tableHeader.addCell().addContent(T_role_buttons);
      rolesTable.addRow();
           
     
      /*
       * The collection admins
       */
      // data row
      tableRow = rolesTable.addRow(Row.ROLE_DATA);
      tableRow.addCell(Cell.ROLE_HEADER).addContent(T_label_admins);
      if (admins != null)
      {
          try
            {
                AuthorizeUtil.authorizeManageAdminGroup(context, thisCollection);
                tableRow.addCell().addXref(baseURL + "&submit_edit_admin", admins.getName());
            }
          catch (AuthorizeException authex) {
                // add a notice, the user is not authorized to create/edit collection's admin group
                tableRow.addCell().addContent(T_not_allowed);
            }
            try
            {
                AuthorizeUtil.authorizeRemoveAdminGroup(context, thisCollection);
                tableRow.addCell().addButton("submit_delete_admin").setValue(T_delete);
            }
            catch (AuthorizeException authex)
            {
                // nothing to add, the user is not allowed to delete the group
            }
      }
      else
      {
        tableRow.addCell().addContent(T_no_role);
        try
            {
                AuthorizeUtil.authorizeManageAdminGroup(context, thisCollection);
                tableRow.addCell().addButton("submit_create_admin").setValue(T_create);
            }
            catch (AuthorizeException authex) {
                // add a notice, the user is not authorized to create/edit collection's admin group
                tableRow.addCell().addContent(T_not_allowed);
            }
      }
      // help and directions row
      tableRow = rolesTable.addRow(Row.ROLE_DATA);
      tableRow.addCell();
      tableRow.addCell(1,2).addHighlight("fade offset").addContent(T_help_admins);
     
      /*
       * The collection submitters
       */
      tableRow = rolesTable.addRow(Row.ROLE_DATA);
      tableRow.addCell(Cell.ROLE_HEADER).addContent(T_label_submitters);
      try
      {
          AuthorizeUtil.authorizeManageSubmittersGroup(context, thisCollection);
          if (submitters != null)
          {
            tableRow.addCell().addXref(baseURL + "&submit_edit_submit", submitters.getName());
                tableRow.addCell().addButton("submit_delete_submit").setValue(T_delete);
          }
          else
          {
            tableRow.addCell().addContent(T_no_role);
                tableRow.addCell().addButton("submit_create_submit").setValue(T_create);
          }
      }
      catch (AuthorizeException authex)
      {
          tableRow.addCell().addContent(T_not_allowed);
      }
      // help and directions row
      tableRow = rolesTable.addRow(Row.ROLE_DATA);
      tableRow.addCell();
      tableRow.addCell(1,2).addHighlight("fade offset").addContent(T_help_submitters);


      /*
       * The collection's default read authorizations
       */
      tableRow = rolesTable.addRow(Row.ROLE_DATA);
      tableRow.addCell(Cell.ROLE_HEADER).addContent(T_label_default_read);
      if (defaultRead == null)
      {
        // Custome reading permissions, we can't handle it, just provide a link to the
        // authorizations manager.
        tableRow.addCell(1,2).addContent(T_default_read_custom);
      }
      else if (defaultRead.getID() == Group.ANONYMOUS_ID) {
        // Anonymous reading
        tableRow.addCell().addContent(T_default_read_anonymous);
        addAdministratorOnlyButton(tableRow.addCell(),"submit_create_default_read",T_restrict);
      }
      else
      {
        // A specific group is dedicated to reading.
        tableRow.addCell().addXref(baseURL + "&submit_edit_default_read", defaultRead.getName());
        addAdministratorOnlyButton(tableRow.addCell(),"submit_delete_default_read",T_delete);
      }

        // help and directions row
        tableRow = rolesTable.addRow(Row.ROLE_DATA);
        tableRow.addCell();
        tableRow.addCell(1,2).addHighlight("fade offset").addContent(T_help_default_read);


         if(ConfigurationManager.getProperty("workflow","workflow.framework").equals("xmlworkflow")){
             try{
                 HashMap<String, Role> roles = WorkflowUtils.getAllExternalRoles(thisCollection);
                 addXMLWorkflowRoles(thisCollection, baseURL, roles, rolesTable);
             } catch (WorkflowConfigurationException e) {
                log.error(LogManager.getHeader(context, "error while getting collection roles", "Collection id: " + thisCollection.getID()));
             } catch (IOException e) {
                 log.error(LogManager.getHeader(context, "error while getting collection roles", "Collection id: " + thisCollection.getID()));
             }
         }else{
             addOriginalWorkflowRoles(thisCollection, baseURL, rolesTable);
         }

      try
      {
          AuthorizeUtil.authorizeManageCollectionPolicy(context, thisCollection);
        // add one last link to edit the raw authorizations
        Cell authCell =rolesTable.addRow().addCell(1,3);
        authCell.addXref(baseURL + "&submit_authorizations", T_edit_authorization);
      }
      catch (AuthorizeException authex) {
            // nothing to add, the user is not authorized to edit collection's policies
        }
View Full Code Here

TOP

Related Classes of org.dspace.app.xmlui.wing.element.Table

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.