Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Database Extra Field
cdavid
New
Dear all,
As I mentioned in the previous posts, I am trying to implement a LaTeX editor plugin for VanillaForums that uses a daemon to convert the contents of a discussion/comment from LaTeX to XHTML.
I want to do some sort of caching for the daemon in order not to call it every time something needs to get rendered (otherwise I'd use a different Format in the Database and a custom input formatter - http://vanillaforums.org/discussion/12384/latex-editor/ ), but I want to store in the database both the LaTeX and the XHTML code.
In my opinion, that would require a change to the database structure and add of a column (e.g.: BodyLaTeX ). My problem is how would I design this as a proper plugin, without meddling with the internals of VanillaForums? Is there any plugin that is making use of these features that I can inspire myself from?
Also, after that is created, I should hook to the Save / Edit / Render events and when you save, send the content to the daemon, get back the request and then save to both sources, when you edit, edit the LaTeX source, when you render, render the XHTML from the database. How does that seem for a plan?
Thanks a lot,
Catalin
As I mentioned in the previous posts, I am trying to implement a LaTeX editor plugin for VanillaForums that uses a daemon to convert the contents of a discussion/comment from LaTeX to XHTML.
I want to do some sort of caching for the daemon in order not to call it every time something needs to get rendered (otherwise I'd use a different Format in the Database and a custom input formatter - http://vanillaforums.org/discussion/12384/latex-editor/ ), but I want to store in the database both the LaTeX and the XHTML code.
In my opinion, that would require a change to the database structure and add of a column (e.g.: BodyLaTeX ). My problem is how would I design this as a proper plugin, without meddling with the internals of VanillaForums? Is there any plugin that is making use of these features that I can inspire myself from?
Also, after that is created, I should hook to the Save / Edit / Render events and when you save, send the content to the daemon, get back the request and then save to both sources, when you edit, edit the LaTeX source, when you render, render the XHTML from the database. How does that seem for a plan?
Thanks a lot,
Catalin
Tagged:
0
Comments
In your plugin file ( default.php ), in the class, one would have to do something like this:
public function Setup() { $Structure = Gdn::Structure(); $Structure->Table('Discussion') ->Column('BodyXHTML', 'text', TRUE) ->Set(FALSE, FALSE); $Structure->Table('Comment') ->Column('BodyXHTML', 'text', TRUE) ->Set(FALSE, FALSE); } public function CleanUp() { $Structure = Gdn::Structure(); $Structure->Table('Discussion') ->DropColumn('BodyXHTML'); $Structure->Table('Comment') ->DropColumn('BodyXHTML'); }
which takes care that when you enable a module, a column named BodyXHTML is added to the Discussion table and when you totally remove (!! not disable, but remove), will delete the column.
/cd
/** * These methods are invoked if present, but are not required and will be silently ignored * if they do not exist. */ // public function CleanUp() - Called as the plugin is removed
Even though it is commented, I think it somehow gets called at *remove* time (when it's disabled, you have to click one more time and then confirm), not at disable time.
/cd