* refactoring

Conflicts:

	openstack/_config.php
	themes/openstack/templates/Layout/SangriaPage_SetCategorySponsors.ss
	themes/openstack/templates/Layout/SangriaPage_ViewSponsorsRequest.ss

Conflicts:

	openstack/_config.php
	openstack/code/SangriaPage.php
	themes/openstack/templates/Layout/SangriaPage_AddInvolvementType.ss

Conflicts:

	openstack/code/SangriaPage.php
This commit is contained in:
Sebastian Marcet 2014-10-29 18:03:29 -03:00
parent 43703c7b5a
commit 00b077eb8f
35 changed files with 1773 additions and 1488 deletions

View File

@ -34,12 +34,10 @@ class JQueryUIDatePickerField extends TextField {
function Field() { function Field() {
$this->addExtraClass('DatePickerField'); $this->addExtraClass('DatePickerField');
Requirements::block(SAPPHIRE_DIR .'/thirdparty/jquery/jquery.js'); Requirements::block(SAPPHIRE_DIR .'/thirdparty/jquery/jquery.js');
Requirements::css("themes/openstack/javascript/jquery-ui-1.10.3.custom/css/smoothness/jquery-ui-1.10.3.custom.min.css");
Requirements::javascript('themes/openstack/javascript/jquery-2.0.3.min.js'); Requirements::javascript('themes/openstack/javascript/jquery-2.0.3.min.js');
Requirements::javascript('themes/openstack/javascript/jquery-migrate-1.2.1.min.js'); Requirements::javascript('themes/openstack/javascript/jquery-migrate-1.2.1.min.js');
Requirements::javascript("themes/openstack/javascript/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js"); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::javascript("datepicker/javascript/datepicker.js"); Requirements::javascript("datepicker/javascript/datepicker.js");
$attributes = array( $attributes = array(

View File

@ -25,6 +25,7 @@ final class SangriaPageEventExtension extends Extension {
public function onBeforeInit(){ public function onBeforeInit(){
Config::inst()->update(get_class($this), 'allowed_actions', array('ViewEventDetails')); Config::inst()->update(get_class($this), 'allowed_actions', array('ViewEventDetails'));
Config::inst()->update(get_class($this->owner), 'allowed_actions', array('ViewEventDetails'));
} }
public function EventRegistrationRequestForm() { public function EventRegistrationRequestForm() {
@ -50,12 +51,12 @@ final class SangriaPageEventExtension extends Extension {
private function commonScripts(){ private function commonScripts(){
Requirements::css("themes/openstack/css/chosen.css", "screen,projection"); Requirements::css("themes/openstack/css/chosen.css", "screen,projection");
Requirements::css("themes/openstack/javascript/jquery-ui-1.10.3.custom/css/smoothness/jquery-ui-1.10.3.custom.min.css"); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::css("events/css/sangria.page.view.event.details.css"); Requirements::css("events/css/sangria.page.view.event.details.css");
Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js"); Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js");
Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js");
Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"); Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js");
Requirements::javascript("themes/openstack/javascript/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.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.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('marketplace/code/ui/admin/js/utils.js'); Requirements::javascript('marketplace/code/ui/admin/js/utils.js');

View File

@ -69,11 +69,11 @@ final class EventRegistrationRequestPage_Controller extends Page_Controller {
); );
//js files //js files
Requirements::css("themes/openstack/css/chosen.css", "screen,projection"); Requirements::css("themes/openstack/css/chosen.css", "screen,projection");
Requirements::css("themes/openstack/javascript/jquery-ui-1.10.3.custom/css/smoothness/jquery-ui-1.10.3.custom.min.css"); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js"); Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js");
Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js");
Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"); Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js");
Requirements::javascript("themes/openstack/javascript/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.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.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('events/js/event.registration.request.page.js'); Requirements::javascript('events/js/event.registration.request.page.js');

View File

@ -1,5 +1,5 @@
<% if IncludeFormTag %> <% if IncludeFormTag %>
<form $FormAttributes> <form $FormAttributes role="form">
<% end_if %> <% end_if %>
<% if Message %> <% if Message %>
<p id="{$FormName}_error" class="message $MessageType">$Message</p> <p id="{$FormName}_error" class="message $MessageType">$Message</p>
@ -51,7 +51,7 @@
</div> </div>
</div> </div>
<div class="section_container"> <div class="form-group">
<h2>Event Location</h2> <h2>Event Location</h2>
<div class="field text " id="city"> <div class="field text " id="city">
@ -78,17 +78,20 @@
</div> </div>
</div> </div>
<div class="section_container"> <div class="row">
<div class="col-md-12">
<h2>Event Duration</h2> <h2>Event Duration</h2>
</div>
<div class="field text " id="start_date"> </div>
<div class="row">
<div class="col-md-2" id="start_date">
<label for="$FormName_start_date" class="left">Start Date</label> <label for="$FormName_start_date" class="left">Start Date</label>
<div class="middleColumn"> <div class="middleColumn">
$Fields.dataFieldByName(start_date) $Fields.dataFieldByName(start_date)
</div> </div>
</div> </div>
<div class="field text " id="end_date"> <div class="col-md-2" id="end_date">
<label for="$FormName_end_date" class="left">End Date</label> <label for="$FormName_end_date" class="left">End Date</label>
<div class="middleColumn"> <div class="middleColumn">

View File

@ -25,6 +25,7 @@ final class SangriaPageJobsExtension extends Extension {
public function onBeforeInit(){ public function onBeforeInit(){
Config::inst()->update(get_class($this), 'allowed_actions', array('ViewJobsDetails')); Config::inst()->update(get_class($this), 'allowed_actions', array('ViewJobsDetails'));
Config::inst()->update(get_class($this->owner), 'allowed_actions', array('ViewJobsDetails'));
} }
public function onAfterInit(){ public function onAfterInit(){
@ -33,11 +34,11 @@ final class SangriaPageJobsExtension extends Extension {
private function commonScripts(){ private function commonScripts(){
Requirements::css("themes/openstack/css/chosen.css", "screen,projection"); Requirements::css("themes/openstack/css/chosen.css", "screen,projection");
Requirements::css("themes/openstack/javascript/jquery-ui-1.10.3.custom/css/smoothness/jquery-ui-1.10.3.custom.min.css");
Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js"); Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js");
Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js");
Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"); Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js");
Requirements::javascript("themes/openstack/javascript/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.js"); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.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.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('marketplace/code/ui/admin/js/utils.js'); Requirements::javascript('marketplace/code/ui/admin/js/utils.js');

View File

@ -32,12 +32,12 @@ final class JobRegistrationRequestPage_Controller extends Page_Controller {
function init() { function init() {
parent::init(); parent::init();
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::css("themes/openstack/css/chosen.css", "screen,projection"); Requirements::css("themes/openstack/css/chosen.css", "screen,projection");
Requirements::css("themes/openstack/javascript/jquery-ui-1.10.3.custom/css/smoothness/jquery-ui-1.10.3.custom.min.css");
Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js"); Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js");
Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js");
Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"); Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js");
Requirements::javascript("themes/openstack/javascript/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.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.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(Director::protocol()."maps.googleapis.com/maps/api/js?sensor=false"); Requirements::javascript(Director::protocol()."maps.googleapis.com/maps/api/js?sensor=false");

View File

@ -132,15 +132,17 @@ abstract class CloudsDirectoryPage_Controller extends MarketPlaceDirectoryPage_C
parent::init(); parent::init();
$cloud_type = $this->getCloudTypeForJS(); $cloud_type = $this->getCloudTypeForJS();
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::customScript(" Requirements::customScript("
var cloud_type = '{$cloud_type}' var cloud_type = '{$cloud_type}'
jQuery(document).ready(function($) { jQuery(document).ready(function($) {
$('#{$cloud_type}','.marketplace-nav').addClass('current'); $('#{$cloud_type}','.marketplace-nav').addClass('current');
});"); });");
Requirements::css("themes/openstack/javascript/jquery-ui-1.10.3.custom/css/smoothness/jquery-ui-1.10.3.custom.min.css");
Requirements::css("themes/openstack/css/chosen.css", "screen,projection"); Requirements::css("themes/openstack/css/chosen.css", "screen,projection");
Requirements::javascript("themes/openstack/javascript/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js");
Requirements::javascript(Director::protocol()."maps.googleapis.com/maps/api/js?sensor=false"); Requirements::javascript(Director::protocol()."maps.googleapis.com/maps/api/js?sensor=false");
Requirements::javascript("marketplace/code/ui/admin/js/utils.js"); Requirements::javascript("marketplace/code/ui/admin/js/utils.js");
Requirements::javascript("marketplace/code/ui/frontend/js/markerclusterer.js"); Requirements::javascript("marketplace/code/ui/frontend/js/markerclusterer.js");

View File

@ -54,12 +54,13 @@ class ConsultantsDirectoryPage_Controller extends MarketPlaceDirectoryPage_Contr
function init() { function init() {
parent::init(); parent::init();
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::customScript("jQuery(document).ready(function($) { Requirements::customScript("jQuery(document).ready(function($) {
$('#consulting','.marketplace-nav').addClass('current'); $('#consulting','.marketplace-nav').addClass('current');
});"); });");
Requirements::css("themes/openstack/javascript/jquery-ui-1.10.3.custom/css/smoothness/jquery-ui-1.10.3.custom.min.css");
Requirements::css("themes/openstack/css/chosen.css", "screen,projection"); Requirements::css("themes/openstack/css/chosen.css", "screen,projection");
Requirements::javascript("themes/openstack/javascript/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js");
Requirements::javascript(Director::protocol()."maps.googleapis.com/maps/api/js?sensor=false"); Requirements::javascript(Director::protocol()."maps.googleapis.com/maps/api/js?sensor=false");
Requirements::javascript("marketplace/code/ui/admin/js/utils.js"); Requirements::javascript("marketplace/code/ui/admin/js/utils.js");
Requirements::javascript("marketplace/code/ui/frontend/js/markerclusterer.js"); Requirements::javascript("marketplace/code/ui/frontend/js/markerclusterer.js");

View File

@ -58,12 +58,15 @@ class DistributionsDirectoryPage_Controller extends MarketPlaceDirectoryPage_Con
function init() function init()
{ {
parent::init(); parent::init();
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::customScript("jQuery(document).ready(function($) { Requirements::customScript("jQuery(document).ready(function($) {
$('#distros','.marketplace-nav').addClass('current'); $('#distros','.marketplace-nav').addClass('current');
});"); });");
Requirements::css("themes/openstack/javascript/jquery-ui-1.10.3.custom/css/smoothness/jquery-ui-1.10.3.custom.min.css");
Requirements::css("themes/openstack/css/chosen.css", "screen,projection"); Requirements::css("themes/openstack/css/chosen.css", "screen,projection");
Requirements::javascript("themes/openstack/javascript/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js");
Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js"); Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js");
Requirements::javascript("marketplace/code/ui/frontend/js/implementation.directory.page.js"); Requirements::javascript("marketplace/code/ui/frontend/js/implementation.directory.page.js");
Requirements::customScript($this->GATrackingCode()); Requirements::customScript($this->GATrackingCode());

View File

@ -49,10 +49,10 @@ class TrainingDirectoryPage_Controller extends MarketPlaceDirectoryPage_Controll
function init(){ function init(){
parent::init(); parent::init();
//JS //JS
Requirements::css("themes/openstack/javascript/jquery-ui-1.10.3.custom/css/smoothness/jquery-ui-1.10.3.custom.min.css");
Requirements::css("themes/openstack/css/chosen.css", "screen,projection");
Requirements::javascript("themes/openstack/javascript/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js"); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::css("themes/openstack/css/chosen.css", "screen,projection");
Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js"); Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js");
Requirements::javascript("marketplace/code/ui/frontend/js/training.directory.page.js"); Requirements::javascript("marketplace/code/ui/frontend/js/training.directory.page.js");
Requirements::customScript("jQuery(document).ready(function($) { Requirements::customScript("jQuery(document).ready(function($) {

View File

@ -82,13 +82,7 @@ final class NewsRequestPage_Controller extends Page_Controller {
private function commonScripts(){ private function commonScripts(){
Requirements::css("themes/openstack/javascript/datetimepicker/jquery.datetimepicker.css"); Requirements::css("themes/openstack/javascript/datetimepicker/jquery.datetimepicker.css");
Requirements::javascript("themes/openstack/javascript/datetimepicker/jquery.datetimepicker.js"); Requirements::javascript("themes/openstack/javascript/datetimepicker/jquery.datetimepicker.js");
Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js");
/*Requirements::javascript("themes/openstack/javascript/jquery.validate.custom.methods.js");
Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js");
Requirements::javascript("themes/openstack/javascript/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.js");
Requirements::javascript("themes/openstack/javascript/jquery.ui.datepicker.validation.package-1.0.1/jquery.ui.datepicker.validation.js");*/
} }
function saveNewsArticle($data, Form $form){ function saveNewsArticle($data, Form $form){

View File

@ -88,3 +88,14 @@ if (Director::isDev()) {
//Set default login //Set default login
Security::setDefaultAdmin('admin','pass'); Security::setDefaultAdmin('admin','pass');
} }
//sangria configuration
Object::add_extension('SangriaPage_Controller', 'SangriaPageDeploymentExtension');
Object::add_extension('SangriaPage_Controller', 'SangriaPageStandardizeOrgNamesExtension');
Object::add_extension('SangriaPage_Controller', 'SangriaPageViewCurrentStoriesExtension');
Object::add_extension('SangriaPage_Controller', 'SangriaPageExportDataExtension');
Object::add_extension('SangriaPage_Controller', 'SangriaPageViewSpeakingSubmissionsExtension');
Object::add_extension('SangriaPage_Controller', 'SangriaSetCategorySponsorsExtension');
Object::add_extension('SangriaPage_Controller', 'SangriaPageInvolvementTypeExtension');
HTTP::set_cache_age(0);

View File

@ -5,4 +5,3 @@ After: 'framework/routes#coreroutes'
Director: Director:
rules: rules:
'depsurvey': 'DeploymentSurveyController' 'depsurvey': 'DeploymentSurveyController'
---

View File

@ -48,14 +48,16 @@ class CompanyListPage_Controller extends Page_Controller
Requirements::css("themes/openstack/css/chosen.css", "screen,projection"); Requirements::css("themes/openstack/css/chosen.css", "screen,projection");
Requirements::css("themes/openstack/css/jquery.autocomplete.css"); Requirements::css("themes/openstack/css/jquery.autocomplete.css");
Requirements::css(THEMES_DIR, "/openstack/javascript/jquery-ui-1.10.3.custom/css/smoothness/jquery-ui-1.10.3.custom.min.css");
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js"); Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js");
Requirements::javascript("themes/openstack/javascript/jquery.autocomplete.min.js"); Requirements::javascript("themes/openstack/javascript/jquery.autocomplete.min.js");
Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js");
Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"); Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js");
Requirements::javascript(THEMES_DIR, "/openstack/javascript/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js");
} }
function DisplayedCompanies($type) function DisplayedCompanies($type)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,349 @@
<?php
/**
* Copyright 2014 Openstack.org
* 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.
**/
/**
* Defines Sangria Admin area
*/
class SangriaPage extends Page {
private static $db = array(
);
private static $has_one = array(
);
}
/**
* Class SangriaPage_Controller
*/
final class SangriaPage_Controller extends Page_Controller {
public static $submissionsCount = 0;
public static $default_start_date;
public static $default_end_date;
public static $date_filter_query;
static $allowed_actions = array(
'GenerateAutoLoginHashes',
// Manage User Stories and Deployments
'SurveyDetails',
'SetCaseStudy',
'DeploymentSurveyDeploymentsFilters',
'FilterResults',
);
function init() {
if(!Permission::check("SANGRIA_ACCESS")) Security::permissionFailure();
parent::init();
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::javascript('themes/openstack/javascript/jquery.tablednd.js');
Requirements::javascript('themes/openstack/javascript/querystring.jquery.js');
Requirements::css("themes/openstack/javascript/datetimepicker/jquery.datetimepicker.css");
Requirements::javascript("themes/openstack/javascript/datetimepicker/jquery.datetimepicker.js");
Requirements::css("themes/openstack/css/deployment.survey.page.css");
Requirements::javascript("themes/openstack/javascript/deployment.survey.filters.js");
self::$default_start_date = date('Y/m/d',strtotime('-1 months')).' 00:00';
self::$default_end_date = date('Y/m/d').' 23:59';
}
function providePermissions() {
return array(
"SANGRIA_ACCESS" => "Access the Sangria Admin"
);
}
// DASHBOARD METRICS
function IndividualMemberCount() {
return EntityCounterHelper::getInstance()->EntityCount('FoundationMember',function (){
$query = new IndividualFoundationMemberCountQuery();
$res = $query->handle(null)->getResult();
return $res[0];
});
}
function CommunityMemberCount() {
return EntityCounterHelper::getInstance()->EntityCount('CommunityMember',function (){
$query = new IndividualCommunityMemberCountQuery();
$res = $query->handle(null)->getResult();
return $res[0];
});
}
function NewsletterMemberCount() {
return EntityCounterHelper::getInstance()->EntityCount('NewsletterMember',function (){
$query = new FoundationMembersSubscribedToNewsLetterCountQuery();
$res = $query->handle(new FoundationMembersSubscribedToNewsLetterCountQuerySpecification)->getResult();
return $res[0];
});
}
function NewsletterPercentage() {
return number_format(($this->NewsletterMemberCount() / $this->IndividualMemberCount())*100,2);
}
function UserStoryCount() {
return EntityCounterHelper::getInstance()->EntityCount('UserStory',function (){
$query = new UserStoriesCountQuery();
$res = $query->handle(new UserStoriesCountQuerySpecification(true))->getResult();
return $res[0];
});
}
function UserLogoCount() {
return EntityCounterHelper::getInstance()->EntityCount('UserLogo',function (){
$query = new UserStoriesCountQuery();
$res = $query->handle(new UserStoriesCountQuerySpecification(false))->getResult();
return $res[0];
});
}
function PlatinumMemberCount() {
return EntityCounterHelper::getInstance()->EntityCount('PlatinumOrg',function (){
$query = new CompanyCountQuery();
$res = $query->handle(new CompanyCountQuerySpecification('Platinum'))->getResult();
return $res[0];
});
}
function GoldMemberCount() {
return EntityCounterHelper::getInstance()->EntityCount('GoldOrg',function (){
$query = new CompanyCountQuery();
$res = $query->handle(new CompanyCountQuerySpecification('Gold'))->getResult();
return $res[0];
});
}
function CorporateSponsorCount() {
return EntityCounterHelper::getInstance()->EntityCount('CorporateOrg',function (){
$query = new CompanyCountQuery();
$res = $query->handle(new CompanyCountQuerySpecification('Corporate'))->getResult();
return $res[0];
});
}
function StartupSponsorCount() {
return EntityCounterHelper::getInstance()->EntityCount('StartupOrg',function (){
$query = new CompanyCountQuery();
$res = $query->handle(new CompanyCountQuerySpecification('Startup'))->getResult();
return $res[0];
});
}
function SupportingOrganizationCount() {
return EntityCounterHelper::getInstance()->EntityCount('MentionOrg',function (){
$query = new CompanyCountQuery();
$res = $query->handle(new CompanyCountQuerySpecification('Mention'))->getResult();
return $res[0];
});
}
function TotalOrganizationCount() {
return EntityCounterHelper::getInstance()->EntityCount('TotalOrgs',function (){
$query = new CompanyCountQuery();
$res = $query->handle(new CompanyCountQuerySpecification())->getResult();
return $res[0];
});
}
function NewsletterInternationalCount() {
return EntityCounterHelper::getInstance()->EntityCount('NewsletterInternationalCount',function (){
$query = new FoundationMembersSubscribedToNewsLetterCountQuery();
$res = $query->handle(new FoundationMembersSubscribedToNewsLetterCountQuerySpecification('US'))->getResult();
return $res[0];
});
}
function NewsletterInternationalPercentage() {
return number_format(($this->NewsletterInternationalCount()/$this->NewsletterMemberCount())*100,2);
}
function IndividualMemberCountryCount() {
$Count = DB::query('select count(distinct(Member.Country)) from Member left join Group_Members on Member.ID = Group_Members.MemberID where Group_Members.GroupID = 5;')->value();
return $Count;
}
function InternationalOrganizationCount() {
return EntityCounterHelper::getInstance()->EntityCount('InternationalOrganization',function (){
$query = new CompanyCountQuery();
$res = $query->handle(new CompanyCountQuerySpecification(null,'US'))->getResult();
return $res[0];
});
}
function OrgsInternationalPercentage() {
return number_format(($this->InternationalOrganizationCount()/$this->TotalOrganizationCount())*100,2);
}
//Survey date filters constructor
function DateFilters($action='') {
$start_date = ($this->request->getVar('From')) ? $this->request->getVar('From') : self::$default_start_date;
$end_date = ($this->request->getVar('To')) ? $this->request->getVar('To') : self::$default_end_date;
$data = array("start_date"=>$start_date, "end_date"=>$end_date, "action"=>$action);
return $this->renderWith("SurveyDateFilters",$data);
}
public function getSortDir($type, $read_only=false){
$default = 'asc';
$dir = Session::get($type.'.sort.dir');
if(empty($dir)){
$dir = $default;
}
else{
$dir = $dir=='asc'?'desc':'asc';
}
if(!$read_only)
Session::set($type.'.sort.dir',$dir);
return $dir;
}
function getSortIcon($type){
return $this->getSortDir($type,true) == 'desc'?'&blacktriangledown;':'&blacktriangle;';
}
function UserStoriesPerIndustry($Industry){
return DataObject::get("UserStory","UserStoriesIndustryID = " . $Industry);
}
function Countries(){
return CountryCodes::asObject();
}
function getQuickActionsExtensions(){
$html = '';
$this->extend('getQuickActionsExtensions',$html);
return $html;
}
public function DeploymentMatchingOrgs() {
$filterWhereClause = self::generateFilterWhereClause();
$results = DB::query("select o.Name from Deployment d join DeploymentSurvey s on (d.DeploymentSurveyID = s.ID) join Org o on (s.OrgID = o.ID) where 1=1".$filterWhereClause);
$list = new DataObjectSet();
for( $i=0; $i < $results->numRecords(); $i++) {
$record = $results->nextRecord();
$do = new ArrayList();
$do->OrgName = $record["Name"];
$list->push($do);
}
return $list;
}
public static function generateSelectListSummary($fieldName, $optionSet, $applyDateFilters=false) {
$list = new ArrayList();
$urlString = $_SERVER["REDIRECT_URL"]."?";
$keyUrlString = "";
$keyValue = "";
foreach($_GET as $key=>$value) {
if (preg_match("/Filter$/",$key)) {
if ($key != $fieldName."Filter") {
$urlString .= $key."=".$value."&";
} else {
$keyUrlString = $key."=".$value;
$keyValue = $value;
}
}
}
foreach( $optionSet as $option => $label ) {
$query = "select count(*) from Deployment where ".$fieldName." like '%".$option."%'".self::generateFilterWhereClause();
$query .= ($applyDateFilters) ? ' AND '.self::$date_filter_query : '';
$count = DB::query($query)->value();
$do = new DataObject();
$href = $urlString.$fieldName."Filter=".$option;
if ($applyDateFilters) {
$start_date = Controller::curr()->request->getVar('From');
$end_date = Controller::curr()->request->getVar('To');
if ($start_date && $end_date)
$href .= "&From=".$start_date."&To=".$end_date;
}
$do->Value = "<a href='".$href."'>".$label."</a>";
if( !empty($keyUrlString) && $keyValue != $option) {
$do->Value .= " (<a href='".$urlString.$keyUrlString.",,".$option."'>+</a>) (<a href='".$urlString.$keyUrlString."||".$option."'>|</a>)";
}
$do->Count = $count;
$list->push($do);
}
return $list;
}
public static function generateFilterWhereClause() {
$filterWhereClause = "";
foreach($_GET as $key=>$value) {
if (preg_match("/Filter$/",$key)) {
$orValues = split("\|\|", $value);
$andValues = split("\,\,", $value);
if (count($orValues) > 1) {
$filterWhereClause .= " and (";
for($i=0; $i<count($orValues); $i++) {
if( $i>0 ) {
$filterWhereClause .= " OR ";
}
$filterWhereClause .= preg_replace("/Filter$/","",$key)." like '%".$orValues[$i]."%'";
}
$filterWhereClause .= ")";
} else if (count($andValues) > 1) {
$filterWhereClause .= " and (";
for($i=0; $i<count($andValues); $i++) {
if( $i>0 ) {
$filterWhereClause .= " AND ";
}
$filterWhereClause .= preg_replace("/Filter$/","",$key)." like '%".$andValues[$i]."%'";
}
$filterWhereClause .= ")";
} else {
$filterWhereClause .= " and ".preg_replace("/Filter$/","",$key)." like '%".$value."%'";
}
}
}
return $filterWhereClause;
}
public static function generateDateFilters($table_prefix = '' ) {
$where_query = '';
$start_date = Controller::curr()->request->getVar('From');
$end_date = Controller::curr()->request->getVar('To');
if(!empty($table_prefix))
$table_prefix .= '.';
if(isset($start_date) && isset($end_date)){
$date_from = Convert::raw2sql(trim($start_date));
$date_to = Convert::raw2sql(trim($end_date));
$start = new \DateTime($date_from);
$start->setTime(00, 00, 00);
$end = new \DateTime($date_to);
$end->setTime(23, 59, 59);
$where_query .= " ( {$table_prefix}UpdateDate >= '{$start->format('Y-m-d H:i:s')}' AND {$table_prefix}UpdateDate <= '{$end->format('Y-m-d H:i:s')}' ) ";
} else {
$start_date = self::$default_start_date;
$end_date = self::$default_end_date;
$where_query .= " ( {$table_prefix}UpdateDate >= '{$start_date}' AND {$table_prefix}UpdateDate <= '{$end_date}' ) ";
}
self::$date_filter_query = $where_query;
}
}

View File

@ -0,0 +1,417 @@
<?php
/**
* Copyright 2014 Openstack.org
* 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.
**/
/**
* Class SangriaPageDeploymentExtension
*/
final class SangriaPageDeploymentExtension extends Extension {
public function onBeforeInit(){
Config::inst()->update(get_class($this), 'allowed_actions', array(
'ViewDeploymentStatistics',
'ViewDeploymentSurveyStatistics',
'ViewDeploymentDetails',
'DeploymentDetails',
'AddNewDeployment',
'AddUserStory'));
Config::inst()->update(get_class($this->owner), 'allowed_actions', array(
'ViewDeploymentStatistics',
'ViewDeploymentSurveyStatistics',
'ViewDeploymentDetails',
'DeploymentDetails',
'AddNewDeployment',
'AddUserStory'));
}
function DeploymentDetails(){
$params = $this->owner->request->allParams();
$deployment_id = intval(Convert::raw2sql($params["ID"]));;
$deployment = Deployment::get()->byID($deployment_id);
if($deployment)
return $this->owner->Customise($deployment)->renderWith(array('SangriaPage_DeploymentDetails','SangriaPage','SangriaPage'));
return $this->owner->httpError(404, 'Sorry that Deployment could not be found!.');
}
// Deployment Survey data
public function ViewDeploymentSurveyStatistics(){
SangriaPage_Controller::generateDateFilters();
Requirements::css("themes/openstack/javascript/datetimepicker/jquery.datetimepicker.css");
Requirements::javascript("themes/openstack/javascript/datetimepicker/jquery.datetimepicker.js");
Requirements::css("themes/openstack/css/deployment.survey.page.css");
Requirements::javascript("themes/openstack/javascript/deployment.survey.filters.js");
return $this->owner->Customise(array())->renderWith(array('SangriaPage_ViewDeploymentSurveyStatistics','SangriaPage','SangriaPage'));
}
function DeploymentSurveysCount() {
$DeploymentSurveys = DeploymentSurvey::get()->where("Title IS NOT NULL")->where(SangriaPage_Controller::$date_filter_query);
$Count = ($DeploymentSurveys) ? $DeploymentSurveys->Count() : 0;
return $Count;
}
function IndustrySummary() {
$list = new ArrayList();
$options = DeploymentSurvey::$industry_options;
foreach( $options as $option => $label ) {
$count = DB::query("select count(*) from DeploymentSurvey where Industry like '%".$option."%' AND ".SangriaPage_Controller::$date_filter_query)->value();
$do = new DataObject();
$do->Value = $label;
$do->Count = $count;
$list->push($do);
}
return $list;
}
function OtherIndustry() {
$list = DeploymentSurvey::get()->where("OtherIndustry IS NOT NULL AND " . SangriaPage_Controller::$date_filter_query)->sort('OtherIndustry');
return $list;
}
function OrganizationSizeSummary() {
$list = new ArrayList();
$options = DeploymentSurvey::$organization_size_options;
foreach( $options as $option => $label ) {
$count = DB::query("select count(*) from DeploymentSurvey where OrgSize like '%".$option."%' AND ".SangriaPage_Controller::$date_filter_query)->value();
$do = new DataObject();
$do->Value = $label;
$do->Count = $count;
$list->push($do);
}
return $list;
}
function InvolvementSummary() {
$list = new ArrayList();
$options = DeploymentSurvey::$openstack_involvement_options;
foreach( $options as $option => $label ) {
$count = DB::query("select count(*) from DeploymentSurvey where OpenStackInvolvement like '%".$option."%' AND ".SangriaPage_Controller::$date_filter_query)->value();
$do = new DataObject();
$do->Value = $label;
$do->Count = $count;
$list->push($do);
}
return $list;
}
function InformationSourcesSummary() {
$list = new ArrayList();
$options = DeploymentSurvey::$information_options;
foreach( $options as $option => $label ) {
$count = DB::query("select count(*) from DeploymentSurvey where InformationSources like '%".$option."%' AND ".SangriaPage_Controller::$date_filter_query)->value();
$do = new DataObject();
$do->Value = $label;
$do->Count = $count;
$list->push($do);
}
return $list;
}
function OtherInformationSources() {
$list = DeploymentSurvey::get()->where("OtherInformationSources IS NOT NULL AND " . SangriaPage_Controller::$date_filter_query)->sort('OtherInformationSources');
return $list;
}
function FurtherEnhancement() {
$list = DeploymentSurvey::get()->where("FurtherEnhancement IS NOT NULL AND " . SangriaPage_Controller::$date_filter_query)->sort('FurtherEnhancement');
return $list;
}
function FoundationUserCommitteePriorities() {
$list = DeploymentSurvey::get()->where("FoundationUserCommitteePriorities IS NOT NULL AND " . SangriaPage_Controller::$date_filter_query)->sort('FurtherEnhancement');
return $list;
}
function BusinessDriversSummary() {
$list = new ArrayList();
$options = DeploymentSurvey::$business_drivers_options;
foreach( $options as $option => $label ) {
if( $option == 'Ability to innovate, compete') {
$option = 'Ability to innovate{comma} compete';
}
$count = DB::query("select count(*) from DeploymentSurvey where BusinessDrivers like '%".$option."%' AND ".SangriaPage_Controller::$date_filter_query)->value();
$do = new DataObject();
$do->Value = $label;
$do->Count = $count;
$list->push($do);
}
return $list;
}
function OtherBusinessDrivers() {
$list = DeploymentSurvey::get()->where("OtherBusinessDrivers IS NOT NULL AND " . SangriaPage_Controller::$date_filter_query)->sort("OtherBusinessDrivers");
return $list;
}
function WhatDoYouLikeMost() {
$list = DeploymentSurvey::get()->where("WhatDoYouLikeMost IS NOT NULL AND " . SangriaPage_Controller::$date_filter_query)->sort("WhatDoYouLikeMost");
return $list;
}
function NumCloudUsersSummary() {
return SangriaPage_Controller::generateSelectListSummary("NumCloudUsers",
Deployment::$num_cloud_users_options);
}
// Deployment Survey data
function ViewDeploymentStatistics(){
SangriaPage_Controller::generateDateFilters();
Requirements::css("themes/openstack/javascript/datetimepicker/jquery.datetimepicker.css");
Requirements::javascript("themes/openstack/javascript/datetimepicker/jquery.datetimepicker.js");
Requirements::css("themes/openstack/css/deployment.survey.page.css");
Requirements::javascript("themes/openstack/javascript/deployment.survey.filters.js");
return $this->owner->Customise(array())->renderWith(array('SangriaPage_ViewDeploymentStatistics','SangriaPage','SangriaPage'));
}
function DeploymentsCount() {
$filterWhereClause = SangriaPage_Controller::generateFilterWhereClause();
$Deployments = Deployment::get()->where(" 1=1 " . $filterWhereClause.' AND '.SangriaPage_Controller::$date_filter_query);
return $Deployments->count();
}
function IsPublicSummary() {
$options = array( 0 => "No", 1 => "Yes" );
return SangriaPage_Controller::generateSelectListSummary("IsPublic", $options, true);
}
function DeploymentTypeSummary() {
return SangriaPage_Controller::generateSelectListSummary("DeploymentType", Deployment::$deployment_type_options, true);
}
function ProjectsUsedSummary() {
return SangriaPage_Controller::generateSelectListSummary("ProjectsUsed", Deployment::$projects_used_options, true);
}
function CurrentReleasesSummary() {
return SangriaPage_Controller::generateSelectListSummary("CurrentReleases", Deployment::$current_release_options, true);
}
function APIFormatsSummary() {
return SangriaPage_Controller::generateSelectListSummary("APIFormats", Deployment::$api_options, true);
}
function DeploymentStageSummary() {
return SangriaPage_Controller::generateSelectListSummary("DeploymentStage", Deployment::$stage_options, true);
}
function HypervisorsSummary() {
return SangriaPage_Controller::generateSelectListSummary("Hypervisors", Deployment::$hypervisors_options, true);
}
function IdentityDriversSummary() {
return SangriaPage_Controller::generateSelectListSummary("IdentityDrivers", Deployment::$identity_driver_options, true);
}
function SupportedFeaturesSummary() {
return SangriaPage_Controller::generateSelectListSummary("SupportedFeatures", Deployment::$deployment_features_options, true);
}
function NetworkDriversSummary() {
return SangriaPage_Controller::generateSelectListSummary("NetworkDrivers", Deployment::$network_driver_options, true);
}
function NetworkNumIPsSummary() {
return SangriaPage_Controller::generateSelectListSummary("NetworkNumIPs", Deployment::$network_ip_options, true);
}
function BlockStorageDriversSummary() {
return SangriaPage_Controller::generateSelectListSummary("BlockStorageDrivers", Deployment::$block_storage_divers_options, true);
}
function ComputeNodesSummary() {
return SangriaPage_Controller::generateSelectListSummary("ComputeNodes", Deployment::$compute_nodes_options, true);
}
function ComputeCoresSummary() {
return SangriaPage_Controller::generateSelectListSummary("ComputeCores", Deployment::$compute_cores_options, true);
}
function ComputeInstancesSummary() {
return SangriaPage_Controller::generateSelectListSummary("ComputeInstances", Deployment::$compute_instances_options, true);
}
function BlockStorageTotalSizeSummary() {
return SangriaPage_Controller::generateSelectListSummary("BlockStorageTotalSize", Deployment::$storage_size_options, true);
}
function ObjectStorageSizeSummary() {
return SangriaPage_Controller::generateSelectListSummary("ObjectStorageSize", Deployment::$storage_size_options, true);
}
function ObjectStorageNumObjectsSummary() {
return SangriaPage_Controller::generateSelectListSummary("ObjectStorageNumObjects", Deployment::$stoage_objects_options, true);
}
// Deployment Details
function ViewDeploymentDetails(){
Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js");
Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js");
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.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/sangria/view.deployment.details.js");
return $this->owner->getViewer('ViewDeploymentDetails')->process($this->owner);
}
function Deployments(){
$sort = $this->request->getVar('sort');
$sort_dir = $this->getSortDir('deployments');
$date_from = Convert::raw2sql(trim($this->request->getVar('date-from')));
$date_to = Convert::raw2sql(trim($this->request->getVar('date-to')));
$sort_query = '';
if (!empty($sort)) {
switch (strtolower(trim($sort))) {
case 'date': {
$sort_query = "UpdateDate";
$sort_dir = strtoupper($sort_dir);
}
break;
default: {
$sort_query = "ID";
$sort_dir = 'DESC';
}
break;
}
}
$where_query = "IsPublic = 1";
if (!empty($date_from) && !empty($date_to)) {
$start = new \DateTime($date_from);
$start->setTime(00, 00, 00);
$end = new \DateTime($date_to);
$end->setTime(23, 59, 59);
$where_query .= " AND ( UpdateDate >= '{$start->format('Y-m-d H:i:s')}' AND UpdateDate <= '{$end->format('Y-m-d H:i:s')}')";
}
$res = Deployment::get()->where($where_query);
if (!empty($sort_query) && !empty($sort_dir)) {
$res->sort($sort_query, $sort_dir);
}
return $res;
}
function DeploymentsSurvey(){
$sqlQuery = new SQLQuery();
$sqlQuery->select = array('DeploymentSurvey.*');
$sqlQuery->from = array("DeploymentSurvey, Deployment, Org");
$sqlQuery->where = array("Deployment.DeploymentSurveyID = DeploymentSurvey.ID
AND Deployment.IsPublic = 1
AND Org.ID = DeploymentSurvey.OrgID
AND DeploymentSurvey.Title IS NOT NULL
");
$sqlQuery->orderby = 'Org.Name';
$result = $sqlQuery->execute();
$arrayList = new ArrayList();
foreach ($result as $rowArray) {
// concept: new Product($rowArray)
$arrayList->push(new $rowArray['ClassName']($rowArray));
}
return $arrayList;
}
// Add User Story from Deployment
function AddUserStory() {
if (isset($_GET['ID']) && is_numeric($_GET['ID'])) {
$ID = $_GET['ID'];
} else {
die();
}
$parent = UserStoryHolder::get()->first();
if (!$parent) {
$this->setMessage('Error', 'could not add an user story bc there is not any available parent page(UserStoryHolder).');
$this->redirectBack();
}
$userStory = new UserStory;
$userStory->Title = $_GET['label'];
$userStory->DeploymentID = $ID;
$userStory->UserStoriesIndustryID = $_GET['industry'];
$userStory->CompanyName = $_GET['org'];
$userStory->CaseStudyTitle = $_GET['org'];
$userStory->ShowInAdmin = 1;
$userStory->setParent($parent); // Should set the ID once the Holder is created...
$userStory->write();
$userStory->publish("Live", "Stage");
$this->setMessage('Success', '<b>' . $userStory->Title . '</b> added as User Story.');
$this->redirectBack();
}
function AddNewDeployment(){
$survey = DataObject::get_one('DeploymentSurvey','ID = ' . $_POST['survey'] );
$deployment = new Deployment;
$deployment->Label = $_POST['label'];
$deployment->DeploymentType = $_POST['type'];
$deployment->CountryCode = $_POST['country'];
$deployment->DeploymentSurveyID = $_POST['survey'];
if($survey){
$deployment->OrgID = $survey->OrgID;
}else{
$deployment->OrgID = 0;
}
$deployment->IsPublic = 1;
$deployment->write();
$this->owner->setMessage('Success', '<b>' . $_POST['label'] . '</b> added as a new Deployment.');
Controller::curr()->redirectBack();
}
function WorkloadsSummary() {
return SangriaPage_Controller::generateSelectListSummary("WorkloadsDescription",
Deployment::$workloads_description_options);
}
function DeploymentToolsSummary() {
return SangriaPage_Controller::generateSelectListSummary("DeploymentTools",
Deployment::$deployment_tools_options);
}
function OperatingSystemSummary() {
return SangriaPage_Controller::generateSelectListSummary("OperatingSystems",
Deployment::$operating_systems_options);
}
function WhyNovaNetwork() {
$filterWhereClause = SangriaPage_Controller::generateFilterWhereClause();
$list = DataObject::get("Deployment","WhyNovaNetwork IS NOT NULL".$filterWhereClause,"WhyNovaNetwork");
return $list;
}
}

View File

@ -0,0 +1,419 @@
<?php
/**
* Copyright 2014 Openstack.org
* 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.
**/
/**
* Class SangriaPageExportDataExtension
*/
final class SangriaPageExportDataExtension extends Extension
{
public function onBeforeInit()
{
Config::inst()->update(get_class($this), 'allowed_actions', array(
'ExportData',
'exportCLAUsers',
'exportGerritUsers',
'ExportSurveyResults',
'ExportAppDevSurveyResults',
'exportFoundationMembers',
'exportCorporateSponsors',
));
Config::inst()->update(get_class($this->owner), 'allowed_actions', array(
'ExportData',
'exportCLAUsers',
'exportGerritUsers',
'ExportSurveyResults',
'ExportAppDevSurveyResults',
'exportFoundationMembers',
'exportCorporateSponsors',
));
}
function ExportData()
{
$this->Title = 'Export Data';
Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js");
Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js");
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::javascript("themes/openstack/javascript/jquery.validate.custom.methods.js");
Requirements::javascript('themes/openstack/javascript/sangria/sangria.page.export.data.js');
return $this->owner->getViewer('ExportData')->process($this->owner);
}
function exportCLAUsers()
{
$params = $this->owner->getRequest()->getVars();
if (!isset($params['fields']) || empty($params['fields']))
return $this->owner->httpError('412', 'missing required param fields');
if (!isset($params['ext']) || empty($params['ext']))
return $this->owner->httpError('412', 'missing required param ext');
$fields = $params['fields'];
$ext = $params['ext'];
$sanitized_fields = array();
if (!count($fields)) {
return $this->httpError('412', 'missing required param fields');
}
$allowed_fields = array('ID' => 'ID', 'FirstName' => 'FirstName', 'SurName' => 'SurName', 'Email' => 'Email');
for ($i = 0; $i < count($fields); $i++) {
if (!array_key_exists($fields[$i], $allowed_fields))
return $this->httpError('412', 'invalid field');
array_push($sanitized_fields, 'M.' . $fields[$i]);
}
$sanitized_fields = implode(',', $sanitized_fields);
$sql = <<< SQL
SELECT {$sanitized_fields}
, GROUP_CONCAT(G.Code, ' | ') AS Groups
FROM Member M
LEFT JOIN Group_Members GM on GM.MemberID = M.ID
LEFT JOIN `Group` G on G.ID = GM.GroupID
WHERE GerritID IS NOT NULL
GROUP BY M.ID
ORDER BY M.SurName, M.FirstName;
SQL;
$result = DB::query($sql);
$data = array();
array_push($fields, 'Groups');
foreach ($result as $row) {
$member = array();
foreach ($fields as $field) {
$member[$field] = $row[$field];
}
array_push($data, $member);
}
$filename = "CLAMembers" . date('Ymd') . "." . $ext;
return CSVExporter::getInstance()->export($filename, $data);
}
function exportGerritUsers()
{
$params = $this->owner->getRequest()->getVars();
if (!isset($params['status']) || empty($params['status']))
return $this->owner->httpError('412', 'missing required param status');
if (!isset($params['ext']) || empty($params['ext']))
return $this->owner->httpError('412', 'missing required param ext');
$status = $params['status'];
$ext = $params['ext'];
$sanitized_filters = array();
$allowed_filter_values = array('foundation-members' => 'foundation-members', 'community-members' => 'community-members');
for ($i = 0; $i < count($status); $i++) {
if (!array_key_exists($status[$i], $allowed_filter_values))
return $this->httpError('412', 'invalid filter value');
array_push($sanitized_filters, $status[$i]);
}
$sanitized_filters = implode("','", $sanitized_filters);
$sql = <<<SQL
SELECT M.FirstName,
M.Surname,
M.Email,
COALESCE(NULLIF(M.SecondEmail , ''), 'N/A') AS Secondary_Email ,
M.GerritID,
COALESCE(NULLIF(M.LastCodeCommit, ''), 'N/A') AS LastCodeCommitDate,
g.Code as Member_Status,
CASE g.Code WHEN 'foundation-members' THEN (SELECT LA.Created FROM LegalAgreement LA WHERE LA.MemberID = M.ID and LA.LegalDocumentPageID = 422) ELSE 'N/A'END AS FoundationMemberJoinDate,
CASE g.Code WHEN 'foundation-members' THEN 'N/A' ELSE ( SELECT ActionDate FROM FoundationMemberRevocationNotification WHERE RecipientID = M.ID AND Action = 'Revoked') END AS DateMemberStatusChanged ,
GROUP_CONCAT(O.Name, ' | ') AS Company_Affiliations
FROM Member M
LEFT JOIN Affiliation A on A.MemberID = M.ID
LEFT JOIN Org O on O.ID = A.OrganizationID
INNER JOIN Group_Members gm on gm.MemberID = M.ID
INNER JOIN `Group` g on g.ID = gm.GroupID and ( g.Code = 'foundation-members' or g.Code = 'community-members')
WHERE GerritID IS NOT NULL AND g.Code IN ('{$sanitized_filters}')
GROUP BY M.ID;
SQL;
$res = DB::query($sql);
$fields = array('FirstName', 'Surname', 'Email', 'Secondary_Email', 'GerritID', 'LastCodeCommitDate', 'Member_Status', 'FoundationMemberJoinDate', 'DateMemberStatusChanged', 'Company_Affiliations');
$data = array();
foreach ($res as $row) {
$member = array();
foreach ($fields as $field) {
$member[$field] = $row[$field];
}
array_push($data, $member);
}
$filename = "GerritUsers" . date('Ymd') . "." . $ext;
return CSVExporter::getInstance()->export($filename, $data);
}
public function Groups()
{
$sql = <<<SQL
SELECT G.Code,G.Title,G.ClassName FROM `Group` G ORDER BY G.Title;
SQL;
$result = DB::query($sql);
// let Silverstripe work the magic
$groups = new ArrayList();
foreach ($result as $rowArray) {
// $res: new Product($rowArray)
$groups->push(new $rowArray['ClassName']($rowArray));
}
}
// Export CSV of all Deployment Surveys and Associated Deployments
function ExportSurveyResults()
{
$fileDate = date('Ymdhis');
SangriaPage_Controller::generateDateFilters('s');
$surveyQuery = "select s.ID as SurveyID, s.Created as SurveyCreated,
s.UpdateDate as SurveyEdited, o.Name as OrgName, o.ID as OrgID , d.ID as DeploymentID,
d.Created as DeploymentCreated, d.UpdateDate as DeploymentEdited, m.FirstName,
m.Surname, m.Email, s.Title, s.Industry, s.OtherIndustry, s.PrimaryCity,
s.PrimaryState, s.PrimaryCountry, s.OrgSize, s.OpenStackInvolvement,
s.InformationSources, s.OtherInformationSources, s.FurtherEnhancement,
s.FoundationUserCommitteePriorities, s.UserGroupMember, s.UserGroupName,
s.OkToContact, s.BusinessDrivers, s.OtherBusinessDrivers, s.WhatDoYouLikeMost,
s.OpenStackRecommendRate as NetPromoter, s.OpenStackRecommendation,
d.Label, d.IsPublic, d.DeploymentType, d.ProjectsUsed, d.CurrentReleases,
d.DeploymentStage, d.NumCloudUsers, d.APIFormats, d.Hypervisors, d.OtherHypervisor,
d.BlockStorageDrivers, d.OtherBlockStorageDriver, d.NetworkDrivers,
d.OtherNetworkDriver, d.IdentityDrivers, d.OtherIndentityDriver,
d.SupportedFeatures, d.ComputeNodes, d.ComputeCores, d.ComputeInstances,
d.BlockStorageTotalSize, d.ObjectStorageSize, d.ObjectStorageNumObjects,
d.NetworkNumIPs, d.WorkloadsDescription, d.OtherWorkloadsDescription,
d.WhyNovaNetwork, d.OtherWhyNovaNetwork, d.DeploymentTools, d.OtherDeploymentTools, d.OperatingSystems,
d.OtherOperatingSystems, d.SwiftGlobalDistributionFeatures, d.SwiftGlobalDistributionFeaturesUsesCases,
d.OtherSwiftGlobalDistributionFeaturesUsesCases, d.Plans2UseSwiftStoragePolicies,
d.OtherPlans2UseSwiftStoragePolicies, d.UsedDBForOpenStackComponents,
d.OtherUsedDBForOpenStackComponents, d.ToolsUsedForYourUsers, d.OtherToolsUsedForYourUsers,
d.Reason2Move2Ceilometer
from DeploymentSurvey s
left outer join Member m on (s.MemberID = m.ID)
left outer join Deployment d on (d.DeploymentSurveyID = s.ID)
left outer join Org o on (s.OrgID = o.ID)
where s.Title is not null AND " . SangriaPage_Controller::$date_filter_query . "
order by s.ID;";
$res = DB::query($surveyQuery);
$fields = array('SurveyID', 'SurveyCreated', 'SurveyEdited', 'OrgName', 'OrgID', 'DeploymentID', 'DeploymentCreated', 'DeploymentEdited', 'FirstName',
'Surname', 'Email', 'Title', 'Industry', 'OtherIndustry', 'PrimaryCity', 'PrimaryState', 'PrimaryCountry', 'OrgSize', 'OpenStackInvolvement', 'InformationSources',
'OtherInformationSources', 'FurtherEnhancement', 'FoundationUserCommitteePriorities', 'UserGroupMember', 'UserGroupName', 'OkToContact', 'BusinessDrivers',
'OtherBusinessDrivers', 'WhatDoYouLikeMost', 'NetPromoter', 'OpenStackRecommendation', 'Label', 'IsPublic', 'DeploymentType', 'ProjectsUsed',
'CurrentReleases', 'DeploymentStage', 'NumCloudUsers', 'APIFormats', 'Hypervisors', 'OtherHypervisor', 'BlockStorageDrivers', 'OtherBlockStorageDriver',
'NetworkDrivers', 'OtherNetworkDriver', 'IdentityDrivers', 'OtherIndentityDriver', 'SupportedFeatures', 'ComputeNodes', 'ComputeCores', 'ComputeInstances',
'BlockStorageTotalSize', 'ObjectStorageSize', 'ObjectStorageNumObjects', 'NetworkNumIPs', 'WorkloadsDescription', 'OtherWorkloadsDescription',
'WhyNovaNetwork', 'OtherWhyNovaNetwork', 'DeploymentTools', 'OtherDeploymentTools', 'OperatingSystems', 'OtherOperatingSystems', 'SwiftGlobalDistributionFeatures',
'SwiftGlobalDistributionFeaturesUsesCases', 'OtherSwiftGlobalDistributionFeaturesUsesCases', 'Plans2UseSwiftStoragePolicies', 'OtherPlans2UseSwiftStoragePolicies',
'UsedDBForOpenStackComponents', 'OtherUsedDBForOpenStackComponents', 'ToolsUsedForYourUsers', 'OtherToolsUsedForYourUsers', 'Reason2Move2Ceilometer');
$data = array();
foreach ($res as $row) {
$member = array();
foreach ($fields as $field) {
$member[$field] = $row[$field];
}
array_push($data, $member);
}
$filename = "survey_results" . $fileDate . ".csv";
return CSVExporter::getInstance()->export($filename, $data, ',');
}
// Export CSV of all App Dev Surveys
function ExportAppDevSurveyResults()
{
$fileDate = date('Ymdhis');
SangriaPage_Controller::generateDateFilters('s');
$surveyQuery = "select s.ID as SurveyID, s.Created as SurveyCreated,
s.LastEdited as SurveyEdited, o.Name as OrgName, o.ID as OrgID, a.ID as AppSurveyID,
a.Created as AppSurveyCreated, a.LastEdited as AppSurveyEdited, m.FirstName,
m.Surname, m.Email, s.Title, s.Industry, s.OtherIndustry, s.PrimaryCity,
s.PrimaryState, s.PrimaryCountry, s.OrgSize, s.OpenStackInvolvement,
s.InformationSources, s.OtherInformationSources, s.FurtherEnhancement,
s.FoundationUserCommitteePriorities, s.UserGroupMember, s.UserGroupName,
s.OkToContact, s.BusinessDrivers, s.OtherBusinessDrivers, s.WhatDoYouLikeMost,
a.Toolkits, a.OtherToolkits, a.ProgrammingLanguages, a.OtherProgrammingLanguages,
a.APIFormats, a.DevelopmentEnvironments, a.OtherDevelopmentEnvironments,
a.OperatingSystems, a.OtherOperatingSystems, a.ConfigTools, a.OtherConfigTools,
a.StateOfOpenStack, a.DocsPriority, a.InteractionWithOtherClouds
from DeploymentSurvey s
right join AppDevSurvey a on (a.DeploymentSurveyID = s.ID)
left outer join Member m on (a.MemberID = m.ID)
left outer join Org o on (s.OrgID = o.ID)
where s.Title is not null AND " . SangriaPage_Controller::$date_filter_query . "
order by s.ID;";
$res = DB::query($surveyQuery);
$fields = array('SurveyID', 'SurveyCreated', 'SurveyEdited', 'OrgName', 'OrgID', 'AppSurveyID', 'AppSurveyCreated', 'AppSurveyEdited', 'FirstName',
'Surname', 'Email', 'Title', 'Industry', 'OtherIndustry', 'PrimaryCity', 'PrimaryState', 'PrimaryCountry', 'OrgSize', 'OpenStackInvolvement', 'InformationSources',
'OtherInformationSources', 'FurtherEnhancement', 'FoundationUserCommitteePriorities', 'UserGroupMember', 'UserGroupName', 'OkToContact', 'BusinessDrivers',
'OtherBusinessDrivers', 'WhatDoYouLikeMost', 'Toolkits', 'OtherToolkits', 'ProgrammingLanguages', 'OtherProgrammingLanguages', 'APIFormats', 'DevelopmentEnvironments', 'OtherDevelopmentEnvironments',
'OperatingSystems', 'OtherOperatingSystems', 'ConfigTools', 'OtherConfigTools', 'StateOfOpenStack', 'DocsPriority', 'InteractionWithOtherClouds');
$data = array();
foreach ($res as $row) {
$member = array();
foreach ($fields as $field) {
$member[$field] = $row[$field];
}
array_push($data, $member);
}
$filename = "app_dev_surveys" . $fileDate . ".csv";
return CSVExporter::getInstance()->export($filename, $data, ',');
}
function exportFoundationMembers(){
$params = $this->owner->getRequest()->getVars();
if(!isset($params['fields']) || empty($params['fields']) )
return $this->owner->httpError('412','missing required param fields');
if(!isset($params['ext']) || empty($params['ext']) )
return $this->owner->httpError('412','missing required param ext');
$fields = $params['fields'];
$ext = $params['ext'];
$sanitized_fields = array();
if(!count($fields)){
return $this->owner->httpError('412','missing required param fields');
}
$allowed_fields = array('ID'=>'ID','FirstName'=>'FirstName','SurName'=>'SurName','Email'=>'Email');
for($i=0 ; $i< count($fields);$i++){
if(!array_key_exists($fields[$i],$allowed_fields))
return $this->httpError('412','invalid field');
array_push($sanitized_fields, 'Member.'.$fields[$i]);
}
$query = new SQLQuery();
$query->setFrom('Member');
$query->setSelect($sanitized_fields);
$query->addInnerJoin('Group_Members','Group_Members.MemberID = Member.ID');
$query->addInnerJoin('Group',"Group.ID = Group_Members.GroupID AND Group.Code='foundation-members'");
$query->setOrderBy('SurName,FirstName');
$result = $query->execute();
$data = array();
foreach($result as $row){
$member = array();
foreach($fields as $field){
$member[$field] = $row[$field];
}
array_push($data,$member);
}
$filename = "FoundationMembers" . date('Ymd') . ".".$ext;
return CSVExporter::getInstance()->export($filename, $data);
}
function exportCorporateSponsors(){
$params = $this->owner->getRequest()->getVars();
if(!isset($params['levels']) || empty($params['levels']) )
return $this->owner->httpError('412','missing required param level');
if(!isset($params['fields']) || empty($params['fields']) )
return $this->owner->httpError('412','missing required param fields');
if(!isset($params['ext']) || empty($params['ext']) )
return $this->owner->httpError('412','missing required param ext');
$level = $params['levels'];
$fields = $params['fields'];
$ext = $params['ext'];
$sanitized_fields = array();
if(!count($fields)){
return $this->owner->httpError('412','missing required param fields');
}
if(!count($level)){
return $this->owner->httpError('412','missing required param $level');
}
$allowed_fields = array('MemberLevel'=>'MemberLevel','Name'=>'Name','City'=>'City','State'=>'State','Country'=>'Country','Industry'=>'Industry','ContactEmail'=>'ContactEmail','AdminEmail'=>'AdminEmail');
$allowed_levels = array('Platinum'=>'Platinum', 'Gold'=>'Gold','Startup'=>'Startup','Mention'=>'Mention');
for($i = 0 ; $i< count($fields);$i++){
if(!array_key_exists($fields[$i],$allowed_fields))
return $this->httpError('412','invalid field');
array_push($sanitized_fields, 'Company.'.$fields[$i]);
}
for($i = 0 ; $i< count($level);$i++){
if(!array_key_exists($level[$i],$allowed_levels))
return $this->httpError('412','invalid level');
}
$query = new SQLQuery();
$query->setFrom('Company');
$query->setSelect($sanitized_fields);
$query->setWhere(" MemberLevel IN ('".implode("','",$level) ."')");
$query->setOrderBy('MemberLevel');
$result = $query->execute();
$data = array();
foreach($result as $row){
$company = array();
foreach($fields as $field){
$company[$field] = $row[$field];
}
array_push($data,$company);
}
$filename = "Companies" . date('Ymd') . ".".$ext;
return CSVExporter::getInstance()->export($filename, $data);
}
}

View File

@ -0,0 +1,58 @@
<?php
/**
* Copyright 2014 Openstack.org
* 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.
**/
/**
* Class SangriaPageInvolvementTypeExtension
*/
final class SangriaPageInvolvementTypeExtension extends Extension {
public function onBeforeInit(){
Config::inst()->update(get_class($this), 'allowed_actions', array(
'AddInvolvementType',
'AddInvolvementTypeForm',
'GenerateAutoLoginHashes',
));
Config::inst()->update(get_class($this->owner), 'allowed_actions', array(
'AddInvolvementType',
'AddInvolvementTypeForm',
'GenerateAutoLoginHashes',
));
}
// Involvement Types
function InvolvementTypes() {
return DataObject::get("InvolvementType");
}
function AddInvolvementTypeForm() {
return new AddInvolvementTypeForm($this->owner, 'AddInvolvementTypeForm');
}
function GenerateAutoLoginHashes() {
$startVal = 0;
if (isset($_GET["startID"]) && intval($_GET["startID"]) > 0 ) {
$startVal = intval($_GET["startID"]);
}
$members = Member::get()->filter(array('SubscribedToNewsletter' => 1, 'ID:GreaterThan' => $startVal))->order('ID')->leftJoin('Group_Members', "`Member`.`ID` = `Group_Members`.`MemberID` AND Group_Members.GroupID = 5 ");
foreach( $members as $member ) {
$token = $member->generateAutologinTokenAndStoreHash(14);
echo "\"".$member->ID."\",\"".$member->Email."\",\"".$member->FirstName."\",\"".$member->Surname."\",\"".urldecode($token)."\"<br/>";
flush();
}
}
}

View File

@ -0,0 +1,94 @@
<?php
/**
* Copyright 2014 Openstack.org
* 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.
**/
/**
* Class SangriaPageStandardizeOrgNamesExtension
*/
final class SangriaPageStandardizeOrgNamesExtension extends Extension {
var $orgs_cached = array();
public function onBeforeInit(){
Config::inst()->update(get_class($this), 'allowed_actions', array(
'StandardizeOrgNames',
'MarkOrgStandardized',
'RemoveDuplicateOrg'));
Config::inst()->update(get_class($this->owner), 'allowed_actions', array(
'StandardizeOrgNames',
'MarkOrgStandardized',
'RemoveDuplicateOrg'));
}
// Org Standardization
function Orgs() {
$orgs = DataObject::get("Org","Name");
return $orgs;
}
function NonStandardizedOrgs() {
$orgs = DataObject::get("Org","IsStandardizedOrg = 0","Name",null,150);
return $orgs;
}
function StandardizedOrgs() {
global $orgs_cached;
if( count($orgs_cached) > 0 ) {
return $orgs_cached;
} else {
$orgs = DataObject::get("Org","IsStandardizedOrg = 1","Name");
$orgs_cached = $orgs;
return $orgs;
}
}
function MarkOrgStandardized() {
if(isset($_GET['orgId']) && is_numeric($_GET['orgId'])) {
$orgId = $_GET['orgId'];
}
$org = DataObject::get_by_id("Org",$orgId);
$org->IsStandardizedOrg = 1;
$org->write();
Controller::curr()->redirectBack();
}
function RemoveDuplicateOrg() {
if(isset($_POST['oldOrgIds']) && is_array($_POST['oldOrgIds'])) {
$oldOrgIds = $_POST['oldOrgIds'];
}
foreach( $oldOrgIds as $oldId => $newId) {
if( $newId == "STANDARDIZE") {
$org = DataObject::get_by_id("Org",$oldId);
$org->IsStandardizedOrg = 1;
$org->write();
} else if( $newId != 0 ) {
$oldOrg = DataObject::get_by_id("Org",$oldId);
$newOrg = DataObject::get_by_id("Org",$newId);
// Update all members with new Org
DB::query("UPDATE `Affiliation` SET `OrganizationID` = ".$newId." WHERE `OrganizationID` = ".$oldId);
// Remove old Org
DB::query("DELETE FROM `Org` WHERE `ID` = ".$oldId);
}
}
Controller::curr()->redirectBack();
}
}

View File

@ -0,0 +1,62 @@
<?php
/**
* Copyright 2014 Openstack.org
* 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.
**/
/**
* Class SangriaPageSurveyDetailsExtension
*/
final class SangriaPageSurveyDetailsExtension extends Extension {
public function onBeforeInit(){
Config::inst()->update(get_class($this), 'allowed_actions', array(
'SetCaseStudy',
'SurveyDetails',
));
Config::inst()->update(get_class($this->owner), 'allowed_actions', array(
'SetCaseStudy',
'SurveyDetails',
));
}
function SetCaseStudy() {
if(isset($_GET['ID']) && is_numeric($_GET['ID'])) {
$UserStory = $_GET['ID'];
}else{
die();
}
$setCaseStudy = ($_GET['Set'] == 1)? 1 : 0;
$story = SiteTree::get_by_id("UserStory",$UserStory);
$story->ShowCaseStudy = $setCaseStudy;
$story->write();
$story->publish("Live","Stage");
$this->owner->setMessage('Success', 'Case Study updated for <b>' . $story->Title . '</b>');
Controller::curr()->redirectBack();
}
function SurveyDetails(){
$params = $this->owner->request->allParams();
$survey_id = intval(Convert::raw2sql($params["ID"]));;
$survey = DeploymentSurvey::get()->byID($survey_id);
if($survey)
return $this->owner->Customise($survey)->renderWith(array('SangriaPage_SurveyDetails','SangriaPage','SangriaPage'));
return $this->owner->httpError(404, 'Sorry that Deployment Survey could not be found!.');
}
}

View File

@ -0,0 +1,82 @@
<?php
/**
* Copyright 2014 Openstack.org
* 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.
**/
/***
* Class SangriaPageViewCurrentStoriesExtension
*/
final class SangriaPageViewCurrentStoriesExtension extends Extension {
public function onBeforeInit(){
Config::inst()->update(get_class($this), 'allowed_actions',array(
'ViewCurrentStories',
'UpdateStories',
'SetAdminSS',
));
Config::inst()->update(get_class($this->owner), 'allowed_actions',array(
'ViewCurrentStories',
'UpdateStories',
'SetAdminSS',
));
}
// Update Stories Industry and Order
function UpdateStories(){
foreach($_POST['industry'] as $story_id => $industry){
$story = SiteTree::get_by_id("UserStory",$story_id);
$story->UserStoriesIndustryID = $industry;
$story->Sort = $_POST['order'][$story_id];
$story->Video = $_POST['video'][$story_id];
$story->Title = $_POST['title'][$story_id];
$story->ShowVideo = ($_POST['video'][$story_id])? true : false;
$story->write();
$story->publish("Live","Stage");
}
$this->owner->setMessage('Success', 'User Stories saved.');
}
function SetAdminSS() {
if(isset($_GET['ID']) && is_numeric($_GET['ID'])) {
$UserStory = $_GET['ID'];
}else{
die();
}
$showinAdmin = ($_GET['Set'] == 1)? 1 : 0;
$story = SiteTree::get_by_id("UserStory", $UserStory);
$parent = UserStoryHolder::get()->first();
if(!$parent){
$this->owner->setMessage('Error', 'could not publish user story bc there is not any available parent page(UserStoryHolder).');
Controller::curr()->redirectBack();
}
$story->ShowInAdmin = $showinAdmin;
$story->setParent($parent); // Should set the ID once the Holder is created...
$story->write();
$story->publish("Live","Stage");
$this->owner->setMessage('Success', '<b>' . $story->Title . '</b> updated.');
Controller::curr()->redirectBack();
}
function UserStoriesIndustries(){
return UserStoriesIndustry::get()->filter('Active', 1);
}
}

View File

@ -0,0 +1,44 @@
<?php
/**
* Copyright 2014 Openstack.org
* 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.
**/
/**
* Class SangriaPageViewSpeakingSubmissionsExtension
*/
final class SangriaPageViewSpeakingSubmissionsExtension
extends Extension {
public function onBeforeInit(){
Config::inst()->update(get_class($this), 'allowed_actions',array(
'ViewSpeakingSubmissions',
));
Config::inst()->update(get_class($this->owner), 'allowed_actions',array(
'ViewSpeakingSubmissions',
));
}
// Speaking Submissions
function SpeakingSubmissions() {
$submissions = DataObject::get("SpeakerSubmission","Created > '2012-11-01'","Created desc");
SangriaPage_Controller::$submissionsCount = $submissions->Count();
return $submissions;
}
function SpeakingSubmissionCount() {
$this->SpeakingSubmissions();
return SangriaPage_Controller::$submissionsCount;
}
}

View File

@ -0,0 +1,144 @@
<?php
/**
* Copyright 2014 Openstack.org
* 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.
**/
/***
* Class SangriaSetCategorySponsorsExtension
*/
final class SangriaSetCategorySponsorsExtension extends Extension {
public function onBeforeInit(){
Config::inst()->update(get_class($this), 'allowed_actions',array(
'SetCategorySponsors',
'UpdateSponsor',
'SetSponsorMarketplaces',
));
Config::inst()->update(get_class($this->owner), 'allowed_actions',array(
'SetCategorySponsors',
'UpdateSponsor',
'SetSponsorMarketplaces',
));
}
// Sponsors
function SponsorsRequest(){
return DataObject::get('Sponsor','Approved = 0');
}
function SponsorsApproved(){
return DataObject::Get('Sponsor','Approved = 2');
}
function SponsorViaGet(){
return DataObject::get_one('Sponsor','ID = ' . intval($_GET['sponsor_id']));
}
function SponsorsMarketplaces(){
$list = new ArrayList();
for ($i=1; $i<=5; $i++){
$do = new DataObject();
$do->Name = 'Market '.$i;
$do->Key = $i;
$list->push($do);
}
return $list;
}
/*function UpdateSponsor(){
$sponsor = DataObject::get_one('Sponsor','ID = ' . intval($_GET['sponsor_id']));
switch($_GET['action']){
case 'approved':
$sponsor->Approved = 1;
break;
case 'rejected':
$sponsor->Approved = -1;
break;
default:
throw new Exception('Method not allowed.');
die();
break;
}
$marketplaces = explode(',', $sponsor->Category);
foreach($marketplaces as $m){
$market = new SponsorMarketplace();
$market->SponsorID = $sponsor->ID;
$market->MarketplaceID = $m;
$market->write();
}
$contract_template = DataObject::get_one('ContractTemplate', " Type = 'General' ");
$contract_url = Director::baseFolder($contract_template->PDF()->URL).$contract_template->PDF()->URL;
$ESLoader = new SplClassLoader('EchoSign', realpath(__DIR__.'/../../'));
$ESLoader->register();
$client = new SoapClient(EchoSign\API::getWSDL());
$api = new EchoSign\API($client, 'PGRUY64K6T664Z');
$file = EchoSign\Info\FileInfo::createFromFile($contract_url);
$document = new EchoSign\Info\DocumentCreationInfo('This is a test contract', $file);
$recipients = new EchoSign\Info\RecipientInfo;
$recipients->addRecipient( $sponsor->LegalEmail );
$document->setRecipients($recipients);
$contract = new Contract();
$contract->SponsorID = $sponsor->ID;
$contract->write();
$url = 'http://openstack.dev9.tipit.net/contract/UpdateStatus?id=' . $contract->ID;
$document->setCallbackInfo($url);
$result = $api->sendDocument($document);
$contract->EchosignID = $result->documentKeys->DocumentKey->documentKey;
$contract->write();
$sponsor->write();
mail($sponsor->Email,'Your Sponsor Request has been ' . $_GET['action'], 'Awesome!');
$this->setMessage('Success', '<b>' . $sponsor->CompanyName . '</b>: Updated');
Director::redirect('/sangria/ViewSponsorsRequest');
}*/
function SetSponsorMarketplaces(){
$sponsor_id = intval($_POST['SponsorID']);
DB::query("DELETE FROM `SponsorMarketplace` WHERE SponsorID = " . $sponsor_id . "");
foreach($_POST['marketplaces'] as $markets){
$market = new SponsorMarketplace();
$market->SponsorID = $sponsor_id;
$market->MarketplaceID = $markets;
$market->write();
}
Controller::curr()->redirect('/sangria/SetCategorySponsors');
}
}

View File

@ -64,8 +64,9 @@ class EditProfilePage_Controller extends Page_Controller
Requirements::css("themes/openstack/css/chosen.css", "screen,projection"); Requirements::css("themes/openstack/css/chosen.css", "screen,projection");
Requirements::css('registration/css/edit.profile.page.css'); Requirements::css('registration/css/edit.profile.page.css');
Requirements::css("themes/openstack/javascript/jquery-ui-1.10.3.custom/css/smoothness/jquery-ui-1.10.3.custom.min.css");
Requirements::css("registration/css/affiliations.css"); Requirements::css("registration/css/affiliations.css");
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js"); Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js");
Requirements::javascript("themes/openstack/javascript/pure.min.js"); Requirements::javascript("themes/openstack/javascript/pure.min.js");
@ -73,12 +74,11 @@ class EditProfilePage_Controller extends Page_Controller
Requirements::javascript("themes/openstack/javascript/jquery.cleanform.js"); Requirements::javascript("themes/openstack/javascript/jquery.cleanform.js");
Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js");
Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"); Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js");
Requirements::javascript("themes/openstack/javascript/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.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.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('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;
@ -457,8 +457,9 @@ class EditProfilePage_Controller extends Page_Controller
function AddTrainingCourseForm() { function AddTrainingCourseForm() {
Requirements::css("themes/openstack/javascript/jquery-ui-1.10.3.custom/css/smoothness/jquery-ui-1.10.3.custom.min.css"); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::javascript("themes/openstack/javascript/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js"); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::javascript("datepicker/javascript/datepicker.js"); Requirements::javascript("datepicker/javascript/datepicker.js");
Requirements::javascript('registration/javascript/edit.profile.training.form.js'); Requirements::javascript('registration/javascript/edit.profile.training.form.js');

View File

@ -30,18 +30,16 @@ class RegistrationPage_Controller extends Page_Controller
{ {
parent::init(); parent::init();
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::css("themes/openstack/css/chosen.css", "screen,projection"); Requirements::css("themes/openstack/css/chosen.css", "screen,projection");
Requirements::css("themes/openstack/javascript/jquery-ui-1.10.3.custom/css/smoothness/jquery-ui-1.10.3.custom.min.css");
Requirements::css("registration/css/affiliations.css"); Requirements::css("registration/css/affiliations.css");
Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js"); Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js");
Requirements::javascript("themes/openstack/javascript/pure.min.js"); Requirements::javascript("themes/openstack/javascript/pure.min.js");
Requirements::javascript("themes/openstack/javascript/jquery.serialize.js"); Requirements::javascript("themes/openstack/javascript/jquery.serialize.js");
Requirements::javascript("themes/openstack/javascript/jquery.cleanform.js"); Requirements::javascript("themes/openstack/javascript/jquery.cleanform.js");
Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js");
Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js");
Requirements::javascript("themes/openstack/javascript/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.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.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");

View File

@ -28,18 +28,16 @@ class SpeakerVotingRegistrationPage_Controller extends Page_Controller
{ {
parent::init(); parent::init();
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::css("themes/openstack/css/chosen.css", "screen,projection"); Requirements::css("themes/openstack/css/chosen.css", "screen,projection");
Requirements::css("themes/openstack/javascript/jquery-ui-1.10.3.custom/css/smoothness/jquery-ui-1.10.3.custom.min.css");
Requirements::css("registration/css/affiliations.css"); Requirements::css("registration/css/affiliations.css");
Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js"); Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js");
Requirements::javascript("themes/openstack/javascript/pure.min.js"); Requirements::javascript("themes/openstack/javascript/pure.min.js");
Requirements::javascript("themes/openstack/javascript/jquery.serialize.js"); Requirements::javascript("themes/openstack/javascript/jquery.serialize.js");
Requirements::javascript("themes/openstack/javascript/jquery.cleanform.js"); Requirements::javascript("themes/openstack/javascript/jquery.cleanform.js");
Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js");
Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js");
Requirements::javascript("themes/openstack/javascript/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.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.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");

View File

@ -25,6 +25,6 @@
} }
.affiliation-info{ .affiliation-info{
width: 200px !important; width: 300px !important;
float: left; float: left;
} }

View File

@ -4,12 +4,13 @@ label.error{
color: #fff; color: #fff;
padding: 5px; padding: 5px;
margin: 0; margin: 0;
width: 100%; width: auto;
float:left; float:left;
-webkit-border-radius: 05px; -webkit-border-radius: 05px;
-moz-border-radius: 05px; -moz-border-radius: 05px;
border-radius: 05px; border-radius: 05px;
} }
input.error{ input.error{
border: 1px solid #aa2222; border: 1px solid #aa2222;
} }

View File

@ -103,10 +103,12 @@
if(org_name.length>0){ if(org_name.length>0){
org_name.autocomplete({ org_name.autocomplete({
source: rest_urls.ListOrganizations, source: rest_urls.ListOrganizations,
minLength: 2 minLength: 2,
open: function( event, ui ) {
org_name.autocomplete("widget").css('z-index',5000);
}
}); });
org_name.autocomplete("widget").css('z-index',1000);
} }
var date_picker_start = $(affiliation_form_id+"_StartDate"); var date_picker_start = $(affiliation_form_id+"_StartDate");

View File

@ -1,9 +1,8 @@
<h2>Add an Involvement Type</h2> <h2>Add an Involvement Type</h2>
<h3>Involvement Types</h3> <h3>Involvement Types</h3>
<% if InvolvementTypes %>
<% loop InvolvementTypes %> <% loop InvolvementTypes %>
<p>$Name</p> <p>$Name</p>
<% end_loop %> <% end_loop %>
<% end_if %>
$AddInvolvementTypeForm $AddInvolvementTypeForm

View File

@ -0,0 +1,16 @@
<div stlye="display:block;clear:both">
<h1>Set Category for Sponsors</h1>
<% if SponsorsApproved %>
<% control SponsorsApproved %>
<ul>
<li><h2>$CompanyName</h2>
<form method="POST" action="/sangria/SetSponsorMarketplaces">
<input type="hidden" name="SponsorID" value="$ID">
<p>$ApproveCategoriesForm</p>
<p><input type="submit" value="Update" class="roundedButton" /><p>
</form>
</li>
</ul>
<% end_control %>
<% end_if %>
</div>

View File

@ -4,13 +4,13 @@
} }
</style> </style>
<h1 style="width:75%;float:left;">User Stories</h1> <h1 style="width:75%;float:left;">User Stories</h1>
<a href="/sangria/ViewDeploymentDetails" class="roundedButton" style="white-space: nowrap;text-align:center;font-weight:normal;float:right;width:20%;margin-bottom:15px">View Deployment List</a> <a href="$Top.Link(ViewDeploymentDetails)" class="roundedButton" style="white-space: nowrap;text-align:center;font-weight:normal;float:right;width:20%;margin-bottom:15px">View Deployment List</a>
<hr/> <hr/>
<% loop UserStoriesIndustries %> <% loop UserStoriesIndustries %>
<% if Stories %> <% if Stories %>
<h3>$IndustryName</h3> <h3>$IndustryName</h3>
<form method="POST" action="/sangria/UpdateStories" class="UpdateStories"> <form method="POST" action="$Top.Link(UpdateStories)" class="UpdateStories">
<table style="border: 1px solid #ccc; border-collapse:collapse;" class="stories"> <table style="border: 1px solid #ccc; border-collapse:collapse;" class="stories">
<tr> <tr>
<th style="border: 1px solid #ccc;width:1%"></th> <th style="border: 1px solid #ccc;width:1%"></th>

View File

@ -19,7 +19,7 @@
</div> </div>
<div class="addDeploymentForm"> <div class="addDeploymentForm">
<form method="POST" action="/sangria/AddNewDeployment"> <form method="POST" action="$Top.Link(AddNewDeployment)">
<table style="border: 1px solid #ccc; border-collapse:collapse;clear:both;"> <table style="border: 1px solid #ccc; border-collapse:collapse;clear:both;">
<tr> <tr>
<th style="border: 1px solid #ccc;">Deployment Name</th> <th style="border: 1px solid #ccc;">Deployment Name</th>
@ -104,7 +104,7 @@
</tr> </tr>
<% loop Deployments %> <% loop Deployments %>
<tr> <tr>
<form method="GET" action="sangria/AddUserStory"> <form method="GET" action="$Top.Link(AddUserStory)">
<input type="hidden" value="$ID" name="ID"> <input type="hidden" value="$ID" name="ID">
<td style="border: 1px solid #ccc;"> <td style="border: 1px solid #ccc;">
<input type="hidden" name="org" value="$Org.Name"> <input type="hidden" name="org" value="$Org.Name">

View File

@ -0,0 +1,11 @@
<div stlye="display:block;clear:both">
<h1>Sponsor Requests</h1>
<% if SponsorsRequest %>
<% control SponsorsRequest %>
<ul>
<li>$CompanyName</li>
<li><a href="sangria/SponsorApprove?sponsor_id=$ID">Approve or Reject</a></li>
</ul>
<% end_control %>
<% end_if %>
</div>