Commit ce347c54b740538f988749baa7d5d632349d453b
1 parent
7fc31ac3
Exists in
master
and in
32 other branches
Done.
Showing
6 changed files
with
260 additions
and
61 deletions
Show diff stats
... | ... | @@ -0,0 +1,190 @@ |
1 | +Ext.define('StatusColorPicker', { | |
2 | + extend: 'Ext.form.field.Picker', | |
3 | + alias: 'widget.statuscolorpicker', | |
4 | + | |
5 | + toUpper : function(x){ | |
6 | + return x.toUpperCase(); | |
7 | + }, | |
8 | + replaceColor : function(x){ | |
9 | + return x.replace("#","") | |
10 | + }, | |
11 | + createPicker: function() { | |
12 | + var me = this; | |
13 | + return Ext.create('Ext.picker.Color', { | |
14 | + pickerField: me, | |
15 | + renderTo: Ext.getBody(), | |
16 | + floating: true, | |
17 | + minWidth: 133, | |
18 | + maxWidth: 200, | |
19 | + minHeight: 225, | |
20 | + autoScroll:true, | |
21 | + focusOnShow: true, | |
22 | + colors: amdaPlotObj.PlotObjectConfig.availableColorsNew.map(this.replaceColor).map(this.toUpper), | |
23 | + listeners: { | |
24 | + select: function(picker, color) { | |
25 | + me.setValue(color); | |
26 | + me.picker.hide(); | |
27 | + }, | |
28 | + scope: me | |
29 | + } | |
30 | + }); | |
31 | + } | |
32 | +}); | |
33 | + | |
34 | +Ext.define('StatusColorEditor', { | |
35 | + extend: 'Ext.grid.CellEditor', | |
36 | + alias: 'widget.statuscoloreditor', | |
37 | + | |
38 | + requires: [ | |
39 | + 'StatusColorPicker' | |
40 | + ], | |
41 | + | |
42 | + field: { | |
43 | + xtype: 'statuscolorpicker' | |
44 | + }, | |
45 | +}); | |
46 | + | |
47 | + | |
48 | +Ext.define('amdaUI.CatalogStatusGrid', { | |
49 | + extend: 'Ext.grid.Panel', | |
50 | + alias: 'widget.catstatusgrid', | |
51 | + | |
52 | + statusStore: Ext.create('Ext.data.Store', { | |
53 | + fields:['value', 'label', 'color'], | |
54 | + data:{'items':[]}, | |
55 | + proxy: { | |
56 | + type: 'memory', | |
57 | + reader: { | |
58 | + type: 'json', | |
59 | + root: 'items' | |
60 | + } | |
61 | + } | |
62 | + }), | |
63 | + cellEditing: Ext.create('Ext.grid.plugin.CellEditing', {clicksToEdit: 1 }), | |
64 | + | |
65 | + xtype:'grid', | |
66 | + | |
67 | + constructor: function(config) { | |
68 | + if(config.status != null){ | |
69 | + this.parseStatus(config.status); | |
70 | + } | |
71 | + this.init(config); | |
72 | + this.callParent(); | |
73 | + }, | |
74 | + onAddClick: function(grid){ | |
75 | + // Create a model instance | |
76 | + var rec = {'value':0, 'label':'', 'color':'000000'}; | |
77 | + | |
78 | + this.statusStore.insert(0, rec); | |
79 | + this.cellEditing.startEditByPosition({ | |
80 | + row: 0, | |
81 | + column: 0 | |
82 | + }); | |
83 | + }, | |
84 | + clearStore: function(){ | |
85 | + this.statusStore.removeAll(); | |
86 | + }, | |
87 | + onRemoveClick: function(grid, rowIndex){ | |
88 | + this.statusStore.removeAt(rowIndex); | |
89 | + }, | |
90 | + | |
91 | + rgbToHex: function(rgbArray) { | |
92 | + var hex = ""; | |
93 | + for (var i = 0; i < rgbArray.length; i++) { | |
94 | + var hexValue = Number(rgbArray[i]).toString(16); | |
95 | + if (hexValue.length < 2) { | |
96 | + hexValue = "0" + hexValue; | |
97 | + } | |
98 | + hex += hexValue; | |
99 | + } | |
100 | + return hex.toUpperCase(); | |
101 | + }, | |
102 | + hexToRgb: function(hex) { | |
103 | + var r = parseInt(hex.substring(0,2), 16); | |
104 | + var g = parseInt(hex.substring(2,4), 16); | |
105 | + var b = parseInt(hex.substring(4,6), 16); | |
106 | + return [r, g, b]; | |
107 | + }, | |
108 | + | |
109 | + getStatusString: function() { | |
110 | + var me = this; | |
111 | + var data = this.statusStore.data.items.map(function(item) { | |
112 | + var label = item.get('label'); | |
113 | + var value = item.get('value'); | |
114 | + var color = item.get('color'); | |
115 | + return value + ' : ' + label + ' [' + me.hexToRgb(color).toString().replaceAll(",",", ") + ']'; | |
116 | + }); | |
117 | + | |
118 | + var outputString = data.join(' - '); | |
119 | + return outputString; | |
120 | + }, | |
121 | + | |
122 | + parseStatus: function(inputStr) { | |
123 | + var me = this; | |
124 | + var items = inputStr.split(" - "); | |
125 | + var data = []; | |
126 | + for (var i = 0; i < items.length; i++) { | |
127 | + var parts = items[i].split(" : "); | |
128 | + if(parts.length > 1){ | |
129 | + var labelParts = parts[1].split(" ["); | |
130 | + | |
131 | + me.statusStore.insert(i,{ | |
132 | + 'value': parseInt(parts[0]), | |
133 | + 'label': labelParts[0], | |
134 | + 'color': this.rgbToHex(labelParts[1].slice(0, -1).split(", ")) | |
135 | + }); | |
136 | + } | |
137 | + } | |
138 | + }, | |
139 | + | |
140 | + init: function(config) { | |
141 | + Ext.apply(this, { | |
142 | + | |
143 | + store:this.statusStore, | |
144 | + columns: [ | |
145 | + { text: 'Value', dataIndex: 'value',width: 55,editor: 'textfield',menuDisabled: true}, | |
146 | + { text: 'Label', dataIndex: 'label', width: 55,editor: 'textfield',menuDisabled: true,}, | |
147 | + { | |
148 | + text: 'Color', | |
149 | + dataIndex: 'color', | |
150 | + width: 40, | |
151 | + menuDisabled: true, | |
152 | + renderer: function(value) { | |
153 | + return '<div style="background-color:#' + value + '; margin-left: auto; \ | |
154 | + margin-right: auto;width:15px;height:15px;"></div>'; | |
155 | + }, | |
156 | + editor: { | |
157 | + xtype: 'statuscoloreditor' | |
158 | + } | |
159 | + }, | |
160 | + { | |
161 | + xtype: 'actioncolumn', | |
162 | + width: 25, | |
163 | + sortable: false, | |
164 | + menuDisabled: true, | |
165 | + items: [{ | |
166 | + iconCls: 'icon-delete', | |
167 | + scope: this, | |
168 | + handler: this.onRemoveClick | |
169 | + }] | |
170 | + } | |
171 | + ], | |
172 | + selType: 'cellmodel', | |
173 | + plugins: [this.cellEditing], | |
174 | + height: 130, | |
175 | + renderTo: Ext.getBody(), | |
176 | + tbar: [ | |
177 | + { | |
178 | + xtype:'text', | |
179 | + text : 'Status', | |
180 | + },'->', | |
181 | + { | |
182 | + iconCls: 'icon-add', | |
183 | + text: 'New line', | |
184 | + scope: this, | |
185 | + handler: this.onAddClick | |
186 | + }] | |
187 | + }); | |
188 | + } | |
189 | + | |
190 | +}); | |
0 | 191 | \ No newline at end of file | ... | ... |
js/app/views/CatalogUI.js
... | ... | @@ -19,6 +19,8 @@ Ext.define('amdaUI.CatalogUI', { |
19 | 19 | 'Ext.ux.grid.filter.StringFilter', |
20 | 20 | 'amdaUI.OperationsTT', |
21 | 21 | 'Ext.grid.plugin.BufferedRenderer', |
22 | + 'amdaPlotObj.PlotObjectConfig', | |
23 | + 'amdaUI.CatalogStatusGrid', | |
22 | 24 | 'amdaUI.StatisticalPlug', |
23 | 25 | 'amdaDesktop.AmdaStateProvider', |
24 | 26 | 'Ext.grid.plugin.CellEditing' |
... | ... | @@ -26,6 +28,7 @@ Ext.define('amdaUI.CatalogUI', { |
26 | 28 | |
27 | 29 | isCatalog: true, |
28 | 30 | activeField : null, |
31 | + statusGrid:null, | |
29 | 32 | statics: { |
30 | 33 | COL_TO_HIDE_DURATION: 'colToHideDuration' |
31 | 34 | }, |
... | ... | @@ -850,8 +853,9 @@ Ext.define('amdaUI.CatalogUI', { |
850 | 853 | }, |
851 | 854 | |
852 | 855 | columnForm: function(isNew, self, me , columnInfo = null){ |
853 | - | |
854 | - | |
856 | + | |
857 | + this.statusGrid = Ext.create('amdaUI.CatalogStatusGrid',{status : (columnInfo != null) ? columnInfo.status : null }); | |
858 | + var me = this; | |
855 | 859 | // Different avaible types |
856 | 860 | var types = Ext.create('Ext.data.Store', { |
857 | 861 | fields: ['type', 'name'], |
... | ... | @@ -863,28 +867,10 @@ Ext.define('amdaUI.CatalogUI', { |
863 | 867 | ] |
864 | 868 | }); |
865 | 869 | |
866 | - Ext.create('Ext.data.Store', { | |
867 | - storeId:'simpsonsStore', | |
868 | - fields:['name', 'email', 'phone'], | |
869 | - data:{'items':[ | |
870 | - { 'name': 'Lisa', "email":"lisa@simpsons.com", "phone":"555-111-1224" }, | |
871 | - { 'name': 'Bart', "email":"bart@simpsons.com", "phone":"555-222-1234" }, | |
872 | - { 'name': 'Homer', "email":"home@simpsons.com", "phone":"555-222-1244" }, | |
873 | - { 'name': 'Marge', "email":"marge@simpsons.com", "phone":"555-222-1254" } | |
874 | - ]}, | |
875 | - proxy: { | |
876 | - type: 'memory', | |
877 | - reader: { | |
878 | - type: 'json', | |
879 | - root: 'items' | |
880 | - } | |
881 | - } | |
882 | - }); | |
883 | - | |
884 | 870 | // Window for the creation of the new Column |
885 | 871 | var window = Ext.create('Ext.window.Window', { |
886 | 872 | title: (isNew) ? 'New Column' : 'Edit Column', |
887 | - width: 575, | |
873 | + width: 480, | |
888 | 874 | height: 210, |
889 | 875 | closable:false, |
890 | 876 | modal:true, |
... | ... | @@ -901,15 +887,14 @@ Ext.define('amdaUI.CatalogUI', { |
901 | 887 | defaults: { |
902 | 888 | xtype: 'panel', |
903 | 889 | bodyStyle: {background: '#dfe8f6'}, |
904 | - flex: 1, | |
905 | 890 | border:false, |
906 | 891 | layout: 'anchor' |
907 | 892 | }, |
908 | 893 | layout:'hbox', |
909 | 894 | id: 'simpleForm', |
910 | 895 | frame: true, |
911 | - bodyPadding: '5 5 0', | |
912 | 896 | items: [{ |
897 | + flex:6, | |
913 | 898 | items:[{ |
914 | 899 | // Name |
915 | 900 | xtype:'textfield', |
... | ... | @@ -954,34 +939,19 @@ Ext.define('amdaUI.CatalogUI', { |
954 | 939 | }] |
955 | 940 | }, |
956 | 941 | { |
957 | - items:[ | |
958 | - { | |
959 | - xtype:'grid', | |
960 | - title: 'Status Color', | |
961 | - store: Ext.data.StoreManager.lookup('simpsonsStore'), | |
962 | - columns: [ | |
963 | - { text: 'Value', dataIndex: 'name',flex: 1,editor: 'textfield'}, | |
964 | - { text: 'Label', dataIndex: 'email', flex: 1,editor: 'textfield' }, | |
965 | - { text: 'Color', dataIndex: 'phone',flex: 1,editor: 'textfield' } | |
966 | - ], | |
967 | - selType: 'cellmodel', | |
968 | - plugins: [ | |
969 | - Ext.create('Ext.grid.plugin.CellEditing', { | |
970 | - clicksToEdit: 1 | |
971 | - }) | |
972 | - ], | |
973 | - height: 120, | |
974 | - width: 200, | |
975 | - renderTo: Ext.getBody() | |
976 | - }], | |
942 | + flex:4, | |
943 | + margin:'0 8 0 -5', | |
944 | + items:[this.statusGrid], | |
977 | 945 | }], |
978 | 946 | |
979 | 947 | buttons: [{ |
980 | 948 | text: 'Save', |
981 | 949 | handler: function() { |
982 | 950 | // If the form is correctly filled, we continue |
951 | + | |
983 | 952 | if(this.up('form').getForm().isValid()){ |
984 | 953 | if(isNew){ |
954 | + console.log(me.statusGrid.getStatusString()); | |
985 | 955 | var newColumnPrefix='added_param_id_'; |
986 | 956 | var nbAddedColumn= 0; |
987 | 957 | Ext.each(self.TTGrid.headerCt.getGridColumns(), function(column){ |
... | ... | @@ -995,6 +965,7 @@ Ext.define('amdaUI.CatalogUI', { |
995 | 965 | this.up('form').getForm().findField('typeColumn').getValue(), |
996 | 966 | this.up('form').getForm().findField('sizeColumn').getValue(), |
997 | 967 | this.up('form').getForm().findField('descriptionColumn').getValue(), |
968 | + me.statusGrid.getStatusString(), | |
998 | 969 | function(result, e){ |
999 | 970 | if(result){ |
1000 | 971 | me.toReconfigure = true; |
... | ... | @@ -1008,6 +979,7 @@ Ext.define('amdaUI.CatalogUI', { |
1008 | 979 | var newType = null; |
1009 | 980 | var newSize = null; |
1010 | 981 | var newDescription = null; |
982 | + var newStatus = null; | |
1011 | 983 | |
1012 | 984 | // Check if there is modifications |
1013 | 985 | if(this.up('form').getForm().findField('nameColumn').getValue() != columnInfo.name){ |
... | ... | @@ -1022,13 +994,17 @@ Ext.define('amdaUI.CatalogUI', { |
1022 | 994 | if(this.up('form').getForm().findField('descriptionColumn').getValue() != columnInfo.description){ |
1023 | 995 | newDescription = this.up('form').getForm().findField('descriptionColumn').getValue(); |
1024 | 996 | } |
997 | + if(me.statusGrid.getStatusString() != columnInfo.status){ | |
998 | + newStatus = me.statusGrid.getStatusString(); | |
999 | + } | |
1025 | 1000 | |
1026 | - if(newName != null || newType != null || newSize != null || newDescription != null) | |
1001 | + if(newName != null || newType != null || newSize != null || newDescription != null || newStatus != null) | |
1027 | 1002 | { |
1028 | - AmdaAction.editColumn(columnInfo.id, newName, newType, newSize, newDescription, function(result, e){ | |
1003 | + AmdaAction.editColumn(columnInfo.id, newName, newType, newSize, newDescription, newStatus, function(result, e){ | |
1029 | 1004 | if(result){ |
1030 | 1005 | me.toReconfigure = true; |
1031 | 1006 | me.onAfterInit(result); |
1007 | + me.statusGrid.clearStore(); | |
1032 | 1008 | window.close(); |
1033 | 1009 | } |
1034 | 1010 | }); |
... | ... | @@ -1046,12 +1022,15 @@ Ext.define('amdaUI.CatalogUI', { |
1046 | 1022 | text: 'Reset', |
1047 | 1023 | handler: function() { |
1048 | 1024 | this.up('form').getForm().reset(); |
1025 | + me.statusGrid.clearStore(); | |
1026 | + me.statusGrid.parseStatus(columnInfo.status); | |
1049 | 1027 | } |
1050 | 1028 | }, |
1051 | 1029 | { |
1052 | 1030 | // To quit the window |
1053 | 1031 | text: 'Cancel', |
1054 | 1032 | handler: function() { |
1033 | + me.statusGrid.clearStore(); | |
1055 | 1034 | window.close(); |
1056 | 1035 | } |
1057 | 1036 | }] | ... | ... |
php/classes/AmdaAction.php
... | ... | @@ -1674,9 +1674,9 @@ class AmdaAction |
1674 | 1674 | return $cacheMgr->deleteColumn($id); |
1675 | 1675 | } |
1676 | 1676 | |
1677 | - public function addColumn($id, $name, $type, $size, $description){ | |
1677 | + public function addColumn($id, $name, $type, $size, $description, $status){ | |
1678 | 1678 | $cacheMgr = new CatalogCacheMgr(); |
1679 | - return $cacheMgr->addColumn($id,$name, $type,$size,$description); | |
1679 | + return $cacheMgr->addColumn($id,$name, $type,$size,$description, $status); | |
1680 | 1680 | } |
1681 | 1681 | |
1682 | 1682 | public function getCatColumnInfo($id){ |
... | ... | @@ -1684,9 +1684,9 @@ class AmdaAction |
1684 | 1684 | return $cacheMgr->getCatColumnInfo($id); |
1685 | 1685 | } |
1686 | 1686 | |
1687 | - public function editColumn($id, $name, $type, $size,$description){ | |
1687 | + public function editColumn($id, $name, $type, $size,$description, $status){ | |
1688 | 1688 | $cacheMgr = new CatalogCacheMgr(); |
1689 | - return $cacheMgr->editColumn($id,$name, $type,$size,$description); | |
1689 | + return $cacheMgr->editColumn($id,$name, $type,$size,$description, $status); | |
1690 | 1690 | } |
1691 | 1691 | } |
1692 | 1692 | ?> | ... | ... |
php/classes/CatalogCacheMgr.php
... | ... | @@ -26,7 +26,7 @@ class CatalogCacheMgr extends TimeTableCacheMgr |
26 | 26 | $this->cache = new CatalogCacheObject(); |
27 | 27 | if (!empty($options['nparams'])) { |
28 | 28 | for ($i = 0; $i < (int)$options['nparams']; $i++) { |
29 | - $this->cache->addParameter(CatalogCacheMgr::DEFAULT_PARAM_ID_PREFIX.(string)($i+1), 'column_'.(string)($i+1), 1, 0, "", FALSE); | |
29 | + $this->cache->addParameter(CatalogCacheMgr::DEFAULT_PARAM_ID_PREFIX.(string)($i+1), 'column_'.(string)($i+1), 1, 0, "","", FALSE); | |
30 | 30 | } |
31 | 31 | } |
32 | 32 | else if (!empty($options['parameters'])) { |
... | ... | @@ -45,7 +45,11 @@ class CatalogCacheMgr extends TimeTableCacheMgr |
45 | 45 | if (isset($parameter['description'])) { |
46 | 46 | $description = $parameter['description']; |
47 | 47 | } |
48 | - $this->cache->addParameter($id, $parameter['name'], intval($parameter['size']), intval($parameter['type']), $description, FALSE); | |
48 | + $status = ""; | |
49 | + if (isset($parameter['status'])) { | |
50 | + $status = $parameter['status']; | |
51 | + } | |
52 | + $this->cache->addParameter($id, $parameter['name'], intval($parameter['size']), intval($parameter['type']), $description, $status, FALSE); | |
49 | 53 | ++$index; |
50 | 54 | } |
51 | 55 | } |
... | ... | @@ -74,7 +78,11 @@ class CatalogCacheMgr extends TimeTableCacheMgr |
74 | 78 | if (isset($parameter['description'])) { |
75 | 79 | $description = $parameter['description']; |
76 | 80 | } |
77 | - $this->cache->addParameter($parameter['id'], $parameter['name'], intval($parameter['size']), intval($parameter['type']), $parameter['description'], FALSE); | |
81 | + $status = ""; | |
82 | + if (isset($parameter['status'])) { | |
83 | + $status = $parameter['']; | |
84 | + } | |
85 | + $this->cache->addParameter($parameter['id'], $parameter['name'], intval($parameter['size']), intval($parameter['type']), $parameter['description'],$parameter['status'], FALSE); | |
78 | 86 | } |
79 | 87 | |
80 | 88 | return $result+ array('parameters' => $info['parameters']); |
... | ... | @@ -161,11 +169,11 @@ class CatalogCacheMgr extends TimeTableCacheMgr |
161 | 169 | return array('success' => $result , 'token' => $this->cache->getToken(), 'status' => $this->cache->getStatus(),'parameters' => $this->cache->getParametersInfo()); |
162 | 170 | } |
163 | 171 | |
164 | - public function addColumn($id,$name, $type,$size, $description){ | |
172 | + public function addColumn($id,$name, $type,$size, $description, $status){ | |
165 | 173 | if (!$this->loadFromFile()) |
166 | 174 | return array('success' => false, 'message' => 'Cannot load cache file'); |
167 | 175 | $isNew=true; |
168 | - $this->cache->addParameter($id,$name, $size, $type, $description , $isNew); | |
176 | + $this->cache->addParameter($id,$name, $size, $type, $description, $status, $isNew); | |
169 | 177 | $this->saveToFile(); |
170 | 178 | return array('success' => true , 'token' => $this->cache->getToken(), 'status' => $this->cache->getStatus(),'parameters' => $this->cache->getParametersInfo()); |
171 | 179 | } |
... | ... | @@ -177,11 +185,11 @@ class CatalogCacheMgr extends TimeTableCacheMgr |
177 | 185 | return $this->cache->getParameterInfo($id); |
178 | 186 | } |
179 | 187 | |
180 | - public function editColumn($id,$name, $type,$size, $description){ | |
188 | + public function editColumn($id,$name, $type,$size, $description, $status){ | |
181 | 189 | if (!$this->loadFromFile()) |
182 | 190 | return array('success' => false, 'message' => 'Cannot load cache file'); |
183 | 191 | |
184 | - $this->cache->editParameter($id,$name, $type, $size, $description); | |
192 | + $this->cache->editParameter($id,$name, $type, $size, $description, $status); | |
185 | 193 | |
186 | 194 | $this->saveToFile(); |
187 | 195 | return array('success' => true , 'token' => $this->cache->getToken(), 'status' => $this->cache->getStatus(),'parameters' => $this->cache->getParametersInfo()); | ... | ... |
php/classes/CatalogCacheObject.php
... | ... | @@ -26,7 +26,7 @@ class CatalogCacheObject extends TimeTableCacheObject |
26 | 26 | return $intervalObj; |
27 | 27 | } |
28 | 28 | |
29 | - public function addParameter($id, $name, $size, $type, $description, $isNew = false) | |
29 | + public function addParameter($id, $name, $size, $type, $description, $status, $isNew = false) | |
30 | 30 | { |
31 | 31 | $this->parameters[] = array( |
32 | 32 | 'id' => $id, |
... | ... | @@ -34,6 +34,7 @@ class CatalogCacheObject extends TimeTableCacheObject |
34 | 34 | 'size' => $size, |
35 | 35 | 'type' => $type, |
36 | 36 | 'description' => $description, |
37 | + 'status' => $status | |
37 | 38 | ); |
38 | 39 | if($isNew){ |
39 | 40 | $this->isModified = $isNew; |
... | ... | @@ -52,7 +53,7 @@ class CatalogCacheObject extends TimeTableCacheObject |
52 | 53 | return false; |
53 | 54 | } |
54 | 55 | |
55 | - public function editParameter($id, $name, $type, $size, $description) | |
56 | + public function editParameter($id, $name, $type, $size, $description, $status) | |
56 | 57 | { |
57 | 58 | foreach ($this->parameters as $index=>$param){ |
58 | 59 | if($id == $param['id']){ |
... | ... | @@ -64,6 +65,8 @@ class CatalogCacheObject extends TimeTableCacheObject |
64 | 65 | $this->parameters[$index]['size'] = $size; |
65 | 66 | if(isset($description)) |
66 | 67 | $this->parameters[$index]['description'] = $description; |
68 | + if(isset($status)) | |
69 | + $this->parameters[$index]['status'] = $status; | |
67 | 70 | $this->isModified = TRUE; |
68 | 71 | return true; |
69 | 72 | } |
... | ... | @@ -99,6 +102,8 @@ class CatalogCacheObject extends TimeTableCacheObject |
99 | 102 | fwrite($handle,pack('L',$parameter['type'])); |
100 | 103 | //Description Size |
101 | 104 | fwrite($handle,pack('L',strlen($parameter['description']))); |
105 | + //Status Size | |
106 | + fwrite($handle,pack('L',strlen($parameter['status']))); | |
102 | 107 | //Param Id |
103 | 108 | for ($i = 0; $i < strlen($parameter['id']); ++$i) |
104 | 109 | fwrite($handle,pack('C',ord($parameter['id'][$i]))); |
... | ... | @@ -108,6 +113,9 @@ class CatalogCacheObject extends TimeTableCacheObject |
108 | 113 | //Param description |
109 | 114 | for ($i = 0; $i < strlen($parameter['description']); ++$i) |
110 | 115 | fwrite($handle,pack('C',ord($parameter['description'][$i]))); |
116 | + //Param status | |
117 | + for ($i = 0; $i < strlen($parameter['status']); ++$i) | |
118 | + fwrite($handle,pack('C',ord($parameter['status'][$i]))); | |
111 | 119 | } |
112 | 120 | } |
113 | 121 | |
... | ... | @@ -143,6 +151,11 @@ class CatalogCacheObject extends TimeTableCacheObject |
143 | 151 | return false; |
144 | 152 | $descriptionlength = $res['descriptionlength']; |
145 | 153 | |
154 | + //Param status length | |
155 | + if (!$res = unpack('Lstatuslength',fread($handle,4))) | |
156 | + return false; | |
157 | + $statuslength = $res['statuslength']; | |
158 | + | |
146 | 159 | //Param Id |
147 | 160 | $id = ""; |
148 | 161 | for ($j = 0; $j < $idlength; ++$j) |
... | ... | @@ -170,7 +183,16 @@ class CatalogCacheObject extends TimeTableCacheObject |
170 | 183 | $description .= chr($res['description']); |
171 | 184 | } |
172 | 185 | |
173 | - $this->addParameter($id, $name, $size, $type, $description, FALSE); | |
186 | + //Param description | |
187 | + $status = ""; | |
188 | + for ($j = 0; $j < $statuslength; ++$j) | |
189 | + { | |
190 | + if (!$res = unpack('Cstatus',fread($handle,1))) | |
191 | + return false; | |
192 | + $status .= chr($res['status']); | |
193 | + } | |
194 | + | |
195 | + $this->addParameter($id, $name, $size, $type, $description, $status, FALSE); | |
174 | 196 | } |
175 | 197 | return true; |
176 | 198 | } | ... | ... |
php/config.php
... | ... | @@ -200,9 +200,9 @@ $API = array( |
200 | 200 | 'parseTemplatedParam' => array('len'=>1), |
201 | 201 | // Furkan - New Catalog Options |
202 | 202 | 'deleteColumn' => array('len'=> 1), |
203 | - 'addColumn' => array('len' => 5), | |
203 | + 'addColumn' => array('len' => 6), | |
204 | 204 | 'getCatColumnInfo' => array('len' => 1), |
205 | - 'editColumn' => array('len' => 5) | |
205 | + 'editColumn' => array('len' => 6) | |
206 | 206 | ) |
207 | 207 | ) |
208 | 208 | ); | ... | ... |