+function handle_text_block_popup_menu_markings(opt, add) {
+ var id = find_text_block_id(opt.$trigger);
+ if (id)
+ $('#text-block-' + id).toggleClass('selected', add);
+ return true;
+}
+
+function requirement_spec_text_block_popup_menu_shown(opt) {
+ return handle_text_block_popup_menu_markings(opt, true);
+}
+
+function requirement_spec_text_block_popup_menu_hidden(opt) {
+ return handle_text_block_popup_menu_markings(opt, false);
+}
+
+
+function handle_item_popup_menu_markings(opt, add) {
+ var id = find_item_id(opt.$trigger);
+ if (id)
+ $('#section-' + id + ',#function-block-' + id + ',#sub-function-block-' + id).toggleClass('selected', add);
+ return true;
+}
+
+function requirement_spec_item_popup_menu_shown(opt) {
+ return handle_item_popup_menu_markings(opt, true);
+}
+
+function requirement_spec_item_popup_menu_hidden(opt) {
+ return handle_item_popup_menu_markings(opt, false);
+}
+
+// -------------------------------------------------------------------------
+// -------------------------- 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 -----------------------------
+// -------------------------------------------------------------------------
+