#contacts_propertymenu li a:hover { color: #fff }
#actionbar { height: 30px; width: 200px; position: fixed; right: 0px; top: 75px; margin: 0 0 0 0; padding: 0 0 0 0;}
#card { /*max-width: 70em; border: thin solid lightgray; display: block;*/ }
- #firstrun { /*border: thin solid lightgray;*/ width: 80%; margin: 5em auto auto auto; text-align: center; font-weight:bold; font-size:1.5em; color:#777;}
- #firstrun #selections { /*border: thin solid lightgray;*/ font-size:0.8em; width: 100%; margin: 2em auto auto auto; clear: both; }
+ #firstrun { width: 100%; position: absolute; top: 5em; left: 0; text-align: center; font-weight:bold; font-size:1.5em; color:#777; }
+ #firstrun #selections { font-size:0.8em; margin: 2em auto auto auto; clear: both; }
-#card input[type="text"].contacts_property,input[type="email"].contacts_property { width: 16em; }
+#card input[type="text"].contacts_property,input[type="email"].contacts_property { width: 14em; }
+.categories { float: left; width: 16em; }
#card input[type="text"],input[type="email"],input[type="tel"],input[type="date"], select { background-color: #f8f8f8; border: 0 !important; -webkit-appearance:none !important; -moz-appearance:none !important; -webkit-box-sizing:none !important; -moz-box-sizing:none !important; box-sizing:none !important; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; -moz-border-radius: 0px; -webkit-border-radius: 0px; border-radius: 0px; float: left; }
#card input[type="text"]:hover, input[type="text"]:focus, input[type="text"]:active,input[type="email"]:hover,input[type="tel"]:hover,input[type="date"]:hover,input[type="date"],input[type="date"]:hover,input[type="date"]:active,input[type="date"]:active,input[type="date"]:active,input[type="email"]:active,input[type="tel"]:active, select:hover, select:focus, select:active { border: 0 !important; -webkit-appearance:textfield; -moz-appearance:textfield; -webkit-box-sizing:content-box; -moz-box-sizing:content-box; box-sizing:content-box; background:#fff; color:#333; border:1px solid #ddd; -moz-box-shadow:0 1px 1px #fff, 0 2px 0 #bbb inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; outline:none; float: left; }
input[type="text"]:invalid,input[type="email"]:invalid,input[type="tel"]:invalid,input[type="date"]:invalid { background-color: #ffc0c0 !important; }
.propertylist li > input[type="checkbox"],input[type="radio"] { float: left; clear: left; width: 20px; height: 20px; vertical-align: middle; }
.propertylist li > select { float: left; max-width: 8em; }
.typelist { float: left; max-width: 10em; } /* for multiselect */
-.addresslist { clear: both; }
+.addresslist { clear: both; }
+
+#categoryform .scrollarea { position: absolute; left: 10px; top: 10px; right: 10px; bottom: 50px; overflow: auto; border:1px solid #ddd; background: #f8f8f8; }
+#categoryform .bottombuttons { position: absolute; bottom: 10px;}
+#categoryform .bottombuttons * { float: left;}
+/*#categorylist { border:1px solid #ddd;}*/
+#categorylist li { background:#f8f8f8; padding:.3em .8em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; -webkit-transition:background-color 500ms; -moz-transition:background-color 500ms; -o-transition:background-color 500ms; transition:background-color 500ms; }
+#categorylist li:hover, li:active { background:#eee; }
- #category_addinput { width: 10em; }
++#category_addinput { width: 10em; }
});
}
+ String.prototype.strip_tags = function(){
+ tags = this;
+ stripped = tags.replace(/[\<\>]/gi, "");
+ return stripped;
+ };
+
+Categories={
+ edit:function(){
+ console.log('Categories.edit');
+ $('body').append('<div id="category_dialog"></div>');
+ $('#category_dialog').load(OC.filePath('contacts', 'ajax', 'categories/edit.php'), function(response, status, xhr){
+ try {
+ var response = jQuery.parseJSON(response);
+ console.log('status: ' + status + ', response: ' + response + ', response.status:' + response.status);
+ if(response.status == 'error'){
+ alert(response.data.message);
+ } else {
+ alert(response);
+ }
+ } catch(e) {
+ $('#edit_categories_dialog').dialog({
+ modal: true,
+ height: 350, minHeight:200, width: 250, minWidth: 200,
+ buttons: {
+ 'Delete':function() {
+ Categories.delete();
+ },
+ 'Rescan':function() {
+ Categories.rescan();
+ }
+ },
+ close : function(event, ui) {
+ //alert('close');
+ $(this).dialog('destroy').remove();
+ $('#category_dialog').remove();
+ },
+ open : function(event, ui) {
+ $('#category_addinput').live('input',function(){
+ if($(this).val().length > 0) {
+ $('#category_addbutton').removeAttr('disabled');
+ }
+ });
+ $('#categoryform').submit(function() {
+ Categories.add($('#category_addinput').val());
+ $('#category_addinput').val('');
+ $('#category_addbutton').attr('disabled', 'disabled');
+ return false;
+ });
+ $('#category_addbutton').live('click',function(e){
+ e.preventDefault();
+ if($('#category_addinput').val().length > 0) {
+ Categories.add($('#category_addinput').val());
+ $('#category_addinput').val('');
+ }
+ });
+ }
+ });
+ }
+ });
+ },
+ delete:function(){
+ var categories = $('#categorylist').find('input[type="checkbox"]').serialize();
+ console.log('Categories.delete: ' + categories);
+ $.post(OC.filePath('contacts', 'ajax', 'categories/delete.php'),categories,function(jsondata){
+ if(jsondata.status == 'success'){
+ Categories._update(jsondata.data.categories);
+ } else {
+ alert(jsondata.data.message);
+ }
+ });
+ },
+ add:function(category){
+ console.log('Categories.add ' + category);
+ $.getJSON(OC.filePath('contacts', 'ajax', 'categories/add.php'),{'category':category},function(jsondata){
+ if(jsondata.status == 'success'){
+ Categories._update(jsondata.data.categories);
+ } else {
+ alert(jsondata.data.message);
+ }
+ });
+ return false;
+ },
+ rescan:function(){
+ console.log('Categories.rescan');
+ $.getJSON(OC.filePath('contacts', 'ajax', 'categories/rescan.php'),{},function(jsondata){
+ if(jsondata.status == 'success'){
+ Categories._update(jsondata.data.categories);
+ } else {
+ alert(jsondata.data.message);
+ }
+ });
+ },
+ _update:function(categories){
+ var categorylist = $('#categorylist');
+ categorylist.find('li').remove();
+ for(var category in categories) {
+ var item = '<li><input type="checkbox" name="categories" value="' + categories[category] + '" />' + categories[category] + '</li>';
+ $(item).appendTo(categorylist);
+ }
+ if(Categories.changed != undefined) {
+ Categories.changed(categories);
+ }
+ }
+}
Contacts={
UI:{
// NOTE: Do we ever get here?
$('#messagebox').dialog('moveToTop');
}else{
- $('#dialog_holder').load(OC.filePath('contacts', 'ajax', 'messagebox.php'), function(){
- $('#messagebox').dialog(
- {
- autoOpen: true,
- title: title,
- buttons: [{
- text: "Ok",
- click: function() { $(this).dialog("close"); }
- }],
- close: function(event, ui) {
- $(this).dialog('destroy').remove();
- },
- open: function(event, ui) {
- $('#messagebox_msg').html(msg);
- }
- });
+ $('#dialog_holder').load(OC.filePath('contacts', 'ajax', 'messagebox.php'), function(jsondata){
+ if(jsondata.status != 'error'){
+ $('#messagebox').dialog(
+ {
+ autoOpen: true,
+ title: title,
+ buttons: [{
+ text: "Ok",
+ click: function() { $(this).dialog("close"); }
+ }],
+ close: function(event, ui) {
+ $(this).dialog('destroy').remove();
+ },
+ open: function(event, ui) {
+ $('#messagebox_msg').html(msg);
+ }
+ });
+ } else {
+ alert(jsondata.data.message);
+ }
});
- }
+ };
},
loadListHandlers:function() {
//$('.add,.delete').hide();