Hi again,

Here is some source to go with my question:

this is the website in question:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html>
  <head>
    <script type='application/javascript' src="js/CalendarPopup.js"></script>
    <script type='application/javascript'
src="js/CalendarSettings.jsp"></script>
    <script src="js/MochiKit/MochiKit.js"
type="application/javascript"></script>
    <script src="js/prototype1.5.0_rc0/prototype.js"
type="application/javascript"></script>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="Content-Style-Type" content="text/css">

    <link rel="stylesheet" href="css/internaldocument.css" type="text/css">
    <link rel="stylesheet" href="css/stilvorlagen.css" type="text/css">

    <title>Auftragslist</title>

    <script type='application/javascript' src="js/test.js"></script>
    <script>
    function get_included(form)
    {
        var is_included = function (value, index) {
            return value.getAttribute('k_included') == 'true' ? true : false
        }
        var of_value = function (value, index) {
            type = value.getAttribute('k_type')
            return [value.id, value.value, type]
        }
        var to_param = function (value, index) {
            return { field: value[0],
                    value: value[1],
                    type: value[2] }
        }
        var append = function (a, b) {
            return a + "&" + b
        }
        elems = Form.getElements(form)
        var fields = elems.select(is_included).map(of_value).map(to_param)
        return fields
    }
    get_table = function(event)
    {
        var params = get_included('search_form');
        engine = new Kombucha.Engine();
        engine.update('auftragslist', params);
        event.stop()
    }
    </script>
  </head>
  <body>
    <div id='headline'>
        <p class="headlinewhite" >Auftragslist </p>
    </div>
    <div id='breadcrumbs'></div>
    <div id="search">
        <form id="search_form" action="javascript:function(){}()">
            <table id='search_table' class='search' cellpadding="3"
cellspacing="0">
                <tr>
                  <td class="searchtableentry">K-Nummer</td>
                  <td class="searchtableentry">
                    <input type="text" id="KUNNR" k_included='true'
k_type='Kunde' maxlength="10" tabindex="1" />
                  </td>
                  <td class="tableentry">
                    &nbsp; &nbsp; &nbsp;
                    <button type="submit" id="submit" value="Submit"
tabindex="6">Submit</button>
                  </td>
                </tr>
                <tr>
                  <td class="searchtableentry">Kommision</td>
                  <td class="searchtableentry">
                    <input type="text" k_included='true'
k_type='Kommision' id="EQUIP" tabindex="2" />
                  </td>
                </tr>
                <tr>
                  <td class="tableentry">&nbsp;</td>
                  <td class="tableentry">&nbsp;</td>
                  <td class="tableentry">&nbsp;</td>
                </tr>
                <tr>
                  <td class="searchtableentry">
                    Date from
                  </td>
                  <td class="searchtableentry">
                    <input type="text" k_included='true' id="ERDATLOW"
k_type='Date' tabindex="3">
                    <a href="#" title="Datum auswaehlen"

onClick="javascript:cal.select($('ERDATLOW'),'anchor1','dd.MM.yyyy')"
                       id="anchor1"><img src="img/cal.gif" width="14"
height="14" border="0"></a>
                  </td>
                </tr>
                <tr>
                  <td class="searchtableentry">
                    to
                  </td>
                  <td class="searchtableentry">
                    <input type="text" k_included="true"
id="ERDATHIGH" k_type='Date' tabindex="4">
                    <a href="#" title="Datum auswaehlen"

onClick="javascript:cal.select($('ERDATHIGH'),'anchor2','dd.MM.yyyy')"
                       id="anchor2"><img src="img/cal.gif" width="14"
height="14" border="0"></a>
                  </td>
                </tr>
                <tr>
                    <td class='searchtableentry'>Lang: </td>
                    <td class="searchtableentry">
                        <select k_included='true' id='LANGU'
k_type='Lang' tabindex='5'>
                            <option value="D" selected="true">Deutsch</option>
                            <option value="E" >English</option>
                            <option value="N" >Nederlands</option>
                            <option value="S" >Espanol</option>
                            <option value="P" >Portugues</option>
                        </select>
                    </td>
                </tr>
            </table>
        </form>
        <script>
        MochiKit.Signal.connect('search_form', 'onsubmit', get_table);
        </script>
      </div>
      <div id='results'></div>
  </body>
</html>

this is test.js:
if (navigator.appName == "Microsoft Internet Explorer") {
    console = function () {
        this.bugger = 1;
        this.info = function(){}
        this.debug = function(){}
        this.warn = function(){}
        this.error = function(){}
    };
}

var info = console.info;
var debug = console.debug;
var warn = console.warn;
var error = console.error;

if (typeof(dojo) != 'undefined') {
    dojo.provide("Kombucha.Engine");
    dojo.require("MochiKit.Base");
    dojo.require("MochiKit.Async");
}
if (typeof(JSAN) != 'undefined') {
    JSAN.use("MochiKit.Base", []);
    JSAN.use("MochiKit.Async", []);
}

try {
    if (typeof(MochiKit.Base) == 'undefined') {
        throw "";
    }
} catch (e) {
    throw "Kombucha.Engine depends on MochiKit.Base!";
}

try {
    if (typeof(MochiKit.Async) == 'undefined') {
        throw "";
    }
} catch (e) {
    throw "Kombucha.Engine depends on MochiKit.Async!";
}
if (typeof(Kombucha) == 'undefined') {
    Kombucha = {};
}

Kombucha.NAME = "Kombucha.Engine";
Kombucha.VERSION = "PR1";
Kombucha.__repr__ = function () {
    return "[" + this.NAME + " " + this.VERSION + "]";
};

Kombucha.toString = function () {
    return this.__repr__();
};

Kombucha.Engine = function() {
    this.runningTasks = [];
}
Kombucha.Engine.prototype = {
    addDeferred: function(deferred) {
        this.runningTasks[deferred.id] = deferred;
    },
    update: function(url, params) {
        d = MochiKit.Async.loadPostJSONDoc(url, params);
        this.addDeferred(d);
        d.addCallback(this.refresh.bind(this));
    },
    refresh: function(doc) {
        doc.each(this.refresh_field);
    },
    refresh_field: function(field, index) {
        Element.update(field.name, field.html);
    }
};


I've also made a few small changes to MochiKit.Async, here are the new
functions:

    doSimplePostXMLHttpRequest: function (url/*, ...*/) {
        var self = MochiKit.Async;
        var req = self.getXMLHttpRequest();
        if (arguments.length > 1) {
            var m = MochiKit.Base;
            var qs = m.queryString.apply(null, m.extend(null, arguments, 1));
        }
        req.open("POST", url, true);
        //taken from Prototype, pretty much verbatim
        var requestHeaders =
        ['X-Requested-With', 'XMLHttpRequest',
          'X-Ajax-Library', MochiKit.Async.VERSION,
          'Accept', 'text/javascript, text/html, application/xml,
text/xml, */*',
         'Content-type', 'application/x-www-form-urlencoded'];
        /* Force "Connection: close" for Mozilla browsers to work around
         * a bug where XMLHttpReqeuest sends an incorrect Content-length
         * header. See Mozilla Bugzilla #246651.
         */
        if (req.overrideMimeType) {
            requestHeaders.push('Connection', 'close');
        }
        for (var i = 0; i < requestHeaders.length; i += 2) {
            req.setRequestHeader(requestHeaders[i], requestHeaders[i+1]);
        }
        return self.sendXMLHttpRequest(req, qs);
    },
    loadPostJSONDoc: function(url, obj) {
        var self = MochiKit.Async;
        var d = MochiKit.Async.doJSONPostXMLHttpRequest.apply(self, arguments);
        d = d.addCallback(self.evalJSONRequest);
        return d;
    },

The calendar script is a script we use in an older program here, and I
will probably do some hacking to later.  If you need to test this page
out, just cut it out.

Thanks alot to anyone that can help.
Yaakov

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~----------~----~----~----~------~----~------~--~---

Reply via email to