RoundCube Webmail Forum  

Go Back   RoundCube Webmail Forum > Release Support > Release Discussion

For more information about the ads and why they're here, please see the FAQ
Reply
  #1  
Old 12-19-2006, 07:45 PM
Registered User
 
Join Date: Dec 2006
Posts: 23
Downloads: 0
Uploads: 0
Default Global Addressbook with hosted webspace....how?

Hello,

we use with our club roundcube. I have installed it on a normal hosted webspace. Now we want to have a global addressbook. How is it possible to use that, because i have no Ldap server.

Is there any way to have an addressbook without a ldapserver where the admin or user can create new contacts and every user can see this contacts.
Thanks a lot for your help!

greetings to the world

Markus
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 12-20-2006, 04:34 AM
Registered User
 
Join Date: Dec 2006
Posts: 17
Downloads: 0
Uploads: 0
Default Re: Global Addressbook with hosted webspace....how?

May be...correct me if wrong...XD
Do a small hack in the file list.inc in program/steps/addressbook/

I've not did this test so...on your own risk...backup anything before your work

modify your rc db table:
ALTER TABLE `roundcubemail`.`contacts` ADD COLUMN `shared` TINYINT(1) SIGNED NOT NULL DEFAULT 0;

Modify list.inc
1
Quote:
// count contacts for this user
$sql_result = $DB->query("SELECT COUNT(contact_id) AS rows
FROM ".get_table_name('contacts')."
WHERE del<>1
AND user_id=?",
$_SESSION['user_id']);
to
Quote:
// count contacts for this user
$sql_result = $DB->query("SELECT COUNT(contact_id) AS rows
FROM ".get_table_name('contacts')."
WHERE del<>1
AND user_id=?
OR shared = 1",
$_SESSION['user_id']);
2
Quote:
// get contacts from DB
$sql_result = $DB->limitquery("SELECT * FROM ".get_table_name('contacts')."
WHERE del<>1
AND user_id=?
ORDER BY name",
$start_row,
$CONFIG['pagesize'],
$_SESSION['user_id']);
to
Quote:
// get contacts from DB
$sql_result = $DB->limitquery("SELECT * FROM ".get_table_name('contacts')."
WHERE del<>1
AND user_id=?
OR shared = 1
ORDER BY name",
$start_row,
$CONFIG['pagesize'],
$_SESSION['user_id']);
This will show the contact which marked shared=1 in the table.
If you trust your user, this may allow all the user to modify/delete the shared contact.

The step you need to do sharing of contacts is a little bit...um....um.....
directly edit the table and change the column "shared" of that row to "1"

Remember, I don't know it works or not...XD
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 12-20-2006, 06:24 AM
Registered User
 
Join Date: Dec 2006
Posts: 23
Downloads: 0
Uploads: 0
Default Re: Global Addressbook with hosted webspace....how?

OK thanks.
Have i any possibility that only i as admin can create, delete and edit the global contacts?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 12-20-2006, 09:19 AM
Registered User
 
Join Date: Dec 2006
Posts: 17
Downloads: 0
Uploads: 0
Default Re: Global Addressbook with hosted webspace....how?

I'm not sure the list.inc is for addressbook page or the dynamic menu of receiptxxx....(Oh...my poor english...) in the composer.

If you tried that script can show the shared contact at the composer but not in the addressbook page, then for your administration:

Create a new user, add/manage the share contact...
Run a sql script every time you updated the contact
UPDATE `contacts` set shared = 1 where user_id = <your user_id in `user` table>

if you can't show the shared contact at the composer then....(Turn my head around and shout: Any one know the dynamic menu's function was load from which files ?)

but if you can see the shared contact in addressbook and not in the composer, may be i've got something wrong in above code. try to replace the original list.inc file and change the show.inc file

Quote:
$DB->query("SELECT * FROM ".get_table_name('contacts')."
WHERE contact_id=?
AND user_id=?
AND del<>1",
$cid,
$_SESSION['user_id']);
to
Quote:
$DB->query("SELECT * FROM ".get_table_name('contacts')."
WHERE (contact_id=?
AND user_id=?
AND del<>1")
OR shared=1,
$cid,
$_SESSION['user_id']);
right, it seem i've missing the () in the above post...XD
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 12-31-2006, 10:01 AM
Registered User
 
Join Date: Oct 2006
Posts: 84
Downloads: 0
Uploads: 0
Default Re: Global Addressbook with hosted webspace....how?


The direction looks good.... I was just thinking that maybe you can also create a linked table and update the get_table_name to UNION (or MySQL equivalent) with the shared table. I dont know how one would then disable the editing.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 01-11-2007, 04:50 AM
Registered User
 
Join Date: Jan 2007
Posts: 9
Downloads: 0
Uploads: 0
Default Re: Global Addressbook with hosted webspace....how?

It took me a few hours, but I combined your parts of your idea with the parts from this post - http://roundcubeforum.net/forum/index.php?topic=584.0

This makes every contact added shared amongst all users. It's what I needed anyway.

Basically I added the column as you suggested, but then used it in a different way.

Instead of adding the OR shared=1 on a separate line I changed all entries of user_id=? in the following files to ( user_id=? OR shared=0 ) - including the parenthesis.

/program/steps/mail/compose.inc
/program/steps/addressbook/delete.inc
/program/steps/addressbook/edit.inc
/program/steps/addressbook/func.inc
/program/steps/addressbook/list.inc
/program/steps/addressbook/show.inc

Now every contact added will default the shared field to 0 since there's no option put in your own value, and all users will see every entry. You can still manually change the shared field to 1 for the ones that you don't want to share. Hopefully an input when adding or editing contacts for shared can be developed sometime soon, and an admin panel.

Cheers
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7  
Old 05-21-2007, 04:24 PM
kmn kmn is offline
Registered User
 
Join Date: May 2007
Posts: 41
Downloads: 0
Uploads: 0
Default Re: Global Addressbook with hosted webspace....how?

Hello,

This folder and file structure seems to have changed in ver.1rc1. Could somebody please point to the correct locations?

Thanks

kmn
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8  
Old 10-13-2007, 11:19 AM
Registered User
 
Join Date: Oct 2007
Posts: 1
Downloads: 0
Uploads: 0
Default Re: Global Addressbook with hosted webspace....how?

This is my quick and dirty method (It only a very quick solution and take 1 hours to modify so please im sorry if this code very dirty)

1. ALTER TABLE `roundcubemail`.`contacts` ADD COLUMN `shared` char(2) NOT NULL DEFAULT 'on';

2. Modify program/include/rcube_contacts.inc become like this
Code:
On function list_records
.....
     WHERE del<>1
     AND  ( user_id=? OR shared='on' )".
    ($this->filter ? " AND (".$this->filter.")" : "") .
    " ORDER BY name",
....
Code:
On function count()
...
 WHERE del<>1
    AND  ( user_id=? OR shared='on' )".
    ($this->filter ? " AND (".$this->filter.")" : ""),
...
Code:
On function get_record()
...
   WHERE contact_id=?
    AND  ( user_id=? OR shared='on' )
    AND  del<>1",
...
3. Modify program/steps/addressbook/edit.inc So there is additional Share Address Book Checkbox options
(around line 64)
Code:
 $a_show_cols = array('name', 'firstname', 'surname', 'email');
Become
Code:
 $a_show_cols = array('name', 'firstname', 'surname', 'email','shared');
(around line 69)
Code:
 $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n",
          $attrib['id'],
          Q(rcube_label($col)),
          $value);
Become
Code:
 if ($col == 'shared') { 
	 if ($record[$col] == 'on') $cek = "checked"; else $cek = " ";
	 $out .= "<tr><td class=\"title\"><label for=\"rcmfd_shared\">Share Address</label></td><td><input type=checkbox name=\"_shared\" id=\"rcmfd_shared\" $cek></td></tr>";
  } else {
  $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n",
          $attrib['id'],
          Q(rcube_label($col)),
          $value);
  }

4. Modify function insert on program/include/rcube_contacts.inc
Code:
var $table_cols = array('name', 'email', 'firstname', 'surname');
Become ....
Code:
var $table_cols = array('name', 'email', 'firstname', 'surname','shared');
Code:
$this->db->query(
    "INSERT INTO ".$this->db_name."
     (user_id, changed, del, ".join(', ', $a_insert_cols).")
     VALUES (?, ".$this->db->now().", 0, ".join(', ', $a_insert_values).")",
    $this->user_id);
Become ........
Code:
if ($a_insert_values[4] == "'on'") {
$this->db->query(
    "INSERT INTO ".$this->db_name."
     (user_id, changed, del, ".join(', ', $a_insert_cols).")
     VALUES (?, ".$this->db->now().", 0, ".join(', ', $a_insert_values).")",
    $this->user_id);
} else {
$this->db->query(
    "INSERT INTO ".$this->db_name."
     (user_id, changed, shared, del, ".join(', ', $a_insert_cols).")
     VALUES (?, ".$this->db->now().", '1', 0, ".join(', ', $a_insert_values).")",
    $this->user_id);
}
Regards
RUdy Cayadi
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

For more information about the ads and why they're here, please see the FAQ

All times are GMT. The time now is 12:56 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright © 2006-2008 RoundCube Webmail Community