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

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


  {     
    int itemID = parameters.getParameterAsInteger("itemID",-1);
    org.dspace.content.Item item = org.dspace.content.Item.find(context,itemID);
   
    // DIVISION: main div
    Division div = body.addInteractiveDivision("add-bitstream", contextPath+"/admin/item", Division.METHOD_MULTIPART, "primary administrative item");     

    // LIST: upload form
    List upload = div.addList("submit-upload-new", List.TYPE_FORM);
    upload.setHead(T_head1);   

    int bundleCount = 0; // record how many bundles we are able to upload too.
    Select select = upload.addItem().addSelect("bundle");
    select.setLabel(T_bundle_label);
   
    // Get the list of bundles to allow the user to upload too. Either use the default
    // or one supplied from the dspace.cfg.
    String bundleString = ConfigurationManager.getProperty("xmlui.bundle.upload");
        if (bundleString == null || bundleString.length() == 0)
          bundleString = DEFAULT_BUNDLE_LIST;
        String[] parts = bundleString.split(",");
        for (String part : parts)
        {
          if (addBundleOption(item,select,part.trim()))
            bundleCount++;
        }
        select.setOptionSelected("ORIGINAL");
   
    if (bundleCount == 0)
      select.setDisabled();
   

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

    if (bundleCount == 0)
      file.setDisabled();
   
    Text description = upload.addItem().addText("description");
    description.setLabel(T_description_label);
    description.setHelp(T_description_help);

    if (bundleCount == 0)
      description.setDisabled();
   
    if (bundleCount == 0)
      upload.addItem().addContent(T_no_bundles);
   
    // ITEM: actions
    Item actions = upload.addItem();
    Button button = actions.addButton("submit_upload");
    button.setValue(T_submit_upload);
    if (bundleCount == 0)
      button.setDisabled();
   
    actions.addButton("submit_cancel").setValue(T_submit_cancel);

    div.addHidden("administrative-continue").setValue(knot.getId());
 
View Full Code Here


       
    }
   
    public void addBody(Body body) throws WingException
    {
        Division verify = body.addDivision("verify-email","primary");

        verify.setHead(T_head);
       
        if (forgot)
        {
            EPersonUtils.forgottProgressList(verify, 1);
        }
        else
        {
            EPersonUtils.registrationProgressList(verify,1);
        }
       
        verify.addPara(T_para.parameterize(email));
    }
View Full Code Here

        + knot.getId() ;
   
    String link = baseURL + "&view_item" + (showFullItem?"":"&show=full");
    String tabLink = baseURL + "&view_item" + (!showFullItem?"":"&show=full");
    // DIVISION: main
    Division main = body.addInteractiveDivision("edit-item-status",
        contextPath + "/admin/item", Division.METHOD_POST,
        "primary administrative edit-item-status");
    main.setHead(T_option_head);

    // LIST: options
    List options = main.addList("options", List.TYPE_SIMPLE, "horizontal");
    options.addItem().addXref(
        baseURL + "&submit_status", T_option_status);
    options.addItem().addXref(baseURL + "&submit_bitstreams",
        T_option_bitstreams);
    options.addItem().addXref(baseURL + "&submit_metadata",
        T_option_metadata);
    options.addItem().addHighlight("bold").addXref(tabLink, T_option_view);

    // item
   
    Para showfullPara = main.addPara(null, "item-view-toggle item-view-toggle-top");

        if (showFullItem)
        {
            link = baseURL + "&view_item";
            showfullPara.addXref(link).addContent(T_show_simple);
        }
        else
        {
            link = baseURL + "&view_item&show=full";
            showfullPara.addXref(link).addContent(T_show_full);
        }

    ReferenceSet referenceSet;
    referenceSet = main.addReferenceSet("collection-viewer",
        showFullItem?ReferenceSet.TYPE_DETAIL_VIEW:ReferenceSet.TYPE_SUMMARY_VIEW);
    // Refrence the actual Item
    ReferenceSet appearsInclude = referenceSet.addReference(item)
        .addReferenceSet(ReferenceSet.TYPE_DETAIL_LIST, null, "hierarchy");
    appearsInclude.setHead(T_head_parent_collections);

    // Reference all collections the item appears in.
    for (Collection collection : item.getCollections()) {
      appearsInclude.addReference(collection);
    }
   
    showfullPara = main.addPara(null, "item-view-toggle item-view-toggle-bottom");

    if (showFullItem)
        {
            showfullPara.addXref(link).addContent(T_show_simple);
        }
View Full Code Here

        Community community = (Community) dso;
        Community[] subCommunities = community.getSubcommunities();
        Collection[] collections = community.getCollections();

        // Build the community viewer division.
        Division home = body.addDivision("community-home", "primary repository community");
        String name = community.getMetadata("name");
        if (name == null || name.length() == 0)
          home.setHead(T_untitled);
        else
          home.setHead(name);

        // The search / browse box.
        {
            Division search = home.addDivision("community-search-browse",
                    "secondary search-browse");

            // Search query
            Division query = search.addInteractiveDivision("community-search",
                    contextPath + "/handle/" + community.getHandle() + "/search",
                    Division.METHOD_POST, "secondary search");
           
            Para para = query.addPara("search-query", null);
            para.addContent(T_full_text_search);
            para.addContent(" ");
            para.addText("query");
            para.addContent(" ");
            para.addButton("submit").setValue(T_go);
            query.addPara().addXref(contextPath + "/handle/" + community.getHandle() + "/advanced-search", T_advanced_search_link);

            // Browse by list
            Division browseDiv = search.addDivision("community-browse","secondary browse");
            List browse = browseDiv.addList("community-browse", List.TYPE_SIMPLE,
                    "community-browse");
            browse.setHead(T_head_browse);
            String url = contextPath + "/handle/" + community.getHandle();

            try
            {
                // Get a Map of all the browse tables
                BrowseIndex[] bis = BrowseIndex.getBrowseIndices();
                for (BrowseIndex bix : bis)
                {
                    // Create a Map of the query parameters for this link
                    Map<String, String> queryParams = new HashMap<String, String>();

                    queryParams.put("type", bix.getName());

                    // Add a link to this browse
                    browse.addItemXref(super.generateURL(url + "/browse", queryParams),
                            message("xmlui.ArtifactBrowser.Navigation.browse_" + bix.getName()));
                }
            }
            catch (BrowseException bex)
            {
                browse.addItemXref(url + "/browse?type=title",T_browse_titles);
                browse.addItemXref(url + "/browse?type=author",T_browse_authors);
                browse.addItemXref(url + "/browse?type=dateissued",T_browse_dates);
            }
        }

        // Add main reference:
        {
          Division viewer = home.addDivision("community-view","secondary");
         
            ReferenceSet referenceSet = viewer.addReferenceSet("community-view",
                    ReferenceSet.TYPE_DETAIL_VIEW);
            Reference communityInclude = referenceSet.addReference(community);

            // If the community has any children communities also refrence them.
            if (subCommunities != null && subCommunities.length > 0)
            {
                ReferenceSet communityReferenceSet = communityInclude
                        .addReferenceSet(ReferenceSet.TYPE_SUMMARY_LIST,null,"hierarchy");

                communityReferenceSet.setHead(T_head_sub_communities);

                // Sub communities
                for (Community subCommunity : subCommunities)
                {
                    communityReferenceSet.addReference(subCommunity);
                }
            }
            if (collections != null && collections.length > 0)
            {
                ReferenceSet communityReferenceSet = communityInclude
                        .addReferenceSet(ReferenceSet.TYPE_SUMMARY_LIST,null,"hierarchy");

                communityReferenceSet.setHead(T_head_sub_collections);
                      

                // Sub collections
                for (Collection collection : collections)
                {
                    communityReferenceSet.addReference(collection);
                }

            }
        }// main refrence

        // Recently submitted items
        {
            java.util.List<BrowseItem> items = getRecentlySubmittedIems(community);

            Division lastSubmittedDiv = home
                    .addDivision("community-recent-submission","secondary recent-submission");
            lastSubmittedDiv.setHead(T_head_recent_submissions);
            ReferenceSet lastSubmitted = lastSubmittedDiv.addReferenceSet(
                    "collection-last-submitted", ReferenceSet.TYPE_SUMMARY_LIST,
                    null, "recent-submissions");
            for (BrowseItem item : items)
            {
                lastSubmitted.addReference(item);
View Full Code Here

    Item item = Item.find(context, itemID);
    String baseURL = contextPath+"/admin/item?administrative-continue="+knot.getId();
   
 
    // DIVISION: main
    Division main = body.addInteractiveDivision("edit-item-status", contextPath+"/admin/item", Division.METHOD_POST,"primary administrative edit-item-status");
    main.setHead(T_option_head);
   
   
   
   
    // LIST: options
    List options = main.addList("options",List.TYPE_SIMPLE,"horizontal");
    options.addItem().addHighlight("bold").addXref(baseURL+"&submit_status",T_option_status);
    options.addItem().addXref(baseURL+"&submit_bitstreams",T_option_bitstreams);
    options.addItem().addXref(baseURL+"&submit_metadata",T_option_metadata);
    options.addItem().addXref(baseURL + "&view_item", T_option_view);
   
   
   
   
   
    // PARA: Helpfull instructions
    main.addPara(T_para1);
   
   
   

   
    // LIST: Item meta-meta information
    List itemInfo = main.addList("item-info");
   
    itemInfo.addLabel(T_label_id);
    itemInfo.addItem(String.valueOf(item.getID()));
   
    itemInfo.addLabel(T_label_handle);
    itemInfo.addItem(item.getHandle()==null?"None":item.getHandle());
   
    itemInfo.addLabel(T_label_modified);
    itemInfo.addItem(item.getLastModified().toString());
   
    itemInfo.addLabel(T_label_in);
   
    List subList = itemInfo.addList("collections", List.TYPE_SIMPLE);
    Collection[] collections = item.getCollections();
    for(Collection collection : collections) {
      subList.addItem(collection.getMetadata("name"));
    }
   
    itemInfo.addLabel(T_label_page);
    if(item.getHandle()==null){
      itemInfo.addItem(T_na);   
    }
    else{
      itemInfo.addItem().addXref(ConfigurationManager.getProperty("dspace.url") + "/handle/" + item.getHandle(),ConfigurationManager.getProperty("dspace.url") + "/handle/" + item.getHandle());   
    }
   
    itemInfo.addLabel(T_label_auth);
    try
    {
        AuthorizeUtil.authorizeManageItemPolicy(context, item);
        itemInfo.addItem().addButton("submit_authorization").setValue(T_submit_authorizations);
    }
    catch (AuthorizeException authex)
    {
        addNotAllowedButton(itemInfo.addItem(), "submit_authorization", T_submit_authorizations);
        }
 
    if(!item.isWithdrawn())
    {
      itemInfo.addLabel(T_label_withdraw);
      try
          {
              AuthorizeUtil.authorizeWithdrawItem(context, item);
              itemInfo.addItem().addButton("submit_withdraw").setValue(T_submit_withdraw);
          }
          catch (AuthorizeException authex)
          {
              addNotAllowedButton(itemInfo.addItem(), "submit_withdraw", T_submit_withdraw);
          }
    }
    else
   
      itemInfo.addLabel(T_label_reinstate);
      try
            {
                AuthorizeUtil.authorizeReinstateItem(context, item);
                itemInfo.addItem().addButton("submit_reinstate").setValue(T_submit_reinstate);
            }
            catch (AuthorizeException authex)
            {
                addNotAllowedButton(itemInfo.addItem(), "submit_reinstate", T_submit_reinstate);
            }
    }
   
        itemInfo.addLabel(T_label_move);
        addCollectionAdminOnlyButton(itemInfo.addItem(), item.getOwningCollection(), "submit_move", T_submit_move);
       
    itemInfo.addLabel(T_label_delete);
    if (AuthorizeManager.authorizeActionBoolean(context, item, Constants.DELETE))
    {
        itemInfo.addItem().addButton("submit_delete").setValue(T_submit_delete);
    }
    else
    {
        addNotAllowedButton(itemInfo.addItem(), "submit_delete", T_submit_delete);
    }
   
   
   
   
    // PARA: main actions
    main.addPara().addButton("submit_return").setValue(T_submit_return);
   
    main.addHidden("administrative-continue").setValue(knot.getId());
  }
View Full Code Here

        .getAttribute(AuthenticationUtil.REQUEST_INTERRUPTED_MESSAGE);
    String characters = (String) session
        .getAttribute(AuthenticationUtil.REQUEST_INTERRUPTED_CHARACTERS);

    if (header != null || message != null || characters != null) {
      Division reason = body.addDivision("login-reason");

      if (header != null)
        reason.setHead(message(header));
      else
        // Allways have a head.
        reason.setHead("Authentication Required");

      if (message != null)
        reason.addPara(message(message));

      if (characters != null)
        reason.addPara(characters);
    }

    Division loginChooser = body.addDivision("login-chooser");
    loginChooser.setHead(T_head1);
    loginChooser.addPara().addContent(T_para1);

    List list = loginChooser.addList("login-options", List.TYPE_SIMPLE);

    while (authMethods.hasNext()) {
      final AuthenticationMethod authMethod = (AuthenticationMethod) authMethods
          .next();
View Full Code Here

  public void addBody(Body body) throws WingException, SQLException
  {
    String loginURL = contextPath+"/login";
    String feedbackURL = contextPath+"/feedback";
   
        Division main = body.addDivision("not-authorized","primary administrative");
    main.setHead(T_head);
    Para para1 = main.addPara();
    para1.addContent(T_para1a);
    para1.addXref(feedbackURL,T_para1b);
    para1.addContent(T_para1c);

    main.addPara().addXref(loginURL,T_para2);
   
  }
View Full Code Here

    if (request.getParameter("help") != null)
      help = true;
    if (request.getParameter("error") != null)
      error = true;
   
    Division div = body.addInteractiveDivision("test", "", "post", "primary");
    div.setHead("Advanced form test");
    div.addPara("There are two options you can use to control how this page is generated. First is the help parameter, if this is present then help text will be provided for all fields. Next is the error parameter, if it is provided then all fields will be generated in error conditions.");
   
    if (help)
      div.addPara().addXref(makeURL(false,error),"Turn help OFF");
    else
      div.addPara().addXref(makeURL(true,error),"Turn help ON");
     
    if (error)
      div.addPara().addXref(makeURL(help,false),"Turn errors OFF");
    else
      div.addPara().addXref(makeURL(help,true),"Turn errors ON");
   
   
    List list = div.addList("fieldTest",List.TYPE_FORM);
    list.setHead("Tests");
   
    // text
    Text text = list.addItem().addText("text");
    text.setLabel("Text");
View Full Code Here

      help = true;
    if (request.getParameter("error") != null)
      error = true;
   
       
        Division div = body.addInteractiveDivision("test", "", "post", "primary");
        div.setHead("Basic form test");
        div.addPara("There are two options you can use to control how this page is generated. First is the help parameter, if this is present then help text will be provided for all fields. Next is the error parameter, if it is provided then all fields will be generated in error conditions.");
   
    if (help)
      div.addPara().addXref(makeURL(false,error),"Turn help OFF");
    else
      div.addPara().addXref(makeURL(true,error),"Turn help ON");
     
    if (error)
      div.addPara().addXref(makeURL(help,false),"Turn errors OFF");
    else
      div.addPara().addXref(makeURL(help,true),"Turn errors ON");
   

        List list = div.addList("fieldTest",List.TYPE_FORM);
        list.setHead("Fields");
       
        // Text field
        Text text = list.addItem().addText("text");
        text.setLabel("Text");
        if (help)
          text.setHelp("This is helpfull text.");
        if (error)
          text.addError("This field is in error.");
        text.setValue("Current raw value");
       
        // Long help
        Text longHelp = list.addItem().addText("longHelp");
        longHelp.setLabel("Long Help");
        if (help)
          longHelp.setHelp("This is a really long help message. It could potentially be a paragraph of material, really really long. Actually we don't know how long it can be because there is no upper limit on it! Although if you do find your self adding a long help message consider whether your user will actually read any of this, my bet is that they won't. However we still need to support these really, really, really, long messages that may break across multiple lines!");
        if (error)
          longHelp.addError("This field is in error.");
        longHelp.setValue("Current raw value");
       
        // Long error
        Text longError = list.addItem().addText("longError");
        longError.setLabel("Long Error");
        if (help)
          longError.setHelp("TThis is helpfull text.");
        if (error)
          longError.addError("This field is very much is serious trouble, it's so horrible wrong that i now have to give you a very long stern message that may break across multiple lines! To fix this problem you should examine what you are attempting to do and consider other factors like what might have lead you to this path vs another path. Are you sure you even want this field or might another one work just as well?");
        longError.setValue("Current raw value");
       
        // Text Area Field
        TextArea textArea = list.addItem().addTextArea("textarea");
        textArea.setLabel("Text Area");
        if (help)
          textArea.setHelp("This is helpfull text.");
        if (error)
          textArea.addError("This field is in error.");
        textArea.setValue("This is the raw value");
       
        // Blank Text Area Field
        TextArea emptyTextArea = list.addItem().addTextArea("emptyTextarea");
        emptyTextArea.setLabel("Empty Text Area");
        if (help)
          emptyTextArea.setHelp("This is helpfull text.");
        if (error)
          emptyTextArea.addError("This field is in error.");
       
       
        // Password field
        Password password = list.addItem().addPassword("password");
        password.setLabel("password");
        if (help)
          password.setHelp("This is helpfull text.");
        if (error)
          password.addError("This field is in error.");
       
        // Hidden field
        Hidden hidden = list.addItem().addHidden("hidden");
        hidden.setLabel("Hidden");
        hidden.setValue("You can not see this.");
        if (help)
          hidden.setHelp("This is hidden help?");
        if (error)
          hidden.addError("This a hidden error - I have no idea what this means?");
       
        // Checkbox field
        CheckBox checkBox = list.addItem().addCheckBox("fruit");
        if (help)
          checkBox.setHelp("Select all the fruits that you like to eat");
        if (error)
          checkBox.addError("You are incorrect you actualy do like Tootse Rolls.");
        checkBox.setLabel("fruits");
        checkBox.addOption("apple","Apples");
        checkBox.addOption(true,"orange","Oranges");
        checkBox.addOption("pear","Pears");
        checkBox.addOption("tootsie","Tootsie Roll");
        checkBox.addOption(true,"cherry","Cherry");
       
        // Radio buttons
       
        Radio radio = list.addItem().addRadio("sex");
        radio.setLabel("Football colors");        
        if (help)
          radio.setHelp("Select the colors of the best (college) football team.");
        if (error)
          radio.addError("Error, Maroon & White is the only acceptable answer.");
        radio.addOption("ut","Burnt Orange & White");
        radio.addOption(true,"tamu","Maroon & White");
        radio.addOption("ttu","Tech Red & Black");
        radio.addOption("baylor","Green & Gold");
        radio.addOption("rice","Blue & Gray");
        radio.addOption("uh","Scarlet Red & Albino White");
       
        // File
        File file = list.addItem().addFile("file");
        file.setLabel("File");
        if (help)
          file.setHelp("Upload a file.");
        if (error)
          file.addError("This field is in error.");
       
        // Select (single)
        Select select = list.addItem().addSelect("select");
        select.setLabel("Select (single)");
        if (help)
          select.setHelp("Select one of the options");
        if (error)
          select.addError("This field is in error.");
        select.addOption("one","uno");
        select.addOption("two","dos");
        select.addOption("three","tres");
        select.addOption("four","cuatro");
        select.addOption("five","cinco");
        select.setOptionSelected("one");

        select = list.addItem().addSelect("multi-select");
        select.setLabel("Select (multiple)");
        select.setMultiple();
        select.setSize(4);
        if (help)
          select.setHelp("Select one or more options");
        if (error)
          select.addError("This field is in error.");
        select.addOption("one","uno");
        select.addOption("two","dos");
        select.addOption("three","tres");
        select.addOption("four","cuatro");
        select.addOption("five","cinco");
        select.setOptionSelected("one");
        select.setOptionSelected("three");
        select.setOptionSelected("five");
       
        // Non-Field-item
        list.addLabel("Non-Field");
        list.addItem().addContent("This is just text, not a field, but it has a list label.");
       
        // Button
        Button button = list.addItem().addButton("button");
        button.setLabel("Button");
        button.setValue("When you touch me I do things, lots of things");
        if (help)
          button.setHelp("Submit buttons allow the user to submit the form.");
        if (error)
          button.addError("This button is in error.");
       
        // Non-field-unlabeled-item
        list.addItem().addContent("The following fields are all various use cases of composites. Also note that this item is an item inside a list of type form that 1) does not contain a field and 2) does not have a label.");
       
        // Composite
        Composite composite = list.addItem().addComposite("composite-2text");
        composite.setLabel("Composite (two text fields)");
        if (help)
          composite.setHelp("I am the help for the entire composite");
        if (error)
          composite.addError("Just the composite is in error");
        text = composite.addText("partA");
        text.setLabel("Part A");
        text.setValue("Value for part A");
        if (help)
          text.setHelp("Part A");
        text = composite.addText("partB");
        text.setLabel("Part B");
        text.setValue("Value for part B");
        if (help)
          text.setHelp("Part B");
       
        // composite select & text fields 
        composite = list.addItem().addComposite("compositeB");
        composite.setLabel("Composite (select & text fields)");
        if (help)
          composite.setHelp("This field is composed of a select and text field, select one and type the other.");
 
        select = composite.addSelect("selectB");
        select.setLabel("Numbers");
        if (help)
          select.setHelp("Me, me, me..... select me!");
        if (error)
          select.addError("The composite components are in error.");
        select.addOption("one","uno");
        select.addOption("two","dos");
        select.addOption("three","tres");
        select.addOption("four","cuatro");
        select.addOption("five","cinco");
        select.setOptionSelected("one");
       
        text = composite.addText("TextB");
        text.setLabel("Spanish Numbers");
        if (help)
          text.setHelp("Yay, yet another text field");
        if (error)
          text.addError("The composite components are in error.");
       
       
        // Composite
        composite = list.addItem().addComposite("composite-date");
        composite.setLabel("Composite (date)");
        if (help)
          composite.setHelp("The data the item was published.");
        if (error)
          composite.addError("The date is in error.");
       
        text = composite.addText("year");
        text.setLabel("Year");
        text.setSize(4,4);
        if (help)
          text.setHelp("year");
        if (error)
          text.addError("The year is in error");
       
       
        select = composite.addSelect("month");
        select.setLabel("Month");
        if (error)
          select.addError("The month is in error");
        if (help)
          text.setHelp("month");
        select.addOption("","(Select Month)");
        select.addOption(1,"January");
        select.addOption(2,"Feburary");
        select.addOption(3,"March");
        select.addOption(4,"April");
        select.addOption(5,"May");
        select.addOption(6,"June");
        select.addOption(7,"July");
        select.addOption(8,"August");
        select.addOption(9,"September");
        select.addOption(10,"August");
        select.addOption(11,"October");
        select.addOption(12,"November");
        select.addOption(13,"December");
       
        text = composite.addText("day");
        text.setLabel("Day");
        if (help)
          text.setHelp("day");
        if (error)
          text.addError("The day is in error.");
        text.setSize(4,2);
       
        // Buttons one typical finds at the end of forums
        Item actions = list.addItem();
        actions.addButton("submit_save").setValue("Save");
        actions.addButton("submit_cancel").setValue("Cancel");
       
       
       
       
        /////////////////////////////////////////////////
        /// Multi section
        ////////////////////////////////////////////////
       
        div.addPara("This next test will use form sections. Sections are logical groupings of related fields that together form the entire set.");
       
        list = div.addList("sectionTest",List.TYPE_FORM);
        list.setHead("Multi-Section form");
        List identity = list.addList("identity",List.TYPE_FORM);
        identity.setHead("Identity");
       
        Text name = identity.addItem().addText("name");
View Full Code Here

        Collection collection = (Collection) dso;
       
        // Only add the submit link if the user has the ability to add items.
        if (AuthorizeManager.authorizeActionBoolean(context, collection, Constants.ADD))
        {
          Division home = body.addDivision("collection-home","primary repository collection");
          Division viewer = home.addDivision("collection-view","secondary");
          String submitURL = contextPath + "/handle/" + collection.getHandle() + "/submit";
          viewer.addPara().addXref(submitURL,T_submit);
        }
       
    }
View Full Code Here

TOP

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

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.