[smarcet] - #7793
* Option to upgrade/downgrade user member level Conflicts: deployment_utils/deployment.sh
This commit is contained in:
parent
a541409705
commit
844218a924
@ -38,7 +38,6 @@ final class FoundationMember
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function isFoundationMember(){
|
public function isFoundationMember(){
|
||||||
$res = false;
|
|
||||||
$res = $this->owner->inGroup(IFoundationMember::FoundationMemberGroupSlug);
|
$res = $this->owner->inGroup(IFoundationMember::FoundationMemberGroupSlug);
|
||||||
$legal_agreements = DataObject::get("LegalAgreement", " LegalDocumentPageID=422 AND MemberID =" . $this->owner->ID);
|
$legal_agreements = DataObject::get("LegalAgreement", " LegalDocumentPageID=422 AND MemberID =" . $this->owner->ID);
|
||||||
$res = $res && $legal_agreements->count() > 0;
|
$res = $res && $legal_agreements->count() > 0;
|
||||||
@ -74,12 +73,12 @@ final class FoundationMember
|
|||||||
public function resign(){
|
public function resign(){
|
||||||
// Remove member from Foundation group
|
// Remove member from Foundation group
|
||||||
foreach($this->owner->Groups() as $g){
|
foreach($this->owner->Groups() as $g){
|
||||||
$this->owner->Groups()->remove($g->ID);
|
$this->owner->Groups()->remove($g);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove member mamaged companies
|
// Remove member mamaged companies
|
||||||
foreach($this->owner->ManagedCompanies() as $c){
|
foreach($this->owner->ManagedCompanies() as $c){
|
||||||
$this->owner->ManagedCompanies()->remove($c->ID);
|
$this->owner->ManagedCompanies()->remove($c);
|
||||||
}
|
}
|
||||||
// Remove Member's Legal Agreements
|
// Remove Member's Legal Agreements
|
||||||
$legal_agreements = $this->owner->LegalAgreements();
|
$legal_agreements = $this->owner->LegalAgreements();
|
||||||
@ -105,4 +104,12 @@ final class FoundationMember
|
|||||||
$is_foundation_member = $this->isFoundationMember();
|
$is_foundation_member = $this->isFoundationMember();
|
||||||
return $group || $is_speaker || $is_foundation_member;
|
return $group || $is_speaker || $is_foundation_member;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isSpeaker() {
|
||||||
|
$is_speaker = DataObject::get_one('Speaker', 'MemberID = '. $this->owner->ID);
|
||||||
|
return $is_speaker;
|
||||||
|
}
|
||||||
}
|
}
|
@ -56,6 +56,7 @@ class FeedbackForm extends Form {
|
|||||||
|
|
||||||
// Redirect back to the page with a success message
|
// Redirect back to the page with a success message
|
||||||
$form->controller->setMessage('Success', 'Thanks for providing feedback to improve the OpenStack website!');
|
$form->controller->setMessage('Success', 'Thanks for providing feedback to improve the OpenStack website!');
|
||||||
|
|
||||||
$form->controller->redirectBack();
|
$form->controller->redirectBack();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -21,7 +21,9 @@ class AffiliationController extends Page_Controller
|
|||||||
'GetAffiliation',
|
'GetAffiliation',
|
||||||
'ListAffiliations',
|
'ListAffiliations',
|
||||||
'ListOrganizations',
|
'ListOrganizations',
|
||||||
'AffiliationsCount'
|
'AffiliationsCount',
|
||||||
|
'Downgrade2CommunityMember',
|
||||||
|
'Upgrade2FoundationMember',
|
||||||
);
|
);
|
||||||
|
|
||||||
function init()
|
function init()
|
||||||
@ -198,4 +200,23 @@ class AffiliationController extends Page_Controller
|
|||||||
}
|
}
|
||||||
echo json_encode('ERROR');
|
echo json_encode('ERROR');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function Downgrade2CommunityMember(){
|
||||||
|
if ($CurrentMember = Member::currentUser()) {
|
||||||
|
$CurrentMember->convert2SiteUser();
|
||||||
|
echo json_encode('OK');
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
echo json_encode('ERROR');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function Upgrade2FoundationMember(){
|
||||||
|
if ($CurrentMember = Member::currentUser()) {
|
||||||
|
$CurrentMember->upgradeToFoundationMember();
|
||||||
|
echo json_encode('OK');
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
echo json_encode('ERROR');
|
||||||
|
}
|
||||||
}
|
}
|
@ -77,8 +77,10 @@ class EditProfilePage_Controller extends Page_Controller
|
|||||||
Requirements::javascript("themes/openstack/javascript/jquery.ui.datepicker.validation.package-1.0.1/jquery.ui.datepicker.validation.js");
|
Requirements::javascript("themes/openstack/javascript/jquery.ui.datepicker.validation.package-1.0.1/jquery.ui.datepicker.validation.js");
|
||||||
Requirements::javascript("themes/openstack/javascript/jquery.validate.custom.methods.js");
|
Requirements::javascript("themes/openstack/javascript/jquery.validate.custom.methods.js");
|
||||||
Requirements::javascript("registration/javascript/affiliations.js");
|
Requirements::javascript("registration/javascript/affiliations.js");
|
||||||
|
Requirements::javascript('themes/openstack/javascript/current.user.infobox.jquery.js');
|
||||||
Requirements::javascript('registration/javascript/edit.profile.page.js');
|
Requirements::javascript('registration/javascript/edit.profile.page.js');
|
||||||
|
|
||||||
|
|
||||||
$this->course_repository = new SapphireCourseRepository;
|
$this->course_repository = new SapphireCourseRepository;
|
||||||
$this->training_repository = new SapphireTrainingServiceRepository;
|
$this->training_repository = new SapphireTrainingServiceRepository;
|
||||||
|
|
||||||
@ -666,4 +668,12 @@ class EditProfilePage_Controller extends Page_Controller
|
|||||||
$this->extend('getNavActionsExtensions',$html);
|
$this->extend('getNavActionsExtensions',$html);
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function LogoutUrl(){
|
||||||
|
return $this->Link('logout');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ResignUrl(){
|
||||||
|
return $this->Link('resign');
|
||||||
|
}
|
||||||
}
|
}
|
@ -256,4 +256,6 @@ jQuery(document).ready(function($) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('body').user_infobox();
|
||||||
});
|
});
|
@ -33,6 +33,7 @@ $SetCurrentTab(1)
|
|||||||
<p>There was a problem saving your profile. Please look for errors below.</p>
|
<p>There was a problem saving your profile. Please look for errors below.</p>
|
||||||
</div>
|
</div>
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
|
<% include CurrentUserInfoBox LogOutLink=$Top.LogoutUrl, ResignLink=$Top.ResignUrl %>
|
||||||
<% include ProfileNav %>
|
<% include ProfileNav %>
|
||||||
<div class="profile-appearance">See how your <a href="/community/members/profile/{$CurrentMember.ID}">public profile</a> appears.</div>
|
<div class="profile-appearance">See how your <a href="/community/members/profile/{$CurrentMember.ID}">public profile</a> appears.</div>
|
||||||
$EditProfileForm
|
$EditProfileForm
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
<% require themedCSS(profile-section) %>
|
<% require themedCSS(profile-section) %>
|
||||||
<h1>$Title</h1>
|
<h1>$Title</h1>
|
||||||
<% if CurrentMember %>
|
<% if CurrentMember %>
|
||||||
|
<% include CurrentUserInfoBox LogOutLink=$Top.LogoutUrl, ResignLink=$Top.ResignUrl %>
|
||||||
<% include ProfileNav %>
|
<% include ProfileNav %>
|
||||||
<% if CurrentMember.isTrainingAdmin %>
|
<% if CurrentMember.isTrainingAdmin %>
|
||||||
<form>
|
<form>
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
<% require themedCSS(profile-section) %>
|
<% require themedCSS(profile-section) %>
|
||||||
<h1>$Title</h1>
|
<h1>$Title</h1>
|
||||||
<% if CurrentMember %>
|
<% if CurrentMember %>
|
||||||
|
<% include CurrentUserInfoBox LogOutLink=$Top.LogoutUrl, ResignLink=$Top.ResignUrl %>
|
||||||
<% include ProfileNav %>
|
<% include ProfileNav %>
|
||||||
<% if CurrentMember.isTrainingAdmin %>
|
<% if CurrentMember.isTrainingAdmin %>
|
||||||
$AddTrainingCourseForm
|
$AddTrainingCourseForm
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
|
<% include CurrentUserInfoBox LogOutLink=$Top.LogoutUrl, ResignLink=$Top.ResignUrl %>
|
||||||
<% include ProfileNav %>
|
<% include ProfileNav %>
|
||||||
|
|
||||||
<form><fieldset>
|
<form><fieldset>
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
<% require themedCSS(profile-section) %>
|
<% require themedCSS(profile-section) %>
|
||||||
<h1>$Title</h1>
|
<h1>$Title</h1>
|
||||||
<% if CurrentMember.isFoundationMember %>
|
<% if CurrentMember.isFoundationMember %>
|
||||||
|
<% include CurrentUserInfoBox LogOutLink=$Top.LogoutUrl, ResignLink=$Top.ResignUrl %>
|
||||||
|
>
|
||||||
<% include ProfileNav %>
|
<% include ProfileNav %>
|
||||||
|
|
||||||
<% if CurrentElection %>
|
<% if CurrentElection %>
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
<% require themedCSS(profile-section) %>
|
<% require themedCSS(profile-section) %>
|
||||||
<h1>$Title</h1>
|
<h1>$Title</h1>
|
||||||
<% if CurrentMember %>
|
<% if CurrentMember %>
|
||||||
|
<% include CurrentUserInfoBox LogOutLink=$Top.LogoutUrl, ResignLink=$Top.ResignUrl %>
|
||||||
<% include ProfileNav %>
|
<% include ProfileNav %>
|
||||||
<% if CurrentMember.isMarketPlaceAdmin %>
|
<% if CurrentMember.isMarketPlaceAdmin %>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
<% require javascript(framework/thirdparty/tinymce/tiny_mce.js) %>
|
<% require javascript(framework/thirdparty/tinymce/tiny_mce.js) %>
|
||||||
<% require javascript(themes/openstack/javascript/simple-tinymce.js) %>
|
<% require javascript(themes/openstack/javascript/simple-tinymce.js) %>
|
||||||
$SetCurrentTab(7)
|
$SetCurrentTab(7)
|
||||||
@ -11,6 +12,7 @@
|
|||||||
<p>Your Profile has been saved!</p>
|
<p>Your Profile has been saved!</p>
|
||||||
</div>
|
</div>
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
|
<% include CurrentUserInfoBox LogOutLink=$Top.LogoutUrl, ResignLink=$Top.ResignUrl %>
|
||||||
<% include ProfileNav %>
|
<% include ProfileNav %>
|
||||||
$EditSpeakerProfileForm
|
$EditSpeakerProfileForm
|
||||||
<% else %>
|
<% else %>
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
<div class="loggedInBox">
|
|
||||||
You are logged in as: <strong>$CurrentMember.Name</strong> <a class="roundedButton" href="{$Link}logout/">Logout</a> <a class="roundedButton" href="{$Link}resign/">Resign Membership</a>
|
|
||||||
</div>
|
|
||||||
<h2 class="profile-tabs">
|
<h2 class="profile-tabs">
|
||||||
<a href="{$Link}" <% if CurrentTab=1 %>class="active"<% end_if %> >Your Details</a>
|
<a href="{$Link}" <% if CurrentTab=1 %>class="active"<% end_if %> >Your Details</a>
|
||||||
<% if CurrentMember.isFoundationMember %>
|
<% if CurrentMember.isFoundationMember %>
|
||||||
|
124
themes/openstack/javascript/current.user.infobox.jquery.js
Normal file
124
themes/openstack/javascript/current.user.infobox.jquery.js
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2014 Openstack Foundation
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
|
||||||
|
(function( $ ){
|
||||||
|
|
||||||
|
var settings = {};
|
||||||
|
var downgrade_btn = null;
|
||||||
|
var upgrade_btn = null;
|
||||||
|
var confirm_downgrade_dialog = null;
|
||||||
|
var confirm_upgrade_dialog = null;
|
||||||
|
|
||||||
|
var methods = {
|
||||||
|
init: function(options){
|
||||||
|
|
||||||
|
settings = $.extend({}, options );
|
||||||
|
downgrade_btn = $('.downgrade-2-community-member');
|
||||||
|
upgrade_btn = $('.upgrade-2-foundation-member');
|
||||||
|
|
||||||
|
downgrade_btn.click(function(event){
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
confirm_downgrade_dialog.dialog( "open");
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
upgrade_btn.click(function(event){
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
confirm_upgrade_dialog.dialog( "open");
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
confirm_upgrade_dialog = $('#dialog-confirm-upgrade').dialog({
|
||||||
|
resizable: false,
|
||||||
|
autoOpen: false,
|
||||||
|
height:520,
|
||||||
|
width:620,
|
||||||
|
modal: true,
|
||||||
|
buttons: {
|
||||||
|
"Agree": function() {
|
||||||
|
$.ajax(
|
||||||
|
{
|
||||||
|
type: "GET",
|
||||||
|
url: 'userprofile/Upgrade2FoundationMember',
|
||||||
|
dataType: "json",
|
||||||
|
timeout:5000,
|
||||||
|
retryMax: 2,
|
||||||
|
complete: function (jqXHR,textStatus) {
|
||||||
|
window.location.reload();
|
||||||
|
},
|
||||||
|
error: function (jqXHR, textStatus, errorThrown) {
|
||||||
|
alert( "Request failed: " + textStatus );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
$(this).dialog( "close" );
|
||||||
|
},
|
||||||
|
"Disagree": function() {
|
||||||
|
$( this ).dialog( "close" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
confirm_downgrade_dialog = $('#dialog-confirm-downgrade').dialog({
|
||||||
|
resizable: false,
|
||||||
|
autoOpen: false,
|
||||||
|
height:220,
|
||||||
|
width:520,
|
||||||
|
modal: true,
|
||||||
|
buttons: {
|
||||||
|
"Agree": function() {
|
||||||
|
$.ajax(
|
||||||
|
{
|
||||||
|
type: "GET",
|
||||||
|
url: 'userprofile/Downgrade2CommunityMember',
|
||||||
|
dataType: "json",
|
||||||
|
timeout:5000,
|
||||||
|
retryMax: 2,
|
||||||
|
complete: function (jqXHR,textStatus) {
|
||||||
|
window.location.reload();
|
||||||
|
},
|
||||||
|
error: function (jqXHR, textStatus, errorThrown) {
|
||||||
|
alert( "Request failed: " + textStatus );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
$(this).dialog( "close" );
|
||||||
|
},
|
||||||
|
"Disagree": function() {
|
||||||
|
$( this ).dialog( "close" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$.fn.user_infobox = function(methodOrOptions) {
|
||||||
|
if ( methods[methodOrOptions] ) {
|
||||||
|
return methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));
|
||||||
|
} else if ( typeof methodOrOptions === 'object' || ! methodOrOptions ) {
|
||||||
|
// Default to "init"
|
||||||
|
return methods.init.apply( this, arguments );
|
||||||
|
} else {
|
||||||
|
$.error( 'Method ' + method + ' does not exist on jQuery.user_infobox' );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// End of closure.
|
||||||
|
}( jQuery ));
|
||||||
|
|
@ -0,0 +1,45 @@
|
|||||||
|
<div class="loggedInBox">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4" style="height: 35px;line-height: 35px;"><span style="display:inline-block; vertical-align:middle;">You are logged in as: <strong>$CurrentMember.Name</strong></span></div>
|
||||||
|
<div class="col-md-1"><a class="roundedButton" href="{$LogOutLink}">Logout</a></div>
|
||||||
|
<div class="col-md-7"><a class="roundedButton" href="{$ResignLink}">Resign Membership</a></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<% if $CurrentMember.isFoundationMember %>
|
||||||
|
<div class="col-md-4" style="height: 35px;line-height: 35px;">
|
||||||
|
<span style="display:inline-block; vertical-align:middle;">Current Member Level: <strong>Foundation Member</strong></span>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<a class="roundedButton downgrade-2-community-member" href="{$Downgrade2CommunityMemberLink}">Change to Community Member</a>
|
||||||
|
</div>
|
||||||
|
<% else_if $CurrentMember.isSpeaker %>
|
||||||
|
<div c class="col-md-12" style="height: 35px;line-height: 35px;">
|
||||||
|
<span style="display:inline-block; vertical-align:middle;">Current Member Level: <strong>Speaker</strong></span>
|
||||||
|
</div>
|
||||||
|
<% else_if $CurrentMember.isCommunityMember %>
|
||||||
|
<div c class="col-md-4" style="height: 35px;line-height: 35px;">
|
||||||
|
<span style="display:inline-block; vertical-align:middle;">Current Member Level: <strong>Community Member</strong></span>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<a class="roundedButton upgrade-2-foundation-member" href="{$Upgrade2FoundationMemberLink}">Make me a Foundation Member</a>
|
||||||
|
</div>
|
||||||
|
<% end_if %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="dialog-confirm-downgrade" title="Change to Community Member?" style="display: none;">
|
||||||
|
<p>
|
||||||
|
<span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>If you select this option, you will be revoking your right to vote in elections and to commit code to OpenStack via Gerrit.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="dialog-confirm-upgrade" title="Change to Foundation Member?" style="display: none;">
|
||||||
|
<h2>1. Read over the terms of becoming an OpenStack Foundation Individual Member.</h2>
|
||||||
|
<div class="termsBox">
|
||||||
|
<p>This Individual Member Agreement (“IM Agreement”) between me and the OpenStack Foundation (the “Foundation”) governs my rights and obligations as an Individual Member of the Foundation and is effective on the date that I sign below. I agree that:</p>
|
||||||
|
<p>1. My rights and obligations as an Individual Member are defined in the Certificate of Incorporation and Bylaws (including policies which are exhibits to the bylaws, including the Community Code of Conduct) of the Foundation located at <a href="http://openstack.org/legal/">http://www.openstack.org/legal/</a> on the date that I submitted the Individual Member Application (“IM Application”) , as they may be amended from time to time (the “Certificate”, “Bylaws,” and the “Community Code of Conduct” respectively). The changes to the Certificate, Bylaws and Community Code of Conduct shall be effective when posted at <a href="/legal/">http://www.openstack.org/legal/</a> and I will regularly check the Certificate, Bylaws and Community Code of Conduct to ensure that I understand my obligations. I will become an Individual Member effective on the date provided in the Bylaws;</p>
|
||||||
|
<p>2. The information that I provided in the IM Application is complete and accurate on the date of submission and I will continue to update such information to ensure that it remains complete and accurate. In particular, I will promptly update any change in my Affiliate status as defined in the Bylaws and my email contact address;</p>
|
||||||
|
<p>3. I will comply with the obligations of Individual Members in the Certificate, Bylaws and the Community Code of Conduct;</p>
|
||||||
|
<p>4. I consent to making available to the public my name, my Statement of Interest (as provided in the IM Application) and Affiliate status. In addition, I consent to the use of other information in the IM Application as provided in the Bylaws; and</p>
|
||||||
|
<p>5. I consent to communication by electronic means to my email contact address. My membership may be terminated for breach of this IM Agreement or my obligations under the Certificate, Bylaws and Community Code of Conduct. Upon such breach, the Foundation shall provide notice to me at my email contact address describing the alleged breach and the thirty day period permitted for response. If I do not respond within such thirty (30) day period, I will automatically cease to be an Individual Member.</p>
|
||||||
|
<p>6. This IM Agreement is governed by the laws of the State of Delaware, but not including its conflict of law principles. This IM Agreement is personal to me and may not be transferred to any other party, whether by operation of law or otherwise. This IM Agreement (including the IM Application, Certificate, Bylaws and Community Code of Conduct) constitutes the entire agreement between the parties concerning membership in the Foundation and supersedes all written or oral prior agreements or understandings with respect thereto. No modification, extension or waiver of or under this IM Agreement is valid unless it is made in a writing which identifies itself as an amendment to this IM Agreement and that writing is signed by an authorized representative of each party. No waiver will constitute, or be construed as, a waiver of any other obligation or condition of this IM Agreement.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
Loading…
Reference in New Issue
Block a user