Programmatically initiate file selection window on igUpload widget - infragistics

Let's pretend we have to make a simple web page that allows users to upload files on the server.
When a user arrives on the page, the files selection window has to open automatically.
The user has to be able to select and upload multiple files at once.
igUpload control does fit nicely in this scenario.
Unfortunately, I didn't find a way to programmatically display the browse window to select a file for upload, without having to click the Upload File button. I'm using Ignite UI 13.2, which documentation could be found here and there is a related question from Infragistics forum here.
I've seen few examples, where overrides of private methods are suggested in order to modify default behavior, but currently, I couldn't find the appropriate place to intervene.

igUpload is using <input type="file"/> and in most browsers it is not allowed opening file selections window( via javascript ) because of security reason( Trigger a file input to open via javascript) . Probalby only IE allows you to achieve this - you can try:
var id = "upload";
$('#' + id).igUpload();
setTimeout(function () {
$('#' + id + '_ibb_fp').click();
}, 0);

Related

C++ Outlook MailItem replace body and discard on close

I have an addon in Outlook which adds warning to mailbody and links in the email when email is coming from external or untrusted sources.
Anyway, when I replace something in body, when email is opened in full view (no reading pane, double click full view of mail item), I hook mailItem close even and I discard changes, everything works well. (mailitem.onclose(olDiscard))
When I do this with reading pane on, when I discard the changes, Outlook still either saves the changes or when user is trying to close Outlook it asks user "Do you want to save changes to ....." and if user clicked on multiple emails during this period, it shows popup question for ALL emails user clicked and we replaced its body.
What's the solution here? What can I do to fix this? I want to make changes to link and to body, but discard them when user clicks away on another email. End goal is not having Outlook to ask user "Do you want to save changes ..." popups. Please advise.
I can't also make changes to inspector, because inspector is read-only.
P.S. plugin is written in C++.
The solution is to avoid modifying the message body if you do not want to keep the changes.
If you want to show a warning to the user, add a task pane to the inspector. Or simply stamp the message with a category - it will be shown in the inspector.
The Outlook object model doesn't provide anything for handling hyperlinks clicks. As a possible workaround you may consider implementing the following functionality:
When the item is selected or opened in Outlook you may replace the original URL with your own where you can pass the original URL as an encoded parameter if needed. So, if it is allowed to open the URL you can redirect the request further. Note, you can use the SelectionChange event of the Explorer class which is fired when the user selects a different or additional Microsoft Outlook item programmatically or by interacting with the user interface. This event also occurs when the user (either programmatically or via the user interface) clicks or switches to a different folder that contains items, because Outlook automatically selects the first item in that folder. However, this event does not occur if the folder is a file-system folder or if any folder with a current Web view is displayed.
Also you may consider handling the Open event of Outlook items which is fired when an instance of the parent object is being opened in an Inspector. When this event occurs, the Inspector object is initialized but not yet displayed. The Open event differs from the Read event in that Read occurs whenever the user selects the item in a view that supports in-cell editing as well as when the item is being opened in an inspector.
Another possible solution is to register a custom URL handler. So, basically, your registered application will be launched instead of a web browser where you can decide whether to launch a web browser and follow the URL or not. See Installing and Registering Protocol Handlers for more information.

Stopping multiple view calls generated via frenzied button clicks (Django app)

I'm uploading an image file in a basic Django web app. There's an upload button in the html template wrapped around by a form tag. Once the upload button is pressed, the underlying view takes over and processes image upload.
In the Chrome browser of my colleague's Macbook, pressing upload multiple times really quickly manages to call the underlying function multiples times too. I end up getting a plethora of copies of the image being uploaded.
However, this isn't replicatable in my own environment's Firefox (Ubuntu OS). Seems this issue is browser sensitive?
In any case, how do I cut off this code behavior? If the user goes into a click frenzy, I don't want multiple images to go up. Can someone guide me how to handle this in Django? I would prefer a non-JS, server solution too.
Note: Let me know if you need to see my related code.
Many people faces this issue. If the submit button called 3 times wihtout waiting to refresh the browser, it will gonna add 3 times.To prevent that you can use jQuery.
For example on form submit you can show the loader or disable the submit button,
$('#login_form').submit(function() {
$('#gif').css('visibility', 'visible');
or
$('#button').prop('disabled', true);
});
Edit for server side implementation:
I do not suggest this for user interface point of view but if you can also valid submits using sessions or cookies.Generate random token in your view and set this in your form as hidden input.
for e.g.,
def checkform(request):
form = ExampleForm(request.POST or None)
randomtoken = #generate random token here and set in session or cookie
if form.is_valid():
# check_token here
session_value == request.POST.get('your_hidden_token')
# if matched than change the random token and save your data else do your restriction processing
render ( request,'template.html',context={ 'form':form,'randomstring':randomstring } )

Is that possible to add a custom button and UI component to file browse dialog in MFC or in win32?

I am trying to create a file browse dialog in my windows project. When user was trying to save the file, he can save the file on local or on his cloud account.
For example, when user click save, by using CFileDialog, we can open a file dialog like:
When user wants to save his file to his cloud account, he can click the button which beside "New folder" on the top of this dialog, then this dialog will display the folder organization on the cloud account:
So I want to ask that is this kind of dialog possible in MFC ? I was searching it for several hours, but I think none of SHBrowseForFolder or CFileDialog can satisfy it.
I need to key component:
1, we can add customized button on the top, like the "cloud" button.
2, the content layout or style in the middle can be customized.
Is this kind of UI possible in MFC ?

Oracle APEX Select RDS Tab in URL

I am developing an application in Oracle APEX 5.1. I have a page which uses a region display selector. The default tab has general information which should be the active tab for anyone navigating to the page from within the app. The other tabs are detailed reports which are relevant to specific users. I want to provide these users with a URL to access the tab containing the reports that they're interested in.
I created a page variable, P14_ACTIVE_TAB, which is the static ID of the region associated with a particular tab. I use this variable in the following JavaScript code..
selectTab = "$('#myRDS .a-Tabs').aTabs('getTabs')['#" + $v('P14_ACTIVE_TAB') + "'].makeActive();";
console.log(selectTab);
eval(selectTab);
I have tested the code and it works correctly if I use it on a button, select list, etc. however I have been unable to get it to properly execute when a user navigates to the page using a URL like
f?p=100:14:::::P14_ACTIVE_TAB:myReport
If I define a dynamic action on page load it appears that the page is being rendered after the code is executed so I still get the default tab. If I look at the console output I see the correct code, which I can then cut/paste as a console command to get the desired result. So it appears that I have the right code being executed at the wrong time.
Does anyone have any suggestions how I can define the dynamic action to execute after the page has been rendered so the correct tab will be made active?
Thanks.

How to show open file dialog in sitecore content editor?

I created a button and assigned command to it. Once user clicks the button open file dialog (<input type="file"/>) should be displayed. When file is selected it has to be uploaded to the server. So what is the fastest way to show open file dialog and get user input?
First upload in Sitecore is not straight forward. If we take the example of the Package Upload Form, we see that it makes use of 2 aspx pages. Moreover, when uploading on the CMS, it will store the information into the database.
Possible Solution:
Create an Upload Form which will appear when the user clicks on the button.
When user selects a file, you will need first to upload it before being able to have access to it. Once uploaded, you just need to read the Zip file in order to know the structure.
Code Example:
Check the UploadForm.xml. Path: Website\sitecore\shell\Applications\Install\Dialogs\Upload package
You will see the 2 aspx pages in the same folder. The codebehind is found in the Sitecore.Client.dll
Thanks