egroupware_official/admin/js/global_categories.js

76 lines
2.1 KiB
JavaScript
Raw Normal View History

/**
* Javascript for Admin / Global categories
*/
// Record original value
var cat_original_owner;
var permission_prompt;
/**
* Check to see if admin has taken away access to a category
*/
function check_owner(element_id) {
* jQuery: changed $ to $j to work around mootools use in Joomla templates and other js code in imported projects required to change $ --> $j: phpgwapi/* jdots/* etemplate/* stylite/* felamimail/* admin/* news_admin/* projectmanager/* importexport/* infolog/* ranking/* required, but not automatic: importexport/setup/etemplates.inc.php phpgwapi/js/jquery/* negative, not to touch or revert later: phpgwapi/inc/savant2/Savant2/Savant2_Compiler_basic.php: '(\$(.+))' => 'print $1', phpgwapi/js/dhtmlxtree/libCompiler/core.js sitemgr/* phpfreechat/* gallery/* activesync/include/smb.php: '^\tIPC\\\$(.*)[ ]+IPC' => 'skip', etemplate/inc/class.bo_merge.inc.php: if ($this->table_plugins && preg_match_all('/\\$\\$table\\/([A-Za-z0-9_]+)\\$\\$(.*?)\\$\\$endtable\\$\\$/s',$content,$matches,PREG_SET_ORDER)) find phpgwapi jdots etemplate stylite felamimail admin news_admin projectmanager importexport infolog ranking \ \( -name '*.php' -o -name '*.js' \) -exec grep -q '\$(' {} \; -print \ -exec sed -i '' 's|\$(|$j(|g' {} \; svn revert phpgwapi/inc/savant2/Savant2/Savant2_Compiler_basic.php phpgwapi/js/dhtmlxtree/libCompiler/core.js \ importexport/setup/etemplates.inc.php phpgwapi/js/jquery/jquery.js etemplate/inc/class.bo_merge.inc.php additional changes: phpgwapi/js/jquery/jquery.js: window.$ --> window.$j phpgwapi/js/egw_json.js:291 this.request = $j.ajax({url: this.url, jdots/templates/jdots/head.tpl:59 $j(document).ready(function() { phpgwapi/js/egw_action/egw_grid_view.js: $.browser --> $j.browser importexport/setup/etemplates.inc.php: etemplate editor importexport.wizard_basic_export_csv.choose_fields onclick of check icon changed phpgwapi/js/egw_action/tests/*.html phpgwapi/js/egw_action/tests/js/jquery.js: window.$ --> window.$j
2011-07-03 11:00:36 +02:00
var checkboxes = $j(':checkbox', document.getElementById(element_id));
var all_users = $j(document.getElementById(element_id + '[0]'));
// If they checked all users, uncheck the others
if(all_users.length > 0 && all_users.attr("checked")) {
checkboxes.attr("checked",false);
all_users.attr("checked", true);
* jQuery: changed $ to $j to work around mootools use in Joomla templates and other js code in imported projects required to change $ --> $j: phpgwapi/* jdots/* etemplate/* stylite/* felamimail/* admin/* news_admin/* projectmanager/* importexport/* infolog/* ranking/* required, but not automatic: importexport/setup/etemplates.inc.php phpgwapi/js/jquery/* negative, not to touch or revert later: phpgwapi/inc/savant2/Savant2/Savant2_Compiler_basic.php: '(\$(.+))' => 'print $1', phpgwapi/js/dhtmlxtree/libCompiler/core.js sitemgr/* phpfreechat/* gallery/* activesync/include/smb.php: '^\tIPC\\\$(.*)[ ]+IPC' => 'skip', etemplate/inc/class.bo_merge.inc.php: if ($this->table_plugins && preg_match_all('/\\$\\$table\\/([A-Za-z0-9_]+)\\$\\$(.*?)\\$\\$endtable\\$\\$/s',$content,$matches,PREG_SET_ORDER)) find phpgwapi jdots etemplate stylite felamimail admin news_admin projectmanager importexport infolog ranking \ \( -name '*.php' -o -name '*.js' \) -exec grep -q '\$(' {} \; -print \ -exec sed -i '' 's|\$(|$j(|g' {} \; svn revert phpgwapi/inc/savant2/Savant2/Savant2_Compiler_basic.php phpgwapi/js/dhtmlxtree/libCompiler/core.js \ importexport/setup/etemplates.inc.php phpgwapi/js/jquery/jquery.js etemplate/inc/class.bo_merge.inc.php additional changes: phpgwapi/js/jquery/jquery.js: window.$ --> window.$j phpgwapi/js/egw_json.js:291 this.request = $j.ajax({url: this.url, jdots/templates/jdots/head.tpl:59 $j(document).ready(function() { phpgwapi/js/egw_action/egw_grid_view.js: $.browser --> $j.browser importexport/setup/etemplates.inc.php: etemplate editor importexport.wizard_basic_export_csv.choose_fields onclick of check icon changed phpgwapi/js/egw_action/tests/*.html phpgwapi/js/egw_action/tests/js/jquery.js: window.$ --> window.$j
2011-07-03 11:00:36 +02:00
checkboxes = $j(':checkbox', document.getElementById(element_id)).filter(':checked');
return true;
}
// Find out what changed
var seen = [], diff = [], labels = [];
for ( var i = 0; i < cat_original_owner.length; i++) {
var checkbox = checkboxes.filter('[value="'+cat_original_owner[i]+'"]');
if(checkbox.filter(':checked').length == 0 && checkbox.get(0) != undefined) {
diff.push(cat_original_owner[i]);
* jQuery: changed $ to $j to work around mootools use in Joomla templates and other js code in imported projects required to change $ --> $j: phpgwapi/* jdots/* etemplate/* stylite/* felamimail/* admin/* news_admin/* projectmanager/* importexport/* infolog/* ranking/* required, but not automatic: importexport/setup/etemplates.inc.php phpgwapi/js/jquery/* negative, not to touch or revert later: phpgwapi/inc/savant2/Savant2/Savant2_Compiler_basic.php: '(\$(.+))' => 'print $1', phpgwapi/js/dhtmlxtree/libCompiler/core.js sitemgr/* phpfreechat/* gallery/* activesync/include/smb.php: '^\tIPC\\\$(.*)[ ]+IPC' => 'skip', etemplate/inc/class.bo_merge.inc.php: if ($this->table_plugins && preg_match_all('/\\$\\$table\\/([A-Za-z0-9_]+)\\$\\$(.*?)\\$\\$endtable\\$\\$/s',$content,$matches,PREG_SET_ORDER)) find phpgwapi jdots etemplate stylite felamimail admin news_admin projectmanager importexport infolog ranking \ \( -name '*.php' -o -name '*.js' \) -exec grep -q '\$(' {} \; -print \ -exec sed -i '' 's|\$(|$j(|g' {} \; svn revert phpgwapi/inc/savant2/Savant2/Savant2_Compiler_basic.php phpgwapi/js/dhtmlxtree/libCompiler/core.js \ importexport/setup/etemplates.inc.php phpgwapi/js/jquery/jquery.js etemplate/inc/class.bo_merge.inc.php additional changes: phpgwapi/js/jquery/jquery.js: window.$ --> window.$j phpgwapi/js/egw_json.js:291 this.request = $j.ajax({url: this.url, jdots/templates/jdots/head.tpl:59 $j(document).ready(function() { phpgwapi/js/egw_action/egw_grid_view.js: $.browser --> $j.browser importexport/setup/etemplates.inc.php: etemplate editor importexport.wizard_basic_export_csv.choose_fields onclick of check icon changed phpgwapi/js/egw_action/tests/*.html phpgwapi/js/egw_action/tests/js/jquery.js: window.$ --> window.$j
2011-07-03 11:00:36 +02:00
labels.push($j(checkbox.get(0).nextSibling).text());
}
}
// Single selection?
if(checkboxes.length == 0) {
2012-04-25 01:13:57 +02:00
var new_group = $j('input#'+element_id);
if(new_group.length > 0 && new_group.attr('value') != 0 && cat_original_owner.length > 0) {
diff.push(cat_original_owner[0]);
var selector = 'option[value="'+cat_original_owner[0]+'"]';
* jQuery: changed $ to $j to work around mootools use in Joomla templates and other js code in imported projects required to change $ --> $j: phpgwapi/* jdots/* etemplate/* stylite/* felamimail/* admin/* news_admin/* projectmanager/* importexport/* infolog/* ranking/* required, but not automatic: importexport/setup/etemplates.inc.php phpgwapi/js/jquery/* negative, not to touch or revert later: phpgwapi/inc/savant2/Savant2/Savant2_Compiler_basic.php: '(\$(.+))' => 'print $1', phpgwapi/js/dhtmlxtree/libCompiler/core.js sitemgr/* phpfreechat/* gallery/* activesync/include/smb.php: '^\tIPC\\\$(.*)[ ]+IPC' => 'skip', etemplate/inc/class.bo_merge.inc.php: if ($this->table_plugins && preg_match_all('/\\$\\$table\\/([A-Za-z0-9_]+)\\$\\$(.*?)\\$\\$endtable\\$\\$/s',$content,$matches,PREG_SET_ORDER)) find phpgwapi jdots etemplate stylite felamimail admin news_admin projectmanager importexport infolog ranking \ \( -name '*.php' -o -name '*.js' \) -exec grep -q '\$(' {} \; -print \ -exec sed -i '' 's|\$(|$j(|g' {} \; svn revert phpgwapi/inc/savant2/Savant2/Savant2_Compiler_basic.php phpgwapi/js/dhtmlxtree/libCompiler/core.js \ importexport/setup/etemplates.inc.php phpgwapi/js/jquery/jquery.js etemplate/inc/class.bo_merge.inc.php additional changes: phpgwapi/js/jquery/jquery.js: window.$ --> window.$j phpgwapi/js/egw_json.js:291 this.request = $j.ajax({url: this.url, jdots/templates/jdots/head.tpl:59 $j(document).ready(function() { phpgwapi/js/egw_action/egw_grid_view.js: $.browser --> $j.browser importexport/setup/etemplates.inc.php: etemplate editor importexport.wizard_basic_export_csv.choose_fields onclick of check icon changed phpgwapi/js/egw_action/tests/*.html phpgwapi/js/egw_action/tests/js/jquery.js: window.$ --> window.$j
2011-07-03 11:00:36 +02:00
labels.push("\n"+$j(selector, new_group).text());
}
}
// Somebody will lose permission, give warning.
if(diff.length > 0) {
var msg = permission_prompt;
for( var i = 0; i < labels.length; i++) {
msg += labels[i];
}
return confirm(msg);
}
return true;
}
/**
* Show icon based on icon-selectbox, hide placeholder (broken image), if no icon selected
*/
function change_icon(_icon)
{
var img = document.getElementById('exec[icon_url]') || document.getElementById('icon_url');
if (typeof _icon == 'undefined')
{
_icon = document.getElementById('exec[data][icon]') || document.getElementById('data[icon]');
}
if (_icon && _icon.value)
{
img.src = img.src.replace(/\/[^\/]*$/,'\/'+_icon.value);
img.style.display = 'block';
}
2012-04-25 01:13:57 +02:00
else if (img)
{
img.style.display = 'none';
}
}