Server : Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.6
System : Windows NT USER-PC 6.1 build 7601 (Windows 7 Professional Edition Service Pack 1) AMD64
User : User ( 0)
PHP Version : 7.4.6
Disable Function : NONE
Directory :  C:/Program Files/CyberLink/PowerDirector/web/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : C:/Program Files/CyberLink/PowerDirector/web/PicasaSearchUI.js
	var strPhotoUrl;
	var strFrob;
	var strToken;
	var nPhotoNum = 0;
	var nContract_id;
	var m_strCurrent_person_id;
	var m_StrPhotoset_id = "";
	
	var m_htPhotoID = new Hashtable;
	var m_htPhotoTitle = new Hashtable;
	var m_htPhotoUser = new Hashtable;
	var m_htPhotoURL = new Hashtable;
	
	var m_nAvoidDownloadLicensesID =[0,3,6];
	
	
	var m_nWindowWidth = 480;
	var m_nWindowHeight = 290;
	
	var nStartIndex = 0;
	var nEndIndex = 0;
	
	var m_nPhotosInWidth = 7;
	var m_nPhotosInHeight = 3;
    	function UpdateUpLevelButtonStatus(bEnable) 
    	{
        var strEnableUpLevelButton;
        if (bEnable == true)
            strEnableUpLevelButton = "EnableUpLevelButton:1";
        else
            strEnableUpLevelButton = "EnableUpLevelButton:0";
        location = strEnableUpLevelButton;
    }
	
	function updateTableWH()
	{
		m_nWindowHeight = document.body.clientHeight;
		m_nWindowWidth = document.body.clientWidth;
		
		for(var i = 0;i<200;i++)
		{
			if(i>m_nWindowWidth/100)
			{
				m_nPhotosInWidth = i;
				break;
			}
		}
		
		for(var i = 0;i<200;i++)
		{
			if(i>(m_nWindowHeight-60)/130)
			{
				m_nPhotosInHeight = i;
				break;
			}
		}
		m_nPhotosPrePage = m_nPhotosInWidth*m_nPhotosInHeight;
	}
	
	
	function GoToPage(nPageIndex)
	{
		m_nCurrentPageIndex = nPageIndex;
		if(m_nCurrentPageIndex >m_nTotalPageNum)
		{
			m_nCurrentPageIndex = m_nTotalPageNum;
		}
		if(m_nCurrentPageIndex < 1)
		{
			m_nCurrentPageIndex = 1;
		}
		TRACE(m_nCurrentPageIndex);
		SearchTag(m_strSearchText);
		UpdateCurPageInfo();
	}
	
	function SearchHotTag(tag_name)
	{
		var ref = "SearchTag:"+tag_name;
		location = ref; 
	}
	
	function GetPhotoUrl(photo_id)
	{
		var strURL = m_htPhotoURL.items(photo_id);
		var strPhoto_URL = "GetPhotoURL:"+decodeURI(strURL);
		location = strPhoto_URL;
	}
	
	function GetPhotoTitle(photo_id)
	{
		TRACE("GetPhotoTitle");
		TRACE(photo_id);
		var strTitle = m_htPhotoTitle.items(photo_id);
		TRACE("result=");
		TRACE(strTitle);
		var strPhoto_Title = "GetTitle:"+strTitle;
		TRACE("return=");
		TRACE(strPhoto_Title);
		location = strPhoto_Title;
	}
	
	function GetPhotoUser(photo_id)
	{
		var strUser = m_htPhotoUser.items(photo_id);
		var strPhoto_Title = "GetPhotoUser:"+decodeURI(strUser);
		location = strPhoto_Title;
	}
	
	function updateBKImage()
	{
		var body = document.getElementById("bkArea");
		body.background = m_strSkinPath+"flickr_search_bg.png";
	}
	
	
	
	function DownloadSelectedPhoto() 
	{
		for(var k in m_htPhotoID._hash)
	    {
			//var strGetID = "add:"+m_htPhotoID.items(k);
			var strGetID = "add:"+k;
			location = strGetID;
		}
		m_htPhotoID.clear();
		//m_htPhotoTitle.clear();
		//start download
		var ref = "download:test";
		location = ref; 
		return;
	}
	
	function UpdateTotalPageInfo() 
	{
		TRACE("UpdateTotalPageInfo");
		TRACE(m_nTotalPageNum);
		var ref = "UpdateTotalPageInfo:"+m_nTotalPageNum;
		location = ref; 
		return;
	}
	
	function UpdateCurPageInfo() 
	{
		var ref = "UpdateCurPageInfo:"+m_nCurrentPageIndex;
		location = ref; 
		return;
	}

	function SelectedAllPhoto() 
	{
		for (var i=nStartIndex; i<nEndIndex; i++)
		{
			var strID = "image"+ i;
			if(document.getElementById(strID).disabled==false)
			{
				document.getElementById(strID).checked = true;
				OnCheckBox(document.getElementById(strID).photo_id,document.getElementById(strID).photo_title,document.getElementById(strID).checked,document.getElementById(strID).photo_user,document.getElementById(strID).photo_URL);
			}
		}
	}
	
	function UnSelectedAllPhoto() 
	{
		for (var i=nStartIndex; i<nEndIndex; i++)
		{
			var strID = "image"+ i;
			document.getElementById(strID).checked = false;
			OnCheckBox(document.getElementById(strID).photo_id,document.getElementById(strID).photo_title,false,document.getElementById(strID).photo_user,document.getElementById(strID).photo_URL);
		}
	}
	
	function OnButtonPrev()
	{
		TRACE("OnButtonPrev");
		m_nCurrentPageIndex--;
		if(m_nCurrentPageIndex<=0)
		{
			m_nCurrentPageIndex = 1;
			UpdateCurPageInfo();
			return;
		}
		TRACE(m_nCurrentPageIndex);
		SearchTag(m_strSearchText);
	}
	
	function OnButtonNext()
	{
		TRACE("OnButtonNext");
		m_nCurrentPageIndex++;
		if(m_nCurrentPageIndex >m_nTotalPageNum)
		{
			m_nCurrentPageIndex = m_nTotalPageNum;
			UpdateCurPageInfo();
			return;
		}
		TRACE(m_nCurrentPageIndex);
		SearchTag(m_strSearchText);
	}
	
	
	function ClearInfoArea1()
	{
		var picList = document.getElementById("Info_Area1");
		picList.innerHTML = "";
	}
	
	function ClearInfoArea2()
	{
		var Info_Area2 = document.getElementById("Info_Area2");
		Info_Area2.innerHTML = "";
	}
	
	function ShowContracts(json)
	{
		TRACE("ShowContracts");
		if(json.feed.entry == null)
		{
			TRACE("Contracts=0");
			return;
		}
		var nUserCount = json.feed.entry.length;
		TRACE(nUserCount);
		m_nTotalPageNums = 1;
		UpdateUpLevelButtonStatus(false);
		nPhotoNum = 0;
		UpdateSelectAllButtonStatus();
		
		ClearInfoArea1();
		ClearInfoArea2();
		
		m_bShowPhotoSet = false;
		var picList = document.getElementById("resultArea");
		picList.innerHTML = ""
		m_nContractGetCount = 0;
		//Create Cell for user icons
		var tbl     = document.createElement("table");
		var tblBody = document.createElement("tbody");
		var nCount = 0;
		var row = document.createElement("tr");
		for (var i=0; i<nUserCount; i++)
		{
			var item = json.feed.entry[i];
			var strTitle = item.title.$t;
			TRACE(strTitle);
			if(nCount>m_nPhotosInWidth-1)
			{
				nCount = 0;
				row = document.createElement("tr");
			}
			
			var strCellID = strTitle;
			
			nCount++;
			var cell = document.createElement("td");
			cell.setAttribute('width', "90");
			cell.setAttribute('height', "100");
			cell.setAttribute('id', strCellID);
			cell.setAttribute('align', "center");
			
			ShowPersons(item,cell);
			
			var link = document.createElement('a');
			
			cell.onmouseover = function()
			{
				//domTT_activate(this, event, 'content',this.title , 'grid', 20, 'fade', 'out', 'trail', false);
				this.style.cursor= 'hand';
			}
			cell.onmouseout=function()
			{
				//domTT_closeAll();domTT_deactivate(this, event);
				this.style.cursor= 'default';
			}
			
			row.appendChild(cell);
			tblBody.appendChild(row);	
		}
		// put the <tbody> in the <table>
		tbl.appendChild(tblBody);
		// appends <table> into <body>
		picList.appendChild(tbl);
		
		m_bShowContract = true;
		UpdateTotalPageInfo();
		UpdateCurPageInfo();
		
		TRACE("ShowContracts_end");
	}
	
	function ShowPersons(person,UserCell)
	{
		var strTitle = person.title.$t;
		var strNickName = person.gphoto$nickname.$t;
		var strThumbnail = person.gphoto$thumbnail.$t;
		var strCellID = person.nsid;
		var picList = document.getElementById("resultArea");
		//var UserCell = document.getElementById(strCellID);
		//if(!UserCell)
		//	return;
		var tbl_new     = document.createElement("table");
		tbl_new.setAttribute('cellspacing','0');
		tbl_new.setAttribute('cellpadding','0');
		var tblBody_new = document.createElement("tbody");
		tbl_new.setAttribute('border','0');
				
		var row1 = document.createElement("tr");
		var cell1 = document.createElement("td");	
		cell1.setAttribute('width', "62");
		cell1.setAttribute('height', "58");
		cell1.setAttribute('align', "center");
		cell1.setAttribute('vAlign', "top");
		cell1.setAttribute('align', "center");
		var strBKImageFile;
		strBKImageFile = m_strSkinPath+"thumb_bg_user.png";
		cell1.setAttribute('background',strBKImageFile);	
		

		var link = document.createElement('a');
		link.setAttribute('target', "_top");
		link.setAttribute('person_id', strTitle);
		
		var url;
		url = strThumbnail;
		
		link.setAttribute('person_image', url);
		link.setAttribute('person_name', strNickName);
		link.setAttribute('title', strTitle);
		
		//var strHref = "GetPhotoSets:"+person.nsid;
		
		//link.setAttribute('href', strHref);
		link.onclick = function()
		{
			m_nCurrentPhotoSetPage = 1;
			m_strCurrent_person_id = this.person_id;
			GetAlbum(this.person_id);
			m_nConstractID = this.person_id;
			
			m_CurrentContractInfo_ImageURL = this.person_image;
			m_CurrentContractInfo_Name = this.person_name;
			//ShowPersonsInfoArea();
		}
		link.onmouseover = function()
		{
			this.style.cursor= 'hand';
		}
		
		link.onmouseout=function()
		{
			this.style.cursor= 'default';
		}
		
		var div = document.createElement('img');
		div.setAttribute('src', url);
		div.setAttribute('border', 0);
		div.setAttribute('width', "49");
		div.setAttribute('height', "48");
		div.setAttribute('vspace', 7);
		link.appendChild(div);
		
		cell1.appendChild(link);
		row1.appendChild(cell1);
		
		tblBody_new.appendChild(row1);
		tbl_new.appendChild(tblBody_new);
		
		var cell2 = document.createElement("td");	
		cell2.setAttribute('align', "center");

		var link2 = document.createElement('a');
		link2.setAttribute('target', "_top");
		link2.setAttribute('person_id', strTitle);
		
		var url;
		url = strThumbnail;
		
		link2.setAttribute('person_image', url);
		link2.setAttribute('person_name', strNickName);
		link2.setAttribute('title', strTitle);
	
		link2.onclick = function()
		{
			m_nCurrentPhotoSetPage = 1;
			m_strCurrent_person_id = this.person_id;
			GetAlbum(this.person_id);
			m_nConstractID = this.person_id;
			
			m_CurrentContractInfo_ImageURL = this.person_image;
			m_CurrentContractInfo_Name = this.person_name;
			//ShowPersonsInfoArea();
		}
		link2.onmouseover = function()
		{
			this.style.cursor= 'hand';
		}
		
		link2.onmouseout=function()
		{
			this.style.cursor= 'default';
		}
		
		var divCell = document.createElement('div');
		var textNodeNobr = "<div style='width: 80px; text-overflow: ellipsis; overflow: hidden'><font size = 2><nobr>"+strNickName+"</nobr></font></div>";
		divCell.innerHTML=textNodeNobr;
				
		link2.appendChild(divCell);
		cell2.appendChild(link2);
		
		
		UserCell.appendChild(tbl_new);
		UserCell.appendChild(cell2);
		m_nContractGetCount = m_nContractGetCount+1;
	}
	
	function UpdateSelectAllButtonStatus()
	{
		var bEnable = true;
		if(nPhotoNum == 0)
			bEnable = false;
		var strEnableSelectAllButton;
		if(bEnable == true)
			strEnableSelectAllButton = "EnableSelectAllButton:1";
		else
			strEnableSelectAllButton = "EnableSelectAllButton:0";
		location = strEnableSelectAllButton;
	}
	
	
	
	function ShowHotTags(tagList)
	{
		// insert newly found pictures
		var body = document.getElementById("resultArea");
		body.innerHTML = "";
		var arr = new Hashtable;
		for(var i = 0;i<tagList.length;i++)
		{
			arr.add(tagList[i]._content,(tagList[i].score/10));
		}
		
		var TagList = new Array(tagList.length);
		for(var i = 0;i<tagList.length;i++)
		{
			TagList[i]= tagList[i]._content;
		}
		
		TagList.sort();
		
		
		var tbl     = document.createElement("table");
		var tblBody = document.createElement("tbody");
		var nCount = 0;
		var row = document.createElement("tr");
	
		var cell = document.createElement("td");
		//cell.setAttribute('width', "80");
		//cell.setAttribute('height', "100");
			
		for(var i = 0;i<tagList.length;i++)
		{
			sizeTag = arr.items(TagList[i]);
			
			var fontTag = document.createElement('font');
			fontTag.setAttribute('size',sizeTag);
			fontTag.setAttribute('color',"#0000FF");
			
			var link = document.createElement('a');
			link.setAttribute('TagName',TagList[i]);
			
			link.onmouseover = function()
			{
				//this.style.background = "#0000FF";
				//this.style.color = "#FFFFFF";
				this.style.cursor= 'hand';
			}
			
			link.onmouseout = function()
			{
				//this.style.background = "#FFFFFF";
				//this.style.color = "#0000FF";
				this.style.cursor= 'default';
			}
			
			link.onclick = function()
			{
				SearchHotTag(this.TagName);
			}
			
			link.innerHTML = TagList[i];
			link.innerHTML += "  ";
			fontTag.appendChild(link);
			
			cell.appendChild(fontTag);
			
		}
		row.appendChild(cell);
		tblBody.appendChild(row);
		tbl.appendChild(tblBody);
		// appends <table> into <body>
		body.appendChild(tbl);
		// sets the border attribute of tbl to 2;
		tbl.setAttribute("border", "0");
	}
	
	function jsonFlickrApi(rsp)
	{
		if (rsp.stat != "ok")
		{
			return;
		}
		
		if(rsp.photosets)
		{
			ShowPhotoSets(rsp.photosets);
			return;
		}
		
		if(rsp.sizes)
		{
			var strURL = "";
			var bFind = false;
			
			for(var i = 0;i<rsp.sizes.size.length;i++)
			{
				strURL = rsp.sizes.size[i].source;
				bFind = true;
				
				if(rsp.sizes.size[i].label == m_nDownloadSizeName)
				{
					break;
				}
			
			}
			if(bFind)
			{
				var strPhotoURL = "GetPhotoURL:"+strURL;
				location = strPhotoURL;
			}
			return;
		}
		
		if(rsp.person)
		{
			ShowPersons(rsp.person);	
			return;
		}
		
		if(rsp.frob)
		{
			var strReturn = "frob:"+rsp.frob._content;
			strFrob = rsp.frob._content;
			
			var strSrc = m_strSecret+"api_key"+m_strApiKey+"frob"+strFrob+"permsread";
			var strMd5 = MD5(strSrc);
			var strRequest = "http://www.flickr.com/services/auth/?api_key="+m_strApiKey+"&perms=read&frob="+strFrob+"&api_sig="+strMd5;

			window.open( strRequest);
			return;
		}
		
		if(rsp.auth)
		{
			if(rsp.auth.token)
			{
				strToken = rsp.auth.token._content;
				return;
			}
		}
		
		if(rsp.contacts)
		{
			if(!rsp.contacts.contact)
			{
				return;
			}
			
			ShowContracts(rsp.contacts);
			return;
		}
		
		if(rsp.photos)
		{
			ShowPhotos(rsp.photos);
			return;
		}
		
		if(rsp.photo)
		{
			ShowPhotoInfo(rsp.photo);
			return;
		}
		
		if(rsp.licenses)
		{
			for(var j = 0;i<10;j++)
			{
				m_nLicenseID[j] = -1;
			}	
			for(var i = 0;i<rsp.licenses.license.length;i++)
			{
				strURL = rsp.licenses.license[i].url;
				m_nLicenseName[i] = rsp.licenses.license[i].name; 
				m_nLicenseURL[i] = rsp.licenses.license[i].url;
				m_nLicenseID[i] = rsp.licenses.license[i].id;				
			}
			return;
		}
		
		if(rsp.photoset!=null)
		{
			m_nTotalPageNum = rsp.photoset.pages;
			ShowPhotos(rsp.photoset);
			return;
		}
		
		if(rsp.hottags)
		{
			if(rsp.hottags.count>0)
				ShowHotTags(rsp.hottags.tag);
			return;
		}
	}