RESOURCE statement is used for reading attachments of topic.
Note:For Custom topics, it will return a empty list always.
<res id=(id:STRING) topic=(topic:STRING) type=(type:STRING) where=(where:string) orderby=(orderby:string) from=(from:int) rows=(rows:int) page=(page:int) style=(style:String)>
--Input your text content here
</res>
Topic parameter must be placed after id parameter and before other parameters.
| parameters | type | meaning | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| id | STRING | Unique identification of the RS. It must begin with letters or underline. | ||||||||||||||||||||
| topic | STRING | The topic code that need to be inquired. You can quote article tag
and attachment tag only with the ID number of the RES. Optional, if topic is not assigned, then the system would calculate according to current context and pick the topic that current template belongs to. If topic assigned to empty string(""), it will retrive all attachments in current site. i.e.: a topic named “news” would be: <res id ="r1" topic="news"> <$r1.res_title$> </res> |
||||||||||||||||||||
| type | STRING | Optional. Indicate the type of attachment, expressed as attachment
suffix. Multiple types can be separated by “;”, space, “tab”, “,”
or “|” and is not case sensitive. If the type is not set, it means
all attachment will be taken. It equals type="*.*".
For example, ".jpg;.gif" means pictures matching jpg and gif format. ".jpg|.bmp|.gif" "*.jpg|.bmp|*.gif" ".jpg;.bmp;.gif" "jpg|bmp|gif" "jpg bmp gif" |
||||||||||||||||||||
| where | string |
Optional,Additional WHERE clause for SQL,and must appear with the topic parameters together.
The statement will appeare in the following SQL statement in red marked with where_clause.
select c.*,d.name creator_cn,e.unit from article a, attach b,resources c,users d,dept e,topic f Where a.Id=b.artid And c.id=b.resid and c.creator=d.id and d.dept=e.id and a.topic=f.id and (f.code='<$top_code$>' or f.code like '<$top_code$>.%') and f.siteid='<$site_id$>' and (where_clause) order by orderby_statement |
||||||||||||||||||||
| orderby | string |
Optional.The ORDER BY clause allows you to sort the records in your result set. "a.important desc,a.publishdate desc,a.createdate desc,a.id,b.idx" as default which means ordering by article's importance, publish date, create date, article and attachment's index in article. |
||||||||||||||||||||
| from | int | Optional, reading data from the item of number X. As default, it will calculate from number 0. |
||||||||||||||||||||
| rows | int | Optional, reading total items of X, All the rest data will be read if it haven’t been filled. | ||||||||||||||||||||
| page | int | Optional, pagination. System will automatically page when the
item number was reached.
|
||||||||||||||||||||
| style | String |
Optional, pagination style. Default value is "modern". A sample css style file comes with NPS, you could find it at <$NPS_HOME$>/css/pagebreak.css, the easies way is to copy it to your website and customize it.
|
Please use JAVA statement to set all fields showed below before RS statement.
ATTENTION PLS:
1.please re-set all fields but not one of them only.
2.If you only want to customize your CSS style, please just do it with /css/pagebreak.css
3.Format String Syntax, please see java Formatter class for more detail:
The format specifiers for general, character, and numeric types have the following syntax:
%[argument_index$][flags][width][.precision]conversion
The optional argument_index is a decimal integer indicating the position of the argument in the argument list. The first argument is referenced by "1$", the second by "2$", etc.
The optional flags is a set of characters that modify the output format. The set of valid flags depends on the conversion.
The optional width is a non-negative decimal integer indicating the minimum number of characters to be written to the output.
The optional precision is a non-negative decimal integer usually used to restrict the number of characters. The specific behavior depends on the conversion.
The required conversion is a character indicating how the argument should be formatted. The set of valid conversions for a given argument depends on the argument's data type.
| Conversion | Argument Category | Description |
|---|---|---|
'b', 'B' |
general | If the argument arg is null, then the result is "false". If arg is a boolean or Boolean, then the result is the string returned by String.valueOf(arg). Otherwise, the result is "true". |
'h', 'H' |
general | If the argument arg is null, then the result is "null". Otherwise, the result is obtained by invoking Integer.toHexString(arg.hashCode()). |
's', 'S' |
general | If the argument arg is null, then the result is "null". If arg implements Formattable, then arg.formatTo is invoked. Otherwise, the result is obtained by invoking arg.toString(). |
'c', 'C' |
character | The result is a Unicode character |
'd' |
integral | The result is formatted as a decimal integer |
'o' |
integral | The result is formatted as an octal integer |
'x', 'X' |
integral | The result is formatted as a hexadecimal integer |
'e', 'E' |
floating point | The result is formatted as a decimal number in computerized scientific notation |
'f' |
floating point | The result is formatted as a decimal number |
'g', 'G' |
floating point | The result is formatted using computerized scientific notation or decimal format, depending on the precision and the value after rounding. |
'a', 'A' |
floating point | The result is formatted as a hexadecimal floating-point number with a significand and an exponent |
't', 'T' |
date/time | Prefix for date and time conversion characters. See Date/Time Conversions. |
'%' |
percent | The result is a literal '%' ('\u0025') |
'n' |
line separator | The result is the platform-specific line separator |
| Symbol | Meaning | Value | Parameter(s) |
|---|---|---|---|
| PAGEBREAK_HEADER | page header | <div class='clear'></div><div class='pagebreak_modern'> | |
| PAGEBREAK_PREVPAGE | Previous Page | <span class='prevpage'><a href='%1$s'>Previous</a></span> | URL for previous |
| PAGEBREAK_NEXTPAGE | Next Page | <span class='nextpage'><a href='%1$s'>Next</a></span> | URL for next |
| PAGEBREAK_SKIP | Omit symbol | <span class='omit'>...</span> | |
| PAGEBREAK_PAGE | page number | <span class='page'><a href='%1$s'>%2$s</a></span> | URL,Page number |
| PAGEBREAK_CURRENTPAGE | Current page | <span class='currentpage'>%2$s</span> | URL,page number |
| PAGEBREAK_TOTAL | Summary Bar | <span class='total'>共%2$d页</span> | records, pages, records per page, current page number |
| PAGEBREAK_SELECTBOX | select box | <select class='page_select' onchange='javascript:window.location=this.value'> | |
| PAGEBREAK_FOOTER | page footer | </div> |
| Symbol | Meaning | Value | Parameter(s) |
|---|---|---|---|
| PAGEBREAK_HEADER | page header | <div class='clear'></div><div class='pagebreak_onebyone'> | |
| PAGEBREAK_PREVPAGE | Previous page | <span class='prevpage'><a href='%1$s'>上一页</a></span> | URL for previous page |
| PAGEBREAK_NEXTPAGE | Next page | <span class='nextpage'><a href='%1$s'>下一页</a></span> | URL for next page |
| PAGEBREAK_SKIP | Omit symbol | ||
| PAGEBREAK_PAGE | Page number | <span class='page'><a href='%1$s'>%2$s</a></span> | URL, page number |
| PAGEBREAK_CURRENTPAGE | Current page | <span class='currentpage'>%2$s</span> | URL, page number |
| PAGEBREAK_TOTAL | Summary bar | records, pages, records per page, current page number | |
| PAGEBREAK_SELECTBOX | select box | ||
| PAGEBREAK_FOOTER | page footer | </div> |
Get all attachments in current topic.
<res id="r1">
<$r1.res_title$>
</res>
Get all attachments in current topic too.
<res id="r1" topic=<$top_code$>>
<$r1.res_title$>
</res>
Get all attachments which importance is "very important", and order by publish date
<res id="r1" topic=<$top_code$> where="a.important=2" orderby="a.publishdate">
<$r1.res_title$>
</res>
Get top 20 attachments in topic coded in "top1"
<res id="r1" topic="top1" rows=20>
<$r1.res_title$>
</res>
Get all attachments in current topic,and display them by 20 rows per page
<res id="r1" page=20>
<$r1.res_title$>
</res>