src/js/widgets/createAnnotationWidget.js
author hamidouk
Wed, 28 Dec 2011 17:07:45 +0100
branchpopcorn-port
changeset 543 5856fab9596c
child 547 5b58a108086a
permissions -rw-r--r--
WIP - adding widget to create annotations.
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;
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
     4
};
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
IriSP.createAnnotationWidget.prototype = new IriSP.Widget();
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
     8
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
     9
IriSP.createAnnotationWidget.prototype.clear = function() {
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    10
    this.selector.find(".Ldt-SaTitle").text("");
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    11
    this.selector.find(".Ldt-SaDescription").text("");
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    12
    this.selector.find(".Ldt-SaKeywordText").text("");
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    13
};
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    14
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    15
IriSP.createAnnotationWidget.prototype.showWidget = function() {
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    16
  this.layoutManager.slice.after("ArrowWidget")
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    17
                          .before("createAnnotationWidget")
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    18
                          .jQuerySelector().hide();
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    19
  this.selector.show();
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    20
};
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    21
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    22
IriSP.createAnnotationWidget.prototype.hideWidget = function() {
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    23
  this.selector.hide();
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    24
  this.layoutManager.slice.after("ArrowWidget")
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    25
                          .before("createAnnotationWidget")
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    26
                          .jQuerySelector().show();
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    27
};
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    28
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    29
IriSP.createAnnotationWidget.prototype.draw = function() {
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    30
  var _this = this;
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    31
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    32
  var annotationMarkup = IriSP.templToHTML(IriSP.createAnnotationWidget_template);
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    33
	this.selector.append(annotationMarkup);
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    34
  this.selector.hide();
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    35
  
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    36
  this._Popcorn.listen("IriSP.PlayerWidget.AnnotateButton.clicked", 
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    37
                        IriSP.wrap(this, this.handleAnnotateSignal));
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    38
};
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    39
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    40
IriSP.createAnnotationWidget.prototype.handleAnnotateSignal = function() {
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    41
  if (this._hidden == false) {
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    42
    this.selector.hide();
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    43
    this._hidden = true;
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    44
  } else {
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    45
    this.selector.show();
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    46
    this._hidden = false;
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    47
  }
5856fab9596c WIP - adding widget to create annotations.
hamidouk
parents:
diff changeset
    48
};