4 wcmf.grid.Action =
function(config) {
5 Ext.apply(
this, config);
6 wcmf.grid.Action.superclass.constructor.call(
this);
9 Ext.extend(wcmf.grid.Action, Ext.util.Observable, {
16 init:
function(grid) {
20 grid.on(
'render',
function() {
21 grid.getView().mainBody.on(
'mousedown', this.onMouseDown,
this);
28 onMouseDown:
function(e, t) {
29 var action = t.className;
30 var regexp = /Action$/;
31 if (action.search(regexp) > 0) {
32 var actionName = action.replace(regexp,
'');
33 if (this.getSupportedActions().indexOf(actionName) != -1) {
36 var row = e.getTarget(
'.x-grid3-row');
38 var record = this.grid.getStore().getAt(row.rowIndex);
40 this.grid.getSelectionModel().selectRow(row.rowIndex,
false);
43 this.performAction(actionName, record);
52 getSupportedActions:
function() {
59 performAction:
function(actionName, record) {
66 renderAction:
function(actionName, text, image) {
70 link += String.format(
'<img class="{0}" src="{1}" alt="{2}" title="{2}" border="0" style="cursor:pointer;">', actionName, image, text);
81 wcmf.grid.SortAction =
function(config) {
82 Ext.apply(
this, config);
83 wcmf.grid.SortAction.superclass.constructor.call(
this);
85 Ext.extend(wcmf.grid.SortAction, wcmf.grid.Action, {
88 getSupportedActions:
function() {
89 return [
'sortDown',
'sortUp'];
92 performAction:
function(actionName, record) {
94 var ignoreValues = record.data.DATATYPE_IGNORE;
96 if (actionName ==
'sortUp') {
97 Action.perform(
'sortup', {sortoid:record[
'id'], prevoid:ignoreValues[
'prevoid']}, this.grid.actionPerformed,
this);
100 else if (actionName ==
'sortDown') {
101 Action.perform(
'sortdown', {sortoid:record[
'id'], nextoid:ignoreValues[
'nextoid']}, this.grid.actionPerformed,
this);
105 renderer:
function(v, p, record) {
108 var ignoreValues = record.data.DATATYPE_IGNORE;
111 if (ignoreValues[
'hasSortUp'] && ignoreValues[
'hasSortUp'])
112 actionNav += wcmf.grid.Action.prototype.renderAction(
"sortUpAction",
Message.
get(
"Up"),
"images/up.png");
114 actionNav += wcmf.grid.Action.prototype.renderAction(
"",
Message.
get(
"Up"),
"images/up_grey.png");
117 if (ignoreValues[
'hasSortDown'] && ignoreValues[
'hasSortDown'])
118 actionNav += wcmf.grid.Action.prototype.renderAction(
"sortDownAction",
Message.
get(
"Down"),
"images/down.png");
120 actionNav += wcmf.grid.Action.prototype.renderAction(
"",
Message.
get(
"Down"),
"images/down_grey.png");
122 return '<span class="txtdefault">'+actionNav+
'</span>';
129 wcmf.grid.EditAction =
function(config) {
130 Ext.apply(
this, config);
131 wcmf.grid.EditAction.superclass.constructor.call(
this);
133 Ext.extend(wcmf.grid.EditAction, wcmf.grid.Action, {
135 getSupportedActions:
function() {
139 performAction:
function(actionName, record) {
141 var realSubject = record.data._properties.realSubject;
144 setContext(realSubject[
'type']); doDisplay(realSubject[
'oid']); submitAction(
'display');
147 setContext(record.data._type); doDisplay(record[
'id']); submitAction(
'display');
151 renderer:
function(v, p, record) {
154 var realSubject = record.data._properties.realSubject;
158 actionNav += wcmf.grid.Action.prototype.renderAction(
"editAction",
Message.
get(
"Edit %1%", [realSubject[
'oid']]),
"images/edit.png");
160 actionNav += wcmf.grid.Action.prototype.renderAction(
"editAction",
Message.
get(
"Edit %1%", [record[
'id']]),
"images/edit.png");
162 return '<span class="txtdefault">'+actionNav+
'</span>';
169 wcmf.grid.DuplicateAction =
function(config) {
170 Ext.apply(
this, config);
171 wcmf.grid.DuplicateAction.superclass.constructor.call(
this);
173 Ext.extend(wcmf.grid.DuplicateAction, wcmf.grid.Action, {
175 getSupportedActions:
function() {
176 return [
'duplicate'];
179 performAction:
function(actionName, record) {
181 var params = {oid:record[
'id'], oneCall:
true};
182 if (this.grid.store.baseParams &&
this.grid.store.baseParams[
'poid'])
183 params.targetoid = this.grid.store.baseParams[
'poid'];
184 Action.perform(
'copy', params, this.grid.actionPerformed,
this);
187 renderer:
function(v, p, record) {
191 actionNav += wcmf.grid.Action.prototype.renderAction(
"duplicateAction",
Message.
get(
"Duplicate %1%", [record[
'id']]),
"images/duplicate.png");
193 return '<span class="txtdefault">'+actionNav+
'</span>';
200 wcmf.grid.DeleteAction =
function(config) {
201 Ext.apply(
this, config);
202 wcmf.grid.DeleteAction.superclass.constructor.call(
this);
204 Ext.extend(wcmf.grid.DeleteAction, wcmf.grid.Action, {
207 getSupportedActions:
function() {
208 return [
'delete',
'unlink'];
211 performAction:
function(actionName, record) {
213 var realSubject = record.data._properties.realSubject;
215 if (actionName ==
'delete') {
217 var _grid = this.grid;
218 Ext.MessageBox.confirm(
Message.
get(
"Delete %1%", [record[
'id']]),
Message.
get(
"Really delete node %1%?", [record[
'id']]),
221 Action.perform(
'delete', {deleteoids:record[
'id']}, _grid.actionPerformed, _this);
226 else if (actionName ==
'unlink') {
228 associateoid = realSubject[
'oid'];
230 associateoid = record[
'id'];
231 Action.perform(
'disassociate', {oid:record.data._properties.clientOID, associateoids:associateoid}, this.grid.actionPerformed,
this);
235 renderer:
function(v, p, record) {
238 var realSubject = record.data._properties.realSubject;
241 if (record.data._properties.composition == undefined || record.data._properties.composition ==
true)
242 actionNav += wcmf.grid.Action.prototype.renderAction(
"deleteAction",
Message.
get(
"Delete %1%", [record[
'id']]),
"images/delete.png");
244 if (realSubject || record.data._properties.aggregation ==
true) {
245 actionNav += wcmf.grid.Action.prototype.renderAction(
"unlinkAction",
Message.
get(
"Disassociate %1%", [record[
'id']]),
"images/unlink.png");
246 actionNav += wcmf.grid.Action.prototype.renderAction(
"deleteAction",
Message.
get(
"Delete %1%", [record[
'id']]),
"images/delete.png");
250 return '<span class="txtdefault">'+actionNav+
'</span>';
get($message, $parameters=null, $domain='', $lang='')
Use the Message class to output messages. You need not instantiate a Message object because the metho...