1 Reply Latest reply on Mar 13, 2013 2:37 PM by robert.fernandes

    Need to know the flow from Places Widget UI to Backend

    skushawaha

      Hi,

      I need to create a widget similar kind of 'Places Widget' in which I want to show the list of followed places but in sorted order. I am trying this on Jive 5.0.5 code base.

      Can anyone please help me out for following questions for the existing 'Places Widget' need to understand the flow from UI to backend-

      1. From which UI file the service call is trigger to get the followed places list and which service is being called?
      2. From which UI file the service call is trigger to get the "more list" of followed places when scroll down the list and which service is being called?

       

      As per my understanding the Widget Class "PlacesWidget.java" is being used to load the properties, but some how could not locate the service call. Here is the Code snippet.

       

      protected Map<String, Object> loadProperties(WidgetContext widgetContext, ContainerSize size) {
              Map<String, Object> properties = super.loadProperties(widgetContext, size);
              List<PlaceType> types = PlaceType.getGeneralPlaceTypeValues();
              List<PlaceWrapper> activePlaceTypes = new ArrayList<PlaceWrapper>();
              for (PlaceType type : types) {
                  if (!type.equals(PlaceType.COMMUNITY) && !type.equals(PlaceType.PROJECT) && !type.equals(PlaceType.GROUP)) {
                      PlaceTypeProvider provider = PlaceType.getProviderForType(type);
      
                      if (provider != null && provider.isEnabled()) {
                          activePlaceTypes.add(new PlaceWrapper(type, provider, widgetContext));
                      }
                  }
              }
              // load everything up initially when the widget is loaded.
              properties.put("projectsEnabled", projectManager.isFeatureEnabled());
              properties.put("socialGroupsEnabled", SocialGroupPermHelper.isSocialGroupsEnabled());
              properties.put("atLeastOneActivePlaceTypeEnabled", !activePlaceTypes.isEmpty());
              properties.put("activePlaceTypes", activePlaceTypes);
              if (WidgetType.PERSONALIZEDHOMEPAGE.equals(widgetContext.getWidgetType())) {
                  loadUserProp(PlacesServiceImpl.PREFERRED_VIEW_KEY, "preferredView", properties, widgetContext);
                  loadUserProp(PlacesServiceImpl.PREFERRED_FILTER_KEY, "preferredFilter", properties, widgetContext);
              }
      
              return properties;
      }
      

       

       

      Template file used for places widget is "/template/widget/your-places.ftl"

       

      Reference images for Places Widget

       

      YourPlaces_CustomizedOverview.png

      PlacesWidget.png

       

       

      Thanks in advance,

      Sanjay

        • Re: Need to know the flow from Places Widget UI to Backend

          The widget is only used to render the initial display of places and the initial widget properties.  Once the widget is rendered, the entire front end UI, which controls the list of places and the search button and what not on the front end is all in Javascript.  It is contained, mainly in the following JavaScript file which is contained in the import of the FTL you mentioned:

          <@resource.javascript file='/resources/scripts/jive/gui/places-gui.js'/>

           

          That file, places-gui.js is where all the front end heavy lifting takes place.  Including calling the REST endpoints for locating and search places and what not.  That's the next place you need to look.  Hope that helps.