Package org.dspace.content

Examples of org.dspace.content.Community


        // Build log information
        String logInfo = "";

        // Get our location
        Community community = UIUtil.getCommunityLocation(request);
        Collection collection = UIUtil.getCollectionLocation(request);

        // get the start of the query results page
        //        List resultObjects = null;
        qArgs.setQuery(query);
        qArgs.setStart(start);

        // Perform the search
        if (collection != null)
        {
            logInfo = "collection_id=" + collection.getID() + ",";

            // Values for drop-down box
            request.setAttribute("community", community);
            request.setAttribute("collection", collection);

            qResults = DSQuery.doQuery(context, qArgs, collection);
        }
        else if (community != null)
        {
            logInfo = "community_id=" + community.getID() + ",";

            request.setAttribute("community", community);

            // Get the collections within the community for the dropdown box
            request
                    .setAttribute("collection.array", community
                            .getCollections());

            qResults = DSQuery.doQuery(context, qArgs, community);
        }
        else
View Full Code Here


            // set the links' reference - community or collection
          boolean commLinks = feedData.startsWith("comm:");
          boolean collLinks = feedData.startsWith("coll:");
          if ( commLinks )
          {
                Community com = (Community)request.getAttribute("dspace.community");
            request.setAttribute("dspace.layout.feedref", com.getHandle());
          }
          else if( collLinks )
          {
            Collection col = (Collection)request.getAttribute("dspace.collection");
            request.setAttribute("dspace.layout.feedref", col.getHandle());
View Full Code Here

    }
 
  public void addBody(Body body) throws WingException, SQLException, AuthorizeException
  {
    int communityID = parameters.getParameterAsInteger("communityID", -1);
    Community parentCommunity = Community.find(context, communityID);
   
    // DIVISION: main
      Division main = body.addInteractiveDivision("create-community",contextPath+"/admin/community",Division.METHOD_MULTIPART,"primary administrative community");
      /* Whether the parent community is null is what determines if
      we are creating a top-level community or a sub-community */
      if (parentCommunity != null)
        main.setHead(T_main_head_sub.parameterize(parentCommunity.getMetadata("name")));
      else
        main.setHead(T_main_head_top);
         
     
      // The grand list of metadata options
View Full Code Here

    }
 
  public void addBody(Body body) throws WingException, SQLException, AuthorizeException
  {
    int communityID = parameters.getParameterAsInteger("communityID", -1);
    Community thisCommunity = Community.find(context, communityID);
   
   
    // DIVISION: main
      Division main = body.addInteractiveDivision("community-confirm-delete",contextPath+"/admin/community",Division.METHOD_POST,"primary administrative community");
      main.setHead(T_main_head.parameterize(communityID));
      main.addPara(T_main_para.parameterize(thisCommunity.getMetadata("name")));     
      List deleteConfirmHelp = main.addList("consequences",List.TYPE_BULLETED);
      deleteConfirmHelp.addItem(T_confirm_item1);
      deleteConfirmHelp.addItem(T_confirm_item2);
      deleteConfirmHelp.addItem(T_confirm_item3);
      deleteConfirmHelp.addItem(T_confirm_item4);
View Full Code Here

        // Build log information
        String logInfo = "";

        // Get our location
        Community community = UIUtil.getCommunityLocation(request);
        Collection collection = UIUtil.getCollectionLocation(request);

        // get the start of the query results page
        // List resultObjects = null;
        qArgs.setQuery(query);
        qArgs.setStart(start);

        // Perform the search
        if (collection != null)
        {
            logInfo = "collection_id=" + collection.getID() + ",";

            // Values for drop-down box
            request.setAttribute("community", community);
            request.setAttribute("collection", collection);

            qResults = DSQuery.doQuery(context, qArgs, collection);
        }
        else if (community != null)
        {
            logInfo = "community_id=" + community.getID() + ",";

            request.setAttribute("community", community);

            // Get the collections within the community for the dropdown box
            request
                    .setAttribute("collection.array", community
                            .getCollections());

            qResults = DSQuery.doQuery(context, qArgs, community);
        }
        else
View Full Code Here

    }
 
  public void addBody(Body body) throws WingException, SQLException, AuthorizeException
  {
        int communityID = parameters.getParameterAsInteger("communityID", -1);
        Community thisCommunity = Community.find(context, communityID);
   
    String baseURL = contextPath + "/admin/community?administrative-continue=" + knot.getId();
   
    Group admins = thisCommunity.getAdministrators();

    // DIVISION: main
      Division main = body.addInteractiveDivision("community-assign-roles",contextPath+"/admin/community",Division.METHOD_POST,"primary administrative community");
        main.setHead(T_main_head.parameterize(thisCommunity.getName()));
     
      List options = main.addList("options", List.TYPE_SIMPLE, "horizontal");
      options.addItem().addXref(baseURL+"&submit_metadata",T_options_metadata);
      options.addItem().addHighlight("bold").addXref(baseURL+"&submit_roles",T_options_roles);
View Full Code Here

   */
  public static FlowResult processCreateCollection(Context context, int communityID, Request request) throws SQLException, AuthorizeException, IOException
  {
    FlowResult result = new FlowResult();
   
    Community parent = Community.find(context, communityID);
    Collection newCollection = parent.createCollection();
   
    // Get the metadata
    String name = request.getParameter("name");
    String shortDescription = request.getParameter("short_description");
    String introductoryText = request.getParameter("introductory_text");
View Full Code Here

   */
  public static FlowResult processCreateCommunity(Context context, int communityID, Request request) throws AuthorizeException, IOException, SQLException
  {
    FlowResult result = new FlowResult();

    Community parent = Community.find(context, communityID);
    Community newCommunity;
   
    if (parent != null)
      newCommunity = parent.createSubcommunity();
    else
      newCommunity = Community.create(null, context);
   
    String name = request.getParameter("name");
    String shortDescription = request.getParameter("short_description");
    String introductoryText = request.getParameter("introductory_text");
    String copyrightText = request.getParameter("copyright_text");
    String sideBarText = request.getParameter("side_bar_text");

    // If they don't have a name then make it untitled.
    if (name == null || name.length() == 0)
      name = "Untitled";

    // If empty, make it null.
    if (shortDescription != null && shortDescription.length() == 0)
      shortDescription = null;
    if (introductoryText != null && introductoryText.length() == 0)
      introductoryText = null;
    if (copyrightText != null && copyrightText.length() == 0)
      copyrightText = null;
    if (sideBarText != null && sideBarText.length() == 0)
      sideBarText = null;
   
    newCommunity.setMetadata("name", name);
    newCommunity.setMetadata("short_description", shortDescription);
    newCommunity.setMetadata("introductory_text", introductoryText);
    newCommunity.setMetadata("copyright_text", copyrightText);
    newCommunity.setMetadata("side_bar_text", sideBarText);
       
      // Upload the logo
    Object object = request.get("logo");
    Part filePart = null;
    if (object instanceof Part)
      filePart = (Part) object;

    if (filePart != null && filePart.getSize() > 0)
    {
      InputStream is = filePart.getInputStream();
     
      newCommunity.setLogo(is);
    }
       
    // Save everything
    newCommunity.update();
        context.commit();
        // success
        result.setContinue(true);
        result.setOutcome(true);
        result.setMessage(new Message("default","The community was successfully created."));
        result.setParameter("communityID", newCommunity.getID());
   
    return result;
  }
View Full Code Here

    }
 
  public void addBody(Body body) throws WingException, SQLException, AuthorizeException
  {
    int communityID = parameters.getParameterAsInteger("communityID", -1);
    Community thisCommunity = Community.find(context, communityID);

    String baseURL = contextPath + "/admin/community?administrative-continue=" + knot.getId();

      String short_description_error = FlowContainerUtils.checkXMLFragment(thisCommunity.getMetadata("short_description"));
      String introductory_text_error = FlowContainerUtils.checkXMLFragment(thisCommunity.getMetadata("introductory_text"));
      String copyright_text_error = FlowContainerUtils.checkXMLFragment(thisCommunity.getMetadata("copyright_text"));
      String side_bar_text_error = FlowContainerUtils.checkXMLFragment(thisCommunity.getMetadata("side_bar_text"));
     
    // DIVISION: main
      Division main = body.addInteractiveDivision("community-metadata-edit",contextPath+"/admin/community",Division.METHOD_MULTIPART,"primary administrative community");
      main.setHead(T_main_head.parameterize(thisCommunity.getName()));
     
        List options = main.addList("options",List.TYPE_SIMPLE,"horizontal");
        options.addItem().addHighlight("bold").addXref(baseURL+"&submit_metadata",T_options_metadata);
        options.addItem().addXref(baseURL+"&submit_roles",T_options_roles);
     
      // The grand list of metadata options
      List metadataList = main.addList("metadataList", "form");
     
      // community name
      metadataList.addLabel(T_label_name);
      Text name = metadataList.addItem().addText("name");
      name.setSize(40);
      name.setValue(thisCommunity.getMetadata("name"));
     
      // short description
      metadataList.addLabel(T_label_short_description);
      Text short_description = metadataList.addItem().addText("short_description");
      short_description.setValue(thisCommunity.getMetadata("short_description"));
      short_description.setSize(40);
      if (short_description_error != null)
        short_description.addError(short_description_error);
     
      // introductory text
      metadataList.addLabel(T_label_introductory_text);
      TextArea introductory_text = metadataList.addItem().addTextArea("introductory_text");
      introductory_text.setValue(thisCommunity.getMetadata("introductory_text"));
      introductory_text.setSize(6, 40);
      if (introductory_text_error != null)
        introductory_text.addError(introductory_text_error);
     
      // copyright text
      metadataList.addLabel(T_label_copyright_text);
      TextArea copyright_text = metadataList.addItem().addTextArea("copyright_text");
      copyright_text.setValue(thisCommunity.getMetadata("copyright_text"));
      copyright_text.setSize(6, 40);
      if (copyright_text_error != null)
        copyright_text.addError(copyright_text_error);
     
      // legacy sidebar text; may or may not be used for news
      metadataList.addLabel(T_label_side_bar_text);
      TextArea side_bar_text = metadataList.addItem().addTextArea("side_bar_text");
      side_bar_text.setValue(thisCommunity.getMetadata("side_bar_text"));
      side_bar_text.setSize(6, 40);
      if (side_bar_text_error != null)
        side_bar_text.addError(side_bar_text_error);
           
      // the row to upload a new logo
      metadataList.addLabel(T_label_logo);
      metadataList.addItem().addFile("logo");

      // the row displaying an existing logo
      Item item;
      if (thisCommunity.getLogo() != null) {
        metadataList.addLabel(T_label_existing_logo);
        item = metadataList.addItem();
        item.addFigure(contextPath + "/bitstream/id/" + thisCommunity.getLogo().getID() + "/bob.jpg", null, null);
        item.addButton("submit_delete_logo").setValue(T_submit_delete_logo);
      }
     
      Para buttonList = main.addPara();
      buttonList.addButton("submit_save").setValue(T_submit_update);
View Full Code Here

   */
  public static FlowResult processEditCommunity(Context context, int communityID, boolean deleteLogo, Request request) throws AuthorizeException, IOException, SQLException
  {
    FlowResult result = new FlowResult();

    Community community = Community.find(context, communityID);
   
    String name = request.getParameter("name");
    String shortDescription = request.getParameter("short_description");
    String introductoryText = request.getParameter("introductory_text");
    String copyrightText = request.getParameter("copyright_text");
    String sideBarText = request.getParameter("side_bar_text");

    // If they don't have a name then make it untitled.
    if (name == null || name.length() == 0)
      name = "Untitled";

    // If empty, make it null.
    if (shortDescription != null && shortDescription.length() == 0)
      shortDescription = null;
    if (introductoryText != null && introductoryText.length() == 0)
      introductoryText = null;
    if (copyrightText != null && copyrightText.length() == 0)
      copyrightText = null;
    if (sideBarText != null && sideBarText.length() == 0)
      sideBarText = null;
   
    // Save the data
    community.setMetadata("name", name);
    community.setMetadata("short_description", shortDescription);
        community.setMetadata("introductory_text", introductoryText);
        community.setMetadata("copyright_text", copyrightText);
        community.setMetadata("side_bar_text", sideBarText);
       
        if (deleteLogo)
        {
          // Remove the logo
          community.setLogo(null);
        }
        else
        {
          // Update the logo
        Object object = request.get("logo");
        Part filePart = null;
        if (object instanceof Part)
          filePart = (Part) object;

        if (filePart != null && filePart.getSize() > 0)
        {
          InputStream is = filePart.getInputStream();
         
          community.setLogo(is);
        }
        }
       
        // Save everything
        community.update();
        context.commit();
       
        // No notice...
        result.setContinue(true);
    return result;
View Full Code Here

TOP

Related Classes of org.dspace.content.Community

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.