Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-33441

SakaiScript's addNewToolToAllWorkspaces() may not set the tool order correctly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Verified
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.7, 11.4, 12.0, 19.0
    • Fix Version/s: 12.0, 19.0
    • Component/s: Web Services
    • Labels:
      None
    • 12 status:
      Resolved
    • Test Plan:
      Hide

      Please add a Test Plan here.

      Show
      Please add a Test Plan here.

      Description

      Steps to reproduce

      • ensure SAK-33428 has been applied to the code
      • run SakaiScript.jws?wsdl and
      • call addNewToolToAllWorkspaces() with a high page position like 99 (to ensure the new tool gets added to the end of the list)
      • After the script finishes not all of the sites' new tool will be added to the correct position

      In Sakai 10.7 SakaiScript.jws (this code includes the patch in SAK-33428)

      public String addNewToolToAllWorkspaces(String sessionid, String toolid, String pagetitle, String tooltitle, int pagelayout, int position, boolean popup) throws AxisFault
      {
      .
      .
      .
          for (Iterator<String> j = siteIdSet.iterator(); j.hasNext();) { 
          .
          .
          .
              int numPages = siteEdit.getPages().size();
      				if(position >= numPages) {
      					position = numPages-1;
      				}
      				
      				int pagePosition = sitePageEdit.getPosition();
      				if (pagePosition != position)
      				{
      					// set the page position
      					LOG.debug("Page:" + sitePageEdit + "  position=" + sitePageEdit.getPosition() + " position_new=" + position);
      					sitePageEdit.setPosition(position);
      					siteEdit.setCustomPageOrdered(true);
      					siteService.save(siteEdit);
      					LOG.debug("Page moved");
      				}
      
      

      The variable position overwrites itself and is inside a for loop, so as sites are processed if the numPages happens to be smaller, it will change the position for all subsequent sites to that position and will keep reducing if you happen to have sites with less and less numPages.

        Gliffy Diagrams

          Zeplin

            Attachments

              Issue Links

                Activity

                  People

                  Assignee:
                  jonespm Matthew Jones
                  Reporter:
                  austinUH Austin
                  Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                    Dates

                    Created:
                    Updated:
                    Resolved:

                      Git Integration