<%
 ' Fruibile - L'elemento CMS Open Source che mancava
 ' Copyright (C) 2002-2006 Roberto Scano
 ' 
 ' Licensed under the terms of the GNU Lesser General Public License:
 ' 		http://www.opensource.org/licenses/lgpl-license.php
 ' 
 ' For further information visit:
 ' 		http://www.fruibile.it/
 ' 
 ' File Author:
 ' 		Roberto Scano (mail@robertoscano.info)
%>
<%
'controllo sicurezza --------------
if Session("WEBGODLogin") <> "W3C_VALIDATOR" then
	If session("utenti")<> 1 Then 
		response.Redirect "/backoffice/noentry.asp"
	end if
end if
'----------------------------------
'Prevent your website from cross website attacks ---------
refererUrl = Cstr(Request.ServerVariables("HTTP_REFERER"))
serverName = Cstr(Request.ServerVariables("SERVER_NAME"))
refererName = mid(refererUrl,8,len(serverName)) 
if refererName <> serverName then
   response.Redirect "/backoffice/noentry.asp"
   response.end
end if
'---------------------------------------------------------
		'RICHIAMO ELENCO STRUTTURE
		Set objX = Server.CreateObject("XStandard.Structure")
		Set objDoc = Server.CreateObject("MSXML2.DOMDocument.4.0")
		objDoc.async = False

		Set rsData = Conn.Execute("SELECT Id, parentid, title_" & Session("Language") & " FROM strutture WHERE visibile=1")

		objX.RootID = "0"
		objX.AddNode "0", "root", ""
		objX.AddNode "0-a", "id", "0", 2
		objX.AddRelationship "0-a", "0"

		Do Until rsData.EOF
			strID = CStr(rsData("id").Value)

			If Not IsNull(rsData("parentid").Value) Then
				If Len(CStr(rsData("parentid").Value)) > 0 Then
					If CStr(rsData("parentid").Value) = "0" Then
						objX.AddNode strID, "group", ""
					Else
						objX.AddNode strID, "item", ""
					End If					
					objX.AddRelationship strID, CStr(rsData("parentid").Value)
				End If
			End If

			objX.AddNode strID & "-a", "id", strID, 2
			objX.AddRelationship strID & "-a", strID
			objX.AddNode strID & "-b", "title", rsData("title_" & Session("Language")).Value, 2
			objX.AddRelationship strID & "-b", strID
		
			rsData.MoveNext
		Loop

		rsdata.close
		set rsdata = nothing

		objDoc.loadXML objX.XML


%>
<!--#include virtual="/backoffice/inc/misc.asp"-->

<form action="usrmgrcmd.asp" method="post" id="SaveForm">

<fieldset><legend><%=DICLanguage(202)%>:</legend>

<table border="0" summary="<%=DICLanguage(37)%>"> 
  <tr>
    <td class="testotd"><label for="referente_nome"><%=DICLanguage(189)%>:</label></td>
    <td><input type="text" name="referente_nome" class="input-lungo" id="referente_nome" /></td>
  </tr>
  <tr>
    <td class="testotd"><label for="referente_email"><%=DICLanguage(237)%>:</label></td>
    <td><input type="text" name="referente_email" class="input-lungo" id="referente_email" /></td>
  </tr>
  <tr>
    <td class="testotd"><label for="userid"><%=DICLanguage(133)%>:</label></td>
    <td><input type="text" name="userid" class="input-lungo" id="userid" /></td>
  </tr>
  <tr>
    <td class="testotd"><label for="pwd"><%=DICLanguage(134)%>:</label></td>
    <td><input type="password" name="pwd" class="input-lungo" id="pwd" /></td>
  </tr>
  <tr>
    <td class="testotd"><label for="timeoutsessione"><%=DICLanguage(238)%>:</label></td>
    <td><input type="text" name="timeoutsessione" id="timeoutsessione" value="<%=Application("timeoutsessione")%>" /></td>
  </tr>
  <tr>
    <td class="testotd"><label for="language"><%=DICLanguage(243)%>:</label></td>
    <td><select name="language" id="language">
		<% 
		ExpSelectCond application("prefix") & "configurazione_lingue", "lingua_int", "codice", "order by lingua_int", Application("language")
		%>
		</select></td>
  </tr>
  <tr>
    <td class="testotd"><label for="areaid"><%=DICLanguage(163)%>:</label></td>
    <td><select name="areaid" id="areaid">
		<option value="0"><%=DICLanguage(207)%></option>
		<% 
		ExpSelectCond application("prefix") & "strutture", "title_" & Session("Language"), "id", "where parentid=0 order by title_" & Session("Language"), null
		%>
		</select></td>
  </tr>
  <tr>
    <td class="testotd"><label for="struttura"><%=DICLanguage(164)%>:</label></td>
    <td><select name="struttura" id="struttura">
		<option value="0"><%=DICLanguage(207)%></option>
		<%
		Call DisplayTree(objDoc.documentElement, 0, null)
		set objdoc = nothing
		%>
		</select></td>
  </tr>
  <tr>
    <td class="testotd"><label for="argoid"><%=DICLanguage(239)%>:</label></td>
    <td><select name="argoid" id="argoid">
		<option value="0"><%=DICLanguage(18)%></option>
		<%
			Set rs1 = Server.CreateObject("ADODB.Recordset")
			sql= "SELECT * FROM " & application("prefix") & "documenti where argomento=2 order by title_" & Session("Language")			
			rs1.Open sql,Conn, adOpenStatic, adLockOptimistic
			
			If rs1.EOF and rs1.BOF Then 
			
			else

				Do while NOT rs1.eof
					response.write estraicategorie(null,rs1("id"),rs1("title_" & Session("Language")))
					rs1.movenext
			    loop

			end if
		%>
		</select></td>
  </tr>
  <tr>
    <td class="testotd"><label for="visibile"><%=DICLanguage(240)%>:</label></td>
    <td><input type="checkbox" name="visibile" id="visibile" checked="checked" /> <%=DICLanguage(48)%></td>
  </tr>
</table>	
</fieldset>

<fieldset><legend><%=DICLanguage(359)%>:</legend>
 <table border="0" summary="<%=DICLanguage(37)%>"> 
  <tr>
    <td class="testotd"><label for="admin"><%=DICLanguage(360)%>:</label></td>
    <td><select name="admin" id="admin">
		<option value="1"><%=DICLanguage(241)%></option>
		<option value="2"><%=DICLanguage(361)%></option>
		<option value="5"><%=DICLanguage(367)%></option>
		<option value="4"><%=DICLanguage(362)%></option>
		<option value="3"><%=DICLanguage(363)%></option>
		</select>
	</td>
  </tr>
  <tr>
    <td class="testotd"><label for="reflanguage"><%=DICLanguage(368)%>:</label></td>
    <td><select name="reflanguage" id="reflanguage">
		<option value="" selected="selected"><%=DICLanguage(207)%></option>
		<% 
		ExpSelectCond application("prefix") & "configurazione_lingue", "lingua_int", "codice", "order by lingua_int", null
		%>
		</select></td>
  </tr>
  <tr>
    <td class="testotd"><%=DICLanguage(364)%>:</td>
    <td><%
	lingua = split(Application("DISP_LINGUE_BACKOFFICE"),",")
	conta = 0
	for j=LBound(lingua) to UBound(lingua)
	conta = conta + 1
	%>
	<input type="checkbox" name="editlanguage" id="editlanguage<%=conta%>"  value="<%=lingua(j)%>" /> <label for="editlanguage<%=conta%>"><%
	SQL = "SELECT * from " & application("prefix") & "configurazione_lingue where codice='" & lingua(j) & "'"
		SET rshtml = conn.execute(sql) 
		if rshtml.eof and rshtml.bof then%> 		
		<%=lingua(j)%>
		<%else%>
		<%=fixstring(rshtml("lingua_int"),"d")%>
		<%end if
		rshtml.close
		set rshtml = nothing
		%></label>&nbsp;
	<%next%>
</td>
  </tr>
  <tr>
    <td class="testotd"><label for="argomenti"><%=DICLanguage(22)%>:</label></td>
    <td><input type="checkbox" name="argomenti" id="argomenti" checked="checked" /> <%=DICLanguage(48)%></td>
  </tr>
  <tr>
    <td class="testotd"><label for="contenuti"><%=DICLanguage(79)%>:</label></td>
    <td><input type="checkbox" name="contenuti" id="contenuti" checked="checked" /> <%=DICLanguage(48)%></td>
  </tr>
  <tr>
    <td class="testotd"><label for="comunicati"><%=DICLanguage(64)%>:</label></td>
    <td><input type="checkbox" name="comunicati" id="comunicati" checked="checked" /> <%=DICLanguage(48)%></td>
  </tr>
  <tr>
    <td class="testotd"><label for="testi"><%=DICLanguage(182)%>:</label></td>
    <td><input type="checkbox" name="testi" id="testi" checked="checked" /> <%=DICLanguage(48)%></td>
  </tr>
  <tr>
    <td class="testotd"><label for="utenti"><%=DICLanguage(185)%>:</label></td>
    <td><input type="checkbox" name="utenti" id="utenti" checked="checked" /> <%=DICLanguage(48)%></td>
  </tr>
  <tr>
    <td class="testotd"><label for="manutenzione"><%=DICLanguage(242)%>:</label></td>
    <td><input type="checkbox" name="manutenzione" id="manutenzione" checked="checked" /> <%=DICLanguage(48)%></td>
  </tr>
</table>	
</fieldset>


<fieldset><legend><%=DICLanguage(20)%></legend>
 <p>
	<input type="hidden" id="LastPage" name="LastPage" value="<%=lastpage%>" class="bottone" />
	<input type="hidden" id="mnu" name="mnu" value="<%=request("mnu")%>" /> 
	<input type="hidden" id="submnu" name="submnu" value="<%=request("submnu")%>" />
	<input type="submit" id="Add" name="Add" value="<%=DICLanguage(21)%>"  class="bottone" />
	<input type="reset" id="Undo" name="Undo" value="<%=DICLanguage(77)%>" onclick="referente_nome.focus()" onkeypress="referente_nome.focus()"  class="bottone" />
	<input type="button" id="Back" name="Back" value="<%=DICLanguage(2)%>" onclick="history.back()" onkeypress="history.back()"  class="bottone"/>
 </p>
</fieldset>
</form>