MS WOPI: How to remove edit option in iframe - ms-wopi

I am using MS Wopi when the file is open for the view so how to remove the edit option as seen in the image.

I have done something like this,
You can have Edit and View separate in the View. So I have passed some parameters with the session context in WOPI action URL to identify what is the operation.
Ex:
https://{_baseUrl}/wopi/files/{combinedDocumentId}?sc=<your value>&wopisrc={wopiHostUrl}
By checking that you can get value inside the Session Context with,
Request.Headers["X-WOPI-SessionContext"]
Keep in mind this value comes with Base64 encoded.
Then you need to decode it and pass it to the GetFileInformation function.
With that, you can set,
ReadOnly = true
UserCanWrite = false
for disabling edit on that iframe.

Related

Why does the Google Tag Manager automaticalls has a Trigger event for gtm.load for my custom variables?

So I want to Trigger my Tags when the user accept cookies, obviously.
I tried different approaches, JSVariable, Custom JS, First party cookie and datalayer variable.
Now I have them all set in Triggers, for example if the JSVariable is true or if the first party cookie contains the cookie value I set, or the datalayer variable contains filled.
Now in Debug mode these Triggers actually seem to work. They all get Ticks under firing triggers, but the Tags don't seem to Trigger because I get another Trigger for some reason which states
gtm.load equals [variableName] (for example: gtm.load equals myJSVariable) and it always has this red X.
I just don't seem to find an answer to this problem.
Thank you all very much
So if anyone experienceses something similar (in case I am not the only dummy):
When you type in the eventname, it is about WHEN to look for your variable basically.
So for example you would enter gtm.load, when the site has been completely loaded. Then GTM would look for your CustomVariable

PHPmailer: attaching a session variable to an email

Due to the fact that I have to create a PDF on my server using the uniqid() function, I must subsequently refer to it as a PHP variable in the rest of my code.
The variable that I create for it is a session variable. I later refer to this session variable in a separate file, which contains my PHPmailer code. I use the following line to attach the session variable to the mail:
$mail->AddStringAttachment($_SESSION[$attachment], "attachment.pdf");
The mail is sent correctly with a PDF attached, called attachment.pdf. However, this attached file, attachment.pdf, is empty. This is despite the fact that the PDF on the server, which the session variable refers to, contains the complete set of data. If I attach the name of the PDF, instead of the session variable, it works correctly.
I don't know why the use of a session variable when attaching the PDF is resulting in an empty file being sent. If anybody may be able to explain why this is happening, or suggest an alternative solution, I would greatly appreciate it!
I'm guessing that $_SESSION[$attachment] contains the name of your generated PDF file, so what you are doing here is attaching the name of the file as an attachment, rather than the file itself. You should probably be using this instead:
$mail->AddAttachment($_SESSION[$attachment], "attachment.pdf");

Add Eventhandler to Object of type Word.Application

With the following code I open a a new word document. To save the word document programmatically I want to add an event listener to the object, which occurs when word will be closed. Is this possible?
Set objWord = createobject("Word.Application")
objWord.visible = True
Set objDoc = objWord.documents.add()
Call objDoc.content.select()
Set selection = objWord.selection()
Call selection.collapse()
objDoc.Close
Set objDoc = Nothing
objWord.Quit
Set objWord = Nothing
EDIT:
I try to explain better what I want to do. My Lotusscript Agent should open a word document for the user. The user types in some text and then closes the word document. Instead of showing the save dialog of word I want to save the document programmatically to embedd the file as attachment to an notes document. Until now I have not found a solution to get an handle of the event when word is closing.
I think this link on one of the ldd wikis probably has what you need. If you are a little clearer on what you need, you may get better answers though.
I think you are wanting to be notified when word closes so you can force a save or something correct? You can already force the save using similar lotusscript to how you are closing it, you don't need to wait until they close it themselves.

appending a form parameter to url in code igniter

I have tried my best to search for an existing question with smiliar issue but was not able to find one. Here's my situation
I have a controller named search which accepts a parameter "search term", when this controller is called directly from URL like www.xyz.com/search/red+car it returns results and the URL in browser address bar is www.xyz.com/search/red+car but when the user submits the search from a from in webpage with same term, the results are coming fine but the URL does not reflect the search term.
If I do a redirect the form POST data is lost, although resubmitting the POSt is not a solution in my case either. I need a way to change the URL so that it shows the search term.
Thanks in advance for your help, please be gentle as this is my first question.
#Vlakarados - I am trying to use same controller to provide search results from post data and controller parameter. Both work fine but when using search form on webpage the search parameter is not reflected in URL.
#Rakesh Shetty - The actual method is very long, but here is the compressed format
build query as per post data and passed parameter.
populate view with results
render the view
Thanks everyone for suggesting various solution.
I used jquery to change the form action parameter, now when ever the dropdown selection is changed the value is appended to the action parameter. I also took out the dropdown from being part of post data.
There are 2 dropdowns one for area and other for zip code. This new approach works with bot dropdowns and my exsting code of controller works without any major change.
I used the following javascript code to create new action parameter when ever user changes the area. Same goes for ZIP code.
$("#cityname").change(function(){
var action = $(this).val();
alert(action);
$("#searchform").attr("action", "search/" + action);
});
I think I was not able to clearly explain my situation otherwise you people would have suggested this long ago.
The better way to do it is in your controller:
function search($search_query) {
// .. use your query as you normally would - display products, posts, messages
$data = array('search_query' => $search_query);
$this->load->view('search', $data);
}
// use this method as the form action
function search_proxy() {
$search_query = $this->input->post('search');
// if needed urlencode or other search query manipulation
redirect('controller/search/'.$search_query);
}
This way you will have no problems and will only work with data in your url.
Edit: The second option is yo use JavaScript - when user submit's the form, change the form's action to include the searched query in form action

Get contents of password variable in response file

I'm evaluating install4j. The installer I'm trying to create uses a passwort text field. The value of this field should be written to the response var file as encoded value. Additional the installer must allow two installation paths:
a normal path ("advanced") that allows the user to see every screen and check/enter every value - using this path, the password field works fine.
a simple path that should use all values of a former installation that was succesful, to allow the user to start an update installation without seeing all screens.
Using the simple path (without showing the screen that contains the password field) it seems that at installation time only the encoded variable ("passwordField".encoded) is available but not the "real" password variable. Is there a chance to get the "real" password variable without showing the screen that contains this variable - maybe by using some kind of "decoding method"?
Thank you very much for your help!
Frank
Add another password component with the same variable to a screen that is shown on the simple path and set its visibility expression to "false". Then that invisible component will update the variable with the decoded value.