Code Monkey home page Code Monkey logo

Comments (12)

atutor avatar atutor commented on June 30, 2024

It already does do direct input.

from achecker.

BarisW avatar BarisW commented on June 30, 2024

I meant the webservice. According to the docs, it needs an URI and I don't see a way to enter just content?

achecker.ca/documentation/web_service_api.php

from achecker.

atutor avatar atutor commented on June 30, 2024

You might take a look at the TinyMCE plugin, which kind of does that.
https://github.com/atutor/acheck_plugin_tmce

There's no plans though, for direct input via Webservices. It might be a good project for a community member to take on ;-)

from achecker.

BarisW avatar BarisW commented on June 30, 2024

Hi, thanks for the info. I've tried implementing the same logics, but I cannot get it to work. I'm using PHP instead of JavaScript. I'm trying to implement the checker in a Drupal module, and I'm using this code:

$url = 'http://achecker.ca/checker/index.php';
$headers = array('Content-Type' => 'application/x-www-form-urlencoded');
$data = array(
  'gid[]' => '8',
  'validate_content' => urlencode('<h1>This is a test</h1>'),
);
$response = drupal_http_request($url, $headers, 'POST', http_build_query($data, '', '&'));

Just like here: http://drupal.org/node/221136
I do get a response, but that response just seems to be the HTML of the page, as if it never received input.

Any thoughts on how I could get this to work?

from achecker.

atutor avatar atutor commented on June 30, 2024

If you want to take this to the atutor.ca forums, I'll pass you on to Cindy Li, who created the Webservices
http://atutor.ca/forum/18/1.html

from achecker.

BarisW avatar BarisW commented on June 30, 2024

I'm more that willing to do that. However, I can't create an account on the forums. I've tried 4 different usernames, but all seem to be taken (can't believe that, I've tried some random strings).

I there another way to contact Cindy Li?

from achecker.

atutor avatar atutor commented on June 30, 2024

We had some problems on the atutor.ca server this weekend. I've made a few adjustments, and hoping things are working now.

You can try again.
https://atutor.ca/my/register.php

from achecker.

cindyli avatar cindyli commented on June 30, 2024

Thanks for pumping in ideas and looking into code.

To achieve what you need, AChecker server side needs to be adjusted to accept the direct html content to be validated. With the current web service implementation:

https://github.com/atutor/AChecker/blob/master/checkacc.php#L48-56

The only valid input is URIs. However, extending AChecker to accommodate direct input should not be hard.

from achecker.

BarisW avatar BarisW commented on June 30, 2024

Thanks Cindy for your reply. Implementing this seems rather simple. Is this something you can/will do? Or do you want me to Fork the module and implement it myself?

from achecker.

cindyli avatar cindyli commented on June 30, 2024

Hi BarisW, it might be a while before we do another round of work on achecker. It would get done faster if you wanted to take it on.

from achecker.

cbiggins avatar cbiggins commented on June 30, 2024

BarisW, this might get you started. Its a diff of checkacc.php. Theres not much to it.

@@ -35,6 +35,7 @@
include_once(AC_INCLUDE_PATH. 'classes/RESTWebServiceOutput.class.php');

$uri = trim(urldecode($_REQUEST['uri']));
+$validate_content = trim(urldecode($_REQUEST['html']));
$web_service_id = trim($_REQUEST['id']);
$guide = trim(strtolower($_REQUEST['guide']));
$output = trim(strtolower($_REQUEST['output']));
@@ -46,11 +47,11 @@
// end of initialization

// validate parameters
-if ($uri == '')
+if ($uri == '' && $validate_content == '')
{
$errors[] = 'AC_ERROR_EMPTY_URI';
}
-else
+else if (empty($validate_content))
{
if (Utility::getValidURI($uri) === false) $errors[] = 'AC_ERROR_INVALID_URI';
}
@@ -106,7 +107,9 @@
$userLinksDAO->setLastSessionID($user_link_id, Utility::getSessionID());

// validating uri content
+if (empty($validate_content)) {
$validate_content = @file_get_contents($uri);
+}

if (isset($validate_content))
{

from achecker.

cbiggins avatar cbiggins commented on June 30, 2024

I've just added a pull request with this functionality also.

https://github.com/atutor/AChecker/pull/30

from achecker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.