6 Replies Latest reply: Mar 16, 2011 6:11 AM by user12026287 RSS

    DHTML Menu Portlet for Portal 10.1.4 - order by sequence isntead of name?

    706593
      DHTML Menu Portlet for OracleAS Portal - 10.1.4 (created 6th juni, 2007)

      Link:http://www.oracle.com/technology/products/ias/portal/files/dhtml-menu.zip

      Does anyone know how to sort the menu elements by "sequence" instead of what currently is, by name?

      The seq can be found in the following section of Oralce portal:

      select seq, id, name
      FROM wwpob_page$

      The "process_tree" procedure in the "dhtml_menu_tree" package has a select against the wwsbr_all_folders view, which is a portal specific view. This again has a select against the wwv_user_corners view which selects against the table wwpob_page$.

      I'm not able to see how and where the sorting is done, but I have a feeling it's done by the API called portal.wwsrc_api.page_search.

      Is there any way we can have the menu sort by sequence? The sequence is manually defined by arranging the pages in the optional tab in page properties.
        • 1. Re: DHTML Menu Portlet for Portal 10.1.4 - order by sequence isntead of name?
          Pmonaco-Oracle
          I remember that the sort is done inside the dhtml_menu_tree package (... order siblings by title ...)
          I you have to the .PKB code, you have to replace TITLE by SEQ, and invoke the colomn SEQ in the various UNION sections of the SELECT statement.

          Patrick.
          • 2. Re: DHTML Menu Portlet for Portal 10.1.4 - order by sequence isntead of name?
            706593
            Hey Patrick. Thanks for the answer.

            The "order siblings by title" you're referring to is for a previous version of the portlet. There is no order clause at all anywhere. The various union selects are also gone.
            • 3. Re: DHTML Menu Portlet for Portal 10.1.4 - order by sequence isntead of name?
              Pmonaco-Oracle
              Could you direct me to the link from where you downloaded this new dhtml_menu_tree kit (2007) ?

              Patrick.
              • 4. Re: DHTML Menu Portlet for Portal 10.1.4 - order by sequence isntead of name?
                706593
                I added the link in the top of the first post.

                I have solved it by rewriting the package body "dhtml_menu_tree" to sort menu items by sequence instead of alphabetical order. There were lots of changes since the seq had to be selected from the wwpob_page$ table for each row in the l_results plsql table. Then made a new plsql table and sorted this manually by using a modified version of the existing bubble sort.

                Robert
                • 5. Re: DHTML Menu Portlet for Portal 10.1.4 - order by sequence isntead of name?
                  706593
                  These are my final changes.
                  Disclaimer:
                  Use at your own risk. This code is not properly tested.

                  Changes to DHTML Menu for Portal 10.1.4
                  By Robert, Juni 16th, 2009
                  Changes consist of sorting menu items by sequence instead of alphabetical order.

                  Strike = uncommenting of existing code

                  Untouched existing code is quoted like this:
                  code
                  New code is plain text

                  ------------------------------------------------------------------------
                  CREATE OR REPLACE PACKAGE BODY PORTAL.DHTML_MENU_TREE
                  is

                  ... (some code)

                  procedure process_tree (
                  p_siteid in number,
                  p_userid in number,
                  p_user in varchar2,
                  > p_refpath in varchar2,
                  p_lang in varchar2
                  )
                  is
                  ... (some code)
                  /**
                  * Changes: sort menu items by sequence instead of alphabetical order
                  * types, cursors and variables
                  *
                  * Robert, June 16th, 2009
                  */
                  type l_results_seq_record_type is record
                  ( id portal.wwv_user_corners.id%type
                  , name portal.wwv_user_corners.name%type
                  , parent_id portal.wwv_user_corners.parentid%type
                  , display_name portal.wwv_user_corners.title%type
                  , seq portal.wwv_user_corners.seq%type
                  );

                  type l_results_seq_table_type is table of l_results_seq_record_type;

                  cursor c_seq_cursor (p_l_results_seq_rec_id in portal.wwpob_page$.id%type)
                  is
                  select p.seq
                  from portal.wwpob_page$ p
                  where p.id = p_l_results_seq_rec_id
                  ;

                  aux_seq number;
                  l_results_seq_table l_results_seq_table_type := l_results_seq_table_type();
                  l_seq portal.wwv_user_corners.seq%type := 0;
                  l_results_seq_rec l_results_seq_record_type;
                  /**
                  * End of changes, June 16th, 2009
                  */
                  begin

                  ... (some code)

                  l_results := portal.wwsrc_api.page_search(
                  p_page_groups => l_pggroups,
                  p_folderid => i_parentid,
                  p_foldersiteid => i_siteid,
                  p_firsthit => 1,
                  p_out_count => l_count,
                  p_out_scores => l_scores);
                  /**
                  * Changes: sort menu items by sequence instead of alphabetical order
                  * Robert, June 16th, 2009
                  */
                  for i in l_results.first..l_results.last
                  loop
                  l_results_seq_rec.id := l_results(i).id;
                  l_results_seq_rec.name := l_results(i).name;
                  l_results_seq_rec.parent_id := l_results(i).parent_id;
                  l_results_seq_rec.display_name := l_results(i).display_name;
                  l_seq := 0;
                  for r_seq_cursor in c_seq_cursor (l_results_seq_rec.id) loop
                  l_seq := r_seq_cursor.seq;
                  end loop;
                  l_results_seq_rec.seq := l_seq;
                  l_results_seq_table.extend;
                  l_results_seq_table(l_results_seq_table.last):= l_results_seq_rec;
                  end loop;
                  l_results.delete;

                  for i in 1..l_results_seq_table.count - 1
                  loop
                  for f in 1..l_results_seq_table.count - 1
                  loop
                  if l_results_seq_table(i).seq < l_results_seq_table(f).seq
                  then
                  aux_id := l_results_seq_table(i).id;
                  aux_parentid := l_results_seq_table(i).parent_id;
                  aux_name := l_results_seq_table(i).name;
                  aux_display_name := l_results_seq_table(i).display_name;
                  aux_seq := l_results_seq_table(i).seq;

                  l_results_seq_table(i).id := l_results_seq_table(f).id;
                  l_results_seq_table(i).parent_id := l_results_seq_table(f).parent_id;
                  l_results_seq_table(i).name := l_results_seq_table(f).name;
                  l_results_seq_table(i).display_name := l_results_seq_table(f).display_name;
                  l_results_seq_table(i).seq := l_results_seq_table(f).seq;

                  l_results_seq_table(f).id := aux_id;
                  l_results_seq_table(f).parent_id := aux_parentid;
                  l_results_seq_table(f).name := aux_name;
                  l_results_seq_table(f).display_name := aux_display_name;
                  l_results_seq_table(f).seq := aux_seq;

                  aux_id := null;
                  aux_parentid := null;
                  aux_name := null;
                  aux_display_name := null;
                  end if;
                  end loop;
                  end loop;
                  /**
                  * End of changes, June 16th, 2009
                  */
                  >
                  i_index_lista := 0;
                  /**
                  * Changes: sort menu items by sequence instead of alphabetical order
                  * Uncommenting
                  * Robert, June 16th, 2009
                  FOR i IN 1..l_results.count
                  LOOP
                  IF (l_results(i).name IS NOT NULL) THEN
                  LISTA_MAS(i_index_lista).i_id := l_results(i).id;
                  LISTA_MAS(i_index_lista).i_parentid := l_results(i).parent_id;
                  LISTA_MAS(i_index_lista).v_name := l_results(i).name;
                  LISTA_MAS(i_index_lista).v_display_name := l_results(i).display_name;
                  * End of changes, June 16th, 2009
                  */

                  /**
                  * Changes: sort menu items by sequence instead of alphabetical order
                  * replace l_results with the new plsql table, l_results_seq_table
                  * Robert, June 16th,2009
                  */
                  FOR i IN 1..l_results_seq_table.count
                  LOOP
                  IF (l_results_seq_table(i).name IS NOT NULL) THEN
                  LISTA_MAS(i_index_lista).i_id := l_results_seq_table(i).id;
                  LISTA_MAS(i_index_lista).i_parentid := l_results_seq_table(i).parent_id;
                  LISTA_MAS(i_index_lista).v_name := l_results_seq_table(i).name;
                  LISTA_MAS(i_index_lista).v_display_name := l_results_seq_table(i).display_name;
                  /**
                  * End of changes, June 16th, 2009
                  */
                  >
                  i_index_lista := i_index_lista + 1;
                  END IF;
                  END LOOP;
                  i_index_lista := null;
                  /**
                  * Changes: sort menu items by sequence instead of alphabetical order
                  * delete l_results_seq_table and l_results
                  * Robert, June 16th, 2009
                  */
                  l_results_seq_table.delete;
                  l_results.delete;
                  /**
                  * End of changes, June 16th, 2009
                  *

                  /**
                  * Changes: sort menu items by sequence instead of alphabetical order
                  * Uncomment for loops
                  * Robert, June 16th, 2009
                  FOR i IN 0..(LISTA_MAS.count-1)
                  LOOP
                  FOR f IN 0..(LISTA_MAS.count-1)
                  LOOP
                  IF LISTA_MAS(i).v_display_name < LISTA_MAS(f).v_display_name THEN
                  aux_id := LISTA_MAS(i).i_id;
                  aux_parentid := LISTA_MAS(i).i_parentid;
                  aux_name := LISTA_MAS(i).v_name;
                  aux_display_name := LISTA_MAS(i).v_display_name;

                  LISTA_MAS(i).i_id := LISTA_MAS(f).i_id;
                  LISTA_MAS(i).i_parentid := LISTA_MAS(f).i_parentid;
                  LISTA_MAS(i).v_name := LISTA_MAS(f).v_name;
                  LISTA_MAS(i).v_display_name := LISTA_MAS(f).v_display_name;

                  LISTA_MAS(f).i_id := aux_id;
                  LISTA_MAS(f).i_parentid := aux_parentid;
                  LISTA_MAS(f).v_name := aux_name;
                  LISTA_MAS(f).v_display_name := aux_display_name;

                  aux_id := null;
                  aux_parentid := null;
                  aux_name := null;
                  aux_display_name := null;
                  END IF;
                  END LOOP;
                  END LOOP;
                  * End of changes, June 16th, 2009
                  */
                  >
                  htp.p('var TREE_ITEMS_'||p_refpath||' = [');
                  htp.p('['|| ''''||v_displayname||''''||', '''|| v_link ||''', null]');
                  DHTML_MENU_TREE.menu_tree_item(LISTA_MAS, i_parentid, 0,'[', v_link||'/');
                  htp.p('];');

                  end process_tree;

                  ... (lots of code)
                  end dhtml_menu_tree;
                  /
                  • 6. Re: DHTML Menu Portlet for Portal 10.1.4 - order by sequence isntead of name?
                    user12026287
                    Hello
                    I want to download a new Rich Menu Portlet (dhtml-menu.zip) but it's not avaible in http://www.oracle.com/technology/products/ias/portal/files/dhtml-menu.zip

                    Can you help me to download this portlet