Is that true that we can't create a browse button in sharepoint? - sharepoint-2010

Hello guys I am stuck at a point and i want ur help.First of all i want to clear that i am not a sharepoint developer but my boss gave me a task which i have to complete in 2 days . I want you ppl to help me to accomplish this task.I have two questions in my mind
1) Is that true that we can't create a browse button in sharepoint?
2) If there is a way to create browse button in sharepoint then pls explain here.And if not then what should i do to get browse button in sharepoint.
EDIT:-
I want a browse button like in picture,onclick which opens file uplod dialog.
Here's the picture.

No that is not true. You can put any html in your web parts, master pages, or page layouts:
<input name="uploadedfile" type="file" />
There is also an ASP.NET file upload button available, like so:
<asp:FileUpload runat="server" id="FileUpload1" />
The "official" SharePoint way to do it would probably be having a document library in your site and doing this with javascript:
NewItem2(event, "/path/to/list/NewForm.aspx?PageType=8&ListId={fdcbd17c-9b66-449e-8875-d25de53f98d1}&RootFolder=");javascript:return false;
and if you have a web part (or any C#) generating this javascript, you should use the document library's DefaultNewFormUrl

Related

webview2 vb.net accept cookies button press

I previously used the old ie based control
But have a new project getting data from a web page
Its a login page so im hoping to use the control to grab login then get the relevant data then log out.
However when loading the page in the control the html elements dont apear to have an id.
The first problem I have is the accept cookie button which in dev tools shows as
<a class="acceptAllButtonLower" tabindex="0" role="button" aria-hidden="false" style="">Accept All</a>
Next button to press is
<button class="sign-in-btn" ng-click="vm.signIn('\\',true)">
SIGN IN
</button>
i have tried
WebView21.CoreWebView2.ExecuteScriptAsync("document.getElementsByClassName('acceptAllButtonLower')[0].click();")
and
WebView21.ExecuteScriptAsync("document.getElementsByName('acceptAllButtonLower')[0].click();")
with no luck.
Im not even sure the click is being passed etc.
Can someone kindly point me in a better direction.
Ta
Have tried the above with no success

How to generate Facebook Share buttons to dynamically fetched content?

Here we have an article on how to add share buttons to a web page and it works:
https://developers.facebook.com/docs/plugins/share-button/
But on my website, I have a "Load more" button to fetch content dynamically and I have no idea how to add a Share button to newly generated items.
Obviously adding this div does not make any effect so I probably need to call some Facebook function to the newly created divs.
<div class="fb-share-button"
data-href="https://www.your-domain.com/your-page.html"
data-layout="button_count">
</div>
Is anyone aware what is the name of this magic function?
OK, found the solution here:
https://developers.facebook.com/docs/javascript/examples#dialogs
It shows how to trigger a share popup. It also gives more control over the look of the share button which is also what I've been looking for.

joomla user authentication by my own custom written form inputs

I've been struggling to find out about user authentication using your own form elements.
In order to make it clear, heres what i want to do.
I'm going to have a button which is going to redirect to a page.
Now, this page can be redirected to in the following ways.
A popup opens where the user needs to enter their email address and password.
My form is like this
<form action="userlogin.php" method="post">
<ul>Email
<li><input type="text" id="email" name="email" /></li>
</ul>
<ul>Password
<li><input type="password" id="pass" name="pass" /> </li>
</ul>
</form>
The user clicks the submit button and if the email address and password exist then we have a successful login and if they dont then we add that user in the database and then redirect.
I dont understand how to authenticate user login using this form i've mentioned about. Which file do i have to post it to and how can it work like a normal joomla login.
Please do help.
Thanks.
You can write your own authentication routine relatively easily in two steps.
Authentication Logic
For the authentication logic, in the plugins folder, there is another folder called "authentication". Aside from the default joomla authentication, there is another called "example.php", which you can clone and work on from there. These are the plugins that you can enable/disable in the plugins manager in your Joomla Administrator, so you can look at them and see the different ways that they authenicate (gmail, openid, etc.).
Be sure to scan/replace all the naming used in the copied file (it's not very big), and when you're happy with it, make an entry in table jos_plugins so that you can enable it in the Joomla administrator.
Your Form (using template atomic as the example, and assuming you're using mod_login)
Within /templates/atomic/html/mod_login you should have, a file called default.php. This is where you change the form to suit your needs, and incorporate into the authentication logic your wrote in the plugin.
Popup Approach
That will depend on the template you're using, and how it, or you, generally handle popups. Rockettheme have many popup modules (some being free) which demonstrate how you could do it that way, or jquery if you're comfortable with that, the list goes on....
You could override the existing login form and open this in a modal popup?

Finding page id of parent form from pop up form

I have two pages
Master page
page using the master page
I am opening a pop up using "window.open" in the second page.
I have textbox control in the second page and trying the find the control in the pop up page using below code.
window.opener.document.getElementById('textbox').value
This code could not found out the control.
Then I checked the page source of second form and dound out the format of control id. It was like below.
"_ctl0_ContentPlaceHolder1_textbox"
and changed the code to below and got success.
"window.opener.document.getElementById('_ctl0_ContentPlaceHolder1_textbox').value"
My query is -> I am not about this approach. Please correct if i am doing anything wrong.
With ASP.NET 4.0 you have the option to set ClientIDMode that could help you in this case.
Setting ClientIDMode to "Static" will ensure that your ID value will not be altered by the framework.
In your page where you have textbox:
<asp:TextBox ID="MyTextBox" runat="server" ClientIDMode="Static" />
Then you should be able to get the value by doing something like this:
window.opener.document.getElementById('textbox').value
Ref: MSDN - ClientIDMode
The problem is that if you use a masterpage the controls of your contentpage will be renamed making it hard to access them from JavaScript.
Use the following code to solve the problem:
<asp:TextBox ID="textbox" runat="server" ClientIDMode="Static"></asp:TextBox>

How Do I Open A PDF In Sitecore

How do I open a pdf document stored in Sitecore when a user clicks a link? The pdf document is stored in the Media Library.
Here's the code I have now:
Sitecore.Data.Fields.LinkField linkField = item.Fields["Url"];
tab.NavigateUrl = linkField.Url;
Same rules apply to a PDF media as to any other type in media library. If you need just to retrieve the media url to construct a link, do the following:
MediaItem mediaItem = linkField.TargetItem;
if(mediaItem != null)
MediaManager.GetMediaUrl(mediaItem);
You can also simply use web control or xsl control to render the link:
Web control:
<sc:Link Field="Url" Item="if you need to process specific item" runat="server" />
If your question concerns browser behavior when the link is clicked, set ForceDownload to true:
<mediaType name="PDF file" extensions="pdf">
<mimeType>application/pdf</mimeType>
**<forceDownload>true</forceDownload>**
<sharedTemplate>system/media/unversioned/pdf</sharedTemplate>
<versionedTemplate>system/media/versioned/pdf</versionedTemplate>
</mediaType>
Be aware of problems with Firefox on a Mac, as PDFs wont seem to work there.
For that you need to setup some stuff according to this.
if you can't access that is basically tells you to go to the web.config, find this:
<mediaType name="PDF file" extensions="pdf">
and change the
<forceDownload>false</forceDownload>
to
<forceDownload>true</forceDownload>