stores: [
'Users',
- 'MenuItems'
+ 'menu.List'
],
models: [
'User',
- 'MenuItem'
+ 'menu.Entry'
],
init: function() {
'useredit button[action=save]': {
click: this.updateUser
},
- 'menuentry': {
- click: this.showMenu
+ 'menulist': {
+ itemdblclick: this.showTab
}
}
);
this.getUsersStore().sync();
},
- showMenu: function(entry) {
- console.log('clicked the ShowMenu button { text: ' + entry.text + ', id:' + entry.id + '}');
- var viewport = entry.up('viewport');
+ // showTab: function(entry) {
+ // console.log('clicked the ShowMenu button { text: ' + entry.text + ', id:' + entry.id + '}');
+ // var viewport = entry.up('viewport');
+ // var maintabs = viewport.child ('#maintabs');
+ // maintabs.showTab(entry);
+ // },
+
+ showTab: function(grid, record) {
+ console.log('Double clicked on ' + record.get('caption'));
+ var caption = record.get('caption');
+ var id = record.get('id');
+ console.log('clicked the ShowMenu entry { text: ' + caption + ', id:' + id + '}');
+ var viewport = grid.up('viewport');
var maintabs = viewport.child ('#maintabs');
- maintabs.showTab(entry);
- //maintabs.addTab();
+ maintabs.showTab(record);
}
}
);
\ No newline at end of file
+++ /dev/null
-Ext.define(
- 'Decshee.model.MenuItem',
- {
- extend: 'Ext.data.Model',
- fields: ['name', 'id']
- }
-);
\ No newline at end of file
--- /dev/null
+Ext.define(
+ 'Decshee.model.menu.Entry',
+ {
+ extend: 'Ext.data.Model',
+ fields: ['caption', 'id']
+ }
+);
\ No newline at end of file
proxy: {
type: 'ajax',
- url: 'data/users.json',
- // api: {
- // read: 'data/users.json',
- // update: 'data/updateUsers.json'
- // },
+ //url: 'data/users.json',
+ api: {
+ read: 'data/users.json',
+ update: 'data/updateUsers.json'
+ },
reader: {
type: 'json',
Ext.define(
- 'Decshee.store.MenuItems',
+ 'Decshee.store.menu.List',
{
extend: 'Ext.data.Store',
- model: 'Decshee.model.MenuItem',
+ model: 'Decshee.model.menu.Entry',
autoLoad: true,
proxy: {
type: 'ajax',
api: {
- read: 'data/menuitems.json',
- update: 'data/updateUsers.json'
+ read: 'data/menu/list.json',
+ update: 'data/menu/updateList.json'
},
reader: {
type: 'json',
- root: 'users',
+ root: 'menus',
successProperty: 'success'
}
-
}
}
-);
\ No newline at end of file
+);
+
Ext.define(
'Decshee.view.menu.List',
{
- extend: 'Ext.panel.Panel',
+ //extend: 'Ext.panel.Panel',
+ extend: 'Ext.grid.Panel',
alias : 'widget.menulist',
title: 'メンテナンス業務',
iconCls: 'settings',
- store : 'MenuItems',
- layout: {
- type: 'vbox',
- padding: 5,
- align: 'stretch'
- },
- items: [
- {
- xtype: 'menuentry',
- text: '社員情報',
- itemId: 'Member'
- },
- {
- xtype: 'menuentry',
- text: '組織情報',
- itemId: 'Belonging'
- },
- {
- xtype: 'menuentry',
- text: '権限情報',
- itemId: 'Role'
- }
- ],
+ store : 'menu.List',
+ hideHeaders : true,
initComponent: function() {
+ this.columns = [
+ //{header: 'Name', dataIndex: 'name', flex: 1},
+ {header: 'Caption', dataIndex: 'caption', flex: 1},
+ {header: 'ID', dataIndex: 'id', flex: 1, hidden: true}
+ ];
+
this.callParent(arguments);
}
}
-);
\ No newline at end of file
+);
console.log('[ END ]tabs.addTab');
},
- showTab: function(entry) {
+ showTab: function(entryRecord) {
var me = this;
- var tabId = entry.itemId + '-tab';
+ var tabId = entryRecord.get('id') + '-tab';
var tab = me.child('#' + tabId);
if (tab == null) {
me.add(
{
- title: entry.text,
+ title: entryRecord.get('caption'),
itemId: tabId,
iconCls: 'tabs',
- html: '<h1>生成された' + entry.text + 'タブです</h1>',
+ html: '<h1>生成された' + entryRecord.get('caption') + 'タブです</h1>',
closable: true
}
);
+++ /dev/null
-{
- success: true,
- users: [
- { name: '社員情報', id: 'member'},
- { name: '組織情報', id: 'belonging'},
- { name: '権限情報', id: 'role'}
- ]
-}
\ No newline at end of file
+++ /dev/null
-var log = function(e) {console.log(e);};
-var http = require('http');
-var url = require('url');
-var path = require('path');
-var fs = require('fs');
-var socketio = require('socket.io');
-var port_local = 8080;
-
-var load_static_file = function(uri, response) {
- // 相対パスで静的リソースを配信する。
- var tmp = uri.split('.');
- var type = tmp[tmp.length - 1];
- var filename = path.join(process.cwd(), uri);
-
- path.exists(
- filename,
- function(exists) {
- if (!exists) {
- response.writeHead(404, {'Content-Type': 'text/plain'});
- response.write('404 Not Found\n');
- response.end();
- return;
- }
-
- fs.readFile(
- filename,
- 'binary',
- function(err, file) {
- if (err) {
- response.writeHead(500, {'Content-Type': 'text/plain'});
- response.write(err + '\n');
- response.end();
- return;
- }
-
- switch (type) {
- case 'html':
- response.writeHead(200, {'Content-Type': 'text/html'});
- break;
- case 'js':
- response.writeHead(200, {'Content-Type': 'text/javascript'});
- break;
- case 'css':
- response.writeHead(200, {'Content-Type': 'text/css'});
- break;
- }
- response.write(file, 'binary');
- response.end();
- }
- );
- }
- );
-};
-
-
-// server
-var server = http.createServer(
- function(req, res) {
- var uri = url.parse(req.url).pathname;
- load_static_file(uri, res);
- }
-);
-
-server.listen(process.env.PORT || port_local);
-
-// websocket
-var io = socketio.listen(server);
-
-io.on(
- 'connection',
- function(client) {
- client.on(
- 'message',
- function(message) {
- //クライアントがメッセージを送って来たら実行される。
- //messageが送って来たデータ
- log(message);
- client.send(message); //送って来た本人だけに送る。
- client.broadcast(message); //送って来た人以外全員に送る。
- }
- );
- }
-);