insertData feature in TS breaks Front end editing

View: New views
4 Messages — Rating Filter:   Alert me  

insertData feature in TS breaks Front end editing

by Ben van Kruistum :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Listreaders!

Today I was practicing with some typoscript and front end editing. At a
given point the "hide" and "delete" features for front end editing didn't
work anymore. When I click one of those buttons the javascript confirm fired
but the actions didn't. Looking into the source code the onclick attribute
in the href was set but incomplete. something like onclick="if(confirm('are
you sure?')) return false;" so the piece of script that submits the form was
gone.

Eventually it turned out that when setting page.stdWrap.insertData = 1 in my
TS this problem occured. Digging into the code I found the function
insertData in class.tslib_content.php that causes it. This function replaces
all text between curly braces  with a match from the original value. So
normally it expects {field:title} and the results from this is used,
javascript functions that are parsed through this function are also affected
resulting in the given problem above (All javascript code between curly
braces is removed).

I don't know if it is recommended to use page.stdWrap.insertData, in my case
it was only for some quick and dirty tests, but I could imagine that I could
have used it for same reason somewhere else.

Ben.





 

_______________________________________________
TYPO3-dev mailing list
TYPO3-dev@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev

Re: insertData feature in TS breaks Front end editing

by Dmitry Dulepov [typo3] :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

Ben van Kruistum wrote:
> Eventually it turned out that when setting page.stdWrap.insertData = 1
> in my TS this problem occured. Digging into the code I found the
> function insertData in class.tslib_content.php that causes it. This
> function replaces all text between curly braces  with a match from the
> original value. So normally it expects {field:title} and the results
> from this is used, javascript functions that are parsed through this
> function are also affected resulting in the given problem above (All
> javascript code between curly braces is removed).

You do not need to digg to the source code. Everything is perfectly described in TSRef on typo3.org.

> I don't know if it is recommended to use page.stdWrap.insertData, in my
> case it was only for some quick and dirty tests, but I could imagine
> that I could have used it for same reason somewhere else.

Short answer: if you use something, you should know why you are doing it. If you just randomly pressing buttons, once you can press a big red one...

--
Dmitry Dulepov
TYPO3 Core team
More about TYPO3: http://typo3bloke.net/
Subscribe: http://typo3bloke.net/rss.xml
Latest article: http://typo3bloke.net/post-details/nominate_me_as_typo3_mvp/
_______________________________________________
TYPO3-dev mailing list
TYPO3-dev@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev

Re: insertData feature in TS breaks Front end editing

by Ben van Kruistum :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



"Dmitry Dulepov [typo3]" <dmitry@...> schreef in bericht
news:mailman.1.1216669092.12933.typo3-dev@......

> Hi!
>
> Ben van Kruistum wrote:
>> Eventually it turned out that when setting page.stdWrap.insertData = 1 in
>> my TS this problem occured. Digging into the code I found the function
>> insertData in class.tslib_content.php that causes it. This function
>> replaces all text between curly braces  with a match from the original
>> value. So normally it expects {field:title} and the results from this is
>> used, javascript functions that are parsed through this function are also
>> affected resulting in the given problem above (All javascript code
>> between curly braces is removed).
>
> You do not need to digg to the source code. Everything is perfectly
> described in TSRef on typo3.org.
>
>> I don't know if it is recommended to use page.stdWrap.insertData, in my
>> case it was only for some quick and dirty tests, but I could imagine that
>> I could have used it for same reason somewhere else.
>
> Short answer: if you use something, you should know why you are doing it.
> If you just randomly pressing buttons, once you can press a big red one...

Hi Dmitry,

First thanks for your appearance in the netherlands on the typo3 userday in
Utrecht :-)  and for your reply.
Secondly, maybe I did not explain myself correctly so here I'll try it
again:

I want to use a wrapper for the content page.

page = PAGE
page.stdWrap.insertData = 1
page.stdWrap.wrap = <H1>{field:title}</H1>|
page.10 < styles.content.get

If I use the above Typoscript and also use Frontend editing

admPanel.override {
    edit = 1
    edit.displayIcons = 1
}

then the buttons for hiding or deleting are not working anymore cause some
javascript code is removed due the insertData() function.
So this is all straight forward Typoscript, but this combination breaks down
front end editing.

Hopefully this describes my point better..


Ben.






>
> --
> Dmitry Dulepov
> TYPO3 Core team
> More about TYPO3: http://typo3bloke.net/
> Subscribe: http://typo3bloke.net/rss.xml
> Latest article:
> http://typo3bloke.net/post-details/nominate_me_as_typo3_mvp/ 

_______________________________________________
TYPO3-dev mailing list
TYPO3-dev@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev

Re: insertData feature in TS breaks Front end editing

by Dmitry Dulepov [typo3] :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

Ben van Kruistum wrote:
> First thanks for your appearance in the netherlands on the typo3 userday
> in Utrecht :-)  and for your reply.

;) Btw, slides from productivity session are now available here:
http://www.slideshare.net/dulepov/personal-productivity/

I did not expect that it will be featured on home page by SlideShare team.

> Secondly, maybe I did not explain myself correctly so here I'll try it
> again:
>
> I want to use a wrapper for the content page.
>
> page = PAGE
> page.stdWrap.insertData = 1
> page.stdWrap.wrap = <H1>{field:title}</H1>|
> page.10 < styles.content.get
>
> If I use the above Typoscript and also use Frontend editing
>
> admPanel.override {
>    edit = 1
>    edit.displayIcons = 1
> }
>
> then the buttons for hiding or deleting are not working anymore cause
> some javascript code is removed due the insertData() function.
> So this is all straight forward Typoscript, but this combination breaks
> down front end editing.
>
> Hopefully this describes my point better..

Yes, now I see :)

page.stdWrap works for the whole page. Or, more precise, it works on the whole page content. Therefore insertData will look for {} in the whole content.

I think you actually looking for one of these two:

page.stdWrap.dataWrap = <H1>{field:title}</H1>|

or

page.5 = TEXT
page.5.dataWrap = <H1>{field:title}</H1>

The second one looks better and more optimal from memory usage view (it does not have to copy the whole content inside dataWrap). The first one is different from insertData because it inserts data only to the string you specify (not to the wrapped content).

--
Dmitry Dulepov
TYPO3 Core team
More about TYPO3: http://typo3bloke.net/
Subscribe: http://typo3bloke.net/rss.xml
Latest article: http://typo3bloke.net/post-details/slides_from_productivity_session/
_______________________________________________
TYPO3-dev mailing list
TYPO3-dev@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev
LightInTheBox - Buy quality products at wholesale price