Orchard 1.7 - Feature Itemslider - orchardcms-1.7

I created a new Orchard 1.7 site with only the Feature Item Slider module installed. I can create a new feature, however I do not get the picture field and none of the feature are displayed.
Any help will be appreciated.

Try this..
Install "Media Picker" module by The Orchard Team from gallery then enable it
It works fine with my Orchard 1.7.2

I haven't used FeaturedItemSlider module in 1.7 but I do know it uses the media picker field and this is no longer used in 1.7. I would guess this is the problem. So either try using 1.6 or have a look at other alternatives to the Featured Item Slider module.
eg. http://www.breakoutdeveloper.com/orchard/content-item-slider

I had the exact same issue, I just fixed it today. Quick steps for the dirty fix below:
Add reference to Orchard.MediaLibrary for FeaturedItemSlider
(remember to also add the dependency in Module.txt)
Go into and update FeaturedItemSliderWidgetPartDriver.cs
Add reference through using Orchard.MediaLibrary.Fields;
Add this function (may be offloaded onto a Service Class but I'm in a hurry so just added to the driver, sorry):
//new function for 1.7
protected string getImagePath(FeaturedItemPart part) {
if (((MediaLibraryPickerField)part.Fields.Single(f => f.Name == "Picture")).MediaParts.Any())
{
return ((MediaLibraryPickerField)part.Fields.Single(f => f.Name == "Picture")).MediaParts.FirstOrDefault().MediaUrl;
}
return string.Empty;
}
Updated featuredItems variable in the Display function:
var featuredItems = _contentManager.Query<FeaturedItemPart, FeaturedItemPartRecord>("FeaturedItem")
.Where(fip => fip.GroupName == part.GroupName)
.OrderBy(fi => fi.SlideOrder)
.List()
.Select(fi => new FeaturedItemViewModel
{
Headline = fi.Headline,
SubHeadline = fi.SubHeadline,
LinkUrl = fi.LinkUrl,
SeparateLink = fi.SeparateLink,
LinkText = fi.LinkText,
//updated due to 1.7.2 upgrade, MediaPicker -> MediaLibraryPicker
ImagePath = getImagePath(fi),
SlideNumber = ++slideNumber
}).ToList();
That should do it. To explain, MediaPicker was replaced with MediaLibraryPicker and now Media are treated as Content Items, so properties have changed. Details of media are now in a MediaPart within the Media Content Item.
Hope this helps.

I upgraded a site from Orchard 1.6 to 1.7.2, and had some success by taking the following steps:
Because I had migrated from 1.6, I already had Media Picker and Media features enabled. I then also enabled then three new media features- Media Library, Media Library Search and Media Processing. I also enabled the Upgrade feature
I then clicked Upgrade to 1.7 on the admin menu and migrated my media files.
After that finished, I migrated the media picker fields. This moves all of your old Media Picker fields to the newer Media Library Picker fields.
When that is complete, you can disable the features Media Picker and Media

Sunkist on GitHub created a patched version of the Featured Item Slider which seems to be working perfectly fine: https://github.com/sunkist/FeaturedItemSlider.
I don't know if it will be maintained but it works ok now.

Related

How to let menu item execute Javascript in Joomla 3.2?

Before 3.2, I can set the menu item type to "external link" and then set the link as
"javascript:myFunction()"
When clicked, the menu item will call the JavaScript function. But after I upgraded to 3.2, when I did the same thing and tried to save the menu item, it said "Save not permitted".
Did 3.2 block this usage? If yes, how do I get my JS function executed by a menu item?
I've came up this problem a while ago, in Joomla version 3.2.1 concerning a 'Skype' link, e.g.
skype:myloginname
This has to do with the protocol types that are allowed and are defined in this file:
/administrator/components/com_menus/controllers/item.php, line ~180.
There is an array that defines the acceptable schemes:
$scheme = array('http', 'https', 'ftp', 'ftps', 'gopher', 'mailto', 'news', 'prospero', 'telnet', 'rlogin', 'tn3270', 'wais', 'url', 'mid', 'cid', 'nntp', 'tel', 'urn', 'ldap', 'file', 'fax', 'modem', 'git');
When adding skype at the end of the list Joomla! allowed saving the external link. The same applies for javascript. In any case you should consider any security risk that comeswith this solution.
In addition, you should take into mind that this override may be discarded in any future update of joomla.
Technically speaking Joomla thinks that javascript is a protocol, like HTTP & Co., it looks it up inside a list of known protocols, it does not find it and it throws an error.
Start reading at around line inside [MenusControllerItem::save()][1]. So basically it has nothing to do with the fact you are trying to use some JavaScript, this is just a side-effect.
While using JavaScript in the External Link is not really an advertised feature but rather said a loophole, it does break b/c if you have used before.
You can:
Open an issue in the Joomla Issue Tracker and report this issue, get some community feedback. The fix is really easy, it just needs to get accepted.
Use the suggestion below:
Instead of link put #
Set the field "Link CSS Style" to something that does not colide with other classes, eg. my-function
Save
You can use jQuery to intercept the click event on the link and to make it run your function. See code below:
jQuery(document).ready(function($){
// Select element based on the class set in Joomla backend
$( ".my-function" ).on( "click", function(e) {
// Do not follow the link
e.preventDefault();
// Call function
myFunction(1);
});
});
function myFunction(x)
{
alert("I was called" + x);
}
Update: after a short discussion with the commiter of the change, I understood that it may be related to a security issue. So it may be on purpose after all not to allow js.

Javascript to detectSkype?

I'd like to change a link's href based on that: if Skype isn't installed, show a popup explaining what Skype is and how to install it, if it is installed, change the link to skype:my.contact.name?call so the click will start a call. Real estate issues means that I'd prefer to only have one link shown.
Unfortunately, browsers do not support such API and this cannot be done cross-browser compatible way. There is some kind of support, but it is buggy.
Javascript to detect Skype?
All browser plugins registering their mime-types in global array named mimeTypes, that can be accessed via navigator object navigator.mimeTypes.
So you can use this for check plugin active or not. If plugin installed and disabled — no any mime-type will be registred for that disabled plugin. If plugin installed and active — he has a mime-type record in navigator.mimeTypes
Some code implementation using jQuery:
jQuery.extend({checkPlugin: function(mimetype_substr) {
for (var i = 0; i < navigator.mimeTypes.length; i++) {
if (navigator.mimeTypes[i]['type'].toLowerCase().indexOf(mimetype_substr) >= 0) {
console.log("Gotcha! Here it is: "+navigator.mimeTypes[i]['type']);
return true;
}
}
return false;
}});
So this: $.checkPlugin("skype"); returns true if skype click2call plugin is installed and active. And false if there is no active plugin or plugin are not installed.
Actually need to search within another global array — navigator.plugins, but all active plugins have their records in navigator.mimeTypes, and this is a bit easier.

Reset the 'Custom Forms' Content Type in Orchard CMS having issues

I have mixed up the Content Type Custom Forms default settings. And it seems not usable anymore after some tweaks and settings.
Now it seems that I have to reinstall the orchard as whole. I'm in initial stage of the setup so it is possible for me to start afresh but I wanted to know regarding how to reset the Content Type to default settings using Orchard Command line or any other simpler way.
Please note: There is a question on deleting a Content Type here but it seems that is also not answered yet. From an youtube video here I found to command to enable or disable the modules using command such as feature enable <ModuleName>
But how to reset the Content Type that is still the question.
I have very short timeline for building the things now, and researching is taking too much time.
Hint or Help towards the solution would be kind of you.
If you take a look in the Migrations.cs of the CustomForms module source code, online here, you can see what parts are being added to it.
So the relevant code is
ContentDefinitionManager.AlterTypeDefinition("CustomForm",
cfg => cfg
.WithPart("CommonPart")
.WithPart("TitlePart")
.WithPart("AutoroutePart", builder => builder
.WithSetting("AutorouteSettings.AllowCustomPattern", "true")
.WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "false")
.WithSetting("AutorouteSettings.PatternDefinitions", "[{Name:'Title', Pattern: '{Content.Slug}', Description: 'my-form'}]")
.WithSetting("AutorouteSettings.DefaultPatternIndex", "0"))
.WithPart("MenuPart")
.WithPart("CustomFormPart")
.DisplayedAs("Custom Form")
.Draftable()
);
The parts are therefore:
CommonPart
TitlePart
AutoroutePart
MenuPart
CustomFormPart
I would recommend taking a look at this tutorial if you are having any problems: DevDirective
Do you really need to add/remove parts from this Content Type?

How do I add version control to uploaded files / images using Plone 4.1?

I want to activate version control facility for uploaded files using Plone 4.1. E.g.Whenever an image is edited using Products.ImageEditor in Plone, I want the entry to appear in the history for the image.
First thing to activate version control for images is to:
1) go to site setup
2) click Types
3) Select Image from the drop down
4) select Automatic versioning
Even with that, I don't think versioning will not automatically be performed for ImageEditor changes. ImageEditor just sets the field value for the image and does not emit any object modified events which I assume is required for plone's versioning to kick in.
FWIW, I'm the author of Products.ImageEditor. You can submit a ticket for the issue if you'd like: https://github.com/collective/Products.ImageEditor/issues

Inject a CSS file into a webpage via firefox extension

I am writing a Firefox extension and I am using their Add-on SDK; but I can't figure out how to inject a local CSS file from the data folder into the webpage. It would be great if there were a way to do it via page_mod package.
As of Add-on SDK 1.14 there's experimental (API may change) support for this in the page-mod module:
var pageMod = require("sdk/page-mod").PageMod({
include: "*",
contentStyleFile: require("sdk/self").data.url("my-style.css")
});
See Modifying Web Pages Based on URL for an elaborate guide to using page-mod.
There's a page on the Addon SDK's wiki discussing issues with the current implementation, although it seems a bit outdated.
Under the hood it uses nsIDOMWindowUtils.loadSheet() to add the stylesheet without touching the page's DOM. (This API was added in Firefox 18, see bug 737003. Before that you had to use nsIStyleSheetService which was similar, but not tab-specific.)
Before that you could use the page-mod's content script to insert the link or style element (example). [edit] thanks to lwburk's comment, here's a more elaborate elaborate description in Greasemonkey Hacks: Tips & Tools for Remixing the Web with Firefox By Mark Pilgrim: "Alter a Page's Style" section.
To insert CSS from main.js one can now use "page-mod":
var data = require("sdk/self").data;
var pageMod = require("sdk/page-mod");
pageMod.PageMod({
include: "*.org",
contentStyleFile: data.url("my-page-mod.css")
});

Resources