Commit 681e70a5 authored by Frank Bergmann's avatar Frank Bergmann

- Sencha Touch:

  Notes example now working with edit
parent 7ff7ea10
......@@ -8,13 +8,15 @@ Ext.application({
],
models: [
'Category',
'Note',
'User'
],
stores: [
'NoteStore',
'UserStore',
'ContactStore'
'ContactStore',
'CategoryNoteTypeStore'
],
views: [
'SplashPage',
......@@ -30,6 +32,7 @@ Ext.application({
'UserNavigationController',
'NoteNavigationController',
'NoteListController'
// 'NoteDetailController'
],
// Main function: Load the various panels
......
Ext.define('PO.controller.NoteDetailController', {
extend: 'Ext.app.Controller',
xtype: 'noteDetailController',
config: {
refs: {
noteDetail: 'noteDetail'
},
control: {
'noteDetail': {
activate: 'onActivate'
}
}
},
onActivate: function(obj, rec) {
var form = this.getNoteDetail();
var data = form.getData();
console.log('NoteDetailController.onActivate: data=' + data);
form.setValues(data);
form.setRecord(rec);
}
});
......@@ -13,12 +13,11 @@ Ext.define('PO.controller.NoteNavigationController', {
},
showDetail: function(list, record) {
console.log('disclose details');
var view = this.getNoteNavigationView();
view.push({
xtype: 'noteDetail',
title: record.data.note,
data: record.data
record: record
});
}
});
......
Ext.define('PO.model.Category', {
extend: 'Ext.data.Model',
config: {
idProperty: 'category_id',
fields: [
{type: 'string', name: 'category_id'},
{type: 'string', name: 'tree_sortkey'},
{type: 'string', name: 'category'},
{type: 'string', name: 'aux_string1'},
{type: 'string', name: 'aux_string2'},
{type: 'string', name: 'category_type'},
{type: 'string', name: 'category_translated'},
{type: 'string', name: 'sort_order'},
{type: 'string', name: 'indent_class',
// Determine the indentation level for each element in the tree
convert: function(value, record) {
var category = record.get('category_translated');
var indent = (record.get('tree_sortkey').length / 8) - 1;
return 'extjs-indent-level-' + indent;
}
},
{type: 'string', name: 'tree_category_translated'}
],
proxy: {
type: 'rest',
url: '/intranet-rest/im_category',
appendId: true, // Append the object_id: ../im_ticket/<object_id>
timeout: 300000,
extraParams: {
format: 'json' // Tell the ]po[ REST to return JSON data.
},
reader: {
type: 'json', // Tell the Proxy Reader to parse JSON
rootProperty: 'data', // Where do the data start in the JSON file?
totalProperty: 'total' // Total number of tickets for pagination
}
}
}
});
Ext.define('PO.store.CategoryNoteTypeStore', {
extend: 'Ext.data.Store',
storeId: 'categoryNodeTypeStore',
config: {
model: 'PO.model.Category',
autoLoad: true,
sorters: [{
property: 'sort_order',
direction: 'ASC'
}, {
property: 'tree_sortkey',
direction: 'ASC'
}],
proxy: {
type: 'rest',
url: '/intranet-rest/im_category',
appendId: true,
extraParams: {
format: 'json',
category_type: '\'Intranet Notes Type\''
},
reader: {
type: 'json',
rootProperty: 'data'
}
}
}
});
......@@ -9,17 +9,30 @@ Ext.define('PO.view.NoteDetail', {
title: 'Note Fields',
instructions: '(email address is optional)',
items: [{
xtype: 'textfield',
name: 'first_names',
label: 'Name'
}, {
xtype: 'emailfield',
name: 'email',
label: 'Email'
xtype: 'selectfield',
name: 'note_type_id',
label: 'Type',
options: [
{text: 'Address', value: '11500'},
{text: 'Email', value: '11502'},
{text: 'Http', value: '11504'},
{text: 'Ftp', value: '11506'},
{text: 'Phone', value: '11508'},
{text: 'Fax', value: '11510'},
{text: 'Mobile', value: '11512'},
{text: 'Other', value: '11514'}
]
}, {
xtype: 'textareafield',
name: 'message',
label: 'Message'
name: 'note',
label: 'Note'
}, {
xtype: 'hiddenfield',
name: 'id'
}, {
xtype: 'hiddenfield',
name: 'object_id',
label: 'Object ID'
}
]
}, {
......@@ -27,21 +40,18 @@ Ext.define('PO.view.NoteDetail', {
text: 'Save',
ui: 'confirm',
handler: function() {
// var form = Ext.getCmp('contactFormPanel').getValues();
var form = this.up('formpanel');
form.submit({
method: 'GET',
url: 'http://www.project-open.net/intranet-crm-tracking/contact',
success: function() {
alert('form submitted successfully!');
},
failure: function() {
alert('form submission failed');
}
});
// Save the form values to the record.
// The record was set by the NoteNavigationController
var form = this.up('formpanel');
var rec = form.getRecord();
rec.set(form.getValues());
rec.save();
// Return to the list of notes page
var navView = this.up('noteNavigationView');
navView.pop();
}
}
]
}
}
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment