Merge pull request #864 from Pita/develop

Merge bugfixes
pull/876/merge
John McLear 2012-07-10 07:59:05 -07:00
commit dae0cbfb53
3 changed files with 22 additions and 12 deletions

View File

@ -154,6 +154,13 @@ Example returns:
*/ */
exports.setText = function(padID, text, callback) exports.setText = function(padID, text, callback)
{ {
//text is required
if(typeof text != "string")
{
callback(new customError("text is no string","apierror"));
return;
}
//get the pad //get the pad
getPadSafe(padID, true, function(err, pad) getPadSafe(padID, true, function(err, pad)
{ {

View File

@ -3,6 +3,7 @@ var express = require('express');
var settings = require('../utils/Settings'); var settings = require('../utils/Settings');
var fs = require('fs'); var fs = require('fs');
var path = require('path'); var path = require('path');
var npm = require("npm/lib/npm.js");
var _ = require("underscore"); var _ = require("underscore");
var server; var server;

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>API Test and Examples Page</title> <title>API Test and Examples Page</title>
<script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/jquery.js"></script>
<style type="text/css"> <style type="text/css">
body { body {
font-size:9pt; font-size:9pt;
@ -65,23 +65,24 @@
callFunction(name, results_node, params); callFunction(name, results_node, params);
}); });
var template = $('#template')
$('.define').each(function() { $('.define').each(function() {
var functionName = parseName($(this).text()); var functionName = parseName($(this).text());
var parameters = parseParameters($(this).text()); var parameters = parseParameters($(this).text());
var $template = $('#template').clone(); var testGroup = template.clone();
$template.find('h2').text(functionName + "()"); testGroup.find('h2').text(functionName + "()");
var $table = $template.find('table'); var table = testGroup.find('table');
$(parameters).each(function(index, el) { $(parameters).each(function(index, el) {
$table.prepend('<tr><td>' + el + ':</td>' + table.prepend('<tr><td>' + el + ':</td>' +
'<td style="width:200px"><input type="text" size="10" name="' + el + '" /></td></tr>'); '<td style="width:200px"><input type="text" size="10" name="' + el + '" /></td></tr>');
}); });
$template.css({display: "block"}); testGroup.css({display: "block"});
$template.appendTo('body'); testGroup.appendTo('body');
}); });
}); });
@ -113,13 +114,12 @@
$('#result').text('Calling ' + memberName + "()..."); $('#result').text('Calling ' + memberName + "()...");
params["apikey"]=$("#apikey").val(); params["apikey"]=$("#apikey").val();
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: "/api/1/" + memberName, url: "/api/1/" + memberName,
data: params, data: params,
success: function(json) { success: function(json,status,xhr) {
results_node.text(json); results_node.text(xhr.responseText);
}, },
error: function(jqXHR, textStatus, errorThrown) { error: function(jqXHR, textStatus, errorThrown) {
results_node.html("textStatus: " + textStatus + "<br />errorThrown: " + errorThrown); results_node.html("textStatus: " + textStatus + "<br />errorThrown: " + errorThrown);
@ -137,7 +137,8 @@
<td class="buttonBox" colspan="2" style="text-align:right;"><input type="button" value="Run" /></td> <td class="buttonBox" colspan="2" style="text-align:right;"><input type="button" value="Run" /></td>
</tr> </tr>
</table> </table>
<div class="results"/> <div class="results"></div>
</div> </div>
<div class="define">createGroup()</div> <div class="define">createGroup()</div>
<div class="define">deleteGroup(groupID)</div> <div class="define">deleteGroup(groupID)</div>
@ -155,6 +156,7 @@
<div class="define">getText(padID,rev)</div> <div class="define">getText(padID,rev)</div>
<div class="define">setText(padID,text)</div> <div class="define">setText(padID,text)</div>
<div class="define">getRevisionsCount(padID)</div> <div class="define">getRevisionsCount(padID)</div>
<div class="define">getLastEdited(padID)</div>
<div class="define">deletePad(padID)</div> <div class="define">deletePad(padID)</div>
<div class="define">getReadOnlyID(padID)</div> <div class="define">getReadOnlyID(padID)</div>
<div class="define">setPublicStatus(padID,publicStatus)</div> <div class="define">setPublicStatus(padID,publicStatus)</div>