some heavy private mail restructuring - work in progress
This commit is contained in:
		| @@ -262,18 +262,30 @@ function private_messages_list($uid, $mailbox = '', $start = 0, $numitems = 0) { | |||||||
| 		); | 		); | ||||||
| 		if(! $x) | 		if(! $x) | ||||||
| 			return array(); | 			return array(); | ||||||
| 		if($mailbox === 'inbox') |  | ||||||
| 			$where = " and sender_xchan != '" . dbesc($x[0]['channel_hash']) . "' "; | 		$channel_hash = dbesc($x[0]['channel_hash']); | ||||||
| 		elseif($mailbox === 'outbox') | 		$local_channel = intval(local_channel()); | ||||||
| 			$where = " and sender_xchan  = '" . dbesc($x[0]['channel_hash']) . "' "; |  | ||||||
|  | 		switch($mailbox) { | ||||||
|  |  | ||||||
|  | 			case 'inbox': | ||||||
|  | 				$sql = "SELECT * FROM mail WHERE channel_id = $local_channel AND from_xchan != '$channel_hash' ORDER BY created DESC $limit"; | ||||||
|  | 				break; | ||||||
|  |  | ||||||
|  | 			case 'outbox': | ||||||
|  | 				$sql = "SELECT * FROM mail WHERE channel_id = $local_channel AND from_xchan = '$channel_hash' ORDER BY created DESC $limit"; | ||||||
|  | 				break; | ||||||
|  |  | ||||||
|  | 			case 'combined': | ||||||
|  | 				$sql = "SELECT * FROM ( SELECT * FROM mail WHERE channel_id = $local_channel ORDER BY created DESC $limit ) AS temp_table GROUP BY parent_mid ORDER BY created DESC"; | ||||||
|  | 				break; | ||||||
|  |  | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// For different orderings, consider applying usort on the results. We thought of doing that | 	$r = q($sql); | ||||||
| 	// inside this function or having some preset sorts, but don't wish to limit app developers.  |  | ||||||
| 		 |  | ||||||
| 	$r = q("SELECT * from mail WHERE channel_id = %d $where order by created desc $limit", |  | ||||||
| 		intval(local_channel()) |  | ||||||
| 	); |  | ||||||
| 	if(! $r) { | 	if(! $r) { | ||||||
| 		return array(); | 		return array(); | ||||||
| 	} | 	} | ||||||
| @@ -437,4 +449,4 @@ function private_messages_fetch_conversation($channel_id, $messageitem_id, $upda | |||||||
| 	 | 	 | ||||||
| 	return $messages; | 	return $messages; | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -185,11 +185,11 @@ EOT; | |||||||
| 		$nav['notifications']['all']=array('notifications/system', t('See all notifications'), "", ""); | 		$nav['notifications']['all']=array('notifications/system', t('See all notifications'), "", ""); | ||||||
| 		$nav['notifications']['mark'] = array('', t('Mark all system notifications seen'), '',''); | 		$nav['notifications']['mark'] = array('', t('Mark all system notifications seen'), '',''); | ||||||
|  |  | ||||||
| 		$nav['messages'] = array('message', t('Mail'), "", t('Private mail'),'mail_nav_btn'); | 		$nav['messages'] = array('mail/combined', t('Mail'), "", t('Private mail'),'mail_nav_btn'); | ||||||
| 		$nav['messages']['all']=array('message', t('See all private messages'), "", ""); | 		$nav['messages']['all']=array('mail/combined', t('See all private messages'), "", ""); | ||||||
| 		$nav['messages']['mark'] = array('', t('Mark all private messages seen'), '',''); | 		$nav['messages']['mark'] = array('', t('Mark all private messages seen'), '',''); | ||||||
| 		$nav['messages']['inbox'] = array('message', t('Inbox'), "", t('Inbox')); | 		$nav['messages']['inbox'] = array('mail/inbox', t('Inbox'), "", t('Inbox')); | ||||||
| 		$nav['messages']['outbox']= array('message/sent', t('Outbox'), "", t('Outbox')); | 		$nav['messages']['outbox']= array('mail/outbox', t('Outbox'), "", t('Outbox')); | ||||||
| 		$nav['messages']['new'] = array('mail/new', t('New Message'), "", t('New Message')); | 		$nav['messages']['new'] = array('mail/new', t('New Message'), "", t('New Message')); | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -562,14 +562,30 @@ function widget_mailmenu($arr) { | |||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
| 	$a = get_app(); | 	$a = get_app(); | ||||||
|  |  | ||||||
| 	return replace_macros(get_markup_template('message_side.tpl'), array( | 	return replace_macros(get_markup_template('message_side.tpl'), array( | ||||||
| 		'$title' => t('Messages'), | 		'$title' => t('Private Mail Menu'), | ||||||
| 		'$tabs'=> array(), |  | ||||||
| 		'$check'=>array( | 		'$check'=>array( | ||||||
| 			'label' => t('Check Mail'), | 			'label' => t('Check Mail'), | ||||||
| 			'url' => $a->get_baseurl(true) . '/message', | 			'url' => $a->get_baseurl(true) . '/mail/combined', | ||||||
| 			'sel' => (argv(1) == ''), | 			'sel' => (argv(1) == ''), | ||||||
| 		), | 		), | ||||||
|  |  | ||||||
|  | 		'$combined'=>array( | ||||||
|  | 			'label' => t('Combined View'), | ||||||
|  | 			'url' => $a->get_baseurl(true) . '/mail/combined', | ||||||
|  | 			'sel' => (argv(1) == 'combined'), | ||||||
|  | 		), | ||||||
|  | 		'$inbox'=>array( | ||||||
|  | 			'label' => t('Inbox'), | ||||||
|  | 			'url' => $a->get_baseurl(true) . '/mail/inbox', | ||||||
|  | 			'sel' => (argv(1) == 'inbox'), | ||||||
|  | 		), | ||||||
|  | 		'$outbox'=>array( | ||||||
|  | 			'label' => t('Outbox'), | ||||||
|  | 			'url' => $a->get_baseurl(true) . '/mail/outbox', | ||||||
|  | 			'sel' => (argv(1) == 'outbox'), | ||||||
|  | 		), | ||||||
| 		'$new'=>array( | 		'$new'=>array( | ||||||
| 			'label' => t('New Message'), | 			'label' => t('New Message'), | ||||||
| 			'url' => $a->get_baseurl(true) . '/mail/new', | 			'url' => $a->get_baseurl(true) . '/mail/new', | ||||||
| @@ -578,6 +594,78 @@ function widget_mailmenu($arr) { | |||||||
| 	)); | 	)); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | function widget_conversations($arr) { | ||||||
|  | 	if (! local_channel()) | ||||||
|  | 		return; | ||||||
|  |  | ||||||
|  | 	$a = get_app(); | ||||||
|  |  | ||||||
|  | 	if(argc() > 1) { | ||||||
|  |  | ||||||
|  | 		switch(argv(1)) { | ||||||
|  | 			case 'combined': | ||||||
|  | 				$mailbox = 'combined'; | ||||||
|  | 				$header = t('Conversations'); | ||||||
|  | 				break; | ||||||
|  | 			case 'inbox': | ||||||
|  | 				$mailbox = 'inbox'; | ||||||
|  | 				$header = t('Received Messages'); | ||||||
|  | 				break; | ||||||
|  | 			case 'outbox': | ||||||
|  | 				$mailbox = 'outbox'; | ||||||
|  | 				$header = t('Sent Messages'); | ||||||
|  | 				break; | ||||||
|  | 			default: | ||||||
|  | 				$mailbox = 'combined'; | ||||||
|  | 				$header = t('Conversations'); | ||||||
|  | 				break; | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		require_once('include/message.php'); | ||||||
|  |  | ||||||
|  | 		// private_messages_list() can do other more complicated stuff, for now keep it simple | ||||||
|  | 		$r = private_messages_list(local_channel(), $mailbox, $a->pager['start'], $a->pager['itemspage']); | ||||||
|  |  | ||||||
|  | 		if(! $r) { | ||||||
|  | 			info( t('No messages.') . EOL); | ||||||
|  | 			return $o; | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		$messages = array(); | ||||||
|  |  | ||||||
|  | 		foreach($r as $rr) { | ||||||
|  |  | ||||||
|  | 			$messages[] = array( | ||||||
|  | 				'id'           => $rr['id'], | ||||||
|  | 				'from_name'    => $rr['from']['xchan_name'], | ||||||
|  | 				'from_url'     => chanlink_hash($rr['from_xchan']), | ||||||
|  | 				'from_photo'   => $rr['from']['xchan_photo_s'], | ||||||
|  | 				'to_name'      => $rr['to']['xchan_name'], | ||||||
|  | 				'to_url'       => chanlink_hash($rr['to_xchan']), | ||||||
|  | 				'to_photo'     => $rr['to']['xchan_photo_s'], | ||||||
|  | 				'subject'      => (($rr['seen']) ? $rr['title'] : '<strong>' . $rr['title'] . '</strong>'), | ||||||
|  | 				'delete'       => t('Delete conversation'), | ||||||
|  | 				'body'         => $rr['body'], | ||||||
|  | 				'date'         => datetime_convert('UTC',date_default_timezone_get(),$rr['created'], t('D, d M Y - g:i A')), | ||||||
|  | 				'seen'         => $rr['seen'] | ||||||
|  | 			); | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		$tpl = get_markup_template('mail_head.tpl'); | ||||||
|  | 		$o .= replace_macros($tpl, array( | ||||||
|  | 			'$header' => $header, | ||||||
|  | 			'$messages' => $messages | ||||||
|  | 		)); | ||||||
|  |  | ||||||
|  | 		$o .= alt_pager($a,count($r)); | ||||||
|  |  | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	return $o; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
| function widget_design_tools($arr) { | function widget_design_tools($arr) { | ||||||
| 	$a = get_app(); | 	$a = get_app(); | ||||||
|  |  | ||||||
| @@ -594,6 +682,7 @@ function widget_design_tools($arr) { | |||||||
| 	return design_tools(); | 	return design_tools(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| function widget_findpeople($arr) { | function widget_findpeople($arr) { | ||||||
| 	return findpeople_widget(); | 	return findpeople_widget(); | ||||||
| } | } | ||||||
| @@ -1135,4 +1224,4 @@ function widget_admin($arr) { | |||||||
|  |  | ||||||
| 	return $o; | 	return $o; | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										191
									
								
								mod/mail.php
									
									
									
									
									
								
							
							
						
						
									
										191
									
								
								mod/mail.php
									
									
									
									
									
								
							| @@ -101,7 +101,7 @@ function mail_post(&$a) { | |||||||
| 		notice($ret['message']); | 		notice($ret['message']); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	goaway(z_root() . '/message'); | 	goaway(z_root() . '/mail/combined'); | ||||||
| 		 | 		 | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -137,7 +137,7 @@ function mail_content(&$a) { | |||||||
| 		if($r) { | 		if($r) { | ||||||
| 			info( t('Message deleted.') . EOL ); | 			info( t('Message deleted.') . EOL ); | ||||||
| 		} | 		} | ||||||
| 		goaway($a->get_baseurl(true) . '/message' ); | 		goaway($a->get_baseurl(true) . '/mail/combined' ); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if((argc() == 3) && (argv(1) === 'recall')) { | 	if((argc() == 3) && (argv(1) === 'recall')) { | ||||||
| @@ -153,7 +153,7 @@ function mail_content(&$a) { | |||||||
| 		if($r) { | 		if($r) { | ||||||
| 				info( t('Message recalled.') . EOL ); | 				info( t('Message recalled.') . EOL ); | ||||||
| 		} | 		} | ||||||
| 		goaway($a->get_baseurl(true) . '/message' ); | 		goaway($a->get_baseurl(true) . '/mail/combined' ); | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -249,117 +249,128 @@ function mail_content(&$a) { | |||||||
| 		return $o; | 		return $o; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	switch(argv(1)) { | ||||||
|  | 		case 'combined': | ||||||
|  | 			$mailbox = 'combined'; | ||||||
|  | 			break; | ||||||
|  | 		case 'inbox': | ||||||
|  | 			$mailbox = 'inbox'; | ||||||
|  | 			break; | ||||||
|  | 		case 'outbox': | ||||||
|  | 			$mailbox = 'outbox'; | ||||||
|  | 			break; | ||||||
|  | 		default: | ||||||
|  | 			$mailbox = 'combined'; | ||||||
|  | 			break; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	if((argc() > 1) && (intval(argv(1)))) { | 	$last_message = private_messages_list(local_channel(), $mailbox, 0, 1); | ||||||
|  |  | ||||||
| 		$o .= $header; | 	$mid = ((argc() > 1) && (intval(argv(1)))) ? argv(1) : $last_message[0]['id']; | ||||||
|  |  | ||||||
| 		$plaintext = true; | 	$plaintext = true; | ||||||
|  |  | ||||||
| //		if( local_channel() && feature_enabled(local_channel(),'richtext') ) | //	if( local_channel() && feature_enabled(local_channel(),'richtext') ) | ||||||
| //			$plaintext = false; | //		$plaintext = false; | ||||||
|  |  | ||||||
| 		$messages = private_messages_fetch_conversation(local_channel(), argv(1), true); | 	$messages = private_messages_fetch_conversation(local_channel(), $mid, true); | ||||||
|  |  | ||||||
| 		if(! $messages) { | 	if(! $messages) { | ||||||
| 			info( t('Message not found.') . EOL); | 		//info( t('Message not found.') . EOL); | ||||||
| 			return $o; | 		return; | ||||||
| 		} | 	} | ||||||
|  |  | ||||||
| 		if($messages[0]['to_xchan'] === $channel['channel_hash']) | 	if($messages[0]['to_xchan'] === $channel['channel_hash']) | ||||||
| 			$a->poi = $messages[0]['from']; | 		$a->poi = $messages[0]['from']; | ||||||
| 		else | 	else | ||||||
| 			$a->poi = $messages[0]['to']; | 		$a->poi = $messages[0]['to']; | ||||||
|  |  | ||||||
| //		require_once('include/Contact.php'); | //	require_once('include/Contact.php'); | ||||||
|  |  | ||||||
| //		$a->set_widget('mail_conversant',vcard_from_xchan($a->poi,$get_observer_hash,'mail')); | //	$a->set_widget('mail_conversant',vcard_from_xchan($a->poi,$get_observer_hash,'mail')); | ||||||
|  |  | ||||||
|  |  | ||||||
| 		$tpl = get_markup_template('msg-header.tpl'); | 	$tpl = get_markup_template('msg-header.tpl'); | ||||||
| 	 | 	 | ||||||
| 		$a->page['htmlhead'] .= replace_macros($tpl, array( | 	$a->page['htmlhead'] .= replace_macros($tpl, array( | ||||||
| 			'$nickname' => $channel['channel_address'], | 		'$nickname' => $channel['channel_address'], | ||||||
| 			'$baseurl' => $a->get_baseurl(true), | 		'$baseurl' => $a->get_baseurl(true), | ||||||
| 			'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), | 		'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), | ||||||
| 			'$linkurl' => t('Please enter a link URL:'), | 		'$linkurl' => t('Please enter a link URL:'), | ||||||
| 			'$expireswhen' => t('Expires YYYY-MM-DD HH:MM') | 		'$expireswhen' => t('Expires YYYY-MM-DD HH:MM') | ||||||
| 		)); | 	)); | ||||||
|  |  | ||||||
|  | 	$mails = array(); | ||||||
|  |  | ||||||
| 		$mails = array(); | 	$seen = 0; | ||||||
| 		$seen = 0; | 	$unknown = false; | ||||||
| 		$unknown = false; |  | ||||||
|  |  | ||||||
| 		foreach($messages as $message) { | 	foreach($messages as $message) { | ||||||
|  |  | ||||||
| 			$s = theme_attachments($message); | 		$s = theme_attachments($message); | ||||||
|  |  | ||||||
| 			$mails[] = array( | 		$mails[] = array( | ||||||
| 				'id' => $message['id'], | 			'id' => $message['id'], | ||||||
| 				'from_name' => $message['from']['xchan_name'], | 			'from_name' => $message['from']['xchan_name'], | ||||||
| 				'from_url' =>  chanlink_hash($message['from_xchan']), | 			'from_url' =>  chanlink_hash($message['from_xchan']), | ||||||
| 				'from_photo' => $message['from']['xchan_photo_m'], | 			'from_photo' => $message['from']['xchan_photo_m'], | ||||||
| 				'to_name' => $message['to']['xchan_name'], | 			'to_name' => $message['to']['xchan_name'], | ||||||
| 				'to_url' =>  chanlink_hash($message['to_xchan']), | 			'to_url' =>  chanlink_hash($message['to_xchan']), | ||||||
| 				'to_photo' => $message['to']['xchan_photo_m'], | 			'to_photo' => $message['to']['xchan_photo_m'], | ||||||
| 				'subject' => $message['title'], | 			'subject' => $message['title'], | ||||||
| 				'body' => smilies(bbcode($message['body']) . $s), | 			'body' => smilies(bbcode($message['body']) . $s), | ||||||
| 				'delete' => t('Delete message'), | 			'delete' => t('Delete message'), | ||||||
| 				'recall' => t('Recall message'), | 			'recall' => t('Recall message'), | ||||||
| 				'can_recall' => (($channel['channel_hash'] == $message['from_xchan']) ? true : false), | 			'can_recall' => (($channel['channel_hash'] == $message['from_xchan']) ? true : false), | ||||||
| 				'is_recalled' => (intval($message['mail_recalled']) ? t('Message has been recalled.') : ''), | 			'is_recalled' => (intval($message['mail_recalled']) ? t('Message has been recalled.') : ''), | ||||||
| 				'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'],'D, d M Y - g:i A'), | 			'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'],'D, d M Y - g:i A'), | ||||||
| 			); | 		); | ||||||
| 				 | 				 | ||||||
| 			$seen = $message['seen']; | 		$seen = $message['seen']; | ||||||
|  |  | ||||||
| 		} | 	} | ||||||
|  |  | ||||||
| 		$recp = (($message['from_xchan'] === $channel['channel_hash']) ? 'to' : 'from'); | 	$recp = (($message['from_xchan'] === $channel['channel_hash']) ? 'to' : 'from'); | ||||||
|  |  | ||||||
| // FIXME - move this HTML to template | // FIXME - move this HTML to template | ||||||
|  |  | ||||||
| 		$select = $message[$recp]['xchan_name'] . '<input type="hidden" name="messageto" value="' . $message[$recp]['xchan_hash'] . '" />'; | 	$select = $message[$recp]['xchan_name'] . '<input type="hidden" name="messageto" value="' . $message[$recp]['xchan_hash'] . '" />'; | ||||||
| 		$parent = '<input type="hidden" name="replyto" value="' . $message['parent_mid'] . '" />'; | 	$parent = '<input type="hidden" name="replyto" value="' . $message['parent_mid'] . '" />'; | ||||||
|  | 	$tpl = get_markup_template('mail_display.tpl'); | ||||||
| 		$tpl = get_markup_template('mail_display.tpl'); | 	$o = replace_macros($tpl, array( | ||||||
| 		$o = replace_macros($tpl, array( | 		'$prvmsg_header' => t('Subject:') . ' ' . $message['title'], | ||||||
| 			'$prvmsg_header' => t('Private Conversation'), | 		'$thread_id' => $mid, | ||||||
| 			'$thread_id' => $a->argv[1], | 		'$thread_subject' => $message['title'], | ||||||
| 			'$thread_subject' => $message['title'], | 		'$thread_seen' => $seen, | ||||||
| 			'$thread_seen' => $seen, | 		'$delete' =>  t('Delete Conversation'), | ||||||
| 			'$delete' =>  t('Delete conversation'), | 		'$canreply' => (($unknown) ? false : '1'), | ||||||
| 			'$canreply' => (($unknown) ? false : '1'), | 		'$unknown_text' => t("No secure communications available. You <strong>may</strong> be able to respond from the sender's profile page."), | ||||||
| 			'$unknown_text' => t("No secure communications available. You <strong>may</strong> be able to respond from the sender's profile page."),			 | 		'$mails' => $mails, | ||||||
| 			'$mails' => $mails, |  | ||||||
| 			 | 			 | ||||||
| 			// reply | 		// reply | ||||||
| 			'$header' => t('Send Reply'), | 		'$header' => t('Send Reply'), | ||||||
| 			'$to' => t('To:'), | 		'$to' => t('To:'), | ||||||
| 			'$showinputs' => '', | 		'$showinputs' => '', | ||||||
| 			'$subject' => t('Subject:'), | 		'$subject' => t('Subject:'), | ||||||
| 			'$subjtxt' => $message['title'], | 		'$subjtxt' => $message['title'], | ||||||
| 			'$readonly' => ' readonly="readonly" style="background: #BBBBBB;" ', | 		'$readonly' => ' readonly="readonly" style="background: #BBBBBB;" ', | ||||||
| 			'$yourmessage' => t('Your message:'), | 		'$yourmessage' => t('Your message:'), | ||||||
| 			'$text' => '', | 		'$text' => '', | ||||||
| 			'$select' => $select, | 		'$select' => $select, | ||||||
| 			'$parent' => $parent, | 		'$parent' => $parent, | ||||||
| 			'$upload' => t('Upload photo'), | 		'$upload' => t('Upload photo'), | ||||||
| 			'$attach' => t('Attach file'), | 		'$attach' => t('Attach file'), | ||||||
| 			'$insert' => t('Insert web link'), | 		'$insert' => t('Insert web link'), | ||||||
| 			'$submit' => t('Submit'), | 		'$submit' => t('Submit'), | ||||||
| 			'$wait' => t('Please wait'), | 		'$wait' => t('Please wait'), | ||||||
| 			'$defexpire' => '', | 		'$defexpire' => '', | ||||||
| 			'$feature_expire' => ((feature_enabled(local_channel(),'content_expire')) ? true : false), | 		'$feature_expire' => ((feature_enabled(local_channel(),'content_expire')) ? true : false), | ||||||
| 			'$expires' => t('Set expiration date'), | 		'$expires' => t('Set expiration date'), | ||||||
| 			'$feature_encrypt' => ((feature_enabled(local_channel(),'content_encrypt')) ? true : false), | 		'$feature_encrypt' => ((feature_enabled(local_channel(),'content_encrypt')) ? true : false), | ||||||
| 			'$encrypt' => t('Encrypt text'), | 		'$encrypt' => t('Encrypt text'), | ||||||
| 			'$cipher' => $cipher, | 		'$cipher' => $cipher, | ||||||
|  | 	)); | ||||||
|  |  | ||||||
| 		)); | 	return $o; | ||||||
|  |  | ||||||
| 		return $o; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -25,8 +25,6 @@ function message_content(&$a) { | |||||||
| 		$cipher = 'aes256'; | 		$cipher = 'aes256'; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	if((argc() == 3) && (argv(1) === 'dropconv')) { | 	if((argc() == 3) && (argv(1) === 'dropconv')) { | ||||||
| 		if(! intval(argv(2))) | 		if(! intval(argv(2))) | ||||||
| 			return; | 			return; | ||||||
| @@ -34,14 +32,31 @@ function message_content(&$a) { | |||||||
| 		$r = private_messages_drop(local_channel(), argv(2), true); | 		$r = private_messages_drop(local_channel(), argv(2), true); | ||||||
| 		if($r) | 		if($r) | ||||||
| 			info( t('Conversation removed.') . EOL ); | 			info( t('Conversation removed.') . EOL ); | ||||||
| 		goaway($a->get_baseurl(true) . '/message' ); | 		goaway($a->get_baseurl(true) . '/mail/combined' ); | ||||||
| 	} | 	} | ||||||
| 	if(argc() == 1) { | /* | ||||||
|  | 	if(argc() == 2) { | ||||||
|  |  | ||||||
|  | 		switch(argv(1)) { | ||||||
|  | 			case 'combined': | ||||||
|  | 				$mailbox = 'combined'; | ||||||
|  | 				$header = t('Conversations'); | ||||||
|  | 				break; | ||||||
|  | 			case 'inbox': | ||||||
|  | 				$mailbox = 'inbox'; | ||||||
|  | 				$header = t('Received Messages'); | ||||||
|  | 				break; | ||||||
|  | 			case 'outbox': | ||||||
|  | 				$mailbox = 'outbox'; | ||||||
|  | 				$header = t('Sent Messages'); | ||||||
|  | 				break; | ||||||
|  | 			default: | ||||||
|  | 				break; | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 		// private_messages_list() can do other more complicated stuff, for now keep it simple | 		// private_messages_list() can do other more complicated stuff, for now keep it simple | ||||||
|  |  | ||||||
| 		$r = private_messages_list(local_channel(), '', $a->pager['start'], $a->pager['itemspage']); | 		$r = private_messages_list(local_channel(), $mailbox, $a->pager['start'], $a->pager['itemspage']); | ||||||
|  |  | ||||||
| 		if(! $r) { | 		if(! $r) { | ||||||
| 			info( t('No messages.') . EOL); | 			info( t('No messages.') . EOL); | ||||||
| @@ -51,6 +66,7 @@ function message_content(&$a) { | |||||||
| 		$messages = array(); | 		$messages = array(); | ||||||
|  |  | ||||||
| 		foreach($r as $rr) { | 		foreach($r as $rr) { | ||||||
|  |  | ||||||
| 			$messages[] = array( | 			$messages[] = array( | ||||||
| 				'id'         => $rr['id'], | 				'id'         => $rr['id'], | ||||||
| 				'from_name'  => $rr['from']['xchan_name'], | 				'from_name'  => $rr['from']['xchan_name'], | ||||||
| @@ -70,14 +86,19 @@ function message_content(&$a) { | |||||||
|  |  | ||||||
| 		$tpl = get_markup_template('mail_head.tpl'); | 		$tpl = get_markup_template('mail_head.tpl'); | ||||||
| 		$o = replace_macros($tpl, array( | 		$o = replace_macros($tpl, array( | ||||||
| 			'$header' => t('Messages'), | 			'$header' => $header, | ||||||
| 			'$messages' => $messages | 			'$messages' => $messages | ||||||
| 		)); | 		)); | ||||||
|  |  | ||||||
|  |  | ||||||
| 		$o .= alt_pager($a,count($r));	 | 		$o .= alt_pager($a,count($r));	 | ||||||
|  |  | ||||||
| 		return $o; | 		return $o; | ||||||
|  |  | ||||||
|  | 		return; | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
|  | */ | ||||||
|  |  | ||||||
|  | 	return; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -122,3 +122,4 @@ li:hover .group-edit-icon { | |||||||
| #tasklist-new-summary { | #tasklist-new-summary { | ||||||
| 	width: 250px; | 	width: 250px; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,5 +2,4 @@ $(document).ready(function() { | |||||||
| 	$("#recip").contact_autocomplete(baseurl + '/acl', '', false, function(data) { | 	$("#recip").contact_autocomplete(baseurl + '/acl', '', false, function(data) { | ||||||
| 		$("#recip-complete").val(data.xid); | 		$("#recip-complete").val(data.xid); | ||||||
| 	}); | 	}); | ||||||
|  |  | ||||||
| });  | });  | ||||||
|   | |||||||
| @@ -1,3 +1,4 @@ | |||||||
| [region=aside] | [region=aside] | ||||||
| [widget=vcard][/widget] | [widget=mailmenu][/widget] | ||||||
|  | [widget=conversations][/widget] | ||||||
| [/region] | [/region] | ||||||
|   | |||||||
| @@ -1305,6 +1305,10 @@ a.rconnect:hover, a.rateme:hover, div.rateme:hover { | |||||||
| 	padding: 0; | 	padding: 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | .widget .conv-participants { | ||||||
|  | 	color: $font_colour; | ||||||
|  | } | ||||||
|  |  | ||||||
| .notif-item a { | .notif-item a { | ||||||
| 	color: #000; | 	color: #000; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,6 +1,8 @@ | |||||||
| <div class="generic-content-wrapper"> | <div class="generic-content-wrapper"> | ||||||
| 	<div class="section-title-wrapper"> | 	<div class="section-title-wrapper"> | ||||||
|  | 		<a class="btn btn-xs btn-danger pull-right" href="message/dropconv/{{$thread_id}}" onclick="return confirmDelete();"><i class="icon-trash"></i> {{$delete}}</a> | ||||||
| 		<h2>{{$prvmsg_header}}</h2> | 		<h2>{{$prvmsg_header}}</h2> | ||||||
|  |  | ||||||
| 	</div> | 	</div> | ||||||
| 	<div class="section-content-wrapper"> | 	<div class="section-content-wrapper"> | ||||||
| 		{{foreach $mails as $mail}} | 		{{foreach $mails as $mail}} | ||||||
|   | |||||||
| @@ -1,10 +1,8 @@ | |||||||
| <div class="generic-content-wrapper"> | <div class="widget"> | ||||||
| 	<div class="section-title-wrapper"> | 	<h3>{{$header}}</h3> | ||||||
| 		<h2>{{$header}}</h2> | 	<ul class="nav nav-pills nav-stacked"> | ||||||
| 	</div> | 	{{foreach $messages as $message}} | ||||||
| 	<div class="section-content-wrapper"> | 		{{include file="mail_list.tpl"}} | ||||||
| 		{{foreach $messages as $message}} | 	{{/foreach}} | ||||||
| 			{{include file="mail_list.tpl"}} | 	</ul> | ||||||
| 		{{/foreach}} |  | ||||||
| 	</div> |  | ||||||
| </div> | </div> | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| <a href="{{$message.from_url}}" class ="mail-list" ><img class="mail-list-sender-photo" src="{{$message.from_photo}}" alt="{{$message.from_name}}" /></a> | <li> | ||||||
| <span class="mail-list">{{$message.from_name}}</span> | 	<a href="mail/{{$message.id}}" class="mail-link"> | ||||||
| <span class="mail-list {{if $message.seen}}seen{{else}}unseen{{/if}}"><a href="mail/{{$message.id}}" class="mail-link">{{$message.subject}}</a></span> | 		<span class="{{if $message.seen}}seen{{else}}unseen{{/if}}">{{$message.subject}}</span><br> | ||||||
| <span class="mail-list" title="{{$message.date}}">{{$message.date}}</span> | 		<span class="conv-participants">{{$message.from_name}} > {{$message.to_name}}</span><br> | ||||||
| <span class="mail-list mail-list-remove" class="btn btn-default btn-sm"><a href="message/dropconv/{{$message.id}}" onclick="return confirmDelete();"  title="{{$message.delete}}"  class="btn btn-default btn-sm" ><i class="icon-trash mail-icons drop-icons"></i></a></span> | 		<span class="wall-item-ago autotime" title="{{$message.date}}">{{$message.date}}</span> | ||||||
| <div class="clear"></div> | 	</a> | ||||||
|  | </li> | ||||||
|   | |||||||
| @@ -1,13 +1,18 @@ | |||||||
| <div class="widget"> | <div class="widget"> | ||||||
| 	<h3>{{$title}}</h3> | 	<h3>{{$title}}</h3> | ||||||
| 	<ul class="nav nav-pills nav-stacked"> | 	<ul class="nav nav-pills nav-stacked"> | ||||||
| 		<li><a href="{{$check.url}}"{{if $check.sel}} class="checkmessage-selected"{{/if}}>{{$check.label}}</a></li> | 		<li><a href="{{$check.url}}"{{if $check.sel}} class="active"{{/if}}>{{$check.label}}</a></li> | ||||||
| 		<li><a href="{{$new.url}}"{{if $new.sel}} class="newmessage-selected"{{/if}}>{{$new.label}}</a></li> | 	{{* | ||||||
|  | 		<li><a href="{{$combined.url}}"{{if $combined.sel}} class="active"{{/if}}>{{$combined.label}}</a></li> | ||||||
|  | 		<li><a href="{{$inbox.url}}"{{if $inbox.sel}} class="active"{{/if}}>{{$inbox.label}}</a></li> | ||||||
|  | 		<li><a href="{{$outbox.url}}"{{if $outbox.sel}} class="active"{{/if}}>{{$outbox.label}}</a></li> | ||||||
|  | 	*}} | ||||||
|  | 		<li><a href="{{$new.url}}"{{if $new.sel}} class="active"{{/if}}>{{$new.label}}</a></li> | ||||||
| 	</ul> | 	</ul> | ||||||
| 	{{if $tabs}} | 	{{if $tabs}} | ||||||
| 	<ul class="nav nav-pills nav-stacked"> | 	<ul class="nav nav-pills nav-stacked"> | ||||||
| 		{{foreach $tabs as $t}} | 		{{foreach $tabs as $t}} | ||||||
| 			<li><a href="{{$t.url}}"{{if $t.sel}} class="message-selected"{{/if}}>{{$t.label}}</a></li> | 			<li><a href="{{$t.url}}"{{if $t.sel}} class="active"{{/if}}>{{$t.label}}</a></li> | ||||||
| 		{{/foreach}} | 		{{/foreach}} | ||||||
| 	</ul> | 	</ul> | ||||||
| 	{{/if}} | 	{{/if}} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user