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/PicasaAction.js
	var m_strAuthToken = "";
	var m_strSkinPath;
	
	var m_bHaveNotInSetPhotos = 0;
	var m_nCurrentPhotoSetPage = 1;
	var m_strUserID;
	var m_StrPhotosetId;
	var m_nCurrentPageIndex = 1;
	var m_nTotalPageNum = 1;
	var m_strAuthToken1 = "";
	var m_strOwnerID = "";

	var m_nPhotosPrePage = 21;
	
	var m_strToolTipsFileName = "File name";
	var m_strToolTipsFileUserName = "User name";
	var m_strToolTipsFileDescription = "Description";
	
	function SetSkinPath(strSKinPath)
	{
		m_strSkinPath = strSKinPath;
	}

	function setToolTipsFileName(strToolTipsFileName)
	{
		m_strToolTipsFileName = strToolTipsFileName;
	}
	
	function setToolTipsFileUserName(strToolTipsFileUserName)
	{
		m_strToolTipsFileUserName = strToolTipsFileUserName;
	}
	
	function setToolTipsFileDescription(strToolTipsFileDescription)
	{
		m_strToolTipsFileDescription = strToolTipsFileDescription;
	}

	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;
	    TRACE("updateTableWH");
	    TRACE(m_nPhotosPrePage);
	    TRACE(m_nPhotosInWidth);
	    TRACE(m_nPhotosInHeight);
	}
	
	function SendRequest(strURL_Send)
	{
		TRACE("SendRequest");
		var xmlHttp;
		try
		{
			xmlHttp=new XMLHttpRequest();
		}
		catch (e) 
		{
			try
			{      
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
			}
			catch (e)
			{      
				try
				{        
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
				}
				catch (e)
				{
					TRACE("Your browser does not support AJAX!");
					return false;        
				}      
			}    
		}

		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{		
				TRACE("readyState==4");
				if(xmlHttp.responseText)
				{
					var myObject = eval(xmlHttp.responseText);
				}
			}
		}
		xmlHttp.open("GET",strURL_Send,true);
		if(m_strAuthToken!="")
		{
			var strHeader = "GoogleLogin auth="+m_strAuthToken;
			TRACE("HEADER=");
			TRACE(strHeader);
			xmlHttp.setRequestHeader('Authorization',strHeader);
			TRACE("setRequestHeader_OK");
		}
		xmlHttp.send(null);
		TRACE("SendRequest_end");
	}
	
	function TRACE(strDebug)
	{
	    return;
	    var ref = "trace:"+"[picasa]"+decodeURI(strDebug)+"\n";
		location = ref; 
	}

	function SetAuthString(strAuthToken)
	{
		TRACE("SetAuthString");
		m_strAuthToken = strAuthToken;
		var strDebug = "authtoken="+m_strAuthToken;
		TRACE(strDebug);
		TRACE("SetAuthString_end");
	}
	
	function GetAlbum(strUserID)
	{
		TRACE("GetAlbum");
		m_strUserID = strUserID;
		var URL_Send = "http://picasaweb.google.com/data/feed/api/user/"+strUserID+"?kind=album&alt=json&callback=ShowPhotoSets";
		SendRequest(URL_Send);
	}

	function SearchTag(strSearchText)
	{
		m_strSearchText = strSearchText
		var URL_Send = "http://picasaweb.google.com/data/feed/base/all?alt=json&callback=ShowPhotos&kind=photo&q="+strSearchText;
		TRACE(URL_Send);
	    	SendRequest(URL_Send);	
	}
	    
    function GetPhotosBySetID(strUserID, strPhotoSetId) 
    {
        TRACE("GetPhotosBySetID");
        m_strUserID = strUserID;
        m_StrPhotosetId = strPhotoSetId;
        var URL_Send = "http://picasaweb.google.com/data/feed/api/user/" + strUserID + "/album/" + strPhotoSetId + "?kind=photo&alt=json&callback=ShowPhotos";
        TRACE(URL_Send);
        SendRequest(URL_Send);
        return;
	}
	
	function GetFriendList(strUserID)
	{
		m_strOwnerID = strUserID;
		TRACE("GetFriendList");
		var URL_Send = "http://picasaweb.google.com/data/feed/api/user/" + strUserID + "/contacts?kind=user&alt=json&callback=ShowContracts";
        SendRequest(URL_Send);
        return;
    }
    function ShowPhotos(json)
	{
		UpdateUpLevelButtonStatus(true);
		TRACE("ShowPhotos");
		var numentries = json.feed.entry.length;
		m_nTotalPageNum = 1;
		
		// insert newly found pictures
		var body = document.getElementById("resultArea");
		body.innerHTML = "";
			
		// creates a <table> element and a <tbody> element
		var tbl     = document.createElement("table");
		var tblBody = document.createElement("tbody");
		var nCount = 0;
		var row = document.createElement("tr");

		m_nTotalPageNum = numentries / m_nPhotosPrePage + 1;
		m_nTotalPageNum = parseInt(m_nTotalPageNum);
		
		UpdateTotalPageInfo();
		UpdateCurPageInfo();

		nStartIndex = (m_nCurrentPageIndex - 1) * m_nPhotosPrePage;
		nEndIndex = nStartIndex + m_nPhotosPrePage;
		if (nEndIndex > numentries)
			nEndIndex = numentries;
		nPhotoNum = nEndIndex - nStartIndex;
		UpdateSelectAllButtonStatus();
		for (var i = nStartIndex; i < nEndIndex; i++) 
		{
		    TRACE("list photo index");
		    TRACE(i);
			var item = json.feed.entry[i];
	        	var title = item.title.$t;
	        	var content = item.content.src;
	        	var thumbnail = item.media$group.media$thumbnail[0].url;
			var ImagePageURL = item.link[1].href;
			var strGPhotoID = item.gphoto$id.$t;
			var strToolTips = "";
			var strOwner = item.media$group.media$credit[0].$t;
			strToolTips = m_strToolTipsFileUserName+":"+strOwner+"\n"+m_strToolTipsFileName+title;
			if(nCount>m_nPhotosInWidth-1)
			{
				nCount = 0;
				row = document.createElement("tr");
			}
			nCount++;
			var cell = document.createElement("td");
			cell.setAttribute("width","100");
			
			//UNIT CELL.
			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 rowIcon = document.createElement("tr");
			var cellIcon = document.createElement("td");
			cellIcon.setAttribute('align','center');
			cellIcon.colSpan = 2;
			

			var link = document.createElement('a');
			//var urlLarge = "add:farm" + photo.farm + ".static.flickr.com/" + photo.server + "/" + photo.id + "_" + photo.secret + ".jpg";
			var urlLarge = "add:"+item;
			var urlLink = content;
			TRACE("thumbnail=====");
			TRACE(thumbnail);
			link.setAttribute('target', "_BLANK");
			link.setAttribute('href', ImagePageURL);
			
			var div = document.createElement('img');
			var url = thumbnail;
			
			var SpaceID = "image"+title;
			
			div.setAttribute('src', url);
			div.setAttribute('border', 0);
			div.setAttribute('id', SpaceID);
			div.setAttribute('photo_id',strGPhotoID);
			div.setAttribute('photo_URL',content);
			
			div.setAttribute('title',strToolTips);
			
			//TRACE("SetTitle=======");
			//TRACE(strToolTips);

			div.onmouseover = function()
			{
				this.style.cursor= 'hand';
				//if(this.title=="")
				//	GetPhotoInfo(this.photo_id);
			}
			
			div.onmouseout=function()
			{
				this.style.cursor= 'default';
			}
			
			
			link.appendChild(div);
			cellIcon.appendChild(link);
			rowIcon.appendChild(cellIcon);
			
			
			var rowButton = document.createElement("tr");
			var cellButton1 = document.createElement("td");
			cellButton1.setAttribute('align', "left");
			cellButton1.setAttribute('width', "20");
			
			var checkBox_select = document.createElement('input');
			checkBox_select.setAttribute('type', "checkbox");
			
			var strID = "image"+ i;
			checkBox_select.setAttribute('id', strID);
			checkBox_select.setAttribute('photo_id', strGPhotoID);
			checkBox_select.setAttribute('photo_URL',content);
			checkBox_select.setAttribute('href', urlLarge);
			checkBox_select.setAttribute('photo_title', title);
			checkBox_select.setAttribute('photo_user', strOwner);
			if(m_htPhotoID.contains(content))
			{
				checkBox_select.defaultChecked = true;
			}
			checkBox_select.onclick = function()
			{
				OnCheckBox(this.photo_id,this.photo_title,this.checked,this.photo_user,this.photo_URL);
			}
			
			cellButton1.appendChild(checkBox_select);
			
			var cellButton2 = document.createElement("td");
			cellButton2.setAttribute('align', "right");
			
			var button_License = document.createElement('img');
			//button_License.setAttribute('type', 'button');
			var strLogoPath = m_strSkinPath+ "btn_copyright_n.png";
			button_License.setAttribute('src', strLogoPath);
			
			button_License.setAttribute('licenseID', 0);
			//button_License.setAttribute('licenseID', photo.license);
			//button_License.setAttribute('title',GetLicenseDescription(photo.license));
			button_License.onclick = function()
			{
				var strLogoPath = m_strSkinPath+ "btn_copyright_p.png";
				this.src = strLogoPath;
				//OpenToLicensePage(this.licenseID);
			}
			
			button_License.onmouseover = function()
			{
				var strLogoPath = m_strSkinPath+ "btn_copyright_h.png";
				this.src = strLogoPath;
				//this.style.cursor= 'hand';
			}
			
			button_License.onmouseout = function()
			{
				var strLogoPath = m_strSkinPath+ "btn_copyright_n.png";
				this.src = strLogoPath;
				//this.style.cursor= 'default';
			}
			
			cellButton2.appendChild(button_License);
			
			rowButton.appendChild(cellButton1);
			rowButton.appendChild(cellButton2);
			
			
			
			tblBody_new.appendChild(rowIcon);
			tblBody_new.appendChild(rowButton);
			
			tbl_new.appendChild(tblBody_new);
			//tbl_new.setAttribute("border","1");
			
			cell.appendChild(tbl_new);
			
			row.appendChild(cell);
			tblBody.appendChild(row);	
		}
		// put the <tbody> in the <table>
		tbl.appendChild(tblBody);
		// appends <table> into <body>
		body.appendChild(tbl);
		// sets the border attribute of tbl to 2;
		//tbl.setAttribute("border", "2");
		return;
	}

	function GoToHome()
	{
		var strURL="https://www.google.com/accounts/NewAccount";
		window.open(strURL);
	}

	function OnCheckBox(photo_id,photo_title,bCheck,photo_user,photo_URL) 
	{
		if(bCheck)
		{
			m_htPhotoTitle.add(photo_id,photo_title);
			m_htPhotoID.add(photo_id,photo_title);
			m_htPhotoUser.add(photo_id,photo_user);
			m_htPhotoURL.add(photo_id,photo_URL);
		}
		else
		{
			m_htPhotoTitle.remove(photo_id,photo_title);
			m_htPhotoID.remove(photo_id,photo_title);
			m_htPhotoUser.remove(photo_id,photo_user)
			m_htPhotoURL.remove(photo_id,photo_URL);
		}
		
		var strSelectCount = "UpdateCurSelectCount:"+m_htPhotoTitle.count();
		location = strSelectCount;
		
	}