SharePoint driven rich text dashboard using jqueryui. (JQuery file)
Jquery file for Operations Dashboard
<script
type="text/javascript">
$(document).ready
(
function()
{
SP.SOD.executeFunc('sp.js',
'SP.CamlQuery', RetrieveListValues);
}
);
function
RetrieveListValues()
{
var query = new SP.CamlQuery();
query.set_viewXml("<View><Query><OrderBy><FieldRef
Name=\"SortOrder\"/></OrderBy></Query></View>");
var clientContext = new
SP.ClientContext("https://sharepoint.name/section/OD");
var oList =
clientContext.get_web().get_lists().getByTitle("ODLinks");
var items = oList.getItems(query);
clientContext.load(items);
clientContext.executeQueryAsync(function ()
{
if (items.get_count() > 0)
{
ParseList(items);
}
},
function(sender, args)
{
console.log(args.get_message());
});
}
function
ParseList(items)
{
var enumerator = items.getEnumerator();
var condition;
var region;
var color;
var title;
var id;
var section;
var header;
var textorlink;
var showtext;
var showlink;
var button1;
var button1link;
var button1color;
var button2;
var button2link;
var button2color;
var button3, sortorder;
var button3link;
var button3color;
if (enumerator.$2_0.length > 0)
{
while (enumerator.moveNext())
{
listItem =
enumerator.get_current();
title =
listItem.get_item('Title');
id = title.split("
").join("");
color =
"button_"+listItem.get_item('Color');
section =
"Section_"+listItem.get_item('Section');
header =
listItem.get_item('Header');
order =
listItem.get_item('SortOrder');
textorlink= listItem.get_item('TextOrLink');
showtext=
listItem.get_item('ShowText') ;
try
{showlink= listItem.get_item('ShowLink').get_url()}catch(err){};
//showlink
+= "&IsDlg=1";
button1=
listItem.get_item('OptButton1');
button1title=
listItem.get_item('OptButton1Title');
button1text=
listItem.get_item('OptButton1Text');
try {button1link=
listItem.get_item('OptButton1Link').get_url()}catch(err){};
//button1link +=
"&IsDlg=1";
button1color=
"button_"+listItem.get_item('OptButton1Color');
button2=
listItem.get_item('OptButton2');
button2title=
listItem.get_item('OptButton2Title');
button2text=
listItem.get_item('OptButton2Text');
try {button2link=
listItem.get_item('OptButton2Link').get_url()}catch(err){};
button2color=
"button_"+listItem.get_item('OptButton2Color');
button3=
listItem.get_item('OptButton3');
button3title=
listItem.get_item('OptButton3Title');
button3text=
listItem.get_item('OptButton3Text');
try {button3link=
listItem.get_item('OptButton3Link').get_url()}catch(err){};
button3color=
"button_"+listItem.get_item('OptButton3Color');
GenerateTopButton(section,
color, id, title, header, textorlink, showlink);
Writeup(id, title, textorlink,
showtext, showlink, button1, button1title, button1text, button1link,
button1color, button2, button2title, button2text, button2link, button2color,
button3, button3title, button3text, button3link, button3color);
GenerateDivs(id, title,
textorlink, showtext, showlink, button1, button1title, button1text, button1link,
button1color, button2, button2title, button2text, button2link, button2color,
button3, button3title, button3text, button3link, button3color);
}
}
}
function
GenerateTopButton(section, color, id, title, header, textorlink, showlink)
{
//This
makes the main button
var sec =
document.getElementById(section);
var btn =
document.createElement('BUTTON');
btn.innerHTML = title;
btn.id = id+"_button";
btn.type = "button";
btn.className = color;
sec.appendChild(btn);
if(header)
{
sec.innerHTML +='<br/>';
}
}
function
setText(id, num, btntext, title)
{
var sec =
document.getElementById("divregion");
var writeupid =
"#"+id+"_button"+num+"_content";
var
btnadd = "#"+id+"_button"+num;
var
btniframe = "#"+id+ "_button"+num+"_content_iframe";
var
spacing = "<p></p>";
var gen =
document.createElement('div');
gen.setAttribute("id", id+
"_button"+num+"_content")
gen.innerHTML += btntext ;
sec.appendChild(gen);
$(writeupid).dialog({
autoOpen:false,
show:'scale',
title:
title +' Writeup',
width:800,
buttons:
[{text:"Close",click:function(){$(this).dialog("close");}}]
});
$(btnadd).click(function() {
$(writeupid).dialog('open');
//$(btniframe).prop('src',
showtext);
return false;
});
}
function
setLink(id, num, btntext, title, showlink)
{
var sec =
document.getElementById("divregion");
var writeupid =
"#"+id+"_button"+num+"_content";
var btnadd =
"#"+id+"_button"+num;
var gen =
document.createElement('div');
var btniframe = "#"+id+
"_button"+num+"_content_iframe";
gen.setAttribute("id", id+
"_button"+num+"_content");
gen.innerHTML += "<iframe
id='"+id+"_button"+num+"_content_iframe' width='100%'
height='100%'></iframe>" ;
sec.appendChild(gen);
$(writeupid).dialog({
autoOpen:false,
show:'scale',
title:
title +' Writeup',
width:800,
height:800,
buttons: [{text:"Close",click:function(){$(this).dialog("close");$(btniframe).prop('src',
'');}}]
});
$(btnadd).click(function() {
$(writeupid).dialog('open');
$(btniframe).prop('src', showlink);
return false;
});
}
function
GenerateDivs(id, title, textorlink, showtext, showlink, button1, button1title,
button1text, button1link, button1color, button2, button2title, button2text,
button2link, button2color, button3, button3title, button3text, button3link,
button3color)
{
var sec = document.getElementById("divregion")
var writeupid =
"#"+id+"_button1_content";
var
btnadd = "#"+id+"_button1";
var
btniframe = "#"+id+ "_button1_content_iframe";
var
spacing = "<p></p>";
if(button1 == "Text")
{
setText(id, "1",
button1text, button1title);
}
if(button1 == "Link")
{
setLink(id, "1",
button1text, button1title, button1link);
}
if(button2 == "Text")
{
setText(id, "2",
button2text, button2title);
}
if(button2 == "Link")
{
setLink(id, "2", button2text,
button2title, button2link);
}
if(button3 == "Text")
{
setText(id, "3",
button3text, button3title);
}
if(button3 == "Link")
{
setLink(id, "3",
button3text, button3title, button3link);
}
}
function
Writeup(id, title, textorlink, showtext, showlink, button1, button1title,
button1text, button1link, button1color, button2, button2title, button2text,
button2link, button2color, button3, button3title, button3text, button3link,
button3color)
{
var sec = document.getElementById("divregion")
var writeupid =
"#"+id+"_writeup";
var
btnadd = "#"+id+"_button";
var
btniframe = "#"+id+ "_iframe";
var
spacing = "<p></p>";
gen
= document.createElement('div');
gen.setAttribute("id",
id+"_writeup");
sec.appendChild(gen);
//Add
Writeup
if
(textorlink)
{
//Show
Text
gen.innerHTML += showtext + spacing;
sec.appendChild(gen);
$(writeupid).dialog({
autoOpen:false,
show:'scale',
title:
title +' Writeup',
width:800,
buttons:
[{text:"Close",click:function(){$(this).dialog("close");}}]
});
$(btnadd).click(function() {
$(writeupid).dialog('open');
return
false;
});
if(button1
!= "Off")
{
GenerateSubButton(id,
id+"_writeup", button1, button1title, button1text, button1link,
button1color, "1");
}
if(button2 != "Off")
{
GenerateSubButton(id,
id+"_writeup", button2, button2title, button2text, button2link,
button2color, "2");
}
if(button3 != "Off")
{
GenerateSubButton(id,
id+"_writeup", button3, button3title, button3text, button3link,
button3color, "3");
}
//Show
the link
}
else
{
gen.innerHTML += "<iframe
id='"+btniframe+"' width='100%' height='100%'
src='"+showlink+"'></iframe>";
sec.appendChild(gen);
$(writeupid).dialog({
autoOpen:false,
show:'scale',
title:
title +' Writeup',
width:800,
height:800,
buttons:
[{text:"Close",click:function(){$(this).dialog("close");$(btniframe).prop('src',
'');}}]
});
$(btnadd).click(function() {
$(writeupid).dialog('open');
$(btniframe).prop('src', showlink);
return false;// was false
});
}
}
function
GenerateSubButton(id, writeupdiv, btntype, btntitle, btntext, btnlink,
btncolor, num)
{
//This
makes a sub button
var sec =
document.getElementById(writeupdiv);
var btn =
document.createElement('BUTTON');
btn.innerHTML = btntitle;
btn.id = id+"_button"+num;
btn.type = "button";
// btn.className = btncolor +
"_small";
btn.className = btncolor ;
if(btntype == "Link - New
Window")
{
btn.onclick = function()
{
window.open(btnlink);
};
}
sec.appendChild(btn);
}
</script>
While these results have been largely inconclusive, the identical authors followed up with a second study (Nacke et al. 2010), during which they tested psychophysiological response to sound on versus off in 토토사이트 video video games. Neither electrodermal activity nor facial electromyography have been influenced by the sounds of the sport. It ought to be famous, however, that only tonic measurements have been recorded.
ReplyDelete