Sitecore 6.6 Shell Excel Uploader - asp.net

A sitecore instance was recently upgraded from 6.1 to 6.6. There was an upload command that opened a custom xaml dialog. This had an upload button on it which would open another modal with:
UploadPackageForm.Show(MyConstants.FolderPath, true);
While testing some points of functionality across the site I ran into an error while using this uploader saying that the file being uploaded needs to be a zip file. I'm guessing that somewhere along the way from 6.1 to 6.6 the package uploader was given a check for the file type being uploaded. I've been looking around for dialogs that sitecore comes with that I may be able to use. These look promising:
I can't seem to get the file path from this one although I think I could set a property on args passed into the OnOK event which I will try tomorrow.
Sitecore.Shell.Applications.Install.Dialogs.AddFilesDialog
I'm not sure how I would show this one:
Sitecore.Shell.Applications.Dialogs.Upload
Another option is to try making a custom dialog. Any thoughts and ideas are appreciated.

I had a look around the code that deals with the file explorer (that does not restrict the upload file type) and found this. Might be useful:
public static void UploadToDirectory(string directory)
{
Assert.ArgumentNotNull((object) directory, "directory");
Error.AssertString(directory, "directory", true);
UrlString urlString = new UrlString("/sitecore/shell/Applications/Dialogs/Upload/Upload.aspx");
urlString.Append("di", directory);
Context.ClientPage.ClientResponse.ShowModalDialog(urlString.ToString(), "files:uploaded");
}
This method is in Sitecore.Shell.Framework.Files in Sitecore.Kernel

Is the upload for site visitors or Sitecore users within a Sitecore app? Regardless, the UploadPackageForm, in 6.6, validates that the file is a valid Sitecore package (which is always a ZIP file). 6.1 didn't do this.
DOn't use the AddFilesDialog as that's also within the context of installing a Sitecore app.
I'm not exactly sure what the upload is for but if it's for the rendered site, you should create your own. If it's for a Sitecore app, there are several depending on what you need. There's the FlashUpload (3 types under /sitecore/shell/Applications/FlasUpload), the Media uploads at /sitecore/shell/Applications/Media/Upload****.

Related

loading css on runtime is half-failure/half-success

I have tried for my app to load fonts on request. I tried to read fonts from the a project directory which is created by my app, and it reads all the info it needs.
First of all, I want to ask if there is a way to know if there is an app-storage:// like in adobe air, because THAT IS KILLING ME! I cannot create temporary files to be read on runtime by the app and place, for example, a style sheet with the new loaded fonts on runtime via JS.!
If there is one, please let me know!!!
Now a very dirty solution. This is what I had done up to now:
Just to let know everybody, my solution relies on :
run the app as administrator (a must to have)
softlinking the user's project font folder.
now lets get the facts:
webkit cannot render fronts coming from a "file:///" url
I had tried using file:/// with no success, and neither converting the SVG fonts to base64 did the trick at all. Trying to do on runtime stylesheets was even worse, so looking for solutions I had to rely on command prompts. For now I'm running this on windows and works pearls:
var WinDoExec = function(cmdline){
var echoCmd = ["C:\\Windows\\System32\\cmd.exe","/C"];
echoCmd = $.merge(echoCmd,cmdline);
console.log(echoCmd);
var echo = Ti.Process.createProcess(echoCmd);
echo.setOnReadLine(function(data) {
console.log(data.toString());
});
echo.stdout.attach(echo.stdin);
echo.launch();
};
so from here, I had to create a mklink (soft link on ntfs) from the user's project font folder to the application font directory, so it could be accessible on runtime.
WinDoExec(["mklink","/D","C:\\Program Files(x86)\\myapp\\Resources\\assets\\fonts\\userfonts","C:\\Users\\windowsuser\\projectAppFolder\\ProjectName\\Fonts"]);
with this, creating a soft link into the application in runtime fixes the issue of loading the custom fonts for the user's project into the runtime app...
I know this is kinda "abusive" with the program environment, but I really wish there was a way for the app to have a url accessible path (such storage url path or temporary url path) in order to process things on runtime. I could copy the fonts into the temporary url container folder and do my stuff without affecting the app system folder at all.
So if you guys on tidekit read this, please allow developers to have accessible url paths for temporary objects (like user's svg/ttf files) that I can copy there and use on runtime.
Thanks.

Wordpress File Upload Hook

I am trying to hook into the Wordpress file uploader and would like some suggestions. I would like to be able to grab the path of the source file (not WP path; i.e. K:\docs\file.pdf) so I can download another file of the same name (different extension) & path automatically (i.e. K:\docs\file.txt).
Wordpress provides hooks for after the file is uploaded but all path information at that point is internal to wordpress.
Thanks in advance!!
the path information can be obtained from normal php functions like pathinfo() and realpath() for example .
Bit too late to the party but I think what you are asking for is to find the source of the document in the clients system and based on that you want similar files there to be picked up by the browser and then sent to the user.
I think it will be a fairly complex thing to do, firstly you have to get the source of the document being added to the browser (I am not sure it can be done, but if it can be done then it will be via javascript) and then upload all the files one by one to the server hosting wordpress and you can do this by creating a custom page which will add the files uploaded to it as a wordpress attachment and then using something like jquery file uploader to upload files to that location.
But honestly, I think it would be a very complex thing, unless the client and the server are on the same machine.

Display Error in Oracle Apex Application

I have exported my oracle apex application and install on another computer. I used css file written by me on my application and also i have change some settings in Theme that i have used for my application. I have exported and installed that css file and theme also. but when i run my application, it is not display correctly. it display only Texts and Images that i have used in application. Theme is missing. but my Login page is display correctly. because it is not using my Template. Login page using Login Template in oracle apex. after logged, when i browse other pages in my application, they are not displaying correctly. Theme is missing on those pages.
The issue is with my Template. but i have imported it in to apex application.
How could i solve this ?
UPDATED
When i open the Developer Tools in my browser(chrome), in Matched CSS Rules section in Elements Tab, display only user agent stylesheet. there is no my stylesheet.
Check your theme templates you changed and see if they are really correct and contain the reference to your custom stylesheet(s)
Check the output of a page you know should have the stylesheet reference
Where do you store the stylesheet? Workspace files, Application files, or simply in the "/i/" (#IMAGE_PREFIX#) folder?
if the latter: did you copy over your stylesheet and is it in the correct location? You say you imported the application to another computer, so you might have simply forgotten to copy over those files.
What is your Apex version ?
How do you load your CSS files ? They are stored on the server (accessible using the image prefix #IMAGE_PREFIX#), loaded into the database (accessible using #WORKSPACE_IMAGES#) or stored on an external server (accessible using the full URL) ?
When you say "install on another computer", you mean load your application into another apex installation right ? Then are you sure the server is configured as the other one (especially image prefix) ?
Have you checked that templates are the same in the two applications ?
Use the console in Chrome or Firefox to check if there are any errors on your page, such as CSS files that can't be loaded.

File browser control to replace <input type="file">

I'm working on an ASP.NET web application for our corporate intranet users. I have a form where a user should provide a path to the file on the local network (something like "\localServer\someFolder\someFile.ext") without uploading the actual file. The issue is that users don't want to type the whole file path and want to use some kind of visual browse dialog.
The standard HTML <input type=file> element allows to browse for a file, but most of the browsers (except for IE) don't allow to access file's full path, so I think it should be done by some external component like Silverlight, Flash, Java applet etc.
I tried to do it with Silverlight, but I'm getting a SecurityException when trying to access file's full path using Silverlight's OpenFileDialog class.
This java applet http://jumploader.com/demo_images.html seems to do something similar to what I'm looking for, but it's focused on uploading files - I only need to be able to get file's full path and pass it to the server as a string.
Any suggestions would be appreciated.
Telerik ASP.NET AJAX RadFileExplorer has the functionality you're looking for:
http://www.telerik.com/products/aspnet-ajax/fileexplorer.aspx
You can use their Custom File Content Provider to hook the GUI to your server's file system.
http://demos.telerik.com/aspnet-ajax/fileexplorer/examples/server-sideapi/dbfilebrowsercontentprovider/defaultcs.aspx
This should be possible with Flash's uploading capabilities. SWFUpload has an API that you may be able to access from JavaScript to extract the selected file name without actually uploading anything. See docs here, for example getFile():
getFile is used to retrieve a File Object from the queue. The file retrieved by passing in a file id (the id property from a file object) or a file index (the index property from a file object).

How do I download an msi file via an asp.net button?

So, I've created my wonderful winforms app that I want to unleash upon the world, and now I am trying to create a simple website to host some basic information and link to the setup file (msi installer file )....
I have a button on the asp.net page and the setup file setupApp.msi in same folder as the asp.net page. I am currently trying the following:
Response.Redirect("http://./SetupApp.msi");
But this best guess at what to do is not working. Is there something wrong with Mime types here? What do I need to put in the click event to allow users to download this file?
The path you are passing in to the method is not valid (there's no server name called ".").
You can pass in a relative path and it should work fine because ASP.NET will resolve the path:
Response.Redirect("SetupApp.msi")
Or if it's not in the same folder, try one of these:
Response.Redirect("../Downloads/SetupApp.msi")
Response.Redirect("~/SomeFolder/SetupApp.msi")
Keep in mind that you don't necessarily have to do the whole redirect at all. Instead of writing code in an ASPX file you could just have a link to your MSI:
Download my app!

Resources