FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Expanded and Collapsed view of Code
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Expanded and Collapsed view of Code
Posted: Thu Jan 29, 2009 11:53 AM
Dear Mr.Antonio,

Can our forum have an option to view the Code Expanded and Collapsed. It improves the readabilty when the code is lengthy. It's only a suggestion.
The screen snapshot is from a Forum running on phpBB like ours



Regards

Anser
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Expanded and Collapsed view of Code
Posted: Sun Feb 01, 2009 11:35 AM

Anser,

It looks as an installed mod for phpbb3.

When you place the mouse over such option, what php file is shown in the message bar ?
If we know the php file name we may be able to locate the mod.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Expanded and Collapsed view of Code
Posted: Mon Feb 02, 2009 05:33 AM
Dear Mr.Antonio,

When you place the mouse over such option, what php file is shown in the message bar ?

When I placed the mouse over the Expand view I could not find any difference in the Php parameters. It is the same as the Select all Php paramteres.

The following forum has the feature what I am talking about
http://user.services.openoffice.org/en/forum/

Regards

Anser
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Expanded and Collapsed view of Code
Posted: Thu Feb 12, 2009 09:41 AM

Anser,

We need to locate the mod or source for:

Code: <a href="#" onclick="selectCode(this); return false;">Select all</a> &nbsp;&nbsp;<a class="codebox" href="#" onclick="return expandCode(this, true);">Expand view</a>

Looking for it :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Expanded and Collapsed view of Code
Posted: Thu Feb 12, 2009 09:44 AM
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Expanded and Collapsed view of Code
Posted: Thu Feb 12, 2009 10:56 AM

So, we will also have this facility soon :D

Regards

Anser

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Expanded and Collapsed view of Code
Posted: Thu Feb 12, 2009 11:36 AM

Anser,

Hopefully :-)

I have to comment it with Daniel García who is the phpbb mods guru :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Expanded and Collapsed view of Code
Posted: Sat Feb 14, 2009 10:53 AM

Anser,

Already implemented :-)

We need just some fine tunning with colors

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Expanded and Collapsed view of Code
Posted: Sat Feb 14, 2009 05:13 PM
Anser,

After a long fight with DOM, its working :-)

Javascrip code :-)
Code (js): Select all Collapse
<div class="js" id="{CB}" style="font-family: monospace;"><ol><li style="" class="li1"> </li><li style="" class="li2">function expandCode( aTag )</li><li style="" class="li1">{</li><li style="" class="li2">   var code = aTag.parentNode.nextSibling.lastChild;</li><li style="" class="li1">     </li><li style="" class="li2">   if( code.style.maxHeight != "none" )</li><li style="" class="li1">   {</li><li style="" class="li2">      aTag.innerHTML = "Collapse view";</li><li style="" class="li1">      code.style.maxHeight = "none";</li><li style="" class="li2">   }   </li><li style="" class="li1">   else   </li><li style="" class="li2">   {    </li><li style="" class="li1">      aTag.innerHTML = "Expand view";</li><li style="" class="li2">      code.style.maxHeight = "200px";</li><li style="" class="li1">   }   </li><li style="" class="li2">}   </li><li style="" class="li1"> </li></ol></div>

A code section has this structure:
Code (text): Select all Collapse
<div class="text" id="{CB}" style="font-family: monospace;"><ol><li style="" class="li1"> </li><li style="" class="li2"><DL>        // distribution list</li><li style="" class="li1">   <DT>     // distribution title</li><li style="" class="li2">      the <a hrefs> are here</li><li style="" class="li1">   </DT>    // end of the distribution title    </li><li style="" class="li2">   <DD>     // distribution description (data)</li><li style="" class="li1">      <CODE>  // here is the code, where we want to swap its style !!!</li><li style="" class="li2">      </CODE></li><li style="" class="li1">   </DD></li><li style="" class="li2"></DL>       // end of the distribution list</li><li style="" class="li1"> </li></ol></div>

This code is really tricky:
aTag.parentNode.nextSibling.lastChild;

1) aTag is the <a href> where we click
2) parentNode is the parent of aTag, that is, the DT (distribution title) of the DL (distribution list)
3) nextSibling is the next child, after DT, so it is DD.
4) lastChild is the only child that DD has: <code>

There we are and then we change its style :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Expanded and Collapsed view of Code
Posted: Sun Feb 15, 2009 02:28 AM
An equivalent javascript code, for this case:
Code (js): Select all Collapse
<div class="js" id="{CB}" style="font-family: monospace;"><ol><li style="" class="li1"> </li><li style="" class="li2">function expandCode( aTag )</li><li style="" class="li1">{</li><li style="" class="li2">   var code = aTag.parentNode.nextSibling.childNodes[0];</li><li style="" class="li1">     </li><li style="" class="li2">   if( code.style.maxHeight != "none" )</li><li style="" class="li1">   {</li><li style="" class="li2">      aTag.innerHTML = "Collapse view";</li><li style="" class="li1">      code.style.maxHeight = "none";</li><li style="" class="li2">   }   </li><li style="" class="li1">   else   </li><li style="" class="li2">   {    </li><li style="" class="li1">      aTag.innerHTML = "Expand view";</li><li style="" class="li2">      code.style.maxHeight = "200px";</li><li style="" class="li1">   }   </li><li style="" class="li2">}   </li><li style="" class="li1"> </li></ol></div>
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Expanded and Collapsed view of Code
Posted: Sun Feb 15, 2009 09:05 AM

Dear Mr.Antonio,

Excellent work. It is working fine. Thankyou very much for your effort.

Regards

Anser

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Expanded and Collapsed view of Code
Posted: Sun Feb 15, 2009 09:26 AM

Anser,

Thanks.

It has been a nice html, css and javascript training for us too :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Expanded and Collapsed view of Code
Posted: Mon Feb 16, 2009 05:57 AM

Dear Mr.Antonio,

Today I have found that the Expand and Collapsed view of code is not working on Mozila FireFox 3.0.6 (The version which I am using) and Internet Explorer 6. The browser displays the code always in the expanded mode irrespective of the click.

It is working fine on the browser which comes with Nokia Symbian OS phones. Yesterday I browsed the forums on my phone and I replied to this thread from my phone itself. Usually the Nokia Internet browser, renders and displays the web page exactly as IE and Mozila Firefox.

Is there anything wrong at my end ? What about the the feedbacks from other members of this forum

Regards

Anser

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Expanded and Collapsed view of Code
Posted: Mon Feb 16, 2009 06:48 AM

Anser,

The fact is that not all the browsers behave the same :-(

We have tested it with IE beta 8, and also with IE 7. And they work fine.
I have been reported that Chrome and Safari are fine too.

Anyhow, we plan to support FireFox too.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Expanded and Collapsed view of Code
Posted: Mon Feb 16, 2009 08:07 AM

Anser,

The problem is that FireFox does not support max-Height style:

http://www.webmasterworld.com/css/3016213.htm

This time is a FireFox limitation :?

regards, saludos

Antonio Linares
www.fivetechsoft.com