Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2ea80648

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID 2ea806480ef25ecd3a61a32d80e216e87210c39d
  • Vorgänger 1f1ee792
  • Nachfolger 82c10c28

requirement_spec.js: Funktionen in namespace kivi.requirement_spec verschoben

Unterschiede anzeigen:

js/requirement_spec.js
1 1
/* Functions used for the requirement specs */
2 2

  
3
namespace("kivi.requirement_spec", function(ns) {
4

  
3 5
// -----------------------------------------------------------------------------
4 6
// ------------------------------ basic settings -------------------------------
5 7
// -----------------------------------------------------------------------------
6 8

  
7
function basic_settings_customer_changed(customer_ctrl, value_ctrl) {
9
ns.basic_settings_customer_changed = function(customer_ctrl, value_ctrl) {
8 10
  $.get(
9 11
    'controller.pl?action=Customer/get_hourly_rate',
10 12
    { id: $(customer_ctrl).val() },
11 13
    function(data) { if (data.hourly_rate_formatted) $(value_ctrl).val(data.hourly_rate_formatted); }
12 14
  );
13
}
15
};
14 16

  
15 17
// -----------------------------------------------------------------------------
16 18
// ------------------------------ the tree itself ------------------------------
17 19
// -----------------------------------------------------------------------------
18 20

  
19
function requirement_spec_tree_check_move(data) {
21
ns.tree_check_move = function(data) {
20 22
  var dragged_type = data.o.data('type');
21 23
  var dropped_type = data.r.data('type');
22 24

  
......
56 58
  // console.debug("dropped_depth " + dropped_depth + " dragged_depth " + dragged_depth);
57 59

  
58 60
  return (2 <= dropped_depth) && ((dragged_depth + dropped_depth) <= 4);
59
}
61
};
60 62

  
61
function requirement_spec_tree_node_moved(event) {
63
ns.tree_node_moved = function(event) {
62 64
  // console.debug("node moved");
63 65
  var move_obj   = $.jstree._reference('#tree')._get_move();
64 66
  var dragged    = move_obj.o;
......
80 82
  $.post("controller.pl", data, eval_json_result);
81 83

  
82 84
  return true;
83
}
85
};
84 86

  
85
function requirement_spec_tree_node_clicked(event) {
87
ns.tree_node_clicked = function(event) {
86 88
  var node = $.jstree._reference('#tree')._get_node(event.target);
87 89
  var type = node ? node.data('type') : undefined;
88 90

  
......
98 100
    clicked_type:         type,
99 101
    clicked_id:           node.data('id')
100 102
  }, eval_json_result);
101
}
103
};
102 104

  
103 105
// -------------------------------------------------------------------------
104 106
// ------------------------------ text blocks ------------------------------
105 107
// -------------------------------------------------------------------------
106 108

  
107
function find_text_block_id(clicked_elt) {
109
ns.find_text_block_id = function(clicked_elt) {
108 110
  // console.log("id: " + $(clicked_elt).attr('id'));
109 111
  var id = $(clicked_elt).attr('id');
110 112
  if (/^text-block-\d+$/.test(id)) {
......
126 128

  
127 129
  // console.log("find_text_block_id: case undef");
128 130
  return undefined;
129
}
131
};
130 132

  
131
function find_text_block_output_position(clicked_elt) {
133
ns.find_text_block_output_position = function(clicked_elt) {
132 134
  var output_position = $(clicked_elt).closest('#text-block-list-container').find('#text_block_output_position').val();
133 135
  if (output_position)
134 136
    return output_position;
......
138 140
    return type == "text-blocks-front" ? 0 : 1;
139 141

  
140 142
  return undefined;
141
}
143
};
142 144

  
143
function disable_edit_text_block_commands(key, opt) {
144
  return find_text_block_id(opt.$trigger) == undefined;
145
}
145
ns.disable_edit_text_block_commands = function(key, opt) {
146
  return ns.find_text_block_id(opt.$trigger) == undefined;
147
};
146 148

  
147
function standard_text_block_ajax_call(key, opt, other_data) {
149
ns.standard_text_block_ajax_call = function(key, opt, other_data) {
148 150
  var data = {
149 151
    action:               "RequirementSpecTextBlock/ajax_" + key,
150 152
    requirement_spec_id:  $('#requirement_spec_id').val(),
151
    id:                   find_text_block_id(opt.$trigger),
152
    output_position:      find_text_block_output_position(opt.$trigger),
153
    id:                   ns.find_text_block_id(opt.$trigger),
154
    output_position:      ns.find_text_block_output_position(opt.$trigger),
153 155
    current_content_type: $('#current_content_type').val(),
154 156
    current_content_id:   $('#current_content_id').val()
155 157
  };
......
157 159
  $.post("controller.pl", $.extend(data, other_data || {}), eval_json_result);
158 160

  
159 161
  return true;
160
}
162
};
161 163

  
162
function cancel_edit_text_block_form(id_base) {
164
ns.cancel_edit_text_block_form = function(id_base) {
163 165
  var id = $('#' + id_base + '_id').val();
164 166
  $('#' + id_base + '_form').remove();
165 167
  if (id)
166 168
    $('#text-block-' + id).show();
167
}
169
};
168 170

  
169
function ask_delete_text_block(key, opt) {
171
ns.ask_delete_text_block = function(key, opt) {
170 172
  if (confirm(kivi.t8("Are you sure?")))
171
    standard_text_block_ajax_call(key, opt);
173
    ns.standard_text_block_ajax_call(key, opt);
172 174
  return true;
173
}
175
};
174 176

  
175 177
// --------------------------------------------------------------------------------
176 178
// ------------------------------ sections and items ------------------------------
177 179
// --------------------------------------------------------------------------------
178 180

  
179
function find_item_id(clicked_elt) {
181
ns.find_item_id = function(clicked_elt) {
180 182
  // console.log("clicked id: " + $(clicked_elt).attr('id'));
181 183
  var id     = $(clicked_elt).attr('id');
182 184
  var result = /^(function-block|function-block-content|sub-function-block|sub-function-block-content|section|section-header)-(\d+)$/.exec(id);
......
193 195

  
194 196
  // console.log("find_item_id: case undef");
195 197
  return undefined;
196
}
198
};
197 199

  
198
function standard_item_ajax_call(key, opt, other_data) {
200
ns.standard_item_ajax_call = function(key, opt, other_data) {
199 201
  var data = {
200 202
    action:               "RequirementSpecItem/ajax_" + key,
201 203
    requirement_spec_id:  $('#requirement_spec_id').val(),
202
    id:                   find_item_id(opt.$trigger),
204
    id:                   ns.find_item_id(opt.$trigger),
203 205
    current_content_type: $('#current_content_type').val(),
204 206
    current_content_id:   $('#current_content_id').val()
205 207
  };
......
209 211
  $.post("controller.pl", $.extend(data, other_data || {}), eval_json_result);
210 212

  
211 213
  return true;
212
}
214
};
213 215

  
214
function disable_edit_item_commands(key, opt) {
215
  return find_item_id(opt.$trigger) == undefined;
216
}
216
ns.disable_edit_item_commands = function(key, opt) {
217
  return ns.find_item_id(opt.$trigger) == undefined;
218
};
217 219

  
218
function disable_add_function_block_command(key, opt) {
219
  if (find_item_id(opt.$trigger))
220
ns.disable_add_function_block_command = function(key, opt) {
221
  if (ns.find_item_id(opt.$trigger))
220 222
    return false;
221 223
  return opt.$trigger.attr('id') != "section-list-empty";
222
}
224
};
223 225

  
224
function cancel_edit_item_form(form_id_base, options) {
226
ns.cancel_edit_item_form = function(form_id_base, options) {
225 227
  $('#' + form_id_base + '_form').remove();
226 228
  if (!options)
227 229
    return;
......
229 231
    $(options.to_show).show();
230 232
  if (options.to_hide_if_empty && (1 == $(options.to_hide_if_empty).children().size()))
231 233
    $(options.to_hide_if_empty).hide();
232
}
234
};
233 235

  
234
function ask_delete_item(key, opt) {
236
ns.ask_delete_item = function(key, opt) {
235 237
  if (confirm(kivi.t8("Are you sure?")))
236
    standard_item_ajax_call(key, opt);
238
    ns.standard_item_ajax_call(key, opt);
237 239
  return true;
238
}
240
};
239 241

  
240
function handle_text_block_popup_menu_markings(opt, add) {
241
  var id = find_text_block_id(opt.$trigger);
242
ns.handle_text_block_popup_menu_markings = function(opt, add) {
243
  var id = ns.find_text_block_id(opt.$trigger);
242 244
  if (id)
243 245
    $('#text-block-' + id).toggleClass('selected', add);
244 246
  return true;
245
}
247
};
246 248

  
247
function requirement_spec_text_block_popup_menu_shown(opt) {
248
  return handle_text_block_popup_menu_markings(opt, true);
249
}
249
ns.text_block_popup_menu_shown = function(opt) {
250
  return ns.handle_text_block_popup_menu_markings(opt, true);
251
};
250 252

  
251
function requirement_spec_text_block_popup_menu_hidden(opt) {
252
  return handle_text_block_popup_menu_markings(opt, false);
253
}
253
ns.text_block_popup_menu_hidden = function(opt) {
254
  return ns.handle_text_block_popup_menu_markings(opt, false);
255
};
254 256

  
255
function handle_item_popup_menu_markings(opt, add) {
256
  var id = find_item_id(opt.$trigger);
257
ns.handle_item_popup_menu_markings = function(opt, add) {
258
  var id = ns.find_item_id(opt.$trigger);
257 259
  if (id)
258 260
    $('#section-' + id + ',#function-block-' + id + ',#sub-function-block-' + id).toggleClass('selected', add);
259 261
  return true;
260
}
262
};
261 263

  
262
function requirement_spec_item_popup_menu_shown(opt) {
263
  return handle_item_popup_menu_markings(opt, true);
264
}
264
ns.item_popup_menu_shown = function(opt) {
265
  return ns.handle_item_popup_menu_markings(opt, true);
266
};
265 267

  
266
function requirement_spec_item_popup_menu_hidden(opt) {
267
  return handle_item_popup_menu_markings(opt, false);
268
}
268
ns.item_popup_menu_hidden = function(opt) {
269
  return ns.handle_item_popup_menu_markings(opt, false);
270
};
269 271

  
270 272
// -------------------------------------------------------------------------
271 273
// -------------------------- time/cost estimate ---------------------------
272 274
// -------------------------------------------------------------------------
273 275

  
274
function standard_time_cost_estimate_ajax_call(key, opt) {
276
ns.standard_time_cost_estimate_ajax_call = function(key, opt) {
275 277
  if ((key == 'cancel') && !confirm(kivi.t8('Do you really want to cancel?')))
276 278
    return true;
277 279

  
......
287 289
  $.post("controller.pl", data, eval_json_result);
288 290

  
289 291
  return true;
290
}
292
};
291 293

  
292 294
// -------------------------------------------------------------------------
293 295
// ---------------------------- general actions ----------------------------
294 296
// -------------------------------------------------------------------------
295 297

  
296
function create_reqspec_pdf(key, opt) {
298
ns.create_reqspec_pdf = function(key, opt) {
297 299
  var data = {
298 300
    action: "RequirementSpec/create_pdf",
299 301
    id:     $('#requirement_spec_id').val()
300 302
  };
301 303
  $.download("controller.pl", data);
302
}
304
};
303 305

  
304
function copy_reqspec(key, opt) {
306
ns.copy_reqspec = function(key, opt) {
305 307
  window.location.href = "controller.pl?action=RequirementSpec/new&copy_source_id=" + encodeURIComponent($('#requirement_spec_id').val());
306 308
  return true;
307
}
309
};
308 310

  
309
function delete_reqspec(key, opt) {
311
ns.delete_reqspec = function(key, opt) {
310 312
  if (confirm(kivi.t8("Are you sure?")))
311 313
    window.location.href = "controller.pl?action=RequirementSpec/destroy&id=" + encodeURIComponent($('#requirement_spec_id').val());
312 314
  return true;
313
}
315
};
314 316

  
315
function disable_requirement_spec_commands(key, opt) {
317
ns.disable_commands = function(key, opt) {
316 318
  if (key === "create_version")
317 319
    return ($('#current_version_id').val() || '') == '' ? false : true;
318 320
  return false;
319
}
321
};
320 322

  
321 323
// -------------------------------------------------------------------------
322 324
// -------------------------------- versions -------------------------------
323 325
// -------------------------------------------------------------------------
324 326

  
325
function find_versioned_copy_id(clicked_elt) {
327
ns.find_versioned_copy_id = function(clicked_elt) {
326 328
  var id = $(clicked_elt).find("[name=versioned_copy_id]");
327 329
  return id ? id.val() : undefined;
328
}
330
};
329 331

  
330
function disable_versioned_copy_item_commands(key, opt) {
332
ns.disable_versioned_copy_item_commands = function(key, opt) {
331 333
  if (key === "revert_to_version")
332
    return !find_versioned_copy_id(opt.$trigger);
334
    return !ns.find_versioned_copy_id(opt.$trigger);
333 335
  return false;
334
}
336
};
335 337

  
336
function create_requirement_spec_version() {
338
ns.create_version = function() {
337 339
  open_jqm_window({ url:  'controller.pl',
338 340
                    data: { action:              'RequirementSpecVersion/new',
339 341
                            requirement_spec_id: $('#requirement_spec_id').val() },
340 342
                    id:   'new_requirement_spec_version_window' });
341 343
  return true;
342
}
344
};
343 345

  
344
function create_pdf_for_versioned_copy_ajax_call(key, opt) {
346
ns.create_pdf_for_versioned_copy_ajax_call = function(key, opt) {
345 347
  var data = {
346 348
    action: "RequirementSpec/create_pdf",
347
    id:     find_versioned_copy_id(opt.$trigger)
349
    id:     ns.find_versioned_copy_id(opt.$trigger)
348 350
  };
349 351
  $.download("controller.pl", data);
350 352

  
351 353
  return true;
352
}
354
};
353 355

  
354
function revert_to_versioned_copy_ajax_call(key, opt) {
356
ns.revert_to_versioned_copy_ajax_call = function(key, opt) {
355 357
  if (!confirm(kivi.t8('Do you really want to revert to this version?')))
356 358
    return true;
357 359

  
358 360
  var data = {
359 361
    action:            'RequirementSpec/revert_to',
360
    versioned_copy_id: find_versioned_copy_id(opt.$trigger),
362
    versioned_copy_id: ns.find_versioned_copy_id(opt.$trigger),
361 363
    id:                $('#requirement_spec_id').val()
362 364
  };
363 365

  
364 366
  $.post("controller.pl", data, eval_json_result);
365 367

  
366 368
  return true;
367
}
369
};
368 370

  
369 371
// -------------------------------------------------------------------------
370 372
// ----------------------------- context menus -----------------------------
371 373
// -------------------------------------------------------------------------
372 374

  
373
function create_requirement_spec_context_menus() {
375
ns.create_context_menus = function() {
374 376
  var general_actions = {
375 377
      sep98:           "---------"
376 378
    , general_actions: { name: kivi.t8('Requirement spec actions'), className: 'context-menu-heading' }
377 379
    // , sep99:           "---------"
378
    , create_pdf:      { name: kivi.t8('Create PDF'),              icon: "pdf",    callback: create_reqspec_pdf }
379
    , create_version:  { name: kivi.t8('Create new version'),      icon: "new",    callback: create_requirement_spec_version, disabled: disable_requirement_spec_commands }
380
    , copy_reqspec:    { name: kivi.t8('Copy requirement spec'),   icon: "copy",   callback: copy_reqspec   }
381
    , delete_reqspec:  { name: kivi.t8('Delete requirement spec'), icon: "delete", callback: delete_reqspec }
380
    , create_pdf:      { name: kivi.t8('Create PDF'),              icon: "pdf",    callback: kivi.requirement_spec.create_reqspec_pdf }
381
    , create_version:  { name: kivi.t8('Create new version'),      icon: "new",    callback: kivi.requirement_spec.create_version, disabled: kivi.requirement_spec.disable_commands }
382
    , copy_reqspec:    { name: kivi.t8('Copy requirement spec'),   icon: "copy",   callback: kivi.requirement_spec.copy_reqspec   }
383
    , delete_reqspec:  { name: kivi.t8('Delete requirement spec'), icon: "delete", callback: kivi.requirement_spec.delete_reqspec }
382 384
  };
383 385

  
384 386
  $.contextMenu({
......
387 389
  });
388 390

  
389 391
  var events = {
390
    show: requirement_spec_text_block_popup_menu_shown,
391
    hide: requirement_spec_text_block_popup_menu_hidden
392
      show: kivi.requirement_spec.text_block_popup_menu_shown
393
    , hide: kivi.requirement_spec.text_block_popup_menu_hidden
392 394
  };
393 395

  
394 396
  $.contextMenu({
395 397
    selector: '.text-block-context-menu',
396 398
    events:   {
397
        show: requirement_spec_text_block_popup_menu_shown
398
      , hide: requirement_spec_text_block_popup_menu_hidden
399
        show: kivi.requirement_spec.text_block_popup_menu_shown
400
      , hide: kivi.requirement_spec.text_block_popup_menu_hidden
399 401
    },
400 402
    items:    $.extend({
401 403
        heading: { name: kivi.t8('Text block actions'),    className: 'context-menu-heading' }
402
      , add:     { name: kivi.t8('Add text block'),        icon: "add",    callback: standard_text_block_ajax_call }
403
      , edit:    { name: kivi.t8('Edit text block'),       icon: "edit",   callback: standard_text_block_ajax_call, disabled: disable_edit_text_block_commands }
404
      , delete:  { name: kivi.t8('Delete text block'),     icon: "delete", callback: ask_delete_text_block,         disabled: disable_edit_text_block_commands }
404
      , add:     { name: kivi.t8('Add text block'),        icon: "add",    callback: kivi.requirement_spec.standard_text_block_ajax_call }
405
      , edit:    { name: kivi.t8('Edit text block'),       icon: "edit",   callback: kivi.requirement_spec.standard_text_block_ajax_call, disabled: kivi.requirement_spec.disable_edit_text_block_commands }
406
      , delete:  { name: kivi.t8('Delete text block'),     icon: "delete", callback: kivi.requirement_spec.ask_delete_text_block,         disabled: kivi.requirement_spec.disable_edit_text_block_commands }
405 407
      , sep1:    "---------"
406
      , flag:    { name: kivi.t8('Toggle marker'),         icon: "flag",   callback: standard_text_block_ajax_call, disabled: disable_edit_text_block_commands }
408
      , flag:    { name: kivi.t8('Toggle marker'),         icon: "flag",   callback: kivi.requirement_spec.standard_text_block_ajax_call, disabled: kivi.requirement_spec.disable_edit_text_block_commands }
407 409
      , sep2:    "---------"
408
      , copy:    { name: kivi.t8('Copy'),                  icon: "copy",   callback: standard_text_block_ajax_call, disabled: disable_edit_text_block_commands }
409
      , paste:   { name: kivi.t8('Paste'),                 icon: "paste",  callback: standard_text_block_ajax_call  }
410
      , copy:    { name: kivi.t8('Copy'),                  icon: "copy",   callback: kivi.requirement_spec.standard_text_block_ajax_call, disabled: kivi.requirement_spec.disable_edit_text_block_commands }
411
      , paste:   { name: kivi.t8('Paste'),                 icon: "paste",  callback: kivi.requirement_spec.standard_text_block_ajax_call  }
410 412
    }, general_actions)
411 413
  });
412 414

  
413 415
  events = {
414
    show: requirement_spec_item_popup_menu_shown,
415
    hide: requirement_spec_item_popup_menu_hidden
416
      show: kivi.requirement_spec.item_popup_menu_shown
417
    , hide: kivi.requirement_spec.item_popup_menu_hidden
416 418
  };
417 419

  
418 420
  $.contextMenu({
......
420 422
    events:   events,
421 423
    items:    $.extend({
422 424
        heading:            { name: kivi.t8('Section/Function block actions'), className: 'context-menu-heading' }
423
      , add_section:        { name: kivi.t8('Add section'),        icon: "add",    callback: standard_item_ajax_call }
424
      , add_function_block: { name: kivi.t8('Add function block'), icon: "add",    callback: standard_item_ajax_call, disabled: disable_add_function_block_command }
425
      , add_section:        { name: kivi.t8('Add section'),        icon: "add",    callback: kivi.requirement_spec.standard_item_ajax_call }
426
      , add_function_block: { name: kivi.t8('Add function block'), icon: "add",    callback: kivi.requirement_spec.standard_item_ajax_call, disabled: kivi.requirement_spec.disable_add_function_block_command }
425 427
      , sep1:               "---------"
426
      , edit:               { name: kivi.t8('Edit'),               icon: "edit",   callback: standard_item_ajax_call, disabled: disable_edit_item_commands }
427
      , delete:             { name: kivi.t8('Delete'),             icon: "delete", callback: ask_delete_item,         disabled: disable_edit_item_commands }
428
      , edit:               { name: kivi.t8('Edit'),               icon: "edit",   callback: kivi.requirement_spec.standard_item_ajax_call, disabled: kivi.requirement_spec.disable_edit_item_commands }
429
      , delete:             { name: kivi.t8('Delete'),             icon: "delete", callback: kivi.requirement_spec.ask_delete_item,         disabled: kivi.requirement_spec.disable_edit_item_commands }
428 430
      , sep2:               "---------"
429
      , flag:               { name: kivi.t8('Toggle marker'),      icon: "flag",   callback: standard_item_ajax_call, disabled: disable_edit_item_commands }
431
      , flag:               { name: kivi.t8('Toggle marker'),      icon: "flag",   callback: kivi.requirement_spec.standard_item_ajax_call, disabled: kivi.requirement_spec.disable_edit_item_commands }
430 432
      , sep3:               "---------"
431
      , copy:               { name: kivi.t8('Copy'),               icon: "copy",   callback: standard_item_ajax_call, disabled: disable_edit_item_commands }
432
      , paste:              { name: kivi.t8('Paste'),              icon: "paste",  callback: standard_item_ajax_call }
433
      , copy:               { name: kivi.t8('Copy'),               icon: "copy",   callback: kivi.requirement_spec.standard_item_ajax_call, disabled: kivi.requirement_spec.disable_edit_item_commands }
434
      , paste:              { name: kivi.t8('Paste'),              icon: "paste",  callback: kivi.requirement_spec.standard_item_ajax_call }
433 435
    }, general_actions)
434 436
  });
435 437

  
......
438 440
    events:   events,
439 441
    items:    $.extend({
440 442
        heading:                { name: kivi.t8('Function block actions'), className: 'context-menu-heading' }
441
      , add_function_block:     { name: kivi.t8('Add function block'),     icon: "add",    callback: standard_item_ajax_call }
442
      , add_sub_function_block: { name: kivi.t8('Add sub function block'), icon: "add",    callback: standard_item_ajax_call }
443
      , add_function_block:     { name: kivi.t8('Add function block'),     icon: "add",    callback: kivi.requirement_spec.standard_item_ajax_call }
444
      , add_sub_function_block: { name: kivi.t8('Add sub function block'), icon: "add",    callback: kivi.requirement_spec.standard_item_ajax_call }
443 445
      , sep1:                   "---------"
444
      , edit:                   { name: kivi.t8('Edit'),                   icon: "edit",   callback: standard_item_ajax_call, disabled: disable_edit_item_commands }
445
      , delete:                 { name: kivi.t8('Delete'),                 icon: "delete", callback: ask_delete_item,         disabled: disable_edit_item_commands }
446
      , edit:                   { name: kivi.t8('Edit'),                   icon: "edit",   callback: kivi.requirement_spec.standard_item_ajax_call, disabled: kivi.requirement_spec.disable_edit_item_commands }
447
      , delete:                 { name: kivi.t8('Delete'),                 icon: "delete", callback: kivi.requirement_spec.ask_delete_item,         disabled: kivi.requirement_spec.disable_edit_item_commands }
446 448
      , sep2:                   "---------"
447
      , flag:                   { name: kivi.t8('Toggle marker'),          icon: "flag",   callback: standard_item_ajax_call, disabled: disable_edit_item_commands }
449
      , flag:                   { name: kivi.t8('Toggle marker'),          icon: "flag",   callback: kivi.requirement_spec.standard_item_ajax_call, disabled: kivi.requirement_spec.disable_edit_item_commands }
448 450
      , sep3:                   "---------"
449
      , copy:                   { name: kivi.t8('Copy'),                   icon: "copy",   callback: standard_item_ajax_call, disabled: disable_edit_item_commands }
450
      , paste:                  { name: kivi.t8('Paste'),                  icon: "paste",  callback: standard_item_ajax_call }
451
      , copy:                   { name: kivi.t8('Copy'),                   icon: "copy",   callback: kivi.requirement_spec.standard_item_ajax_call, disabled: kivi.requirement_spec.disable_edit_item_commands }
452
      , paste:                  { name: kivi.t8('Paste'),                  icon: "paste",  callback: kivi.requirement_spec.standard_item_ajax_call }
451 453
    }, general_actions)
452 454
  });
453 455

  
......
455 457
    selector: '.time-cost-estimate-context-menu',
456 458
    items:    $.extend({
457 459
        heading: { name: kivi.t8('Time/cost estimate actions'), className: 'context-menu-heading' }
458
      , edit:    { name: kivi.t8('Edit'), icon: "edit", callback: standard_time_cost_estimate_ajax_call }
460
      , edit:    { name: kivi.t8('Edit'), icon: "edit", callback: kivi.requirement_spec.standard_time_cost_estimate_ajax_call }
459 461
    }, general_actions)
460 462
  });
461 463

  
......
463 465
    selector: '.edit-time-cost-estimate-context-menu',
464 466
    items:    $.extend({
465 467
        heading: { name: kivi.t8('Time/cost estimate actions'), className: 'context-menu-heading' }
466
      , save:    { name: kivi.t8('Save'),   icon: "save",  callback: standard_time_cost_estimate_ajax_call }
467
      , cancel:  { name: kivi.t8('Cancel'), icon: "close", callback: standard_time_cost_estimate_ajax_call }
468
      , save:    { name: kivi.t8('Save'),   icon: "save",  callback: kivi.requirement_spec.standard_time_cost_estimate_ajax_call }
469
      , cancel:  { name: kivi.t8('Cancel'), icon: "close", callback: kivi.requirement_spec.standard_time_cost_estimate_ajax_call }
468 470
    }, general_actions)
469 471
  });
470 472

  
......
472 474
    selector: '.versioned-copy-context-menu',
473 475
    items:    $.extend({
474 476
        heading:            { name: kivi.t8('Version actions'), className: 'context-menu-heading' }
475
      , create_version_pdf: { name: kivi.t8('Create PDF'),        icon: "pdf",    callback: create_pdf_for_versioned_copy_ajax_call                                                }
476
      , revert_to_version:  { name: kivi.t8('Revert to version'), icon: "revert", callback: revert_to_versioned_copy_ajax_call,     disabled: disable_versioned_copy_item_commands }
477
      , create_version_pdf: { name: kivi.t8('Create PDF'),        icon: "pdf",    callback: kivi.requirement_spec.create_pdf_for_versioned_copy_ajax_call                                                                      }
478
      , revert_to_version:  { name: kivi.t8('Revert to version'), icon: "revert", callback: kivi.requirement_spec.revert_to_versioned_copy_ajax_call,     disabled: kivi.requirement_spec.disable_versioned_copy_item_commands }
477 479
    }, general_actions)
478 480
  });
479
}
481
};
482

  
483
});                             // end of namespace(...., function() {...
templates/webpages/requirement_spec/_form.html
24 24
  <tr>
25 25
   <td>[% LxERP.t8("Customer") %]</td>
26 26
   <td>[% L.select_tag("requirement_spec.customer_id",  SELF.customers, default=SELF.requirement_spec.customer_id, title_key="name", id=id_prefix _ '_customer_id',
27
                       onchange="basic_settings_customer_changed('#" _ id_prefix _ "_customer_id', '#" _ id_prefix _ "_hourly_rate_as_number')") %]</td>
27
                       onchange="kivi.requirement_spec.basic_settings_customer_changed('#" _ id_prefix _ "_customer_id', '#" _ id_prefix _ "_hourly_rate_as_number')") %]</td>
28 28
  </tr>
29 29

  
30 30
  <tr>
templates/webpages/requirement_spec/show.html
87 87
    },
88 88
    crrm: {
89 89
      move: {
90
        check_move: requirement_spec_tree_check_move,
90
        check_move: kivi.requirement_spec.tree_check_move,
91 91
        open_move:  true
92 92
      }
93 93
    },
......
96 96
    },
97 97
    plugins: [ "themes", "json_data", "ui", "crrm", "dnd" ]
98 98
  })
99
  .bind("move_node.jstree", requirement_spec_tree_node_moved)
100
  .bind("click.jstree",     requirement_spec_tree_node_clicked);
99
  .bind("move_node.jstree", kivi.requirement_spec.tree_node_moved)
100
  .bind("click.jstree",     kivi.requirement_spec.tree_node_clicked);
101 101
[% IF SELF.requirement_spec_item %]
102 102
  $.jstree._reference("#tree").select_node('#fb-[% SELF.requirement_spec_item.id %]', true);
103 103
[% END %]
104 104

  
105
  create_requirement_spec_context_menus();
105
  kivi.requirement_spec.create_context_menus();
106 106
});
107 107

  
108 108
  -->
templates/webpages/requirement_spec_item/_function_block_form.html
51 51

  
52 52
 <p>
53 53
  [% L.ajax_submit_tag('controller.pl?action=RequirementSpecItem/ajax_' _ (SELF.item.id ? 'update' : 'create'), '#' _ id_base _ '_form', LxERP.t8('Save')) %]
54
  <a href="#" onclick="cancel_edit_item_form('[% id_base %]', { [% a_options %] })">[%- LxERP.t8("Cancel") %]</a>
54
  <a href="#" onclick="kivi.requirement_spec.cancel_edit_item_form('[% id_base %]', { [% a_options %] })">[%- LxERP.t8("Cancel") %]</a>
55 55
 </p>
56 56
</form>
templates/webpages/requirement_spec_item/_section_form.html
32 32

  
33 33
 <p>
34 34
  [% L.ajax_submit_tag('controller.pl?action=RequirementSpecItem/ajax_' _ (SELF.item.id ? 'update' : 'create'), '#' _ id_base _ '_form', LxERP.t8('Save')) %]
35
  <a href="#" onclick="cancel_edit_item_form('[% id_base %]', { to_show: '[% hidden %]' })">[%- LxERP.t8("Cancel") %]</a>
35
  <a href="#" onclick="kivi.requirement_spec.cancel_edit_item_form('[% id_base %]', { to_show: '[% hidden %]' })">[%- LxERP.t8("Cancel") %]</a>
36 36
 </p>
37 37
</form>
templates/webpages/requirement_spec_text_block/_form.html
42 42

  
43 43
 <p>
44 44
  [%- L.ajax_submit_tag('controller.pl?action=RequirementSpecTextBlock/ajax_' _ (SELF.text_block.id ? 'update' : 'create'), '#' _ id_base _ '_form', LxERP.t8('Save')) %]
45
  <a href="#" onclick="cancel_edit_text_block_form('[% id_base %]')">[%- LxERP.t8("Cancel") %]</a>
45
  <a href="#" onclick="kivi.requirement_spec.cancel_edit_text_block_form('[% id_base %]')">[%- LxERP.t8("Cancel") %]</a>
46 46
 </p>
47 47

  
48 48
[%- IF SELF.predefined_texts.size %]

Auch abrufbar als: Unified diff