简体   繁体   中英

CRUD in Sharepoint 2010 list, controlled by Javascript

Basically there is a MOSS 2010 site, and it contains a list of all user IDs that have accepted some terms. Of course these terms must be presented, and they should try to impede site navigation without accepting them. The trouble is that the page they will access is editable only in HTML, so I can use Javascript as the only scripting engine.

So there is Site1 - Sharepoint, Site2 - HTML page.

  1. User visits Site2 for first time, gets terms.
  2. The user clicks Accept, it is recorded in a Sharepoint list located at Site1 , terms disappear and the user sees regular website Site2

Security is the last problem. So let's assume the user is already logged in to the Sharepoint site.

I've tried iframes, but security asks for same domain/port/protocol.

Use JSONP. Send whatever data you need to as arguments in a URL that is set as the src of <script> element. Have the requested page return whatever data you need as JavaScript. That script will be executed and can do something like call an onaccepted() function in your page.

user sees regular website Site2

I am confused with statement above. You have written that site2 is just an HTML page. If that is the case I will just assume that site 2 refers to an HTML page which must be presented to the first time user when he is visiting Site1.

You can achieve this with a simple code on the default page.

  1. Set default.aspx as the default page of Site1.

  2. When the user visits Site1, a small piece of code runs, may be as a webpart or a delegate, which checks if the incoming user is in the Accepted terms list. If yes, it does nothing, else it redirects to site2.html.

  3. The site2.html is a regular html page with Accept or Reject button. Upon accept, you will have to utilize Jquery code to put the user into the list once he clicks accepts.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM