mirror of
				https://github.com/nerzhul/ocsms.git
				synced 2025-10-28 00:49:11 +00:00 
			
		
		
		
	Add photo into update and fix HTML generator
This commit is contained in:
		
							parent
							
								
									6fa1bfe17f
								
							
						
					
					
						commit
						19bd6adcca
					
				| @ -189,7 +189,9 @@ class SmsController extends Controller { | |||||||
| 	public function checkNewMessages($lastDate) { | 	public function checkNewMessages($lastDate) { | ||||||
| 		$phoneList = $this->smsMapper->getNewMessagesCountForAllPhonesNumbers($this->userId, $lastDate); | 		$phoneList = $this->smsMapper->getNewMessagesCountForAllPhonesNumbers($this->userId, $lastDate); | ||||||
| 		$contactsSrc = $this->app->getContacts(); | 		$contactsSrc = $this->app->getContacts(); | ||||||
|  | 		$photosSrc = $this->app->getContactPhotos(); | ||||||
| 		$contacts = array(); | 		$contacts = array(); | ||||||
|  | 		$photos = array(); | ||||||
| 
 | 
 | ||||||
| 		$countPhone = count($phoneList); | 		$countPhone = count($phoneList); | ||||||
| 		foreach ($phoneList as $number => $ts) { | 		foreach ($phoneList as $number => $ts) { | ||||||
| @ -198,10 +200,11 @@ class SmsController extends Controller { | |||||||
| 				$fmtPN2 = preg_replace("#\/#","", $fmtPN); | 				$fmtPN2 = preg_replace("#\/#","", $fmtPN); | ||||||
| 				$contacts[$fmtPN] = $contactsSrc[$fmtPN]; | 				$contacts[$fmtPN] = $contactsSrc[$fmtPN]; | ||||||
| 				$contacts[$fmtPN2] = $contactsSrc[$fmtPN]; | 				$contacts[$fmtPN2] = $contactsSrc[$fmtPN]; | ||||||
|  | 				$photos[$fmtPN] = $photosSrc[$fmtPN]; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		return new JSONResponse(array("phonelist" => $phoneList, "contacts" => $contacts)); | 		return new JSONResponse(array("phonelist" => $phoneList, "contacts" => $contacts, "photos" => $photos)); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/** | 	/** | ||||||
|  | |||||||
| @ -88,8 +88,13 @@ var checkNewMessages = function() { | |||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
| 				if ($.inArray(peerLabel, bufferedContacts) == -1) { | 				if ($.inArray(peerLabel, bufferedContacts) == -1) { | ||||||
|  | 					$("div[mailbox-avatar='" + peerLabel + "']").remove(); | ||||||
| 					$("a[mailbox-label='" + peerLabel + "']").remove(); | 					$("a[mailbox-label='" + peerLabel + "']").remove(); | ||||||
| 					peerListBuf = '<li><a href="#" mailbox-navigation="' + idxVal2 + '" style="font-weight: bold;" mailbox-label="' + peerLabel + '">' + peerLabel + ' (' + val + ')</a></li>'; | 					peerListBuf += '<li><div class="ocsms-plavatar"'; | ||||||
|  | 					if (typeof jsondata['photos'][peerLabel] != 'undefined') { | ||||||
|  | 						peerListBuf += 'style="background-image: url(' + jsondata['photos'][peerLabel] + ');"'; | ||||||
|  | 					} | ||||||
|  | 					peerListBuf = '></div><a href="#" mailbox-navigation="' + idxVal2 + '" style="font-weight: bold;" mailbox-label="' + peerLabel + '">' + peerLabel + ' (' + val + ')</a></li>'; | ||||||
| 					$('#app-mailbox-peers ul').prepend(peerListBuf); | 					$('#app-mailbox-peers ul').prepend(peerListBuf); | ||||||
| 					bufferedContacts.push(peerLabel); | 					bufferedContacts.push(peerLabel); | ||||||
| 
 | 
 | ||||||
| @ -289,7 +294,6 @@ function fetchInitialPeerList(jsondata) { | |||||||
| 			peerLabel = fn; | 			peerLabel = fn; | ||||||
| 		} | 		} | ||||||
| 		if ($.inArray(peerLabel, bufferedContacts) == -1) { | 		if ($.inArray(peerLabel, bufferedContacts) == -1) { | ||||||
| 			//peerListBuf += '<li><a href="#" mailbox-navigation="' + idxVal2 + '" mailbox-label="' + peerLabel + '">' + peerLabel + '</a></li>';
 |  | ||||||
| 			peerListBuf += '<li><div class="ocsms-plavatar"'; | 			peerListBuf += '<li><div class="ocsms-plavatar"'; | ||||||
| 			if (typeof jsondata['photos'][peerLabel] != 'undefined') { | 			if (typeof jsondata['photos'][peerLabel] != 'undefined') { | ||||||
| 				peerListBuf += 'style="background-image: url(' + jsondata['photos'][peerLabel] + ');"'; | 				peerListBuf += 'style="background-image: url(' + jsondata['photos'][peerLabel] + ');"'; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user