~openerp-dev/openobject-client-web/pop-up-reopen

« back to all changes in this revision

Viewing changes to addons/openerp/static/javascript/openerp/openerp.base.js

  • Committer: vda(Open ERP)
  • Date: 2010-12-07 04:55:35 UTC
  • Revision ID: vda@tinyerp.com-20101207045535-e6i729ow0hc9q5ba
[FIX] Issue of popup reopen when background view is empty.

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
function doLoadingSuccess(app) {
75
75
    return function (data, status, xhr) {
76
76
        var target = xhr.getResponseHeader('X-Target');
 
77
        var window_opener = xhr.getResponseHeader('window_opener');
77
78
        if(target) {
78
79
            var _openAction;
79
80
            if (window.top.openAction) {
81
82
            } else {
82
83
                _openAction = openAction;
83
84
            }
84
 
            _openAction(xhr.getResponseHeader('Location'), target);
 
85
            _openAction(xhr.getResponseHeader('Location'), target, window_opener);
85
86
            return;
86
87
        }
87
88
        jQuery(window).trigger('before-appcontent-change');
96
97
 * @param action_url the URL of the action to open
97
98
 * @param target the target, if any, defaults to 'current'
98
99
 */
99
 
function openAction(action_url, target) {
 
100
function openAction(action_url, target, window_opener) {
 
101
    window_opener = parseInt(window_opener) || 0;
100
102
    var $dialogs = jQuery('.action-dialog');
101
103
    switch(target) {
102
104
        case 'new':
 
105
            if(window_opener == 1) {
 
106
                if(jQuery('#appContent').length) {
 
107
                    jQuery('#appContent').append(
 
108
                        jQuery('<input>', {'type': 'hidden', 'id': 'window_opener'}).val(true)
 
109
                    );
 
110
                }
 
111
            }
103
112
            var $contentFrame = jQuery('<iframe>', {
104
113
                src: action_url,
105
114
                frameborder: 0,