Commit 89a4f78a authored by sylvieg's avatar sylvieg

[MOD]feature: create a feature groupofalert as it can be consumming ressource on large sites

parent 653ee099
......@@ -942,3 +942,4 @@ feature_id,feature_name,parent_id,status,setting_name,type,template,permission,o
1051,Username Pattern,1012,,username_pattern,byref,,tiki_p_admin,,,,,,
1052,ShareThis,913,,wikiplugin_sharethis,flag,,tiki_p_admin,,,,SHARETHIS plugin emits a social bookmarking popup window,,
1053,Comments Moderation,15,,feature_comments_moderation,feature,,tiki_p_admin,,,,,,
1054,Group Alert,15,,feature_groupalert,feature,,tiki_p_admin,,,,,,
......@@ -1134,6 +1134,9 @@ Style,FontName,FontSize,-,TextColor,BGColor,-,Source",
'transition_style_ver' => '2.0',
'magic_last_load' => 0,
//groupalert
'feature_groupalert' => 'y',
);
// spellcheck
......
......@@ -404,6 +404,10 @@
<span class="checkbox"><input type="checkbox" name="feature_userlevels" {if $prefs.feature_userlevels eq 'y'}checked="checked"{/if}/></span>
<span class="label"> {if $prefs.feature_help eq 'y'}<a href="{$prefs.helpurl}User+Levels" target="tikihelp" class="tikihelp" title="{tr}User Levels{/tr}">{/if} {tr}User Levels{/tr} {if $prefs.feature_help eq 'y'}</a>{/if}</span>
</div>
<div class="float_l" style="width: 49%; text-align: left; float: left">
<span class="checkbox"><input type="checkbox" name="feature_groupalert" {if $prefs.feature_groupalert eq 'y'}checked="checked"{/if}/></span>
<span class="label"> {if $prefs.feature_help eq 'y'}<a href="{$prefs.helpurl}Group+Alert" target="tikihelp" class="tikihelp" title="{tr}Group Alert{/tr}">{/if} {tr}Group Alert{/tr} {if $prefs.feature_help eq 'y'}</a>{/if}</span>
</div>
</div>
</fieldset>
......
......@@ -11,7 +11,9 @@ $section = 'calendar';
require_once ('tiki-setup.php');
include_once ('lib/calendar/calendarlib.php');
include_once ('lib/groupalert/groupalertlib.php');
if ($prefs['feature_groupalert'] == 'y') {
include_once ('lib/groupalert/groupalertlib.php');
}
if ($tiki_p_admin_calendar != 'y' and $tiki_p_admin != 'y') {
$smarty->assign('errortype', 401);
......@@ -62,7 +64,9 @@ if (isset($_REQUEST["save"])) {
}
}
$_REQUEST["calendarId"] = $calendarlib->set_calendar($_REQUEST["calendarId"],$user,$_REQUEST["name"],$_REQUEST["description"],$customflags,$options);
$groupalertlib->AddGroup ('calendar',$_REQUEST["calendarId"],$_REQUEST['groupforAlert'], !empty($_REQUEST['showeachuser'])?$_REQUEST['showeachuser']:'n');
if ($prefs['feature_groupalert'] == 'y') {
$groupalertlib->AddGroup ('calendar',$_REQUEST["calendarId"],$_REQUEST['groupforAlert'], !empty($_REQUEST['showeachuser'])?$_REQUEST['showeachuser']:'n');
}
if ($_REQUEST['personal'] == 'y') {
$userlib->assign_object_permission("Registered", $_REQUEST["calendarId"], "calendar", "tiki_p_view_calendar");
$userlib->assign_object_permission("Registered", $_REQUEST["calendarId"], "calendar", "tiki_p_view_events");
......@@ -132,17 +136,22 @@ if ($_REQUEST["calendarId"]) {
$cookietab = 1;
}
}
$info["groupforAlertList"] = array();
$info["groupforAlert"] = $groupalertlib->GetGroup('calendar',$_REQUEST["calendarId"]);
$all_groups = $userlib->list_all_groups();
if ( is_array($all_groups) ) {
foreach ( $all_groups as $g ){
$groupforAlertList[$g] = ( $g == $info["groupforAlert"] ) ? 'selected' : '';
if ($prefs['feature_groupalert'] == 'y') {
$info["groupforAlertList"] = array();
$info["groupforAlert"] = $groupalertlib->GetGroup('calendar',$_REQUEST["calendarId"]);
$all_groups = $userlib->list_all_groups();
if ( is_array($all_groups) ) {
foreach ( $all_groups as $g ){
$groupforAlertList[$g] = ( $g == $info['groupforAlert'] ) ? 'selected' : '';
}
}
$showeachuser = $groupalertlib-> GetShowEachUser('calendar',$_REQUEST['calendarId'],$info['groupforAlert']) ;
$smarty->assign('groupforAlert', $info['groupforAlert']);
$smarty->assign_by_ref('groupforAlertList', $groupforAlertList);
$smarty->assign_by_ref('showeachuser', $showeachuser);
}
$showeachuser=$groupalertlib-> GetShowEachUser('calendar',$_REQUEST['calendarId'],$info["groupforAlert"]) ;
setcookie('tab', $cookietab);
$smarty->assign_by_ref('cookietab', $cookietab);
......@@ -168,9 +177,6 @@ $smarty->assign('show_participants', $info["show_participants"]);
$smarty->assign('show_url', $info["show_url"]);
$smarty->assign('calendarId', $_REQUEST["calendarId"]);
$smarty->assign('personal', $info["personal"]);
$smarty->assign('groupforAlert', $info["groupforAlert"]);
$smarty->assign_by_ref('groupforAlertList', $groupforAlertList);
$smarty->assign_by_ref('showeachuser', $showeachuser);
$smarty->assign('startday', $info["startday"] < 0 ?0: round($info['startday']/(60*60)));
......
......@@ -99,6 +99,7 @@ if (isset($_REQUEST["features"])) {
"feature_magic",
"feature_minichat",
"feature_comments_moderation",
"feature_groupalert",
);
$pref_byref_values = array(
......
......@@ -8,17 +8,18 @@
$section = 'calendar';
require_once ('tiki-setup.php');
include_once ('lib/calendar/calendarlib.php');
include_once ('lib/newsletters/nllib.php');
include_once ('lib/groupalert/groupalertlib.php');
if ($prefs['feature_calendar'] != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_calendar");
$smarty->display("error.tpl");
die;
}
include_once ('lib/calendar/calendarlib.php');
include_once ('lib/newsletters/nllib.php');
if ($prefs['feature_groupalert'] == 'y') {
include_once ('lib/groupalert/groupalertlib.php');
}
if ($prefs['feature_ajax'] == "y") {
require_once ('lib/ajax/ajaxlib.php');
require_once ('lib/ajax/ajaxlib.php');
}
/*
if (isset($_REQUEST['calendarId']) and $userlib->object_has_one_permission($_REQUEST['calendarId'],'calendar')) {
......@@ -119,15 +120,6 @@ foreach ($rawcals["data"] as $cal_id=>$cal_data) {
}
$smarty->assign('listcals',$caladd);
$smarty->assign_by_ref('groupforalert',$groupforalert);
$smarty->assign_by_ref('showeachuser',$showeachuser);
if ( ! isset($_REQUEST["calendarId"]) ) {
if (isset($_REQUEST['calitemId'])) {
$calID = $calendarlib->get_calendarid($_REQUEST['calitemId']);
......@@ -138,11 +130,15 @@ if ( ! isset($_REQUEST["calendarId"]) ) {
$calID=$_REQUEST["calendarId"];
}
$groupforalert=$groupalertlib->GetGroup ('calendar',$calID);
if ( $groupforalert != "" ) {
$showeachuser=$groupalertlib->GetShowEachUser('calendar',$calID, $groupforalert) ;
$listusertoalert=$userlib->get_users(0,-1,'login_asc','','',false,$groupforalert,'') ;
$smarty->assign_by_ref('listusertoalert',$listusertoalert['data']);
if ($prefs['feature_groupalert'] == 'y') {
$groupforalert=$groupalertlib->GetGroup ('calendar',$calID);
if ( $groupforalert != '' ) {
$showeachuser=$groupalertlib->GetShowEachUser('calendar',$calID, $groupforalert) ;
$listusertoalert=$userlib->get_users(0,-1,'login_asc','','',false,$groupforalert,'') ;
$smarty->assign_by_ref('listusertoalert',$listusertoalert['data']);
}
$smarty->assign_by_ref('groupforalert',$groupforalert);
$smarty->assign_by_ref('showeachuser',$showeachuser);
}
if (!isset($_REQUEST['calendarId']) and count($caladd)) {
......@@ -215,7 +211,9 @@ if (isset($_POST['act'])) {
if (empty($save['name'])) $save['name'] = tra("event without name");
$calitemId=$calendarlib->set_item($user,$save['calitemId'],$save);
$groupalertlib->Notify($_REQUEST['listtoalert'],"tiki-calendar_edit_item.php?viewcalitemId=".$calitemId);
if ($prefs['feature_groupalert'] == 'y') {
$groupalertlib->Notify($_REQUEST['listtoalert'],"tiki-calendar_edit_item.php?viewcalitemId=".$calitemId);
}
header('Location: tiki-calendar.php');
die;
}
......
......@@ -9,19 +9,20 @@
// Initialization
$section = 'file_galleries';
require_once('tiki-setup.php');
include_once ('lib/groupalert/groupalertlib.php');
if ( $prefs['feature_file_galleries'] != 'y' ) {
$smarty->assign('msg', tra('This feature is disabled').': feature_file_galleries');
$smarty->display('error.tpl');
die;
}
include_once ('lib/filegals/filegallib.php');
include_once ('lib/stats/statslib.php');
if ( $prefs['feature_categories'] == 'y' ) {
global $categlib; include_once('lib/categories/categlib.php');
}
if ($prefs['feature_groupalert'] == 'y') {
include_once ('lib/groupalert/groupalertlib.php');
}
$auto_query_args = array('galleryId','fileId','offset','find','sort_mode','edit_mode','page','filegals_manager','maxRecords','show_fgalexplorer','dup_mode','show_details','view');
......@@ -91,8 +92,6 @@ $smarty->assign('edited', 'n');
$smarty->assign('edit_mode', 'n');
$smarty->assign('dup_mode', 'n');
$smarty->assign('parentId', isset($_REQUEST['parentId']) ? (int)$_REQUEST['parentId'] : -1);
$smarty->assign('groupforAlert', isset($_REQUEST['groupforAlert']) ? $_REQUEST['groupforAlert'] : '');
$smarty->assign_by_ref('showeachuser', $showeachuser);
$smarty->assign('creator', $user);
$smarty->assign('sortorder', 'created');
$smarty->assign('sortdirection', 'desc');
......@@ -100,7 +99,6 @@ $smarty->assign('sortdirection', 'desc');
$smarty->assign_by_ref('gal_info', $gal_info);
$smarty->assign_by_ref('name', $gal_info['name']);
$smarty->assign_by_ref('galleryId', $_REQUEST['galleryId']);
$smarty->assign_by_ref('groupforAlertList', $groupforAlertList);
$smarty->assign('reindex_file_id', -1);
......@@ -248,17 +246,21 @@ if ( isset($_REQUEST['edit_mode']) and $_REQUEST['edit_mode'] ) {
$smarty->assign_by_ref('users', $users['data']);
}
$all_groups = $userlib->list_all_groups();
$groupselected=$groupalertlib->GetGroup('file gallery',$_REQUEST['galleryId']);
if ( is_array($all_groups) ) {
foreach ( $all_groups as $g ){
$groupforAlertList[$g] = ( $g == $groupselected ) ? 'selected' : '';
if ($prefs['feature_groupalert'] == 'y') {
$smarty->assign('groupforAlert', isset($_REQUEST['groupforAlert']) ? $_REQUEST['groupforAlert'] : '');
$all_groups = $userlib->list_all_groups();
$groupselected=$groupalertlib->GetGroup('file gallery',$_REQUEST['galleryId']);
if ( is_array($all_groups) ) {
foreach ( $all_groups as $g ){
$groupforAlertList[$g] = ( $g == $groupselected ) ? 'selected' : '';
}
}
}
$showeachuser=$groupalertlib-> GetShowEachUser('file gallery',$_REQUEST['galleryId'],$groupselected) ;
$smarty->assign_by_ref('groupforAlert',$groupselected );
$showeachuser=$groupalertlib->GetShowEachUser('file gallery',$_REQUEST['galleryId'],$groupselected) ;
$smarty->assign_by_ref('showeachuser', $showeachuser);
$smarty->assign_by_ref('groupforAlertList', $groupforAlertList);
}
// Edit a file
if ( isset($_REQUEST['fileId']) && $_REQUEST['fileId'] > 0 ) {
......@@ -274,7 +276,6 @@ if ( isset($_REQUEST['edit_mode']) and $_REQUEST['edit_mode'] ) {
elseif ( $galleryId > 0 ) {
$smarty->assign_by_ref('maxRows', $gal_info['maxRows']);
$smarty->assign_by_ref('parentId', $gal_info['parentId']);
$smarty->assign_by_ref('groupforAlert',$groupselected );
$smarty->assign_by_ref('creator', $gal_info['user']);
$smarty->assign('max_desc', $gal_info['max_desc']);
......@@ -425,7 +426,9 @@ if ( isset($_REQUEST['edit']) ) {
unset($fgal_diff['hits']);
$smarty->assign('fgal_diff',$fgal_diff);
$fgid = $filegallib->replace_file_gallery($gal_info);
$groupalertlib->AddGroup ('file gallery', $galleryId ,$_REQUEST['groupforAlert'],$_REQUEST['showeachuser']);
if ($prefs['feature_groupalert'] == 'y') {
$groupalertlib->AddGroup ('file gallery', $galleryId ,$_REQUEST['groupforAlert'],$_REQUEST['showeachuser']);
}
if ( $prefs['feature_categories'] == 'y' ) {
$cat_type = 'file gallery';
$cat_objid = $fgid;
......
......@@ -12,9 +12,18 @@
$section = 'file_galleries';
require_once ('tiki-setup.php');
include_once ('lib/categories/categlib.php');
if ($prefs['feature_categories'] == 'y') {
include_once ('lib/categories/categlib.php');
}
if ($prefs['feature_file_galleries'] != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_file_galleries");
$smarty->display("error.tpl");
die;
}
include_once ('lib/filegals/filegallib.php');
include_once ('lib/groupalert/groupalertlib.php');
if ($prefs['feature_groupalert'] == 'y') {
include_once ('lib/groupalert/groupalertlib.php');
}
include('lib/filegals/max_upload_size.php');
@ini_set('max_execution_time', 0); //will not work in safe_mode is on
......@@ -41,13 +50,6 @@ function print_msg($msg,$id) {
}
}
if ($prefs['feature_file_galleries'] != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_file_galleries");
$smarty->display("error.tpl");
die;
}
if (!empty($_REQUEST['fileId'])) {
if (!($fileInfo = $filegallib->get_file_info($_REQUEST['fileId']))) {
......@@ -126,21 +128,17 @@ $_REQUEST['hit_limit'] = 0;
$smarty->assign('show', 'n');
$smarty->assign_by_ref('groupforalert',$groupforalert);
$smarty->assign_by_ref('showeachuser',$showeachuser);
if (!empty($_REQUEST['galleryId'])) {
$groupforalert=$groupalertlib->GetGroup ('file gallery',(int)$_REQUEST["galleryId"]);
if (!empty($_REQUEST['galleryId']) && $prefs['feature_groupalert'] == 'y') {
$groupforalert=$groupalertlib->GetGroup ('file gallery',(int)$_REQUEST["galleryId"]);
if ( $groupforalert != '' ) {
$showeachuser=$groupalertlib->GetShowEachUser('file gallery',(int)$_REQUEST["galleryId"], $groupforalert) ;
$listusertoalert=$userlib->get_users(0,-1,'login_asc','','' ,false,$groupforalert,'') ;
$smarty->assign_by_ref('listusertoalert',$listusertoalert['data']);
}
$smarty->assign_by_ref('groupforalert',$groupforalert);
$smarty->assign_by_ref('showeachuser',$showeachuser);
}
if ( $groupforalert != "" ) {
$showeachuser=$groupalertlib->GetShowEachUser('file gallery',(int)$_REQUEST["galleryId"], $groupforalert) ;
$listusertoalert=$userlib->get_users(0,-1,'login_asc','','' ,false,$groupforalert,'') ;
$smarty->assign_by_ref('listusertoalert',$listusertoalert['data']);
}
if (isset($_REQUEST['fileId']))
$editFileId = $_REQUEST['fileId'];
$editFile = false;
......@@ -350,7 +348,9 @@ if (isset($_REQUEST["upload"])) {
$cat_name = empty($_REQUEST['name'][$key])? $name: $_REQUEST['name'][$key];
$cat_href = $aux['dllink'];
$groupalertlib->Notify($_REQUEST['listtoalert'],"tiki-download_file.php?fileId=".$fileId);
if ($prefs['feature_groupalert'] == 'y') {
$groupalertlib->Notify($_REQUEST['listtoalert'],"tiki-download_file.php?fileId=".$fileId);
}
include_once ('categorize.php');
// Print progress
......
......@@ -10,26 +10,21 @@
$section = 'trackers';
require_once('tiki-setup.php');
include_once('lib/trackers/trackerlib.php');
include_once ('lib/groupalert/groupalertlib.php');
global $notificationlib; include_once('lib/notifications/notificationlib.php');
$auto_query_args = array('offset','trackerId','reloff','itemId','maxRecords','status','sort_mode','initial','filterfield','filtervalue');
if ($prefs['feature_categories'] == 'y') {
global $categlib;
if (!is_object($categlib)) {
include_once('lib/categories/categlib.php');
}
}
if ($prefs['feature_trackers'] != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_trackers");
$smarty->display("error.tpl");
die;
}
include_once('lib/trackers/trackerlib.php');
if ($prefs['feature_groupalert'] == 'y') {
include_once ('lib/groupalert/groupalertlib.php');
}
include_once('lib/notifications/notificationlib.php');
if ($prefs['feature_categories'] == 'y') {
include_once('lib/categories/categlib.php');
}
$auto_query_args = array('offset','trackerId','reloff','itemId','maxRecords','status','sort_mode','initial','filterfield','filtervalue');
if (!empty($_REQUEST['itemId']))
$ratedItemId = $_REQUEST['itemId'];
......@@ -122,18 +117,16 @@ if ($tiki_p_view_trackers != 'y') {
$smarty->assign('my', $my);
$smarty->assign('ours', $ours);
$smarty->assign_by_ref('groupforalert',$groupforalert);
$smarty->assign_by_ref('showeachuser',$showeachuser);
$groupforalert=$groupalertlib->GetGroup ('tracker',$_REQUEST["trackerId"]);
if ( $groupforalert != "" ) {
$showeachuser=$groupalertlib->GetShowEachUser('tracker',$_REQUEST["trackerId"], $groupforalert) ;
$listusertoalert=$userlib->get_users(0,-1,'login_asc','','',false,$groupforalert,'') ;
$smarty->assign_by_ref('listusertoalert',$listusertoalert['data']);
}
if ($prefs['feature_groupalert'] == 'y') {
$groupforalert=$groupalertlib->GetGroup ('tracker', $_REQUEST['trackerId']);
if ( $groupforalert != '' ) {
$showeachuser=$groupalertlib->GetShowEachUser('tracker',$_REQUEST["trackerId"], $groupforalert) ;
$listusertoalert=$userlib->get_users(0,-1,'login_asc','','',false,$groupforalert,'') ;
$smarty->assign_by_ref('listusertoalert',$listusertoalert['data']);
}
$smarty->assign_by_ref('groupforalert',$groupforalert);
$smarty->assign_by_ref('showeachuser',$showeachuser);
}
$field_types = $trklib->field_types();
$smarty->assign('field_types', $field_types);
......@@ -629,7 +622,7 @@ if (isset($_REQUEST['import'])) {
$_REQUEST['itemId'] = $trklib->get_user_item($_REQUEST['trackerId'], $tracker_info);
}
$itemid = $trklib->replace_item($_REQUEST["trackerId"], $_REQUEST["itemId"], $ins_fields, $_REQUEST['status'], $ins_categs);
if (isset($_REQUEST['listtoalert'])) {
if (isset($_REQUEST['listtoalert']) && $prefs['feature_groupalert'] == 'y') {
$groupalertlib->Notify($_REQUEST['listtoalert'],"tiki-view_tracker_item.php?itemId=$itemid");
}
$cookietab = "1";
......
......@@ -9,19 +9,21 @@
// Initialization
$section = 'trackers';
require_once ('tiki-setup.php');
include_once('lib/categories/categlib.php');
include_once ("lib/filegals/filegallib.php");
include_once ('lib/trackers/trackerlib.php');
include_once ('lib/notifications/notificationlib.php');
include_once ('lib/groupalert/groupalertlib.php');
if ($prefs['feature_trackers'] != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_trackers");
$smarty->display("error.tpl");
die;
}
include_once ('lib/trackers/trackerlib.php');
if ($prefs['feature_categories'] == 'y') {
include_once('lib/categories/categlib.php');
}
include_once ("lib/filegals/filegallib.php");
include_once ('lib/notifications/notificationlib.php');
if ($prefs['feature_groupalert'] == 'y') {
include_once ('lib/groupalert/groupalertlib.php');
}
$auto_query_args = array('offset','trackerId','reloff','itemId','maxRecords','status','sort_mode','initial','filterfield','filtervalue','exactvalue');
$special = false;
......@@ -134,19 +136,17 @@ if (!isset($utid) and !isset($gtid) and (!isset($_REQUEST["itemId"]) or !$_REQUE
die;
}
$smarty->assign_by_ref('groupforalert',$groupforalert);
$smarty->assign_by_ref('showeachuser',$showeachuser);
$groupforalert=$groupalertlib->GetGroup ('tracker',$_REQUEST["trackerId"]);
if ( $groupforalert != "" ) {
$showeachuser=$groupalertlib->GetShowEachUser('tracker',$_REQUEST["trackerId"], $groupforalert) ;
$listusertoalert=$userlib->get_users(0,-1,'login_asc','','',false,$groupforalert,'') ;
$smarty->assign_by_ref('listusertoalert',$listusertoalert['data']);
}
if ($prefs['feature_groupalert'] == 'y') {
$groupforalert=$groupalertlib->GetGroup ('tracker',$_REQUEST['trackerId']);
if ( $groupforalert != "" ) {
$showeachuser=$groupalertlib->GetShowEachUser('tracker',$_REQUEST['trackerId'], $groupforalert) ;
$listusertoalert=$userlib->get_users(0,-1,'login_asc','','',false,$groupforalert,'') ;
$smarty->assign_by_ref('listusertoalert',$listusertoalert['data']);
}
$smarty->assign_by_ref('groupforalert',$groupforalert);
$smarty->assign_by_ref('showeachuser',$showeachuser);
}
if (!isset($_REQUEST["sort_mode"])) {
$sort_mode = 'created_desc';
......@@ -735,7 +735,9 @@ if ($tiki_p_modify_tracker_items == 'y' || $special) {
if (count($field_errors['err_mandatory']) == 0 && count($field_errors['err_value']) == 0 ) {
$smarty->assign('input_err', '0'); // no warning to display
$groupalertlib->Notify($_REQUEST['listtoalert'],"tiki-view_tracker_item.php?itemId=".$_REQUEST["itemId"]);
if ($prefs['feature_groupalert'] == 'y') {
$groupalertlib->Notify($_REQUEST['listtoalert'],"tiki-view_tracker_item.php?itemId=".$_REQUEST["itemId"]);
}
check_ticket('view-trackers-items');
if (!isset($_REQUEST["edstatus"]) or ($tracker_info["showStatus"] != 'y' and $tiki_p_admin_trackers != 'y')) {
$_REQUEST["edstatus"] = $tracker_info["modItemStatus"];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment