Some help with this code (quick modify inline edit)

Started by ɔɔɔɔɔɔuɥoɾ, July 19, 2010, 07:37:25 PM

Previous topic - Next topic

ɔɔɔɔɔɔuɥoɾ

Code (Display.template.php) Select

            <img src="', $settings['images_url'], '/icons/modify_inline.gif" alt="" title="', $txt['modify_msg'], '" class="modifybutton" id="modify_button_', $message['id'],
            '" style="cursor: ', ($context['browser']['is_ie5'] || $context['browser']['is_ie5.5'] ? 'hand' : 'pointer'), '; display: none;" onclick="oQuickModify.modifyMsg
            (\'', $message['id'], '\')" />';

The code was all in 1 line, I split it into 3 so it would be easier to read

Specifically this part, how is this changing the record in the database

" onclick="oQuickModify.modifyMsg
            (\'', $message['id'], '\')" />';

Can someone explain this code, as I'm working on a mod, which uses something like this..

Thanks


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

ɔɔɔɔɔɔuɥoɾ



SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

MrPhil


" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\')" />';

Are you asking how this PHP code is handled? I can answer that, but I have no idea what the oQuickModify.modifyMsg() method is doing. The PHP code gives a " to end the style attribute, then defines an onclick attribute to trigger Javascript code upon a mouse click. What is sent to the browser is onclick="oQuickModify.modifyMsg('12345')", where modifyMsg is a method (function) of the object oQuickModify. That takes some kind of action on message ID 12345, but I don't what. \' inserts a literal quote ' into the PHP output. Then ' ends the string. $message['id'] is output, then a new string starts at '. A literal ' is inserted by \', and finally comes )" to end the onclick string. The two literal quotes are within the ().

Somewhere in the Javascript is a oQuickModify = new QuickModifyClassName; statement. This creates the object oQuickModify. In its class definition there should be a method definition called modifyMsg(). Without knowing anything more about the QM, I can't tell you what else is going on.

ɔɔɔɔɔɔuɥoɾ

I gathered it was some kind of Javascript or Ajax

Where is the Java coded, I want to change another record, using this method, I have got no clue how the QuickModify works though

Thanks


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

Advertisement: