Skip to content

Commit

Permalink
v1.5.0: First inclusion of fuzzy search. Updated fullcalendar plugin.…
Browse files Browse the repository at this point in the history
… Various improvements.
  • Loading branch information
mfakih294 committed Mar 21, 2021
1 parent 28892f6 commit ffb06db
Show file tree
Hide file tree
Showing 78 changed files with 23,779 additions and 45 deletions.
5 changes: 4 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ buildscript {
}
}

version "1.4.6"
version "1.5.0"
group "nibras"

//apply plugin:"eclipse"
Expand Down Expand Up @@ -98,6 +98,9 @@ dependencies {
//compile group: 'com.github.emmanueltouzery', name: 'crony', version: '1.1.0'
compile group: 'com.cronutils', name: 'cron-utils', version: '9.0.2'

// https://mvnrepository.com/artifact/com.intuit.fuzzymatcher/fuzzy-matcher
compile group: 'com.intuit.fuzzymatcher', name: 'fuzzy-matcher', version: '1.0.4'

// other plugins
compile "com.nayidisha.grails.uploadr:grails3-uploadr:3.0"
compile 'org.grails.plugins:remote-pagination:0.5.0'
Expand Down
1 change: 1 addition & 0 deletions grails-app/controllers/UrlMappings.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class UrlMappings {


"/cal" (controller: 'page', action: 'appCalendar')
"/calm" (controller: 'page', action: 'appMobileCalendar')

"/kanban" (controller: 'page', action: 'appKanban')
"/daftar" (controller: 'page', action: 'appDaftar')
Expand Down
1 change: 1 addition & 0 deletions grails-app/controllers/app/IndexCardController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ class IndexCardController { // entity id = 16

n.language = params.language
render(template: "/gTemplates/recordSummary", model: [record: n])
render(template: '/layouts/achtung', model: [message: 'Record saved with id: ' + n.id])
// render('<i style="font-size: tiny">' + params.description + '</i>')
// } else {
// render 'No description entered'
Expand Down
9 changes: 9 additions & 0 deletions grails-app/controllers/ker/PageController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,15 @@ class PageController {
random: Math.floor(Math.random()* 400)
])
}
def appMobileCalendar() {

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

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

def record() {
def record = grailsApplication.classLoader.loadClass(entityMapping[params.entityCode]).get(params.id)
Expand Down
48 changes: 48 additions & 0 deletions grails-app/controllers/ker/ReportController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ import mcs.Writing
import mcs.parameters.ResourceStatus


import com.intuit.fuzzymatcher.component.MatchService;
import com.intuit.fuzzymatcher.domain.Document;
import com.intuit.fuzzymatcher.domain.Element;
import static com.intuit.fuzzymatcher.domain.ElementType.ADDRESS;
import static com.intuit.fuzzymatcher.domain.ElementType.NAME;
import com.intuit.fuzzymatcher.domain.Match;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;



import grails.plugin.springsecurity.annotation.Secured


Expand Down Expand Up @@ -587,4 +600,39 @@ def enterJournalWithType() {
}


def duplicatesList2(){
String[][] input = [
];

Goal.list().each(){
input += [[it.id.toString(), it.summary?: it.id.toString(), '']]
}

// println input


List<Document> documentList = Arrays.asList(input).stream().map({contact ->
return new Document.Builder(contact[0])
.addElement(new Element.Builder<String>().setValue(contact[0]).setType(NAME).createElement())
.addElement(new Element.Builder<String>().setValue(contact[1]).setType(NAME).createElement())
// .addElement(new Element.Builder<String>().setValue(contact[2]).setType(ADDRESS).createElement())
.createDocument();
}).collect(Collectors.toList());

MatchService matchService = new MatchService();
Map<String, List<Match<Document>>> result =
matchService.applyMatchByDocId(documentList);

result.entrySet().forEach({ entry ->
entry.getValue().forEach({ match ->
render("Data: " + match.getData() + " Matched With:<br/> " + match.getMatchedWith() + " Score: " + new java.text.DecimalFormat('#.##').format(match.getScore().getResult()) + '<br/><br/><br/>');
});
});


render 'done.'

}


} // end of class
34 changes: 31 additions & 3 deletions grails-app/controllers/ker/SyncController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class SyncController {

def records = []
for (i in mcs.Planner.executeQuery("from Planner where startDate >= ? and startDate <= ? and bookmarked = ? order by startDate desc ",
[new Date() - 3, new Date() + 7, true])) {
[new Date() - 7, new Date() + 7, true])) {
records += [type : 'P', id: i.id, ecode: 'P',
meta : i?.startDate?.format('dd-MM-yyyy-HH-mm'),
color : 'darkblue',
Expand All @@ -262,6 +262,29 @@ class SyncController {
body : i.description ? i.description?.replace('\n', '<br/>') : '']
}

//println 'records' + records
def json = builder.build {
result = "ok"
data = records
}

render(status: 200, contentType: 'application/json', text: json)
}

def exportJsonJ = {
def builder = new JSONBuilder()

def records = []
for (i in mcs.Planner.executeQuery("from Journal where startDate >= ? and startDate <= ? and bookmarked = ? order by startDate desc ",
[new Date() - 7, new Date() + 7, true])) {
records += [type : 'J', id: i.id, ecode: 'J',
meta : i?.startDate?.format('dd-MM-yyyy-HH-mm'),
color : 'darkblue',
title : i.summary,
language: i.language,
body : i.description ? i.description?.replace('\n', '<br/>') : '']
}

//println 'records' + records
def json = builder.build {
result = "ok"
Expand Down Expand Up @@ -568,6 +591,7 @@ class SyncController {

def mobilePush() {
def c = 0
if (params.tosyncText && params.tosyncText?.contains(','))
params.tosyncText.split(',').each() { r ->
if (r.trim() != '' && r != 'null') {
//println 'r ' + r
Expand All @@ -592,7 +616,10 @@ class SyncController {
// t.properties = record.properties
t.summary = 'rc: ' + t.summary
t.description = 'rc: ' + t.description
if (record.endDate)
t.endDate = record.endDate + record.recurringInterval
else
t.endDate = new Date() + record.recurringInterval
t.recurringInterval = record.recurringInterval
t.isRecurring = true
t.completedOn = null
Expand Down Expand Up @@ -642,10 +669,11 @@ class SyncController {
def data = request.JSON.data
if (data && data?.trim() != '') {
def c = 0
def n = new app.IndexCard()
def n = new mcs.Journal()
n.summary = new Date().format('dd.MM.yyyy HH:mm') + ' k'
n.description = data?.replace('::', ':\n')
// n.type = WritingType.findByCode('k')
n.type = JournalType.findByCode('usr')
n.startDate = new Date()

n.bookmarked = true
n.save(flush: true)
Expand Down
3 changes: 2 additions & 1 deletion grails-app/taglib/pkm/PkmTagLib.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ class PkmTagLib {
try {
def folders = [
OperationController.getPath('root.rps1.path') + '/' + module,
OperationController.getPath('root.rps2.path') + '/' + module
OperationController.getPath('root.rps2.path') + '/' + module,
OperationController.getPath('root.rps3.path') + '/' + module
]
folders.each() { folder ->
if (folder && new File(folder).exists()) {
Expand Down
35 changes: 21 additions & 14 deletions grails-app/views/appCalendar/main.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,36 @@



<script type="text/javascript" src="${resource(dir: 'plugins/fullcalendar', file: 'main5.js')}"></script>
%{-- <script type="text/javascript" src="${resource(dir: 'plugins/fullcalendar', file: 'main5.js')}"></script>--}%
%{-- <script type="text/javascript" src="${resource(dir: 'plugins/fullcalendar', file: 'main1.js')}"></script>--}%
%{-- <link rel="stylesheet" href="${resource(dir: 'plugins/fullcalendar', file: 'main1.css')}"/>--}%
%{--<script type="text/javascript" src="${resource(dir: 'plugins/fullcalendar', file: 'main1.js')}"></script>--}%
%{-- <link rel="stylesheet" href="${resource(dir: 'plugins/fullcalendar', file: 'main2.css')}"/>--}%
%{--<script type="text/javascript" src="${resource(dir: 'plugins/fullcalendar', file: 'main2.js')}"></script>--}%
%{-- <link rel="stylesheet" href="${resource(dir: 'plugins/fullcalendar', file: 'main3.css')}"/>--}%
%{--<script type="text/javascript" src="${resource(dir: 'plugins/fullcalendar', file: 'main3.js')}"></script>--}%


<script type="text/javascript" src="${resource(dir: 'plugins/fullcalendar', file: 'main1.js')}"></script>
<link rel="stylesheet" href="${resource(dir: 'plugins/fullcalendar', file: 'main1.css')}"/>
%{-- <link rel="stylesheet" href="${resource(dir: 'plugins/fullcalendar', file: 'main6.css')}"/>--}%
%{-- <script type="text/javascript" src="${resource(dir: 'plugins/fullcalendar', file: 'main6.js')}"></script>--}%

<script type="text/javascript" src="${resource(dir: 'plugins/fullcalendar', file: 'main1.js')}"></script>

<link rel="stylesheet" href="${resource(dir: 'plugins/fullcalendar', file: 'main2.css')}"/>
<script type="text/javascript" src="${resource(dir: 'plugins/fullcalendar', file: 'main2.js')}"></script>

<link rel="stylesheet" href="${resource(dir: 'plugins/fullcalendar', file: 'main3.css')}"/>
<script type="text/javascript" src="${resource(dir: 'plugins/fullcalendar', file: 'main3.js')}"></script>
%{-- <link rel="stylesheet" href="${resource(dir: 'plugins/fullcalendar', file: 'main4.css')}"/>--}%

%{-- <script type="text/javascript" src="${resource(dir: 'plugins/fullcalendar', file: 'main4.js')}"></script>--}%

<link rel="stylesheet" href="${resource(dir: 'plugins/fullcalendar', file: 'main6.css')}"/>
<script type="text/javascript" src="${resource(dir: 'plugins/fullcalendar', file: 'main6.js')}"></script>

<script type="text/javascript" src="${resource(dir: 'plugins/fullcalendar/430', file: 'main.js')}"></script>
<link rel="stylesheet" href="${resource(dir: 'plugins/fullcalendar/430', file: 'main.css')}"/>

<script type="text/javascript" src="${resource(dir: 'plugins/fullcalendar/430/daygrid', file: 'main.js')}"></script>
<link rel="stylesheet" href="${resource(dir: 'plugins/fullcalendar/430/daygrid', file: 'main.css')}"/>

<link rel="stylesheet" href="${resource(dir: 'plugins/fullcalendar', file: 'main4.css')}"/>
<script type="text/javascript" src="${resource(dir: 'plugins/fullcalendar/430/timegrid', file: 'main.js')}"></script>
<link rel="stylesheet" href="${resource(dir: 'plugins/fullcalendar/430/timegrid', file: 'main.css')}"/>

<script type="text/javascript" src="${resource(dir: 'plugins/fullcalendar', file: 'main4.js')}"></script>
<script type="text/javascript" src="${resource(dir: 'plugins/fullcalendar/430/interaction', file: 'main.js')}"></script>

<link rel="stylesheet" href="${createLinkTo(dir: 'css', file: 'main-calendar.css')}"/>

Expand Down Expand Up @@ -522,7 +529,7 @@
<br/>

</div>

<g:if test="${1==2}">
<table class="dashboard" style="width: 90%; margin: 0 4%; position: absolute; bottom: 5px;" border="0">
<tr>
<td colspan="3">
Expand Down Expand Up @@ -638,7 +645,7 @@
</tr>

</table>

</g:if>



Expand Down
2 changes: 1 addition & 1 deletion grails-app/views/appMain/_north.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@

<g:textField name="input" value="" id="speedsearch"
autocomplete="off"
style="float: right; display: inline; width: 220px !important; height: 24px; padding: 3px; margin: 1px; font-size: 11px;"
style="float: right; display: inline; width: 250px !important; height: 24px; padding: 3px; margin: 1px; font-size: 12px;"
placeholder="Search (Esc)..."
class=""/>

Expand Down
6 changes: 3 additions & 3 deletions grails-app/views/appMain/_regions.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@
value="N"/>
<g:textField name="title" value=""
tabindex="2" id="summayDaftar"
style="background: #f8f9fa; padding: 3px; text-align: right; display: inline; font-family: tahoma ; width: 60% !important;"
style="background: #f8f9fa; padding: 3px; text-align: right; display: inline; font-family: tahoma ; min-width: 80% !important;"
placeholder="Summary * "
class=""/>

<g:select name="courseNgs" id="courseNgs" from="${mcs.Course.findAll([sort: 'department', order: 'desc'])}"
optionKey="id" class="chosen"
optionKey="id" class="chosen" style="width: 350px !important;" optionValue="summary"
/>

<g:select name="language" id="language" from="${['ar', 'en', 'fr', 'fa', 'de']}"
Expand Down Expand Up @@ -349,7 +349,7 @@
</div>

<script type="text/javascript">
jQuery(".chosen").chosen({allow_single_deselect: true, no_results_text: "None found"});
jQuery(".chosen").chosen({allow_single_deselect: true, search_contains: true, no_results_text: "None found"});
jQuery("#chosenTags").chosen({allow_single_deselect: true, no_results_text: "None found"});
Expand Down
Loading

0 comments on commit ffb06db

Please sign in to comment.