source: ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/Comment.as @ 1896

Last change on this file since 1896 was 1896, checked in by twagoo, 12 years ago

Linked delete button on comments to delete service. Extended DeleteService? to allow deletion of comments in addition to items. Extended Comment to provide required information. Refs #185

File size: 1.7 KB
Line 
1package clarin.cmdi.componentregistry.common
2{
3        import clarin.cmdi.componentregistry.services.Config;
4
5        public class Comment implements XmlAble
6        {
7                [Bindable]
8                public var comments:String;
9               
10                [Bindable]
11                public var userName:String;
12               
13                [Bindable]
14                public var commentDate:String;
15               
16                public var componentDescriptionId:String;
17                public var profileDescriptionId:String;
18                public var id:String;
19                public var canDelete:Boolean;
20                public var itemDescription:ItemDescription;
21                public var dataUrl:String;
22               
23                public function Comment():void{
24                       
25                }
26               
27                public function create(comment:XML, itemDescription:ItemDescription):void{
28                        this.comments = comment.comments;
29                        this.commentDate  = DateUtils.formatDateString(comment.commentDate);
30                        this.componentDescriptionId = comment.componentDescriptionId;
31                        this.profileDescriptionId = comment.profileDescriptionId;
32                        this.id = comment.id;
33                        this.userName = comment.userName;
34                        this.canDelete = comment.canDelete == "true";
35                       
36                        this.itemDescription = itemDescription;
37                        if(itemDescription.isProfile){
38                                dataUrl = Config.instance.getProfileCommentsPath(itemDescription.id) + id;
39                        } else {
40                                dataUrl = Config.instance.getComponentCommentsPath(itemDescription.id) + id;
41                        }
42                }
43               
44                public function toXml():XML {
45                        var result:XML = <comment></comment>;
46                        result.appendChild(<comments>{comments}</comments>);
47                        result.appendChild(<commentDate>{commentDate}</commentDate>);
48                        if(profileDescriptionId){
49                                result.appendChild(<profileDescriptionId>{profileDescriptionId}</profileDescriptionId>);
50                        }
51                        if(componentDescriptionId){
52                                result.appendChild(<componentDescriptionId>{componentDescriptionId}</componentDescriptionId>);
53                        }
54                        result.appendChild(<userName>{userName}</userName>);
55                        return result;
56                }
57        }
58}
Note: See TracBrowser for help on using the repository browser.