diff --git a/addons/website_slides/__openerp__.py b/addons/website_slides/__openerp__.py index 2dfa3d9198b..0eb182f292b 100644 --- a/addons/website_slides/__openerp__.py +++ b/addons/website_slides/__openerp__.py @@ -14,7 +14,7 @@ Share and Publish Videos, Presentations and Documents' * Filters and Tagging * Statistics of Presentation * Channel Subscription - * Supported document types supported: PDF, images, YouTube videos and Google Drive documents) + * Supported document types : PDF, images, YouTube videos and Google Drive documents) """, 'depends': ['website', 'website_mail','marketing'], 'data': [ diff --git a/addons/website_slides/models/slides.py b/addons/website_slides/models/slides.py index 503d89e19d7..c62abddcc8e 100644 --- a/addons/website_slides/models/slides.py +++ b/addons/website_slides/models/slides.py @@ -213,7 +213,7 @@ class Slide(models.Model): _description = 'Slides' _PROMOTIONAL_FIELDS = [ - '__last_update', 'name', 'image_thumb', 'slide_type', 'total_views', 'category_id', + '__last_update', 'name', 'image_thumb', 'image_medium', 'slide_type', 'total_views', 'category_id', 'channel_id', 'description', 'tag_ids', 'write_date', 'create_date', 'website_published', 'website_url', 'website_meta_title', 'website_meta_description', 'website_meta_keywords'] @@ -359,13 +359,13 @@ class Slide(models.Model): def check_field_access_rights(self, operation, fields): """ As per channel access configuration (visibility) - public ==> no restriction on slides access - - private ==> restrict all slides of channel base on access group defined on channel group_ids field + - private ==> restrict all slides of channel based on access group defined on channel group_ids field - partial ==> show channel, but presentations based on groups means any user can see channel but not slide's content. For private: implement using record rule For partial: user can see channel, but channel gridview have slide detail so we have to implement partial field access mechanism for public user so he can have access of promotional field (name, view_count) of slides, but not all fields like data (actual pdf content) - all fields should be accessible only for user group define on channel group_ids + all fields should be accessible only for user group defined on channel group_ids """ if self.env.uid == SUPERUSER_ID: return fields or list(self._fields) diff --git a/addons/website_slides/static/description/index.html b/addons/website_slides/static/description/index.html index f6cd3ebc780..5bb8c8bf83b 100644 --- a/addons/website_slides/static/description/index.html +++ b/addons/website_slides/static/description/index.html @@ -13,7 +13,7 @@

Odoo presentations lets you upload files privately or publicly in the following file formats: PowerPoint, PDF, Keynote, Video or OpenDocument presentations.

-

This module originally meant to be used for businesses to share slides among employees more easily. It also provides users the ability to rate, comment, share the uploaded content and see detailed statistics like total views, web-views, embedded-views, likes and dislikes, total comments, total social-shares and shares on individual social site. +

This module is originally meant to be used by businesses to share slides among employees more easily. It also provides the users with the ability to rate, comment, share the uploaded content and see detailed statistics like total views, web-views, embedded-views, likes and dislikes, total comments, total social-shares and shares on individual social site.

Contact Us diff --git a/addons/website_slides/static/lib/pdfslidesviewer/PDFSlidesViewer.js b/addons/website_slides/static/lib/pdfslidesviewer/PDFSlidesViewer.js index a6d533e8cd0..48153085d32 100644 --- a/addons/website_slides/static/lib/pdfslidesviewer/PDFSlidesViewer.js +++ b/addons/website_slides/static/lib/pdfslidesviewer/PDFSlidesViewer.js @@ -145,26 +145,15 @@ var PDFSlidesViewer = (function(){ return this.queueRenderPage(this.pdf_page_total); } + PDFSlidesViewer.prototype.toggleFullScreenFooter = function(){ + if(document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement) { + $('div#PDFViewer > div.navbar-fixed-bottom').toggleClass('oe_show_footer'); + } + } + PDFSlidesViewer.prototype.toggleFullScreen = function(){ var el = this.canvas; - var $PDFViewer = $("div#PDFSlideViewer"); - var $navigation_footer = $('div#PDFViewer > div.navbar-fixed-bottom'); - - $(document).unbind('webkitfullscreenchange mozfullscreenchange fullscreenchange') - .bind('webkitfullscreenchange mozfullscreenchange fullscreenchange', function() { - var state = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen || document.msFullScreen; - if (!state) { - $navigation_footer.removeAttr('style'); - $PDFViewer.unbind('click'); - } else { - $navigation_footer.css('z-index', 2147483647); - $PDFViewer.on('click', function() { - $navigation_footer.fadeToggle(); - }); - } - }); - var isFullscreenAvailable = document.fullscreenEnabled || document.mozFullScreenEnabled || document.webkitFullscreenEnabled || document.msFullscreenEnabled || false; if(isFullscreenAvailable){ // Full screen supported // get the actual element in FullScreen mode (Null if no element) diff --git a/addons/website_slides/static/src/js/slides.js b/addons/website_slides/static/src/js/slides.js index f898e45ee76..71d20378044 100644 --- a/addons/website_slides/static/src/js/slides.js +++ b/addons/website_slides/static/src/js/slides.js @@ -152,35 +152,11 @@ $(document).ready(function () { var social_urls = { 'linkedin': 'https://www.linkedin.com/countserv/count/share?url=', 'twitter': 'https://cdn.api.twitter.com/1/urls/count.json?url=', - 'fb': 'https://graph.facebook.com/?id=', + 'facebook': 'https://graph.facebook.com/?id=', 'gplus': 'https://clients6.google.com/rpc' } - var socialgatter = function (app_url, url, callback) { - $.ajax({ - url: app_url + url, - dataType: 'jsonp', - success: callback - }); - }; + var update_statistics = function(social_site, slide_url) { - if (social_site == 'linkedin') { - socialgatter(social_urls['linkedin'], slide_url, function(data) { - $('#linkedin-badge').text(data.count || 0); - $('#total-share').text(parseInt($('#total-share').text()) + parseInt($('#linkedin-badge').text())); - }); - } - if (social_site == 'twitter') { - socialgatter(social_urls['twitter'], slide_url, function(data) { - $('#twitter-badge').text(data.count || 0); - $('#total-share').text(parseInt($('#total-share').text()) + parseInt($('#twitter-badge').text())); - }); - } - if (social_site == 'fb') { - socialgatter(social_urls['fb'], slide_url, function(data) { - $('#facebook-badge').text(data.shares || 0); - $('#total-share').text(parseInt($('#total-share').text()) + parseInt($('#facebook-badge').text())); - }); - } if (social_site == 'gplus') { $.ajax({ url: social_urls['gplus'], @@ -206,33 +182,37 @@ $(document).ready(function () { $('#total-share').text(parseInt($('#total-share').text()) + parseInt($('#google-badge').text())); }, }); + } else { + $.ajax({ + url: social_urls[social_site] + slide_url, + dataType: 'jsonp', + success: function(data) { + var shareCount = (social_site === 'facebook' ? data.shares : data.count) || 0; + $('#' + social_site + '-badge').text(shareCount); + $('#total-share').text(parseInt($('#total-share').text()) + parseInt($('#' + social_site+ '-badge').text())); + }, + }); } }; $.each(social_urls, function(key, value) { - update_statistics(key, slide_url) + update_statistics(key, slide_url); }); $("a.o_slides_social_share").on('click', function(ev) { ev.preventDefault(); var key = $(ev.currentTarget).attr('social-key'); - var win_url = $(ev.currentTarget).attr('href'); - var win = window.open( - win_url, + var popUpURL = $(ev.currentTarget).attr('href'); + var popUp = window.open( + popUpURL, 'Share Dialog', 'width=626,height=436'); - var interval = window.setInterval(function() { - try { - if (win.closed) { - window.clearInterval(interval); - setTimeout(function() { - update_statistics(key, slide_url); - }, 3000); - } - } catch (e) { - window.clearInterval(interval); + $(window).on('focus', function() { + if (popUp.closed) { + update_statistics(key, slide_url); + $(window).off('focus'); } - }, 1000); + }); }); } }); diff --git a/addons/website_slides/static/src/js/slides_embed.js b/addons/website_slides/static/src/js/slides_embed.js index 67000eba25f..f758e9b677e 100644 --- a/addons/website_slides/static/src/js/slides_embed.js +++ b/addons/website_slides/static/src/js/slides_embed.js @@ -73,7 +73,7 @@ $(document).ready(function () { } }); }, - previous: function (ev) { + previous: function () { var self = this; this.pdf_viewer.previousPage().then(function(page_num){ if(page_num){ @@ -82,14 +82,14 @@ $(document).ready(function () { self.$("#slide_suggest").hide(); }); }, - first: function (ev) { + first: function () { var self = this; this.pdf_viewer.firstPage().then(function(page_num){ self.on_rendered_page(page_num); self.$("#slide_suggest").hide(); }); }, - last: function (ev) { + last: function () { var self = this; this.pdf_viewer.lastPage().then(function(page_num){ self.on_rendered_page(page_num); @@ -97,9 +97,14 @@ $(document).ready(function () { }); }, // full screen mode - fullscreen: function (ev) { + fullscreen: function () { this.pdf_viewer.toggleFullScreen(); }, + fullScreenFooter: function (ev) { + if (ev.target.id === "PDFViewerCanvas") { + this.pdf_viewer.toggleFullScreenFooter(); + } + }, // display suggestion displayed after last slide display_suggested_slides: function () { this.$("#slide_suggest").show(); @@ -128,6 +133,9 @@ $(document).ready(function () { $('#fullscreen').on('click',function(){ embedded_viewer.fullscreen(); }); + $('#PDFViewer').on('click',function (ev){ + embedded_viewer.fullScreenFooter(ev); + }); // switching slide with keyboard $(document).keydown(function (ev) { @@ -160,7 +168,7 @@ $(document).ready(function () { ); // embed widget page selector - $('.oe_slide_js_embed_code_widget input').on('change', function (e) { + $('.oe_slide_js_embed_code_widget input').on('change', function () { var page = parseInt($(this).val()); if (!(page > 0 && page <= embedded_viewer.pdf_viewer.pdf_page_total)) { page = 1; diff --git a/addons/website_slides/static/src/js/slides_upload.js b/addons/website_slides/static/src/js/slides_upload.js index 91a4b1dadb1..1dc10f0e845 100644 --- a/addons/website_slides/static/src/js/slides_upload.js +++ b/addons/website_slides/static/src/js/slides_upload.js @@ -208,22 +208,19 @@ var SlideDialog = Widget.extend({ } return data.text; }, - check_unique_tag: function(term, tags) { - return _.filter(tags, function(tag) { - return tag.text.toLowerCase() === term.toLowerCase() - }).length === 0; - }, createSearchChoice: function(term, data) { var added_tags = $(this.opts.element).select2('data'); - if (this.opts.check_unique_tag(term, _.union(added_tags, data))) { + if (_.filter(_.union(added_tags, data), function(tag) { + return tag.text.toLowerCase().localeCompare(term.toLowerCase()) === 0; + }).length === 0) { return { id: _.uniqueId('tag_'), create: true, tag: term, - text: _.str.sprintf(_t("Create New %s '%s'"), tag, term) + text: _.str.sprintf(_t("Create new tag '%s'"), term), }; } - }, + }, fill_data: function (query, data) { var that = this, tags = {results: []}; @@ -302,7 +299,8 @@ var SlideDialog = Widget.extend({ svg_to_png: function() { var img = this.$el.find("img#slide-image")[0]; var canvas = document.createElement("canvas"); - canvas.width = img.width, canvas.height = img.height; + canvas.width = img.width; + canvas.height = img.height; canvas.getContext("2d").drawImage(img, 0, 0); return canvas.toDataURL("image/png").split(',')[1]; }, diff --git a/addons/website_slides/static/src/less/website_slides.less b/addons/website_slides/static/src/less/website_slides.less index a9348336a3b..fc4cb43e9f7 100644 --- a/addons/website_slides/static/src/less/website_slides.less +++ b/addons/website_slides/static/src/less/website_slides.less @@ -9,6 +9,7 @@ @navbar-default-link-color: #777; @navbar-default-link-hover-color: #333; @navbar-default-bg: #f8f8f8; + @MAX-Z-INDEX : 2147483647; } .define-color-if-not-defined(); .oe_slides_panel_footer { @@ -167,6 +168,10 @@ textarea.o_slides_comment { .oe_slides_panel_footer #page_number { width: 45px; } + +.oe_show_footer { + z-index: @MAX-Z-INDEX; // Looks terrible but seems necessary due to fullscreen & canvas in PDFSlidesViewer +} // Display Slide Navigation Footer bit clear on mobile preview @media screen and (max-width: 300px) { .o_slide_navigation_buttons { diff --git a/addons/website_slides/view/website_slides.xml b/addons/website_slides/view/website_slides.xml index 6e038214367..fc05dbb0157 100644 --- a/addons/website_slides/view/website_slides.xml +++ b/addons/website_slides/view/website_slides.xml @@ -24,7 +24,7 @@