}, kivi.eval_json_result);
};
+ns.setup_tooltip_for_tree_node = function(li) {
+ $(li).find('a').prop('title', $(li).prop('title')).tooltip();
+ $(li).prop('title', '');
+};
+
+ns.tree_loaded = function(event) {
+ var id = $('#tree').data('initially_selected_node');
+ if (id)
+ $.jstree._reference("#tree").select_node(id, true);
+
+ $('#tree li[title!=""]').each(function(idx, elt) {
+ ns.setup_tooltip_for_tree_node(elt);
+ });
+};
+
+ns.tree_node_created = function(event, data) {
+ console.info("created ", data);
+ if (data && data.rslt && data.rslt.obj)
+ ns.setup_tooltip_for_tree_node(data.rslt.obj);
+};
+
+ns.initialize_requirement_spec = function(data) {
+ $('#tree').data('initially_selected_node', data.initially_selected_node);
+
+ $('#tree')
+ .bind('create_node.jstree', ns.tree_node_created)
+ .bind('move_node.jstree', ns.tree_node_moved)
+ .bind('click.jstree', ns.tree_node_clicked)
+ .bind('loaded.jstree', ns.tree_loaded)
+ .jstree({
+ core: {
+ animation: 0,
+ initially_open: data.initially_open,
+ },
+ json_data: {
+ data: data.tree_data
+ },
+ crrm: {
+ move: {
+ check_move: ns.tree_check_move,
+ open_move: true
+ }
+ },
+ themes: {
+ theme: "requirement-spec"
+ },
+ plugins: [ "themes", "json_data", "ui", "crrm", "dnd" ]
+ });
+
+ ns.create_context_menus(data.is_template);
+ $('#requirement_spec_tabs').on("tabsbeforeactivate", ns.tabs_before_activate);
+};
+
// -------------------------------------------------------------------------
// ------------------------------ text blocks ------------------------------
// -------------------------------------------------------------------------
return ns.handle_item_popup_menu_markings(opt, false);
};
-ns.submit_function_block = function(event) {
+ns.submit_function_block = function(event, shift_in_out) {
event.preventDefault();
var prefix = $(this).attr('id').match("^(?:edit|new)_function_block_[\\d_]+\\d")[0];
- kivi.submit_ajax_form('controller.pl?action=RequirementSpecItem/ajax_update', '#' + prefix + '_form');
+ var action = $('#' + prefix + '_id').val() ? 'update' : 'create';
+ kivi.submit_ajax_form('controller.pl?action=RequirementSpecItem/ajax_' + action, '#' + prefix + '_form', { shift_in_out: !!shift_in_out });
return false;
};
ns.init_function_block_keypress_events = function(form_id) {
$("#" + form_id + " INPUT[type=text]").bind("keypress", "return", ns.submit_function_block);
+
+ $('#' + form_id + ' INPUT[type=text],#' + form_id + ' TEXTAREA,#' + form_id + ' INPUT[type=button]')
+ .bind('keypress', 'shift+return', function(event) { return ns.submit_function_block.apply(this, [ event, true ]); });
};
// -------------------------------------------------------------------------
return true;
}
- var data = "action=RequirementSpec/ajax_" + key + "_time_and_cost_estimate&";
+ var add_data = '';
+ if (key == 'save_keep_open') {
+ key = 'save';
+ add_data = 'keep_open=1&';
+ }
+
+ var data = "action=RequirementSpec/ajax_" + key + "_time_and_cost_estimate&" + add_data;
if (key == 'save')
data += $('#edit_time_cost_estimate_form').serialize()
items: $.extend({
heading: { name: kivi.t8('Time/cost estimate actions'), className: 'context-menu-heading' }
, save: { name: kivi.t8('Save'), icon: "save", callback: kivi.requirement_spec.standard_time_cost_estimate_ajax_call }
+ , save_keep_open: { name: kivi.t8('Save and keep open'), icon: "save", callback: kivi.requirement_spec.standard_time_cost_estimate_ajax_call }
, cancel: { name: kivi.t8('Cancel'), icon: "close", callback: kivi.requirement_spec.standard_time_cost_estimate_ajax_call }
}, general_actions)
});