Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
erp5
Commits
b25768be
Commit
b25768be
authored
Jul 04, 2017
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: Bookmark Dispatcher, update encoding
parent
a097e772
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
111 additions
and
111 deletions
+111
-111
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_bookmark_dispatcher_js.js
...age_module/gadget_officejs_page_bookmark_dispatcher_js.js
+109
-109
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_bookmark_dispatcher_js.xml
...ge_module/gadget_officejs_page_bookmark_dispatcher_js.xml
+2
-2
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_bookmark_dispatcher_js.js
View file @
b25768be
/*globals window, RSVP, rJS*/
/*jslint indent: 2, nomen: true, maxlen: 80*/
(
function
(
window
,
RSVP
,
rJS
)
{
"
use strict
"
;
function
getSearchedString
()
{
var
regex
=
new
RegExp
(
"
[
\\
#?&]search=([^&]*)
"
),
results
=
regex
.
exec
(
window
.
location
.
hash
);
return
results
===
null
?
""
:
decodeURIComponent
(
results
[
1
].
replace
(
/
\+
/g
,
"
"
));
}
function
updateSearchUrl
(
event
)
{
var
gadget
=
this
;
makeOptionDict
(
gadget
)
.
push
(
function
()
{
return
gadget
.
getSetting
(
"
option
"
);
})
.
push
(
function
(
option
)
{
return
gadget
.
getUrlFor
(
option
);
})
.
push
(
function
(
url
)
{
url
=
window
.
location
.
href
+
url
;
gadget
.
props
.
element
.
getElementsByClassName
(
"
search-engine-url
"
)[
0
].
innerHTML
=
url
;
});
}
rJS
(
window
)
.
ready
(
function
(
g
)
{
g
.
props
=
{};
return
g
.
getElement
()
.
push
(
function
(
element
)
{
g
.
props
.
element
=
element
;
});
})
.
declareAcquiredMethod
(
"
translate
"
,
"
translate
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
'
getSetting
'
,
'
getSetting
'
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
setSetting
"
,
"
setSetting
"
)
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
,
portal_type
=
null
,
option
=
{
auto_redirect
:
false
,
search_engine
:
""
};
return
new
RSVP
.
Queue
()
.
push
(
gadget
.
updateHeader
({
title
:
'
Search in Bookmarks
'
}))
.
push
(
function
()
{
return
gadget
.
getSetting
(
"
portal_type
"
)
.
push
(
function
(
result
)
{
portal_type
=
result
;
});
})
.
push
(
function
(){
return
gadget
.
getSetting
(
"
option
"
)
.
push
(
function
(
result
)
{
if
(
result
)
{
option
=
result
;
}
});
})
.
push
(
function
()
{
var
search
=
window
.
decodeURIComponent
(
getSearchedString
()),
query
=
""
;
if
(
search
)
{
query
=
{
query
:
'
(title:"%
'
+
search
+
'
%" OR url_string:"%
'
+
search
+
'
%" OR description:"%
'
+
search
+
'
%") AND portal_type:"
'
+
portal_type
+
'
"
'
,
select_list
:
[
'
title
'
,
'
url_string
'
,
'
description
'
],
};
return
gadget
.
jio_allDocs
(
query
)
.
push
(
function
(
query_result
)
{
var
result_list_length
=
query_result
.
data
.
rows
.
length
;
// if 0 result, let's search with a real search engine
if
(
result_list_length
===
0
&&
option
.
search_engine
!==
''
)
{
window
.
location
.
href
=
option
.
search_engine
+
window
.
encodeURIComponent
(
search
);
}
// if 1 result, we go there
else
if
(
result_list_length
===
1
&&
option
.
auto_redirect
===
true
)
{
window
.
location
.
href
=
query_result
.
data
.
rows
[
0
].
value
.
url_string
;
}
else
{
return
gadget
.
getUrlFor
({
page
:
"
bookmark_list
"
,
search
:
window
.
encodeURIComponent
(
search
)})
.
push
(
function
(
url
)
{
window
.
location
.
href
=
url
;
});
}
});
}
});
})
.
onEvent
(
"
submit
"
,
function
()
{
var
gadget
=
this
;
//var option_parameter = gadget.getSetting("option");
var
option_parameter
=
{
search
:
window
.
encodeURIComponent
(
gadget
.
props
.
element
.
getElementsByTagName
(
'
input
'
)[
0
].
value
),
page
:
'
bookmark_dispatcher
'
};
return
gadget
.
getUrlFor
(
option_parameter
)
.
push
(
function
(
url
)
{
window
.
location
.
href
=
url
;
});
});
/*globals window, RSVP, rJS*/
/*jslint indent: 2, nomen: true, maxlen: 80*/
(
function
(
window
,
RSVP
,
rJS
)
{
"
use strict
"
;
function
getSearchedString
()
{
var
regex
=
new
RegExp
(
"
[
\\
#?&]search=([^&]*)
"
),
results
=
regex
.
exec
(
window
.
location
.
hash
);
return
results
===
null
?
""
:
decodeURIComponent
(
results
[
1
].
replace
(
/
\+
/g
,
"
"
));
}
function
updateSearchUrl
(
event
)
{
var
gadget
=
this
;
makeOptionDict
(
gadget
)
.
push
(
function
()
{
return
gadget
.
getSetting
(
"
option
"
);
})
.
push
(
function
(
option
)
{
return
gadget
.
getUrlFor
(
option
);
})
.
push
(
function
(
url
)
{
url
=
window
.
location
.
href
+
url
;
gadget
.
props
.
element
.
getElementsByClassName
(
"
search-engine-url
"
)[
0
].
innerHTML
=
url
;
});
}
rJS
(
window
)
.
ready
(
function
(
g
)
{
g
.
props
=
{};
return
g
.
getElement
()
.
push
(
function
(
element
)
{
g
.
props
.
element
=
element
;
});
})
.
declareAcquiredMethod
(
"
translate
"
,
"
translate
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
'
getSetting
'
,
'
getSetting
'
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
setSetting
"
,
"
setSetting
"
)
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
,
portal_type
=
null
,
option
=
{
auto_redirect
:
false
,
search_engine
:
""
};
return
new
RSVP
.
Queue
()
.
push
(
gadget
.
updateHeader
({
title
:
'
Search in Bookmarks
'
}))
.
push
(
function
()
{
return
gadget
.
getSetting
(
"
portal_type
"
)
.
push
(
function
(
result
)
{
portal_type
=
result
;
});
})
.
push
(
function
(){
return
gadget
.
getSetting
(
"
option
"
)
.
push
(
function
(
result
)
{
if
(
result
)
{
option
=
result
;
}
});
})
.
push
(
function
()
{
var
search
=
window
.
decodeURIComponent
(
getSearchedString
()),
query
=
""
;
if
(
search
)
{
query
=
{
query
:
'
(title:"%
'
+
search
+
'
%" OR url_string:"%
'
+
search
+
'
%" OR description:"%
'
+
search
+
'
%") AND portal_type:"
'
+
portal_type
+
'
"
'
,
select_list
:
[
'
title
'
,
'
url_string
'
,
'
description
'
],
};
return
gadget
.
jio_allDocs
(
query
)
.
push
(
function
(
query_result
)
{
var
result_list_length
=
query_result
.
data
.
rows
.
length
;
// if 0 result, let's search with a real search engine
if
(
result_list_length
===
0
&&
option
.
search_engine
!==
''
)
{
window
.
location
.
href
=
option
.
search_engine
+
window
.
encodeURIComponent
(
search
);
}
// if 1 result, we go there
else
if
(
result_list_length
===
1
&&
option
.
auto_redirect
===
true
)
{
window
.
location
.
href
=
query_result
.
data
.
rows
[
0
].
value
.
url_string
;
}
else
{
return
gadget
.
getUrlFor
({
page
:
"
bookmark_list
"
,
search
:
window
.
encodeURIComponent
(
search
)})
.
push
(
function
(
url
)
{
window
.
location
.
href
=
url
;
});
}
});
}
});
})
.
onEvent
(
"
submit
"
,
function
()
{
var
gadget
=
this
;
//var option_parameter = gadget.getSetting("option");
var
option_parameter
=
{
search
:
window
.
encodeURIComponent
(
gadget
.
props
.
element
.
getElementsByTagName
(
'
input
'
)[
0
].
value
),
page
:
'
bookmark_dispatcher
'
};
return
gadget
.
getUrlFor
(
option_parameter
)
.
push
(
function
(
url
)
{
window
.
location
.
href
=
url
;
});
});
}(
window
,
RSVP
,
rJS
));
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_bookmark_dispatcher_js.xml
View file @
b25768be
...
...
@@ -236,7 +236,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
56.64652.37486.36010
</string>
</value>
<value>
<string>
9
60.32759.37420.3857
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>
14
85780744.68
</float>
<float>
14
99162399.03
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
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