Merge pull request #2686 from rabuzarus/2107-contact_edit

frio: templates for contact_edit and crepair
This commit is contained in:
Michael Vogel 2016-07-26 09:33:37 +02:00 committed by GitHub
commit 0deea97cf2
11 changed files with 315 additions and 71 deletions

View file

@ -7,10 +7,10 @@ function contact_profile_assign($current,$foreign_net) {
$disabled = (($foreign_net) ? ' disabled="true" ' : ''); $disabled = (($foreign_net) ? ' disabled="true" ' : '');
$o .= "<select id=\"contact-profile-selector\" $disabled name=\"profile-assign\" />\r\n"; $o .= "<select id=\"contact-profile-selector\" class=\"form-control\" $disabled name=\"profile-assign\" />\r\n";
$r = q("SELECT `id`, `profile-name` FROM `profile` WHERE `uid` = %d", $r = q("SELECT `id`, `profile-name` FROM `profile` WHERE `uid` = %d",
intval($_SESSION['uid'])); intval($_SESSION['uid']));
if(count($r)) { if(count($r)) {
foreach($r as $rr) { foreach($r as $rr) {

View file

@ -571,6 +571,7 @@ function contacts_content(&$a) {
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
//'$header' => t('Contact Editor'), //'$header' => t('Contact Editor'),
'$header' => t("Contact"),
'$tab_str' => $tab_str, '$tab_str' => $tab_str,
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$lbl_vis1' => t('Profile Visibility'), '$lbl_vis1' => t('Profile Visibility'),
@ -604,6 +605,7 @@ function contacts_content(&$a) {
'$ignore_text' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ), '$ignore_text' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ),
'$insecure' => (($contact['network'] !== NETWORK_DFRN && $contact['network'] !== NETWORK_MAIL && $contact['network'] !== NETWORK_FACEBOOK && $contact['network'] !== NETWORK_DIASPORA) ? $insecure : ''), '$insecure' => (($contact['network'] !== NETWORK_DFRN && $contact['network'] !== NETWORK_MAIL && $contact['network'] !== NETWORK_FACEBOOK && $contact['network'] !== NETWORK_DIASPORA) ? $insecure : ''),
'$info' => $contact['info'], '$info' => $contact['info'],
'$cinfo' => array('info', '', $contact['info'], ''),
'$blocked' => (($contact['blocked']) ? t('Currently blocked') : ''), '$blocked' => (($contact['blocked']) ? t('Currently blocked') : ''),
'$ignored' => (($contact['readonly']) ? t('Currently ignored') : ''), '$ignored' => (($contact['readonly']) ? t('Currently ignored') : ''),
'$archived' => (($contact['archive']) ? t('Currently archived') : ''), '$archived' => (($contact['archive']) ? t('Currently archived') : ''),
@ -620,6 +622,7 @@ function contacts_content(&$a) {
'$url' => $url, '$url' => $url,
'$profileurllabel' => t('Profile URL'), '$profileurllabel' => t('Profile URL'),
'$profileurl' => $contact['url'], '$profileurl' => $contact['url'],
'account_type' => (($contact['forum'] || $contact['prv']) ? t('Forum') : ''),
'$location' => bbcode($contact["location"]), '$location' => bbcode($contact["location"]),
'$location_label' => t("Location:"), '$location_label' => t("Location:"),
'$about' => bbcode($contact["about"], false, false), '$about' => bbcode($contact["about"], false, false),
@ -630,6 +633,7 @@ function contacts_content(&$a) {
'$contact_actions' => $contact_actions, '$contact_actions' => $contact_actions,
'$contact_status' => t("Status"), '$contact_status' => t("Status"),
'$contact_settings_label' => t('Contact Settings'), '$contact_settings_label' => t('Contact Settings'),
'$contact_profile_label' => t("Profile"),
)); ));

View file

@ -24,7 +24,7 @@ function crepair_init(&$a) {
if($contact_id) { if($contact_id) {
$a->data['contact'] = $r[0]; $a->data['contact'] = $r[0];
$contact = $r[0]; $contact = $r[0];
profile_load($a, "", 0, get_contact_details_by_url($contact["url"])); profile_load($a, "", 0, get_contact_details_by_url($contact["url"]));
} }
} }
@ -150,15 +150,9 @@ function crepair_content(&$a) {
'$return' => t('Return to contact editor'), '$return' => t('Return to contact editor'),
'$update_profile' => update_profile, '$update_profile' => update_profile,
'$udprofilenow' => t('Refetch contact data'), '$udprofilenow' => t('Refetch contact data'),
'$label_name' => t('Name'), '$contact_id' => $contact['id'],
'$label_nick' => t('Account Nickname'), '$lbl_submit' => t('Submit'),
'$label_attag' => t('@Tagname - overrides Name/Nickname'),
'$label_url' => t('Account URL'),
'$label_request' => t('Friend Request URL'),
'$label_confirm' => t('Friend Confirm URL'),
'$label_notify' => t('Notification Endpoint URL'),
'$label_poll' => t('Poll/Feed URL'),
'$label_photo' => t('New photo from this URL'),
'$label_remote_self' => t('Remote Self'), '$label_remote_self' => t('Remote Self'),
'$allow_remote_self' => $allow_remote_self, '$allow_remote_self' => $allow_remote_self,
'$remote_self' => array('remote_self', '$remote_self' => array('remote_self',
@ -167,16 +161,16 @@ function crepair_content(&$a) {
t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.'), t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.'),
$remote_self_options $remote_self_options
), ),
'$contact_name' => htmlentities($contact['name']),
'$contact_nick' => htmlentities($contact['nick']), '$name' => array('name', t('Name') , htmlentities($contact['name'])),
'$contact_id' => $contact['id'], '$nick' => array('nick', t('Account Nickname'), htmlentities($contact['nick'])),
'$contact_url' => $contact['url'], '$attag' => array('attag', t('@Tagname - overrides Name/Nickname'), $contact['attag']),
'$request' => $contact['request'], '$url' => array('url', t('Account URL'), $contact['url']),
'$confirm' => $contact['confirm'], '$request' => array('request', t('Friend Request URL'), $contact['request']),
'$notify' => $contact['notify'], 'confirm' => array('confirm', t('Friend Confirm URL'), $contact['confirm']),
'$poll' => $contact['poll'], 'notify' => array('notify', t('Notification Endpoint URL'), $contact['notify']),
'$contact_attag' => $contact['attag'], 'poll' => array('poll', t('Poll/Feed URL'), $contact['poll']),
'$lbl_submit' => t('Submit') 'photo' => array('photo', t('New photo from this URL'), ''),
)); ));
return $o; return $o;

View file

@ -1,6 +1,4 @@
{{if $header}}<h2>{{$header}}</h2>{{/if}}
<div id="contact-edit-wrapper" > <div id="contact-edit-wrapper" >
{{* Insert Tab-Nav *}} {{* Insert Tab-Nav *}}

View file

@ -11,56 +11,38 @@
<form id="crepair-form" action="crepair/{{$contact_id}}" method="post" > <form id="crepair-form" action="crepair/{{$contact_id}}" method="post" >
<!-- <h4>{{$contact_name}}</h4> --> <!-- <h4>{{$contact_name}}</h4> -->
<div id="contact-update-profile-wrapper"> <div id="contact-update-profile-wrapper">
{{if $update_profile}} {{if $update_profile}}
<span id="contact-update-profile-now" class="button"><a href="contacts/{{$contact_id}}/updateprofile" >{{$udprofilenow}}</a></span> <span id="contact-update-profile-now" class="button"><a href="contacts/{{$contact_id}}/updateprofile" >{{$udprofilenow}}</a></span>
{{/if}} {{/if}}
</div> </div>
<label id="crepair-name-label" class="crepair-label" for="crepair-name">{{$label_name}}</label> {{include file="field_input.tpl" field=$name}}
<input type="text" id="crepair-name" class="crepair-input" name="name" value="{{$contact_name|escape:'html'}}" />
<div class="clear"></div>
<label id="crepair-nick-label" class="crepair-label" for="crepair-nick">{{$label_nick}}</label> {{include file="field_input.tpl" field=$nick}}
<input type="text" id="crepair-nick" class="crepair-input" name="nick" value="{{$contact_nick|escape:'html'}}" />
<div class="clear"></div>
<label id="crepair-attag-label" class="crepair-label" for="crepair-attag">{{$label_attag}}</label> {{include file="field_input.tpl" field=$attag}}
<input type="text" id="crepair-attag" class="crepair-input" name="attag" value="{{$contact_attag|escape:'html'}}" />
<div class="clear"></div>
<label id="crepair-url-label" class="crepair-label" for="crepair-url">{{$label_url}}</label> {{include file="field_input.tpl" field=$url}}
<input type="text" id="crepair-url" class="crepair-input" name="url" value="{{$contact_url|escape:'html'}}" />
<div class="clear"></div>
<label id="crepair-request-label" class="crepair-label" for="crepair-request">{{$label_request}}</label> {{include file="field_input.tpl" field=$request}}
<input type="text" id="crepair-request" class="crepair-input" name="request" value="{{$request|escape:'html'}}" />
<div class="clear"></div>
<label id="crepair-confirm-label" class="crepair-label" for="crepair-confirm">{{$label_confirm}}</label>
<input type="text" id="crepair-confirm" class="crepair-input" name="confirm" value="{{$confirm|escape:'html'}}" />
<div class="clear"></div>
<label id="crepair-notify-label" class="crepair-label" for="crepair-notify">{{$label_notify}}</label> {{include file="field_input.tpl" field=$confirm}}
<input type="text" id="crepair-notify" class="crepair-input" name="notify" value="{{$notify|escape:'html'}}" />
<div class="clear"></div>
<label id="crepair-poll-label" class="crepair-label" for="crepair-poll">{{$label_poll}}</label> {{include file="field_input.tpl" field=$notify}}
<input type="text" id="crepair-poll" class="crepair-input" name="poll" value="{{$poll|escape:'html'}}" />
<div class="clear"></div>
<label id="crepair-photo-label" class="crepair-label" for="crepair-photo">{{$label_photo}}</label> {{include file="field_input.tpl" field=$poll}}
<input type="text" id="crepair-photo" class="crepair-input" name="photo" value="" />
<div class="clear"></div>
{{if $allow_remote_self eq 1}}
<h4>{{$label_remote_self}}</h4>
{{include file="field_select.tpl" field=$remote_self}}
{{/if}}
<input type="submit" name="submit" value="{{$lbl_submit|escape:'html'}}" /> {{include file="field_input.tpl" field=$photo}}
{{if $allow_remote_self eq 1}}
<h4>{{$label_remote_self}}</h4>
{{include file="field_select.tpl" field=$remote_self}}
{{/if}}
<input type="submit" name="submit" value="{{$lbl_submit|escape:'html'}}" />
</form> </form>

View file

@ -1794,8 +1794,8 @@ ul.dropdown-menu li:hover {
/* PAGES */ /* PAGES */
/* Profile-page */ /* Profile-page */
.generic-page-wrapper ,#profile-page, .profile_photo-content-wrapper, .photos-content-wrapper, .generic-page-wrapper ,#profile-page, .profile_photo-content-wrapper,
.contacts-content-wrapper, .suggest-content-wrapper, .common-content-wrapper, .suggest-content-wrapper, .common-content-wrapper,
.allfriends-content-wrapper, .match-content-wrapper, .dirfind-content-wrapper, .allfriends-content-wrapper, .match-content-wrapper, .dirfind-content-wrapper,
.directory-content-wrapper, .manage-content-wrapper, .notes-content-wrapper, .directory-content-wrapper, .manage-content-wrapper, .notes-content-wrapper,
.message-content-wrapper, .apps-content-wrapper, .notifications-content-wrapper, .message-content-wrapper, .apps-content-wrapper, .notifications-content-wrapper,
@ -1909,6 +1909,28 @@ ul li:hover .contact-wrapper a.contact-action-link:hover {
padding: 10px 0; padding: 10px 0;
} }
/* contact-edit */
#contact-edit-actions {
position: absolute;
}
#contact-edit-status-wrapper {
border: none;
background-color: #E1F5FE;
margin: 15px -15px;
}
#contact-edit-tools {
margin-left: -15px;
margin-right: -15px;
}
#contact-edit-tools > .panel {
padding-left: 15px;
padding-right: 15px;
}
#contact-edit-settings {
display: block;
margin: 0;
}
/* directory page */ /* directory page */
#directory-search-heading { #directory-search-heading {
padding-top: 10px; padding-top: 10px;

View file

@ -0,0 +1,192 @@
<div class="generic-page-wrapper">
{{if $header}}<h3>{{$header}}:&nbsp;{{$name}}{{if $account_type}}&nbsp;<small>({{$account_type}})</small>{{/if}}</h3>{{/if}}
<div id="contact-edit-wrapper" >
{{* Insert Tab-Nav *}}
{{$tab_str}}
<div id="contact-edit-content-wrapper">
<form action="contacts/{{$contact_id}}" method="post" >
{{* This is the Action menu where contact related actions like 'ignore', 'hide' can be performed *}}
<ul id="contact-edit-actions" class="nav nav-pills preferences">
<li class="dropdown pull-right">
<a class="btn btn-link btn-sm dropdown-toggle" type="button" id="contact-edit-actions-button" data-toggle="dropdown" aria-expanded="true">
<i class="fa fa-angle-down"></i>&nbsp;{{$contact_action_button}}
</a>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="contact-edit-actions-button" aria-haspopup="true" id="contact-actions-menu" >
{{if $lblsuggest}}<li role="menuitem"><a href="#" title="{{$contact_actions.suggest.title}}" onclick="window.location.href='{{$contact_actions.suggest.url}}'; return false;">{{$contact_actions.suggest.label}}</a></li>{{/if}}
{{if $poll_enabled}}<li role="menuitem"><a href="#" title="{{$contact_actions.update.title}}" onclick="window.location.href='{{$contact_actions.update.url}}'; return false;">{{$contact_actions.update.label}}</a></li>{{/if}}
<li class="divider"></li>
<li role="menuitem"><a href="#" title="{{$contact_actions.block.title}}" onclick="window.location.href='{{$contact_actions.block.url}}'; return false;">{{$contact_actions.block.label}}</a></li>
<li role="menuitem"><a href="#" title="{{$contact_actions.ignore.title}}" onclick="window.location.href='{{$contact_actions.ignore.url}}'; return false;">{{$contact_actions.ignore.label}}</a></li>
<li role="menuitem"><a href="#" title="{{$contact_actions.archive.title}}" onclick="window.location.href='{{$contact_actions.archive.url}}'; return false;">{{$contact_actions.archive.label}}</a></li>
<li role="menuitem"><a href="#" title="{{$contact_actions.delete.title}}" onclick="return confirmDelete();">{{$contact_actions.delete.label}}</a></li>
</ul>
</li>
</ul>
<div class="clear"></div>
<div id="contact-edit-status-wrapper">
<span id="contact-edit-contact-status">{{$contact_status}}</span>
{{* Block with status information about the contact *}}
<ul>
{{if $relation_text}}<li><div id="contact-edit-rel">{{$relation_text}}</div></li>{{/if}}
{{if $nettype}}<li><div id="contact-edit-nettype">{{$nettype}}</div></li>{{/if}}
{{if $poll_enabled}}
<li><div id="contact-edit-last-update-text">{{$lastupdtext}} <span id="contact-edit-last-updated">{{$last_update}}</span></div>
{{if $poll_interval}}
<span id="contact-edit-poll-text">{{$updpub}}</span> {{$poll_interval}}
{{/if}}
</li>
{{/if}}
{{if $lost_contact}}<li><div id="lost-contact-message">{{$lost_contact}}</div></li>{{/if}}
{{if $insecure}}<li><div id="insecure-message">{{$insecure}}</div></li> {{/if}}
{{if $blocked}}<li><div id="block-message">{{$blocked}}</div></li>{{/if}}
{{if $ignored}}<li><div id="ignore-message">{{$ignored}}</div></li>{{/if}}
{{if $archived}}<li><div id="archive-message">{{$archived}}</div></li>{{/if}}
</ul>
<ul>
<!-- <li><a href="network/0?nets=all&cid={{$contact_id}}" id="contact-edit-view-recent">{{$lblrecent}}</a></li> -->
{{if $follow}}<li><div id="contact-edit-follow"><a href="{{$follow}}">{{$follow_text}}</a></div></li>{{/if}}
</ul>
</div> {{* End of contact-edit-status-wrapper *}}
<div id="contact-edit-links-end"></div>
<div class="panel-group" id="contact-edit-tools" role="tablist" aria-multiselectable="true">
{{* Some information about the contact from the profile *}}
<div class="panel">
<div class="section-subtitle-wrapper" role="tab" id="contact-edit-profile">
<h4>
<a class="accordion-toggle" data-toggle="collapse" data-parent="#contact-edit-tools" href="#contact-edit-profile-collapse" aria-expanded="true" aria-controls="contact-edit-profile-collapse">
{{$contact_profile_label}}
</a>
</h4>
</div>
<div id="contact-edit-profile-collapse" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="contact-edit-profile">
<div class="section-content-tools-wrapper">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 text-muted">{{$profileurllabel}}</div><a target="blank" href="{{$url}}">{{$profileurl}}</a></dd></dl>
</div>
{{if $location}}
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<hr class="profile-separator">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 text-muted">{{$location_label}}</div>
<div class="col-lg-8 col-md-8 col-sm-8 col-xs-12">{{$location}}</div>
</div>
{{/if}}
{{if $keywords}}
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<hr class="profile-separator">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 text-muted">{$keywords_label}}</div>
<div class="col-lg-8 col-md-8 col-sm-8 col-xs-12">{{$keywords}}</div>
</div>
{{/if}}
{{if $about}}
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<hr class="profile-separator">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 text-muted">{{$about_label}}</div>
<div class="col-lg-8 col-md-8 col-sm-8 col-xs-12">{{$about}}</div>
</div>
{{/if}}
</div>
</div>
<div class="clear"></div>
</div>
<div class="panel">
<div class="section-subtitle-wrapper" role="tab" id="contact-edit-settings">
<h4>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#contact-edit-tools" href="#contact-edit-settings-collapse" aria-expanded="true" aria-controls="contact-edit-settings-collapse">
{{$contact_settings_label}}
</a>
</h4>
</div>
<div id="contact-edit-settings-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="contact-edit-settings">
<div class="section-content-tools-wrapper">
<input type="hidden" name="contact_id" value="{{$contact_id}}">
{{include file="field_checkbox.tpl" field=$notify}}
{{if $fetch_further_information}}
{{include file="field_select.tpl" field=$fetch_further_information}}
{{if $fetch_further_information.2 == 2 }} {{include file="field_textarea.tpl" field=$ffi_keyword_blacklist}} {{/if}}
{{/if}}
{{include file="field_checkbox.tpl" field=$hidden}}
<div class="form-group pull-right settings-submit-wrapper" >
<button type="submit" name="submit" class="btn btn-primary" value="{{$submit|escape:'html'}}">{{$submit}}</button>
</div>
<div class="clear"></div>
</div>
</div>
</div>
<div class="panel">
<div class="section-subtitle-wrapper" role="tab" id="contact-edit-info">
<h4>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#contact-edit-tools" href="#contact-edit-info-collapse" aria-expanded="true" aria-controls="contact-edit-info-collapse">
{{$lbl_info1}}
</a>
</h4>
</div>
<div id="contact-edit-info-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="contact-edit-info">
<div class="section-content-tools-wrapper">
{{include file="field_textarea.tpl" field=$cinfo}}
<div class="form-group pull-right settings-submit-wrapper" >
<button type="submit" name="submit" class="btn btn-primary" value="{{$submit|escape:'html'}}">{{$submit}}</button>
</div>
<div class="clear"></div>
</div>
</div>
</div>
<div class="panel">
<div class="section-subtitle-wrapper" role="tab" id="contact-edit-profile-select">
<h4>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#contact-edit-tools" href="#contact-edit-profile-select-collapse" aria-expanded="true" aria-controls="contact-edit-profile-select-collapse">
{{$lbl_vis1}}
</a>
</h4>
</div>
<div id="contact-edit-profile-select-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="contact-edit-profile-select">
{{if $profile_select}}
<div id="contact-edit-profile-select-text">
<p>{{$lbl_vis2}}</p>
</div>
<div class="form-group">
{{$profile_select}}
</div>
<div class="clear"></div>
{{/if}}
<div class="form-group pull-right settings-submit-wrapper" >
<button type="submit" name="submit" class="btn btn-primary" value="{{$submit|escape:'html'}}">{{$submit}}</button>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
</form>{{* End of the form *}}
</div>{{* End of contact-edit-content-wrapper *}}
</div>
</div>

View file

@ -1,5 +1,5 @@
<div id="contacts" class="standard-page"> <div id="contacts" class="generic-page-wrapper">
{{$tabs}} {{$tabs}}

View file

@ -0,0 +1,54 @@
<div id="crepair" class="generic-page-wrapper">
{{include file="section_title.tpl"}}
{{$tab_str}}
<div class="crepair-error-message">{{$warning}}</div><br>
<div class="crepair-return">
{{$info}}<br>
<!-- <a href="{{$returnaddr}}">{{$return}}</a> -->
</div>
<br />
<form id="crepair-form" action="crepair/{{$contact_id}}" method="post" >
<!-- <h4>{{$contact_name}}</h4> -->
<div id="contact-update-profile-wrapper">
{{if $update_profile}}
<span id="contact-update-profile-now" class="button"><a href="contacts/{{$contact_id}}/updateprofile" >{{$udprofilenow}}</a></span>
{{/if}}
</div>
{{include file="field_input.tpl" field=$name}}
{{include file="field_input.tpl" field=$nick}}
{{include file="field_input.tpl" field=$attag}}
{{include file="field_input.tpl" field=$url}}
{{include file="field_input.tpl" field=$request}}
{{include file="field_input.tpl" field=$confirm}}
{{include file="field_input.tpl" field=$notify}}
{{include file="field_input.tpl" field=$poll}}
{{include file="field_input.tpl" field=$photo}}
{{if $allow_remote_self eq 1}}
<h4>{{$label_remote_self}}</h4>
{{include file="field_select.tpl" field=$remote_self}}
{{/if}}
<div class="pull-right settings-submit-wrapper" >
<button type="submit" name="submit" class="btn btn-primary" value="{{$lbl_submit|escape:'html'}}">{{$lbl_submit|escape:'html'}}</button>
</div>
<div class="clear"></div>
</form>
</div>

View file

@ -18,7 +18,7 @@
</script> </script>
<div id="profile-page" class="standard-page"> <div id="profile-page" class="generic-page-wrapper">
<h3 class="">{{$title}}</h3> <h3 class="">{{$title}}</h3>
<ul id="profile-menu" class="nav nav-tabs" role="menubar" data-tabs="tabs"> <ul id="profile-menu" class="nav nav-tabs" role="menubar" data-tabs="tabs">

View file

@ -1,6 +1,4 @@
{{if $header}}<h2>{{$header}}</h2>{{/if}}
<div id="contact-edit-wrapper" > <div id="contact-edit-wrapper" >
{{* Insert Tab-Nav *}} {{* Insert Tab-Nav *}}