src/js/widgets/createAnnotationWidget.js
author hamidouk
Thu, 29 Dec 2011 17:04:56 +0100
branchpopcorn-port
changeset 547 5b58a108086a
parent 543 5856fab9596c
child 548 96a188138c20
permissions -rw-r--r--
adding support for keywords.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
543
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
     1
IriSP.createAnnotationWidget = function(Popcorn, config, Serializer) {
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
     2
  IriSP.Widget.call(this, Popcorn, config, Serializer);
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
     3
  this._hidden = true;
547
5b58a108086a adding support for keywords.
hamidouk
parents: 543
diff changeset
     4
  this.keywords = IriSP.widgetsDefaults["createAnnotationWidget"].keywords;
543
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
     5
};
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
     6
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
     7
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
     8
IriSP.createAnnotationWidget.prototype = new IriSP.Widget();
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
     9
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    10
IriSP.createAnnotationWidget.prototype.clear = function() {
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    11
    this.selector.find(".Ldt-SaTitle").text("");
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    12
    this.selector.find(".Ldt-SaDescription").text("");
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    13
    this.selector.find(".Ldt-SaKeywordText").text("");
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    14
};
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    15
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    16
IriSP.createAnnotationWidget.prototype.showWidget = function() {
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    17
  this.layoutManager.slice.after("ArrowWidget")
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    18
                          .before("createAnnotationWidget")
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    19
                          .jQuerySelector().hide();
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    20
  this.selector.show();
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    21
};
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    22
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    23
IriSP.createAnnotationWidget.prototype.hideWidget = function() {
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    24
  this.selector.hide();
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    25
  this.layoutManager.slice.after("ArrowWidget")
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    26
                          .before("createAnnotationWidget")
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    27
                          .jQuerySelector().show();
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    28
};
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    29
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    30
IriSP.createAnnotationWidget.prototype.draw = function() {
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    31
  var _this = this;
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    32
547
5b58a108086a adding support for keywords.
hamidouk
parents: 543
diff changeset
    33
  var annotationMarkup = IriSP.templToHTML(IriSP.createAnnotationWidget_template,
5b58a108086a adding support for keywords.
hamidouk
parents: 543
diff changeset
    34
                                           {keywords: this.keywords});
543
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    35
	this.selector.append(annotationMarkup);
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    36
  this.selector.hide();
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    37
  
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    38
  this._Popcorn.listen("IriSP.PlayerWidget.AnnotateButton.clicked", 
547
5b58a108086a adding support for keywords.
hamidouk
parents: 543
diff changeset
    39
                        IriSP.wrap(this, this.handleAnnotateSignal));  
543
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    40
};
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    41
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    42
IriSP.createAnnotationWidget.prototype.handleAnnotateSignal = function() {
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    43
  if (this._hidden == false) {
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    44
    this.selector.hide();
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    45
    this._hidden = true;
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    46
  } else {
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    47
    this.selector.show();
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    48
    this._hidden = false;
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    49
  }
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    50
};