From RPM Wiki
| Table of contents |
Summary
For various things in RPM a user can indicate a thing as being a favorite. This affects the way the thing is displayed, giving the user some personal organization functionality. All favorites in RPM are handled in a standard way.
Details
Star graphic
Favorite status and selection are both conveyed through a star icon. A star outline indicates the thing is not a favorite and clicking the outline will mark the thing as a favorite. Conversely, a favorite thing will have a gold star beside it and clicking the gold star will remove the favorite status from that thing. This click provides immediate feedback through the changing of the icon and possible re-organization of the thing if it was being displayed in a list by favorites.
Control format
The initial favorite/not favorite status is indicated by the src of the image. The id passed to the server to identify the thing is set as the name attribute.Favorite
<img src="../images/icon_fav.gif" class="fav" name="123;1234">
Not favorite
<img src="../images/icon_fav_no.gif" class="fav" name="123;1234">
When a dark background color is required, like in a grid control bar, use this alternate image pair:
icon_fav_dark.gif icon_fav_dark_no.gif
No other code is required as long as the default style sheet is being called (which every page requires). The client side code automatically takes care of keeping the right background color and any sorting.
Communication
When the user clicks the favorite icon, the desired change is communicated to the server with an asynchronous call from JScript. This means there is no page load required.
- The value in the control's "name" attribute is passed as the "Item" parameter to the favorite page. The user this is for is indicated by the session. Just the item ID is passed, not an indication of favorite or not-favorite. The server just assumes the user is making it the opposite of whatever it already is.
- The server replies with an integer:
- -1 Error
- 0 Favorite
- 1 Not a favorite
- When used for views or other things with multiple type possibilities, the JScript may need to reorganize the thing. In that case additional integers past 1 are used to indicate other, non-favorite conditions. Example for views:
- -1 Error
- 0 Favorite
- 1 Built-in
- 2 Shared
- 3 Private
Error handling
If the server returns an error or the request times out, an error indicator is displayed under the mouse cursor. No other display or organization change is made. Possible errors:
- Thing has been deleted
- User no longer has access to thing
History
- Phoenix: Control added
- This page was last modified 21:21, 1 Dec 2005.
- This page has been accessed 940 times.
