<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="camera.aspx.cs" Inherits="Us.Web.admin.document.camera" %>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>在线拍照图片处理</title>
     <%=ImportScriptStr %>
    <script type="text/javascript" src="scripts/swfobject.js"></script>
    <script type="text/javascript" src="scripts/fullAvatarEditor.js"></script>
    <script type="text/javascript" src="js/0451skyMyDocument.js"></script>
    <script type="text/javascript">
        function addli(img) {
            var msrc = img;
            msrc = msrc.replace(".jpg.jpg", ".jpg");
            var ul = document.getElementById("myul");
            var obj = document.createElement("li");
            obj.innerHTML = "<a href=\"#\" onclick=\"return GoReutrn('" + msrc + "');\"><img src='" + msrc + "' title='点击应用 \n图片地址:" + msrc + "'/></a>";
            ul.appendChild(obj);
        }

        function GoReutrn(sPath) {
            var info = "确实要使用您选中的内容吗？";
            art.dialog.confirm(info, function () {
                //alert("1=" + sPath);
                art.dialog.data("retndata", sPath);
                parent.art.dialog.close();
            });
            return false;
        }

    </script>
    <script type="text/javascript">
        function NoRightClick(pid) { //id:flash id ; pid:parent container id
            var el = document.getElementById(pid);
            if (el.addEventListener) {
                el.addEventListener("mousedown", function (event) {
                    if (event.button == 2) {
                        event.stopPropagation(); //for firefox
                        event.preventDefault();  //for chrome
                    }
                }, true);
            } else {
                el.attachEvent("onmousedown", function () {
                    if (event.button == 2) {
                        el.setCapture();
                    }
                });
                el.attachEvent("onmouseup", function () {
                    el.releaseCapture();
                });
                el.oncontextmenu = function () {
                    return false;
                };
            }
        };
	</script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <style type="text/css">
        <!--
        body {
            margin-left: 0px;
            margin-top: 0px;
            margin-right: 0px;
            margin-bottom: 0px;
        }

        #nav ul {
            list-style: none;
            margin-left: 0px;
        }

        #nav li {
            /*display: inline;*/
            line-height: 20px;
            /*float: left;*/
        }

            #nav li img {
                width: 150px;
                height: 200px;
                margin-left: 5px;
                border: 1px solid #999999;
            }

            #nav li img:hover {
                 border: 1px solid #ff0000;
            }
        -->
    </style>
    <link href="../style/default/style.css" rel="stylesheet" type="text/css" />
</head>
<body>

    <div id="tbMain">
        <div class="divTbg">
            <div class="divTbgL"></div>
            <div class="divTbgInfo">
                <div class="divTbgTitle">在线拍照图片处理</div>
            </div>
        </div>
        <div class="divTbgF"></div>
        <div id="mypanel">
            <div class="divInfo" id="ddiv1">

                <div class="divInfoContext">
                    
                        <div style="float:left">
                            <p id="swfContainer">
                                本组件需要安装Flash Player后才可使用，请从<a href="http://www.adobe.com/go/getflashplayer">这里</a>下载安装。
                            </p>
                        </div>

                        <div id="nav" style="float:left">
                            <ul id="myul">
                                <%--<li><a href='#'><img src='/upload/camera/1.jpg' title='选中'/></a></li>
                                <li><a href='#'><img src='/upload/camera/1.jpg' title='选中'/></a></li>--%>
                            </ul>
                        </div>
                    
                    <script type="text/javascript">
                        swfobject.addDomLoadEvent(function () {
                            //以下两行代码正式环境下请删除
                            if (location.href.indexOf('http://') == -1)
                                alert('请于WEB服务器环境中查看、测试！');
                            var swf = new fullAvatarEditor("fullAvatarEditor.swf", "expressInstall.swf", "swfContainer", {
                                id: 'swf',
                                upload_url: '/editor/cameraupload.aspx?userid=<% =sUserID%>&username=admin',	//上传接口
                                method: 'post',	//传递到上传接口中的查询参数的提交方式。更改该值时，请注意更改上传接口中的查询参数的接收方式
                                src_upload: 0,		//是否上传原图片的选项，有以下值：0-不上传；1-上传；2-显示复选框由用户选择
                                avatar_box_border_width: 0,
                                avatar_sizes: '150*200',
                                avatar_sizes_desc: '150*200像素'
                            }, function (msg) {
                                //alert(msg.code + " " + msg.type + " " + msg.content);
                                switch (msg.code) {
                                    case 1: break;
                                    case 2:

                                        document.getElementById("upload").style.display = "inline";
                                        break;
                                    case 3:
                                        if (msg.type == 0) {

                                        }
                                        else if (msg.type == 1) {

                                        }
                                        else {

                                        }
                                        break;
                                    case 5:
                                        if (msg.type == 0) {
                                            if (msg.content.sourceUrl) {
                                                //alert("原图已成功保存至服务器，url为：\n" +　msg.content.sourceUrl+"\n\n" + "头像已成功保存至服务器，url为：\n" + msg.content.avatarUrls.join("\n\n")+"\n\n传递的userid="+msg.content.userid+"&username="+msg.content.username);
                                            }
                                            else {
                                                //alert("头像已成功保存至服务器，url为：\n" + msg.content.avatarUrls.join("\n\n")+"\n\n传递的userid="+msg.content.userid+"&username="+msg.content.username);
                                            }
                                            addli(msg.content.avatarUrls.join("\n\n"));
                                            //msg.content.avatarUrls.join("\n\n")
                                        }
                                        break;
                                }
                            }
                            );
                            document.getElementById("upload").onclick = function () {
                                swf.call("upload");
                            };
                        });

                        NoRightClick("swf");
                        //var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
                        //document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F5f036dd99455cb8adc9de73e2f052f72' type='text/javascript'%3E%3C/script%3E"));
                    </script>
                </div>

                 <div class="divInfo">
                <span class="usHelpMessage"> * 注意事项： 
                1、在线拍照需要您的电脑上安装摄像头，图片处理则不需要摄像头直接上传即可；<br/>
                2、拍照上传的文件默认保存到upload目录下的camera目录里面，您可以从那里查看到详细的拍照信息；

        </span>  
            </div>
        </div>

    </div>


</body>
</html>
