<html>
<head>
<title>Application Versioning</title>
	<style type="text/css">
#MainDiv 
{
  width: 1024px;
  height:800px;
  margin-left: auto ;
  margin-right: auto ; 
  overflow:auto;
  background-color:#F9F9F9;
  font-family:Segoe UI;
  font-size:12px;
}  
#modelDiv 
{
  float: left;
  width: 288px;
  height: 336px; 
  border:1px solid #c4c9ce;
  overflow:auto;
  background:#FFFFFF;
}
#columnDiv 
{
  background: #FFFFFF;
  float: right;
  width: 722px;
  height: 336px;  
  border:1px solid #c4c9ce;
  overflow:auto;  
  font-family:Segoe UI;
  font-size:12px;
}
#newversiondiv 
{
  background: #FFFFFF;
  float: left;
  width: 340px;
  height: 100%;
  overflow:visible;  
  font-family:Segoe UI;
  font-size:12px;
  padding-top:10px;
}
#oldversiondiv 
{
  background: #FFFFFF;
  float: left;
  width: 345px;  
  height: 100%;
  overflow:visible;
  font-family:Segoe UI;
  font-size:12px;
  padding-top:10px;
}
#displayLabelMainDiv 
{
  width: 1024px;
  margin-left: auto ;
  margin-right: auto ; 
  overflow:auto;
  background-color:#F9F9F9;
  font-family:Segoe UI;
  font-size:12px;
}
#displayLabelModelDiv 
{
   background: none repeat scroll 0 0 #F9F9F9;
    float: left;
    overflow: auto;
    padding-top: 1px;
    width: 300px;
}
#displayLabelNewversiondiv
{
    background: none repeat scroll 0 0 #F9F9F9;
    float: left;
    font-family: Segoe UI;
    font-size: 12px;
    overflow: visible;
    padding-top: 1px;
    width: 352px;
}
#displayLabelOldversiondiv
{
   background: none repeat scroll 0 0 #F9F9F9;
    float: left;
    font-family: Segoe UI;
    font-size: 12px;
    overflow: visible;
    padding-bottom: 3px;
    padding-right: 2px;
    padding-top: 1px;
    width: 361px;
}
#formMainDiv 
{
  width: 1024px;
  margin-left: auto ;
  margin-right: auto ; 
  overflow:auto;
  background-color:#F9F9F9;
  font-family:Segoe UI;
  font-size:12px;
}
#lineItemsLI
{
    align:top;
    style:padding-right:4px;
}
.folderLink 
{
text-decoration:none;
color:#727272;
font-weight:bold
}
.modelListLIStyle
{
    padding-top:7px
}
.modelListULStyle
{
    padding-top:1px;
    padding-left:20px;
    font-family:Segoe UI;
}
.topHeaderStyle
{
    width:100%;
    background:url('${application_static_path}/static/images/migration/Gradient.png') repeat;
    font-size:14px;
    color:#727272;
    height:25px;
    padding-left:10px;
    padding-top:5px;
    font-family:Segoe UI
}
#textareaDiv
{
    font-family:Segoe UI;
}
.plusminusImageStyle
{
    padding-top:3px;
    padding-right:2px;
    width:11px;
    height:11px;
    align:center;
}
.columnListLIStyle
{
    cursor:pointer;
}
.modelListStyle 
{
text-decoration:none;
color:#727272;
font-weight:bold;
cursor:pointer;
padding-bottom:5px;
}
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.min.js"></script>

<script type="text/javascript">
function getSheetmetadataDiff(sheetId)
{
    #if $applicationid:
        var sheetDiffUrl="/$applicationid/1/migrate/sheetmetadata/"+sheetId;
         jQuery.ajax({url:sheetDiffUrl, success:function(result)
         {
            //alert(result);
            jQuery('#columnDiv').html('<img src="${application_static_path}/static/images/migration/loading.gif" />');
            jQuery('#columnDiv').html(result);
        }
        }
      );
   #end if
}
function generateScripts()
{  
    #if $applicationid:
        var generateScriptUrl="/$applicationid/1/migrate/generatescripts";
        popup(generateScriptUrl);
    #end if
}
function popup(url) 
{
 var width  = 600;
 var height = 400;
 var left   = (screen.width  - width)/2;
 var top    = (screen.height - height)/2;
 var params = 'width='+width+', height='+height;
 params += ', top='+top+', left='+left;
 params += ', directories=no';
 params += ', location=no';
 params += ', menubar=no';
 params += ', resizable=no';
 params += ', scrollbars=yes';
 params += ', status=no';
 params += ', toolbar=no';
 newwin=window.open(url,'windowname5', params);
 if (window.focus) {newwin.focus()}
 return false;
}
function migrate()
{  
    #if $applicationid:
        var migrateUrl="/$applicationid/1/migrate/executescripts";
         jQuery.ajax({url:migrateUrl, success:function(result)
         {     
            alert("Migrated Successfully");
            window.location.reload();            
         }
        }
      );
   #end if
}
function expand_Cell(value)
{
 newVersionLineItems = document.getElementById("NewVersion_"+value+"_LineItems");
 oldVersionLineItems = document.getElementById("OldVersion_"+value+"_LineItems");
 newVersionPlusMinus = document.getElementById("NewVersion_"+value+"_PlusMinus");
 oldVersionPlusMinus = document.getElementById("OldVersion_"+value+"_PlusMinus");
 newVersionFolder = document.getElementById("NewVersion_"+value+"_Folder");
 oldVersionFolder = document.getElementById("OldVersion_"+value+"_Folder");
 if (newVersionLineItems.style.display == 'none')
 {
   newVersionLineItems.style.display = 'block';
   oldVersionLineItems.style.display = 'block';
   newVersionPlusMinus.src = "${application_static_path}/static/images/migration/minus.gif";
   oldVersionPlusMinus.src = "${application_static_path}/static/images/migration/minus.gif";
   newVersionFolder.src = "${application_static_path}/static/images/migration/folder-open.png";
   oldVersionFolder.src = "${application_static_path}/static/images/migration/folder-open.png";
 }
 else if (newVersionLineItems.style.display == 'block')
 {
   newVersionLineItems.style.display = 'none';
   oldVersionLineItems.style.display = 'none';
   newVersionPlusMinus.src = "${application_static_path}/static/images/migration/plus.gif";
   oldVersionPlusMinus.src = "${application_static_path}/static/images/migration/plus.gif";
   newVersionFolder.src = "${application_static_path}/static/images/migration/folder.png";
   oldVersionFolder.src = "${application_static_path}/static/images/migration/folder.png";
 }
}
function showDetails(value)
{
    if(value=='')
    {
        alert('Blank');        
    }
    else
    {
       document.frmdetails.detailstext.value=value;       
    }
    
}
</script>
</head>
<body style="background-color:#F9F9F9">
<div id="topHeader" class="topHeaderStyle">Database Versioning</div><br/>
<div id="displayLabelMainDiv">
    <div id="displayLabelModelDiv">
        Model Names
    </div>
    <div id="displayLabelNewversiondiv">
        New Version
    </div>
    <div id="displayLabelOldversiondiv">
        Old Version
    </div>
</div>
<div id="MainDiv">
   <div id="modelDiv">
          <ul type="None">
            #if $mismatchModelList:
                #for $sheet in $mismatchModelList:
                        <li class="modelListStyle" onClick="getSheetmetadataDiff('$sheet')">
                            $mismatchModelList[$sheet].get('Sheet Name')  ($mismatchModelList[$sheet].get('Mismatch Count'))
                        </li>
                #end for
             #end if
          </ul>
    </div>
    <div id="columnDiv">
        <table style="height:100%">
            <tr>
                <td>
                  <div id="newversiondiv">
                    <ul style="list-style-type:none; margin:0; padding:0;">    
                        <li>&nbsp;
                            <a href="javascript:expand_Cell('Public');">
                                <img src="${application_static_path}/static/images/migration/plus.gif"  class="plusminusImageStyle" border="0" id="NewVersion_Public_PlusMinus" /></a>
                                <img src="${application_static_path}/static/images/migration/folder.png" align="top" id="NewVersion_Public_Folder"/>
                                <a href="javascript:expand_Cell('Public');" class="folderLink">Public Cells</a>
                                <ul id="NewVersion_Public_LineItems" style="display:block;list-style-type:none;padding-top:3px">
                                </ul>
                        </li>                        
                     </ul>   <br/>         
                    <ul style="list-style-type:none; margin:0; padding:0;">    
                        <li>&nbsp;
                            <a href="javascript:expand_Cell('Private');">
                                <img src="${application_static_path}/static/images/migration/plus.gif" class="plusminusImageStyle" border="0" id="NewVersion_Private_PlusMinus" /></a>
                                <img src="${application_static_path}/static/images/migration/folder.png" align="top" id="NewVersion_Private_Folder"/>
                                <a href="javascript:expand_Cell('Private');" class="folderLink">Private Cells</a>
                                <ul  id="NewVersion_Private_LineItems" style="display:block;list-style-type:none;padding-top:3px">
                                </ul>
                        </li>                        
                     </ul><br/>
                    <ul style="list-style-type:none; margin:0; padding:0;">    
                        <li>&nbsp;
                            <a href="javascript:expand_Cell('ReferenceCell');">
                                <img src="${application_static_path}/static/images/migration/plus.gif" class="plusminusImageStyle" border="0" id="NewVersion_ReferenceCell_PlusMinus" /></a>
                                <img src="${application_static_path}/static/images/migration/folder.png" align="top" id="NewVersion_ReferenceCell_Folder"/>
                                <a href="javascript:expand_Cell('ReferenceCell');" class="folderLink">Reference Cells</a>
                                <ul  id="NewVersion_ReferenceCell_LineItems" style="display:block;list-style-type:none;padding-top:3px">
                                </ul>
                        </li>                        
                     </ul>
                </div>
              </td>
              <td style="border-right:1px solid #c4c9ce">&nbsp;</td>
              <td>
                <div id="oldversiondiv">
                    <ul style="list-style-type:none; margin:0; padding:0;">    
                        <li>&nbsp;
                            <a href="javascript:expand_Cell('Public');">
                                <img src="${application_static_path}/static/images/migration/plus.gif" class="plusminusImageStyle" border="0" id="OldVersion_Public_PlusMinus" /></a>
                                <img src="${application_static_path}/static/images/migration/folder.png" align="top" alt="icon" id="OldVersion_Public_Folder"/>
                                <a href="javascript:expand_Cell('Public');" class="folderLink">Public Cells</a>
                                <ul  id="OldVersion_Public_LineItems" style="display:block;list-style-type:none;padding-top:3px">
                                </ul>
                        </li>                        
                     </ul>  <br/>          
                    <ul style="list-style-type:none; margin:0; padding:0;">    
                        <li>&nbsp;
                            <a href="javascript:expand_Cell('Private');">
                                <img src="${application_static_path}/static/images/migration/plus.gif" class="plusminusImageStyle" border="0" id="OldVersion_Private_PlusMinus" /></a>
                                <img src="${application_static_path}/static/images/migration/folder.png" align="top" alt="icon" id="OldVersion_Private_Folder"/>
                                <a href="javascript:expand_Cell('Private');" class="folderLink">Private Cells</a>
                                <ul  id="OldVersion_Private_LineItems" style="display:block;list-style-type:none;padding-top:3px">
                                </ul>
                        </li>                        
                     </ul><br/>
                    <ul style="list-style-type:none; margin:0; padding:0;">    
                        <li>&nbsp;
                            <a href="javascript:expand_Cell('ReferenceCell');">
                                <img src="${application_static_path}/static/images/migration/plus.gif" class="plusminusImageStyle" border="0" id="OldVersion_ReferenceCell_PlusMinus" /></a>
                                <img src="${application_static_path}/static/images/migration/folder.png" align="top" alt="icon" id="OldVersion_ReferenceCell_Folder"/>
                                <a href="javascript:expand_Cell('ReferenceCell');" class="folderLink">Reference Cells</a>
                                <ul type="None" id="OldVersion_ReferenceCell_LineItems" style="display:block;list-style-type:none;padding-top:3px">                                </ul>
                        </li>                        
                     </ul>
                </div>  
              </td>
          </tr>
       </table>
    </div> 
    <table>
        <tbody>
            <tr>
                <td style="padding-top: 7px; font-size: 12px; font-family: Segoe UI;">
                    Details
                </td>
            </tr>
        </tbody>
    </table>    
        <div>
            <form name="frmdetails">
                <textarea rows="4" cols="122" name="detailstext" style="font-family:Segoe UI;font-size:14px">                
                </textarea>
            </form>
        </div>
        <div align="right" id="buttondetails">
            <form>
                <input type="button" value="Migrate" onClick="migrate()">
            </form>
        </div>
</div> 
</body>
</html>