Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
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*/
/*globals window, RSVP, rJS*/
/*jslint indent: 2, nomen: true, maxlen: 80*/
/*jslint indent: 2, nomen: true, maxlen: 80*/
(
function
(
window
,
RSVP
,
rJS
)
{
(
function
(
window
,
RSVP
,
rJS
)
{
"
use strict
"
;
"
use strict
"
;
function
getSearchedString
()
{
function
getSearchedString
()
{
var
regex
=
new
RegExp
(
"
[
\\
#?&]search=([^&]*)
"
),
var
regex
=
new
RegExp
(
"
[
\\
#?&]search=([^&]*)
"
),
results
=
regex
.
exec
(
window
.
location
.
hash
);
results
=
regex
.
exec
(
window
.
location
.
hash
);
return
results
===
null
?
""
:
decodeURIComponent
(
results
[
1
].
replace
(
/
\+
/g
,
"
"
));
return
results
===
null
?
""
:
decodeURIComponent
(
results
[
1
].
replace
(
/
\+
/g
,
"
"
));
}
}
function
updateSearchUrl
(
event
)
{
function
updateSearchUrl
(
event
)
{
var
gadget
=
this
;
var
gadget
=
this
;
makeOptionDict
(
gadget
)
makeOptionDict
(
gadget
)
.
push
(
function
()
{
.
push
(
function
()
{
return
gadget
.
getSetting
(
"
option
"
);
return
gadget
.
getSetting
(
"
option
"
);
})
})
.
push
(
function
(
option
)
{
.
push
(
function
(
option
)
{
return
gadget
.
getUrlFor
(
option
);
return
gadget
.
getUrlFor
(
option
);
})
})
.
push
(
function
(
url
)
{
.
push
(
function
(
url
)
{
url
=
window
.
location
.
href
+
url
;
url
=
window
.
location
.
href
+
url
;
gadget
.
props
.
element
.
getElementsByClassName
(
"
search-engine-url
"
)[
0
].
innerHTML
=
url
;
gadget
.
props
.
element
.
getElementsByClassName
(
"
search-engine-url
"
)[
0
].
innerHTML
=
url
;
});
});
}
}
rJS
(
window
)
rJS
(
window
)
.
ready
(
function
(
g
)
{
.
ready
(
function
(
g
)
{
g
.
props
=
{};
g
.
props
=
{};
return
g
.
getElement
()
return
g
.
getElement
()
.
push
(
function
(
element
)
{
.
push
(
function
(
element
)
{
g
.
props
.
element
=
element
;
g
.
props
.
element
=
element
;
});
});
})
})
.
declareAcquiredMethod
(
"
translate
"
,
"
translate
"
)
.
declareAcquiredMethod
(
"
translate
"
,
"
translate
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
'
getSetting
'
,
'
getSetting
'
)
.
declareAcquiredMethod
(
'
getSetting
'
,
'
getSetting
'
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
setSetting
"
,
"
setSetting
"
)
.
declareAcquiredMethod
(
"
setSetting
"
,
"
setSetting
"
)
.
declareMethod
(
"
render
"
,
function
(
options
)
{
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
,
var
gadget
=
this
,
portal_type
=
null
,
portal_type
=
null
,
option
=
{
option
=
{
auto_redirect
:
false
,
auto_redirect
:
false
,
search_engine
:
""
search_engine
:
""
};
};
return
new
RSVP
.
Queue
()
return
new
RSVP
.
Queue
()
.
push
(
gadget
.
updateHeader
({
title
:
'
Search in Bookmarks
'
}))
.
push
(
gadget
.
updateHeader
({
title
:
'
Search in Bookmarks
'
}))
.
push
(
function
()
{
.
push
(
function
()
{
return
gadget
.
getSetting
(
"
portal_type
"
)
return
gadget
.
getSetting
(
"
portal_type
"
)
.
push
(
function
(
result
)
{
.
push
(
function
(
result
)
{
portal_type
=
result
;
portal_type
=
result
;
});
});
})
})
.
push
(
function
(){
.
push
(
function
(){
return
gadget
.
getSetting
(
"
option
"
)
return
gadget
.
getSetting
(
"
option
"
)
.
push
(
function
(
result
)
{
.
push
(
function
(
result
)
{
if
(
result
)
{
if
(
result
)
{
option
=
result
;
option
=
result
;
}
}
});
});
})
})
.
push
(
function
()
{
.
push
(
function
()
{
var
search
=
window
.
decodeURIComponent
(
getSearchedString
()),
var
search
=
window
.
decodeURIComponent
(
getSearchedString
()),
query
=
""
;
query
=
""
;
if
(
search
)
{
if
(
search
)
{
query
=
{
query
=
{
query
:
'
(title:"%
'
+
search
+
'
%" OR url_string:"%
'
+
search
+
'
%" OR description:"%
'
+
search
+
'
%") AND portal_type:"
'
+
portal_type
+
'
"
'
,
query
:
'
(title:"%
'
+
search
+
'
%" OR url_string:"%
'
+
search
+
'
%" OR description:"%
'
+
search
+
'
%") AND portal_type:"
'
+
portal_type
+
'
"
'
,
select_list
:
[
'
title
'
,
'
url_string
'
,
'
description
'
],
select_list
:
[
'
title
'
,
'
url_string
'
,
'
description
'
],
};
};
return
gadget
.
jio_allDocs
(
query
)
return
gadget
.
jio_allDocs
(
query
)
.
push
(
function
(
query_result
)
{
.
push
(
function
(
query_result
)
{
var
result_list_length
=
query_result
.
data
.
rows
.
length
;
var
result_list_length
=
query_result
.
data
.
rows
.
length
;
// if 0 result, let's search with a real search engine
// if 0 result, let's search with a real search engine
if
(
result_list_length
===
0
&&
option
.
search_engine
!==
''
)
{
if
(
result_list_length
===
0
&&
option
.
search_engine
!==
''
)
{
window
.
location
.
href
=
option
.
search_engine
+
window
.
encodeURIComponent
(
search
);
window
.
location
.
href
=
option
.
search_engine
+
window
.
encodeURIComponent
(
search
);
}
}
// if 1 result, we go there
// if 1 result, we go there
else
if
(
result_list_length
===
1
&&
option
.
auto_redirect
===
true
)
{
else
if
(
result_list_length
===
1
&&
option
.
auto_redirect
===
true
)
{
window
.
location
.
href
=
query_result
.
data
.
rows
[
0
].
value
.
url_string
;
window
.
location
.
href
=
query_result
.
data
.
rows
[
0
].
value
.
url_string
;
}
}
else
{
else
{
return
gadget
.
getUrlFor
({
page
:
"
bookmark_list
"
,
search
:
window
.
encodeURIComponent
(
search
)})
return
gadget
.
getUrlFor
({
page
:
"
bookmark_list
"
,
search
:
window
.
encodeURIComponent
(
search
)})
.
push
(
function
(
url
)
{
.
push
(
function
(
url
)
{
window
.
location
.
href
=
url
;
window
.
location
.
href
=
url
;
});
});
}
}
});
});
}
}
});
});
})
})
.
onEvent
(
"
submit
"
,
function
()
{
.
onEvent
(
"
submit
"
,
function
()
{
var
gadget
=
this
;
var
gadget
=
this
;
//var option_parameter = gadget.getSetting("option");
//var option_parameter = gadget.getSetting("option");
var
option_parameter
=
{
var
option_parameter
=
{
search
:
window
.
encodeURIComponent
(
gadget
.
props
.
element
.
getElementsByTagName
(
'
input
'
)[
0
].
value
),
search
:
window
.
encodeURIComponent
(
gadget
.
props
.
element
.
getElementsByTagName
(
'
input
'
)[
0
].
value
),
page
:
'
bookmark_dispatcher
'
page
:
'
bookmark_dispatcher
'
};
};
return
gadget
.
getUrlFor
(
option_parameter
)
return
gadget
.
getUrlFor
(
option_parameter
)
.
push
(
function
(
url
)
{
.
push
(
function
(
url
)
{
window
.
location
.
href
=
url
;
window
.
location
.
href
=
url
;
});
});
});
});
}(
window
,
RSVP
,
rJS
));
}(
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 @@
...
@@ -236,7 +236,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -254,7 +254,7 @@
...
@@ -254,7 +254,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
85780744.68
</float>
<float>
14
99162399.03
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</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