siliconfarm
Karma: 0
|
Re:Edit in the frontend - 2010/02/27 22:50
hi, I really wanted this function as well. After playing around I found an pretty straight forward way...it makes me wonder who really wrote this code ??
if you open: components > com_glossary > v-classes > glossaryEditHTML.php
You see that there's already an option to load the page with existing information to edit.
And if you open glossaryUserHTML.php you'll see that even the "add an entry" button of the frontend uses a link that refers to the "edit" task: $addlink = $interface->sefRelToAbs("index.php?option=com_glossary&task=edit&id=0&glossid=".$glossary->id);
It's only missing the id of the entry to edit ! So basically, all you need in glossaryListHTML.php is to use:
$editlink = $interface->sefRelToAbs("index.php?option=com_glossary&task=edit&id=".$entry->id."&glossid="
.$glossary->id);
The only thing missing was to give acces to allowed users only...which is if ($allowentry) {} in glossaryUserHTML.php but it does not work in glossaryListHTML.php
so you have to edit: components > com_glossary > c-classes > glossary_list_Controller.php
move: $allowentry = ($this->gconfig->anonentry OR ($this->gconfig->allowentry AND $my->id));
above the if statement: if ($total) {
that includes: require_once ($interface->getCfg('absolute_path').'/components/com_glossary/v-classes/glossaryListHTML.php');
and add $allowentry to the variablesto sent to glossaryListHTML.php :
$listhtml = $listing->view($entries, $letter, $grandtotal, $allowentry);
and finally add the variable to the function on glossaryListHTML.php:
function view ($entries, $letter, $total, $allowentry) {
now you can add the editing button next to the word on glossaryListHTML.php :
{$this->showHTML($entry->tterm)} LIST_ENTRY; if ($allowentry) { $editlink = $interface->sefRelToAbs("index.php?option=com_glossary&task=edit&id=".$entry->id."&glossid="
.$glossary->id); $listhtml .= << LIST_ENTRY; } $listhtml .= <<
that's it, it works !!! most of it was already there...it only needed to be enabled !!
Not Possible is never an answer...
I hope it helps someone !
Post edited by: siliconfarm, at: 2010/02/27 22:55
|