Exemple #1
0
    edit_node: function(node_id){
        var self = this;
        var title = _t('Activity');
        var pop = new form_common.FormOpenPopup(self);

        pop.show_element(
                self.node,
                node_id,
                self.context || self.dataset.context,
                {
                    title: _t("Open: ") + title
                }
            );

        pop.on('write_completed', self, function() {
            self.dataset.read_index(_.keys(self.fields_view.fields)).then(self.on_diagram_loaded);
            });
        
        var form_fields = [self.parent_field];
        var form_controller = pop.view_form;

       form_controller.on("load_record", self, function(){
            _.each(form_fields, function(fld) {
                if (!(fld in form_controller.fields)) { return; }
                var field = form_controller.fields[fld];
                field.$input.prop('disabled', true);
                field.$drop_down.unbind();
            });
         });

       
    },
Exemple #2
0
 on_task_display: function(task) {
     var self = this;
     var pop = new form_common.FormOpenPopup(self);
     pop.on('write_completed',self,self.reload);
     pop.show_element(
         self.dataset.model,
         task.id,
         null,
         {}
     );
 },
Exemple #3
0
 edit_connector: function(connector_id){
     var self = this;
     var title = _t('Transition');
     var pop = new form_common.FormOpenPopup(self);
     pop.show_element(
         self.connector,
         parseInt(connector_id,10),      //FIXME Isn't connector_id supposed to be an int ?
         self.context || self.dataset.context,
         {
             title: _t("Open: ") + title
         }
     );
     pop.on('write_completed', self, function() {
         self.dataset.read_index(_.keys(self.fields_view.fields)).then(self.on_diagram_loaded);
     });
 },
Exemple #4
0
    open_event: function(id, title) {
        var self = this;
        if (! this.open_popup_action) {
            var index = this.dataset.get_id_index(id);
            this.dataset.index = index;
            if (this.write_right) {
                this.do_switch_view('form', null, { mode: "edit" });
            } else {
                this.do_switch_view('form', null, { mode: "view" });
            }
        }
        else {
            var pop = new form_common.FormOpenPopup(this);
            var id_cast = parseInt(id).toString() == id ? parseInt(id) : id;
            pop.show_element(this.dataset.model, id_cast, this.dataset.get_context(), {
                title: _.str.sprintf(_t("View: %s"),title),
                view_id: +this.open_popup_action,
                res_id: id_cast,
                target: 'new',
                readonly:true
            });

           var form_controller = pop.view_form;
           form_controller.on("load_record", self, function(){
                var button_delete = _.str.sprintf("<button class='oe_button oe_bold delme'><span> %s </span></button>",_t("Delete"));
                var button_edit = _.str.sprintf("<button class='oe_button oe_bold editme oe_highlight'><span> %s </span></button>",_t("Edit Event"));
                
                pop.$el.closest(".modal").find(".modal-footer").prepend(button_delete);
                pop.$el.closest(".modal").find(".modal-footer").prepend(button_edit);
                
                $('.delme').click(
                    function() {
                        $('.oe_form_button_cancel').trigger('click');
                        self.remove_event(id);
                    }
                );
                $('.editme').click(
                    function() {
                        $('.oe_form_button_cancel').trigger('click');
                        self.dataset.index = self.dataset.get_id_index(id);
                        self.do_switch_view('form', null, { mode: "edit" });
                    }
                );
           });
        }
        return false;
    },