function buildWebsiteForm($affiliate) { $form = new OA_Admin_UI_Component_Form("affiliateform", "POST", $_SERVER['SCRIPT_NAME']); $form->forceClientValidation(true); $form->addElement('hidden', 'affiliateid', $affiliate['affiliateid']); $form->addElement('header', 'basic_info', $GLOBALS['strBasicInformation']); $form->addElement('text', 'website', $GLOBALS['strWebsiteURL']); $form->addElement('text', 'name', $GLOBALS['strName']); $form->addElement('text', 'contact', $GLOBALS['strContact']); $form->addElement('text', 'email', $GLOBALS['strEMail']); $form->addElement('controls', 'form-controls'); $form->addElement('submit', 'save', 'Save changes'); //Form validation rules $translation = new OX_Translation(); $urlRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strWebsiteURL'])); $form->addRule('website', $urlRequiredMsg, 'required'); $form->addRule('website', $GLOBALS['strInvalidWebsiteURL'], 'regex', '#^http(s?)\\://.+$#'); $contactRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strContact'])); $form->addRule('contact', $contactRequiredMsg, 'required'); $nameRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strName'])); $form->addRule('name', $nameRequiredMsg, 'required'); $emailRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strEMail'])); $form->addRule('email', $emailRequiredMsg, 'required'); $form->addRule('email', $GLOBALS['strEmailField'], 'email'); //set form values $form->setDefaults($affiliate); return $form; }
function buildTrackerForm($tracker) { $form = new OA_Admin_UI_Component_Form("trackerform", "POST", $_SERVER['SCRIPT_NAME']); $form->forceClientValidation(true); $form->addElement('hidden', 'trackerid', $tracker['trackerid']); $form->addElement('hidden', 'clientid', $tracker['clientid']); $form->addElement('hidden', 'move', $tracker['move']); $form->addElement('header', 'basic_info', $GLOBALS['strTrackerInformation']); $form->addElement('text', 'trackername', $GLOBALS['strName']); $form->addElement('text', 'description', $GLOBALS['strDescription']); $types = $GLOBALS['_MAX']['CONN_TYPES']; foreach ($types as $typeId => $typeName) { $aTypes[$typeId] = $GLOBALS[$typeName]; } $form->addElement('select', 'type', $GLOBALS['strConversionType'], $aTypes); $statuses = $GLOBALS['_MAX']['STATUSES']; $startStatusesIds = array(1, 2, 4); foreach ($statuses as $statusId => $statusName) { if (in_array($statusId, $startStatusesIds)) { $activeStatuses[$statusId] = $GLOBALS[$statusName]; } } $form->addElement('select', 'status', $GLOBALS['strDefaultStatus'], $activeStatuses); $form->addElement('advcheckbox', 'linkcampaigns', null, $GLOBALS['strLinkCampaignsByDefault'], null, array("f", "t")); $form->addElement('controls', 'form-controls'); $form->addElement('submit', 'submit', $GLOBALS['strSaveChanges']); //set form values $form->setDefaults($tracker); //validation rules $translation = new OX_Translation(); $nameRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strName'])); $form->addRule('trackername', $nameRequiredMsg, 'required'); return $form; }
function buildAgencyForm($aAgency) { $form = new OA_Admin_UI_Component_Form("agencyform", "POST", $_SERVER['SCRIPT_NAME']); $form->forceClientValidation(true); $form->addElement('hidden', 'agencyid', $aAgency['agencyid']); $form->addElement('header', 'header_basic', $GLOBALS['strBasicInformation']); $form->addElement('text', 'name', $GLOBALS['strName']); $form->addElement('text', 'contact', $GLOBALS['strContact']); $form->addElement('text', 'email', $GLOBALS['strEMail']); //we want submit to be the last element in its own separate section $form->addElement('controls', 'form-controls'); $form->addElement('submit', 'submit', $GLOBALS['strSaveChanges']); //Form validation rules $translation = new OX_Translation(); $nameRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strName'])); $form->addRule('name', $nameRequiredMsg, 'required'); $contactRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strContact'])); $form->addRule('contact', $contactRequiredMsg, 'required'); $emailRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strEMail'])); $form->addRule('email', $emailRequiredMsg, 'required'); $form->addRule('email', $GLOBALS['strEmailField'], 'email'); //set form values $form->setDefaults($aAgency); return $form; }
function &buildForm() { global $oTrans; $form = new OA_Admin_UI_Component_Form("oxToolBoxForm", "POST", $_SERVER['SCRIPT_NAME'], null, array("enctype" => "multipart/form-data")); $form->forceClientValidation(true); $form->addElement('header', 'header', $oTrans->translate("New Plugin")); $form->addElement('text', 'name', $oTrans->translate("Plugin Name"), array('class' => 'medium')); $form->addElement('text', 'email', $oTrans->translate("Author Email")); $form->addElement('text', 'author', $oTrans->translate("Author Name")); $form->addElement('text', 'url', $oTrans->translate("Author URL")); $form->addElement('text', 'licence', $oTrans->translate("Licence Info")); $form->addElement('text', 'description', $oTrans->translate("Description")); $version['major'] = $form->createElement('text', 'version[major]', $oTrans->translate("Major")); $version['minor'] = $form->createElement('text', 'version[minor]', $oTrans->translate("Minor")); $version['build'] = $form->createElement('text', 'version[build]', $oTrans->translate("Build")); // for new plugins status is -dev only //$aStatus = array('-dev','-beta','-beta-rc'); $aStatus = array('-dev' => '-dev'); $version['status'] = $form->createElement('select', 'version[status]', $oTrans->translate("Status"), $aStatus); //$version['rc'] = $form->createElement('text', 'version[rc]', 'rc#'); $form->addGroup($version, 'version', $oTrans->translate("Version"), "", false); //$form->addElement('text', 'versionMajor', 'Version', array('class'=>'small')); $aGroups = getExtensionList(); foreach ($aGroups as $extension) { $group['name'] = $form->createElement('text', 'group[' . $extension . '][groupname]', $oTrans->translate("Group Name"), array('class' => 'medium')); $group['schema'] = $form->createElement('checkbox', 'group[' . $extension . '][schema]', $oTrans->translate("Has Schema")); $form->addGroup($group, 'group_' . $extension, $oTrans->translate("Extends %s", array($extension)), "", false); } $form->addElement('controls', 'form-controls'); $form->addElement('submit', 'submit', $oTrans->translate("Submit")); return $form; }
function buildAdvertiserForm($aAdvertiser) { $form = new OA_Admin_UI_Component_Form("clientform", "POST", $_SERVER['SCRIPT_NAME']); $form->forceClientValidation(true); $form->addElement('hidden', 'clientid', $aAdvertiser['clientid']); $form->addElement('header', 'header_basic', $GLOBALS['strBasicInformation']); $nameElem = $form->createElement('text', 'clientname', $GLOBALS['strName']); if (!OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $nameElem->freeze(); } $form->addElement($nameElem); $form->addElement('text', 'contact', $GLOBALS['strContact']); $form->addElement('text', 'email', $GLOBALS['strEMail']); $form->addElement('header', 'header_adv_report', $GLOBALS['strMailSubject']); $form->addElement('hidden', 'reportlastdate', $aAdvertiser['reportlastdate']); $form->addElement('hidden', 'reportprevious', $aAdvertiser['report']); $form->addElement('advcheckbox', 'reportdeactivate', null, $GLOBALS['strSendDeactivationWarning'], null, array("f", "t")); $form->addElement('advcheckbox', 'report', null, $GLOBALS['strSendAdvertisingReport'], null, array("f", "t")); $form->addElement('text', 'reportinterval', $GLOBALS['strNoDaysBetweenReports'], array('class' => 'x-small')); $form->addElement('header', 'header_misc', $GLOBALS['strMiscellaneous']); $form->addElement('advcheckbox', 'advertiser_limitation', null, $GLOBALS['strAdvertiserLimitation'], null, array("0", "1")); $form->addElement('textarea', 'comments', $GLOBALS['strComments']); //we want submit to be the last element in its own separate section $form->addElement('controls', 'form-controls'); $form->addElement('submit', 'submit', $GLOBALS['strSaveChanges']); //Form validation rules $translation = new OX_Translation(); if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $nameRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strName'])); $form->addRule('clientname', $nameRequiredMsg, 'required'); } $contactRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strContact'])); $form->addRule('contact', $contactRequiredMsg, 'required'); $emailRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strEMail'])); $form->addRule('email', $emailRequiredMsg, 'required'); $form->addRule('email', $GLOBALS['strEmailField'], 'email'); $form->addRule('reportinterval', $GLOBALS['strNumericField'], 'numeric'); $form->addRule('reportinterval', $GLOBALS['strGreaterThanZeroField'], 'min', 1); //set form values $form->setDefaults($aAdvertiser); return $form; }
function buildChannelForm($channel) { $form = new OA_Admin_UI_Component_Form("channelform", "POST", $_SERVER['PHP_SELF']); $form->forceClientValidation(true); $form->addElement('hidden', 'agencyid', OA_Permission::getAgencyId()); $form->addElement('hidden', 'affiliateid', $channel['affiliateid']); $form->addElement('hidden', 'channelid', $channel['channelid']); $form->addElement('header', 'header_basic', $GLOBALS['strBasicInformation']); $form->addElement('text', 'name', $GLOBALS['strName']); $form->addElement('text', 'description', $GLOBALS['strDescription']); $form->addElement('textarea', 'comments', $GLOBALS['strComments']); $form->addElement('controls', 'form-controls'); $form->addElement('submit', 'submit', $GLOBALS['strSaveChanges']); //set form values $form->setDefaults($channel); //validation rules $translation = new OX_Translation(); $nameRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strName'])); $form->addRule('name', $nameRequiredMsg, 'required'); return $form; }
function buildZoneForm($aZone, $oComponent = null) { $form = new OA_Admin_UI_Component_Form("zoneform", "POST", $_SERVER['SCRIPT_NAME']); $form->forceClientValidation(true); $form->addElement('hidden', 'zoneid', $aZone['zoneid']); $form->addElement('hidden', 'affiliateid', $aZone['affiliateid']); buildChainSettingsFormSection($form, $aZone); if ($oComponent && method_exists($oComponent, 'extendZoneAdvancedForm')) { $oComponent->extendZoneAdvancedForm($form, $aZone); } buildDeliveryCappingFormSection($form, $GLOBALS['strCappingZone'], $aZone); buildAppendFormSection($form, $aZone); buildAlgorithmFormSection($form, $aZone); //we want submit to be the last element in its own separate section $form->addElement('controls', 'form-controls'); $form->addElement('submit', 'submit', $GLOBALS['strSaveChanges']); //set form values $form->setDefaults($aZone); $form->setDefaults(array('chaintype' => $aZone['chain'] == '' ? 0 : 1)); //appendinterstitial i appendpopup if ($appendid == $k) { return $form; } }
function buildCampaignForm($campaign, &$oComponent = null) { global $pref; $form = new OA_Admin_UI_Component_Form("campaignform", "POST", $_SERVER['SCRIPT_NAME']); $form->forceClientValidation(true); $form->addElement('hidden', 'campaignid', $campaign['campaignid']); $form->addElement('hidden', 'clientid', $campaign['clientid']); $form->addElement('hidden', 'expire_time', $campaign['expire_time']); $form->addElement('hidden', 'target_old', isset($campaign['target_value']) ? (int) $campaign['target_value'] : 0); $form->addElement('hidden', 'target_type_old', isset($campaign['target_type']) ? $campaign['target_type'] : ''); $form->addElement('hidden', 'weight_old', isset($campaign['weight']) ? (int) $campaign['weight'] : 0); $form->addElement('hidden', 'status_old', isset($campaign['status']) ? (int) $campaign['status'] : 1); $form->addElement('hidden', 'previousweight', isset($campaign["weight"]) ? $campaign["weight"] : ''); $form->addElement('hidden', 'previoustarget', isset($campaign["target"]) ? $campaign["target"] : ''); $form->addElement('hidden', 'previousactive', isset($campaign["active"]) ? $campaign["active"] : ''); $form->addElement('hidden', 'previousimpressions', isset($campaign["impressions"]) ? $campaign["impressions"] : ''); $form->addElement('hidden', 'previousclicks', isset($campaign["clicks"]) ? $campaign["clicks"] : ''); $form->addElement('hidden', 'previousconversions', isset($campaign["conversions"]) ? $campaign["conversions"] : ''); //campaign inactive note (if any) if (isset($campaign['status']) && $campaign['status'] != OA_ENTITY_STATUS_RUNNING) { $aReasons = getCampaignInactiveReasons($campaign); $form->addElement('custom', 'campaign-inactive-note', null, array('inactiveReason' => $aReasons), false); } //form sections $newCampaign = empty($campaign['campaignid']); $remnantEcpmEnabled = !empty($pref['campaign_ecpm_enabled']); $contractEcpmEnabled = !empty($pref['contract_ecpm_enabled']); buildBasicInformationFormSection($form, $campaign, $newCampaign, $remnantEcpmEnabled, $contractEcpmEnabled); buildDateFormSection($form, $campaign, $newCampaign); buildPricingFormSection($form, $campaign, $newCampaign, $remnantEcpmEnabled, $contractEcpmEnabled); buildPluggableFormSection($oComponent, 'afterPricingFormSection', $form, $campaign, $newCampaign); buildHighPriorityFormSection($form, $campaign, $newCampaign); buildLowAndExclusivePriorityFormSection($form, $campaign, $newCampaign); buildDeliveryCappingFormSection($form, $GLOBALS['strCappingCampaign'], $campaign, null, null, true, $newCampaign); buildMiscFormSection($form, $campaign, $newCampaign); //form controls $form->addElement('controls', 'form-controls'); $form->addElement('submit', 'submit', $GLOBALS['strSaveChanges']); //validation rules $translation = new OX_Translation(); $nameRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strName'])); $form->addRule('campaignname', $nameRequiredMsg, 'required'); $form->addFormRule('checkIfCampaignTypeSpecified'); $typeRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strPricingModel'])); $form->addRule('revenue_type', $typeRequiredMsg, 'required'); // $form->addRule('impressions', 'TODO message', 'formattedNumber'); // $form->addRule('clicks', 'TODO message', 'formattedNumber'); // if ($conf['logging']['trackerImpressions']) { // $form->addRule('conversions', 'TODO message', 'formattedNumber'); // } // $form->addRule('weight', 'TODO message', 'wholeNumber-'); // $form->addRule('target_value', 'TODO message', 'wholeNumber-'); //set form values $form->setDefaults($campaign); $form->setDefaults(array('impressions' => !isset($campaign['impressions']) || $campaign['impressions'] == '' || $campaign['impressions'] < 0 ? '-' : $campaign['impressions'], 'clicks' => !isset($campaign['clicks']) || $campaign['clicks'] == '' || $campaign['clicks'] < 0 ? '-' : $campaign['clicks'], 'conversions' => !isset($campaign['conversions']) || $campaign['conversions'] == '' || $campaign['conversions'] < 0 ? '-' : $campaign['conversions'])); if (!empty($campaign['activate_date'])) { $oDate = new Date($campaign['activate_date']); $startDateSet = 't'; $startDateStr = $oDate->format('%d %B %Y '); } else { $startDateSet = 'f'; $startDateStr = ''; } if (!empty($campaign['expire_date'])) { $oDate = new Date($campaign['expire_date']); $endDateSet = 't'; $endDateStr = $oDate->format('%d %B %Y '); } else { $endDateSet = 'f'; $endDateStr = ''; } $form->setDefaults(array('campaign_type' => $newCampaign ? '' : OX_Util_Utils::getCampaignType($campaign['priority']), 'impr_unlimited' => isset($campaign["impressions"]) && $campaign["impressions"] >= 0 ? 'f' : 't', 'click_unlimited' => isset($campaign["clicks"]) && $campaign["clicks"] >= 0 ? 'f' : 't', 'conv_unlimited' => isset($campaign["conversions"]) && $campaign["conversions"] >= 0 ? 'f' : 't', 'startSet' => $startDateSet, 'endSet' => $endDateSet, 'start' => $startDateStr, 'end' => $endDateStr, 'priority' => $campaign['priority'] > '0' && $campaign['campaignid'] != '' ? 2 : $campaign['priority'], 'high_priority_value' => $campaign['priority'] > '0' ? $campaign['priority'] : 5, 'target_value' => !empty($campaign['target_value']) ? $campaign['target_value'] : '-', 'weight' => isset($campaign["weight"]) ? $campaign["weight"] : $pref['default_campaign_weight'], 'revenue_type' => isset($campaign["revenue_type"]) ? $campaign["revenue_type"] : MAX_FINANCE_CPM)); return $form; }
function buildZoneForm($zone) { global $conf; // Initialise Ad Networks $oAdNetworks = new OA_Central_AdNetworks(); $form = new OA_Admin_UI_Component_Form("zoneform", "POST", $_SERVER['PHP_SELF']); $form->forceClientValidation(true); $form->addElement('hidden', 'zoneid', $zone['zoneid']); $form->addElement('hidden', 'affiliateid', $zone['affiliateid']); $form->addElement('header', 'zone_basic_info', $GLOBALS['strBasicInformation']); $form->addElement('text', 'zonename', $GLOBALS['strName']); $form->addElement('text', 'description', $GLOBALS['strDescription']); $form->addElement('select', 'oac_category_id', $GLOBALS['strCategory'], $oAdNetworks->getCategoriesSelect()); //zone type group $zoneTypes[] = $form->createElement('radio', 'delivery', '', "<img src='" . OX::assetPath() . "/images/icon-zone.gif' align='absmiddle'> " . $GLOBALS['strBannerButtonRectangle'], phpAds_ZoneBanner, array('id' => 'delivery-b', 'onClick' => 'phpAds_formEnableSize();', 'onChange' => 'oa_hide("warning_change_zone_type");')); if ($conf['oxInvocationTags']['isAllowedAdlayer'] || $zone['delivery'] == phpAds_ZoneInterstitial) { $zoneTypes[] = $form->createElement('radio', 'delivery', '', "<img src='" . OX::assetPath() . "/images/icon-interstitial.gif' align='absmiddle'> " . $GLOBALS['strInterstitial'], phpAds_ZoneInterstitial, array('id' => 'delivery-i', 'onClick' => 'phpAds_formEnableSize();', 'onChange' => 'oa_hide("warning_change_zone_type");')); } if ($conf['oxInvocationTags']['isAllowedPopup'] || $zone['delivery'] == phpAds_ZonePopup) { $zoneTypes[] = $form->createElement('radio', 'delivery', '', "<img src='" . OX::assetPath() . "/images/icon-popup.gif' align='absmiddle'> " . $GLOBALS['strPopup'], phpAds_ZonePopup, array('id' => 'delivery-p', 'onClick' => 'phpAds_formEnableSize();', 'onChange' => 'oa_hide("warning_change_zone_type");')); } $zoneTypes[] = $form->createElement('radio', 'delivery', '', "<img src='" . OX::assetPath() . "/images/icon-textzone.gif' align='absmiddle'> " . $GLOBALS['strTextAdZone'], phpAds_ZoneText, array('id' => 'delivery-t', 'onClick' => 'phpAds_formDisableSize();', 'onChange' => 'oa_hide("warning_change_zone_type");')); $zoneTypes[] = $form->createElement('radio', 'delivery', '', "<img src='" . OX::assetPath() . "/images/icon-zone-email.gif' align='absmiddle'> " . $GLOBALS['strEmailAdZone'], MAX_ZoneEmail, array('id' => 'delivery-e', 'onClick' => 'phpAds_formEnableSize();', 'onChange' => 'oa_hide("warning_change_zone_type");')); if (!empty($conf['allowedBanners']['video'])) { $zoneTypes[] = $form->createElement('radio', 'delivery', '', "<img src='" . OX::assetPath() . "/images/icon-zone-video-instream.png' align='absmiddle'> " . $GLOBALS['strZoneVideoInstream'], OX_ZoneVideoInstream, array('id' => 'delivery-vi', 'onClick' => 'phpAds_formDisableSize();', 'onChange' => 'oa_hide("warning_change_zone_type");')); $zoneTypes[] = $form->createElement('radio', 'delivery', '', "<img src='" . OX::assetPath() . "/images/icon-zone-video-overlay.png' align='absmiddle'> " . $GLOBALS['strZoneVideoOverlay'], OX_ZoneVideoOverlay, array('id' => 'delivery-vo', 'onClick' => 'phpAds_formDisableSize();', 'onChange' => 'oa_hide("warning_change_zone_type");')); } $form->addGroup($zoneTypes, 'zone_types', $GLOBALS['strZoneType'], "<br/>"); //size global $phpAds_IAB; switch ($zone['delivery']) { case phpAds_ZoneText: case OX_ZoneVideoInstream: case OX_ZoneVideoOverlay: $sizeDisabled = true; $zone['width'] = '*'; $zone['height'] = '*'; break; default: $sizeDisabled = false; break; } $aDefaultSize['radio'] = $form->createElement('radio', 'sizetype', '', '', 'default', array('id' => 'size-d')); foreach (array_keys($phpAds_IAB) as $key) { $iabSizes[$phpAds_IAB[$key]['width'] . "x" . $phpAds_IAB[$key]['height']] = $GLOBALS['strIab'][$key]; } $iabSizes['-'] = $GLOBALS['strCustom']; $aDefaultSize['select'] = $form->createElement('select', 'size', null, $iabSizes, array('onchange' => 'phpAds_formSelectSize(this); oa_sizeChangeUpdateMessage("warning_change_zone_size");', 'class' => 'medium')); $aCustomSize['radio'] = $form->createElement('radio', 'sizetype', '', '', 'custom', array('id' => 'size-c')); $aCustomSize['width'] = $form->createElement('text', 'width', $GLOBALS['strWidth'] . ':', array('onkeydown' => 'phpAds_formEditSize();', 'onChange' => 'oa_sizeChangeUpdateMessage("warning_change_zone_size");')); $aCustomSize['width']->setSize(5); $aCustomSize['height'] = $form->createElement('text', 'height', $GLOBALS['strHeight'] . ':', array('onkeydown' => 'phpAds_formEditSize();', 'onChange' => 'oa_sizeChangeUpdateMessage("warning_change_zone_size");')); $aCustomSize['height']->setSize(5); $sizeTypes['default'] = $form->createElement('group', 'defaultSizeG', null, $aDefaultSize, null, false); $sizeTypes['custom'] = $form->createElement('group', 'customSizeG', null, $aCustomSize, null, false); //disable fields if necessary if ($sizeDisabled) { $aDefaultSize['radio']->setAttribute('disabled', $sizeDisabled); $aDefaultSize['select']->setAttribute('disabled', $sizeDisabled); $aCustomSize['radio']->setAttribute('disabled', $sizeDisabled); $aCustomSize['width']->setAttribute('disabled', $sizeDisabled); $aCustomSize['height']->setAttribute('disabled', $sizeDisabled); } $form->addGroup($sizeTypes, 'size_types', $GLOBALS['strSize'], "<br/>"); $form->addElement('textarea', 'comments', $GLOBALS['strComments']); $form->addElement('controls', 'form-controls'); $form->addElement('submit', 'submit', $GLOBALS['strSaveChanges']); //validation rules $translation = new OX_Translation(); $urlRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strName'])); $form->addRule('zonename', $urlRequiredMsg, 'required'); /* TODO max_formSetRequirements('width', '<?php echo addslashes($strWidth); ?>', true, 'number*'); max_formSetRequirements('height', '<?php echo addslashes($strHeight); ?>', true, 'number*'); */ //set form values $form->setDefaults($zone); //sizes radio if (phpAds_sizeExists($zone['width'], $zone['height'])) { $size = $zone['width'] . "x" . $zone['height']; $sizeType = 'default'; } else { $size = "-"; $sizeType = 'custom'; } $form->setDefaults(array('size' => $size, 'sizetype' => $sizeType)); return $form; }
function buildWebsiteForm($affiliate) { // Initialise Ad Networks $oAdNetworks = new OA_Central_AdNetworks(); $form = new OA_Admin_UI_Component_Form("affiliateform", "POST", $_SERVER['PHP_SELF']); $form->forceClientValidation(true); $form->addElement('hidden', 'affiliateid', $affiliate['affiliateid']); $form->addElement('header', 'basic_info', $GLOBALS['strBasicInformation']); $form->addElement('text', 'website', $GLOBALS['strWebsiteURL']); $form->addElement('text', 'name', $GLOBALS['strName']); if (defined('OA_AD_DIRECT_ENABLED') && OA_AD_DIRECT_ENABLED === true) { $form->addElement('checkbox', 'advsignup', $GLOBALS['strAdvertiserSignup'], $GLOBALS['strAdvertiserSignupDesc'], array('disabled' => !$GLOBALS['_MAX']['CONF']['sync']['checkForUpdates'])); $form->addElement('custom', 'advertiser-signup-dialog', null, array('formId' => $form->getId()), false); } $form->addElement('text', 'contact', $GLOBALS['strContact']); $form->addElement('text', 'email', $GLOBALS['strEMail']); $form->addElement('select', 'category', $GLOBALS['strCategory'], $oAdNetworks->getCategoriesSelect(), array('style' => 'width: 16em;')); $catLangGroup['country'] = $form->createElement('select', 'country', null, $oAdNetworks->getCountriesSelect()); $catLangGroup['country']->setAttribute('style', 'width: 16em;'); $catLangGroup['lang'] = $form->createElement('select', 'language', null, $oAdNetworks->getLanguagesSelect()); $catLangGroup['lang']->setAttribute('style', 'width: 16em;'); $form->addGroup($catLangGroup, 'catlang_group', $GLOBALS['strCountry'] . ' / ' . $GLOBALS['strLanguage'], array(" "), false); $form->addElement('controls', 'form-controls'); $form->addElement('submit', 'save', 'Save changes'); //Form validation rules $translation = new OX_Translation(); $urlRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strWebsiteURL'])); $form->addRule('website', $urlRequiredMsg, 'required'); $form->addRule('website', $GLOBALS['strInvalidWebsiteURL'], 'regex', '#^http(s?)\\://.+$#'); $contactRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strContact'])); $form->addRule('contact', $contactRequiredMsg, 'required'); $nameRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strName'])); $form->addRule('name', $nameRequiredMsg, 'required'); $emailRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strEMail'])); $form->addRule('email', $emailRequiredMsg, 'required'); $form->addRule('email', $GLOBALS['strEmailField'], 'email'); //set form values $form->setDefaults($affiliate); $form->setDefaults(array("category" => $affiliate['oac_category_id'], "country" => $affiliate['oac_country_code'], "language" => $affiliate['oac_language_id'], 'advsignup' => !empty($affiliate['as_website_id']))); return $form; }
function buildBannerForm($type, $aBanner, &$oComponent = null, $formDisabled = false) { $form = new OA_Admin_UI_Component_Form("bannerForm", "POST", $_SERVER['SCRIPT_NAME'], null, array("enctype" => "multipart/form-data")); $form->forceClientValidation(true); $form->addElement('hidden', 'clientid', $aBanner['clientid']); $form->addElement('hidden', 'campaignid', $aBanner['campaignid']); $form->addElement('hidden', 'bannerid', $aBanner['bannerid']); $form->addElement('hidden', 'type', 'txt'); $form->addElement('hidden', 'status', $aBanner['status']); $translation = new OX_Translation(); $pluginConf = $GLOBALS['conf']['oxMarkedText']; $bannerTextMaxLength = $pluginConf['textMaxLength']; $regularLinkMaxLength = $pluginConf['anchor1MaxLength']; $highlightedLinkMaxLength = $pluginConf['anchor2MaxLength']; $form->addElement('header', 'header_b_links', "Banner content"); $form->addElement('text', 'description', "Name"); $fieldwithdescr[] = $form->createElement('textarea', 'bannertext', '<label for="bannertext" style="display: block; float: left; width: 170px;">Banner text</label>'); $fieldwithdescr[] = $form->createElement('static', 'descr', str_replace(array('XX', 'YY', 'ZZ'), array($bannerTextMaxLength, $regularLinkMaxLength, $highlightedLinkMaxLength), '<p>Type your ad text, mark any blocks with brackets to add link. Example: <i>My [super ads] for only [[123$]]</i>.</p> Single brackets will show regular link and double brackets means highlighted link. You can use <ul><li>- up to XX chars for whole ad text</li><li>- 1 regular link, up to YY chars </li><li>- 1 highlighted link, up to ZZ chars</li></ul>')); $form->addGroup($fieldwithdescr, 'bannertext', null, '<br />'); $form->addElement('text', 'url', $GLOBALS['strURL']); $form->addElement('hidden', 'ext_bannertype', 'bannerTypeText:oxMarkedText:oxMarkedTextComponent'); $weightfield[] = $form->createElement('text', 'weight', '<label for="weight" style="display: block; float: left; width: 170px;">' . $GLOBALS['strWeight'] . '</label>'); $weightfield[] = $form->createElement('static', 'weightdescr', '<p>If you want to show this ad more frequently, adjust its weight.</p>'); $form->addGroup($weightfield, 'weight', null, '<br />'); $weightPositiveRule = $translation->translate($GLOBALS['strXPositiveWholeNumberField'], array($GLOBALS['strWeight'])); $form->addRule('weight', $weightPositiveRule, 'numeric'); $form->addRule('bannertext', "Maximum {$bannerTextMaxLength} characters", 'maxlength', $bannerTextMaxLength); $form->addElement('controls', 'form-controls'); $form->addElement('submit', 'submit', 'Save changes'); $form->setDefaults($aBanner); if ($formDisabled) { $form->freeze(); } return $form; }
function buildBannerForm($type, $aBanner, &$oComponent = null, $formDisabled = false) { //-- Build forms $form = new OA_Admin_UI_Component_Form("bannerForm", "POST", $_SERVER['SCRIPT_NAME'], null, array("enctype" => "multipart/form-data")); $form->forceClientValidation(true); $form->addElement('hidden', 'clientid', $aBanner['clientid']); $form->addElement('hidden', 'campaignid', $aBanner['campaignid']); $form->addElement('hidden', 'bannerid', $aBanner['bannerid']); $form->addElement('hidden', 'type', $type); $form->addElement('hidden', 'status', $aBanner['status']); if ($type == 'sql' || $type == 'web') { $form->addElement('custom', 'banner-iab-note', null, null); } if ($aBanner['contenttype'] == 'swf' && empty($aBanner['alt_contenttype']) && empty($aBanner['alt_imageurl'])) { $form->addElement('custom', 'banner-backup-note', null, null); } $form->addElement('header', 'header_basic', $GLOBALS['strBasicInformation']); if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $form->addElement('text', 'description', $GLOBALS['strName']); } else { $form->addElement('static', 'description', $GLOBALS['strName'], $aBanner['description']); } //local banners if ($type == 'sql' || $type == 'web') { if ($type == 'sql') { $header = $form->createElement('header', 'header_sql', $GLOBALS['strMySQLBanner'] . " - banner creative"); } else { $header = $form->createElement('header', 'header_sql', $GLOBALS['strWebBanner'] . " - banner creative"); } $header->setAttribute('icon', 'icon-banner-stored.gif'); $form->addElement($header); $imageName = _getContentTypeIconImageName($aBanner['contenttype']); $size = _getBannerSizeText($type, $aBanner['filename']); addUploadGroup($form, $aBanner, array('uploadName' => 'upload', 'radioName' => 'replaceimage', 'imageName' => $imageName, 'fileName' => $aBanner['filename'], 'fileSize' => $size, 'newLabel' => $GLOBALS['strNewBannerFile'], 'updateLabel' => $GLOBALS['strUploadOrKeep'], 'handleSWF' => true)); $altImageName = null; $altSize = null; if ($aBanner['contenttype'] == 'swf') { $altImageName = _getContentTypeIconImageName($aBanner['alt_contenttype']); $altSize = _getBannerSizeText($type, $aBanner['alt_filename']); } $aUploadParams = array('uploadName' => 'uploadalt', 'radioName' => 'replacealtimage', 'imageName' => $altImageName, 'fileSize' => $altSize, 'fileName' => $aBanner['alt_filename'], 'newLabel' => $GLOBALS['strNewBannerFileAlt'], 'updateLabel' => $GLOBALS['strUploadOrKeep'], 'handleSWF' => false); if ($aBanner['contenttype'] != 'swf') { $aUploadParams = array_merge($aUploadParams, array('decorateId' => 'swfAlternative')); } addUploadGroup($form, $aBanner, $aUploadParams); $form->addElement('header', 'header_b_links', "Banner link"); if (count($aBanner['hardcoded_links']) == 0) { $form->addElement('text', 'url', $GLOBALS['strURL']); $targetElem = $form->createElement('text', 'target', $GLOBALS['strTarget']); $targetElem->setAttribute('maxlength', '16'); $form->addElement($targetElem); } else { foreach ($aBanner['hardcoded_links'] as $key => $val) { $link['text'] = $form->createElement('text', "alink[" . $key . "]", null); $link['text']->setAttribute("style", "width:330px"); $link['radio'] = $form->createElement('radio', "alink_chosen", null, null, $key); $form->addGroup($link, 'url_group', $GLOBALS['strURL'], "", false); if (isset($aBanner['hardcoded_targets'][$key])) { $targetElem = $form->createElement('text', "atar[" . $key . "]", $GLOBALS['strTarget']); $targetElem->setAttribute('maxlength', '16'); $form->addElement($targetElem); } if (count($aBanner['hardcoded_links']) > 1) { $form->addElement('text', "asource[" . $key . "]", $GLOBALS['strOverwriteSource']); } } $form->addElement('hidden', 'url', $aBanner['url']); } $form->addElement('header', 'header_b_display', 'Banner display'); $form->addElement('text', 'alt', $GLOBALS['strAlt']); $form->addElement('text', 'statustext', $GLOBALS['strStatusText']); $form->addElement('text', 'bannertext', $GLOBALS['strTextBelow']); if (!empty($aBanner['bannerid'])) { $sizeG['width'] = $form->createElement('text', 'width', $GLOBALS['strWidth'] . ":"); $sizeG['width']->setAttribute('onChange', 'oa_sizeChangeUpdateMessage("warning_change_banner_size");'); $sizeG['width']->setSize(5); $sizeG['height'] = $form->createElement('text', 'height', $GLOBALS['strHeight'] . ":"); $sizeG['height']->setAttribute('onChange', 'oa_sizeChangeUpdateMessage("warning_change_banner_size");'); $sizeG['height']->setSize(5); $form->addGroup($sizeG, 'size', $GLOBALS['strSize'], " ", false); //validation rules $translation = new OX_Translation(); $widthRequiredRule = array($translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strWidth'])), 'required'); $widthPositiveRule = array($translation->translate($GLOBALS['strXGreaterThanZeroField'], array($GLOBALS['strWidth'])), 'min', 1); $heightRequiredRule = array($translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strHeight'])), 'required'); $heightPositiveRule = array($translation->translate($GLOBALS['strXGreaterThanZeroField'], array($GLOBALS['strHeight'])), 'min', 1); $numericRule = array($GLOBALS['strNumericField'], 'numeric'); $form->addGroupRule('size', array('width' => array($widthRequiredRule, $numericRule, $widthPositiveRule), 'height' => array($heightRequiredRule, $numericRule, $heightPositiveRule))); } if (!isset($aBanner['contenttype']) || $aBanner['contenttype'] == 'swf') { $form->addElement('checkbox', 'transparent', $GLOBALS['strSwfTransparency'], $GLOBALS['strSwfTransparency']); } //TODO $form->addRule("size", 'Please enter a number', 'numeric'); //this should make all fields in group size are numeric } //external banners if ($type == "url") { $header = $form->createElement('header', 'header_txt', $GLOBALS['strURLBanner']); $header->setAttribute('icon', 'icon-banner-url.gif'); $form->addElement($header); $form->addElement('text', 'imageurl', $GLOBALS['strNewBannerURL']); if ($aBanner['contenttype'] == 'swf') { $altImageName = _getContentTypeIconImageName($aBanner['alt_contenttype']); $altSize = _getBannerSizeText($type, $aBanner['alt_filename']); $form->addElement('text', 'alt_imageurl', $GLOBALS['strNewBannerFileAlt']); } $form->addElement('header', 'header_b_links', "Banner link"); $form->addElement('text', 'url', $GLOBALS['strURL']); $targetElem = $form->createElement('text', 'target', $GLOBALS['strTarget']); $targetElem->setAttribute('maxlength', '16'); $form->addElement($targetElem); $form->addElement('header', 'header_b_display', 'Banner display'); $form->addElement('text', 'alt', $GLOBALS['strAlt']); $form->addElement('text', 'statustext', $GLOBALS['strStatusText']); $form->addElement('text', 'bannertext', $GLOBALS['strTextBelow']); $sizeG['width'] = $form->createElement('text', 'width', $GLOBALS['strWidth'] . ":"); $sizeG['width']->setAttribute('onChange', 'oa_sizeChangeUpdateMessage("warning_change_banner_size");'); $sizeG['width']->setSize(5); $sizeG['height'] = $form->createElement('text', 'height', $GLOBALS['strHeight'] . ":"); $sizeG['height']->setAttribute('onChange', 'oa_sizeChangeUpdateMessage("warning_change_banner_size");'); $sizeG['height']->setSize(5); $form->addGroup($sizeG, 'size', $GLOBALS['strSize'], " ", false); if (!isset($aBanner['contenttype']) || $aBanner['contenttype'] == 'swf') { $form->addElement('checkbox', 'transparent', $GLOBALS['strSwfTransparency'], $GLOBALS['strSwfTransparency']); } //validation rules $translation = new OX_Translation(); $widthRequiredRule = array($translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strWidth'])), 'required'); $widthPositiveRule = array($translation->translate($GLOBALS['strXGreaterThanZeroField'], array($GLOBALS['strWidth'])), 'min', 1); $heightRequiredRule = array($translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strHeight'])), 'required'); $heightPositiveRule = array($translation->translate($GLOBALS['strXGreaterThanZeroField'], array($GLOBALS['strHeight'])), 'min', 1); $numericRule = array($GLOBALS['strNumericField'], 'numeric'); $form->addGroupRule('size', array('width' => array($widthRequiredRule, $numericRule, $widthPositiveRule), 'height' => array($heightRequiredRule, $numericRule, $heightPositiveRule))); } //html & text banners if ($oComponent) { $oComponent->buildForm($form, $aBanner); } $translation = new OX_Translation(); //common for all banners if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $form->addElement('header', 'header_additional', "Additional data"); $form->addElement('text', 'keyword', $GLOBALS['strKeyword']); $weightElem = $form->createElement('text', 'weight', $GLOBALS['strWeight']); $weightElem->setSize(6); $form->addElement($weightElem); $form->addElement('textarea', 'comments', $GLOBALS['strComments']); $weightPositiveRule = $translation->translate($GLOBALS['strXPositiveWholeNumberField'], array($GLOBALS['strWeight'])); $form->addRule('weight', $weightPositiveRule, 'numeric'); } //we want submit to be the last element in its own separate section $form->addElement('controls', 'form-controls'); $form->addElement('submit', 'submit', 'Save changes'); //validation rules if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $urlRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strName'])); $form->addRule('description', $urlRequiredMsg, 'required'); } //set banner values $form->setDefaults($aBanner); foreach ($aBanner['hardcoded_links'] as $key => $val) { $swfLinks["alink[" . $key . "]"] = phpAds_htmlQuotes($val); if ($val == $aBanner['url']) { $swfLinks['alink_chosen'] = $key; } if (isset($aBanner['hardcoded_targets'][$key])) { $swfLinks["atar[" . $key . "]"] = phpAds_htmlQuotes($aBanner['hardcoded_targets'][$key]); } if (count($aBanner['hardcoded_links']) > 1) { $swfLinks["asource[" . $key . "]"] = phpAds_htmlQuotes($aBanner['hardcoded_sources'][$key]); } } $form->setDefaults($swfLinks); if ($formDisabled) { $form->freeze(); } return $form; }
function buildStatusForm($aCampaign) { $form = new OA_Admin_UI_Component_Form("statusChangeForm", "POST", $_SERVER['PHP_SELF']); $form->forceClientValidation(true); $form->addElement('hidden', 'campaignid', $aCampaign['campaignid']); $form->addElement('hidden', 'clientid', $aCampaign['clientid']); $form->addElement('header', 'h_misc', $GLOBALS['strCampaignStatus']); $form->addElement('static', 'status_display', $GLOBALS['strStatus'], OX_Util_Utils::getCampaignStatusName($aCampaign['status'])); if ($aCampaign['status'] == OA_ENTITY_STATUS_APPROVAL) { $form->addElement('radio', 'status', null, $GLOBALS['strCampaignApprove'] . " - " . $GLOBALS['strCampaignApproveDescription'], OA_ENTITY_STATUS_RUNNING, array('id' => 'sts_approve')); $form->addElement('radio', 'status', null, $GLOBALS['strCampaignReject'] . " - " . $GLOBALS['strCampaignRejectDescription'], OA_ENTITY_STATUS_REJECTED, array('id' => 'sts_reject')); $form->addElement('select', 'as_reject_reason', $GLOBALS['strReasonForRejection'], array(OA_ENTITY_ADVSIGNUP_REJECT_NOTLIVE => $GLOBALS['strReasonSiteNotLive'], OA_ENTITY_ADVSIGNUP_REJECT_BADCREATIVE => $GLOBALS['strReasonBadCreative'], OA_ENTITY_ADVSIGNUP_REJECT_BADURL => $GLOBALS['strReasonBadUrl'], OA_ENTITY_ADVSIGNUP_REJECT_BREAKTERMS => $GLOBALS['strReasonBreakTerms'])); $form->addDecorator('as_reject_reason', 'process', array('tag' => 'tr', 'addAttributes' => array('id' => 'rsn_row{numCall}', 'class' => ''))); } elseif ($aCampaign['status'] == OA_ENTITY_STATUS_RUNNING) { $form->addElement('radio', 'status', null, $GLOBALS['strCampaignPause'] . " - " . $GLOBALS['strCampaignPauseDescription'], OA_ENTITY_STATUS_PAUSED, array('id' => 'sts_pause')); } elseif ($aCampaign['status'] == OA_ENTITY_STATUS_PAUSED) { $form->addElement('radio', 'status', null, $GLOBALS['strCampaignRestart'] . " - " . $GLOBALS['strCampaignRestartDescription'], OA_ENTITY_STATUS_RUNNING, array('id' => 'sts_restart')); } elseif ($aCampaign['status'] == OA_ENTITY_STATUS_REJECTED) { $rejectionReasonText = phpAds_showStatusRejected($aCampaign['as_reject_reason']); $form->addElement('static', 'status', null, $rejectionReasonText, OA_ENTITY_STATUS_PAUSED, array('id' => 'sts_pause')); } $form->addElement('controls', 'form-controls'); $form->addElement('submit', 'submit_status', $GLOBALS['strChangeStatus']); return $form; }