Import XLIFF in Ektron - ektron

I am working in Ektron 8.0.
I have been trying to import XLIFF files to ektron through API.I made use of the following piece of code to achive this.
private void ImportTranslation()
{
try
{
Ektron.Cms.LocalizationAPI m_objLocalizationApi = new Ektron.Cms.LocalizationAPI();
m_objLocalizationApi.StartImportTranslation();
}
catch (Exception ex)
{
}
}
I called this function and i added the XLIFF file to the "uploadedfiles" directory programmatically.
I handled this code in a button click,and it works like a charm!
When i wrote this code in the Page_Load event in the workarea,in the status tree structure it shows
the following exception,
"Exception has been thrown by the target of an invocation."
I am supposed to handle the XLIFF Import in a webservice,it also results in throwing the same error.
Can anybody help me in resolving this?

Related

Webview browser application not open the dynamic links of Google Forms either dynamically or directly

I built a Webview browser application on an Android 11 device that knows how to open all links perfectly! But it does not open the dynamic links of Google Forms either dynamically or directly (when I copy the final address that opens on my computer), the application completely crashes and closes! I did not find any useful information on Google only regarding dynamic links to Firebase - I added the functionality as required, but to no avail! For Dodge:
Dynamic: https://forms.gle/uJq3pGPJhqZGYzLC6
, Direct: https://docs.google.com/forms/d/e/1FAIpQLSd8PZt648GmhALFyykBTflSiU8b9_e-h3gVfY6ZBcF9-N0HbQ/viewform
Dynamic: https://docs.google.com/forms/d/e/1FAIpQLScnkyROLo8VavCmaRagZb6eiucxjCdkOs6blijHwe34vFXO6g/viewform?usp=sf_link ,
direct: https://docs.google.com/forms/d/e/1FAIpQLScnkyROLo8VavCmaRagZb6eiucxjCdkOs6blijHwe34vFXO6g/viewform
I tried to add dynamic links to the firebase SDK, and In AndroidManifest.xml, add an intent filter to the activity that handles deep links for your app. And I also called to call the getDynamicLink() in OnCreate() but the links never reached this event.
Direct reading ON 'shouldOverrideUrlLoading' didn't help either because the application crashes before it gets here, that is, something goes wrong with the dynamic search and even in debugging it disrupts the URL completely:
public boolean shouldOverrideUrlLoading (WebView view, String url) {
if(url.contains("https://docs.google.com/forms/") && url.contains("/viewform"))
{
try {
url= "https://"+ url.split("https://")[url.split("https://").length-1].split("viewform")[0].trim()+"viewform";
}
catch (Exception e)
{
Toast.makeText(MainActivity.this, e.toString(), Toast.LENGTH_LONG).show();
url = "https://www.google.com";
}
}
mWebView.loadUrl(url);
return true;
}

PrestaShop Call to undefined method FrontController::parseCMSContent() after update to 1.7.8.2

I created some custom shortcodes for my PrestaShop by creating a file (override/classes/controller/FrontController.php) with a method like :
public static function parseCMSContent($content)
{
...
}
And in my module and cms smarty templates I changed:
{$cms.content nofilter}
to:
{FrontController::parseCMSContent($cms.content) nofilter}
Everything was working fine with Prestashop 1.7.7.5, but the update to 1.7.8.2 broke the whole thing.
I get a 500 error saying :
PHP Fatal error: Uncaught Error: Call to undefined method FrontController::parseCMSContent() ... .module.pscustomtextpscustomtext. ...
It's still working fine with debug mode enabled though..
I can't find anything about the function being deprecated, any idea on how I could get this working again please?
In case this can help anyone, I fixed this by moving my override into a new smarty plugin.
I created a file vendor/smarty/smarty/libs/plugins/function.get_shortcoded_content.php
I added my shortcodes in:
function smarty_function_get_shortcoded_content($params, &$smarty)
{
...
}
And in my smarty files I called:
{get_shortcoded_content content=$cms.content}
instead of:
{$cms.content nofilter}
It seems to work all fine again.

Handle Razor Page Exception

Hi I'm getting strange behavior in our AspNetCore 2.1 application using Razor Pages. When an exception escapes from a Razor Page action like OnGet the application crashes. The exception never reaches any middleware. It looks like the application seems is crashing somewhere in the internal PageActionInvoker.Next method.
I can't paste the code as it far too much. But the following will crash the application:
public async void OnGet() {
await Task.CompletedTask; // normally we await something else
throw new Exception("Boom!");
}
Note:
We are:
combining Views and Razor Pages. The Views are part of the 'older' section of the application.
we are allowing Razor Page area's.
Do we have to configure some feature?
Are we missing something? Does someone have suggestions?
FOUND IT
Nothing special. Well AspNetCore accepts async void OnGet and everything works fine UNTIL an exception is raised.
using the following fixed it.
public async Task OnGetAsync() {
It seems that even AspNetCore doesn't handle the following construction well:
public async void OnGet() {
...
}
Even though it's accepted and seems to be working possible exceptions are not handled correctly.
The correct way to do this is:
public async Task OnGetAsync() {
....
}
Don't know whether this classifies as a AspNetCore bug ... in that sense maybe it should be rejected like many other things. Oh well ... bug fixed.

Is there a way to simulate a link/button click in mink?

I'm using a headless browser (phantomjs) in conjunction with Mink to do some functional testing on my Website.
Now in this setting, files can not be downloaded regularly e.g: by clicking a link. So I have to extract the url from the link or the button, and download the file manually.
As I just stated sometimes there is no link () for the download, but a button in a Form (e.g: Inputting data for a report in the form, and receiving the report file on submission).
So what I need to do is simulate clicking the link or button and extract the Data for the Request that would have been sent, and use that data to download the file manually.
Is there a way to do this?
Note: I'm using guzzle to actually download the file.
Mmmm... I don't know if you solved this and only as an alternative to typical mink methods. As Phantomjs is a javascript based browser engine, did you tried with javascript?
You could try something like this:
public function getElementHref($element)
{
/* #var FeatureContext $this */
$function = "(function(){
//Javascript method to get the href.
})()";
try {
return $this->featureContext->getSession()->evaluateScript($function);
} catch (Exception $e) {
throw new Exception('Element not found');
}
}
You can find a method to do this in javascript here: How to get anchor text/href on click using jQuery?
Then use the URL returned with file_get_contents (depending on the file type) and that's it.

kendo ui editorfor imagebrowser returns 403

I'm new to web development and I'm trying to implement the Kendo UI editor with an image browser to insert into the document on an MVC 4.5 page. the editor is working fine, however, when i click the insert image button i gt a 403 forbidden popup message.
I've created a custom image browser controller pointing to ~/Content/images.
and in my view, i am using the custom browser controller within my code
#(Html.Kendo().EditorFor(m => m.QuestionText)
.Encode(false)
.HtmlAttributes(new { style = "width: 100%; height: 200px" })
.Name("EditQuestionText")
.Tools(tools => tools.Clear().InsertImage())
.ImageBrowser(imageBrowser => imageBrowser
.Image("~/JFA/QuestionImages/{0}")
.Read("Read", "JFAImageBrowser"))
)
I've compared my code to the sample project from Kendo for the EditorFor (which will browse the folder) but can find no discernible differences... I also cannot find much in the way of other people who are having this problem so i suspect there is a setting that i cannot find that is causing my issue, any help would be GREATLY appreicated
my image browser (taken directly from the demo)
public class JFAImageBrowserController : EditorImageBrowserController
{
private const string contentFolderRoot = "~/Content/images";
public override string ContentPath
{
get
{
return contentFolderRoot;
}
}
additionally, using Fiddler the click event for the "Insert Image" button is
GET /JFA/JFAImageBrowser/Read?path=%2F HTTP/1.1
where as the demo is
POST /ImageBrowser/Read HTTP/1.1
I don't know why the demo is using a POST where as mine is using a GET, unless this is because of the overridden image browswer
That code looks fine. Can you make sure your JFAImageBrowser controller looks something like this?
public class BlogImagesController : EditorImageBrowserController
{
//
// GET: /BlogImage/
public ActionResult Index()
{
return View();
}
public override string ContentPath
{
get { return AssetFilePaths.BlogContentPath; }
}
}
It's important that it inherits from EditorImageBrowserController
Also, a 403 may mean that the user doesn't have permission to access the directory. Check the permissions for the user you're running as.
It turns out my problem was in the _Layout page. I was using bundling and either
A) I made some error when setting up the bundling
-or-
b) the bundling didn't work as expected/intended.
either way i added the individual script/java script references and it works as expected.
Here is the solution to this problem
the page this issue fixed was it kendo forum
http://www.telerik.com/forums/implementing-image-browser-for-editor
and the direct link for the demo
http://www.telerik.com/clientsfiles/e3e38f54-7bb7-4bec-b637-7c30c7841dd1_KendoEditorImageBrowser.zip?sfvrsn=0
and if this demo didn't work you can see this sample i made from above
https://www.mediafire.com/?9hy728ht4cnevxt
you can browse the editor through HomeController and the action name is homepage (home/homepage)
& I think that the error was in different uses of paths between the base controller & child controller you make.