SharePoint 2010 Rolling Three Months Calendar - sharepoint-2010

Hi i'm trying to develop a three month rolling calendar view by inserting three calendar webparts in a page and also by inserting the below code in a CEWP.
The calendars should roll to previous or next respectively but clicking on the button 'PrevMonth' and 'NextMonth'.
It seems to be working for just roll but something is wrong. Can someone help me with this ?
< script type = "text/javascript" >
$(document).ready(function() {
window.setTimeout(setCal, 1000);
});
var CurrentDate = new Date();
function setCal() {
$("#PrevMonth").click(PrevMonth);
$("#NextMonth").click(NextMonth);
MoveToDate((CurrentDate.getMonth() + 2).toString() + '\u002f' + CurrentDate.getDate().toString() + '\u002f' + CurrentDate.getFullYear().toString(), 'WPQ3');
MoveToDate((CurrentDate.getMonth() + 1).toString() + '\u002f' + CurrentDate.getDate().toString() + '\u002f' + CurrentDate.getFullYear().toString(), 'WPQ2');
MoveToDate((CurrentDate.getMonth()).toString() + '\u002f' + CurrentDate.getDate().toString() + '\u002f' + CurrentDate.getFullYear().toString(), 'WPQ1');
}
function PrevMonth() {
MoveToDate((CurrentDate.getMonth() - 1).toString() + '\u002f' + CurrentDate.getDate().toString() + '\u002f' + CurrentDate.getFullYear().toString(), 'WPQ3');
MoveToDate((CurrentDate.getMonth() - 1).toString() + '\u002f' + CurrentDate.getDate().toString() + '\u002f' + CurrentDate.getFullYear().toString(), 'WPQ2');
MoveToDate((CurrentDate.getMonth() - 1).toString() + '\u002f' + CurrentDate.getDate().toString() + '\u002f' + CurrentDate.getFullYear().toString(), 'WPQ1');
}
function NextMonth() {
MoveToDate((currentMonth + 1).toString() + '\u002f' + CurrentDate.getDate().toString() + '\u002f' + CurrentDate.getFullYear().toString(), 'WPQ3');
MoveToDate((currentMonth + 1).toString() + '\u002f' + CurrentDate.getDate().toString() + '\u002f' + CurrentDate.getFullYear().toString(), 'WPQ2');
MoveToDate((currentMonth + 1).toString() + '\u002f' + CurrentDate.getDate().toString() + '\u002f' + CurrentDate.getFullYear().toString(), 'WPQ1');
}
<
/script>

Here you go, after much searching, this works perfectly.
<script type="text/javascript" src="http://sharepoint server/sites/page/Scripts/jquery.SPServices.js"></script>
<script src="https://code.jquery.com/jquery-1.11.0.min.js" type="text/javascript"></script>
<script type="text/javascript">
function myPrevFunction() {
document.getElementById("WPQ3_nav_prev_img").click();
document.getElementById("WPQ4_nav_prev_img").click();
document.getElementById("WPQ5_nav_prev_img").click();
document.getElementById("WPQ6_nav_prev_img").click();
document.getElementById("WPQ7_nav_prev_img").click();
document.getElementById("WPQ8_nav_prev_img").click();
}
function myNextFunction() {
document.getElementById("WPQ3_nav_next_img").click();
document.getElementById("WPQ4_nav_next_img").click();
document.getElementById("WPQ5_nav_next_img").click();
document.getElementById("WPQ6_nav_next_img").click();
document.getElementById("WPQ7_nav_next_img").click();
document.getElementById("WPQ8_nav_next_img").click();
}
</script>
<input type="button" id="CFCCalPrev" value="Prev" onclick="myPrevFunction()">
<input type="button" id="CFCCalNext" value="Next" onclick="myNextFunction()">

Related

I'm not quite making sense of where these Amadeus API Calls are coming from?

I have a code here which is in .js, but some of these variable aren't making sense. For example, the line stating var departure_from = segment.departure.iataCode; there isn't anything in the file that the .js would understand departure_from or segment.departure.iataCode. I'm assuming that the Amadeus website interprets this, but I can't seem to find anything on the Amadeus website that would tell me which of these JS code snippets to use in which circumstances.
jQuery(function($){
$( "#departureDate" ).datepicker( { dateFormat: "yy-mm-dd" } );
$( "#returnDate" ).datepicker( { dateFormat: "yy-mm-dd" } );
$( "#flight_offers_request_form" ).submit( function( event ) {
event.preventDefault();
$( "#response" ).html( '' );
$.ajax({
url: ajax_object.ajax_url,
type: "post",
dataType: 'JSON',
data: $( this ).serialize(),
})
.done ( function( response ) {
var responseObj = $.parseJSON( response );
var content = '';
content += '<p>Flight offers from ' +
$( '#originLocationCode' ).val() +
' to ' + $( '#destinationLocationCode' ).val() +
' departing on ' + $( '#departureDate' ).val() +
( ( $( '#returnDate' ).val() !== '' ) ? ( ' and returning on ' + $( '#returnDate' ).val() ) : '') +
' for ' + $( '#adults' ).val() +
' adult' + ( $( '#adults' ).val() > 1 ? 's.' : '.' ) +
'</p>';
content += '<table>';
content += '<tr><th>ID</th><th>Departure Place</th><th>Departure Time</th><th>Arrival Place</th><th>Arrival Time</th><th>Flight No</th><th>Duration</th><th>Total Price</th></tr>';
$.each( responseObj.data, function( idx, data ) {
var id = data.id;
var currency = data.price.currency;
var total = data.price.total;
var segment_count = 0;
$.each( data.itineraries, function( idx, itinerary ) {
$.each( itinerary.segments, function( idx, segment ) {
var departure_from = segment.departure.iataCode;
var departure_time = segment.departure.at;
var arrival_at = segment.arrival.iataCode;
var arrival_time = segment.arrival.at;
var carrierCode = segment.carrierCode;
var number = segment.number;
var duration = segment.duration;
content += '<tr>';
content += '<td>' + ( ( segment_count === 0 ) ? id : '' ) + '</td><td>';
content += departure_from + '</td><td>' +
departure_time + '</td><td>' +
arrival_at + '</td><td>' +
arrival_time + '</td><td>' +
carrierCode + ' ' + number +
'</td><td>' +
duration + '</td>';
content += '<td>' + ( ( segment_count === 0 ) ? currency + ' ' + total : '' ) + '</td><td>';
content += '</tr>';
segment_count++;
})
})
})
content += '</table>';
$( '#response' ).html( content );
})
.fail(function( jqXHR, textStatus ) {
$( "#response" ).html( '<p>' + jqXHR.responseText + '</p>' );
})
})
});

undefined object in retrieving data aspnetcore

I'm having trouble in binding the records from json to my
script in my view but I'm getting data from console.log. Can you
please help me what am I missing? here's my code...
public JsonResult GetListOfQuestions()
{
List<Question> QuesList = _context.Question.ToList();
return Json(QuesList);
}
<div id="SetQuestionsList">
<div id="LoadingStatus">
</div>
</div>
<script>
$("#LoadingStatus").html("Loading....");
$.get("/Questions/GetListOfQuestions", null, DataBind);
function DataBind(QuesList) {
var SetData = $("#SetQuestionsList");
console.log(QuesList);
for (var i = 0; i < QuesList.length; i++) {
var aa = i + 1
var Data =
"<div class='row_{" + QuesList.QuestionId + "}'>" +
"<div class='panel panel-primary'>" +
"<div class='panel-heading'>" +
"<div class='row'>" +
"<div class='col-lg-10'>" +
"<p>Question " + aa + "</p>" +
"</div>" +
"<div class='col-lg-1'>" +
"<a href='#' class='btn btn-warning' onclick='EditQuestion({" + QuesList.QuestionId + "})'>" +
"<span class='glyphicon glyphicon-edit'></span>Update" +
"</a>" +
"</div>" +
"<div class='col-lg-1'>" +
"<a href='#' class='btn btn-danger' onclick='DeleteQuestionRecord({" + QuesList.QuestionId + "})'>" +
"<span class='glyphicon glyphicon-trash'></span>Delete" +
"</a>" +
"</div>" +
"</div>" +
"</div>" +
"<div class='panel-body'>" +
"<div class='row'>" +
"<div class='col-lg-12'>" +
"<div class='form-group'>" +
"<b>Description</b><br />" +
"<p>" + QuesList.QuestionText + "</p>" +
"</div>" +
"</div>" +
"</div>" +
"</div>" +
"</div>" +
"</div>";
SetData.append(Data);
$("#LoadingStatus").html(" ");
}
}
</script>
Assuming you are using a version of jQuery >= 1.5, the following should help you determine what's going on. The way the script is currently written, using the ajax shorthand version, if there is an error in the call, jquery will fail silently. This way, you have an option to handle an error during the call execution and view the error in the browser dev console to help you debug the issue.
Update I added a jsfiddle for you to understand it better in case the explanation isn't enough (you should provide a jsfiddle in the future)
Also, see the following json, I'm assuming your data is similar to https://api.myjson.com/bins/1fryq4. You have to take into account the data structure that is being converted into json from the backend.
function getQuestions(){
$("#LoadingStatus").show();
$.get("https://api.myjson.com/bins/1fryq4")
.done(function( data ) {
//call you binding function
DataBind(data);
})
.fail( function(err){
//handle the error in the UI, alert the user something went wrong, recover form the error
alert("GetListOfQuestions error!");
//chrome: display object in js console
console.dir(err);
})
.always(function() {
//hide loading spinner
$("#LoadingStatus").hide();
});
}
Databind js function (shortened, see jsfiddle)
function DataBind(QuesList) {
var aa = 0;
var QuestionList = $("#SetQuestionsList");
//if you need to convert json to a js object use the builtin parser
//Example: var data = JSON.parse(QuesList);
//TODO good practice to check if valid list before trying to iterate the array
//pay attention to your incoming object
QuesList.questions.forEach(function(item){
aa++;
var question =
"<div class='row_{" + item.questionId + "}'>" +
"<div class='panel panel-primary'>" +
"<div class='panel-heading'>" +
"<div class='row'>" +
"<div class='col-lg-10'>" +
"<p>Question " + aa + "</p>" +
"</div>" +
"<div class='col-lg-1'>" +
"<a href='#' class='btn btn-warning' onclick='EditQuestion({" + item.questionId + "})'>" +
"<span class='glyphicon glyphicon-edit'></span>Update" +
"</a>" +
"</div>" +
"<div class='col-lg-1'>" +
"<a href='#' class='btn btn-danger' onclick='DeleteQuestionRecord({" + item.questionId + "})'>" +
"<span class='glyphicon glyphicon-trash'></span>Delete" +
"</a>" +
"</div>" +
"</div>" +
"</div>" +
...
"<b>Description</b><br />" +
"<p>" + item.questionDescription + "</p>" +
"</div>" +
...
"</div>";
QuestionList.append(question);
});
}
<script type="text/javascript">
function getQuestions() {
$("#LoadingStatus").show();
$.get("/Questions/GetListOfQuestions")
.done(function (data) {
//call you binding function
console.log(data)
DataBind(data);
})
.fail(function (err) {
//handle the error in the UI, alert the user something went wrong, recover form the error
alert("GetListOfQuestions error!");
//chrome: display object in js console
console.dir(err);
})
.always(function () {
//hide loading spinner
$("#LoadingStatus").hide();
});
}
function DataBind(QuesList) {
var aa = 0;
var QuestionList = $("#SetQuestionsList");
console.log(QuesList);
//if you need to convert json to a js object use the builtin parser
//Example: var data = JSON.parse(QuesList);
//TODO good practice to check if valid list before trying to iterate the array
//pay attention to your incoming object
QuesList.questions.forEach(function (item) {
aa++;
var question =
"<div class='row_{" + item.QuestionId + "}'>" +
"<div class='panel panel-primary'>" +
"<div class='panel-heading'>" +
"<div class='row'>" +
"<div class='col-lg-10'>" +
"<p>Question " + aa + "</p>" +
"</div>" +
"<div class='col-lg-1'>" +
"<a href='#' class='btn btn-warning' onclick='EditQuestion({" + item.QuestionId + "})'>" +
"<span class='glyphicon glyphicon-edit'></span>Update" +
"</a>" +
"</div>" +
"<div class='col-lg-1'>" +
"<a href='#' class='btn btn-danger' onclick='DeleteQuestionRecord({" + item.QuestionId + "})'>" +
"<span class='glyphicon glyphicon-trash'></span>Delete" +
"</a>" +
"</div>" +
"</div>" +
"</div>" +
"<div class='panel-body'>" +
"<div class='row'>" +
"<div class='col-md-6'>" +
"<div class='form-group'>" +
"<b>Question Type</b><br />" +
"<text>" + item.QuestionTypeName + "</text>" +
"</div>" +
"</div>" +
"</div>" +
"<div class='row'>" +
"<div class='col-lg-12'>" +
"<div class='form-group'>" +
"<b>Description</b><br />" +
"<p>" + item.QuestionDescription + "</p>" +
"</div>" +
"</div>" +
"</div>" +
"</div>" +
"</div>" +
"</div>";
QuestionList.append(question);
});
}
</script>

SAP API Journal Entry "Post Journal Entries from External Systems" (SAP_COM_0002)

Has anyone successfully created a Journal Entry in S/4HANA Cloud system via POSTMAN or Cloud Platform App?
I keep getting 401 unauthorized in POSTMAN. I tried PO GET API URL, and it is working fine.
https://:/sap/bc/srt/scs/sap/journalentrycreaterequestconfi
{
"JournalEntryBulkCreateRequest": {
"MessageHeader": { "CreationDateTime": "2018-05-27T12:50:30.45+01:00" },
"JournalEntryCreateRequest": {
"MessageHeader": { "CreationDateTime": "2018-05-27T12:50:30.45+01:00" },
"JournalEntry": {
"OriginalReferenceDocumentLogicalSystem": "",
"OriginalReferenceDocumentType": "BKPFF",
"OriginalReferenceDocument": "",
"BusinessTransactionType": "RFBU",
"AccountingDocumentType": "",
"DocumentHeaderText": "Header Value",
"CompanyCode": "US01",
"CreatedByUser": "CB9980000010",
"DocumentDate": "2018-05-27",
"PostingDate": "2018-05-27",
"item": [
{
"GLAccount": "0021517000",
"AmountInTransactionCurrency": {
"Amount": "1200.00",
"currencyCode": "USD"
},
"DocumentItemText": "Text1"
},
{
"GLAccount": "0010010000",
"AmountInTransactionCurrency": {
"Amount": "-1200.00",
"currencyCode": "USD"
},
"DocumentItemText": "Text2"
}
]
}
}
}
This is a Soap Request so you need to call by sending XML Envelop data.
var request =
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope\"" +
" xmlns:sfin=\"http://sap.com/xi/SAPSCORE/SFIN\"><soapenv:Header/><soapenv:Body><sfin:JournalEntryBulkCreateRequest>" +
"<MessageHeader><CreationDateTime>" + currentDate.toISOString() + "</CreationDateTime></MessageHeader>" +
"<JournalEntryCreateRequest><MessageHeader><CreationDateTime>" + currentDate.toISOString() + "</CreationDateTime></MessageHeader>" +
"<JournalEntry>" +
"<OriginalReferenceDocumentType>BKPFF</OriginalReferenceDocumentType>" +
"<OriginalReferenceDocument>" + Item[1] + "</OriginalReferenceDocument>" + // Report number
"<OriginalReferenceDocumentLogicalSystem>INBOUND</OriginalReferenceDocumentLogicalSystem>" +
"<BusinessTransactionType>RFBU</BusinessTransactionType>" +
"<AccountingDocumentType>SA</AccountingDocumentType>" +
"<DocumentHeaderText>Certify NonReimbursement</DocumentHeaderText>" +
"<CreatedByUser>CC0000000001</CreatedByUser>" +
"<CompanyCode>" + Item[8] + "</CompanyCode>" +
"<DocumentDate>" + this.parseJsonDate(documentDate) + "</DocumentDate>" +
"<PostingDate>" + this.parseJsonDate(postingdate) + "</PostingDate>" +
"<Item>" +
"<CompanyCode>" + Item[8] + "</CompanyCode>" +
"<GLAccount>" + this.suffixZeros(nonExpAcc + "") + "</GLAccount>" +
"<AmountInTransactionCurrency currencyCode=\"" + Item[5] + "\">-" + Item[4] + "</AmountInTransactionCurrency>" +
"<DebitCreditCode>S</DebitCreditCode>" +
"</Item>" +
"<Item>" +
"<CompanyCode>" + Item[8] + "</CompanyCode>" +
"<GLAccount>" + this.suffixZeros(Item[3] + "") + "</GLAccount>" +
"<AmountInTransactionCurrency currencyCode=\"" + Item[5] + "\">" + Item[4] + "</AmountInTransactionCurrency>" +
"<DebitCreditCode>H</DebitCreditCode>" +
"<AccountAssignment>" +
"<CostCenter>" + this.suffixZeros(Item[7] + "") + "</CostCenter>" +
"</AccountAssignment>" +
"</Item>" +
"</JournalEntry></JournalEntryCreateRequest></sfin:JournalEntryBulkCreateRequest></soapenv:Body></soapenv:Envelope>";

dblclick on marker not working at all

i am just doing my first experiences with maps api. Works great, but...
adding a click event to a marker works, adding a dblclick ... nothings happens. As if the dblclick simply doesnt fire.
So my questions:
Is a marker capable to handle a dblclick?
Sample code is as follows (the catch exception e doesnt make any change) :
try
{
if (urlfuerdoppelclick != null)
if (urlfuerdoppelclick.Length > 0)
{
eintraege = eintraege + " marker" + i.ToString() + ".addListener";
eintraege = eintraege + " ('dblclick',";
eintraege = eintraege + " function () ";
eintraege = eintraege + " { ";
eintraege = eintraege + " window.open(\"" + urlfuerdoppelclick
+ "\"); ";
eintraege = eintraege + " } ";
eintraege = eintraege + " ); ";
}
}
catch { };
try
{
if (voninnen != null)
if (voninnen.Length > 0)
{
eintraege = eintraege + " marker" + i.ToString() + ".addListener";
eintraege = eintraege + " ('click',";
eintraege = eintraege + " function () ";
eintraege = eintraege + " { ";
eintraege = eintraege + " window.open(\"" + voninnen + "\"); ";
eintraege = eintraege + " } ";
eintraege = eintraege + " ); ";
};
}
catch (Exception e) { };

Cannot read property 'opacity' of undefined

I am loading the fine uploader in this manner:
var uploader = new qq.FineUploaderBasic({
button: $("#docAddHref"),
request: {
endpoint: 'server/handleUploads'
},
validation: {
allowedExtensions: ['jpeg', 'jpg', 'gif', 'png'],
sizeLimit: 204800 // 200 kB = 200 * 1024 bytes
},
callbacks: {
onSubmit: function (id, fileName) {
$messages.append('<div id="file-' + id + '" class="alert" style="margin: 20px 0 0"></div>');
},
onUpload: function (id, fileName) {
$('#file-' + id).addClass('alert-info')
.html('<img src="client/loading.gif" alt="Initializing. Please hold."> ' +
'Initializing ' +
'“' + fileName + '”');
},
onProgress: function (id, fileName, loaded, total) {
if (loaded < total) {
progress = Math.round(loaded / total * 100) + '% of ' + Math.round(total / 1024) + ' kB';
$('#file-' + id).removeClass('alert-info')
.html('<img src="client/loading.gif" alt="In progress. Please hold."> ' +
'Uploading ' +
'“' + fileName + '” ' +
progress);
} else {
$('#file-' + id).addClass('alert-info')
.html('<img src="client/loading.gif" alt="Saving. Please hold."> ' +
'Saving ' +
'“' + fileName + '”');
}
},
onComplete: function (id, fileName, responseJSON) {
if (responseJSON.success) {
$('#file-' + id).removeClass('alert-info')
.addClass('alert-success')
.html('<i class="icon-ok"></i> ' +
'Successfully saved ' +
'“' + fileName + '”' +
'<br><img src="img/success.jpg" alt="' + fileName + '">');
} else {
$('#file-' + id).removeClass('alert-info')
.addClass('alert-error')
.html('<i class="icon-exclamation-sign"></i> ' +
'Error with ' +
'“' + fileName + '”: ' +
responseJSON.error);
}
},
onError: function (id, name, reason, xhr) {
$('#fubErrorAlert .message').text(reason);
$('#fubErrorAlert button').click(function () {
$('#fubErrorAlert').hide();
});
$('#fubErrorAlert').show();
}
}
});
console.log('uploader called');
uploader();
When the page loads I am getting this javascript error:
Cannot read property 'opacity' of undefined
I installed the FineUploader via Nuget Pacakage for ASP.NET
https://github.com/Widen/fine-uploader-server/tree/master/ASP.NET%20MVC%20C%23
Please advice!
Your button option is likely the problem. You should change it to:
button: $("#docAddHref")[0]
If you want to do things like pass in a jQuery object, you will need to download and use Fine Uploader's jQuery plugin. More info about the plugin at http://docs.fineuploader.com/integrating/jquery.html