コード例 #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);
     $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);
         }
     }
 }
コード例 #3
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());
     }
 }
コード例 #4
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 !';
         }
     }
 }
 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;
 }
コード例 #6
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");
     }
 }
コード例 #7
0
ファイル: deploy_v2.php プロジェクト: DBezemer/server
 /**
  *
  * Populate the uiconf from the config
  * @param Zend_Config_Ini $widget
  * @param string $baseSwfUrl
  * @param string $swfName
  * @param int $objType
  * @param bool $disableUrlHashing
  */
 public static function populateUiconfFromConfig($widget, $baseSwfUrl, $swfName, $objType, $disableUrlHashing)
 {
     $uiconf = new uiConf();
     if ($widget->conf_file) {
         $confFileContents = uiConfDeployment::readConfFileFromPath($widget->conf_file);
         if (!$confFileContents) {
             KalturaLog::debug("Unable to read xml file from: {$widget->conf_file}");
         }
         if ($disableUrlHashing) {
             $confFileContents = str_replace('<Plugin id="kalturaMix"', '<Plugin id="kalturaMix" disableUrlHashing="true" ', $confFileContents);
         }
         $uiconf->setConfFile($confFileContents);
     }
     if ($widget->config) {
         $uiconf->setConfig(@$widget->config);
     } else {
         if ($widget->config_file) {
             $configFileContents = uiConfDeployment::readConfFileFromPath($widget->config_file);
             if (!$configFileContents) {
                 KalturaLog::debug("Unable to read json file from: {$widget->config_file}");
             }
             $uiconf->setConfig($configFileContents);
         }
     }
     if ($uiconf->getConfFile() === FALSE && $uiconf->getConfig() === FALSE) {
         return FALSE;
         // conf file or config is a must, features is not.
     }
     if (isset($widget->features)) {
         $uiconf->setConfFileFeatures(uiConfDeployment::readConfFileFromPath($widget->features));
     }
     if ($uiconf->getConfFileFeatures() === FALSE) {
         KalturaLog::debug("missing features conf file for uiconf {$widget->name}");
         // conf file is a must, features is not.
     }
     //Set values to the ui conf
     $uiconf->setPartnerId(uiConfDeployment::$partnerId);
     $uiconf->setSubpId(uiConfDeployment::$subPartnerId);
     $uiconf->setCreationMode(uiConfDeployment::$creationMode);
     $uiconf->setUseCdn(uiConfDeployment::$useCdn);
     $uiconf->setObjType($objType);
     $uiconf->setName($widget->name);
     $uiconf->setSwfUrl($baseSwfUrl . $widget->version . '/' . $swfName);
     if ($widget->html5_version) {
         $uiconf->setHtml5Url("/html5/html5lib/" . $widget->html5_version . "/mwEmbedLoader.php");
     }
     $uiconf->setTags(uiConfDeployment::$defaultTags . ', ' . uiConfDeployment::$baseTag . '_' . $widget->usage);
     $uiconf->setWidth(@$widget->width);
     $uiconf->setHeight(@$widget->height);
     $uiconf->setConfVars(@$widget->conf_vars);
     $uiconf->setDisplayInSearch(mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK);
     return $uiconf;
 }
コード例 #8
0
ファイル: UiConfService.php プロジェクト: richhl/kalturaCE
 function cloneAction($id)
 {
     $dbUiConf = uiConfPeer::retrieveByPK($id);
     if (!$dbUiConf) {
         throw new KalturaAPIException(APIErrors::INVALID_UI_CONF_ID, $id);
     }
     $ui_conf_verride_params = new uiConf();
     $ui_conf_verride_params->setPartnerId($this->getPartnerId());
     $ui_conf_verride_params->setDisplayInSearch(1);
     // the cloned ui_conf should NOT be a template
     $uiConfClone = $dbUiConf->cloneToNew($ui_conf_verride_params);
     $uiConf = new KalturaUiConf();
     $uiConf->fromUiConf($uiConfClone);
     return $uiConf;
 }
コード例 #9
0
ファイル: deploy.php プロジェクト: richhl/kalturaCE
 public static function populateUiconfFromConfig($confConfigObj, $baseSwfUrl, $swfName, $objType, $disableUrlHashing)
 {
     global $defaultTags, $baseTag, $confObj, $kcw_for_editors, $kdp_for_studio;
     $uiconf = new uiConf();
     $confFileContents = uiConfDeployment::readConfFileFromPath($confConfigObj->conf_file);
     if ($disableUrlHashing) {
         $confFileContents = str_replace('<Plugin id="kalturaMix"', '<Plugin id="kalturaMix" disableUrlHashing="true" ', $confFileContents);
     }
     $uiconf->setConfFile($confFileContents);
     if ($uiconf->getConfFile() === FALSE) {
         return FALSE;
         // conf file is a must, features is not.
     }
     $replace_tag = '';
     if ($objType == uiConf::UI_CONF_TYPE_ADVANCED_EDITOR) {
         $replace_tag = 'uIConfigId';
     }
     if ($objType == uiConf::UI_CONF_TYPE_EDITOR) {
         $replace_tag = 'UIConfigId';
     }
     if ($replace_tag) {
         if (isset($confConfigObj->kcw_identifier) && isset($kcw_for_editors[$confConfigObj->kcw_identifier])) {
             $pattern = '/<' . $replace_tag . '>(.*)<\\/' . $replace_tag . '>/';
             $replacement = "<{$replace_tag}>{$kcw_for_editors[$confConfigObj->kcw_identifier]}</{$replace_tag}>";
             $uiconf->setConfFile(preg_replace($pattern, $replacement, $uiconf->getConfFile()));
         }
     }
     if (isset($confConfigObj->usage) && $confConfigObj->usage == 'templates') {
         foreach ($kdp_for_studio as $identifier => $confId) {
             $uiconf->setConfFile(str_replace('@@' . $identifier . '@@', $confId, $uiconf->getConfFile()));
         }
     }
     $uiconf->setConfFileFeatures(uiConfDeployment::readConfFileFromPath($confConfigObj->conf_file, true));
     if ($uiconf->getConfFileFeatures() === FALSE) {
         echo "missing features conf file for uiconf {$confConfigObj->name}" . PHP_EOL;
     }
     // conf file is a must, features is not.
     $uiconf->setPartnerId(0);
     $uiconf->setSubpId(0);
     $uiconf->setCreationMode(3);
     $uiconf->setUseCdn(1);
     $uiconf->setObjType($objType);
     $uiconf->setName($confConfigObj->name);
     $uiconf->setSwfUrl($baseSwfUrl . $confConfigObj->version . '/' . $swfName);
     $uiconf->setTags($defaultTags . ', ' . $baseTag . '_' . $confConfigObj->usage);
     $uiconf->setWidth(@$confConfigObj->width);
     $uiconf->setHeight(@$confConfigObj->height);
     $uiconf->setConfVars(@$confConfigObj->conf_vars);
     $uiconf->setDisplayInSearch(mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK);
     return $uiconf;
 }