OSDN Git Service

ナビゲーションのアコーディオンパネル、及びその中の「メンテナンス業務」パネル、更にその中の各種ボタンを別ファイル(js)に定義し、それをロードするように修正。
authorMasamitsu Oikawa <oicawa@gmail.com>
Wed, 25 May 2011 16:38:47 +0000 (01:38 +0900)
committerMasamitsu Oikawa <oicawa@gmail.com>
Wed, 25 May 2011 16:38:47 +0000 (01:38 +0900)
これらのボタンにハンドラを割り付けてメインタブパネルにタブが追加表示されるようにしたつもりだが、正常に表示できていない。原因不明。てかよく分かってないのが原因。
また、不要なファイルを削除。

12 files changed:
app/controller/Platform.js
app/model/MenuItem.js [new file with mode: 0644]
app/store/MenuItems.js [new file with mode: 0644]
app/store/Users.js
app/view/#Decshee.js# [deleted file]
app/view/Decshee.js [deleted file]
app/view/menu/Entry.js [new file with mode: 0644]
app/view/menu/List.js [new file with mode: 0644]
app/view/platform/MainTabs.js
app/view/platform/Navigator.js
data/menuitems.json [new file with mode: 0644]
ext-4.0 [new symlink]

index af22f91..e81b0d6 100644 (file)
@@ -8,15 +8,19 @@ Ext.define(
       'user.Edit',
       'platform.Top',
       'platform.Navigator',
-      'platform.MainTabs'
+      'platform.MainTabs',
+      'menu.List',
+      'menu.Entry'
     ],
 
     stores: [
-      'Users'
+      'Users',
+      'MenuItems'
     ],
 
     models: [
-      'User'
+      'User',
+      'MenuItem'
     ],
 
     init: function() {
@@ -28,6 +32,9 @@ Ext.define(
           },
           'useredit button[action=save]': {
             click: this.updateUser
+          },
+          'menuentry': {
+            click: this.showMenu
           }
         }
       );
@@ -49,6 +56,14 @@ Ext.define(
       record.set(values);
       win.close();
       this.getUsersStore().sync();
+    },
+
+    showMenu: function(entry) {
+      console.log('clicked the ShowMenu button { text: ' + entry.text +  ', id:' + entry.id + '}');
+      var tabs = Ext.widget('platformmain');
+      console.log('tabs=' + tabs);
+      //tabs.showTab(entry);
+      tabs.addTab();
     }
   }
 );
\ No newline at end of file
diff --git a/app/model/MenuItem.js b/app/model/MenuItem.js
new file mode 100644 (file)
index 0000000..b9d9768
--- /dev/null
@@ -0,0 +1,7 @@
+Ext.define(
+  'Decshee.model.MenuItem',
+  {
+    extend: 'Ext.data.Model',
+    fields: ['name', 'id']
+  }
+);
\ No newline at end of file
diff --git a/app/store/MenuItems.js b/app/store/MenuItems.js
new file mode 100644 (file)
index 0000000..5647032
--- /dev/null
@@ -0,0 +1,23 @@
+Ext.define(
+  'Decshee.store.MenuItems',
+  {
+    extend: 'Ext.data.Store',
+    model: 'Decshee.model.MenuItem',
+    autoLoad: true,
+
+    proxy: {
+      type: 'ajax',
+      api: {
+        read: 'data/menuitems.json',
+        update: 'data/updateUsers.json'
+      },
+
+      reader: {
+        type: 'json',
+        root: 'users',
+        successProperty: 'success'
+      }
+
+    }
+  }
+);
\ No newline at end of file
index 3e45978..24d7538 100644 (file)
@@ -7,11 +7,11 @@ Ext.define(
 
     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',
diff --git a/app/view/#Decshee.js# b/app/view/#Decshee.js#
deleted file mode 100644 (file)
index ece93e3..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-// ------------------------------
-// トップパネル
-// ------------------------------
-Ext.define(
-  'Decshee.view.core.Top',
-  {
-    extend: 'Ext.Panel',
-    alias: 'widget.top',
-    defaults: {
-      border: false
-    },
-    initComponent: function() {
-      var me = this;
-      Ext.apply(
-        me,
-        {
-          html:'<h1>Decshee Groupware</h1>',
-          margins:'5 5 0 5',
-          region:'north',
-          split:true,
-          items: [
-          ]
-        }
-      );
-
-      this.callParent(arguments);
-    }
-  }
-);
-
-// ------------------------------
-// メインタブパネル
-// ------------------------------
-Ext.define(
-  'Decshee.view.core.Main',
-  {
-    extend: 'Ext.tab.Panel',
-    alias: 'widget.main',
-    defaults: {
-      border: false
-    },
-    initComponent: function() {
-      var me = this;
-      Ext.apply(
-        me,
-        {
-          activeTab: 0,
-          margins:'0 5 5 0',
-          region:'center',
-          index: 0,
-          items: [
-            {
-              id: 'home',
-              title: 'ホーム',
-              html: '<h1>ホームタブ</h1>'
-            }
-          ]
-        }
-      );
-
-      this.callParent(arguments);
-    },
-    add: function() {
-      var me = this;
-      ++me.index;
-      me.add(
-        {
-          title: 'New Tab ' + me.index,
-          iconCls: 'tabs',
-          html: '<h1>生成されたタブ' + me.index + 'です</h1>',
-          closable: true
-        }
-      ).show();
-    }
-  }
-);
-
-// ------------------------------
-// ナビゲーションパネル
-// ------------------------------
-Ext.define(
-  'Decshee.view.core.Navigator',
-  {
-    extend: 'Ext.Panel',
-    alias: 'widget.navigator',
-    defaults: {
-      border: false
-    },
-    initComponent: function() {
-      var me = this;
-      Ext.apply(
-        me,
-        {
-          title: 'ナビゲータ',
-          margins: '0 0 5 5',
-          width: 200,
-          collapsible: true,
-          region: 'west',
-          split: true,
-          layout: 'accordion',
-          bitems: [
-            {
-              title: 'お気に入り',
-              html: '<h1>業務関連へのリンクを表示する予定。<h1>',
-              iconCls: 'nav'
-            },
-            {
-              title: '検索',
-              html: '<h1>検索とか。<h1>',
-              iconCls: 'nav'
-            },
-            {
-              title: '管理業務',
-              iconCls: 'settings',
-              layout: {
-                type: 'vbox',
-                padding: 5,
-                align: 'stretch'
-              },
-              items: [
-                {
-                  xtype: 'button',
-                  text: '社員情報',
-                  margins: '0 0 5 0',
-                  handler: function() {
-                    showTab();
-                  }
-                },
-                {
-                  xtype: 'button',
-                  text: '組織情報',
-                  margins: '0 0 5 0',
-                  handler: function() {
-                    showTab();
-                  }
-                },
-                {
-                  xtype: 'button',
-                  text: '権限情報',
-                  margins: '0 0 5 0',
-                  handler: function() {
-                    showTab();
-                  }
-
-                }
-              ]
-            }
-          ]
-        }
-      );
-
-      this.callParent(arguments);
-    }
-  }
-);
diff --git a/app/view/Decshee.js b/app/view/Decshee.js
deleted file mode 100644 (file)
index f5da93d..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-// ------------------------------
-// トップパネル
-// ------------------------------
-Ext.define(
-  'Decshee.view.core.Top',
-  {
-    extend: 'Ext.Panel',
-    alias: 'widget.top',
-    defaults: {
-      border: false
-    },
-    initComponent: function() {
-      var me = this;
-      Ext.apply(
-        me,
-        {
-          html:'<h1>Decshee Groupware</h1>',
-          margins:'5 5 0 5',
-          region:'north',
-          split:true,
-          items: [
-          ]
-        }
-      );
-
-      this.callParent(arguments);
-    }
-  }
-);
-
-// ------------------------------
-// メインタブパネル
-// ------------------------------
-Ext.define(
-  'Decshee.view.core.Main',
-  {
-    extend: 'Ext.tab.Panel',
-    alias: 'widget.main',
-    defaults: {
-      border: false
-    },
-    initComponent: function() {
-      var me = this;
-      Ext.apply(
-        me,
-        {
-          activeTab: 0,
-          margins:'0 5 5 0',
-          region:'center',
-          index: 0,
-          items: [
-            {
-              id: 'home',
-              title: 'ホーム',
-              html: '<h1>ホームタブ</h1>'
-            }
-          ]
-        }
-      );
-
-      this.callParent(arguments);
-    },
-    add: function() {
-      var me = this;
-      ++me.index;
-      me.add(
-        {
-          title: 'New Tab ' + me.index,
-          iconCls: 'tabs',
-          html: '<h1>生成されたタブ' + me.index + 'です</h1>',
-          closable: true
-        }
-      ).show();
-    }
-  }
-);
-
-// ------------------------------
-// ナビゲーションパネル
-// ------------------------------
-Ext.define(
-  'Decshee.view.core.Navigator',
-  {
-    extend: 'Ext.Panel',
-    alias: 'widget.navigator',
-    defaults: {
-      border: false
-    },
-    initComponent: function() {
-      var me = this;
-      Ext.apply(
-        me,
-        {
-          title: 'ナビゲータ',
-          margins: '0 0 5 5',
-          width: 200,
-          collapsible: true,
-          region: 'west',
-          split: true,
-          layout: 'accordion',
-          items: [
-            {
-              title: 'お気に入り',
-              html: '<h1>業務関連へのリンクを表示する予定。<h1>',
-              iconCls: 'nav'
-            },
-            {
-              title: '検索',
-              html: '<h1>検索とか。<h1>',
-              iconCls: 'nav'
-            },
-            {
-              title: '管理業務',
-              iconCls: 'settings',
-              layout: {
-                type: 'vbox',
-                padding: 5,
-                align: 'stretch'
-              },
-              items: [
-                {
-                  xtype: 'button',
-                  text: '社員情報',
-                  margins: '0 0 5 0',
-                  handler: function() {
-                    showTab();
-                  }
-                },
-                {
-                  xtype: 'button',
-                  text: '組織情報',
-                  margins: '0 0 5 0',
-                  handler: function() {
-                    showTab();
-                  }
-                },
-                {
-                  xtype: 'button',
-                  text: '権限情報',
-                  margins: '0 0 5 0',
-                  handler: function() {
-                    showTab();
-                  }
-
-                }
-              ]
-            }
-          ]
-        }
-      );
-
-      this.callParent(arguments);
-    }
-  }
-);
diff --git a/app/view/menu/Entry.js b/app/view/menu/Entry.js
new file mode 100644 (file)
index 0000000..a71a087
--- /dev/null
@@ -0,0 +1,14 @@
+Ext.define(
+  'Decshee.view.menu.Entry',
+  {
+    extend: 'Ext.Button',
+    alias : 'widget.menuentry',
+    //store : 'MenuItem',
+    margins: '0 0 5 0',
+    id: ''
+    //renderTo: Ext.getBody(),
+    //initComponent: function() {
+    //  this.callParent(arguments);
+    //}
+  }
+);
\ No newline at end of file
diff --git a/app/view/menu/List.js b/app/view/menu/List.js
new file mode 100644 (file)
index 0000000..47798f9
--- /dev/null
@@ -0,0 +1,36 @@
+Ext.define(
+  'Decshee.view.menu.List',
+  {
+    extend: 'Ext.panel.Panel',
+    alias : 'widget.menulist',
+    title: 'メンテナンス業務',
+    iconCls: 'settings',
+    store : 'MenuItems',
+    layout: {
+      type: 'vbox',
+      padding: 5,
+      align: 'stretch'
+    },
+    items: [
+      {
+        xtype: 'menuentry',
+        text: '社員情報',
+        id: 'Member'
+      },
+      {
+        xtype: 'menuentry',
+        text: '組織情報',
+        id: 'Belonging'
+      },
+      {
+        xtype: 'menuentry',
+        text: '権限情報',
+        id: 'Role'
+      }
+    ],
+
+    initComponent: function() {
+      this.callParent(arguments);
+    }
+  }
+);
\ No newline at end of file
index c4989c4..3acf560 100644 (file)
@@ -13,7 +13,7 @@ Ext.define(
           index: 0,
           items: [
             {
-              id: 'home',
+              itemId: 'home',
               title: 'ホーム',
               html: '<h1>ホームタブ</h1>'
             }
@@ -25,6 +25,7 @@ Ext.define(
     },
 
     addTab: function() {
+      console.log('[START]tabs.addTab');
       var me = this;
       ++me.index;
       me.add(
@@ -35,6 +36,20 @@ Ext.define(
           closable: true
         }
       ).show();
+      console.log('[ END ]tabs.addTab');
+    },
+
+    showTab: function(entry) {
+      var me = this;
+        me.add(
+          {
+            title: entry.text,
+            //itemId: entry.id,
+            iconCls: 'tabs',
+            html: '<h1>生成された' + entry.text + 'タブです</h1>',
+            closable: true
+          }
+        ).show();
     }
   }
 );
\ No newline at end of file
index 38d17b2..fc7b006 100644 (file)
@@ -7,51 +7,17 @@ Ext.define(
     layout: 'accordion',
     // TODO items群はここに定義すべきではない。動的にどこかから持ってくるのが正しい。
     items: [
-       {
-         title: 'お気に入り',
-         html: '<h1>業務関連へのリンクを表示する予定。<h1>',
-         iconCls: 'nav'
-       },
-       {
-         title: '検索',
-         html: '<h1>検索とか。<h1>',
-         iconCls: 'nav'
-       },
-       {
-         title: '管理業務',
-         iconCls: 'settings',
-         layout: {
-           type: 'vbox',
-           padding: 5,
-           align: 'stretch'
-         },
-         items: [
-           {
-             xtype: 'button',
-             text: '社員情報',
-             margins: '0 0 5 0'
-             // handler: function() {
-             //   showTab();
-             // }
-           },
-           {
-             xtype: 'button',
-             text: '組織情報',
-             margins: '0 0 5 0'
-             // handler: function() {
-             //   showTab();
-             // }
-           },
-           {
-             xtype: 'button',
-             text: '権限情報',
-             margins: '0 0 5 0'
-             // handler: function() {
-             //   showTab();
-             // }
-           }
-         ]
-       }
+      { xtype: 'menulist' },
+      {
+        title: 'お気に入り',
+        html: '<h1>業務関連へのリンクを表示する予定。<h1>',
+        iconCls: 'nav'
+      },
+      {
+        title: '検索',
+        html: '<h1>検索とか。<h1>',
+        iconCls: 'nav'
+      }
     ]
   }
 );
\ No newline at end of file
diff --git a/data/menuitems.json b/data/menuitems.json
new file mode 100644 (file)
index 0000000..8aceadd
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  success: true,
+  users: [
+    { name: '社員情報', id: 'member'},
+    { name: '組織情報', id: 'belonging'},
+    { name: '権限情報', id: 'role'}
+  ]
+}
\ No newline at end of file
diff --git a/ext-4.0 b/ext-4.0
new file mode 120000 (symlink)
index 0000000..0c849e1
--- /dev/null
+++ b/ext-4.0
@@ -0,0 +1 @@
+../ext-4.0.0/
\ No newline at end of file