2011-08-05 16:53:54 +02:00
|
|
|
/**
|
2011-08-06 16:36:44 +02:00
|
|
|
* eGroupWare eTemplate2 - JS Description object
|
2011-08-05 16:53:54 +02:00
|
|
|
*
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
|
|
* @package etemplate
|
|
|
|
* @subpackage api
|
|
|
|
* @link http://www.egroupware.org
|
|
|
|
* @author Andreas Stöckel
|
|
|
|
* @copyright Stylite 2011
|
|
|
|
* @version $Id$
|
|
|
|
*/
|
|
|
|
|
2011-08-07 15:43:46 +02:00
|
|
|
"use strict";
|
|
|
|
|
2011-08-05 16:53:54 +02:00
|
|
|
/*egw:uses
|
|
|
|
jquery.jquery;
|
2011-08-10 16:36:31 +02:00
|
|
|
et2_baseWidget;
|
2011-08-05 16:53:54 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class which implements the "description" XET-Tag
|
|
|
|
*/
|
2011-08-10 16:36:31 +02:00
|
|
|
var et2_description = et2_baseWidget.extend({
|
|
|
|
|
|
|
|
attributes: {
|
|
|
|
"value": {
|
|
|
|
"name": "Caption",
|
|
|
|
"type": "string",
|
|
|
|
"description": "Displayed text"
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Options converted from the "options"-attribute.
|
|
|
|
*/
|
|
|
|
"font_style": {
|
|
|
|
"name": "Font Style",
|
|
|
|
"type": "string",
|
|
|
|
"description": "Style may be a compositum of \"b\" and \"i\" which " +
|
|
|
|
" renders the text bold and/or italic."
|
|
|
|
},
|
|
|
|
"href": {
|
|
|
|
"name": "Link Target",
|
|
|
|
"type": "string",
|
|
|
|
"description": "Link URL, empty if you don't wan't to display a link."
|
|
|
|
},
|
|
|
|
"activate_links": {
|
|
|
|
"name": "Replace URLs",
|
|
|
|
"type": "boolean",
|
|
|
|
"default": false,
|
|
|
|
"description": "If set, URLs in the text are automatically replaced " +
|
|
|
|
"by links"
|
|
|
|
},
|
|
|
|
"label_for": {
|
|
|
|
"name": "Label for widget",
|
|
|
|
"type": "string",
|
|
|
|
"description": "Marks the text as label for the given widget."
|
|
|
|
},
|
|
|
|
"extra_link_target": {
|
|
|
|
"name": "Link target",
|
|
|
|
"type": "string",
|
|
|
|
"default": "_self",
|
|
|
|
"description": "Link target descriptor"
|
|
|
|
},
|
|
|
|
"extra_link_popup": {
|
|
|
|
"name": "Popup",
|
|
|
|
"type": "string",
|
|
|
|
"description": "???"
|
|
|
|
},
|
|
|
|
"extra_link_title": {
|
|
|
|
"name": "Link Title",
|
|
|
|
"type": "string",
|
|
|
|
"description": "Link title which is displayed on mouse over."
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
legacyOptions: ["font_style", "href", "activate_links", "label_for",
|
|
|
|
"extra_link_target", "extra_link_popup", "extra_link_title"],
|
2011-08-05 16:53:54 +02:00
|
|
|
|
|
|
|
init: function(_parent) {
|
2011-08-10 16:36:31 +02:00
|
|
|
this._super.apply(this, arguments);
|
|
|
|
|
|
|
|
this.value = "";
|
|
|
|
this.font_style = "";
|
|
|
|
|
2011-08-07 15:43:46 +02:00
|
|
|
this.span = $j(document.createElement("span"))
|
|
|
|
.addClass("et2_label");
|
2011-08-05 16:53:54 +02:00
|
|
|
|
2011-08-10 16:36:31 +02:00
|
|
|
this.setDOMNode(this.span[0]);
|
2011-08-05 16:53:54 +02:00
|
|
|
},
|
|
|
|
|
2011-08-16 14:31:18 +02:00
|
|
|
set_value: function(_value) {
|
|
|
|
this.value = _value;
|
2011-08-05 16:53:54 +02:00
|
|
|
|
2011-08-16 14:31:18 +02:00
|
|
|
this.span.text(_value);
|
2011-08-05 16:53:54 +02:00
|
|
|
},
|
|
|
|
|
2011-08-10 16:36:31 +02:00
|
|
|
set_font_style: function(_value) {
|
2011-08-16 14:31:18 +02:00
|
|
|
this.font_style = _value;
|
2011-08-10 16:36:31 +02:00
|
|
|
|
2011-08-16 14:31:18 +02:00
|
|
|
this.span.toggleClass("et2_bold", _value.indexOf("b") >= 0);
|
|
|
|
this.span.toggleClass("et2_italic", _value.indexOf("i") >= 0);
|
2011-08-05 16:53:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2011-08-06 16:36:44 +02:00
|
|
|
et2_register_widget(et2_description, ["description", "label"]);
|
2011-08-05 16:53:54 +02:00
|
|
|
|
|
|
|
|