+// -------------------------------------------------------------------------
+// -------------------------- time/cost estimate ---------------------------
+// -------------------------------------------------------------------------
+
+function standard_time_cost_estimate_ajax_call(key, opt) {
+ if ((key == 'cancel') && !confirm(kivi.t8('Do you really want to cancel?')))
+ return true;
+
+ var data = "action=RequirementSpec/ajax_" + key + "_time_and_cost_estimate&";
+
+ if (key == 'save')
+ data += $('#edit_time_cost_estimate_form').serialize()
+ + '&' + $('#current_content_type').serialize()
+ + '&' + $('#current_content_id').serialize();
+ else
+ data += 'id=' + encodeURIComponent($('#requirement_spec_id').val());
+
+ $.post("controller.pl", data, eval_json_result);
+
+ return true;
+}
+
+// -------------------------------------------------------------------------
+// ---------------------------- general actions ----------------------------
+// -------------------------------------------------------------------------
+
+function download_reqspec_pdf(key, opt) {
+ var data = {
+ action: "RequirementSpec/download_pdf",
+ id: $('#requirement_spec_id').val()
+ };
+ $.download("controller.pl", data);
+}
+
+function copy_reqspec(key, opt) {
+ window.location.href = "controller.pl?action=RequirementSpec/new©_source_id=" + encodeURIComponent($('#requirement_spec_id').val());
+ return true;
+}
+
+function delete_reqspec(key, opt) {
+ if (confirm(kivi.t8("Are you sure?")))
+ window.location.href = "controller.pl?action=RequirementSpec/destroy&id=" + encodeURIComponent($('#requirement_spec_id').val());
+ return true;
+}
+
+function disable_requirement_spec_commands(key, opt) {
+ if (key === "create_version")
+ return ($('#current_version_id').val() || '') == '' ? false : true;
+ return false;
+}
+
+// -------------------------------------------------------------------------
+// -------------------------------- versions -------------------------------
+// -------------------------------------------------------------------------
+
+function create_requirement_spec_version() {
+ open_jqm_window({ url: 'controller.pl',
+ data: { action: 'RequirementSpecVersion/new',
+ requirement_spec_id: $('#requirement_spec_id').val() },
+ id: 'new_requirement_spec_version_window' });
+ return true;
+}
+
+// -------------------------------------------------------------------------
+// ----------------------------- context menus -----------------------------
+// -------------------------------------------------------------------------
+