Skip to content

Commit

Permalink
Bug fixes and enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
mfakih294 committed Jan 5, 2021
1 parent e1430af commit 8b669cf
Show file tree
Hide file tree
Showing 10 changed files with 137 additions and 43 deletions.
7 changes: 3 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

export PATH=/home/mf/dev/grails-3.3.10/bin:/home/mf/dev/jdk1.8.0_111/bin/:$PATH
export PATH=$PATH:/nbr/dev/grails-3.3.10/bin:/nbr/dev/jdk1.8.0_65/bin/

export GRAILS_HOME=/home/mf/dev/grails-3.3.10/
export GRAILS_HOME=/nbr/dev/grails-3.3.10/

export JAVA_HOME=/home/mf/dev/jdk1.8.0_111/
#/usr/lib/jvm/java-11-openjdk-amd64/
export JAVA_HOME=/nbr/dev/jdk1.8.0_65/

export CATALINA="-server"
export JAVA_OPTS="-server"
Expand Down
14 changes: 7 additions & 7 deletions grails-app/controllers/ker/ExportController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class ExportController {
def allCalendarEvents() {
def events = []

Task.executeQuery("from Journal t where t.startDate between :start and :end",
Task.executeQuery("from Journal t where t.bookmarked = 1 and t.startDate between :start and :end",
//[new Date(Long.parseLong(params.start) * 1000), new Date(Long.parseLong(params.end) * 1000)]).each() {
[start: Date.parse('yyyy-MM-dd', params.start) - 20, end: Date.parse('yyyy-MM-dd', params.end) + 20]).each() {

Expand All @@ -263,7 +263,7 @@ class ExportController {
url : request.contextPath + '/page/record/' + it.id + '?entityCode=J',
allDay : (it.level != 'm' || it.startDate.hours < 5 ? true : false)])
}
Task.executeQuery("from Planner t where t.startDate between :start and :end",
Task.executeQuery("from Planner t where t.bookmarked = 1 and t.startDate between :start and :end",
//[new Date(Long.parseLong(params.start) * 1000), new Date(Long.parseLong(params.end) * 1000)]).each() {
[start: Date.parse('yyyy-MM-dd', params.start) - 20, end: Date.parse('yyyy-MM-dd', params.end) + 20]).each() {

Expand All @@ -287,7 +287,7 @@ class ExportController {
allDay : (it.level != 'm' || it.startDate.hours < 5 ? true : false)])
}

Task.executeQuery("from Task t where t.endDate between :start and :end",
Task.executeQuery("from Task t where t.bookmarked = 1 and t.endDate between :start and :end",
//[new Date(Long.parseLong(params.start) * 1000), new Date(Long.parseLong(params.end) * 1000)]).each() {
[start: Date.parse('yyyy-MM-dd', params.start) - 20, end: Date.parse('yyyy-MM-dd', params.end) + 20]).each() {

Expand All @@ -309,7 +309,7 @@ class ExportController {
}


Task.executeQuery("from Goal t where t.endDate between :start and :end",
Task.executeQuery("from Goal t where t.bookmarked = 1 and t.endDate between :start and :end",
//[new Date(Long.parseLong(params.start) * 1000), new Date(Long.parseLong(params.end) * 1000)]).each() {
[start: Date.parse('yyyy-MM-dd', params.start) - 20, end: Date.parse('yyyy-MM-dd', params.end) + 20]).each() {

Expand All @@ -333,7 +333,7 @@ class ExportController {



Task.executeQuery("from Book t where t.readOn between :start and :end",
Task.executeQuery("from Book t where t.bookmarked = 1 and t.readOn between :start and :end",
//[new Date(Long.parseLong(params.start) * 1000), new Date(Long.parseLong(params.end) * 1000)]).each() {
[start: Date.parse('yyyy-MM-dd', params.start) - 20, end: Date.parse('yyyy-MM-dd', params.end) + 20]).each() {

Expand Down Expand Up @@ -562,13 +562,13 @@ This presentation aims to give an overview of Pomegranate PKM system.


def staticWebsiteToString() {
render(view: '/static/site')
render(view: '/appStatic/site')
}


def staticWebsite() {

def f = new File('/' + (OperationController.getPath('rootFolder') ?: 'mhi') + '/mcd/site.html')
def f = new File('/' + (OperationController.getPath('root.rps1.path') ?: '') + '/site.html')
f.write(g.include([controller: 'export', action: 'staticWebsiteToString']).toString(), 'UTF-8')
render 'Generation done: ' + new Date().format('HH:mm:ss')

Expand Down
2 changes: 1 addition & 1 deletion grails-app/controllers/ker/GenericsController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@ ll

def record = grailsApplication.classLoader.loadClass(entityMapping[entityCode]).get(id)

if (record.class.declaredFields.name.contains('bookmarked') && record.bookmarked)
if (!'R'.contains(entityCode) && record.class.declaredFields.name.contains('bookmarked') && record.bookmarked)
record.bookmarked = false


Expand Down
36 changes: 36 additions & 0 deletions grails-app/controllers/ker/PageController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,43 @@ class PageController {
}

def appCalendar() {


double latitude = 33.8933182;
double longitude = 35.5015717;
double timezone = ker.OperationController.getPath('prayers.timezone') ?ker.OperationController.getPath('prayers.timezone').toInteger(): 2 ;
// Test Prayer times here
PrayTime prayers = new newpackage.PrayTime();

prayers.setTimeFormat(prayers.Time12NS);
prayers.setCalcMethod(prayers.Jafari);
prayers.setAsrJuristic(prayers.Shafii);
prayers.setAdjustHighLats(prayers.AngleBased);
int[] offsets = [0, 1, 0, 0, 0, 3, 5]; // {Fajr,Sunrise,Dhuhr,Asr,Sunset,Maghrib,Isha}
prayers.tune(offsets);

Date now = new Date();
Calendar cal = Calendar.getInstance();
cal.setTime(now);

ArrayList<String> prayerTimes = prayers.getPrayerTimes(cal,
latitude, longitude, timezone);
ArrayList<String> prayerNames = prayers.getTimeNames();

def prayersText = ''
// for (int i = 0; i < prayerTimes.size(); i++) {
prayersText += (prayerNames.get(0) + ": " + prayerTimes.get(0) + '\n')
prayersText += (prayerNames.get(1) + ": " + prayerTimes.get(1) + '\n')
prayersText += (prayerNames.get(2) + ": " + prayerTimes.get(2) + '\n')
prayersText += (prayerNames.get(3) + ": " + prayerTimes.get(3) + '\n')
prayersText += (prayerNames.get(4) + ": " + prayerTimes.get(4) + '\n')
prayersText += (prayerNames.get(5) + ": " + prayerTimes.get(5) + '\n')
// prayersText += (prayerNames.get(6) + ": " + prayerTimes.get(6) + '\n')
// }


render(view: '/appCalendar/main', model: [
prayersText: prayersText
])
}

Expand Down
2 changes: 1 addition & 1 deletion grails-app/domain/mcs/Course.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class Course implements Comparable { // entity id = 130


public String toString() {
return (bookmarked ? '* ' : '') + (code ? '' + code + ' ': '') + summary
return (bookmarked ? '* ' : '') + (code ? '[' + code + '] ': '') + summary
}

public String fullString() {
Expand Down
62 changes: 48 additions & 14 deletions grails-app/views/appCalendar/main.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@


<script>
var calendar
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
calendar = new FullCalendar.Calendar(calendarEl, {
isRTL: false,
// locale: 'ar',
plugins: ['bootstrap', 'interaction', 'dayGrid', 'timeGrid', 'list'],
Expand Down Expand Up @@ -99,8 +99,8 @@
var endDate = new Date(currentDate.valueOf());
// Adjust the start & end dates, respectively
startDate.setDate(startDate.getDate() - 1); // One day in the past
endDate.setDate(endDate.getDate() + 3); // Three days into the future
startDate.setDate(startDate.getDate() - 2); // One day in the past
endDate.setDate(endDate.getDate() + 2); // Three days into the future
return { start: startDate, end: endDate }
}
Expand Down Expand Up @@ -144,9 +144,9 @@
// day:'' // Monday 19.07
// },
// lazyFetching: true,
firstHour: '05:00',
firstHour: '07:00',
// minTime: 5,
minTime: '05:00',
minTime: '07:00',
slotDuration: '00:30',
// showNonCurrentDates: false,
// dayCount: 31,
Expand Down Expand Up @@ -270,15 +270,20 @@
});
/*
setInterval(function() {
jQuery.ajax({
type: 'GET',
url: '${request.contextPath}/page/heartbeat',
dataType: 'html',
success: function(html, textStatus) {
if (html == 'ok') {
// console.log('here' + jQuery('#calendar').fullCalendar.view);
// console.log('here2' + calendarEl.view.title);
if (html == 'ok' && calendar.view.type == 'dayGrid') {
window.location.href = window.location;
jQuery('#logArea2').html("<span style='background: darkgray; color: darkgreen'>Online</span>");
}
Expand All @@ -288,8 +293,8 @@
// console.log('An error occurred! ' + ( errorThrown ? errorThrown : xhr.status ));
}
});
}, 60000);
*/
}, ${ker.OperationController.getPath('calendar.reload.interval').toInteger()});
</script>
Expand Down Expand Up @@ -351,10 +356,37 @@
</div>

<div id="calendar-container" style="margin: 10px; text-align: left; height: 99%">

<g:if test="${ker.OperationController.getPath('hijriDate.enabled')?.toLowerCase() == 'yes' ? true : false}">
<div style="direction: rtl; text-align: center; ">
<b>
<b>${((java.time.chrono.HijrahDate.now().plus(ker.OperationController.getPath('hijri.adjustment') ? ker.OperationController.getPath('hijri.adjustment').toInteger(): 0, java.time.temporal.ChronoUnit.DAYS))).format(java.time.format.DateTimeFormatter.ofPattern("dd MMMM").withLocale(Locale.forLanguageTag('ar')))}</b>:
%{-- &nbsp;&nbsp; ${new Date().format("E dd HH:mm")}: &nbsp;--}%
</b>
&nbsp;

%{-- <g:set var="aya"--}%
%{-- value="${app.IndexCard.executeQuery('from IndexCard i where i.priority >= ? and i.type.code = ? and length(i.summary) < 80', [4, 'aya'], [offset: Math.floor(Math.random()*100)])[0]}"/>--}%
%{-- {--}%
%{-- ${aya.shortDescription}--}%
%{-- }--}%
%{-- (${mcs.Writing.get(aya.recordId)?.summary}--}%
%{-- ${aya.orderInWriting})--}%
%{-- --}%


<g:each in="${prayersText.split('\n')}" var='l'>
<span style="margin-left: 15px;">
<b>${raw(l)?.split(': ')[0]}</b>:
${raw(l)?.split(': ')[1]}
</span>
</g:each>
</div>
</g:if>
<div id='calendar' ></div>
</div>

<div id="login-form" class="modal" style="height: 400px; width: 600px; border: 1px solid darkgray; margin: 5px; padding: 15px !important;">
<div id="login-form" class="modal" style="height: 500px; width: 600px; border: 1px solid darkgray; margin: 5px; padding: 15px !important;">
%{--Event title or command (e.g. p -- title):--}%
%{--<br/>--}%
%{--<br/>--}%
Expand Down Expand Up @@ -397,14 +429,16 @@
Summary or Nibras command*:
<br/>
<g:textField name="title" value="" id="title"
style=" direction: rtl; text-align: right; display: inline; font-family: tahoma ; width: 99% !important;"
placeholder=""
style=" text-align: start !important; unicode-bidi: plaintext !important; display: inline; font-family: tahoma ; width: 99% !important;"


placeholder=""
class="commandBarTexFieldTop"/>
<br/>
Description:
<g:textArea name="description" value="" id="description" rows="5" columns="80"
placeholder=""
style="width: 99% !important; height: 100px;direction: rtl; text-align: right; display: inline; font-family: tahoma ; "
style="width: 99% !important; height: 100px; text-align: start !important; unicode-bidi: plaintext !important; display: inline; font-family: tahoma ; "
class="commandBarTexFieldTop"/>
<br/>
<br/>
Expand Down
7 changes: 1 addition & 6 deletions grails-app/views/appDashboard/main.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,7 @@
%{-- &nbsp;&nbsp; ${new Date().format("E dd HH:mm")}: &nbsp;--}%
</b>
&nbsp;
<g:each in="${prayersText.split('\n')}" var='l'>
<span >
${raw(l)}
</span>
</g:each>
&nbsp;

<g:set var="aya"
value="${app.IndexCard.executeQuery('from IndexCard i where i.priority >= ? and i.type.code = ? and length(i.summary) < 80', [4, 'aya'], [offset: Math.floor(Math.random()*100)])[0]}"/>
{
Expand Down
9 changes: 6 additions & 3 deletions grails-app/views/appMain/_east.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -718,9 +718,9 @@

<br/>

<h5 class="">
<h4 class="">
<a>Exports</a>
</h5>
</h4>

%{--<div>--}%

Expand All @@ -741,8 +741,11 @@
<br/>


<g:remoteLink controller="export" action="staticWebsite" update="notificationArea">
<g:remoteLink controller="export" action="staticWebsite" update="centralArea">
Generate static site



</g:remoteLink>
<br/>
<g:remoteLink controller="report" action="quranReportToString" update="centralArea">
Expand Down
Loading

0 comments on commit 8b669cf

Please sign in to comment.