NpsResource indicates resource object.
| String |
id resource’s unique identification. Readonly |
| String |
name title caption resource’s name |
| NpsSite |
site the site which resource located |
| int |
type type=0 means it is a picture type=1 means it is a documentation type=2 means it is an video type=3 means it is a sound type=4 means it is a flash file, and type=5 mean it is other file. |
| String |
suffix suffix name, i.e.: .jpg. Readonly |
| double |
size File length in bytes. Readonly |
| NpsFile |
file The file is attached. Readonly. |
| String |
url URL path. Readonly |
| String |
tags mutiple tags will be seperated by '-'. Readonly |
| void |
new(NpsSite site,NpsFile file) Constructor. To create an resource located in "site" with the "file", the default title is the name of "file". |
| void |
ExtractFile(String file) write attachment into file names which designated by "file". |
| NpsAttach |
FitTo(int width,int height) convert pictures into attachment whose "width" and "height" are designated and return to the converted object. width=-1: scaling width as self-defined. height=-1: scaling heigt as self-defined. |
| boolean |
HasField(String name) whether it contains field or not. “true”: yes “false”: no |
| Object |
GetFieldValue(String name) return to the field value designated by “name” Text content will return “string” object while others will return relevant digital type, character string type and date type according to database’s definition. |
| String |
GetFieldValueFormatted(String name,String format) Format and return the field value designated by “name” according to the requirement of “format”. |
| String |
GetFieldValueLimitted(String name,int wordcount) return to the front “wordcount” value among field values designated by “name”. Digits will not be truncated. “wordcount<=0”: it will return to the whole field value. |
| void |
Save() save to database |
| void |
UpdateContent(String content) Update memo for resource |
| void |
UpdateContentByFile(NpsFile file) Update memo by file |
| void |
CopyTo(NpsSite site) copy to other site |
| NpsArticle |
PublishTo(NpsTopic topic) publish to topic, return the article created. |
| void |
Delete() delete this resource |
| void |
AddTags(String tags) add tags, mutiple tags should be seperated by '_' |
| void |
Clear() clear all temp files |