<%@ Page Language="C#" MasterPageFile="~/webUser/MasterPage.master" AutoEventWireup="true" Inherits="webUser_myImg" Title="Untitled Page"  EnableViewState="false" Codebehind="myImg.aspx.cs" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Content1" runat="Server">
    <form id="form1" runat="server">
        <div class="maxTitle">
            我上传的图片
        </div>
        <asp:Repeater ID="myImg" runat="server">
            <ItemTemplate>
                <div class="imgb" id="imgDiv" name="imgDiv" imgid="<%# DataBinder.Eval(Container, "DataItem.id")%>">
                    <div class="imgup">
                        <img height="160" alt="上传日期: <%# DataBinder.Eval(Container,"DataItem.UpDateTime") %>
<%# DataBinder.Eval(Container,"DataItem.fileTitle") %>
点击修改图片说明"
                            src="<%# DataBinder.Eval(Container,"DataItem.FilePath")%>" />
                    </div>
                    <%# DataBinder.Eval(Container, "DataItem.SourceName")%>
                    <br />
                    大小:<%# DataBinder.Eval(Container, "DataItem.FileSize")%>字节
                    <div style=" background-color:#efefef;padding:3px;display:none;position:absolute;top:0px;left:0px;" name="imgDiv<%# DataBinder.Eval(Container, "DataItem.id")%>" id="imgDiv<%# DataBinder.Eval(Container, "DataItem.id")%>">
                        <div style="text-align:center;">
                            标题:<input onblur="isDisplay=1" onfocus="isDisplay=0" onchange="upImgTitle(this)" imgid="<%# DataBinder.Eval(Container, "DataItem.id")%>" title='标题' isV='1'  max="250"  type="text" value='<%# DataBinder.Eval(Container, "DataItem.fileTitle")%>' style="width:150px;">
                        </div>
                        <div style="text-align:center;">
                            简介:<textarea  onblur="isDisplay=1" onfocus="isDisplay=0" onchange="upImgCBS(this)"  imgid="<%# DataBinder.Eval(Container, "DataItem.id")%>" title='简介' isV='1'  max="250"  cols='2' style="width:150px;height:60px;"><%# DataBinder.Eval(Container, "DataItem.fileCBS")%></textarea>
                        </div>
                        <div style="text-align:center;">
                            <input onclick="closIMBDIV(<%# DataBinder.Eval(Container, "DataItem.id")%>)" type="button" value='关闭' class='inputText' style="height:18px;" title="关闭时会更新你设置的标题和说明">
                        </div>
                        
                    </div>
                </div>
            </ItemTemplate>
        </asp:Repeater>
        <div style="width: 100%; clear: both; height: 5px;">
        </div>
        <asp:Button ID="pageUp" runat="server" Text="上一页" CausesValidation="False" Enabled="False"
            UseSubmitBehavior="False" />
        <asp:Button ID="pageDown" runat="server" Text="下一页" CausesValidation="False" UseSubmitBehavior="False" />
        <asp:Label ID="pageLabel" runat="server" Text="Label"></asp:Label><asp:Label ID="timerText"
            runat="server" Text="Label"></asp:Label> <font color="#000ff"> 点击图片, 为图片设置标题和说明, 让你的图片更易于理解.</font>
    </form>
    
    <script language="javascript" type="text/javascript" >
    
    var thisimgID=0;
    var isDisplay=1;
    
    function loadImgDiv(){
     
       var objs= document.getElementsByName("imgDiv");
      
       for (var x=0;x<objs.length;x++){
//        
           objs[x].onclick=function(){
                if (isDisplay==0){
                    return;
                }
                thisimgID=this.imgid;
                var left=getLeft(this);
//                var top=getTop(this)+Element.getHeight(this)-180;
                var top=getTop(this)+2;
                var obj=$("imgDiv"+this.imgid);
                 //  alert(obj);
                 if (obj.style.display=="none"){
                    obj.style.cssText="filter:Alpha(Opacity=80);background-color:#efefef;padding:3px;width:200px;position:absolute;display:block;top:"+top+";left:"+left+";";
                }else{
                    closIMBDIV(this.imgid);
                }
           } 
           
//           objs[x].onmouseout=function(){
//                var left=getLeft(this);
//                var top=getTop(this)+10;
//                var obj=$("imgDiv"+this.imgid);
//                 //  alert(obj);
//                obj.style.cssText="width:200px;position:absolute;display:none;top:"+top+";left:"+left+";";
//           } 
           
             
       }
    }
    
    function closIMBDIV(id)
    { 
    
         var obj=$("imgDiv"+id);
       
        obj.style.display="none";
        //alert(obj.style.cssText);
        isDisplay=0;
        setTimeout("isDisplay=1",500);
        
        
    }
    
    function upImgTitle(obj){
        if (thisimgID==obj.imgid){
            var v=obj.value;
            
            if (v.indexOf(c1)!=-1|v.indexOf(c2)!=-1 | v.indexOf("'") !=-1 ){
                alert("不能填写特殊字符")
                return;
            }
            if (v.length>250){
               alert("长度不能超过250")
                return;
            }
           	var objAjax=new JAjax();
	        var objResponse=new JHttpResponse();
	        objResponse.write("v",v);
	        objResponse.write("id",thisimgID);
	        var out=objAjax.getText("post",sysPath+"webServer.aspx?type=upIMGTITLE",objResponse,null);
	        if (out=="-1"){
	            alert("图片ID非法");
	        }else if (out!="1"){
	            alert(erStr(out));
	        }

        }
    }
    
    function  upImgCBS(obj){
   
     if (thisimgID==obj.imgid){
            var v=obj.value;
            
            if (v.indexOf(c1)!=-1|v.indexOf(c2)!=-1 | v.indexOf("'") !=-1 ){
                alert("不能填写特殊字符")
                return;
            }
            if (v.length>250){
               alert("长度不能超过250")
                return;
            }

           	var objAjax=new JAjax();
	        var objResponse=new JHttpResponse();
	        objResponse.write("v",v);
	        objResponse.write("id",thisimgID);
	        var out=objAjax.getText("post",sysPath+"webServer.aspx?type=upIMGCBS",objResponse,null);
	        if (out=="-1"){
	            alert("图片ID非法");
	        }else if (out!="1"){
	            alert(erStr(out));
	        }
        }
    }
    
    
    loadImgDiv();
    </script>
    
</asp:Content>
