<%@ page language="C#" autoeventwireup="true" inherits="HL_Admin_Admin_AddSkin, HoWaveVGO" enableEventValidation="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>风格操作</title>
    <link href="Css/template_css.css" type="text/css" rel="stylesheet" />
    <base target="_self"></base>
<script type="text/javascript">
function ResizeImage(obj, MaxW, MaxH)
{
    if (obj != null) imageObject = obj;
    var state=imageObject.readyState;
	if(state!='complete') {
        setTimeout("ResizeImage(null,"+MaxW+","+MaxH+")",50);
		return;
    }
    var oldImage = new Image();
    oldImage.src = imageObject.src;
    var dW=oldImage.width; var dH=oldImage.height;
    if(dW>MaxW || dH>MaxH) {
        a=dW/MaxW; b=dH/MaxH;
        if(b>a) a=b;
        dW=dW/a; dH=dH/a;
    }
    if(dW > 0 && dH > 0) {
        imageObject.width=dW;
		imageObject.height=dH;
	}
}

function ShowImage(obj){
    document.getElementById('previewImage').innerHTML ="预览<br><img src=\""+obj.value+"\" width=100 height=100 onload=\"ResizeImage(this, 100, 100);\" align=absmiddle>";
}

function selectskinpath(objvalue){
    pathobj = document.getElementById("FormView1_Skin_SavePath");
    if(objvalue=="Index"){
        pathobj.value = "/Skin/Css/Index";
    }else if(objvalue=="Member"){
        pathobj.value = "/Skin/Css/Member";
    }else if(objvalue=="ShopBase"){
        pathobj.value = "/Skin/Css/Base";
    }else if(objvalue=="Special"){
        pathobj.value = "/Skin/Css/Special";
    }else if(objvalue=="Shop"){
        pathobj.value = "/Skin/Css/Shop";
    }else if(objvalue=="Product"){
        pathobj.value = "/Skin/Css/Auction";
    }else if(objvalue=="Browse"){
        pathobj.value = "/Skin/Css/Browse";
    }else if(objvalue=="Customer"){
        pathobj.value = "/Skin/Css/Customer";
    }
    
}
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:FormView ID="FormView1" runat="server" DataSourceID="ObjectDataSource1"  DefaultMode="Edit" Width="98%"   
          DataKeyNames="SkinID">
         <EditItemTemplate>
           <table class="nick" width="95%"> 
                <tr>
                      <td colspan="2" class="tit">修改风格</td>
                  </tr>                  
                  <tr>
                      <th>风格名称：</th>
                      <td class="rtd"><asp:TextBox ID="SkinName" runat="server" Text='<%#Bind("SkinName") %>' />
                      <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="名称不能空" ControlToValidate="SkinName"/></td>
                  </tr>
                  <tr>
                      <th>风格类型：</th>
                      <td class="rtd">
                          <asp:DropDownList ID="Skin_Type" runat="server" SelectedValue='<%# Bind("SkinType") %>'>
                             <asp:ListItem Text="首页风格" Value="Index" />
                             <asp:ListItem Text="专题风格" Value="Special" />
                             <asp:ListItem Text="店铺风格" Value="Shop" />
                             <asp:ListItem Text="会员中心风格" Value="Member" />
                             <asp:ListItem Text="商城基本风格" Value="ShopBase" />
                             <asp:ListItem Text="商品风格" Value="Product" />
                             <asp:ListItem Text="商品分类风格" Value="Class" />
                             <asp:ListItem Text="自定义风格" Value="Customer" />
                          </asp:DropDownList>
                       
                      </td>
                  </tr>                
                  <tr>
                      <th>风格内容：</th>
                      <td class="rtd"><asp:TextBox ID="Skin_css" runat="server" Height="300px" Text='<%# Bind("SKIN_CSS") %>'
                            TextMode="MultiLine" Width="460px" CssClass="TextBoxStyle"/>
                      </td>
                  </tr>
                  <tr>
                      <th>保存Css名称：</th>
                      <td class="rtd"><asp:TextBox ID="Skin_SaveName" runat="server" Width="150"  Text='<%# Bind("ProjectName") %>' />.css
                      <asp:RequiredFieldValidator ID="rfv1" runat="server" ErrorMessage="名称不能空" ControlToValidate="Skin_SaveName"/>
                      </td>
                  </tr>
                  <tr>
                      <th>风格保存路径：</th>
                      <td class="rtd"><asp:TextBox ID="Skin_SavePath" runat="server" Width="200" Text='<%# Bind("SkinPath") %>' />
                       <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="保存路径不能空" ControlToValidate="Skin_SavePath"/>
                      </td>
                  </tr>
                   <tr>
                      <th>风格预览图：</th>
                      <td class="rtd">
                         <div style="float:left"><asp:FileUpload ID="FileUpload1" runat="server" /></div>
                         <div id="previewImage"  style="text-align:center; width:100px; height:100px; border:solid 1px gray; float:right;">
                           缩微图<asp:Image ID="previewImgShow" runat="server"  ImageUrl='<%#"../Shop"+Eval("SkinPreviewImg") %>' Width="80px" Height="100px" />
                         </div>
                    </td>
                  </tr>
                   <tr>
                      <th>设为默认：</th>
                      <td class="rtd"><asp:CheckBox ID="IsDefault" runat="server" Checked='<%# Bind("IsDefault") %>' /></td>
                  </tr>
               <tr>
                  <td  style="text-align:center" colspan="2">
                      <asp:Button OnClick="onUpdateSkin"  runat="server" Text="修改" />
                      <asp:Button CommandName="Cancle" runat="server" Text="重置" />
                      <input name="clae" type="button" value="取消" onclick="window.close();" />
                  </td>
               </tr>
            </table>
        </EditItemTemplate>      
         <InsertItemTemplate>
              <table class="nick" width="95%">
                  <tr>
                      <td colspan="2" class="tit">添加风格</td>
                  </tr>                  
                  <tr>
                      <th>风格名称：</th>
                      <td class="rtd"><asp:TextBox ID="SkinName" runat="server" Text='<%#Bind("SkinName") %>' />
                      <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="名称不能空" ControlToValidate="SkinName"/>
                      </td>
                  </tr>
                  <tr>
                      <th>风格类型：</th>
                      <td class="rtd">
                          <asp:DropDownList ID="Skin_Type" runat="server" SelectedValue='<%# Bind("SkinType") %>' onchange="return selectskinpath(this.value)">
                             <asp:ListItem Text="首页风格" Value="Index" />
                             <asp:ListItem Text="专题风格" Value="Special" />
                             <asp:ListItem Text="店铺风格" Value="Shop" />
                             <asp:ListItem Text="会员中心风格" Value="Member" />
                             <asp:ListItem Text="商城基本风格" Value="ShopBase" />
                             <asp:ListItem Text="商品风格" Value="Product" />
                             <asp:ListItem Text="商品分类风格" Value="Class" />
                               <asp:ListItem Text="自定义风格" Value="Customer" />
                          </asp:DropDownList>
                       
                      </td>
                  </tr>                
                  <tr>
                      <th>风格内容：</th>
                      <td class="rtd"><asp:TextBox ID="Skin_css" runat="server" Height="300px" Text='<%# Bind("SKIN_CSS") %>'
                            TextMode="MultiLine" Width="460px" CssClass="TextBoxStyle"/>
                      </td>
                  </tr>
                  <tr>
                      <th>保存Css名称：</th>
                      <td class="rtd"><asp:TextBox ID="Skin_SaveName" runat="server" Width="150" Text='<%# Bind("ProjectName") %>' />.css
                      <asp:RequiredFieldValidator ID="rfv1" runat="server" ErrorMessage="名称不能空" ControlToValidate="Skin_SaveName"/>
                      </td>
                  </tr>
                  <tr>
                      <th>风格保存路径：</th>
                      <td class="rtd" ><asp:TextBox ID="Skin_SavePath" runat="server" Width="200" Text='<%# Bind("SkinPath") %>'/>
                       </td>
                  </tr>
                  <tr>
                      <th>风格预览图：</th>
                      <td class="rtd">
                         <div style="float:left"><asp:FileUpload ID="FileUpload1" runat="server" /></div>
                         <div id="previewImage"  style="text-align:center; width:100px; height:100px; border:solid 1px gray; float:right;">
                           缩微图
                         </div>
                    </td>
                  </tr>
                   <tr>
                      <th>设为默认：</th>
                      <td class="rtd"><asp:CheckBox ID="IsDefault" runat="server" Checked='<%# Bind("IsDefault") %>' /></td>
                  </tr>
                  <tr>
                      <td  style="text-align:center" colspan="2">
                          <asp:Button OnClick="onAddSkin" runat="server" Text="保存" ID="Button1" />
                          <asp:Button CommandName="Cancle" runat="server" Text="重置" ID="Button2" />
                          <input name="clae" type="button" value="取消" onclick="window.close();" />
                      </td>
                  </tr>
              </table>
          </InsertItemTemplate>
    </asp:FormView>
         <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetSkinBySkinID"
            TypeName="SkinBll" OnInit="ObjectDataSource1_Init">
            <SelectParameters>
                <asp:QueryStringParameter DefaultValue="0"  Name="SkinID" QueryStringField="SkinID"  Type="Int32" />
            </SelectParameters>          
            <UpdateParameters>
                <asp:Parameter Name="SkinName" Type="String" />
                <asp:Parameter Name="Skin_CSS" Type="String" />
                <asp:Parameter Name="IsDefault" Type="Boolean" />             
                <asp:Parameter Name="ProjectName" Type="String" />              
                <asp:Parameter Name="SkinID" Type="Int32" />
                <asp:Parameter Name="SkinType" Type="String" /> 
                <asp:Parameter Name="SkinPath" Type="String" /> 
                <asp:Parameter Name="SkinPreviewImg" Type="String" /> 
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="SkinName" Type="String" />
                <asp:Parameter Name="Skin_CSS" Type="String" />
                <asp:Parameter Name="IsDefault" Type="Boolean" />            
                <asp:Parameter Name="ProjectName" Type="String" />
                <asp:Parameter Name="SkinType" Type="String" /> 
                <asp:Parameter Name="SkinPath" Type="String" /> 
                <asp:Parameter Name="SkinPreviewImg" Type="String" /> 
        
            </InsertParameters>
        </asp:ObjectDataSource>
    
       
    </div>
    </form>
</body>
</html>
