Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mynij
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mynij
mynij
Commits
933ebfd7
Commit
933ebfd7
authored
Feb 15, 2021
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_mynij_search: fix build index with broken sitemap/rss url
parent
2e87a198
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
20 deletions
+65
-20
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_mynij_parser.js.js
...athTemplateItem/web_page_module/gadget_mynij_parser.js.js
+28
-7
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_mynij_parser.js.xml
...thTemplateItem/web_page_module/gadget_mynij_parser.js.xml
+2
-2
bt5/erp5_web_mynij_search/SkinTemplateItem/portal_skins/erp5_mynij/action_mynij_search_build_index.js.js
...al_skins/erp5_mynij/action_mynij_search_build_index.js.js
+35
-11
No files found.
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_mynij_parser.js.js
View file @
933ebfd7
...
...
@@ -94,8 +94,16 @@
gadget
.
state
.
current_build
=
entry
;
link_list
=
entry
.
links
.
split
(
"
\n
"
).
filter
(
l
=>
l
.
length
>
0
);
return
gadget
.
build_index
(
link_list
,
entry
.
index_name
)
.
push
(
function
()
{
console
.
log
(
"
done building index
"
);
.
push
(
function
(
build_failed
)
{
if
(
build_failed
)
{
failed
=
true
;
status
=
'
build failed
'
;
gadget
.
state
.
current_build
=
undefined
;
return
gadget
.
notifySubmitted
({
message
:
"
Index '
"
+
entry
.
index_name
+
"
' built failed!
"
,
status
:
"
error
"
});
}
return
gadget
.
save_index
(
entry
.
index_name
)
.
push
(
function
(
result
)
{
status
=
'
built
'
;
...
...
@@ -191,11 +199,27 @@
.
declareMethod
(
"
build_index
"
,
function
(
links
,
index_name
)
{
var
gadget
=
this
,
promise_list
=
[],
build_queue
=
new
RSVP
.
Queue
(),
failed
=
false
,
i
;
function
build_link
(
link
,
name
)
{
return
build_queue
.
push
(
function
()
{
if
(
!
failed
)
return
gadget
.
get_and_handle
(
link
,
name
);
})
.
push
(
undefined
,
function
(
error
)
{
console
.
log
(
error
);
failed
=
true
;
});
}
for
(
i
=
0
;
i
<
links
.
length
;
i
+=
1
)
{
promise_list
.
push
(
gadget
.
get_and_handle
(
links
[
i
],
index_name
)
);
build_link
(
links
[
i
],
index_name
);
}
return
RSVP
.
all
(
promise_list
);
return
build_queue
.
push
(
function
()
{
return
failed
;
});
})
.
declareMethod
(
"
get_and_handle
"
,
function
(
link
,
index_name
)
{
...
...
@@ -222,9 +246,6 @@
link
,
index_name
);
}
})
.
push
(
undefined
,
function
(
error
)
{
console
.
log
(
error
);
});
})
...
...
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_mynij_parser.js.xml
View file @
933ebfd7
...
...
@@ -242,7 +242,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
990.2
089.59132.27426
</string>
</value>
<value>
<string>
990.2
403.64322.7168
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>
1613
386502.59
</float>
<float>
1613
405732.81
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_mynij_search/SkinTemplateItem/portal_skins/erp5_mynij/action_mynij_search_build_index.js.js
View file @
933ebfd7
(
function
(
window
,
rJS
,
RSVP
)
{
"
use strict
"
;
function
validateHttpUrl
(
value
)
{
/*jslint regexp: true*/
if
(
/
\(?(?:(
http|https
)
:
\/\/)(?:((?:[^\W\s]
|
\.
|-|
[
:
]{1})
+
)
@
{1})?((?:
www.
)?(?:[^\W\s]
|
\.
|-
)
+
[\.][^\W\s]{2,4}
|localhost|
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}
|
\[[\d
abcedf:
]
+
\])(?:
:
(\d
*
))?([\/]?[^\s\?]
*
[\/]{1})
*
(?:\/?([^\s\n\?\[\]\{\}\#]
*
(?:(?=\.)){1}
|
[^\s\n\?\[\]\{\}\.\#]
*
)?([\.]{1}[^\s\?\#]
*
)?)?(?:\?{1}([^\s\n\#\[\]]
*
))?([\#][^\s\n]
*
)?\)?
/i
.
test
(
value
))
{
return
true
;
}
/*jslint regexp: false*/
return
false
;
}
rJS
(
window
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
"
notifySubmitted
"
)
...
...
@@ -21,7 +31,29 @@
gadget
=
this
,
list
=
parent_options
.
doc
.
links
,
index_name
=
parent_options
.
doc
.
title
,
jio_key
=
parent_options
.
action_options
.
jio_key
;
jio_key
=
parent_options
.
action_options
.
jio_key
,
link_list
,
i
;
return_submit_dict
=
{
notify
:
{
message
:
""
,
status
:
"
success
"
},
redirect
:
{
command
:
"
display
"
,
options
:
{
page
:
"
ojs_local_controller
"
,
jio_key
:
jio_key
}
}
};
link_list
=
list
.
split
(
"
\n
"
).
filter
(
l
=>
l
.
length
>
0
);
for
(
i
=
0
;
i
<
link_list
.
length
;
i
+=
1
)
{
if
(
!
validateHttpUrl
(
link_list
[
i
]))
{
return_submit_dict
.
notify
.
message
=
"
Links paramter has invalid URL(s)!
"
;
return_submit_dict
.
notify
.
status
=
"
error
"
;
return
return_submit_dict
;
}
}
return
gadget
.
getSetting
(
"
build_dict
"
,
{})
.
push
(
function
(
build_dict
){
...
...
@@ -34,16 +66,8 @@
return
gadget
.
setSetting
(
"
build_dict
"
,
build_dict
);
})
.
push
(
function
(){
return_submit_dict
=
{
notify
:
{
message
:
"
Index
"
+
index_name
+
"
will start building...
"
,
status
:
"
success
"
},
redirect
:
{
command
:
"
display
"
,
options
:
{
page
:
"
ojs_local_controller
"
,
jio_key
:
jio_key
}
}
};
return_submit_dict
.
notify
.
message
=
"
Index
"
+
index_name
+
"
will start building...
"
;
return
return_submit_dict
;
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment