~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/media/common/util.js

  • Committer: mattgiuca
  • Date: 2008-06-23 11:38:50 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:788
fileservice_lib: Fixed and made consistent the error message if a file already
    exists, across all actions. (Previously 3 different messages).

Show diffs side-by-side

added added

removed removed

Lines of Context:
603
603
    }
604
604
}
605
605
 
606
 
/** Creates a random string of length length,
607
 
 * consisting of alphanumeric characters.
608
 
 */
609
 
var rand_chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ"
610
 
               + "abcdefghiklmnopqrstuvwxyz";
611
 
function random_string(length)
612
 
{
613
 
    var str = Array(length);
614
 
    var v;
615
 
    for (var i=0; i<length; i++)
616
 
    {
617
 
        v = Math.floor(Math.random() * rand_chars.length);
618
 
        str[i] = rand_chars.charAt(v);
619
 
    }
620
 
    return str.join('');
621
 
}
622
 
 
623
606
/** Makes an asynchronous XMLHttpRequest call to the server.
624
607
 * Sends the XMLHttpRequest object containing the completed response to a
625
608
 * specified callback function.
644
627
    /* A random string, for multipart/form-data
645
628
     * (This is not checked against anywhere else, it is solely defined and
646
629
     * used within this function) */
647
 
    var boundary = random_string(20);
 
630
    var boundary = "48234n334nu7n4n2ynonjn234t683jyh80j";
648
631
    var xhr = new_xmlhttprequest();
649
632
    xhr.onreadystatechange = function()
650
633
        {
670
653
        if (content_type == "multipart/form-data")
671
654
        {
672
655
            xhr.setRequestHeader("Content-Type",
673
 
                "multipart/form-data; boundary=" + boundary);
 
656
                "multipart/form-data, boundary=" + boundary);
674
657
            message = make_multipart_formdata(args, boundary);
675
658
        }
676
659
        else