projects
/
ldapsaisie.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0f53dcf
)
functions.js : add urlAddVar function
author
Benjamin Renard
<brenard@easter-eggs.com>
Thu, 22 Oct 2009 08:31:54 +0000
(08:31 +0000)
committer
Benjamin Renard
<brenard@easter-eggs.com>
Thu, 22 Oct 2009 08:31:54 +0000
(08:31 +0000)
trunk/includes/js/functions.js
patch
|
blob
|
history
diff --git
a/trunk/includes/js/functions.js
b/trunk/includes/js/functions.js
index
efd1ef9
..
10987b6
100644
(file)
--- a/
trunk/includes/js/functions.js
+++ b/
trunk/includes/js/functions.js
@@
-144,3
+144,25
@@
function replaceSpaces(str,to) {
}
return new_str;
}
+
+/**
+ * Add one variable with value in URL
+ * @param[in] url string The original URL
+ * @param[in] name string The variable name
+ * @param[in] value string The value of the variable
+ *
+ * @retval string The URL with the value
+ */
+function urlAddVar(url,name,value) {
+ if ($type(url)) {
+ var isExtended = RegExp('[?]');
+ if (isExtended.test(url)) {
+ url=url+'&';
+ }
+ else {
+ url=url+'?';
+ }
+ return url + name + '=' + value;
+ }
+ return url;
+}