wiki:WebsiteNotes

Website Notes

Layout

Websites which are part of the GeoGebra.org website should use this layout file Download as their template. For more complicated examples one can directly consult the source code of GeoGebra.org or any of its subpages of course. The main menu is included in "navigation.php", located in the root directory of GeoGebra.org, this file should be included to allow translations of the main menu (if PHP is not available, contact florian@… to find a solution).

Forum

Collapsible Categories

On update add the parent ID for the collapse add-on to the file includes/functions_display.php again at the line the forumrow block is added to the template (around line 470 in the current version):

'FORUM_PARENT' => $row['parent_id'],

To display the user's website just if he wrote more than 5 posts, you have to change the U_WWW (and U_WWW_SHORT) field in viewtopic.php and memberlist.php. In viewtopic.php the condition is $user_cache[$poster_id]['posts'] >= 5, in memberlist.php it's $data['user_posts'] >= 5.

Applet Attachment Viewer

In the template attachment.html add the following code in the appropriate place:

<!-- IF _file.S_GEOGEBRA -->
<span class="genmed" style="display: block; overflow: auto;">
	<!-- IF _file.UPLOAD_ICON --><div style="float: left; margin-right: 5px;">{_file.UPLOAD_ICON}</div><!-- ENDIF -->
	<a href="{_file.U_DOWNLOAD_LINK}">{_file.DOWNLOAD_NAME}</a> [{_file.FILESIZE} {_file.SIZE_LANG}]
	<!--[if !IE]>-->
	<br />
	<strong>View in browser:</strong>
	<a onclick="javascript:toggleApplet('{_file.ATTACH_ID}', '3.2');" style="cursor:pointer;">Version 3.2</a>
	(<a onclick="javascript:toggleApplet('{_file.ATTACH_ID}', '4.0');" style="cursor:pointer;">Version 4.0</a>,
<a onclick="javascript:toggleApplet('{_file.ATTACH_ID}', '4.2');" style="cursor:pointer;">Version 4.2 (CAS)</a>)
	<!--(<a onclick="javascript:toggleApplet('{_file.ATTACH_ID}', '5.0');" style="cursor:pointer;">5.0</a>)-->
	<!--<![endif]-->
</span>
<span class="gensmall">{_file.L_DOWNLOAD_COUNT}</span>
<!--[if !IE]>-->
<div id="applet_{_file.ATTACH_ID}" style="display:none;">
<applet code="geogebra.GeoGebraApplet" archive="geogebra.jar" id="appletobj_{_file.ATTACH_ID}" codetype="application/java" width="100%" height="400">
	<param name="filename" value="{_file.U_DOWNLOAD_LINK}" />
	<param name="java_arguments" value="-Xmx512m"/>
	<param name="framePossible" value="true"/>
	<param name="showResetIcon" value="true"/>
	<param name="showAnimationButton" value="true"/>
	<param name="enableRightClick" value="true"/>
	<param name="errorDialogsActive" value="true"/>
	<param name="enableLabelDrags" value="true"/>
	<param name="showMenuBar" value="false"/>
	<param name="showToolBar" value="false"/>
	<param name="showToolBarHelp" value="false"/>
	<param name="showAlgebraInput" value="false"/>
	This is a Java Applet created using GeoGebra from www.geogebra.org - it looks like you don't have Java installed, please go to <a href="http://www.java.com">www.java.com</a>
</applet>
</div>
<!--<![endif]-->
<!-- ENDIF -->

In the template overall_header, add the following JS Code:

function toggleApplet(appletid, version, linkTag) {
	var appletTag = document.getElementById('applet_'+appletid);
	var appletObjTag = document.getElementById('appletobj_'+appletid);
	var codebase = "http://www.geogebra.org/webstart/"+version+"/";
	var diffVersions = codebase != appletObjTag.getAttribute("codebase");
	
	if(appletTag.style.display == "none") {
		if(diffVersions) {
			appletObjTag.setAttribute("codebase", codebase);
		}		
		appletTag.style.display = "block"; 
	} else {
		appletTag.style.display = "none"; 
	}
}

In includes/functions_content.php, as part of the function parse_attachments add:

/* < GGB Attachment Parsing > */
define('ATTACHMENT_CATEGORY_GEOGEBRA', 101);
if($attachment['extension'] == 'ggb') {
	$display_cat = ATTACHMENT_CATEGORY_GEOGEBRA;
}
/* </ GGB Attachment Parsing > */

right before if ($display_cat == ATTACHMENT_CATEGORY_IMAGE)

also include

/* < GGB Attachment Parsing > */
case ATTACHMENT_CATEGORY_GEOGEBRA:
	$l_downloaded_viewed = 'VIEWED_COUNT';
	
	$block_array += array(
		'U_FORUM'       => generate_board_url(),
		'S_GEOGEBRA' => true,
		'ATTACH_ID'			=> $attachment['attach_id'],
	);
	
	$update_count[] = $attachment['attach_id'];
break;
/* </ GGB Attachment Parsing > */

in the appropriate $display_cat switch.

+ secret change

Attachments