freeform text area for private contact info - notes or things you just want to remember (addresses, phone numbers, birthdays, whatever)

This commit is contained in:
Friendika 2010-12-28 01:06:34 -08:00
parent 76d92d3f62
commit 7b6385df94
7 changed files with 60 additions and 2 deletions

View File

@ -2,7 +2,7 @@
set_time_limit(0);
define ( 'BUILD_ID', 1029 );
define ( 'BUILD_ID', 1030 );
define ( 'DFRN_PROTOCOL_VERSION', '2.0' );
define ( 'EOL', "<br />\r\n" );

View File

@ -87,6 +87,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
`pending` tinyint(1) NOT NULL DEFAULT '1',
`rating` tinyint(1) NOT NULL DEFAULT '0',
`reason` text NOT NULL,
`info` MEDIUMTEXT NOT NULL AFTER `reason`,
`profile-id` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `uid` (`uid`),

View File

@ -65,12 +65,15 @@ function contacts_post(&$a) {
$reason = notags(trim($_POST['reason']));
$r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `rating` = %d, `reason` = '%s'
$info = escape_tags(trim($_POST['info']));
$r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `rating` = %d, `reason` = '%s', `info` = '%s'
WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($profile_id),
intval($priority),
intval($rating),
dbesc($reason),
dbesc($info),
intval($contact_id),
intval(local_user())
);
@ -190,6 +193,8 @@ function contacts_content(&$a) {
return;
}
$tpl = load_view_file('view/contact_head.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl()));
require_once('include/contact_selectors.php');
@ -239,6 +244,7 @@ function contacts_content(&$a) {
'$block_text' => (($r[0]['blocked']) ? t('Unblock this contact') : t('Block this contact') ),
'$ignore_text' => (($r[0]['readonly']) ? t('Unignore this contact') : t('Ignore this contact') ),
'$insecure' => (($r[0]['network'] === 'dfrn') ? '' : load_view_file('view/insecure_net.tpl')),
'$info' => $r[0]['info'],
'$blocked' => (($r[0]['blocked']) ? '<div id="block-message">' . t('Currently blocked') . '</div>' : ''),
'$ignored' => (($r[0]['readonly']) ? '<div id="ignore-message">' . t('Currently ignored') . '</div>' : ''),
'$rating' => contact_reputation($r[0]['rating']),

View File

@ -274,3 +274,6 @@ function update_1028() {
q("ALTER TABLE `user` ADD `openidserver` text NOT NULL AFTER `deny_gid` ");
}
function update_1029() {
q("ALTER TABLE `contact` ADD `info` MEDIUMTEXT NOT NULL AFTER `reason` ");
}

31
view/contact_head.tpl Normal file
View File

@ -0,0 +1,31 @@
<script language="javascript" type="text/javascript"
src="$baseurl/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
theme : "advanced",
mode : "exact",
elements: "contact-edit-info",
plugins : "bbcode",
theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "center",
theme_advanced_styles : "Code=codeStyle;Quote=quoteStyle",
content_css : "bbcode.css",
entity_encoding : "raw",
add_unload_trigger : false,
remove_linebreaks : false,
force_p_newlines : false,
force_br_newlines : true,
forced_root_block : '',
content_css: "$baseurl/view/custom_tinymce.css"
});
</script>

View File

@ -38,6 +38,14 @@ $ignored
<form action="contacts/$contact_id" method="post" >
<input type="hidden" name="contact_id" value="$contact_id">
<div id="contact-edit-info-wrapper">
<h4>Contact Information / Notes</h4>
<textarea id="contact-edit-info" rows="10" cols="72" name="info" >$info</textarea>
</div>
<div id="contact-edit-info-end"></div>
<input class="contact-edit-submit" type="submit" name="submit" value="Submit" />
<div id="contact-edit-profile-select-text">
<h4>Profile Visibility</h4>
<p>Please choose the profile you would like to display to $name when viewing your profile securely.

View File

@ -38,6 +38,15 @@ $ignored
<form action="contacts/$contact_id" method="post" >
<input type="hidden" name="contact_id" value="$contact_id">
<div id="contact-edit-info-wrapper">
<h4>Informazioni di contatto / Note</h4>
<textarea id="contact-edit-info" rows="10" cols="72" name="info" >$info</textarea>
</div>
<div id="contact-edit-info-end"></div>
<input class="contact-edit-submit" type="submit" name="submit" value="Aggiorna" />
<div id="contact-edit-profile-select-text">
<h4>Visibilt&agrave; Profiloe</h4>
<p>Scegli il profilo che vuoi mostrare a $name quando guarda il tuo profilo in modo sicuro.</p>