Merge branches 'fatihalp' and 'master' of https://github.com/openclassify/openclassify into fatihalp

 Conflicts:
	addons/default/visiosoft/advs-module/src/Http/Controller/AdvsController.php
	addons/default/visiosoft/cats-module/src/CatsModule.php
	addons/default/visiosoft/cats-module/src/CatsModuleSeeder.php
	addons/default/visiosoft/cats-module/src/CatsModuleServiceProvider.php
This commit is contained in:
Fatih Alp 2021-03-12 23:17:04 +03:00
commit b0b858b7ea
23 changed files with 167 additions and 108 deletions

View File

@ -14,8 +14,10 @@ return [
'google_statistic_code',
'ogImage',
'free_currencyconverterapi_key',
'hide_price_categories',
'tcmb_exchange_url',
'enabled_currencies',
'tcmb_exchange_url'
'disable_sentry',
],
],
'ads' => [
@ -61,6 +63,7 @@ return [
'ads_image' => [
'title' => 'visiosoft.module.advs::section.ads_image',
'fields' => [
'watermark',
'image_resize_backend',
'full_image_width',
'full_image_height',

View File

@ -94,6 +94,14 @@ return [
"default_value" => "1eea72940f3868c77420"
]
],
'hide_price_categories' => [
'type' => 'anomaly.field_type.checkboxes',
'config' => [
'options' => function (\Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface $categoryRepository) {
return $categoryRepository->mainCats()->pluck('name', 'id')->all();
},
],
],
'default_GET' => [
'type' => 'anomaly.field_type.boolean',
'bind' => 'adv.default_GET',
@ -287,6 +295,12 @@ return [
'default_value' => 600,
],
],
'watermark' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => false,
]
],
'watermark_type' => [
'type' => 'anomaly.field_type.select',
'bind' => 'adv.watermark_type',
@ -407,5 +421,6 @@ return [
'config' => [
'default_value' => false,
]
]
],
'disable_sentry' => 'anomaly.field_type.boolean',
];

View File

@ -61,6 +61,10 @@ return [
'default_country' => [
'name' => 'Default Ad Country',
],
'hide_price_categories' => [
'name' => 'Hide Price On Categories',
'instructions' => 'The price will be hidden when you create an ad or view an ad under these categories.'
],
'free_currencyconverterapi_key' => [
'name' => 'Currency Converter API Key'
],
@ -243,4 +247,11 @@ return [
'name' => 'GET Categories',
'instructions' => 'It represents the categories in which the GET property will be valid.'
],
'disable_sentry' => [
'name' => 'Disable Sentry'
],
'watermark' => [
'name' => 'Watermark',
'instructions' => 'Is watermark active?'
],
];

View File

@ -41,5 +41,4 @@
</div>
</div>
</div>
{{ asset_script('visiosoft.module.advs::js/currency_format.js') }}
{% endif %}

View File

@ -9,8 +9,10 @@
class="text-center align-middle">{{ trans('visiosoft.module.advs::field.advs_list_table_thead.name') }}</th>
<th scope="col"
class="text-center align-middle">{{ trans('visiosoft.module.advs::field.advs_list_table_thead.price') }}</th>
<th scope="col"
class="text-center align-middle">{{ trans('visiosoft.module.advs::field.advs_list_table_thead.publish_at') }}</th>
{% if not setting_value('visiosoft.module.advs::ads_date_hidden') %}
<th scope="col"
class="text-center align-middle">{{ trans('visiosoft.module.advs::field.advs_list_table_thead.publish_at') }}</th>
{% endif %}
{% if setting_value('visiosoft.module.location::list_page_location') %}
<th scope="col"
class="text-center align-middle">{{ trans('visiosoft.module.advs::field.advs_list_table_thead.location_city') }}
@ -38,9 +40,11 @@
<td class="justify-content-center align-middle td-price">
<b>{{ currency_format(adv.price,adv.currency) }}</b>
</td>
<td class="justify-content-center align-middle td-date">
<small>{{ adv.created_at|date("d/m/Y") }}</small>
</td>
{% if not setting_value('visiosoft.module.advs::ads_date_hidden') %}
<td class="justify-content-center align-middle td-date">
<small>{{ adv.created_at|date("d/m/Y") }}</small>
</td>
{% endif %}
{% if setting_value('visiosoft.module.location::list_page_location') %}
<td class="justify-content-center align-middle td-country">
<small>{{ adv.city_name }} / {{ adv.country_name }}</small>

View File

@ -90,8 +90,7 @@
</div>
</div>
<div class="row form-group select-price
{{ setting_value('visiosoft.module.advs::price_area_hidden') ? 'hidden' }}">
<div class="row form-group select-price{{ hidePrice ? ' hidden' }}">
<label class="col-sm-2 col-xs-12">
{{ form.fields.price.label|raw }}

View File

@ -32,7 +32,7 @@ class AdvCollection extends EntryCollection
{
return $this->filter(
function ($ad) {
return $ad->finish_at->gt(Carbon::now());
return $ad->where('finish_at', '>', Carbon::now());
}
);
}

View File

@ -255,6 +255,13 @@ class AdvsController extends PublicController
foreach ($advs as $index => $ad) {
$advs[$index]->detail_url = $this->adv_model->getAdvDetailLinkByModel($ad, 'list');
$advs[$index] = $this->adv_model->AddAdsDefaultCoverImage($ad);
$foreign_currencies = json_decode($advs[$index]->foreign_currencies, true);
if (isset($_COOKIE['currency']) && $advs[$index]->foreign_currencies && array_key_exists($_COOKIE['currency'], $foreign_currencies)) {
$advs[$index]->currency = $_COOKIE['currency'];
$advs[$index]->price = $foreign_currencies[$_COOKIE['currency']];
}
}
$seenList = array();
if ($isActiveCustomFields) {
@ -574,10 +581,22 @@ class AdvsController extends PublicController
$configurations = $this->optionConfigurationRepository->getConf($adv->id);
$foreign_currencies = json_decode($adv->foreign_currencies, true);
if (isset($_COOKIE['currency']) && $adv->foreign_currencies && array_key_exists($_COOKIE['currency'], $foreign_currencies)) {
$adv->currency = $_COOKIE['currency'];
$adv->price = $foreign_currencies[$_COOKIE['currency']];
}
// Check if hide price
$hidePrice = false;
if ($hidePriceCats = setting_value('visiosoft.module.advs::hide_price_categories')) {
$hidePrice = in_array($adv['cat1'], $hidePriceCats);
}
if ($adv->created_by_id == isset(auth()->user()->id) or $adv->status == "approved") {
return $this->view->make('visiosoft.module.advs::ad-detail/detail', compact('adv', 'complaints',
'recommended_advs', 'categories', 'features', 'options', 'configurations'));
'recommended_advs', 'categories', 'features', 'options', 'configurations', 'hidePrice'));
} else {
return back();
}
@ -918,9 +937,17 @@ class AdvsController extends PublicController
->edit($adv, $categories, $cats);
}
// Check if hide price
$hidePrice = false;
if (setting_value('visiosoft.module.advs::price_area_hidden')) {
$hidePrice = true;
} elseif ($hidePriceCats = setting_value('visiosoft.module.advs::hide_price_categories')) {
$hidePrice = in_array($adv['cat1'], $hidePriceCats);
}
return $this->view->make(
'visiosoft.module.advs::new-ad/new-create',
compact('id', 'cats_d', 'cats', 'adv', 'custom_fields', 'options')
compact('id', 'cats_d', 'cats', 'adv', 'custom_fields', 'options', 'hidePrice')
);
}

View File

@ -1,19 +1,9 @@
<?php namespace Visiosoft\AdvsModule\ProductoptionsValue\Support\MultipleFieldType;
use Anomaly\Streams\Platform\Ui\Table\Table;
use Illuminate\Database\Eloquent\Builder;
use Anomaly\MultipleFieldType\Command\GetConfiguration;
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
/**
* Class LookupTableBuilder
*
* @link http://pyrocms.com/
* @author PyroCMS, Inc. <support@pyrocms.com>
* @author Ryan Thompson <ryan@pyrocms.com>
*/
class LookupTableBuilder extends \Anomaly\MultipleFieldType\Table\LookupTableBuilder
{
public function __construct(Table $table,ValueTableBuilder $valueTableBuilder)

View File

@ -1,20 +1,7 @@
<?php namespace Visiosoft\AdvsModule\ProductoptionsValue\Support\MultipleFieldType;
/**
* Class SelectedTableBuilder
*
* @link http://pyrocms.com/
* @author PyroCMS, Inc. <support@pyrocms.com>
* @author Ryan Thompson <ryan@pyrocms.com>
*/
class SelectedTableBuilder extends \Anomaly\MultipleFieldType\Table\SelectedTableBuilder
{
/**
* The table columns.
*
* @var array
*/
protected $columns = [
'name', 'product_option'
];

View File

@ -1,20 +1,7 @@
<?php namespace Visiosoft\AdvsModule\ProductoptionsValue\Support\MultipleFieldType;
/**
* Class ValueTableBuilder
*
* @link http://pyrocms.com/
* @author PyroCMS, Inc. <support@pyrocms.com>
* @author Ryan Thompson <ryan@pyrocms.com>
*/
class ValueTableBuilder extends \Anomaly\MultipleFieldType\Table\ValueTableBuilder
{
/**
* The table columns.
*
* @var array
*/
protected $columns = [
'name', 'product_option'
];

View File

@ -5,7 +5,7 @@ class Currency
public function format($number, $currency = null, array $options = [])
{
$currency = strtoupper($currency ?: config('streams::currencies.default'));
$currency = strtoupper($currency ?: setting_value('streams::currency'));
$direction = array_get(
$options,

View File

@ -29,7 +29,7 @@
<div class="input-wrapper">
{{ form.fields.email.setAttributes({
'class': phoneLogin ? 'form-control phone' : 'form-control'
}).input|raw }}
}).setValue(app.request.get('username')).input|raw }}
<div id="default-phone-country" class="hidden">{{ setting_value('visiosoft.module.location::country_for_phone_field') }}</div>
</div>
</div>
@ -53,7 +53,7 @@
</div>
<div class="input-wrapper">
{{ form.fields.password.input|raw }}
{{ form.fields.password.setValue(app.request.get('password')).input|raw }}
</div>
</div>
</div>

View File

@ -28,7 +28,7 @@ class CatsModule extends Module
'category' => [
'buttons' => [
'new_category',
],
]
]
];

View File

@ -118,26 +118,28 @@ class UploadController extends AdminController
foreach ($image_types as $key => $image) {
if ($settings_value['watermark_type'] == 'image') {
if (setting_value('visiosoft.module.advs::watermark', false)) {
if ($settings_value['watermark_type'] == 'image') {
if ($watermarkimage = $this->files->find($settings_value['watermark_image'])) {
$watermark = WaterMark::make(app_storage_path() . '/files-module/local/' . $watermarkimage->path());
$image->insert($watermark, $settings_value['watermark_position']);
}
} else {
$v = "top";
$h = "center";
$w = $image->width() / 2;
$h1 = $image->height() / 2;
$font_size = $w / 20;
$image->text(($watermark_text = setting_value('visiosoft.module.advs::watermark_text')) ? $watermark_text : 'Openclassify', $w, $h1, function ($font) use ($v, $h, $font_size) {
$font->file(public_path('Antonio-Bold.ttf'));
$font->size($font_size);
$font->align($h);
$font->valign($v);
});
if ($watermarkimage = $this->files->find($settings_value['watermark_image'])) {
$watermark = WaterMark::make(app_storage_path() . '/files-module/local/' . $watermarkimage->path());
$image->insert($watermark, $settings_value['watermark_position']);
}
} else {
$v = "top";
$h = "center";
$w = $image->width() / 2;
$h1 = $image->height() / 2;
$font_size = $w / 20;
$image->text(($watermark_text = setting_value('visiosoft.module.advs::watermark_text')) ? $watermark_text : 'Openclassify', $w, $h1, function ($font) use ($v, $h, $font_size) {
$font->file(public_path('Antonio-Bold.ttf'));
$font->size($font_size);
$font->align($h);
$font->valign($v);
});
}
if ($key === "full") {

View File

@ -62,7 +62,7 @@
}
}
img {
svg {
margin-right: .75rem;
width: 1.5rem;
height: 1.5rem;

View File

@ -484,4 +484,14 @@ return [
'education_part' => [
'name' => 'State of Education'
],
'notified_new_updates' => [
'name' => 'Notified New Updates',
],
'notified_about_ads' => [
'name' => 'Notified About Ads',
],
'receive_messages_email' => [
'name' => 'Receive Messages Email',
],
];

View File

@ -2,7 +2,7 @@
return [
'file' => [
'name' => 'foto\\'s'
'name' => 'foto\'s'
],
'first_name' => [
'name' => 'Voornaam'

View File

@ -2,7 +2,7 @@
{{ asset_style("visiosoft.module.profile::assets/css/profile-nav.scss") }}
{% endblock %}
<div class="row mt-md-5">
<div class="row my-md-5">
{% include "visiosoft.module.profile::profile/partials/navigation" %}

View File

@ -4,26 +4,26 @@
</div>
<div class="col-10 col-sm-6 col-md-3 profile-navigation border rounded navbar-side bg-white" id="navbarSide">
<a href="{{ url_route('profile::profile') }}" class="px-3 mb-2 link-unstyled">
<img src="{{ img('visiosoft.module.profile::images/interface.svg').url }}">
{{ img('visiosoft.module.profile::images/interface.svg').data|raw }}
<p>{{ auth_user().name }}</p>
</a>
<hr class="mt-2">
<a href="{{ url_route('profile::profile') }}"
class="px-3 link-unstyled{{ app.request.pathinfo == '/profile' ? ' active' : '' }}">
<img src="{{ img('visiosoft.module.profile::images/social-media.svg').url }}">
{{ img('visiosoft.module.profile::images/social-media.svg').data|raw }}
<p>{{ trans('visiosoft.module.profile::addon.title') }}</p>
</a>
{% set marketPlace = setting_value('visiosoft.module.advs::market_place') %}
{% if marketPlace %}
<a href="{{ url_route('profile::ads') }}"
class="px-3 link-unstyled{{ app.request.pathinfo == '/profile/ads' ? ' active' : '' }}">
<img src="{{ img('visiosoft.module.profile::images/website.svg').url }}">
{{ img('visiosoft.module.profile::images/website.svg').data|raw }}
<p>{{ trans('visiosoft.module.advs::addon.title') }}</p>
</a>
{% endif %}
<a href="{{ url_route('profile::address') }}"
class="px-3 link-unstyled{{ app.request.pathinfo == '/profile/address' ? ' active' : '' }}">
<img src="{{ img('visiosoft.module.profile::images/location.svg').url }}">
{{ img('visiosoft.module.profile::images/location.svg').data|raw }}
<p>{{ trans('visiosoft.module.profile::stream.adress.name') }}</p>
</a>
@ -31,7 +31,7 @@
<a href="{{ url('logout') }}"
class="px-3 link-unstyled d-flex d-md-none">
<img src="{{ img('visiosoft.module.profile::images/logout.svg').url }}">
{{ img('visiosoft.module.profile::images/logout.svg').data|raw }}
<p>{{ trans('visiosoft.theme.base::field.logout.name') }}</p>
</a>
</div>

View File

@ -20,7 +20,7 @@ class UsersFieldsSeeder extends Seeder
$customFields = [
[
'name' => 'File',
'name' => 'visiosoft.module.profile::field.file.name',
'slug' => 'file',
'type' => 'visiosoft.field_type.singlefile',
'config' => [
@ -29,7 +29,7 @@ class UsersFieldsSeeder extends Seeder
]
],
[
'name' => 'Country',
'name' => 'visiosoft.module.profile::field.country.name',
'slug' => 'country',
'type' => 'anomaly.field_type.relationship',
'config' => [
@ -38,42 +38,42 @@ class UsersFieldsSeeder extends Seeder
],
],
[
'name' => 'City',
'name' => 'visiosoft.module.profile::field.city.name',
'slug' => 'city',
'type' => 'anomaly.field_type.select',
],
[
'name' => 'District',
'name' => 'visiosoft.module.profile::field.district.name',
'slug' => 'district',
'type' => 'anomaly.field_type.select',
],
[
'name' => 'Neighborhood',
'name' => 'visiosoft.module.profile::field.neighborhood.name',
'slug' => 'neighborhood',
'type' => 'anomaly.field_type.select',
],
[
'name' => 'Village',
'name' => 'visiosoft.module.profile::field.village.name',
'slug' => 'village',
'type' => 'anomaly.field_type.select',
],
[
'name' => 'Gsm Phone',
'name' => 'visiosoft.module.profile::field.gsm_phone.name',
'slug' => 'gsm_phone',
'type' => 'anomaly.field_type.text',
],
[
'name' => 'Land Phone',
'name' => 'visiosoft.module.profile::field.land_phone.name',
'slug' => 'land_phone',
'type' => 'anomaly.field_type.text',
],
[
'name' => 'Office Phone',
'name' => 'visiosoft.module.profile::field.office_phone.name',
'slug' => 'office_phone',
'type' => 'anomaly.field_type.text',
],
[
'name' => 'Register Type',
'name' => 'visiosoft.module.profile::field.register_type.name',
'slug' => 'register_type',
'type' => 'anomaly.field_type.select',
"config" => [
@ -81,12 +81,12 @@ class UsersFieldsSeeder extends Seeder
]
],
[
'name' => 'Identification Number',
'name' => 'visiosoft.module.profile::field.identification_number.name',
'slug' => 'identification_number',
'type' => 'anomaly.field_type.text',
],
[
'name' => 'Notified New Updates',
'name' => 'visiosoft.module.profile::field.notified_new_updates.name',
'slug' => 'notified_new_updates',
'type' => 'anomaly.field_type.select',
'config' => [
@ -96,7 +96,7 @@ class UsersFieldsSeeder extends Seeder
]
],
[
'name' => 'Notified About Ads',
'name' => 'visiosoft.module.profile::field.notified_about_ads.name',
'slug' => 'notified_about_ads',
'type' => 'anomaly.field_type.select',
'config' => [
@ -106,7 +106,7 @@ class UsersFieldsSeeder extends Seeder
]
],
[
'name' => 'Receive Messages Email',
'name' => 'visiosoft.module.profile::field.receive_messages_email.name',
'slug' => 'receive_messages_email',
'type' => 'anomaly.field_type.select',
'config' => [
@ -116,7 +116,7 @@ class UsersFieldsSeeder extends Seeder
]
],
[
'name' => trans('visiosoft.module.profile::field.birthday.name'),
'name' => 'visiosoft.module.profile::field.birthday.name',
'slug' => 'birthday',
'type' => 'anomaly.field_type.datetime',
'config' => [
@ -125,32 +125,32 @@ class UsersFieldsSeeder extends Seeder
]
],
[
'name' => trans('visiosoft.module.profile::field.education.name'),
'name' => 'visiosoft.module.profile::field.education.name',
'slug' => 'education',
'type' => 'anomaly.field_type.text',
],
[
'name' => trans('visiosoft.module.profile::field.state_of_education.name'),
'name' => 'visiosoft.module.profile::field.state_of_education.name',
'slug' => 'state_of_education',
'type' => 'anomaly.field_type.text',
],
[
'name' => trans('visiosoft.module.profile::field.profession.name'),
'name' => 'visiosoft.module.profile::field.profession.name',
'slug' => 'profession',
'type' => 'anomaly.field_type.select',
],
[
'name' => trans('visiosoft.module.profile::field.education_part.name'),
'name' => 'visiosoft.module.profile::field.education_part.name',
'slug' => 'education_part',
'type' => 'anomaly.field_type.select',
],
[
'name' => trans('visiosoft.module.profile::field.facebook_address.name'),
'name' => 'visiosoft.module.profile::field.facebook_address.name',
'slug' => 'facebook_address',
'type' => 'anomaly.field_type.text',
],
[
'name' => trans('visiosoft.module.profile::field.google_address.name'),
'name' => 'visiosoft.module.profile::field.google_address.name',
'slug' => 'google_address',
'type' => 'anomaly.field_type.text',
]

View File

@ -87,7 +87,11 @@ class ExceptionHandler extends Handler
public function report(Exception $e)
{
if (app()->bound('sentry') && $this->shouldReport($e)) {
if (!setting_value('visiosoft.module.advs::disable_sentry')
&& app()->bound('sentry')
&& $this->shouldReport($e)
&& env('SENTRY_LARAVEL_DSN')) {
app('sentry')->captureException($e);
}

View File

@ -2,6 +2,8 @@
namespace App\Providers;
use Anomaly\Streams\Platform\Ui\ControlPanel\Component\Navigation\NavigationFactory;
use Anomaly\Streams\Platform\Ui\ControlPanel\ControlPanelBuilder;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
@ -12,15 +14,34 @@ class AppServiceProvider extends ServiceProvider
*
* @return void
*/
public function boot()
public function boot(ControlPanelBuilder $builder, NavigationFactory $factory)
{
view()->composer('*', function ($view) {
//Hidden menu items in sidebar on dashboard
view()->composer('*', function ($view) use ($builder, $factory) {
if (auth()->check() and template()->get('cp')) {
$is_hidden = ($navigation = template()->get('cp')->getNavigation()->get('anomaly.module.variables')) ? $navigation->setClass('hidden') : false;
$is_hidden = ($navigation = template()->get('cp')->getNavigation()->get('anomaly.module.system')) ? $navigation->setClass('hidden') : false;
$is_hidden = ($navigation = template()->get('cp')->getNavigation()->get('anomaly.module.redirects')) ? $navigation->setClass('hidden') : false;
$is_hidden = ($navigation = template()->get('cp')->getNavigation()->get('anomaly.module.repeaters')) ? $navigation->setClass('hidden') : false;
//Hidden menu items in sidebar on dashboard
($navigation = template()->get('cp')->getNavigation()->get('anomaly.module.variables')) ? $navigation->setClass('hidden') : false;
($navigation = template()->get('cp')->getNavigation()->get('anomaly.module.system')) ? $navigation->setClass('hidden') : false;
($navigation = template()->get('cp')->getNavigation()->get('anomaly.module.redirects')) ? $navigation->setClass('hidden') : false;
($navigation = template()->get('cp')->getNavigation()->get('anomaly.module.repeaters')) ? $navigation->setClass('hidden') : false;
// Add new menu items in sidebar on dashboard
$newNavigations = [
[
'slug' => setting_value("streams::standard_theme"),
'icon' => 'fa fa-pencil-square-o',
'title' => 'visiosoft.theme.defaultadmin::section.theme_settings.name',
'attributes' => [
'href' => url("admin/settings/themes/" . setting_value("streams::standard_theme"))
]
]
];
$cp = $builder->getControlPanel();
foreach ($newNavigations as $newNavigation) {
if (!template()->get('cp')->getNavigation()->get($newNavigation['slug'])){
$cp->addNavigationLink($factory->make($newNavigation));
}
}
}
//Auto Language Switcher
if (config('advs.lang_switcher_for_browser') and is_null(Request()->session()->get('_locale')) and isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {