tx_news - Insert a slide show in detail mode - tx-news

I would like to display a slideshow in detail mode, if the news features several pictures.
For example, previously I used tt_news, and its rgsmoothgallery extension met this need.
Do you know a simple solution for tx_news?
My system: Typo3 7.6.18 - tx_news 6.0.0

you need to build the appropiate HTML markup in your templates.
Slideshows, lightboxes, accordions, tabs, ... need a special markup so the initializing javascript can identify all parts and rebuild the DOM. As it is about which JS-lib you use you need to know which tags are expected, which data is expected. Look in the documentation of the JS-lib.
In general you have the include of the JS-lib,
then you build your HTML,
somewhere you call something like onLoad("initSlideshow('.slideshow', options)" so that the JS can modify your DOM in all the (div?) tags which have a class 'slideshow'. Often options could be given in parameters or in data-attributes.
The rebuild of the DOM includes adding eventhandler so you can interact with the content.
As there are multiple libs and also multiple content it is easier to do this individually per installation than to build an extension which adds just one JS lib to very special content. If an extension would modify the templates of news, you can't replace the news templates easily (or you need to build the complete template where you won't need the extension at all.

To edit the detail page you need to edit the Resources/Private/Templates/News/Show.html
Here you can include your slider.
To load the JavaScript file from this template you could use the vhs viewhelper v:asset.script

Related

How To Create a Standalone Swift SDK

I would like to create a SDK to use without iOS or Xcode.
Let me explain. I would like to use Swift language to create a framework with which to develop front-end. In few words with this framework I would like create html pages for web and substitute HTML, CSS and javascript with swift. The idea get from what Apple does with iOS. If you look how is made a xib or storyboard you can see xml file. I would like to do the same thing or take the idea and applicate for the web.
To do this I need to create an SDK that is not connected to iOS but that I can use in any IDE like VSCode or similar or also in a my own IDE created by me.
An other thing that could help you to understand what I mean is Javascript. In javascript there is a command createElement that let you to create an element, adding class, attribute and, yes, style. But create UI in this way, you understand well that is very hard. So, I Would like create a framework in iOS style, to create frontend in simpler and easier way.
I would like create create this framework (if it's possible) in Xcode and I don't want have any interference by iOS.
So, have you any suggests about how to start?
thank you
XIB layout is constraint-based, which means you describe your view hierarchy and constraints, and autolayout system does the layout for you every time according to constraints you've provided. Technically, inside it converts constraints to a system of linear equations and solves it in run-time, thus calculating frames for every UIView. And .xib file is just an XML with all the views, their properties and constraints. (that's a bit simplified, but you've got the idea)
HTML layout is totally different: HTML is a declarative way to describe elements on a page, i.e you describe every element with tags, and every tag (or its parent, or CSS file) already contains all necessary information about its positioning and appearance, so browser just parses and renders a page accordingly.
Theoretically, you could've reinvented a web browser: write your HTML parser, then write UI to somehow render it, and add feature to alter HTML tags by moving the page elements with mouse. But that would've taken a lot of time and effort :)
There are many website constructors on WWW, which allow you to build simple sites only with drag-and-drop (no coding needed). Also, you can inspect element in your browser, and then change some attributes of some element right in the debug window, and see changes in realtime.
P.S Im not a web/frontend developer, but I suppose that IDE's popular among frontenders already have some features or plugins that allow them to render HTML/CSS code and see changes in realtime, just like browser's debug menu.

Explanation of (undocumented?) XUL dialog attribute buttoniconaccept (and similar)

I am pulling this attribute directly from Mozilla Firefox's about.xul file which shows the About dialog box for an add-on. It is a relatively simple XUL dialog with no inputs, locale data pulled from DTD entities, string bundle properties and JavaScript.
<!-- omni.ja!/chrome/toolkit/content/mozapps/extensions/about.xul -->
<!-- chrome://mozapps/content/extensions/about.xul -->
<dialog id="genericAbout"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="init();"
buttons="accept"
buttoniconaccept="close"
onaccept="close();">
MDN: Dialogs and Prompts and MDN: dialog both mention something about attributes that are formed by concatenating (pseudo-regexp):
"button" + "(label|accesskey|oncommand)" + "(accept|cancel|disclosure|help|extra[12])"
For example: buttonlabelaccept.
However, I could not find any documentation about the use of icon. The word icon does not even show up on either of the above-mentioned pages! What does it do? What is the correct way to use it?
I'm trying to make my add-on about page more modular, without loading internal files from omni.ja(r), which pulls in a LOT of unnecessary code with it. I am developing a very streamlined version, that will style itself appropriately depending on calling context.
I want it to look like Firefox's official About < addon.name > dialog if called from about:addons context-menu, or from my add-on's status-bar context-menu. I want a slightly different appearance if viewed from within the Options dialog as an iframe inside a XUL. I already have that structure set up. Just tweaking the little quirks.
This is not critical design or feature wise, and indeed the entire API will go away in a few months, but it just bothers me to not really understand this, so I want to figure it out before I let it go an move on to more important things. But I will if I absolutely can't find an answer. But it's one of those stupid little things that will just bother me a disproportionate amount. =D
If you can point me to documentation I may have missed, or even specific Mozilla source code, and a few examples, or a more complete explanation and typical use-cases, that would be great.
If you check the "blame" for about.xul, you'll see that the line was added to fix bug 422763. Judging from the screenshot in the bug, GNOME (Linux) has (had?) a convention of putting icons on dialog buttons, and this attribute allows overriding the default icon (inferred from the button type).
If you search for buttonicon, you'll find the code that handles this attribute in toolkit/content/widgets/dialog.xml.

How to add page header & footer to pdf using export plugin in grails?

I am able to generate & download pdf file using export plugin. But, now I want to add PAGE HEADER & FOOTER in the pdf.
Can anybody please tell me how can I achieve that? Reference links are also ok. Thank you.
This plugin isn't designed to support these features, however, you can implement them if you want.
If you take a look at the default implementation for the DefaultPDFExporter which is used by the plugin to render PDF documents you will see it does include a blank footer, but you can't configure the text. You will also see that it doesn't support adding in a header either. This means you are going to have to write your own PDF exporter implementation.
Since you want to generate a custom PDF document you will need to implement your own version of the DefaultPDFExporter which does support these features. You can do this by extending the AbstractExporter and using the DefaultPDFExporter as your guide. You will also need to configure your application to use your own implementation instead of the default. Take a look at the doWithSpring section of the ExportGrailsPlugin.groovy to see how your exporter bean should be defined in your Resources.groovy.
This isn't something that is exactly straight forward or easy. It does require you to have a good understanding of Grails, Spring, and Java.

Is there a way to load AngularJS not from an HTML file (in a Firefox addon main.js file)?

I'm developing a Firefox extension using AngularJS and I'm trying to use some of the AngularJS services inside my main.js file. I use require() to include the relevant modules and angular.bootstrap() to initialize the modules.
However, I always get the following error:
Reference Error: window is not defined
Is there anything else I can do about it?
AngularJS isn't really meant for this kind of environment - it is an MVC framework and in your case V (the view) is missing. You don't tell what you want to use AngularJS for but you might want to consider using it in your content scripts rather than main.js.
That said, AngularJS is often using window simply as a means to access the global object. This is easy enough to fix, the next-to-last line of AngularJS source code says:
})(window, document);
This should be changed into:
})(this, document);
This will at least allow the functions to proceed that don't really require a view. Of course you would still need to remove the last line (the one attempting to insert a stylesheet into the document) and export the angular variable instead:
exports.angular = angular;
There isn't much detail so I am unsure if this suggestion fits with what you want to do. If you want to use some JS libraries that require a DOM and don't want to show a document to the user, consider using the page-worker module:
https://addons.mozilla.org/en-US/developers/docs/sdk/latest/packages/addon-kit/page-worker.html
You will need to set up event-driven communications between the worker and main.js, as with any other content document used with SDK code:
https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/guides/events.html
May be you have to get window object via
var window = require("window-utils").activeBrowserWindow;?
What is the view that you are trying to update? You should be able to provide angular.bootstrap with some non-root element to start compiling from. http://docs.angularjs.org/api/angular.bootstrap
If you're using some service that relies on window, you also might need to supply your own tweaked $window service. http://docs.angularjs.org/api/ng.$window

textarea that was using plain text with option of markdown or textile filter now needs images

My clients can enter text into textarea and have the option to use the markdown or textile filters for each textarea.
With some models (articles, newsletter, etc) they can upload images to associate with the model, which are displayed in a column next to the text of the text.
This worked fine for a while, but they have now told me that the want the ability to put the images INSIDE the text a specific positions.
What is the best way to go about this? I suppose I may have to use a wysiwyg for this, but would rather not. And how would this work for images which are not yet on the server, etc?
There are different directions you could go to:
Follow the path of Confluence, which released in their new version 4.0 a rewritten WYSIWYG editor, that stores as source XHTML, not any more wiki markup.
Leads to an update of all pages when migrating.
Was pretty difficult to implement. I do not know if they use any more the TinyMCE editor of previous versions.
Follow the format of markdown how to include images in your source format. So by typing: This is my text. !image.png! The inline image shows ..., you will have a format that is understandable.
You have to expand the interpretation, so that the !<filename>! will be mapped that is stored locally anyway.
You have to add clear-up dialogs for the images that are yet not known, so doing bulk uploads ...
You may provide a drag area on your view, that then shows the filename and gives examples how to include that inside the text area.
Go for something in between, by allowing users to drag images inside the editor. There are plugins written in Javascript that allow you to do that, e.g. UI Draggable for jquery
I have no idea how to integrate that image inside the text editor. Overlay?
So the second one is the easiest, and the user knows how to do it. If they only decide that this is the solution they want to have :-)
I think I'm going to use a combination of #2 above, and the Liquid templating engine.

Resources