home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2006 April / DPPRO0406DVD.ISO / Essentials / Programming / Eclipse SDK / eclipse-SDK-3.1.1-win32.exe / eclipse / plugins / org.eclipse.help.webapp_3.1.0 / advanced / bookmarksView.jsp < prev    next >
Encoding:
Text File  |  2005-09-29  |  3.6 KB  |  150 lines

  1. <%--
  2.  Copyright (c) 2000, 2004 IBM Corporation and others.
  3.  All rights reserved. This program and the accompanying materials 
  4.  are made available under the terms of the Eclipse Public License v1.0
  5.  which accompanies this distribution, and is available at
  6.  http://www.eclipse.org/legal/epl-v10.html
  7.  
  8.  Contributors:
  9.      IBM Corporation - initial API and implementation
  10. --%>
  11. <%@ include file="header.jsp"%>
  12.  
  13. <% 
  14.     BookmarksData data = new BookmarksData(application,request, response);
  15.     WebappPreferences prefs = data.getPrefs();
  16. %>
  17.  
  18. <html>
  19. <head>
  20. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  21. <meta http-equiv="Pragma" content="no-cache">
  22. <meta http-equiv="Expires" content="-1">
  23.  
  24. <title><%=ServletResources.getString("Bookmarks", request)%></title>
  25.  
  26. <style type="text/css">
  27. <%@ include file="list.css"%>
  28. </style>
  29.  
  30. <base target="ContentViewFrame">
  31.  
  32. <script language="JavaScript" src="list.js"></script>
  33.  
  34. <script language="JavaScript">        
  35.  
  36. /**
  37.  * Removes bookmark 
  38.  */
  39. function removeBookmark() 
  40. {
  41.     if (!active) 
  42.         return false;
  43.         
  44.     var bookmark = active;
  45.     active = null;
  46.     
  47.     // Note: bookmark is an anchor "a"
  48.     var url = bookmark.href;
  49.     var i = url.indexOf("/topic/");
  50.     if (i >=0 )
  51.         url = url.substring(i+6);
  52.     // remove any query string
  53.     i = url.indexOf("?");
  54.     if (i >= 0)
  55.         url = url.substring(0, i);
  56.         
  57.     var title = bookmark.title;
  58.     if (title == null || title == "")
  59.         title = url;
  60.             
  61.     window.location.replace("bookmarksView.jsp?operation=remove&bookmark="+encodeURIComponent(url)+"&title="+encodeURIComponent(title));
  62.     return true;
  63. }
  64.  
  65. /**
  66.  * Removes all bookmarks
  67.  */
  68. function removeAllBookmarks() 
  69. {
  70.     hidePopupMenu();
  71.     if(!confirm("<%=ServletResources.getString("confirmDeleteAllBookmarks",request)%>"))
  72.         return true;
  73.     window.location.replace("bookmarksView.jsp?operation=removeAll");
  74.     return true;
  75. }
  76.  
  77. /**
  78.  * If the Del key was pressed, remove the bookmark
  79.  */
  80. function bookmarkKeyDownHandler(e) {
  81.     var key;
  82.     
  83.     if (isIE) {
  84.         key = window.event.keyCode;
  85.     } else if (isMozilla) {
  86.         key = e.keyCode;
  87.     }
  88.  
  89.     // Check if this is the Delete key (code 46)
  90.     if (key != 46)
  91.         return true;
  92.         
  93.     if (isMozilla)
  94.         e.cancelBubble = true;
  95.     else if (isIE)
  96.         window.event.cancelBubble = true;
  97.       
  98.       return removeBookmark();
  99. }
  100. </script>
  101.  
  102. </head>
  103.  
  104.  
  105. <body dir="<%=direction%>">
  106.  
  107. <%
  108. if(data.getBookmarks().length == 0) {
  109.     out.write(ServletResources.getString("addBookmark", request));
  110. } else {
  111. %>
  112. <table id='list'  cellspacing='0' >
  113.  
  114. <%
  115.     Topic[] bookmarks = data.getBookmarks();
  116.     for (int i=0; i<bookmarks.length; i++) 
  117.     {
  118. %>
  119.  
  120. <tr class='list' id='r<%=i%>'>
  121.     <td align='<%=isRTL?"right":"left"%>' class='label' nowrap>
  122.         <a id='a<%=i%>' 
  123.            href='<%=bookmarks[i].getHref()%>' 
  124.            onmouseover="showStatus(event);return true;"
  125.            onmouseout="clearStatus();return true;"
  126.            onclick='parent.parent.parent.setContentToolbarTitle(" ")' 
  127.            oncontextmenu="contextMenuHandler(event);return false;"
  128.            onkeydown="bookmarkKeyDownHandler(event);"
  129.            title="<%=UrlUtil.htmlEncode(bookmarks[i].getLabel())%>">
  130.            <img src="<%=prefs.getImagesDirectory()%>/topic.gif" alt=""><%=UrlUtil.htmlEncode(bookmarks[i].getLabel())%></a>
  131.     </td>
  132. </tr>
  133.  
  134. <%
  135.     }
  136. %>
  137.  
  138. </table>
  139. <div id="menu">
  140.     <div class="unselectedMenuItem" onmouseover="this.className='selectedMenuItem'" onmouseout="this.className='unselectedMenuItem'" onclick="removeBookmark()" ><nobr><%=ServletResources.getString("RemoveBookmark",request)%></nobr></div>
  141.     <div class="unselectedMenuItem" onmouseover="this.className='selectedMenuItem'" onmouseout="this.className='unselectedMenuItem'" onclick="removeAllBookmarks()" ><nobr><%=ServletResources.getString("RemoveAllBookmarks",request)%></nobr></div>
  142. </div>
  143.  
  144. <%
  145. }
  146. %>
  147.  
  148. </body>
  149. </html>
  150.