Changeset 987


Ignore:
Timestamp:
Jul 22, 2005, 8:52:51 AM (18 years ago)
Author:
Nicklas Nordborg
Message:

Fixed layout problems with Reload button.
The last selected directory is now remembered to the next time

Location:
trunk/www
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/include/scripts/newjoust.js

    r866 r987  
    101101    @return The index of the new item
    102102  */
    103   this.addMenuItem = function(afterItemIndex, iconName, text, onclick, tooltip)
     103  this.addMenuItem = function(afterItemIndex, iconName, text, onclick, tooltip, externalId)
    104104  {
    105105    var afterItem = this.menuItems[afterItemIndex];
     
    112112    var insertIndex = this.menuItems.length;
    113113
    114     var menuItem = new MenuItem(this, insertIndex, iconName, text, onclick, tooltip, nextItemIndex, previousItemIndex, parentItemIndex);
     114    var menuItem = new MenuItem(this, insertIndex, iconName, text, onclick, tooltip, nextItemIndex, previousItemIndex, parentItemIndex, externalId);
    115115    this.menuItems[insertIndex] = menuItem;
     116    this.menuItems[externalId] = menuItem;
    116117    if (afterItem)
    117118    {
     
    146147    @return The index of the new item
    147148  */
    148   this.addChildItem = function(parentItemIndex, iconName, text, onclick, tooltip)
     149  this.addChildItem = function(parentItemIndex, iconName, text, onclick, tooltip, externalId)
    149150  {
    150151    var parentItem = this.menuItems[parentItemIndex];
     
    156157    if (afterItem)
    157158    {
    158       parentItem.lastChildIndex = this.addMenuItem(parentItem.lastChildIndex, iconName, text, onclick, tooltip);
     159      parentItem.lastChildIndex = this.addMenuItem(parentItem.lastChildIndex, iconName, text, onclick, tooltip, externalId);
    159160      return parentItem.lastChildIndex;
    160161    }
    161162    var insertIndex = this.menuItems.length;
    162     var menuItem = new MenuItem(this, insertIndex, iconName, text, onclick, tooltip, -1, -1, parentItemIndex);
     163    var menuItem = new MenuItem(this, insertIndex, iconName, text, onclick, tooltip, -1, -1, parentItemIndex, externalId);
    163164    this.menuItems[insertIndex] = menuItem;
     165    this.menuItems[externalId] = menuItem;
    164166    parentItem.firstChildIndex = insertIndex;
    165167    parentItem.lastChildIndex = insertIndex;
     
    189191 
    190192  /**
     193    Open a menu item and make sure all parents are open as well.
     194    @param menuItemIndex The index of the menu item to open
     195  */
     196  this.open = function(menuItemIndex)
     197  {
     198    var menuItem = this.menuItems[menuItemIndex];
     199    if (!menuItem) return;
     200    menuItem.isOpen = true;
     201    Main.show('children'+menuItem.index);
     202    this.updateIconsAndText(menuItemIndex);
     203    if (menuItem.parentItemIndex != -1) this.open(menuItem.parentItemIndex);
     204  }
     205 
     206  /**
    191207    Select a menu item and load it's URL into the target frame.
    192208    Only one menu item can be selected at a time. Any previously
     
    206222    }
    207223    menuItem.isSelected = true;
     224    if (menuItem.parentItemIndex != -1) this.open(menuItem.parentItemIndex);
    208225    this.selectedItemIndex = menuItemIndex;
    209226    this.updateIconsAndText(menuItemIndex);
    210227    eval(menuItem.onclick);
    211 //    parent.window.frames[menuItem.target].location = menuItem.url;
    212228  }
    213229
     
    263279  @param parentItemIndex The index of the parent menu item, or -1 if this is on the root level
    264280*/
    265 function MenuItem(menu, index, iconName, text, onclick, tooltip, nextItemIndex, previousItemIndex, parentItemIndex)
     281function MenuItem(menu, index, iconName, text, onclick, tooltip, nextItemIndex, previousItemIndex, parentItemIndex, externalId)
    266282{
    267283  this.menu = menu;
  • trunk/www/my_base/files/directories.jsp

    r914 r987  
    4949<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
    5050<%!
    51 
    5251String generateSubTree(Map<Directory, List<Directory>> tree, Directory parent, String ID, String parentId)
    5352{
     
    6463    sb.append(",'directoryOnClick(").append(child.getId()).append(",");
    6564    sb.append(" \"").append(HTML.javaScriptEncode(child.getPath().toString())).append("\")'");
    66     sb.append(",'files', '')\n");
     65    sb.append(",'', 'D").append(child.getId()).append("')\n");
    6766    sb.append(generateSubTree(tree, child, ID, null));
    6867  }
     
    7978final float scale = Base.getScale(sc);
    8079final String requestTitle = request.getParameter("title");
     80final Integer directoryId = (Integer)sc.getSessionSetting("lastDirectoryId");
    8181try
    8282{
     
    105105  function initialise()
    106106  {
     107    parent.parent.adjustIFrameSize();
    107108    IconStore.init();
    108109    <%
     
    110111    {
    111112      %>
    112       var userHome = JoustMenu.addMenuItem(-1, 'Home', 'My home', 'directoryOnClick(<%=userHome.getId()%>, "<%=HTML.javaScriptEncode(userHome.getPath().toString())%>")');
     113      var userHome = JoustMenu.addMenuItem(-1, 'Home', 'My home',
     114        'directoryOnClick(<%=userHome.getId()%>, "<%=HTML.javaScriptEncode(userHome.getPath().toString())%>")',
     115        '', 'D<%=userHome.getId()%>');
    113116      JoustMenu.menuItems[userHome].noOutlineIcon = true;
    114117      JoustMenu.menuItems[userHome].isOpen = true;
     
    117120    }
    118121    %>
    119     var root = JoustMenu.addMenuItem(-1, '<%=rootIcon%>', '<%=HTML.javaScriptEncode(rootTitle)%>', 'directoryOnClick(<%=root.getId()%>, "<%=HTML.javaScriptEncode(root.getPath().toString())%>")');
     122    var root = JoustMenu.addMenuItem(-1, '<%=rootIcon%>', '<%=HTML.javaScriptEncode(rootTitle)%>',
     123      'directoryOnClick(<%=root.getId()%>, "<%=HTML.javaScriptEncode(root.getPath().toString())%>")',
     124      '', 'D<%=root.getId()%>');
    120125    JoustMenu.menuItems[root].noOutlineIcon = true;
    121126    JoustMenu.menuItems[root].isOpen = true;
    122127    <%=generateSubTree(tree, root, ID, "root")%>
    123128    JoustMenu.draw('joust');
    124     JoustMenu.select(<%=userHome != null ? "userHome" : "root"%>);
     129    var lastDirectory;
     130    <%
     131    if (directoryId != null)
     132    {
     133      %>
     134      lastDirectory = JoustMenu.menuItems['D<%=directoryId%>'];
     135      <%
     136    }
     137    %>
     138    JoustMenu.select(lastDirectory ? lastDirectory.index : <%=userHome != null ? "userHome" : "root"%>);
    125139  }
    126140 
     
    148162    function directoryOnClick(directoryId, path)
    149163    {
     164      parent.lastOpenDirectoryId = directoryId;
    150165      parent.frames.files.location.href = 'files.jsp?ID=<%=ID%>&directory_id='+directoryId+'&mode=<%=mode%>';
    151166    }
     
    153168  }
    154169  %>
    155 
    156170  function refresh()
    157171  {
    158     parent.parent.location.reload();
     172    location.reload();
    159173  }
    160174  </script>
     
    190204  {
    191205    %>
    192     <base:body onload="initialise()" style="border: 1px solid #666666; border-bottom: 0px;" >
    193       <div id="main" class="joust" style="background: #E0E0E0; width:100%;">
    194         <div id="joust">
    195         </div>
    196         <div style="position: absolute; bottom: 5px; width:99%">
    197         <table align="center">
    198         <tr>
    199           <td><base:button onclick="refresh()" title="Refresh" /></td>
    200         </tr>
    201         </table>
    202         </div>
     206    <base:body onload="initialise()" style="background: #E0E0E0; border: 1px solid #666666; border-bottom: 0px;" >
     207    <div id="main" class="joust" style="width:100%;">
     208      <div id="joust" style="overflow: auto;">
    203209      </div>
     210      <div style="width:99%;">
     211      <table align="center">
     212      <tr>
     213        <td><base:button onclick="refresh()" title="Refresh" /></td>
     214      </tr>
     215      </table>
     216      </div>
     217    </div>
    204218    </base:body>
    205219    <%
  • trunk/www/my_base/files/files.jsp

    r959 r987  
    6363
    6464final int directoryId = Values.getInt(request.getParameter("directory_id"), SystemItems.getId(Directory.ROOT));
     65sc.setSessionSetting("lastDirectoryId", directoryId);
    6566final TableInfo tix = Base.getAndSetTableInfo(sc, itemType, pageContext, defaultInfo);
    6667final TableInfo.Entry ti = tix.getDefault();
  • trunk/www/my_base/files/index.jsp

    r958 r987  
    7777    var directories = iframe.frames['directories'].document.getElementById('main');
    7878    if (directories) directories.style.height = (iframeElement.height-1)+'px';
     79    var joust = iframe.frames['directories'].document.getElementById('joust');
     80    if (joust) joust.style.height = (iframeElement.height-1-30)+'px';
    7981    var files = iframe.frames['files'].document.getElementById('main');
    8082    if (files) files.style.height = iframeElement.height+'px';
     
    8991  </script>
    9092</base:head>
    91 <base:body onload="adjustIFrameSize();" attributes="onresize='setTimer();'">
    92   <iframe name="manager" id="idManager" src="manage.jsp?ID=<%=ID%>" width="100%" frameborder=0 vspace=0 hspace=0
    93     marginwidth=0 marginheight=0 scrolling="no" style="overflow: visible"></iframe>
     93<base:body attributes="onresize='setTimer();'">
     94  <iframe name="manager" id="idManager" src="manage.jsp?ID=<%=ID%>" width="100%"
     95    frameborder="0" vspace="0" hspace="0"
     96    marginwidth="0" marginheight="0" scrolling="no" style="overflow: visible"></iframe>
    9497</base:body>
    9598</base:page>
  • trunk/www/my_base/files/manage.jsp

    r864 r987  
    4444  <base:head />
    4545  <frameset cols="170,*" frameborder="yes" border="3" >
    46     <frame name="directories" src="directories.jsp?ID=<%=ID%>&mode=<%=mode%>"
    47       scrolling="auto" marginwidth="0" marginheight="0" frameborder="0">
     46      <frame name="directories" src="directories.jsp?ID=<%=ID%>&mode=<%=mode%>"
     47        scrolling="auto" marginwidth="0" marginheight="0" frameborder="0">
    4848    <frame name="files" scrolling="auto" marginwidth="0" marginheight="0" frameborder="0">
    4949  </frameset>
  • trunk/www/my_base/files/save_as.jsp

    r958 r987  
    7878    var directories = iframe.frames['directories'].document.getElementById('main');
    7979    if (directories) directories.style.height = (iframeElement.height-1)+'px';
     80    var joust = iframe.frames['directories'].document.getElementById('joust');
     81    if (joust) joust.style.height = (iframeElement.height-1-30)+'px';
    8082    var files = iframe.frames['files'].document.getElementById('main');
    8183    if (files) files.style.height = iframeElement.height+'px';
     
    104106  </script>
    105107</base:head>
    106 <base:body onload="adjustIFrameSize();" attributes="onresize='setTimer();'">
     108<base:body attributes="onresize='setTimer();'">
    107109  <h3><%=requestTitle == null ? "Save as" : requestTitle%></h3>
    108110  <iframe name="manager" id="idManager" src="manage.jsp?ID=<%=ID%>&mode=selectone" width="100%" frameborder=0 vspace=0 hspace=0
  • trunk/www/my_base/files/select_files.jsp

    r958 r987  
    7878    var directories = iframe.frames['directories'].document.getElementById('main');
    7979    if (directories) directories.style.height = (iframeElement.height-1)+'px';
     80    var joust = iframe.frames['directories'].document.getElementById('joust');
     81    if (joust) joust.style.height = (iframeElement.height-1-30)+'px';
    8082    var files = iframe.frames['files'].document.getElementById('main');
    8183    if (files) files.style.height = iframeElement.height+'px';
     
    104106  </script>
    105107</base:head>
    106 <base:body onload="adjustIFrameSize();" attributes="onresize='setTimer();'">
     108<base:body attributes="onresize='setTimer();'">
    107109  <h3><%=requestTitle == null ? "Select one file" : requestTitle%></h3>
    108110  <iframe name="manager" id="idManager" src="manage.jsp?ID=<%=ID%>&mode=selectone" width="100%" frameborder=0 vspace=0 hspace=0
Note: See TracChangeset for help on using the changeset viewer.