Scratchpad - Demonstration AJAX Add-on

It's possible for coder to add Edit and delete button + more permissions ?
Of course, though I won't be doing that myself - the purpose of the add-on is a demonstration of how to work with form data via AJAX, not to be an add-on that people install on their forums.
 
Wonderful tutorial, works like a charm !
Just one question...
Suppose I wanted to parse smilies in addition to the bodytext helper used in template (that one only does the links and carriage returns)..
I know how to do it in php for the existing messages, adding formater and parser..
but when it comes to the ajax part I am lost...

My thought would be to:
a) remove the helper thingy in the template..
and
b)
add the bbcode parser either in:

the json part of Scratchpad_ViewPublic_LatestNotes

or before that, inside the $this->_noRedirect conditional..

any hint would be helpful

Thx

Luc
 
I'd love to be able to figure this out on my own, but unfortunately, I don't have the coding experience for it. :( Would there be a way to modify this code (or at least learn from it, I guess) to allow the creation of our own forms that would post the information to a new thread within a designated forum? I briefly outlined what I'm thinking about here.
 
Nice and clear, for forms...

Instead I would like to have an JSON method that works on GETs in the <a href>. Reason being that I have some data within Xenforo's FORM for thread view, and I'd need to update only a single ID and not submit the whole form.

I tried to have a look at the "Like" button, which is pretty similar in behaviour to what I want to do, but didn't quite understand where it hooks up.

Any hint?
 
Of course, though I won't be doing that myself - the purpose of the add-on is a demonstration of how to work with form data via AJAX, not to be an add-on that people install on their forums.
I don't want to bring up old posts, but...is there a way this could be implemented into the acp? It would be very helpful for making notes / reminders and such say during template reverts and or for general reminders pertaining to administration of the site.

I understand this was meant to be used for learning purposes but...I find this perfect and completely usable as a note taking system in the acp.

Possible?
 
To install the add-on, decompress the zip then upload the contents of the upload directory (which should contain js/scratchpad and library/Scratchpad) and finally install the addon_Scratchpad.xml via the XenForo Add-on Installer system.

I am trying to install this addon, getting following error when trying to import the XML file:


Server Error

call_user_func(Scratchpad_Install_Base::install) [function.call-user-func]: First argument is expected to be a valid callback
  1. XenForo_Application::handlePhpError() in XenForo/Model/AddOn.php at line 214
  2. XenForo_Model_AddOn->installAddOnXml() in XenForo/Model/AddOn.php at line 169
  3. XenForo_Model_AddOn->installAddOnXmlFromFile() in XenForo/ControllerAdmin/AddOn.php at line 180
  4. XenForo_ControllerAdmin_AddOn->actionInstall() in XenForo/FrontController.php at line 310
  5. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
  6. XenForo_FrontController->run() in /home2/masterf4/public_html/community/admin.php at line 13
 
I am trying to install this addon, getting following error when trying to import the XML file:

Server Error

call_user_func(Scratchpad_Install_Base::install) [function.call-user-func]: First argument is expected to be a valid callback
  1. XenForo_Application::handlePhpError() in XenForo/Model/AddOn.php at line 214
  2. XenForo_Model_AddOn->installAddOnXml() in XenForo/Model/AddOn.php at line 169
  3. XenForo_Model_AddOn->installAddOnXmlFromFile() in XenForo/ControllerAdmin/AddOn.php at line 180
  4. XenForo_ControllerAdmin_AddOn->actionInstall() in XenForo/FrontController.php at line 310
  5. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
  6. XenForo_FrontController->run() in /home2/masterf4/public_html/community/admin.php at line 13

Sure that you uploaded the files(into the right directory)?
 
Hi,

Thank you for your tutorial. It's most helpful to my understanding of Xenforo. I installed the add-on and it works fine!!

The only thing I can't figure out for some reason, is how the ScratchPad Controller (index.php) gets called. In the admin cp I can't see any declared listeners. It's probably very simple, but I just don't see it.

Thanks in advance for any replies.
 
I think I made some progress. It seems to me that you register a router in Admin CP using Route Prefix and that code in turns specifies the controller to be used.

Does that sound right?
 
I have another question....

In your template why do you include a .js file instead of another template. Is that for some sort of efficiency? Or does the .js file do something that can't be done in a template?

Thanks
 
Thanks, it is great to have code examples.

I believe there is an error in the comment on line 81 of /ControllerPublic/Index.php
Code:
 81     // return a View (Scratchpad_ViewPublic_Index) using template 'scratchpad_index'
 82      return $this->responseView(
 83            'Scratchpad_ViewPublic_LatestNotes',
 84            'scratchpad_notes',
 85           $viewParams
 86       );

I presume it should read:
Code:
 81     // return a View (Scratchpad_ViewPublic_LatestNotes) using template 'scratchpad_notes'
 
Back
Top Bottom