![]() |
|
|
|||||||
| For more information about the ads and why they're here, please see the FAQ |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
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:
Quote:
![]() Quote:
Quote:
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 |
|
#3
|
|||
|
|||
|
OK thanks.
Have i any possibility that only i as admin can create, delete and edit the global contacts? |
|
#4
|
|||
|
|||
|
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:
Quote:
|
|
#5
|
|||
|
|||
|
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. |
|
#6
|
|||
|
|||
|
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 |
|
#7
|
|||
|
|||
|
Hello,
This folder and file structure seems to have changed in ver.1rc1. Could somebody please point to the correct locations? Thanks kmn |
|
#8
|
|||
|
|||
|
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",
...
(around line 64) Code:
$a_show_cols = array('name', 'firstname', 'surname', 'email');
Code:
$a_show_cols = array('name', 'firstname', 'surname', 'email','shared');
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);
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');
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);
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);
}
RUdy Cayadi |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
| For more information about the ads and why they're here, please see the FAQ |