[spalenque] - #6968 *WIP
Conflicts: marketplace/_config.php marketplace/code/interfaces/restfull_api/marketplace/ConsultantsCrudApi.php marketplace/templates/Layout/Includes/MarketPlaceAdminPage_implementations_list.ss
This commit is contained in:
parent
8bc923482f
commit
073cd5cd19
@ -36,4 +36,4 @@ Object::add_extension('OpenStackComponent', 'OpenStackComponentAdminUI');
|
||||
Object::add_extension('OpenStackApiVersion', 'OpenStackApiVersionAdminUI');
|
||||
Object::add_extension('OpenStackRelease', 'OpenStackReleaseAdminUI');
|
||||
Object::add_extension('OpenStackReleaseSupportedApiVersion', 'OpenStackReleaseSupportedApiVersionAdminUI');
|
||||
Object::add_extension('MarketPlaceAllowedInstance', 'MarketPlaceAllowedInstanceAdminUI');
|
||||
Object::add_extension('MarketPlaceAllowedInstance', 'MarketPlaceAllowedInstanceAdminUI');
|
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* Class AvailabilityZoneDraft
|
||||
*/
|
||||
class AvailabilityZoneDraft
|
||||
extends DataObject
|
||||
implements IAvailabilityZone
|
||||
{
|
||||
|
||||
static $create_table_options = array('MySQLDatabase' => 'ENGINE=InnoDB');
|
||||
|
||||
static $db = array(
|
||||
'Name' => 'Varchar',
|
||||
);
|
||||
|
||||
static $has_one = array(
|
||||
'Location' => 'DataCenterLocationDraft',
|
||||
);
|
||||
|
||||
static $indexes = array(
|
||||
'Location_Name' => array('type'=>'unique', 'value'=>'LocationID,Name'),
|
||||
);
|
||||
|
||||
/**
|
||||
* @return mixed|string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->getField('Name');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->setField('Name',$name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DataObject|IDataCenterLocation
|
||||
*/
|
||||
public function getLocation()
|
||||
{
|
||||
return AssociationFactory::getInstance()->getMany2OneAssociation($this,'Location','AvailabilityZones')->getTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IDataCenterLocation $location
|
||||
*/
|
||||
public function setLocation(IDataCenterLocation $location)
|
||||
{
|
||||
AssociationFactory::getInstance()->getMany2OneAssociation($this,'Location','AvailabilityZones')->setTarget($location);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getIdentifier()
|
||||
{
|
||||
return (int)$this->getField('ID');
|
||||
}
|
||||
}
|
@ -8,10 +8,10 @@ class CloudServiceDraft extends OpenStackImplementationDraft {
|
||||
static $create_table_options = array('MySQLDatabase' => 'ENGINE=InnoDB');
|
||||
|
||||
static $has_many = array(
|
||||
'DataCenters' => 'DataCenterLocation',
|
||||
'DataCenters' => 'DataCenterLocationDraft',
|
||||
//@override
|
||||
'Capabilities' => 'CloudServiceOffered',
|
||||
'DataCenterRegions' => 'DataCenterRegion',
|
||||
'Capabilities' => 'CloudServiceOfferedDraft',
|
||||
'DataCenterRegions' => 'DataCenterRegionDraft',
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class CloudServiceOfferedDraft
|
||||
*/
|
||||
class CloudServiceOfferedDraft
|
||||
extends OpenStackImplementationApiCoverageDraft
|
||||
implements ICloudServiceOffered
|
||||
{
|
||||
|
||||
static $create_table_options = array('MySQLDatabase' => 'ENGINE=InnoDB');
|
||||
|
||||
|
||||
static $many_many = array(
|
||||
'PricingSchemas' => 'PricingSchemaType',
|
||||
);
|
||||
|
||||
/**
|
||||
* @return IPricingSchemaType[]
|
||||
*/
|
||||
public function getPricingSchemas()
|
||||
{
|
||||
return AssociationFactory::getInstance()->getMany2ManyAssociation($this,'PricingSchemas')->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IPricingSchemaType $pricing_schema
|
||||
* @return void
|
||||
*/
|
||||
public function addPricingSchema(IPricingSchemaType $pricing_schema)
|
||||
{
|
||||
AssociationFactory::getInstance()->getMany2ManyAssociation($this,'PricingSchemas')->add($pricing_schema);
|
||||
}
|
||||
|
||||
public function clearPricingSchemas(){
|
||||
AssociationFactory::getInstance()->getMany2ManyAssociation($this,'PricingSchemas')->removeAll();
|
||||
}
|
||||
}
|
@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class DataCenterLocationDraft
|
||||
*/
|
||||
class DataCenterLocationDraft
|
||||
extends DataObject
|
||||
implements IDataCenterLocation
|
||||
{
|
||||
|
||||
static $create_table_options = array('MySQLDatabase' => 'ENGINE=InnoDB');
|
||||
|
||||
static $db = array(
|
||||
'City' => 'Varchar(125)',
|
||||
'State' => 'Varchar(50)',
|
||||
'Country' => 'Varchar(5)',
|
||||
'Lat' => 'Decimal',
|
||||
'Lng' => 'Decimal',
|
||||
);
|
||||
|
||||
static $has_one = array(
|
||||
'CloudService' => 'CloudServiceDraft',
|
||||
'DataCenterRegion' => 'DataCenterRegionDraft',
|
||||
);
|
||||
|
||||
static $has_many = array(
|
||||
'AvailabilityZones' => 'AvailabilityZoneDraft',
|
||||
);
|
||||
|
||||
static $indexes = array(
|
||||
'City_State_Country_Service_Region' => array('type'=>'unique', 'value'=>'CloudServiceID,DataCenterRegionID,City,Country,State'),
|
||||
);
|
||||
|
||||
public function setCountry($country)
|
||||
{
|
||||
$this->setField('Country',$country);
|
||||
}
|
||||
|
||||
public function getCountry()
|
||||
{
|
||||
return $this->getField('Country');
|
||||
}
|
||||
|
||||
public function setCity($city)
|
||||
{
|
||||
$this->setField('City',$city);
|
||||
}
|
||||
|
||||
public function getCity()
|
||||
{
|
||||
return $this->getField('City');
|
||||
}
|
||||
|
||||
public function setCloudService(ICloudService $cloud_service)
|
||||
{
|
||||
AssociationFactory::getInstance()->getMany2OneAssociation($this,'CloudService','DataCenters')->setTarget($cloud_service);
|
||||
}
|
||||
|
||||
public function getCloudService()
|
||||
{
|
||||
return AssociationFactory::getInstance()->getMany2OneAssociation($this,'CloudService','DataCenters')->getTarget();
|
||||
}
|
||||
|
||||
public function getAvailabilityZones()
|
||||
{
|
||||
return AssociationFactory::getInstance()->getOne2ManyAssociation($this,'AvailabilityZones')->toArray();
|
||||
}
|
||||
|
||||
public function clearAvailabilityZones()
|
||||
{
|
||||
AssociationFactory::getInstance()->getOne2ManyAssociation($this,'AvailabilityZones')->removeAll();
|
||||
}
|
||||
|
||||
public function addAvailabilityZone(IAvailabilityZone $az)
|
||||
{
|
||||
AssociationFactory::getInstance()->getOne2ManyAssociation($this,'AvailabilityZones')->add($az);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getIdentifier()
|
||||
{
|
||||
return (int)$this->getField('ID');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getState()
|
||||
{
|
||||
return $this->getField('State');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $state
|
||||
* @return void
|
||||
*/
|
||||
public function setState($state)
|
||||
{
|
||||
$this->setField('State',$state);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $lng
|
||||
* @return void
|
||||
*/
|
||||
public function setLng($lng)
|
||||
{
|
||||
$this->setField('Lng',$lng);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getLng()
|
||||
{
|
||||
return $this->getField('Lng');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $lat
|
||||
* @return void
|
||||
*/
|
||||
public function setLat($lat)
|
||||
{
|
||||
$this->setField('Lat',$lat);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getLat()
|
||||
{
|
||||
return $this->getField('Lat');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return IDataCenterRegion
|
||||
*/
|
||||
public function getDataCenterRegion()
|
||||
{
|
||||
return AssociationFactory::getInstance()->getMany2OneAssociation($this,'DataCenterRegion','Locations')->getTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IDataCenterRegion $region
|
||||
* @return void
|
||||
*/
|
||||
public function setDataCenterRegion(IDataCenterRegion $region)
|
||||
{
|
||||
AssociationFactory::getInstance()->getMany2OneAssociation($this,'DataCenterRegion','Locations')->setTarget($region);
|
||||
}
|
||||
}
|
@ -0,0 +1,128 @@
|
||||
<?php
|
||||
/**
|
||||
* Class DataCenterRegionDraft
|
||||
*/
|
||||
final class DataCenterRegionDraft
|
||||
extends DataObject implements IDataCenterRegion {
|
||||
|
||||
static $create_table_options = array('MySQLDatabase' => 'ENGINE=InnoDB');
|
||||
|
||||
static $db = array(
|
||||
'Name' => 'Varchar(100)',
|
||||
'Endpoint' => 'Varchar(512)',
|
||||
'Color' => 'Varchar(6)',
|
||||
);
|
||||
|
||||
static $has_one = array(
|
||||
'CloudService' => 'CloudServiceDraft',
|
||||
);
|
||||
|
||||
static $has_many = array(
|
||||
'Locations' => 'DataCenterLocationDraft',
|
||||
);
|
||||
|
||||
/*static $indexes = array(
|
||||
'Name_CloudService' => array('type'=>'unique', 'value'=>'Name,CloudServiceID'),
|
||||
);*/
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->getField('Name');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->setField('Name',$name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->getField('Endpoint');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $endpoint
|
||||
* @return void
|
||||
*/
|
||||
public function setEndpoint($endpoint)
|
||||
{
|
||||
$this->setField('Endpoint',$endpoint);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getIdentifier()
|
||||
{
|
||||
return (int)$this->getField('ID');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ICloudService
|
||||
*/
|
||||
public function getCloud()
|
||||
{
|
||||
return AssociationFactory::getInstance()->getMany2OneAssociation($this,'CloudService','DataCenterRegions')->getTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ICloudService $cloud
|
||||
* @return void
|
||||
*/
|
||||
public function setCloud(ICloudService $cloud)
|
||||
{
|
||||
AssociationFactory::getInstance()->getMany2OneAssociation($this,'CloudService','DataCenterRegions')->setTarget($cloud);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return IDataCenterLocation[]
|
||||
*/
|
||||
public function getLocations()
|
||||
{
|
||||
return AssociationFactory::getInstance()->getOne2ManyAssociation($this,'Locations')->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IDataCenterLocation $location
|
||||
* @return void
|
||||
*/
|
||||
public function addLocation(IDataCenterLocation $location)
|
||||
{
|
||||
AssociationFactory::getInstance()->getOne2ManyAssociation($this,'Locations')->add($location);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function clearLocations()
|
||||
{
|
||||
AssociationFactory::getInstance()->getOne2ManyAssociation($this,'Locations')->removeAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getColor()
|
||||
{
|
||||
return $this->getField('Color');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $color
|
||||
* @return void
|
||||
*/
|
||||
public function setColor($color)
|
||||
{
|
||||
$this->setField('Color',$color);
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* Class ConsultantClientDraft
|
||||
*/
|
||||
class ConsultantClientDraft
|
||||
extends DataObject
|
||||
implements IConsultantClient
|
||||
{
|
||||
|
||||
static $create_table_options = array('MySQLDatabase' => 'ENGINE=InnoDB');
|
||||
|
||||
static $db = array(
|
||||
'Name' => 'Varchar',
|
||||
'Order' => 'Int',
|
||||
);
|
||||
|
||||
static $has_one = array(
|
||||
'Consultant' => 'ConsultantDraft'
|
||||
);
|
||||
|
||||
static $indexes = array(
|
||||
'Name_Owner' => array('type'=>'unique', 'value'=>'Name,ConsultantID')
|
||||
);
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function getOrder()
|
||||
{
|
||||
return (int)$this->getField('Order');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $order
|
||||
* @return void
|
||||
*/
|
||||
public function setOrder($order)
|
||||
{
|
||||
$this->setField('Order',$order);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->getField('Name');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->setField('Name',$name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return IConsultant
|
||||
*/
|
||||
public function getConsultant()
|
||||
{
|
||||
return AssociationFactory::getInstance()->getMany2OneAssociation($this,'Consultant','PreviousClients')->getTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IConsultant $consultant
|
||||
* @return void
|
||||
*/
|
||||
public function setConsultant(IConsultant $consultant)
|
||||
{
|
||||
AssociationFactory::getInstance()->getMany2OneAssociation($this,'Consultant','PreviousClients')->setTarget($consultant);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getIdentifier()
|
||||
{
|
||||
return (int)$this->getField('ID');
|
||||
}
|
||||
}
|
@ -0,0 +1,211 @@
|
||||
<?php
|
||||
/**
|
||||
* Class ConsultantDraft
|
||||
*/
|
||||
final class ConsultantDraft
|
||||
extends RegionalSupportedCompanyServiceDraft
|
||||
implements IConsultant
|
||||
{
|
||||
|
||||
static $create_table_options = array('MySQLDatabase' => 'ENGINE=InnoDB');
|
||||
|
||||
static $has_many = array(
|
||||
'Offices' => 'OfficeDraft',
|
||||
'PreviousClients' => 'ConsultantClientDraft',
|
||||
);
|
||||
|
||||
static $many_many = array(
|
||||
'SpokenLanguages' => 'SpokenLanguage',
|
||||
'ConfigurationManagementExpertises' => 'ConfigurationManagementType',
|
||||
'ExpertiseAreas' => 'OpenStackComponent',
|
||||
'ServicesOffered' => 'ConsultantServiceOfferedType',
|
||||
);
|
||||
|
||||
static $many_many_extraFields = array(
|
||||
'ServicesOffered' => array(
|
||||
'RegionID' => "Int",
|
||||
),
|
||||
'SpokenLanguages' => array(
|
||||
'Order' => 'Int',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* @return IOffice[]
|
||||
*/
|
||||
public function getOffices()
|
||||
{
|
||||
$query = new QueryObject(new Office);
|
||||
$query->addOrder(QueryOrder::asc('Order'));
|
||||
return AssociationFactory::getInstance()->getOne2ManyAssociation($this,'Offices',$query)->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IOffice $office
|
||||
* @return void
|
||||
*/
|
||||
public function addOffice(IOffice $office)
|
||||
{
|
||||
$new_order = 0;
|
||||
$offices = $this->getOffices();
|
||||
if(count($offices)>0){
|
||||
$last_one = end($offices);
|
||||
$new_order = $last_one->getOrder()+1;
|
||||
}
|
||||
$office->setOrder($new_order);
|
||||
$query = new QueryObject(new Office);
|
||||
$query->addOrder(QueryOrder::asc('Order'));
|
||||
AssociationFactory::getInstance()->getOne2ManyAssociation($this,'Offices',$query)->add($office);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function clearOffices()
|
||||
{
|
||||
$query = new QueryObject(new Office);
|
||||
$query->addOrder(QueryOrder::asc('Order'));
|
||||
AssociationFactory::getInstance()->getOne2ManyAssociation($this,'Offices',$query)->removeAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return IConsultantClient[]
|
||||
*/
|
||||
public function getPreviousClients()
|
||||
{
|
||||
$query = new QueryObject(new ConsultantClient);
|
||||
$query->addOrder(QueryOrder::asc('Order'));
|
||||
return AssociationFactory::getInstance()->getOne2ManyAssociation($this,'PreviousClients',$query)->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IConsultantClient $client
|
||||
* @return void
|
||||
*/
|
||||
public function addPreviousClients(IConsultantClient $client)
|
||||
{
|
||||
$new_order = 0;
|
||||
$clients = $this->getPreviousClients();
|
||||
if(count($clients)>0){
|
||||
$last_one = end($clients);
|
||||
$new_order = $last_one->getOrder()+1;
|
||||
}
|
||||
$client->setOrder($new_order);
|
||||
$query = new QueryObject(new ConsultantClient());
|
||||
$query->addOrder(QueryOrder::asc('Order'));
|
||||
AssociationFactory::getInstance()->getOne2ManyAssociation($this,'PreviousClients',$query)->add($client);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function clearClients()
|
||||
{
|
||||
$query = new QueryObject(new ConsultantClient);
|
||||
$query->addOrder(QueryOrder::asc('Order'));
|
||||
AssociationFactory::getInstance()->getOne2ManyAssociation($this,'PreviousClients',$query)->removeAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ISpokenLanguage[]
|
||||
*/
|
||||
public function getSpokenLanguages()
|
||||
{
|
||||
$query = new QueryObject(new SpokenLanguage);
|
||||
$query->addOrder(QueryOrder::asc('Order'));
|
||||
return AssociationFactory::getInstance()->getMany2ManyAssociation($this,'SpokenLanguages',$query)->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ISpokenLanguage $language
|
||||
* @return void
|
||||
*/
|
||||
public function addSpokenLanguages(ISpokenLanguage $language)
|
||||
{
|
||||
$query = new QueryObject(new SpokenLanguage);
|
||||
$query->addOrder(QueryOrder::asc('Order'));
|
||||
$languages = $this->getSpokenLanguages();
|
||||
$new_order = count($languages);
|
||||
AssociationFactory::getInstance()->getMany2ManyAssociation($this,'SpokenLanguages',$query)->add($language , array('Order' => $new_order));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function clearSpokenLanguages()
|
||||
{
|
||||
$query = new QueryObject(new SpokenLanguage);
|
||||
$query->addOrder(QueryOrder::asc('Order'));
|
||||
AssociationFactory::getInstance()->getMany2ManyAssociation($this,'SpokenLanguages',$query)->removeAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return IConfigurationManagementType[]
|
||||
*/
|
||||
public function getConfigurationManagementExpertises()
|
||||
{
|
||||
return AssociationFactory::getInstance()->getMany2ManyAssociation($this,'ConfigurationManagementExpertises')->toArray();
|
||||
}
|
||||
|
||||
public function addConfigurationManagementExpertise(IConfigurationManagementType $expertise)
|
||||
{
|
||||
AssociationFactory::getInstance()->getMany2ManyAssociation($this,'ConfigurationManagementExpertises')->add($expertise);
|
||||
}
|
||||
|
||||
public function clearConfigurationManagementExpertises()
|
||||
{
|
||||
AssociationFactory::getInstance()->getMany2ManyAssociation($this,'ConfigurationManagementExpertises')->removeAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return IOpenStackComponent[]
|
||||
*/
|
||||
public function getExpertiseAreas()
|
||||
{
|
||||
return AssociationFactory::getInstance()->getMany2ManyAssociation($this,'ExpertiseAreas')->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IOpenStackComponent $component
|
||||
* @return void
|
||||
*/
|
||||
public function addExpertiseArea(IOpenStackComponent $component)
|
||||
{
|
||||
AssociationFactory::getInstance()->getMany2ManyAssociation($this,'ExpertiseAreas')->add($component);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function clearExpertiseAreas()
|
||||
{
|
||||
AssociationFactory::getInstance()->getMany2ManyAssociation($this,'ExpertiseAreas')->removeAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return IConsultantServiceOfferedType[]
|
||||
*/
|
||||
public function getServicesOffered()
|
||||
{
|
||||
return AssociationFactory::getInstance()->getMany2ManyAssociation($this,'ServicesOffered')->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IConsultantServiceOfferedType $service
|
||||
* @param IRegion $region
|
||||
* @return void
|
||||
*/
|
||||
public function addServiceOffered(IConsultantServiceOfferedType $service, IRegion $region)
|
||||
{
|
||||
AssociationFactory::getInstance()->getMany2ManyAssociation($this,'ServicesOffered')->add($service, array('RegionID'=>$region->getIdentifier()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function clearServicesOffered()
|
||||
{
|
||||
AssociationFactory::getInstance()->getMany2ManyAssociation($this,'ServicesOffered')->removeAll();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,212 @@
|
||||
<?php
|
||||
/**
|
||||
* Class OfficeDraft
|
||||
*/
|
||||
final class OfficeDraft
|
||||
extends DataObject
|
||||
implements IOffice
|
||||
{
|
||||
|
||||
static $create_table_options = array('MySQLDatabase' => 'ENGINE=InnoDB');
|
||||
|
||||
static $db = array(
|
||||
'Address' => 'Varchar',
|
||||
'Address2' => 'Varchar',
|
||||
'State' => 'Varchar',
|
||||
'ZipCode' => 'Varchar',
|
||||
'City' => 'Varchar',
|
||||
'Country' => 'Varchar',
|
||||
'Lat' => 'Decimal',
|
||||
'Lng' => 'Decimal',
|
||||
'Order' => 'Int',
|
||||
);
|
||||
|
||||
static $has_one = array(
|
||||
'Consultant' => 'ConsultantDraft'
|
||||
);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAddress()
|
||||
{
|
||||
return $this->getField('Address');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $address
|
||||
* @return void
|
||||
*/
|
||||
public function setAddress($address)
|
||||
{
|
||||
$this->setField('Address',$address);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAddress1()
|
||||
{
|
||||
return $this->getField('Address2');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $address1
|
||||
* @return void
|
||||
*/
|
||||
public function setAddress1($address1)
|
||||
{
|
||||
$this->setField('Address2',$address1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getState()
|
||||
{
|
||||
return $this->getField('State');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $state
|
||||
* @return void
|
||||
*/
|
||||
public function setState($state)
|
||||
{
|
||||
$this->setField('State',$state);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getZipCode()
|
||||
{
|
||||
return $this->getField('ZipCode');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $zip_code
|
||||
* @return void
|
||||
*/
|
||||
public function setZipCode($zip_code)
|
||||
{
|
||||
$this->setField('ZipCode',$zip_code);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $country
|
||||
* @return void
|
||||
*/
|
||||
public function setCountry($country)
|
||||
{
|
||||
$this->setField('Country',$country);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCountry()
|
||||
{
|
||||
return $this->getField('Country');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $city
|
||||
* @return void
|
||||
*/
|
||||
public function setCity($city)
|
||||
{
|
||||
$this->setField('City',$city);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCity()
|
||||
{
|
||||
return $this->getField('City');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param float $lng
|
||||
* @return void
|
||||
*/
|
||||
public function setLng($lng)
|
||||
{
|
||||
$this->setField('Lng',$lng);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getLng()
|
||||
{
|
||||
return $this->getField('Lng');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $lat
|
||||
* @return void
|
||||
*/
|
||||
public function setLat($lat)
|
||||
{
|
||||
$this->setField('Lat',$lat);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getLat()
|
||||
{
|
||||
return $this->getField('Lat');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return IConsultant
|
||||
*/
|
||||
public function getConsultant()
|
||||
{
|
||||
return AssociationFactory::getInstance()->getMany2OneAssociation($this,'Consultant','Offices')->getTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IConsultant $consultant
|
||||
* @return void
|
||||
*/
|
||||
public function setConsultant(IConsultant $consultant)
|
||||
{
|
||||
AssociationFactory::getInstance()->getMany2OneAssociation($this,'Consultant','Offices')->setTarget($consultant);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getIdentifier()
|
||||
{
|
||||
return (int)$this->getField('ID');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function getOrder()
|
||||
{
|
||||
return (int)$this->getField('Order');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $order
|
||||
* @return void
|
||||
*/
|
||||
public function setOrder($order)
|
||||
{
|
||||
$this->setField('Order',$order);
|
||||
}
|
||||
|
||||
public function getCountryFriendlyName(){
|
||||
return Geoip::countryCode2name($this->getCountry());
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class ApplianceDraftFactory
|
||||
*/
|
||||
final class ApplianceDraftFactory extends OpenStackImplementationDraftFactory {
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $overview
|
||||
* @param ICompany $company
|
||||
* @param bool $active
|
||||
* @param IMarketPlaceType $marketplace_type
|
||||
* @param null|string $call_2_action_url
|
||||
* @return ICompanyService
|
||||
*/
|
||||
public function buildCompanyService($name, $overview, ICompany $company, $active, IMarketPlaceType $marketplace_type, $call_2_action_url = null, $live_id = null)
|
||||
{
|
||||
$appliance = new ApplianceDraft;
|
||||
$appliance->setName($name);
|
||||
$appliance->setOverview($overview);
|
||||
$appliance->setCompany($company);
|
||||
if($active)
|
||||
$appliance->activate();
|
||||
else
|
||||
$appliance->deactivate();
|
||||
$appliance->setMarketplace($marketplace_type);
|
||||
$appliance->setCall2ActionUri($call_2_action_url);
|
||||
$appliance->setLiveServiceId($live_id);
|
||||
return $appliance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return ICompanyService
|
||||
*/
|
||||
public function buildCompanyServiceById($id)
|
||||
{
|
||||
$appliance = new ApplianceDraft;
|
||||
$appliance->ID = $id;
|
||||
return $appliance;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* Class CloudDraftFactory
|
||||
*/
|
||||
abstract class CloudDraftFactory
|
||||
extends OpenStackImplementationDraftFactory
|
||||
implements ICloudFactory {
|
||||
|
||||
/**
|
||||
* @param int $coverage_percent
|
||||
* @param IReleaseSupportedApiVersion $release_supported_api_version
|
||||
* @param IOpenStackImplementation $implementation
|
||||
* @return IOpenStackImplementationApiCoverage|CloudServiceOffered
|
||||
*/
|
||||
public function buildCapability($coverage_percent, IReleaseSupportedApiVersion $release_supported_api_version, IOpenStackImplementation $implementation)
|
||||
{
|
||||
$service = new CloudServiceOfferedDraft;
|
||||
$service->setCoveragePercent($coverage_percent);
|
||||
$service->setReleaseSupportedApiVersion($release_supported_api_version);
|
||||
$service->setImplementation($implementation);
|
||||
return $service;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return IPricingSchemaType
|
||||
*/
|
||||
public function buildPricingSchemaById($id){
|
||||
$pricing_schema = new PricingSchemaType;
|
||||
$pricing_schema->ID = $id;
|
||||
return $pricing_schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $city
|
||||
* @param string $state
|
||||
* @param string $country
|
||||
* @param float $lat
|
||||
* @param float $lng
|
||||
* @param IDataCenterRegion $region
|
||||
* @return IDataCenterLocation
|
||||
*/
|
||||
public function buildDataCenterLocation($city,$state,$country,$lat,$lng,IDataCenterRegion $region) {
|
||||
$location = new DataCenterLocationDraft;
|
||||
$location->setCity($city);
|
||||
$location->setState($state);
|
||||
$location->setCountry($country);
|
||||
$location->setLat($lat);
|
||||
$location->setLng($lng);
|
||||
$region->addLocation($location);
|
||||
$location->setDataCenterRegion($region);
|
||||
return $location;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param IDataCenterLocation $location
|
||||
* @return IAvailabilityZone
|
||||
*/
|
||||
public function buildAZ($name,IDataCenterLocation $location){
|
||||
$az = new AvailabilityZoneDraft;
|
||||
$az->setName($name);
|
||||
$az->setLocation($location);
|
||||
$location->addAvailabilityZone($az);
|
||||
return $az;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $color
|
||||
* @param string $endpoint
|
||||
* @return IDataCenterRegion
|
||||
*/
|
||||
public function buildDataCenterRegion($name, $color, $endpoint)
|
||||
{
|
||||
$region = new DataCenterRegionDraft;
|
||||
$region->setName($name);
|
||||
$region->setColor($color);
|
||||
$region->setEndpoint($endpoint);
|
||||
return $region;
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* Class ConsultantDraftFactory
|
||||
*/
|
||||
final class ConsultantDraftFactory
|
||||
extends RegionalSupportedCompanyServiceDraftFactory
|
||||
implements IConsultantFactory {
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $overview
|
||||
* @param ICompany $company
|
||||
* @param bool $active
|
||||
* @param IMarketPlaceType $marketplace_type
|
||||
* @param null|string $call_2_action_url
|
||||
* @return ICompanyService
|
||||
*/
|
||||
public function buildCompanyService($name, $overview, ICompany $company, $active, IMarketPlaceType $marketplace_type, $call_2_action_url = null, $live_id = null)
|
||||
{
|
||||
$consultant = new ConsultantDraft;
|
||||
$consultant->setName($name);
|
||||
$consultant->setOverview($overview);
|
||||
$consultant->setCompany($company);
|
||||
if($active)
|
||||
$consultant->activate();
|
||||
else
|
||||
$consultant->deactivate();
|
||||
$consultant->setMarketplace($marketplace_type);
|
||||
$consultant->setCall2ActionUri($call_2_action_url);
|
||||
$consultant->setLiveServiceId($live_id);
|
||||
return $consultant;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return ICompanyService
|
||||
*/
|
||||
public function buildCompanyServiceById($id)
|
||||
{
|
||||
$consultant = new ConsultantDraft;
|
||||
$consultant->ID = $id;
|
||||
return $consultant;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return ISpokenLanguage
|
||||
*/
|
||||
public function buildSpokenLanguage($name)
|
||||
{
|
||||
$language = new SpokenLanguage;
|
||||
$language->setName($name);
|
||||
return $language;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
* @return IConfigurationManagementType
|
||||
*/
|
||||
public function buildConfigurationManagementType($type)
|
||||
{
|
||||
$config_management = new ConfigurationManagementType;
|
||||
$config_management->setType($type);
|
||||
return $config_management;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return IConsultantClient
|
||||
*/
|
||||
public function buildClient($name)
|
||||
{
|
||||
$client = new ConsultantClientDraft;
|
||||
$client->setName($name);
|
||||
return $client;
|
||||
}
|
||||
|
||||
public function buildOffice(AddressInfo $address_info)
|
||||
{
|
||||
$office = new OfficeDraft;
|
||||
list($address1,$address2)=$address_info->getAddress();
|
||||
$office->setAddress($address1);
|
||||
$office->setAddress1($address2);
|
||||
$office->setZipCode($address_info->getZipCode());
|
||||
$office->setCity($address_info->getCity());
|
||||
$office->setState($address_info->getState());
|
||||
$office->setCountry($address_info->getCountry());
|
||||
return $office;
|
||||
}
|
||||
|
||||
}
|
@ -27,7 +27,7 @@ final class ConsultantFactory
|
||||
* @param null|string $call_2_action_url
|
||||
* @return ICompanyService
|
||||
*/
|
||||
public function buildCompanyService($name, $overview, ICompany $company, $active, IMarketPlaceType $marketplace_type, $call_2_action_url = null, $live_service = null)
|
||||
public function buildCompanyService($name, $overview, ICompany $company, $active, IMarketPlaceType $marketplace_type, $call_2_action_url = null, $live_id = null)
|
||||
{
|
||||
$consultant = new Consultant;
|
||||
$consultant->setName($name);
|
||||
@ -39,6 +39,7 @@ final class ConsultantFactory
|
||||
$consultant->deactivate();
|
||||
$consultant->setMarketplace($marketplace_type);
|
||||
$consultant->setCall2ActionUri($call_2_action_url);
|
||||
$consultant->setLiveServiceId($live_id);
|
||||
return $consultant;
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* Class DistributionDraftFactory
|
||||
*/
|
||||
final class DistributionDraftFactory extends OpenStackImplementationFactory {
|
||||
final class DistributionDraftFactory extends OpenStackImplementationDraftFactory {
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
@ -41,30 +41,4 @@ final class DistributionDraftFactory extends OpenStackImplementationFactory {
|
||||
return $distribution;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IRegion $region
|
||||
* @param IRegionalSupportedCompanyService $service
|
||||
* @return IRegionalSupport
|
||||
*/
|
||||
public function buildRegionalSupport(IRegion $region, IRegionalSupportedCompanyService $service){
|
||||
$regional_support = new RegionalSupportDraft;
|
||||
$regional_support->setRegion($region);
|
||||
$regional_support->setCompanyService($service);
|
||||
return $regional_support;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $coverage_percent
|
||||
* @param IReleaseSupportedApiVersion $release_supported_api_version
|
||||
* @param IOpenStackImplementation $implementation
|
||||
* @return IOpenStackImplementationApiCoverage
|
||||
*/
|
||||
public function buildCapability($coverage_percent, IReleaseSupportedApiVersion $release_supported_api_version, IOpenStackImplementation $implementation)
|
||||
{
|
||||
$capability = new OpenStackImplementationApiCoverageDraft;
|
||||
$capability->setCoveragePercent($coverage_percent);
|
||||
$capability->setReleaseSupportedApiVersion($release_supported_api_version);
|
||||
$capability->setImplementation($implementation);
|
||||
return $capability;
|
||||
}
|
||||
}
|
@ -0,0 +1,125 @@
|
||||
<?php
|
||||
/**
|
||||
* Class MarketplaceDraftFactory
|
||||
*/
|
||||
final class MarketplaceDraftFactory implements IMarketplaceFactory {
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return IMarketPlaceType
|
||||
*/
|
||||
public function buildMarketplaceType($name)
|
||||
{
|
||||
$marketplace_type = new MarketPlaceType;
|
||||
$marketplace_type->setName($name);
|
||||
$marketplace_type->activate();
|
||||
$slug = str_replace(' ', '-', strtolower($name));
|
||||
$marketplace_type->setSlug($slug);
|
||||
$g = $marketplace_type->createSecurityGroup();
|
||||
$marketplace_type->setAdminGroup($g);
|
||||
return $marketplace_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $title
|
||||
* @return ISecurityGroup
|
||||
*/
|
||||
public function buildSecurityGroup($title)
|
||||
{
|
||||
$g = new Group;
|
||||
$g->setTitle($title);
|
||||
$g->setDescription($title);
|
||||
$g->setSlug(str_replace(' ', '-', strtolower($title)));
|
||||
return $g;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
* @param int $max_allowed_duration
|
||||
* @return IMarketPlaceVideoType
|
||||
*/
|
||||
public function buildMarketPlaceVideoType($type, $max_allowed_duration)
|
||||
{
|
||||
$video_type = new MarketPlaceVideoType;
|
||||
$video_type->Type = $type;
|
||||
$video_type->MaxTotalVideoTime = $max_allowed_duration;
|
||||
return $video_type;
|
||||
}
|
||||
|
||||
public function buildVideoTypeById($id){
|
||||
$video_type = new MarketPlaceVideoType;
|
||||
$video_type->ID = $id;
|
||||
return $video_type;
|
||||
}
|
||||
|
||||
/***
|
||||
* @param int $id
|
||||
* @return ICompany
|
||||
*/
|
||||
public function buildCompanyById($id)
|
||||
{
|
||||
$company = new Company;
|
||||
$company->ID = $id;
|
||||
return $company;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $uri
|
||||
* @param ICompanyService $company_service
|
||||
* @return ICompanyServiceResource
|
||||
*/
|
||||
public function buildResource($name, $uri, ICompanyService $company_service)
|
||||
{
|
||||
$resource = new CompanyServiceResourceDraft;
|
||||
$resource->setName($name);
|
||||
$resource->setUri($uri);
|
||||
$resource->setOwner($company_service);
|
||||
return $resource;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $description
|
||||
* @param string $youtube_id
|
||||
* @param int $length
|
||||
* @param IMarketPlaceVideoType $type
|
||||
* @param ICompanyService $owner
|
||||
* @return IMarketPlaceVideo
|
||||
*/
|
||||
public function buildVideo($name, $description, $youtube_id, $length, IMarketPlaceVideoType $type, ICompanyService $owner)
|
||||
{
|
||||
$video = new MarketPlaceVideoDraft;
|
||||
$video->setName($name);
|
||||
$video->setDescription($description);
|
||||
$video->setYouTubeId($youtube_id);
|
||||
$video->setLength($length);
|
||||
$video->setType($type);
|
||||
$video->setOwner($owner);
|
||||
return $video;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $region_id
|
||||
* @return IRegion
|
||||
*/
|
||||
public function buildRegionById($region_id)
|
||||
{
|
||||
$region = new Region;
|
||||
$region->ID = $region_id;
|
||||
return $region;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $support_channel_type_id
|
||||
* @return ISupportChannelType
|
||||
*/
|
||||
public function buildSupportChannelTypeById($support_channel_type_id)
|
||||
{
|
||||
$support_channel_type = new SupportChannelType;
|
||||
$support_channel_type->ID = $support_channel_type_id;
|
||||
return $support_channel_type;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
abstract class OpenStackImplementationDraftFactory
|
||||
extends RegionalSupportedCompanyServiceDraftFactory
|
||||
implements IOpenStackImplementationFactory {
|
||||
/**
|
||||
* @param int $coverage_percent
|
||||
* @param IReleaseSupportedApiVersion $release_supported_api_version
|
||||
* @param IOpenStackImplementation $implementation
|
||||
* @return IOpenStackImplementationApiCoverage
|
||||
*/
|
||||
public function buildCapability($coverage_percent, IReleaseSupportedApiVersion $release_supported_api_version, IOpenStackImplementation $implementation)
|
||||
{
|
||||
$capability = new OpenStackImplementationApiCoverageDraft;
|
||||
$capability->setCoveragePercent($coverage_percent);
|
||||
$capability->setReleaseSupportedApiVersion($release_supported_api_version);
|
||||
$capability->setImplementation($implementation);
|
||||
return $capability;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class PrivateCloudDraftFactory
|
||||
*/
|
||||
final class PrivateCloudDraftFactory extends CloudDraftFactory {
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $overview
|
||||
* @param ICompany $company
|
||||
* @param bool $active
|
||||
* @param IMarketPlaceType $marketplace_type
|
||||
* @param null|string $call_2_action_url
|
||||
* @return ICompanyService
|
||||
*/
|
||||
public function buildCompanyService($name, $overview, ICompany $company, $active, IMarketPlaceType $marketplace_type, $call_2_action_url = null, $live_id = null)
|
||||
{
|
||||
$private_cloud = new PrivateCloudServiceDraft;
|
||||
$private_cloud->setName($name);
|
||||
$private_cloud->setOverview($overview);
|
||||
$private_cloud->setCompany($company);
|
||||
if($active)
|
||||
$private_cloud->activate();
|
||||
else
|
||||
$private_cloud->deactivate();
|
||||
$private_cloud->setMarketplace($marketplace_type);
|
||||
$private_cloud->setCall2ActionUri($call_2_action_url);
|
||||
$private_cloud->setLiveServiceId($live_id);
|
||||
return $private_cloud;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return ICompanyService
|
||||
*/
|
||||
public function buildCompanyServiceById($id)
|
||||
{
|
||||
$private_cloud = new PrivateCloudServiceDraft;
|
||||
$private_cloud->ID = $id;
|
||||
return $private_cloud;
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class PublicCloudDraftFactory
|
||||
*/
|
||||
final class PublicCloudDraftFactory
|
||||
extends CloudDraftFactory {
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $overview
|
||||
* @param ICompany $company
|
||||
* @param bool $active
|
||||
* @param IMarketPlaceType $marketplace_type
|
||||
* @param null|string $call_2_action_url
|
||||
* @return ICompanyService
|
||||
*/
|
||||
public function buildCompanyService($name, $overview, ICompany $company, $active, IMarketPlaceType $marketplace_type, $call_2_action_url = null, $live_id = null)
|
||||
{
|
||||
$public_cloud = new PublicCloudServiceDraft();
|
||||
$public_cloud->setName($name);
|
||||
$public_cloud->setOverview($overview);
|
||||
$public_cloud->setCompany($company);
|
||||
if($active)
|
||||
$public_cloud->activate();
|
||||
else
|
||||
$public_cloud->deactivate();
|
||||
$public_cloud->setMarketplace($marketplace_type);
|
||||
$public_cloud->setCall2ActionUri($call_2_action_url);
|
||||
$public_cloud->setLiveServiceId($live_id);
|
||||
return $public_cloud;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return ICompanyService
|
||||
*/
|
||||
public function buildCompanyServiceById($id)
|
||||
{
|
||||
$public_cloud = new PublicCloudServiceDraft();
|
||||
$public_cloud->ID = $id;
|
||||
return $public_cloud;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
abstract class RegionalSupportedCompanyServiceDraftFactory implements IRegionalSupportedCompanyServiceFactory {
|
||||
/**
|
||||
* @param IRegion $region
|
||||
* @param IRegionalSupportedCompanyService $service
|
||||
* @return IRegionalSupport
|
||||
*/
|
||||
public function buildRegionalSupport(IRegion $region, IRegionalSupportedCompanyService $service){
|
||||
$regional_support = new RegionalSupportDraft;
|
||||
$regional_support->setRegion($region);
|
||||
$regional_support->setCompanyService($service);
|
||||
return $regional_support;
|
||||
}
|
||||
|
||||
}
|
@ -18,7 +18,7 @@ final class SapphirePrivateCloudRepository
|
||||
extends SapphireOpenStackImplementationRepository {
|
||||
|
||||
public function __construct($draft_entity=false){
|
||||
$entity = ($draft_entity) ? new PrivateCloudServiceDraft() : new PublicCloudService();
|
||||
$entity = ($draft_entity) ? new PrivateCloudServiceDraft() : new PrivateCloudService();
|
||||
parent::__construct($entity);
|
||||
}
|
||||
|
||||
|
@ -18,11 +18,13 @@ final class ApplianceCrudApi extends CompanyServiceCrudApi {
|
||||
|
||||
private $marketplace_type_repository;
|
||||
private $appliance_repository;
|
||||
private $appliance_draft_repository;
|
||||
|
||||
|
||||
public function __construct() {
|
||||
|
||||
$this->appliance_repository = new SapphireApplianceRepository;
|
||||
$this->appliance_draft_repository = new SapphireApplianceRepository(true);
|
||||
$this->marketplace_type_repository = new SapphireMarketPlaceTypeRepository;
|
||||
|
||||
$manager = new ApplianceManager (
|
||||
@ -49,12 +51,36 @@ final class ApplianceCrudApi extends CompanyServiceCrudApi {
|
||||
SapphireTransactionManager::getInstance()
|
||||
);
|
||||
|
||||
parent::__construct($manager, new ApplianceFactory);
|
||||
$draft_manager = new ApplianceManager (
|
||||
$this->appliance_draft_repository,
|
||||
new SapphireMarketPlaceVideoTypeRepository,
|
||||
$this->marketplace_type_repository,
|
||||
new SapphireGuestOSTypeRepository,
|
||||
new SapphireHyperVisorTypeRepository,
|
||||
new SapphireOpenStackApiVersionRepository,
|
||||
new SapphireOpenStackComponentRepository,
|
||||
new SapphireOpenStackReleaseRepository,
|
||||
new SapphireRegionRepository,
|
||||
new SapphireSupportChannelTypeRepository,
|
||||
new SapphireOpenStackReleaseSupportedApiVersionRepository,
|
||||
new ApplianceAddPolicy($this->appliance_draft_repository, $this->marketplace_type_repository),
|
||||
new CompanyServiceCanAddResourcePolicy,
|
||||
new CompanyServiceCanAddVideoPolicy,
|
||||
new ApplianceDraftFactory,
|
||||
new MarketplaceDraftFactory,
|
||||
new ValidatorFactory,
|
||||
new OpenStackApiFactory,
|
||||
null,
|
||||
new SessionCacheService,
|
||||
SapphireTransactionManager::getInstance()
|
||||
);
|
||||
|
||||
parent::__construct($manager, $draft_manager, new ApplianceFactory, new ApplianceDraftFactory);
|
||||
|
||||
// filters ...
|
||||
$this_var = $this;
|
||||
$current_user = $this->current_user;
|
||||
$repository = $this->appliance_repository;
|
||||
$repository = $this->appliance_draft_repository;
|
||||
|
||||
$this->addBeforeFilter('addCompanyService','check_add_company',function ($request) use($this_var, $current_user,$repository){
|
||||
$data = $this_var->getJsonRequest();
|
||||
@ -90,6 +116,7 @@ final class ApplianceCrudApi extends CompanyServiceCrudApi {
|
||||
'DELETE $COMPANY_SERVICE_ID!' => 'deleteCompanyService',
|
||||
'POST ' => 'addCompanyService',
|
||||
'PUT ' => 'updateCompanyService',
|
||||
'PUT $COMPANY_SERVICE_ID!' => 'publishCompanyService',
|
||||
);
|
||||
|
||||
/**
|
||||
@ -99,7 +126,8 @@ final class ApplianceCrudApi extends CompanyServiceCrudApi {
|
||||
'getDistribution',
|
||||
'deleteCompanyService',
|
||||
'addCompanyService',
|
||||
'updateCompanyService'
|
||||
'updateCompanyService',
|
||||
'publishCompanyService'
|
||||
);
|
||||
|
||||
public function getDistribution(){
|
||||
@ -110,9 +138,17 @@ final class ApplianceCrudApi extends CompanyServiceCrudApi {
|
||||
return $this->ok(OpenStackImplementationAssembler::convertOpenStackImplementationToArray($appliance));
|
||||
}
|
||||
|
||||
public function getDistributionDraft(){
|
||||
$company_service_id = intval($this->request->param('COMPANY_SERVICE_ID'));
|
||||
$appliance = $this->appliance_draft_repository->getByLiveServiceId($company_service_id);
|
||||
if(!$appliance)
|
||||
return $this->notFound();
|
||||
return $this->ok(OpenStackImplementationAssembler::convertOpenStackImplementationToArray($appliance));
|
||||
}
|
||||
|
||||
public function addCompanyService(){
|
||||
try {
|
||||
return parent::addCompanyService();
|
||||
return parent::addCompanyServiceDraft();
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
SS_Log::log($ex,SS_Log::ERR);
|
||||
@ -122,7 +158,7 @@ final class ApplianceCrudApi extends CompanyServiceCrudApi {
|
||||
|
||||
public function updateCompanyService(){
|
||||
try {
|
||||
return parent::updateCompanyService();
|
||||
return parent::updateCompanyServiceDraft();
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
SS_Log::log($ex,SS_Log::ERR);
|
||||
@ -130,4 +166,25 @@ final class ApplianceCrudApi extends CompanyServiceCrudApi {
|
||||
}
|
||||
}
|
||||
|
||||
public function publishCompanyService(){
|
||||
try {
|
||||
return parent::publishCompanyService();
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
SS_Log::log($ex,SS_Log::ERR);
|
||||
return $this->serverError();
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteCompanyService(){
|
||||
try {
|
||||
parent::deleteCompanyService();
|
||||
return parent::deleteCompanyServiceDraft();
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
SS_Log::log($ex,SS_Log::ERR);
|
||||
return $this->serverError();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -16,33 +16,35 @@
|
||||
*/
|
||||
final class ConsultantsCrudApi extends CompanyServiceCrudApi {
|
||||
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private static $url_handlers = array(
|
||||
static $url_handlers = array(
|
||||
'GET languages' => 'getLanguages',
|
||||
'GET $COMPANY_SERVICE_ID!' => 'getConsultant',
|
||||
'DELETE $COMPANY_SERVICE_ID!' => 'deleteCompanyService',
|
||||
'POST ' => 'addCompanyService',
|
||||
'PUT ' => 'updateCompanyService',
|
||||
'PUT $COMPANY_SERVICE_ID!' => 'publishCompanyService',
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private static $allowed_actions = array(
|
||||
static $allowed_actions = array(
|
||||
'getConsultant',
|
||||
'deleteCompanyService',
|
||||
'addCompanyService',
|
||||
'updateCompanyService',
|
||||
'getLanguages'
|
||||
'getLanguages',
|
||||
'publishCompanyService'
|
||||
);
|
||||
|
||||
/**
|
||||
* @var IEntityRepository
|
||||
*/
|
||||
private $consultant_repository;
|
||||
private $consultant_draft_repository;
|
||||
/**
|
||||
* @var IEntityRepository
|
||||
*/
|
||||
@ -50,9 +52,10 @@ final class ConsultantsCrudApi extends CompanyServiceCrudApi {
|
||||
|
||||
public function __construct(){
|
||||
|
||||
$this->consultant_repository = new SapphireConsultantRepository;
|
||||
$this->marketplace_type_repository = new SapphireMarketPlaceTypeRepository;
|
||||
$this->languages_repository = new SapphireSpokenLanguageRepository;
|
||||
$this->consultant_repository = new SapphireConsultantRepository;
|
||||
$this->consultant_draft_repository = new SapphireConsultantRepository(true);
|
||||
$this->marketplace_type_repository = new SapphireMarketPlaceTypeRepository;
|
||||
$this->languages_repository = new SapphireSpokenLanguageRepository;
|
||||
$google_geo_coding_api_key = null;
|
||||
$google_geo_coding_client_id = null;
|
||||
$google_geo_coding_private_key = null;
|
||||
@ -95,7 +98,38 @@ final class ConsultantsCrudApi extends CompanyServiceCrudApi {
|
||||
SapphireTransactionManager::getInstance()
|
||||
);
|
||||
|
||||
parent::__construct($manager,new ConsultantFactory);
|
||||
$draft_manager = new ConsultantManager (
|
||||
$this->consultant_draft_repository,
|
||||
new SapphireMarketPlaceVideoTypeRepository,
|
||||
$this->marketplace_type_repository,
|
||||
new SapphireOpenStackApiVersionRepository,
|
||||
new SapphireOpenStackComponentRepository,
|
||||
new SapphireOpenStackReleaseRepository,
|
||||
new SapphireRegionRepository,
|
||||
new SapphireSupportChannelTypeRepository,
|
||||
$this->languages_repository,
|
||||
new SapphireConfigurationManagementTypeRepository,
|
||||
new SapphireConsultantServiceOfferedTypeRepository,
|
||||
new ConsultantAddPolicy($this->consultant_draft_repository, $this->marketplace_type_repository),
|
||||
new CompanyServiceCanAddResourcePolicy,
|
||||
new CompanyServiceCanAddVideoPolicy,
|
||||
new ConsultantDraftFactory,
|
||||
new MarketplaceDraftFactory,
|
||||
new ValidatorFactory,
|
||||
new OpenStackApiFactory,
|
||||
new GoogleGeoCodingService(
|
||||
new SapphireGeoCodingQueryRepository,
|
||||
new UtilFactory,
|
||||
SapphireTransactionManager::getInstance(),
|
||||
$google_geo_coding_api_key,
|
||||
$google_geo_coding_client_id,
|
||||
$google_geo_coding_private_key),
|
||||
null,
|
||||
new SessionCacheService,
|
||||
SapphireTransactionManager::getInstance()
|
||||
);
|
||||
|
||||
parent::__construct($manager,$draft_manager,new ConsultantFactory,new ConsultantDraftFactory);
|
||||
|
||||
// filters ...
|
||||
$this_var = $this;
|
||||
@ -133,6 +167,14 @@ final class ConsultantsCrudApi extends CompanyServiceCrudApi {
|
||||
return $this->ok(ConsultantAssembler::convertConsultantToArray($consultant));
|
||||
}
|
||||
|
||||
public function getConsultantDraft(){
|
||||
$company_service_id = intval($this->request->param('COMPANY_SERVICE_ID'));
|
||||
$consultant = $this->consultant_draft_repository->getByLiveServiceId($company_service_id);
|
||||
if(!$consultant)
|
||||
return $this->notFound();
|
||||
return $this->ok(OpenStackImplementationAssembler::convertOpenStackImplementationToArray($consultant));
|
||||
}
|
||||
|
||||
public function getLanguages(){
|
||||
$term = Convert::raw2sql ($this->request->getVar('term'));
|
||||
$query = new QueryObject;
|
||||
@ -144,4 +186,46 @@ final class ConsultantsCrudApi extends CompanyServiceCrudApi {
|
||||
}
|
||||
return $this->ok($res);
|
||||
}
|
||||
|
||||
public function addCompanyService(){
|
||||
try {
|
||||
return parent::addCompanyServiceDraft();
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
SS_Log::log($ex,SS_Log::ERR);
|
||||
return $this->serverError();
|
||||
}
|
||||
}
|
||||
|
||||
public function updateCompanyService(){
|
||||
try {
|
||||
return parent::updateCompanyServiceDraft();
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
SS_Log::log($ex,SS_Log::ERR);
|
||||
return $this->serverError();
|
||||
}
|
||||
}
|
||||
|
||||
public function publishCompanyService(){
|
||||
try {
|
||||
return parent::publishCompanyService();
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
SS_Log::log($ex,SS_Log::ERR);
|
||||
return $this->serverError();
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteCompanyService(){
|
||||
try {
|
||||
parent::deleteCompanyService();
|
||||
return parent::deleteCompanyServiceDraft();
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
SS_Log::log($ex,SS_Log::ERR);
|
||||
return $this->serverError();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -67,7 +67,7 @@ final class DistributionCrudApi extends CompanyServiceCrudApi {
|
||||
new CompanyServiceCanAddResourcePolicy,
|
||||
new CompanyServiceCanAddVideoPolicy,
|
||||
new DistributionDraftFactory,
|
||||
new MarketplaceFactory,
|
||||
new MarketplaceDraftFactory,
|
||||
new ValidatorFactory,
|
||||
new OpenStackApiFactory,
|
||||
null,
|
||||
|
@ -18,11 +18,13 @@ final class PrivateCloudCrudApi extends CompanyServiceCrudApi {
|
||||
|
||||
private $marketplace_type_repository;
|
||||
private $private_cloud_repository;
|
||||
private $private_cloud_draft_repository;
|
||||
|
||||
public function __construct(){
|
||||
|
||||
$this->private_cloud_repository = new SapphirePrivateCloudRepository;
|
||||
$this->marketplace_type_repository = new SapphireMarketPlaceTypeRepository;
|
||||
$this->private_cloud_repository = new SapphirePrivateCloudRepository;
|
||||
$this->private_cloud_draft_repository = new SapphirePrivateCloudRepository(true);
|
||||
$this->marketplace_type_repository = new SapphireMarketPlaceTypeRepository;
|
||||
|
||||
//google geo coding settings
|
||||
$google_geo_coding_api_key = null;
|
||||
@ -67,7 +69,38 @@ final class PrivateCloudCrudApi extends CompanyServiceCrudApi {
|
||||
SapphireTransactionManager::getInstance()
|
||||
);
|
||||
|
||||
parent::__construct($manager,new PublicCloudFactory);
|
||||
$draft_manager = new PrivateCloudManager (
|
||||
$this->private_cloud_draft_repository,
|
||||
new SapphireMarketPlaceVideoTypeRepository,
|
||||
$this->marketplace_type_repository,
|
||||
new SapphireGuestOSTypeRepository,
|
||||
new SapphireHyperVisorTypeRepository,
|
||||
new SapphireOpenStackApiVersionRepository,
|
||||
new SapphireOpenStackComponentRepository,
|
||||
new SapphireOpenStackReleaseRepository,
|
||||
new SapphireRegionRepository,
|
||||
new SapphireSupportChannelTypeRepository,
|
||||
new SapphireOpenStackReleaseSupportedApiVersionRepository,
|
||||
new PrivateCloudAddPolicy($this->private_cloud_draft_repository, $this->marketplace_type_repository),
|
||||
new CompanyServiceCanAddResourcePolicy,
|
||||
new CompanyServiceCanAddVideoPolicy,
|
||||
new PrivateCloudDraftFactory,
|
||||
new MarketplaceDraftFactory,
|
||||
new ValidatorFactory,
|
||||
new OpenStackApiFactory,
|
||||
new GoogleGeoCodingService(
|
||||
new SapphireGeoCodingQueryRepository,
|
||||
new UtilFactory,
|
||||
SapphireTransactionManager::getInstance(),
|
||||
$google_geo_coding_api_key,
|
||||
$google_geo_coding_client_id,
|
||||
$google_geo_coding_private_key),
|
||||
null,
|
||||
new SessionCacheService,
|
||||
SapphireTransactionManager::getInstance()
|
||||
);
|
||||
|
||||
parent::__construct($manager,$draft_manager,new PublicCloudFactory,new PublicCloudDraftFactory);
|
||||
|
||||
// filters ...
|
||||
$this_var = $this;
|
||||
@ -106,6 +139,7 @@ final class PrivateCloudCrudApi extends CompanyServiceCrudApi {
|
||||
'DELETE $COMPANY_SERVICE_ID!' => 'deleteCompanyService',
|
||||
'POST ' => 'addCompanyService',
|
||||
'PUT ' => 'updateCompanyService',
|
||||
'PUT $COMPANY_SERVICE_ID!' => 'publishCompanyService',
|
||||
);
|
||||
|
||||
/**
|
||||
@ -115,7 +149,8 @@ final class PrivateCloudCrudApi extends CompanyServiceCrudApi {
|
||||
'getPrivateCloud',
|
||||
'deleteCompanyService',
|
||||
'addCompanyService',
|
||||
'updateCompanyService'
|
||||
'updateCompanyService',
|
||||
'publishCompanyService'
|
||||
);
|
||||
|
||||
public function getPrivateCloud(){
|
||||
@ -126,9 +161,17 @@ final class PrivateCloudCrudApi extends CompanyServiceCrudApi {
|
||||
return $this->ok(CloudAssembler::convertCloudToArray($private_cloud));
|
||||
}
|
||||
|
||||
public function getPrivateCloudDraft(){
|
||||
$company_service_id = intval($this->request->param('COMPANY_SERVICE_ID'));
|
||||
$private_cloud = $this->private_cloud_draft_repository->getByLiveServiceId($company_service_id);
|
||||
if(!$private_cloud)
|
||||
return $this->notFound();
|
||||
return $this->ok(OpenStackImplementationAssembler::convertOpenStackImplementationToArray($private_cloud));
|
||||
}
|
||||
|
||||
public function addCompanyService(){
|
||||
try {
|
||||
return parent::addCompanyService();
|
||||
return parent::addCompanyServiceDraft();
|
||||
}
|
||||
catch (NonSupportedApiVersion $ex1) {
|
||||
SS_Log::log($ex1,SS_Log::ERR);
|
||||
@ -146,7 +189,7 @@ final class PrivateCloudCrudApi extends CompanyServiceCrudApi {
|
||||
|
||||
public function updateCompanyService(){
|
||||
try {
|
||||
return parent::updateCompanyService();
|
||||
return parent::updateCompanyServiceDraft();
|
||||
}
|
||||
catch (NonSupportedApiVersion $ex1) {
|
||||
SS_Log::log($ex1,SS_Log::ERR);
|
||||
@ -161,4 +204,25 @@ final class PrivateCloudCrudApi extends CompanyServiceCrudApi {
|
||||
return $this->serverError();
|
||||
}
|
||||
}
|
||||
|
||||
public function publishCompanyService(){
|
||||
try {
|
||||
return parent::publishCompanyService();
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
SS_Log::log($ex,SS_Log::ERR);
|
||||
return $this->serverError();
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteCompanyService(){
|
||||
try {
|
||||
parent::deleteCompanyService();
|
||||
return parent::deleteCompanyServiceDraft();
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
SS_Log::log($ex,SS_Log::ERR);
|
||||
return $this->serverError();
|
||||
}
|
||||
}
|
||||
}
|
@ -18,11 +18,13 @@ class PublicCloudCrudApi extends CompanyServiceCrudApi {
|
||||
|
||||
private $marketplace_type_repository;
|
||||
private $public_cloud_repository;
|
||||
private $public_cloud_draft_repository;
|
||||
|
||||
public function __construct(){
|
||||
|
||||
$this->public_cloud_repository = new SapphirePublicCloudRepository;
|
||||
$this->marketplace_type_repository = new SapphireMarketPlaceTypeRepository;
|
||||
$this->public_cloud_repository = new SapphirePublicCloudRepository;
|
||||
$this->public_cloud_draft_repository = new SapphirePublicCloudRepository(true);
|
||||
$this->marketplace_type_repository = new SapphireMarketPlaceTypeRepository;
|
||||
|
||||
//google geo coding settings
|
||||
$google_geo_coding_api_key = null;
|
||||
@ -67,7 +69,38 @@ class PublicCloudCrudApi extends CompanyServiceCrudApi {
|
||||
SapphireTransactionManager::getInstance()
|
||||
);
|
||||
|
||||
parent::__construct($manager,new PublicCloudFactory);
|
||||
$draft_manager = new PublicCloudManager (
|
||||
$this->public_cloud_draft_repository,
|
||||
new SapphireMarketPlaceVideoTypeRepository,
|
||||
$this->marketplace_type_repository,
|
||||
new SapphireGuestOSTypeRepository,
|
||||
new SapphireHyperVisorTypeRepository,
|
||||
new SapphireOpenStackApiVersionRepository,
|
||||
new SapphireOpenStackComponentRepository,
|
||||
new SapphireOpenStackReleaseRepository,
|
||||
new SapphireRegionRepository,
|
||||
new SapphireSupportChannelTypeRepository,
|
||||
new SapphireOpenStackReleaseSupportedApiVersionRepository,
|
||||
new PublicCloudAddPolicy($this->public_cloud_draft_repository, $this->marketplace_type_repository),
|
||||
new CompanyServiceCanAddResourcePolicy,
|
||||
new CompanyServiceCanAddVideoPolicy,
|
||||
new PublicCloudDraftFactory,
|
||||
new MarketplaceDraftFactory,
|
||||
new ValidatorFactory,
|
||||
new OpenStackApiFactory,
|
||||
new GoogleGeoCodingService(
|
||||
new SapphireGeoCodingQueryRepository,
|
||||
new UtilFactory,
|
||||
SapphireTransactionManager::getInstance(),
|
||||
$google_geo_coding_api_key,
|
||||
$google_geo_coding_client_id,
|
||||
$google_geo_coding_private_key),
|
||||
null,
|
||||
new SessionCacheService,
|
||||
SapphireTransactionManager::getInstance()
|
||||
);
|
||||
|
||||
parent::__construct($manager,$draft_manager,new PublicCloudFactory,new PublicCloudDraftFactory);
|
||||
|
||||
// filters ...
|
||||
$this_var = $this;
|
||||
@ -106,6 +139,7 @@ class PublicCloudCrudApi extends CompanyServiceCrudApi {
|
||||
'DELETE $COMPANY_SERVICE_ID!' => 'deleteCompanyService',
|
||||
'POST ' => 'addCompanyService',
|
||||
'PUT ' => 'updateCompanyService',
|
||||
'PUT $COMPANY_SERVICE_ID!' => 'publishCompanyService',
|
||||
);
|
||||
|
||||
/**
|
||||
@ -115,7 +149,8 @@ class PublicCloudCrudApi extends CompanyServiceCrudApi {
|
||||
'getPublicCloud',
|
||||
'deleteCompanyService',
|
||||
'addCompanyService',
|
||||
'updateCompanyService'
|
||||
'updateCompanyService',
|
||||
'publishCompanyService'
|
||||
);
|
||||
|
||||
public function getPublicCloud(){
|
||||
@ -126,9 +161,17 @@ class PublicCloudCrudApi extends CompanyServiceCrudApi {
|
||||
return $this->ok(CloudAssembler::convertCloudToArray($public_cloud));
|
||||
}
|
||||
|
||||
public function getPublicCloudDraft(){
|
||||
$company_service_id = intval($this->request->param('COMPANY_SERVICE_ID'));
|
||||
$public_cloud = $this->public_cloud_draft_repository->getByLiveServiceId($company_service_id);
|
||||
if(!$public_cloud)
|
||||
return $this->notFound();
|
||||
return $this->ok(OpenStackImplementationAssembler::convertOpenStackImplementationToArray($public_cloud));
|
||||
}
|
||||
|
||||
public function addCompanyService(){
|
||||
try {
|
||||
return parent::addCompanyService();
|
||||
return parent::addCompanyServiceDraft();
|
||||
}
|
||||
catch (NonSupportedApiVersion $ex1) {
|
||||
SS_Log::log($ex1,SS_Log::ERR);
|
||||
@ -146,7 +189,7 @@ class PublicCloudCrudApi extends CompanyServiceCrudApi {
|
||||
|
||||
public function updateCompanyService(){
|
||||
try {
|
||||
return parent::updateCompanyService();
|
||||
return parent::updateCompanyServiceDraft();
|
||||
}
|
||||
catch (NonSupportedApiVersion $ex1) {
|
||||
SS_Log::log($ex1,SS_Log::ERR);
|
||||
@ -161,4 +204,25 @@ class PublicCloudCrudApi extends CompanyServiceCrudApi {
|
||||
return $this->serverError();
|
||||
}
|
||||
}
|
||||
|
||||
public function publishCompanyService(){
|
||||
try {
|
||||
return parent::publishCompanyService();
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
SS_Log::log($ex,SS_Log::ERR);
|
||||
return $this->serverError();
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteCompanyService(){
|
||||
try {
|
||||
parent::deleteCompanyService();
|
||||
return parent::deleteCompanyServiceDraft();
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
SS_Log::log($ex,SS_Log::ERR);
|
||||
return $this->serverError();
|
||||
}
|
||||
}
|
||||
}
|
@ -51,11 +51,14 @@ class MarketPlaceAdminPage_Controller extends Page_Controller
|
||||
* @var ICompanyServiceRepository
|
||||
*/
|
||||
private $distribution_draft_repository;
|
||||
|
||||
/**
|
||||
* @var ICompanyServiceRepository
|
||||
*/
|
||||
private $appliance_repository;
|
||||
/**
|
||||
* @var ICompanyServiceRepository
|
||||
*/
|
||||
private $appliance_draft_repository;
|
||||
/**
|
||||
* @var IOpenStackComponentRepository
|
||||
*/
|
||||
@ -68,7 +71,6 @@ class MarketPlaceAdminPage_Controller extends Page_Controller
|
||||
* @var IEntityRepository
|
||||
*/
|
||||
private $guests_os_repository;
|
||||
|
||||
/**
|
||||
* @var IEntityRepository
|
||||
*/
|
||||
@ -85,31 +87,38 @@ class MarketPlaceAdminPage_Controller extends Page_Controller
|
||||
* @var IEntityRepository
|
||||
*/
|
||||
private $pricing_schema_repository;
|
||||
|
||||
/**
|
||||
* @var IEntityRepository
|
||||
*/
|
||||
private $public_clouds_repository;
|
||||
|
||||
/**
|
||||
* @var IEntityRepository
|
||||
*/
|
||||
private $public_clouds_draft_repository;
|
||||
/**
|
||||
* @var IEntityRepository
|
||||
*/
|
||||
private $private_clouds_repository;
|
||||
|
||||
/**
|
||||
* @var IEntityRepository
|
||||
*/
|
||||
private $private_clouds_draft_repository;
|
||||
/**
|
||||
* @var IEntityRepository
|
||||
*/
|
||||
private $config_management_type_repository;
|
||||
|
||||
/**
|
||||
* @var IEntityRepository
|
||||
*/
|
||||
private $consultant_service_offered_type_repository;
|
||||
|
||||
/**
|
||||
* @var IEntityRepository
|
||||
*/
|
||||
private $consultant_repository;
|
||||
/**
|
||||
* @var IEntityRepository
|
||||
*/
|
||||
private $consultant_draft_repository;
|
||||
|
||||
function init()
|
||||
{
|
||||
@ -146,6 +155,7 @@ class MarketPlaceAdminPage_Controller extends Page_Controller
|
||||
$this->distribution_repository = new SapphireDistributionRepository;
|
||||
$this->distribution_draft_repository = new SapphireDistributionRepository(true);
|
||||
$this->appliance_repository = new SapphireApplianceRepository;
|
||||
$this->appliance_draft_repository = new SapphireApplianceRepository(true);
|
||||
$this->components_repository = new SapphireOpenStackComponentRepository;
|
||||
$this->hyper_visors_repository = new SapphireHyperVisorTypeRepository;
|
||||
$this->guests_os_repository = new SapphireGuestOSTypeRepository();
|
||||
@ -154,10 +164,13 @@ class MarketPlaceAdminPage_Controller extends Page_Controller
|
||||
$this->region_repository = new SapphireRegionRepository;
|
||||
$this->pricing_schema_repository = new SapphirePricingSchemaRepository;
|
||||
$this->public_clouds_repository = new SapphirePublicCloudRepository;
|
||||
$this->public_clouds_draft_repository = new SapphirePublicCloudRepository(true);
|
||||
$this->private_clouds_repository = new SapphirePrivateCloudRepository;
|
||||
$this->private_clouds_draft_repository = new SapphirePrivateCloudRepository(true);
|
||||
$this->config_management_type_repository = new SapphireConfigurationManagementTypeRepository;
|
||||
$this->consultant_service_offered_type_repository = new SapphireConsultantServiceOfferedTypeRepository;
|
||||
$this->consultant_repository = new SapphireConsultantRepository;
|
||||
$this->consultant_draft_repository = new SapphireConsultantRepository(true);
|
||||
}
|
||||
|
||||
|
||||
@ -194,6 +207,7 @@ class MarketPlaceAdminPage_Controller extends Page_Controller
|
||||
'preview',
|
||||
'draft_preview',
|
||||
'pdf',
|
||||
'draft_pdf',
|
||||
);
|
||||
|
||||
|
||||
@ -204,6 +218,7 @@ class MarketPlaceAdminPage_Controller extends Page_Controller
|
||||
'GET $MARKETPLACETYPE/$ID/preview' => 'preview',
|
||||
'GET $MARKETPLACETYPE/$ID/draft_preview' => 'draft_preview',
|
||||
'GET $MARKETPLACETYPE/$ID/pdf' => 'pdf',
|
||||
'GET $MARKETPLACETYPE/$ID/draft_pdf' => 'draft_pdf',
|
||||
);
|
||||
|
||||
public function getCurrentTab()
|
||||
@ -301,10 +316,15 @@ class MarketPlaceAdminPage_Controller extends Page_Controller
|
||||
public function getCurrentAppliance()
|
||||
{
|
||||
$appliance_id = intval($this->request->getVar('id'));
|
||||
$appliance = false;
|
||||
if ($appliance_id > 0) {
|
||||
return $this->appliance_repository->getById($appliance_id);
|
||||
$appliance = $this->appliance_draft_repository->getByLiveServiceId($appliance_id);
|
||||
//if no draft found we pull the live one to create the draft from it when saved
|
||||
if (!$appliance) {
|
||||
$appliance = $this->appliance_repository->getById($appliance_id);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return $appliance;
|
||||
}
|
||||
|
||||
public function getOpenStackAvailableComponents()
|
||||
@ -583,10 +603,15 @@ class MarketPlaceAdminPage_Controller extends Page_Controller
|
||||
public function getCurrentConsultant()
|
||||
{
|
||||
$consultant_id = intval($this->request->getVar('id'));
|
||||
if ($consultant_id > 0) {
|
||||
return $this->consultant_repository->getById($consultant_id);
|
||||
}
|
||||
return false;
|
||||
$consultant = false;
|
||||
if ($consultant_id > 0) {
|
||||
$consultant = $this->consultant_draft_repository->getByLiveServiceId($consultant_id);
|
||||
//if no draft found we pull the live one to create the draft from it when saved
|
||||
if (!$consultant) {
|
||||
$consultant = $this->consultant_repository->getById($consultant_id);
|
||||
}
|
||||
}
|
||||
return $consultant;
|
||||
}
|
||||
|
||||
public function getCurrentConsultantJson()
|
||||
@ -779,10 +804,15 @@ class MarketPlaceAdminPage_Controller extends Page_Controller
|
||||
public function getCurrentPublicCloud()
|
||||
{
|
||||
$public_cloud_id = intval($this->request->getVar('id'));
|
||||
if ($public_cloud_id > 0) {
|
||||
return $this->public_clouds_repository->getById($public_cloud_id);
|
||||
}
|
||||
return false;
|
||||
$public_cloud = false;
|
||||
if ($public_cloud_id > 0) {
|
||||
$public_cloud = $this->public_clouds_draft_repository->getByLiveServiceId($public_cloud_id);
|
||||
//if no draft found we pull the live one to create the draft from it when saved
|
||||
if (!$public_cloud) {
|
||||
$public_cloud = $this->public_clouds_repository->getById($public_cloud_id);
|
||||
}
|
||||
}
|
||||
return $public_cloud;
|
||||
}
|
||||
|
||||
public function getCurrentPublicCloudJson()
|
||||
@ -871,10 +901,15 @@ class MarketPlaceAdminPage_Controller extends Page_Controller
|
||||
public function getCurrentPrivateCloud()
|
||||
{
|
||||
$private_cloud_id = intval($this->request->getVar('id'));
|
||||
if ($private_cloud_id > 0) {
|
||||
return $this->private_clouds_repository->getById($private_cloud_id);
|
||||
}
|
||||
return false;
|
||||
$private_cloud = false;
|
||||
if ($private_cloud_id > 0) {
|
||||
$private_cloud = $this->private_clouds_draft_repository->getByLiveServiceId($private_cloud_id);
|
||||
//if no draft found we pull the live one to create the draft from it when saved
|
||||
if (!$private_cloud) {
|
||||
$private_cloud = $this->private_clouds_repository->getById($private_cloud_id);
|
||||
}
|
||||
}
|
||||
return $private_cloud;
|
||||
}
|
||||
|
||||
public function getCurrentPrivateCloudJson()
|
||||
@ -939,7 +974,6 @@ class MarketPlaceAdminPage_Controller extends Page_Controller
|
||||
|
||||
public function preview()
|
||||
{
|
||||
|
||||
$marketplace_type = $this->request->param('MARKETPLACETYPE');
|
||||
$instance_id = intval($this->request->param('ID'));
|
||||
|
||||
@ -1017,32 +1051,35 @@ class MarketPlaceAdminPage_Controller extends Page_Controller
|
||||
}
|
||||
break;
|
||||
case 'appliance': {
|
||||
$appliance = $this->appliance_repository->getBy($query);
|
||||
$appliance = $this->appliance_draft_repository->getBy($query);
|
||||
$appliance->IsPreview = true;
|
||||
$render = new ApplianceSapphireRender($appliance);
|
||||
return $render->draw();
|
||||
}
|
||||
break;
|
||||
case 'public_cloud': {
|
||||
$public_cloud = $this->public_clouds_repository->getBy($query);
|
||||
$public_cloud = $this->public_clouds_draft_repository->getBy($query);
|
||||
$public_cloud->IsPreview = true;
|
||||
$public_cloud->IsDraft = true;
|
||||
if (!$public_cloud) throw new NotFoundEntityException('', '');
|
||||
$render = new PublicCloudSapphireRender($public_cloud);
|
||||
return $render->draw();
|
||||
}
|
||||
break;
|
||||
case 'private_cloud': {
|
||||
$private_cloud = $this->private_clouds_repository->getBy($query);
|
||||
$private_cloud = $this->private_clouds_draft_repository->getBy($query);
|
||||
$private_cloud->IsPreview = true;
|
||||
$private_cloud->IsDraft = true;
|
||||
$render = new PrivateCloudSapphireRender($private_cloud);
|
||||
return $render->draw();
|
||||
|
||||
}
|
||||
break;
|
||||
case 'consultant': {
|
||||
$consultant = $this->consultant_repository->getBy($query);
|
||||
$consultant = $this->consultant_draft_repository->getBy($query);
|
||||
if (!$consultant) throw new NotFoundEntityException('', '');
|
||||
$consultant->IsPreview = true;
|
||||
$consultant->IsDraft = true;
|
||||
$render = new ConsultantSapphireRender($consultant);
|
||||
return $render->draw();
|
||||
}
|
||||
@ -1075,6 +1112,28 @@ class MarketPlaceAdminPage_Controller extends Page_Controller
|
||||
return CloudViewModel::getDataCenterLocationsJson($cloud);
|
||||
}
|
||||
|
||||
public function getCurrentDataCenterLocationsDraftJson()
|
||||
{
|
||||
$instance_id = intval($this->request->param('ID'));
|
||||
$marketplace_type = $this->request->param('MARKETPLACETYPE');
|
||||
$query = new QueryObject();
|
||||
$query->addAddCondition(QueryCriteria::equal('ID', $instance_id));
|
||||
switch (strtolower($marketplace_type)) {
|
||||
case 'public_cloud': {
|
||||
$cloud = $this->public_clouds_draft_repository->getBy($query);
|
||||
}
|
||||
break;
|
||||
case 'private_cloud': {
|
||||
$cloud = $this->private_clouds_draft_repository->getBy($query);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (!$cloud) throw new NotFoundEntityException('', '');
|
||||
return CloudViewModel::getDataCenterLocationsJson($cloud);
|
||||
}
|
||||
|
||||
public function getCurrentDataCenterStaticMapForPDF()
|
||||
{
|
||||
$static_map_url = "http://maps.googleapis.com/maps/api/staticmap?zoom=1&size=300x200&maptype=roadmap";
|
||||
@ -1104,6 +1163,35 @@ class MarketPlaceAdminPage_Controller extends Page_Controller
|
||||
return $static_map_url;
|
||||
}
|
||||
|
||||
public function getCurrentDataCenterStaticMapDraftForPDF()
|
||||
{
|
||||
$static_map_url = "http://maps.googleapis.com/maps/api/staticmap?zoom=1&size=300x200&maptype=roadmap";
|
||||
$instance_id = intval($this->request->param('ID'));
|
||||
$marketplace_type = $this->request->param('MARKETPLACETYPE');
|
||||
$query = new QueryObject();
|
||||
$query->addAddCondition(QueryCriteria::equal('ID', $instance_id));
|
||||
switch (strtolower($marketplace_type)) {
|
||||
case 'public_cloud': {
|
||||
$cloud = $this->public_clouds_draft_repository->getBy($query);
|
||||
}
|
||||
break;
|
||||
case 'private_cloud': {
|
||||
$cloud = $this->private_clouds_draft_repository->getBy($query);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (!$cloud) throw new NotFoundEntityException('', '');
|
||||
$locations = json_decode(CloudViewModel::getDataCenterLocationsJson($cloud));
|
||||
|
||||
foreach ($locations as $loc) {
|
||||
$static_map_url .= "&markers=".$loc->lat.",".$loc->lng;
|
||||
}
|
||||
|
||||
return $static_map_url;
|
||||
}
|
||||
|
||||
public function getPricingSchemas()
|
||||
{
|
||||
return CloudViewModel::getPricingSchemas();
|
||||
@ -1126,7 +1214,45 @@ class MarketPlaceAdminPage_Controller extends Page_Controller
|
||||
return $pricing_schemas;
|
||||
}
|
||||
|
||||
public function getEnabledPricingSchemas()
|
||||
public function getPricingSchemasDraftForPDF()
|
||||
{
|
||||
$pricing_schemas = CloudViewModel::getPricingSchemas();
|
||||
$enabled_ps = json_decode($this->getEnabledPricingSchemasDraft());
|
||||
|
||||
foreach($pricing_schemas as $ps) {
|
||||
$ps->Enabled = 0;
|
||||
foreach ($enabled_ps as $eps) {
|
||||
if ($ps->ID == $eps) {
|
||||
$ps->Enabled = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $pricing_schemas;
|
||||
}
|
||||
|
||||
public function getEnabledPricingSchemas()
|
||||
{
|
||||
$instance_id = intval($this->request->param('ID'));
|
||||
$marketplace_type = $this->request->param('MARKETPLACETYPE');
|
||||
$query = new QueryObject();
|
||||
$query->addAddCondition(QueryCriteria::equal('ID', $instance_id));
|
||||
switch (strtolower($marketplace_type)) {
|
||||
case 'public_cloud': {
|
||||
$cloud = $this->public_clouds_repository->getBy($query);
|
||||
}
|
||||
break;
|
||||
case 'private_cloud': {
|
||||
$cloud = $this->private_clouds_repository->getBy($query);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
if (!$cloud) throw new NotFoundEntityException('', '');
|
||||
return CloudViewModel::getEnabledPricingSchemas($cloud);
|
||||
}
|
||||
|
||||
public function getEnabledPricingSchemasDraft()
|
||||
{
|
||||
$instance_id = intval($this->request->param('ID'));
|
||||
$marketplace_type = $this->request->param('MARKETPLACETYPE');
|
||||
@ -1134,11 +1260,11 @@ class MarketPlaceAdminPage_Controller extends Page_Controller
|
||||
$query->addAddCondition(QueryCriteria::equal('ID', $instance_id));
|
||||
switch (strtolower($marketplace_type)) {
|
||||
case 'public_cloud': {
|
||||
$cloud = $this->public_clouds_repository->getBy($query);
|
||||
$cloud = $this->public_clouds_draft_repository->getBy($query);
|
||||
}
|
||||
break;
|
||||
case 'private_cloud': {
|
||||
$cloud = $this->private_clouds_repository->getBy($query);
|
||||
$cloud = $this->private_clouds_draft_repository->getBy($query);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1159,6 +1285,18 @@ class MarketPlaceAdminPage_Controller extends Page_Controller
|
||||
return ConsultantViewModel::getOfficesLocationsJson($consultant);
|
||||
}
|
||||
|
||||
public function getCurrentOfficesLocationsDraftJson()
|
||||
{
|
||||
$instance_id = intval($this->request->param('ID'));
|
||||
$query = new QueryObject();
|
||||
$query->addAddCondition(QueryCriteria::equal('ID', $instance_id));
|
||||
|
||||
$consultant = $this->consultant_draft_repository->getBy($query);
|
||||
|
||||
if (!$consultant) throw new NotFoundEntityException('', '');
|
||||
return ConsultantViewModel::getOfficesLocationsJson($consultant);
|
||||
}
|
||||
|
||||
public function getCurrentOfficesLocationsStaticMapForPDF()
|
||||
{
|
||||
$static_map_url = "http://maps.googleapis.com/maps/api/staticmap?zoom=1&size=300x200&maptype=roadmap";
|
||||
@ -1178,6 +1316,26 @@ class MarketPlaceAdminPage_Controller extends Page_Controller
|
||||
return $static_map_url;
|
||||
}
|
||||
|
||||
|
||||
public function getCurrentOfficesLocationsStaticMapDraftForPDF()
|
||||
{
|
||||
$static_map_url = "http://maps.googleapis.com/maps/api/staticmap?zoom=1&size=300x200&maptype=roadmap";
|
||||
$instance_id = intval($this->request->param('ID'));
|
||||
$query = new QueryObject();
|
||||
$query->addAddCondition(QueryCriteria::equal('ID', $instance_id));
|
||||
|
||||
$consultant = $this->consultant_draft_repository->getBy($query);
|
||||
|
||||
if (!$consultant) throw new NotFoundEntityException('', '');
|
||||
$locations = json_decode(ConsultantViewModel::getOfficesLocationsJson($consultant));
|
||||
|
||||
foreach ($locations as $loc) {
|
||||
$static_map_url .= "&markers=".$loc->lat.",".$loc->lng;
|
||||
}
|
||||
|
||||
return $static_map_url;
|
||||
}
|
||||
|
||||
public function pdf(){
|
||||
$html_inner = '';
|
||||
$marketplace_type = $this->request->param('MARKETPLACETYPE');
|
||||
@ -1189,7 +1347,7 @@ class MarketPlaceAdminPage_Controller extends Page_Controller
|
||||
|
||||
switch (strtolower($marketplace_type)) {
|
||||
case 'distribution': {
|
||||
$distribution = $this->distribution_draft_repository->getBy($query);
|
||||
$distribution = $this->distribution_repository->getBy($query);
|
||||
if (!$distribution) throw new NotFoundEntityException('', '');
|
||||
$render = new DistributionSapphireRender($distribution);
|
||||
$distribution ->IsPreview = true;
|
||||
@ -1264,4 +1422,90 @@ class MarketPlaceAdminPage_Controller extends Page_Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function draft_pdf(){
|
||||
$html_inner = '';
|
||||
$marketplace_type = $this->request->param('MARKETPLACETYPE');
|
||||
$instance_id = intval($this->request->param('ID'));
|
||||
$base = Director::baseFolder();
|
||||
|
||||
$query = new QueryObject();
|
||||
$query->addAddCondition(QueryCriteria::equal('ID', $instance_id));
|
||||
|
||||
switch (strtolower($marketplace_type)) {
|
||||
case 'distribution': {
|
||||
$distribution = $this->distribution_draft_repository->getBy($query);
|
||||
if (!$distribution) throw new NotFoundEntityException('', '');
|
||||
$render = new DistributionSapphireRender($distribution);
|
||||
$distribution ->IsPreview = true;
|
||||
$html_inner = $render->pdf();
|
||||
$css = @file_get_contents($base . "/marketplace/code/ui/admin/css/pdf.css");
|
||||
}
|
||||
break;
|
||||
case 'appliance': {
|
||||
$appliance = $this->appliance_draft_repository->getBy($query);
|
||||
$appliance->IsPreview = true;
|
||||
$render = new ApplianceSapphireRender($appliance);
|
||||
$html_inner = $render->pdf();
|
||||
$css = @file_get_contents($base . "/marketplace/code/ui/admin/css/pdf.css");
|
||||
}
|
||||
break;
|
||||
case 'public_cloud': {
|
||||
$public_cloud = $this->public_clouds_draft_repository->getBy($query);
|
||||
$public_cloud->IsPreview = true;
|
||||
if (!$public_cloud) throw new NotFoundEntityException('', '');
|
||||
$render = new PublicCloudSapphireRender($public_cloud);
|
||||
$html_inner = $render->pdf();
|
||||
$css = @file_get_contents($base . "/marketplace/code/ui/admin/css/pdf.css");
|
||||
}
|
||||
break;
|
||||
case 'private_cloud': {
|
||||
$private_cloud = $this->private_clouds_draft_repository->getBy($query);
|
||||
$private_cloud->IsPreview = true;
|
||||
$render = new PrivateCloudSapphireRender($private_cloud);
|
||||
$html_inner = $render->pdf();
|
||||
$css = @file_get_contents($base . "/marketplace/code/ui/admin/css/pdf.css");
|
||||
|
||||
}
|
||||
break;
|
||||
case 'consultant': {
|
||||
$consultant = $this->consultant_draft_repository->getBy($query);
|
||||
if (!$consultant) throw new NotFoundEntityException('', '');
|
||||
$consultant->IsPreview = true;
|
||||
$render = new ConsultantSapphireRender($consultant);
|
||||
$html_inner = $render->pdf();
|
||||
$css = @file_get_contents($base . "/marketplace/code/ui/admin/css/pdf.css");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$this->httpError(404);
|
||||
break;
|
||||
}
|
||||
|
||||
//create pdf
|
||||
$file = FileUtils::convertToFileName('preview') . '.pdf';
|
||||
|
||||
$html_outer = sprintf("<html><head><style>%s</style></head><body><div class='container'>%s</div></body></html>",
|
||||
str_replace("@host", $base, $css),$html_inner);
|
||||
|
||||
|
||||
try {
|
||||
$html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(15, 5, 15, 5));
|
||||
//$html2pdf->addFont('Open Sans', '', $base.'/themes/openstack/assets/fonts/PT-Sans/PTC75F-webfont.ttf');
|
||||
$html2pdf->WriteHTML($html_outer);
|
||||
//clean output buffer
|
||||
ob_end_clean();
|
||||
$html2pdf->Output($file, "D");
|
||||
} catch (HTML2PDF_exception $e) {
|
||||
$message = array(
|
||||
'errno' => '',
|
||||
'errstr' => $e->__toString(),
|
||||
'errfile' => 'UserStory.php',
|
||||
'errline' => '',
|
||||
'errcontext' => ''
|
||||
);
|
||||
SS_Log::log($message, SS_Log::ERR);
|
||||
$this->httpError(404,'There was an error on PDF generation!');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -52,8 +52,8 @@ input.error{
|
||||
float:left;
|
||||
text-align:center;
|
||||
padding:0 !important;
|
||||
padding-left: 15px !important;
|
||||
padding-right: 15px !important;
|
||||
padding-left: 10px !important;
|
||||
padding-right: 10px !important;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,16 @@ jQuery(document).ready(function($){
|
||||
else{
|
||||
$('#active',form).prop('checked',false);
|
||||
}
|
||||
$("#id",form).val(appliance.id);
|
||||
|
||||
//this is a draft
|
||||
if (appliance.live_service_id) {
|
||||
$("#id",form).val(appliance.id);
|
||||
$("#live_id",form).val(appliance.live_service_id);
|
||||
} else { //its not a draft is the live version, so we remove the id and set the live_service_id
|
||||
$("#live_id",form).val(appliance.id);
|
||||
$('.publish-appliance').prop('disabled',true);
|
||||
}
|
||||
|
||||
//reload widgets
|
||||
$("#guest_os_form").guest_os('load',appliance.guest_os);
|
||||
$("#hypervisors_form").hypervisors('load',appliance.hypervisors);
|
||||
@ -77,6 +86,7 @@ jQuery(document).ready(function($){
|
||||
//create distribution object and POST it
|
||||
var appliance = {};
|
||||
appliance.id = parseInt($("#id",form).val());
|
||||
appliance.live_service_id = parseInt($("#live_id",form).val());
|
||||
appliance.company_id = parseInt($("#company_id",form).val());
|
||||
appliance.name = $("#name",form).val();
|
||||
appliance.overview = $("#overview",form).val();
|
||||
@ -98,7 +108,10 @@ jQuery(document).ready(function($){
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function (data,textStatus,jqXHR) {
|
||||
window.location = listing_url;
|
||||
//window.location = listing_url;
|
||||
if(appliance.id < 1) $("#id",form).val(data);
|
||||
$('.publish-appliance').prop('disabled',false);
|
||||
$('.save-appliance').prop('disabled',false);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
ajaxError(jqXHR, textStatus, errorThrown);
|
||||
@ -108,6 +121,69 @@ jQuery(document).ready(function($){
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.publish-appliance').click(function(event){
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var button = $(this);
|
||||
if(button.prop('disabled')){
|
||||
return false;
|
||||
}
|
||||
var form_validator = form.marketplace_type_header('getFormValidator');
|
||||
form_validator.settings.ignore = ".add-comtrol";
|
||||
var is_valid = form.valid();
|
||||
if(!is_valid) return false;
|
||||
form_validator.resetForm();
|
||||
var additional_resources = $("#additional-resources-form").additional_resources('serialize');
|
||||
var regional_support = $("#support-channels-form").support_channels('serialize');
|
||||
var capabilities = $("#components_form").components('serialize');
|
||||
var guest_os = $("#guest_os_form").guest_os('serialize');
|
||||
var hypervisors = $("#hypervisors_form").hypervisors('serialize');
|
||||
var videos = $("#videos-form").videos('serialize');
|
||||
|
||||
if(additional_resources !== false &&
|
||||
regional_support !== false &&
|
||||
capabilities !== false &&
|
||||
guest_os !== false &&
|
||||
hypervisors !== false &&
|
||||
videos !== false){
|
||||
|
||||
//create distribution object and POST it
|
||||
var appliance = {};
|
||||
appliance.id = parseInt($("#id",form).val());
|
||||
appliance.live_service_id = parseInt($("#live_id",form).val());
|
||||
appliance.company_id = parseInt($("#company_id",form).val());
|
||||
appliance.name = $("#name",form).val();
|
||||
appliance.overview = $("#overview",form).val();
|
||||
appliance.call_2_action_uri = $("#call_2_action_uri",form).val();
|
||||
appliance.active = $('#active',form).is(":checked");;
|
||||
appliance.videos = videos;
|
||||
appliance.hypervisors = hypervisors;
|
||||
appliance.guest_os = guest_os;
|
||||
appliance.capabilities = capabilities;
|
||||
appliance.regional_support = regional_support;
|
||||
appliance.additional_resources = additional_resources;
|
||||
|
||||
var url = 'api/v1/marketplace/appliances/'+appliance.live_service_id;
|
||||
|
||||
$('.publish-appliance').prop('disabled',true);
|
||||
$.ajax({
|
||||
type: 'PUT',
|
||||
url: url,
|
||||
data: JSON.stringify(appliance),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function (data,textStatus,jqXHR) {
|
||||
window.location = listing_url;
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
ajaxError(jqXHR, textStatus, errorThrown);
|
||||
$('.publish-appliance').prop('disabled',false);
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -41,7 +41,16 @@ jQuery(document).ready(function($){
|
||||
else{
|
||||
$('#active',form).prop('checked',false);
|
||||
}
|
||||
$("#id",form).val(consultant.id);
|
||||
|
||||
//this is a draft
|
||||
if (consultant.live_service_id) {
|
||||
$("#id",form).val(consultant.id);
|
||||
$("#live_id",form).val(consultant.live_service_id);
|
||||
} else { //its not a draft is the live version, so we remove the id and set the live_service_id
|
||||
$("#live_id",form).val(consultant.id);
|
||||
$('.publish-consultant').prop('disabled',true);
|
||||
}
|
||||
|
||||
//reload widgets
|
||||
$("#videos-form").videos('load',consultant.videos);
|
||||
$("#support-channels-form").support_channels('load',consultant.regional_support);
|
||||
@ -92,6 +101,7 @@ jQuery(document).ready(function($){
|
||||
|
||||
var consultant = {
|
||||
id : parseInt($("#id",form).val()),
|
||||
live_service_id : parseInt($("#live_id",form).val()),
|
||||
company_id : parseInt($("#company_id",form).val()),
|
||||
name : $("#name",form).val().trim(),
|
||||
overview : $("#overview",form).val().trim(),
|
||||
@ -152,7 +162,10 @@ jQuery(document).ready(function($){
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function (data,textStatus,jqXHR) {
|
||||
window.location = listing_url;
|
||||
//window.location = listing_url;
|
||||
if(consultant.id < 1) $("#id",form).val(data);
|
||||
$('.publish-consultant').prop('disabled',false);
|
||||
$('.save-consultant').prop('disabled',false);
|
||||
ajaxIndicatorStop();
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
@ -173,5 +186,129 @@ jQuery(document).ready(function($){
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.publish-consultant').click(function(event){
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var button = $(this);
|
||||
if(button.prop('disabled')){
|
||||
return false;
|
||||
}
|
||||
var form_validator = form.marketplace_type_header('getFormValidator');
|
||||
form_validator.settings.ignore = ".add-comtrol";
|
||||
var is_valid = form.valid();
|
||||
form_validator.settings.ignore = [];
|
||||
if(!is_valid) return false;
|
||||
form_validator.resetForm();
|
||||
|
||||
var expertise_areas = $('#expertise_areas_form').expertise_areas('serialize');
|
||||
var configuration_management = $('#configuration_management_form').configuration_management_expertise('serialize');
|
||||
var reference_clients = $('#reference_clients_form').reference_clients('serialize');
|
||||
var services_offered = $('#services_offered_form').services_offered('serialize');
|
||||
var regional_support = $('#support-channels-form').support_channels('serialize');
|
||||
var languages_spoken = $('#languages_spoken_form').spoken_languages('serialize');
|
||||
var offices = $('#offices_form').offices('serialize');
|
||||
var videos = $('#videos-form').videos('serialize');
|
||||
var additional_resources = $('#additional-resources-form').additional_resources('serialize');
|
||||
|
||||
if(expertise_areas!==false &&
|
||||
configuration_management!== false &&
|
||||
reference_clients!== false &&
|
||||
services_offered !== false &&
|
||||
regional_support !== false &&
|
||||
languages_spoken !== false &&
|
||||
offices !== false &&
|
||||
videos !== false &&
|
||||
additional_resources !== false ){
|
||||
|
||||
ajaxIndicatorStart('saving data.. please wait..');
|
||||
|
||||
var consultant = {
|
||||
id : parseInt($("#id",form).val()),
|
||||
live_service_id : parseInt($("#live_id",form).val()),
|
||||
company_id : parseInt($("#company_id",form).val()),
|
||||
name : $("#name",form).val().trim(),
|
||||
overview : $("#overview",form).val().trim(),
|
||||
call_2_action_uri : $("#call_2_action_uri",form).val().trim(),
|
||||
active : $('#active',form).is(":checked"),
|
||||
expertise_areas: expertise_areas,
|
||||
configuration_management: configuration_management,
|
||||
reference_clients: reference_clients,
|
||||
services_offered: services_offered,
|
||||
regional_support: regional_support,
|
||||
languages_spoken: languages_spoken,
|
||||
offices: offices,
|
||||
videos: videos,
|
||||
additional_resources: additional_resources
|
||||
}
|
||||
$('.publish-consultant').prop('disabled',true);
|
||||
|
||||
var url = 'api/v1/marketplace/consultants/'+consultant.live_service_id;
|
||||
|
||||
$(this).geocoding({
|
||||
requests:consultant.offices,
|
||||
buildGeoRequest:function(office){
|
||||
var address = office.address_1+' '+office.address_2;
|
||||
address = address.trim();
|
||||
if(address!=''){
|
||||
address+= ', '+office.city;
|
||||
}
|
||||
var restrictions = {
|
||||
locality: office.city,
|
||||
country:office.country
|
||||
};
|
||||
if(office.state!=''){
|
||||
restrictions.administrativeArea = office.state;
|
||||
if(address!=''){
|
||||
address+= ', '+office.state;
|
||||
}
|
||||
}
|
||||
if(office.zip_code!=''){
|
||||
//restrictions.postalCode = office.zip_code;
|
||||
if(address!=''){
|
||||
address+= ', '+office.zip_code;
|
||||
}
|
||||
}
|
||||
var request = {componentRestrictions:restrictions};
|
||||
if(address!=''){
|
||||
request.address = address;
|
||||
}
|
||||
return request;
|
||||
},
|
||||
postProcessRequest:function(office, lat, lng){
|
||||
office.lat = lat;
|
||||
office.lng = lng;
|
||||
},
|
||||
processFinished:function(){
|
||||
$.ajax({
|
||||
type: 'PUT',
|
||||
url: url,
|
||||
data: JSON.stringify(consultant),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function (data,textStatus,jqXHR) {
|
||||
window.location = listing_url;
|
||||
ajaxIndicatorStop();
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
ajaxIndicatorStop();
|
||||
$('.publish-consultant').prop('disabled',false);
|
||||
ajaxError(jqXHR, textStatus, errorThrown);
|
||||
}
|
||||
});
|
||||
},
|
||||
cancelProcess:function(){
|
||||
ajaxIndicatorStop();
|
||||
$('.publish-consultant').prop('disabled',false);
|
||||
},
|
||||
errorMessage:function(office){
|
||||
return 'office: address ( address_1:'+office.address_1+', address_2:'+office.address_2+', city:'+office.city+',state: '+office.state+', country:'+office.country+' )';
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
});
|
@ -111,6 +111,7 @@ jQuery(document).ready(function($){
|
||||
dataType: "json",
|
||||
success: function (data,textStatus,jqXHR) {
|
||||
//window.location = listing_url;
|
||||
if(distribution.id < 1) $("#id",form).val(data);
|
||||
$('.publish-distribution').prop('disabled',false);
|
||||
$('.save-distribution').prop('disabled',false);
|
||||
},
|
||||
|
@ -43,7 +43,16 @@ jQuery(document).ready(function($){
|
||||
else{
|
||||
$('#active',form).prop('checked',false);
|
||||
}
|
||||
$("#id",form).val(private_cloud.id);
|
||||
|
||||
//this is a draft
|
||||
if (private_cloud.live_service_id) {
|
||||
$("#id",form).val(private_cloud.id);
|
||||
$("#live_id",form).val(private_cloud.live_service_id);
|
||||
} else { //its not a draft is the live version, so we remove the id and set the live_service_id
|
||||
$("#live_id",form).val(private_cloud.id);
|
||||
$('.publish-private-cloud').prop('disabled',true);
|
||||
}
|
||||
|
||||
//reload widgets
|
||||
$("#components_form").components('load',private_cloud.capabilities);
|
||||
if(private_cloud.capabilities.length>0){
|
||||
@ -94,6 +103,7 @@ jQuery(document).ready(function($){
|
||||
//create private_cloud object and POST it
|
||||
var private_cloud = {};
|
||||
private_cloud.id = parseInt($("#id",form).val());
|
||||
private_cloud.live_service_id = parseInt($("#live_id",form).val());
|
||||
private_cloud.company_id = parseInt($("#company_id",form).val());
|
||||
private_cloud.name = $("#name",form).val();
|
||||
private_cloud.overview = $("#overview",form).val();
|
||||
@ -140,7 +150,10 @@ jQuery(document).ready(function($){
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function (data,textStatus,jqXHR) {
|
||||
window.location = listing_url;
|
||||
//window.location = listing_url;
|
||||
if(private_cloud.id < 1) $("#id",form).val(data);
|
||||
$('.publish-private-cloud').prop('disabled',false);
|
||||
$('.save-private-cloud').prop('disabled',false);
|
||||
ajaxIndicatorStop();
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
@ -163,5 +176,114 @@ jQuery(document).ready(function($){
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.publish-private-cloud').click(function(event){
|
||||
var button = $(this);
|
||||
if(button.prop('disabled')){
|
||||
return false;
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var form_validator = form.marketplace_type_header('getFormValidator');
|
||||
form_validator.settings.ignore = ".add-comtrol";
|
||||
var is_valid = form.valid();
|
||||
if(!is_valid) return false;
|
||||
form_validator.resetForm();
|
||||
|
||||
var additional_resources = $("#additional-resources-form").additional_resources('serialize');
|
||||
var regional_support = $("#support-channels-form").support_channels('serialize');
|
||||
var capabilities = $("#components_form").components('serialize');
|
||||
var guest_os = $("#guest_os_form").guest_os('serialize');
|
||||
var hyper_visors = $("#hypervisors_form").hypervisors('serialize');
|
||||
var videos = $("#videos-form").videos('serialize');
|
||||
var data_centers = $("#data-centers-form").datacenter_locations('serialize');
|
||||
var pricing_schemas = $("#pricing_schema_form").pricing_schemas('serialize');
|
||||
|
||||
if(additional_resources !== false &&
|
||||
regional_support !== false &&
|
||||
capabilities !== false &&
|
||||
guest_os !== false &&
|
||||
hyper_visors !== false &&
|
||||
videos !== false &&
|
||||
data_centers !== false &&
|
||||
pricing_schemas !== false
|
||||
){
|
||||
|
||||
ajaxIndicatorStart('saving data.. please wait..');
|
||||
|
||||
//create private_cloud object and POST it
|
||||
var private_cloud = {};
|
||||
private_cloud.id = parseInt($("#id",form).val());
|
||||
private_cloud.live_service_id = parseInt($("#live_id",form).val());
|
||||
private_cloud.company_id = parseInt($("#company_id",form).val());
|
||||
private_cloud.name = $("#name",form).val();
|
||||
private_cloud.overview = $("#overview",form).val();
|
||||
private_cloud.call_2_action_uri = $("#call_2_action_uri",form).val();
|
||||
private_cloud.active = $('#active',form).is(":checked");
|
||||
private_cloud.videos = videos;
|
||||
private_cloud.hypervisors = hyper_visors;
|
||||
private_cloud.guest_os = guest_os;
|
||||
private_cloud.capabilities = capabilities;
|
||||
for(var i in private_cloud.capabilities){
|
||||
var c = private_cloud.capabilities[i];
|
||||
c.pricing_schemas = pricing_schemas;
|
||||
}
|
||||
private_cloud.regional_support = regional_support;
|
||||
private_cloud.additional_resources = additional_resources;
|
||||
private_cloud.data_centers = data_centers;
|
||||
|
||||
var url = 'api/v1/marketplace/private-clouds/'+private_cloud.live_service_id;
|
||||
|
||||
$('.publish-private-cloud').prop('disabled',true);
|
||||
|
||||
$(this).geocoding({
|
||||
requests:private_cloud.data_centers.locations,
|
||||
buildGeoRequest:function(location){
|
||||
var restrictions = {
|
||||
locality: location.city,
|
||||
country:location.country
|
||||
};
|
||||
if(location.state!=''){
|
||||
restrictions.administrativeArea = location.state;
|
||||
}
|
||||
var request = {componentRestrictions:restrictions};
|
||||
return request;
|
||||
},
|
||||
postProcessRequest:function(location, lat, lng){
|
||||
location.lat = lat;
|
||||
location.lng = lng;
|
||||
},
|
||||
processFinished:function(){
|
||||
$.ajax({
|
||||
type: 'PUT',
|
||||
url: url,
|
||||
data: JSON.stringify(private_cloud),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function (data,textStatus,jqXHR) {
|
||||
window.location = listing_url;
|
||||
ajaxIndicatorStop();
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
ajaxIndicatorStop();
|
||||
$('.publish-private-cloud').prop('disabled',false);
|
||||
ajaxError(jqXHR, textStatus, errorThrown);
|
||||
}
|
||||
});
|
||||
},
|
||||
cancelProcess:function(){
|
||||
ajaxIndicatorStop();
|
||||
$('.publish-private-cloud').prop('disabled',false);
|
||||
},
|
||||
errorMessage:function(location){
|
||||
return 'data center location: address ( city:'+location.city+',state: '+location.state+', country:'+location.country+' )';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
}
|
||||
});
|
@ -43,7 +43,16 @@ jQuery(document).ready(function($){
|
||||
else{
|
||||
$('#active',form).prop('checked',false);
|
||||
}
|
||||
$("#id",form).val(public_cloud.id);
|
||||
|
||||
//this is a draft
|
||||
if (public_cloud.live_service_id) {
|
||||
$("#id",form).val(public_cloud.id);
|
||||
$("#live_id",form).val(public_cloud.live_service_id);
|
||||
} else { //its not a draft is the live version, so we remove the id and set the live_service_id
|
||||
$("#live_id",form).val(public_cloud.id);
|
||||
$('.publish-public-cloud').prop('disabled',true);
|
||||
}
|
||||
|
||||
//reload widgets
|
||||
$("#components_form").components('load',public_cloud.capabilities);
|
||||
if(public_cloud.capabilities.length>0){
|
||||
@ -94,6 +103,7 @@ jQuery(document).ready(function($){
|
||||
//create public_cloud object and POST it
|
||||
var public_cloud = {};
|
||||
public_cloud.id = parseInt($("#id",form).val());
|
||||
public_cloud.live_service_id = parseInt($("#live_id",form).val());
|
||||
public_cloud.company_id = parseInt($("#company_id",form).val());
|
||||
public_cloud.name = $("#name",form).val();
|
||||
public_cloud.overview = $("#overview",form).val();
|
||||
@ -142,7 +152,10 @@ jQuery(document).ready(function($){
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function (data,textStatus,jqXHR) {
|
||||
window.location = listing_url;
|
||||
//window.location = listing_url;
|
||||
if(public_cloud.id < 1) $("#id",form).val(data);
|
||||
$('.publish-public-cloud').prop('disabled',false);
|
||||
$('.save-public-cloud').prop('disabled',false);
|
||||
ajaxIndicatorStop();
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
@ -166,5 +179,116 @@ jQuery(document).ready(function($){
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.publish-public-cloud').click(function(event){
|
||||
var button = $(this);
|
||||
if(button.prop('disabled')){
|
||||
return false;
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var form_validator = form.marketplace_type_header('getFormValidator');
|
||||
form_validator.settings.ignore = ".add-comtrol";
|
||||
var is_valid = form.valid();
|
||||
if(!is_valid) return false;
|
||||
form_validator.resetForm();
|
||||
var additional_resources = $("#additional-resources-form").additional_resources('serialize');
|
||||
var regional_support = $("#support-channels-form").support_channels('serialize');
|
||||
var capabilities = $("#components_form").components('serialize');
|
||||
var guest_os = $("#guest_os_form").guest_os('serialize');
|
||||
var hyper_visors = $("#hypervisors_form").hypervisors('serialize');
|
||||
var videos = $("#videos-form").videos('serialize');
|
||||
var data_centers = $("#data-centers-form").datacenter_locations('serialize');
|
||||
var pricing_schemas = $("#pricing_schema_form").pricing_schemas('serialize');
|
||||
|
||||
if(additional_resources !== false &&
|
||||
regional_support !== false &&
|
||||
capabilities !== false &&
|
||||
guest_os !== false &&
|
||||
hyper_visors !== false &&
|
||||
videos !== false &&
|
||||
data_centers !== false &&
|
||||
pricing_schemas !== false
|
||||
){
|
||||
|
||||
ajaxIndicatorStart('saving data.. please wait..');
|
||||
|
||||
//create public_cloud object and POST it
|
||||
var public_cloud = {};
|
||||
public_cloud.id = parseInt($("#id",form).val());
|
||||
public_cloud.live_service_id = parseInt($("#live_id",form).val());
|
||||
public_cloud.company_id = parseInt($("#company_id",form).val());
|
||||
public_cloud.name = $("#name",form).val();
|
||||
public_cloud.overview = $("#overview",form).val();
|
||||
public_cloud.call_2_action_uri = $("#call_2_action_uri",form).val();
|
||||
public_cloud.active = $('#active',form).is(":checked");
|
||||
public_cloud.videos = videos;
|
||||
public_cloud.hypervisors = hyper_visors;
|
||||
public_cloud.guest_os = guest_os;
|
||||
public_cloud.capabilities = capabilities;
|
||||
for(var i in public_cloud.capabilities){
|
||||
var c = public_cloud.capabilities[i];
|
||||
c.pricing_schemas = pricing_schemas;
|
||||
}
|
||||
public_cloud.regional_support = regional_support;
|
||||
public_cloud.additional_resources = additional_resources;
|
||||
public_cloud.data_centers = data_centers;
|
||||
|
||||
|
||||
var url = 'api/v1/marketplace/public-clouds/'+public_cloud.live_service_id;
|
||||
|
||||
$('.publish-public-cloud').prop('disabled',true);
|
||||
|
||||
|
||||
$(this).geocoding({
|
||||
requests:public_cloud.data_centers.locations,
|
||||
buildGeoRequest:function(location){
|
||||
var restrictions = {
|
||||
locality: location.city,
|
||||
country:location.country
|
||||
};
|
||||
if(location.state!=''){
|
||||
restrictions.administrativeArea = location.state;
|
||||
}
|
||||
var request = {componentRestrictions:restrictions};
|
||||
return request;
|
||||
},
|
||||
postProcessRequest:function(location, lat, lng){
|
||||
location.lat = lat;
|
||||
location.lng = lng;
|
||||
},
|
||||
processFinished:function(){
|
||||
$.ajax({
|
||||
type: 'PUT',
|
||||
url: url,
|
||||
data: JSON.stringify(public_cloud),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function (data,textStatus,jqXHR) {
|
||||
window.location = listing_url;
|
||||
ajaxIndicatorStop();
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
ajaxIndicatorStop();
|
||||
$('.publish-public-cloud').prop('disabled',false);
|
||||
ajaxError(jqXHR, textStatus, errorThrown);
|
||||
}
|
||||
});
|
||||
},
|
||||
cancelProcess:function(){
|
||||
ajaxIndicatorStop();
|
||||
$('.publish-public-cloud').prop('disabled',false);
|
||||
},
|
||||
errorMessage:function(location){
|
||||
return 'data center location: address ( city:'+location.city+',state: '+location.state+', country:'+location.country+' )';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
}
|
||||
});
|
@ -55,7 +55,11 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<script>
|
||||
var enabled_schemas = $Top.EnabledPricingSchemas;
|
||||
<% if IsDraft %>
|
||||
var enabled_schemas = $Top.EnabledPricingSchemasDraft;
|
||||
<% else %>
|
||||
var enabled_schemas = $Top.EnabledPricingSchemas;
|
||||
<% end_if %>
|
||||
</script>
|
||||
<% end_if %>
|
||||
<% if HyperVisors %>
|
||||
@ -97,7 +101,11 @@
|
||||
<% end_if %>
|
||||
<% if DataCenters %>
|
||||
<script type="text/javascript">
|
||||
var dc_locations_per_cloud_instance = $Top.CurrentDataCenterLocationsJson;
|
||||
<% if IsDraft %>
|
||||
var dc_locations_per_cloud_instance = $Top.CurrentDataCenterLocationsDraftJson;
|
||||
<% else %>
|
||||
var dc_locations_per_cloud_instance = $Top.CurrentDataCenterLocationsJson;
|
||||
<% end_if %>
|
||||
</script>
|
||||
<hr>
|
||||
<h3 style="color: #{$Company.CompanyColor} !important;" >Data Center Locations</h3>
|
||||
|
@ -73,7 +73,11 @@
|
||||
<% end_control %>
|
||||
</p>
|
||||
<div style="width: 300px; height: 200px; position: relative;" tabindex="0">
|
||||
<img src="$Top.CurrentDataCenterStaticMapForPDF" />
|
||||
<% if IsDraft %>
|
||||
<img src="$Top.CurrentDataCenterStaticMapDraftForPDF" />
|
||||
<% else %>
|
||||
<img src="$Top.CurrentDataCenterStaticMapForPDF" />
|
||||
<% end_if %>
|
||||
</div>
|
||||
<p>Click any location to see availability zones and API endpoints</p>
|
||||
<% end_if %>
|
||||
@ -161,12 +165,22 @@
|
||||
<h3 style="color: {$Company.CompanyColorRGB} !important;">Pricing Options</h3>
|
||||
<table class="pricing">
|
||||
<tbody>
|
||||
<% control Top.PricingSchemasForPDF %>
|
||||
<tr>
|
||||
<td>$Type</td>
|
||||
<td id="enabled_{$ID}"><% if Enabled==1 %>Yes<% else %>No<% end_if %></td>
|
||||
</tr>
|
||||
<% end_control %>
|
||||
<% if IsDraft %>
|
||||
<% control Top.PricingSchemasDraftForPDF %>
|
||||
<tr>
|
||||
<td>$Type</td>
|
||||
<td id="enabled_{$ID}"><% if Enabled==1 %>Yes<% else %>No<% end_if %></td>
|
||||
</tr>
|
||||
<% end_control %>
|
||||
<% else %>
|
||||
<% control Top.PricingSchemasForPDF %>
|
||||
<tr>
|
||||
<td>$Type</td>
|
||||
<td id="enabled_{$ID}"><% if Enabled==1 %>Yes<% else %>No<% end_if %></td>
|
||||
</tr>
|
||||
<% end_control %>
|
||||
<% end_if %>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<hr>
|
||||
|
@ -73,7 +73,11 @@
|
||||
<hr>
|
||||
<h3 style="color: #{$Company.CompanyColor} !important;">Offices</h3>
|
||||
<script type="text/javascript">
|
||||
var offices_instance = $Top.CurrentOfficesLocationsJson;
|
||||
<% if IsDraft %>
|
||||
var offices_instance = $Top.CurrentOfficesLocationsDraftJson;
|
||||
<% else %>
|
||||
var offices_instance = $Top.CurrentOfficesLocationsJson;
|
||||
<% end_if %>
|
||||
</script>
|
||||
<div style="width: 300px; height: 200px; position: relative;" id="mini-map" tabindex="0">
|
||||
</div>
|
||||
|
@ -69,7 +69,11 @@
|
||||
<hr>
|
||||
<h3 style="color: #{$Company.CompanyColorRGB} !important;">Offices</h3>
|
||||
<div style="width: 300px; height: 200px; position: relative;" tabindex="0">
|
||||
<img src="$Top.CurrentOfficesLocationsStaticMapForPDF" />
|
||||
<% if IsDraft %>
|
||||
<img src="$Top.CurrentOfficesLocationsStaticMapDraftForPDF" />
|
||||
<% else %>
|
||||
<img src="$Top.CurrentOfficesLocationsStaticMapForPDF" />
|
||||
<% end_if %>
|
||||
</div>
|
||||
<p>
|
||||
Click any map pin to see office address
|
||||
|
@ -77,6 +77,7 @@
|
||||
<td style="min-width: 200px" width="30%">
|
||||
<a class="product-button roundedButton addDeploymentBtn" href="$Top.Link(consultant)?id=$ID">Edit Product Details</a>
|
||||
<a target="_blank" class="product-button roundedButton addDeploymentBtn" href="$Top.Link(consultant)/$ID/preview">Preview Product</a>
|
||||
<a target="_blank" class="product-button roundedButton addDeploymentBtn" href="$Top.Link(consultant)/$ID/pdf">PDF</a>
|
||||
<a class="roundedButton delete-consultant product-button addDeploymentBtn" href="#" data-id="{$ID}">Delete Product</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -20,9 +20,9 @@
|
||||
<select name="implementation_type_id" id="implementation_type_id">
|
||||
<option value="">--select--</option>
|
||||
<% if DistributionMarketPlaceTypes %>
|
||||
<% loop DistributionMarketPlaceTypes %>
|
||||
<% control DistributionMarketPlaceTypes %>
|
||||
<option value="$ID">$Name</option>
|
||||
<% end_loop %>
|
||||
<% end_control %>
|
||||
<% end_if %>
|
||||
</select>
|
||||
</td>
|
||||
@ -30,9 +30,9 @@
|
||||
<select name="company_id" id="company_id">
|
||||
<option value="">--select--</option>
|
||||
<% if Companies %>
|
||||
<% loop Companies %>
|
||||
<% control Companies %>
|
||||
<option value="$ID">$Name</option>
|
||||
<% end_loop %>
|
||||
<% end_control %>
|
||||
<% end_if %>
|
||||
</select>
|
||||
</td>
|
||||
@ -63,7 +63,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if Distributions %>
|
||||
<% loop Distributions %>
|
||||
<% control Distributions %>
|
||||
<tr>
|
||||
<td>
|
||||
$Company.Name
|
||||
@ -81,23 +81,24 @@
|
||||
<% if Top.isSuperAdmin %>
|
||||
<td>
|
||||
<% if EditedBy %>
|
||||
<% with EditedBy %>
|
||||
<% control EditedBy %>
|
||||
$Email ($CurrentCompany)
|
||||
<% end_with %>
|
||||
<% end_control %>
|
||||
<% else %>
|
||||
N/A
|
||||
<% end_if %>
|
||||
</td>
|
||||
<% end_if %>
|
||||
<td style="min-width: 200px" width="30%">
|
||||
<a class="product-button roundedButton addDeploymentBtn" href="<% with MarketPlace %><% if Name == "Appliance" %>$Top.Link(appliance)<% end_if %><% if Name == "Distribution" %>$Top.Link(distribution)<% end_if %><% end_with %>?id=$ID">Edit Product Details</a>
|
||||
<a target="_blank" class="product-button roundedButton addDeploymentBtn" href="<% with MarketPlace %><% if Name == "Appliance" %>$Top.Link(appliance)<% end_if %><% if Name == "Distribution" %>$Top.Link(distribution)<% end_if %><% end_with %>/$ID/preview">Preview Product</a>
|
||||
<a class="product-button roundedButton addDeploymentBtn" href="<% control MarketPlace %><% if Name == "Appliance" %>$Top.Link(appliance)<% end_if %><% if Name == "Distribution" %>$Top.Link(distribution)<% end_if %><% end_control %>?id=$ID">Edit Product Details</a>
|
||||
<a target="_blank" class="product-button roundedButton addDeploymentBtn" href="<% control MarketPlace %><% if Name == "Appliance" %>$Top.Link(appliance)<% end_if %><% if Name == "Distribution" %>$Top.Link(distribution)<% end_if %><% end_control %>/$ID/preview">Preview Product</a>
|
||||
<a target="_blank" class="product-button roundedButton addDeploymentBtn" href="<% control MarketPlace %><% if Name == "Appliance" %>$Top.Link(appliance)<% end_if %><% if Name == "Distribution" %>$Top.Link(distribution)<% end_if %><% end_control %>/$ID/pdf">PDF</a>
|
||||
<a class="roundedButton delete-implementation product-button addDeploymentBtn" href="#"
|
||||
data-id="{$ID}"
|
||||
data-class="<% with MarketPlace %><% if Name == "Appliance" %>appliance<% end_if %><% if Name == "Distribution" %>distribution<% end_if %><% end_with %>">Delete Product</a>
|
||||
data-class="<% control MarketPlace %><% if Name == "Appliance" %>appliance<% end_if %><% if Name == "Distribution" %>distribution<% end_if %><% end_control %>">Delete Product</a>
|
||||
</td>
|
||||
</tr>
|
||||
<% end_loop %>
|
||||
<% end_control %>
|
||||
<% end_if %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -77,6 +77,7 @@
|
||||
<td style="min-width: 200px" width="30%">
|
||||
<a class="product-button roundedButton addDeploymentBtn" href="$Top.Link(private_cloud)?id=$ID">Edit Product Details</a>
|
||||
<a target="_blank" class="product-button roundedButton addDeploymentBtn" href="$Top.Link(private_cloud)/$ID/preview">Preview Product</a>
|
||||
<a target="_blank" class="product-button roundedButton addDeploymentBtn" href="$Top.Link(private_cloud)/$ID/pdf">PDF</a>
|
||||
<a class="roundedButton delete-private-cloud product-button addDeploymentBtn" href="#" data-id="{$ID}">Delete Product</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -77,6 +77,7 @@
|
||||
<td style="min-width: 200px" width="30%">
|
||||
<a class="product-button roundedButton addDeploymentBtn" href="$Top.Link(public_cloud)?id=$ID">Edit Product Details</a>
|
||||
<a target="_blank" class="product-button roundedButton addDeploymentBtn" href="$Top.Link(public_cloud)/$ID/preview">Preview Product</a>
|
||||
<a target="_blank" class="product-button roundedButton addDeploymentBtn" href="$Top.Link(public_cloud)/$ID/pdf">PDF</a>
|
||||
<a class="roundedButton delete-public-cloud product-button addDeploymentBtn" href="#" data-id="{$ID}">Delete Product</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -3,11 +3,12 @@
|
||||
<div style="clear:both">
|
||||
<h1 style="width:50%;float:left;">Appliances - Product Details</h1>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center" class="roundedButton save-appliance" href="#" id="save-appliance">Save</a>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton publish-appliance" href="#" id="publish-appliance">Publish</a>
|
||||
<% if CurrentAppliance %>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" target="_blank" href="$Top.Link(appliance)/$CurrentAppliance.ID/preview">Preview</a>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" target="_blank" href="$Top.Link(appliance)/$CurrentAppliance.ID/draft_preview">Preview</a>
|
||||
<% end_if %>
|
||||
<% if CurrentAppliance %>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" target="_blank" href="$Top.Link(appliance)/$CurrentAppliance.ID/pdf">Download PDF</a>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" target="_blank" href="$Top.Link(appliance)/$CurrentAppliance.ID/draft_pdf">Download PDF</a>
|
||||
<% end_if %>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" href="$Top.Link"><< Back to Products</a>
|
||||
</div>
|
||||
|
@ -3,11 +3,12 @@
|
||||
<div style="clear:both">
|
||||
<h1 style="width:50%;float:left;">Consultant - Product Details</h1>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center" class="roundedButton save-consultant" href="#" id="save-consultant" name="save-consultant">Save</a>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton publish-consultant" href="#" id="publish-consultant">Publish</a>
|
||||
<% if CurrentConsultant %>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" target="_blank" href="$Top.Link(consultant)/$CurrentConsultant.ID/preview">Preview</a>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" target="_blank" href="$Top.Link(consultant)/$CurrentConsultant.ID/draft_preview">Preview</a>
|
||||
<% end_if %>
|
||||
<% if CurrentConsultant %>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" target="_blank" href="$Top.Link(consultant)/$CurrentConsultant.ID/pdf">Download PDF</a>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" target="_blank" href="$Top.Link(consultant)/$CurrentConsultant.ID/draft_pdf">Download PDF</a>
|
||||
<% end_if %>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" href="$Top.Link(consultants)"><< Back to Products</a>
|
||||
</div>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" target="_blank" href="$Top.Link(distribution)/$CurrentDistribution.ID/draft_preview">Preview</a>
|
||||
<% end_if %>
|
||||
<% if CurrentDistribution %>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" target="_blank" href="$Top.Link(distribution)/$CurrentDistribution.ID/pdf">Download PDF</a>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" target="_blank" href="$Top.Link(distribution)/$CurrentDistribution.ID/draft_pdf">Download PDF</a>
|
||||
<% end_if %>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" href="$Top.Link"><< Back to Products</a>
|
||||
</div>
|
||||
|
@ -3,11 +3,12 @@
|
||||
<div style="clear:both">
|
||||
<h1 style="width:50%;float:left;">Private Cloud - Product Details</h1>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center" class="roundedButton save-private-cloud" href="#" id="save-private-cloud1">Save</a>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton publish-private-cloud" href="#" id="publish-private-cloud1">Publish</a>
|
||||
<% if CurrentPrivateCloud %>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" target="_blank" href="$Top.Link(private_cloud)/$CurrentPrivateCloud.ID/preview">Preview</a>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" target="_blank" href="$Top.Link(private_cloud)/$CurrentPrivateCloud.ID/draft_preview">Preview</a>
|
||||
<% end_if %>
|
||||
<% if CurrentPrivateCloud %>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" target="_blank" href="$Top.Link(private_cloud)/$CurrentPrivateCloud.ID/pdf">Download PDF</a>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" target="_blank" href="$Top.Link(private_cloud)/$CurrentPrivateCloud.ID/draft_pdf">Download PDF</a>
|
||||
<% end_if %>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" href="$Top.Link(private_clouds)"><< Back to Products</a>
|
||||
</div>
|
||||
|
@ -3,11 +3,12 @@
|
||||
<div style="clear:both">
|
||||
<h1 style="width:50%;float:left;">Public Cloud - Product Details</h1>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center" class="roundedButton save-public-cloud" href="#" id="save-public-cloud1">Save</a>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton publish-public-cloud" href="#" id="publish-public-cloud1">Publish</a>
|
||||
<% if CurrentPublicCloud %>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" target="_blank" href="$Top.Link(public_cloud)/$CurrentPublicCloud.ID/preview">Preview</a>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" target="_blank" href="$Top.Link(public_cloud)/$CurrentPublicCloud.ID/draft_preview">Preview</a>
|
||||
<% end_if %>
|
||||
<% if CurrentPublicCloud %>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" target="_blank" href="$Top.Link(public_cloud)/$CurrentPublicCloud.ID/pdf">Download PDF</a>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" target="_blank" href="$Top.Link(public_cloud)/$CurrentPublicCloud.ID/draft_pdf">Download PDF</a>
|
||||
<% end_if %>
|
||||
<a style="overflow:hidden;white-space: nowrap;font-weight:normal;float:right;margin-bottom:50px;text-align:center;margin-right:50px;" class="roundedButton addDeploymentBtn" href="$Top.Link(public_clouds)"><< Back to Products</a>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user