Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1821465
script.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Size
31 KB
Subscribers
None
script.js
View Options
jQuery
(
function
()
{
var
links
=
0
;
// Remove the CSS-only popup and replace it with a jQuery/AJAX popup
jQuery
(
'div.dokuwiki a.plugin_davcard_url span.plugin_davcard_popup'
).
each
(
function
()
{
jQuery
(
this
).
addClass
(
'plugin_davcard_nopopup'
);
jQuery
(
this
).
removeClass
(
'plugin_davcard_popup'
);
var
$link
=
jQuery
(
this
).
parents
(
'a.plugin_davcard_url'
);
if
(
!
$link
)
return
;
$link
.
davcard_popup_id
=
'plugin_davcard_popup_'
+
(
links
++
);
$link
.
mouseover
(
function
()
{
$link
.
davcard_timer
=
window
.
setTimeout
(
function
()
{
dw_davcard__modals
.
showOverlay
(
$link
);
$link
.
davcard_timer
=
null
;
},
300
);
});
// Attach edit event dialog to link
$link
.
click
(
function
(
e
)
{
dw_davcard__modals
.
attachEditDialog
(
$link
);
e
.
preventDefault
();
return
''
;
}
);
$link
.
mouseout
(
function
()
{
$link
=
jQuery
(
this
);
if
(
$link
.
davcard_timer
)
window
.
clearTimeout
(
$link
.
davcard_timer
);
$link
.
davcard_timer
=
null
;
});
});
// Attach to addressbook links
var
addressbookpage
=
jQuery
(
'#davcardAddressbookList'
).
data
(
'addressbookpage'
);
if
(
!
addressbookpage
)
return
;
jQuery
(
'div.davcardAddressbookAddNew a'
).
each
(
function
()
{
var
$link
=
jQuery
(
this
);
var
href
=
$link
.
attr
(
'href'
);
if
(
!
href
)
return
;
$link
.
click
(
function
(
e
)
{
dw_davcard__modals
.
id
=
addressbookpage
;
dw_davcard__modals
.
showEditContactDialog
(
null
,
false
,
true
);
e
.
preventDefault
();
return
''
;
}
);
}
);
jQuery
(
'div.dokuwiki a.plugin_davcard_edit_vcard'
).
each
(
function
()
{
var
$link
=
jQuery
(
this
);
// Attach edit event dialog to link
$link
.
click
(
function
(
e
)
{
dw_davcard__modals
.
attachEditDialog
(
$link
);
e
.
preventDefault
();
return
''
;
}
);
});
});
/**
* This holds all modal windows that DAVCard uses.
*/
var
dw_davcard__modals
=
{
$editContactDialog
:
null
,
$confirmDialog
:
null
,
$loadingDialog
:
null
,
page
:
JSINFO
[
'id'
],
id
:
null
,
uri
:
null
,
action
:
null
,
completeCb
:
null
,
msg
:
null
,
attachEditDialog
:
function
(
$link
)
{
dw_davcard__modals
.
showLoadingDialog
();
dw_davcard__modals
.
id
=
$link
.
data
(
'davcardid'
);
var
write
=
$link
.
data
(
'write'
);
jQuery
.
post
(
DOKU_BASE
+
'lib/exe/ajax.php'
,
{
call
:
'plugin_davcard'
,
id
:
$link
.
data
(
'davcardid'
),
page
:
dw_davcard__modals
.
page
,
action
:
'getContactDetails'
,
params
:
{
uri
:
$link
.
data
(
'davcarduri'
),
},
sectok
:
JSINFO
.
plugin
.
davcard
[
'sectok'
]
},
function
(
data
)
{
var
result
=
data
[
'result'
];
if
(
result
===
true
)
{
dw_davcard__modals
.
hideLoadingDialog
();
dw_davcard__modals
.
showEditContactDialog
(
data
[
'contactdata'
],
true
,
write
);
}
else
{
dw_davcard__modals
.
hideLoadingDialog
();
dw_davcard__modals
.
msg
=
LANG
.
plugins
.
davcard
[
'error_loading'
];
dw_davcard__modals
.
showDialog
(
false
);
}
}
);
},
showEditContactDialog
:
function
(
entry
,
edit
,
write
)
{
if
(
dw_davcard__modals
.
$editContactDialog
)
return
;
var
title
=
''
;
var
dialogButtons
=
{};
if
(
edit
)
{
title
=
LANG
.
plugins
.
davcard
[
'edit_entry'
];
dialogButtons
[
LANG
.
plugins
.
davcard
[
'edit'
]]
=
function
()
{
var
postArray
=
{
};
var
addrArray
=
new
Array
();
var
mailArray
=
new
Array
();
var
phoneArray
=
new
Array
();
var
pageid
=
jQuery
(
"#dw_davcard__addressbook option:selected"
).
val
();
jQuery
(
"tr.dw_davcard__editentry_phone_row"
).
each
(
function
()
{
var
type
=
jQuery
(
this
).
children
(
"td.dw_davcard__editentry_phone_row_type"
).
data
(
'type'
);
var
phone
=
jQuery
(
this
).
children
(
"td.dw_davcard__editentry_phone_row_number"
).
html
();
var
phoneRow
=
{
};
phoneRow
[
'type'
]
=
type
;
phoneRow
[
'number'
]
=
phone
;
phoneArray
.
push
(
phoneRow
);
});
jQuery
(
"tr.dw_davcard__editentry_email_row"
).
each
(
function
()
{
var
type
=
jQuery
(
this
).
children
(
"td.dw_davcard__editentry_email_row_data"
).
data
(
'type'
);
var
email
=
jQuery
(
this
).
children
(
"td.dw_davcard__editentry_email_row_data"
).
html
();
mailRow
=
{
};
mailRow
[
'type'
]
=
type
;
mailRow
[
'mail'
]
=
email
;
mailArray
.
push
(
mailRow
);
});
jQuery
(
"tr.dw_davcard__editentry_addresses_row"
).
each
(
function
()
{
var
$rowData
=
jQuery
(
this
).
children
(
"td.dw_davcard__editentry_addresses_row_data"
);
var
type
=
$rowData
.
data
(
'type'
);
var
city
=
$rowData
.
data
(
'city'
);
var
street
=
$rowData
.
data
(
'street'
);
var
zipcode
=
$rowData
.
data
(
'zipcode'
);
var
country
=
$rowData
.
data
(
'country'
);
var
addrRow
=
{
};
addrRow
[
'type'
]
=
type
;
addrRow
[
'city'
]
=
city
;
addrRow
[
'street'
]
=
street
;
addrRow
[
'zipcode'
]
=
zipcode
;
addrRow
[
'country'
]
=
country
;
addrArray
.
push
(
addrRow
);
});
postArray
[
'phones'
]
=
phoneArray
;
postArray
[
'email'
]
=
mailArray
;
postArray
[
'addresses'
]
=
addrArray
;
postArray
[
'uri'
]
=
entry
[
'uri'
];
jQuery
(
"input.dw_davcard__editcontact"
).
each
(
function
()
{
if
(
jQuery
(
this
).
attr
(
'type'
)
==
'checkbox'
)
{
postArray
[
jQuery
(
this
).
prop
(
'name'
)]
=
jQuery
(
this
).
prop
(
'checked'
)
?
1
:
0
;
}
else
{
postArray
[
jQuery
(
this
).
prop
(
'name'
)]
=
jQuery
(
this
).
val
();
}
});
jQuery
(
'#dw_davcard__ajaxedit'
).
html
(
'<img src="'
+
DOKU_BASE
+
'lib/images/throbber.gif" alt="" width="16" height="16" />'
);
jQuery
.
post
(
DOKU_BASE
+
'lib/exe/ajax.php'
,
{
call
:
'plugin_davcard'
,
id
:
pageid
,
page
:
dw_davcard__modals
.
page
,
action
:
'editContact'
,
params
:
postArray
,
sectok
:
JSINFO
.
plugin
.
davcard
[
'sectok'
]
},
function
(
data
)
{
var
result
=
data
[
'result'
];
var
html
=
data
[
'html'
];
jQuery
(
'#dw_davcard__ajaxedit'
).
html
(
html
);
if
(
result
===
true
)
{
dw_davcard__modals
.
hideEditContactDialog
();
location
.
reload
();
}
}
);
};
dialogButtons
[
LANG
.
plugins
.
davcard
[
'delete'
]]
=
function
()
{
dw_davcard__modals
.
action
=
'deleteContact'
;
dw_davcard__modals
.
uri
=
entry
[
'uri'
];
dw_davcard__modals
.
msg
=
LANG
.
plugins
.
davcard
[
'really_delete_this_entry'
];
dw_davcard__modals
.
completeCb
=
function
(
data
)
{
var
result
=
data
[
'result'
];
jQuery
(
'#dw_davcard__ajaxedit'
).
html
(
data
[
'html'
]);
if
(
result
===
true
)
{
dw_davcard__modals
.
hideEditContactDialog
();
location
.
reload
();
}
};
dw_davcard__modals
.
showDialog
(
true
);
};
}
else
{
title
=
LANG
.
plugins
.
davcard
[
'create_entry'
];
dialogButtons
[
LANG
.
plugins
.
davcard
[
'create'
]]
=
function
()
{
var
postArray
=
{
};
var
addrArray
=
new
Array
();
var
mailArray
=
new
Array
();
var
phoneArray
=
new
Array
();
var
pageid
=
jQuery
(
"#dw_davcard__addressbook option:selected"
).
val
();
jQuery
(
"tr.dw_davcard__editentry_phone_row"
).
each
(
function
()
{
var
type
=
jQuery
(
this
).
children
(
"td.dw_davcard__editentry_phone_row_type"
).
data
(
'type'
);
var
phone
=
jQuery
(
this
).
children
(
"td.dw_davcard__editentry_phone_row_number"
).
html
();
var
phoneRow
=
{
};
phoneRow
[
'type'
]
=
type
;
phoneRow
[
'number'
]
=
phone
;
phoneArray
.
push
(
phoneRow
);
});
jQuery
(
"tr.dw_davcard__editentry_email_row"
).
each
(
function
()
{
var
type
=
jQuery
(
this
).
children
(
"td.dw_davcard__editentry_email_row_data"
).
data
(
'type'
);
var
email
=
jQuery
(
this
).
children
(
"td.dw_davcard__editentry_email_row_data"
).
html
();
mailRow
=
{
};
mailRow
[
'type'
]
=
type
;
mailRow
[
'mail'
]
=
email
;
mailArray
.
push
(
mailRow
);
});
jQuery
(
"tr.dw_davcard__editentry_addresses_row"
).
each
(
function
()
{
var
$rowData
=
jQuery
(
this
).
children
(
"td.dw_davcard__editentry_addresses_row_data"
);
var
type
=
$rowData
.
data
(
'type'
);
var
city
=
$rowData
.
data
(
'city'
);
var
street
=
$rowData
.
data
(
'street'
);
var
zipcode
=
$rowData
.
data
(
'zipcode'
);
var
country
=
$rowData
.
data
(
'country'
);
var
addrRow
=
{
};
addrRow
[
'type'
]
=
type
;
addrRow
[
'city'
]
=
city
;
addrRow
[
'street'
]
=
street
;
addrRow
[
'zipcode'
]
=
zipcode
;
addrRow
[
'country'
]
=
country
;
addrArray
.
push
(
addrRow
);
});
postArray
[
'phones'
]
=
phoneArray
;
postArray
[
'email'
]
=
mailArray
;
postArray
[
'addresses'
]
=
addrArray
;
jQuery
(
"input.dw_davcard__editcontact"
).
each
(
function
()
{
if
(
jQuery
(
this
).
attr
(
'type'
)
==
'checkbox'
)
{
postArray
[
jQuery
(
this
).
prop
(
'name'
)]
=
jQuery
(
this
).
prop
(
'checked'
)
?
1
:
0
;
}
else
{
postArray
[
jQuery
(
this
).
prop
(
'name'
)]
=
jQuery
(
this
).
val
();
}
});
jQuery
(
'#dw_davcard__ajaxedit'
).
html
(
'<img src="'
+
DOKU_BASE
+
'lib/images/throbber.gif" alt="" width="16" height="16" />'
);
jQuery
.
post
(
DOKU_BASE
+
'lib/exe/ajax.php'
,
{
call
:
'plugin_davcard'
,
id
:
pageid
,
page
:
dw_davcard__modals
.
page
,
action
:
'newContact'
,
params
:
postArray
,
sectok
:
JSINFO
.
plugin
.
davcard
[
'sectok'
]
},
function
(
data
)
{
var
result
=
data
[
'result'
];
var
html
=
data
[
'html'
];
jQuery
(
'#dw_davcard__ajaxedit'
).
html
(
html
);
if
(
result
===
true
)
{
dw_davcard__modals
.
hideEditContactDialog
();
location
.
reload
();
}
}
);
};
}
// Remove create/edit buttons if we are read only
if
(
!
write
)
{
delete
dialogButtons
[
'create'
];
delete
dialogButtons
[
'edit'
];
}
dialogButtons
[
LANG
.
plugins
.
davcard
[
'cancel'
]]
=
function
()
{
dw_davcard__modals
.
hideEditContactDialog
();
};
dw_davcard__modals
.
$editContactDialog
=
jQuery
(
document
.
createElement
(
'div'
))
.
dialog
({
autoOpen
:
false
,
draggable
:
true
,
// fix for dragging: http://stackoverflow.com/questions/17247486/jquery-ui-dialog-dragging-issues
drag
:
function
(
event
,
ui
)
{
var
fixPix
=
jQuery
(
document
).
scrollTop
();
iObj
=
ui
.
position
;
iObj
.
top
=
iObj
.
top
-
fixPix
;
jQuery
(
this
).
closest
(
".ui-dialog"
).
css
(
"top"
,
iObj
.
top
+
"px"
);
},
title
:
title
,
resizable
:
true
,
buttons
:
dialogButtons
,
})
.
html
(
'<div><table>'
+
'<tr><td>'
+
LANG
.
plugins
.
davcard
[
'addressbook'
]
+
'</td><td><select id="dw_davcard__addressbook"></select></td></tr>'
+
'<tr><td>'
+
LANG
.
plugins
.
davcard
[
'firstname'
]
+
'</td><td><input type="text" id="dw_davcard__firstname_edit" name="firstname" class="dw_davcard__editcontact"></td></tr>'
+
'<tr><td>'
+
LANG
.
plugins
.
davcard
[
'lastname'
]
+
'</td><td><input type="text" id="dw_davcard__lastname_edit" name="lastname" class="dw_davcard__editcontact"></td></tr>'
+
'<tr><td>'
+
LANG
.
plugins
.
davcard
[
'phone'
]
+
'</td><td><table id="dw_davcard__editentry_phones"><tbody><tr><td><select id="dw_davcard__editentry_phones_select"></select></td><td><input type="text" id="dw_davcard__editentry_phone_edit"></td><td><a href="#" id="dw_davcard__editentry_phone_add">'
+
LANG
.
plugins
.
davcard
[
'add_phone'
]
+
'</a></td></tr></tbody></table></td></tr>'
+
'<tr><td>'
+
LANG
.
plugins
.
davcard
[
'email'
]
+
'</td><td><table id="dw_davcard__editentry_emails"><tbody><tr><td><input type="text" id="dw_davcard__editentry_email_edit"></td><td><a href="#" id="dw_davcard__editentry_email_add">'
+
LANG
.
plugins
.
davcard
[
'add_mail'
]
+
'</a></td></tr></tbody></table></td></tr>'
+
'<tr><td>'
+
LANG
.
plugins
.
davcard
[
'addresses'
]
+
'</td><td><table id="dw_davcard__editentry_addresses"><tbody>'
+
'<tr><td rowspan="5"><select id="dw_davcard__editentry_addresses_select"></select></td><td>'
+
LANG
.
plugins
.
davcard
[
'street'
]
+
'</td><td><input type="text" id="dw_davcard__editentry_addresses_street"></td></tr>'
+
'<tr><td>'
+
LANG
.
plugins
.
davcard
[
'zipcode'
]
+
'</td><td><input type="text" id="dw_davcard__editentry_addresses_zipcode"></td></tr>'
+
'<tr><td>'
+
LANG
.
plugins
.
davcard
[
'city'
]
+
'</td><td><input type="text" id="dw_davcard__editentry_addresses_city"></td></tr>'
+
'<tr><td>'
+
LANG
.
plugins
.
davcard
[
'country'
]
+
'</td><td><input type="text" id="dw_davcard__editentry_addresses_country"></td></tr>'
+
'<tr><td><a href="#" id="dw_davcard__editentry_addresses_add">'
+
LANG
.
plugins
.
davcard
[
'add_address'
]
+
'</a></td></tr></tbody></table></td></tr>'
+
'</tbody></table></td></tr>'
+
'</table>'
+
'</div>'
+
'<div id="dw_davcard__ajaxedit"></div>'
)
.
parent
()
.
attr
(
'id'
,
'dw_davcard__edit'
)
.
css
({
'overflow-y'
:
'auto'
})
.
show
()
.
appendTo
(
'.dokuwiki:first'
);
// attach event handlers
jQuery
(
'#dw_davcard__edit .ui-dialog-titlebar-close'
).
click
(
function
(){
dw_davcard__modals
.
hideEditContactDialog
();
});
// Populate Dropdowns
var
$dropdown
=
jQuery
(
'#dw_davcard__editentry_phones_select'
);
$dropdown
.
append
(
'<option value="work">'
+
dw_davcard__modals
.
phoneTypeToString
(
'work'
)
+
'</option>'
);
$dropdown
.
append
(
'<option value="cell">'
+
dw_davcard__modals
.
phoneTypeToString
(
'cell'
)
+
'</option>'
);
$dropdown
.
append
(
'<option value="home">'
+
dw_davcard__modals
.
phoneTypeToString
(
'home'
)
+
'</option>'
);
$dropdown
=
jQuery
(
'#dw_davcard__editentry_addresses_select'
);
$dropdown
.
append
(
'<option value="work">'
+
dw_davcard__modals
.
addressTypeToString
(
'work'
)
+
'</option>'
);
$dropdown
.
append
(
'<option value="home">'
+
dw_davcard__modals
.
addressTypeToString
(
'home'
)
+
'</option>'
);
$dropdown
=
jQuery
(
'#dw_davcard__addressbook'
);
jQuery
(
'#davcardAddressbookList option'
).
each
(
function
()
{
var
sel
=
''
;
if
(
edit
&&
dw_davcard__modals
.
id
==
jQuery
(
this
).
val
())
sel
=
' selected="selected"'
;
if
(
edit
||
(
!
edit
&&
(
jQuery
(
this
).
data
(
'write'
)
==
"1"
||
jQuery
(
this
).
data
(
'write'
)
==
"true"
)))
{
$dropdown
.
append
(
'<option value="'
+
jQuery
(
this
).
val
()
+
'"'
+
sel
+
'>'
+
jQuery
(
this
).
text
()
+
'</option>'
);
}
});
if
(
edit
)
{
$dropdown
.
prop
(
'disabled'
,
true
);
}
dw_davcard__modals
.
attachPhoneDeleteHandlers
();
dw_davcard__modals
.
attachMailDeleteHandlers
();
dw_davcard__modals
.
attachAddressDeleteHandlers
();
jQuery
(
'#dw_davcard__editentry_phone_add'
).
on
(
"click"
,
function
(
e
)
{
e
.
preventDefault
();
var
number
=
jQuery
(
'#dw_davcard__editentry_phone_edit'
).
val
();
if
(
number
==
''
)
return
false
;
var
type
=
jQuery
(
'#dw_davcard__editentry_phones_select option:selected'
).
val
();
var
typeText
=
jQuery
(
'#dw_davcard__editentry_phones_select option:selected'
).
text
();
jQuery
(
'#dw_davcard__editentry_phone_edit'
).
val
(
''
);
dw_davcard__modals
.
addPhone
(
type
,
typeText
,
number
);
return
false
;
});
jQuery
(
'#dw_davcard__editentry_email_add'
).
on
(
"click"
,
function
(
e
)
{
e
.
preventDefault
();
var
mail
=
jQuery
(
'#dw_davcard__editentry_email_edit'
).
val
();
if
(
mail
==
''
)
return
false
;
jQuery
(
'#dw_davcard__editentry_email_edit'
).
val
(
''
);
dw_davcard__modals
.
addMail
(
'internet'
,
mail
);
return
false
;
});
jQuery
(
'#dw_davcard__editentry_addresses_add'
).
on
(
"click"
,
function
(
e
)
{
e
.
preventDefault
();
var
street
=
jQuery
(
'#dw_davcard__editentry_addresses_street'
).
val
();
var
zipcode
=
jQuery
(
'#dw_davcard__editentry_addresses_zipcode'
).
val
();
var
country
=
jQuery
(
'#dw_davcard__editentry_addresses_country'
).
val
();
var
city
=
jQuery
(
'#dw_davcard__editentry_addresses_city'
).
val
();
var
type
=
jQuery
(
'#dw_davcard__editentry_addresses_select option:selected'
).
val
();
var
typeText
=
jQuery
(
'#dw_davcard__editentry_addresses_select option:selected'
).
text
();
if
(
street
==
''
&&
zipcode
==
''
&&
country
==
''
&&
city
==
''
)
return
false
;
jQuery
(
'#dw_davcard__editentry_addresses_street'
).
val
(
''
);
jQuery
(
'#dw_davcard__editentry_addresses_city'
).
val
(
''
);
jQuery
(
'#dw_davcard__editentry_addresses_country'
).
val
(
''
);
jQuery
(
'#dw_davcard__editentry_addresses_zipcode'
).
val
(
''
);
dw_davcard__modals
.
addAddress
(
type
,
typeText
,
street
,
zipcode
,
city
,
country
);
return
false
;
});
if
(
edit
)
{
var
name
=
entry
[
'structuredname'
].
split
(
';'
);
jQuery
(
'#dw_davcard__lastname_edit'
).
val
(
name
[
0
]);
jQuery
(
'#dw_davcard__firstname_edit'
).
val
(
name
[
1
]);
for
(
var
i
=
0
;
i
<
entry
[
'tel'
].
length
;
i
++
)
{
var
type
=
'other'
;
if
(
'type'
in
entry
[
'tel'
][
i
])
var
type
=
entry
[
'tel'
][
i
][
'type'
];
var
val
=
entry
[
'tel'
][
i
][
'number'
];
var
typeText
=
dw_davcard__modals
.
phoneTypeToString
(
type
);
dw_davcard__modals
.
addPhone
(
type
,
typeText
,
val
);
}
for
(
var
i
=
0
;
i
<
entry
[
'addr'
].
length
;
i
++
)
{
var
type
=
'other'
;
if
(
'type'
in
entry
[
'addr'
][
i
])
type
=
entry
[
'addr'
][
i
][
'type'
];
var
street
=
entry
[
'addr'
][
i
][
'address'
][
2
];
var
zipcode
=
entry
[
'addr'
][
i
][
'address'
][
5
];
var
country
=
entry
[
'addr'
][
i
][
'address'
][
6
];
var
city
=
entry
[
'addr'
][
i
][
'address'
][
3
];
var
typeText
=
dw_davcard__modals
.
addressTypeToString
(
type
);
dw_davcard__modals
.
addAddress
(
type
,
typeText
,
street
,
zipcode
,
city
,
country
);
}
for
(
var
i
=
0
;
i
<
entry
[
'mail'
].
length
;
i
++
)
{
var
type
=
'other'
;
if
(
'type'
in
entry
[
'mail'
][
i
])
type
=
entry
[
'mail'
][
i
][
'type'
];
var
mail
=
entry
[
'mail'
][
i
][
'mail'
];
dw_davcard__modals
.
addMail
(
type
,
mail
);
}
}
// Resize the dialog if it's higher than the window
if
(
jQuery
(
'#dw_davcard__edit'
).
height
()
>
jQuery
(
window
).
height
())
{
jQuery
(
'#dw_davcard__edit'
).
height
(
jQuery
(
window
).
height
()
*
0.9
);
}
jQuery
(
'#dw_davcard__edit'
).
position
({
my
:
"center"
,
at
:
"center"
,
of
:
window
});
},
addressTypeToString
:
function
(
type
)
{
var
ret
=
''
;
switch
(
type
)
{
case
'work'
:
ret
=
LANG
.
plugins
.
davcard
[
'work'
];
break
;
case
'home'
:
ret
=
LANG
.
plugins
.
davcard
[
'home'
];
break
;
default
:
ret
=
LANG
.
plugins
.
davcard
[
'other_address'
];
break
;
}
return
ret
;
},
phoneTypeToString
:
function
(
type
)
{
var
ret
=
''
;
switch
(
type
)
{
case
'work'
:
ret
=
LANG
.
plugins
.
davcard
[
'workphone'
];
break
;
case
'cell'
:
ret
=
LANG
.
plugins
.
davcard
[
'cellphone'
];
break
;
case
'home'
:
ret
=
LANG
.
plugins
.
davcard
[
'phone'
];
break
;
default
:
ret
=
LANG
.
plugins
.
davcard
[
'otherphone'
];
break
;
}
return
ret
;
},
addPhone
:
function
(
type
,
typeText
,
number
)
{
var
row
=
'<tr class="dw_davcard__editentry_phone_row"><td class="dw_davcard__editentry_phone_row_type" data-type="'
+
type
+
'">'
+
typeText
+
'</td><td class="dw_davcard__editentry_phone_row_number">'
+
number
+
'</td><td><a class="deletePhoneNumber" href="#">'
+
LANG
.
plugins
.
davcard
[
'delete'
]
+
'</a></td></tr>'
;
jQuery
(
'#dw_davcard__editentry_phones > tbody:last'
).
append
(
row
);
dw_davcard__modals
.
attachPhoneDeleteHandlers
();
},
addMail
:
function
(
type
,
mail
)
{
var
row
=
'<tr class="dw_davcard__editentry_email_row"><td class="dw_davcard__editentry_email_row_data" data-type="'
+
type
+
'">'
+
mail
+
'</td><td><a class="deleteEmail" href="#">'
+
LANG
.
plugins
.
davcard
[
'delete'
]
+
'</a></td></tr>'
;
jQuery
(
'#dw_davcard__editentry_emails > tbody:last'
).
append
(
row
);
dw_davcard__modals
.
attachMailDeleteHandlers
();
},
addAddress
:
function
(
type
,
typeText
,
street
,
zipcode
,
city
,
country
)
{
var
row
=
'<tr class="dw_davcard__editentry_addresses_row"><td class="dw_davcard__editentry_addresses_row_data" data-type="'
+
type
+
'" data-city="'
+
city
+
'" data-zipcode="'
+
zipcode
+
'" data-country="'
+
country
+
'" data-street="'
+
street
+
'">'
+
typeText
+
'</td><td colspan="2"><strong>'
+
LANG
.
plugins
.
davcard
[
'street'
]
+
': </strong>'
+
street
+
'<br>'
+
'<strong>'
+
LANG
.
plugins
.
davcard
[
'city'
]
+
': </strong>'
+
zipcode
+
' '
+
city
+
'<br>'
+
'<strong>'
+
LANG
.
plugins
.
davcard
[
'country'
]
+
': </strong>'
+
country
+
'<br>'
+
'<a class="deleteAddress" href="#">'
+
LANG
.
plugins
.
davcard
[
'delete'
]
+
'</a></td></tr>'
;
jQuery
(
'#dw_davcard__editentry_addresses > tbody:last'
).
append
(
row
);
dw_davcard__modals
.
attachAddressDeleteHandlers
();
},
attachAddressDeleteHandlers
:
function
()
{
jQuery
(
"#dw_davcard__editentry_addresses .deleteAddress"
).
on
(
"click"
,
function
(
e
)
{
e
.
preventDefault
();
var
tr
=
jQuery
(
this
).
closest
(
'tr'
);
tr
.
css
(
"background-color"
,
"#FF3700"
);
tr
.
fadeOut
(
400
,
function
()
{
tr
.
remove
();
});
return
false
;
});
},
attachPhoneDeleteHandlers
:
function
()
{
jQuery
(
"#dw_davcard__editentry_phones .deletePhoneNumber"
).
on
(
"click"
,
function
(
e
)
{
e
.
preventDefault
();
var
tr
=
jQuery
(
this
).
closest
(
'tr'
);
tr
.
css
(
"background-color"
,
"#FF3700"
);
tr
.
fadeOut
(
400
,
function
()
{
tr
.
remove
();
});
return
false
;
});
},
attachMailDeleteHandlers
:
function
()
{
jQuery
(
"#dw_davcard__editentry_emails .deleteEmail"
).
on
(
"click"
,
function
(
e
)
{
e
.
preventDefault
();
var
tr
=
jQuery
(
this
).
closest
(
'tr'
);
tr
.
css
(
"background-color"
,
"#FF3700"
);
tr
.
fadeOut
(
400
,
function
()
{
tr
.
remove
();
});
return
false
;
});
},
showLoadingDialog
:
function
()
{
if
(
dw_davcard__modals
.
$loadingDialog
)
return
;
var
dialogButtons
=
{};
var
title
=
''
;
title
=
LANG
.
plugins
.
davcard
[
'loading'
];
dialogButtons
[
LANG
.
plugins
.
davcard
[
'cancel'
]]
=
function
()
{
dw_davcard__modals
.
hideLoadingDialog
();
};
dw_davcard__modals
.
$loadingDialog
=
jQuery
(
document
.
createElement
(
'div'
))
.
dialog
({
autoOpen
:
false
,
draggable
:
true
,
//fix for dragging: http://stackoverflow.com/questions/17247486/jquery-ui-dialog-dragging-issues
drag
:
function
(
event
,
ui
)
{
var
fixPix
=
jQuery
(
document
).
scrollTop
();
iObj
=
ui
.
position
;
iObj
.
top
=
iObj
.
top
-
fixPix
;
jQuery
(
this
).
closest
(
".ui-dialog"
).
css
(
"top"
,
iObj
.
top
+
"px"
);
},
title
:
title
,
resizable
:
true
,
buttons
:
dialogButtons
,
})
.
html
(
'<div>'
+
LANG
.
plugins
.
davcard
[
'loading'
]
+
'<img src="'
+
DOKU_BASE
+
'lib/images/throbber.gif" alt="" width="16" height="16" /></div>'
)
.
parent
()
.
attr
(
'id'
,
'dw_davcard__loading'
)
.
show
()
.
appendTo
(
'.dokuwiki:first'
);
jQuery
(
'#dw_davcard__loading'
).
position
({
my
:
"center"
,
at
:
"center"
,
of
:
window
});
// attach event handlers
jQuery
(
'#dw_davcard__loading .ui-dialog-titlebar-close'
).
click
(
function
(){
dw_davcard__modals
.
hideDialog
();
});
},
hideEditContactDialog
:
function
()
{
dw_davcard__modals
.
$editContactDialog
.
empty
();
dw_davcard__modals
.
$editContactDialog
.
remove
();
dw_davcard__modals
.
$editContactDialog
=
null
;
},
hideDialog
:
function
()
{
dw_davcard__modals
.
$dialog
.
empty
();
dw_davcard__modals
.
$dialog
.
remove
();
dw_davcard__modals
.
$dialog
=
null
;
},
hideLoadingDialog
:
function
()
{
dw_davcard__modals
.
$loadingDialog
.
empty
();
dw_davcard__modals
.
$loadingDialog
.
remove
();
dw_davcard__modals
.
$loadingDialog
=
null
;
},
showOverlay
:
function
(
$link
)
{
if
(
!
$link
.
davcard_popup
)
{
$link
.
davcard_popup
=
dw_page
.
insituPopup
(
$link
,
$link
.
davcard_popup_id
);
$link
.
davcard_popup
.
addClass
(
'plugin_davcard_popup_overlay'
);
$link
.
davcard_popup
.
load
(
DOKU_BASE
+
'lib/exe/ajax.php'
,
{
call
:
'plugin_davcard'
,
sectok
:
JSINFO
.
plugin
.
davcard
[
'sectok'
],
action
:
'getContactAjax'
,
id
:
$link
.
data
(
'davcardid'
),
params
:
{
uri
:
$link
.
data
(
'davcarduri'
),
}
}
);
}
$link
.
davcard_popup
.
show
();
},
showDialog
:
function
(
confirm
)
{
if
(
dw_davcard__modals
.
$confirmDialog
)
return
;
var
dialogButtons
=
{};
var
title
=
''
;
if
(
confirm
)
{
title
=
LANG
.
plugins
.
davcard
[
'confirmation'
];
dialogButtons
[
LANG
.
plugins
.
davcard
[
'yes'
]]
=
function
()
{
jQuery
.
post
(
DOKU_BASE
+
'lib/exe/ajax.php'
,
{
call
:
'plugin_davcard'
,
id
:
dw_davcard__modals
.
id
,
page
:
dw_davcard__modals
.
page
,
action
:
dw_davcard__modals
.
action
,
params
:
{
uri
:
dw_davcard__modals
.
uri
},
sectok
:
JSINFO
.
plugin
.
davcard
[
'sectok'
]
},
function
(
data
)
{
dw_davcard__modals
.
completeCb
(
data
);
}
);
dw_davcard__modals
.
hideDialog
();
};
dialogButtons
[
LANG
.
plugins
.
davcard
[
'cancel'
]]
=
function
()
{
dw_davcard__modals
.
hideDialog
();
};
}
else
{
title
=
LANG
.
plugins
.
davcard
[
'info'
];
dialogButtons
[
LANG
.
plugins
.
davcard
[
'ok'
]]
=
function
()
{
dw_davcard__modals
.
hideDialog
();
};
}
dw_davcard__modals
.
$dialog
=
jQuery
(
document
.
createElement
(
'div'
))
.
dialog
({
autoOpen
:
false
,
draggable
:
true
,
//fix for dragging: http://stackoverflow.com/questions/17247486/jquery-ui-dialog-dragging-issues
drag
:
function
(
event
,
ui
)
{
var
fixPix
=
jQuery
(
document
).
scrollTop
();
iObj
=
ui
.
position
;
iObj
.
top
=
iObj
.
top
-
fixPix
;
jQuery
(
this
).
closest
(
".ui-dialog"
).
css
(
"top"
,
iObj
.
top
+
"px"
);
},
title
:
title
,
resizable
:
true
,
buttons
:
dialogButtons
,
})
.
html
(
'<div>'
+
dw_davcard__modals
.
msg
+
'</div>'
)
.
parent
()
.
attr
(
'id'
,
'dw_davcard__confirm'
)
.
show
()
.
appendTo
(
'.dokuwiki:first'
);
jQuery
(
'#dw_davcard__confirm'
).
position
({
my
:
"center"
,
at
:
"center"
,
of
:
window
});
// attach event handlers
jQuery
(
'#dw_davcard__confirm .ui-dialog-titlebar-close'
).
click
(
function
(){
dw_davcard__modals
.
hideDialog
();
});
},
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 24, 12:33 AM (1 d, 3 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
893163
Default Alt Text
script.js (31 KB)
Attached To
rDAVCARD DokuWiki davcard PlugIn
Event Timeline
Log In to Comment