Changeset 2129
- Timestamp:
- Mar 30, 2006, 9:50:56 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/Help.java
r2108 r2129 38 38 <pre> 39 39 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> 40 <base:help help_id="required_help sectionID" />40 <base:help help_id="required_helpexternalID" /> 41 41 </pre> 42 42 … … 44 44 <b>Syntax:</b> 45 45 <pre> 46 <base:icon 47 id=... 46 <base:help 48 47 helpid=... 49 48 clazz=... … … 64 63 </tr> 65 64 <tr> 66 <td>id</td>67 <td>-</td>68 <td>no</td>69 <td>70 The ID of the help. The value of this attribute goes71 directly into the standard <code>id</code> attribute.72 This means that if you need a reference to the note object in your own73 JavaScript code, you may for example use the following code:74 <p>75 <code>76 help = document.getElementById('<id>');77 </code>78 </td>79 </tr>80 <tr>81 65 <td>helpid</td> 82 66 <td></td> … … 86 70 to be identified with. 87 71 </td> 88 </tr> 72 </tr> 89 73 <tr> 90 74 <td>clazz</td> … … 200 184 return this.helpid; 201 185 } 202 186 203 187 public void setClazz(String clazz) 204 188 { … … 259 243 { 260 244 page = (Page)findAncestorWithClass(this, Page.class); 261 if (page == null) throw new JspTagException("Tag <base: icon> must be inside a <base:page> tag");245 if (page == null) throw new JspTagException("Tag <base:help > must be inside a <base:page> tag"); 262 246 if (!isVisible()) return SKIP_BODY; 263 247 264 248 String theStyle = getStyle(); 249 265 250 if (getOnClick() != null) 266 251 { 267 252 theStyle = Values.getString(theStyle) + "cursor: pointer;"; 268 253 } 269 270 254 StringBuilder sb = new StringBuilder(); 271 sb.append("<a href=\"javascript:Main.openHelp('").append( getHelpid()).append("')\">");272 sb.append(" <img border=0");273 if (getId() != null) sb.append(" id=\"").append(getId()).append("\"");255 sb.append("<a href=\"javascript:Main.openHelp('").append(pageContext.getRequest().getParameter("ID")); 256 sb.append("' ,'").append(getHelpid()).append("')\">"); 257 sb.append("<img border=0"); 274 258 if (getClazz() != null) sb.append(" class=\"").append(getClazz()).append("\""); 275 259 if (theStyle != null) sb.append(" style=\"").append(theStyle).append("\""); -
trunk/src/core/common-queries.xml
r2104 r2129 1611 1611 </description> 1612 1612 </query> 1613 1614 <query id="GET_HELP_FOR_EXTERNAL_ID" type="HQL"> 1615 <sql> 1616 SELECT hlp 1617 FROM HelpData hlp 1618 WHERE hlp.externalId = :externalId AND hlp.client = :client 1619 </sql> 1620 <description> 1621 A Hibernate query that loads a help text. 1622 </description> 1623 </query> 1613 1624 1614 1625 </predefined-queries> -
trunk/src/core/net/sf/basedb/core/Client.java
r2021 r2129 26 26 27 27 import net.sf.basedb.core.data.ClientData; 28 import net.sf.basedb.core.data.HelpData; 28 29 import net.sf.basedb.core.query.Restrictions; 29 30 import net.sf.basedb.core.query.Expressions; … … 275 276 return Help.getQuery(this); 276 277 } 277 278 279 /** 280 Get a <code>Help</code> item when you know the external ID. 281 282 @param dc The <code>DbControl</code> which will be used for 283 permission checking and database access. 284 @param externalId The external id of the item to load 285 @return The <code>Help</code> item 286 @throws ItemNotFoundException If an item with the specified ID is not found 287 @throws PermissionDeniedException If the logged in user doesn't have 288 {@link Permission#READ READ} permission for the item 289 @throws BaseException If there is another error 290 */ 291 public Help getHelpByExternalId(DbControl dc, String externalId) 292 throws ItemNotFoundException, PermissionDeniedException, BaseException 293 { 294 org.hibernate.Query query = HibernateUtil.getPredefinedQuery(dc.getHibernateSession(), 295 "GET_HELP_FOR_EXTERNAL_ID"); 296 /* 297 SELECT hlp 298 FROM HelpData hlp 299 WHERE hlp.externalId = :externalId AND hlp.client = :client 300 */ 301 query.setString("externalId", externalId); 302 query.setEntity("client", getData()); 303 Help h = dc.getItem(Help.class, HibernateUtil.loadData(HelpData.class, query)); 304 if (h == null) throw new ItemNotFoundException("Help[externalId="+externalId+"]"); 305 return h; 306 } 278 307 } 279 308 -
trunk/www/WEB-INF/base.tld
r2108 r2129 304 304 <tagclass>net.sf.basedb.clients.web.taglib.Help</tagclass> 305 305 <attribute> 306 <name>id</name>307 <required>false</required>308 <rtexprvalue>true</rtexprvalue>309 </attribute>310 <attribute>311 306 <name>helpid</name> 312 307 <required>true</required> 313 308 <rtexprvalue>true</rtexprvalue> 314 </attribute> 309 </attribute> 315 310 <attribute> 316 311 <name>clazz</name> -
trunk/www/include/scripts/main.js
r2113 r2129 95 95 url += '&disabled='+(disabled ? '1' : '0'); 96 96 Main.openPopup(url, title.replace(/[^\w]/g, ''), 640, 550); 97 } 98 99 /* 100 Opens a popupwindow with helptext 101 102 @param session The ID of the session. 103 @param helpid The id of the helptext to be displayed. 104 */ 105 this.openHelp = function(sessionid, helpid) 106 { 107 var url = getRoot()+'common/help/view_help.jsp?ID='+sessionid+'&external_id='+helpid; 108 Main.openPopup(url, 'Help', 640, 550); 97 109 } 98 110
Note: See TracChangeset
for help on using the changeset viewer.