Changeset 371


Ignore:
Timestamp:
Apr 22, 2010, 11:13:12 AM (14 years ago)
Author:
duh
Message:
  • fixed a bug with variable scope
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/web-app/js/SelectAddMore.js

    r365 r371  
    6666
    6767        // find all matching select elements
    68         $("select[rel*='" + this.options.rel + "']").each(function() {
     68        $("select[rel*='" + that.options.rel + "']").each(function() {
    6969            // add the magic option
    70             that.addTermEditorOption(this);
     70            that.addOpenDialogOption(this);
    7171        });
    7272    },
     
    7575     * extend the select element
    7676     */
    77     addTermEditorOption: function(element) {
    78         var that = this;
    79         var e = $(element);
    80         var s = e.children().size();
     77    addOpenDialogOption: function(element) {
     78        var that    = this;
     79        var e       = $(element);
     80        var s       = e.children().size();
     81        var class   = that.options.class;
     82        var label   = that.options.label;
     83        var vars    = that.options.vars;
     84        var url     = that.options.url;
     85        var width   = that.options.width;
     86        var height  = that.options.height;
     87        var onClose = that.options.onClose;
    8188
    8289        // add a magic option to the end of the select element
    83         e.append('<option value="" class="' + this.options.class + '">' + this.options.label + '</option>');
     90        e.append('<option value="" class="' + class + '">' + label + '</option>');
    8491
    8592        // and bind and onChange event
     
    9198                // the dialog integrate with the application!
    9299                // @see http://www.w3schools.com/html5/tag_iframe.asp
    93                 $('<iframe src="' + that.options.url + '?' + that.options.vars + '=' + e.attr(that.options.vars) + '" sanbox="allow-same-origin" seamless />').dialog({
    94                     title: that.options.label,
     100                $('<iframe src="' + url + '?' + vars + '=' + e.attr(vars) + '" sanbox="allow-same-origin" seamless />').dialog({
     101                    title   : label,
    95102                    autoOpen: true,
    96                     width: that.options.width,
    97                     height: that.options.height,
    98                     modal: true,
    99                     close: function() {
    100                         that.options.onClose(this);
     103                    width   : width,
     104                    height  : height,
     105                    modal   : true,
     106                    close   : function() {
     107                        onClose(this);
    101108                    }
    102                 }).width(that.options.width - 10).height(that.options.height)
     109                }).width(width - 10).height(height)
    103110            }
    104111        })
Note: See TracChangeset for help on using the changeset viewer.