AnsweredAssumed Answered

filterOwner at toolbar.js

Question asked by frontman on Dec 1, 2010
Latest reply on Dec 1, 2010 by mikeh
Hi guys,

I've modified filters.lib.js that is at "alfresco\WEB-INF\classes\alfresco\templates\webscripts\org\alfresco\slingshot\documentlibrary" in order to execute a lucene search. The documents are there, the parameters are fine, but when I hit document library url, IE shows an error and no results are displayed, just stays loading the library.

An example of how I'm invoking the url is "http://192.168.1.131:8080/share/page/site/inbursa/documentlibrary#filter=custom|curp_RORA820327HDFLN02-". IE error is "filterOwner is null o not an object".

The code I added to filter.lib.js is:

case "custom":

      logger.log("Entering custom code");

          var strData=decodeURI(args.filterData);
      var lstParamVal = strData.split("-");
      var lstNextParamVal;
      var strNextParam = "";
      var strNextVal = "";
            logger.log("—–>>>" + strData);

            filterQuery = "+PATH:\"" + parsedArgs.rootNode.qnamePath + "//*\"";

      for(var i=0; i < lstParamVal.length; i++)
      {
         lstNextParamVal = lstParamVal[i].split("_");
         strNextParam = lstNextParamVal[0];
         strNextVal = lstNextParamVal[1];

         logger.log("strNextParam[" + i + "]=" + strNextParam);
         logger.log("strNextVal[" + i + "]=" + strNextVal);

         switch (strNextParam)
                    {
                       case "folio":
                        
                  filterQuery += " +@tsg\\:folioInbursa:"+strNextVal+;
                     
                  break;
                     
                  case "servicio":

                  filterQuery += " +@tsg\\:servicioInbursa:"+strNextVal;

                  break;
                     
                  case "curp":
                        
                  filterQuery += " +@tsg\\:curpInbursa:"+strNextVal;

                  break;                                   
                       
                       case "sort":

                          if(strQueryArray[1]=="editdesc")
                          {
                             filterParams.sort = [
                             {
                                column: "@{http://www.alfresco.org/model/content/1.0}modified",
                                ascending: false
                             }];
                          }
                          if(strQueryArray[1]=="editasc")
                          {
                             filterParams.sort = [
                             {   
                                column: "@{http://www.alfresco.org/model/content/1.0}modified",
                                ascending: true
                             }];
                          }   

                       break;
                  }

         // ADD THE CASE LOGIC TO PROCESS THE ARGUMENTS, NEED THIS LINE TO COMPLETE THE QUERY
               //filterQuery += " +@cm\\:PARAM:\"VALUE\"";
      }
     
            filterParams.query = filterQuery;

      logger.log(filterQuery);

            break;

When I choose any other of the filters (All Documents, I'm Editing, etc), document library works fine. I don't if  I'm missing something.

Regards.

Outcomes