Changeset 1893


Ignore:
Timestamp:
04/19/12 15:25:40 (12 years ago)
Author:
twagoo
Message:

Added delete buttons to comments owned by logged in user. Delete service not implemented yet.

Location:
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/CommentPanel.as

    r1710 r1893  
    33        import clarin.cmdi.componentregistry.common.Comment;
    44       
     5        import flash.events.MouseEvent;
     6       
    57        import mx.containers.HBox;
    68        import mx.containers.VBox;
     9        import mx.controls.Alert;
     10        import mx.controls.Button;
    711        import mx.controls.HRule;
    812        import mx.controls.Label;
    913        import mx.controls.Text;
    10 
     14        import mx.events.CloseEvent;
     15       
    1116        public class CommentPanel extends VBox
    1217        {
     
    4449                        commentText.percentWidth = 100;
    4550                        addChild(commentText);
    46 
     51                       
     52                        if(comment.canDelete) {                         
     53                                var deleteButton:Button = new Button();
     54                                deleteButton.label = "Delete comment";
     55                                deleteButton.addEventListener(MouseEvent.CLICK, confirmDeleteHandler);
     56                                addChild(deleteButton);
     57                        }
     58                       
    4759                        var rule:HRule = new HRule();
    4860                        rule.percentWidth = 100;
     
    5567                        commentText.text = comment.comments;
    5668                }
     69               
     70                private function confirmDeleteHandler(event:MouseEvent):void{
     71                        Alert.show("Are you sure you want to delete this comment?", "Delete comment", Alert.OK|Alert.CANCEL, this, deleteHandler);
     72                }
     73               
     74                private function deleteHandler(event:CloseEvent):void {
     75                        if(event.detail == Alert.OK){
     76                                Alert.show("Will delete","TODO");
     77                        }       
     78                }
    5779        }
    5880}
  • ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/Comment.as

    r1706 r1893  
    1515                public var profileDescriptionId:String;
    1616                public var id:String;
     17                public var canDelete:Boolean;
    1718               
    1819                public function Comment():void{
     
    2728                        this.id = comment.id;
    2829                        this.userName = comment.userName;
     30                        this.canDelete = comment.canDelete == "true";
    2931                }
    3032               
Note: See TracChangeset for help on using the changeset viewer.