<%@ page language="java" buffer="100kb" errorPage="/common/error.jsp"%>

<%@ page import="vkc.view.WebShare" %>
<%@ page import="vkc.view.TabId" %>
<%@ page import="org.apache.struts.Globals" %>

<%@ taglib uri="struts-html" 	prefix="html"  %>
<%@ taglib uri="struts-bean" 	prefix="bean"  %>
<%@ taglib uri="struts-logic" 	prefix="logic" %>
<%@ taglib uri="vkc-taglib" 	prefix="vkc"   %>

<vkc:checkLogin />
<vkc:init/>
<html:html locale="true">
<head>

  	<vkc:cssinclude />

    <meta http-equiv="content-type"  content="text/html; charset=iso-8859-1" />
    <script type="text/javascript" src="<vkc:rewrite page='/common/utils.js'/>"></script>
    
    <script type="text/javascript">
    
    window.name = "MAINVIEW";
    var aclform = null;
    var associatedTabId = <%=TabId.ADMIN_USERMANAGEMENT_TAB%>;
    	
    function init() {
      	var tabView = getTabView();
        var tabViewForm = tabView.document.forms[0];

        if (tabView && tabView.systemviewtype == "administrationview" && tabView.selectedTabId != associatedTabId) {
          	tabView.location.replace("<%=ctxPath%>/adminTabView.do?selectedTabId=<%=TabId.ADMIN_USERMANAGEMENT_TAB%>"
          						   + "&lastCategoryId=" + tabViewForm.lastCategoryId.value
          						   + "&lastFunctionalId=" + tabViewForm.lastFunctionalId.value
          						   + "&lastProjectId=" + tabViewForm.lastProjectId.value);
        }

        <logic:present name="<%=WebShare.INFO_KEY%>" scope="request">
          <bean:define id="msg" type="java.lang.String" scope="request" name="<%=WebShare.INFO_KEY%>"/>
          alert( '<vkc:message javascript="true" filter="false" key="<%=msg%>"/>' );
        </logic:present>
    }

    function openUserInfoWindow( id ) {
	    var w = 800;
	    var h = 600;
	    var leftPosition = screen.width/2  - w/2;
	    var topPosition  = screen.height/2 - h/2;
	    var settings ='height=' + h + ', width=' + w + ', top=' + topPosition + ', left=' + leftPosition;
	    settings += ',scrollbars=yes,resizable';
	    settings += ',toolbar=no, location=no, directories=no, status=true, menubar=no';
	    var win = window.open( '<vkc:rewrite page="/displayUserInfo.do"/>?userId=' + id, 'USERINFO_MAINVIEW', settings );
		win.focus();                              
	}
    
    </script>
</head>
<body onload="init();" topmargin="0" marginheight="0">

<table align="center" cellspacing="1" cellpadding="5" border="0">

  <html:form action="/changeCreatorPublishership" method="post">

  <bean:define id="form" name="changeCreatorPublishershipForm" scope="request" type="vkc.administration.form.ChangeCreatorPublishershipForm"/>
  <bean:define id="user" name="form" property="user" type="vkc.db.entities.VKCUser"/>
  
  <html:hidden name="form" property="userId" />
  <html:hidden name="form" property="redirect"/>

  <tr>
    <td align="center">

	  <table width="1%" align="center" cellpadding="0" cellspacing="5" border="0">
        <logic:present name="<%=Globals.ERROR_KEY%>">
        <tr>
          <td align="left" nowrap="nowrap" colspan="2"><font color="red"><b><vkc:errors/></b></font></td>
        </tr>
        </logic:present>

        <logic:present name="<%=Globals.MESSAGE_KEY%>">
        <tr>            
          <html:messages id="message" message="true">
		    <td align="left" nowrap="nowrap" colspan="2"><font color="green"><b><vkc:write name="message"/></b></font></td>
		  </html:messages>
		</tr>
        </logic:present>
		
        <tr>
		  <td colspan="2">
            <b><vkc:message key="vkc.administration.changecreatorpublishership" /></b> 		  
   	      </td>
		</tr>		
			
		<vkc:hline colspan="2" lineClass="hline" lineHeight="1" topSpace="5" bottomSpace="5"/>
		
		<tr>
		  <td nowrap>
		      <b><vkc:message key="vkc.administration.changecreatorpublishership.old" />:</b> 		  
    	  </td>
		  <td nowrap>
              <vkc:write name="form" property="oldPublisherLastnameLabel"/> 		  
		  </td>
		</tr>		
		
		<tr>
		  <td>&nbsp;</td>
		</tr>
		
		<logic:notEmpty name="form" property="userQuota">
	      <bean:define id="userQuota" name="form" property="userQuota" />
	      <td><b><vkc:message key="vkc.administration.used.quota" />:</b></td>
	      <td><vkc:write name="userQuota" property="usedQuotaInMegaByteString"/>MB
	        <logic:notEmpty name="userQuota" property="usedQuotaInPercentString">
	        [ <vkc:write name="userQuota" property="usedQuotaInPercentString"/> ]
	        </logic:notEmpty>
	      </td>
        </logic:notEmpty>

		<tr>
		  <td nowrap>
		      <b><vkc:message key="vkc.administration.quota.published.docs" />:</b> 		  
  	      </td>
		  <td nowrap>
		      <vkc:write name="form" property="userStatistics.numPublishedDocuments" />
		  </td>
		</tr>		

		<tr>
		  <td nowrap>
		      <b><vkc:message key="vkc.administration.quota.published.cats" />:</b> 		  
  	      </td>
		  <td nowrap>
		      <vkc:write name="form" property="userStatistics.numCreatedCategories" />		        
		  </td>
		</tr>		

		<vkc:hline colspan="2" lineClass="hline" lineHeight="1" topSpace="5" bottomSpace="5"/>
		
        <tr>
		  <td nowrap>
		      <b><vkc:message key="vkc.administration.changecreatorpublishership.new" />:</b> 		  
  	      </td>
		  <td>
            <bean:define id="publisherInfo" name="form" property="newPublisherList" type="java.util.List"/>
            <html:select name="form" property="selectedNewPublisherId" size="1">
              <vkc:options collection="publisherInfo" property="userId" labelProperty="lastnameLabel"/>
            </html:select>          
          </td>        
        </tr>
        
		<vkc:hline colspan="2" lineClass="hline" lineHeight="1" topSpace="5" bottomSpace="5"/>
        
		<tr>
          <td align="center" colspan="2">
            <table align="center" cellpadding="0" cellspacing="5" border="0">
              <tr>
                <td><vkc:button property="action.change.publisher" onclick="javascript:disableAllButtonsAndSubmit(this);"><vkc:message key="vkc.administration.button.changePublisher"/></vkc:button></td>
                <td><vkc:button property="action.back" onclick="javascript:disableAllButtonsAndSubmit(this);"><vkc:message key="button.back"/></vkc:button></td>
              </tr>
            </table>    
          </td>
        </tr>
	  </table>
    </td>
  </tr>
  </html:form>
</table>
</body>
</html:html>