function display($tpl = null) { JHTML::_('core'); $mainframe = JFactory::getApplication(); $option = JRequest::getCmd('option'); $view = JRequest::getCmd('view'); $limit = $mainframe->getUserStateFromRequest("{$option}.{$view}.limit", 'limit', 15, 'int'); $limitstart = $mainframe->getUserStateFromRequest("{$option}.{$view}.limitstart", 'limitstart', 0, 'int'); $ordering = $mainframe->getUserStateFromRequest("{$option}.{$view}.ordering", 'filter_order', 'virtuemart_product_id', 'cmd'); $orderingDir = $mainframe->getUserStateFromRequest("{$option}.{$view}.orderingDir", 'filter_order_Dir', 'DESC', 'word'); $published = $mainframe->getUserStateFromRequest("{$option}.{$view}.published", 'published', '-1', 'cmd'); $catid = $mainframe->getUserStateFromRequest("{$option}.{$view}.catid", 'catid', 0, 'int'); $search = $mainframe->getUserStateFromRequest("{$option}.{$view}.search", 'search', '', 'string'); $search = JString::strtolower($search); $model = $this->getModel('virtuemart'); $model->setState('ordering', $ordering); $model->setState('orderingDir', $orderingDir); $model->setState('published', $published); $model->setState('catid', $catid); $model->setState('search', $search); $model->setState('limit', $limit); $model->setState('limitstart', $limitstart); $products = $model->getData(); $this->assignRef('rows', $products); $total = $model->getTotal(); jimport('joomla.html.pagination'); $pagination = new JPagination($total, $limitstart, $limit); $this->assignRef('pagination', $pagination); $filters = array(); $filters['search'] = $search; $filters['ordering'] = $ordering; $filters['orderingDir'] = $orderingDir; $options = array(); $options[] = JHTML::_('select.option', -1, JText::_('K2MART_ANY')); $options[] = JHTML::_('select.option', 1, JText::_('K2MART_PUBLISHED')); $options[] = JHTML::_('select.option', 0, JText::_('K2MART_UNPUBLISHED')); $filters['published'] = JHTML::_('select.genericlist', $options, 'published', 'onchange="this.form.submit();"', 'value', 'text', $published); $filters['category'] = $model->getCategories(); if (count(vmconfig::get('active_languages')) > 1) { $params = JComponentHelper::getParams('com_languages'); $defaultLanguage = $params->get('site', 'en-GB'); jimport('joomla.language.helper'); $lang = $mainframe->getUserStateFromRequest("{$option}.{$view}.vmlang", 'vmlang', $defaultLanguage, 'string'); $languages = JLanguageHelper::createLanguageList($defaultLanguage, constant('JPATH_SITE'), true); $activeVmLangs = vmconfig::get('active_languages'); foreach ($languages as $k => &$joomlaLang) { if (!in_array($joomlaLang['value'], $activeVmLangs)) { unset($languages[$k]); } } $filters['language'] = JHTML::_('select.genericlist', $languages, 'vmlang', 'onchange="this.form.submit();"', 'value', 'text', $lang, 'vmlang'); } $this->assignRef('filters', $filters); $template = $mainframe->getTemplate(); $this->assignRef('template', $template); parent::display($tpl); }
function sendPostRequest () { $post_variables = $this->getPostVariables(); $jump_url = $this->getJumpUrl(); $html = ''; if ($this->_method->debug) { $html .= '<form action="' . $jump_url . '" method="post" name="vm_realex_form" target="realex">'; } else { if (vmconfig::get('css')) { $msg = vmText::_('VMPAYMENT_REALEX_HPP_API_REDIRECT_MESSAGE', true); } else { $msg=''; } vmJsApi::addJScript('vm.paymentFormAutoSubmit', ' jQuery(document).ready(function($){ jQuery("body").addClass("vmLoading"); var msg="'.$msg.'"; jQuery("body").append("<div class=\"vmLoadingDiv\"><div class=\"vmLoadingDivMsg\">"+msg+"</div></div>"); jQuery("#vmPaymentForm").submit(); }) '); $html .= '<form action="' . $jump_url . '" method="post" name="vm_realex_form" id="vmPaymentForm" accept-charset="UTF-8">'; } $html .= '<input type="hidden" name="charset" value="utf-8">'; foreach ($post_variables as $name => $value) { $html .= '<input type="hidden" name="' . $name . '" value="' . $value . '" />'; } if ($this->_method->debug) { $html .= '<div style="background-color:red;color:white;padding:10px;"> <input type="submit" value="The method is in debug mode. Click here to be redirected to Realex" /> </div>'; $this->debugLog($post_variables, 'sendPostRequest:', 'debug'); } $html .= '</form>'; return $html; }
function addStandardEditViewCommands($id = 0, $object = null) { $view = vRequest::getCmd('view', vRequest::getCmd('controller', 'virtuemart')); if (!class_exists('JToolBarHelper')) { require JPATH_ADMINISTRATOR . DS . 'includes' . DS . 'toolbar.php'; } JToolBarHelper::divider(); if ($this->canDo->get('core.admin') or $this->canDo->get('vm.' . $view . '.edit') or $this->canDo->get('vm.' . $view . '.create')) { JToolBarHelper::save(); JToolBarHelper::apply(); } JToolBarHelper::cancel(); self::showHelp(); self::showACLPref($view); if ($view == 'user' or $view == 'product') { $validate = true; } else { $validate = false; } $this->addJsJoomlaSubmitButton($validate); $editView = vRequest::getCmd('view', vRequest::getCmd('controller', '')); $params = JComponentHelper::getParams('com_languages'); $selectedLangue = $params->get('site', 'en-GB'); $this->lang = strtolower(strtr($selectedLangue, '-', '_')); // Get all the published languages defined in Language manager > Content $allLanguages = JLanguageHelper::getLanguages(); foreach ($allLanguages as $jlang) { $languagesByCode[$jlang->lang_code] = $jlang; } // only add if ID and view not null if ($editView and $id and count(vmconfig::get('active_languages')) > 1) { if ($editView == 'user') { $editView = 'vendor'; } jimport('joomla.language.helper'); $this->lang = vRequest::getVar('vmlang', $this->lang); // list of languages installed in #__extensions (may be more than the ones in the Language manager > Content if the user did not added them) $languages = JLanguageHelper::createLanguageList($selectedLangue, constant('VMPATH_ROOT'), true); $activeVmLangs = vmconfig::get('active_languages'); $flagCss = ""; foreach ($languages as $k => &$joomlaLang) { if (!in_array($joomlaLang['value'], $activeVmLangs)) { unset($languages[$k]); } else { $key = $joomlaLang['value']; if (!isset($languagesByCode[$key])) { $img = substr($key, 0, 2); //We try a fallback vmdebug('COM_VIRTUEMART_MISSING_FLAG', $img, $joomlaLang['text']); } else { $img = $languagesByCode[$key]->image; } $image_flag = VMPATH_ROOT . "/media/mod_languages/images/" . $img . ".gif"; $image_flag_url = JURI::root() . "media/mod_languages/images/" . $img . ".gif"; if (!file_exists($image_flag)) { vmerror(vmText::sprintf('COM_VIRTUEMART_MISSING_FLAG', $image_flag, $joomlaLang['text'])); } else { $flagCss .= "td.flag-" . $key . ",.flag-" . $key . "{background: url( " . $image_flag_url . ") no-repeat 0 0; padding-left:20px !important;}\n"; } } } JFactory::getDocument()->addStyleDeclaration($flagCss); $this->langList = JHtml::_('select.genericlist', $languages, 'vmlang', 'class="inputbox" style="width:176px;"', 'value', 'text', $selectedLangue, 'vmlang'); if ($editView == 'product') { $productModel = VmModel::getModel('product'); $childproducts = $productModel->getProductChilds($id) ? $productModel->getProductChilds($id) : ''; } $token = JSession::getFormToken(); $j = ' jQuery(function($) { var oldflag = ""; $("select#vmlang").chosen().change(function() { langCode = $(this).find("option:selected").val(); flagClass = "flag-"+langCode; jQuery.ajax({ type: "GET", cache: false, dataType: "json", url: "index.php?option=com_virtuemart&view=translate&task=paste&format=json&lg="+langCode+"&id=' . $id . '&editView=' . $editView . '&' . $token . '=1", }).done( function(data) { var items = []; var theForm = document.forms["adminForm"]; if(typeof theForm.vmlang==="undefined"){ var input = document.createElement("input"); input.type = "hidden"; input.name = "vmlang"; input.value = langCode; theForm.appendChild(input); } else { theForm.vmlang.value = langCode; } if (data.fields !== "error" ) { if (data.structure == "empty") alert(data.msg); $.each(data.fields , function(key, val) { cible = jQuery("#"+key); if (oldflag !== "") cible.parent().removeClass(oldflag) var tmce_ver = 0; if(typeof window.tinyMCE!=="undefined"){ var tmce_ver=window.tinyMCE.majorVersion; } if (tmce_ver>="4") { if (cible.parent().addClass(flagClass).children().hasClass("mce_editable") && data.structure !== "empty" ) tinyMCE.execCommand("mceSetContent", false,val); else if (data.structure !== "empty") cible.val(val); } else { if (cible.parent().addClass(flagClass).children().hasClass("mce_editable") && data.structure !== "empty" ) tinyMCE.execInstanceCommand(key,"mceSetContent",false,val); else if (data.structure !== "empty") cible.val(val); } }); } else alert(data.msg);'; if ($editView == 'product' && !empty($childproducts)) { foreach ($childproducts as $child) { $j .= 'jQuery.ajax({ type: "GET", cache: false, dataType: "json", url: "index.php?option=com_virtuemart&view=translate&task=paste&format=json&lg="+langCode+"&id=' . $child->virtuemart_product_id . '&editView=' . $editView . '&' . $token . '=1", }).done( // $.getJSON( "index.php?option=com_virtuemart&view=translate&task=paste&format=json&lg="+langCode+"&id=' . $child->virtuemart_product_id . '&editView=' . $editView . '&' . $token . '=1" , function(data) { cible = jQuery("#child' . $child->virtuemart_product_id . 'product_name"); if (oldflag !== "") cible.parent().removeClass(oldflag) cible.parent().addClass(flagClass); cible.val(data.fields.product_name); jQuery("#child' . $child->virtuemart_product_id . 'slug").val(data.fields["slug"]); } ) '; } } $j .= 'oldflag = flagClass ; } ) }); })'; vmJsApi::addJScript('vmlang', $j); } else { $jlang = JFactory::getLanguage(); $langs = $jlang->getKnownLanguages(); $defautName = $selectedLangue; $flagImg = $selectedLangue; if (isset($languagesByCode[$selectedLangue])) { $defautName = $langs[$selectedLangue]['name']; $flagImg = JHtml::_('image', 'mod_languages/' . $languagesByCode[$selectedLangue]->image . '.gif', $languagesByCode[$selectedLangue]->title_native, array('title' => $languagesByCode[$selectedLangue]->title_native), true); } else { vmWarn(vmText::sprintf('COM_VIRTUEMART_MISSING_FLAG', $selectedLangue, $selectedLangue)); } $this->langList = '<input name ="vmlang" type="hidden" value="' . $selectedLangue . '" >' . $flagImg . ' <b> ' . $defautName . '</b>'; } if (JFactory::getApplication()->isSite()) { $bar = JToolBar::getInstance('toolbar'); $bar->appendButton('Link', 'back', 'COM_VIRTUEMART_LEAVE', 'index.php?option=com_virtuemart&manage=0'); } }
function addStandardEditViewCommands($id = 0, $object = null) { $view = JRequest::getCmd('view', JRequest::getCmd('controller', 'virtuemart')); if (JRequest::getCmd('tmpl') == 'component') { if (!class_exists('JToolBarHelper')) { require JPATH_ADMINISTRATOR . DS . 'includes' . DS . 'toolbar.php'; } } else { // JRequest::setVar('hidemainmenu', true); JToolBarHelper::divider(); if ($this->canDo->get('core.admin') || $this->canDo->get('vm.' . $view . '.edit')) { JToolBarHelper::save(); JToolBarHelper::apply(); } JToolBarHelper::cancel(); self::showHelp(); self::showACLPref($view); } // javascript for cookies setting in case of press "APPLY" $document = JFactory::getDocument(); if (JVM_VERSION === 1) { $j = "\n//<![CDATA[\n\tfunction submitbutton(pressbutton) {\n\n\t\tjQuery( '#media-dialog' ).remove();\n\t\tvar options = { path: '/', expires: 2}\n\t\tif (pressbutton == 'apply') {\n\t\t\tvar idx = jQuery('#tabs li.current').index();\n\t\t\tjQuery.cookie('vmapply', idx, options);\n\t\t} else {\n\t\t\tjQuery.cookie('vmapply', '0', options);\n\t\t}\n\t\t submitform(pressbutton);\n\t};\n//]]>\n\t"; } else { $j = "\n//<![CDATA[\n\tJoomla.submitbutton=function(a){\n\t\tvar options = { path: '/', expires: 2}\n\t\tif (a == 'apply') {\n\t\t\tvar idx = jQuery('#tabs li.current').index();\n\t\t\tjQuery.cookie('vmapply', idx, options);\n\t\t} else {\n\t\t\tjQuery.cookie('vmapply', '0', options);\n\t\t}\n\t\tjQuery( '#media-dialog' ).remove();\n\t\tJoomla.submitform(a);\n\t};\n//]]>\n\t"; } $document->addScriptDeclaration($j); // LANGUAGE setting $editView = JRequest::getWord('view', JRequest::getWord('controller', '')); $params = JComponentHelper::getParams('com_languages'); //$config =JFactory::getConfig();$config->getValue('language'); $selectedLangue = $params->get('site', 'en-GB'); $lang = strtolower(strtr($selectedLangue, '-', '_')); // Get all the published languages defined in Language manager > Content $allLanguages = JLanguageHelper::getLanguages(); foreach ($allLanguages as $jlang) { $languagesByCode[$jlang->lang_code] = $jlang; } // only add if ID and view not null if ($editView and $id and count(vmconfig::get('active_languages')) > 1) { if ($editView == 'user') { $editView = 'vendor'; } //$params = JComponentHelper::getParams('com_languages'); jimport('joomla.language.helper'); $lang = JRequest::getVar('vmlang', $lang); // list of languages installed in #__extensions (may be more than the ones in the Language manager > Content if the user did not added them) $languages = JLanguageHelper::createLanguageList($selectedLangue, constant('JPATH_SITE'), true); $activeVmLangs = vmconfig::get('active_languages'); $flagCss = ""; foreach ($languages as $k => &$joomlaLang) { if (!in_array($joomlaLang['value'], $activeVmLangs)) { unset($languages[$k]); } else { $key = $joomlaLang['value']; $img = $languagesByCode[$joomlaLang['value']]->image; $image_flag = "../media/mod_languages/images/" . $img . ".gif"; if (!file_exists($image_flag)) { vmerror(JText::sprintf('COM_VIRTUEMART_MISSING_FLAG', $image_flag, $joomlaLang['text'])); } $flagCss .= "td.flag-" . $key . ",.flag-" . $key . "{background: url( " . $image_flag . ") no-repeat 0 0; padding-left:20px !important;}\n"; } } JFactory::getDocument()->addStyleDeclaration($flagCss); $langList = JHTML::_('select.genericlist', $languages, 'vmlang', 'class="inputbox"', 'value', 'text', $selectedLangue, 'vmlang'); $this->assignRef('langList', $langList); $this->assignRef('lang', $lang); if ($editView == 'product') { $productModel = VmModel::getModel('product'); $childproducts = $productModel->getProductChilds($id) ? $productModel->getProductChilds($id) : ''; } $token = JUtility::getToken(); $j = ' jQuery(function($) { var oldflag = ""; $("select#vmlang").chosen().change(function() { langCode = $(this).find("option:selected").val(); flagClass = "flag-"+langCode; $.getJSON( "index.php?option=com_virtuemart&view=translate&task=paste&format=json&lg="+langCode+"&id=' . $id . '&editView=' . $editView . '&' . $token . '=1" , function(data) { var items = []; if (data.fields !== "error" ) { if (data.structure == "empty") alert(data.msg); $.each(data.fields , function(key, val) { cible = jQuery("#"+key); if (oldflag !== "") cible.parent().removeClass(oldflag) if (cible.parent().addClass(flagClass).children().hasClass("mce_editable") && data.structure !== "empty" ) tinyMCE.execInstanceCommand(key,"mceSetContent",false,val); else if (data.structure !== "empty") cible.val(val); }); } else alert(data.msg);'; if ($editView == 'product' && !empty($childproducts)) { foreach ($childproducts as $child) { $j .= ' $.getJSON( "index.php?option=com_virtuemart&view=translate&task=paste&format=json&lg="+langCode+"&id=' . $child->virtuemart_product_id . '&editView=' . $editView . '&' . $token . '=1" , function(data) { cible = jQuery("#child' . $child->virtuemart_product_id . 'product_name"); cible.parent().removeClass(oldflag) cible.parent().addClass(flagClass); cible.val(data.fields["product_name"]); jQuery("#child' . $child->virtuemart_product_id . 'slug").val(data.fields["slug"]); oldflag = flagClass ; } ) '; } } else { $j .= 'oldflag = flagClass ;'; } $j .= ' } ) }); })'; $document->addScriptDeclaration($j); } else { // $params = JComponentHelper::getParams('com_languages'); // $lang = $params->get('site', 'en-GB'); $jlang = JFactory::getLanguage(); $langs = $jlang->getKnownLanguages(); $defautName = $langs[$selectedLangue]['name']; $flagImg = JHtml::_('image', 'mod_languages/' . $languagesByCode[$selectedLangue]->image . '.gif', $languagesByCode[$selectedLangue]->title_native, array('title' => $languagesByCode[$selectedLangue]->title_native), true); $langList = '<input name ="vmlang" type="hidden" value="' . $selectedLangue . '" >' . $flagImg . ' <b> ' . $defautName . '</b>'; $this->assignRef('langList', $langList); $this->assignRef('lang', $lang); } }
public function preparePost() { $post_variables = $this->initPostVariables($this->_method->payment_type); $paymentCurrency = CurrencyDisplay::getInstance($this->_method->payment_currency); $order_number_text = $this->getItemName(vmText::_('COM_VIRTUEMART_ORDER_NUMBER')); switch ($this->_method->payment_type) { case '_xclick': case '_donations': $post_variables['item_name'] = $order_number_text . ': ' . $this->order['details']['BT']->order_number; $post_variables['amount'] = $this->total; break; case '_oe-gift-certificate': $post_variables['item_name'] = $order_number_text . ': ' . $this->order['details']['BT']->order_number; //$post_variables['amount'] = round ($paymentCurrency->convertCurrencyTo ($this->_method->payment_currency, $this->order['details']['BT']->order_total, FALSE), 2);; $post_variables['fixed_denom'] = vmPSPlugin::getAmountValueInCurrency($this->order['details']['BT']->order_salesPrice, $this->_method->payment_currency); //$post_variables['min_denom'] = $this->total; //$post_variables['max_denom'] = $this->total; $post_variables['shopping_url'] = JURI::root(); $post_variables['buyer_name'] = $this->order['details']['BT']->first_name . ' ' . $this->order['details']['BT']->last_name; if (array_key_exists('ST', $this->order['details'])) { $post_variables['recipient_name'] = $this->order['details']['ST']->first_name . ' ' . $this->order['details']['ST']->last_name; } break; case '_cart': $this->addPrices($post_variables); break; case '_xclick-subscriptions': $post_variables['item_name'] = $order_number_text . ': ' . $this->order['details']['BT']->order_number; if ($this->_method->subcription_trials) { $post_variables['a1'] = $this->_method->trial1_price ? $this->_method->trial1_price : 0; //Trial1 price. $post_variables['p1'] = $this->getDurationValue($this->_method->trial1_duration); $post_variables['t1'] = $this->getDurationUnit($this->_method->trial1_duration); } /*if ($this->_method->subcription_trials == 2) { $post_variables['a2'] = ($this->_method->trial2_price) ? $this->_method->trial2_price : 0; //Trial2 price. $post_variables['p2'] = $this->getDurationValue($this->_method->trial2_duration); $post_variables['t2'] = $this->getDurationUnit($this->_method->trial2_duration); }*/ $post_variables['a3'] = $this->total; //Regular subscription price. $post_variables['p3'] = $this->getDurationValue($this->_method->subscription_duration); $post_variables['t3'] = $this->getDurationUnit($this->_method->subscription_duration); $post_variables['src'] = 1; //Recurring payments. Subscription payments recur unless subscribers cancel their subscriptions before the end of the current billing cycle or you limit the number of times that payments recur with the value that you specify for srt $post_variables['srt'] = $this->_method->subscription_term; //Recurring times. Number of times that subscription payments recur. Specify an integer with a minimum value of 1 and a maximum value of 52. Valid only if you specify src="1" $post_variables['sra'] = 1; //Reattempt on failure. If a recurring payment fails, PayPal attempts to collect the payment two more times before canceling the subscription. $post_variables['modify'] = 0; //Modification behavior. Allowable values are: //0 – allows subscribers only to sign up for new subscriptions, //1 – allows subscribers to sign up for new subscriptions and modify their current subscriptions //2 – allows subscribers to modify only their current subscriptions break; case '_xclick-auto-billing': $post_variables['item_name'] = $order_number_text . ': ' . $this->order['details']['BT']->order_number; //A description of the automatic billing plan. $post_variables['max_text'] = $this->_method->payment_desc; //Specify whether to let buyers enter maximum billing limits in a text box or choose from a list of maximum billing limits that you specify. //Allowable values are: //max_limit_own – your button displays a text box for buyers to enter their own maximums above a minimum billing limit that you set with the min_amount variable. //max_limit_defined – your button displays a dropdown menu of product options with prices to let buyers choose their maximum billing limits. $post_variables['set_customer_limit'] = 'max_limit_defined'; //The minimum monthly billing limit, if you have one. Valid only if set_customer_limit = max_limit_own. //$post_variables['min_amount'] = 0; $post_variables['min_amount'] = $this->total; switch ($this->_method->billing_max_amount_type) { case 'cust': $post_variables["max_amount"] = vmPSPlugin::getAmountValueInCurrency($this->customerData->getVar('autobilling_max_amount'), $this->_method->payment_currency); break; case 'value': $post_variables["max_amount"] = vmPSPlugin::getAmountValueInCurrency($this->_method->billing_max_amount, $this->_method->payment_currency); break; case 'perc': $percentage = $this->_method->billing_max_amount; $max_amount = $this->total * floatval($percentage) / 100 + $this->total; $post_variables['max_amount'] = round($max_amount, 2); break; case 'cart': default: $post_variables['max_amount'] = $this->total; break; } break; case '_xclick-payment-plan': $post_variables['item_name'] = $order_number_text . ': ' . $this->order['details']['BT']->order_number; $post_variables['disp_tot'] = 'Y'; //Display the total payment amount to buyers during checkout $post_variables['option_index'] = 0; $post_variables['option_select0_type'] = 'E'; //F – pay in full, at checkout, E – pay in equal periods, beginning at checkout or sometime later, V – pay in variable periods, beginning at checkout if ($this->_method->payment_plan_defer) { $post_variables['option_select0_a0'] = '0.00'; $post_variables['option_select0_p0'] = $this->getDurationValue($this->_method->payment_plan_defer_duration); $post_variables['option_select0_t0'] = $this->getDurationUnit($this->_method->payment_plan_defer_duration); $post_variables['option_select0_n0'] = 1; $post_variables['option_select0_a1'] = round($this->total / $this->_method->payment_plan_term, 2); $post_variables['option_select0_p1'] = $this->getDurationValue($this->_method->payment_plan_duration); $post_variables['option_select0_t1'] = $this->getDurationUnit($this->_method->payment_plan_duration); $post_variables['option_select0_n1'] = $this->_method->payment_plan_term; } else { $post_variables['option_select0_a0'] = round($this->total / $this->_method->payment_plan_term, 2); $post_variables['option_select0_p0'] = $this->getDurationValue($this->_method->payment_plan_duration); $post_variables['option_select0_t0'] = $this->getDurationUnit($this->_method->payment_plan_duration); $post_variables['option_select0_n0'] = $this->_method->payment_plan_term; } $post_variables['os0'] = 'pay-in-' . $this->_method->payment_plan_term; $post_variables['option_select0'] = 'pay-in-' . $this->_method->payment_plan_term; $post_variables['option_select0_name'] = $this->_method->payment_name; } $url = $this->_getPayPalUrl(); if (vmconfig::get('css')) { $msg = vmText::_('VMPAYMENT_PAYPAL_REDIRECT_MESSAGE', true); } else { $msg = ''; } vmJsApi::addJScript('vm.paymentFormAutoSubmit', ' jQuery(document).ready(function($){ jQuery("body").addClass("vmLoading"); var msg="' . $msg . '"; jQuery("body").append("<div class=\\"vmLoadingDiv\\"><div class=\\"vmLoadingDivMsg\\">"+msg+"</div></div>"); jQuery("#vmPaymentForm").submit(); }) '); $html = ''; if ($this->_method->debug) { $html .= '<form action="' . $url . '" method="post" name="vm_paypal_form" target="paypal">'; } else { $html .= '<form action="' . $url . '" method="post" name="vm_paypal_form" id="vmPaymentForm" accept-charset="UTF-8">'; } $html .= '<input type="hidden" name="charset" value="utf-8">'; foreach ($post_variables as $name => $value) { $html .= '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value) . '" />'; } if ($this->_method->debug) { $html .= '<div style="background-color:red;color:white;padding:10px;"> <input type="submit" value="The method is in debug mode. Click here to be redirected to PayPal" /> </div>'; $this->debugLog($post_variables, 'PayPal request:', 'debug'); } else { $html .= '<input type="submit" value="' . vmText::_('VMPAYMENT_PAYPAL_REDIRECT_MESSAGE') . '" />'; } $html .= '</form>'; return $html; }
function addStandardEditViewCommands($id = 0, $save2new = true) { // if (JRequest::getCmd('tmpl') =='component' ) { // if (!class_exists('JToolBarHelper')) require(JPATH_ADMINISTRATOR.DS.'includes'.DS.'toolbarhelper.php'); // } else { // JRequest::setVar('hidemainmenu', true); $view = $this->getName(); JToolBarHelper::divider(); if (ShopFunctions::can('add', $view)) { if ($id) { JToolBarHelper::save2copy('save2copy', 'JTOOLBAR_SAVE_AS_COPY'); } if ($save2new) { JToolbarHelper::save2new('save2new', 'JTOOLBAR_SAVE_AND_NEW'); } } JToolBarHelper::save(); JToolBarHelper::apply(); JToolBarHelper::cancel(); // todo add filter by view if ($id) { JToolBarHelper::custom('preview', 'eye', null, 'COM_VIRTUEMART_PREVIEW', false); } // } // javascript for cookies setting in case of press "APPLY" $document = JFactory::getDocument(); if ($view == 'product') { $view = 'productdetails'; } $j = "\n\t\t\tJoomla.submitbutton=function(a){\n\t\t\t\tvar options = { path: '/', expires: 2},\n\t\t\t\t\tlink = '';\n\t\t\t\tif (a == 'preview') {\n\t\t\t\t\tlink='" . juri::root() . "index.php?option=com_virtuemart&view=" . $view . "&" . $this->_cidName . "=" . $id . "';\n\t\t\t\t\twindow.location = link;\n\t\t\t\t\t// console.log(link);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (a == 'apply') {\n\t\t\t\t\tjQuery('#searchMedia-div ul').remove();\n\t\t\t\t\tvar idx = jQuery('#adminForm ul li.active').index();\n\t\t\t\t\tjQuery.cookie('vmapply', idx, options);\n\t\t\t\t} else {\n\t\t\t\t\tjQuery.cookie('vmapply', '0', options);\n\t\t\t\t}\n\t\t\t\tjQuery( '#media-dialog' ).remove();\n\t\t\t\tJoomla.submitform(a);\n\t\t\t};\n\t\t"; $document->addScriptDeclaration($j); // LANGUAGE setting $editView = JRequest::getWord('view', ''); $params = JComponentHelper::getParams('com_languages'); //$config =JFactory::getConfig();$config->get('language'); $selectedLangue = $params->get('site', 'en-GB'); $lang = JFactory::getLanguage(); if ($this->frontEdit) { $selectedLangue = $lang->getTag(); } $lang = strtolower(strtr($selectedLangue, '-', '_')); // only add if ID and view not null if ($id && count(vmconfig::get('active_languages')) > 1) { if ($view == 'user') { $view = 'vendor'; } //$params = JComponentHelper::getParams('com_languages'); jimport('joomla.language.helper'); $this->lang = JRequest::getVar('vmlang', $lang); $languages = JLanguageHelper::createLanguageList($selectedLangue, constant('JPATH_SITE'), true); $activeVmLangs = vmconfig::get('active_languages'); foreach ($languages as $k => &$joomlaLang) { if (!in_array($joomlaLang['value'], $activeVmLangs)) { unset($languages[$k]); } } $this->langList = JHTML::_('select.genericlist', $languages, 'vmlang', 'class="inputbox"', 'value', 'text', $selectedLangue, 'vmlang'); $token = JSession::getFormToken(); $j = ' jQuery(function($) { var oldflag = ""; $("select#vmlang").chosen().change(function() { langCode = $(this).val(); flagClass = "flag-"+langCode.substr(0,2) ; $.getJSON( "index.php?option=com_virtuemart&view=translate&task=paste&format=json&lg="+langCode+"&id=' . $id . '&editView=' . $editView . '&' . $token . '=1' . $this->tmpl . '" , function(data) { var items = []; if (data.fields !== "error" ) { if (data.structure == "empty") alert(data.msg); $.each(data.fields , function(key, val) { cible = jQuery("#"+key); if (oldflag !== "") cible.parent().removeClass(oldflag) if (cible.parent().addClass(flagClass).children().hasClass("mce_editable") && data.structure !== "empty" ) { if (tinyMCE.execInstanceCommand) tinyMCE.execInstanceCommand(key,"mceSetContent",false,val); else tinymce.editors[key].setContent(val); } else if (data.structure !== "empty") cible.val(val); }); oldflag = flagClass ; } else alert(data.msg); } ) }); })'; $document->addScriptDeclaration($j); } else { // $params = JComponentHelper::getParams('com_languages'); // $lang = $params->get('site', 'en-GB'); $jlang = JFactory::getLanguage(); $langs = $jlang->getKnownLanguages(); $defautName = $langs[$selectedLangue]['name']; $flagImg = JURI::root(true) . '/administrator/components/com_virtuemart/assets/images/flag/' . substr($lang, 0, 2) . '.png'; $this->langList = '<input name ="vmlang" type="hidden" value="' . $selectedLangue . '" ><img style="vertical-align: middle;" alt="' . $defautName . '" src="' . $flagImg . '"> <b> ' . $defautName . '</b>'; $this->lang = $lang; } //I absolutly do not understand for that should be for, note by Max /* if ($object) { if(Vmconfig::get('multix','none')!=='none'){ $this->loadHelper('permissions'); if(!Permissions::getInstance()->check('admin')) { if (!$object->virtuemart_vendor_id) { if(!class_exists('VirtueMartModelVendor')) require(JPATH_VM_ADMINISTRATOR.DS.'models'.DS.'vendor.php'); $object->virtuemart_vendor_id = VirtueMartModelVendor::getLoggedVendor(); } $vendorList = '<input type="hidden" name="virtuemart_vendor_id" value="'.$object->virtuemart_vendor_id.'" />'; } else $vendorList= ShopFunctions::renderVendorList($object->virtuemart_vendor_id,false); } else { $vendorList = '<input type="hidden" name="virtuemart_vendor_id" value="1" />'; } $this->assignRef('vendorList', $vendorList); }*/ }
/** * @param $post_variables * @return string */ function getConfirmedHtml($post_variables) { $pbxServer = $this->getPayboxServerUrl(); // add spin image $html = ''; if ($this->_method->debug) { $html .= '<form action="' . $pbxServer . '" method="post" name="vm_paybox_form" target="paybox">'; } else { if (vmconfig::get('css')) { $msg = vmText::_('VMPAYMENT_PAYBOX_REDIRECT_MESSAGE', true); } else { $msg = ''; } vmJsApi::addJScript('vm.paymentFormAutoSubmit', ' jQuery(document).ready(function($){ jQuery("body").addClass("vmLoading"); var msg="' . $msg . '"; jQuery("body").append("<div class=\\"vmLoadingDiv\\"><div class=\\"vmLoadingDivMsg\\">"+msg+"</div></div>"); jQuery("#vmPaymentForm").submit(); }) '); $html .= '<form action="' . $pbxServer . '" method="post" name="vm_paybox_form" id="vmPaymentForm">'; } foreach ($post_variables as $name => $value) { $html .= '<input type="hidden" name="' . $name . '" value="' . $value . '" />'; } if ($this->_method->debug) { $this->plugin->debugLog($this->_method->virtuemart_paymentmethod_id, 'sendPostRequest: payment method', 'debug'); $this->plugin->debugLog($pbxServer, 'sendPostRequest: Server', 'debug'); $html .= '<div style="background-color:red;color:white;padding:10px;"> <input type="submit" value="The method is in debug mode. Click here to be redirected to Paybox" /> </div>'; $this->plugin->debugLog($post_variables, 'sendPostRequest:', 'debug'); } else { $html .= '<input type="submit" value="' . vmText::_('VMPAYMENT_PAYBOX_REDIRECT_MESSAGE') . '" />'; } $html .= '</form>'; return $html; }
/** * @param $post_variables * @return string */ function getConfirmedHtml($post_variables, $interface, $subscribe_id = NULL) { $server = $interface->getKlikandpayServerUrl($subscribe_id); $this->debugLog(var_export($post_variables, true), 'getConfirmedHtml', 'debug', false); if (vmconfig::get('css')) { $msg = vmText::_('VMPAYMENT_KLIKANDPAY_REDIRECT_MESSAGE', true); } else { $msg = ''; } vmJsApi::addJScript('vm.paymentFormAutoSubmit', ' jQuery(document).ready(function($){ jQuery("body").addClass("vmLoading"); var msg="' . $msg . '"; jQuery("body").append("<div class=\\"vmLoadingDiv\\"><div class=\\"vmLoadingDivMsg\\">"+msg+"</div></div>"); jQuery("#vmPaymentForm").submit(); }) '); $html = ''; if ($this->_method->debug) { $html .= '<form action="' . $server . '" method="post" name="vm_klikandpay_form" target="paypal">'; } else { $html .= '<form action="' . $server . '" method="post" name="vm_klikandpay_form" id="vmPaymentForm" accept-charset="UTF-8">'; } $html .= '<input type="hidden" name="charset" value="utf-8">'; foreach ($post_variables as $name => $value) { $html .= '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value) . '" />'; } if ($this->_method->debug) { $html .= '<div style="background-color:red;color:white;padding:10px;"> <input type="submit" value="The method is in debug mode. Click here to be redirected to PayPal" /> </div>'; $this->debugLog($post_variables, 'getConfirmedHtml:', 'debug'); } else { $html .= '<input type="submit" value="' . vmText::_('VMPAYMENT_PAYPAL_REDIRECT_MESSAGE') . '" />'; } $html .= '</form>'; return $html; }
private function lSelectPayment() { $cart = $this->cart; $cart->prepareAddressFieldsInCart(); if (empty($cart->BT['virtuemart_country_id'])) { if (count($cart->BTaddress['fields'])) { if (!empty($cart->BTaddress['fields']["virtuemart_country_id"]["virtuemart_country_id"])) { $post['virtuemart_country_id'] = $cart->BTaddress['fields']["virtuemart_country_id"]["virtuemart_country_id"]; $cart->saveAddressInCart($post, 'BT'); } } } $paymentModel = VmModel::getModel('Paymentmethod'); $payments = $paymentModel->getPayments(true, false); $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select('virtuemart_paymentmethod_id'); $query->from('#__virtuemart_paymentmethods'); $query->where("payment_element='klarna_checkout_onepage'"); $query->where("published=1"); $db->setQuery($query); $pmid = $db->loadResult(); $klarnapaymentid = 0; if ($pmid > 0) { $klarnapaymentid = $pmid; } if ($cart->virtuemart_paymentmethod_id == 0) { if (vmconfig::get("set_automatic_payment") > 0) { $cart->virtuemart_paymentmethod_id = vmconfig::get("set_automatic_payment"); } else { if ($pmid > 0) { $cart->virtuemart_paymentmethod_id = $pmid; } else { if (count($payments) > 0) { foreach ($payments as $payment) { if ($payment->published == 1) { $cart->virtuemart_paymentmethod_id = $payment->virtuemart_paymentmethod_id; break; } } } } } } $this->payment_not_found_text = ''; $this->payments_payment_rates = array(); $this->found_payment_method = 0; assignpay: $selectedPayment = empty($cart->virtuemart_paymentmethod_id) ? 0 : $cart->virtuemart_paymentmethod_id; $this->assignRef('selectedPayment', $selectedPayment); $this->paymentplugins_payments = array(); if (!$this->checkPaymentMethodsConfigured()) { return; } if (!class_exists('vmPSPlugin')) { require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php'; } JPluginHelper::importPlugin('vmpayment'); $dispatcher = JDispatcher::getInstance(); $returnValues = $dispatcher->trigger('plgVmDisplayListFEPayment', array($cart, $selectedPayment, &$this->paymentplugins_payments)); $this->found_payment_method = count($this->paymentplugins_payments); if (!$this->found_payment_method) { $link = ''; // todo $this->payment_not_found_text = vmText::sprintf('COM_VIRTUEMART_CART_NO_PAYMENT_METHOD_PUBLIC', '<a href="' . $link . '" rel="nofollow">' . $link . '</a>'); } $ok = true; if ($this->found_payment_method == 0) { $validUserDataBT = $cart->validateUserData(); if ($validUserDataBT === -1) { if (VmConfig::get('oncheckout_opc', 1)) { $ok = false; } } } $paymentsarray = array(); $paymentsnew = array(); /* this code modified for one page generic to list payment in one page */ foreach ($this->paymentplugins_payments as $items) { /* this code modified for one page generic to list payment in one page */ if (is_array($items)) { foreach ($items as $item) { $paymentsarray[] = $item; $tmptext = ""; $tmptext = strip_tags($item, '<span><input><img>'); $tmptext = str_replace("error_div", "error_div opg-hidden ", $tmptext); $tmptext = str_replace(" /* */ Please enable JavaScript. ", "", $tmptext); $tmptext = str_replace("/*", "", $tmptext); $tmptext = str_replace("*/", "", $tmptext); $tmptext = str_replace("Please enable JavaScript.", "", $tmptext); $paymentsnew[] = $tmptext; } } else { $paymentsarray[] = $items; $tmptext = strip_tags($items, '<span><input><img>'); $tmptext = str_replace("error_div", "error_div opg-hidden ", $tmptext); $tmptext = str_replace(" /* */ Please enable JavaScript. ", "", $tmptext); $tmptext = str_replace("/*", "", $tmptext); $tmptext = str_replace("*/", "", $tmptext); $tmptext = str_replace("Please enable JavaScript.", "", $tmptext); $paymentsnew[] = $tmptext; } } $newpayid = array(); foreach ($paymentsnew as $rates) { $shiptext = explode('"', $rates); foreach ($shiptext as $key => $shiptxt) { if (strpos($shiptxt, "value") !== false) { $newkey = $key + 1; $newpayid[] = $shiptext[$newkey]; } } if (strpos($rates, "checked") !== false) { $paymentselected = true; } } if (!$paymentselected) { if (count($newpayid) > 0) { $cart->virtuemart_paymentmethod_id = $newpayid[0]; $selectedPayment = $newpayid[0]; $this->assignRef('selectedPayment', $selectedPayment); unset($this->paymentplugins_payments); goto assignpay; } } /* this code modified for one page generic to list payment in one page */ $this->assignRef('paymentplugins_paymentsnew', $paymentsnew); $this->assignRef('paymentplugins_payments', $paymentsarray); $this->assignRef('selectedPayment', $selectedPayment); $this->assignRef('klarnapaymentid', $klarnapaymentid); return $ok; }
} } if ($params->get('hide_onepayment', 0)) { $onepaymenthide = "yes"; } ?> <div id="payment_select" class="opg-width-1-1 opg-panel-box opg-margin-small-top <?php echo $paymenthideclass; ?> "> <input type="hidden" name="onepaymenthide" id="onepaymenthide" value="<?php echo $onepaymenthide; ?> " /> <input type="hidden" name="auto_paymentid" id="auto_paymentid" value="<?php echo vmconfig::get("set_automatic_payment"); ?> " /> <h3 class="opg-panel-title"><?php echo JText::_('COM_VIRTUEMART_CART_SELECTPAYMENT'); ?> </h3> <div id="payment_fulldiv" class="opg-width-1-1"> <?php $paymentsarr = $this->paymentplugins_paymentsnew; $paymentpresent = 0; foreach ($this->paymentplugins_paymentsnew as $tmppay) { $vmpayid = '"' . $this->cart->virtuemart_paymentmethod_id . '"'; if (strpos($tmppay, "checked") !== false) { $tmpdis = strip_tags($tmppay, '<span>'); echo '<table class="opg-table opg-table-striped" id="paymentable"><tr id="paymentrow"><td id="paymentdetails">';
/** * This displays a media handler. It displays the full and the thumb (icon) of the media. * It also gives a possibility to upload/change/thumbnail media * * @param string $imageArgs html atttributes, Just for displaying the fullsized image */ public function displayFileHandler() { VmConfig::loadJLang('com_virtuemart_media'); $identify = ''; // ':'.$this->virtuemart_media_id; $this->addHiddenByType(); $html = '<fieldset class="checkboxes">'; $html .= '<legend>' . JText::_('COM_VIRTUEMART_IMAGE_INFORMATION') . '</legend>'; $html .= '<div class="vm__img_autocrop">'; $imageArgs = 'id="vm_display_image" '; $html .= $this->displayMediaFull($imageArgs, false, '', false) . '</div>'; //This makes problems, when there is already a form, and there would be form in a form. breaks js in some browsers // $html .= '<form name="adminForm" id="adminForm" method="post" enctype="multipart/form-data">'; $html .= ' <table class="adminform"> '; if ($this->published || $this->virtuemart_media_id === 0) { $checked = 1; } else { $checked = 0; } $html .= '<tr>'; // The following was removed bacause the check box (publish/unpublish) was not functioning... // $this->media_published = $this->published; $html .= '<td class="labelcell"> <label for="published">' . JText::_('COM_VIRTUEMART_FILES_FORM_FILE_PUBLISHED') . '</label> </td> <td>'; if (!class_exists('VmHTML')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php'; } $html .= VmHTML::checkbox('media_published', $checked, 1, 0, 'class="inputbox"', 'media_published' . $identify); //<input type="checkbox" class="inputbox" id="media_published'.$identify.'" name="media_published'.$identify.'" '.$checked.' size="16" value="1" /> $html .= '</td>'; $html .= '<td rowspan = "8">'; $html .= JHTML::image($this->file_url_thumb, 'thumbnail', 'id="vm_thumb_image" style="overflow: auto; float: right;"'); // $html .= $this->displayMediaThumb('',false,'id="vm_thumb_image" style="overflow: auto; float: right;"'); $html .= '</td>'; $html .= '</tr>'; // $html .= '<tr> // <td class="labelcell">'. JText::_('COM_VIRTUEMART_FILES_FORM_CURRENT_FILE') .'</td> // <td>'.$this->file_name.'.'.$this->file_extension .'</td> // </tr>'; if (!class_exists('Permissions')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php'; } if (!Permissions::getInstance()->check('admin')) { $readonly = 'readonly'; } else { $readonly = ''; } $html .= $this->displayRow('COM_VIRTUEMART_FILES_FORM_FILE_TITLE', 'file_title'); $html .= $this->displayRow('COM_VIRTUEMART_FILES_FORM_FILE_DESCRIPTION', 'file_description'); $html .= $this->displayRow('COM_VIRTUEMART_FILES_FORM_FILE_META', 'file_meta'); $html .= $this->displayRow('COM_VIRTUEMART_FILES_FORM_FILE_URL', 'file_url', $readonly); //remove the file_url_thumb in case it is standard if (!empty($this->file_url_thumb) and is_a($this, 'VmImage')) { $file_url_thumb = $this->createThumbFileUrl(); //vmdebug('my displayFileHandler ',$this,$file_url_thumb); if ($this->file_url_thumb == $file_url_thumb) { $this->file_url_thumb = JText::sprintf('COM_VIRTUEMART_DEFAULT_URL', $file_url_thumb); } } $html .= $this->displayRow('COM_VIRTUEMART_FILES_FORM_FILE_URL_THUMB', 'file_url_thumb', $readonly); $this->addMediaAttributesByType(); $html .= '<tr> <td class="labelcell">' . JText::_('COM_VIRTUEMART_FILES_FORM_ROLE') . '</td> <td><fieldset class="checkboxes">' . JHTML::_('select.radiolist', $this->getOptions($this->_mRoles), 'media_roles' . $identify, '', 'value', 'text', $this->media_role) . '</fieldset></td></tr>'; // $html .= '<tr><td class="labelcell">'.VmHTML::checkbox('file_is_forSale', $this->file_is_forSale); // $html .= VmHTML::checkbox('file_is_downloadable', $this->file_is_downloadable); if (!empty($this->file_type)) { $html .= '<tr> <td class="labelcell">' . JText::_('COM_VIRTUEMART_FILES_FORM_LOCATION') . '</td> <td><fieldset class="checkboxes">' . JText::_('COM_VIRTUEMART_FORM_MEDIA_SET_' . strtoupper($this->file_type)) . '</fieldset></td></tr>'; } else { $mediaattribtemp = $this->media_attributes; if (empty($this->media_attributes)) { $mediaattribtemp = 'product'; } $html .= '<tr> <td class="labelcell">' . JText::_('COM_VIRTUEMART_FILES_FORM_LOCATION') . '</td> <td><fieldset class="checkboxes">' . JHTML::_('select.radiolist', $this->getOptions($this->_mLocation), 'media_attributes' . $identify, '', 'value', 'text', $mediaattribtemp) . '</fieldset></td></tr>'; } // select language for image if (count(vmconfig::get('active_languages')) > 1) { $selectedLangue = explode(",", $this->file_lang); $languages = JLanguageHelper::createLanguageList($selectedLangue, constant('JPATH_SITE'), true); $html .= '<tr> <td class="labelcell"><span class="hasTip" title="' . JText::_('COM_VIRTUEMART_FILES_FORM_LANGUAGE_TIP') . '">' . JText::_('COM_VIRTUEMART_FILES_FORM_LANGUAGE') . '</span></td> <td><fieldset class="inputbox">' . JHTML::_('select.genericlist', $languages, 'vmlangimg[]', 'size="10" multiple="multiple"', 'value', 'text', $selectedLangue) . '</fieldset></td> </tr>'; } $html .= '</table>'; $html .= '<br /></fieldset>'; $this->addMediaActionByType(); $html .= '<fieldset class="checkboxes">'; $html .= '<legend>' . JText::_('COM_VIRTUEMART_FILE_UPLOAD') . '</legend>'; $html .= JText::_('COM_VIRTUEMART_IMAGE_ACTION') . JHTML::_('select.radiolist', $this->getOptions($this->_actions), 'media_action' . $identify, '', 'value', 'text', 0) . '<br /><br style="clear:both" />'; $html .= JText::_('COM_VIRTUEMART_FILE_UPLOAD') . ' <input type="file" name="upload" id="upload" size="50" class="inputbox" /><br />'; $html .= '<br />' . $this->displaySupportedImageTypes(); $html .= '<br /></fieldset>'; $html .= $this->displayFoldersWriteAble(); $html .= $this->displayHidden(); // $html .= '</form>'; return $html; }
function getConfirmedHtml($vtweb_url, $interface, $subscribe_id = NULL) { // error_log('getConfirmedHtml'); // debug purpose if (vmconfig::get('css')) { $msg = vmText::_('Please wait while redirecting to VT-Web Veritrans', true); } else { $msg = ''; } vmJsApi::addJScript('vm.paymentFormAutoSubmit', ' jQuery(document).ready(function($){ jQuery("body").addClass("vmLoading"); var msg="' . $msg . '"; jQuery("body").append("<div class=\\"vmLoadingDiv\\"><div class=\\"vmLoadingDivMsg\\">"+msg+"</div></div>"); jQuery("#vmPaymentForm").submit(); window.location.href = "' . $vtweb_url . '"; }) '); $html = ''; $html .= '<form action="' . $vtweb_url . '" method="post" name="vm_veritrans_form" id="vmPaymentForm" accept-charset="UTF-8">'; $html .= '<input type="hidden" name="charset" value="utf-8">'; $html .= '<input type="submit" value="' . vmText::_('Please wait while redirecting to VT-Web Veritrans') . '" />'; $html .= '</form>'; return $html; }
/** * This displays a media handler. It displays the full and the thumb (icon) of the media. * It also gives a possibility to upload/change/thumbnail media * * @param string $imageArgs html atttributes, Just for displaying the fullsized image */ public function displayFileHandler() { if (!class_exists('VmHTML')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php'; } VmConfig::loadJLang('com_virtuemart_media'); $identify = ''; // ':'.$this->virtuemart_media_id; if (Permissions::getInstance()->isSuperVendor() > 1) { $params = JComponentHelper::getParams('com_virtuemart', true); $max_uploads = $params->get('max_uploads', 1); if (!$max_uploads) { return; } } $this->addHiddenByType(); $html = ' <div class="accordion-group"> <div class="accordion-heading"> <a class="accordion-toggle" data-toggle="collapse" href="#image_desc_accordion"> ' . JText::_('COM_VIRTUEMART_IMAGE_INFORMATION') . '<i class="pull-right icon icon-info-2"></i> </a> </div> <div id="image_desc_accordion" class="accordion-body collapse"> <div class="accordion-inner"> <div class="vm__img_autocrop"> ' . $this->displayMediaFull('id="vm_display_image" ', false, '', false) . ' </div> <div class="row-fluid"> <table class="adminform span6"> '; if ($this->published || $this->virtuemart_media_id === 0) { $checked = 1; } else { $checked = 0; } // The following was removed bacause the check box (publish/unpublish) was not functioning... // $this->media_published = $this->published; $html .= VmHTML::row('booleanlist', 'COM_VIRTUEMART_FILES_FORM_FILE_PUBLISHED', 'media_published', $checked); if (!$this->file_url_thumb) { $thumbnail = ''; } else { $thumbnail = 'src="' . juri::root() . $this->file_url_thumb . '"'; } $html .= VmHTML::row('raw', '<img ' . $thumbnail . ' alt="' . $this->file_meta . '" title="' . $this->file_meta . '" id="vm_thumb_image">', ''); if (!class_exists('Permissions')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php'; } if (!Permissions::getInstance()->check('admin')) { $readonly = 'readonly'; } else { $readonly = ''; } $html .= $this->displayRow('COM_VIRTUEMART_FILES_FORM_FILE_TITLE', 'file_title'); $html .= $this->displayRow('COM_VIRTUEMART_FILES_FORM_FILE_DESCRIPTION', 'file_description'); $html .= $this->displayRow('COM_VIRTUEMART_FILES_FORM_FILE_META', 'file_meta'); $html .= '</table><table class="span6">'; $html .= $this->displayRow('COM_VIRTUEMART_FILES_FORM_FILE_URL', 'file_url', $readonly); //remove the file_url_thumb in case it is standard if (!empty($this->file_url_thumb) and is_a($this, 'VmImage')) { $file_url_thumb = $this->createThumbFileUrl(); //vmdebug('my displayFileHandler ',$this,$file_url_thumb); if ($this->file_url_thumb == $file_url_thumb) { $this->file_url_thumb = JText::sprintf('COM_VIRTUEMART_DEFAULT_URL', $file_url_thumb); } } $html .= $this->displayRow('COM_VIRTUEMART_FILES_FORM_FILE_URL_THUMB', 'file_url_thumb', $readonly); $this->addMediaAttributesByType(); $html .= ' <tr> <td class="key">' . JText::_('COM_VIRTUEMART_FILES_FORM_ROLE') . '</td> <td><fieldset class="checkboxes radio btn-group">' . JHTML::_('select.radiolist', $this->getOptions($this->_mRoles), 'media_roles' . $identify, '', 'value', 'text', $this->media_role) . '</fieldset> </td> </tr>'; // $html .= '<tr><td class="key">'.VmHTML::checkbox('file_is_forSale', $this->file_is_forSale); // $html .= VmHTML::checkbox('file_is_downloadable', $this->file_is_downloadable); if (!empty($this->file_type)) { $html .= ' <tr> <td class="key">' . JText::_('COM_VIRTUEMART_FILES_FORM_LOCATION') . '</td> <td><fieldset class="checkboxes radio">' . JText::_('COM_VIRTUEMART_FORM_MEDIA_SET_' . strtoupper($this->file_type)) . '</fieldset></td> </tr>'; } else { $mediaattribtemp = $this->media_attributes; if (empty($this->media_attributes)) { $mediaattribtemp = 'product'; } $html .= ' <tr> <td class="key">' . JText::_('COM_VIRTUEMART_FILES_FORM_LOCATION') . '</td> <td><fieldset class="checkboxes radio btn-group">' . JHTML::_('select.radiolist', $this->getOptions($this->_mLocation), 'media_attributes' . $identify, '', 'value', 'text', $mediaattribtemp) . '</fieldset> </td> </tr>'; } // select language for image if (count(vmconfig::get('active_languages')) > 1) { $selectedLangue = explode(",", $this->file_lang); $languages = JLanguageHelper::createLanguageList($selectedLangue, constant('JPATH_SITE'), true); $html .= ' <tr> <td class="key"><span class="hasTip" title="' . JText::_('COM_VIRTUEMART_FILES_FORM_LANGUAGE_TIP') . '">' . JText::_('COM_VIRTUEMART_FILES_FORM_LANGUAGE') . '</span></td> <td><fieldset class="inputbox">' . JHTML::_('select.genericlist', $languages, 'vmlangimg[]', 'size="10" multiple="multiple"', 'value', 'text', $selectedLangue) . '</fieldset></td> </tr>'; } $html .= ' </table> </div> </div> </div> </div>'; $this->addMediaActionByType(); $html .= ' <div class="accordion-group"> <div class="accordion-heading"> <a class="accordion-toggle" data-toggle="collapse" href="#image_upload_accordeon"> ' . JText::_('COM_VIRTUEMART_FILE_UPLOAD') . '<i class="pull-right icon icon-plus"></i> </a> </div> <div id="image_upload_accordeon" class="accordion-body collapse"> <div class="accordion-inner"> <input type="file" name="uploads[]" id="uploads" multiple data-show-upload="false" data-show-caption="true"> ' . JText::_('COM_VIRTUEMART_IMAGE_ACTION') . ' <div class="checkboxes radio btn-group"> ' . JHTML::_('select.radiolist', $this->getOptions($this->_actions), 'media_action' . $identify, '', 'value', 'text', 0) . ' </div> <br style="clear:both" /> <br /> <small>' . $this->displaySupportedImageTypes() . '</small><br /> </div> </div> </div>'; $html .= $this->displayFoldersWriteAble(); $html .= $this->displayHidden(); // $html .= '</form>'; return $html; }