I am working on an email notification that contains the list of contents of the article.
I have somewhat worked backwards through the databases, so I could use simple PHP requests, but then if OJS changes the database structure, I would need to do everything again.
I am going through the code to see which php function is used to get the list of articles - I have found the smarty template, but not the DAO
Now I need to see how to integrate everything so farâŠ
I wish to call a modal window, which would contain a smarty template, with the table of contents. I would like to incorporate this as a plugin, but first i will try with direct modification of the system.
I have just tried that, and it works. Now Iâll see what is the next step.
But now again stuck, this time on
PHP Fatal error: Call to a member function getAuthorizedContextObject() on null in
l/lib/pkp/classes/handler/PKPHandler.inc.php on line 140
Well, my aim is to prepare a plugin that sends an email TOC in HTML format, using a smarty template.
For now, I am trying to get a preview in a tab in the issues section. Then add a button, that will inititiate the sending of the email.
I am currently stuck at the first step. I have added the tab, with load_url_div in the smarty template for the page. This tries to load the above page, but it is not working.
I am also trying to see how emails are being sent by the system, but that is another story
Where exactly is your tab? Parallel to the Future Issues and Back Issues, or when you edit an issue?
Your load_url_div should call a component handler function. You could use an existing handler and implement the function there. That function should best call a form (similar to the other cases in the system), that will provide you the email preview and âsubmitâ button.
From above it seems that you are trying to use the IssueHandler which is not the right choice, I think â it is a page handler used for the frontend display. If you tell me where you tab is, I can see further⊠how to point you to a few examples you could see as an exampleâŠ
You are correct, I am trying to load a component handler, but used controllers/grid/toc/TocGridHandler.inc.php as a basis. The previous code was the contents of my TestTocGridHandler
I did not find documentation on how plugins are. written - if there is anything, please do let me know. I have had to try to figure out by searching through github.
Hmm⊠What do you think about having your extra tab in the model that opens when you edit an issue? â You would like to email only TOC of one issue, correct?
For that, for example, you would add a new line here ojs/issue.tpl at ojs-3_1_1-2 · pkp/ojs · GitHub, something like: <li><a href="{url router=$smarty.const.ROUTE_COMPONENT op="editEmailTOC" issueId=$issueId}">{translate key="..."}</a></li>
Then you would need to implement that function editEmailTOC in controllers/grid/issues/IssueGridHandler.inc.php. It should call a form, similar how the functions editIssueData or identifiers are doing it there.
Then you would need to implement that form class and template, that would display the e-mail content and have a button âSend to all usersâ or so. The form action would be the function sendEmailTOC, that you would also have to implement in controllers/grid/issues/IssueGridHandler.inc.php.
Then, maybe when it works like this, hard coded, we can see how to best write a plugin for that.
What do you think?
So far, I have created the extra tab, and edited IssueHandler - although I think that in the future, I will see if this can be limited only to back issues, to avoid accidents. This calls the function emailTOC - which so far is just a duplicate of editIssueData, just renamed.
However, whenever. Iclick on the tab, I keep getting the alert:
The current role does not have access to this operation.
Any ideas how to move on?
Stephen
EIDT: OK - am slowly getting the idea - i had to add the name of my function to the rolemanager at the start of the Issuehandler.
I am very close to finishing off a test of this function, but am stuck at the final stages.
I need to call an external page to send the email, but of course, it does not go through all the initialization process of OJS. That means that even simple functions like âimport ()â do not work. I have replaced as much as I can and made it simple, but each import() means more and more work.
Any idea how I call this page through OJS and get it part of the OJS? I know it has got to do with routers, but this is still a concept that I need to grasp.