.ms-formtable
{display:none;}
</style>
<script src="../../Style Library/js/jquery-1.10.1.min.js" type="text/javascript"></script>
<script src="../../Style Library/js/spjs-utility.js" type="text/javascript"> </script>
<script src="../../Style Library/js/jquery.SPServices-0.7.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
var fldTranslationdictionary=[];
$(document).ready(function() {
//loop through all the spans in the custom layout
$("span").each(function()
{
//get the display name from the custom layout
displayName = $(this).attr("data-displayName");
elem = $(this);
//find the corresponding field from the default form and move it
//into the custom layout
$("table.ms-formtable td").each(function(){
if (this.innerHTML.indexOf('FieldInternalName="'+displayName+'"') != -1){
$(this).contents().appendTo(elem);
}
});
});
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', retrieveListItems);
});//ready() ends
function retrieveListItems()
{
var listname = "TranslateConfig";
var ctx = SP.ClientContext.get_current();
this.web = ctx.get_web();
ctx.load(this.web);
this.list = this.web.get_lists().getByTitle(listname);
var camlQuery = new SP.CamlQuery();
this.collListItem = this.list.getItems(camlQuery);
ctx.load(collListItem);
ctx.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.getListInfoFail));
}
function onQuerySucceeded(sender, args)
{
var listItemEnumerator = collListItem.getEnumerator();
var dict = {};
var lcid = SP.Res.lcid;
while (listItemEnumerator.moveNext())
{
var oListItem = listItemEnumerator.get_current();
var Key=oListItem.get_item('Title')
//console.log("Key="+ Key);
if(lcid==1031)
{
var FieldName=oListItem.get_item('Field_x002d_DE');
//$('div.Cell h3.ms-standardheader :contains('+Key+')').text(FieldName);
//$('div.Cell h3.ms-standardheader :contains('+Key+')')[0].innerHTML=FieldName;
$("#"+Key).text(FieldName);
fldTranslationdictionary[Key]=FieldName;
}
else
{
var FieldName=oListItem.get_item('Field_x002d_EN');
//console.log("Key="+ Key +"," + FieldName);
//$('div.Cell h3.ms-standardheader :contains('+Key+')').text(FieldName);
//$('div.Cell h3.ms-standardheader :contains('+Key+')')[0].innerHTML=FieldName;
$("#"+Key).text(FieldName);
fldTranslationdictionary[Key]=FieldName;
}
}
}
function onQueryFailed(sender, args)
{
alert('Request failed for retrieveListItems(). ' + args.get_message() + '\n' + args.get_stackTrace());
}
</script>
No comments:
Post a Comment