summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Brachold <vdr07@deltab.de>2009-11-28 17:09:03 +0000
committerAndreas Brachold <vdr07@deltab.de>2009-11-28 17:09:03 +0000
commit65ababad8a7ef911f29a29cfcac775ad26e68445 (patch)
tree02e0d27359ded3c2724a9250e61675db1ed84501
parent77d42ce2ee10a780528a2bf864dceb053eb58d63 (diff)
downloadxxv-65ababad8a7ef911f29a29cfcac775ad26e68445.tar.gz
xxv-65ababad8a7ef911f29a29cfcac775ad26e68445.tar.bz2
* jason: highlight searched text
* jason: fix theme-gray * jason: teletext adjust loading mask field
-rw-r--r--skins/jason/common.js41
-rw-r--r--skins/jason/extjs/resources/css/xtheme-gray.css2
-rw-r--r--skins/jason/program.js16
-rw-r--r--skins/jason/recordings.js31
-rw-r--r--skins/jason/search.js42
-rw-r--r--skins/jason/teletext.js11
-rw-r--r--skins/jason/timers.js31
-rw-r--r--skins/jason/ux/Search.js7
8 files changed, 102 insertions, 79 deletions
diff --git a/skins/jason/common.js b/skins/jason/common.js
index 355c71a..f15814f 100644
--- a/skins/jason/common.js
+++ b/skins/jason/common.js
@@ -180,3 +180,44 @@ Ext.extend(Ext.xxv.TagClouds, Ext.Component, {
Ext.reg('TagClouds', Ext.xxv.TagClouds);
+function highlightText(node, regex, cls, deep) {
+ if (typeof(regex) == 'string') {
+ regex = new RegExp(regex, "ig");
+ } else if (!regex.global) {
+ throw "RegExp to highlight must use the global qualifier";
+ }
+
+ var value, df, m, l, start = 0, highlightSpan;
+ if ((node.nodeType == 3) && (value = node.data.trim())) {
+
+ // Loop through creating a document DocumentFragment containing text nodes interspersed with
+ // <span class={cls}> elements wrapping the matched text.
+ while (m = regex.exec(value)) {
+ if (!df) {
+ df = document.createDocumentFragment();
+ }
+ if (l = m.index - start) {
+ df.appendChild(document.createTextNode(value.substr(start, l)));
+ }
+ highlightSpan = document.createElement('span');
+ highlightSpan.className = cls;
+ highlightSpan.appendChild(document.createTextNode(m[0]));
+ df.appendChild(highlightSpan);
+ start = m.index + m[0].length;
+ }
+
+ // If there is a resulting DocumentFragment, replace the original text node with the fragment
+ if (df) {
+ if (l = value.length - start) {
+ df.appendChild(document.createTextNode(value.substr(start, l)));
+ }
+ node.parentNode.replaceChild(df, node);
+ }
+ }else{
+ if(deep){
+ Ext.each(node.childNodes, function(child){
+ highlightText(child, regex, cls, deep);
+ });
+ }
+ }
+ };
diff --git a/skins/jason/extjs/resources/css/xtheme-gray.css b/skins/jason/extjs/resources/css/xtheme-gray.css
index 7e8851d..062ef10 100644
--- a/skins/jason/extjs/resources/css/xtheme-gray.css
+++ b/skins/jason/extjs/resources/css/xtheme-gray.css
@@ -1502,7 +1502,7 @@ a.x-menu-item {
}
body.x-body-masked .x-window-plain .x-window-mc {
- background-color: #ccd9e8;
+ background-color: #e8e8e8;
}
.x-html-editor-wrap {
border-color:#a9bfd3;
diff --git a/skins/jason/program.js b/skins/jason/program.js
index 3535e54..6f8f442 100644
--- a/skins/jason/program.js
+++ b/skins/jason/program.js
@@ -111,7 +111,7 @@ Ext.xxv.programGrid = function(viewer, record) {
,scope:this
});
this.on('rowcontextmenu', this.onContextClick, this);
- this.getSelectionModel().on('rowselect', this.preview.select, this.preview, {buffer:50});
+ this.getSelectionModel().on('rowselect', this.select, this, {buffer:50});
};
Ext.extend(Ext.xxv.programGrid, Ext.grid.GridPanel, {
@@ -202,8 +202,7 @@ Ext.extend(Ext.xxv.programGrid, Ext.grid.GridPanel, {
}
,reload : function(data) {
- var f = this.filter.field.getValue();
- if(f && f != '') {
+ if(this.filter.field.isValid()) {
this.filter.field.setValue('');
}
this.store.baseParams = {
@@ -230,8 +229,11 @@ Ext.extend(Ext.xxv.programGrid, Ext.grid.GridPanel, {
}
,EditTimer : function(record) {
this.viewer.gridNow.EditTimer(record, this.store);
- }
-
+ }
+ ,select : function(sm, index, record){
+ this.preview.select(sm, index, record,
+ this.filter.getValue());
+ }
});
Ext.xxv.programPreview = function(viewer) {
@@ -271,9 +273,11 @@ Ext.xxv.programPreview = function(viewer) {
Ext.extend(Ext.xxv.programPreview, Ext.Panel, {
- select : function(sm, index, record){
+ select : function(sm, index, record, lookup){
if(this.body)
XXV.getTemplate().overwrite(this.body, record.data);
+ if(lookup)
+ highlightText(this.body.dom,lookup,'x-highlight',1);
// Enable all toolbar buttons
var items = this.topToolbar.items;
diff --git a/skins/jason/recordings.js b/skins/jason/recordings.js
index 64447ca..eb1daa3 100644
--- a/skins/jason/recordings.js
+++ b/skins/jason/recordings.js
@@ -145,7 +145,7 @@ Ext.extend(Ext.xxv.RecHeader, Ext.Component, {
this.tpl.compile();
},
- setvalue : function(data){
+ setvalue : function(data, lookupdata){
this.param = {
title: data.fulltitle
@@ -157,6 +157,7 @@ Ext.extend(Ext.xxv.RecHeader, Ext.Component, {
,stop: new Date(data.day.getTime() + (data.duration * 1000)).dateFormat('H:i')
,cutlength: data.cutlength == data.duration ? null : SecondsToHMS(data.cutlength)
,period: SecondsToHMS(data.duration)
+ ,lookup: lookupdata
};
var title = data.title.split("~");
@@ -171,6 +172,8 @@ Ext.extend(Ext.xxv.RecHeader, Ext.Component, {
render : function(ct, position){
if(this.param) {
this.tpl.overwrite(ct, this.param);
+ if(this.param.lookup)
+ highlightText(ct.dom,this.param.lookup,'x-highlight',1);
}
}
});
@@ -414,7 +417,6 @@ Ext.xxv.recordingsDataView = function(viewer, preview, store, config) {
,multiSelect: true
,overClass:'x-view-over'
,itemSelector:'div.thumb-wrap'
- ,loadMask:true
,prepareData: function(data){
if(data.id != 'up' && this.store.baseParams.data && this.store.baseParams.cmd == 'rl') {
@@ -594,8 +596,7 @@ Ext.extend(Ext.xxv.recordingsDataView, Ext.DataView, {
delete(this.store.baseParams['data']);
this.store.baseParams.cmd = 'rl';
if(record.id == 'up') {
- var f = this.filter.field.getValue();
- if(f && f != '') {
+ if(this.filter.field.isValid()) {
this.filter.field.setValue('');
}
var Woerter = data.split("~");
@@ -625,7 +626,7 @@ Ext.extend(Ext.xxv.recordingsDataView, Ext.DataView, {
}
},
showDetails : function(record){
- this.preview.content(record);
+ this.preview.content(record,this.filter.getValue());
this.DetailsItem(record);
},
/******************************************************************************/
@@ -650,7 +651,7 @@ Ext.extend(Ext.xxv.recordingsDataView, Ext.DataView, {
this.store.data.items[iSel].data.keywords = o.data.keywords;
var record = this.store.getById(RecordingsID[j]);
- this.preview.update(record);
+ this.preview.update(record,this.filter.getValue());
}
} else {
@@ -672,7 +673,7 @@ Ext.extend(Ext.xxv.recordingsDataView, Ext.DataView, {
return;
}
if(record.data.priority) { //use cached data
- this.preview.update(record);
+ this.preview.update(record,this.filter.getValue());
return;
}
var toDetails = '';
@@ -1206,7 +1207,7 @@ function createRecordingsView(viewer,id) {
}
, timefield
]
- ,content : function(record){
+ ,content : function(record,lookup){
if(record && this.record != record
&& record.data.isrecording
@@ -1215,8 +1216,7 @@ function createRecordingsView(viewer,id) {
) {
this.record = record;
//header
- this.get(0).get(0).setvalue(record.data);
-
+ this.get(0).get(0).setvalue(record.data,lookup);
this.timefield.maxValue = new Date((this.timefield.minValue.getTime())+(record.data.duration * 1000));
this.timefield.setValue(this.timefield.minValue);
@@ -1235,20 +1235,21 @@ function createRecordingsView(viewer,id) {
,items);
}
- var content = Ext.get("preview-recordings-frame");
- content.dom.innerHTML = record.data.description.replace(/\r\n/g, '<br />');
-
+ var content = Ext.getDom("preview-recordings-frame");
+ content.innerHTML = record.data.description.replace(/\r\n/g, '<br />');
+ if(lookup)
+ highlightText(content,lookup,'x-highlight',1);
this.doLayout();
}
}
- ,update : function(record) {
+ ,update : function(record,lookup) {
if(record
&& record.data.isrecording
&& this.body
&& this.ownerCt.isVisible()) {
this.record = record;
- this.get(0).get(0).setvalue(record.data);
+ this.get(0).get(0).setvalue(record.data,lookup);
if(!this.tplimg) {
this.tplimg = new Ext.Template('{day:date} - {start} ({period})');
diff --git a/skins/jason/search.js b/skins/jason/search.js
index 1018b11..c17bc91 100644
--- a/skins/jason/search.js
+++ b/skins/jason/search.js
@@ -284,48 +284,6 @@ Ext.extend(Ext.xxv.searchPreview, Ext.Panel, {
}
});
-function highlightText(node, regex, cls, deep) {
- if (typeof(regex) == 'string') {
- regex = new RegExp(regex, "ig");
- } else if (!regex.global) {
- throw "RegExp to highlight must use the global qualifier";
- }
-
- var value, df, m, l, start = 0, highlightSpan;
- if ((node.nodeType == 3) && (value = node.data.trim())) {
-
- // Loop through creating a document DocumentFragment containing text nodes interspersed with
- // <span class={cls}> elements wrapping the matched text.
- while (m = regex.exec(value)) {
- if (!df) {
- df = document.createDocumentFragment();
- }
- if (l = m.index - start) {
- df.appendChild(document.createTextNode(value.substr(start, l)));
- }
- highlightSpan = document.createElement('span');
- highlightSpan.className = cls;
- highlightSpan.appendChild(document.createTextNode(m[0]));
- df.appendChild(highlightSpan);
- start = m.index + m[0].length;
- }
-
- // If there is a resulting DocumentFragment, replace the original text node with the fragment
- if (df) {
- if (l = value.length - start) {
- df.appendChild(document.createTextNode(value.substr(start, l)));
- }
- node.parentNode.replaceChild(df, node);
- }
- }else{
- if(deep){
- Ext.each(node.childNodes, function(child){
- highlightText(child, regex, cls, deep);
- });
- }
- }
- };
-
function createSearchView(viewer,id,lookup) {
viewer.gridSearch = new Ext.xxv.searchGrid(viewer, lookup);
diff --git a/skins/jason/teletext.js b/skins/jason/teletext.js
index 0519783..dcdcdff 100644
--- a/skins/jason/teletext.js
+++ b/skins/jason/teletext.js
@@ -69,7 +69,7 @@ Ext.xxv.TeleTextView = function(viewer, store, config) {
,singleSelect: true
,overClass:'x-view-over'
,itemSelector:'div.thumb-wrap'
- ,loadMask:true
+ ,loadMask:null
,listeners: {
'beforeselect' : {fn:function(view){ return view.store.getRange().length > 0; } }
,'selectionchange': {fn:this.doClick, scope:this, buffer:100}
@@ -95,11 +95,16 @@ Ext.extend(Ext.xxv.TeleTextView, Ext.DataView, {
,szLoadException : "Couldn't get teletext pages!\r\n{0}"
,onLoadException : function( scope, o, arg, e) {
+ this.loadMask.hide();
new Ext.xxv.MessageBox().msgFailure(this.szLoadException, e.message);
var tb = this.ownerCt.getTopToolbar();
tb.get('teletext-refresh').enable();
}
,onBeforeLoad : function( scope, params ) {
+ if(!this.loadMask)
+ this.loadMask = new Ext.LoadMask(this.viewer.id, {msg: Ext.LoadMask.prototype.msg, msgCls:'x-mask-loading'});
+ if(this.filter.getValue())
+ this.loadMask.show();
if(this.DetailsTransaction)
Ext.Ajax.abort(this.DetailsTransaction);
@@ -114,7 +119,6 @@ Ext.extend(Ext.xxv.TeleTextView, Ext.DataView, {
tb.get('teletext-refresh').disable();
}
,onLoad : function( store, records, opt ) {
-
// replace all anchor to pages with callback
if(this.el && this.el.dom) {
var elem = this.el.dom.getElementsByTagName('a');
@@ -147,6 +151,7 @@ Ext.extend(Ext.xxv.TeleTextView, Ext.DataView, {
tb.get('teletext-next').setDisabled(data.next == 0);
//tb.get('teletext-last').setDisabled(true);
tb.get('teletext-refresh').enable();
+ this.loadMask.hide();
}
,doClick : function(){
var selNode = this.getSelectedNodes();
@@ -275,7 +280,7 @@ function createTeleTextView(viewer,id,name, channel) {
,closable:true
,border:false
,layout:'border'
- ,stateful:true
+ ,stateful:true
,items:[ viewer.pageTeleText ]
,tbar:new Ext.Toolbar({
items: [
diff --git a/skins/jason/timers.js b/skins/jason/timers.js
index 8cf3fb7..d02926a 100644
--- a/skins/jason/timers.js
+++ b/skins/jason/timers.js
@@ -140,6 +140,16 @@ Ext.xxv.timerGrid = function(viewer) {
];
var cm = new Ext.grid.ColumnModel(this.columns);
cm.defaultSortable = false;
+ this.filter = new Ext.ux.grid.Search({
+ position:'top'
+ ,shortcutKey:null
+ ,paramNames: {
+ fields:'cmd'
+ ,all:'tl'
+ ,cmd:'ts'
+ ,query:'data'
+ }
+ });
Ext.xxv.timerGrid.superclass.constructor.call(this, {
region: 'center'
@@ -170,16 +180,7 @@ Ext.xxv.timerGrid = function(viewer) {
,handler: function(){ this.EditItem(null); }
}
]})
- ,plugins:[new Ext.ux.grid.Search({
- position:'top'
- ,shortcutKey:null
- ,paramNames: {
- fields:'cmd'
- ,all:'tl'
- ,cmd:'ts'
- ,query:'data'
- }
- })]
+ ,plugins:[this.filter]
});
this.store.on({
@@ -190,7 +191,7 @@ Ext.xxv.timerGrid = function(viewer) {
});
this.on('rowcontextmenu', this.onContextClick, this);
this.on('rowdblclick', this.onEditItem, this);
- this.getSelectionModel().on('rowselect', this.preview.select, this.preview, {buffer:50});
+ this.getSelectionModel().on('rowselect', this.select, this, {buffer:50});
};
Ext.extend(Ext.xxv.timerGrid, Ext.grid.GridPanel, { // Ext.grid.EditorGridPanel
@@ -500,6 +501,10 @@ Ext.extend(Ext.xxv.timerGrid, Ext.grid.GridPanel, { // Ext.grid.EditorGridPanel
var record = this.store.getAt(index);
this.EditItem(record);
}
+ ,select : function(sm, index, record){
+ this.preview.select(sm, index, record,
+ this.filter.getValue());
+ }
});
Ext.xxv.timerPreview = function(viewer) {
@@ -542,9 +547,11 @@ Ext.extend(Ext.xxv.timerPreview, Ext.Panel, {
szFindReRun : "Find rerun"
,szEdit : "Edit"
,szDelete : "Delete"
- ,select : function(sm, index, record){
+ ,select : function(sm, index, record, lookup){
if(this.body)
XXV.getTemplate().overwrite(this.body, record.data);
+ if(lookup)
+ highlightText(this.body.dom,lookup,'x-highlight',1);
// Enable all toolbar buttons
var items = this.topToolbar.items;
diff --git a/skins/jason/ux/Search.js b/skins/jason/ux/Search.js
index c59c9f0..7295aca 100644
--- a/skins/jason/ux/Search.js
+++ b/skins/jason/ux/Search.js
@@ -200,6 +200,13 @@ Ext.extend(Ext.ux.grid.Search, Ext.util.Observable, {
,disable:function() {
this.setDisabled(true);
} // eo function disable
+
+ /**
+ * get value of search field
+ */
+ ,getValue:function() {
+ return this.field.isValid() ? this.field.getValue() : null
+ } // eo function disable
// }}}
}); // eo extend