Issue localization in javascript - javascript

With Abp version 7.0 I customized the folder structure in a new project. For each project I created the Xep.Cms structure in which I moved all the files and folders of the starting project.
After this operation the localization on the site pages work correctly, but instead if I go to use the localization with some javascript code I get:
`WARN:
Could not find localization source: AbpUi
WARN:
Could not find localization source: AbpUi
Index.js initialized!
WARN:
Could not find localization source: Cms`
What can I check to fix the problem?
Grazie
Running the project I get the error I attached and in the modal windows I don't see the localized text

I guess you have overridden the layout. ABP 7.0 introduced a breaking change for localizations. You can see it here: https://docs.abp.io/en/abp/latest/Migration-Guides/Abp-7_0#external-localization-infrastructure.
You need to add the following line just before the ApplicationConfigurationString line:
<script src="~/Abp/ApplicationLocalizationScript?cultureName=#CultureInfo.CurrentUICulture.Name"></script>

Related

TinyMCE MS MVC looking for non-minified file

I have an MS MVC deployment that is looking for a subscript for TinyMCE "theme.js" and not finding it because the file is theme.min.js. How do I get MVC to look for the minified file?
The tinymce file is tinyMCE.min.js, so it is finding that one. Is this a problem with setting TinyMCE or MS MVC?
Long explanation : We are in the process of implementing TinyMCE on a Microsoft MVC page. It was working locally but would not run when deployed to the server. It was failing with a 404, file not found for the file :
PROJECT_ROOT/bundles/themes/modern/theme.js
This was not the location of the theme file it was looking for and after a little research I found out that you needed to set the tinymce.baseURL property. When I did this it helped a little by changing the location in the error to the actual location of the file :
PROJECT_ROOT/Scripts/libs/tinymce/themes/modern/theme.js
The problem is that for some reason it was looking for the un-minified file theme.js and not theme.min.js. If I change the name to theme.js it works.
I thought that MVC and/or TinyMCE would do some magic to get the right name. Is there a setting I need to change?
You need to set tinymce.suffix = '.min'; before you init TinyMCE
tinymce.suffix = '.min';
tinymce.baseURL = '/js/tinymce';
tinymce.init({
selector: '#editor',
menubar: false,
plugins: 'code'
});
TinyMCE should work out to load minified (or non-minified) files based on which TinyMCE file you load (tinymce.js or tinymce.min.js).
Not sure what's happening in your case but that logic appears to be failing.
If you grab the DEV package from https://www.tiny.cloud/get-tiny/self-hosted/ it would come with both the minified and non-minified versions of each file so the editor would find what it needs at runtime.
Note: The code in the minified and non-minified files functions just the same so from a functionality perspective it does not really matter if theme.min.js or theme.js code is loaded. It only add ~200K to the file size so even that is immaterial.
I think I found the solution for this. There is a property you can set in the tinymce object called "suffix" that resolved this for me.
So, for the first part I set a rootURL property in the page calling TinyMCE, and then added the line tinymce.baseURL = rootURL + 'Scripts/libs/tinymce' just before the tinymce.init.
Then, to get it to find the theme.min.js set tinymce.suffix = '.min'
This seems to have resolved the issue. Not sure if this is a hack solution but it is working. If anyone has a better way to do it please let me know.

Loading customer sapui5 library inside component.js

According to the documentation here:
https://scn.sap.com/thread/3502503
http://jsbin.com/openui5-notepad-control-with-its-own-library-used-in-xmlview/1/edit?html,output
I build the following folder structure with following files:
/my/themes/sap_bluecrystal/library.css
/my/library.js
/my/Square.js
Now I am asking me how to load the library (inside Component.js) correct.
I tried following in Component.js
jQuery.sap.registerModulePath("my", "./my");
And in some View:
jQuery.sap.require("my.Square");
...
new my.Square({
text : "Test",
size : "200px"
})
All in all the Square control seems to be usable but the library.js and library.css is not loaded at all.
Any idea how to do it right?
Using bootstrap XML code inside index.html would not work if the app is running inside Fiori Launchpad.
Bonus question: Where to deploy a custom library inside SAP to be usable by multiple apps? One idea (but maybe that's wrong) is to create a BSP application just containing the library code?
The right way to load the library would be (instead of jQuery.sap.require):
sap.ui.getCore().loadLibrary("my");
This will load a "library-preload.json" file (if available) and also include the theme resources.
See https://openui5.hana.ondemand.com/#docs/api/symbols/sap.ui.core.Core.html#loadLibrary
First question I could solve for my own:
Replace
jQuery.sap.require("my.Square");
with
jQuery.sap.require("my.library");
Second question is still open :)

Google Caja: Sample html4 def file?

I'm trying to implement this Introduction Tutorial to sanitize HTML using Caja's JSHtmlSanitizer.
I'm getting a reference is not defined error at line 1056 in html-sanitizer.js because the variable html4 is undefined. I believe this is a definition file. Where can I can get a sample of this definition file? I think I found a very old def file that dates back in 2008 and it's no longer in the latest version of the repo.
The HTML defs file is built from the schema JSON by Caja's build system. The minimum build operation is:
$ ant pluginc
which will leave the built file at ant-lib/com/google/caja/plugin/html4-defs.js.

sitefinity 6 - events module error javascript

I've upgraded a website from 4.4 to 6.0 and found some issues. Some I already solved but I keep getting one error (javascript I suppose) on events module. When I try to preview/create new/publish/save draft I get the following js error:
TypeError: startDate is null
Unable to get property 'getFullYear' of undefined or null reference
Telerik.Web.UI.WebResource.axd, line 329 character 1
var range=this.get_rangeView().getRange();
var time=this.get_timeView().getRange();
var startDateTime=new Date(time.get_start());
var endDateTime=new Date(time.get_start());
var startDate=range.get_start();
var endDate=range.get_recursUntil();
startDateTime.setFullYear(startDate.getFullYear(),startDate.getMonth(),startDate.getDate());
I reckon that this is dynamically created by Telerik sitefinity and I'm not sure how to fix it. I went to the administration area and checked the relevant configurations and it seems to be everything ok (similar configs as sitefinity 4.4).
Does anyone have an idea how to solve this? I've tried to post a sitefinity forum thread on their website but they took way to much time to answer.
Cheers
by any chance were you using external templates or a custom widget to show the events?
Sitefinity 6.0 apparently rebuilt the events module and it is no longer a simple, flat type. Instead it is a nested (hierarchical) type, with a parent calendar to which events are added (or multiple calendars if you need them).
So if you did any custom code or external template to display the content (in other words anything not out of the box that auto-upgraded itself when you updated to 6.0) you may need to rebuild this custom component to use the latest changes.
Consult the upgrade guide to 6.0 for latest breaking changes that one had the most differences, then compare your custom templates (if any) to the widget templates in the SDK: http://selarom.net/blog/2012/11/06/mapping-sitefinity-templates-from-the-sdk
I hope this is helpful!

Mapping error with ChildBrowser and PhoneGap 1.5.0 (Cordova)

When I try to call:
window.plugins.childBrowser.showWebPage
I get this error in the console window:
2012-03-13 16:14:58.036 CordovaHybridDemo[874:707] ERROR: Plugin 'ChildBrowserCommand' not found, or is not a CDVPlugin. Check your plugin mapping in Cordova.plist.
I added an entry in Cordova.plist with a key of ChildBrowserCommand and a value of ChildBrowserCommand. That worked in PhoneGap 1.4.1 but has that changed for Cordova?
Cordova changing their plugin architecture. Including keywords and files, classes.
Check your ChildBrowserCommand.h file
#interface ChildBrowserCommand : CDVPlugin <ChildBrowserDelegate>
For this. If it is not CDVPlugin you have not updated your plugin files successfully. Analogy might be apply for Android.
Check the updated js file for the plugin also.
var cordovaRef = window.PhoneGap || window.Cordova || window.cordova; // old to new fallbacks
Here they make plugins usable for new cordova.
Refer this plugin upgration guide by Cordova
https://github.com/phonegap/phonegap-plugins/blob/master/iOS/README.md
The answer is right here, in the picture. It doesn't mention it in the text, but this key/value pair has to be nested under Plugins.
I struggled with this for a while before I noticed I'd messed it up. I blame the Xcode UI: if you click the + on Plugins while it's closed, it just creates a sibling, not a child. Also my first mistake was to put this keypair in the wrong plist file entirely :P.

Categories

Resources