- 浏览: 47949 次
- 性别:
- 来自: 西安
文章分类
var viewSelectFolder;
var moveFolder;
var createNewFolder;
var currentFolder;
var resizeProps={};
var photoUrlMover=ce('div');
var photoUrlMovered;
var bMove=false;
var _mp={};
var _replacePid;
function formatPhotoUrl(tempUrl,type){
var ipos = tempUrl.lastIndexOf('.');
return tempUrl.substring(0,ipos)+type+tempUrl.substring(ipos);
}
function selectAll(selector){
var itemChecked = false;
if(selector.checked){
itemChecked = true;
}
var itemContainer = ge('item_container');
var items = itemContainer.getElementsByTagName('input');
for(var i=0;i<items.length;i++){
var tempItem = items[i];
if(tempItem.name=='item_photo_select'){
tempItem.checked=itemChecked
}
}
}
function deletePhoto(){
var _ids = getSelectedIds();
if(!_ids || _ids==''){
alert('请先选择要删除的图片,然后再点击删除!');
return;
}
_util.window.cfm('删除图片确认','删除图片后,您外链到店铺中的图片将无法显示。<br/><br/>您确定要删除选中的图片吗?',doDeletePhoto).cfm.style.height=180;
}
function doDeletePhoto(){
var _ids = getSelectedIds();
var xmlhttp = createXmlHttp();
if(xmlhttp){
_util.window.cfmc();
showManagePhotoWaiting('正在删除图片,请稍等……');
showManagePhotoBack();
xmlhttp.open('post', '/photo?op=deletephoto&ids='+_ids,true);
xmlhttp.setRequestHeader("Content-Type","utf-8");
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4) {
var returnDocument = xmlhttp.responseXML;
if(getXmlhttpError(returnDocument)=='false'){
window.location.reload();return;
}else{
closeManagePhotoWindows();
alert(getXmlhttpError(returnDocument));
}
}
};
xmlhttp.send(null);
}
}
function getSelectedIds(){
var selectIds='';
var itemContainer = ge('item_container');
var items = itemContainer.getElementsByTagName('input');
for(var i=0;i<items.length;i++){
var tempItem = items[i];
if(tempItem.name=='item_photo_select' && tempItem.checked){
selectIds += tempItem.value+';';
}
}
return selectIds;
}
function deleteSet(id){
_util.window.cfm('删除文件夹确认','删除文件夹后,此文件夹中的图片和子文件夹将被删除,被删除的图片外链同时会失效!<br/><br/>您确定要删除选中的图片吗?',doDeletePhoto);
ge('pub_cfm_butt').onclick=function(){doDeleteSet(id)};
}
function doDeleteSet(id){
var xmlhttp = createXmlHttp();
if(xmlhttp){
_util.window.cfmc();
showManagePhotoWaiting('正在删除文件夹,请稍等……');
showManagePhotoBack();
var _del_url='/photo?op=deleteset&id='+id;
if(ge('cur_path_name')){_del_url+='&pname='+encodeURIComponent(ge('cur_path_name').value);}
xmlhttp.open('post',_del_url ,true);
xmlhttp.setRequestHeader("Content-Type","utf-8");
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4) {
var returnDocument = xmlhttp.responseXML;
if(getXmlhttpError(returnDocument)=='false'){
window.location.reload();return;
}else{
closeManagePhotoWindows();
alert(getXmlhttpError(returnDocument));
}
}
};
xmlhttp.send(null);
}
}
function goCreateNewFolder(){
showManagePhotoWaiting('正在查询文件夹,请稍等……');
showManagePhotoBack();
xmlHttpRequest('/folder?op=getsubfolder&pid=0',showCreateNewFolder);
}
function showCreateNewFolder(_xmlhttp){
var _document = _xmlhttp.responseXML;
var _error = getXmlhttpError(_document);
if(_error=='false'){
showCreateNewFolderWindow(_document);
closeManagePhotoWaiting();
}else{
alert(_error);
closeManagePhotoWaiting();
closeManagePhotoBack();
}
}
function closeCreateNewFolderWindow(){
closeManagePhotoBack();
var _window = ge('create_new_folder_window');
if(_window)_window.style.display='none';
if(createNewFolder){
createNewFolder._distroy();
}
}
function showCreateNewFolderWindow(_document){
var _window = ge('create_new_folder_window');
if(!_window){
_window = ce('div');
_window.id = 'create_new_folder_window';
_window.style.cssText='z-index:101;top:0px;left:0px;width:520px;height:480px;position:absolute;border:10px solid #DAD6D6';
document.body.appendChild(_window);
}
_window.style.display = '';
var tempPos = getAbsoluteLocation(ge('item_container'));
var tempTop = tempPos.absoluteTop;
if(tempTop<document.body.scrollTop){
tempTop = document.body.scrollTop;
}
_window.style.top = tempTop+10;
_window.style.left = tempPos.absoluteLeft+tempPos.offsetWidth/2 - 270;
var _html = '';
_html += '<div class="left" style="margin:15px 0px 0px 15px"></div>';
_html += '<div class="right" style="margin:5px 5px 0px 0px"><a class="pre_title_close" href="#" onclick="closeCreateNewFolderWindow();return false;"><img src="/image/close_2.gif" style="vertical-align:middle"/></a></div><div class="clear_div"></div>';
_html += '</div>';
_html += '<div id="create_folder_list" style="text-align:left;padding-left:30px"><select id="create_folder_select"><option pid="-1" cid="1" value="0" path="0">我的文件夹</option>';
var folders = _document.getElementsByTagName('folder');
if(folders && folders.length>0){
for(var i=0;i<folders.length;i++){
var tempFolder = folders[i];
var tempId = getElementValueByTagName(tempFolder,'id');
var tempName = getElementValueByTagName(tempFolder,'name');
_html += '<option value="'+tempId+'" pid="0" cid="0" status="close">'+tempName+'</option>';
}
}
_html += '</select></div>';
_window.innerHTML = _html;
var createNewFolderProps = {id:'user_create_folder',selector:ge('create_folder_select'),height:285,ctop:10,cleft:10,bottonNew:true,buttonSelect:false};
var _callback = {closeFolder:closeCreateNewFolderWindow,createClose:closeCreateNewFolderWindow};
createNewFolderProps.callback=_callback;
createNewFolder = new folder(createNewFolderProps);
createNewFolder._showFolderTree();
createNewFolder._createFolder();
}
function movePhotoSet(type,ids,dotype){
if(type=='photo'){
ids = getSelectedIds();
if(dotype=='cut'){
if(_newusertype=='1'){
_util.window.cfm('转移图片确认','您确定要转移吗?',doMovePhotoSet);
}else{
_util.window.cfm('转移图片确认','转移图片后,这些图片的外链就会失效!<br/><br/>您确定要转移吗?',doMovePhotoSet);
}
ge('pub_cfm_butt').onclick=function(){doMovePhotoSet(type,ids,dotype);};
}else{
doMovePhotoSet(type,ids,dotype);
}
if(ids==null || ids==''){
alert('请先选择图片后再点击转移!');
return;
}
}else{
if(_newusertype=='1'){
_util.window.cfm('转移文件夹确认','您确定要转移吗?',doMovePhotoSet).cfm.style.height=220;
}else{
_util.window.cfm('转移文件夹确认','转移文件夹之后,文件夹中的图片和其他文件夹将一起被转移,这些图片的外链就会失效!<br/><br/>您确定要转移吗?',doMovePhotoSet).cfm.style.height=220;
}
ge('pub_cfm_butt').onclick=function(){doMovePhotoSet(type,ids,dotype);};
}
}
function doMovePhotoSet(type,ids,dotype){
var xmlhttp = createXmlHttp();
if(xmlhttp){
_util.window.cfmc();
showManagePhotoWaiting('正在查询文件夹,请稍等……');
showManagePhotoBack();
xmlhttp.open('post', '/folder?op=getsubfolder&pid=0',true);
xmlhttp.setRequestHeader("Content-Type","utf-8");
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4) {
closeManagePhotoWindows();
var returnDocument = xmlhttp.responseXML;
if(getXmlhttpError(returnDocument)=='false'){
writeMoveWindow(returnDocument,type,ids,dotype);
}else{
alert(getXmlhttpError(returnDocument));
}
}
};
xmlhttp.send(null);
}
}
function writeMoveWindow(returnDocument,type,ids,dotype){
var managePhotoWindow = showManagePhotoWindow();
var strHTML = '';
strHTML += '<div>';
strHTML += '<div class="left" style="margin:15px 0px 0px 15px"></div>';
strHTML += '<div class="right" style="margin:5px 5px 0px 0px"><a class="pre_title_close" href="#" onclick="closePhotoUrl();return false;"><img src="/image/close_2.gif" style="vertical-align:middle"/></a></div><div class="clear_div"></div>';
strHTML += '</div>';
if(type=='photo' && dotype=='copy'){
strHTML += '<div class="left" style="text-align:right;width:90px;padding:5px 0 0 0">复制图片到:</div><div class="right" style="width:410px">';
}
if(dotype=='cut'){
strHTML += '<div style="text-align:left;padding-left:40px"><div id="move_folder_list"><select id="move_folder_select"><option pid="-1" cid="1" value="0" path="0">我的文件夹</option>';
}else{
strHTML += '<div style="text-align:left;"><div id="move_folder_list"><select id="move_folder_select"><option pid="-1" cid="1" value="0" path="0">我的文件夹</option>';
}
var folders = returnDocument.getElementsByTagName('folder');
if(folders && folders.length>0){
for(var i=0;i<folders.length;i++){
var tempFolder = folders[i];
var tempId = getElementValueByTagName(tempFolder,'id');
var tempName = getElementValueByTagName(tempFolder,'name');
strHTML += '<option value="'+tempId+'" pid="0" cid="0" status="close">'+tempName+'</option>';
}
}
strHTML += '</select></div></div>';
if(type=='photo' && dotype=='copy'){
strHTML += '</div><div class="clear_div"> </div>';
}
strHTML += '</div>';
if(type=='photo' && dotype=='copy'){
strHTML += '<div style="padding:20px 0 0 0">';
strHTML += '<div class="left" style="text-align:right;width:90px">图片尺寸:</div>';
strHTML += '<div class="right" style="text-align:left;width:410px">';
strHTML += '<div><input type="radio" name="photo_resize" checked="checked" onclick="showPhotoResizeCover();" id="photo_resize_no"/><label for="photo_resize_no">保留原图</label><span style="padding:0 10px"> </span><input type="radio" name="photo_resize" id="photo_resize_yes" onclick="closePhotoResizeCover();"/><label for="photo_resize_yes">自定义图片大小</label></div>';
strHTML += '<div id="resize_photo_con" style="padding:10px;margin:10px 0 0 0;width:330px">';
strHTML += '<div style="margin:0 0 10px 0">指定图片的宽度或高度,按比例缩小图片。</div>';
strHTML += '<div><input type="radio" name="resize_photo_type" value="1" id="resize_photo_type_1" onclick="setResizeValu(this);"/><label for="resize_photo_type_1">分类图片(宽度152像素)</label></div>';
strHTML += '<div style="margin:8px 0"><input type="radio" name="resize_photo_type" value="2" id="resize_photo_type_2" onclick="setResizeValu(this);"/><label for="resize_photo_type_2">左侧自定义模块(宽度190像素)</label></div>';
strHTML += '<div><input type="radio" name="resize_photo_type" value="3" id="resize_photo_type_3" onclick="setResizeValu(this);"/><label for="resize_photo_type_3">宝贝图片(500*500像素,图片小于120K)</label></div>';
strHTML += '<div style="margin:8px 0"><input type="radio" name="resize_photo_type" value="4" id="resize_photo_type_4" onclick="setResizeValu(this);"/><label for="resize_photo_type_4">促销区小图(宽度245像素,一行可放3张图片)</label></div>';
strHTML += '<div><input type="radio" name="resize_photo_type" value="5" id="resize_photo_type_5" onclick="setResizeValu(this);"/><label for="resize_photo_type_5">宝贝描述图片(宽度740像素)</label></div>';
strHTML += '<div style="margin:8px 0"><input type="radio" name="resize_photo_type" value="6" id="resize_photo_type_6" onclick="setResizeValu(this);"/><label for="resize_photo_type_6">自定义(限定图片的最大宽度或高度,按比例缩小。)</label></div>';
strHTML += '<div><span style="padding:0 25px">宽度<input type="text" style="width:40px" id="resize_custom_width" disabled="disabled" value="-1"/>像素<span style="padding:0 10px"> </span>高度<input type="text" id="resize_custom_height" style="width:40px" disabled="disabled" value="-1"/>像素</span><br/><span class="font_light_gray" style="padding:0 25px">设置为-1表示不限制。</span></div>';
strHTML += '</div>';
strHTML += '</div><div class="clear_div"> </div>';
strHTML += '</div>';
}
if(type=='photo' && dotype=='copy'){
strHTML += '<div style="padding:30px 0px 0px 282px">';
}else{
strHTML += '<div style="padding:350px 0px 0px 282px">';
}
strHTML += '<div class="button_bg button_blue_2_1"></div><div class="button_bg button_blue_2_2" style="width:50px;" onclick="doMove(\''+type+'\',\''+ids+'\',\''+dotype+'\');"><div style="padding-top:1px;background-color:transparent;font-size:12px;font-weight:normal">确定</div></div><div class="button_bg button_blue_2_3" style="margin-right:20px"></div>';
strHTML += '<div class="button_bg button_gray_3_1"></div><div class="button_bg button_gray_3_2" style="width:50px;" onclick="closePhotoUrl();"><div style="color:#000000;font-size:12px;background-color:transparent">取消</div></div><div class="button_bg button_gray_3_3"></div><div class="clear_div"></div>';
strHTML += '</div>';
managePhotoWindow.innerHTML = strHTML;
managePhotoWindow.style.display='';
managePhotoWindow.style.width=510;
managePhotoWindow.style.height=470;
var tempPos = getAbsoluteLocation(ge('item_container'));
var tempTop = tempPos.absoluteTop;
if(tempTop<document.body.scrollTop){
tempTop = document.body.scrollTop;
}
managePhotoWindow.style.top = tempTop+10;
managePhotoWindow.style.left = tempPos.absoluteLeft+tempPos.offsetWidth/2 - 270;
var moveFolderProps = {id:'move_folder',selector:ge('move_folder_select'),width:390,height:295,ctop:10,cleft:10,bottonNew:true,buttonSelect:false,buttonCancel:false};
if(type=='photo' && dotype=='copy'){
moveFolderProps.buttonSelect=true;
moveFolderProps.selectFolderClose=true;
}
moveFolder = new folder(moveFolderProps);
if(type=='photo'){
if(dotype=='copy'){
}else{
moveFolder._showFolderTree();
}
}else{
moveFolder._showFolderTree();
}
showManagePhotoBack();
try{
showPhotoResizeCover();
}catch(e){}
}
function closePhotoResizeCover(){
var _cover = ge('photo_resize_cover');
if(_cover)_cover.style.display='none';
}
function showPhotoResizeCover(){
var _cover = ge('photo_resize_cover');
if(!_cover){
_cover =ce('div');
_cover.id='photo_resize_cover';
_cover.style.cssText='z-index:102;top:0px;left:0px;position:absolute;background-color:#ffffff;filter:alpha(opacity=50);moz-opacity: 0.5;opacity:.5';
document.body.appendChild(_cover);
}
var _pos = getAbsoluteLocation(ge('resize_photo_con'));
_cover.style.width = _pos.offsetWidth;
_cover.style.height = _pos.offsetHeight;
_cover.style.left = _pos.absoluteLeft;
_cover.style.top = _pos.absoluteTop;
_cover.style.display='';
}
function doMove(type,ids,dotype){
var xmlhttp = createXmlHttp();
if(xmlhttp){
showPageBackPublic(ge('item_container'),500);
var _title = '正在转移,请稍等……';
var _url = '/photo?op=move&type='+type+'&dotype='+dotype+'&ids='+ids+'&to='+moveFolder.f_current.getAttribute('fid');
if(type=='photo' && dotype=='copy'){
_url += getResizeVars();
_title = '正在复制,请稍等……';
}
showPageWaitingPublic(_title);
xmlhttp.open('post', _url,true);
xmlhttp.setRequestHeader("Content-Type","utf-8");
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4) {
var returnDocument = xmlhttp.responseXML;
if(getXmlhttpError(returnDocument)=='false'){
refresh();
}else{
closePageWaitingPublic();
closePageBackPublic();
// closeManagePhotoWaiting();
alert(getXmlhttpError(returnDocument));
}
}
};
xmlhttp.send(null);
}
}
function closePhotoUrl(){
var managePhotoWindow = ge('manage_photo_window');
if(managePhotoWindow)managePhotoWindow.style.display='none';
closeManagePhotoBack();
if(moveFolder){
moveFolder._distroy();
}
closePhotoResizeCover();
}
function changePhotoUrlSize(type){
if(type=='o'){
ge('photo_url_title_m').style.display='none';
ge('photo_url_con_m').style.display='none';
ge('photo_url_title_o').style.display='';
ge('photo_url_con_o').style.display='';
}else{
ge('photo_url_title_o').style.display='none';
ge('photo_url_con_o').style.display='none';
ge('photo_url_title_m').style.display='';
ge('photo_url_con_m').style.display='';
}
}
function copyPhotoUrl(){
if(ge('photo_url_title_m').style.display!='none'){
if(ge('photo_url_m').checked){
copy_code(ge('colde_photo_url_m').value,'图片地址复制成功。您可以通过ctrl+v将地址粘贴到输入框中。');
}else if(ge('photo_html_m').checked){
copy_code(ge('colde_photo_html_m').value,'图片代码复制成功。您可以通过ctrl+v将代码粘贴到输入框中。');
}else{
alert('请选择您是要复制图片地址还是图片代码!');
return;
}
}else{
if(ge('photo_url_o').checked){
copy_code(ge('colde_photo_url_o').value,'图片地址复制成功。您可以通过ctrl+v将地址粘贴到输入框中。');
}else if(ge('photo_html_o').checked){
copy_code(ge('colde_photo_html_o').value,'图片代码复制成功。您可以通过ctrl+v将代码粘贴到输入框中。');
}else{
alert('请选择您是要复制图片地址还是图片代码!');
return;
}
}
}
function closeViewPhoto(){
var viwePhotoWindow = ge('viwe_photo_window');
if(viwePhotoWindow)viwePhotoWindow.style.display='none';
closeManagePhotoBackF();
}
function viewPhoto(name,url){
var previePhoto = new Image();
previePhoto.src = url;
if (previePhoto.complete) {
showManagePhotoBackF();
}
previePhoto.onload = function () {
showManagePhotoBackF();
};
var viwePhotoWindow = ge('viwe_photo_window');
if(!viwePhotoWindow){
viwePhotoWindow = document.createElement('div');
viwePhotoWindow.id='viwe_photo_window';
viwePhotoWindow.style.cssText='position:absolute;z-index:101;width:974px;text-align:center;padding:20px 0;top:10px;left:10px;';
document.body.appendChild(viwePhotoWindow);
}
viwePhotoWindow.style.left=document.body.scrollWidth/2-487;
var strHTML = '';
strHTML += '<div style="width:944px;margin:0 auto"><div class="bg_img main_sub_title1"><div class="left">浏览</div><div class="right" style="padding-right:10px"><a class="pre_title_close" href="#" onclick="closeViewPhoto();return false;"><img src="/image/close_2.gif" style="vertical-align:middle"/></a></div><div class="clear_div" style="height:1px"></div></div>';
strHTML += '<div style="background-color:#F7F7F7;text-align:center;padding:20px 0px 20px 0px">'+name+'<br/><img src="'+url+'"/></div>';
strHTML += '<div style="background-color:#E7E7E7;padding:10px 0px 10px 450px;border:-bottom:1px solid ##999999"><div class="button_bg button_gray_2_1"></div><div class="button_bg button_gray_2_2" onclick="closeViewPhoto();"><div>关闭</div></div><div class="button_bg button_gray_2_3"></div><div class="clear_div"></div></div></div>';
viwePhotoWindow.innerHTML = strHTML;
showManagePhotoBackF();
viwePhotoWindow.style.display='';
}
function checkRightClick(event){
event = event || window.event;
if(event && event.button==2){
alert('请在“按文件夹浏览”页面点击小图下方的“地址”链接获取图片地址。');
}
}
function closeThisPhotoUrl(event){
event = event || window.event;
var toElement = event.toElement || event.relatedTarget;
if(toElement && toElement.id!='photo_url_window' && toElement.getAttribute('name')!='photo_url_window'){
var photoUrlWindow = ge('photo_url_window');
if(photoUrlWindow)photoUrlWindow.style.display='none';
}
}
function showThisPhotoUrl(el,tempUrl){
var photoUrlWindow = ge('photo_url_window');
if(!photoUrlWindow){
photoUrlWindow = document.createElement('div');
photoUrlWindow.id='photo_url_window';
photoUrlWindow.className='photo_url_window';
photoUrlWindow.style.cssText='width:185px;height:95px;position:absolute;z-index:100;top:0px;left:0px;background-image:url(/image/url_bg.gif)';
document.body.appendChild(photoUrlWindow);
}
photoUrlWindow.onmouseout=closeThisPhotoUrl;
var tempPos = getAbsoluteLocation(el);
photoUrlWindow.style.top=tempPos.absoluteTop+19;
photoUrlWindow.style.left=tempPos.absoluteLeft-90;
var strHTML = '';
strHTML += '<div name="photo_url_window" style="margin:25px 0px 0px 10px">';
strHTML += '<div name="photo_url_window">标准:<input type="text" name="photo_url_window" onfocus="this.select();" value="'+formatPhotoUrl(tempUrl,'_m')+'"/><input type="button" name="photo_url_window" class="buttonGraySmall" value="复制" onclick="copyThisPhotoUrl(\''+formatPhotoUrl(tempUrl,'_m')+'\');" style="width:40px;margin-left:4px"/></div>';
strHTML += '<div name="photo_url_window">原图:<input type="text" name="photo_url_window" onfocus="this.select();" value="'+tempUrl+'"/><input type="button" name="photo_url_window" class="buttonGraySmall" value="复制" onclick="copyThisPhotoUrl(\''+tempUrl+'\');" style="width:40px;margin-left:4px"/></div>';
strHTML += '</div>';
photoUrlWindow.innerHTML = strHTML;
photoUrlWindow.style.display='';
}
function copyReturn(){
var _tips = ge('copy_tips');
if(!_tips){
_tips = ce('div');
_tips.id = 'copy_tips';
_tips.style.cssText='position:absolute;z-index:300;top:0px;left:0px;width:200;padding:10px 0;background-color:#FEF7B0;border:1px solid #FCD163';
_tips.innerHTML = '图片地址复制成功!';
document.body.appendChild(_tips);
}
_tips.style.display='';
var _pos = getAbsoluteLocation(ge('photo_url_window'));
_tips.style.left = _pos.absoluteLeft;
_tips.style.top = _pos.absoluteTop-40;
setTimeout(function(){ge('copy_tips').style.display='none';},1000);
}
function copyThisPhotoUrl(tempUrl){
copy_code(tempUrl,'图片地址复制成功!',copyReturn);
}
function showFolder(id){
photoPageProps.id=id;
photoPageProps.page=1;
reloadPhoto('open');
}
function getPhotoUrl(){
var _ids = getSelectedIds();
if(!_ids || _ids==''){
alert('请先选择图片,然后再点击获取地址!');
return;
}
var selectedPhoto=_ids.split(';');
var strPhotoUrlM='',strPhotoHTMLM='',strPhotoUrlO='',strPhotoHTMLO='';
var managePhotoWindow = showManagePhotoWindow();
var strHTML = '';
strHTML+='<div style="text-align:left;padding:0 0 0 10px">';
strHTML+='<div class="left" style="padding:10px 0 0 0"><div class="font_title_s">拖动图片排序,点击右边的按钮复制图片或者代码。</div></div><div class="right" style="padding:5px"><a class="pre_title_close" href="#" onclick="closePhotoUrl();return false;"><img src="/image/close_2.gif" style="vertical-align:middle"/></a></div><div class="clear_div"> </div>';
strHTML+='<div id="move_urlphoto_container" class="left" style="width:450px">';
for(var i=0;i<selectedPhoto.length;i++){
var tempSelectPhoto = ge('img_checkbox_'+selectedPhoto[i]);
if(!tempSelectPhoto)continue;
var tempUrl = tempSelectPhoto.getAttribute('url');
var tempName = tempSelectPhoto.getAttribute('title');
var tempUrlS = tempSelectPhoto.getAttribute('urls');
strHTML += '<div style="float:left;width:90px;height:90px;cursor:move;" index="'+(i+1)+'" name="movephoto" class="movephoto" onmousedown="startPhotoUrlMove(event,this,\''+tempUrlS+'\','+(i+1)+');return false;"><img width="75" height="75" name="movephoto_c" class="float_thumb" src="'+tempUrlS+'" osrc="'+tempUrl+'"/><div class="float_index_white" name="movephoto_c">'+(i+1)+'</div><div class="float_index_black" name="movephoto_c">'+(i+1)+'</div></div>';
}
strHTML+='<div class="clear_div"> </div>';
strHTML+='</div>';
strHTML+='<div class="right" style="text-align:left;padding:0 0 0 20px;width:185px;height:345px;overflow:hidden;border-left:1px solid #DDDDDD">';
strHTML+='<div class="font_title_s">相邻的两张图片之间</div><div style="margin-bottom:20px"><input id="img-line-0" type="radio" name="copy-img-line"/><label for="img-line-0">无间隔</label><input id="img-line-1" name="copy-img-line" checked="checked" type="radio" style="margin-left:10px"/><label for="img-line-1">一行间隔</label></div>';
if(bIE){
strHTML+='<div class="font_title_s">复制图片?</div><div>可以直接粘贴到宝贝描述。<br/><span class="font_orange">友情提示:如出现提示框,请选择“允许”访问剪贴板</span></div><div style="padding:10px 0 0 0"><div class="button_bg button_blue_2_1"></div><div class="button_bg button_blue_2_2" style="width:100px" onclick="copyMovephoto(\'_m\');"><div>复制标准尺寸</div></div><div class="button_bg button_blue_2_3"></div><div class="clear_div"> </div></div><div style="padding-bottom:20px"><div class="button_bg button_blue_2_1"></div><div class="button_bg button_blue_2_2" style="width:80px" onclick="copyMovephoto(\'\');"><div>复制原图</div></div><div class="button_bg button_blue_2_3"></div><div class="clear_div"> </div></div>';
}
strHTML+='<div class="font_title_s">复制代码?</div><div>用于宝贝描述的“编辑源文件”中。</div><div style="padding:10px 0 0 0"><div class="button_bg button_blue_2_1"></div><div class="button_bg button_blue_2_2" style="width:100px" onclick="copyMovephotoUrl(\'_m\');"><div>复制标准尺寸</div></div><div class="button_bg button_blue_2_3"></div><div class="clear_div"> </div></div><div><div class="button_bg button_blue_2_1"></div><div class="button_bg button_blue_2_2" style="width:80px" onclick="copyMovephotoUrl(\'\');"><div>复制原图</div></div><div class="button_bg button_blue_2_3"></div><div class="clear_div"> </div></div>';
strHTML+='</div><div class="clear_div"> </div>';
strHTML+='</div>';
managePhotoWindow.innerHTML = strHTML;
managePhotoWindow.style.display='';
managePhotoWindow.style.width=680;
managePhotoWindow.style.height=430;
var tempPos = getAbsoluteLocation(ge('item_container'));
var tempTop = tempPos.absoluteTop;
if(tempTop<document.body.scrollTop){
tempTop = document.body.scrollTop;
}
managePhotoWindow.style.top = tempTop+10;
managePhotoWindow.style.left = tempPos.absoluteLeft+tempPos.offsetWidth/2 - 340;
showManagePhotoBack();
document.body.appendChild(photoUrlMover);
writeMovePhotoPos();
}
var movePhotoPosList,movePhotoContainer;
function writeMovePhotoPos(){
var _list = ge('move_urlphoto_container').childNodes;
movePhotoPosList = new Array();
for(var i=0;i<_list.length;i++){
if(_list[i].className=='movephoto'){
var _pos = getAbsoluteLocation(_list[i]);
var _index = _list[i].getAttribute('index');
movePhotoPosList.push({index:_index,x:_pos.absoluteLeft,y:_pos.absoluteTop,w:_pos.offsetWidth,h:_pos.offsetHeight,photo:_list[i]});
}
}
}
function startPhotoUrlMove(event,_move,_url,_index){
event = event || window.event;
var objTarget = event.target || event.srcElement;
if(!objTarget.name || (objTarget.name!='movephoto' && objTarget.name!='movephoto_c')){
return true;
}
if(objTarget.name=='movephoto_c'){
_move = objTarget.parentNode;
}else{
_move = objTarget;
}
_index = _move.getAttribute('index');
_url = _move.getElementsByTagName('img')[0].src;
bMove=true;
photoUrlMover.style.cssText='width:90px;height:90px;text-align:center;background-color:transparent;cursor:move;position:absolute;top:10px;left:10px;z-index:110;text-align:left';
photoUrlMover.innerHTML = getPhotoMoverContent(_move,_url,_index);
photoUrlMover.setAttribute('index',_index);
var _pos = getAbsoluteLocation(_move);
photoUrlMover.style.top=_pos.absoluteTop+10;
photoUrlMover.style.left=_pos.absoluteLeft+10;
photoUrlMover.style.display='block';
setMoveOpa(_move,40);
_mp.x=event.clientX-_pos.absoluteLeft-10;
_mp.y=event.clientY-_pos.absoluteTop-10;
photoUrlMovered=_move;
}
function getCopyMovephotoUrl(_url,_type){
var _pos = _url.lastIndexOf('_s.');
return _url.substring(0,_pos)+_type+_url.substring(_pos+2);
}
function getCopyMovephotoUrlOri(_url,_type){
var _pos = _url.lastIndexOf('.');
return _url.substring(0,_pos)+_type+_url.substring(_pos);
}
var _copy_movePhoto_nodelist,_temp_photo_container,_copy_movephoto_type,_copy_movephoto_ctrl,_copy_movephoto_i=0;
function copyMovephoto(_type){
var _addline=true;
if(document.getElementById('img-line-0').checked){
_addline=false;
}
_copy_movePhoto_nodelist = ge('move_urlphoto_container').getElementsByTagName('img');
_copy_movephoto_i=0;
_copy_movephoto_ctrl=document.body.createControlRange();
if(!_temp_photo_container){_temp_photo_container=ce('div');document.body.appendChild(_temp_photo_container);_temp_photo_container.style.display='none';}
_copy_movephoto_type=_type;
// showPageBackPublic(document.body,110,'copy_movephoto_bg');
var _copy_movephoto_pro=ge('_copy_movephoto_pro');
if(!_copy_movephoto_pro){_copy_movephoto_pro=ce('div');_copy_movephoto_pro.id='_copy_movephoto_pro';_copy_movephoto_pro.style.cssText='position:absolute;z-index:111;border:10px solid #777777;width:400px;height:80px;padding-top:10px';document.body.appendChild(_copy_movephoto_pro);}
var tempPos = getAbsoluteLocation(ge('item_container'));
var tempTop = tempPos.absoluteTop;
if(tempTop<document.body.scrollTop){
tempTop = document.body.scrollTop;
}
// _copy_movephoto_pro.style.top = tempTop+30;
// _copy_movephoto_pro.style.left = tempPos.absoluteLeft+tempPos.offsetWidth/2 - 200;
// _copy_movephoto_pro.innerHTML='<div>您选择了'+_copy_movePhoto_nodelist.length+'张图片,正在复制第<span id="cur_copy_photos">1</span>张。</div><div style="width:240px;height:18px;overflow:hidden"><div id="movephoto_copyed" class="progress_bg_done_green" style="width:1px;height:18px"></div><div id="movephoto_left" class="progress_bg_remaining_gray" style="width:239px;height:18px"></div><div class="clear_div"> </div></div>';
// _copy_movephoto_pro.style.display='block';
var _imghtml='';
for(var i=0;i<_copy_movePhoto_nodelist.length;i++){
var _url = _copy_movePhoto_nodelist[i].src;
_url = getCopyMovephotoUrl(_url,_copy_movephoto_type);
if(_addline){
_imghtml += '<img src="'+_url+'"/><br/><br/>';
}else{
_imghtml += '<img src="'+_url+'"/><br/>';
}
// var _tempimg=ce('div');
// if(_addline){
// _tempimg.innerHTML='<img src="'+_url+'"/><br/><br/>';
// }else{
// _tempimg.innerHTML='<img src="'+_url+'"/><br/>';
// }
// _tempimg.style.textAlign='center';
// _temp_photo_container.appendChild(_tempimg);
// _tempimg.contentEditable='true';
// _copy_movephoto_ctrl.addElement(_tempimg);
}
_temp_photo_container.innerHTML=_imghtml;
_temp_photo_container.style.cssText='text-align:center';
_temp_photo_container.contentEditable='true';
_copy_movephoto_ctrl.addElement(_temp_photo_container);
doCopyMovephotoObject();
alert('复制成功。');
// doCopyMovephoto();
}
function doCopyMovephotoObject(){
_copy_movephoto_ctrl.execCommand('Copy',null);
var _copy_movephoto_pro=ge('_copy_movephoto_pro');
if(_copy_movephoto_pro){
_copy_movephoto_pro.innerHTML='<div style="padding-top:15px;color:#FE6600;font-weight:bold">图片复制成功,您可以直接粘贴到淘宝的宝贝描述中!</div>';
setTimeout(function(){ge('_copy_movephoto_pro').style.display='none';closePageBackPublic('copy_movephoto_bg');},1000);
}
_temp_photo_container.innerHTML='';
}
function doCopyMovephoto(){
if(_copy_movephoto_i>=_copy_movePhoto_nodelist.length){
doCopyMovephotoObject();
return;
}
setCopyMovephotoPro();
var _img = new Image();
var _url = _copy_movePhoto_nodelist[_copy_movephoto_i].src;
_url = getCopyMovephotoUrl(_url,_copy_movephoto_type)
_img.src=_url;
if(_img.complete){
var _tempimg=ce('div');_tempimg.innerHTML='<img src="'+_url+'"/><br/>';
_temp_photo_container.appendChild(_tempimg);
_tempimg.contentEditable='true';
_copy_movephoto_ctrl.addElement(_tempimg);
_copy_movephoto_i++;
doCopyMovephoto();
}else{
_img.onload=function(){
var _tempimg=ce('div');_tempimg.innerHTML='<img src="'+this.src+'"/><br/>';
_temp_photo_container.appendChild(_tempimg);
_tempimg.contentEditable='true';
_copy_movephoto_ctrl.addElement(_tempimg);
_copy_movephoto_i++;
doCopyMovephoto();
};
}
}
function setCopyMovephotoPro(){
var _w = 240*(_copy_movephoto_i+1)/_copy_movePhoto_nodelist.length;
ge('movephoto_copyed').style.width=_w;
ge('movephoto_left').style.width=(240-_w);
ge('cur_copy_photos').innerHTML=_copy_movephoto_i+1;
}
function copyMovephotoUrl(_type){
var _addline=true;
if(document.getElementById('img-line-0').checked){
_addline=false;
}
var _imgs = ge('move_urlphoto_container').getElementsByTagName('img');
var _html = '';
for(var i=0;i<_imgs.length;i++){
var _url = _imgs[i].getAttribute('osrc');
if(_addline){
_html+="<img src='"+getCopyMovephotoUrlOri(_url,_type)+"'/><br/><br/>";
}else{
_html+="<img src='"+getCopyMovephotoUrlOri(_url,_type)+"'/><br/>";
}
}
// copyit(_html);
// alert('复制成功!');
copy_code(_html,'复制成功。');
}
function stopmovephoto(){
if(bMove){
bMove=false;
setMoveOpa(photoUrlMovered,100);
photoUrlMover.style.display='none';
}
}
function movephoto(event){
if(!bMove){
return true;
}
event = event || window.event;
var _x = event.clientX-_mp.x;
var _y = event.clientY-_mp.y;
photoUrlMover.style.left=_x;
photoUrlMover.style.top=_y;
var _target = movePhotoGetPhotoByPos(_x,_y);
if(!_target || _target.getAttribute('index')==photoUrlMover.getAttribute('index')){
return false;
}
var targetIndex = parseInt(_target.getAttribute('index'))-1;
resortPhotoMove(_target);
movephotoChangeIndex(_target,targetIndex);
return false;
}
function movephotoChangeIndex(_target,targetIndex){
var oldIndex = parseInt(photoUrlMover.getAttribute('index'))-1;
setMovephotoIndex(photoUrlMover,targetIndex);
if(targetIndex>oldIndex){//move after
var _temp = movePhotoPosList[oldIndex].photo;
for(var i=oldIndex;i<targetIndex;i++){
movePhotoPosList[i].photo = movePhotoPosList[i+1].photo;
setMovephotoIndex(movePhotoPosList[i].photo,i);
}
movePhotoPosList[targetIndex].photo=_temp;
setMovephotoIndex(movePhotoPosList[targetIndex].photo,targetIndex);
}else{
var _temp = movePhotoPosList[oldIndex].photo;
for(var i=oldIndex;i>targetIndex;i--){
movePhotoPosList[i].photo = movePhotoPosList[i-1].photo;
setMovephotoIndex(movePhotoPosList[i].photo,i);
}
movePhotoPosList[targetIndex].photo=_temp;
setMovephotoIndex(movePhotoPosList[targetIndex].photo,targetIndex);
}
}
function resortPhotoMove(_target){//向后插入
var _next = _target;
var _parent = _target.parentNode;
var oldIndex = parseInt(photoUrlMover.getAttribute('index'));
var targetIndex = parseInt(_target.getAttribute('index'));
if(targetIndex>oldIndex){//insert after
_next = _target.nextSibling;
}
if(_next){
_parent.insertBefore(photoUrlMovered,_next);
}else{
_parent.appendChild(photoUrlMovered);
}
}
function setMovephotoIndex(_movephoto,_index){
var _tempIndex = parseInt(_index)+1;
_movephoto.setAttribute('index',_tempIndex);
var _temp = _movephoto.getElementsByTagName('div');
for(var i=0;i<_temp.length;i++){
var _class = _temp[i].className;
if(_class=='float_index_black' || _class=='float_index_white'){
_temp[i].innerHTML = _tempIndex;
}
}
}
function movePhotoGetPhotoByPos(_x,_y){
for(var i=0;i<movePhotoPosList.length;i++){
var _pos = movePhotoPosList[i];
var _leftMin = _pos.x+5;
var _leftMax = _pos.x+30;
var _topMin = _pos.y-5;
var _topMax = _pos.y+30;
if(_x>_leftMin && _x<_leftMax && _y>_topMin && _y<_topMax){
return _pos.photo;
}
}
return null;
}
function getPhotoMoverContent(_move,_url,_index){
var _html = '<div style="position:absolute;z-index:111;text-align:left"><img width="75" height="75" src="'+_url+'"/></div><div class="float_index_black" style="z-index:113">'+_index+'</div><div class="float_index_white" style="z-index:112">'+_index+'</div>';
return _html;
}
function setMoveOpa(_move,_opa){
var _opa_m = _opa/100;
_move.style.filter = 'alpha(opacity='+_opa+')';
_move.style.opacity = _opa_m;
var _childs = _move.childNodes;
for(var i=0;i<_childs.length;i++){
_childs[i].style.filter = 'alpha(opacity='+_opa+')';
_childs[i].style.opacity = _opa_m;
}
}
function refresh(){
window.location.reload();
// if(photoPageProps.type=='recent'){
// location.href='/photo?type=recent&p='+photoPageProps.page;
// }else{
// var pathId = getPathId();
// location.href='/photo?pathid='+pathId+'&p='+photoPageProps.page;
// }
}
function getPathId(){
return ge('cur_path').value;
}
function changeViewType(type){
location.href='/photo?type='+type;
}
function goPhotoPage(type,page,sort){
photoPageProps.page=page;
photoPageProps.type=type;
photoPageProps.sort =sort;
reloadPhoto();
}
function changePhotoSort(_sorturl,tempSort){
location.href=_sorturl+tempSort;
}
function reloadPhoto(type){
var objReloadXmlHttp = createXmlHttp();
if(objReloadXmlHttp){
showManagePhotoWaiting('正在重新载入图片,请稍等……');
showManagePhotoBack();
if(photoPageProps.type=='recent'){
objReloadXmlHttp.open('post', '/photo?op=getphotorecent&id='+photoPageProps.id+'&p='+photoPageProps.page,true);
}else{
var _id = photoPageProps.s;
if(_id!='0'){
var _ids = _id.split('/');
_id = _ids[_ids.length-1];
}
objReloadXmlHttp.open('post', '/photo?op=show&id='+_id+'&p='+photoPageProps.page+'&sort='+photoPageProps.sort,true);
}
objReloadXmlHttp.setRequestHeader("Content-Type","utf-8");
objReloadXmlHttp.onreadystatechange=function(){
if (objReloadXmlHttp.readyState==4) {
closeManagePhotoWindows();
var returnDocument = objReloadXmlHttp.responseXML;
if(getXmlhttpError(returnDocument)=='false'){
if(type=='open'){
viewSelectFolder.f_selected=currentFolder=document.getElementById(viewSelectFolder.id+'_folder_item_'+photoPageProps.id);
}
writePhotos(returnDocument,type);
if(type=='open'){
viewSelectFolder._insertNewFolderSet();
}
if(viewSelectFolder){
currentFolder = viewSelectFolder.f_selected;
}
ge('photo_select_all').checked=false;
}else{
alert(getXmlhttpError(returnDocument));
}
}
};
objReloadXmlHttp.send(null);
}
}
function writeNoPhoto(){
ge('photo_container').innerHTML = '<div style="margin:20px">非常抱歉,您还没有上传图片或创建创建文件夹,到此文件夹下。</div>';
if(ge('page_container'))page_container.innerHTML = '';
var topPage = ge('toppage');
if(topPage)topPage.innerHTML = '';
var bottomPage = ge('page');
if(bottomPage)bottomPage.innerHTML = '';
}
function writePhotos(returnDocument,type){
if(!returnDocument || returnDocument==null){
writeNoPhoto();
return;
}
var items = returnDocument.getElementsByTagName('item');
if(!items || items.length==0){
writeNoPhoto();
return;
}
var strHTML = '';
strHTML += '<div style="padding:10px 0px 10px 15px;text-align:left">';
for(var i=0;i<items.length;i++){
var tempItem = items[i];
strHTML += '<div class="photo_item_con">';
var strType = getElementValueByTagName(tempItem,'itemType');
var tempId = getElementValueByTagName(tempItem,'id');
var tempName = getElementValueByTagName(tempItem,'name');
if(strType=='set'){
var setcount = getElementValueByTagName(tempItem,'setcount');
var photocount = getElementValueByTagName(tempItem,'photocount');
strHTML += '<div class="set_img_con photo_border"><div><a href="/photo?s='+ge('cur_path').value+'/'+tempId+'"><img src="/image/folder/folder.gif"/></a></div><div class="font_light_gray">'+setcount+'文件夹|'+photocount+'文件</div></div>';
strHTML += '<div id="name_'+tempId+'" class="photo_item_name" title="单击即可修改" onmouseout="this.style.backgroundColor=\'#ffffff\';" onmouseover="this.style.backgroundColor=\'#FAF4C6\';" onclick="showEditName(\''+tempId+'\',\'folder\');">'+tempName+'</div>';
strHTML += '<div style="text-align:left;padding-left:5px;display:none" id="edit_name_'+tempId+'"><input type="text" class="text" id="edit_name_input_'+tempId+'" maxlength="25" style="width:110px"/><input type="button" class="button_mini" value="确定" onclick="saveEditName(\''+tempId+'\',\'folder\');"/><input type="button" class="button_gray_mini1" value="取消" onclick="closeEditName(\''+tempId+'\');"/></div>';
strHTML += '<div style="display:none" id="edit_name_waiting_'+tempId+'"><img width="24" src="/image/loading.gif" style="vertical-align:middle"/>正在保存…</div>';
strHTML += '<div style="padding-bottom:5px"><a class="link_gray_button" href="/photo?s='+ge('cur_path').value+'/'+tempId+'">打开</a><span> </span><a class="link_gray_button" href="#" onclick="movePhotoSet(\'set\',\''+tempId+'\',\'cut\');">移动</a><span> </span><a class="link_gray_button" href="#" onclick="deleteSet(\''+tempId+'\');return false;">删除</a></div>';
if(type=='open'){
inserSelectNewFolder(tempId,tempName);
}
}else{
var tempUrl = getElementValueByTagName(tempItem,'url');
var tempUrls = getElementValueByTagName(tempItem,'urls');
var tempUrlm = getElementValueByTagName(tempItem,'urlm');
strHTML += '<div class="photo_center_border" style="cursor:pointer" onclick="selectThisPhoto(\''+tempId+'\');"><p><img src="'+tempUrls+'" style="cursor:pointer"/></p></div><br class="tl"/>';
strHTML += '<div id="name_'+tempId+'" class="photo_item_name" title="单击即可修改" onmouseout="this.style.backgroundColor=\'#ffffff\';" onmouseover="this.style.backgroundColor=\'#FAF4C6\';" onclick="showEditName(\''+tempId+'\',\'photo\');">'+tempName+'</div>';
strHTML += '<div style="text-align:left;padding-left:5px;display:none" id="edit_name_'+tempId+'"><input type="text" class="text" id="edit_name_input_'+tempId+'" maxlength="25" style="width:110px"/><input type="button" class="button_mini" value="确定" onclick="saveEditName(\''+tempId+'\',\'photo\');"/><input type="button" class="button_gray_mini1" value="取消" onclick="closeEditName(\''+tempId+'\');"/></div>';
strHTML += '<div style="display:none" id="edit_name_waiting_'+tempId+'"><img width="24" src="/image/loading.gif" style="vertical-align:middle"/>正在保存…</div>';
strHTML += '<div style="padding-bottom:5px"><input type="checkbox" name="item_photo_select" id="img_checkbox_'+tempId+'" value="'+tempId+'" url="'+tempUrl+'"/>';
strHTML += '<a class="link_gray_button" href="#" onclick="viewPhoto(\''+tempName+'\',\''+tempUrlm+'\');">浏览</a><span> </span><a class="link_gray_button" href="#" onclick="replacePhoto();return false;">替换</a>';
strHTML += '<span> </span><a class="link_gray_button" href="#" onmouseover="showThisPhotoUrl(this,\''+tempUrl+'\');" onmouseout="closeThisPhotoUrl(event);">地址</a></div>';
}
strHTML += '</div>';
if(i%5==4){
strHTML += '<div class="clear_div"></div>';
}
}
strHTML += '<div class="clear_div"></div>';
strHTML += '</div>';
ge('photo_container').innerHTML = strHTML;
var totalPage = getElementValueByTagName(returnDocument,'totalPage');
if(totalPage==1){
var topPage = ge('toppage');
if(topPage)topPage.innerHTML = '';
var bottomPage = ge('page');
if(bottomPage)bottomPage.innerHTML = '';
}else{
writePages(returnDocument);
}
}
function writePages(returnDocument){
var pages = returnDocument.getElementsByTagName('pageNum');
var firstPage = parseInt(pages[0].childNodes[0].data);
var lastpage = parseInt(pages[pages.length-1].childNodes[0].data);
var curPage = parseInt(getElementValueByTagName(returnDocument,'currentPage'));
var totalPage = parseInt(getElementValueByTagName(returnDocument,'totalPage'));
var strHTML = '';
if(curPage==1){
strHTML += '<span class="page_pre_gray"> </span>';
}else{
strHTML += '<span class="page_pre" onclick="goPhotoPage(\''+photoPageProps.type+'\','+(curPage-1)+',\''+photoPageProps.sort+'\');"> </span>';
}
if(firstPage>1){
strHTML += '<a href="#" onclick="goPhotoPage(\''+photoPageProps.type+'\',1,\''+photoPageProps.sort+'\');">1</a> ';
if(firstPage>2){
strHTML += ' … ';
}
}
for(var i=0;i<pages.length;i++){
var tempPage = parseInt(pages[i].childNodes[0].data);
if(tempPage==curPage){
strHTML += ' <font color="#111111"><strong>'+tempPage+'</strong></font> ';
}else{
strHTML += '<a href="#" onclick="goPhotoPage(\''+photoPageProps.type+'\','+tempPage+',\''+photoPageProps.sort+'\');">'+tempPage+'</a> ';
}
}
if(totalPage>lastpage){
if(totalPage>lastpage+1){
strHTML += ' … ';
}
strHTML += '<a href="#" onclick="goPhotoPage(\''+photoPageProps.type+'\','+totalPage+',\''+photoPageProps.sort+'\');">'+totalPage+'</a>';
}
if(curPage==lastpage){
strHTML += '<span class="page_next_gray"> </span>';
}else{
strHTML += '<span class="page_next" onclick="goPhotoPage(\''+photoPageProps.type+'\','+(curPage+1)+',\''+photoPageProps.sort+'\');"> </span>';
}
var topPage = ge('toppage');
if(!topPage){
topPage = document.createElement('div');
topPage.id='toppage';
topPage.className='page_style';
topPage.style.cssText='margin:0px;padding:5px 0px 9px 0px;text-align:right;width:520px';
ge('top_page_con').appendChild(topPage);
}
topPage.innerHTML = strHTML;
topPage.style.display='';
var bottomPage = ge('page_container');
if(!bottomPage){
bottomPage = document.createElement('div');
bottomPage.id='page_container';
bottomPage.className='bg_img main_sub_footer';
ge('item_container').appendChild(bottomPage);
}
bottomPage.innerHTML = '<div id="page">'+strHTML+'</div>';
}
function inserSelectNewFolder(tempId,tempName){
var newFolderProps = {id:tempId,name:tempName,tipImg:viewSelectFolder.F_TC,folderImg:viewSelectFolder.F_FC,cid:'0',status:'close',className:'folder_items'};
newFolderProps.pid=currentFolder.getAttribute('fid');
var strPath = currentFolder.getAttribute('path');
if(strPath=='0'){
strPath=currentFolder.getAttribute('name');
}else{
strPath=strPath+'/'+currentFolder.getAttribute('name');
}
newFolderProps.path=strPath;
var paddingLeft = parseInt(currentFolder.getElementsByTagName('td')[0].width)+viewSelectFolder.f_paddingLeft;
newFolderProps.paddingLeft=paddingLeft;
viewSelectFolder._insertNewFolder(newFolderProps);
}
function onSelectFolder(){
currentFolder = viewSelectFolder.f_selected;
photoPageProps.id=currentFolder.getAttribute('fid');
photoPageProps.page=1;
reloadPhoto();
}
function onNewFolder(){
}
function closeManagePhotoWaiting(){
var managePhotoWaiting = ge('manage_photo_waiting');
if(managePhotoWaiting)managePhotoWaiting.style.display='none';
var managePhotoWaitingBack = ge('manage_photo_waiting_back');
if(managePhotoWaitingBack)managePhotoWaitingBack.style.display='none';
}
function showManagePhotoWaiting(msg){
var managePhotoWaiting = ge('manage_photo_waiting');
if(!managePhotoWaiting){
managePhotoWaiting = document.createElement('div');
managePhotoWaiting.id = 'manage_photo_waiting';
managePhotoWaiting.style.cssText='z-index:111;top:0px;left:0px;width:300px;height:90px;position:absolute;border:10px solid #DAD6D6';
document.body.appendChild(managePhotoWaiting);
}
var tempPos = getAbsoluteLocation(ge('item_container'));
var tempTop = tempPos.absoluteTop;
managePhotoWaiting.style.top = tempTop+45;
managePhotoWaiting.style.left = tempPos.absoluteLeft+tempPos.offsetWidth/2 - 150;
managePhotoWaiting.innerHTML = '<div style="margin-top:20px"><img width="16" src="/image/loading.gif" styel="vertical-align:bottom;margin-right:5px"/>'+msg+'</div>';
managePhotoWaiting.style.display='';
//
var managePhotoWaitingBack = ge('manage_photo_waiting_back');
if(!managePhotoWaitingBack){
managePhotoWaitingBack = document.createElement('div');
managePhotoWaitingBack.id = 'manage_photo_waiting_back';
managePhotoWaitingBack.style.cssText='z-index:110;top:0px;left:0px;background-color:#000000;position:absolute;filter:alpha(opacity=20);moz-opacity: 0.2;opacity:.2';
document.body.appendChild(managePhotoWaitingBack);
}
managePhotoWaitingBack.style.display='';
managePhotoWaitingBack.style.width = tempPos.offsetWidth;
managePhotoWaitingBack.style.height = tempPos.offsetHeight;
managePhotoWaitingBack.style.top = tempPos.absoluteTop;
managePhotoWaitingBack.style.left = tempPos.absoluteLeft;
}
function closeManagePhotoWindows(){
var managePhotoWindow = ge('manage_photo_window');
if(managePhotoWindow)managePhotoWindow.style.display='none';
var managePhotoBack = ge('manage_photo_back');
if(managePhotoBack)managePhotoBack.style.display='none';
closeManagePhotoWaiting();
var _pageBackFrame = ge('manage_photo_back_frame');
if(_pageBackFrame)_pageBackFrame.style.display='none';
}
function showManagePhotoWindow(){
var managePhotoWindow = ge('manage_photo_window');
if(!managePhotoWindow){
managePhotoWindow = document.createElement('div');
managePhotoWindow.id = 'manage_photo_window';
managePhotoWindow.style.cssText='z-index:101;top:0px;left:0px;position:absolute;border:10px solid #777777';
document.body.appendChild(managePhotoWindow);
}
return managePhotoWindow;
}
function closeManagePhotoBack(){
var managePhotoBack = ge('manage_photo_back');
if(managePhotoBack)managePhotoBack.style.display='none';
var _pageBackFrame = ge('manage_photo_back_frame');
if(_pageBackFrame)_pageBackFrame.style.display='none';
}
function showManagePhotoBack(){
var managePhotoBack = ge('manage_photo_back');
if(!managePhotoBack){
managePhotoBack = document.createElement('div');
managePhotoBack.id = 'manage_photo_back';
managePhotoBack.style.cssText='z-index:100;top:0px;left:0px;background-color:#000000;position:absolute;filter:alpha(opacity=20);moz-opacity: 0.2;opacity:.2';
document.body.appendChild(managePhotoBack);
}
var tempPos = getAbsoluteLocation(ge('item_container'));
managePhotoBack.style.display='';
managePhotoBack.style.width = tempPos.offsetWidth;
managePhotoBack.style.height = tempPos.offsetHeight;
managePhotoBack.style.top = tempPos.absoluteTop;
managePhotoBack.style.left = tempPos.absoluteLeft;
//
if(bIE && getIEVer()<7){
var _pageBackFrame = ge('manage_photo_back_frame');
if(!_pageBackFrame){
_pageBackFrame = ce('iframe');
_pageBackFrame.id = 'manage_photo_back_frame';
_pageBackFrame.frameborder='0';
_pageBackFrame.style.cssText='z-index:99;top:0px;left:0px;background-color:transparent;position:absolute;border:none';
document.body.appendChild(_pageBackFrame);
}
_pageBackFrame.style.display='';
_pageBackFrame.style.top=managePhotoBack.style.top;
_pageBackFrame.style.left=managePhotoBack.style.left;
_pageBackFrame.style.width=managePhotoBack.style.width;
_pageBackFrame.style.height=managePhotoBack.style.height;
}
}
function closeManagePhotoBackF(){
var managePhotoBack = ge('manage_photo_back_f');
if(managePhotoBack)managePhotoBack.style.display='none';
}
function showManagePhotoBackF(){
var managePhotoBack = ge('manage_photo_back_f');
if(!managePhotoBack){
managePhotoBack = document.createElement('div');
managePhotoBack.id = 'manage_photo_back_f';
managePhotoBack.style.cssText='z-index:100;top:0px;left:0px;background-color:#000000;position:absolute;filter:alpha(opacity=20);moz-opacity: 0.2;opacity:.2';
document.body.appendChild(managePhotoBack);
}
managePhotoBack.style.display='';
managePhotoBack.style.width = document.body.scrollWidth;
managePhotoBack.style.height = document.body.scrollHeight;
}
//
function initPhoto(){
if(photoPageProps.type=='recent')return;
var viewSelectFolderProps={id:'view_select_folder',selector:ge('view_folder'),parentId:'view_folder_parent',ctop:0,cleft:0,bottonNew:true};
var callback={onSelect:onSelectFolder};
viewSelectFolderProps.callback = callback;
viewSelectFolder = new folder(viewSelectFolderProps);
currentFolder = viewSelectFolder.f_selected;
}
//
function goUpload(){
var pathId = '0';
if(viewSelectFolder){
pathId = getPathId();
}
var uploadProps = {path:pathId,pathName:_util.pb.gev('full-path-name'),fullPath:_util.pb.gev('cur_path'),lastId:_util.pb.gev('last-path-id'),lastName:_util.pb.gev('last-path-name')};
showUpload(uploadProps);
}
function doUserCompleteUpload(fileCount,errorCount){
reloadPhoto();
}
function selectThisPhoto(_id){
ge('img_checkbox_'+_id).checked=!(ge('img_checkbox_'+_id).checked);
}
function replacePhoto(_pid){
_replacePid = _pid;
_util.window.bg();
var _html = '<div style="text-align:left"><div style="margin:10px">选择一张图片,替换当前这张图片。</div>';
_html += '<iframe id="replace-photo-frame" src="/uploadReplace.html" frameborder="0" scrolling="no" style="width:360px;height:100px;margin:0 auto;overflow:hidden"></iframe><div id="replace-photo-waiting" style="display:none;text-align:center"></div></div>';
_util.window.show('','替换图片',_html,{w:400,h:200});
}
function replacingPhoto(){
$('#replace-photo-frame').hide();
$('#replace-photo-waiting').show().html('<img src="/image/loading.gif" style="vertical-align:middle"/><span>上传替换中,请稍等……</span>');
}
function replacePhotoError(_error){
$('#replace-photo-waiting').html('<img src="/image/error.gif"/><span>'+_error+'</span><div style="margin-top:10px"><input type="button" class="buttonblue" value="重新上传" onclick="replacePhoto(\''+_replacePid+'\');"/><input type="button" class="buttonblue" value="关闭" onclick="_util.window.bgc();_util.window.showc();" style="margin-left:20px"/></div>');
}
function replacePhotoSuccess(){
$('#replace-photo-waiting').html('<img src="/image/tp_su_1.gif"/>替换成功。<div style="margin-top:10px"><input type="button" class="buttonblue" value="确定" onclick="location.reload();"/></div>');
var _img = $('#img-list-'+_replacePid);
_img.attr('src',_img.attr('src')+'?v='+Math.random());
}
function encodeName1(_id){
var _name = ge(_id).innerHTML;
ge(_id).innerHTML = _name.replace(/ /g,' ');
}
function showEditName(_id,_type){
ge('name_'+_id).style.display='none';
ge('edit_name_'+_id).style.display='';
var _name = ge('name_'+_id).innerHTML.replace(/ /g,' ');
if(_type=='photo'){
var _p = _name.lastIndexOf('.');
var _sufix = _name.substring(_p);
_name = _name.substring(0,_p);
}
ge('edit_name_input_'+_id).value = _name;
ge('edit_name_input_'+_id).select();
}
function closeEditName(_id){
ge('name_'+_id).style.display='';
ge('edit_name_'+_id).style.display='none';
}
function saveEditName(_id,_type){
var _name = ge('edit_name_input_'+_id).value;
if(!_name || _name==''){
alert('名字不能为空!');
return;
}
var _confirm = '';
if(_newusertype=='1'){
if(_type=='folder'){
_util.window.cfm('修改文件夹名确认','您确定要修改吗?',doSaveEditName);
}else{
_util.window.cfm('修改图片名确认','您确定要修改吗?',doSaveEditName);
}
}else{
if(_type=='folder'){
_util.window.cfm('修改文件夹名确认','修改之后,文件夹中的图片的外链将失效!<br/><br/>您确定要修改吗?',doSaveEditName);
}else{
_util.window.cfm('修改图片名确认','修改图片名之后,图片的外链将失效!<br/><br/>您确定要修改吗?',doSaveEditName);
}
}
ge('pub_cfm_butt').onclick=function(){doSaveEditName(_id,_type);};
}
function doSaveEditName(_id,_type){
var _name = ge('edit_name_input_'+_id).value;
if(_type=='photo'){
var _nameo = ge('name_'+_id).innerHTML;
var _p = _nameo.lastIndexOf('.');
var _sufix = _nameo.substring(_p);
_name = _name + _sufix;
}
var _url = '/photo?op=edit&t='+_type+'&id='+_id+'&name='+encodeURIComponent(_name);
if(ge('cur_path_name')){_url+='&pname='+encodeURIComponent(ge('cur_path_name').value);}
ge('edit_name_waiting_'+_id).style.display='';
ge('edit_name_'+_id).style.display='none';
_util.window.cfmc();
xmlHttpRequest(_url,saveEditNameReturn,{id:_id,name:_name});
}
function saveEditNameReturn(_xmlhttp,_props){
var _document = _xmlhttp.responseXML;
var _error = getXmlhttpError(_document);
ge('edit_name_waiting_'+_props.id).style.display='none';
if(_error=='false'){
ge('name_'+_props.id).innerHTML=_props.name.replace(/ /g,' ');
ge('name_'+_props.id).style.display='';
refresh();
}else{
ge('edit_name_'+_props.id).style.display='';
alert(_error);
}
}
function closePhotoSizeTips(){
var photoSizeTipWindow = ge('photoSize_tip_window');
if(photoSizeTipWindow)photoSizeTipWindow.style.display='none';
}
function showPhotoSizeTips(_link){
var photoSizeTipWindow = createPhotoSizeTipWindow(_link);
var _html = '';
_html += '<div style="border:3px solid #E4EFFF;padding:10px">';
_html += '<div style="float:right;margin-left:10px"><a class="link_del" href="#" onclick="closePhotoSizeTips();return false;">X</a></div>';
_html += '<div style="text-align:left;line-height:1.8">';
_html += '<b>什么是标准尺寸?</b><br/>标准图片自动将宽度超过640像素的图片缩小为640像素,适合网店宝贝展示。<br/>原图为原始图片,适合网店装饰用途。';
_html += '</div><div class="clear_div"></div>';
_html += '</div>';
photoSizeTipWindow.innerHTML = _html;
}
function createPhotoSizeTipWindow(_link){
var photoSizeTipWindow = ge('photoSize_tip_window');
if(!photoSizeTipWindow){
photoSizeTipWindow = ce('div');
photoSizeTipWindow.id='photoSize_tip_window';
photoSizeTipWindow.style.cssText='z-index:110;position:absolute;width:360px;border:1px solid #C1DBFF';
document.body.appendChild(photoSizeTipWindow);
}
var _pos = getAbsoluteLocation(_link);
photoSizeTipWindow.style.top=_pos.absoluteTop+30;
photoSizeTipWindow.style.left = document.body.scrollWidth/2 - 40;
photoSizeTipWindow.style.display='';
return photoSizeTipWindow;
}
function setResizeValu(_radio){
if(_radio.value=="6"){
ge('resize_custom_width').disabled=false;
ge('resize_custom_height').disabled=false;
}else{
ge('resize_custom_width').disabled=true;
ge('resize_custom_height').disabled=true;
}
resizeProps.type = _radio.value;
}
function saveResize(){
var _inputs = ge('manage_photo_window').getElementsByTagName('input');
var bChecked=false;
for(var i=0;i<_inputs.length;i++){
if(_inputs[i].name=='resize_photo_type' && _inputs[i].checked){
resizeProps.type = _inputs[i].value;
bChecked = true;
break;
}
}
if(!bChecked){
alert('请选择您需要的图片大小。');
return;
}
if(resizeProps.type=='6'){
var _width = ge('resize_custom_width').value;
var _height = ge('resize_custom_height').value;
if(!_width || !isInt(_width) || (parseInt(_width)<=0 && _width!='-1')){
alert('宽度必须是-1或大于0的整数。');
return;
}
if(!_height || !isInt(_height) || (parseInt(_height)<=0 && _height!='-1')){
alert('高度必须是-1或大于0的整数。');
return;
}
resizeProps.width = _width;
resizeProps.height = _height;
}
}
function getResizeVars(){
var _paras='';
if(ge('photo_resize_yes').checked){
saveResize();
_paras += '&photoResize_t='+resizeProps.type;
if(resizeProps.type=='6'){
_paras += '&photoResize_w='+resizeProps.width;
_paras += '&photoResize_h='+resizeProps.height;
}
}else{
_paras += '&photoResize_t=-1';
}
return _paras;
}
//document.onmousedown = startPhotoUrlMove;
document.onmousemove=movephoto;
document.onmouseup=stopmovephoto;
var moveFolder;
var createNewFolder;
var currentFolder;
var resizeProps={};
var photoUrlMover=ce('div');
var photoUrlMovered;
var bMove=false;
var _mp={};
var _replacePid;
function formatPhotoUrl(tempUrl,type){
var ipos = tempUrl.lastIndexOf('.');
return tempUrl.substring(0,ipos)+type+tempUrl.substring(ipos);
}
function selectAll(selector){
var itemChecked = false;
if(selector.checked){
itemChecked = true;
}
var itemContainer = ge('item_container');
var items = itemContainer.getElementsByTagName('input');
for(var i=0;i<items.length;i++){
var tempItem = items[i];
if(tempItem.name=='item_photo_select'){
tempItem.checked=itemChecked
}
}
}
function deletePhoto(){
var _ids = getSelectedIds();
if(!_ids || _ids==''){
alert('请先选择要删除的图片,然后再点击删除!');
return;
}
_util.window.cfm('删除图片确认','删除图片后,您外链到店铺中的图片将无法显示。<br/><br/>您确定要删除选中的图片吗?',doDeletePhoto).cfm.style.height=180;
}
function doDeletePhoto(){
var _ids = getSelectedIds();
var xmlhttp = createXmlHttp();
if(xmlhttp){
_util.window.cfmc();
showManagePhotoWaiting('正在删除图片,请稍等……');
showManagePhotoBack();
xmlhttp.open('post', '/photo?op=deletephoto&ids='+_ids,true);
xmlhttp.setRequestHeader("Content-Type","utf-8");
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4) {
var returnDocument = xmlhttp.responseXML;
if(getXmlhttpError(returnDocument)=='false'){
window.location.reload();return;
}else{
closeManagePhotoWindows();
alert(getXmlhttpError(returnDocument));
}
}
};
xmlhttp.send(null);
}
}
function getSelectedIds(){
var selectIds='';
var itemContainer = ge('item_container');
var items = itemContainer.getElementsByTagName('input');
for(var i=0;i<items.length;i++){
var tempItem = items[i];
if(tempItem.name=='item_photo_select' && tempItem.checked){
selectIds += tempItem.value+';';
}
}
return selectIds;
}
function deleteSet(id){
_util.window.cfm('删除文件夹确认','删除文件夹后,此文件夹中的图片和子文件夹将被删除,被删除的图片外链同时会失效!<br/><br/>您确定要删除选中的图片吗?',doDeletePhoto);
ge('pub_cfm_butt').onclick=function(){doDeleteSet(id)};
}
function doDeleteSet(id){
var xmlhttp = createXmlHttp();
if(xmlhttp){
_util.window.cfmc();
showManagePhotoWaiting('正在删除文件夹,请稍等……');
showManagePhotoBack();
var _del_url='/photo?op=deleteset&id='+id;
if(ge('cur_path_name')){_del_url+='&pname='+encodeURIComponent(ge('cur_path_name').value);}
xmlhttp.open('post',_del_url ,true);
xmlhttp.setRequestHeader("Content-Type","utf-8");
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4) {
var returnDocument = xmlhttp.responseXML;
if(getXmlhttpError(returnDocument)=='false'){
window.location.reload();return;
}else{
closeManagePhotoWindows();
alert(getXmlhttpError(returnDocument));
}
}
};
xmlhttp.send(null);
}
}
function goCreateNewFolder(){
showManagePhotoWaiting('正在查询文件夹,请稍等……');
showManagePhotoBack();
xmlHttpRequest('/folder?op=getsubfolder&pid=0',showCreateNewFolder);
}
function showCreateNewFolder(_xmlhttp){
var _document = _xmlhttp.responseXML;
var _error = getXmlhttpError(_document);
if(_error=='false'){
showCreateNewFolderWindow(_document);
closeManagePhotoWaiting();
}else{
alert(_error);
closeManagePhotoWaiting();
closeManagePhotoBack();
}
}
function closeCreateNewFolderWindow(){
closeManagePhotoBack();
var _window = ge('create_new_folder_window');
if(_window)_window.style.display='none';
if(createNewFolder){
createNewFolder._distroy();
}
}
function showCreateNewFolderWindow(_document){
var _window = ge('create_new_folder_window');
if(!_window){
_window = ce('div');
_window.id = 'create_new_folder_window';
_window.style.cssText='z-index:101;top:0px;left:0px;width:520px;height:480px;position:absolute;border:10px solid #DAD6D6';
document.body.appendChild(_window);
}
_window.style.display = '';
var tempPos = getAbsoluteLocation(ge('item_container'));
var tempTop = tempPos.absoluteTop;
if(tempTop<document.body.scrollTop){
tempTop = document.body.scrollTop;
}
_window.style.top = tempTop+10;
_window.style.left = tempPos.absoluteLeft+tempPos.offsetWidth/2 - 270;
var _html = '';
_html += '<div class="left" style="margin:15px 0px 0px 15px"></div>';
_html += '<div class="right" style="margin:5px 5px 0px 0px"><a class="pre_title_close" href="#" onclick="closeCreateNewFolderWindow();return false;"><img src="/image/close_2.gif" style="vertical-align:middle"/></a></div><div class="clear_div"></div>';
_html += '</div>';
_html += '<div id="create_folder_list" style="text-align:left;padding-left:30px"><select id="create_folder_select"><option pid="-1" cid="1" value="0" path="0">我的文件夹</option>';
var folders = _document.getElementsByTagName('folder');
if(folders && folders.length>0){
for(var i=0;i<folders.length;i++){
var tempFolder = folders[i];
var tempId = getElementValueByTagName(tempFolder,'id');
var tempName = getElementValueByTagName(tempFolder,'name');
_html += '<option value="'+tempId+'" pid="0" cid="0" status="close">'+tempName+'</option>';
}
}
_html += '</select></div>';
_window.innerHTML = _html;
var createNewFolderProps = {id:'user_create_folder',selector:ge('create_folder_select'),height:285,ctop:10,cleft:10,bottonNew:true,buttonSelect:false};
var _callback = {closeFolder:closeCreateNewFolderWindow,createClose:closeCreateNewFolderWindow};
createNewFolderProps.callback=_callback;
createNewFolder = new folder(createNewFolderProps);
createNewFolder._showFolderTree();
createNewFolder._createFolder();
}
function movePhotoSet(type,ids,dotype){
if(type=='photo'){
ids = getSelectedIds();
if(dotype=='cut'){
if(_newusertype=='1'){
_util.window.cfm('转移图片确认','您确定要转移吗?',doMovePhotoSet);
}else{
_util.window.cfm('转移图片确认','转移图片后,这些图片的外链就会失效!<br/><br/>您确定要转移吗?',doMovePhotoSet);
}
ge('pub_cfm_butt').onclick=function(){doMovePhotoSet(type,ids,dotype);};
}else{
doMovePhotoSet(type,ids,dotype);
}
if(ids==null || ids==''){
alert('请先选择图片后再点击转移!');
return;
}
}else{
if(_newusertype=='1'){
_util.window.cfm('转移文件夹确认','您确定要转移吗?',doMovePhotoSet).cfm.style.height=220;
}else{
_util.window.cfm('转移文件夹确认','转移文件夹之后,文件夹中的图片和其他文件夹将一起被转移,这些图片的外链就会失效!<br/><br/>您确定要转移吗?',doMovePhotoSet).cfm.style.height=220;
}
ge('pub_cfm_butt').onclick=function(){doMovePhotoSet(type,ids,dotype);};
}
}
function doMovePhotoSet(type,ids,dotype){
var xmlhttp = createXmlHttp();
if(xmlhttp){
_util.window.cfmc();
showManagePhotoWaiting('正在查询文件夹,请稍等……');
showManagePhotoBack();
xmlhttp.open('post', '/folder?op=getsubfolder&pid=0',true);
xmlhttp.setRequestHeader("Content-Type","utf-8");
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4) {
closeManagePhotoWindows();
var returnDocument = xmlhttp.responseXML;
if(getXmlhttpError(returnDocument)=='false'){
writeMoveWindow(returnDocument,type,ids,dotype);
}else{
alert(getXmlhttpError(returnDocument));
}
}
};
xmlhttp.send(null);
}
}
function writeMoveWindow(returnDocument,type,ids,dotype){
var managePhotoWindow = showManagePhotoWindow();
var strHTML = '';
strHTML += '<div>';
strHTML += '<div class="left" style="margin:15px 0px 0px 15px"></div>';
strHTML += '<div class="right" style="margin:5px 5px 0px 0px"><a class="pre_title_close" href="#" onclick="closePhotoUrl();return false;"><img src="/image/close_2.gif" style="vertical-align:middle"/></a></div><div class="clear_div"></div>';
strHTML += '</div>';
if(type=='photo' && dotype=='copy'){
strHTML += '<div class="left" style="text-align:right;width:90px;padding:5px 0 0 0">复制图片到:</div><div class="right" style="width:410px">';
}
if(dotype=='cut'){
strHTML += '<div style="text-align:left;padding-left:40px"><div id="move_folder_list"><select id="move_folder_select"><option pid="-1" cid="1" value="0" path="0">我的文件夹</option>';
}else{
strHTML += '<div style="text-align:left;"><div id="move_folder_list"><select id="move_folder_select"><option pid="-1" cid="1" value="0" path="0">我的文件夹</option>';
}
var folders = returnDocument.getElementsByTagName('folder');
if(folders && folders.length>0){
for(var i=0;i<folders.length;i++){
var tempFolder = folders[i];
var tempId = getElementValueByTagName(tempFolder,'id');
var tempName = getElementValueByTagName(tempFolder,'name');
strHTML += '<option value="'+tempId+'" pid="0" cid="0" status="close">'+tempName+'</option>';
}
}
strHTML += '</select></div></div>';
if(type=='photo' && dotype=='copy'){
strHTML += '</div><div class="clear_div"> </div>';
}
strHTML += '</div>';
if(type=='photo' && dotype=='copy'){
strHTML += '<div style="padding:20px 0 0 0">';
strHTML += '<div class="left" style="text-align:right;width:90px">图片尺寸:</div>';
strHTML += '<div class="right" style="text-align:left;width:410px">';
strHTML += '<div><input type="radio" name="photo_resize" checked="checked" onclick="showPhotoResizeCover();" id="photo_resize_no"/><label for="photo_resize_no">保留原图</label><span style="padding:0 10px"> </span><input type="radio" name="photo_resize" id="photo_resize_yes" onclick="closePhotoResizeCover();"/><label for="photo_resize_yes">自定义图片大小</label></div>';
strHTML += '<div id="resize_photo_con" style="padding:10px;margin:10px 0 0 0;width:330px">';
strHTML += '<div style="margin:0 0 10px 0">指定图片的宽度或高度,按比例缩小图片。</div>';
strHTML += '<div><input type="radio" name="resize_photo_type" value="1" id="resize_photo_type_1" onclick="setResizeValu(this);"/><label for="resize_photo_type_1">分类图片(宽度152像素)</label></div>';
strHTML += '<div style="margin:8px 0"><input type="radio" name="resize_photo_type" value="2" id="resize_photo_type_2" onclick="setResizeValu(this);"/><label for="resize_photo_type_2">左侧自定义模块(宽度190像素)</label></div>';
strHTML += '<div><input type="radio" name="resize_photo_type" value="3" id="resize_photo_type_3" onclick="setResizeValu(this);"/><label for="resize_photo_type_3">宝贝图片(500*500像素,图片小于120K)</label></div>';
strHTML += '<div style="margin:8px 0"><input type="radio" name="resize_photo_type" value="4" id="resize_photo_type_4" onclick="setResizeValu(this);"/><label for="resize_photo_type_4">促销区小图(宽度245像素,一行可放3张图片)</label></div>';
strHTML += '<div><input type="radio" name="resize_photo_type" value="5" id="resize_photo_type_5" onclick="setResizeValu(this);"/><label for="resize_photo_type_5">宝贝描述图片(宽度740像素)</label></div>';
strHTML += '<div style="margin:8px 0"><input type="radio" name="resize_photo_type" value="6" id="resize_photo_type_6" onclick="setResizeValu(this);"/><label for="resize_photo_type_6">自定义(限定图片的最大宽度或高度,按比例缩小。)</label></div>';
strHTML += '<div><span style="padding:0 25px">宽度<input type="text" style="width:40px" id="resize_custom_width" disabled="disabled" value="-1"/>像素<span style="padding:0 10px"> </span>高度<input type="text" id="resize_custom_height" style="width:40px" disabled="disabled" value="-1"/>像素</span><br/><span class="font_light_gray" style="padding:0 25px">设置为-1表示不限制。</span></div>';
strHTML += '</div>';
strHTML += '</div><div class="clear_div"> </div>';
strHTML += '</div>';
}
if(type=='photo' && dotype=='copy'){
strHTML += '<div style="padding:30px 0px 0px 282px">';
}else{
strHTML += '<div style="padding:350px 0px 0px 282px">';
}
strHTML += '<div class="button_bg button_blue_2_1"></div><div class="button_bg button_blue_2_2" style="width:50px;" onclick="doMove(\''+type+'\',\''+ids+'\',\''+dotype+'\');"><div style="padding-top:1px;background-color:transparent;font-size:12px;font-weight:normal">确定</div></div><div class="button_bg button_blue_2_3" style="margin-right:20px"></div>';
strHTML += '<div class="button_bg button_gray_3_1"></div><div class="button_bg button_gray_3_2" style="width:50px;" onclick="closePhotoUrl();"><div style="color:#000000;font-size:12px;background-color:transparent">取消</div></div><div class="button_bg button_gray_3_3"></div><div class="clear_div"></div>';
strHTML += '</div>';
managePhotoWindow.innerHTML = strHTML;
managePhotoWindow.style.display='';
managePhotoWindow.style.width=510;
managePhotoWindow.style.height=470;
var tempPos = getAbsoluteLocation(ge('item_container'));
var tempTop = tempPos.absoluteTop;
if(tempTop<document.body.scrollTop){
tempTop = document.body.scrollTop;
}
managePhotoWindow.style.top = tempTop+10;
managePhotoWindow.style.left = tempPos.absoluteLeft+tempPos.offsetWidth/2 - 270;
var moveFolderProps = {id:'move_folder',selector:ge('move_folder_select'),width:390,height:295,ctop:10,cleft:10,bottonNew:true,buttonSelect:false,buttonCancel:false};
if(type=='photo' && dotype=='copy'){
moveFolderProps.buttonSelect=true;
moveFolderProps.selectFolderClose=true;
}
moveFolder = new folder(moveFolderProps);
if(type=='photo'){
if(dotype=='copy'){
}else{
moveFolder._showFolderTree();
}
}else{
moveFolder._showFolderTree();
}
showManagePhotoBack();
try{
showPhotoResizeCover();
}catch(e){}
}
function closePhotoResizeCover(){
var _cover = ge('photo_resize_cover');
if(_cover)_cover.style.display='none';
}
function showPhotoResizeCover(){
var _cover = ge('photo_resize_cover');
if(!_cover){
_cover =ce('div');
_cover.id='photo_resize_cover';
_cover.style.cssText='z-index:102;top:0px;left:0px;position:absolute;background-color:#ffffff;filter:alpha(opacity=50);moz-opacity: 0.5;opacity:.5';
document.body.appendChild(_cover);
}
var _pos = getAbsoluteLocation(ge('resize_photo_con'));
_cover.style.width = _pos.offsetWidth;
_cover.style.height = _pos.offsetHeight;
_cover.style.left = _pos.absoluteLeft;
_cover.style.top = _pos.absoluteTop;
_cover.style.display='';
}
function doMove(type,ids,dotype){
var xmlhttp = createXmlHttp();
if(xmlhttp){
showPageBackPublic(ge('item_container'),500);
var _title = '正在转移,请稍等……';
var _url = '/photo?op=move&type='+type+'&dotype='+dotype+'&ids='+ids+'&to='+moveFolder.f_current.getAttribute('fid');
if(type=='photo' && dotype=='copy'){
_url += getResizeVars();
_title = '正在复制,请稍等……';
}
showPageWaitingPublic(_title);
xmlhttp.open('post', _url,true);
xmlhttp.setRequestHeader("Content-Type","utf-8");
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4) {
var returnDocument = xmlhttp.responseXML;
if(getXmlhttpError(returnDocument)=='false'){
refresh();
}else{
closePageWaitingPublic();
closePageBackPublic();
// closeManagePhotoWaiting();
alert(getXmlhttpError(returnDocument));
}
}
};
xmlhttp.send(null);
}
}
function closePhotoUrl(){
var managePhotoWindow = ge('manage_photo_window');
if(managePhotoWindow)managePhotoWindow.style.display='none';
closeManagePhotoBack();
if(moveFolder){
moveFolder._distroy();
}
closePhotoResizeCover();
}
function changePhotoUrlSize(type){
if(type=='o'){
ge('photo_url_title_m').style.display='none';
ge('photo_url_con_m').style.display='none';
ge('photo_url_title_o').style.display='';
ge('photo_url_con_o').style.display='';
}else{
ge('photo_url_title_o').style.display='none';
ge('photo_url_con_o').style.display='none';
ge('photo_url_title_m').style.display='';
ge('photo_url_con_m').style.display='';
}
}
function copyPhotoUrl(){
if(ge('photo_url_title_m').style.display!='none'){
if(ge('photo_url_m').checked){
copy_code(ge('colde_photo_url_m').value,'图片地址复制成功。您可以通过ctrl+v将地址粘贴到输入框中。');
}else if(ge('photo_html_m').checked){
copy_code(ge('colde_photo_html_m').value,'图片代码复制成功。您可以通过ctrl+v将代码粘贴到输入框中。');
}else{
alert('请选择您是要复制图片地址还是图片代码!');
return;
}
}else{
if(ge('photo_url_o').checked){
copy_code(ge('colde_photo_url_o').value,'图片地址复制成功。您可以通过ctrl+v将地址粘贴到输入框中。');
}else if(ge('photo_html_o').checked){
copy_code(ge('colde_photo_html_o').value,'图片代码复制成功。您可以通过ctrl+v将代码粘贴到输入框中。');
}else{
alert('请选择您是要复制图片地址还是图片代码!');
return;
}
}
}
function closeViewPhoto(){
var viwePhotoWindow = ge('viwe_photo_window');
if(viwePhotoWindow)viwePhotoWindow.style.display='none';
closeManagePhotoBackF();
}
function viewPhoto(name,url){
var previePhoto = new Image();
previePhoto.src = url;
if (previePhoto.complete) {
showManagePhotoBackF();
}
previePhoto.onload = function () {
showManagePhotoBackF();
};
var viwePhotoWindow = ge('viwe_photo_window');
if(!viwePhotoWindow){
viwePhotoWindow = document.createElement('div');
viwePhotoWindow.id='viwe_photo_window';
viwePhotoWindow.style.cssText='position:absolute;z-index:101;width:974px;text-align:center;padding:20px 0;top:10px;left:10px;';
document.body.appendChild(viwePhotoWindow);
}
viwePhotoWindow.style.left=document.body.scrollWidth/2-487;
var strHTML = '';
strHTML += '<div style="width:944px;margin:0 auto"><div class="bg_img main_sub_title1"><div class="left">浏览</div><div class="right" style="padding-right:10px"><a class="pre_title_close" href="#" onclick="closeViewPhoto();return false;"><img src="/image/close_2.gif" style="vertical-align:middle"/></a></div><div class="clear_div" style="height:1px"></div></div>';
strHTML += '<div style="background-color:#F7F7F7;text-align:center;padding:20px 0px 20px 0px">'+name+'<br/><img src="'+url+'"/></div>';
strHTML += '<div style="background-color:#E7E7E7;padding:10px 0px 10px 450px;border:-bottom:1px solid ##999999"><div class="button_bg button_gray_2_1"></div><div class="button_bg button_gray_2_2" onclick="closeViewPhoto();"><div>关闭</div></div><div class="button_bg button_gray_2_3"></div><div class="clear_div"></div></div></div>';
viwePhotoWindow.innerHTML = strHTML;
showManagePhotoBackF();
viwePhotoWindow.style.display='';
}
function checkRightClick(event){
event = event || window.event;
if(event && event.button==2){
alert('请在“按文件夹浏览”页面点击小图下方的“地址”链接获取图片地址。');
}
}
function closeThisPhotoUrl(event){
event = event || window.event;
var toElement = event.toElement || event.relatedTarget;
if(toElement && toElement.id!='photo_url_window' && toElement.getAttribute('name')!='photo_url_window'){
var photoUrlWindow = ge('photo_url_window');
if(photoUrlWindow)photoUrlWindow.style.display='none';
}
}
function showThisPhotoUrl(el,tempUrl){
var photoUrlWindow = ge('photo_url_window');
if(!photoUrlWindow){
photoUrlWindow = document.createElement('div');
photoUrlWindow.id='photo_url_window';
photoUrlWindow.className='photo_url_window';
photoUrlWindow.style.cssText='width:185px;height:95px;position:absolute;z-index:100;top:0px;left:0px;background-image:url(/image/url_bg.gif)';
document.body.appendChild(photoUrlWindow);
}
photoUrlWindow.onmouseout=closeThisPhotoUrl;
var tempPos = getAbsoluteLocation(el);
photoUrlWindow.style.top=tempPos.absoluteTop+19;
photoUrlWindow.style.left=tempPos.absoluteLeft-90;
var strHTML = '';
strHTML += '<div name="photo_url_window" style="margin:25px 0px 0px 10px">';
strHTML += '<div name="photo_url_window">标准:<input type="text" name="photo_url_window" onfocus="this.select();" value="'+formatPhotoUrl(tempUrl,'_m')+'"/><input type="button" name="photo_url_window" class="buttonGraySmall" value="复制" onclick="copyThisPhotoUrl(\''+formatPhotoUrl(tempUrl,'_m')+'\');" style="width:40px;margin-left:4px"/></div>';
strHTML += '<div name="photo_url_window">原图:<input type="text" name="photo_url_window" onfocus="this.select();" value="'+tempUrl+'"/><input type="button" name="photo_url_window" class="buttonGraySmall" value="复制" onclick="copyThisPhotoUrl(\''+tempUrl+'\');" style="width:40px;margin-left:4px"/></div>';
strHTML += '</div>';
photoUrlWindow.innerHTML = strHTML;
photoUrlWindow.style.display='';
}
function copyReturn(){
var _tips = ge('copy_tips');
if(!_tips){
_tips = ce('div');
_tips.id = 'copy_tips';
_tips.style.cssText='position:absolute;z-index:300;top:0px;left:0px;width:200;padding:10px 0;background-color:#FEF7B0;border:1px solid #FCD163';
_tips.innerHTML = '图片地址复制成功!';
document.body.appendChild(_tips);
}
_tips.style.display='';
var _pos = getAbsoluteLocation(ge('photo_url_window'));
_tips.style.left = _pos.absoluteLeft;
_tips.style.top = _pos.absoluteTop-40;
setTimeout(function(){ge('copy_tips').style.display='none';},1000);
}
function copyThisPhotoUrl(tempUrl){
copy_code(tempUrl,'图片地址复制成功!',copyReturn);
}
function showFolder(id){
photoPageProps.id=id;
photoPageProps.page=1;
reloadPhoto('open');
}
function getPhotoUrl(){
var _ids = getSelectedIds();
if(!_ids || _ids==''){
alert('请先选择图片,然后再点击获取地址!');
return;
}
var selectedPhoto=_ids.split(';');
var strPhotoUrlM='',strPhotoHTMLM='',strPhotoUrlO='',strPhotoHTMLO='';
var managePhotoWindow = showManagePhotoWindow();
var strHTML = '';
strHTML+='<div style="text-align:left;padding:0 0 0 10px">';
strHTML+='<div class="left" style="padding:10px 0 0 0"><div class="font_title_s">拖动图片排序,点击右边的按钮复制图片或者代码。</div></div><div class="right" style="padding:5px"><a class="pre_title_close" href="#" onclick="closePhotoUrl();return false;"><img src="/image/close_2.gif" style="vertical-align:middle"/></a></div><div class="clear_div"> </div>';
strHTML+='<div id="move_urlphoto_container" class="left" style="width:450px">';
for(var i=0;i<selectedPhoto.length;i++){
var tempSelectPhoto = ge('img_checkbox_'+selectedPhoto[i]);
if(!tempSelectPhoto)continue;
var tempUrl = tempSelectPhoto.getAttribute('url');
var tempName = tempSelectPhoto.getAttribute('title');
var tempUrlS = tempSelectPhoto.getAttribute('urls');
strHTML += '<div style="float:left;width:90px;height:90px;cursor:move;" index="'+(i+1)+'" name="movephoto" class="movephoto" onmousedown="startPhotoUrlMove(event,this,\''+tempUrlS+'\','+(i+1)+');return false;"><img width="75" height="75" name="movephoto_c" class="float_thumb" src="'+tempUrlS+'" osrc="'+tempUrl+'"/><div class="float_index_white" name="movephoto_c">'+(i+1)+'</div><div class="float_index_black" name="movephoto_c">'+(i+1)+'</div></div>';
}
strHTML+='<div class="clear_div"> </div>';
strHTML+='</div>';
strHTML+='<div class="right" style="text-align:left;padding:0 0 0 20px;width:185px;height:345px;overflow:hidden;border-left:1px solid #DDDDDD">';
strHTML+='<div class="font_title_s">相邻的两张图片之间</div><div style="margin-bottom:20px"><input id="img-line-0" type="radio" name="copy-img-line"/><label for="img-line-0">无间隔</label><input id="img-line-1" name="copy-img-line" checked="checked" type="radio" style="margin-left:10px"/><label for="img-line-1">一行间隔</label></div>';
if(bIE){
strHTML+='<div class="font_title_s">复制图片?</div><div>可以直接粘贴到宝贝描述。<br/><span class="font_orange">友情提示:如出现提示框,请选择“允许”访问剪贴板</span></div><div style="padding:10px 0 0 0"><div class="button_bg button_blue_2_1"></div><div class="button_bg button_blue_2_2" style="width:100px" onclick="copyMovephoto(\'_m\');"><div>复制标准尺寸</div></div><div class="button_bg button_blue_2_3"></div><div class="clear_div"> </div></div><div style="padding-bottom:20px"><div class="button_bg button_blue_2_1"></div><div class="button_bg button_blue_2_2" style="width:80px" onclick="copyMovephoto(\'\');"><div>复制原图</div></div><div class="button_bg button_blue_2_3"></div><div class="clear_div"> </div></div>';
}
strHTML+='<div class="font_title_s">复制代码?</div><div>用于宝贝描述的“编辑源文件”中。</div><div style="padding:10px 0 0 0"><div class="button_bg button_blue_2_1"></div><div class="button_bg button_blue_2_2" style="width:100px" onclick="copyMovephotoUrl(\'_m\');"><div>复制标准尺寸</div></div><div class="button_bg button_blue_2_3"></div><div class="clear_div"> </div></div><div><div class="button_bg button_blue_2_1"></div><div class="button_bg button_blue_2_2" style="width:80px" onclick="copyMovephotoUrl(\'\');"><div>复制原图</div></div><div class="button_bg button_blue_2_3"></div><div class="clear_div"> </div></div>';
strHTML+='</div><div class="clear_div"> </div>';
strHTML+='</div>';
managePhotoWindow.innerHTML = strHTML;
managePhotoWindow.style.display='';
managePhotoWindow.style.width=680;
managePhotoWindow.style.height=430;
var tempPos = getAbsoluteLocation(ge('item_container'));
var tempTop = tempPos.absoluteTop;
if(tempTop<document.body.scrollTop){
tempTop = document.body.scrollTop;
}
managePhotoWindow.style.top = tempTop+10;
managePhotoWindow.style.left = tempPos.absoluteLeft+tempPos.offsetWidth/2 - 340;
showManagePhotoBack();
document.body.appendChild(photoUrlMover);
writeMovePhotoPos();
}
var movePhotoPosList,movePhotoContainer;
function writeMovePhotoPos(){
var _list = ge('move_urlphoto_container').childNodes;
movePhotoPosList = new Array();
for(var i=0;i<_list.length;i++){
if(_list[i].className=='movephoto'){
var _pos = getAbsoluteLocation(_list[i]);
var _index = _list[i].getAttribute('index');
movePhotoPosList.push({index:_index,x:_pos.absoluteLeft,y:_pos.absoluteTop,w:_pos.offsetWidth,h:_pos.offsetHeight,photo:_list[i]});
}
}
}
function startPhotoUrlMove(event,_move,_url,_index){
event = event || window.event;
var objTarget = event.target || event.srcElement;
if(!objTarget.name || (objTarget.name!='movephoto' && objTarget.name!='movephoto_c')){
return true;
}
if(objTarget.name=='movephoto_c'){
_move = objTarget.parentNode;
}else{
_move = objTarget;
}
_index = _move.getAttribute('index');
_url = _move.getElementsByTagName('img')[0].src;
bMove=true;
photoUrlMover.style.cssText='width:90px;height:90px;text-align:center;background-color:transparent;cursor:move;position:absolute;top:10px;left:10px;z-index:110;text-align:left';
photoUrlMover.innerHTML = getPhotoMoverContent(_move,_url,_index);
photoUrlMover.setAttribute('index',_index);
var _pos = getAbsoluteLocation(_move);
photoUrlMover.style.top=_pos.absoluteTop+10;
photoUrlMover.style.left=_pos.absoluteLeft+10;
photoUrlMover.style.display='block';
setMoveOpa(_move,40);
_mp.x=event.clientX-_pos.absoluteLeft-10;
_mp.y=event.clientY-_pos.absoluteTop-10;
photoUrlMovered=_move;
}
function getCopyMovephotoUrl(_url,_type){
var _pos = _url.lastIndexOf('_s.');
return _url.substring(0,_pos)+_type+_url.substring(_pos+2);
}
function getCopyMovephotoUrlOri(_url,_type){
var _pos = _url.lastIndexOf('.');
return _url.substring(0,_pos)+_type+_url.substring(_pos);
}
var _copy_movePhoto_nodelist,_temp_photo_container,_copy_movephoto_type,_copy_movephoto_ctrl,_copy_movephoto_i=0;
function copyMovephoto(_type){
var _addline=true;
if(document.getElementById('img-line-0').checked){
_addline=false;
}
_copy_movePhoto_nodelist = ge('move_urlphoto_container').getElementsByTagName('img');
_copy_movephoto_i=0;
_copy_movephoto_ctrl=document.body.createControlRange();
if(!_temp_photo_container){_temp_photo_container=ce('div');document.body.appendChild(_temp_photo_container);_temp_photo_container.style.display='none';}
_copy_movephoto_type=_type;
// showPageBackPublic(document.body,110,'copy_movephoto_bg');
var _copy_movephoto_pro=ge('_copy_movephoto_pro');
if(!_copy_movephoto_pro){_copy_movephoto_pro=ce('div');_copy_movephoto_pro.id='_copy_movephoto_pro';_copy_movephoto_pro.style.cssText='position:absolute;z-index:111;border:10px solid #777777;width:400px;height:80px;padding-top:10px';document.body.appendChild(_copy_movephoto_pro);}
var tempPos = getAbsoluteLocation(ge('item_container'));
var tempTop = tempPos.absoluteTop;
if(tempTop<document.body.scrollTop){
tempTop = document.body.scrollTop;
}
// _copy_movephoto_pro.style.top = tempTop+30;
// _copy_movephoto_pro.style.left = tempPos.absoluteLeft+tempPos.offsetWidth/2 - 200;
// _copy_movephoto_pro.innerHTML='<div>您选择了'+_copy_movePhoto_nodelist.length+'张图片,正在复制第<span id="cur_copy_photos">1</span>张。</div><div style="width:240px;height:18px;overflow:hidden"><div id="movephoto_copyed" class="progress_bg_done_green" style="width:1px;height:18px"></div><div id="movephoto_left" class="progress_bg_remaining_gray" style="width:239px;height:18px"></div><div class="clear_div"> </div></div>';
// _copy_movephoto_pro.style.display='block';
var _imghtml='';
for(var i=0;i<_copy_movePhoto_nodelist.length;i++){
var _url = _copy_movePhoto_nodelist[i].src;
_url = getCopyMovephotoUrl(_url,_copy_movephoto_type);
if(_addline){
_imghtml += '<img src="'+_url+'"/><br/><br/>';
}else{
_imghtml += '<img src="'+_url+'"/><br/>';
}
// var _tempimg=ce('div');
// if(_addline){
// _tempimg.innerHTML='<img src="'+_url+'"/><br/><br/>';
// }else{
// _tempimg.innerHTML='<img src="'+_url+'"/><br/>';
// }
// _tempimg.style.textAlign='center';
// _temp_photo_container.appendChild(_tempimg);
// _tempimg.contentEditable='true';
// _copy_movephoto_ctrl.addElement(_tempimg);
}
_temp_photo_container.innerHTML=_imghtml;
_temp_photo_container.style.cssText='text-align:center';
_temp_photo_container.contentEditable='true';
_copy_movephoto_ctrl.addElement(_temp_photo_container);
doCopyMovephotoObject();
alert('复制成功。');
// doCopyMovephoto();
}
function doCopyMovephotoObject(){
_copy_movephoto_ctrl.execCommand('Copy',null);
var _copy_movephoto_pro=ge('_copy_movephoto_pro');
if(_copy_movephoto_pro){
_copy_movephoto_pro.innerHTML='<div style="padding-top:15px;color:#FE6600;font-weight:bold">图片复制成功,您可以直接粘贴到淘宝的宝贝描述中!</div>';
setTimeout(function(){ge('_copy_movephoto_pro').style.display='none';closePageBackPublic('copy_movephoto_bg');},1000);
}
_temp_photo_container.innerHTML='';
}
function doCopyMovephoto(){
if(_copy_movephoto_i>=_copy_movePhoto_nodelist.length){
doCopyMovephotoObject();
return;
}
setCopyMovephotoPro();
var _img = new Image();
var _url = _copy_movePhoto_nodelist[_copy_movephoto_i].src;
_url = getCopyMovephotoUrl(_url,_copy_movephoto_type)
_img.src=_url;
if(_img.complete){
var _tempimg=ce('div');_tempimg.innerHTML='<img src="'+_url+'"/><br/>';
_temp_photo_container.appendChild(_tempimg);
_tempimg.contentEditable='true';
_copy_movephoto_ctrl.addElement(_tempimg);
_copy_movephoto_i++;
doCopyMovephoto();
}else{
_img.onload=function(){
var _tempimg=ce('div');_tempimg.innerHTML='<img src="'+this.src+'"/><br/>';
_temp_photo_container.appendChild(_tempimg);
_tempimg.contentEditable='true';
_copy_movephoto_ctrl.addElement(_tempimg);
_copy_movephoto_i++;
doCopyMovephoto();
};
}
}
function setCopyMovephotoPro(){
var _w = 240*(_copy_movephoto_i+1)/_copy_movePhoto_nodelist.length;
ge('movephoto_copyed').style.width=_w;
ge('movephoto_left').style.width=(240-_w);
ge('cur_copy_photos').innerHTML=_copy_movephoto_i+1;
}
function copyMovephotoUrl(_type){
var _addline=true;
if(document.getElementById('img-line-0').checked){
_addline=false;
}
var _imgs = ge('move_urlphoto_container').getElementsByTagName('img');
var _html = '';
for(var i=0;i<_imgs.length;i++){
var _url = _imgs[i].getAttribute('osrc');
if(_addline){
_html+="<img src='"+getCopyMovephotoUrlOri(_url,_type)+"'/><br/><br/>";
}else{
_html+="<img src='"+getCopyMovephotoUrlOri(_url,_type)+"'/><br/>";
}
}
// copyit(_html);
// alert('复制成功!');
copy_code(_html,'复制成功。');
}
function stopmovephoto(){
if(bMove){
bMove=false;
setMoveOpa(photoUrlMovered,100);
photoUrlMover.style.display='none';
}
}
function movephoto(event){
if(!bMove){
return true;
}
event = event || window.event;
var _x = event.clientX-_mp.x;
var _y = event.clientY-_mp.y;
photoUrlMover.style.left=_x;
photoUrlMover.style.top=_y;
var _target = movePhotoGetPhotoByPos(_x,_y);
if(!_target || _target.getAttribute('index')==photoUrlMover.getAttribute('index')){
return false;
}
var targetIndex = parseInt(_target.getAttribute('index'))-1;
resortPhotoMove(_target);
movephotoChangeIndex(_target,targetIndex);
return false;
}
function movephotoChangeIndex(_target,targetIndex){
var oldIndex = parseInt(photoUrlMover.getAttribute('index'))-1;
setMovephotoIndex(photoUrlMover,targetIndex);
if(targetIndex>oldIndex){//move after
var _temp = movePhotoPosList[oldIndex].photo;
for(var i=oldIndex;i<targetIndex;i++){
movePhotoPosList[i].photo = movePhotoPosList[i+1].photo;
setMovephotoIndex(movePhotoPosList[i].photo,i);
}
movePhotoPosList[targetIndex].photo=_temp;
setMovephotoIndex(movePhotoPosList[targetIndex].photo,targetIndex);
}else{
var _temp = movePhotoPosList[oldIndex].photo;
for(var i=oldIndex;i>targetIndex;i--){
movePhotoPosList[i].photo = movePhotoPosList[i-1].photo;
setMovephotoIndex(movePhotoPosList[i].photo,i);
}
movePhotoPosList[targetIndex].photo=_temp;
setMovephotoIndex(movePhotoPosList[targetIndex].photo,targetIndex);
}
}
function resortPhotoMove(_target){//向后插入
var _next = _target;
var _parent = _target.parentNode;
var oldIndex = parseInt(photoUrlMover.getAttribute('index'));
var targetIndex = parseInt(_target.getAttribute('index'));
if(targetIndex>oldIndex){//insert after
_next = _target.nextSibling;
}
if(_next){
_parent.insertBefore(photoUrlMovered,_next);
}else{
_parent.appendChild(photoUrlMovered);
}
}
function setMovephotoIndex(_movephoto,_index){
var _tempIndex = parseInt(_index)+1;
_movephoto.setAttribute('index',_tempIndex);
var _temp = _movephoto.getElementsByTagName('div');
for(var i=0;i<_temp.length;i++){
var _class = _temp[i].className;
if(_class=='float_index_black' || _class=='float_index_white'){
_temp[i].innerHTML = _tempIndex;
}
}
}
function movePhotoGetPhotoByPos(_x,_y){
for(var i=0;i<movePhotoPosList.length;i++){
var _pos = movePhotoPosList[i];
var _leftMin = _pos.x+5;
var _leftMax = _pos.x+30;
var _topMin = _pos.y-5;
var _topMax = _pos.y+30;
if(_x>_leftMin && _x<_leftMax && _y>_topMin && _y<_topMax){
return _pos.photo;
}
}
return null;
}
function getPhotoMoverContent(_move,_url,_index){
var _html = '<div style="position:absolute;z-index:111;text-align:left"><img width="75" height="75" src="'+_url+'"/></div><div class="float_index_black" style="z-index:113">'+_index+'</div><div class="float_index_white" style="z-index:112">'+_index+'</div>';
return _html;
}
function setMoveOpa(_move,_opa){
var _opa_m = _opa/100;
_move.style.filter = 'alpha(opacity='+_opa+')';
_move.style.opacity = _opa_m;
var _childs = _move.childNodes;
for(var i=0;i<_childs.length;i++){
_childs[i].style.filter = 'alpha(opacity='+_opa+')';
_childs[i].style.opacity = _opa_m;
}
}
function refresh(){
window.location.reload();
// if(photoPageProps.type=='recent'){
// location.href='/photo?type=recent&p='+photoPageProps.page;
// }else{
// var pathId = getPathId();
// location.href='/photo?pathid='+pathId+'&p='+photoPageProps.page;
// }
}
function getPathId(){
return ge('cur_path').value;
}
function changeViewType(type){
location.href='/photo?type='+type;
}
function goPhotoPage(type,page,sort){
photoPageProps.page=page;
photoPageProps.type=type;
photoPageProps.sort =sort;
reloadPhoto();
}
function changePhotoSort(_sorturl,tempSort){
location.href=_sorturl+tempSort;
}
function reloadPhoto(type){
var objReloadXmlHttp = createXmlHttp();
if(objReloadXmlHttp){
showManagePhotoWaiting('正在重新载入图片,请稍等……');
showManagePhotoBack();
if(photoPageProps.type=='recent'){
objReloadXmlHttp.open('post', '/photo?op=getphotorecent&id='+photoPageProps.id+'&p='+photoPageProps.page,true);
}else{
var _id = photoPageProps.s;
if(_id!='0'){
var _ids = _id.split('/');
_id = _ids[_ids.length-1];
}
objReloadXmlHttp.open('post', '/photo?op=show&id='+_id+'&p='+photoPageProps.page+'&sort='+photoPageProps.sort,true);
}
objReloadXmlHttp.setRequestHeader("Content-Type","utf-8");
objReloadXmlHttp.onreadystatechange=function(){
if (objReloadXmlHttp.readyState==4) {
closeManagePhotoWindows();
var returnDocument = objReloadXmlHttp.responseXML;
if(getXmlhttpError(returnDocument)=='false'){
if(type=='open'){
viewSelectFolder.f_selected=currentFolder=document.getElementById(viewSelectFolder.id+'_folder_item_'+photoPageProps.id);
}
writePhotos(returnDocument,type);
if(type=='open'){
viewSelectFolder._insertNewFolderSet();
}
if(viewSelectFolder){
currentFolder = viewSelectFolder.f_selected;
}
ge('photo_select_all').checked=false;
}else{
alert(getXmlhttpError(returnDocument));
}
}
};
objReloadXmlHttp.send(null);
}
}
function writeNoPhoto(){
ge('photo_container').innerHTML = '<div style="margin:20px">非常抱歉,您还没有上传图片或创建创建文件夹,到此文件夹下。</div>';
if(ge('page_container'))page_container.innerHTML = '';
var topPage = ge('toppage');
if(topPage)topPage.innerHTML = '';
var bottomPage = ge('page');
if(bottomPage)bottomPage.innerHTML = '';
}
function writePhotos(returnDocument,type){
if(!returnDocument || returnDocument==null){
writeNoPhoto();
return;
}
var items = returnDocument.getElementsByTagName('item');
if(!items || items.length==0){
writeNoPhoto();
return;
}
var strHTML = '';
strHTML += '<div style="padding:10px 0px 10px 15px;text-align:left">';
for(var i=0;i<items.length;i++){
var tempItem = items[i];
strHTML += '<div class="photo_item_con">';
var strType = getElementValueByTagName(tempItem,'itemType');
var tempId = getElementValueByTagName(tempItem,'id');
var tempName = getElementValueByTagName(tempItem,'name');
if(strType=='set'){
var setcount = getElementValueByTagName(tempItem,'setcount');
var photocount = getElementValueByTagName(tempItem,'photocount');
strHTML += '<div class="set_img_con photo_border"><div><a href="/photo?s='+ge('cur_path').value+'/'+tempId+'"><img src="/image/folder/folder.gif"/></a></div><div class="font_light_gray">'+setcount+'文件夹|'+photocount+'文件</div></div>';
strHTML += '<div id="name_'+tempId+'" class="photo_item_name" title="单击即可修改" onmouseout="this.style.backgroundColor=\'#ffffff\';" onmouseover="this.style.backgroundColor=\'#FAF4C6\';" onclick="showEditName(\''+tempId+'\',\'folder\');">'+tempName+'</div>';
strHTML += '<div style="text-align:left;padding-left:5px;display:none" id="edit_name_'+tempId+'"><input type="text" class="text" id="edit_name_input_'+tempId+'" maxlength="25" style="width:110px"/><input type="button" class="button_mini" value="确定" onclick="saveEditName(\''+tempId+'\',\'folder\');"/><input type="button" class="button_gray_mini1" value="取消" onclick="closeEditName(\''+tempId+'\');"/></div>';
strHTML += '<div style="display:none" id="edit_name_waiting_'+tempId+'"><img width="24" src="/image/loading.gif" style="vertical-align:middle"/>正在保存…</div>';
strHTML += '<div style="padding-bottom:5px"><a class="link_gray_button" href="/photo?s='+ge('cur_path').value+'/'+tempId+'">打开</a><span> </span><a class="link_gray_button" href="#" onclick="movePhotoSet(\'set\',\''+tempId+'\',\'cut\');">移动</a><span> </span><a class="link_gray_button" href="#" onclick="deleteSet(\''+tempId+'\');return false;">删除</a></div>';
if(type=='open'){
inserSelectNewFolder(tempId,tempName);
}
}else{
var tempUrl = getElementValueByTagName(tempItem,'url');
var tempUrls = getElementValueByTagName(tempItem,'urls');
var tempUrlm = getElementValueByTagName(tempItem,'urlm');
strHTML += '<div class="photo_center_border" style="cursor:pointer" onclick="selectThisPhoto(\''+tempId+'\');"><p><img src="'+tempUrls+'" style="cursor:pointer"/></p></div><br class="tl"/>';
strHTML += '<div id="name_'+tempId+'" class="photo_item_name" title="单击即可修改" onmouseout="this.style.backgroundColor=\'#ffffff\';" onmouseover="this.style.backgroundColor=\'#FAF4C6\';" onclick="showEditName(\''+tempId+'\',\'photo\');">'+tempName+'</div>';
strHTML += '<div style="text-align:left;padding-left:5px;display:none" id="edit_name_'+tempId+'"><input type="text" class="text" id="edit_name_input_'+tempId+'" maxlength="25" style="width:110px"/><input type="button" class="button_mini" value="确定" onclick="saveEditName(\''+tempId+'\',\'photo\');"/><input type="button" class="button_gray_mini1" value="取消" onclick="closeEditName(\''+tempId+'\');"/></div>';
strHTML += '<div style="display:none" id="edit_name_waiting_'+tempId+'"><img width="24" src="/image/loading.gif" style="vertical-align:middle"/>正在保存…</div>';
strHTML += '<div style="padding-bottom:5px"><input type="checkbox" name="item_photo_select" id="img_checkbox_'+tempId+'" value="'+tempId+'" url="'+tempUrl+'"/>';
strHTML += '<a class="link_gray_button" href="#" onclick="viewPhoto(\''+tempName+'\',\''+tempUrlm+'\');">浏览</a><span> </span><a class="link_gray_button" href="#" onclick="replacePhoto();return false;">替换</a>';
strHTML += '<span> </span><a class="link_gray_button" href="#" onmouseover="showThisPhotoUrl(this,\''+tempUrl+'\');" onmouseout="closeThisPhotoUrl(event);">地址</a></div>';
}
strHTML += '</div>';
if(i%5==4){
strHTML += '<div class="clear_div"></div>';
}
}
strHTML += '<div class="clear_div"></div>';
strHTML += '</div>';
ge('photo_container').innerHTML = strHTML;
var totalPage = getElementValueByTagName(returnDocument,'totalPage');
if(totalPage==1){
var topPage = ge('toppage');
if(topPage)topPage.innerHTML = '';
var bottomPage = ge('page');
if(bottomPage)bottomPage.innerHTML = '';
}else{
writePages(returnDocument);
}
}
function writePages(returnDocument){
var pages = returnDocument.getElementsByTagName('pageNum');
var firstPage = parseInt(pages[0].childNodes[0].data);
var lastpage = parseInt(pages[pages.length-1].childNodes[0].data);
var curPage = parseInt(getElementValueByTagName(returnDocument,'currentPage'));
var totalPage = parseInt(getElementValueByTagName(returnDocument,'totalPage'));
var strHTML = '';
if(curPage==1){
strHTML += '<span class="page_pre_gray"> </span>';
}else{
strHTML += '<span class="page_pre" onclick="goPhotoPage(\''+photoPageProps.type+'\','+(curPage-1)+',\''+photoPageProps.sort+'\');"> </span>';
}
if(firstPage>1){
strHTML += '<a href="#" onclick="goPhotoPage(\''+photoPageProps.type+'\',1,\''+photoPageProps.sort+'\');">1</a> ';
if(firstPage>2){
strHTML += ' … ';
}
}
for(var i=0;i<pages.length;i++){
var tempPage = parseInt(pages[i].childNodes[0].data);
if(tempPage==curPage){
strHTML += ' <font color="#111111"><strong>'+tempPage+'</strong></font> ';
}else{
strHTML += '<a href="#" onclick="goPhotoPage(\''+photoPageProps.type+'\','+tempPage+',\''+photoPageProps.sort+'\');">'+tempPage+'</a> ';
}
}
if(totalPage>lastpage){
if(totalPage>lastpage+1){
strHTML += ' … ';
}
strHTML += '<a href="#" onclick="goPhotoPage(\''+photoPageProps.type+'\','+totalPage+',\''+photoPageProps.sort+'\');">'+totalPage+'</a>';
}
if(curPage==lastpage){
strHTML += '<span class="page_next_gray"> </span>';
}else{
strHTML += '<span class="page_next" onclick="goPhotoPage(\''+photoPageProps.type+'\','+(curPage+1)+',\''+photoPageProps.sort+'\');"> </span>';
}
var topPage = ge('toppage');
if(!topPage){
topPage = document.createElement('div');
topPage.id='toppage';
topPage.className='page_style';
topPage.style.cssText='margin:0px;padding:5px 0px 9px 0px;text-align:right;width:520px';
ge('top_page_con').appendChild(topPage);
}
topPage.innerHTML = strHTML;
topPage.style.display='';
var bottomPage = ge('page_container');
if(!bottomPage){
bottomPage = document.createElement('div');
bottomPage.id='page_container';
bottomPage.className='bg_img main_sub_footer';
ge('item_container').appendChild(bottomPage);
}
bottomPage.innerHTML = '<div id="page">'+strHTML+'</div>';
}
function inserSelectNewFolder(tempId,tempName){
var newFolderProps = {id:tempId,name:tempName,tipImg:viewSelectFolder.F_TC,folderImg:viewSelectFolder.F_FC,cid:'0',status:'close',className:'folder_items'};
newFolderProps.pid=currentFolder.getAttribute('fid');
var strPath = currentFolder.getAttribute('path');
if(strPath=='0'){
strPath=currentFolder.getAttribute('name');
}else{
strPath=strPath+'/'+currentFolder.getAttribute('name');
}
newFolderProps.path=strPath;
var paddingLeft = parseInt(currentFolder.getElementsByTagName('td')[0].width)+viewSelectFolder.f_paddingLeft;
newFolderProps.paddingLeft=paddingLeft;
viewSelectFolder._insertNewFolder(newFolderProps);
}
function onSelectFolder(){
currentFolder = viewSelectFolder.f_selected;
photoPageProps.id=currentFolder.getAttribute('fid');
photoPageProps.page=1;
reloadPhoto();
}
function onNewFolder(){
}
function closeManagePhotoWaiting(){
var managePhotoWaiting = ge('manage_photo_waiting');
if(managePhotoWaiting)managePhotoWaiting.style.display='none';
var managePhotoWaitingBack = ge('manage_photo_waiting_back');
if(managePhotoWaitingBack)managePhotoWaitingBack.style.display='none';
}
function showManagePhotoWaiting(msg){
var managePhotoWaiting = ge('manage_photo_waiting');
if(!managePhotoWaiting){
managePhotoWaiting = document.createElement('div');
managePhotoWaiting.id = 'manage_photo_waiting';
managePhotoWaiting.style.cssText='z-index:111;top:0px;left:0px;width:300px;height:90px;position:absolute;border:10px solid #DAD6D6';
document.body.appendChild(managePhotoWaiting);
}
var tempPos = getAbsoluteLocation(ge('item_container'));
var tempTop = tempPos.absoluteTop;
managePhotoWaiting.style.top = tempTop+45;
managePhotoWaiting.style.left = tempPos.absoluteLeft+tempPos.offsetWidth/2 - 150;
managePhotoWaiting.innerHTML = '<div style="margin-top:20px"><img width="16" src="/image/loading.gif" styel="vertical-align:bottom;margin-right:5px"/>'+msg+'</div>';
managePhotoWaiting.style.display='';
//
var managePhotoWaitingBack = ge('manage_photo_waiting_back');
if(!managePhotoWaitingBack){
managePhotoWaitingBack = document.createElement('div');
managePhotoWaitingBack.id = 'manage_photo_waiting_back';
managePhotoWaitingBack.style.cssText='z-index:110;top:0px;left:0px;background-color:#000000;position:absolute;filter:alpha(opacity=20);moz-opacity: 0.2;opacity:.2';
document.body.appendChild(managePhotoWaitingBack);
}
managePhotoWaitingBack.style.display='';
managePhotoWaitingBack.style.width = tempPos.offsetWidth;
managePhotoWaitingBack.style.height = tempPos.offsetHeight;
managePhotoWaitingBack.style.top = tempPos.absoluteTop;
managePhotoWaitingBack.style.left = tempPos.absoluteLeft;
}
function closeManagePhotoWindows(){
var managePhotoWindow = ge('manage_photo_window');
if(managePhotoWindow)managePhotoWindow.style.display='none';
var managePhotoBack = ge('manage_photo_back');
if(managePhotoBack)managePhotoBack.style.display='none';
closeManagePhotoWaiting();
var _pageBackFrame = ge('manage_photo_back_frame');
if(_pageBackFrame)_pageBackFrame.style.display='none';
}
function showManagePhotoWindow(){
var managePhotoWindow = ge('manage_photo_window');
if(!managePhotoWindow){
managePhotoWindow = document.createElement('div');
managePhotoWindow.id = 'manage_photo_window';
managePhotoWindow.style.cssText='z-index:101;top:0px;left:0px;position:absolute;border:10px solid #777777';
document.body.appendChild(managePhotoWindow);
}
return managePhotoWindow;
}
function closeManagePhotoBack(){
var managePhotoBack = ge('manage_photo_back');
if(managePhotoBack)managePhotoBack.style.display='none';
var _pageBackFrame = ge('manage_photo_back_frame');
if(_pageBackFrame)_pageBackFrame.style.display='none';
}
function showManagePhotoBack(){
var managePhotoBack = ge('manage_photo_back');
if(!managePhotoBack){
managePhotoBack = document.createElement('div');
managePhotoBack.id = 'manage_photo_back';
managePhotoBack.style.cssText='z-index:100;top:0px;left:0px;background-color:#000000;position:absolute;filter:alpha(opacity=20);moz-opacity: 0.2;opacity:.2';
document.body.appendChild(managePhotoBack);
}
var tempPos = getAbsoluteLocation(ge('item_container'));
managePhotoBack.style.display='';
managePhotoBack.style.width = tempPos.offsetWidth;
managePhotoBack.style.height = tempPos.offsetHeight;
managePhotoBack.style.top = tempPos.absoluteTop;
managePhotoBack.style.left = tempPos.absoluteLeft;
//
if(bIE && getIEVer()<7){
var _pageBackFrame = ge('manage_photo_back_frame');
if(!_pageBackFrame){
_pageBackFrame = ce('iframe');
_pageBackFrame.id = 'manage_photo_back_frame';
_pageBackFrame.frameborder='0';
_pageBackFrame.style.cssText='z-index:99;top:0px;left:0px;background-color:transparent;position:absolute;border:none';
document.body.appendChild(_pageBackFrame);
}
_pageBackFrame.style.display='';
_pageBackFrame.style.top=managePhotoBack.style.top;
_pageBackFrame.style.left=managePhotoBack.style.left;
_pageBackFrame.style.width=managePhotoBack.style.width;
_pageBackFrame.style.height=managePhotoBack.style.height;
}
}
function closeManagePhotoBackF(){
var managePhotoBack = ge('manage_photo_back_f');
if(managePhotoBack)managePhotoBack.style.display='none';
}
function showManagePhotoBackF(){
var managePhotoBack = ge('manage_photo_back_f');
if(!managePhotoBack){
managePhotoBack = document.createElement('div');
managePhotoBack.id = 'manage_photo_back_f';
managePhotoBack.style.cssText='z-index:100;top:0px;left:0px;background-color:#000000;position:absolute;filter:alpha(opacity=20);moz-opacity: 0.2;opacity:.2';
document.body.appendChild(managePhotoBack);
}
managePhotoBack.style.display='';
managePhotoBack.style.width = document.body.scrollWidth;
managePhotoBack.style.height = document.body.scrollHeight;
}
//
function initPhoto(){
if(photoPageProps.type=='recent')return;
var viewSelectFolderProps={id:'view_select_folder',selector:ge('view_folder'),parentId:'view_folder_parent',ctop:0,cleft:0,bottonNew:true};
var callback={onSelect:onSelectFolder};
viewSelectFolderProps.callback = callback;
viewSelectFolder = new folder(viewSelectFolderProps);
currentFolder = viewSelectFolder.f_selected;
}
//
function goUpload(){
var pathId = '0';
if(viewSelectFolder){
pathId = getPathId();
}
var uploadProps = {path:pathId,pathName:_util.pb.gev('full-path-name'),fullPath:_util.pb.gev('cur_path'),lastId:_util.pb.gev('last-path-id'),lastName:_util.pb.gev('last-path-name')};
showUpload(uploadProps);
}
function doUserCompleteUpload(fileCount,errorCount){
reloadPhoto();
}
function selectThisPhoto(_id){
ge('img_checkbox_'+_id).checked=!(ge('img_checkbox_'+_id).checked);
}
function replacePhoto(_pid){
_replacePid = _pid;
_util.window.bg();
var _html = '<div style="text-align:left"><div style="margin:10px">选择一张图片,替换当前这张图片。</div>';
_html += '<iframe id="replace-photo-frame" src="/uploadReplace.html" frameborder="0" scrolling="no" style="width:360px;height:100px;margin:0 auto;overflow:hidden"></iframe><div id="replace-photo-waiting" style="display:none;text-align:center"></div></div>';
_util.window.show('','替换图片',_html,{w:400,h:200});
}
function replacingPhoto(){
$('#replace-photo-frame').hide();
$('#replace-photo-waiting').show().html('<img src="/image/loading.gif" style="vertical-align:middle"/><span>上传替换中,请稍等……</span>');
}
function replacePhotoError(_error){
$('#replace-photo-waiting').html('<img src="/image/error.gif"/><span>'+_error+'</span><div style="margin-top:10px"><input type="button" class="buttonblue" value="重新上传" onclick="replacePhoto(\''+_replacePid+'\');"/><input type="button" class="buttonblue" value="关闭" onclick="_util.window.bgc();_util.window.showc();" style="margin-left:20px"/></div>');
}
function replacePhotoSuccess(){
$('#replace-photo-waiting').html('<img src="/image/tp_su_1.gif"/>替换成功。<div style="margin-top:10px"><input type="button" class="buttonblue" value="确定" onclick="location.reload();"/></div>');
var _img = $('#img-list-'+_replacePid);
_img.attr('src',_img.attr('src')+'?v='+Math.random());
}
function encodeName1(_id){
var _name = ge(_id).innerHTML;
ge(_id).innerHTML = _name.replace(/ /g,' ');
}
function showEditName(_id,_type){
ge('name_'+_id).style.display='none';
ge('edit_name_'+_id).style.display='';
var _name = ge('name_'+_id).innerHTML.replace(/ /g,' ');
if(_type=='photo'){
var _p = _name.lastIndexOf('.');
var _sufix = _name.substring(_p);
_name = _name.substring(0,_p);
}
ge('edit_name_input_'+_id).value = _name;
ge('edit_name_input_'+_id).select();
}
function closeEditName(_id){
ge('name_'+_id).style.display='';
ge('edit_name_'+_id).style.display='none';
}
function saveEditName(_id,_type){
var _name = ge('edit_name_input_'+_id).value;
if(!_name || _name==''){
alert('名字不能为空!');
return;
}
var _confirm = '';
if(_newusertype=='1'){
if(_type=='folder'){
_util.window.cfm('修改文件夹名确认','您确定要修改吗?',doSaveEditName);
}else{
_util.window.cfm('修改图片名确认','您确定要修改吗?',doSaveEditName);
}
}else{
if(_type=='folder'){
_util.window.cfm('修改文件夹名确认','修改之后,文件夹中的图片的外链将失效!<br/><br/>您确定要修改吗?',doSaveEditName);
}else{
_util.window.cfm('修改图片名确认','修改图片名之后,图片的外链将失效!<br/><br/>您确定要修改吗?',doSaveEditName);
}
}
ge('pub_cfm_butt').onclick=function(){doSaveEditName(_id,_type);};
}
function doSaveEditName(_id,_type){
var _name = ge('edit_name_input_'+_id).value;
if(_type=='photo'){
var _nameo = ge('name_'+_id).innerHTML;
var _p = _nameo.lastIndexOf('.');
var _sufix = _nameo.substring(_p);
_name = _name + _sufix;
}
var _url = '/photo?op=edit&t='+_type+'&id='+_id+'&name='+encodeURIComponent(_name);
if(ge('cur_path_name')){_url+='&pname='+encodeURIComponent(ge('cur_path_name').value);}
ge('edit_name_waiting_'+_id).style.display='';
ge('edit_name_'+_id).style.display='none';
_util.window.cfmc();
xmlHttpRequest(_url,saveEditNameReturn,{id:_id,name:_name});
}
function saveEditNameReturn(_xmlhttp,_props){
var _document = _xmlhttp.responseXML;
var _error = getXmlhttpError(_document);
ge('edit_name_waiting_'+_props.id).style.display='none';
if(_error=='false'){
ge('name_'+_props.id).innerHTML=_props.name.replace(/ /g,' ');
ge('name_'+_props.id).style.display='';
refresh();
}else{
ge('edit_name_'+_props.id).style.display='';
alert(_error);
}
}
function closePhotoSizeTips(){
var photoSizeTipWindow = ge('photoSize_tip_window');
if(photoSizeTipWindow)photoSizeTipWindow.style.display='none';
}
function showPhotoSizeTips(_link){
var photoSizeTipWindow = createPhotoSizeTipWindow(_link);
var _html = '';
_html += '<div style="border:3px solid #E4EFFF;padding:10px">';
_html += '<div style="float:right;margin-left:10px"><a class="link_del" href="#" onclick="closePhotoSizeTips();return false;">X</a></div>';
_html += '<div style="text-align:left;line-height:1.8">';
_html += '<b>什么是标准尺寸?</b><br/>标准图片自动将宽度超过640像素的图片缩小为640像素,适合网店宝贝展示。<br/>原图为原始图片,适合网店装饰用途。';
_html += '</div><div class="clear_div"></div>';
_html += '</div>';
photoSizeTipWindow.innerHTML = _html;
}
function createPhotoSizeTipWindow(_link){
var photoSizeTipWindow = ge('photoSize_tip_window');
if(!photoSizeTipWindow){
photoSizeTipWindow = ce('div');
photoSizeTipWindow.id='photoSize_tip_window';
photoSizeTipWindow.style.cssText='z-index:110;position:absolute;width:360px;border:1px solid #C1DBFF';
document.body.appendChild(photoSizeTipWindow);
}
var _pos = getAbsoluteLocation(_link);
photoSizeTipWindow.style.top=_pos.absoluteTop+30;
photoSizeTipWindow.style.left = document.body.scrollWidth/2 - 40;
photoSizeTipWindow.style.display='';
return photoSizeTipWindow;
}
function setResizeValu(_radio){
if(_radio.value=="6"){
ge('resize_custom_width').disabled=false;
ge('resize_custom_height').disabled=false;
}else{
ge('resize_custom_width').disabled=true;
ge('resize_custom_height').disabled=true;
}
resizeProps.type = _radio.value;
}
function saveResize(){
var _inputs = ge('manage_photo_window').getElementsByTagName('input');
var bChecked=false;
for(var i=0;i<_inputs.length;i++){
if(_inputs[i].name=='resize_photo_type' && _inputs[i].checked){
resizeProps.type = _inputs[i].value;
bChecked = true;
break;
}
}
if(!bChecked){
alert('请选择您需要的图片大小。');
return;
}
if(resizeProps.type=='6'){
var _width = ge('resize_custom_width').value;
var _height = ge('resize_custom_height').value;
if(!_width || !isInt(_width) || (parseInt(_width)<=0 && _width!='-1')){
alert('宽度必须是-1或大于0的整数。');
return;
}
if(!_height || !isInt(_height) || (parseInt(_height)<=0 && _height!='-1')){
alert('高度必须是-1或大于0的整数。');
return;
}
resizeProps.width = _width;
resizeProps.height = _height;
}
}
function getResizeVars(){
var _paras='';
if(ge('photo_resize_yes').checked){
saveResize();
_paras += '&photoResize_t='+resizeProps.type;
if(resizeProps.type=='6'){
_paras += '&photoResize_w='+resizeProps.width;
_paras += '&photoResize_h='+resizeProps.height;
}
}else{
_paras += '&photoResize_t=-1';
}
return _paras;
}
//document.onmousedown = startPhotoUrlMove;
document.onmousemove=movephoto;
document.onmouseup=stopmovephoto;
发表评论
-
prototype属性的说明
2013-05-30 14:36 711对于对象的prototype属 ... -
js copyimage
2011-10-11 16:25 1045<html xmlns="http://www ... -
js s
2011-10-10 21:59 806function drawTile() { v ... -
iframe 父窗口和子窗口相互的调用方法集锦
2011-09-28 13:34 651iframe 父窗口和子窗口相互的调用方法集锦 一、父窗口调 ... -
js刷新当前页面
2011-09-26 15:02 4422一、先来看一个简单的例子: 下面以三个页面分别命名为fram ... -
execCommand(参数)
2011-09-22 15:31 1019execCommand(参数); 用法 2D-Positio ... -
js-checkbox
2011-09-21 18:00 676<html> <!DOCTYPE html ...
相关推荐
PassMark BurnInTest V5.3 Copyright (C) 1999-2008 PassMark Software All Rights Reserved http://www.passmark.com Overview ======== Passmark's BurnInTest is a software tool that allows all the major sub...
最好用的单元测试工具,除了这里你是找不到9.0版本的破解的。 ... 独立的版本破解: ... 把lic_client.jar复制到 ... c:\Program Files (x86)\Parasoft\Test\9.0\plugins\...这个是:plugins-c++Test For Visual Studio.7z
eNetTest 网管内网单机测速工具eNetTest 网管内网单机测速工具eNetTest 网管内网单机测速工具eNetTest 网管内网单机测速工具eNetTest 网管内网单机测速工具eNetTest 网管内网单机测速工具eNetTest 网管内网单机测速...
c:\Program Files (x86)\Parasoft\C++test for Visual Studio\9.0\plugins\ 这个目录中 把plugins-Test for Virsual Studio.7z 中的文件覆盖到 c:\Program Files (x86)\Parasoft\Test for Visual Studio\9.0\...
Modeltest 使用说明 Modeltest 是一个选择核苷酸替代模型的软件,通过和 PAUP 配合使用,可以选择出合适的 MODEL,并同时计算出相关参数。下面是 Modeltest 的使用说明和相关知识点: 一、Modeltest 概述 * Model...
Parasoft C++Test 9.5是一款由Parasoft公司开发的专业自动化白盒测试工具,专注于C++编程语言的测试。它集成了多种测试策略,包括静态代码分析、动态测试、单元测试、代码覆盖率分析以及缺陷预防等功能,旨在提高...
(speedtest服务器搭建教程) 本篇教程旨在指导读者搭建speedtest服务器,通过安装PHPStudy、配置WNMP和Nginx、下载并配置speedtest测速平台,实现本地测速功能。 一、 PHPStudy 安装和配置 PHPStudy 是一个集成...
### ECU-Test高级教程知识点解析 #### 一、ECU-Test概述 **ECU-Test**是一款专为汽车电子控制单元(ECU)开发与验证而设计的强大工具。它支持自动化测试流程,并能有效管理和控制整个测试环境,极大地提高了ECU开发...
Google Test是Google开发的一款强大的C++测试框架,它使得C++开发者能够编写单元测试和集成测试,以确保代码的质量和稳定性。本文档将详细介绍Google Test框架的使用方法,包括基本概念、断言、测试套件、测试用例、...
最好用的单元测试工具,除了这里你是找不到9.0版本的破解的。 ... 独立的版本破解: ... 把lic_client.jar复制到 ... c:\Program Files (x86)\Parasoft\Test\9.0\plugins\...这个是:( plugins-Test for Virsual Studio.7z )
Test Track Client 使用说明 Test Track 是一个功能强大且实用的BUG管理软件,能够帮助测试工程师、开发工程师、开发主管和项目管理人员等角色更好地管理和跟踪项目中的BUG。该软件具有强大的管理功能和灵活的配置...
Test Bench是电子设计自动化(EDA)领域中的一个重要概念,主要用于验证数字集成电路的设计。在硬件描述语言(HDL,如Verilog或VHDL)中,Test Bench是模拟真实硬件环境来测试设计功能的一个虚拟平台。它能帮助...
CAN Test V2.53 软件使用说明 CAN Test V2.53 软件是一款功能强大且易用的CAN总线测试工具,旨在帮助用户快速地测试和诊断CAN总线设备。以下是CAN Test V2.53 软件使用说明的详细知识点: 软件安装 CAN Test 软件...
### ECU-TEST基本教程知识点概述 #### 一、ECU-TEST简介 ECU-TEST是一款由Vector公司开发的专业汽车电子控制单元(Electronic Control Unit, ECU)测试工具,它能够实现对ECU进行全面而深入的功能性测试,并且支持...
《Parasoft C++test 9.2官方用户手册_eclipse_中文版》是一本详尽的指南,专为使用C++test工具的开发者提供在Eclipse集成开发环境中的使用方法。C++test是一款强大的静态代码分析和单元测试工具,旨在提高C++软件的...
cifar-10数据集由10个类的60000个32x32彩色图像组成,每个类有6000个图像。有50000个训练图像和10000个测试图像。数据集分为五个训练批次和一个测试...具体:test.mat文件,该训练集可以用于图片识别,非负矩阵分解等。
**串口调试工具——PortTest详解** 在计算机通信领域,串行端口(Serial Port)是一种常见的硬件接口,用于设备间的通信。PortTest是一款专为串口调试设计的实用工具,它可以帮助用户检测和测试串口通讯功能,确保...
C++test简明操作手册 C++test是一款功能强大的测试工具,旨在帮助开发者编写高质量的代码。作为Parasoft公司的旗舰产品,C++test提供了全面的测试解决方案,涵盖了静态测试、动态测试、测试用例生成等多方面的测试...