[ Thread Index |
Date Index
| More lists.tuxfamily.org/qo-modules-dev Archives
]
Revision: 8
Author: ytorres
Date: 2008-11-04 21:27:03 +0100 (Tue, 04 Nov 2008)
Log Message:
-----------
Modified Paths:
--------------
trunk/qo-kregator/install.sql
Removed Paths:
-------------
trunk/qo-kregator/qo-kregator_old.js
Modified: trunk/qo-kregator/install.sql
===================================================================
--- trunk/qo-kregator/install.sql 2008-11-03 21:28:27 UTC (rev 7)
+++ trunk/qo-kregator/install.sql 2008-11-04 20:27:03 UTC (rev 8)
@@ -143,7 +143,7 @@
from (select id from qo_modules where module_id like 'qo-kregator') m;
insert into `qo_modules_dependencies` (`qo_modules_id`, `directory`, `file`)
-select m.id, 'qo-kregator/locale/', 'Desk-Kregator-en.js'
+select m.id, 'qo-kregator/locale/', 'qo-kregator-en.js'
from (select id from qo_modules where module_id like 'qo-kregator') m;
-- ----------------------------------------------------------------------------
Deleted: trunk/qo-kregator/qo-kregator_old.js
===================================================================
--- trunk/qo-kregator/qo-kregator_old.js 2008-11-03 21:28:27 UTC (rev 7)
+++ trunk/qo-kregator/qo-kregator_old.js 2008-11-04 20:27:03 UTC (rev 8)
@@ -1,3434 +0,0 @@
-/************************************************************************
- This file is part of Qo-Kregator.
- Qo-Kregator is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- Qo-Kregator is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with Qo-Kregator. If not, see <http://www.gnu.org/licenses/>.
- *************************************************************************/
-
-// Allow to add a Menu after the Button is rendered
-Ext.override(Ext.Button,
-{
- initComponent: function() {
- Ext.Button.superclass.initComponent.call(this);
- this.addEvents('click','toggle','mouseover','mouseout','menushow','menuhide','menutriggerover','menutriggerout');
-
- if (this.menu) {
- var m = this.menu;
- delete this.menu;
- this.setMenu(m);
- }
-
- if (typeof this.toggleGroup === 'string') {
- this.enableToggle = true;
- }
- },
-
- setMenu: function(menu) {
- var hasMenu = (this.menu !== null);
- this.menu = Ext.menu.MenuMgr.get(menu);
-
- if (this.rendered && !hasMenu) {
- this.el.child(this.menuClassTarget).addClass('x-btn-with-menu');
- this.menu.on("show", this.onMenuShow, this);
- this.menu.on("hide", this.onMenuHide, this);
- }
- },
-
- clearMenu: function(destroy) {
- if (this.rendered) {
- this.el.child(this.menuClassTarget).removeClass('x-btn-with-menu');
- this.menu.un('show', this.onMenuShow, this);
- this.menu.un('hide', this.onMenuHide, this);
- }
- if (destroy) {
- Ext.destroy(this.menu);
- }
- this.menu = null;
- }
-}
-);
-
-QoDesk.QoKregator = Ext.extend(Ext.app.Module, {
-
- moduleType : 'internet',
- moduleId : 'qo-kregator',
- menuPath: 'StartMenu/Internet',
-
- appVer : '2.0',
-
- // Conf var
- ConfExpandCollapse : false,
- ConfGoRefresh: true,
- ConfShowSummary: true,
- ConfTreePanelWidth:'254',
- ConfGridPanelHeight:'150',
- ConfPreviewPanelSouthHeight:'300',
- ConfPreviewPanelEastWidth:'400',
- ConfPreviewPane:'bottom',
- ConfRefreshFeed:'10',
- ConfOldItems:false,
- ConfOldItemsDay:'30',
- ConfContentFontSize: 11,
- ConfshowStatusBar: 'on',
- ConfOpenMode: 'Window',
- ConfDateTimeFormat: 'd/m/y, H:i',
- ConfDateFormat: 'd/m/y',
-
- // Panel
- PanelFeedTree:'',
- PanelFeedTreeEditor:'',
- PanelGridItem:'',
- PanelPreview:'',
- PanelCenter:'',
-
- //ToolBars
- tbFeedBtnAvailable: ['AddFeed', 'AddFolder', 'Import', 'Export', 'ExpandCollapse', 'RefreshFeed', 'ContextMenu'],
- tbFeedBtnCurrent: [],
-
- // DataStore
- dsItems:'',
- dsItemDesc:'',
-
- // Window
- winAbout:false,
-
- // Task
- TaskSearchFeed:false,
- TaskCleanFeed:false,
-
- // others vars
- FeedNeedUpdate:false,
- LastClick:0,
- curNodeId:'',
- curFeedId:'',
- columnUnseenWidth:50, // change this value to modify Unseen column width
- columnTotalWidth:50, // change this value to modify Total column width
- linkDefaultTab:'',
-
- init: function(){
- this.launcher = {
- text: 'Qo-Kregator',
- tooltip: '<b>Qo-Kregator</b><br />' + QoKregator.LauncherDescription,
- iconCls: 'qo-kregator-icon',
- shortcutIconCls: 'qo-kregator-win-shortcut',
- handler: this.createWindow,
- scope: this
- };
- },
-
- createWindow: function() {
- var desktop = this.app.getDesktop();
- var win = desktop.getWindow('qo-kregator');
-
- if (!win) {
-
-
- // Plugins for right click on tab
- Ext.ux.KregaTabCloseMenu = function(env){
- var tabs, menu, ctxItem;
- this.scope = env;
- this.init = function(tp){
- tabs = tp;
- tabs.on('contextmenu', onContextMenu, this);
- };
-
- function onContextMenu(ts, item, e){
-
- e.preventDefault();
- e.stopEvent();
-
- if( item.id == 'qo-kregator-main' ) { item.linkTab = this.scope.linkDefaultTab;}
-
- if(!menu){ // create context menu on first right click
- menu = new Ext.menu.Menu([{
- id: 'qo-kregator-' + tabs.id + '-close',
- text: QoKregator.TabCtxCloseTab,
- iconCls: 'DeskKregator-close-Tab-btn',
- handler : function() {
- tabs.remove(ctxItem);
- }
- },{
- id: 'qo-kregator-' + tabs.id + '-close-others',
- text: QoKregator.TabCtxCloseOtherTabs,
- handler : function() {
- tabs.items.each(function(item){
- if(item.closable && item != ctxItem){
- tabs.remove(item);
- }
- });
- }
- },'-',{
- id:'qo-kregator-' + tabs.id + '-open-tab-site',
- text:QoKregator.FeedGridItemOpenInWin,
- iconCls:'qo-kregator-open-site-btn',
- handler: function() {
- window.open(ctxItem.linkTab, 'win');
- }
- }]);
- }
- ctxItem = item;
- var items = menu.items;
- items.get('qo-kregator-' + tabs.id + '-close').setDisabled(!item.closable);
- var disableOthers = true;
- tabs.items.each(function(){
- if(this != item && this.closable){
- disableOthers = false;
- return false;
- }
- });
- items.get('qo-kregator-' + tabs.id + '-close-others').setDisabled(disableOthers);
- if( !item.linkTab ) {
- items.get('qo-kregator-' + tabs.id + '-open-tab-site').setDisabled(true);
- } else {
- items.get('qo-kregator-' + tabs.id + '-open-tab-site').setDisabled(false);
- }
- menu.showAt(e.getPoint());
- }
- };
-
- // Create Splash
- Ext.DomHelper.append(document.body, {
- tag: 'div',
- id: 'qo-kregator-splash',
- children: [{
- tag: 'div',
- cls: 'qo-kregator-splash-indicator',
- html: '<img src="system/modules/qo-kregator/img/default/logo.png" alt="" /><div id="qo-kregator-splash-msg">' + QoKregator.SplashInit + '</div>'
- }]
- });
-
- // We load user conf before show app
- Ext.get('qo-kregator-splash-msg').dom.innerHTML = QoKregator.SplashLoadConf;
-
-
- Ext.Ajax.request({
- scope: this,
- url: this.app.connection,
- params: {
- moduleId: this.moduleId,
- fileName: 'php/qo-kregator.php',
- what: 'get_user_conf'
- },
- success: function(response, options) {
-
- var o = Ext.util.JSON.decode(response.responseText);
-
- if (o.success) {
-
- this.ConfRefreshFeed = o.refresh_feed;
- this.ConfOldItems = o.old_items;
- this.ConfOldItemsDay = o.old_items_day;
- this.ConfPreviewPane = o.preview_pane;
- this.ConfShowSummary = o.showSummary;
- this.ConfContentFontSize = o.content_font_size;
- this.ConfshowStatusBar = o.showStatusBar;
- this.tbFeedBtnCurrent = o.tbFeedBtn;
-
- this.ConfOpenMode = o.openMode;
-
- this.ConfDateTimeFormat = o.dateTimeFormat;
- this.ConfDateFormat = o.dateFormat;
-
- this.ConfTreePanelWidth = o.tree_panel_width;
- this.ConfGridPanelHeight = o.grid_panel_height;
- this.ConfPreviewPanelSouthHeight = o.preview_panel_south_height;
- this.ConfPreviewPanelEastWidth = o.preview_panel_east_width;
-
- } else {
-
- this.ConfRefreshFeed = 10;
- this.ConfOldItems = false;
- this.ConfOldItemsDay = 30;
- this.ConfPreviewPane = 'bottom';
- this.ConfShowSummary = true;
- this.ConfContentFontSize = 11;
- this.ConfshowStatusBar = 'on';
- this.ConfOpenMode = 'Window';
-
- this.ConfDateTimeFormat = 'd/m/y, H:i';
- this.ConfDateFormat = 'd/m/y';
-
- this.ConfTreePanelWidth = '254';
- this.ConfGridPanelHeight = '150';
- this.ConfPreviewPanelSouthHeight = '300';
- this.ConfPreviewPanelEastWidth = '400';
- this.tbFeedBtnCurrent = ['AddFeed', 'AddFolder', 'Import', 'Export', 'ExpandCollapse', 'RefreshFeed'];
-
- }
-
- // Custom ColumnTree
- Ext.tree.KregaColumnTree = Ext.extend(Ext.tree.TreePanel, {
- lines:false,
- borderWidth: Ext.isBorderBox ? 0 : 2, // the combined left/right border for each cell
- cls:'qo-kregator-x-column-tree',
- onRender : function(){
- Ext.tree.KregaColumnTree.superclass.onRender.apply(this, arguments);
- this.headers = this.body.createChild(
- {id:'qo-kregator-x-tree-headers-id', cls:'qo-kregator-x-tree-headers'},this.innerCt.dom);
- var cols = this.columns, c;
- var totalWidth = 0;
- for(var i = 0, len = cols.length; i < len; i++) {
- var clsHere;
- if( i === 0 ) { clsHere = 'qo-kregator-x-tree-hd-text-feed';}
- else { clsHere = 'qo-kregator-x-tree-hd-text';}
-
- c = cols[i];
- totalWidth += c.width;
- this.headers.createChild({
- id: 'qo-kregator-feed-hd-'+i,
- cls:'qo-kregator-x-tree-hd ' + (c.cls?c.cls+'-hd':''),
- cn: {
- cls: clsHere,
- html: c.header
- },
- style:'width:'+(c.width-this.borderWidth)+'px;'
- });
- }
- this.headers.createChild({cls:'x-clear'});
- // prevent floats from wrapping when clipped
- this.headers.setWidth(totalWidth);
- this.innerCt.setWidth(totalWidth);
- }
- });
-
- Ext.tree.KregaColumnNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
- focus: Ext.emptyFn, // prevent odd scrolling behavior
-
- renderElements : function(n, a, targetNode, bulkRender){
- this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';
-
- var t = n.getOwnerTree();
- var cols = t.columns;
- var bw = t.borderWidth;
- var c = cols[0];
- var colID;
-
- var buf = [
- '<li class="x-tree-node"><div ext:tree-node-id="',n.id,'" class="x-tree-node-el x-tree-node-leaf ', a.cls,'">',
- '<div class="qo-kregator-x-tree-col" style="width:',c.width-bw,'px;">',
- '<span class="x-tree-node-indent">',this.indentMarkup,"</span>",
- '<img src="', this.emptyIcon, '" class="x-tree-ec-icon x-tree-elbow">',
- '<img src="', a.icon || this.emptyIcon, '" class="x-tree-node-icon',(a.icon ? " x-tree-node-inline-icon" : ""),(a.iconCls ? " "+a.iconCls : ""),'" unselectable="on">',
- '<a hidefocus="on" class="x-tree-node-anchor" href="',a.href ? a.href : "#",'" tabIndex="1" ',
- a.hrefTarget ? ' target="'+a.hrefTarget+'"' : "", '>',
- '<span unselectable="on">', n.text || (c.renderer ? c.renderer(a[c.dataIndex], n, a) : a[c.dataIndex]),"</span></a>",
- "</div>"];
- for(var i = 1, len = cols.length; i < len; i++) {
- c = cols[i];
-
- if( i == 1 ) { colID = 'qo-kregator-unSeen-'+n.id; }
- else { colID = 'qo-kregator-Total-'+n.id; }
-
- buf.push('<div class="qo-kregator-x-tree-col ',(c.cls?c.cls:''),'" style="width:',c.width-bw,'px;">',
- '<div class="qo-kregator-x-tree-col-text" id="'+colID+'">',(c.renderer ? c.renderer(a[c.dataIndex], n, a) : a[c.dataIndex]),"</div>",
- "</div>");
- }
- buf.push(
- '<div class="x-clear"></div></div>',
- '<ul class="x-tree-node-ct" style="display:none;"></ul>',
- "</li>");
-
- if(bulkRender !== true && n.nextSibling && n.nextSibling.ui.getEl()){
- this.wrap = Ext.DomHelper.insertHtml("beforeBegin",
- n.nextSibling.ui.getEl(), buf.join(""));
- }else{
- this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf.join(""));
- }
-
- this.elNode = this.wrap.childNodes[0];
- this.ctNode = this.wrap.childNodes[1];
- var cs = this.elNode.firstChild.childNodes;
- this.indentNode = cs[0];
- this.ecNode = cs[1];
- this.iconNode = cs[2];
- this.anchor = cs[3];
- this.textNode = cs[3].firstChild;
- }
- });
-
- this.dsItems = new Ext.data.Store({
- proxy: new Ext.data.HttpProxy({
- url: this.app.connection+'?moduleId='+this.moduleId+'&fileName=php/qo-kregator.php&what=get_items'
- }),
- reader: new Ext.data.JsonReader({
- root: 'Items',
- totalProperty: 'nbItems',
- id: 'id'
- }, [{
- name: 'id',
- mapping: 'id'
- }, {
- name: 't',
- mapping: 't'
- }, {
- name: 'd',
- mapping: 'd'
- }, {
- name: 'u',
- mapping: 'u'
- }, {
- name: 's',
- mapping: 's'
- }, {
- name: 'i',
- mapping: 'i'
- }, {
- name: 'f',
- mapping: 'f'
- }, {
- name: 'id_f',
- mapping: 'id_f'
- }, {
- name: 'sum',
- mapping: 'sum'
- }])
- });
-
- // Sort by default : date, DESC
- this.dsItems.setDefaultSort('d', 'desc');
-
- this.dsItems.on('load', function(){
- this.setStatusBar('qo-kregator-done', QoKregator.StatutDone);
- this.selectFirstUnreadItems();
-
- }, this);
-
- this.dsItemDesc = new Ext.data.Store({
- proxy: new Ext.data.HttpProxy({
- url: this.app.connection
- }),
- baseParams: {
- moduleId: this.moduleId,
- fileName: 'php/qo-kregator.php',
- what: 'get_items_desc'
- },
- reader: new Ext.data.JsonReader({}, [{
- name: 't'
- }, {
- name: 'd'
- }, {
- name: 'a'
- }, {
- name: 'des'
- }, {
- name: 'u'
- }, {
- name: 'f'
- }])
- });
-
- this.dsItemDesc.on('load', function(){
-
- var nodeItem = this.dsItemDesc.getAt(0);
- var title = nodeItem.data.t;
- var link = nodeItem.data.u;
- var date = this.renderDate(nodeItem.data.d, this.ConfDateTimeFormat);
- var auteur = nodeItem.data.a;
- var feedName = nodeItem.data.f;
- var desc = nodeItem.data.des;
-
- if (this.PanelFeedTree.selModel.selNode.attributes.view == 'site') {
-
- this.PanelPreview.setTitle(this.PanelFeedTree.selModel.selNode.attributes.text);
- this.PanelPreview.body.dom.innerHTML = '<div class="qo-kregator-preview-content"><iframe width="100%" height="100%" frameborder="0" src="' + link + '" /></div>';
-
- } else {
-
- this.PanelPreview.setTitle(feedName);
-
- var content = '<div class="qo-kregator-feed-info">' +
- '<div class="qo-kregator-item-date">' +
- date +
- '</div>' +
- '<div class="qo-kregator-item-title">' +
- title +
- '</div>' +
- '<div class="qo-kregator-item-author">' +
- QoKregator.PreviewAutor +
- auteur +
- '</div>' +
- '</div>' +
- '<div class="qo-kregator-feed-content">' +
- desc +
- '</div>';
-
- this.PanelPreview.body.dom.innerHTML = content;
- this.setContentFontSize('=');
- this.PanelPreview.el.on('click', function(e, target, options) {
-
- e.preventDefault();
- e.stopEvent();
-
- var delai = new Date();
- var curClick = delai.getTime();
-
- if (this.LastClick === 0) { this.LastClick = curClick - 51; }
-
- var diff = (curClick - this.LastClick);
- if (target.href) {
- if (diff > 50) {
- this.LastClick = curClick;
- var uniq = Ext.id();
- this.openInTab(uniq, target.href, target.href);
- }
- }
- }, this);
- }
-
- this.setStatusBar('qo-kregator-done', QoKregator.StatutDone);
-
- }, this);
-
- this.PanelFeedTree = new Ext.tree.KregaColumnTree({
- width:252,
- id: 'qo-kregator-id-tree-column',
- border: false,
- enableDD: true,
- autoHeight:true,
- rootVisible:false,
- autoScroll:true,
- containerScroll: true,
- listeners: {
- scope: this,
- contextmenu: this.onContextMenuFeed,
- click: this.onClickFeed
- },
-
- columns:[{
- id:'qo-kregator-feedTree-colum',
- header:QoKregator.TreeTitle,
- width:150,
- dataIndex:'text'
- },{
- header: QoKregator.TreeColumn1,
- width:this.columnUnseenWidth,
- dataIndex:'unseen'
- },{
- header: QoKregator.TreeColumn2,
- width:this.columnTotalWidth,
- dataIndex:'total'
- }],
-
- loader: new Ext.tree.TreeLoader({
- dataUrl:this.app.connection+'?moduleId='+this.moduleId+'&fileName=php/qo-kregator.php&what=get_nodes',
- uiProviders:{
- 'col': Ext.tree.KregaColumnNodeUI
- }
- }),
-
- root: new Ext.tree.AsyncTreeNode({
- text:'RootFeed'
- })
- });
-
- // Editor
- this.PanelFeedTreeEditor = new Ext.tree.TreeEditor(this.PanelFeedTree, {
- allowBlank: false
- });
-
- // Edit node
- this.PanelFeedTreeEditor.on('complete', function(editor, fieldValue, beforeValue){
-
- // If there is no change, go back
- if(fieldValue == beforeValue) { return; }
-
- this.setStatusBar('qo-kregator-inProgress', QoKregator.StatutMod);
-
- // Update nodeText
- var saveFeedText = new Ext.data.Connection();
- saveFeedText.request({
- scope: this,
- url: this.app.connection,
- params: {
- moduleId: this.moduleId,
- fileName: 'php/qo-kregator.php',
- id: editor.editNode.id,
- value: fieldValue,
- what: 'mod_feed_text'
- },
-
- success: function(response, options){
-
- var o = Ext.util.JSON.decode(response.responseText);
-
- if (o.success) {
- this.setStatusBar('qo-kregator-done', QoKregator.StatutModOk);
-
- // Update tab title & preview Title
- Ext.getCmp('qo-kregator-main').setTitle(Ext.util.Format.ellipsis(fieldValue,20));
- this.PanelPreview.setTitle(fieldValue);
-
- }
- else {
- this.setStatusBar('qo-kregator-done', QoKregator.StatutModNok);
- }
- }
- });
-
- }, this);
-
- // Drag & Drop Tree Elements
- this.PanelFeedTree.on('enddrag', function(tree){
-
- this.setStatusBar('qo-kregator-inProgress', QoKregator.StatutReorder);
-
- function simplifyNodes(node){
- var resultNode = {};
- var kids = node.childNodes;
- var len = kids.length;
- for (var i = 0; i < len; i++) {
- resultNode[kids[i].id] = simplifyNodes(kids[i]);
- }
- return resultNode;
- }
-
- // JSON-encode our tree
- var encNodes = Ext.encode(simplifyNodes(this.PanelFeedTree.root));
-
- // send it to the backend to save
- var saveOrder = new Ext.data.Connection();
- saveOrder.request({
- scope: this,
- url: this.app.connection,
- params: {
- moduleId: this.moduleId,
- fileName: 'php/qo-kregator.php',
- nodes: encNodes,
- what: 'save_nodes'
- },
-
- success: function(response, options){
-
- var o = Ext.util.JSON.decode(response.responseText);
-
- if (o.success) {
- this.setStatusBar('qo-kregator-done', QoKregator.StatutReorderOk);
- }
- else {
- this.setStatusBar('qo-kregator-error', QoKregator.StatutReorderNok);
- }
- }
- });
- }, this);
-
- // New SearchField
- Ext.app.SearchField = Ext.extend(Ext.form.TwinTriggerField, {
-
- initComponent: function(){
-
- if (!this.store.baseParams) {
- this.store.baseParams = {};
- }
-
- Ext.app.SearchField.superclass.initComponent.call(this);
-
- this.on('specialkey', function(f, e){
- if (e.getKey() == e.ENTER) {
- this.onTrigger2Click();
- }
- }, this);
- },
-
- validationEvent: false,
- validateOnBlur: false,
- trigger1Class: 'x-form-clear-trigger',
- trigger2Class: 'x-form-search-trigger',
- hideTrigger1: true,
- width: 100,
- hasSearch: false,
- emptyText: QoKregator.FeedGridFilterSearch,
-
- onTrigger1Click: function(){
- if (this.hasSearch) {
-
- this.store.baseParams = {
- 'id_feed': this.env.curFeedId,
- 'id_node': this.env.curNodeId
- };
-
- Ext.getCmp('qo-kregator-etat').setValue('all', true);
-
- var o = {
- start: 0,
- limit: 25
- };
- this.store.reload({
- params: o
- });
-
- this.el.dom.value = '';
- this.triggers[0].hide();
- this.hasSearch = false;
- }
- this.reset();
- },
-
- onTrigger2Click: function(){
-
- var v = this.getRawValue();
-
- if (v.length < 2 && v !== '') {
- Ext.Msg.alert(QoKregator.FeedGridBoxSearchTitle, QoKregator.FeedGridBoxSearchContent);
- return;
- }
-
- this.env.setStatusBar('qo-kregator-inProgress', QoKregator.StatutSearchLoad);
-
- this.store.baseParams = {
- 'id_feed': this.env.curFeedId,
- 'id_node': this.env.curNodeId,
- 'searchText': v,
- 'searchEtat': Ext.getCmp('qo-kregator-etat').getValue(),
- 'searchDate' : Ext.getCmp('qo-kregator-datefilter-btn').curDate
- };
-
- var o = {
- start: 0,
- limit: 25
- };
- this.store.reload({
- params: o
- });
- this.hasSearch = true;
- this.triggers[0].show();
- }
- });
- Ext.reg('searchfield', Ext.app.SearchField);
- // End new searchField
-
- this.PanelGridItem = new Ext.grid.GridPanel({
- scope: this,
- id:'qo-kregator-id-gridFeed-panel',
- store: this.dsItems,
- lastRowClick: {
- time: new Date().getTime(),
- row: -1
- },
- columns: [{
- id: 'article',
- header: QoKregator.FeedGridHeaderItem,
- sortable: true,
- dataIndex: 't'
- }, {
- id: 'feed',
- header: QoKregator.FeedGridHeaderFeed,
- sortable: true,
- width: 120,
- dataIndex: 'f'
- }, {
- id: 'date',
- header: QoKregator.FeedGridHeaderDate,
- width: 120,
- sortable: true,
- dataIndex: 'd',
- scope: this,
- renderer: this.renderDate.createDelegate(this, [this.ConfDateTimeFormat], 1)
- }],
- autoExpandColumn: 'article',
- loadMask: true,
- viewConfig: {
- scope: this,
- forceFit: true,
- showSummary: this.ConfShowSummary,
- enableRowBody: true,
- getRowClass: function(record, rowIndex, p, ds) {
-
- var retour = '';
-
- if (record.data.s == 'y') {
- retour += 'qo-kregator-feed-read';
- } else {
- retour += 'qo-kregator-feed-unread';
- }
-
- if (record.data.i == 'y') {
- retour += ' qo-kregator-feed-important';
- }
-
- if( this.showSummary ) {
- p.body = '<p class="qo-kregator-summary">' + record.data.sum + '</p>';
- retour += ' x-grid3-row-expanded';
- }
-
- return retour;
-
- }
- },
- enableColumnMove: true,
- tbar: [{
- xtype:'searchfield',
- id: 'qo-kregator-search',
- width: 130,
- store: this.dsItems,
- env: this,
- listeners: {
- scope: this
- }
- },'-',{
- xtype: 'combo',
- store: new Ext.data.SimpleStore({
- fields: ['etat', 'Libel'],
- data: [['all', QoKregator.FeedGridFilterAllItems], ['nonlu', QoKregator.FeedGridFilterUnseenItems], ['important', QoKregator.FeedGridFilterImportantItems]]
- }),
- displayField: 'Libel',
- valueField: 'etat',
- typeAhead: true,
- width: 120,
- mode: 'local',
- triggerAction: 'all',
- selectOnFocus: false,
- editable: false,
- allowBlank: false,
- value: 'all',
- id: 'qo-kregator-etat',
- listeners: {
- scope: this,
- select: function(){
- Ext.getCmp('qo-kregator-search').onTrigger2Click();
- }
- }
- },'-',{
- xtype: 'tbsplit',
- scope:this,
- text: QoKregator.FeedGridFilterDateAllDate,
- id: 'qo-kregator-datefilter-btn',
- iconCls: 'qo-kregator-icon-datefilter',
- tooltip: QoKregator.FeedGridFilterDatePickDate,
- curDate: '*',
- enableToggle: true,
- handler: function(btn) {
- if( btn.pressed ) {
- btn.setText(QoKregator.FeedGridFilterDatePickDate);
- btn.showMenu();
- btn.curDate = '*';
- } else {
- btn.setText(QoKregator.FeedGridFilterDateAllDate);
- btn.hideMenu();
- btn.curDate = '*';
- Ext.getCmp('qo-kregator-search').onTrigger2Click();
- }
- },
- menu: new Ext.menu.DateMenu({
- scope: this,
- handler : function(dp, date){
- Ext.getCmp('qo-kregator-datefilter-btn').setText(date.format(this.ConfDateFormat));
- Ext.getCmp('qo-kregator-datefilter-btn').curDate = date.format('Y:m:d');
- Ext.getCmp('qo-kregator-search').onTrigger2Click();
- }
- })
- }, '-', {
- scope: this,
- tooltip: {
- title: QoKregator.ReadingBtnTitle,
- text: QoKregator.ReadingBtnQtip
- },
- iconCls: 'qo-kregator-preview-bottom',
- handler: this.movePreview
- },'-',{
- scope: this,
- tooltip: {
- title: QoKregator.SummaryBtnTitle,
- text: QoKregator.SummaryBtnText
- },
- enableToggle: true,
- id:'qo-kregator-summary-btn-id',
- iconCls: 'qo-kregator-summary-btn',
- toggleHandler: function(btn, pressed){
- this.toggleSummary(pressed);
- }
- },'-', {
- xtype: 'button',
- scope:this,
- id: 'qo-kregator-contextmenu-news-btn',
- iconCls: 'qo-kregator-icon-contextmenu',
- tooltip: {
- title: QoKregator.ContextMenuBtnTooltipTitle,
- text: QoKregator.ContextMenuBtnTooltipText
- },
- menu: []
- }
- ],
-
- bbar: new Ext.PagingToolbar({
- pageSize: 25,
- store: this.dsItems,
- displayInfo: true,
- displayMsg: QoKregator.FeedGridPagingDisplay,
- emptyMsg: QoKregator.FeedGridPagingNoDisplay
- }),
- listeners: {
- scope: this,
- rowdblclick: function(grid, rowIndex, e) {
-
- var _node = this.dsItems.getAt(rowIndex);
- var _id = _node.data.id;
- var _link = _node.data.u;
- var _title = _node.data.t;
- this.openInTab('items-' + _id, _title, _link);
-
- var timeNow = new Date().getTime();
-
- if(grid.lastRowClick.row != rowIndex){
- grid.lastRowClick.row = rowIndex;
- grid.lastRowClick.time = timeNow;
- }
- else if(timeNow - grid.lastRowClick.time >= 500){
- return;
- }
- else{
- grid.lastRowClick.time = timeNow;
- }
-
- },
-
- rowclick: function(grid, rowIndex, e) {
-
- var timeNow = new Date().getTime();
- if(grid.lastRowClick.row != rowIndex){
- grid.lastRowClick.row = rowIndex;
- grid.lastRowClick.time = timeNow;
- }
- else if(timeNow - grid.lastRowClick.time < 500){
- return;
- }
- else{
- grid.lastRowClick.time = timeNow;
- }
-
- },
-
- rowcontextmenu: function(grid, rowIndex, e){
- this.onContextItemFeed(grid, rowIndex, e);
- }
- }
- });
-
- // SelectionModel for GridPanel
- var smPanelGridItem = this.PanelGridItem.getSelectionModel();
- smPanelGridItem.on('rowselect', function(sM, rowIndex, r) {
-
- //Build the sub-menu for the contextMenu-btn
- Ext.getCmp('qo-kregator-contextmenu-news-btn').setMenu(this.createContextItemFeed());
-
- this.loadItem(rowIndex);
-
- }, this);
-
- this.PanelCenter = new Ext.TabPanel({
- region: 'center',
- margins: '0 0 0 0',
- activeTab: 0,
- border: false,
- bodyStyle: 'background-color:#fff',
- enableTabScroll: true,
- plugins: new Ext.ux.KregaTabCloseMenu(this),
- defaults: {
- autoScroll: true
- },
- items: [{
- title: QoKregator.FeedGridTabTitle,
- id: 'qo-kregator-main',
- border: false,
- margins: '0 0 0 0',
- layout: 'fit',
- items: [{
- region: 'center',
- border: false,
- layout: 'border',
- margins: '0 0 0 0',
- items: [{
- region: 'center',
- layout: 'fit',
- border: false,
- minHeight: 150,
- height: 150,
- split: true,
- items: this.PanelGridItem
- }, {
- autoScroll: true,
- layout: 'fit',
- region: 'south',
- split: true,
- height: 300,
- bodyStyle: 'background-color:#fff',
- id: 'qo-kregator-previewPanelSouth',
- title: QoKregator.PreviewTitle
- }, {
- autoScroll: true,
- layout: 'fit',
- region: 'east',
- split: true,
- hidden: true,
- width: 400,
- bodyStyle: 'background-color:#fff',
- id: 'qo-kregator-previewPanelEast',
- title: QoKregator.PreviewTitle
- }]
- }]
- }]
- });
-
- this.PanelPreview = Ext.getCmp('qo-kregator-previewPanelSouth');
-
- var winWidth = desktop.getWinWidth() / 1.1;
- var winHeight = desktop.getWinHeight() / 1.1;
-
- // Feed ToolBar
- this.tbFeedBtnAvailable.AddFeed = {
- xtype: 'button',
- id: 'qo-kregator-add-feed-btn',
- iconCls:'qo-kregator-icon-add-feed',
- cls: 'x-btn-icon',
- scope: this,
- handler: function(){
- this.showAddFeed(0);
- },
- tooltip: QoKregator.TreeAddFeed
- };
-
- this.tbFeedBtnAvailable.AddFolder = {
- xtype: 'button',
- iconCls:'qo-kregator-icon-add-folder',
- scope: this,
- handler: function(){
- this.showAddFolder(0);
- },
- tooltip: QoKregator.TreeAddFolder
- };
-
- this.tbFeedBtnAvailable.Import = {
- xtype: 'button',
- iconCls:'qo-kregator-icon-import',
- scope: this,
- handler: this.showImport,
- tooltip: QoKregator.TreeImport
- };
-
- this.tbFeedBtnAvailable.Export = {
- xtype: 'button',
- scope: this,
- iconCls:'qo-kregator-icon-export',
- handler: function(){
- window.location = this.app.connection+'?moduleId='+this.moduleId+'&fileName=php/export.php';
- },
- tooltip: QoKregator.TreeExport
- };
-
-
- this.tbFeedBtnAvailable.ExpandCollapse = {
- xtype: 'button',
- scope: this,
- id: 'qo-kregator-expand-collapse-btn',
- iconCls:'qo-kregator-icon-expand',
- handler: function(){
- if( !this.ConfExpandCollapse ) {
-
- this.ConfExpandCollapse='collapse';
- this.PanelFeedTree.expandAll();
- Ext.getCmp('qo-kregator-expand-collapse-btn').setIconClass('qo-kregator-icon-collapse');
-
- } else if( this.ConfExpandCollapse == 'expand' ) {
-
- this.ConfExpandCollapse='collapse';
- this.PanelFeedTree.expandAll();
- Ext.getCmp('qo-kregator-expand-collapse-btn').setIconClass('qo-kregator-icon-collapse');
-
- } else if( this.ConfExpandCollapse == 'collapse' ) {
-
- this.ConfExpandCollapse='expand';
- this.PanelFeedTree.collapseAll();
- Ext.getCmp('qo-kregator-expand-collapse-btn').setIconClass('qo-kregator-icon-expand');
-
- }
- },
- tooltip: QoKregator.TreeExpandCollapse
- };
-
- this.tbFeedBtnAvailable.RefreshFeed = {
- xtype: 'button',
- scope:this,
- id: 'qo-kregator-add-refresh-feed-btn',
- iconCls: 'qo-kregator-refresh-btn',
- handler: function(){
- this.TaskSearchFeed.delay(1000);
- },
- tooltip: QoKregator.TreeRefresh
- };
-
- this.tbFeedBtnAvailable.ContextMenu = {
- xtype: 'button',
- scope:this,
- id: 'qo-kregator-contextmenu-btn',
- iconCls: 'qo-kregator-icon-contextmenu',
- tooltip: {
- title: QoKregator.ContextMenuBtnTooltipTitle,
- text: QoKregator.ContextMenuBtnTooltipText
- },
- menu: []
- };
-
-
- win = desktop.createWindow({
- id: 'qo-kregator',
- title: 'Qo-Kregator',
- width: winWidth,
- height: winHeight,
- x: desktop.getWinX(winWidth),
- y: desktop.getWinY(winHeight),
- iconCls: 'qo-kregator-icon',
- shim: false,
- animCollapse: false,
- constrainHeader: true,
- minimizable: true,
- maximizable: true,
- layout: 'border',
- tools : [{
- scope: this,
- id:'gear',
- qtip:QoKregator.WinConfToolTip,
- handler:this.showConf
-
- }, {
- scope: this,
- id:'help',
- qtip: QoKregator.WinAboutTitle,
- handler:this.showAbout
-
- }],
- bbar: new Ext.StatusBar({
- id: 'qo-kregator-statusBar',
- text: QoKregator.StatutReady,
- iconCls: 'qo-kregator-done'
-
- }),
- items: [{
- region: 'west',
- layout:'fit',
- id: 'qo-kregator-id-Feed-Tree',
- autoScroll: true,
- collapsible: true,
- collapseMode: 'mini',
- cmargins: '0 0 0 0',
- margins: '0 0 0 0',
- split: true,
- bodyStyle: 'background-color:#fff',
- width: 254,
- items: this.PanelFeedTree,
- scope: this,
- tbar: []
- }, this.PanelCenter]
- });
-
- //Build Tb Feed
- this.buildTbFeed();
-
- this.PanelFeedTree.on('collapsenode', function(node){ this.saveFolderState(node.id, 0); }, this);
- this.PanelFeedTree.on('expandnode', function(node){ this.saveFolderState(node.id, 1); }, this);
-
- // Set preview pane position
- this.setPreviewPanePosition(this.ConfPreviewPane);
-
- // Set summary configuration
- this.setSummary(this.ConfShowSummary);
-
- // Show / Hide the statusBar
- this.showHideStatusBar();
-
- // Set Pane Size
- this.setPanelSize('tree_panel_width', this.ConfTreePanelWidth);
- this.setPanelSize('grid_panel_height', this.ConfGridPanelHeight);
- this.setPanelSize('panel_south_height',this.ConfPreviewPanelSouthHeight);
- this.setPanelSize('panel_east_width', this.ConfPreviewPanelEastWidth);
-
- if (this.ConfOldItems) {
-
- // Register task for delete old items
- this.TaskCleanFeed = new Ext.util.DelayedTask(this.cleanFeed, this);
- this.TaskCleanFeed.delay(2000); // start after 2 secondes.
- } else {
-
- // Register task for AutoRefresh Feed
- this.TaskSearchFeed = new Ext.util.DelayedTask(this.searchFeed, this);
- this.TaskSearchFeed.delay(2000); // start after 2 secondes.
- }
-
- // Unregister
- win.on('close', function() { this.TaskSearchFeed.cancel(); }, this);
-
- var Krega_taskSelectFirstFeed = new Ext.util.DelayedTask(this.selectFirstUnseenFeed, this);
- Krega_taskSelectFirstFeed.delay(1000); // start after 1 seconde.
-
- this.setStatusBar('qo-kregator-done', QoKregator.StatutReady);
-
- // 'On' resize TreePanel
- Ext.getCmp('qo-kregator-id-Feed-Tree').on('resize', function(panel, Pwidth, Pheight) {
-
- var treeWidth;
-
- if( panel.body.isScrollable() ) { treeWidth = Pwidth-19; }
- else { treeWidth = Pwidth; }
-
- this.setFeedPanelWidth(treeWidth);
- this.savePanelSizeState('tree_panel_width', treeWidth);
-
- }, this);
-
- // 'On' resize GridPanel
- Ext.getCmp('qo-kregator-id-gridFeed-panel').on('resize', function(panel, Pwidth, Pheight) {
- this.savePanelSizeState('grid_panel_height', Pheight);
- }, this);
-
- // 'On' resize PreviewPanel Bottom
- Ext.getCmp('qo-kregator-previewPanelSouth').on('resize', function(panel, Pwidth, Pheight) {
- this.savePanelSizeState('preview_panel_south_height', Pheight);
- }, this);
-
- // 'On' resize PreviewPanel Right
- Ext.getCmp('qo-kregator-previewPanelEast').on('resize', function(panel, Pwidth, Pheight) {
- this.savePanelSizeState('preview_panel_east_width', Pwidth);
- }, this);
-
- // Remove the splash screen
- Ext.get('qo-kregator-splash').fadeOut({
- remove: true
- });
-
- // Handle How we must open Qo-Kregator
- if( this.ConfOpenMode == 'Window' ) {
- win.show();
- } else if( this.ConfOpenMode == 'FullScreen' ) {
- win.show();
- win.maximize();
- } else if( this.ConfOpenMode == 'Minimized' ) {}
-
-
-
- } // End successfully load user's configuration
-
- });
-
-
- } else { win.show(); }
-
- }, //createWindow
-
- buildTbFeed: function() {
-
- // We remove all button currently in this toolBar
- var nbButton = Ext.getCmp('qo-kregator-id-Feed-Tree').getTopToolbar().items.items.length;
-
- for( var i=0; i < nbButton; i++ ) {
- var item = Ext.getCmp('qo-kregator-id-Feed-Tree').getTopToolbar().items.itemAt(i);
- item.destroy();
- }
-
- // And now, we create the New ToolBar
- var curTb = [];
-
- Ext.each(this.tbFeedBtnCurrent, function(item) {
-
- curTb.push(this.tbFeedBtnAvailable[item]);
-
- }, this);
-
- Ext.getCmp('qo-kregator-id-Feed-Tree').getTopToolbar().add(curTb);
-
- // Build the sub Menu for contextMenu button if exist
- if( Ext.getCmp('qo-kregator-contextmenu-btn') ) {
-
- var node = this.PanelFeedTree.getSelectionModel().getSelectedNode();
-
- if( node && node.attributes.type == 'folder' ) {
- Ext.getCmp('qo-kregator-contextmenu-btn').setMenu(this.createContextMenuTreeFolder());
- }
- if( node && node.attributes.type == 'file' ) {
- Ext.getCmp('qo-kregator-contextmenu-btn').setMenu(this.createContextMenuTreeFeed());
- }
- }
- }, //buildTbFeed
-
- selectFirstUnreadItems: function() {
-
- var firstItem = false;
- var firstItemUnread = false;
- var rowIndex = 0;
-
- // If there is no items in the dsItems, we reset the contextMenu-btn
- if( this.dsItems.data.length === 0 ) {
- Ext.getCmp('qo-kregator-contextmenu-news-btn').setMenu('');
- }
-
- // We loop over items
- for( var i = 0 ; i < this.dsItems.data.length ; i++ ) {
-
- // State first items
- if( i === 0 ) { firstItem = this.dsItems.data.items[i].data.id; }
-
- // State first items unread
- if( this.dsItems.data.items[i].data.s == 'n' ) {
- firstItemUnread = this.dsItems.data.items[i].data.id;
- rowIndex = i;
- break;
- }
- }
-
- if( firstItemUnread ) {
-
- // Load first unread
- this.PanelGridItem.getSelectionModel().selectRow(rowIndex);
-
- this.loadItem(rowIndex);
- } else if( firstItem ) {
-
- // or load first item
- this.PanelGridItem.getSelectionModel().selectRow(rowIndex);
- this.loadItem(rowIndex);
- }
-
- }, // selectFirstUnreadItems
-
- selectFirstUnseenFeed: function() {
-
- var firstFeed = false;
- var firstFolder = false;
- var firstFeedUnread = false;
-
- function _searchFeed(node){
- var kids = node.childNodes;
- var len = kids.length;
- for (var i = 0; i < len; i++) {
-
- if (kids[i].attributes.type == 'folder') {
- if( !firstFolder ) { firstFolder = kids[i].id; }
- }
-
- if (kids[i].attributes.type == 'file') {
-
- if( !firstFeed ) { firstFeed = kids[i].id; }
-
- if( kids[i].attributes.unseen != '-' && kids[i].attributes.unseen > 0 ) {
-
- if( !firstFeedUnread ) {
- firstFeedUnread = kids[i].id;
- break;
- }
- }
-
- }
- if( !firstFeedUnread ) { _searchFeed(kids[i]); }
- }
- }
-
- _searchFeed(this.PanelFeedTree.getRootNode());
-
- // Select Best Feed
- if( firstFeedUnread ) {
- this.PanelFeedTree.getNodeById(firstFeedUnread).select();
- this.onClickFeed(this.PanelFeedTree.getNodeById(firstFeedUnread));
- } else if( firstFeed ) {
- this.PanelFeedTree.getNodeById(firstFeed).select();
- this.onClickFeed(this.PanelFeedTree.getNodeById(firstFeed));
- } else if( firstFolder ) {
- this.PanelFeedTree.getNodeById(firstFolder).select();
- this.onClickFeed(this.PanelFeedTree.getNodeById(firstFolder));
- }
- },
-
- loadItem : function(rowIndex) {
-
- var curArticle = this.dsItems.getAt(rowIndex).data.id;
-
- this.setStatusBar('qo-kregator-inProgress', QoKregator.StatutLoadFeedArticle + this.dsItems.getAt(rowIndex).data.t);
-
- this.markAsSeenUnseen('y', curArticle, this);
- var r = Ext.get(this.PanelGridItem.getView().getRow(rowIndex));
- r.replaceClass("qo-kregator-feed-unread", "qo-kregator-feed-read");
-
- this.dsItemDesc.load({
- params: {
- 'id_item': curArticle
- }
- });
-
- }, // loadItem
-
- setPanelSize : function(Panel, Psize) {
-
- switch (Panel) {
- case 'tree_panel_width':
- Ext.getCmp('qo-kregator-id-Feed-Tree').setWidth(Psize);
- this.setFeedPanelWidth(Psize);
- break;
- case 'grid_panel_height':
- Ext.getCmp('qo-kregator-id-gridFeed-panel').setHeight(Psize);
- break;
- case 'panel_south_height':
- Ext.getCmp('qo-kregator-previewPanelSouth').setHeight(Psize);
- break;
- case 'panel_east_width':
- Ext.getCmp('qo-kregator-previewPanelEast').setWidth(Psize);
- break;
- }
-
- }, // setPanelSize
-
- savePanelSizeState : function(Panel, Psize) {
-
- Ext.Ajax.request({
- url: this.app.connection,
- params: {
- moduleId: this.moduleId,
- fileName: 'php/qo-kregator.php',
- panel: Panel,
- panelsize: Psize,
- what: 'set_panelsize_state'
- }
- });
-
- }, //savePanelWidthState
-
- setFeedPanelWidth : function(treeWidth) {
-
- var bw = Ext.isBorderBox ? 0 : 2;
- var widths = [(treeWidth-(this.columnUnseenWidth+this.columnTotalWidth+4)), this.columnUnseenWidth, this.columnTotalWidth];
- var totalWidth = 0;
- for (var i = 0; i < widths.length; i++) {
- totalWidth += widths[i];
- Ext.select("div.qo-kregator-x-tree-hd:nth-child(" + (i+1) + ")", false, "*TreeID*").setWidth(widths[i] - bw);
- Ext.select("div.qo-kregator-x-tree-col:nth-child(" + (i+1) + ")", false, "*TreeID*").setWidth(widths[i] - bw);
- this.PanelFeedTree.columns[i].width = widths[i];
- }
- this.PanelFeedTree.headers.setWidth(totalWidth);
- this.PanelFeedTree.innerCt.setWidth(totalWidth);
-
- }, //setFeedPanelWidth
-
- setSummary : function(pressed) {
-
- this.toggleSummary(pressed);
- Ext.getCmp('qo-kregator-summary-btn-id').toggle(pressed);
-
- }, // setSummary
-
- toggleSummary : function(pressed) {
-
- this.PanelGridItem.view.showSummary = pressed;
- this.PanelGridItem.view.refresh();
-
- // Save in DB
- this.saveSummaryState(pressed);
-
- }, // toggleSummary
-
- saveSummaryState:function(state) {
-
- Ext.Ajax.request({
- url: this.app.connection,
- params: {
- moduleId: this.moduleId,
- fileName: 'php/qo-kregator.php',
- showSummary: state,
- what: 'set_summary_state'
- }
- });
-
- }, // saveSummaryState
-
- saveFolderState:function(_nodeID, expand) {
-
- Ext.Ajax.request({
- url: this.app.connection,
- params: {
- moduleId: this.moduleId,
- fileName: 'php/qo-kregator.php',
- nodeID: _nodeID,
- expand: expand,
- what: 'set_folder_state'
- },
- success: function(response, options){},
- failure: function(response, options){}
- });
-
- }, // saveFolderState
-
- movePreview: function() {
-
- if( this.ConfPreviewPane == 'bottom' ) {
- // Set to right
- this.ConfPreviewPane = 'right';
- this.setPreviewPanePosition('right');
-
- } else if( this.ConfPreviewPane == 'right' ) {
- //set to hide
- this.ConfPreviewPane = 'hide';
- this.setPreviewPanePosition('hide');
-
- } else if( this.ConfPreviewPane == 'hide' ) {
- // set to bottom
- this.ConfPreviewPane = 'bottom';
- this.setPreviewPanePosition('bottom');
-
- }
-
- }, // movePreview
-
- setPreviewPanePosition : function(position) {
-
- var _title = this.PanelPreview.title;
- var _content = this.PanelPreview.body.dom.innerHTML;
-
- var right = Ext.getCmp('qo-kregator-previewPanelEast');
- var bot = Ext.getCmp('qo-kregator-previewPanelSouth');
- var btn = this.PanelGridItem.getTopToolbar().items.get(6);
-
- switch (position) {
- case 'bottom':
- this.PanelPreview = bot;
- this.PanelPreview.setTitle(_title);
- this.PanelPreview.body.dom.innerHTML = _content;
- this.PanelPreview.el.on('click',this.clickInterceptor, this);
- right.hide();
- bot.show();
- bot.ownerCt.doLayout();
- btn.setIconClass('qo-kregator-preview-bottom');
- break;
- case 'right':
- this.PanelPreview = right;
- this.PanelPreview.setTitle(_title);
- this.PanelPreview.body.dom.innerHTML = _content;
-
- this.PanelPreview.el.on('click',this.clickInterceptor, this);
-
- bot.hide();
- right.show();
- right.ownerCt.doLayout();
- btn.setIconClass('qo-kregator-preview-right');
- break;
- case 'hide':
- this.PanelPreview.hide();
- this.PanelPreview.ownerCt.doLayout();
- btn.setIconClass('qo-kregator-preview-hide');
- break;
- }
-
- this.savePreviewPanePosition(position);
-
- }, // setPreviewPanePosition
-
- savePreviewPanePosition:function(state) {
-
- Ext.Ajax.request({
- url: this.app.connection,
- params: {
- moduleId: this.moduleId,
- fileName: 'php/qo-kregator.php',
- preview_pane: state,
- what: 'set_previewpaneposition_state'
- }
- });
-
- }, // savePreviewPanePosition
-
- updateFeedInfo : function(id_feed, nb_unseen, nb_total) {
-
- if( nb_total === 0 ) { nb_total = '-'; }
-
-
- if( nb_unseen === 0 ) {
- // Remove class bold
- nb_unseen = '-';
- this.PanelFeedTree.getNodeById(id_feed).ui.removeClass("qo-kregator-feed-Unseen");
- Ext.get('qo-kregator-unSeen-'+id_feed).removeClass("qo-kregator-feed-Unseen");
- } else {
- // Add class bold
- this.PanelFeedTree.getNodeById(id_feed).ui.addClass("qo-kregator-feed-Unseen");
- Ext.get('qo-kregator-unSeen-'+id_feed).addClass("qo-kregator-feed-Unseen");
- }
-
- Ext.get('qo-kregator-unSeen-'+id_feed).dom.innerHTML = nb_unseen;
- Ext.get('qo-kregator-Total-'+id_feed).dom.innerHTML = nb_total;
-
- }, //updateFeedInfo
-
- cleanFeed: function(){
-
- this.setStatusBar('qo-kregator-inProgress', QoKregator.StatutCleanItemsWait);
-
- Ext.Ajax.request({
- scope: this,
- url: this.app.connection,
- params: {
- moduleId: this.moduleId,
- fileName: 'php/qo-kregator.php',
- day: this.ConfOldItemsDay,
- what: 'clean_feed'
- },
- success: function(response, options){
-
- var o = Ext.util.JSON.decode(response.responseText);
-
- if (o.success) {
-
- this.setStatusBar('qo-kregator-done', QoKregator.StatutCleanItemsOk + o.del_items);
-
-
- }
- else {
-
- this.setStatusBar('qo-kregator-error', QoKregator.StatutCleanItemsNok + o.msg);
-
- }
-
- // Register task for AutoRefresh Feed after cleanFeed
- this.TaskSearchFeed = new Ext.util.DelayedTask(this.searchFeed, this);
- this.TaskSearchFeed.delay(2000); // start after 2 secondes.
- }
- });
-
- }, // cleanFeed
-
- clickInterceptor : function(e, target, options){
-
- e.preventDefault();
- e.stopEvent();
-
- var delai = new Date();
- var curClick = delai.getTime();
-
- if (this.LastClick === 0) {
- this.LastClick = curClick - 51;
- }
-
- var diff = (curClick - this.LastClick);
-
- if (target.href) {
- if (diff > 50) {
- this.LastClick = curClick;
- var uniq = Ext.id();
- this.openInTab(uniq, target.href, target.href);
- }
- }
-
- }, // clickInterceptor
-
- /********
- *
- * ContextMenu
- *
- ********/
-
- createContextMenuTreeFeed: function() {
-
- var node = this.PanelFeedTree.getNodeById(this.curNodeId);
-
- var menu = new Ext.menu.Menu({
- items: [{
- text: QoKregator.TreeFeedMarkAsRead,
- iconCls: 'qo-kregator-icon-mark-all-as-read',
- scope: this,
- handler: function(el, ev){
- this.markAllAsRead(node, this);
- }
- }, new Ext.menu.Separator(), {
- scope: this,
- text: QoKregator.TreeFeedLoadFeed,
- iconCls:'qo-kregator-refresh-btn',
- handler: function(n, ev){
- this.updateFeed(node.attributes.text, node.attributes.id, node.id, 'off', -1);
- }
- }, new Ext.menu.Separator(), {
- scope: this,
- text: QoKregator.TreeFeedOpenSite,
- iconCls: 'qo-kregator-open-site-btn',
- handler: function(n, ev){
- this.openInTab(node.attributes.id, node.attributes.text, node.attributes.url);
- }
- }, new Ext.menu.Separator(), {
- scope: this,
- text: QoKregator.TreeFeedMod,
- iconCls: 'qo-kregator-icon-mod-feed',
- handler: function(n, ev){
- this.showModFeed(node);
- }
- }, {
- scope: this,
- text: QoKregator.TreeFeedDel,
- iconCls: 'qo-kregator-icon-del-feed',
- handler: function(n, ev){
- this.showDelItemArbre(node);
- }
- }]
- });
- return menu;
- }, //createContextMenuTreeFeed
-
- createContextMenuTreeFolder: function() {
-
- var node = this.PanelFeedTree.getNodeById(this.curNodeId);
-
- var menu = new Ext.menu.Menu({
- items: [{
- scope: this,
- text: QoKregator.TreeAddNewFeed,
- iconCls:'qo-kregator-icon-add-feed',
- handler: function(n, ev){
- this.showAddFeed(node.id);
- }
- }, {
- scope: this,
- text: QoKregator.TreeAddNewFolder,
- iconCls: 'qo-kregator-icon-add-folder',
- handler: function(n, ev){
- this.showAddFolder(node.id);
- }
- }, '-', {
- scope: this,
- text: QoKregator.TreeFolderMod,
- iconCls: 'qo-kregator-icon-mod-folder',
- handler: function(n, ev){
- // Start Edit
- this.PanelFeedTreeEditor.editNode = node;
- this.PanelFeedTreeEditor.startEdit(node.ui.getAnchor(), node.text);
- }
- }, {
- scope: this,
- text: QoKregator.TreeFolderDel,
- iconCls: 'qo-kregator-icon-del-folder',
- handler: function(n, ev){
- this.showDelItemArbre(node);
- }
- }]
- });
- return menu;
-
- }, //createContextMenuTreeFolder
-
- onContextMenuFeed: function(node, ev) {
-
- ev.preventDefault();
- ev.stopEvent();
-
- var actuNode = this.PanelFeedTree.getSelectionModel().getSelectedNode();
-
- if (node != actuNode) {
- node.select();
- this.onClickFeed(node, ev);
- }
-
- this.curNodeId = node.id;
- var nodeType = node.attributes.type;
-
- if (this.curNodeId !== 0) {
- if (nodeType == 'file') {
- menu = this.createContextMenuTreeFeed();
- menu.showAt(ev.getXY());
- }
-
- if (nodeType == 'folder') {
- menu = this.createContextMenuTreeFolder();
- menu.showAt(ev.getXY());
- }
- }
- }, // onContextMenuFeed
-
- createContextItemFeed : function() {
-
- var rowSelected = this.PanelGridItem.getSelections(); // All row selected
- var RowToDel = ''; // construct the string containing all row to delete
-
- var isImportant = false; //Is a row is important into all rows selected ?
- var isUnseen = false; //Is a row is unseen into all rows selected ?
-
- var menu = new Ext.menu.Menu();
-
- for (var j = 0; j < rowSelected.length; j++) {
-
- RowToDel += rowSelected[j].id + ',';
- if (rowSelected[j].data.i == 'y') {
- isImportant = true;
- }
- if (rowSelected[j].data.s == 'n') {
- isUnseen = true;
- }
-
- }
-
- menu.add({
- scope: this,
- text: QoKregator.FeedGridItemOpenInTab,
- iconCls: 'qo-kregator-open-inTab-btn',
- handler: function(){
- for (var i = 0; i < rowSelected.length; i++) {
-
- var _node = this.dsItems.getById(rowSelected[i].id);
- var _link = _node.data.u;
- var _title = _node.data.t;
-
- this.openInTab('items-' + rowSelected[i].id, _title, _link);
- }
- }
- });
-
- menu.add({
- scope: this,
- text: QoKregator.FeedGridItemOpenInWin,
- iconCls: 'qo-kregator-open-site-btn',
- handler: function(){
- for (var i = 0; i < rowSelected.length; i++) {
- this.openInWindow(rowSelected[i].id);
- }
- }
- });
-
- menu.addSeparator();
-
- var varMenuImportant;
-
- if (isImportant) {
-
- varMenuImportant = new Ext.menu.Item({
- scope: this,
- text: QoKregator.FeedGridItemRemoveMarkImportant,
- iconCls: 'qo-kregator-icon-unmark-as-important',
- handler: function(){
-
- for (var i = 0; i < rowSelected.length; i++) {
- this.markAsImportant('n', rowSelected[i].id);
-
- var rowId = rowSelected[i].id;
- var p = Ext.get(this.PanelGridItem.getView().getRow(this.dsItems.indexOfId(rowId)));
- p.removeClass("qo-kregator-feed-important");
- }
-
- }
- });
- }
- else {
-
- varMenuImportant = new Ext.menu.Item({
- scope: this,
- text: QoKregator.FeedGridItemMarkAsImportant,
- iconCls: 'qo-kregator-icon-mark-as-important',
- handler: function(){
-
- for (var i = 0; i < rowSelected.length; i++) {
- this.markAsImportant('y', rowSelected[i].id);
-
- var rowId = rowSelected[i].id;
- var p = Ext.get(this.PanelGridItem.getView().getRow(this.dsItems.indexOfId(rowId)));
- p.addClass("qo-kregator-feed-important");
-
- }
- }
- });
- }
-
- var varMenuUnseen;
-
- if( isUnseen ) {
-
- varMenuUnseen = new Ext.menu.Item({
- scope: this,
- text: QoKregator.FeedGridItemMarkAsRead,
- iconCls: 'qo-kregator-icon-mark-as-read',
- handler: function(){
- for (var i = 0; i < rowSelected.length; i++) {
- this.markAsSeenUnseen('y', rowSelected[i].id, this);
-
- var rowId = rowSelected[i].id;
- var p = Ext.get(this.PanelGridItem.getView().getRow(this.dsItems.indexOfId(rowId)));
- p.addClass("qo-kregator-feed-read");
- p.removeClass("qo-kregator-feed-unread");
-
- }
- }
- });
-
- } else {
-
- varMenuUnseen = new Ext.menu.Item({
- scope: this,
- text: QoKregator.FeedGridItemMarkAsUnRead,
- iconCls: 'qo-kregator-icon-mark-as-unread',
- handler: function(){
-
- for (var i = 0; i < rowSelected.length; i++) {
- this.markAsSeenUnseen('n', rowSelected[i].id, this);
-
- var rowId = rowSelected[i].id;
- var p = Ext.get(this.PanelGridItem.getView().getRow(this.dsItems.indexOfId(rowId)));
- p.removeClass("qo-kregator-feed-read");
- p.addClass("qo-kregator-feed-unread");
- }
- }
- });
-
- }
-
- menu.add({
- scope: this,
- text: QoKregator.FeedGridItemMarkAs,
- menu: {
- items: [varMenuImportant, new Ext.menu.Separator(),varMenuUnseen]
- }
- });
-
- menu.addSeparator();
-
- menu.add({
- scope: this,
- text: QoKregator.FeedGridItemDel,
- iconCls: 'qo-kregator-icon-del-feed',
- handler: function(grid, rowIndex, ev){
-
- var boxTitle='', boxMessage='';
-
- // How many rows to delete ?
- if( rowSelected.length == 1 ) {
- boxTitle = QoKregator.BoxConfirmDelItemTitle;
- boxMessage = QoKregator.BoxConfirmDelItemMessage;
- } else {
- boxTitle = QoKregator.BoxConfirmDelItemsTitle;
- boxMessage = QoKregator.BoxConfirmDelItemsMessage;
- }
-
-
- // Show confirm box
- Ext.Msg.show({
- scope: this,
- title:boxTitle,
- msg: boxMessage,
- buttons: Ext.Msg.YESNOCANCEL,
- fn: function(btn) {
-
- if( btn == 'yes' ) {
-
- this.setStatusBar('qo-kregator-inProgress', QoKregator.StatutItemDel);
-
- // Update DB
- var delItem = new Ext.data.Connection();
- delItem.request({
- scope: this,
- url: this.app.connection,
- params: {
- moduleId: this.moduleId,
- fileName: 'php/qo-kregator.php',
- id_item: RowToDel,
- what: 'del_items'
- },
- success: function(response, options){
-
- var o = Ext.util.JSON.decode(response.responseText);
-
- this.setStatusBar('qo-kregator-done', QoKregator.StatutItemDelOk);
-
- // Delete ligne(s)
- for (var i = 0; i < rowSelected.length; i++) {
-
- var _nodeID = this.dsItems.getById(rowSelected[i].id).data.id_f;
- var unSeen = o.message.Node[_nodeID].unseen;
- var total = o.message.Node[_nodeID].total;
- this.dsItems.remove(this.dsItems.getById(rowSelected[i].id));
- this.updateFeedInfo(_nodeID, unSeen, total);
-
- }
-
- // Focus & Display next items
- if( this.dsItems.data.items.length > 0 ) {
- this.loadItem(0);
- this.PanelGridItem.getSelectionModel().selectRow(0);
- } else {
- // Clear Preview Panel
- this.PanelPreview.setTitle(QoKregator.PreviewTitle);
- this.PanelPreview.body.dom.innerHTML = '';
- }
-
- },
- failure: function(form, action){
- this.setStatusBar('qo-kregator-error', QoKregator.StatutItemDelNok);
- }
- });
- }
- },
- icon: Ext.MessageBox.QUESTION
- });
- }
- });
- return menu;
- }, // CreateContextItemFeed
-
- onContextItemFeed: function(grid, rowIndex, ev){
-
- ev.stopEvent();
-
- // Get all rows selected, if any
- var rowSelected = this.PanelGridItem.getSelections();
-
- // Get the single row selected
- var contextRowID = this.dsItems.getAt(rowIndex).id;
-
- // If right-click without a rows selected, we auto-select the rows over the right-click
- var asSelect = false;
- for (var i = 0; i < rowSelected.length; i++) {
- if (contextRowID == rowSelected[i].id) {
- asSelect = true;
- }
- }
-
- if (!asSelect) {
- var v = this.PanelGridItem.getSelectionModel();
- v.selectRow(rowIndex);
- rowSelected = this.PanelGridItem.getSelections();
- }
-
- var menu;
- menu = this.createContextItemFeed();
- menu.showAt(ev.getXY());
-
- }, // onContextItemFeed
-
- markAsImportant: function(typeMark, rowId){
-
- var importantStatut = this.dsItems.getById(rowId).data.i;
-
- var _typeMark = typeMark;
- var _rowId = rowId;
-
- if ((importantStatut == 'y' && _typeMark == 'n') || (importantStatut == 'n' && _typeMark == 'y')) {
-
- var saveImportant = new Ext.data.Connection();
- saveImportant.request({
- scope: this,
- url: this.app.connection,
- params: {
- moduleId: this.moduleId,
- fileName: 'php/qo-kregator.php',
- id_item: _rowId,
- typeMark: _typeMark,
- what: 'save_important'
- },
- success: function(){
-
- if (_typeMark == 'y') {
- this.dsItems.getById(_rowId).data.i = 'y';
- } else if (_typeMark == 'n') {
- this.dsItems.getById(_rowId).data.i = 'n';
- }
-
- // ReBuilt the contextMenu-btn
- Ext.getCmp('qo-kregator-contextmenu-news-btn').setMenu(this.createContextItemFeed());
-
- }
- });
- }
- }, //markAsImportant
-
- markAsSeenUnseen: function(typeMark, rowId, scope){
-
- this.scope = scope;
-
- var seenStatut = this.dsItems.getById(rowId).data.s;
- var _typeMark = typeMark;
- var _rowId = rowId;
-
- // Modify if necessary
- if ((seenStatut == 'y' && _typeMark == 'n') || (seenStatut == 'n' && _typeMark == 'y')) {
-
- var saveSeenUnseen = new Ext.data.Connection();
- saveSeenUnseen.request({
- scope: this,
- url: this.app.connection,
- params: {
- moduleId: this.moduleId,
- fileName: 'php/qo-kregator.php',
- id_item: _rowId,
- typeMark: _typeMark,
- what: 'save_seenUnseen'
- },
- success: function(response, options){
-
- var o = Ext.util.JSON.decode(response.responseText);
-
- if (o.success) {
-
- var node = this.PanelFeedTree.getNodeById(o.nodeID);
- node.attributes.unseen = o.unSeen;
- node.attributes.total = o.total;
-
- // Update client data
- if (_typeMark == 'y') {
- this.dsItems.getById(_rowId).data.s = 'y';
- } else if (_typeMark == 'n') {
- this.dsItems.getById(_rowId).data.s = 'n';
- }
-
- this.updateFeedInfo(node.id, o.unSeen, o.total);
-
- // ReBuilt the contextMenu-btn
- Ext.getCmp('qo-kregator-contextmenu-news-btn').setMenu(this.createContextItemFeed());
-
- }
- }
- });
- }
- }, //markAsSeenUnseen
-
- markAllAsRead: function(node, scope) {
-
- var nb = scope.dsItems.data.length;
-
- for (var i = 0; i < nb; i++) {
- var r = Ext.get(scope.PanelGridItem.getView().getRow(i));
- r.replaceClass("qo-kregator-feed-unread", "qo-kregator-feed-read");
- }
- scope.markAsSeenDB(node.id, scope);
- node.ui.removeClass("qo-kregator-feed-Unseen");
-
- },
-
- markAsSeenDB: function(_nodeID, scope){
-
- this.scope = scope;
-
- var saveSeenUnseen = new Ext.data.Connection();
- saveSeenUnseen.request({
- scope: this,
- url: this.app.connection,
- params: {
- moduleId: this.moduleId,
- fileName: 'php/qo-kregator.php',
- id_feed: _nodeID,
- what: 'save_seenDB'
- },
- success: function(response, options){
-
- var o = Ext.util.JSON.decode(response.responseText);
-
- if (o.success) {
-
- var node = this.PanelFeedTree.getNodeById(o.nodeID);
- node.attributes.unseen = o.unSeen;
- node.attributes.total = o.total;
- this.updateFeedInfo(node.id, o.unSeen, o.total);
-
- }
- }
- });
-
- }, //markAsSeenDB
-
- openInWindow: function(rowId){
- var node = this.dsItems.getById(rowId);
- var link = node.data.u;
- window.open(link, 'win' + rowId);
- }, //openInWindow
-
- openInTab: function(feedID, title, link){
-
- var TabExist = this.PanelCenter.findById('qo-kregator-tab-' + feedID);
-
- if (TabExist) {
- this.PanelCenter.activate('qo-kregator-tab-' + feedID);
- }
- else {
-
- this.PanelCenter.add({
- id: 'qo-kregator-tab-' + feedID,
- linkTab: link,
- closable: true,
- title: Ext.util.Format.ellipsis(title, 20),
- layout: 'fit',
- border: true,
- html: '<div class="qo-kregator-preview-content"><iframe width="100%" height="100%" frameborder="0" src="' + link + '" /></div>'
-
- });
-
- this.PanelCenter.activate('qo-kregator-tab-' + feedID);
-
- }
-
- }, //openInTab
-
- onClickFeed: function(node, ev){
-
- this.curNodeId = node.id;
-
- var nodeType = node.attributes.type;
-
- this.PanelCenter.activate('qo-kregator-main');
-
- this.gridClearFilter();
-
- // Delete data
- this.dsItems.removeAll();
-
- if (nodeType == 'folder') {
-
- this.PanelPreview.body.dom.innerHTML = '';
-
- this.setStatusBar('qo-kregator-inProgress', QoKregator.StatutLoadFolder + " " + node.attributes.text);
-
- var ColIndex = this.PanelGridItem.getColumnModel().getIndexById('feed');
- this.PanelGridItem.getColumnModel().setHidden(ColIndex, false);
-
- // Set tab title
- Ext.getCmp('qo-kregator-main').setTitle(Ext.util.Format.ellipsis(node.attributes.text, 20));
- this.linkDefaultTab = '';
- this.curFeedId = '*';
-
- } else {
-
- this.setStatusBar('qo-kregator-inProgress', QoKregator.StatutLoadFeed + " " + node.attributes.text);
-
- var _ColIndex = this.PanelGridItem.getColumnModel().getIndexById('feed');
- this.PanelGridItem.getColumnModel().setHidden(_ColIndex, true);
-
- Ext.getCmp('qo-kregator-main').setTitle(Ext.util.Format.ellipsis(node.attributes.text, 20));
- this.linkDefaultTab = node.attributes.url;
- this.curFeedId = node.id;
-
- var image;
-
- if ( node.attributes.image ) {
- image = "<img src=\"" + node.attributes.image + "\" alt=\"\" />";
- } else {
- image = '';
- }
-
- var content = '<div class="qo-kregator-feed-info">' +
- '<div class="qo-kregator-item-date"></div>' +
- '<div class="qo-kregator-item-title">' +
- node.attributes.desc +
- '</div>' +
- '<div class="qo-kregator-item-author"><a href="' +
- node.attributes.url +
- '" Ext:qtip="' +
- QoKregator.previewLoadInNewPage +
- '" target="_blank">' +
- node.attributes.url +
- '</a></div>' +
- '</div>' +
- '<div class="qo-kregator-feed-content">' +
- '<div class="qo-kregator-feed-image">' +
- image +
- '</div>' +
- '</div>';
-
- this.PanelPreview.body.dom.innerHTML = content;
-
- }
-
- this.PanelPreview.setTitle(node.attributes.text);
-
- this.dsItems.baseParams = {
- 'id_feed': this.curFeedId,
- 'id_node': this.curNodeId
- };
-
- this.dsItems.load({
- params: {
- start: 0,
- limit: 25
- }
- });
-
-
- if (nodeType == 'folder') {
-
- //Handle ContextMenu
- if( Ext.getCmp('qo-kregator-contextmenu-btn') ) {
- Ext.getCmp('qo-kregator-contextmenu-btn').setMenu(this.createContextMenuTreeFolder());
- }
-
- } else {
-
- //Handle ContextMenu
- if( Ext.getCmp('qo-kregator-contextmenu-btn') ) {
- Ext.getCmp('qo-kregator-contextmenu-btn').setMenu(this.createContextMenuTreeFeed());
- }
-
- }
-
- }, //onClickFeed
-
- showDelItemArbre: function(node){
-
- var titre, message, typeObj;
-
- if (node.attributes.type == 'file') {
- titre = QoKregator.BoxConfirmDelFeedTitle;
- message = QoKregator.BoxConfirmDelFeedMessage + node.attributes.text + ' ?';
- }
-
- if (node.attributes.type == 'folder') {
- titre = QoKregator.BoxConfirmDelFolderTitle;
- message = String.format(QoKregator.BoxConfirmDelFolderMessage, node.attributes.text);
- }
-
- Ext.Msg.show({
- scope: this,
- icon: Ext.MessageBox.QUESTION,
- title: titre,
- msg: message,
- buttons: Ext.MessageBox.YESNO,
- fn: function(btn){
- if (btn == 'yes') {
- if (node.attributes.type == 'file') {
- this.setStatusBar('qo-kregator-inProgress', QoKregator.StatutDelFeed + node.attributes.text + '...');
- }
- else {
- this.setStatusBar('qo-kregator-inProgress', QoKregator.StatutDelFolder + node.attributes.text + '...');
- }
-
- // Update
- var delNode = new Ext.data.Connection();
- delNode.request({
- scope: this,
- url: this.app.connection,
- params: {
- moduleId: this.moduleId,
- fileName: 'php/qo-kregator.php',
- id_node: node.id,
- what: 'del_nodes'
- },
- success: function(response, options){
-
- var o = Ext.util.JSON.decode(response.responseText);
-
- if (o.success) {
-
- this.setStatusBar('qo-kregator-done', QoKregator.StatutDone);
-
- //Del node
- var curNode = this.PanelFeedTree.selModel.selNode;
-
- //Animation
- Ext.fly(curNode.ui.elNode).switchOff({
- easing: 'easeIn',
- duration: .3,
- remove: false,
- useDisplay: false,
- scope: this,
- callback: function() { curNode.parentNode.removeChild(curNode) ; }
- });
-
- // Return to initial state
- Ext.getCmp('qo-kregator-main').setTitle(QoKregator.FeedGridTabTitle);
- this.linkDefaultTab = '';
- this.dsItems.removeAll();
-
- this.PanelPreview.setTitle(QoKregator.PreviewTitle);
- this.PanelPreview.body.dom.innerHTML = '';
-
- }
- else {
- this.setStatusBar('qo-kregator-error', QoKregator.StatutDelItemNok);
- }
-
- }
- });
-
- }
- }
- });
-
- }, // showDelItemArbre
-
- showAddFeed: function(_nodeID){
-
- function validForm(scope) {
-
- scope.setStatusBar('qo-kregator-inProgress', QoKregator.StatutAddNewFeed);
-
- var waitAddFeed = Ext.MessageBox.show({
- msg: QoKregator.StatutAddNewFeedWait,
- progressText: QoKregator.StatutAddNewFeedWaitInProgress,
- width: 300,
- wait: true,
- waitConfig: {
- interval: 200
- }
- });
-
- FormAddFeed.form.submit({
- scope: scope,
- url: scope.app.connection,
- params: {
- moduleId: scope.moduleId,
- fileName: 'php/qo-kregator.php',
- nodeID: _nodeID,
- what: 'add_feed'
- },
- success: function(form, action){
-
- // Add this new node to tree
- var o = action.result;
-
- var nodeToAppend = new Ext.tree.TreeNode({
- id:o.id,
- text:o.text,
- url: o.url,
- url_feed: o.url_feed,
- type: o.type,
- desc: o.desc,
- image: o.image,
- view: o.view,
- nodeID: o.nodeID,
- unseen:o.unseen,
- total:o.total,
- uiProvider:Ext.tree.KregaColumnNodeUI,
- leaf:true,
- icon:o.icon,
- iconCls:'',
- refreshCycle:'on'
- });
-
- if( o.nodeID === "0" ) { scope.PanelFeedTree.getRootNode().appendChild(nodeToAppend); }
- else { scope.PanelFeedTree.getNodeById(o.nodeID).appendChild(nodeToAppend); }
-
- scope.PanelFeedTree.expandAll();
-
- var newNode = scope.PanelFeedTree.getNodeById(o.id);
- newNode.select();
- scope.onClickFeed(newNode);
-
- scope.updateFeedInfo(o.id, o.unseen, o.total);
-
- FormAddFeed.form.reset();
- waitAddFeed.hide();
- winAddFeed.close();
- scope.setStatusBar('qo-kregator-done', QoKregator.StatutAddNewFeedOk);
- },
-
- failure: function(form, action){
- scope.setStatusBar('qo-kregator-error', QoKregator.StatutAddNewFeedNok + action.result.message);
-
- waitAddFeed.hide();
- Ext.get('newFeed').focus();
-
- }
- });
-
- } //addFeed
-
- var FormAddFeed = new Ext.FormPanel({
- labelWidth: 40,
- frame: true,
- bodyStyle: 'padding:5px',
- width: 350,
- items: [{
- xtype:'textfield',
- fieldLabel: QoKregator.BoxAddFeedUrl,
- name: 'newFeed',
- id: 'newFeed',
- width: 300,
- enableKeyEvents: true,
- listeners: {
- scope: this,
- keyup: function(field, e) {
- if( e.getCharCode() == e.ENTER ) {
- validForm(this);
- }
- }
- }
- },{
- xtype: 'checkbox',
- hideLabel: true,
- boxLabel: QoKregator.BoxModFeedView,
- name: 'view',
- checked: false
- }]
- });
-
- var winAddFeed = new Ext.Window({
- animateEl: 'qo-kregator-add-feed-btn',
- title: QoKregator.BoxAddFeedTitle,
- layout: 'fit',
- modal: true,
- iconCls: 'qo-kregator-icon-add-feed',
- width: 430,
- height: 160,
- closeAction: 'close',
- bodyStyle: 'padding:5px',
- plain: true,
- items: FormAddFeed,
-
- buttons: [{
- text: QoKregator.BoxAddFeedSaveBtn,
- scope: this,
- handler: function(){
- validForm(this);
- }
- }, {
- text: QoKregator.BoxAddFeedCancelBtn,
- handler: function(){
- winAddFeed.close();
- }
- }]
- });
-
- winAddFeed.show(this);
-
- var tmp = new Ext.util.DelayedTask(function() { Ext.getCmp('newFeed').focus(); }, this);
- tmp.delay(200);
-
- }, //showAddFeed
-
- showConf: function() {
-
- function in_array(array, it) {
-
- for( var i=0; i < array.length; i++ ) {
-
- if( array[i] == it ) { return 1; }
-
- }
- return 0;
-
- } // array_diff
-
- var _tbFeedCurrent=[], _tbFeedDisponible=[];
-
- //Actual tbFeed
- Ext.each(this.tbFeedBtnCurrent, function(item) {
-
- _tbFeedCurrent.push([item, '<div class="'+this.tbFeedBtnAvailable[item].iconCls+'-conf">'+((typeof this.tbFeedBtnAvailable[item].tooltip == 'object' ) ? this.tbFeedBtnAvailable[item].tooltip.title : this.tbFeedBtnAvailable[item].tooltip) +'</div>']);
-
- }, this);
-
- //Disponible tbFeed
- Ext.each(this.tbFeedBtnAvailable, function(item) {
-
- if( in_array(this.tbFeedBtnCurrent,item) === 0 ) {
-
- _tbFeedDisponible.push([item, '<div class="'+this.tbFeedBtnAvailable[item].iconCls+'-conf">'+((typeof this.tbFeedBtnAvailable[item].tooltip == 'object' ) ? this.tbFeedBtnAvailable[item].tooltip.title : this.tbFeedBtnAvailable[item].tooltip) +'</div>']);
-
- }
-
- }, this);
-
- var FormConf = new Ext.FormPanel({
- labelWidth: 75,
- border:false,
- autoWidth: true,
- items: [{
- xtype:'tabpanel',
- deferredRender:false,
- activeTab: 0,
- defaults:{autoHeight:true, bodyStyle:'padding:10px'},
- items:[{
- title:QoKregator.WinConfTab0,
- layout:'form',
- items: [{
- layout:'column',
- border: false,
- items:[{
- columnWidth:0.5,
- layout: 'form',
- border: false,
- items: [{
- //1
- xtype: 'fieldset',
- anchor:'95%',
- title: QoKregator.WinConfFieldSetTitle0,
- height: 60,
- labelWidth: 100,
- items: [
- new Ext.ux.form.Spinner({
- strategy: new Ext.ux.form.Spinner.NumberStrategy({minValue: '1', maxValue: '100'}),
- fieldLabel: QoKregator.WinConfFieldSetLabel0,
- name: 'refresh_feed',
- editable: false,
- width: 50,
- value: this.ConfRefreshFeed
- })
- ]
- },{
- //2
- xtype: 'fieldset',
- anchor:'95%',
- title: QoKregator.WinConfFieldSetTitle1,
- height: 60,
- checkboxToggle: true,
- checkboxName: 'old_items',
- collapsed: !this.ConfOldItems,
- labelWidth: 100,
- items: [
- new Ext.ux.form.Spinner({
- strategy: new Ext.ux.form.Spinner.NumberStrategy({minValue: '1', maxValue: '100'}),
- fieldLabel: QoKregator.WinConfFieldSetLabel1,
- name: 'old_items_day',
- editable: false,
- width: 50,
- value: this.ConfOldItemsDay
- })
- ]
- },{
- xtype:'checkbox',
- checked: (this.ConfshowStatusBar == 'on') ? true : false,
- hideLabel: true,
- boxLabel: QoKregator.WinConfFieldSetTitle5,
- name: 'showStatusBar'
- }]
- },{
- columnWidth:0.5,
- layout: 'form',
- border: false,
- items: [{
- xtype: 'fieldset',
- anchor:'95%',
- title: QoKregator.WinConfFieldSetTitle3,
- height: 60,
- labelWidth: 100,
- layout:'absolute',
- items: [{
- xtype: 'slider',
- width: 150,
- value: this.ConfContentFontSize,
- increment: 1,
- minValue: 8,
- maxValue: 20,
- listeners: {
- change: function(s, NewValue) {
- Ext.getCmp('showSlider').setValue(NewValue);
- }
- }
- },{
- xtype: 'textfield',
- readOnly: true,
- id:'showSlider',
- name: 'ContentFontSize',
- width: 24,
- value: this.ConfContentFontSize,
- x: 154,
- y: 0
- }]
- },{
- xtype: 'fieldset',
- anchor:'95%',
- title: QoKregator.WinConfFieldSetTitle4,
- height: 60,
- labelWidth: 100,
- items: [{
- xtype: 'combo',
- hideLabel: true,
- store: [['FullScreen', QoKregator.WinConfFieldSetLabel41],['Window', QoKregator.WinConfFieldSetLabel42], ['Minimized', QoKregator.WinConfFieldSetLabel43]],
- forceSelection: true,
- triggerAction: 'all',
- hiddenName: 'openMode',
- mode: 'local',
- value: this.ConfOpenMode,
- editable:false,
- width: 100
-
- }]
- },{
- xtype: 'fieldset',
- anchor:'95%',
- title: 'Date/Time format',
- height: 90,
- labelWidth: 70,
- items: [{
- xtype: 'combo',
- fieldLabel: 'Date ',
- store: [
- ['d/m/y', '31/12/99'],
- ['d/m/Y', '31/12/1999'],
- ['y-m-d', '99-12-31'],
- ['Y-m-d', '1999-12-31']
- ],
- forceSelection: true,
- triggerAction: 'all',
- hiddenName: 'dateFormat',
- mode: 'local',
- value: this.ConfDateFormat,
- editable:false,
- width: 120
-
- },{
- xtype: 'combo',
- fieldLabel: 'Date/Time ',
- store: [
- ['d/m/y, H:i', '31/12/99, 14:15'],
- ['d/m/Y, H:i', '31/12/1999, 14:15'],
- ['y-m-d, H:i', '99-12-31, 14:15'],
- ['Y-m-d, H:i', '1999-12-31, 14:15']
- ],
- forceSelection: true,
- triggerAction: 'all',
- hiddenName: 'dateTimeFormat',
- mode: 'local',
- value: this.ConfDateTimeFormat,
- editable:false,
- width: 120
-
- }]
- }]
- }]
- }]
- },{
- title : QoKregator.WinConfTab1,
- layout:'form',
- defaults: {width: 420},
- items: [{
- xtype:"itemselector",
- id: "qo-kregator-conf-tb-feed",
- name:"tbFeedBtn",
- hideLabel: true,
- dataFields:["code", "desc"],
- fromData: _tbFeedDisponible,
- toData:_tbFeedCurrent,
- msWidth:200,
- msHeight:110,
- valueField:"code",
- displayField:"desc",
- imagePath:"system/modules/qo-kregator/ux/MultiselectItemSelector/",
- toLegend: QoKregator.WinConfTab1Selected,
- fromLegend: QoKregator.WinConfTab1Available
- }]
- }]
- }],
- buttons: [{
- text: QoKregator.WinConfSaveBtn,
- scope: this,
- handler: function(){
-
- this.setStatusBar('qo-kregator-inProgress', QoKregator.StatutConfWait);
-
- FormConf.form.submit({
- scope: this,
- url: this.app.connection,
- params: {
- moduleId: this.moduleId,
- fileName: 'php/qo-kregator.php',
- what: 'mod_user_conf'
- },
- success: function(form, action){
-
- var o = action.result;
-
- this.ConfRefreshFeed = o.refresh_feed;
- this.ConfOldItems = o.old_items;
- this.ConfOldItemsDay = o.old_items_day;
- this.ConfshowStatusBar = o.showStatusBar;
- this.tbFeedBtnCurrent = o.tbFeedBtn;
- this.ConfContentFontSize = o.ContentFontSize;
- this.ConfOpenMode = o.openMode;
-
- this.ConfDateTimeFormat = o.dateTimeFormat;
- this.ConfDateFormat = o.dateFormat;
-
- // Update ContentFontSize for the current preview
- this.setContentFontSize();
-
- // Update conf for the statusBar
- this.showHideStatusBar();
-
- // Update tbFeedBtn
- this.buildTbFeed();
-
- // Redraw the grid to handle dateFormat Change
- this.PanelGridItem.getColumnModel().getColumnById('date').renderer = this.renderDate.createDelegate(this, [this.ConfDateTimeFormat], 1);
- this.PanelGridItem.getView().refresh();
-
- this.setStatusBar('qo-kregator-done', QoKregator.StatutConfOk);
-
- winConf.close();
- },
- failure: function(form, action){
- this.setStatusBar('qo-kregator-error', QoKregator.StatutConfNok);
- }
- });
-
- }
- },{
- text: QoKregator.WinConfCancelBtn,
- handler: function(){
- winConf.close();
- }
- }]
-
- });
-
- var winConf = new Ext.Window({
- scope: this,
- title: QoKregator.WinConfTitle,
- layout: 'fit',
- modal: true,
- closeAction: 'close',
- iconCls: 'qo-kregator-icon-conf',
- width: 500,
- height: 350,
- plain: true,
- items: FormConf
- });
-
- winConf.show();
- },
-
- showModFeed: function(node){
-
- function validForm(node, scope) {
-
- scope.setStatusBar('qo-kregator-inProgress', QoKregator.StatutModFeed);
-
- FormModFeed.form.submit({
- params: {
- moduleId: scope.moduleId,
- fileName: 'php/qo-kregator.php',
- id_feed: node.attributes.id,
- what: 'mod_feed'
- },
- scope: scope,
- url: scope.app.connection,
- success: function(form, action){
-
- var o = action.result;
-
- // Update tree
- node.setText(o.nom);
- node.attributes.view = o.view;
- node.attributes.refreshCycle = o.refreshCycle;
- scope.setStatusBar('qo-kregator-done', QoKregator.StatutModFeedOk);
- scope.winModFeed.hide();
- },
- failure: function(form, action){
- scope.setStatusBar('qo-kregator-error', QoKregator.StatutModFeedNok);
- }
- });
-
- } // validForm
-
- var viewValue = false;
- if (node.attributes.view == 'site') {
- viewValue = true;
- }
-
- var refreshCycleValue = false;
- if (node.attributes.refreshCycle == 'off') {
- refreshCycleValue = true;
- }
-
- var FormModFeed = new Ext.FormPanel({
- labelWidth: 40,
- frame: true,
- bodyStyle: 'padding:5px',
- items: [{
- xtype: 'fieldset',
- title: node.text,
- autoHeight: true,
- defaultType: 'textfield',
- items: [{
- fieldLabel: QoKregator.BoxModFeedName,
- name: 'modFeed',
- value: node.text,
- width: 300,
- enableKeyEvents: true,
- listeners: {
- scope: this,
- keyup: function(field, e) {
- if( e.getCharCode() == e.ENTER ) {
- validForm(node, this);
- }
- }
- }
- }, {
- fieldLabel: 'Url ',
- name: 'url',
- readOnly: true,
- value: node.attributes.url_feed,
- width: 300,
- enableKeyEvents: true,
- listeners: {
- scope: this,
- keyup: function(field, e) {
- if( e.getCharCode() == e.ENTER ) {
- validForm(node, this);
- }
- }
- }
- }]
- }, {
- xtype: 'fieldset',
- title: QoKregator.BoxModFeedOption,
- autoHeight: true,
- defaultType: 'checkbox',
- items: [{
- hideLabel: true,
- boxLabel: QoKregator.BoxModFeedView,
- name: 'view',
- checked: viewValue
- },{
- hideLabel: true,
- boxLabel: 'Exclude from refresh cycle',
- name: 'refreshCycle',
- checked: refreshCycleValue
- }]
- }]
- });
-
- this.winModFeed = new Ext.Window({
- scope: this,
- title: QoKregator.BoxModFeedTitle,
- layout: 'fit',
- modal: true,
- iconCls: 'qo-kregator-icon-mod-feed',
- width: 450,
- height: 280,
- closeAction: 'hide',
- bodyStyle: 'padding:5px',
- plain: true,
- items: FormModFeed,
-
- buttons: [{
- text: QoKregator.BoxModFeedSaveBtn,
- scope: this,
- handler: function(){
- validForm(node, this);
- }
- }, {
- scope:this,
- text: QoKregator.BoxModFeedCancelBtn,
- handler: function(){
- this.winModFeed.hide();
- }
- }]
- });
- this.winModFeed.show(this);
- }, //showModFeed
-
- showAddFolder: function(_nodeID){
-
- function validForm(scope) {
-
- // Disable btn
- Ext.getCmp('qo-kregator-btnOK-id-add-folder').disable();
- Ext.getCmp('qo-kregator-btnCANCEL-id-add-folder').disable();
-
- scope.setStatusBar('qo-kregator-inProgress', QoKregator.StatutAddNewFolder);
-
- FormAddFolder.form.submit({
- scope: scope,
- url: scope.app.connection,
- params: {
- moduleId: scope.moduleId,
- fileName: 'php/qo-kregator.php',
- nodeID: _nodeID,
- what: 'add_folder'
- },
- success: function(form, action){
-
- var o = action.result, node;
-
- scope.setStatusBar('qo-kregator-done', QoKregator.StatutAddNewFolderOk);
-
- // Add this new node to tree
-
- if( o.nodeID !== "0" ) {
-
- scope.PanelFeedTree.getNodeById(o.nodeID).appendChild(new Ext.tree.TreeNode({
- text: o.name,
- id: o.id,
- leaf: false,
- iconCls: 'qo-kregator-feed-folder',
- type: 'folder',
- children:[],
- nodeID: o.nodeID
- }));
-
- } else {
-
- scope.PanelFeedTree.getRootNode().appendChild(new Ext.tree.TreeNode({
- text: o.name,
- id: o.id,
- leaf: false,
- iconCls: 'qo-kregator-feed-folder',
- type: 'folder',
- children:[],
- nodeID: o.nodeID
- }));
-
- }
-
- var newNode = scope.PanelFeedTree.getNodeById(o.id);
- newNode.select();
-
- FormAddFolder.form.reset();
- Ext.getCmp('qo-kregator-btnOK-id-add-folder').enable();
- Ext.getCmp('qo-kregator-btnCANCEL-id-add-folder').enable();
- winAddFolder.close();
- },
- failure: function(form, action){
- scope.setStatusBar('qo-kregator-done', QoKregator.StatutAddNewFolderNok);
- }
- });
-
- } //validForm
-
- var FormAddFolder = new Ext.FormPanel({
- labelWidth: 45,
- id: 'form-add-folder',
- frame: true,
- bodyStyle: 'padding:5px 5px 0',
- width: 350,
- defaults: {width: 280},
- items: [{
- xtype: 'textfield',
- fieldLabel: QoKregator.BoxAddFolderName,
- name: 'newFolder',
- id: 'newFolder',
- enableKeyEvents: true,
- listeners: {
- scope: this,
- keyup: function(field, e) {
- if( e.getCharCode() == e.ENTER ) {
- validForm(this);
- }
- }
- }
- }]
- });
-
- var winAddFolder = new Ext.Window({
- scope: this,
- animateEl: 'qo-kregator-add-feed-btn',
- title: QoKregator.BoxAddFolderTitle,
- layout: 'fit',
- modal: true,
- iconCls: 'qo-kregator-icon-add-folder',
- width: 400,
- height: 130,
- closeAction: 'close',
- plain: true,
- items: FormAddFolder,
- buttons: [{
- id:'qo-kregator-btnOK-id-add-folder',
- text: QoKregator.BoxAddFolderSaveBtn,
- scope: this,
- handler: function(){
- validForm(this);
- }
- }, {
- scope:this,
- text: QoKregator.BoxAddFolderCancelBtn,
- id:'qo-kregator-btnCANCEL-id-add-folder',
- handler: function(){
- winAddFolder.close();
- }
- }]
- });
-
- winAddFolder.show(this);
-
- var tmp = new Ext.util.DelayedTask(function() { Ext.getCmp('newFolder').focus(); }, this);
- tmp.delay(200);
-
- }, //showAddFolder
-
- showImport: function(_nodeID){
-
- function validForm(scope) {
-
- scope.setStatusBar('qo-kregator-inProgress', QoKregator.StatutImportWait);
-
- FormImport.form.submit({
- scope: scope,
- success: function(form, action){
-
- var o = action.result;
-
- if (o.success) {
-
- // Add folder
- scope.PanelFeedTree.getRootNode().appendChild(new Ext.tree.TreeNode({
- text: o.folderText,
- id: o.folderId,
- leaf: false,
- iconCls: 'qo-kregator-feed-folder',
- type: 'folder',
- children:[],
- nodeID: 0
- }));
-
- scope.PanelFeedTree.getNodeById(o.folderId).expand();
-
- var new_feed = [];
- var reg = new RegExp("[|]+", "g");
-
- var tmp_feed = o.new_feed;
- new_feed = tmp_feed.split(reg);
-
- // On ajoute les flux
- for (var i = 0; i < new_feed.length; i++) {
-
- if ( !new_feed[i]) { continue; }
-
- scope.setStatusBar('qo-kregator-inProgress', QoKregator.StatutAddNewFeed);
-
- var saveFeed = new Ext.data.Connection();
- saveFeed.request({
- scope: scope,
- url: scope.app.connection,
- params: {
- moduleId: scope.moduleId,
- fileName: 'php/qo-kregator.php',
- newFeed: new_feed[i],
- nodeID: o.folderId,
- what: 'add_feed'
- },
-
- success: function(response, options){
-
- var o2 = Ext.util.JSON.decode(response.responseText);
-
- if (o2.success) {
-
- // Add the new node
- scope.PanelFeedTree.getNodeById(o.folderId).appendChild(new Ext.tree.TreeNode({
- id:o2.id,
- text:o2.text,
- url: o2.url,
- url_feed: o2.url_feed,
- type: o2.type,
- desc: o2.desc,
- image: o2.image,
- view: o2.view,
- nodeID: o2.nodeID,
- unseen:o2.unseen,
- total:o2.total,
- uiProvider:Ext.tree.KregaColumnNodeUI,
- leaf:true,
- icon:o2.icon,
- iconCls:'',
- refreshCycle:'on'
- }));
-
- scope.updateFeedInfo(o2.id, o2.unseen, o2.total);
-
- scope.setStatusBar('qo-kregator-done', QoKregator.StatutAddNewFeedOk);
-
- } else {
- scope.setStatusBar('qo-kregator-error', QoKregator.StatutAddNewFeedNok + o2.message);
- }
- }
- });
-
- }
-
- scope.setStatusBar('qo-kregator-done', QoKregator.StatutImportOk);
-
- } else {
-
- Ext.MessageBox.show({
- title: 'erreur',
- msg: 'erreur' + o.msg,
- buttons: Ext.MessageBox.OK,
- animEl: 'mb9',
- icon: Ext.MessageBox.ERROR
- });
-
- }
-
- FormImport.form.reset();
- winImport.close();
- },
- failure: function(form, action){
- scope.setStatusBar('qo-kregator-done', QoKregator.StatutImportNok + action.result.msg);
- }
- });
-
- } // validForm
-
-
- var FormImport = new Ext.FormPanel({
- labelWidth: 45,
- labelAlign: 'top',
- id: 'form-import',
- fileUpload: true,
- url: this.app.connection+'?moduleId='+this.moduleId+'&fileName=php/qo-kregator.php&what=import',
- frame: true,
- bodyStyle: 'padding: 10px 10px 0 10px;',
- autoHeight: true,
- labelWidth: 50,
- defaults: {
- anchor: '95%',
- allowBlank: false,
- msgTarget: 'side'
- },
-
- items: [{
- fieldLabel: QoKregator.WinImportLibel1,
- xtype: 'textfield',
- name: 'importFolder',
- value: QoKregator.WinImportDefaultValue
- }, {
- xtype: 'fileuploadfield',
- fieldLabel: QoKregator.WinImportLibel2,
- name: 'importFile',
- id: 'importFile',
- emptyText: QoKregator.WinImportInfo,
- buttonCfg: {
- text: '',
- iconCls: 'upload-icon'
- }
-
- }]
-
- });
-
- var winImport = new Ext.Window({
- animateEl: 'qo-kregator-add-feed-btn',
- title: QoKregator.WinImportTitle,
- layout: 'fit',
- modal: true,
- iconCls: 'qo-kregator-icon-import',
- width: 400,
- height: 210,
- plain: true,
- bodyStyle: 'padding:5px',
- items: FormImport,
-
- buttons: [{
- text: QoKregator.WinImportSaveBtn,
- scope: this,
- handler: function(){
- validForm(this);
- }
- }, {
- text: QoKregator.WinImportCancelBtn,
- handler: function(){
- winImport.close();
- }
- }]
- });
-
- winImport.show(this);
-
- }, //showImport
-
- showAbout: function(){
-
- if (!this.winAbout) {
-
- this.winAbout = new Ext.Window({
- layout: 'fit',
- width: 560,
- height: 520,
- iconCls: 'qo-kregator-icon-about',
- modal: true,
- title: QoKregator.WinAboutTitle,
- closeAction: 'hide',
- plain: true,
- bodyStyle: 'color:#000',
- items: new Ext.TabPanel({
- autoTabs: true,
- activeTab: 0,
- border: false,
- defaults: {
- autoScroll: true
- },
- items: [{
- title: QoKregator.WinAboutTab0,
- html: '<div id="qo-kregator-about"><img src="system/modules/qo-kregator/img/default/logo.png" alt="" /></div><div id="qo-kregator-about-info">ver '+this.appVer+' - (c) 2007 - 2008, Yannick Torrès - <a href="mailto:yannick.torres@xxxxxxxxxxxx">yannick.torres@xxxxxxxxxxxx</a></div>'
- }, {
- title: QoKregator.WinAboutTab1,
- bodyStyle: 'padding:5px',
- html: '<div id="qo-kregator-credit"><ul><li><a href="http://extjs.com/forum/member.php?u=12208">Franck Carrouget</a><br><span class="qo-kregator-credit-info">' + QoKregator.WinAboutTab1Credits0 + '</span></li><li><a href="http://extjs.com/forum/member.php?u=6915">Andriy Levytskyy</a><br><span class="qo-kregator-credit-info">' + QoKregator.WinAboutTab1Credits1 + '</span></li><li><a href="http://extjs.com/forum/member.php?u=1485">K0bo</a><br><span class="qo-kregator-credit-info">' + QoKregator.WinAboutTab1Credits21 + '</span></li><li><a href="http://www.alsacreations.fr">AlsaCréations</a><br><span class="qo-kregator-credit-info"><a href="http://www.alsacreations.fr/dewplayer">DewPlayer</a> & <a href="http://www.alsacreations.fr/dewtube">DewTube</a></span></li><li><a href="http://extjs.com">ExtJs Team</a><br><span class="qo-kregator-credit-info">' + QoKregator.WinAboutTab1Credits3 + '</span></li></ul></div>'
- }, {
- title: QoKregator.WinAboutTab2,
- autoLoad: {
- url: 'system/modules/qo-kregator/license_LGPL_v2.txt'
- }
- }]
- }),
-
- buttons: [{
- scope:this,
- text: QoKregator.WinAboutClose,
- handler: function(){
- this.winAbout.hide();
- }
- }]
- });
- }
- this.winAbout.show(this);
-
- }, //showAbout
-
- gridClearFilter: function(){
-
- // Date searchField
- Ext.getCmp('qo-kregator-datefilter-btn').curDate = '*';
- Ext.getCmp('qo-kregator-datefilter-btn').setText(QoKregator.FeedGridFilterDateAllDate);
- Ext.getCmp('qo-kregator-datefilter-btn').toggle(false);
-
- // Text searchField
- Ext.getCmp('qo-kregator-search').setValue('');
-
- // State searchField
- Ext.getCmp('qo-kregator-etat').setValue('all', true);
-
- // Reset the trigger
- Ext.getCmp('qo-kregator-search').triggers[0].hide();
-
- }, // gridClearFilter
-
- showHideStatusBar: function() {
-
- if( this.ConfshowStatusBar == 'on' ) {
- Ext.getCmp('qo-kregator').getBottomToolbar().show();
- } else {
- Ext.getCmp('qo-kregator').getBottomToolbar().hide();
- }
-
- }, //showHideStatusBar
-
- setStatusBar: function(style, message){
-
- var statusBar = Ext.getCmp('qo-kregator-statusBar');
-
- statusBar.setStatus({
- text: message,
- iconCls: style
- });
-
- }, // setStatusBar
-
- searchFeed: function() {
-
- var count = 0;
-
- this.FeedNeedUpdate = [];
- this.ConfGoRefresh = true;
-
- // We change "refresh" to "stop" icon
- if( Ext.getCmp('qo-kregator-add-refresh-feed-btn') ) {
- Ext.getCmp('qo-kregator-add-refresh-feed-btn').setHandler(function() {this.ConfGoRefresh = false;}, this);
- Ext.getCmp('qo-kregator-add-refresh-feed-btn').setIconClass('qo-kregator-refresh-stop-btn');
- }
-
- function _searchFeed(node, scope){
-
- var kids = node.childNodes;
- var len = kids.length;
- for (var i = 0; i < len; i++) {
-
- if (kids[i].attributes.type == 'file') {
-
- // Exclude feed where refreshCycle == off
- if( kids[i].attributes.refreshCycle == 'on' ) {
-
- scope.FeedNeedUpdate[count] = [];
-
- scope.FeedNeedUpdate[count].nodeID = kids[i].id;
- scope.FeedNeedUpdate[count].id = kids[i].attributes.id;
- scope.FeedNeedUpdate[count].texte = kids[i].text;
- ++count;
-
- }
-
- }
- _searchFeed(kids[i], scope);
- }
- }
-
- _searchFeed(this.PanelFeedTree.getRootNode(), this);
-
- this.goUpdateAllFeed(0);
-
- this.TaskSearchFeed.delay(this.ConfRefreshFeed * 60 * 1000);
-
- }, //searchFeed
-
- goUpdateAllFeed: function(FeedIndex){
-
- if (this.FeedNeedUpdate[FeedIndex] && this.ConfGoRefresh ) {
- this.updateFeed(this.FeedNeedUpdate[FeedIndex].texte, this.FeedNeedUpdate[FeedIndex].id, this.FeedNeedUpdate[FeedIndex].nodeID, 'on', FeedIndex + 1);
- } else {
-
- // Return to default button refresh
- if( Ext.getCmp('qo-kregator-add-refresh-feed-btn') ) {
- Ext.getCmp('qo-kregator-add-refresh-feed-btn').setHandler(function() {this.TaskSearchFeed.delay(1000);}, this);
- Ext.getCmp('qo-kregator-add-refresh-feed-btn').setIconClass('qo-kregator-refresh-btn');
- }
- }
-
-
- }, // goUpdateAllFeed
-
- updateFeed: function(id_texte, id_Feed, _nodeID, cache, NextFeedIndex){
-
- this.setStatusBar('qo-kregator-inProgress', QoKregator.StatutUpdateFeed + id_texte + '...');
-
- this.PanelFeedTree.getNodeById(_nodeID).ui.removeClass("qo-kregator-feed-Unseen");
- this.PanelFeedTree.getNodeById(_nodeID).ui.addClass("x-tree-node-disabled");
-
- var UpdateFeed = new Ext.data.Connection();
-
- UpdateFeed.request({
- scope: this,
- url: this.app.connection,
- params: {
- moduleId: this.moduleId,
- fileName: 'php/qo-kregator.php',
- idFeed: id_Feed,
- cache: cache,
- what: 'update_feed'
- },
- success: function(response, options){
-
- var o = Ext.util.JSON.decode(response.responseText);
-
- if (o.success) {
-
- this.setStatusBar('qo-kregator-done', id_texte + ' : ' + QoKregator.StatutDone);
- this.PanelFeedTree.getNodeById(_nodeID).ui.removeClass("x-tree-node-disabled");
- this.updateFeedInfo(_nodeID, o.unseen, o.new_nb_item);
-
- // if there is new items & items for this feed are displayed, we update the grid
- if (o.new_nb_item > o.old_nb_item && this.curFeedId == id_Feed) {
- this.dsItems.reload();
- }
-
- } else {
-
- this.setStatusBar('qo-kregator-error', QoKregator.StatutUpdateFeedNok + id_texte);
-
- this.PanelFeedTree.getNodeById(_nodeID).ui.removeClass("x-tree-node-disabled");
- this.PanelFeedTree.getNodeById(_nodeID).ui.addClass("x-tree-node-error");
- }
-
- if (NextFeedIndex >= 0) {
- this.goUpdateAllFeed(NextFeedIndex);
- }
-
- }
- });
- }, //updateFeed
-
- renderDate: function(TmpDate, GoFormat) {
-
- if (TmpDate == '0000-00-00 00:00:00') { return '-'; }
-
- var dt = new Date();
- dt = Date.parseDate(TmpDate, "Y-m-d h:i:s");
-
- return dt.format(GoFormat);
-
- }, //renderDate
-
- setContentFontSize: function(choice) {
-
- if( Ext.select('.qo-kregator-feed-content') ) {
- Ext.select('.qo-kregator-feed-content').setStyle('font-size', this.ConfContentFontSize+'px');
- }
- } // setContentFontSize
-
-});