ASP-NUKE Modules
By Mr.Spock aka Rolf Thomassen

A short into to use modules and the modules.xml file to setup modules into asp-nuke.

Modules

	I have opdated the modules XML files.
	Its not possible to make language translations inside the XML files

	Syntax is the following:
		Name of the XML file have to be name of the folder the module is installed in, or default.xml

		The XML file have to be saved in UNICODE format, just like the language XML file

		<?xml version="1.0" encoding="Unicode" ?>
		<modules_config>
			<config name="whoswhat" role="4" version="1.4" bullet="unix-icon.gif">
				<parameter name="TITLE">Who's What</parameter>
				<parameter name="AUTHOR">Rolf Thomassen, Mr.Spock</parameter>
			</config>
			<lang>
				<translation name="LANG_MODULE">Default Language</translation>
				<translation name="LANG_TITLE">Default title</translation>
				<en>
					<translation name="LANG_MODULE">Who is what</translation>
					<translation name="LANG_TITLE">Title of module</translation>
				</en>
				<dk>
					<translation name="LANG_MODULE">Hvem er hvad</translation>
					<translation name="LANG_TITLE">Modulets title</translation>
				</dk>
			</lang>
		</modules_config>
					
		config	-	contains parameters to the module:
			name    =	<Uniq_module_name>		-	Name of module. no space
			role    =	<User access level>		-	0=public, 1=user, 2=member, 3=newser, 4=editor, 5=admin
			version =	<1.4>					-	To what version of asp-nuke is the modules build for, just info
			bullet  =	<bullet.gif>			-	bullet to show on menu, bullet have to be in moduls folder

			parameters
				parameters contain info the module can/will need to run
				And other info about the module.
				Can be accessed with obj.parameter

		lang	-	Language for module
			Default language, show in all versions/languages
			<en>
			<dk>
			<fr>
			<..>	-	any language defintion
							
			Language is access via obj.GetTranslation("LANG_xxxx")

	Use the class moduleXMLobj
	usage:
		Dim XMLobj
		Set XMLobj = new moduleXMLobj
		XMLobj.loadxml("module")
		if XMLobj.loaded then
			x = XMLobj.config("role")
			x = XMLobj.parameter("title")
			x = XMLobj.parameter("author")
			x = XMLobj.GetTranslation("lang_module")
			
			your code for the module
			to access the XML file use the obj
		end if
		set obj = nothing



This is an example on usage of module:

example.xml:
	<?xml version="1.0" encoding="Unicode" ?>
	<modules_config>
		<config name="example" role="2" version="1.4" bullet="unix-icon.gif">
			<parameter name="TITLE">Example</parameter>
			<parameter name="AUTHOR">Rolf Thomassen, Mr.Spock</parameter>
		</config>
		<lang>
			<translation name="LANG_MODULE">Default Language</translation>
			<translation name="LANG_TITLE_DEFAULT">Default title</translation>
			<translation name="LANG_TITLE">Default title</translation>
			<en>
				<translation name="LANG_TITLE_DEFAULT">Default module title</translation>
				<translation name="LANG_MODULE">Example module</translation>
				<translation name="LANG_TITLE">Title of module</translation>
			</en>
			<dk>
				<translation name="LANG_TITLE_DEFAULT">Standard modul titel</translation>
				<translation name="LANG_MODULE">Eksemple modul</translation>
				<translation name="LANG_TITLE">Modulets title</translation>
			</dk>
		</lang>
	</modules_config>

example.asp:
	<!-- #include file='../../includes/includes-inc.asp' -->
	<!-- #include file='includes/example-inc.asp' -->
	<%
			sTitlePage = oXML.GetTranslation("LANG_TITLE_DEFAULT")
	%>
	<!-- #include file='../../includes/toppage-inc.asp' -->
	<% 
		DoModule()

		Set oXML = Nothing
	%>
	<!-- #include file='../../includes/bottompage-inc.asp' -->
	<!-- #include file='../../includes/clearitall-inc.asp' -->


example-inc.asp:
	Dim oXML
	Set oXML = New moduleXMLobj
	oXML.loadXML("example")

	Sub ShowModule(ByVal sTitle)
		Response.Write oXML.GetTranslation("LANG_MODULE") & "<br>" & vbCrLf
		Response.Write sTitle & "<br>" & vbCrLf
	End Sub
	
	Sub DoModule()
		Dim sTitle, imRole
		With oXML
			sTitle = .Parameter("title")
			imRole = .config("role")

			If IsAuthorized(imRole) Then 
				ShowModule( sTitle )
			End If

		End With
	End Sub
	