`ImpressPages PageImage Plugin dont't work - impresspages

I have problem with PageImage plugin.
After adding slot to my theme:
<?php echo ipSlot('pageImage'); ?> - image not displayed
Plugin created link to image:
<img src="file/2014/09/06/filename.png" alt="">
Maybe IP trying read file from:
http://testsite.com/pl/file/2014/09/06/filename.png
Maybe i have bad settings modrewrite?
Thanks in advance.

I have a fix for you. Does it work?
https://github.com/impresspages-plugins/PageImage/commit/b55e4a5ac1d17c65415aa0ee5d911fc3b39b57af

Related

Unable to drop image into TinyMCE

I am unable to drag an image into TinyMCE 5.7.0, it just makes an error "Dropped file type is not supported". Dragging and dropping into the image upload modal works fine, but into the main window does not. A similar question here had an answer that suggested setting block_unsupported_drop to false but all that does is make the image open in another tab.
Here is the contents of the fiddle
<script type="text/javascript">
tinymce.init({
selector: "textarea",
images_upload_url: '/upload/tinymce',
automatic_uploads: true,
image_file_types: 'jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp',
});
</script>
<form method="post" action="dump.php">
<textarea name="content"></textarea>
</form>
I created a fiddle that shows the problem https://fiddle.tiny.cloud/25haab
I actually found a commit in TinyMCE that says this version fixed the problem but evidently not. Thanks for any ideas.
Solve the drag and drop problem:
paste_data_images: true
But then you will have a lot of trouble with the path of the image, try to find out
images_upload_handler or images_upload_url

Vue cli image wont load with webpack

What am I doing?
I am using the intersection observer API to make lazy loading.
What have I tried?
I tried the code in a simple HTML page and it works perfect, but when I use the code in vue, the images won't load (local images). If I put a htttp source images (online images) it works perfect, too. I think this is a webpack error config. Am I right? How can I fix it?.
Whats the error?
When i use a local image the code doesnt work, if only change that src with something else like this image https://images.pexels.com/photos/69817/france-confectionery-raspberry-cake-fruit-69817.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940 the code WORKS, why i cant make it work with local images?
HTML AND SCRIPT
<template>
<div class="container" id="section3">
<span class="containerTitle">Galeria</span>
<div class="wrapper">
<img v-lazyload data-src="#assets/images/001.jpg" class="card">
</div>
</div>
</template>
<script>
import lazyload from '../directives/lazyload'
export default {
directives:{
lazyload
},
}
</script>
DIRECTIVE
export default{
inserted: el =>{
const options = {
// root:
rootMargin: '0px 0px 0px 0px',
threshold:1
}
var observer = new IntersectionObserver((entries,observer) =>{
entries.forEach(entry => {
if(entry.isIntersecting){
el.src = el.dataset.src
observer.unobserve(el)
console.log('intersecting');
}
})
},options)
observer.observe(el)
}
}
CODE IMAGE
FOLDER
The issue is with your image path.
You can fix it with either using public folder and give it in path.
You can also check for auto suggestion which come up while typing, this may help you to check whether your path is correct or not.
Like this
Your path is wrong. You gave ../assets/images/001.jpg as the path to the image (as stated in your question), but according to your directory tree it's ../assets/001.jpg (or write it like #/assets/001.jpg, # points to root of project). That should fix it.
As far as I remember you can't use # sign inside <template>.
So you can either:
require it
<img v-lazyload :data-src="require('#assets/images/001.jpg')" class="card">
import it
<template>
...
<img v-lazyload data-src="image" class="card">
...
</template>
<script>
import img from '#assets/images/001.jpg';
...
data() {
return {
image: img,
}
}
...
</script>
use relative path
<img v-lazyload data-src="../assets/images/001.jpg" class="card">
You can check how it works in Vue docs
I can't remember why this works, but you need to use the following syntax:
<img v-lazyload data-src="~assets/images/001.jpg" class="card">
with the ~ replacing the ../.
I will update the answer if I figure out exactly why.
doing extensive research i found this article about vuejs and static assets.
https://edicasoft.com/weblog/2018/04/27/static-vs-srcassets-webpack-template-vue-cli/
They said that this kind of problems occurs "because" of webpack,like i though, so the solution for this (i hope not the only solution), but this is the solution so far...
QUOTE
All asset URLs such as , background: url(...) and CSS #import are resolved by Webpack as module dependencies like require('./logo.png').
We then use loaders for Webpack, such as file-loader and url-loader, to process them. Webpack template has already configured these loaders.
File-loader helps to determine the final file location and how to name it using version hashes for better caching. Thus you can put your static assets near your .vue files and use relative paths. There is no need to put them strictly into the ‘assets’ folder.
Url-loader helps to conditionally inline assets such as base64 data URL, reducing the amount of HTTP requests.
So what the hell should I do with it?
The answer is: put your assets in the ‘src’ folder.
I tested this and it works perfect BUT you CANT make a subfolder and this for me, is disorganized.
This is the final folder structure to get this done using intersection observer api as vue directive!

Powered by Odoo footer

I need to change the "Powered" in "Powered by Odoo" footer to "Made",
So the footer of my Odoo (Formerly OpenERP) Version 8.0-aab3d9f will be "Made by Odoo"
any ideas??
Instead of changing directly in the core of odoo (which is not appreciated), you can create a new module that depends on web module.
Then you can extend template web.menu_secondary from webclient_templates.xml in web module, like this:
-> _ _openerp__.py file:
{
'name': "My Module",
# for the full list
'category': 'Web',
# any module necessary for this one to work correctly
'depends': ['web'],
# always loaded
'data': ['templates.xml'],
'demo': [],
}
-> templates.xml file:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="menu_secondary" inherit_id="web.menu_secondary">
<div class="oe_footer" position="replace">
<div class="oe_footer">
Made by <span>Odoo</span>
</div>
</div>
</template>
</data>
</openerp>
First go to your Odoo web module and open below file.
addons => web => views => webclient_templates.xml
Now find this tag <div class="oe_footer"> and edit it like
<div class="oe_footer">
Made by <span>Odoo</span>
</div>
Save it and refresh your browser. Hope you get what you want.
You can use the HTML Editor of the Website module to change your site's copyright footer:
Customize > HTML Editor
Website HTML Editor Footer Copyright
As this is a fast and clean way to accomplish what you're asking for, though changes will be saved directly to working database. If you want to replicate your changes in different databases, the best approach is to make a custom module.

$(...).tabs is not a function

I have this code on two pages on my site, but at one page the function doesn't work. Firebug shows me " $(...).tabs is not a function ". I don't understand why, can anyone tell me what is wrong ?
this is working:
http://www.invat-online.net/variante-rezolvate
this is not working:
http://www.invat-online.net/variante-explicate-limba-romana/varianta-01
Here is the code:
<div id="tabss">
<ul>
<li>Subiect I</li>
<li>Subiect II</li>
<li>Subiect III</li>
</ul>
<div id="SubiectI">content here</div>
<div id="SubiectII">content here</div>
<div id="SubiectIII">content here</div>
</div>
$(document).ready(function() {
$("#tabss").tabs();
});
You have relative paths to javascript files:
javascript/jquery-ui-1.9.2.custom.min.js
change them to absolute paths because you're using mod_rewrite module
/javascript/jquery-ui-1.9.2.custom.min.js
In first link the server is looking to the directory
http://www.invat-online.net/javascript/my_js_file.js (which exists)
but in the second one the path will be
http://www.invat-online.net/variante-explicate-limba-romana/javascript/my_js_file.js which do not exists
In my case:
I was using
jquery-ui-1.10.3.minimal.min.js
instead of
jquery-ui-1.10.3.custom.min.js
minimal version does not include ui.tabs.js, hence no ui.tabs function. Hope this helps someone else out there
The issue is that the jQuery UI js and css is not loading.
Try changing the path in you <script> tags to either the directory above ../javascript or the website root /javascript.
<script src="/javascript/head.min.js"></script>
<script src="/javascript/jquery-ui-1.9.2.custom.min.js"></script>
<link href="/stylesheets/smoothness/jquery-ui-1.9.2.custom.min.css" rel="stylesheet" />
Your first demo loads:
http://www.invat-online.net/javascript/jquery-ui-1.9.2.custom.min.js
Your second demo attempts to load:
http://www.invat-online.net/variante-explicate-limba-romana/javascript/jquery-ui-1.9.2.custom.min.js
The last one results in a 404. You should correct the path of the later, perhaps instructing it to find jQuery UI in one directory above the current: ../jquery-ui-1.9.2.custom.min.js.
Try this:
#section scripts{
$(document).ready(function() {
$("#tabss").tabs();
});
}
Put #Scripts.Render("~/bundles/jqueryui") in the <body></body> of your layout.cshtml
The error Uncaught TypeError: $(...).tabs is not a function may also be produced when in a Django project on the Admin area and using django-tabbed-admin under the following setup:
Django = 1.10.5
django-tabbed-admin=1.0.4
DEFAULT_JQUERY_UI_JS = 'tabbed_admin/js/jquery-ui-1.11.4.min.js'
The problem is that the code in jquery-ui-1.11.4.min.js for this Django lib is as follows:
/*! jQuery UI - v1.11.4 - 2015-07-27
(...)*/
jQuery = jQuery || django.jQuery.noConflict(false);
and the code on django-tabbed-admin uses it this way (change_form.html):
<script type="text/javascript">
(function($) {
$(window).scrollTop()
$('#tabs').tabs({
{% if add %}
// when adding, don't select a tab by default, we'll do it ourselves
// by finding the first available tab.
selected: -1
{% endif %}
});
(....)
})(django.jQuery);
</script>
<!-- end admin_tabs stuff -->
To sort this out this should be what would be passed in to the IIFE instead of the (django.jQuery) as above:
<script type="text/javascript">
(function($) {
(....)
})((typeof window.jQuery == 'undefined' && typeof window.django != 'undefined')
? django.jQuery
: jQuery)
</script>
<!-- end admin_tabs stuff -->
I've reported this issue in the project and created a PR with a fix for it. Waiting on it to be approved, so in the meantime you can sort it following my simple fix.
I hope this helps someone out there.
Check your page you might have loaded multiple versions of jQuery
I had the same problem, I realized that I had jquery and bootstrap css imports that enter in conflict each other. Take a look to the ones you have imported and reduce those imports to the minimum to see which is the conflict.
Here there is an example of how to implement it, I took that example and worked, then I adapted to my application:
for jquery 1.9 (click on view source to see the code)
http://jqueryui.com/tabs/
for jquery 1.8 (check the example at the end of the page)
http://api.jqueryui.com/1.8/tabs/
Hope it helps!

How to control where YII flashes are placed?

With YII Flashes you can do this:
Yii::app()->user->setFlash('success', "Data saved!");
However, when the flash appears on the page, it appears like so:
<div id="yw1">
<div class="alert in alert-block fade alert-info"><a class="close" data-dismiss="alert">×</a>
MESSAGE
</div>
</div>
How do I control WHERE this is placed? I don't see anything in layouts/main.php that controls this, yet they display?
They won't display anywhere unless you are calling them, a good example in the Yii default app is the site/contact view:
<?php if(Yii::app()->user->hasFlash('contact')): ?>
<div class="flash-success">
<?php echo Yii::app()->user->getFlash('contact'); ?>
</div>
<?php else: ?>
...
And the flash is set using the setFlash method
Yii::app()->user->setFlash('contact','Thank you for contacting us. We will respond to you as soon as possible.');
A possibility is that there may be a check in the Controller root class (protected/components/Controller.php), where someone may have written an init() function that checks for them. This would be called on every controller/action call so it may be there.
Another possibility is that whoever created the project edited the flash method in the framework folder (or possibly extended it), you could have a look there, it is in framework/web/auth/CWebUser.php
But as Mik said, try doing a text search in your project for getFlash or even just flash
I would do a textsearch on user->getFlashes() in your views folder. You can output the messages at any place with this
<?php
foreach(Yii::app()->user->getFlashes() as $key => $message) {
echo '<div class="flash-' . $key . '">' . $message . "</div>\n";
}
?>
You, the developer, need to display flash-messages. Yii does not do that for you.
You display them in a view, as shown by Eskimo and Mik, at a location of your own choosing . Yii could never do that, because Yii does not know the layout of your view.