[TYPO3]  icon to edit a record in Backend
    Rakowski Tomasz 
    raczek at open.infi.pl
       
    Thu Apr 17 13:43:15 CEST 2008
    
    
  
hello!
I am worknig on backend extension in which I will display records from 
specific table with the possibility to apply different filters on them 
(show hidden only, show not older than, etc).
Next to the title of the record I would like to place an icon of pencil, 
like in Web->List to enable edition of this particular record. I dived 
into Web->List to see how it works and I found that to generate the icon 
you have to use t3lib_BEfunc::editOnClick() function. Then you must 
provide your site with JavaScript code to write some variables 
(T3_THIS_LOCATION). The problem is, that after clicking the icon, I get 
the TYPO3 error screen about wrong segment :
Reason: Segment "mysite" was not a keyword for a postVarSet as expected!
So, how I do it:
In my backend function:
$this->doc = t3lib_div::makeInstance('template'); //could be mediumDoc
$this->doc->backPath = $BACK_PATH;
$this->doc->redirectUrls(); //this writes JavaScript vars 
T3_THIS_LOCATION into the code
Then I generate javaScript on onClick action for <a>:
$jScript = t3lib_BEfunc::editOnClick('&edit[tx_myExt][1]=edit','','-1');
In the source the icon link looks like that:
<a onclick= 
"window.location.href='alt_doc.php?returnUrl='+T3_THIS_LOCATION+'&edit[tx_myExt][1]=edit=edit'; 
return false;" href="#"><img alt="" title="Edit record" 
src="sysext/t3skin/icons/gfx/edit2.gif" height="16" width="16"></a>
And T3_THIS_LOCATION is set to:
var T3_THIS_LOCATION = 
'%2F_dev%2Fmysite%2Ftypo3conf%2Fext%2FmyExt%2Fmod1%2Findex.php';
If I copy paste the window.location.href link and substitute the 
T3_THIS_LOCATION with the above value the page for editing my record 
opens, but it takes 100% of window, so all left side menu disappears 
(which is obvious because I call directly alt.doc).
That's basically all.
I hope some of you have faced the issue of using alt.doc and links 
generation in framesets in backend, because I think there is something 
wrong with the paths.
    
    
More information about the TYPO3-english
mailing list