<%@ page language="java" buffer="100kb" %>

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

<%@ page import="vkc.db.entities.VKCCategory" %>

<vkc:init/>

<script type="text/javascript">

    function changeProcessId(id) {
        var form = document.forms[0];
        form.selectedId.value = id;

        if (form.action.indexOf('?') == -1) {
          form.action = form.action + "?action.change.processid=true";
        } else {
          form.action = form.action + "&action.change.processid=true";
        }

        form.submit();
    }

    function changeCheckerId(id) {
        var form = document.forms[0];
        form.selectedId.value = id;

        if (form.action.indexOf('?') == -1) {
          form.action = form.action + "?action.change.checkerid=true";
        } else {
          form.action = form.action + "&action.change.checkerid=true";
        }

        form.submit();
    }

    function insertStep(elem, id) {
        var form = document.forms[0];
        form.selectedId.value = id;

        if (form.action.indexOf('?') == -1) {
          form.action = form.action + "?action.new.step=true";
        } else {
          form.action = form.action + "&action.new.step=true";
        }

        disableAllButtons(elem);
        form.submit();
    }

    function confirmCloseProject(elem) {
        if (confirm('<vkc:message javascript="true" filter="false" key="vkc.string.confirm.close.project"/>')) {
            var form = document.forms[0]
            disableAllButtons(elem);
            form.submit();
        }
    }

    function confirmActivateProject(elem) {
        if (confirm('<vkc:message javascript="true" filter="false" key="vkc.string.confirm.activate.project"/>')) {
            var form = document.forms[0];
            disableAllButtons(elem);
            form.submit();
        }
    }

    function confirmFinalizeProject(elem) {
        if (confirm('<vkc:message javascript="true" filter="false" key="vkc.string.confirm.finalize.project"/>')) {
            var form = document.forms[0];
            disableAllButtons(elem);
            form.submit();
        }
    }
</script>

<table cellpadding="0" cellspacing="0" border="0" width="100%">

  <bean:define id="form"  name="form" scope="request" type="vkc.procoba.project.ProjectViewForm"/>
  <bean:define id="steps" name="form" property="projectSteps" type="java.util.List"/>

  <html:hidden property="viewMode"    name="form"/>
  <html:hidden property="uniqueId"    name="form"/>

  <logic:iterate id="pid" name="form" property="changedStepProcessedIds" type="java.lang.Integer">
    <html:hidden property="changedStepProcessedIds" name="form" value='<%=String.valueOf(pid.toString())%>'/>
  </logic:iterate>
  <logic:iterate id="cid" name="form" property="changedStepCheckedIds" type="java.lang.Integer">
    <html:hidden property="changedStepCheckedIds" name="form" value='<%=String.valueOf(cid.toString())%>'/>
  </logic:iterate>

  <logic:iterate id="projectStepInfo" name="form" property="projectStepInfos" type="vkc.view.bean.NewProjectStepInfo">
    <logic:notEmpty name="projectStepInfo">
    <html:hidden property="catProjStepId" name="projectStepInfo" indexed="true"/>
    <html:hidden property="categoryId"    name="projectStepInfo" indexed="true"/>
    <vkc:hidden property="activity"      name="projectStepInfo" indexed="true"/>
    <html:hidden property="selected"      name="projectStepInfo" indexed="true"/>
    <html:hidden property="enabled"       name="projectStepInfo" indexed="true"/>
    <html:hidden property="startDate"     name="projectStepInfo" indexed="true"/>
    <html:hidden property="endDate"       name="projectStepInfo" indexed="true"/>
    <html:hidden property="step"          name="projectStepInfo" indexed="true"/>
    <html:hidden property="processorId"   name="projectStepInfo" indexed="true"/>
    <html:hidden property="processedTS"   name="projectStepInfo" indexed="true"/>
    <html:hidden property="checkerId"     name="projectStepInfo" indexed="true"/>
    <html:hidden property="checkedTS"     name="projectStepInfo" indexed="true"/>
    </logic:notEmpty>
  </logic:iterate>

  <tr>
    <td align="left" width="100%" class="color_toolbar" colspan="1">
      <table cellpadding="0" cellspacing="5" width="100%">
        <tr><td align="left"><b><vkc:message key="project.label.edit.steps"/>:</b></td></tr>
      </table>
    </td>
  </tr>

  <tr><td background="<vkc:rewrite page='/templates/${template.name}/gfx/dotted-line-h.gif'/>"><vkc:img page="/templates/${template.name}/procoba/images/void.gif" alt="" width="1" height="1"/></td></tr>

  <logic:empty name="steps">
    <tr>
      <td width="100%">
        <table cellpadding="0" cellspacing="5" border="0" width="100%">
          <tr><td align="left"><vkc:message key="project.info.no.steps"/></td></tr>
          <logic:notEqual value="<%=VKCCategory.FLAG_CLOSED.toString()%>" name="form" property="project.flag">

          <logic:equal name="form" property="userIsLeader" value="true">
          <tr><td align="left"><vkc:button property="action.new.step" onclick='<%= String.valueOf( "javascript:insertStep(this, 1);" )%>'><vkc:message key="vkc.projectmgmt.create.button.newStep"/></vkc:button></td></tr>
          <vkc:hline lineHeight="1" lineClass="hline" colspan="1" topSpace="0" bottomSpace="5" />
          <tr>
            <td align="center" width="100%">
              <logic:notEmpty name="form" property="project.projectSteps">
              <vkc:button property="action.save.edit.steps" onclick="javascript:disableAllButtonsAndSubmit(this);"><vkc:message key="project.label.save" /></vkc:button>
              </logic:notEmpty>
              <vkc:button property="action.close.project" onclick="confirmCloseProject(this);"><vkc:message key="project.label.close" /></vkc:button>
              <vkc:button property="action.back.to.subfolder" onclick="javascript:disableAllButtonsAndSubmit(this);"><vkc:message key="button.back"/></vkc:button>
            </td>
          </tr>
          </logic:equal>

          <logic:equal name="form" property="userIsLeader" value="false">
          <vkc:hline lineHeight="1" lineClass="hline" colspan="1" topSpace="0" bottomSpace="5"/>
          <tr>
            <td align="center" width="100%">
              <vkc:button property="action.back.to.subfolder" onclick="javascript:disableAllButtonsAndSubmit(this);"><vkc:message key="button.back"/></vkc:button>
            </td>
          </tr>
          </logic:equal>

          </logic:notEqual>

          <logic:equal value="<%=VKCCategory.FLAG_CLOSED.toString()%>" name="form" property="project.flag">
          <vkc:hline lineHeight="1" lineClass="hline" colspan="1" topSpace="0" bottomSpace="5"/>
          <tr>
            <td align="center" width="100%">
              <logic:equal name="form" property="userIsLeader" value="true">
              <vkc:button property="action.activate.project" onclick="confirmActivateProject(this);"><vkc:message key="project.label.activate"/></vkc:button>
              </logic:equal>
              <vkc:button property="action.back.to.subfolder" onclick="javascript:disableAllButtonsAndSubmit(this);"><vkc:message key="button.back"/></vkc:button>
            </td>
          </tr>
          </logic:equal>
        </table>
      </td>
    </tr>
  </logic:empty>


  <logic:notEmpty name="steps">
    <logic:notEqual value="<%=VKCCategory.FLAG_CLOSED.toString()%>" name="form" property="project.flag">

    <logic:equal name="form" property="userIsLeader" value="false">
    <logic:equal name="form" property="userHasWritePermission" value="true">
    <tr>
      <td colspan="1" nowrap="nowrap" width="100%" align="left">
        <table cellspacing="5" cellpadding="0" border="0" width="100%">
          <tr>
            <td width="100%" align="left">
              <table width="100%" cellSpacing="1" cellPadding="2" border="0" class="tableLineColor">
                <tr>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.step"/></b></td>
                  <td class="headerUnselected" align=left width="100%" nowrap><b><vkc:message key="project.label.edit.steps.activity"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.startDate"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.endDate"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.state"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.processed"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.processor"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.processedAt"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.checked"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.checker"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.checkedAt"/></b></td>
                </tr>

                <logic:iterate id="step" indexId="index" name="steps" type="vkc.db.entities.VKCCatProjectStep">
                <logic:equal name="step" property="stepRunning" value="true">
                  <tr>
                    <td class='columnUnselected' align=center nowrap>
                      <b><vkc:write name="step" property="step"/></b>
                    </td>
                    <td class='columnUnselected' align=left width="100%" nowrap>
                      <b><vkc:write name="step" property="activity"/></b>
                    </td>
                    <td class='columnUnselected' align=center nowrap>
                      <b><vkc:write name="step" property="startDateString"/></b>
                    </td>
                    <td class='columnUnselected' align=center nowrap>
                      <b><vkc:write name="step" property="endDateString"/></b>
                    </td>
                    <td class='columnUnselected' align=center nowrap>
                      <b><vkc:message key="project.label.edit.steps.state.running"/></b>
                    </td>
                    <td class='columnUnselected' align=center nowrap><b>
                      <html:multibox name="form" property="selectedStepProcessedIds" onclick='<%= String.valueOf( "javascript:changeProcessId(" + step.getCatProjStepId().intValue() + ");")%>'>
                        <vkc:write name="step" property="catProjStepId"/>
                      </html:multibox></b>
                    </td>
                    <td class='columnUnselected' align=center nowrap>
                      <logic:equal name="form" property='<%= String.valueOf( "changedProcessId[" + step.getCatProjStepId() + "]" ) %>' value="true">
                        <logic:equal name="form" property='<%= String.valueOf( "selectedProcessId[" + step.getCatProjStepId() + "]" ) %>' value="true">
                          <bean:define id="processor" name="form" property="userInfo" type="vkc.view.bean.UserInfo"/>
                          <bean:define id="processorId" name="processor" property="userId" type="java.lang.Integer"/>
                          <bean:define id="usernameLabel" name="processor" property="lastnameLabel" type="java.lang.String"/>
                          <vkc:link href='<%= String.valueOf( "javascript:openUserInfoWindow(" + processorId.intValue() + ");" )%>' title='<%=usernameLabel%>'>
                            <span style="text-decoration:underline"><vkc:write name="processor" property="username"/></span>
                          </vkc:link>
                        </logic:equal>
                        <logic:equal name="form" property='<%= String.valueOf( "selectedProcessId[" + step.getCatProjStepId() + "]" ) %>' value="false">
                          &nbsp;
                        </logic:equal>
                      </logic:equal>
                      <logic:equal name="form" property='<%= String.valueOf( "changedProcessId[" + step.getCatProjStepId() + "]" ) %>' value="false">
                        <logic:notEmpty name="step" property="processor">
                          <bean:define id="processor" name="step" property="processor" type="vkc.view.bean.UserInfo"/>
                          <bean:define id="processorId" name="processor" property="userId" type="java.lang.Integer"/>
                          <bean:define id="usernameLabel" name="processor" property="lastnameLabel" type="java.lang.String"/>
                          <vkc:link href='<%= String.valueOf( "javascript:openUserInfoWindow(" + processorId.intValue() + ");" )%>' title='<%=usernameLabel%>'>
                            <span style="text-decoration:underline"><vkc:write name="processor" property="username"/></span>
                          </vkc:link>
                        </logic:notEmpty>
                        <logic:empty name="step" property="processor">
                          &nbsp;
                        </logic:empty>
                      </logic:equal>
                    </td>
                    <td class='columnUnselected' align=center nowrap>
                      <logic:equal name="form" property='<%= String.valueOf( "changedProcessId[" + step.getCatProjStepId() + "]" ) %>' value="true">
                        <logic:equal name="form" property='<%= String.valueOf( "selectedProcessId[" + step.getCatProjStepId() + "]" ) %>' value="true">
                          <bean:define id="processedTS" name="form" property="currentTimeString" type="java.lang.String"/>
                          <vkc:write name="processedTS"/>
                        </logic:equal>
                        <logic:equal name="form" property='<%= String.valueOf( "selectedProcessId[" + step.getCatProjStepId() + "]" ) %>' value="false">
                          &nbsp;
                        </logic:equal>
                      </logic:equal>
                      <logic:equal name="form" property='<%= String.valueOf( "changedProcessId[" + step.getCatProjStepId() + "]" ) %>' value="false">
                        <logic:notEmpty name="step" property="processedTSString">
                          <bean:define id="processedTS" name="step" property="processedTSString" type="java.lang.String"/>
                          <vkc:write name="processedTS"/>
                        </logic:notEmpty>
                        <logic:empty name="step" property="processedTSString">
                          &nbsp;
                        </logic:empty>
                      </logic:equal>
                    </td>
                    <td class='columnSelected' align=center nowrap><b>
                      <logic:equal name="step" property="checked" value="true">
                        <html:hidden property="selectedStepCheckedIds" name="form" value='<%=String.valueOf(step.getCatProjStepId().toString())%>'/>
                      </logic:equal>
                      <html:multibox name="form" property="selectedStepCheckedIds" disabled="true">
                        <vkc:write name="step" property="catProjStepId"/>
                      </html:multibox></b>
                    </td>
                    <td class='columnSelected' align=center nowrap>
                      <logic:notEmpty name="step" property="checker">
                      <bean:define id="checker" name="step" property="checker" type="vkc.view.bean.UserInfo"/>
                      <bean:define id="checkerId" name="checker" property="userId" type="java.lang.Integer"/>
                      <bean:define id="usernameLabel" name="checker" property="lastnameLabel" type="java.lang.String"/>
                      <vkc:link href='<%= String.valueOf( "javascript:openUserInfoWindow(" + checkerId.intValue() + ");" )%>' title='<%=usernameLabel%>'>
                        <span style="text-decoration:underline"><vkc:write name="checker" property="username"/></span>
                      </vkc:link>
                      </logic:notEmpty>
                      <logic:empty name="step" property="checker">
                        &nbsp;
                      </logic:empty>
                    </td>
                    <td class='columnSelected' align=center nowrap>
                      <logic:notEmpty name="step" property="checkedTSString">
                      <bean:define id="checkedTS" name="step" property="checkedTSString" type="java.lang.String"/>
                        <vkc:write name="checkedTS"/>
                      </logic:notEmpty>
                      <logic:empty name="step" property="checkedTSString">
                        &nbsp;
                      </logic:empty>
                    </td>
                  </tr>
                </logic:equal>

                <logic:equal name="step" property="stepRunning" value="false">
                  <tr>
                    <td class='columnSelected' align=center nowrap>
                      <b><vkc:write name="step" property="step"/></b>
                    </td>
                    <td class='columnSelected' align=left width="100%" nowrap>
                      <b><vkc:write name="step" property="activity"/></b>
                    </td>
                    <td class='columnSelected' align=center nowrap>
                      <b><vkc:write name="step" property="startDateString"/></b>
                    </td>
                    <td class='columnSelected' align=center nowrap>
                      <b><vkc:write name="step" property="endDateString"/></b>
                    </td>
                    <logic:equal name="step" property="stepProcessed" value="true">
                    <td class='columnSelected' align=center nowrap>
                      <b><vkc:message key="project.label.edit.steps.state.processed"/></b>
                    </td>
                    </logic:equal>
                    <logic:equal name="step" property="stepChecked" value="true">
                    <td class='columnSelected' align=center nowrap>
                      <b><vkc:message key="project.label.edit.steps.state.checked"/></b>
                    </td>
                    </logic:equal>
                    <logic:equal name="step" property="enabled" value="false">
                    <td class='columnSelected' align=center nowrap>
                      <b><vkc:message key="project.label.edit.steps.state.disabled"/></b>
                    </td>
                    </logic:equal>
                    <td class='columnSelected' align=center nowrap><b>
                      <logic:equal name="step" property="processed" value="true">
                        <html:hidden property="selectedStepProcessedIds" name="form" value='<%=String.valueOf(step.getCatProjStepId().toString())%>'/>
                      </logic:equal>
                      <html:multibox name="form" property="selectedStepProcessedIds" disabled="true">
                        <vkc:write name="step" property="catProjStepId"/>
                      </html:multibox></b>
                    </td>
                    <td class='columnSelected' align=center nowrap>
                      <logic:notEmpty name="step" property="processor">
                        <bean:define id="processor" name="step" property="processor" type="vkc.view.bean.UserInfo"/>
                        <bean:define id="processorId" name="processor" property="userId" type="java.lang.Integer"/>
                        <bean:define id="usernameLabel" name="processor" property="lastnameLabel" type="java.lang.String"/>
                        <vkc:link href='<%= String.valueOf( "javascript:openUserInfoWindow(" + processorId.intValue() + ");" )%>' title='<%=usernameLabel%>'>
                          <span style="text-decoration:underline"><vkc:write name="processor" property="username"/></span>
                        </vkc:link>
                      </logic:notEmpty>
                      <logic:empty name="step" property="processor">
                        &nbsp;
                      </logic:empty>
                    </td>
                    <td class='columnSelected' align=center nowrap>
                      <logic:notEmpty name="step" property="processedTSString">
                        <bean:define id="processedTS" name="step" property="processedTSString" type="java.lang.String"/>
                        <vkc:write name="processedTS"/>
                      </logic:notEmpty>
                      <logic:empty name="step" property="processedTSString">
                        &nbsp;
                      </logic:empty>
                    </td>
                    <td class='columnSelected' align=center nowrap><b>
                      <logic:equal name="step" property="checked" value="true">
                        <html:hidden property="selectedStepCheckedIds" name="form" value='<%=String.valueOf(step.getCatProjStepId().toString())%>'/>
                      </logic:equal>
                      <html:multibox name="form" property="selectedStepCheckedIds" disabled="true">
                        <vkc:write name="step" property="catProjStepId"/>
                      </html:multibox></b>
                    </td>
                    <td class='columnSelected' align=center nowrap>
                      <logic:notEmpty name="step" property="checker">
                      <bean:define id="checker" name="step" property="checker" type="vkc.view.bean.UserInfo"/>
                      <bean:define id="checkerId" name="checker" property="userId" type="java.lang.Integer"/>
                      <bean:define id="usernameLabel" name="checker" property="lastnameLabel" type="java.lang.String"/>
                      <vkc:link href='<%= String.valueOf( "javascript:openUserInfoWindow(" + checkerId.intValue() + ");" )%>' title='<%=usernameLabel%>'>
                        <span style="text-decoration:underline"><vkc:write name="checker" property="username"/></span>
                      </vkc:link>
                      </logic:notEmpty>
                      <logic:empty name="step" property="checker">
                        &nbsp;
                      </logic:empty>
                    </td>
                    <td class='columnSelected' align=center nowrap>
                      <logic:notEmpty name="step" property="checkedTSString">
                      <bean:define id="checkedTS" name="step" property="checkedTSString" type="java.lang.String"/>
                        <vkc:write name="checkedTS"/>
                      </logic:notEmpty>
                      <logic:empty name="step" property="checkedTSString">
                        &nbsp;
                      </logic:empty>
                    </td>
                  </tr>
                </logic:equal>
                </logic:iterate>
              </table>
            </td>
          </tr>
        </table>
      </td>
    </tr>
    </logic:equal>

    <logic:equal name="form" property="userHasWritePermission" value="false">
    <logic:equal name="form" property="userIsMember" value="true">
    <tr>
      <td colspan="1" nowrap="nowrap" width="100%" align="left">
        <table cellspacing="5" cellpadding="0" border="0" width="100%">
          <tr>
            <td width="100%" align="left">
              <table width="100%" cellSpacing="1" cellPadding="2" border="0" class="tableLineColor">
                <tr>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.step"/></b></td>
                  <td class="headerUnselected" align=left width="100%" nowrap><b><vkc:message key="project.label.edit.steps.activity"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.startDate"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.endDate"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.state"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.processed"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.processor"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.processedAt"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.checked"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.checker"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.checkedAt"/></b></td>
                </tr>

                <logic:iterate id="step" indexId="index" name="steps" type="vkc.db.entities.VKCCatProjectStep">
                  <tr>
                    <td class='columnSelected' align=center nowrap>
                      <b><vkc:write name="step" property="step"/></b>
                    </td>
                    <td class='columnSelected' align=left width="100%" nowrap>
                      <b><vkc:write name="step" property="activity"/></b>
                    </td>
                    <td class='columnSelected' align=center nowrap>
                      <b><vkc:write name="step" property="startDateString"/></b>
                    </td>
                    <td class='columnSelected' align=center nowrap>
                      <b><vkc:write name="step" property="endDateString"/></b>
                    </td>
                    <logic:equal name="step" property="stepRunning" value="true">
                    <td class='columnSelected' align=center nowrap>
                      <b><vkc:message key="project.label.edit.steps.state.running"/></b>
                    </td>
                    </logic:equal>
                    <logic:equal name="step" property="stepRunning" value="false">
                    <logic:equal name="step" property="stepProcessed" value="true">
                    <td class='columnSelected' align=center nowrap>
                      <b><vkc:message key="project.label.edit.steps.state.processed"/></b>
                    </td>
                    </logic:equal>
                    <logic:equal name="step" property="stepChecked" value="true">
                    <td class='columnSelected' align=center nowrap>
                      <b><vkc:message key="project.label.edit.steps.state.checked"/></b>
                    </td>
                    </logic:equal>
                    <logic:equal name="step" property="enabled" value="false">
                    <td class='columnSelected' align=center nowrap>
                      <b><vkc:message key="project.label.edit.steps.state.disabled"/></b>
                    </td>
                    </logic:equal>
                    </logic:equal>
                    <td class='columnSelected' align=center nowrap><b>
                      <logic:equal name="step" property="processed" value="true">
                        <html:hidden property="selectedStepProcessedIds" name="form" value='<%=String.valueOf(step.getCatProjStepId().toString())%>'/>
                      </logic:equal>
                      <html:multibox name="form" property="selectedStepProcessedIds" disabled="true">
                        <vkc:write name="step" property="catProjStepId"/>
                      </html:multibox></b>
                    </td>
                    <td class='columnSelected' align=center nowrap>
                      <logic:notEmpty name="step" property="processor">
                        <bean:define id="processor" name="step" property="processor" type="vkc.view.bean.UserInfo"/>
                        <bean:define id="processorId" name="processor" property="userId" type="java.lang.Integer"/>
                        <bean:define id="usernameLabel" name="processor" property="lastnameLabel" type="java.lang.String"/>
                        <vkc:link href='<%= String.valueOf( "javascript:openUserInfoWindow(" + processorId.intValue() + ");" )%>' title='<%=usernameLabel%>'>
                          <span style="text-decoration:underline"><vkc:write name="processor" property="username"/></span>
                        </vkc:link>
                      </logic:notEmpty>
                      <logic:empty name="step" property="processor">
                        &nbsp;
                      </logic:empty>
                    </td>
                    <td class='columnSelected' align=center nowrap>
                      <logic:notEmpty name="step" property="processedTSString">
                        <bean:define id="processedTS" name="step" property="processedTSString" type="java.lang.String"/>
                        <vkc:write name="processedTS"/>
                      </logic:notEmpty>
                      <logic:empty name="step" property="processedTSString">
                        &nbsp;
                      </logic:empty>
                    </td>
                    <td class='columnSelected' align=center nowrap><b>
                      <logic:equal name="step" property="checked" value="true">
                        <html:hidden property="selectedStepCheckedIds" name="form" value='<%=String.valueOf(step.getCatProjStepId().toString())%>'/>
                      </logic:equal>
                      <html:multibox name="form" property="selectedStepCheckedIds" disabled="true">
                        <vkc:write name="step" property="catProjStepId"/>
                      </html:multibox></b>
                    </td>
                    <td class='columnSelected' align=center nowrap>
                      <logic:notEmpty name="step" property="checker">
                      <bean:define id="checker" name="step" property="checker" type="vkc.view.bean.UserInfo"/>
                      <bean:define id="checkerId" name="checker" property="userId" type="java.lang.Integer"/>
                      <bean:define id="usernameLabel" name="checker" property="lastnameLabel" type="java.lang.String"/>
                      <vkc:link href='<%= String.valueOf( "javascript:openUserInfoWindow(" + checkerId.intValue() + ");" )%>' title='<%=usernameLabel%>'>
                        <span style="text-decoration:underline"><vkc:write name="checker" property="username"/></span>
                      </vkc:link>
                      </logic:notEmpty>
                      <logic:empty name="step" property="checker">
                        &nbsp;
                      </logic:empty>
                    </td>
                    <td class='columnSelected' align=center nowrap>
                      <logic:notEmpty name="step" property="checkedTSString">
                      <bean:define id="checkedTS" name="step" property="checkedTSString" type="java.lang.String"/>
                        <vkc:write name="checkedTS"/>
                      </logic:notEmpty>
                      <logic:empty name="step" property="checkedTSString">
                        &nbsp;
                      </logic:empty>
                    </td>
                  </tr>
                </logic:iterate>
              </table>
            </td>
          </tr>
        </table>
      </td>
    </tr>
    </logic:equal>
    </logic:equal>

    </logic:equal>

    <logic:equal name="form" property="userIsLeader" value="true">
    <tr>
      <td colspan="1" nowrap="nowrap" width="100%" align="left">
        <table cellspacing="5" cellpadding="0" border="0" width="100%">
          <tr>
            <td width="100%" align="left">
              <table width="100%" cellSpacing=1 cellPadding=2 border=0 class="tableLineColor">
                <tr>
                  <td class="headerUnselected" align=center nowrap>&nbsp;</td>
                  <td class="headerUnselected" align=center nowrap>&nbsp;</td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.enabled"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.step"/></b></td>
                  <td class="headerUnselected" align=left width="100%" nowrap><b><vkc:message key="project.label.edit.steps.activity"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.startDate"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.endDate"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.processed"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.processor"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.processedAt"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.checked"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.checker"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.checkedAt"/></b></td>
                </tr>

                <logic:iterate id="step" indexId="index" name="steps" type="vkc.db.entities.VKCCatProjectStep">
                <bean:define id="stepIndex" name="step" property="step" type="java.lang.Integer"/>
                <tr>
                  <td class='columnSelected' align=center nowrap><b>
                    <html:multibox name="form" property="selectedStepDeleteIds">
                      <vkc:write name="step" property="catProjStepId"/>
                    </html:multibox></b>
                  </td>
                  <td class='columnSelected' align=center nowrap><b>
                    <table>
                      <tr><td valign="top"><vkc:link href='<%= String.valueOf( "javascript:insertStep(this, " + stepIndex + ");" )%>' titleKey="vkc.tooltip.insert.step.above"><vkc:img border="0" page="/templates/${template.name}/gfx/insert-step-above.gif" alt=""/></vkc:link></td></tr>
                      <vkc:hline lineHeight="1" lineClass="hline" colspan="1" topSpace="0" bottomSpace="0" />
                      <tr><td valign="bottom"><vkc:link href='<%= String.valueOf( "javascript:insertStep(this, " + ( stepIndex.intValue() + 1 ) + ");" )%>' titleKey="vkc.tooltip.insert.step.below"><vkc:img border="0" page="/templates/${template.name}/gfx/insert-step-below.gif" alt=""/></vkc:link></td></tr>
                    </table>
                  </td>
                  <td class='columnUnselected' align=center nowrap><b>
                    <html:multibox name="form" property="selectedStepEnabledIds">
                      <vkc:write name="step" property="catProjStepId"/>
                    </html:multibox></b>
                  </td>
                  <td class='columnUnselected' align=center nowrap>
                    <b><vkc:write name="step" property="step"/></b>
                  </td>
                  <td class='columnUnselected' align=left width="100%" nowrap>
                    <vkc:text name="form" property='<%= String.valueOf( "dynaValue(activityId_" + step.getCatProjStepId() + ")" )%>' style="width:100%"/>
                  </td>
                  <td class='columnUnselected' align=center nowrap>
                    <table cellspacing="0" cellspacing="0" border="0">
                      <tr>
                        <td><html:text name="form" property='<%= String.valueOf( "dynaValue(startdateId_" + step.getCatProjStepId() + ")" )%>' maxlength="10" size="10" styleClass="dateField"/></td>
                        <td><vkc:calendarbutton buttonName='<%= String.valueOf( "btn_dynaValue(startdateId_" + step.getCatProjStepId() + ")" )%>'/></td>
                         </tr>
                    </table>
                  </td>
                  <td class='columnUnselected' align=center nowrap>
                    <table cellspacing="0" cellspacing="0" border="0">
                      <tr>
                        <td><html:text name="form" property='<%= String.valueOf( "dynaValue(enddateId_" + step.getCatProjStepId() + ")" )%>' maxlength="10" size="10" styleClass="dateField"/></td>
                        <td><vkc:calendarbutton buttonName='<%= String.valueOf( "btn_dynaValue(enddateId_" + step.getCatProjStepId() + ")" )%>'/></td>
                         </tr>
                    </table>
                  </td>
                  <td class='columnUnselected' align=center nowrap><b>
                    <html:multibox name="form" property="selectedStepProcessedIds" onclick='<%= String.valueOf( "javascript:changeProcessId(" + step.getCatProjStepId().intValue() + ");")%>'>
                      <vkc:write name="step" property="catProjStepId"/>
                    </html:multibox></b>
                  </td>
                  <td class='columnUnselected' align=center nowrap>
                    <logic:equal name="form" property='<%= String.valueOf( "changedProcessId[" + step.getCatProjStepId() + "]" ) %>' value="true">
                      <logic:equal name="form" property='<%= String.valueOf( "selectedProcessId[" + step.getCatProjStepId() + "]" ) %>' value="true">
                        <bean:define id="processor" name="form" property="userInfo" type="vkc.view.bean.UserInfo"/>
                        <bean:define id="processorId" name="processor" property="userId" type="java.lang.Integer"/>
                        <bean:define id="usernameLabel" name="processor" property="lastnameLabel" type="java.lang.String"/>
                        <vkc:link href='<%= String.valueOf( "javascript:openUserInfoWindow(" + processorId.intValue() + ");" )%>' title='<%=usernameLabel%>'>
                          <span style="text-decoration:underline"><vkc:write name="processor" property="username"/></span>
                        </vkc:link>
                      </logic:equal>
                      <logic:equal name="form" property='<%= String.valueOf( "selectedProcessId[" + step.getCatProjStepId() + "]" ) %>' value="false">
                        &nbsp;
                      </logic:equal>
                    </logic:equal>
                    <logic:equal name="form" property='<%= String.valueOf( "changedProcessId[" + step.getCatProjStepId() + "]" ) %>' value="false">
                      <logic:notEmpty name="step" property="processor">
                        <bean:define id="processor" name="step" property="processor" type="vkc.view.bean.UserInfo"/>
                        <bean:define id="processorId" name="processor" property="userId" type="java.lang.Integer"/>
                        <bean:define id="usernameLabel" name="processor" property="lastnameLabel" type="java.lang.String"/>
                        <vkc:link href='<%= String.valueOf( "javascript:openUserInfoWindow(" + processorId.intValue() + ");" )%>' title='<%=usernameLabel%>'>
                          <span style="text-decoration:underline"><vkc:write name="processor" property="username"/></span>
                        </vkc:link>
                      </logic:notEmpty>
                      <logic:empty name="step" property="processor">
                        &nbsp;
                      </logic:empty>
                    </logic:equal>
                  </td>
                  <td class='columnUnselected' align=center nowrap>
                    <logic:equal name="form" property='<%= String.valueOf( "changedProcessId[" + step.getCatProjStepId() + "]" ) %>' value="true">
                      <logic:equal name="form" property='<%= String.valueOf( "selectedProcessId[" + step.getCatProjStepId() + "]" ) %>' value="true">
                        <bean:define id="processedTS" name="form" property="currentTimeString" type="java.lang.String"/>
                        <vkc:write name="processedTS"/>
                      </logic:equal>
                      <logic:equal name="form" property='<%= String.valueOf( "selectedProcessId[" + step.getCatProjStepId() + "]" ) %>' value="false">
                        &nbsp;
                      </logic:equal>
                    </logic:equal>
                    <logic:equal name="form" property='<%= String.valueOf( "changedProcessId[" + step.getCatProjStepId() + "]" ) %>' value="false">
                      <logic:notEmpty name="step" property="processedTSString">
                        <bean:define id="processedTS" name="step" property="processedTSString" type="java.lang.String"/>
                        <vkc:write name="processedTS"/>
                      </logic:notEmpty>
                      <logic:empty name="step" property="processedTSString">
                        &nbsp;
                      </logic:empty>
                    </logic:equal>
                  </td>
                  <td class='columnUnselected' align=center nowrap><b>
                    <html:multibox name="form" property="selectedStepCheckedIds" onclick='<%= String.valueOf( "javascript:changeCheckerId(" + step.getCatProjStepId().intValue() + ");")%>'>
                      <vkc:write name="step" property="catProjStepId"/>
                    </html:multibox></b>
                  </td>
                  <td class='columnUnselected' align=center nowrap>
                    <logic:equal name="form" property='<%= String.valueOf( "changedCheckerId[" + step.getCatProjStepId() + "]" ) %>' value="true">
                      <logic:equal name="form" property='<%= String.valueOf( "selectedCheckerId[" + step.getCatProjStepId() + "]" ) %>' value="true">
                        <bean:define id="checker" name="form" property="userInfo" type="vkc.view.bean.UserInfo"/>
                        <bean:define id="checkerId" name="checker" property="userId" type="java.lang.Integer"/>
                        <bean:define id="usernameLabel" name="checker" property="lastnameLabel" type="java.lang.String"/>
                        <vkc:link href='<%= String.valueOf( "javascript:openUserInfoWindow(" + checkerId.intValue() + ");" )%>' title='<%=usernameLabel%>'>
                          <span style="text-decoration:underline"><vkc:write name="checker" property="username"/></span>
                        </vkc:link>
                      </logic:equal>
                      <logic:equal name="form" property='<%= String.valueOf( "selectedCheckerId[" + step.getCatProjStepId() + "]" ) %>' value="false">
                        &nbsp;
                      </logic:equal>
                    </logic:equal>
                    <logic:equal name="form" property='<%= String.valueOf( "changedCheckerId[" + step.getCatProjStepId() + "]" ) %>' value="false">
                      <logic:notEmpty name="step" property="checker">
                        <bean:define id="checker" name="step" property="checker" type="vkc.view.bean.UserInfo"/>
                        <bean:define id="checkerId" name="checker" property="userId" type="java.lang.Integer"/>
                        <bean:define id="usernameLabel" name="checker" property="lastnameLabel" type="java.lang.String"/>
                        <vkc:link href='<%= String.valueOf( "javascript:openUserInfoWindow(" + checkerId.intValue() + ");" )%>' title='<%=usernameLabel%>'>
                          <span style="text-decoration:underline"><vkc:write name="checker" property="username"/></span>
                        </vkc:link>
                      </logic:notEmpty>
                      <logic:empty name="step" property="checker">
                        &nbsp;
                      </logic:empty>
                    </logic:equal>
                  </td>
                  <td class='columnUnselected' align=center nowrap>
                    <logic:equal name="form" property='<%= String.valueOf( "changedCheckerId[" + step.getCatProjStepId() + "]" ) %>' value="true">
                      <logic:equal name="form" property='<%= String.valueOf( "selectedCheckerId[" + step.getCatProjStepId() + "]" ) %>' value="true">
                        <bean:define id="checkedTS" name="form" property="currentTimeString" type="java.lang.String"/>
                        <vkc:write name="checkedTS"/>
                      </logic:equal>
                      <logic:equal name="form" property='<%= String.valueOf( "selectedCheckerId[" + step.getCatProjStepId() + "]" ) %>' value="false">
                        &nbsp;
                      </logic:equal>
                    </logic:equal>
                    <logic:equal name="form" property='<%= String.valueOf( "changedCheckerId[" + step.getCatProjStepId() + "]" ) %>' value="false">
                      <logic:notEmpty name="step" property="checkedTSString">
                        <bean:define id="checkedTS" name="step" property="checkedTSString" type="java.lang.String"/>
                        <vkc:write name="checkedTS"/>
                      </logic:notEmpty>
                      <logic:empty name="step" property="checkedTSString">
                        &nbsp;
                      </logic:empty>
                    </logic:equal>
                  </td>
                </tr>
                </logic:iterate>
              </table>
            </td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td colspan="1" nowrap="nowrap" width="100%" align="left">
        <table cellspacing="5" cellpadding="0" border="0" width="100%">
          <tr><td width="100%" align="left"><vkc:button property="action.delete.steps" onclick="javascript:disableAllButtonsAndSubmit(this);"><vkc:message key="vkc.projectmgmt.create.button.deleteSelectedSteps"/></vkc:button></td></tr>
        </table>
      </td>
    </tr>
    </logic:equal>

    </logic:notEqual>

    <logic:equal value="<%=VKCCategory.FLAG_CLOSED.toString()%>" name="form" property="project.flag">
    <tr>
      <td colspan="1" nowrap="nowrap" width="100%" align="left">
        <table cellspacing="5" cellpadding="0" border="0" width="100%">
          <tr>
            <td width="100%" align="left">
              <table width="100%" cellSpacing="1" cellPadding="2" border="0" class="tableLineColor">
                <tr>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.step"/></b></td>
                  <td class="headerUnselected" align=left width="100%" nowrap><b><vkc:message key="project.label.edit.steps.activity"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.startDate"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.endDate"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.state"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.processed"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.processor"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.processedAt"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.checked"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.checker"/></b></td>
                  <td class="headerUnselected" align=center nowrap><b><vkc:message key="project.label.edit.steps.checkedAt"/></b></td>
                </tr>

                <logic:iterate id="step" indexId="index" name="steps" type="vkc.db.entities.VKCCatProjectStep">
                  <tr>
                    <td class='columnSelected' align=center nowrap>
                      <b><vkc:write name="step" property="step"/></b>
                    </td>
                    <td class='columnSelected' align=left width="100%" nowrap>
                      <b><vkc:write name="step" property="activity"/></b>
                    </td>
                    <td class='columnSelected' align=center nowrap>
                      <b><vkc:write name="step" property="startDateString"/></b>
                    </td>
                    <td class='columnSelected' align=center nowrap>
                      <b><vkc:write name="step" property="endDateString"/></b>
                    </td>
                    <logic:equal name="step" property="stepRunning" value="true">
                    <td class='columnSelected' align=center nowrap>
                      <b><vkc:message key="project.label.edit.steps.state.running"/></b>
                    </td>
                    </logic:equal>
                    <logic:equal name="step" property="stepRunning" value="false">
                    <logic:equal name="step" property="stepProcessed" value="true">
                    <td class='columnSelected' align=center nowrap>
                      <b><vkc:message key="project.label.edit.steps.state.processed"/></b>
                    </td>
                    </logic:equal>
                    <logic:equal name="step" property="stepChecked" value="true">
                    <td class='columnSelected' align=center nowrap>
                      <b><vkc:message key="project.label.edit.steps.state.checked"/></b>
                    </td>
                    </logic:equal>
                    <logic:equal name="step" property="enabled" value="false">
                    <td class='columnSelected' align=center nowrap>
                      <b><vkc:message key="project.label.edit.steps.state.disabled"/></b>
                    </td>
                    </logic:equal>
                    </logic:equal>
                    <td class='columnSelected' align=center nowrap><b>
                      <logic:equal name="step" property="processed" value="true">
                        <html:hidden property="selectedStepProcessedIds" name="form" value='<%=String.valueOf(step.getCatProjStepId().toString())%>'/>
                      </logic:equal>
                      <html:multibox name="form" property="selectedStepProcessedIds" disabled="true">
                        <vkc:write name="step" property="catProjStepId"/>
                      </html:multibox></b>
                    </td>
                    <td class='columnSelected' align=center nowrap>
                      <logic:notEmpty name="step" property="processor">
                      <bean:define id="processor" name="step" property="processor" type="vkc.view.bean.UserInfo"/>
                      <bean:define id="processorId" name="processor" property="userId" type="java.lang.Integer"/>
                      <bean:define id="usernameLabel" name="processor" property="lastnameLabel" type="java.lang.String"/>
                      <vkc:link href='<%= String.valueOf( "javascript:openUserInfoWindow(" + processorId.intValue() + ");" )%>' title='<%=usernameLabel%>'>
                        <span style="text-decoration:underline"><vkc:write name="processor" property="username"/></span>
                      </vkc:link>
                      </logic:notEmpty>
                      <logic:empty name="step" property="processor">
                        &nbsp;
                      </logic:empty>
                    </td>
                    <td class='columnSelected' align=center nowrap>
                      <logic:notEmpty name="step" property="processedTSString">
                      <bean:define id="processedTS" name="step" property="processedTSString" type="java.lang.String"/>
                        <vkc:write name="processedTS"/>
                      </logic:notEmpty>
                      <logic:empty name="step" property="processedTSString">
                        &nbsp;
                      </logic:empty>
                    </td>
                    <td class='columnSelected' align=center nowrap><b>
                      <logic:equal name="step" property="checked" value="true">
                        <html:hidden property="selectedStepCheckedIds" name="form" value='<%=String.valueOf(step.getCatProjStepId().toString())%>'/>
                      </logic:equal>
                      <html:multibox name="form" property="selectedStepCheckedIds" disabled="true">
                        <vkc:write name="step" property="catProjStepId"/>
                      </html:multibox></b>
                    </td>
                    <td class='columnSelected' align=center nowrap>
                      <logic:notEmpty name="step" property="checker">
                      <bean:define id="checker" name="step" property="checker" type="vkc.view.bean.UserInfo"/>
                      <bean:define id="checkerId" name="checker" property="userId" type="java.lang.Integer"/>
                      <bean:define id="usernameLabel" name="checker" property="lastnameLabel" type="java.lang.String"/>
                      <vkc:link href='<%= String.valueOf( "javascript:openUserInfoWindow(" + checkerId.intValue() + ");" )%>' title='<%=usernameLabel%>'>
                        <span style="text-decoration:underline"><vkc:write name="checker" property="username"/></span>
                      </vkc:link>
                      </logic:notEmpty>
                      <logic:empty name="step" property="checker">
                        &nbsp;
                      </logic:empty>
                    </td>
                    <td class='columnSelected' align=center nowrap>
                      <logic:notEmpty name="step" property="checkedTSString">
                      <bean:define id="checkedTS" name="step" property="checkedTSString" type="java.lang.String"/>
                        <vkc:write name="checkedTS"/>
                      </logic:notEmpty>
                      <logic:empty name="step" property="checkedTSString">
                        &nbsp;
                      </logic:empty>
                    </td>
                  </tr>
                </logic:iterate>
              </table>
            </td>
          </tr>
        </table>
      </td>
    </tr>
    </logic:equal>

    <vkc:hline lineHeight="1" lineClass="hline" colspan="1" topSpace="0" bottomSpace="5" />

    <tr>
      <td align="center" width="100%">
        <logic:notEqual value="<%=VKCCategory.FLAG_CLOSED.toString()%>" name="form" property="project.flag">
        <logic:equal name="form" property="userHasWritePermission" value="true">
        <vkc:button property="action.save.edit.steps" onclick="javascript:disableAllButtonsAndSubmit(this);"><vkc:message key="project.label.save"/></vkc:button>
        </logic:equal>
        <logic:equal name="form" property="userIsLeader" value="true">
        <vkc:button property="action.close.project" onclick="confirmCloseProject(this);"><vkc:message key="project.label.close" /></vkc:button>
        </logic:equal>
        </logic:notEqual>

        <logic:equal value="<%=VKCCategory.FLAG_CLOSED.toString()%>" name="form" property="project.flag">
        <logic:equal name="form" property="userIsLeader" value="true">
        <vkc:button property="action.activate.project" onclick="confirmActivateProject(this);"><vkc:message key="project.label.activate"/></vkc:button>
        <logic:notEmpty name="form" property="project.projectSteps">
        <vkc:button property="action.finalize.project" onclick="confirmFinalizeProject(this);"><vkc:message key="project.label.finalize"/></vkc:button>
        </logic:notEmpty>
        </logic:equal>
        </logic:equal>

        <vkc:button property="action.back.to.subfolder" onclick="javascript:disableAllButtonsAndSubmit(this);"><vkc:message key="button.back"/></vkc:button>
      </td>
    </tr>
  </logic:notEmpty>
</table>