Ignore:
Timestamp:
2011-12-07T15:59:23+13:00 (12 years ago)
Author:
sjb48
Message:

Added fix for CURRENT_SELECT problem.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/oran/js/gui_div.js

    r24442 r24869  
    8484    var prev_service = getSubstring(myurl, "&p.s", "&");
    8585
    86     var post_url = "http://localhost:8989/greenstone3/format?a=f&sa=saveDocument&c=" + collection_name + "&d=" + document_id + "&dt=" + document_type + "&p.a=" + prev_action + "&p.s=" + prev_service;
     86    var post_url = "http://localhost:8383/greenstone3/dev?a=f&sa=saveDocument&c=" + collection_name + "&d=" + document_id + "&dt=" + document_type + "&p.a=" + prev_action + "&p.s=" + prev_service;
    8787
    8888    // XML will be automatically wrapped in <display><format> tags when saved to collection config
     
    9696/* FUNCTIONS FOR FORMAT EDITING */                                                                   
    9797
     98// Ensures that a change to a text field is remembered
    9899function onTextChange(item, text)
    99100{
     
    102103}
    103104
     105// Ensures that a change to a select field is remembered
    104106function onSelectChange(item)
    105107{
     
    170172        classifier_name = getSubstring(myurl, "&cl", "&");
    171173
    172     var post_url = "http://localhost:8989/greenstone3/format?a=f&sa=update&c=" + collection_name +"&s=" + service_name;
     174    var post_url = "http://localhost:8383/greenstone3/dev?a=f&sa=update&c=" + collection_name +"&s=" + service_name;
    173175
    174176    if(classifier_name != null)
     
    201203        classifier_name = getSubstring(myurl, "&cl", "&");
    202204
    203     var post_url = "http://localhost:8989/greenstone3/format?a=f&sa=save&c=" + collection_name +"&s=" + service_name;
     205    var post_url = "http://localhost:8383/greenstone3/dev?a=f&sa=save&c=" + collection_name +"&s=" + service_name;
    204206
    205207    if(classifier_name != null)
     
    222224    var prev_service = getSubstring(myurl, "&p.s", "&");
    223225
    224     var post_url = "http://localhost:8989/greenstone3/format?a=d&c=" + collection_name + "&d=" + document_id + "&dt=" + document_type + "&p.a=" + prev_action + "&p.s=" + prev_service + "&o=skinandlib";
     226    var post_url = "http://localhost:8383/greenstone3/dev?a=d&c=" + collection_name + "&d=" + document_id + "&dt=" + document_type + "&p.a=" + prev_action + "&p.s=" + prev_service + "&o=skinandlib";
    225227
    226228    $.post(post_url, {data: classname}, function(data) {
     
    365367    console.log("Document ready function\n");
    366368   
    367     var CURRENT_SELECT_VALUE = "";
     369    CURRENT_SELECT_VALUE = ""; //global - gets set by ui.draggable
    368370
    369371    /* DOCUMENT SPECIFIC FUNCTIONS */
     
    425427        }
    426428    });
     429
     430    $.ui.draggable.prototype._createHelper = function(event) {
     431
     432                var o = this.options;
     433                var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element);
     434
     435        var select = $(this.element).find('select');
     436        var value = select.attr('value');
     437        console.log("Found "+value+" in helper");
     438        CURRENT_SELECT_VALUE = value;
     439        helper.find('select').attr('value', value);
     440
     441                if(!helper.parents('body').length)
     442                        helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
     443
     444                if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
     445                        helper.css("position", "absolute");
     446
     447                return helper;
     448
     449        };
    427450   
    428451    $.ui.sortable.prototype._removeCurrentsFromItems = function() {
     
    974997    {
    975998    // If select exists, then find CURRENT_SELECT_VALUE
    976         var index = me.search(CURRENT_SELECT_VALUE);
    977         if(index == -1)
    978             console.log("Did not find " + CURRENT_SELECT_VALUE);
    979         else
    980             console.log("Found " + CURRENT_SELECT_VALUE + " at index " + index);   
    981             index = index + CURRENT_SELECT_VALUE.length + 1;
    982             console.log("Attempt inserting select at new index "+index);
    983             a = me.substring(0,index);
    984             b = me.substring(index);
    985             me = a.concat("selected",b);
     999    if(me.search(CURRENT_SELECT_VALUE) != -1)
     1000    {
     1001        var index = me.search(CURRENT_SELECT_VALUE);
     1002            if(index == -1)
     1003                console.log("Did not find " + CURRENT_SELECT_VALUE);
     1004            else
     1005        {
     1006                console.log("Found " + CURRENT_SELECT_VALUE + " at index " + index);   
     1007                index = index + CURRENT_SELECT_VALUE.length + 1;
     1008                console.log("Attempt inserting select at new index "+index);
     1009                a = me.substring(0,index);
     1010                b = me.substring(index);
     1011                me = a.concat("selected",b);
     1012            }
     1013    }
    9861014    }
    9871015
Note: See TracChangeset for help on using the changeset viewer.