<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BatchUpload.aspx.cs" Inherits="PowerEasy.Module.General.WebSite.Editor.BatchUpload"
    ValidateRequest="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>
    <script src="../JS/jquery.pack.js" type="text/javascript"></script>
    <style type="text/css">
        .uploadContainerContent div.divFileProgressContainer
        {
            height:230px;
            -height:220px;
          
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table style="width: 100%">
            <tr>
                <td class='tdbg' align='left'>
                    <div id='errorLocation' style="font-size: small; color: Gray;">
                    </div>
                    <div id="silverlightControlHost">
                        <pe:FileUploadControl runat="server" ID="FileUploader" Pattern="Popup" />
                    </div>
                </td>
            </tr>
        </table>
        <script type="text/javascript">

          var photoUrls = '';
          var thumbUrl = '';

          function DealwithUpload(paths, size, id, thumbpath) {
              var photos = paths.split(',');
              var thumbs = thumbpath.split(',');
              for (var i = 0; i < photos.length; i++) {
                  var path = photos[i];
                   
                  if (path.indexOf('http://')!=0) {
                    path = '<%= UploadPath %>' + path;
                  }
   
                  if (photoUrls != '') {
                      photoUrls += '$$$'+ path;
                    }
                    else {
                      photoUrls += path;
                    }

                    if(thumbs.length>0){
                          if (thumbs.length<photos.length) {
                                for (var j = 0; j < thumbs.length; j++) {
                                    var thumb = thumbs[j];
                                    if(thumb.substring(0,thumb.lastIndexOf('_S'))===path.substring(0,path.lastIndexOf('.'))){
                                        if (thumb.indexOf('http://')!=0) {
                                            thumb = '<%= UploadPath %>' + thumbUrl;
                                         }
                                         if (thumbUrl && $.trim(thumbUrl)!='') {
                                            thumbUrl = thumb;
                                         }else{
                                             thumbUrl += '$$$'+ thumb;
                                         }
                                     }
                                }
                                
                           }else {
                                var thumb = thumbs[i];
                                if (thumb.indexOf('http://')!=0) {
                                    thumb = '<%= UploadPath %>' + thumbUrl;
                                }
                                if (thumbUrl && $.trim(thumbUrl)!='') {
                                    thumbUrl = thumb;
                                }else{
                                    thumbUrl += '$$$'+ thumb;
                                }
                           }
                          
                    }
                    window.parent.CKEDITOR.tools.callFunction(<%=CKEditorFuncNum %>,photoUrls,"");
              }
            
          }

          function ChangeThumbField(path, thumbpath) {
            thumbUrl = thumbpath;
            
            if (photoUrls != '') {
              photoUrls += '$$$' + '<%= UploadPath %>' + path;
            }
            else {
              photoUrls += '$$$' + '<%= UploadPath %>' + path;
            }
            photoUrls += '$$$' + '<%= UploadPath %>' + thumbUrl;
            
           window.parent.CKEDITOR.tools.callFunction(<%=CKEditorFuncNum %>,photoUrls,'');
          }

        </script>
    </div>
    </form>
</body>
</html>
