diff --git a/css/profile_freelist.css b/css/profile_freelist.css --- a/css/profile_freelist.css +++ b/css/profile_freelist.css @@ -1,47 +1,50 @@ .field.field-block-content--body.field-name-body.field-type-text-with-summary.field-label-hidden.quickedit-field{ margin-top: -55px; } -section#block-openxadsp7{ +#openx-zone-7 img{ margin-top: 55px; } +#aw0 .img_ad{ + width: 100%!important; +} .typ-profile-sidebar{ margin-left: 0px !important; } .typ-profile-sidebar{ width: 310px; } .profile_share img{ width: 90px; height: 28px; } .nav-tabs > li.active > a, .nav-tabs > li.active > a:focus, .nav-tabs > li.active > a:hover{ background-color: #FFDE00 !important; color: #000000 !important; } .nav-tabs>li>a{ border: 1px solid #DDDDDD !important; color: #000000 !important; } .profile_share{ border: 1px solid #DDDDDD; padding: 15px; } .profile_share_title_promotion{ background-color: #4e4e4e; margin-bottom: 2px; color: #f5cc22 !important; padding: 10px; } .profile_share_title_promotion > a > span{ margin-left: 8px; color: #f5cc22 !important; } .profile_share_title_promotion:hover{ background-color: rgba(78,78,78,0.8); } .profile_share_title{ margin-top: 12px; background-color: #f5cc22; color: #000 !important; padding: 10px; } \ No newline at end of file diff --git a/js/profile.js b/js/profile.js --- a/js/profile.js +++ b/js/profile.js @@ -1,35 +1,33 @@ var url= ''; (function ($, Drupal, drupalSettings) { })(jQuery, Drupal, drupalSettings); function print_content(){ var printContents = jQuery("#block-bootstrap-content").html(); var originalContents = document.body.innerHTML; document.body.innerHTML = printContents; window.print(); document.body.innerHTML = originalContents; } function hover_share(data){ var src = data.getAttribute('src'); var hover = src.replace("1","2"); data.setAttribute('src',hover); } function out_share(data){ var src = data.getAttribute('src'); var hover = src.replace("2","1"); data.setAttribute('src',hover); } function sendmail(obj){ - // Create Base64 Object - var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(f>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");var t="";for(var n=0;n127&&r<2048){t+=String.fromCharCode(r>>6|192);t+=String.fromCharCode(r&63|128)}else{t+=String.fromCharCode(r>>12|224);t+=String.fromCharCode(r>>6&63|128);t+=String.fromCharCode(r&63|128)}}return t},_utf8_decode:function(e){var t="";var n=0;var r=c1=c2=0;while(n191&&r<224){c2=e.charCodeAt(n+1);t+=String.fromCharCode((r&31)<<6|c2&63);n+=2}else{c2=e.charCodeAt(n+1);c3=e.charCodeAt(n+2);t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);n+=3}}return t}} var data = jQuery(obj).attr('data-value'); var data_from = jQuery(obj).attr('data-from'); - var from = Base64.decode(data_from); - var content = Base64.decode(data); console.log(content); + var from = data_from; + var content = data; var link = "mailto:email@address.com" + "?subject="+from + "&body="+content; window.location.href = link; } \ No newline at end of file diff --git a/src/Plugin/Block/TYPProfileShareBlock.php b/src/Plugin/Block/TYPProfileShareBlock.php --- a/src/Plugin/Block/TYPProfileShareBlock.php +++ b/src/Plugin/Block/TYPProfileShareBlock.php @@ -1,1 +1,1 @@ -getRequestUri(); $language = \Drupal::languageManager()->getCurrentLanguage()->getId(); $s = explode("/",$url); $bid = end($s); $this->data = \Drupal::service("typ.search")->getProfile($bid ,AUTO); $this->result = \Drupal::service('typ.unvservice')->loadListing($this->data['customerid'],NULL); $type = $this->result['address'][$this->data['headingcode']][$this->data['addressid']]['customertype']; $prodesc = $this->result['address'][$this->data['headingcode']][$this->data['addressid']][$language]['proddesc']; $telno = '';$fax = '';$workinghours = ''; if(!empty($this->result['accounting_status']) || $type == 'FL'){ $type = 'FL'; } if (!empty($this->data['telno'])) { foreach ($this->data['telno'] as $t) { $telno .= TYPProfileController::FormatPhoneNumber($t); } } if (!empty($this->data['fax'])) { foreach ($this->data['fax'] as $t) { $fax .= TYPProfileController::FormatPhoneNumber($t); } } if (!empty($this->data['workinghours'])) { $workinghours .= $this->formatWorkingHour($this->data['workinghours']); } $body_email = $this->data['humanname'].'%0A%0A'.$prodesc.'%0A%0A'."http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; switch ($type){ case "FL": $email = $body_email; $facebook = 'https://www.facebook.com/sharer/sharer.php?u='.format_string($this->data['proddesc']).$fullurl; $twitter = format_string($this->data['proddesc']).$fullurl; $gplus = 'https://plus.google.com/share?url='.$fullurl; break; default: $email = $body_email; $facebook = 'https://www.facebook.com/sharer/sharer.php?u='.format_string($this->data['proddesc']).$fullurl; $twitter = format_string($this->data['proddesc']).$fullurl; $gplus = 'https://plus.google.com/share?url='.$fullurl; } $base_url_images = '/themes/bootstrap/typ/images/icon-service-profilepage/'.$language; $email = base64_encode($email); header('Content-Type: text/html; charset=UTF-8'); $build = array(); $build[] = array( '#markup' => format_string('
'.t('Share this business here').'
'), ); $build['#attached']['library'] = array( 'typ_profile/profile_share' ); return $build; } } ?> \ No newline at end of file +getRequestUri(); $language = \Drupal::languageManager()->getCurrentLanguage()->getId(); $s = explode("/",$url); $bid = end($s); $this->data = \Drupal::service("typ.search")->getProfile($bid ,AUTO); $this->result = \Drupal::service('typ.unvservice')->loadListing($this->data['customerid'],NULL); $type = $this->result['address'][$this->data['headingcode']][$this->data['addressid']]['customertype']; $prodesc = $this->result['address'][$this->data['headingcode']][$this->data['addressid']][$language]['proddesc']; $telno = '';$fax = '';$workinghours = ''; if(!empty($this->result['accounting_status']) || $type == 'FL'){ $type = 'FL'; } if (!empty($this->data['telno'])) { foreach ($this->data['telno'] as $t) { $telno .= TYPProfileController::FormatPhoneNumber($t); } } if (!empty($this->data['fax'])) { foreach ($this->data['fax'] as $t) { $fax .= TYPProfileController::FormatPhoneNumber($t); } } if (!empty($this->data['workinghours'])) { $workinghours .= $this->formatWorkingHour($this->data['workinghours']); } $body_email = strip_tags($this->data['humanname']).'%0A%0A'.strip_tags($prodesc).'%0A%0A'."http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; switch ($type){ case "FL": $email = $body_email; $facebook = 'https://www.facebook.com/sharer/sharer.php?u='.format_string($this->data['proddesc']).$fullurl; $twitter = format_string($this->data['proddesc']).$fullurl; $gplus = 'https://plus.google.com/share?url='.$fullurl; break; default: $email = $body_email; $facebook = 'https://www.facebook.com/sharer/sharer.php?u='.format_string($this->data['proddesc']).$fullurl; $twitter = format_string($this->data['proddesc']).$fullurl; $gplus = 'https://plus.google.com/share?url='.$fullurl; } $base_url_images = '/themes/bootstrap/typ/images/icon-service-profilepage/'.$language; header('Content-Type: text/html; charset=UTF-8'); $build = array(); $build[] = array( '#markup' => format_string('
'.t('If you own this business contact here').'
'.t('Total Promotion').'
'.t('Share this business here').'
'), ); $build['#attached']['library'] = array( 'typ_profile/profile_share' ); return $build; } } ?> \ No newline at end of file diff --git a/templates/typ-profile.html.twig b/templates/typ-profile.html.twig --- a/templates/typ-profile.html.twig +++ b/templates/typ-profile.html.twig @@ -1,458 +1,460 @@ {% set base_images = 'http://media.yellowpages.co.th/yellowpages' %} {% set base_promotion = 'http://promotion.yellowpages.co.th/media/promotion/' %}
-
+
{#{% if profile.logo %}#} {#
#} {##} {#
#} {#{% else %}#} {#
#} {##} {#
#} {#{% endif %}#}

{{ profile.humanname|raw }}

{% trans %}Category{% endtrans %} : {{ profile.headingname|raw }}

{% if type != 'FL' %} {% endif %} -
+
{% if type != 'FL' %} {{ profile.profile|raw}} - {% if profile.profile %}

{% endif %} + {% if profile.profile %}
{% endif %} {% else %} {{ profile.profile|raw|slice(0, 100)}}{% if profile.profile|length > 100 %}{{ '...

' }}{% endif %} - {% if profile.profile %}

{% endif %} + {% if profile.profile %}
{% endif %} {% endif %} {#{% if not profile.addr %}{% else %}#} {#{% trans %} Address {% endtrans %}#} {#{{ [profile.addr,profile.soi,profile.road,profile.subdistrictname,#} {#profile.districtname,profile.cityname,profile.postcode]|join(' ') }}#} {#{% endif %}#} {#{% if profile.location.lat %}#} {#
#} {#{% else %}#} {#
#} {#{% endif %}#}
{% if not profile.addr %}{% else %} - + {% endif %} {% if not profile.telno %}{% else %} - + {% endif %} {% if not profile.fax %}{% else %} {% endif %} {% if not profile.email %}{% else %} - + {% endif %} {% if not profile.website %}{% else %} - + {% endif %} {% if not profile.workinghours %}{% else %} - + {% endif %}
{% trans %} Address {% endtrans %}:{% trans %} Address {% endtrans %}: {{ [profile.addr,profile.soi,profile.road,profile.subdistrictname,profile.districtname,profile.cityname,profile.postcode]|join(' ') }}
{% trans %} Tel {% endtrans %}:{% trans %} Tel {% endtrans %}: {% if not profile.telno %} {% else %} {% if type == 'FL' %} {{ profile._format.telno.0 }}
{% else %} {% for key, tel in profile._format.telno %} {% if loop.last != key+1 %}{{ tel }}{{ "," }} {% else %}{{ tel }}{% endif %} {% endfor %}
{% endif %} {% endif %}
{% trans %} Fax {% endtrans %}: {% if not profile.fax %} {% else %} {% if type == 'FL' %} {{ profile._format.fax.0 }}
{% else %} {% for key, fax in profile._format.fax %} {% if loop.last != key+1 %}{{ fax }}{{ "," }} {% else %}{{ fax }}{% endif %} {% endfor %}
{% endif %} {% endif %}
{% trans %} Email {% endtrans %}:{% trans %} Email {% endtrans %}: {% if not profile.email %} {% else %} {% if type == 'FL' %} {% set email = profile.email|split(',') %} {% for key , mail in email %} {% if loop.last != key+1 %}{{ mail }},
{% else %}{{ mail }}
{% endif %} {% endfor %} {% else %} {% set email = profile.email|split(',') %} {% for key , mail in email %} {% if loop.last != key+1 %}{{ mail }},
{% else %}{{ mail }}
{% endif %} {% endfor %} {% endif %} {% endif %}
{% trans %} Website {% endtrans %}:{% trans %} Website {% endtrans %}: {% if not profile.website %} {% else %} {% set website = profile.website|split(',') %} {% if type == 'FL' %} {{ website.0 }} {% else %} {% for key , web in website %} {% if loop.last != key+1 %}{{ web }},
{% else %}{{ web }}
{% endif %} {% endfor %} {% endif %} {% endif %}
{% trans %} Work-Time {% endtrans %}:{% trans %} Work-Time {% endtrans %}: {% if not profile.workinghours %} {% else %} {{ profile._format.workinghours }}
{% endif %}
-
+
{% if type != 'FL' %} {% if not prodescription or prodescription is empty %} {% else %}
{% trans %} Product And Service {% endtrans %} {{ prodescription|raw }} {% if prodescription and profile.brandname %}
{% endif %} {% endif %} {% if not profile.brandname %} {% else %}
{% trans %} Banner {% endtrans %}
{{ profile.brandname|replace({"

":" ","

":" "}) }} {% endif %} {% endif %}

{# TAB #} {% if type == 'FL' %}
{% if promotion.promotionid %}
{% else %}
{% endif %} {#


#} {#{% if not profile.custname %}#} {#{% else %}#} {#{{ profile.custname|raw }} : แสดงความคิดเห็น#} {#{% endif %}#} {#

#} {# TAB #} {#
#} {##} {#
#} {##} {##} {#{##}#} {#
#} {#
#} {# END TAB #}