diff --git a/marketplace/_config.php b/marketplace/_config.php index 130db30..821443c 100644 --- a/marketplace/_config.php +++ b/marketplace/_config.php @@ -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'); \ No newline at end of file diff --git a/marketplace/code/infrastructure/active_records/clouds/AvailabilityZoneDraft.php b/marketplace/code/infrastructure/active_records/clouds/AvailabilityZoneDraft.php new file mode 100644 index 0000000..782b9db --- /dev/null +++ b/marketplace/code/infrastructure/active_records/clouds/AvailabilityZoneDraft.php @@ -0,0 +1,63 @@ + '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'); + } +} \ No newline at end of file diff --git a/marketplace/code/infrastructure/active_records/clouds/CloudServiceDraft.php b/marketplace/code/infrastructure/active_records/clouds/CloudServiceDraft.php index e0c0915..a9531fc 100644 --- a/marketplace/code/infrastructure/active_records/clouds/CloudServiceDraft.php +++ b/marketplace/code/infrastructure/active_records/clouds/CloudServiceDraft.php @@ -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', ); /** diff --git a/marketplace/code/infrastructure/active_records/clouds/CloudServiceOfferedDraft.php b/marketplace/code/infrastructure/active_records/clouds/CloudServiceOfferedDraft.php new file mode 100644 index 0000000..c87d7a8 --- /dev/null +++ b/marketplace/code/infrastructure/active_records/clouds/CloudServiceOfferedDraft.php @@ -0,0 +1,38 @@ + '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(); + } +} \ No newline at end of file diff --git a/marketplace/code/infrastructure/active_records/clouds/DataCenterLocationDraft.php b/marketplace/code/infrastructure/active_records/clouds/DataCenterLocationDraft.php new file mode 100644 index 0000000..f58e45c --- /dev/null +++ b/marketplace/code/infrastructure/active_records/clouds/DataCenterLocationDraft.php @@ -0,0 +1,154 @@ + '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); + } +} \ No newline at end of file diff --git a/marketplace/code/infrastructure/active_records/clouds/DataCenterRegionDraft.php b/marketplace/code/infrastructure/active_records/clouds/DataCenterRegionDraft.php new file mode 100644 index 0000000..bafc48a --- /dev/null +++ b/marketplace/code/infrastructure/active_records/clouds/DataCenterRegionDraft.php @@ -0,0 +1,128 @@ + '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); + } +} \ No newline at end of file diff --git a/marketplace/code/infrastructure/active_records/consultants/ConsultantClientDraft.php b/marketplace/code/infrastructure/active_records/consultants/ConsultantClientDraft.php new file mode 100644 index 0000000..8d9c4f7 --- /dev/null +++ b/marketplace/code/infrastructure/active_records/consultants/ConsultantClientDraft.php @@ -0,0 +1,83 @@ + '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'); + } +} \ No newline at end of file diff --git a/marketplace/code/infrastructure/active_records/consultants/ConsultantDraft.php b/marketplace/code/infrastructure/active_records/consultants/ConsultantDraft.php new file mode 100644 index 0000000..55bea19 --- /dev/null +++ b/marketplace/code/infrastructure/active_records/consultants/ConsultantDraft.php @@ -0,0 +1,211 @@ + '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(); + } + +} \ No newline at end of file diff --git a/marketplace/code/infrastructure/active_records/consultants/OfficeDraft.php b/marketplace/code/infrastructure/active_records/consultants/OfficeDraft.php new file mode 100644 index 0000000..85fafb9 --- /dev/null +++ b/marketplace/code/infrastructure/active_records/consultants/OfficeDraft.php @@ -0,0 +1,212 @@ + '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()); + } +} \ No newline at end of file diff --git a/marketplace/code/infrastructure/factories/ApplianceDraftFactory.php b/marketplace/code/infrastructure/factories/ApplianceDraftFactory.php new file mode 100644 index 0000000..3630cc1 --- /dev/null +++ b/marketplace/code/infrastructure/factories/ApplianceDraftFactory.php @@ -0,0 +1,44 @@ +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; + } + +} \ No newline at end of file diff --git a/marketplace/code/infrastructure/factories/CloudDraftFactory.php b/marketplace/code/infrastructure/factories/CloudDraftFactory.php new file mode 100644 index 0000000..aab4225 --- /dev/null +++ b/marketplace/code/infrastructure/factories/CloudDraftFactory.php @@ -0,0 +1,82 @@ +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; + } +} \ No newline at end of file diff --git a/marketplace/code/infrastructure/factories/ConsultantDraftFactory.php b/marketplace/code/infrastructure/factories/ConsultantDraftFactory.php new file mode 100644 index 0000000..f07db6d --- /dev/null +++ b/marketplace/code/infrastructure/factories/ConsultantDraftFactory.php @@ -0,0 +1,91 @@ +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; + } + +} \ No newline at end of file diff --git a/marketplace/code/infrastructure/factories/ConsultantFactory.php b/marketplace/code/infrastructure/factories/ConsultantFactory.php index 37a0420..6a34467 100644 --- a/marketplace/code/infrastructure/factories/ConsultantFactory.php +++ b/marketplace/code/infrastructure/factories/ConsultantFactory.php @@ -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; } diff --git a/marketplace/code/infrastructure/factories/DistributionDraftFactory.php b/marketplace/code/infrastructure/factories/DistributionDraftFactory.php index adf353b..93182bf 100644 --- a/marketplace/code/infrastructure/factories/DistributionDraftFactory.php +++ b/marketplace/code/infrastructure/factories/DistributionDraftFactory.php @@ -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; - } } \ No newline at end of file diff --git a/marketplace/code/infrastructure/factories/MarketplaceDraftFactory.php b/marketplace/code/infrastructure/factories/MarketplaceDraftFactory.php new file mode 100644 index 0000000..f2d9c4c --- /dev/null +++ b/marketplace/code/infrastructure/factories/MarketplaceDraftFactory.php @@ -0,0 +1,125 @@ +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; + } + +} \ No newline at end of file diff --git a/marketplace/code/infrastructure/factories/OpenStackImplementationDraftFactory.php b/marketplace/code/infrastructure/factories/OpenStackImplementationDraftFactory.php new file mode 100644 index 0000000..d1a022f --- /dev/null +++ b/marketplace/code/infrastructure/factories/OpenStackImplementationDraftFactory.php @@ -0,0 +1,22 @@ +setCoveragePercent($coverage_percent); + $capability->setReleaseSupportedApiVersion($release_supported_api_version); + $capability->setImplementation($implementation); + return $capability; + } + + +} \ No newline at end of file diff --git a/marketplace/code/infrastructure/factories/PrivateCloudDraftFactory.php b/marketplace/code/infrastructure/factories/PrivateCloudDraftFactory.php new file mode 100644 index 0000000..bbfe175 --- /dev/null +++ b/marketplace/code/infrastructure/factories/PrivateCloudDraftFactory.php @@ -0,0 +1,42 @@ +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; + } +} \ No newline at end of file diff --git a/marketplace/code/infrastructure/factories/PublicCloudDraftFactory.php b/marketplace/code/infrastructure/factories/PublicCloudDraftFactory.php new file mode 100644 index 0000000..3d27430 --- /dev/null +++ b/marketplace/code/infrastructure/factories/PublicCloudDraftFactory.php @@ -0,0 +1,45 @@ +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; + } + +} \ No newline at end of file diff --git a/marketplace/code/infrastructure/factories/RegionalSupportedCompanyServiceDraftFactory.php b/marketplace/code/infrastructure/factories/RegionalSupportedCompanyServiceDraftFactory.php new file mode 100644 index 0000000..dd215b6 --- /dev/null +++ b/marketplace/code/infrastructure/factories/RegionalSupportedCompanyServiceDraftFactory.php @@ -0,0 +1,16 @@ +setRegion($region); + $regional_support->setCompanyService($service); + return $regional_support; + } + +} \ No newline at end of file diff --git a/marketplace/code/infrastructure/repositories/SapphirePrivateCloudRepository.php b/marketplace/code/infrastructure/repositories/SapphirePrivateCloudRepository.php index ad28e9b..978e38a 100644 --- a/marketplace/code/infrastructure/repositories/SapphirePrivateCloudRepository.php +++ b/marketplace/code/infrastructure/repositories/SapphirePrivateCloudRepository.php @@ -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); } diff --git a/marketplace/code/interfaces/restfull_api/marketplace/ApplianceCrudApi.php b/marketplace/code/interfaces/restfull_api/marketplace/ApplianceCrudApi.php index 64871b8..3af1fcb 100644 --- a/marketplace/code/interfaces/restfull_api/marketplace/ApplianceCrudApi.php +++ b/marketplace/code/interfaces/restfull_api/marketplace/ApplianceCrudApi.php @@ -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(); + } + } + } \ No newline at end of file diff --git a/marketplace/code/interfaces/restfull_api/marketplace/ConsultantsCrudApi.php b/marketplace/code/interfaces/restfull_api/marketplace/ConsultantsCrudApi.php index 372b1a4..a900575 100644 --- a/marketplace/code/interfaces/restfull_api/marketplace/ConsultantsCrudApi.php +++ b/marketplace/code/interfaces/restfull_api/marketplace/ConsultantsCrudApi.php @@ -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(); + } + } + } \ No newline at end of file diff --git a/marketplace/code/interfaces/restfull_api/marketplace/DistributionCrudApi.php b/marketplace/code/interfaces/restfull_api/marketplace/DistributionCrudApi.php index dc2a013..a325978 100644 --- a/marketplace/code/interfaces/restfull_api/marketplace/DistributionCrudApi.php +++ b/marketplace/code/interfaces/restfull_api/marketplace/DistributionCrudApi.php @@ -67,7 +67,7 @@ final class DistributionCrudApi extends CompanyServiceCrudApi { new CompanyServiceCanAddResourcePolicy, new CompanyServiceCanAddVideoPolicy, new DistributionDraftFactory, - new MarketplaceFactory, + new MarketplaceDraftFactory, new ValidatorFactory, new OpenStackApiFactory, null, diff --git a/marketplace/code/interfaces/restfull_api/marketplace/PrivateCloudCrudApi.php b/marketplace/code/interfaces/restfull_api/marketplace/PrivateCloudCrudApi.php index 5e0abb7..d4d98ea 100644 --- a/marketplace/code/interfaces/restfull_api/marketplace/PrivateCloudCrudApi.php +++ b/marketplace/code/interfaces/restfull_api/marketplace/PrivateCloudCrudApi.php @@ -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(); + } + } } \ No newline at end of file diff --git a/marketplace/code/interfaces/restfull_api/marketplace/PublicCloudCrudApi.php b/marketplace/code/interfaces/restfull_api/marketplace/PublicCloudCrudApi.php index 2304eb3..b8282b7 100644 --- a/marketplace/code/interfaces/restfull_api/marketplace/PublicCloudCrudApi.php +++ b/marketplace/code/interfaces/restfull_api/marketplace/PublicCloudCrudApi.php @@ -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(); + } + } } \ No newline at end of file diff --git a/marketplace/code/ui/admin/MarketPlaceAdminPage.php b/marketplace/code/ui/admin/MarketPlaceAdminPage.php index 48201d3..7725e45 100644 --- a/marketplace/code/ui/admin/MarketPlaceAdminPage.php +++ b/marketplace/code/ui/admin/MarketPlaceAdminPage.php @@ -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("
%s
", + 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!'); + } + } + } \ No newline at end of file diff --git a/marketplace/code/ui/admin/css/marketplace.admin.css b/marketplace/code/ui/admin/css/marketplace.admin.css index 63e8be1..6e3485a 100644 --- a/marketplace/code/ui/admin/css/marketplace.admin.css +++ b/marketplace/code/ui/admin/css/marketplace.admin.css @@ -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; } diff --git a/marketplace/code/ui/admin/js/appliance.js b/marketplace/code/ui/admin/js/appliance.js index 8bca3be..51124cd 100644 --- a/marketplace/code/ui/admin/js/appliance.js +++ b/marketplace/code/ui/admin/js/appliance.js @@ -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; + }); } }); diff --git a/marketplace/code/ui/admin/js/consultant.js b/marketplace/code/ui/admin/js/consultant.js index 485d1cd..7687831 100644 --- a/marketplace/code/ui/admin/js/consultant.js +++ b/marketplace/code/ui/admin/js/consultant.js @@ -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; + }); + + } }); \ No newline at end of file diff --git a/marketplace/code/ui/admin/js/distribution.js b/marketplace/code/ui/admin/js/distribution.js index d7fa332..7682785 100644 --- a/marketplace/code/ui/admin/js/distribution.js +++ b/marketplace/code/ui/admin/js/distribution.js @@ -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); }, diff --git a/marketplace/code/ui/admin/js/private_cloud.js b/marketplace/code/ui/admin/js/private_cloud.js index ff4df94..a032ce9 100644 --- a/marketplace/code/ui/admin/js/private_cloud.js +++ b/marketplace/code/ui/admin/js/private_cloud.js @@ -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; + }); + } }); \ No newline at end of file diff --git a/marketplace/code/ui/admin/js/public_cloud.js b/marketplace/code/ui/admin/js/public_cloud.js index 8cab1bf..16a061a 100644 --- a/marketplace/code/ui/admin/js/public_cloud.js +++ b/marketplace/code/ui/admin/js/public_cloud.js @@ -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; + }); + } }); \ No newline at end of file diff --git a/marketplace/templates/Layout/CloudsDirectoryPage_cloud.ss b/marketplace/templates/Layout/CloudsDirectoryPage_cloud.ss index 400c17f..312a51b 100644 --- a/marketplace/templates/Layout/CloudsDirectoryPage_cloud.ss +++ b/marketplace/templates/Layout/CloudsDirectoryPage_cloud.ss @@ -55,7 +55,11 @@ <% end_if %> <% if HyperVisors %> @@ -97,7 +101,11 @@ <% end_if %> <% if DataCenters %>

Data Center Locations

diff --git a/marketplace/templates/Layout/CloudsDirectoryPage_pdf.ss b/marketplace/templates/Layout/CloudsDirectoryPage_pdf.ss index 9ca1fdb..a7f1d19 100644 --- a/marketplace/templates/Layout/CloudsDirectoryPage_pdf.ss +++ b/marketplace/templates/Layout/CloudsDirectoryPage_pdf.ss @@ -73,7 +73,11 @@ <% end_control %>

- + <% if IsDraft %> + + <% else %> + + <% end_if %>

Click any location to see availability zones and API endpoints

<% end_if %> @@ -161,12 +165,22 @@

Pricing Options

- <% control Top.PricingSchemasForPDF %> - - - - - <% end_control %> + <% if IsDraft %> + <% control Top.PricingSchemasDraftForPDF %> + + + + + <% end_control %> + <% else %> + <% control Top.PricingSchemasForPDF %> + + + + + <% end_control %> + <% end_if %> +
$Type<% if Enabled==1 %>Yes<% else %>No<% end_if %>
$Type<% if Enabled==1 %>Yes<% else %>No<% end_if %>
$Type<% if Enabled==1 %>Yes<% else %>No<% end_if %>

diff --git a/marketplace/templates/Layout/ConsultantsDirectoryPage_consultant.ss b/marketplace/templates/Layout/ConsultantsDirectoryPage_consultant.ss index 5099921..833493e 100644 --- a/marketplace/templates/Layout/ConsultantsDirectoryPage_consultant.ss +++ b/marketplace/templates/Layout/ConsultantsDirectoryPage_consultant.ss @@ -73,7 +73,11 @@

Offices

diff --git a/marketplace/templates/Layout/ConsultantsDirectoryPage_pdf.ss b/marketplace/templates/Layout/ConsultantsDirectoryPage_pdf.ss index 7fa8714..f95c792 100644 --- a/marketplace/templates/Layout/ConsultantsDirectoryPage_pdf.ss +++ b/marketplace/templates/Layout/ConsultantsDirectoryPage_pdf.ss @@ -69,7 +69,11 @@

Offices

- + <% if IsDraft %> + + <% else %> + + <% end_if %>

Click any map pin to see office address diff --git a/marketplace/templates/Layout/Includes/MarketPlaceAdminPage_consultants_list.ss b/marketplace/templates/Layout/Includes/MarketPlaceAdminPage_consultants_list.ss index bc4f41f..00132fc 100644 --- a/marketplace/templates/Layout/Includes/MarketPlaceAdminPage_consultants_list.ss +++ b/marketplace/templates/Layout/Includes/MarketPlaceAdminPage_consultants_list.ss @@ -77,6 +77,7 @@ Edit Product Details Preview Product + PDF Delete Product diff --git a/marketplace/templates/Layout/Includes/MarketPlaceAdminPage_implementations_list.ss b/marketplace/templates/Layout/Includes/MarketPlaceAdminPage_implementations_list.ss index 193c340..e3b8f5b 100644 --- a/marketplace/templates/Layout/Includes/MarketPlaceAdminPage_implementations_list.ss +++ b/marketplace/templates/Layout/Includes/MarketPlaceAdminPage_implementations_list.ss @@ -20,9 +20,9 @@ @@ -30,9 +30,9 @@ @@ -63,7 +63,7 @@ <% if Distributions %> - <% loop Distributions %> + <% control Distributions %> $Company.Name @@ -81,23 +81,24 @@ <% if Top.isSuperAdmin %> <% if EditedBy %> - <% with EditedBy %> + <% control EditedBy %> $Email ($CurrentCompany) - <% end_with %> + <% end_control %> <% else %> N/A <% end_if %> <% end_if %> - $Top.Link(appliance)<% end_if %><% if Name == "Distribution" %>$Top.Link(distribution)<% end_if %><% end_with %>?id=$ID">Edit Product Details - $Top.Link(appliance)<% end_if %><% if Name == "Distribution" %>$Top.Link(distribution)<% end_if %><% end_with %>/$ID/preview">Preview Product + $Top.Link(appliance)<% end_if %><% if Name == "Distribution" %>$Top.Link(distribution)<% end_if %><% end_control %>?id=$ID">Edit Product Details + $Top.Link(appliance)<% end_if %><% if Name == "Distribution" %>$Top.Link(distribution)<% end_if %><% end_control %>/$ID/preview">Preview Product + $Top.Link(appliance)<% end_if %><% if Name == "Distribution" %>$Top.Link(distribution)<% end_if %><% end_control %>/$ID/pdf">PDF appliance<% end_if %><% if Name == "Distribution" %>distribution<% end_if %><% end_with %>">Delete Product + data-class="<% control MarketPlace %><% if Name == "Appliance" %>appliance<% end_if %><% if Name == "Distribution" %>distribution<% end_if %><% end_control %>">Delete Product - <% end_loop %> + <% end_control %> <% end_if %> diff --git a/marketplace/templates/Layout/Includes/MarketPlaceAdminPage_private_clouds_list.ss b/marketplace/templates/Layout/Includes/MarketPlaceAdminPage_private_clouds_list.ss index a437847..7aed8a1 100644 --- a/marketplace/templates/Layout/Includes/MarketPlaceAdminPage_private_clouds_list.ss +++ b/marketplace/templates/Layout/Includes/MarketPlaceAdminPage_private_clouds_list.ss @@ -77,6 +77,7 @@ Edit Product Details Preview Product + PDF Delete Product diff --git a/marketplace/templates/Layout/Includes/MarketPlaceAdminPage_public_clouds_list.ss b/marketplace/templates/Layout/Includes/MarketPlaceAdminPage_public_clouds_list.ss index 9792495..a854bfe 100644 --- a/marketplace/templates/Layout/Includes/MarketPlaceAdminPage_public_clouds_list.ss +++ b/marketplace/templates/Layout/Includes/MarketPlaceAdminPage_public_clouds_list.ss @@ -77,6 +77,7 @@ Edit Product Details Preview Product + PDF Delete Product diff --git a/marketplace/templates/Layout/MarketPlaceAdminPage_appliance.ss b/marketplace/templates/Layout/MarketPlaceAdminPage_appliance.ss index 1b250e9..819f04f 100644 --- a/marketplace/templates/Layout/MarketPlaceAdminPage_appliance.ss +++ b/marketplace/templates/Layout/MarketPlaceAdminPage_appliance.ss @@ -3,11 +3,12 @@

Appliances - Product Details

Save + Publish <% if CurrentAppliance %> - Preview + Preview <% end_if %> <% if CurrentAppliance %> - Download PDF + Download PDF <% end_if %> << Back to Products
diff --git a/marketplace/templates/Layout/MarketPlaceAdminPage_consultant.ss b/marketplace/templates/Layout/MarketPlaceAdminPage_consultant.ss index 0410ce0..f60ade8 100644 --- a/marketplace/templates/Layout/MarketPlaceAdminPage_consultant.ss +++ b/marketplace/templates/Layout/MarketPlaceAdminPage_consultant.ss @@ -3,11 +3,12 @@

Consultant - Product Details

Save + Publish <% if CurrentConsultant %> - Preview + Preview <% end_if %> <% if CurrentConsultant %> - Download PDF + Download PDF <% end_if %> << Back to Products
diff --git a/marketplace/templates/Layout/MarketPlaceAdminPage_distribution.ss b/marketplace/templates/Layout/MarketPlaceAdminPage_distribution.ss index 64c73dd..13ef93b 100644 --- a/marketplace/templates/Layout/MarketPlaceAdminPage_distribution.ss +++ b/marketplace/templates/Layout/MarketPlaceAdminPage_distribution.ss @@ -8,7 +8,7 @@ Preview <% end_if %> <% if CurrentDistribution %> - Download PDF + Download PDF <% end_if %> << Back to Products diff --git a/marketplace/templates/Layout/MarketPlaceAdminPage_private_cloud.ss b/marketplace/templates/Layout/MarketPlaceAdminPage_private_cloud.ss index f0a11b7..f3b6827 100644 --- a/marketplace/templates/Layout/MarketPlaceAdminPage_private_cloud.ss +++ b/marketplace/templates/Layout/MarketPlaceAdminPage_private_cloud.ss @@ -3,11 +3,12 @@

Private Cloud - Product Details

Save + Publish <% if CurrentPrivateCloud %> - Preview + Preview <% end_if %> <% if CurrentPrivateCloud %> - Download PDF + Download PDF <% end_if %> << Back to Products
diff --git a/marketplace/templates/Layout/MarketPlaceAdminPage_public_cloud.ss b/marketplace/templates/Layout/MarketPlaceAdminPage_public_cloud.ss index 5a65187..b8bd89f 100644 --- a/marketplace/templates/Layout/MarketPlaceAdminPage_public_cloud.ss +++ b/marketplace/templates/Layout/MarketPlaceAdminPage_public_cloud.ss @@ -3,11 +3,12 @@

Public Cloud - Product Details

Save + Publish <% if CurrentPublicCloud %> - Preview + Preview <% end_if %> <% if CurrentPublicCloud %> - Download PDF + Download PDF <% end_if %> << Back to Products