this.dialog = Roo.factory({
xtype: 'LayoutDialog',
xns: Roo,
+ listeners : {
+ show : function (_self)
+ {
+ if(typeof(_this.data) != 'undefined'){
+ _this.grid.footer.onClick('first');
+ }
+
+ if (!_this.grid.getSelectionModel().getSelected()) {
+ _this.source = '';
+ _this.viewPanel.setContent("Please select a version on the left");
+ }
+
+
+
+ }
+ },
background : false,
closable : false,
collapsible : false,
xns: Roo,
listeners : {
activate : function() {
- _this.wpanel = this;
- if (_this.wgrid) {
- _this.wgrid.footer.onClick('first');
+ _this.panel = this;
+ if (_this.grid) {
+ _this.grid.footer.onClick('first');
}
}
},
- background : true,
+ background : false,
fitContainer : true,
fitToframe : true,
region : 'west',
- tableName : 'clipping_journalist',
- title : "Publication Lists",
+ tableName : 'Images',
+ title : "Images",
grid : {
xtype: 'Grid',
xns: Roo.grid,
listeners : {
render : function()
{
- _this.wgrid = this;
- //_this.dialog = Pman.Dialog.FILL_IN
- if (_this.wpanel.active) {
+ _this.grid = this;
+
+ if (_this.panel.active) {
this.footer.onClick('first');
}
}
},
- autoExpandColumn : 'publication',
+ autoExpandColumn : 'event_when',
loadMask : true,
- dataSource : {
- xtype: 'Store',
- xns: Roo.data,
+ sm : {
+ xtype: 'RowSelectionModel',
+ xns: Roo.grid,
listeners : {
- beforeload : function (_self, o)
+ afterselectionchange : function (_self)
{
- o.params = o.params || {};
- o.params._list = 1;
+ var selected = this.getSelected();
+
+ _this.viewPanel.load( { url : baseURL + "/Roo/Events", method : 'GET' }, {_id : selected.data.id, _retrieve_source : 1}, function(oElement, bSuccess, oResponse){
+
+ _this.source = '';
+
+ var res = Roo.decode(oResponse.responseText);
+
+ if(!bSuccess || !res.success){
+ _this.viewPanel.setContent("Load data failed?!");
+ }
+
+ if(typeof(res.data) === 'string'){
+ _this.viewPanel.setContent(res.data);
+ return;
+ }
+
+ if(!_this.data.successFn){
+ Roo.MessageBox.alert('Error', 'Please setup the successFn');
+ return;
+ }
+
+ _this.source = _this.data.successFn(res);
+
+ _this.viewPanel.setContent(_this.source);
+
+ });
}
},
- remoteSort : true,
- sortInfo : { field : 'publication', direction: 'ASC' },
- proxy : {
- xtype: 'HttpProxy',
- xns: Roo.data,
- method : 'GET',
- url : baseURL + '/Roo/Groups.php'
- },
- reader : {
- xtype: 'JsonReader',
- xns: Roo.data,
- totalProperty : 'total',
- root : 'data',
- id : 'id',
- fields : [
- {
- 'name': 'id',
- 'type': 'int'
- },
- {
- 'name': 'name',
- 'type': 'string'
- },
- {
- 'name': 'type',
- 'type': 'int'
- },
- {
- 'name': 'leader',
- 'type': 'int'
- },
- {
- 'name': 'leader_id',
- 'type': 'int'
- },
- {
- 'name': 'leader_office_id',
- 'type': 'int'
- },
- {
- 'name': 'leader_name',
- 'type': 'string'
- },
- {
- 'name': 'leader_phone',
- 'type': 'string'
- },
- {
- 'name': 'leader_fax',
- 'type': 'string'
- },
- {
- 'name': 'leader_email',
- 'type': 'string'
- },
- {
- 'name': 'leader_company_id',
- 'type': 'int'
- },
- {
- 'name': 'leader_role',
- 'type': 'string'
- },
- {
- 'name': 'leader_active',
- 'type': 'int'
- },
- {
- 'name': 'leader_remarks',
- 'type': 'string'
- },
- {
- 'name': 'leader_passwd',
- 'type': 'string'
- },
- {
- 'name': 'leader_owner_id',
- 'type': 'int'
- },
- {
- 'name': 'leader_lang',
- 'type': 'string'
- },
- {
- 'name': 'leader_no_reset_sent',
- 'type': 'int'
- },
- {
- 'name': 'leader_action_type',
- 'type': 'string'
- },
- {
- 'name': 'leader_project_id',
- 'type': 'int'
- },
- {
- 'name': 'leader_deleted_by',
- 'type': 'int'
- },
- {
- 'name': 'leader_deleted_dt',
- 'type': 'date'
- },
- {
- 'name': 'leader_firstname',
- 'type': 'string'
- },
- {
- 'name': 'leader_lastname',
- 'type': 'string'
- },
- {
- 'name': 'leader_name_facebook',
- 'type': 'string'
- },
- {
- 'name': 'leader_url_blog',
- 'type': 'string'
- },
- {
- 'name': 'leader_url_twitter',
- 'type': 'string'
- },
- {
- 'name': 'leader_url_linkedin',
- 'type': 'string'
- },
- {
- 'name': 'leader_crm_lead_percentage',
- 'type': 'int'
- },
- {
- 'name': 'leader_crm_industry_id',
- 'type': 'int'
- },
- {
- 'name': 'leader_crm_updated_action_id',
- 'type': 'int'
- },
- {
- 'name': 'leader_crm_created_action_id',
- 'type': 'int'
- },
- {
- 'name': 'leader_crm_type_id',
- 'type': 'int'
- }
- ]
- }
- },
- footer : {
- xtype: 'PagingToolbar',
- xns: Roo,
- displayInfo : true,
- displayMsg : "Displaying Publication{0} - {1} of {2}",
- emptyMsg : "Nothing found",
- pageSize : 25
- },
- colModel : [
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'publication',
- header : 'Publication Lists',
- width : 200,
- renderer : function(v) { return String.format('{0}', v); }
- }
- ]
- }
- },
- {
- xtype: 'GridPanel',
- xns: Roo,
- listeners : {
- activate : function() {
- _this.panel = this;
- if (_this.grid) {
- _this.grid.footer.onClick('first');
- }
- }
- },
- background : true,
- fitContainer : true,
- fitToframe : true,
- region : 'center',
- tableName : 'clipping_journalist',
- title : "Journalist",
- grid : {
- xtype: 'EditorGrid',
- xns: Roo.grid,
- listeners : {
- render : function()
- {
- _this.grid = this;
- if (_this.panel.active) {
- this.footer.onClick('first');
- }
- }
+ singleSelect : true
},
- autoExpandColumn : 'name',
- clicksToEdit : 1,
- loadMask : true,
dataSource : {
xtype: 'Store',
xns: Roo.data,
beforeload : function (_self, o)
{
o.params = o.params || {};
- if (!_this.data.campaign_id) {
- Roo.log('Missing campaign id!?');
+
+ if(typeof(_this.data) == 'undefined'){
+ this.removeAll();
return false;
}
- o.params.campaign_id = _this.data.campaign_id;
+
+ var d = Roo.apply({}, _this.data);
+ delete d.successFn;
+
+ Roo.apply(o.params, d);
+
}
},
remoteSort : true,
- sortInfo : { field : 'name', direction: 'ASC' },
+ sortInfo : { field : 'event_when', direction: 'DESC' },
proxy : {
xtype: 'HttpProxy',
xns: Roo.data,
method : 'GET',
- url : baseURL + '/Roo/clipping_journalist.php'
+ url : baseURL + '/Roo/Events.php'
},
reader : {
xtype: 'JsonReader',
'type': 'int'
},
{
- 'name': 'name',
- 'type': 'string'
- },
- {
- 'name': 'publication',
+ 'name': 'event_when',
'type': 'string'
}
]
footer : {
xtype: 'PagingToolbar',
xns: Roo,
- displayInfo : true,
- displayMsg : "Displaying Journalist {0} - {1} of {2}",
- emptyMsg : "Nothing found",
+ displayInfo : false,
pageSize : 25
},
colModel : [
{
xtype: 'ColumnModel',
xns: Roo.grid,
- dataIndex : 'name',
- header : 'Name',
+ dataIndex : 'event_when',
+ header : 'Date',
width : 100,
- renderer : function(v,x,r)
- {
- return String.format('{0}', v ? v : '');
- }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'publication',
- header : 'Publication',
- width : 300,
- renderer : function(v,x,r)
- {
- return String.format('{0}', v ? v : '');
- },
- editor : {
- xtype: 'GridEditor',
- xns: Roo.grid
- }
+ renderer : function(v) { return String.format('{0}', v ? v.format('Y-m-d H:i:s') : ''); }
}
]
}
+ },
+ {
+ xtype: 'ContentPanel',
+ xns: Roo,
+ listeners : {
+ render : function (_self)
+ {
+ _this.viewPanel = _self;
+ }
+ },
+ autoScroll : true,
+ background : false,
+ fitContainer : true,
+ fitToFrame : true,
+ region : 'center'
}
],
center : {
xtype: 'LayoutRegion',
- xns: Roo,
- titlebar : false
+ xns: Roo
},
west : {
xtype: 'LayoutRegion',
xns: Roo,
- split : true
+ split : true,
+ width : 200
},
buttons : [
{
xns: Roo,
listeners : {
click : function() {
+
_this.dialog.hide();
+
+ if (_this.callback && _this.source != '') {
+ _this.callback.call(this, _this.source);
+ }
}
},
text : "OK"