how to open document in browser with angular? - angularjs

I have a table with in it documents with their filelocation ie url. What can I use /do to open this document in the browser ? Or when this is an ms office file in word or excel?

A quickwin but probably expensive solution is to upload or your files to googledrive by API (https://developers.google.com/drive/v2/reference/) with restrictive permissions (a unique authkey per file) then you iframe the google drive's url in your webapp.
This is expensive as if you have many users/files, you'll need more space on google drive.
If your users are signed in using google, then it's better for security as instead of an authkey you can handle permissions by email.
Otherwise, you can use some javascript word/excel editor like http://webodf.org/.
Hope it helps!
Younes for Wishtack.com

Related

How to solve: This URL is already in use by another Google service (Sites Google)?

I have just verified the custom URL for my Sites Google. When I want to assign it, it says, "This URL is already in use by another Google service." Meanwhile, I don't remember using the URL for any Google service. I just verified it with Google Webmasters. Anyway, I use Plesk for my domain services. Any help?
This is my site: https://sites.google.com/view/alvisyhrn/home
This is my URL: www.alvisyahrin.com
Your help will be much appreciated.
Thank you.
I use Google Domains but was running into the same error message. This post suggests creating and then deleting a synthetic redirect record (e.g. www.alvisyahrin.com -> http://google.com) in Google Domains. This displayed a "All resource records in this synthetic record will be deleted." message before deleting, and seems to have done the trick, since as soon as I deleted the synthetic record Sites was willing to use it as a custom domain.
I realize you're using a different registrar for your domain, but visiting your site now it looks like you managed to get things working (I assume by doing something like this). Hopefully this will be a helpful breadcrumb for Google Domains users that run into this, at least.

Google app add attachment option to email

I want to create a google app that will let you add a file from a cloud service as an attachment to an email. From reading the google documentations it seems like you can't do anything while the user is creating an email, but the attachments.me app is able to do it. When composing an email, their app will pop up a button next to the regular attachment app letting you select an attachment from the cloud. I am new to working with google apps and I do not understand how attachments.me is able to do this. If anyone has an idea as to how this is possible please let me know, thanks.
To add features to the GMail UI you'd probably have to implement this as a Chrome extension (and/or Firefox or IE extension to support those browsers). In fact, this is apparently how attachments.me does it.
What the extension does is load when you go to gmail.com, identify a place in the UI where it wants to add its button(s), and inject them using JavaScript. You may then want to use JavaScript again to do something like add a link to the text of the email before it gets sent to the media you want to attach from the cloud, or intercept the "Send" button to tell your server to send the message with the cloud attachment included (assuming the user has authorized your server to send as them -- this can have serious security implications)
Beware, modifying complex web app UIs like GMail's using a Chrome extension can be very difficult; GMail may make changes that break your UI or functionality, and they may do it whenever they want, or only to a subset of users, so you'll have to constantly keep up with these changes to fix bugs. All in all I don't recommend it as a way of adding attachments to emails.

edge caching secure content on google app engine

In my app, I have to serve huge secure files ( svg drawings etc ) that I want to show only to logged in user. File do not change much, and if it does, It do have different url, so I would like to use edge cache on google app engine for faster loading to already logged in user.
My question is, how do I make it secure ? i.e. if the user logged out and if someone else use his browser can he see that content ? if so, how do I prevent it ?
Related: How do I prevent browser from remembering a url of a content on my website.
One of the solutions could be using Google Cloud Storage with ACL, i.e. in the way that only a particular logged in user has access to that file. This solution is limited to Google Accounts though.
UPDATE: Google Cloud Storage now has a short-life signed URLs:
"...you could provide a signed URL to a user which would allow the user to access that resource for a limited time. Anyone who knows the URL can access the resource for a limited time. (You specify the expiration time in the query string to be signed.)"
- so, that could be even closer to what you need.
Another solution is that you serve your huge file from your dynamic handlers. This however will consume a lot of CPU and bandwidth. Also, you'll still be limited by GAE quotas.
Related: you can't prevent browser from remembering visited URLs or any other kind of history. It depends solely on the specific browser and user preferences (not accessible to your app / javascript/whatever). The only thing you can ask your users is to clear their history, cookie and whatnot when they log out.
You could set expiration in the appconfig
Sorry I just have a german link (just try, maybe google switches to your language)
http://code.google.com/intl/de-DE/appengine/docs/java/config/appconfig.html
As long as not expired the browser could cache the file locally. This results in a small load time. However, if the cache is too small, the browser will request the file again.
A good browser will only make secured file to the logged user available.
However, you have no guarantee which browser is in use. Your user could always download secure file and publish them anywhere.
When a user give the login to third users, they could all the time access the secured files.
I don't think you could avoid to remember any links. In some way it is a contradiction to the above.

Limiting access to a static file with GAE

I have a static file that I don't want to be publicly available. Is there a way to limit access with app.yaml so that it can only be loaded by its own domain?
web2py based solutions are also welcomed as I'm using it on top of GAE.
Thanks!
You can limit access to it with 'login: required' to require login with a Google account, or 'login: admin' to restrict it to admins only. If you're only concerned about abuse, you probably want to look into the DOS API instead.
I assume you want to use web2py authentication for this. You have to follow a few simple rules. 1) files in app/static are public files. 2) files that you want to subject to authentication go in app/private. Then create you own web2py action to server the content of private/
#auth.requires()
def private():
import os
file = os.path.join(request.folder, 'private', request.args(0))
return response.stream(open(file,'rb'))
If you want to use the role based access control you need to store the filename in a database table and auth.add_permission to the group to the record.
You get faster responses and more competent responses if you ask questions to the web2py mailing list.

attach spreadsheet to mail message with GAE

I am running Django on Python SDK of GAE.
My application is an order processing app for a small business. I want to email a delivery note in the form of a spreadsheet to customers on completion of an order. Now I have been reading the docs and its no problem sending attachments, just that only certain file types are allowed in GAE.
I have created a spreadsheet document using the Google Data API, but my problem is how to get the Google Spreadsheet document emailed to the customer. My App Engine is on a hosted domain, so normal gmail accounts don't have access to it and many of the customer email accounts won't even be gmail anyway, the Google Spreadsheet attachment will just be a XML Atom object pointing to a doc hosted on my account which won't be accessible to outside users anyhow, right?
Is there any way to copy this Spreadsheet object and attach it to the email, so it can be opened locally by users with no access rights to my google doc, it can basically be opened offline. My code looks like this:
new_entry = gdata.GDataEntry()
new_entry.title = gdata.atom.Title(text='Delivery Note from ' + company.company_name)
category = gd_client._MakeKindCategory(gdata.docs.service.SPREADSHEET_LABEL)
new_entry.category.append(category)
doc_entry = gd_client.Post(new_entry, '/feeds/documents/private/full')
.....now build the spreadsheet
doc_title = 'deliverynote' + '.' + doc_entry.title.type
.....build the email body
mail.send_mail(sender_address, to_address, subject, body, attachments=[(doc_title, str(doc_entry))])
Doing it this way however when the customer receives the mail, when they try and open it they get an unexpected error (the exact words that Google uses when it tries and opens it).
The other alternative of course is to try and convert it to an Excel file. Methods are provided by google to export the file as an excel file to the local file system, but then the program is faced with the problem of uploading it again without any manual user intervention. Besides the excel file type isn't supported by GAE as a legitimate attachment type.
Has anyone got any ideas?
Interesting question.
Since you use GData to create it, your GAE app should have rights to get a copy of it and attach it. Not sure what format it would be in, and how the guy that receives it uses it though.
If you attached a Google spreadsheet to an email, how would the person open it? Since Google runs "on the web"? I know Google now has an offline option, but I haven't tried it yet. I think it requires install Google Gears and other stuff on the local machine.
Do you want people to share the spreadsheet or each get their own copy? Could you just change the rights to let more people have read-only or update access?
Do all your recipients have Excel? Do they all have Google App Accounts?
Neal Walters

Resources