コード例 #1
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $this->applyPartnerFilterForClass(new uiConfPeer(), $partner_id);
     $allow_empty = $this->getP("allow_empty_field", false);
     if ($allow_empty == "false" || $allow_empty === 0) {
         $allow_empty = false;
     }
     $prefix = $this->getObjectPrefix();
     $uiconf_id = $this->getPM("{$prefix}_id");
     $uiconf = uiConfPeer::retrieveByPK($uiconf_id);
     if (!$uiconf) {
         $this->addError(APIErrors::INVALID_UI_CONF_ID, $uiconf_id);
         return;
     }
     if ($uiconf && !$uiconf->isValid()) {
         $this->addError(APIErrors::INTERNAL_SERVERL_ERROR, "uiConf object [{$uiconf->getId()}] is not valid");
         return;
     }
     // get the new properties for the uiconf from the request
     $uiconf_update_data = new uiConf();
     $uiconf_update_data->setPartnerId($partner_id);
     // set this once before filling the object and once after
     $obj_wrapper = objectWrapperBase::getWrapperClass($uiconf_update_data, 0);
     $updateable_fields = $obj_wrapper->getUpdateableFields();
     $fields_modified = baseObjectUtils::fillObjectFromMapOrderedByFields($this->getInputParams(), $uiconf_update_data, "{$prefix}_", $updateable_fields, BasePeer::TYPE_PHPNAME, $allow_empty);
     if (count($fields_modified) > 0) {
         if ($uiconf_update_data) {
             baseObjectUtils::fillObjectFromObject($updateable_fields, $uiconf_update_data, $uiconf, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME, $allow_empty);
         }
         $uiconf->save();
     }
     $wrapper = objectWrapperBase::getWrapperClass($uiconf, objectWrapperBase::DETAIL_LEVEL_REGULAR);
     $this->addMsg("{$prefix}", $wrapper);
     $this->addDebug("modified_fields", $fields_modified);
 }
コード例 #2
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $this->applyPartnerFilterForClass(new uiConfPeer(), $partner_id);
     $detailed = $this->getDetailed();
     //$this->getP ( "detailed" , false );
     $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
     // get the new properties for the kuser from the request
     $ui_conf = new uiConf();
     $ui_conf->setPartnerId($partner_id);
     // set this once before filling the object and once after
     // this is called for the first time to set the type and media type for fillObjectFromMap
     $this->setObjType($ui_conf);
     $obj_wrapper = objectWrapperBase::getWrapperClass($ui_conf, 0);
     $field_level = $this->isAdmin() ? 2 : 1;
     $updateable_fields = $obj_wrapper->getUpdateableFields($field_level);
     // TODO - always use fillObjectFromMapOrderedByFields rather than fillObjectFromMap
     $fields_modified = baseObjectUtils::fillObjectFromMapOrderedByFields($this->getInputParams(), $ui_conf, $this->getObjectPrefix() . "_", $updateable_fields);
     // check that mandatory fields were set
     // TODO
     if (count($fields_modified) > 0) {
         $ui_conf->setPartnerId($partner_id);
         // this is now called for the second time to force the obj_type
         $this->setObjType($ui_conf);
         $ui_conf->save();
         $this->addMsg($this->getObjectPrefix(), objectWrapperBase::getWrapperClass($ui_conf, $level));
         $this->addDebug("added_fields", $fields_modified);
     } else {
         $this->addError(APIErrors::NO_FIELDS_SET_FOR_UI_CONF, $this->getObjectPrefix());
     }
 }
コード例 #3
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $this->applyPartnerFilterForClass(new uiConfPeer(), $partner_id);
     $ui_conf_id = $this->getPM("uiconf_id");
     $detailed = $this->getP("detailed", false);
     $new_name = $this->getP("new_name");
     if (!$new_name || $new_name == '') {
         $new_name = null;
     }
     $ui_conf = null;
     if ($ui_conf_id) {
         $ui_conf = uiConfPeer::retrieveByPK($ui_conf_id);
     }
     if (!$ui_conf) {
         $this->addError(APIErrors::INVALID_UI_CONF_ID, $ui_conf_id);
     } else {
         $ui_conf_verride_params = new uiConf();
         $ui_conf_verride_params->setPartnerId($partner_id);
         $ui_conf_verride_params->setDisplayInSearch(1);
         // the cloned ui_conf should NOT be a template
         $new_ui_conf = $ui_conf->cloneToNew($ui_conf_verride_params, $new_name);
         if (!$new_ui_conf) {
             $this->addError(APIErrors::UI_CONF_CLONE_FAILED, $ui_conf_id);
         } else {
             $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
             $wrapper = objectWrapperBase::getWrapperClass($new_ui_conf, $level);
             // TODO - remove this code when cache works properly when saving objects (in their save method)
             //				$wrapper->removeFromCache( "kshow" , $new_ui_conf->getId() );
             $this->addMsg("uiconf", $wrapper);
         }
     }
 }
コード例 #4
0
 /**
  * @param uiConf $fromObject
  * @param uiConf $toObject
  */
 protected function uiConfCopied(uiConf $fromObject, uiConf $toObject)
 {
     $fileAssets = FileAssetPeer::retrieveByObject(FileAssetObjectType::UI_CONF, $fromObject->getId());
     foreach ($fileAssets as $fileAsset) {
         /* @var $fileAsset FileAsset */
         $newFileAssets = $fileAsset->copy();
         $newFileAssets->setObjectId($toObject->getId());
         $newFileAssets->incrementVersion();
         $newFileAssets->save();
         $syncKey = $fileAsset->getSyncKey(FileAsset::FILE_SYNC_ASSET);
         $newSyncKey = $newFileAssets->getSyncKey(FileAsset::FILE_SYNC_ASSET);
         if (kFileSyncUtils::fileSync_exists($syncKey)) {
             kFileSyncUtils::softCopy($syncKey, $newSyncKey);
         }
     }
 }
コード例 #5
0
 public function execute()
 {
     $this->forceSystemAuthentication();
     myDbHelper::$use_alternative_con = null;
     //myDbHelper::DB_HELPER_CONN_PROPEL2
     $this->partner_error = null;
     if (isset($_POST['partnerId']) && $_POST['partnerId'] !== null && $_POST['partnerId'] !== '') {
         $partner = PartnerPeer::retrieveByPK($_POST['partnerId']);
         if ($partner) {
             $uiConf = new uiConf();
             $uiConf->setPartnerId($_POST['partnerId']);
             $uiConf->setCreationMode(uiConf::UI_CONF_CREATION_MODE_ADVANCED);
             $uiConf->save();
             $this->redirect("system/editUiconf?id=" . $uiConf->getId());
         } else {
             $this->partner_error = 'Partner ID ' . $_POST['partnerId'] . ' not found !';
         }
     }
 }
コード例 #6
0
 public function execute()
 {
     $this->forceSystemAuthentication();
     $type = $this->getRequestParameter("type");
     $versionsPath = "/web/flash/";
     $uiConf = new uiConf();
     $dirs = $uiConf->getDirectoryMap();
     $versions = array();
     if (array_key_exists($type, $dirs)) {
         $swfDir = $dirs[$type];
         $path = $versionsPath . $swfDir . "/";
         $path = realpath($path);
         $files = scandir($path);
         foreach ($files as $file) {
             if (is_dir(realpath($path . "/" . $file)) && strpos($file, "v") === 0) {
                 $versions[] = $file;
             }
         }
     }
     return $this->renderText(json_encode($versions));
 }
コード例 #7
0
ファイル: BaseuiConfPeer.php プロジェクト: DBezemer/server
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      uiConf $value A uiConf object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(uiConf $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         if (isset(self::$instances[$key]) || count(self::$instances) < kConf::get('max_num_instances_in_pool')) {
             self::$instances[$key] = $obj;
             kMemoryManager::registerPeer('uiConfPeer');
         }
     }
 }
コード例 #8
0
 public static function copyUiConfsByType(Partner $fromPartner, Partner $toPartner, $uiConfType)
 {
     KalturaLog::log("Copying uiconfs from partner [" . $fromPartner->getId() . "] to partner [" . $toPartner->getId() . "] with type [" . $uiConfType . "]");
     uiConfPeer::setUseCriteriaFilter(false);
     $c = new Criteria();
     $c->addAnd(uiConfPeer::PARTNER_ID, $fromPartner->getId());
     $c->addAnd(uiConfPeer::OBJ_TYPE, $uiConfType);
     $c->addAnd(uiConfPeer::STATUS, uiConf::UI_CONF_STATUS_READY);
     $uiConfs = uiConfPeer::doSelect($c);
     uiConfPeer::setUseCriteriaFilter(true);
     foreach ($uiConfs as $uiConf) {
         // create a new uiConf, set its partner Id (so that upcoming file_sync will have the new partner's id)
         // and clone fileds from current uiConf
         $newUiConf = new uiConf();
         $newUiConf->setPartnerId($toPartner->getId());
         $newUiConf = $uiConf->cloneToNew($newUiConf);
         $newUiConf->save();
         KalturaLog::log("UIConf [" . $newUiConf->getId() . "] was created");
     }
 }
コード例 #9
0
ファイル: deploy_v2.php プロジェクト: DBezemer/server
 /**
  *
  * Updates the player id in the features file
  * @param uiConf $uiconf
  * @param string $uiconfId
  * @param string $replacementString
  */
 public static function updateFeaturesFile(uiConf $uiconf, $replacementString, $replacementToken)
 {
     $conf_file = $uiconf->getConfFile(true);
     $featuresFile = $uiconf->getConfFileFeatures(true);
     $newFeatures = str_replace($replacementToken, $replacementString, $featuresFile);
     if ($newFeatures != $featuresFile) {
         $uiconf->setConfFile($conf_file);
         $uiconf->setConfFileFeatures($newFeatures);
         $uiconf->save();
     }
 }
コード例 #10
0
ファイル: uiConf.php プロジェクト: DBezemer/server
 public function cloneToNew($new_ui_conf_obj, $new_name = null)
 {
     $cloned = new uiConf();
     $cloned->setCopiedFrom($this);
     $all_fields = uiConfPeer::getFieldNames();
     $ignore_list = array("Id", "ConfFilePath");
     // clone from current
     baseObjectUtils::fillObjectFromObject($all_fields, $this, $cloned, baseObjectUtils::CLONE_POLICY_PREFER_NEW, $ignore_list, BasePeer::TYPE_PHPNAME);
     //		$cloned->setNew(true);
     // override with data from the $new_ui_conf_obj - the name can be chosen to override
     if ($new_ui_conf_obj) {
         baseObjectUtils::fillObjectFromObject($all_fields, $new_ui_conf_obj, $cloned, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME);
     }
     if ($new_name) {
         $cloned->setName($new_name);
     }
     foreach (self::$validSubTypes as $subType) {
         $suffix = $this->getSuffixBySubType($subType);
         $content = $this->getConfFileBySuffix($suffix);
         $cloned->setConfFileBySuffix($suffix, $content);
     }
     $cloned->save(null, true);
     return $cloned;
 }
コード例 #11
0
ファイル: deploy.php プロジェクト: richhl/kalturaCE
 public static function updatePlayerIdInFeaturesFile(uiConf $uiconf, $uiconfId, $replacementString)
 {
     $conf_file = $uiconf->getConfFile(true);
     $featuresFile = $uiconf->getConfFileFeatures(true);
     $newFeatures = str_replace($replacementString, $uiconfId, $featuresFile);
     $uiconf->setConfFile($conf_file);
     $uiconf->setConfFileFeatures($newFeatures);
     $uiconf->save();
 }
コード例 #12
0
ファイル: BaseuiConfPeer.php プロジェクト: richhl/kalturaCE
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      uiConf $value A uiConf object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(uiConf $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
コード例 #13
0
ファイル: UiConfService.php プロジェクト: richhl/kalturaCE
 /**
  * Retrieve a list of all available versions by object type
  * 
  * @action getAvailableTypes
  * @return KalturaUiConfTypeInfoArray
  */
 function getAvailableTypesAction()
 {
     $flashPath = myContentStorage::getFSContentRootPath() . myContentStorage::getFSFlashRootPath();
     $flashPath = realpath($flashPath);
     $uiConf = new uiConf();
     $dirs = $uiConf->getDirectoryMap();
     $swfNames = $uiConf->getSwfNames();
     $typesInfoArray = new KalturaUiConfTypeInfoArray();
     foreach ($dirs as $objType => $dir) {
         $typesInfo = new KalturaUiConfTypeInfo();
         $typesInfo->type = $objType;
         $typesInfo->directory = $dir;
         $typesInfo->filename = isset($swfNames[$objType]) ? $swfNames[$objType] : '';
         $versions = array();
         $path = $flashPath . '/' . $dir . '/';
         $path = realpath($path);
         $files = scandir($path);
         foreach ($files as $file) {
             if (is_dir(realpath($path . '/' . $file)) && strpos($file, 'v') === 0) {
                 $versions[] = $file;
             }
         }
         rsort($versions);
         $versionsObjectArray = new KalturaStringArray();
         foreach ($versions as $version) {
             $versionString = new KalturaString();
             $versionString->value = $version;
             $versionsObjectArray[] = $versionString;
         }
         $typesInfo->versions = $versionsObjectArray;
         $typesInfoArray[] = $typesInfo;
     }
     return $typesInfoArray;
 }
コード例 #14
0
ファイル: Basewidget.php プロジェクト: DBezemer/server
 /**
  * Declares an association between this object and a uiConf object.
  *
  * @param      uiConf $v
  * @return     widget The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setuiConf(uiConf $v = null)
 {
     if ($v === null) {
         $this->setUiConfId(NULL);
     } else {
         $this->setUiConfId($v->getId());
     }
     $this->auiConf = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the uiConf object, it will not be re-added.
     if ($v !== null) {
         $v->addwidget($this);
     }
     return $this;
 }
 public function execute()
 {
     $this->forceSystemAuthentication();
     myDbHelper::$use_alternative_con = null;
     //myDbHelper::DB_HELPER_CONN_PROPEL2
     $this->saved = false;
     $uiConfId = $this->getRequestParameter("id");
     if ($uiConfId) {
         $uiConf = uiConfPeer::retrieveByPK($uiConfId);
     } else {
         $uiConf = new uiConf();
     }
     if ($this->getRequest()->getMethodName() == "POST") {
         $uiConf->setPartnerId($this->getRequestParameter("partnerId"));
         $uiConf->setSubpId($uiConf->getPartnerId() * 100);
         $uiConf->setObjType($this->getRequestParameter("type"));
         $uiConf->setName($this->getRequestParameter("name"));
         $uiConf->setWidth($this->getRequestParameter("width"));
         $uiConf->setHeight($this->getRequestParameter("height"));
         $uiConf->setCreationMode($this->getRequestParameter("creationMode"));
         $uiConf->setSwfUrl($this->getRequestParameter("swfUrl"));
         $uiConf->setConfVars($this->getRequestParameter("confVars"));
         $useCdn = $this->getRequestParameter("useCdn");
         $uiConf->setUseCdn($useCdn === "1" ? true : false);
         $uiConf->setDisplayInSearch($this->getRequestParameter("displayInSearch"));
         $uiConf->setConfVars($this->getRequestParameter("confVars"));
         $uiConf->setTags($this->getRequestParameter("tags"));
         /* files: */
         if ($uiConf->getCreationMode() != uiConf::UI_CONF_CREATION_MODE_MANUAL) {
             $confFile = $this->getRequestParameter("uiconf_confFile");
             $confFileFeatures = $this->getRequestParameter("uiconf_confFileFeatures");
             if ($uiConf->getConfFile() != $confFile || $uiConf->getConfFileFeatures() != $confFileFeatures) {
                 $uiConf->setConfFile($confFile);
                 $uiConf->setConfFileFeatures($confFileFeatures);
             }
         }
         $uiConf->save();
         $this->saved = true;
     }
     // so script won't die when uiconf is missing
     if (!$uiConf) {
         $uiConf = new uiConf();
     }
     $partner = PartnerPeer::retrieveByPK($uiConf->getPartnerId());
     $types = $uiConf->getUiConfTypeMap();
     $c = new Criteria();
     $c->add(widgetPeer::UI_CONF_ID, $uiConf->getId());
     $c->setLimit(1000);
     $widgets = widgetPeer::doSelect($c);
     $widgetsPerPartner = array();
     $this->tooMuchWidgets = false;
     if (count($widgets) == 1000) {
         $this->tooMuchWidgets = true;
     } else {
         if ($widgets) {
             foreach ($widgets as $widget) {
                 if (!array_key_exists($widget->getPartnerId(), $widgetsPerPartner)) {
                     $widgetsPerPartner[$widget->getPartnerId()] = 0;
                 }
                 $widgetsPerPartner[$widget->getPartnerId()]++;
             }
         }
     }
     // find the FileSync
     $fileSyncs = array();
     $fileSyncs[] = array("key" => $uiConf->getSyncKey(uiConf::FILE_SYNC_UICONF_SUB_TYPE_DATA));
     $fileSyncs[] = array("key" => $uiConf->getSyncKey(uiConf::FILE_SYNC_UICONF_SUB_TYPE_FEATURES));
     foreach ($fileSyncs as &$fileSync) {
         $fileSync["fileSyncs"] = FileSyncPeer::retrieveAllByFileSyncKey($fileSync["key"]);
     }
     $this->fileSyncs = $fileSyncs;
     $this->widgetsPerPartner = $widgetsPerPartner;
     $this->directoryMap = $uiConf->getDirectoryMap();
     $this->swfNames = $uiConf->getSwfNames();
     $this->types = $types;
     $this->uiConf = $uiConf;
     $this->partner = $partner;
 }
コード例 #16
0
 /**
  * @param uiConf $uiConf
  */
 protected function uiConfDeleted(uiConf $uiConf)
 {
     $this->syncableDeleted($uiConf->getId(), FileSyncObjectType::UICONF);
 }
コード例 #17
0
 private static function initUiConfRequiredFile()
 {
     if (self::$REQUIRE_UI_CONF_FILE_FOR_TYPE == null) {
         self::$REQUIRE_UI_CONF_FILE_FOR_TYPE = array(self::UI_CONF_TYPE_GENERIC => false, self::UI_CONF_TYPE_WIDGET => true, self::UI_CONF_TYPE_CW => true, self::UI_CONF_TYPE_EDITOR => true, self::UI_CONF_TYPE_ADVANCED_EDITOR => true, self::UI_CONF_TYPE_PLAYLIST => true, self::UI_CONF_TYPE_KMC_APP_STUDIO => true, self::UI_CONF_TYPE_KDP3 => true, self::UI_CONF_TYPE_KMC_ACCOUNT => true, self::UI_CONF_TYPE_KMC_ANALYTICS => true, self::UI_CONF_TYPE_KMC_CONTENT => true, self::UI_CONF_TYPE_KMC_DASHBOARD => true, self::UI_CONF_TYPE_KMC_LOGIN => true, self::UI_CONF_TYPE_SLP => true, self::UI_CONF_CLIENTSIDE_ENCODER => true, self::UI_CONF_KMC_GENERAL => true, self::UI_CONF_KMC_ROLES_AND_PERMISSIONS => false, self::UI_CONF_CLIPPER => false, self::UI_CONF_TYPE_KSR => true);
     }
 }