b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 |
|
| 2 |
|
| 3 | var count=0;
|
| 4 | (function($) {
|
| 5 | $.fn.objWebDav = function(InIt) {
|
| 6 |
|
| 7 |
|
| 8 | this.onLoad = function(flag) {
|
| 9 | if(flag) {
|
| 10 | LoadWebPage("//192.168.1.1/html/router/webdav.html");
|
| 11 |
|
| 12 | function GetSelWebdavFileId() {
|
| 13 | var smsIdSet = "";
|
| 14 | $(".delCheckBox:checked").each(function() {
|
| 15 | smsIdSet = smsIdSet+$(this).parents("tr:first").attr("id")+"/";
|
| 16 | });
|
| 17 |
|
| 18 | return smsIdSet;
|
| 19 | }
|
| 20 |
|
| 21 | function GetSelWebdavFileType() {
|
| 22 | var type = "";
|
| 23 | $(".delCheckBox:checked").each(function() {
|
| 24 | type = $(this).parents("tr:first").attr("name");
|
| 25 | });
|
| 26 |
|
| 27 | return type;
|
| 28 | }
|
| 29 |
|
| 30 | $("#webdavDownload").click(function() {
|
| 31 |
|
| 32 | var fileName=GetSelWebdavFileId();
|
| 33 | WebDav_Get_Download(fileName);
|
| 34 | });
|
| 35 |
|
| 36 | $("#webdavDelete").click(function() {
|
| 37 |
|
| 38 | var fileName=GetSelWebdavFileId();
|
| 39 | WebDav_Delete(fileName);
|
| 40 | });
|
| 41 |
|
| 42 | $("#webdavShare").click(function() {
|
| 43 | var fileName=GetSelWebdavFileId();
|
| 44 | var fileType=GetSelWebdavFileType();
|
| 45 |
|
| 46 | WebDav_Share(fileName,fileType);
|
| 47 | });
|
| 48 |
|
| 49 |
|
| 50 | if(isBrowser()=="IE8")
|
| 51 | {
|
| 52 | $("#WebdavFileToUpload").bind("change",function() {
|
| 53 | showAlert("lupdateBrowser");
|
| 54 | });
|
| 55 | }
|
| 56 | else
|
| 57 | {
|
| 58 | $("#WebdavFileToUpload").live("change",function() {
|
| 59 | WebDav_Upload_Change();
|
| 60 | });
|
| 61 | }
|
| 62 |
|
| 63 | $("#webdavMkdir").click(function() {
|
| 64 | sm("mkdirInfoDlg", 450, 150);
|
| 65 |
|
| 66 | $("#selSaveLoc").attr("disabled", false);
|
| 67 | $("#mkdir_stcInputCheckout").hide();
|
| 68 |
|
| 69 | $("#lt_Mkdir_btnSave").click(function() {
|
| 70 |
|
| 71 | var FolderName = $("#mkdirtxtName").val();
|
| 72 | if ($("#mkdirtxtName").val().length == 0) {
|
| 73 | $("#mkdir_stcInputCheckout").show().text(jQuery.i18n.prop("mkdir_stcInputCheckout1"));
|
| 74 | //document.getElementById('mkdirInfoDlgTitle').innerHTML=
|
| 75 | return;
|
| 76 | }
|
| 77 | if((FolderName.indexOf("%")==-1)&&(FolderName.indexOf("^")==-1)&&(FolderName.indexOf("&")==-1)
|
| 78 | &&(FolderName.indexOf("*")==-1)&&(FolderName.indexOf("#")==-1)&&(FolderName.indexOf("|")==-1)
|
| 79 | &&(FolderName.indexOf(":")==-1)&&(FolderName.indexOf("\\")==-1)&&(FolderName.indexOf("/")==-1)
|
| 80 | &&(FolderName.indexOf("?")==-1)&&(FolderName.indexOf("\"")==-1)&&(FolderName.indexOf("<")==-1)
|
| 81 | &&(FolderName.indexOf(">")==-1))
|
| 82 | {
|
| 83 | FolderName=encodeURIComponent(FolderName);
|
| 84 | WebDav_Mkdir(FolderName);
|
| 85 | hm();
|
| 86 | }
|
| 87 | else
|
| 88 | {
|
| 89 | $("#mkdir_stcInputCheckout").show().text(jQuery.i18n.prop("mkdir_stcInputCheckout2"));
|
| 90 | //$("#mkdir_stcInputCheckout").show().text("A file name can't contain any of following characters:% ^ & * # | : \\ / ? \" < >");
|
| 91 | return;
|
| 92 | }
|
| 93 |
|
| 94 | });
|
| 95 | });
|
| 96 | webdavFileInit();
|
| 97 |
|
| 98 | }
|
| 99 |
|
| 100 | //buttonLocaliztion("webdavDownload");
|
| 101 | //buttonLocaliztion("webdavDelete");
|
| 102 | //buttonLocaliztion("webdavShare");
|
| 103 | //buttonLocaliztion("webdavUpload");
|
| 104 | //buttonLocaliztion("webdavMkdir");
|
| 105 | //buttonLocaliztion("lt_Mkdir_btnSave");
|
| 106 | //buttonLocaliztion("lt_webdavLogin_btnSave");
|
| 107 |
|
| 108 | document.getElementById("webdavDownload").value = jQuery.i18n.prop("webdavDownload");
|
| 109 | document.getElementById("webdavDelete").value = jQuery.i18n.prop("webdavDelete");
|
| 110 | document.getElementById("webdavShare").value = jQuery.i18n.prop("webdavShare");
|
| 111 | document.getElementById("webdavUpload").value = jQuery.i18n.prop("webdavUpload");
|
| 112 | document.getElementById("webdavMkdir").value = jQuery.i18n.prop("webdavMkdir");
|
| 113 | document.getElementById("lt_Mkdir_btnSave").value = jQuery.i18n.prop("lt_Mkdir_btnSave");
|
| 114 | document.getElementById("lt_webdavLogin_btnSave").value = jQuery.i18n.prop("lt_webdavLogin_btnSave");
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 | document.getElementById("lloginfailed").innerHTML = jQuery.i18n.prop("lloginfailed");
|
| 122 | document.getElementById('WebdavLoginDlgTitle').innerHTML=jQuery.i18n.prop("WebdavLoginDlgTitle");
|
| 123 | document.getElementById('WebDavUsername').innerHTML=jQuery.i18n.prop("webdav_lUsername");
|
| 124 | document.getElementById('WebDavPassword').innerHTML=jQuery.i18n.prop("webdav_lPassword");
|
| 125 |
|
| 126 | document.getElementById('mkdir_stcCancelView').innerHTML=jQuery.i18n.prop("mkdir_stcCancelView");
|
| 127 | document.getElementById('mkdir_stcName').innerHTML=jQuery.i18n.prop("mkdir_stcName");
|
| 128 | document.getElementById('mkdirInfoDlgTitle').innerHTML=jQuery.i18n.prop("mkdirInfoDlgTitle");
|
| 129 |
|
| 130 | document.getElementById('webdavsharesettingDlgTitle').innerHTML=jQuery.i18n.prop("webdavsharesettingDlgTitle");
|
| 131 | document.getElementById('ShareFile_method').innerHTML=jQuery.i18n.prop("ShareFile_method");
|
| 132 | document.getElementById('lreadmode').innerHTML=jQuery.i18n.prop("lreadmode");
|
| 133 | document.getElementById('lreadwitemode').innerHTML=jQuery.i18n.prop("lreadwitemode");
|
| 134 | document.getElementById('share_stcCancelView').innerHTML=jQuery.i18n.prop("mkdir_stcCancelView");
|
| 135 | document.getElementById('webdavsharesetting_ok').value = jQuery.i18n.prop("lt_Mkdir_btnSave");
|
| 136 | document.getElementById('ShareSelect1').innerHTML=jQuery.i18n.prop("ShareSelect1");
|
| 137 | //document.getElementById('ShareSelect2').innerHTML=jQuery.i18n.prop("ShareSelect2");
|
| 138 | //document.getElementById('ShareSelect3').innerHTML=jQuery.i18n.prop("ShareSelect3");
|
| 139 | //document.getElementById('ShareSelect4').innerHTML=jQuery.i18n.prop("ShareSelect4");
|
| 140 |
|
| 141 |
|
| 142 | document.getElementById('webdavuploadschedule_pause').value = jQuery.i18n.prop("webdavuploadschedule_pause");
|
| 143 | document.getElementById('webdavuploadscheduleDlgTitle').innerHTML=jQuery.i18n.prop("webdavuploadscheduleDlgTitle");
|
| 144 | document.getElementById('upload_stcCancelView').innerHTML=jQuery.i18n.prop("mkdir_stcCancelView");
|
| 145 |
|
| 146 | document.getElementById('webdav_name').innerHTML=jQuery.i18n.prop("webdav_name")+"<img id=\"NameOrder\" src=//192.168.1.1/images/ico_webdav_up.png style=\"display: none\">";
|
| 147 | document.getElementById('webdav_size').innerHTML=jQuery.i18n.prop("webdav_size")+"<img id=\"SizeOrder\" src=//192.168.1.1/images/ico_webdav_up.png style=\"display: none\">";
|
| 148 | document.getElementById('webdav_date').innerHTML=jQuery.i18n.prop("webdav_date")+"<img id=\"FiledateOrder\" src=//192.168.1.1/images/ico_webdav_up.png style=\"display: none\">";
|
| 149 |
|
| 150 |
|
| 151 | }
|
| 152 |
|
| 153 | this.putMapElement = function(xpath, value, index) {
|
| 154 | mapData[index] = new Array(2);
|
| 155 | mapData[index][0] = xpath;
|
| 156 | mapData[index][1] = value;
|
| 157 | }
|
| 158 |
|
| 159 | //this.onPostSuccess = function() {
|
| 160 | // this.onLoad(true);
|
| 161 | //}
|
| 162 |
|
| 163 | //this.loadHTML = function() {
|
| 164 | // document.getElementById('Content').innerHTML = "";
|
| 165 | // document.getElementById('Content').innerHTML = CallHtmlFile("//192.168.1.1/html/router/webdav.html");
|
| 166 | //LoadWebPage("//192.168.1.1/html/router/webdav.html");
|
| 167 | //}
|
| 168 |
|
| 169 |
|
| 170 | //this.setXMLName = function(_xmlname) {
|
| 171 | // xmlName = _xmlname;
|
| 172 | //}
|
| 173 | return this;
|
| 174 | }
|
| 175 |
|
| 176 |
|
| 177 | })(jQuery);
|
| 178 |
|
| 179 |
|
| 180 | function webdavFileInit()
|
| 181 | {
|
| 182 |
|
| 183 | /*
|
| 184 | var xml = getData('webdav_management');
|
| 185 | $(xml).find("webdav_user_management").each(function() {
|
| 186 |
|
| 187 | var sd_flag=$(this).find("sd_state").text();
|
| 188 | var usb_flag=$(this).find("webdav_enable").text();
|
| 189 | if(sd_flag=='0')
|
| 190 | {
|
| 191 | $("#webdav_Share_Button").hide();
|
| 192 | $("#webdav_Delete_Button").hide();
|
| 193 | $("#webdav_Upload_Button").hide();
|
| 194 | $("#webdav_Mkdir_Button").hide();
|
| 195 |
|
| 196 | showAlert(jQuery.i18n.prop("lsdcardstatus"));
|
| 197 | return;
|
| 198 | }
|
| 199 | if(usb_flag=="0")
|
| 200 | {
|
| 201 | $("#webdav_Share_Button").hide();
|
| 202 | $("#webdav_Delete_Button").hide();
|
| 203 | $("#webdav_Upload_Button").hide();
|
| 204 | $("#webdav_Mkdir_Button").hide();
|
| 205 |
|
| 206 | showAlert(jQuery.i18n.prop("lwebdavusbflag"));
|
| 207 | return;
|
| 208 |
|
| 209 | }
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 | });
|
| 214 | */
|
| 215 | WebDav_Get_OPTIONS();
|
| 216 | }
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 | var Path_Name='/';
|
| 222 |
|
| 223 |
|
| 224 | function WebDav_Utf8_To_Chinese_Char(strUtf8)
|
| 225 | {
|
| 226 | var iCode, iCode1, iCode2;
|
| 227 | iCode = parseInt("0x" + strUtf8.substr(1, 2));
|
| 228 | iCode1 = parseInt("0x" + strUtf8.substr(4, 2));
|
| 229 | iCode2 = parseInt("0x" + strUtf8.substr(7, 2));
|
| 230 |
|
| 231 | return String.fromCharCode(((iCode & 0x0F) << 12) |
|
| 232 | ((iCode1 & 0x3F) << 6) |
|
| 233 | (iCode2 & 0x3F));
|
| 234 | }
|
| 235 |
|
| 236 | function WebDav_Utf8_To_Specific_Char(strUtf8)
|
| 237 | {
|
| 238 | var iCode;
|
| 239 | iCode = parseInt("0x" + strUtf8.substr(1, 2));
|
| 240 | return String.fromCharCode(iCode);
|
| 241 | }
|
| 242 |
|
| 243 | function WebDav_Utf8_To_symbol_Char(strUtf8)
|
| 244 | {
|
| 245 | var bstr = "";
|
| 246 | var nOffset = 0;
|
| 247 | nOffset = strUtf8.indexOf("%");
|
| 248 | if( nOffset == -1 )
|
| 249 | return strUtf8;
|
| 250 |
|
| 251 | while( nOffset != -1 )
|
| 252 | {
|
| 253 | bstr += strUtf8.substr(0, nOffset);
|
| 254 | strUtf8 = strUtf8.substr(nOffset, strUtf8.length - nOffset);
|
| 255 | if( strUtf8 == "" || strUtf8.length < 3 ) // bad string
|
| 256 | return bstr;
|
| 257 |
|
| 258 | bstr += WebDav_Utf8_To_Specific_Char(strUtf8.substr(0, 3));
|
| 259 | strUtf8 = strUtf8.substr(3, strUtf8.length - 3);
|
| 260 | nOffset = strUtf8.indexOf("%");
|
| 261 | }
|
| 262 | return bstr + strUtf8;
|
| 263 | }
|
| 264 |
|
| 265 | function WebDav_Utf8_To_Char(strUtf8)
|
| 266 | {
|
| 267 | var bstr = "";
|
| 268 | var nOffset = 0; // processing point on strUtf8
|
| 269 |
|
| 270 | if( strUtf8 == "" )
|
| 271 | return "";
|
| 272 |
|
| 273 | //strUtf8 = strUtf8.toLowerCase();
|
| 274 | nOffset = strUtf8.indexOf("%e");
|
| 275 | if( nOffset == -1 )
|
| 276 | {
|
| 277 | nOffset = strUtf8.indexOf("%E");
|
| 278 | if( nOffset == -1 )
|
| 279 | {
|
| 280 | return WebDav_Utf8_To_symbol_Char(strUtf8);
|
| 281 | }
|
| 282 | }
|
| 283 |
|
| 284 |
|
| 285 | while( nOffset != -1 )
|
| 286 | {
|
| 287 | bstr += strUtf8.substr(0, nOffset);
|
| 288 | strUtf8 = strUtf8.substr(nOffset, strUtf8.length - nOffset);
|
| 289 | if( strUtf8 == "" || strUtf8.length < 9 ) // bad string
|
| 290 | return bstr;
|
| 291 |
|
| 292 | bstr += WebDav_Utf8_To_Chinese_Char(strUtf8.substr(0, 9));
|
| 293 | strUtf8 = strUtf8.substr(9, strUtf8.length - 9);
|
| 294 | nOffset = strUtf8.indexOf("%e");
|
| 295 | if( nOffset == -1 )
|
| 296 | {
|
| 297 | nOffset = strUtf8.indexOf("%E");
|
| 298 | }
|
| 299 | }
|
| 300 |
|
| 301 | return WebDav_Utf8_To_symbol_Char(bstr + strUtf8);
|
| 302 | }
|
| 303 |
|
| 304 |
|
| 305 | function WebDav_GetImage_By_FileType(FileType)
|
| 306 | {
|
| 307 | var FileTypeImage;
|
| 308 | if(FileType=="application/pdf")
|
| 309 | {
|
| 310 | FileTypeImage="ico_webdav_pdf.png";
|
| 311 | }
|
| 312 | else if((FileType=="video/mpeg")||(FileType=="video/quicktime")
|
| 313 | ||(FileType=="video/x-msvideo")||(FileType=="video/x-ms-asf")
|
| 314 | ||(FileType=="video/x-ms-wmv")||(FileType=="video/webm")
|
| 315 | ||(FileType=="video/mp4")||(FileType=="video/x-m4v"))
|
| 316 | {
|
| 317 | FileTypeImage="ico_webdav_video.png";
|
| 318 | }
|
| 319 | else if((FileType=="application/x-tar-gz")||(FileType=="application/x-tgz")||(FileType=="application/x-tar")
|
| 320 | ||(FileType=="application/zip")||(FileType=="application/x-gzip")||(FileType=="application/x-gunzip")
|
| 321 | ||(FileType=="application/bzip2")||(FileType=="application/x-7z-compressed")||(FileType=="application/x-zip-compressed")
|
| 322 | ||(FileType=="application/x-tar")||(FileType=="application/x-rar")||(FileType=="application/x-arj-compressed"))
|
| 323 | {
|
| 324 | FileTypeImage="ico_webdav_tgz.png";
|
| 325 | }
|
| 326 | else if((FileType=="image/gif")||(FileType=="image/jpeg")||(FileType=="image/x-icon")
|
| 327 | ||(FileType=="image/png")||(FileType=="image/x-xbitmap")||(FileType=="image/svg+xml")
|
| 328 | ||(FileType=="image/x-xpixmap")||(FileType=="image/x-xwindowdump"))
|
| 329 | {
|
| 330 | FileTypeImage="ico_webdav_image.png";
|
| 331 | }
|
| 332 | else if((FileType=="audio/mpeg")||(FileType=="audio/x-mpegurl")||(FileType=="audio/mid")
|
| 333 | ||(FileType=="audio/x-ms-wma")||(FileType=="audio/x-ms-wax")||(FileType=="audio/x-pn-realaudio")
|
| 334 | ||(FileType=="audio/x-wav")||(FileType=="audio/x-mp3"))
|
| 335 | {
|
| 336 | FileTypeImage="ico_webdav_audio.png";
|
| 337 | }
|
| 338 | else
|
| 339 | {
|
| 340 | FileTypeImage="ico_webdav_txt.png";
|
| 341 | }
|
| 342 | return FileTypeImage;
|
| 343 | }
|
| 344 |
|
| 345 | function WebDav_GetFileOnClick(FileType,FileName)
|
| 346 | {
|
| 347 | FileName=encodeURIComponent(FileName);
|
| 348 | var str_path=Path_Name;
|
| 349 | var temp=new Array();
|
| 350 | temp=str_path.split("/");
|
| 351 | var path='/';
|
| 352 | for(var i=0;i<temp.length;i++)
|
| 353 | {
|
| 354 | if(temp[i]!='')
|
| 355 | {
|
| 356 | path=path+encodeURIComponent(temp[i])+"/";
|
| 357 | }
|
| 358 | }
|
| 359 | if(FileType=="httpd/unix-directory")
|
| 360 | {
|
| 361 | WebDav_PROPFIND(path+FileName+"/");
|
| 362 |
|
| 363 | }
|
| 364 | else
|
| 365 | {
|
| 366 | WebDav_Get_Open(path+FileName);
|
| 367 | }
|
| 368 | }
|
| 369 | var Order_Mode=1;
|
| 370 | var NameOrder_flag=1;
|
| 371 | var SizeOrder_flag=1;
|
| 372 | var FileDateOrder_flag=1;
|
| 373 | var WebdavFileListArray = new Array();
|
| 374 |
|
| 375 | function clear_order_image_function(img)
|
| 376 | {
|
| 377 | if(img=="Nameimg")
|
| 378 | {
|
| 379 | $("#NameOrder").hide();
|
| 380 | }
|
| 381 | if(img=="Sizeimg")
|
| 382 | {
|
| 383 | $("#SizeOrder").hide();
|
| 384 | }
|
| 385 | if(img=="Filedateimg")
|
| 386 | {
|
| 387 | $("#FiledateOrder").hide();
|
| 388 | }
|
| 389 | }
|
| 390 |
|
| 391 | function clear_upload_barview_function()
|
| 392 | {
|
| 393 | hm();
|
| 394 | }
|
| 395 |
|
| 396 | function WebDav_NameOrderOnClick()
|
| 397 | {
|
| 398 | //$("#webdav_Download_Button").hide();
|
| 399 | Order_Mode=1;
|
| 400 | var Nameimg = document.getElementById("NameOrder");
|
| 401 | if(NameOrder_flag)
|
| 402 | {
|
| 403 | Nameimg.src="//192.168.1.1/images/ico_webdav_down.png";
|
| 404 | NameOrder_flag=0;
|
| 405 | }
|
| 406 | else
|
| 407 | {
|
| 408 | NameOrder_flag=1;
|
| 409 | Nameimg.src="//192.168.1.1/images/ico_webdav_up.png";
|
| 410 | }
|
| 411 |
|
| 412 | if(WebdavFileListArray.length>0)
|
| 413 | {
|
| 414 | $("#WebdavFileListInfo").empty();
|
| 415 | var WebdavNameListArray = new Array();
|
| 416 | WebdavNameListArray.length=WebdavFileListArray.length;
|
| 417 | for(var i=0;i<WebdavFileListArray.length;i++)
|
| 418 | {
|
| 419 | var temp=new Array();
|
| 420 | temp=WebdavFileListArray[i].split("?");
|
| 421 | WebdavNameListArray[i]=temp[0].toLowerCase();
|
| 422 | }
|
| 423 | if(NameOrder_flag)
|
| 424 | {
|
| 425 | WebdavNameListArray.sort(function(a,b){return a<b?1:-1});
|
| 426 | }
|
| 427 | else
|
| 428 | {
|
| 429 | WebdavNameListArray.sort(function(a,b){return a>b?1:-1});
|
| 430 | }
|
| 431 | for(var i=0;i<WebdavFileListArray.length;i++)
|
| 432 | {
|
| 433 | for(var j=0;j<WebdavFileListArray.length;j++)
|
| 434 | {
|
| 435 | var temp=new Array();
|
| 436 | temp=WebdavFileListArray[j].split("?");
|
| 437 | if(WebdavNameListArray[i]==temp[0].toLowerCase())
|
| 438 | {
|
| 439 | var htmlText ;
|
| 440 | htmlText = "<tr style=\"cursor: pointer; background-color: rgb(255, 255, 255);\" id=\"" + temp[0] + "\" name=\"" + temp[3]+"\">"
|
| 441 | + "<td><div>"
|
| 442 | +"<input align=\"right\" type=\"checkbox\" class=\"chk11 delCheckBox\"/>"
|
| 443 | +"<img src=\"//192.168.1.1/images/"+temp[4]+"\" align=\"right\"/>"
|
| 444 | +"</div></td>"
|
| 445 | + "<td onclick=\"WebDav_GetFileOnClick('"+temp[3]+"',\'"+temp[0]+"\')\"><span>"+temp[0]+"</span></td>"
|
| 446 | + "<td><div><span>"+temp[1]+"</span></div></td>"
|
| 447 | + "<td><span>"+temp[2]+"</span></td></tr>"
|
| 448 |
|
| 449 | $("#WebdavFileListInfo").append(htmlText);
|
| 450 |
|
| 451 | $(".delCheckBox:last").click(function() {
|
| 452 | if ($(".delCheckBox:checked").length == $(".delCheckBox").length) {
|
| 453 | $("#deleteAllWebdavFile").attr("checked", true);
|
| 454 | }
|
| 455 | else {
|
| 456 | $("#deleteAllWebdavFile").attr("checked", false);
|
| 457 | }
|
| 458 |
|
| 459 | if($(".delCheckBox:checked").length==1)
|
| 460 | {
|
| 461 | $("#webdav_Share_Button").show();
|
| 462 | }
|
| 463 | else
|
| 464 | {
|
| 465 | $("#webdav_Share_Button").hide();
|
| 466 | }
|
| 467 |
|
| 468 | if ($(".delCheckBox:checked").length >= 1) {
|
| 469 |
|
| 470 | $("#webdav_Delete_Button").show();
|
| 471 | $("#webdav_Upload_Button").hide();
|
| 472 | $("#webdav_Mkdir_Button").hide();
|
| 473 |
|
| 474 | }
|
| 475 | else {
|
| 476 | $("#webdav_Delete_Button").hide();
|
| 477 | $("#webdav_Upload_Button").show();
|
| 478 | $("#webdav_Mkdir_Button").show();
|
| 479 | }
|
| 480 |
|
| 481 | });
|
| 482 |
|
| 483 | }
|
| 484 | }
|
| 485 |
|
| 486 |
|
| 487 | }
|
| 488 | }
|
| 489 |
|
| 490 |
|
| 491 | $("#NameOrder").show();
|
| 492 | setTimeout("clear_order_image_function(\"Nameimg\");",500);
|
| 493 | }
|
| 494 |
|
| 495 | function WebDav_SizeOrderOnClick()
|
| 496 | {
|
| 497 | Order_Mode=2;
|
| 498 | var Sizeimg = document.getElementById("SizeOrder");
|
| 499 | if(SizeOrder_flag)
|
| 500 | {
|
| 501 | Sizeimg.src="//192.168.1.1/images/ico_webdav_down.png";
|
| 502 | SizeOrder_flag=0;
|
| 503 | }
|
| 504 | else
|
| 505 | {
|
| 506 | SizeOrder_flag=1;
|
| 507 | Sizeimg.src="//192.168.1.1/images/ico_webdav_up.png";
|
| 508 | }
|
| 509 |
|
| 510 | if(WebdavFileListArray.length>0)
|
| 511 | {
|
| 512 | $("#WebdavFileListInfo").empty();
|
| 513 | var WebdavFolderListArray = new Array();
|
| 514 | var WebdavSizeListArray = new Array();
|
| 515 |
|
| 516 | for(var i=0;i<WebdavFileListArray.length;i++)
|
| 517 | {
|
| 518 | var temp=new Array();
|
| 519 | temp=WebdavFileListArray[i].split("?");
|
| 520 | if(temp[1]=="-")
|
| 521 | {
|
| 522 | WebdavFolderListArray.length=WebdavFolderListArray.length+1;
|
| 523 | var len=WebdavFolderListArray.length;
|
| 524 | WebdavFolderListArray[len-1]=WebdavFileListArray[i];
|
| 525 | }
|
| 526 | else
|
| 527 | {
|
| 528 | WebdavSizeListArray.length=WebdavSizeListArray.length+1;
|
| 529 | var len=WebdavSizeListArray.length;
|
| 530 | WebdavSizeListArray[len-1]=WebdavFileListArray[i];
|
| 531 | }
|
| 532 | }
|
| 533 | if(SizeOrder_flag)
|
| 534 | {
|
| 535 | for(var j=0;j<WebdavFolderListArray.length;j++)
|
| 536 | {
|
| 537 | var temp=new Array();
|
| 538 | temp=WebdavFolderListArray[j].split("?");
|
| 539 | var htmlText ;
|
| 540 | htmlText = "<tr style=\"cursor: pointer; background-color: rgb(255, 255, 255);\" id=\"" + temp[0] + "\" name=\"" + temp[3]+"\">"
|
| 541 | + "<td><div>"
|
| 542 | +"<input align=\"right\" type=\"checkbox\" class=\"chk11 delCheckBox\"/>"
|
| 543 | +"<img src=\"//192.168.1.1/images/"+temp[4]+"\" align=\"right\"/>"
|
| 544 | +"</div></td>"
|
| 545 | + "<td onclick=\"WebDav_GetFileOnClick('"+temp[3]+"',\'"+temp[0]+"\')\"><span>"+temp[0]+"</span></td>"
|
| 546 | + "<td><div><span>"+temp[1]+"</span></div></td>"
|
| 547 | + "<td><span>"+temp[2]+"</span></td></tr>"
|
| 548 |
|
| 549 | $("#WebdavFileListInfo").append(htmlText);
|
| 550 |
|
| 551 | $(".delCheckBox:last").click(function() {
|
| 552 | if ($(".delCheckBox:checked").length == $(".delCheckBox").length) {
|
| 553 | $("#deleteAllWebdavFile").attr("checked", true);
|
| 554 | }
|
| 555 | else {
|
| 556 | $("#deleteAllWebdavFile").attr("checked", false);
|
| 557 | }
|
| 558 |
|
| 559 | if($(".delCheckBox:checked").length==1)
|
| 560 | {
|
| 561 | $("#webdav_Share_Button").show();
|
| 562 | }
|
| 563 | else
|
| 564 | {
|
| 565 | $("#webdav_Share_Button").hide();
|
| 566 | }
|
| 567 |
|
| 568 | if ($(".delCheckBox:checked").length >= 1) {
|
| 569 |
|
| 570 | $("#webdav_Delete_Button").show();
|
| 571 | $("#webdav_Upload_Button").hide();
|
| 572 | $("#webdav_Mkdir_Button").hide();
|
| 573 |
|
| 574 | }
|
| 575 | else {
|
| 576 | $("#webdav_Delete_Button").hide();
|
| 577 | $("#webdav_Upload_Button").show();
|
| 578 | $("#webdav_Mkdir_Button").show();
|
| 579 | }
|
| 580 |
|
| 581 | });
|
| 582 | }
|
| 583 |
|
| 584 | var int_File_Size=new Array();
|
| 585 | for(var k=0;k<WebdavSizeListArray.length;k++)
|
| 586 | {
|
| 587 | var temp=new Array();
|
| 588 | temp=WebdavSizeListArray[k].split("?");
|
| 589 | int_File_Size.length=int_File_Size.length+1;
|
| 590 | var len=int_File_Size.length;
|
| 591 | int_File_Size[len-1]=parseInt(temp[5]);
|
| 592 |
|
| 593 | }
|
| 594 | int_File_Size.sort(function(a,b){return a<=b?1:-1});
|
| 595 | for(var k=0;k<WebdavSizeListArray.length;k++)
|
| 596 | {
|
| 597 | for(var m=0;m<WebdavSizeListArray.length;m++)
|
| 598 | {
|
| 599 | var temp=new Array();
|
| 600 | temp=WebdavSizeListArray[m].split("?");
|
| 601 | if(int_File_Size[k]==parseInt(temp[5]))
|
| 602 | {
|
| 603 | WebdavSizeListArray[m]="";
|
| 604 | var htmlText ;
|
| 605 | htmlText = "<tr style=\"cursor: pointer; background-color: rgb(255, 255, 255);\" id=\"" + temp[0] + "\" name=\"" + temp[3]+"\">"
|
| 606 | + "<td><div>"
|
| 607 | +"<input align=\"right\" type=\"checkbox\" class=\"chk11 delCheckBox\"/>"
|
| 608 | +"<img src=\"//192.168.1.1/images/"+temp[4]+"\" align=\"right\"/>"
|
| 609 | +"</div></td>"
|
| 610 | + "<td onclick=\"WebDav_GetFileOnClick('"+temp[3]+"',\'"+temp[0]+"\')\"><span>"+temp[0]+"</span></td>"
|
| 611 | + "<td><div><span>"+temp[1]+"</span></div></td>"
|
| 612 | + "<td><span>"+temp[2]+"</span></td></tr>"
|
| 613 |
|
| 614 | $("#WebdavFileListInfo").append(htmlText);
|
| 615 |
|
| 616 | $(".delCheckBox:last").click(function() {
|
| 617 | if ($(".delCheckBox:checked").length == $(".delCheckBox").length) {
|
| 618 | $("#deleteAllWebdavFile").attr("checked", true);
|
| 619 | }
|
| 620 | else {
|
| 621 | $("#deleteAllWebdavFile").attr("checked", false);
|
| 622 | }
|
| 623 |
|
| 624 |
|
| 625 | if($(".delCheckBox:checked").length==1)
|
| 626 | {
|
| 627 | $("#webdav_Share_Button").show();
|
| 628 | }
|
| 629 | else
|
| 630 | {
|
| 631 | $("#webdav_Share_Button").hide();
|
| 632 | }
|
| 633 |
|
| 634 | if ($(".delCheckBox:checked").length >= 1) {
|
| 635 |
|
| 636 | $("#webdav_Delete_Button").show();
|
| 637 | $("#webdav_Upload_Button").hide();
|
| 638 | $("#webdav_Mkdir_Button").hide();
|
| 639 |
|
| 640 | }
|
| 641 | else {
|
| 642 | $("#webdav_Delete_Button").hide();
|
| 643 | $("#webdav_Upload_Button").show();
|
| 644 | $("#webdav_Mkdir_Button").show();
|
| 645 | }
|
| 646 |
|
| 647 | });
|
| 648 | }
|
| 649 | }
|
| 650 | }
|
| 651 | }
|
| 652 | else
|
| 653 | {
|
| 654 | var int_File_Size=new Array();
|
| 655 | for(var k=0;k<WebdavSizeListArray.length;k++)
|
| 656 | {
|
| 657 | var temp=new Array();
|
| 658 | temp=WebdavSizeListArray[k].split("?");
|
| 659 | int_File_Size.length=int_File_Size.length+1;
|
| 660 | var len=int_File_Size.length;
|
| 661 | int_File_Size[len-1]=parseInt(temp[5]);
|
| 662 |
|
| 663 | }
|
| 664 | int_File_Size.sort(function(a,b){return a>=b?1:-1});
|
| 665 | for(var k=0;k<WebdavSizeListArray.length;k++)
|
| 666 | {
|
| 667 | for(var m=0;m<WebdavSizeListArray.length;m++)
|
| 668 | {
|
| 669 | var temp=new Array();
|
| 670 | temp=WebdavSizeListArray[m].split("?");
|
| 671 | if(int_File_Size[k]==parseInt(temp[5]))
|
| 672 | {
|
| 673 | WebdavSizeListArray[m]="";
|
| 674 | var htmlText ;
|
| 675 | htmlText = "<tr style=\"cursor: pointer; background-color: rgb(255, 255, 255);\" id=\"" + temp[0] + "\" name=\"" + temp[3]+"\">"
|
| 676 | + "<td><div>"
|
| 677 | +"<input align=\"right\" type=\"checkbox\" class=\"chk11 delCheckBox\"/>"
|
| 678 | +"<img src=\"//192.168.1.1/images/"+temp[4]+"\" align=\"right\"/>"
|
| 679 | +"</div></td>"
|
| 680 | + "<td onclick=\"WebDav_GetFileOnClick('"+temp[3]+"',\'"+temp[0]+"\')\"><span>"+temp[0]+"</span></td>"
|
| 681 | + "<td><div><span>"+temp[1]+"</span></div></td>"
|
| 682 | + "<td><span>"+temp[2]+"</span></td></tr>"
|
| 683 |
|
| 684 | $("#WebdavFileListInfo").append(htmlText);
|
| 685 |
|
| 686 | $(".delCheckBox:last").click(function() {
|
| 687 | if ($(".delCheckBox:checked").length == $(".delCheckBox").length) {
|
| 688 | $("#deleteAllWebdavFile").attr("checked", true);
|
| 689 | }
|
| 690 | else {
|
| 691 | $("#deleteAllWebdavFile").attr("checked", false);
|
| 692 | }
|
| 693 |
|
| 694 |
|
| 695 | if($(".delCheckBox:checked").length==1)
|
| 696 | {
|
| 697 | $("#webdav_Share_Button").show();
|
| 698 | }
|
| 699 | else
|
| 700 | {
|
| 701 | $("#webdav_Share_Button").hide();
|
| 702 | }
|
| 703 |
|
| 704 | if ($(".delCheckBox:checked").length >= 1) {
|
| 705 |
|
| 706 | $("#webdav_Delete_Button").show();
|
| 707 | $("#webdav_Upload_Button").hide();
|
| 708 | $("#webdav_Mkdir_Button").hide();
|
| 709 |
|
| 710 | }
|
| 711 | else {
|
| 712 | $("#webdav_Delete_Button").hide();
|
| 713 | $("#webdav_Upload_Button").show();
|
| 714 | $("#webdav_Mkdir_Button").show();
|
| 715 | }
|
| 716 |
|
| 717 | });
|
| 718 | }
|
| 719 | }
|
| 720 | }
|
| 721 | for(var j=0;j<WebdavFolderListArray.length;j++)
|
| 722 | {
|
| 723 | var temp=new Array();
|
| 724 | temp=WebdavFolderListArray[j].split("?");
|
| 725 | var htmlText ;
|
| 726 | htmlText = "<tr style=\"cursor: pointer; background-color: rgb(255, 255, 255);\" id=\"" + temp[0] + "\" name=\"" + temp[3]+"\">"
|
| 727 | + "<td><div>"
|
| 728 | +"<input align=\"right\" type=\"checkbox\" class=\"chk11 delCheckBox\"/>"
|
| 729 | +"<img src=\"//192.168.1.1/images/"+temp[4]+"\" align=\"right\"/>"
|
| 730 | +"</div></td>"
|
| 731 | + "<td onclick=\"WebDav_GetFileOnClick('"+temp[3]+"',\'"+temp[0]+"\')\"><span>"+temp[0]+"</span></td>"
|
| 732 | + "<td><div><span>"+temp[1]+"</span></div></td>"
|
| 733 | + "<td><span>"+temp[2]+"</span></td></tr>"
|
| 734 |
|
| 735 | $("#WebdavFileListInfo").append(htmlText);
|
| 736 | $(".delCheckBox:last").click(function() {
|
| 737 | if ($(".delCheckBox:checked").length == $(".delCheckBox").length) {
|
| 738 | $("#deleteAllWebdavFile").attr("checked", true);
|
| 739 | }
|
| 740 | else {
|
| 741 | $("#deleteAllWebdavFile").attr("checked", false);
|
| 742 | }
|
| 743 |
|
| 744 | if($(".delCheckBox:checked").length==1)
|
| 745 | {
|
| 746 | $("#webdav_Share_Button").show();
|
| 747 | }
|
| 748 | else
|
| 749 | {
|
| 750 | $("#webdav_Share_Button").hide();
|
| 751 | }
|
| 752 |
|
| 753 | if ($(".delCheckBox:checked").length >= 1) {
|
| 754 |
|
| 755 | $("#webdav_Delete_Button").show();
|
| 756 | $("#webdav_Upload_Button").hide();
|
| 757 | $("#webdav_Mkdir_Button").hide();
|
| 758 |
|
| 759 | }
|
| 760 | else {
|
| 761 | $("#webdav_Delete_Button").hide();
|
| 762 | $("#webdav_Upload_Button").show();
|
| 763 | $("#webdav_Mkdir_Button").show();
|
| 764 | }
|
| 765 |
|
| 766 | });
|
| 767 | }
|
| 768 |
|
| 769 | }
|
| 770 |
|
| 771 | }
|
| 772 |
|
| 773 | $("#SizeOrder").show();
|
| 774 | setTimeout("clear_order_image_function(\"Sizeimg\");",500);
|
| 775 | }
|
| 776 |
|
| 777 | function WebDav_FileDateOrderOnClick()
|
| 778 | {
|
| 779 | Order_Mode=3;
|
| 780 | var Filedateimg = document.getElementById("FiledateOrder");
|
| 781 | if(FileDateOrder_flag)
|
| 782 | {
|
| 783 | Filedateimg.src="//192.168.1.1/images/ico_webdav_down.png";
|
| 784 | FileDateOrder_flag=0;
|
| 785 | }
|
| 786 | else
|
| 787 | {
|
| 788 | FileDateOrder_flag=1;
|
| 789 | Filedateimg.src="//192.168.1.1/images/ico_webdav_up.png";
|
| 790 | }
|
| 791 | var WebdavFileDateListArray = new Array();
|
| 792 | if(WebdavFileListArray.length>0)
|
| 793 | {
|
| 794 | $("#WebdavFileListInfo").empty();
|
| 795 | var WebdavFileListArray_temp=new Array();
|
| 796 | WebdavFileListArray_temp.length=WebdavFileListArray.length;
|
| 797 |
|
| 798 | for(var i=0;i<WebdavFileListArray.length;i++)
|
| 799 | {
|
| 800 | var temp=new Array();
|
| 801 |
|
| 802 | WebdavFileListArray_temp[i]=WebdavFileListArray[i];
|
| 803 | temp=WebdavFileListArray[i].split("?");
|
| 804 | temp[2]=temp[2].replace("-","");
|
| 805 | temp[2]=temp[2].replace("-","");
|
| 806 | temp[2]=temp[2].replace(" ","");
|
| 807 | temp[2]=temp[2].replace(":","");
|
| 808 | temp[2]=temp[2].replace(":","");
|
| 809 |
|
| 810 |
|
| 811 | WebdavFileDateListArray.length=WebdavFileDateListArray.length+1;
|
| 812 | var len=WebdavFileDateListArray.length;
|
| 813 | WebdavFileDateListArray[len-1]=parseInt(temp[2]);
|
| 814 | }
|
| 815 |
|
| 816 |
|
| 817 |
|
| 818 |
|
| 819 | if(FileDateOrder_flag)
|
| 820 | {
|
| 821 | WebdavFileDateListArray.sort(function(a,b){return a<=b?1:-1});
|
| 822 | for(var k=0;k<WebdavFileListArray.length;k++)
|
| 823 | {
|
| 824 | for(var m=0;m<WebdavFileListArray.length;m++)
|
| 825 | {
|
| 826 | if(WebdavFileListArray_temp[m]=="")
|
| 827 | {
|
| 828 | continue;
|
| 829 | }
|
| 830 | else
|
| 831 | {
|
| 832 | var temp1=new Array();
|
| 833 | temp1=WebdavFileListArray_temp[m].split("?");
|
| 834 | var temp2=temp1[2];
|
| 835 |
|
| 836 | temp2=temp2.replace("-","");
|
| 837 | temp2=temp2.replace("-","");
|
| 838 | temp2=temp2.replace(" ","");
|
| 839 | temp2=temp2.replace(":","");
|
| 840 | temp2=temp2.replace(":","");
|
| 841 | if(WebdavFileDateListArray[k]==parseInt(temp2))
|
| 842 | {
|
| 843 | WebdavFileListArray_temp[m]="";
|
| 844 | var htmlText ;
|
| 845 | htmlText = "<tr style=\"cursor: pointer; background-color: rgb(255, 255, 255);\" id=\"" + temp1[0] + "\" name=\"" + temp1[3]+"\">"
|
| 846 | + "<td><div>"
|
| 847 | +"<input align=\"right\" type=\"checkbox\" class=\"chk11 delCheckBox\"/>"
|
| 848 | +"<img src=\"//192.168.1.1/images/"+temp1[4]+"\" align=\"right\"/>"
|
| 849 | +"</div></td>"
|
| 850 | + "<td onclick=\"WebDav_GetFileOnClick('"+temp1[3]+"',\'"+temp1[0]+"\')\"><span>"+temp1[0]+"</span></td>"
|
| 851 | + "<td><div><span>"+temp1[1]+"</span></div></td>"
|
| 852 | + "<td><span>"+temp1[2]+"</span></td></tr>"
|
| 853 |
|
| 854 | $("#WebdavFileListInfo").append(htmlText);
|
| 855 | $(".delCheckBox:last").click(function() {
|
| 856 | if ($(".delCheckBox:checked").length == $(".delCheckBox").length) {
|
| 857 | $("#deleteAllWebdavFile").attr("checked", true);
|
| 858 | }
|
| 859 | else {
|
| 860 | $("#deleteAllWebdavFile").attr("checked", false);
|
| 861 | }
|
| 862 |
|
| 863 | if($(".delCheckBox:checked").length==1)
|
| 864 | {
|
| 865 | $("#webdav_Share_Button").show();
|
| 866 | }
|
| 867 | else
|
| 868 | {
|
| 869 | $("#webdav_Share_Button").hide();
|
| 870 | }
|
| 871 |
|
| 872 | if ($(".delCheckBox:checked").length >= 1) {
|
| 873 |
|
| 874 | $("#webdav_Delete_Button").show();
|
| 875 | $("#webdav_Upload_Button").hide();
|
| 876 | $("#webdav_Mkdir_Button").hide();
|
| 877 |
|
| 878 | }
|
| 879 | else {
|
| 880 | $("#webdav_Delete_Button").hide();
|
| 881 | $("#webdav_Upload_Button").show();
|
| 882 | $("#webdav_Mkdir_Button").show();
|
| 883 | }
|
| 884 |
|
| 885 | });
|
| 886 |
|
| 887 | break;
|
| 888 | }
|
| 889 | }
|
| 890 |
|
| 891 | }
|
| 892 | }
|
| 893 | }
|
| 894 | else
|
| 895 | {
|
| 896 | WebdavFileDateListArray.sort(function(a,b){return a>=b?1:-1});
|
| 897 | for(var k=0;k<WebdavFileListArray.length;k++)
|
| 898 | {
|
| 899 | for(var m=0;m<WebdavFileListArray.length;m++)
|
| 900 | {
|
| 901 | if(WebdavFileListArray_temp[m]=="")
|
| 902 | {
|
| 903 | continue;
|
| 904 | }
|
| 905 | else
|
| 906 | {
|
| 907 | var temp1=new Array();
|
| 908 | temp1=WebdavFileListArray_temp[m].split("?");
|
| 909 | var temp2=temp1[2];
|
| 910 |
|
| 911 | temp2=temp2.replace("-","");
|
| 912 | temp2=temp2.replace("-","");
|
| 913 | temp2=temp2.replace(" ","");
|
| 914 | temp2=temp2.replace(":","");
|
| 915 | temp2=temp2.replace(":","");
|
| 916 | if(WebdavFileDateListArray[k]==parseInt(temp2))
|
| 917 | {
|
| 918 | WebdavFileListArray_temp[m]="";
|
| 919 | var htmlText ;
|
| 920 | htmlText = "<tr style=\"cursor: pointer; background-color: rgb(255, 255, 255);\" id=\"" + temp1[0] + "\" name=\"" + temp1[3]+"\">"
|
| 921 | + "<td><div>"
|
| 922 | +"<input align=\"right\" type=\"checkbox\" class=\"chk11 delCheckBox\"/>"
|
| 923 | +"<img src=\"//192.168.1.1/images/"+temp1[4]+"\" align=\"right\"/>"
|
| 924 | +"</div></td>"
|
| 925 | + "<td onclick=\"WebDav_GetFileOnClick('"+temp1[3]+"',\'"+temp1[0]+"\')\"><span>"+temp1[0]+"</span></td>"
|
| 926 | + "<td><div><span>"+temp1[1]+"</span></div></td>"
|
| 927 | + "<td><span>"+temp1[2]+"</span></td></tr>"
|
| 928 |
|
| 929 | $("#WebdavFileListInfo").append(htmlText);
|
| 930 | $(".delCheckBox:last").click(function() {
|
| 931 | if ($(".delCheckBox:checked").length == $(".delCheckBox").length) {
|
| 932 | $("#deleteAllWebdavFile").attr("checked", true);
|
| 933 | }
|
| 934 | else {
|
| 935 | $("#deleteAllWebdavFile").attr("checked", false);
|
| 936 | }
|
| 937 | if($(".delCheckBox:checked").length==1)
|
| 938 | {
|
| 939 | $("#webdav_Share_Button").show();
|
| 940 | }
|
| 941 | else
|
| 942 | {
|
| 943 | $("#webdav_Share_Button").hide();
|
| 944 | }
|
| 945 |
|
| 946 | if ($(".delCheckBox:checked").length >= 1) {
|
| 947 |
|
| 948 | $("#webdav_Delete_Button").show();
|
| 949 | $("#webdav_Upload_Button").hide();
|
| 950 | $("#webdav_Mkdir_Button").hide();
|
| 951 |
|
| 952 | }
|
| 953 | else {
|
| 954 | $("#webdav_Delete_Button").hide();
|
| 955 | $("#webdav_Upload_Button").show();
|
| 956 | $("#webdav_Mkdir_Button").show();
|
| 957 | }
|
| 958 |
|
| 959 | });
|
| 960 |
|
| 961 | break;
|
| 962 | }
|
| 963 | }
|
| 964 |
|
| 965 | }
|
| 966 | }
|
| 967 | }
|
| 968 |
|
| 969 | }
|
| 970 | $("#FiledateOrder").show();
|
| 971 | setTimeout("clear_order_image_function(\"Filedateimg\");",500);
|
| 972 | }
|
| 973 |
|
| 974 | function WebDav_BackOnClick()
|
| 975 | {
|
| 976 | var path='';
|
| 977 | var name=new Array();
|
| 978 | name =Path_Name.split("/");
|
| 979 | var i=0;
|
| 980 | if(name.length>2)
|
| 981 | {
|
| 982 | for(i=0;i<name.length-2;i++)
|
| 983 | {
|
| 984 | path=path+encodeURIComponent(name[i])+'/';
|
| 985 | }
|
| 986 | }
|
| 987 | else
|
| 988 | {
|
| 989 | var path='/';
|
| 990 | }
|
| 991 | WebDav_PROPFIND(path);
|
| 992 | }
|
| 993 |
|
| 994 |
|
| 995 | function WebDav_Get_Open(path)
|
| 996 | {
|
| 997 | var contentType="";
|
| 998 | var xml_content=WebDav_GetSyncXML(path,contentType);
|
| 999 | window.open("/webdav" + path, '_blank');
|
| 1000 |
|
| 1001 | }
|
| 1002 |
|
| 1003 |
|
| 1004 | function WebDav_Get_Download(FileName)
|
| 1005 | {
|
| 1006 |
|
| 1007 |
|
| 1008 | var contentType="application/octet-stream";
|
| 1009 |
|
| 1010 | var FileNameArray = new Array();
|
| 1011 | FileNameArray =FileName.split("/");
|
| 1012 | var i=0;
|
| 1013 | var j=0;
|
| 1014 | var currnwin;
|
| 1015 | for(i=0;i<FileNameArray.length;i++)
|
| 1016 | {
|
| 1017 | if(FileNameArray[i]!="")
|
| 1018 | {
|
| 1019 | var path=Path_Name;
|
| 1020 | path=path+FileNameArray[i];
|
| 1021 | var xml_content=WebDav_GetSyncXML(path,contentType);
|
| 1022 | currnwin=window.open("dav"+path, '_blank','scrollbars=yes,z-look=yes,resizable=no,width=550,height=350');
|
| 1023 | }
|
| 1024 | while(j<1000000000)
|
| 1025 | {
|
| 1026 | j++;
|
| 1027 | }
|
| 1028 |
|
| 1029 | }
|
| 1030 | var pro_path=WebDav_chines_utf8(Path_Name);
|
| 1031 | WebDav_PROPFIND(pro_path);
|
| 1032 | }
|
| 1033 |
|
| 1034 | function WebDav_chines_utf8(chines_path)
|
| 1035 | {
|
| 1036 | var path=chines_path;
|
| 1037 | var name=new Array();
|
| 1038 | name =path.split("/");
|
| 1039 | var str_path='/';
|
| 1040 | var i=0;
|
| 1041 | for(i=0;i<name.length;i++)
|
| 1042 | {
|
| 1043 | if(name[i]!='')
|
| 1044 | {
|
| 1045 | str_path=str_path+encodeURIComponent(name[i])+'/';
|
| 1046 | }
|
| 1047 |
|
| 1048 | }
|
| 1049 | return str_path;
|
| 1050 | }
|
| 1051 |
|
| 1052 | function WebDav_Delete(FileName)
|
| 1053 | {
|
| 1054 |
|
| 1055 | var FileNameArray = new Array();
|
| 1056 | FileNameArray =FileName.split("/");
|
| 1057 | var i=0;
|
| 1058 | var currnwin;
|
| 1059 | sm("PleaseWait", 150, 100);
|
| 1060 | $("#lPleaseWait").text(jQuery.i18n.prop("h1PleaseWait"));
|
| 1061 | for(i=0;i<FileNameArray.length;i++)
|
| 1062 | {
|
| 1063 | if(FileNameArray[i]!="")
|
| 1064 | {
|
| 1065 | FileNameArray[i]=encodeURIComponent(FileNameArray[i]);
|
| 1066 | var path=WebDav_chines_utf8(Path_Name);
|
| 1067 | path=path+FileNameArray[i];
|
| 1068 | var xml_content=WebDav_DeleteSyncXML(path);
|
| 1069 | }
|
| 1070 | }
|
| 1071 | hm();
|
| 1072 | var pro_path=WebDav_chines_utf8(Path_Name);
|
| 1073 | WebDav_PROPFIND(pro_path);
|
| 1074 |
|
| 1075 | }
|
| 1076 | var share_file_name="";
|
| 1077 |
|
| 1078 | function WebDav_Share(share_name,fileType)
|
| 1079 | {
|
| 1080 | if ($("#deleteAllWebdavFile").attr("checked")) {
|
| 1081 |
|
| 1082 | } else
|
| 1083 | {}
|
| 1084 |
|
| 1085 | sm("webdavsharsettingDlg", 450, 150);
|
| 1086 | $("#ReadModeSta").attr("checked", true);
|
| 1087 | $("#ReadWriteModeSta").attr("checked", false);
|
| 1088 |
|
| 1089 | var ShareFileNameArray = new Array();
|
| 1090 | ShareFileNameArray =share_name.split("/");
|
| 1091 | share_file_name=ShareFileNameArray[0];
|
| 1092 | if(fileType=="httpd/unix-directory")
|
| 1093 | {
|
| 1094 | share_file_name=share_file_name+"/";
|
| 1095 | }
|
| 1096 | share_read_select=1;
|
| 1097 |
|
| 1098 | document.getElementById('ShareFile_Path').innerHTML=ShareFileNameArray[0];
|
| 1099 |
|
| 1100 | }
|
| 1101 |
|
| 1102 | function WebDav_Share_Setting_Select()
|
| 1103 | {
|
| 1104 |
|
| 1105 | var select_value=document.getElementById("ShareSelect").value;
|
| 1106 | if(select_value=="1")
|
| 1107 | {
|
| 1108 | share_read_select=1;
|
| 1109 | $("#share_mode_setting").show();
|
| 1110 | $("#ReadModeSta").attr("checked", true);
|
| 1111 | $("#ReadWriteModeSta").attr("checked", false);
|
| 1112 |
|
| 1113 | $("#ReadModeSta").attr("disabled", false);
|
| 1114 | $("#ReadWriteModeSta").attr("disabled", false);
|
| 1115 | document.getElementById('ShareFile_Path').innerHTML=share_file_name;
|
| 1116 | }
|
| 1117 | else if(select_value=="2")
|
| 1118 | {
|
| 1119 | share_read_select=1;
|
| 1120 | $("#share_mode_setting").show();
|
| 1121 | $("#ReadModeSta").attr("checked", true);
|
| 1122 | $("#ReadWriteModeSta").attr("checked", false);
|
| 1123 |
|
| 1124 | $("#ReadModeSta").attr("disabled", false);
|
| 1125 | $("#ReadWriteModeSta").attr("disabled", false);
|
| 1126 |
|
| 1127 | document.getElementById('ShareFile_Path').innerHTML=jQuery.i18n.prop("webdav_Path_Root");
|
| 1128 | }
|
| 1129 | else if(select_value=="3")
|
| 1130 | {
|
| 1131 |
|
| 1132 | var xml = getData('webdav_management');
|
| 1133 | $(xml).find("webdav_shared_management").each(function() {
|
| 1134 |
|
| 1135 | var shared_enable=$(this).find("webdav_shared_enable").text();
|
| 1136 | if(shared_enable=="1")
|
| 1137 | {
|
| 1138 | var shared_path=$(this).find("webdav_shared_file_name").text();
|
| 1139 | if(shared_path=="/")
|
| 1140 | {
|
| 1141 | document.getElementById('ShareFile_Path').innerHTML=jQuery.i18n.prop("webdav_Path_Root");
|
| 1142 | }
|
| 1143 | else
|
| 1144 | {
|
| 1145 | document.getElementById('ShareFile_Path').innerHTML=WebDav_Utf8_To_Char(shared_path);
|
| 1146 | }
|
| 1147 |
|
| 1148 | $("#share_mode_setting").show();
|
| 1149 | var shared_mode=$(this).find("webdav_shared_only_read").text();
|
| 1150 | if(shared_mode=="1")
|
| 1151 | {
|
| 1152 | $("#ReadModeSta").attr("checked", true);
|
| 1153 | $("#ReadWriteModeSta").attr("checked", false);
|
| 1154 | }
|
| 1155 | else
|
| 1156 | {
|
| 1157 | $("#ReadModeSta").attr("checked", false);
|
| 1158 | $("#ReadWriteModeSta").attr("checked", true);
|
| 1159 | }
|
| 1160 |
|
| 1161 | $("#ReadModeSta").attr("disabled", true);
|
| 1162 | $("#ReadWriteModeSta").attr("disabled", true);
|
| 1163 | }
|
| 1164 | else
|
| 1165 | {
|
| 1166 | $("#share_mode_setting").hide();
|
| 1167 | document.getElementById('ShareFile_Path').innerHTML=jQuery.i18n.prop("lsdcardsharestatus");
|
| 1168 | }
|
| 1169 |
|
| 1170 |
|
| 1171 |
|
| 1172 | });
|
| 1173 |
|
| 1174 |
|
| 1175 | }
|
| 1176 | else if(select_value=="4")
|
| 1177 | {
|
| 1178 | $("#share_mode_setting").hide();
|
| 1179 | document.getElementById('ShareFile_Path').innerHTML="";
|
| 1180 | }
|
| 1181 | else
|
| 1182 | {
|
| 1183 | alert(select_value);
|
| 1184 | }
|
| 1185 |
|
| 1186 |
|
| 1187 | }
|
| 1188 |
|
| 1189 |
|
| 1190 | var share_read_select;
|
| 1191 | function ShareReadMode()
|
| 1192 | {
|
| 1193 | $("#ReadModeSta").attr("checked", true);
|
| 1194 | $("#ReadWriteModeSta").attr("checked", false);
|
| 1195 | share_read_select=1;
|
| 1196 | }
|
| 1197 |
|
| 1198 |
|
| 1199 |
|
| 1200 | function ShareReadWriteMode()
|
| 1201 | {
|
| 1202 | $("#ReadModeSta").attr("checked", false);
|
| 1203 | $("#ReadWriteModeSta").attr("checked", true);
|
| 1204 | share_read_select=0;
|
| 1205 | }
|
| 1206 |
|
| 1207 |
|
| 1208 | function WebDav_Share_Setting_OK()
|
| 1209 | {
|
| 1210 | var WebdavSharedEnable=0;
|
| 1211 | var retXml = PostXml("router","webdav_get_management_info");
|
| 1212 | $(retXml).find("webdav_basic").each(function() {
|
| 1213 | enable = $(this).find("enable").text();
|
| 1214 | if(enable=="on")
|
| 1215 | {
|
| 1216 | WebdavSharedEnable=1;
|
| 1217 | }
|
| 1218 | else
|
| 1219 | {
|
| 1220 | WebdavSharedEnable=0
|
| 1221 | }
|
| 1222 | });
|
| 1223 | if(WebdavSharedEnable!=1)
|
| 1224 | {
|
| 1225 | hm();
|
| 1226 | showAlert("lsharesettingresultfail_notsupport");
|
| 1227 | return;
|
| 1228 | }
|
| 1229 | var webdavConfigMap = new Map();
|
| 1230 | var share_enable;
|
| 1231 | var share_path;
|
| 1232 | var share_read;
|
| 1233 | var select_value=document.getElementById("ShareSelect").value;
|
| 1234 |
|
| 1235 | if(select_value=="1")
|
| 1236 | {
|
| 1237 | share_enable=1;
|
| 1238 | share_read=share_read_select;
|
| 1239 | share_path=Path_Name+share_file_name;
|
| 1240 | }
|
| 1241 | else if(select_value=="2")
|
| 1242 | {
|
| 1243 | share_enable=1;
|
| 1244 | share_read=share_read_select;
|
| 1245 | share_path=Path_Name;
|
| 1246 | }
|
| 1247 | else if(select_value=="3")
|
| 1248 | {
|
| 1249 | hm();
|
| 1250 | return;
|
| 1251 | }
|
| 1252 | else if(select_value=="4")
|
| 1253 | {
|
| 1254 | share_enable=0;
|
| 1255 | share_read=0;
|
| 1256 | share_path="";
|
| 1257 | }
|
| 1258 |
|
| 1259 | var curConfigMap = new Map();
|
| 1260 | curConfigMap.put("RGW/router/shared_path",share_path);
|
| 1261 | var configMap = curConfigMap.getChange(webdavConfigMap);
|
| 1262 | WebDav_PostXml("router","webdav_add_shared",configMap);
|
| 1263 |
|
| 1264 | //var itemIndex = 0;
|
| 1265 | //mapData = null;
|
| 1266 | //mapData = new Array();
|
| 1267 |
|
| 1268 | //mapData=putMapElement(mapData,"RGW/webdav_shared_management/webdav_shared_enable", share_enable, itemIndex++);
|
| 1269 | //mapData=putMapElement(mapData,"RGW/webdav_shared_management/webdav_shared_only_read", share_read, itemIndex++);
|
| 1270 | //mapData=putMapElement(mapData,"RGW/webdav_shared_management/webdav_shared_file_name", share_path, itemIndex++);
|
| 1271 | //if (mapData.length > 0) {
|
| 1272 | // webdav_postXML('webdav_management', g_objXML.getXMLDocToString(g_objXML.createXML(mapData)));
|
| 1273 | //}
|
| 1274 |
|
| 1275 | }
|
| 1276 |
|
| 1277 | function WebDav_Mkdir(FolderName)
|
| 1278 | {
|
| 1279 | var path=Path_Name;
|
| 1280 | var name=new Array();
|
| 1281 | name =path.split("/");
|
| 1282 | var str_path='/';
|
| 1283 | var i=0;
|
| 1284 | for(i=0;i<name.length;i++)
|
| 1285 | {
|
| 1286 | if(name[i]!='')
|
| 1287 | {
|
| 1288 | str_path=str_path+encodeURIComponent(name[i])+'/';
|
| 1289 | }
|
| 1290 |
|
| 1291 | }
|
| 1292 | var prop_path=str_path;
|
| 1293 | str_path=str_path+FolderName;
|
| 1294 | var xml_content=WebDav_MkdirSyncXML(str_path);
|
| 1295 | WebDav_PROPFIND(prop_path);
|
| 1296 |
|
| 1297 | }
|
| 1298 |
|
| 1299 |
|
| 1300 | function stringToXml(xmlString)
|
| 1301 | {
|
| 1302 | var xmlDoc;
|
| 1303 | if(typeof xmlString == "string")
|
| 1304 | {
|
| 1305 | //FF
|
| 1306 | if (document.implementation.createDocument) {
|
| 1307 | var parser = new DOMParser();
|
| 1308 | xmlDoc = parser.parseFromString(xmlString, "application/xml");
|
| 1309 | //IE
|
| 1310 | } else if (window.ActiveXObject) {
|
| 1311 | xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
|
| 1312 | xmlDoc.async="false";
|
| 1313 | xmlDoc.loadXML(xmlString);
|
| 1314 | }
|
| 1315 | }
|
| 1316 | else
|
| 1317 | {
|
| 1318 | xmlDoc = xmlString;
|
| 1319 | }
|
| 1320 | return xmlDoc;
|
| 1321 | }
|
| 1322 |
|
| 1323 | var webdav_username="",webdav_passwd="";
|
| 1324 | var Authrealm_webdav="WebDav";
|
| 1325 | var nonce_webdav="d591e50a9ede43d822dc46162b3f7ce1";
|
| 1326 | var AuthQop_webdav="auth";
|
| 1327 |
|
| 1328 | function webdav_getAuthHeader(requestType,file) {
|
| 1329 | // return getCookie("Authheader");
|
| 1330 | var rand, date, salt, strAuthHeader;
|
| 1331 | var tmp, DigestRes,AuthCnonce_f;
|
| 1332 | var HA1, HA2;
|
| 1333 |
|
| 1334 |
|
| 1335 |
|
| 1336 | HA1 = hex_md5(webdav_username+ ":" + Authrealm_webdav + ":" + webdav_passwd);
|
| 1337 | HA2 = hex_md5( requestType + ":" + "/cgi/xml_action.cgi");
|
| 1338 |
|
| 1339 | rand = Math.floor(Math.random()*100001)
|
| 1340 | date = new Date().getTime();
|
| 1341 |
|
| 1342 | salt = rand+""+date;
|
| 1343 | tmp = hex_md5(salt);
|
| 1344 | AuthCnonce_f = tmp.substring(0,16);
|
| 1345 | //AuthCnonce_f = tmp;
|
| 1346 |
|
| 1347 | var strhex = hex(GnCount);
|
| 1348 | var temp = "0000000000" + strhex;
|
| 1349 | var Authcount = temp.substring(temp.length-8);
|
| 1350 | DigestRes =hex_md5(HA1 + ":" + nonce_webdav + ":" + Authcount + ":" + AuthCnonce_f + ":" + AuthQop_webdav + ":"+ HA2);
|
| 1351 |
|
| 1352 |
|
| 1353 | GnCount++;
|
| 1354 | strAuthHeader = "Digest " + "username=\"" + webdav_username + "\", realm=\"" + Authrealm_webdav + "\", nonce=\"" + nonce_webdav + "\", uri=\"" + "/cgi/xml_action.cgi" + "\", response=\"" + DigestRes + "\", qop=" + AuthQop_webdav + ", nc=" + Authcount + ", cnonce=\"" + AuthCnonce_f + "\"" ;
|
| 1355 | DigestHeader = strAuthHeader ;
|
| 1356 | return strAuthHeader;
|
| 1357 | }
|
| 1358 |
|
| 1359 | function WebDav_Login_OK()
|
| 1360 | {
|
| 1361 |
|
| 1362 | webdav_username = $("#tbaWebDav_username").val();
|
| 1363 | webdav_passwd = $("#WebDav_password").val();
|
| 1364 | var res=WebDav_Get_OPTIONS();
|
| 1365 | if(res==-1)
|
| 1366 | {
|
| 1367 | $("#webdav_Upload_Button").hide();
|
| 1368 | $("#webdav_Mkdir_Button").hide();
|
| 1369 | $("#webdav_Share_Button").hide();
|
| 1370 | $("#webdav_Delete_Button").hide();
|
| 1371 | $("#lloginfailed").show();
|
| 1372 | }
|
| 1373 | else
|
| 1374 | {
|
| 1375 | hm();
|
| 1376 | }
|
| 1377 | }
|
| 1378 |
|
| 1379 | function WebDav_Login ()
|
| 1380 | {
|
| 1381 |
|
| 1382 | //var xml_content=WebDav_Options();
|
| 1383 | //if(xml_content.search('Internal Server Error')!=-1)
|
| 1384 | //{
|
| 1385 | $("#webdav_Upload_Button").hide();
|
| 1386 | $("#webdav_Mkdir_Button").hide();
|
| 1387 | $("#webdav_Share_Button").hide();
|
| 1388 | $("#webdav_Delete_Button").hide();
|
| 1389 | sm("WebdavLoginInfoDlg", 450, 150);
|
| 1390 | //return -1;
|
| 1391 | //}
|
| 1392 | //else
|
| 1393 | //{
|
| 1394 | // WebDav_PROPFIND("/");
|
| 1395 | //}
|
| 1396 |
|
| 1397 | }
|
| 1398 |
|
| 1399 | function WebDav_Get_OPTIONS ()
|
| 1400 | {
|
| 1401 | /*
|
| 1402 | var xml_content=WebDav_Options();
|
| 1403 | if(xml_content.search('Internal Server Error')!=-1)
|
| 1404 | {
|
| 1405 | $("#webdav_Upload_Button").hide();
|
| 1406 | $("#webdav_Mkdir_Button").hide();
|
| 1407 | $("#webdav_Share_Button").hide();
|
| 1408 | $("#webdav_Delete_Button").hide();
|
| 1409 | sm("WebdavLoginInfoDlg", 450, 150);
|
| 1410 | return -1;
|
| 1411 | }
|
| 1412 | else
|
| 1413 | {
|
| 1414 | WebDav_PROPFIND("/");
|
| 1415 | }
|
| 1416 | */
|
| 1417 |
|
| 1418 | //var url = window.location.protocol + "//" + window.location.host + "/webdav/login.cgi";
|
| 1419 | //var loginParam = getAuthType(url);
|
| 1420 | WebDav_PROPFIND("/");
|
| 1421 | }
|
| 1422 |
|
| 1423 | function WebDav_PROPFIND (path)
|
| 1424 | {
|
| 1425 | var xml = '<?xml version=\"1.0\" encoding=\"utf-8\"?>\n';
|
| 1426 | xml += '<d:propfind xmlns:d=\"DAV:\">\n';
|
| 1427 | xml += '<d:prop>\n';
|
| 1428 | xml += '<d:displayname/>\n';
|
| 1429 | xml += '<d:getcontentlength/>\n';
|
| 1430 | xml += '<d:getcontenttype/>\n';
|
| 1431 | xml += '<d:resourcetype/>\n';
|
| 1432 | xml += '<d:getlastmodified/>\n';
|
| 1433 | xml += '<d:lockdiscovery/>\n';
|
| 1434 | xml += '</d:prop>\n';
|
| 1435 | xml += '</d:propfind>\n';
|
| 1436 |
|
| 1437 | var xml_content=WebDav_PropfindSyncXML(path,xml);
|
| 1438 | if(xml_content.search('Internal Server Error')!=-1)
|
| 1439 | {
|
| 1440 | $("#webdav_Upload_Button").hide();
|
| 1441 | $("#webdav_Mkdir_Button").hide();
|
| 1442 | $("#webdav_Share_Button").hide();
|
| 1443 | $("#webdav_Delete_Button").hide();
|
| 1444 | sm("WebdavLoginInfoDlg", 450, 150);
|
| 1445 | return -1;
|
| 1446 | }
|
| 1447 |
|
| 1448 | $("#WebdavFileListInfo").empty();
|
| 1449 | WebdavFileListArray.length = 0;
|
| 1450 | $("#webdav_Upload_Button").show();
|
| 1451 | $("#webdav_Mkdir_Button").show();
|
| 1452 | $("#webdav_Share_Button").hide();
|
| 1453 | $("#webdav_Delete_Button").hide();
|
| 1454 | $("#deleteAllWebdavFile").attr("checked", false);
|
| 1455 |
|
| 1456 | var FileSize_flag;
|
| 1457 |
|
| 1458 | while(1)
|
| 1459 | {
|
| 1460 | if(xml_content.indexOf("D:")!=-1)
|
| 1461 | {
|
| 1462 | xml_content=xml_content.replace("D:","");
|
| 1463 | }
|
| 1464 | else
|
| 1465 | {
|
| 1466 | break;
|
| 1467 | }
|
| 1468 | }
|
| 1469 | var xmldoc=stringToXml(xml_content);
|
| 1470 | $(xmldoc).find("response").each(function() {
|
| 1471 | if(path=="/")
|
| 1472 | {
|
| 1473 | $("#webdav_Path_NoRoot").hide();
|
| 1474 | $("#webdav_Path_Root").show();
|
| 1475 | document.getElementById('webdav_Path_Root').innerHTML=jQuery.i18n.prop("webdav_Path_Root");
|
| 1476 | var zoom=document.getElementById('webdav_Path_Root');
|
| 1477 | zoom.style.fontWeight="bold";
|
| 1478 |
|
| 1479 | }
|
| 1480 | else
|
| 1481 | {
|
| 1482 | $("#webdav_Path_Root").hide();
|
| 1483 | $("#webdav_Path_NoRoot").show();
|
| 1484 | document.getElementById('webdav_Back_label').innerHTML=jQuery.i18n.prop("webdav_Back_label");
|
| 1485 |
|
| 1486 | }
|
| 1487 |
|
| 1488 | var FileName=$(this).find("href").text();
|
| 1489 | FileName=FileName.replace("/webdav","");
|
| 1490 | if(WebDav_Utf8_To_Char(FileName)==WebDav_Utf8_To_Char(path))
|
| 1491 | {
|
| 1492 | //FileName=FileName.replace(window.location.protocol + "//" + window.location.host + "/"+"dav","");
|
| 1493 | Path_Name=WebDav_Utf8_To_Char(FileName);
|
| 1494 | var FileNameArray = new Array();
|
| 1495 | FileNameArray =FileName.split("/");
|
| 1496 | document.getElementById('webdav_Path_record').innerHTML=jQuery.i18n.prop("webdav_Path_record");
|
| 1497 | for(var i=0;i<FileNameArray.length;i++)
|
| 1498 | {
|
| 1499 | if(FileNameArray[i]!="")
|
| 1500 | {
|
| 1501 | document.getElementById('webdav_Path_record').innerHTML+=">"+WebDav_Utf8_To_Char(FileNameArray[i]);
|
| 1502 |
|
| 1503 | }
|
| 1504 | }
|
| 1505 | var zoom=document.getElementById('webdav_Path_record');
|
| 1506 | zoom.style.fontWeight="bold";
|
| 1507 | }
|
| 1508 | else
|
| 1509 | {
|
| 1510 |
|
| 1511 | FileName=WebDav_Utf8_To_Char(FileName);
|
| 1512 | FileName=FileName.replace(WebDav_Utf8_To_Char(path),"");
|
| 1513 |
|
| 1514 | var FileSize;
|
| 1515 | var FileType=$(this).find("getcontenttype").text();
|
| 1516 |
|
| 1517 | var FileTypeImage;
|
| 1518 | if(FileType=="httpd/unix-directory")
|
| 1519 | {
|
| 1520 | FileSize="-";
|
| 1521 | FileTypeImage="ico_webdav_directory.png"
|
| 1522 | FileName=FileName.replace("/","");
|
| 1523 | }
|
| 1524 | else
|
| 1525 | {
|
| 1526 | FileSize=$(this).find("getcontentlength").text();
|
| 1527 | FileSize_flag=FileSize;
|
| 1528 | if(parseInt(FileSize)<1024)
|
| 1529 | {
|
| 1530 | FileSize=FileSize+'B';
|
| 1531 | }else if(parseInt(FileSize)<1048576)
|
| 1532 | {
|
| 1533 | var size=parseInt((parseInt(FileSize)/1024)*100);
|
| 1534 | FileSize=size/100+'K';
|
| 1535 | }
|
| 1536 | else
|
| 1537 | {
|
| 1538 | var size=parseInt((parseInt(FileSize)/1048576)*100);
|
| 1539 | FileSize=size/100+'M';
|
| 1540 | }
|
| 1541 | FileTypeImage=WebDav_GetImage_By_FileType(FileType);
|
| 1542 |
|
| 1543 | }
|
| 1544 |
|
| 1545 | var FileDate=$(this).find("getlastmodified").text();
|
| 1546 | FileDate=WebDav_GetDate_By_DateStr(FileDate);
|
| 1547 |
|
| 1548 | var htmlText ;
|
| 1549 | htmlText = "<tr style=\"cursor: pointer; background-color: rgb(255, 255, 255);\" id=\"" + FileName + "\" name=\"" + FileType + "\">"
|
| 1550 | + "<td><div>"
|
| 1551 | +"<input align=\"right\" type=\"checkbox\" class=\"chk11 delCheckBox\"/>"
|
| 1552 | +"<img src=\"//192.168.1.1/images/"+FileTypeImage+"\" align=\"right\"/>"
|
| 1553 | +"</div></td>"
|
| 1554 | + "<td onclick=\"WebDav_GetFileOnClick('"+FileType+"',\'"+FileName+"\')\"><span>"+FileName+"</span></td>"
|
| 1555 | + "<td><div><span>"+FileSize+"</span></div></td>"
|
| 1556 | + "<td><span>"+FileDate+"</span></td></tr>"
|
| 1557 |
|
| 1558 |
|
| 1559 |
|
| 1560 | WebdavFileListArray.length=WebdavFileListArray.length+1;
|
| 1561 | var len;
|
| 1562 | len=WebdavFileListArray.length;
|
| 1563 | WebdavFileListArray[len-1]=FileName+"?"+FileSize+"?"+FileDate+"?"+FileType+"?"+FileTypeImage+"?"+FileSize_flag;
|
| 1564 |
|
| 1565 | $("#WebdavFileListInfo").append(htmlText);
|
| 1566 |
|
| 1567 |
|
| 1568 | $(".delCheckBox:last").click(function() {
|
| 1569 | if ($(".delCheckBox:checked").length == $(".delCheckBox").length) {
|
| 1570 | $("#deleteAllWebdavFile").attr("checked", true);
|
| 1571 | }
|
| 1572 | else {
|
| 1573 | $("#deleteAllWebdavFile").attr("checked", false);
|
| 1574 | }
|
| 1575 |
|
| 1576 | if($(".delCheckBox:checked").length==1)
|
| 1577 | {
|
| 1578 | $("#webdav_Share_Button").show();
|
| 1579 | }
|
| 1580 | else
|
| 1581 | {
|
| 1582 | $("#webdav_Share_Button").hide();
|
| 1583 | }
|
| 1584 |
|
| 1585 | if ($(".delCheckBox:checked").length >= 1) {
|
| 1586 |
|
| 1587 |
|
| 1588 | $("#webdav_Delete_Button").show();
|
| 1589 | $("#webdav_Upload_Button").hide();
|
| 1590 | $("#webdav_Mkdir_Button").hide();
|
| 1591 |
|
| 1592 | }
|
| 1593 | else {
|
| 1594 |
|
| 1595 | $("#webdav_Delete_Button").hide();
|
| 1596 | $("#webdav_Upload_Button").show();
|
| 1597 | $("#webdav_Mkdir_Button").show();
|
| 1598 | }
|
| 1599 |
|
| 1600 | });
|
| 1601 |
|
| 1602 | $("#deleteAllWebdavFile").click(function() {
|
| 1603 | if ($("#deleteAllWebdavFile").attr("checked")) {
|
| 1604 | $(".delCheckBox").attr("checked", true);
|
| 1605 | } else
|
| 1606 | $(".delCheckBox").attr("checked", false);
|
| 1607 |
|
| 1608 | if($(".delCheckBox:checked").length==1)
|
| 1609 | {
|
| 1610 | $("#webdav_Share_Button").show();
|
| 1611 | }
|
| 1612 | else
|
| 1613 | {
|
| 1614 | $("#webdav_Share_Button").hide();
|
| 1615 | }
|
| 1616 |
|
| 1617 | if ($(".delCheckBox:checked").length >= 1)
|
| 1618 | {
|
| 1619 | $("#webdav_Delete_Button").show();
|
| 1620 | $("#webdav_Upload_Button").hide();
|
| 1621 | $("#webdav_Mkdir_Button").hide();
|
| 1622 | }
|
| 1623 | else
|
| 1624 | {
|
| 1625 | $("#webdav_Delete_Button").hide();
|
| 1626 | $("#webdav_Upload_Button").show();
|
| 1627 | $("#webdav_Mkdir_Button").show();
|
| 1628 | }
|
| 1629 | });
|
| 1630 |
|
| 1631 | }
|
| 1632 |
|
| 1633 |
|
| 1634 | });
|
| 1635 | /*
|
| 1636 | if(Order_Mode==1)
|
| 1637 | {
|
| 1638 | if(NameOrder_flag)
|
| 1639 | {
|
| 1640 | NameOrder_flag=0;
|
| 1641 | }
|
| 1642 | else
|
| 1643 | {
|
| 1644 | NameOrder_flag=1;
|
| 1645 | }
|
| 1646 | WebDav_NameOrderOnClick();
|
| 1647 | }
|
| 1648 | else if(Order_Mode==2)
|
| 1649 | {
|
| 1650 |
|
| 1651 | if(SizeOrder_flag)
|
| 1652 | {
|
| 1653 | SizeOrder_flag=0;
|
| 1654 | }
|
| 1655 | else
|
| 1656 | {
|
| 1657 | SizeOrder_flag=1;
|
| 1658 | }
|
| 1659 | WebDav_SizeOrderOnClick();
|
| 1660 | }
|
| 1661 | else if(Order_Mode==3)
|
| 1662 | {
|
| 1663 | if(FileDateOrder_flag)
|
| 1664 | {
|
| 1665 | FileDateOrder_flag=0;
|
| 1666 | }
|
| 1667 | else
|
| 1668 | {
|
| 1669 | FileDateOrder_flag=1;
|
| 1670 | }
|
| 1671 | WebDav_FileDateOrderOnClick();
|
| 1672 | }
|
| 1673 | */
|
| 1674 | return 0;
|
| 1675 | }
|
| 1676 |
|
| 1677 | var Pause_flag=0;
|
| 1678 | var Cancel_flag=0;
|
| 1679 |
|
| 1680 |
|
| 1681 | //function WebDav_Upload_Pause()
|
| 1682 | function WebDav_Upload_Pause()
|
| 1683 | {
|
| 1684 | if(Pause_flag==0)
|
| 1685 | {
|
| 1686 | Pause_flag=1;
|
| 1687 | //document.getElementById('webdavuploadschedule_pause').value="Continue";
|
| 1688 | document.getElementById('webdavuploadschedule_pause').value = jQuery.i18n.prop("webdavuploadschedule_continue");
|
| 1689 | }
|
| 1690 | else
|
| 1691 | {
|
| 1692 | Pause_flag=0;
|
| 1693 | document.getElementById('webdavuploadschedule_pause').value = jQuery.i18n.prop("webdavuploadschedule_pause");
|
| 1694 | //document.getElementById('webdavuploadschedule_pause').value="Pause";
|
| 1695 | WebDav_Upload();
|
| 1696 | }
|
| 1697 | }
|
| 1698 |
|
| 1699 | function WebDav_Upload_Cancel()
|
| 1700 | {
|
| 1701 | Cancel_flag=1;
|
| 1702 | if(Pause_flag==1)
|
| 1703 | {
|
| 1704 | WebDav_Upload();
|
| 1705 | }
|
| 1706 | }
|
| 1707 | var device_size=0;
|
| 1708 |
|
| 1709 | function WebDav_Upload_Change()
|
| 1710 | {
|
| 1711 | Pause_flag=0;
|
| 1712 | Cancel_flag=0;
|
| 1713 | var file = document.getElementById('WebdavFileToUpload').files[0];
|
| 1714 |
|
| 1715 | device_size=GetWebDavPathInfo("/www/webdav"+Path_Name);
|
| 1716 | sm("webdavuploadscheduleDlg", 450, 150);
|
| 1717 | document.getElementById('webdavuploadschedule_FileName').innerHTML = file.name;
|
| 1718 |
|
| 1719 |
|
| 1720 | WebDav_Upload();
|
| 1721 |
|
| 1722 | }
|
| 1723 | var uploadSize=0;
|
| 1724 | var uploadEndSize=0;
|
| 1725 |
|
| 1726 | var fromSize=0;
|
| 1727 | var ToSize=0;
|
| 1728 | var total_file_size=0;
|
| 1729 | function WebDav_Upload_Ondoing()
|
| 1730 | {
|
| 1731 |
|
| 1732 | if(Cancel_flag==1)
|
| 1733 | {
|
| 1734 | var cancelfilename=document.getElementById('webdavuploadschedule_FileName').innerHTML;
|
| 1735 |
|
| 1736 | WebDav_Delete(cancelfilename);
|
| 1737 | uploadSize = 0;
|
| 1738 | uploadEndSize = 0;
|
| 1739 | fromSize=0;
|
| 1740 | ToSize=0;
|
| 1741 | setTimeout("clear_upload_barview_function();",100);
|
| 1742 | if(isBrowser()=='Firefox')
|
| 1743 | {
|
| 1744 | $("#webdav_Upload_Button").replaceWith("<span class='btnWrp' id='webdav_Upload_Button' style='width:86px;'> <input type='file' name='WebdavFileToUpload' id='WebdavFileToUpload' style='position:absolute; width:80px;height:30px;left:1260; filter:alpha(opacity:0);opacity: 0;'/> <input type='button' id='webdavUpload' value='Upload' style='width:86px;'/> </span>");
|
| 1745 | //buttonLocaliztion("webdavUpload");
|
| 1746 | //$("#WebdavFileToUpload").replaceWith("<input type='file' name='WebdavFileToUpload' id='WebdavFileToUpload' style='position:absolute; width:80px;height:30px;left:1080px; filter:alpha(opacity:0);opacity: 0;' />");
|
| 1747 | }else if(isBrowser()=='Chrome')
|
| 1748 | {
|
| 1749 | $("#webdav_Upload_Button").replaceWith("<span class='btnWrp' id='webdav_Upload_Button' style='width:86px;'> <input type='file' name='WebdavFileToUpload' id='WebdavFileToUpload' style='position:absolute; width:80px;height:30px;left:1260; filter:alpha(opacity:0);opacity: 0;'/> <input type='button' id='webdavUpload' value='Upload' style='width:86px;'/> </span>");
|
| 1750 | //buttonLocaliztion("webdavUpload");
|
| 1751 | //$("#WebdavFileToUpload").replaceWith("<input type='file' name='WebdavFileToUpload' id='WebdavFileToUpload' style='position:absolute; width:80px;height:30px;left:1180px; filter:alpha(opacity:0);opacity: 0;' />");
|
| 1752 | }
|
| 1753 | else
|
| 1754 | {
|
| 1755 | $("#webdav_Upload_Button").replaceWith("<span class='btnWrp' id='webdav_Upload_Button' style='width:86px;'> <input type='file' name='WebdavFileToUpload' id='WebdavFileToUpload' style='position:absolute; width:80px;height:30px;left:1260; filter:alpha(opacity:0);opacity: 0;'/> <input type='button' id='webdavUpload' value='Upload' style='width:86px;'/> </span>");
|
| 1756 | //buttonLocaliztion("webdavUpload");
|
| 1757 | //$("#WebdavFileToUpload").replaceWith("<input type='file' name='WebdavFileToUpload' id='WebdavFileToUpload' style='position:absolute; width:80px;height:30px;left:1180px; filter:alpha(opacity:0);opacity: 0;' />");
|
| 1758 | }
|
| 1759 |
|
| 1760 | return;
|
| 1761 | }
|
| 1762 | if(Pause_flag==1)
|
| 1763 | {
|
| 1764 | return;
|
| 1765 | }
|
| 1766 | else
|
| 1767 | {
|
| 1768 | if(uploadEndSize==total_file_size)
|
| 1769 | {
|
| 1770 | uploadSize = 0;
|
| 1771 | uploadEndSize = 0;
|
| 1772 | fromSize=0;
|
| 1773 | ToSize=0;
|
| 1774 | document.getElementById("bar").style.width = 100 + "%";
|
| 1775 | document.getElementById("bar").innerHTML = document.getElementById("bar").style.width;
|
| 1776 | setTimeout("clear_upload_barview_function();",800);
|
| 1777 |
|
| 1778 | WebDav_PROPFIND(Path_Name);
|
| 1779 | if(isBrowser()=='Firefox')
|
| 1780 | {
|
| 1781 |
|
| 1782 | $("#webdav_Upload_Button").replaceWith("<span class='btnWrp' id='webdav_Upload_Button' style='width:86px;'> <input type='file' name='WebdavFileToUpload' id='WebdavFileToUpload' style='position:absolute; width:80px;height:30px;left:1260; filter:alpha(opacity:0);opacity: 0;'/> <input type='button' id='webdavUpload' value='Upload' style='width:86px;'/> </span>");
|
| 1783 | //buttonLocaliztion("webdavUpload");
|
| 1784 | //$("#WebdavFileToUpload").replaceWith("<input type='file' name='WebdavFileToUpload' id='WebdavFileToUpload' style='position:absolute; width:80px;height:30px;left:1080px; filter:alpha(opacity:0);opacity: 0;' />");
|
| 1785 | }else if(isBrowser()=='Chrome')
|
| 1786 | {
|
| 1787 | //$("#WebdavFileToUpload").replaceWith("<input type='file' name='WebdavFileToUpload' id='WebdavFileToUpload' style='position:absolute; width:80px;height:30px;left:1180px; filter:alpha(opacity:0);opacity: 0;' />");
|
| 1788 | $("#webdav_Upload_Button").replaceWith("<span class='btnWrp' id='webdav_Upload_Button' style='width:86px;'> <input type='file' name='WebdavFileToUpload' id='WebdavFileToUpload' style='position:absolute; width:80px;height:30px;left:1260; filter:alpha(opacity:0);opacity: 0;'/> <input type='button' id='webdavUpload' value='Upload' style='width:86px;'/> </span>");
|
| 1789 | //buttonLocaliztion("webdavUpload");
|
| 1790 | }
|
| 1791 | else
|
| 1792 | {
|
| 1793 | $("#webdav_Upload_Button").replaceWith("<span class='btnWrp' id='webdav_Upload_Button' style='width:86px;'> <input type='file' name='WebdavFileToUpload' id='WebdavFileToUpload' style='position:absolute; width:80px;height:30px;left:1260; filter:alpha(opacity:0);opacity: 0;'/> <input type='button' id='webdavUpload' value='Upload' style='width:86px;'/> </span>");
|
| 1794 | //buttonLocaliztion("webdavUpload");
|
| 1795 | //$("#WebdavFileToUpload").replaceWith("<input type='file' name='WebdavFileToUpload' id='WebdavFileToUpload' style='position:absolute; width:80px;height:30px;left:1180px; filter:alpha(opacity:0);opacity: 0;' />");
|
| 1796 | }
|
| 1797 | }
|
| 1798 | else
|
| 1799 | {
|
| 1800 | var bar_length;
|
| 1801 | bar_length=Math.floor((uploadEndSize/total_file_size)*100);
|
| 1802 | document.getElementById("bar").style.width = bar_length + "%";
|
| 1803 | document.getElementById("bar").innerHTML = document.getElementById("bar").style.width;
|
| 1804 | WebDav_Upload();
|
| 1805 | }
|
| 1806 | }
|
| 1807 |
|
| 1808 | }
|
| 1809 |
|
| 1810 |
|
| 1811 | function WebDav_ReUpload()
|
| 1812 | {
|
| 1813 | uploadSize=0;
|
| 1814 | uploadEndSize = 0;
|
| 1815 | fromSize=0;
|
| 1816 | ToSize=0;
|
| 1817 | total_file_size=0;
|
| 1818 | WebDav_Upload_Ondoing();
|
| 1819 | }
|
| 1820 |
|
| 1821 | function WebDav_Upload()
|
| 1822 | {
|
| 1823 | var file = document.getElementById('WebdavFileToUpload').files[0];
|
| 1824 | if (window.FileReader )
|
| 1825 | {
|
| 1826 | if(file)
|
| 1827 | {
|
| 1828 | if((device_size*1024)<file.size){
|
| 1829 | showAlert("upload_file_larger");
|
| 1830 | return;
|
| 1831 | }
|
| 1832 | total_file_size=file.size;
|
| 1833 | fromSize=ToSize;
|
| 1834 | ToSize=ToSize+ 4 * 1024;
|
| 1835 | if(ToSize>file.size)
|
| 1836 | {
|
| 1837 | ToSize=file.size;
|
| 1838 | }
|
| 1839 |
|
| 1840 | var reader = new FileReader();
|
| 1841 | var blob;
|
| 1842 | if(file.webkitSlice)
|
| 1843 | {
|
| 1844 | blob = file.webkitSlice(fromSize, ToSize);
|
| 1845 | }
|
| 1846 | else if (file.mozSlice)
|
| 1847 | {
|
| 1848 | blob = file.mozSlice(fromSize, ToSize );
|
| 1849 | }
|
| 1850 | else
|
| 1851 | {
|
| 1852 | blob=file.slice(fromSize,ToSize);
|
| 1853 | }
|
| 1854 | reader.onprogress=function(p)
|
| 1855 | {
|
| 1856 | if (p.loaded)
|
| 1857 | {
|
| 1858 | }
|
| 1859 | else {
|
| 1860 | }
|
| 1861 | }
|
| 1862 | reader.onabort=function(p)
|
| 1863 | {
|
| 1864 | if (p.loaded)
|
| 1865 | {
|
| 1866 | }
|
| 1867 | else {
|
| 1868 | }
|
| 1869 | }
|
| 1870 | reader.onerror=function(p)
|
| 1871 | {
|
| 1872 | if (p.loaded)
|
| 1873 | {
|
| 1874 | }
|
| 1875 | else {
|
| 1876 | }
|
| 1877 | }
|
| 1878 |
|
| 1879 | reader.onloadend = function()
|
| 1880 | {
|
| 1881 | uploadSize=uploadEndSize;
|
| 1882 | uploadEndSize = uploadEndSize+4 * 1024;
|
| 1883 | if(uploadEndSize>file.size)
|
| 1884 | {
|
| 1885 | uploadEndSize=file.size;
|
| 1886 | }
|
| 1887 | if(isBrowser()=='IE')
|
| 1888 | {
|
| 1889 | WebDav_PutSyncXML_IE11(Path_Name+file.name,file.type,uploadSize,uploadEndSize,file.size,reader.result);
|
| 1890 | }
|
| 1891 | else
|
| 1892 | {
|
| 1893 | WebDav_PutSyncXML(Path_Name+file.name,file.type,uploadSize,uploadEndSize,file.size,reader.result);
|
| 1894 | }
|
| 1895 | if (reader.error)
|
| 1896 | {
|
| 1897 | }
|
| 1898 | else
|
| 1899 | {
|
| 1900 | }
|
| 1901 | }
|
| 1902 | if(isBrowser()=='IE')
|
| 1903 | {
|
| 1904 | reader.readAsArrayBuffer(blob);
|
| 1905 | }
|
| 1906 | else
|
| 1907 | {
|
| 1908 | reader.readAsBinaryString(blob);
|
| 1909 | }
|
| 1910 | }
|
| 1911 | }
|
| 1912 | else
|
| 1913 | {
|
| 1914 | showAlert("lupdateBrowser");
|
| 1915 | return;
|
| 1916 | }
|
| 1917 |
|
| 1918 |
|
| 1919 | } |