Changeset 3492
- Timestamp:
- Jun 14, 2007, 10:44:39 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/src/docbook/userdoc/webclient.xml
r3490 r3492 237 237 <listitem> 238 238 <para> 239 Go to the most recently viewed item. By default, the list contains links to 240 the most recently viewed experiment and bioassayset, but this 241 is configurable. If you, for example, work a lot with protocols, you may 242 add a link to the most recently viewed protocol. 239 Shortcut to the most recently viewed items. The number of items are 240 configurable and you can also make some item types 241 <emphasis>sticky</emphasis>. This will for example keep the shortcut 242 to the last experiment even if you have viewed lots of other items 243 more recently. 243 244 See <xref linkend="webclient.configuration.preferences.mostrecent"/> 245 for configuration information. 244 246 </para> 245 247 </listitem> … … 593 595 <varlistentry> 594 596 <term> 595 <guilabel>Recently used items</guilabel>596 </term>597 <listitem>598 <para>599 The number of items to remember in the list600 of recently used items. The default is to remember601 4 items.602 </para>603 </listitem>604 </varlistentry>605 <varlistentry>606 <term>607 597 <guilabel>Ratio color range</guilabel> 608 598 </term> … … 732 722 733 723 <sect3 id="webclient.configuration.preferences.mostrecent"> 734 <title>The Most recent tab</title> 735 736 <helptext external_id="userpreferences.mostrecent" title="Preferences - Most recent"> 724 <title>The Recent items tab</title> 725 726 <helptext external_id="userpreferences.mostrecent" 727 title="Preferences - Recent items"> 737 728 738 729 <para> 739 This tab contains settings that affect the <guilabel>Most 740 recent</guilabel> menu. You can select which items should 741 appear in the menu by moving them to the left list. Use 742 the up and down arrows to change the order in which they appear. 730 This tab contains settings that affect the <guilabel>Recent 731 items</guilabel> menu. 743 732 </para> 744 733 745 <para> 746 If the <guilabel>Load the names of all recent items</guilabel> checkbox 747 is checked the name of the items will be displayed in the menu (for example, 748 Experiment: My experiment). Otherwise only the type of the item is 749 displayed (for example, Experiment). 750 </para> 734 <variablelist> 735 <varlistentry> 736 <term> 737 <guilabel>Recently viewed items</guilabel> 738 </term> 739 <listitem> 740 <para> 741 The number of recently <emphasis>viewed</emphasis> items to remember. 742 The default is to remember 6 items. The remembered items 743 will be displayed in the <guilabel>Recent items</guilabel> 744 menu in the menu bar. 745 </para> 746 </listitem> 747 </varlistentry> 748 <varlistentry> 749 <term> 750 <guilabel>Recently used items</guilabel> 751 </term> 752 <listitem> 753 <para> 754 The number of recently <emphasis>used</emphasis> items to remember. 755 The default is to remember 4 items. The remembered items will 756 be displayed in edit dialogs where they have been used before. 757 Each type of edit operation has it's own list of remembered items. 758 For example, there is one list that remembers the most recently used 759 protocols when creating a sample, and there is another list that 760 remembers the most recently used scanners when creating a scan. 761 </para> 762 </listitem> 763 </varlistentry> 764 765 <varlistentry> 766 <term> 767 <guilabel>Load the names of all items</guilabel> 768 </term> 769 <listitem> 770 <para> 771 If checked, the names of the items will be loaded and 772 displayed in the menu, otherwise only the ID and type of item 773 is displayed. 774 </para> 775 </listitem> 776 </varlistentry> 777 778 <varlistentry> 779 <term> 780 <guilabel>Sticky items</guilabel> 781 </term> 782 <listitem> 783 <para> 784 Always remember the last viewed item of the selected types. 785 For example, if you have selected <emphasis>Experiment</emphasis> 786 as a sticky item, the last viewed experiment will be remembered 787 even if you view hundreds of other items. Use the arrow buttons 788 to move item types between the lists and sort the sticky items list. 789 Sticky items will be displayed in the <guilabel>Recent items</guilabel> 790 menu in the menu bar. 791 </para> 792 </listitem> 793 </varlistentry> 794 </variablelist> 751 795 </helptext> 752 796 -
trunk/src/clients/web/net/sf/basedb/clients/web/Base.java
r3045 r3492 40 40 import net.sf.basedb.core.PropertyFilter; 41 41 import net.sf.basedb.core.ItemQuery; 42 import net.sf.basedb.core.StringUtil; 42 43 import net.sf.basedb.core.Type; 43 44 import net.sf.basedb.core.Operator; … … 67 68 68 69 import java.awt.Color; 70 import java.util.ArrayList; 69 71 import java.util.Date; 72 import java.util.List; 70 73 import java.util.Set; 71 74 import java.util.Arrays; … … 390 393 391 394 // Current item 392 cc.setId(Values.getInt(request.getParameter("item_id"), cc.getId())); 395 String itemId = request.getParameter("item_id"); 396 cc.setId(Values.getInt(itemId, cc.getId())); 393 397 398 // Record this in the list of recently view items 399 if (itemId != null) 400 { 401 String recent = sc.getUserClientSetting("menu.mostRecent.viewed"); 402 List<String> recentItems = null; 403 if (recent == null) 404 { 405 recentItems = new ArrayList<String>(); 406 } 407 else 408 { 409 // Need a new list since Arrays.asList returns a read-only list 410 recentItems = new ArrayList<String>(Arrays.asList(recent.split(":"))); 411 } 412 String thisItem = itemType.name()+"="+itemId; 413 recentItems.remove(thisItem); 414 recentItems.add(0, thisItem); 415 int maxRecent = Values.getInt(sc.getUserClientSetting("menu.mostRecent.maxViewed"), 6); 416 if (recentItems.size() > maxRecent) recentItems = recentItems.subList(0, maxRecent); 417 sc.setUserClientSetting("menu.mostRecent.viewed", StringUtil.join(recentItems, ":", true)); 418 } 394 419 // Visible columns 395 420 cc.setSetting("columns", Values.getString(request.getParameter("columns"), cc.getSetting("columns"))); … … 467 492 if (extraValueContext != null) extraValueContext.getSelected().clear(); 468 493 469 String itemId = request.getParameter("item_id");470 494 if (itemId != null && request.getParameter(itemId) == null) 471 495 { -
trunk/www/include/menu.jsp
r3021 r3492 57 57 import="java.util.HashMap" 58 58 import="java.util.ArrayList" 59 import="java.util.List" 60 import="java.util.Arrays" 59 61 %> 60 62 <%@ taglib prefix="m" uri="/WEB-INF/menu.tld" %> … … 73 75 { 74 76 // Recently used items menu 75 String mostRecent= Values.getString(sc.getUserClientSetting("menu.mostRecent"),77 String stickyItems = Values.getString(sc.getUserClientSetting("menu.mostRecent"), 76 78 "EXPERIMENT:BIOASSAYSET:TRANSFORMATION"); 77 79 boolean loadNames = Values.getBoolean(sc.getUserClientSetting("menu.mostRecent.loadNames"), 78 80 false); 81 String recentItems = sc.getUserClientSetting("menu.mostRecent.viewed"); 79 82 DbControl dc = loadNames ? sc.newDbControl() : null; 80 83 try … … 87 90 <% 88 91 int numItems = 0; 89 for (String recentItem : mostRecent.split(":")) 92 // Recently viewed items 93 List<String> recentlyViewed = recentItems == null ? 94 new ArrayList<String>() : Arrays.asList(recentItems.split(":")); 95 if (recentlyViewed.size() > 0) 90 96 { 91 Item itemType = Item.valueOf(recentItem); 92 ItemContext cc = sc.getCurrentContext(itemType); 93 if (cc.getId() != 0) 97 %> 98 <m:menuitem 99 title="Recently viewed items" 100 style="font-weight: bold; color: #000000; background: #e8e8e8;" 101 enabled="false" 102 /> 103 <m:menuseparator /> 104 <% 105 for (String recent : recentlyViewed) 94 106 { 95 String shortName = ""; 96 String fullName = ""; 97 if (loadNames) 107 String[] tmp = recent.split("="); 108 Item itemType = Item.valueOf(tmp[0]); 109 int itemId = Values.getInt(tmp[1], 0); 110 if (itemId != 0) 98 111 { 99 try 112 String shortName = ""; 113 String fullName = ""; 114 if (loadNames) 100 115 { 101 BasicItem item = itemType.getById(dc, cc.getId()); 102 fullName = ((Nameable)item).getName(); 103 shortName = ": " + StringUtil.trimString(fullName, 20); 116 try 117 { 118 BasicItem item = itemType.getById(dc, itemId); 119 fullName = ((Nameable)item).getName(); 120 shortName = HTML.encodeTags(StringUtil.trimString(fullName, 20)); 121 } 122 catch (Throwable t) 123 { 124 continue; 125 } 104 126 } 105 catch (Throwable t) 106 {} 107 } 108 else 109 { 110 fullName = itemType.toString() + "; id=" + cc.getId(); 111 } 112 numItems++; 113 %> 114 <m:menuitem 115 title="<%=itemType.toString()+HTML.encodeTags(shortName)%>" 116 onclick="<%="Main.viewOrEditItem('" + ID + "', '" + itemType.name() + "', " + cc.getId() + ")"%>" 117 tooltip="<%="Go to " + HTML.encodeTags(fullName)%>" 118 /> 119 <% 120 if (itemType == Item.BIOASSAYSET) 121 { 122 // Add menu for Experiment explorer as well 127 else 128 { 129 fullName = itemType.toString() + "; id=" + itemId; 130 shortName = itemType + " (id=" + itemId + ")"; 131 } 132 numItems++; 123 133 %> 124 134 <m:menuitem 125 title="<%= "Experiment explorer"+HTML.encodeTags(shortName)%>"126 onclick="<%=" location.href = '"+root+"views/experiments/explorer/view/index.jsp?ID=" + ID + "&bioassayset_id="+cc.getId()+"'"%>"127 tooltip=" Go to experiment explorer"135 title="<%=numItems + ". " + shortName%>" 136 onclick="<%="Main.viewOrEditItem('" + ID + "', '" + itemType.name() + "', " + itemId + ")"%>" 137 tooltip="<%="Go to " + HTML.encodeTags(fullName) + " (" + itemType + ")"%>" 128 138 /> 129 139 <% … … 131 141 } 132 142 } 133 if ( numItems ==0)143 if (stickyItems != null && stickyItems.length() > 0) 134 144 { 145 int numSticky = 0; 146 if (numItems > 0) 147 { 148 %> 149 <m:menuseparator /> 150 <% 151 } 135 152 %> 136 153 <m:menuitem 137 title="<i>- no recent items -</i>" 138 enabled="false" 139 /> 154 title="Sticky items" 155 style="font-weight: bold; color: #000000; background: #e8e8e8;" 156 enabled="false" 157 /> 158 <m:menuseparator /> 140 159 <% 160 // Sticky items 161 for (String recentItem : stickyItems.split(":")) 162 { 163 Item itemType = Item.valueOf(recentItem); 164 ItemContext cc = sc.getCurrentContext(itemType); 165 if (cc.getId() != 0) 166 { 167 String shortName = ""; 168 String fullName = ""; 169 if (loadNames) 170 { 171 try 172 { 173 BasicItem item = itemType.getById(dc, cc.getId()); 174 fullName = ((Nameable)item).getName(); 175 shortName = ": " + HTML.encodeTags(StringUtil.trimString(fullName, 20)); 176 } 177 catch (Throwable t) 178 { 179 continue; 180 } 181 } 182 else 183 { 184 fullName = itemType.toString() + "; id=" + cc.getId(); 185 shortName = " (id=" + cc.getId() + ")"; 186 } 187 numItems++; 188 numSticky++; 189 %> 190 <m:menuitem 191 title="<%=itemType + shortName%>" 192 onclick="<%="Main.viewOrEditItem('" + ID + "', '" + itemType.name() + "', " + cc.getId() + ")"%>" 193 tooltip="<%="Go to " + HTML.encodeTags(fullName) + " (" + itemType + ")"%>" 194 /> 195 <% 196 if (itemType == Item.BIOASSAYSET) 197 { 198 // Add menu for Experiment explorer as well 199 %> 200 <m:menuitem 201 title="<%="Experiment explorer"+HTML.encodeTags(shortName)%>" 202 onclick="<%="location.href = '"+root+"views/experiments/explorer/view/index.jsp?ID=" + ID + "&bioassayset_id="+cc.getId()+"'"%>" 203 tooltip="Go to experiment explorer" 204 /> 205 <% 206 } 207 } 208 } 209 if (numSticky == 0) 210 { 211 %> 212 <m:menuitem 213 title="<i>- no sticky items -</i>" 214 enabled="false" 215 /> 216 <% 217 } 141 218 } 142 219 %> -
trunk/www/my_base/user/preferences.jsp
r3480 r3492 93 93 return false; 94 94 } 95 var recent = parseInt(frm.recent.value); 96 if (!Numbers.isInteger(frm.recent.value) || recent < 0 || recent > 10) 95 return true; 96 } 97 function validatePlugins() 98 { 99 return true; 100 } 101 function validateMostRecent() 102 { 103 var frm = document.forms['preferences']; 104 var maxViewed = parseInt(frm.maxViewed.value); 105 if (!Numbers.isInteger(frm.maxViewed.value) || maxViewed < 0 || maxViewed > 10) 97 106 { 98 frm.recent.focus(); 99 frm.recent.select(); 107 frm.maxViewed.focus(); 108 frm.maxViewed.select(); 109 alert("Please enter a value between 0 and 10."); 110 return false; 111 } 112 var maxUsed = parseInt(frm.maxUsed.value); 113 if (!Numbers.isInteger(frm.maxUsed.value) || maxUsed < 0 || maxUsed > 10) 114 { 115 frm.maxUsed.focus(); 116 frm.maxUsed.select(); 100 117 alert("Please enter a value between 0 and 10."); 101 118 return false; … … 103 120 return true; 104 121 } 105 function validatePlugins()106 {107 return true;108 }109 function validateMostRecent()110 {111 return true;112 }113 122 // Changes the scale value 114 123 function setScale(newScale) … … 123 132 if (TabControl.validateActiveTab('settings')) 124 133 { 125 var enabled = frm.enabled;126 for (var i = 0; i < enabled.length; i++) // >134 var sticky_items = frm.sticky_items; 135 for (var i = 0; i < sticky_items.length; i++) // > 127 136 { 128 enabled.options[i].selected = true;137 sticky_items.options[i].selected = true; 129 138 } 130 139 frm.submit(); … … 172 181 { 173 182 var frm = document.forms['preferences']; 174 var enabled = frm.enabled;175 var disabled = frm.disabled;183 var sticky_items = frm.sticky_items; 184 var all_items = frm.all_items; 176 185 <% 177 186 String mostRecent = Values.getString(sc.getUserClientSetting("menu.mostRecent"), … … 183 192 for (Item item : items) 184 193 { 185 String list = current.contains(item.name()) ? " enabled" : "disabled";194 String list = current.contains(item.name()) ? "sticky_items" : "all_items"; 186 195 %> 187 196 var option = new Option('<%=item.toString()%>', '<%=item.name()%>'); … … 281 290 ><a href="javascript:document.forms['preferences'].toolbar[2].click()">Text only</a> 282 291 </td> 283 </tr> 284 <tr> 285 <td class="prompt">Recently used items</td> 286 <td> 287 <input class="text required" type="text" name="recent" 288 value="<%=Values.getInt(sc.getUserClientSetting("appearance.recent"), 4)%>" 289 size="4" maxlength="2" onkeypress="return Numbers.integerOnly(event);"> 290 (0 - 10) 291 </td> 292 </tr> 293 292 </tr> 294 293 <tr> 295 294 <td class="prompt">Ratio color range</td> … … 446 445 <t:tab 447 446 id="mostRecent" 448 title=" Most recent"447 title="Recent items" 449 448 validate="validateMostRecent()" 450 449 helpid="userpreferences.mostrecent" 451 tooltip="Specify which items should be shown in the 'Most recent' menu."450 tooltip="Specify how many items to remember in lists of 'most recent items'" 452 451 > 452 <% 453 boolean loadNames = Values.getBoolean(sc.getUserClientSetting("menu.mostRecent.loadNames"), false); 454 %> 455 <table border=0 cellspacing=0 cellpadding=2 class="form"> 456 <tr valign="baseline"> 457 <td class="prompt">Recently viewed items</td> 458 <td> 459 <input class="text required" type="text" name="maxViewed" 460 value="<%=Values.getInt(sc.getUserClientSetting("menu.mostRecent.maxViewed"), 6)%>" 461 size="4" maxlength="2" onkeypress="return Numbers.integerOnly(event);"> 462 (0 - 10) 463 </td> 464 </tr> 465 <tr> 466 <td class="prompt">Recently used items</td> 467 <td> 468 <input class="text required" type="text" name="maxUsed" 469 value="<%=Values.getInt(sc.getUserClientSetting("appearance.recent"), 4)%>" 470 size="4" maxlength="2" onkeypress="return Numbers.integerOnly(event);"> 471 (0 - 10) 472 </td> 473 </tr> 474 <tr> 475 <td class="prompt">Load the names of all items</td> 476 <td> 477 <input type="checkbox" name="loadNames" value="1" <%=loadNames ? "checked" : ""%>> 478 </td> 479 </tr> 480 </table> 453 481 <table border=0 cellspacing=0 cellpadding=2> 482 454 483 <tr> 455 484 <td style="vertical-align: middle"> 456 485 <br> 457 486 <base:button 458 onclick="moveSelected(document.forms['preferences']. enabled, false)"487 onclick="moveSelected(document.forms['preferences'].sticky_items, false)" 459 488 title="<img src='../../images/move_up.gif' alt='' style='vertical-align: middle;'>" 460 489 tooltip="Move up" 461 490 /><p> 462 491 <base:button 463 onclick="moveSelected(document.forms['preferences']. enabled, true)"492 onclick="moveSelected(document.forms['preferences'].sticky_items, true)" 464 493 title="<img src='../../images/move_down.gif' alt='' style='vertical-align: middle;'>" 465 494 tooltip="Move down" … … 468 497 </td> 469 498 <td> 470 <b>S how in 'Most recent' menu</b><br>471 <select name=" enabled" multiple size="14" style="width: 12em;"472 ondblclick="moveBetween(document.forms['preferences']. enabled, document.forms['preferences'].disabled)">499 <b>Sticky items</b><br> 500 <select name="sticky_items" multiple size="10" style="width: 12em;" 501 ondblclick="moveBetween(document.forms['preferences'].sticky_items, document.forms['preferences'].all_items)"> 473 502 </select> 474 503 </td> … … 477 506 <br> 478 507 <base:button 479 onclick="moveBetween(document.forms['preferences']. disabled, document.forms['preferences'].enabled)"508 onclick="moveBetween(document.forms['preferences'].all_items, document.forms['preferences'].sticky_items)" 480 509 title="<img src='../../images/move_left.gif' alt='' style='vertical-align: middle;'>" 481 510 tooltip="Show this item in the 'Most recent' menu" 482 511 /><p> 483 512 <base:button 484 onclick="moveBetween(document.forms['preferences']. enabled, document.forms['preferences'].disabled)"513 onclick="moveBetween(document.forms['preferences'].sticky_items, document.forms['preferences'].all_items)" 485 514 title="<img src='../../images/move_right.gif' alt='' style='vertical-align: middle;'>" 486 515 tooltip="Don't show this item in the 'Most recent' menu" … … 490 519 491 520 <td> 492 <b> Don't show</b><br>493 <select name=" disabled" multiple size="14" style="width: 12em;"494 ondblclick="moveBetween(document.forms['preferences']. disabled, document.forms['preferences'].enabled)">521 <b>All items</b><br> 522 <select name="all_items" multiple size="10" style="width: 12em;" 523 ondblclick="moveBetween(document.forms['preferences'].all_items, document.forms['preferences'].sticky_items)"> 495 524 </select> 496 525 </td> 497 526 </tr> 498 527 </table> 499 <%500 boolean loadNames = Values.getBoolean(sc.getUserClientSetting("menu.mostRecent.loadNames"), false);501 %>502 <input type="checkbox" name="loadNames" value="1" <%=loadNames ? "checked" : ""%>>503 <a href="javascript:document.forms['preferences'].loadNames.click()"504 >Load the names of all recent items</a>505 528 </t:tab> 506 529 </t:tabcontrol> -
trunk/www/my_base/user/submit_user.jsp
r3480 r3492 93 93 sc.setUserClientSetting("appearance.fontsize", Values.getString(request.getParameter("fontsize"), "size_m.css")); 94 94 sc.setSessionSetting("appearance.scale", new Float(newScale / 100.0)); 95 int newMaxRecent = Values.getInt(request.getParameter("recent"), 4);96 sc.setUserClientSetting("appearance.recent", Integer.toString(newMaxRecent));97 sc.setSessionSetting("appearance.recent", newMaxRecent);98 95 ItemContext cc = sc.getCurrentContext(Item.USERCLIENTSETTING); 99 96 int maxRecent = Base.getMaxRecent(sc); … … 130 127 FormatterSettings.setNumDecimals(sc, numDecimals); 131 128 129 // Plugins tab 132 130 sc.setUserClientSetting("plugins.sendmessage", Values.getString(request.getParameter("sendmessage"), "0")); 133 131 sc.setUserClientSetting("plugins.removejob", Values.getString(request.getParameter("removejob"), "0")); 134 String[] mostRecent = request.getParameterValues("enabled"); 132 133 // Recent items tab 134 int newMaxUsed = Values.getInt(request.getParameter("maxUsed"), 4); 135 sc.setUserClientSetting("appearance.recent", Integer.toString(newMaxUsed)); 136 sc.setSessionSetting("appearance.recent", newMaxUsed); 137 int newMaxViewed = Values.getInt(request.getParameter("maxViewed"), 6); 138 sc.setUserClientSetting("menu.mostRecent.maxViewed", Integer.toString(newMaxViewed)); 139 sc.setUserClientSetting("menu.mostRecent.loadNames", Values.getString(request.getParameter("loadNames"), "0")); 140 141 String[] stickyItems = request.getParameterValues("sticky_items"); 135 142 sc.setUserClientSetting("menu.mostRecent", 136 mostRecent == null ? "" : Values.getString(Arrays.asList(mostRecent), ":", true)); 137 sc.setUserClientSetting("menu.mostRecent.loadNames", Values.getString(request.getParameter("loadNames"), "0")); 143 stickyItems == null ? "" : Values.getString(Arrays.asList(stickyItems), ":", true)); 138 144 139 145 message = "Preferences saved";
Note: See TracChangeset
for help on using the changeset viewer.