Skip to content

Commit

Permalink
Merge branch 'master' into 37596-pdf-download-in-property-lists
Browse files Browse the repository at this point in the history
  • Loading branch information
yeneastgate authored Feb 23, 2024
2 parents 307dc9b + 7b8c00e commit c5ed492
Show file tree
Hide file tree
Showing 38 changed files with 804 additions and 117 deletions.
99 changes: 89 additions & 10 deletions css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ body.sticky-menu #onoffice-ajax #post-body.columns-2 #postbox-container-1 {
max-width: 500px;
}

#onoffice-ajax #poststuff #post-body-content {
width: 100%;
margin: 0;
}

#onoffice-ajax #poststuff #post-body.columns-2 #side-sortables {
width: 100%;
}
Expand Down Expand Up @@ -333,10 +328,7 @@ input#onoffice-input-submit {
border-width: 1px;
}

body #post-body-content .viewusage, body #post-body-content .wp-clearfix{
display: inline-block;
}
body #post-body-content p.wp-clearfix:nth-child(1){
body #post-head-content p.wp-clearfix:nth-child(1) {
display: block !important;
}
.button.button-copy{
Expand Down Expand Up @@ -547,6 +539,16 @@ body #post-body-content p.wp-clearfix:nth-child(1){
min-height: 30px;
}

.oo-poststuff .custom-input-field input[name=oopluginlistviews-countryactive]:checked::before,
.oo-poststuff .custom-input-field input[name=oopluginlistviews-radiusactive]:checked::before {
filter: brightness(0) saturate(100%) invert(35%) sepia(4%) saturate(967%) hue-rotate(170deg) brightness(91%) contrast(94%);
}

.oo-poststuff .custom-input-field input[name=oopluginlistviews-countryactive],
.oo-poststuff .custom-input-field input[name=oopluginlistviews-radiusactive] {
pointer-events: none;
}

#listSettings .custom-input-field,
#viewpicturetypes .custom-input-field {
display: block;
Expand All @@ -568,4 +570,81 @@ body #post-body-content p.wp-clearfix:nth-child(1){

.oo-poststuff .key-of-field-block {
display: flex;
}
}

.oo-poststuff .custom-input-field .onoffice-input-radio {
border-radius: 4px;
width: 50%;
display: grid;
float: left;
justify-content: initial;
border: 1px solid #8c8f94;
}

.oo-poststuff .custom-input-field .onoffice-input-radio label {
display: flex;
justify-content: space-between;
margin: 10px;
}

@media only screen and (max-width: 1365px) {
.block-publish .postbox-header {
display: none;
}
}

@media only screen and (min-width: 1366px) and (max-width: 1440px) {
.block-publish {
max-width: 230px !important;
}
}

@media only screen and (min-width: 1366px) {
.oo-poststuff {
display: block;
width: 100%;
}

.oo-poststuff #post-head-content {
max-width: 1000px;
width: 100%;
}

#onoffice-ajax #poststuff #post-body.columns-2 {
display: inline-block;
width: 100%;
}

.oo-poststuff-estate-detail .viewusage {
width: 100%;
}

.oo-poststuff-estate-detail .block-publish,
.oo-poststuff-similar-estate .block-publish {
margin-top: 0;
}

.block-publish {
width: calc(100% - 1000px);
max-width: 280px;
min-width: 200px;
border: 1px solid #c3c4c7;
box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
background: #fff;
display: inline-block;
position: fixed;
margin-left: 20px;
}

.block-publish .inside {
font-size: 13px;
margin: 0 !important;
padding: 0 !important;
}

.block-publish p.submit {
text-align: left;
padding: 10px 10px 10px 10px;
margin: 0 !important;
}
}
2 changes: 1 addition & 1 deletion dist/onoffice-default-form-values.min.js

Large diffs are not rendered by default.

62 changes: 59 additions & 3 deletions js/onoffice-default-form-values.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,49 @@ onOffice.default_values_input_converter = function () {
onOffice.default_values_inputs_converted.push(fieldName);
var fieldDefinition = getFieldDefinition(fieldName);

if (fieldDefinition.type === "urn:onoffice-de-ns:smart:2.5:dbAccess:dataType:tinyint") {
const parent = mainInput;
const element = document.createElement('fieldset');
const keys = Object.keys(fieldDefinition.permittedvalues).sort();
parent.name = 'oopluginfieldconfigformdefaultsvalues-value[' + fieldName + ']';

element.className = 'onoffice-input-radio';
keys.forEach(k => {
const mainInputClone = parent.cloneNode(true);
const label = document.createElement('label');
onOffice.js_field_count += 1;
mainInputClone.id = 'input_radio_js_' + onOffice.js_field_count;
mainInputClone.value = k;
label.textContent = fieldDefinition.permittedvalues[k];
if (k == onOffice_loc_settings.defaultvalues[fieldName]) {
mainInputClone.checked = true;
}
label.appendChild(mainInputClone);
element.appendChild(label);
parent.parentElement.appendChild(element);
});
const labels = parent.parentElement.getElementsByTagName('label')[1];
parent.parentElement.removeChild(labels);
mainInput.remove();
return;
}

if (!fieldDefinition.rangefield &&
[
'integer', 'float', 'date', 'datetime',
'urn:onoffice-de-ns:smart:2.5:dbAccess:dataType:float',
'urn:onoffice-de-ns:smart:2.5:dbAccess:dataType:int',
'urn:onoffice-de-ns:smart:2.5:dbAccess:dataType:integer',
'urn:onoffice-de-ns:smart:2.5:dbAccess:dataType:decimal'
'urn:onoffice-de-ns:smart:2.5:dbAccess:dataType:decimal',
'urn:onoffice-de-ns:smart:2.5:dbAccess:dataType:date',
'urn:onoffice-de-ns:smart:2.5:dbAccess:dataType:tinyint'
].indexOf(fieldDefinition.type) >= 0) {
if (fieldDefinition.type === 'date' || fieldDefinition.type === 'datetime') {
mainInput.setAttribute('type', 'text');
if (fieldDefinition.type === 'date' || fieldDefinition.type === 'urn:onoffice-de-ns:smart:2.5:dbAccess:dataType:date') {
mainInput.setAttribute('type', 'date');
}
if (fieldDefinition.type === 'datetime') {
mainInput.setAttribute('type', 'datetime-local');
mainInput.setAttribute('step', 1);
}
mainInput.name = 'oopluginfieldconfigformdefaultsvalues-value[' + fieldName + ']';
mainInput.value = predefinedValues[fieldName][0] || '';
Expand Down Expand Up @@ -286,6 +319,29 @@ document.addEventListener("addFieldItem", function(e) {
onOffice.js_field_count += 1;
select.options.selectedIndex = 0;
element.parentNode.replaceChild(select, element);
} else if (['urn:onoffice-de-ns:smart:2.5:dbAccess:dataType:tinyint'].indexOf(fieldDefinition.type) >= 0) {
const element = e.detail.item.querySelector('input[name^=oopluginfieldconfigformdefaultsvalues-value]');
const fieldset = document.createElement('fieldset');
const keys = Object.keys(fieldDefinition.permittedvalues).sort();
fieldset.className = 'onoffice-input-radio';
keys.forEach(function (k) {
const label = document.createElement('label');
const input = document.createElement('input');
input.name = 'oopluginfieldconfigformdefaultsvalues-value[' + fieldName + ']';
input.type = 'radio';
input.value = k;
input.className = 'onoffice-input';
onOffice.js_field_count += 1;
label.htmlFor = 'input_radio_js_' + onOffice.js_field_count;
label.textContent = fieldDefinition.permittedvalues[k];
if(k == onOffice_loc_settings.defaultvalues[fieldName]){
input.checked = true;
}
label.appendChild(input);
fieldset.appendChild(label);
});

element.parentNode.replaceChild(fieldset, element);
}

var paragraph = e.detail.item.querySelectorAll('.menu-item-settings p')[2];
Expand Down
11 changes: 8 additions & 3 deletions plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
Author: onOffice GmbH
Author URI: https://en.onoffice.com/
Description: Your connection to onOffice: This plugin enables you to have quick access to estates and forms – no additional sync with the software is needed. Consult support@onoffice.de for source code.
Version: 4.16
Version: 4.17
License: AGPL 3+
License URI: https://www.gnu.org/licenses/agpl-3.0
Text Domain: onoffice-for-wp-websites
Expand Down Expand Up @@ -77,6 +77,13 @@

$pAdminViewController = new AdminViewController();
$pDetailViewPostSaveController = $pDI->get(DetailViewPostSaveController::class);

add_action('save_post', [$pDetailViewPostSaveController, 'onSavePost']);
add_action('wp_trash_post', [$pDetailViewPostSaveController, 'onMoveTrash']);
if (is_admin() && isset($_GET['post']) && isset($_GET['action']) && $_GET['action'] === 'edit') {
return $pDI;
}

$pDI->get(ScriptLoaderRegistrator::class)->generate();

add_action('plugins_loaded', function() use ($pDI) {
Expand All @@ -99,8 +106,6 @@
add_action('admin_enqueue_scripts', [$pAdminViewController, 'enqueue_ajax']);
add_action('admin_enqueue_scripts', [$pAdminViewController, 'enqueue_css']);
add_action('admin_enqueue_scripts', [$pAdminViewController, 'enqueueExtraJs']);
add_action('save_post', [$pDetailViewPostSaveController, 'onSavePost']);
add_action('wp_trash_post', [$pDetailViewPostSaveController, 'onMoveTrash']);
add_action('oo_cache_cleanup', function() use ($pDI) {
$pDI->get(CacheHandler::class)->clean();
});
Expand Down
2 changes: 1 addition & 1 deletion plugin/Controller/AdminViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public function disableHideMetaboxes()
public function enqueue_css()
{
wp_enqueue_style('onoffice-admin-css',
plugins_url('/css/admin.css', ONOFFICE_PLUGIN_DIR.'/index.php'), array(), '4.2.0');
plugins_url('/css/admin.css', ONOFFICE_PLUGIN_DIR.'/index.php'));

wp_enqueue_style('chosen-admin-css',
plugins_url('/third_party/chosen/chosen.css', ONOFFICE_PLUGIN_DIR.'/index.php'));
Expand Down
1 change: 1 addition & 0 deletions plugin/Controller/GeoPositionFieldHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ private function getDefaultConfiguration(): array
$defaultActive = [
GeoPosition::ESTATE_LIST_SEARCH_ZIP,
GeoPosition::ESTATE_LIST_SEARCH_RADIUS,
GeoPosition::ESTATE_LIST_SEARCH_COUNTRY
];
$intersection = array_intersect_key($this->_booleanFields, array_flip($defaultActive));
return array_combine($intersection, array_fill(0, count($intersection), '1'));
Expand Down
24 changes: 24 additions & 0 deletions plugin/DataView/DataDetailView.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,21 @@ class DataDetailView
/** @var bool */
private $_showPriceOnRequest = false;

/** @var string[] */
private $_priceFields = [
'kaufpreis',
'erbpacht',
'nettokaltmiete',
'warmmiete',
'pacht',
'kaltmiete',
'miete_pauschal',
'saisonmiete',
'wochmietbto',
'kaufpreis_pro_qm',
'mietpreis_pro_qm',
];

/**
*
*/
Expand Down Expand Up @@ -353,4 +368,13 @@ public function getShowPriceOnRequest(): bool
/** @param bool $priceOnRequest */
public function setShowPriceOnRequest(bool $priceOnRequest)
{ $this->_showPriceOnRequest = $priceOnRequest; }


/**
* @return array
*/
public function getListFieldsShowPriceOnRequest(): array
{
return $this->_priceFields;
}
}
Loading

0 comments on commit c5ed492

Please sign in to comment.