egroupware_official/admin/js/global_categories.js

70 lines
1.7 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(button) {
var select_owner = button.getRoot().getWidgetById('owner')
var owner = select_owner.get_value();
if(typeof owner != 'object')
{
owner = [owner];
}
2013-12-10 23:21:36 +01:00
// No owner probably means selectbox is read-only, so no need to check
if(owner == null) return true;
var all_users = owner.indexOf('0') >= 0;
// If they checked all users, uncheck the others
if(all_users) {
select_owner.set_value(['0']);
return true;
}
// Find out what changed
var seen = [], diff = [], labels = [];
var cat_original_owner = select_owner.getArrayMgr('content').getEntry('owner');
if(typeof cat_original_owner != "object")
{
cat_original_owner = [cat_original_owner];
}
for ( var i = 0; i < cat_original_owner.length; i++) {
if(owner.indexOf(cat_original_owner[i]) < 0)
{
var checkbox = $j('input[value="'+cat_original_owner[i]+'"]',select_owner.node);
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());
}
}
// Somebody will lose permission, give warning.
if(diff.length > 0) {
var msg = egw.lang('Removing access for groups may cause problems for data in this category. Are you sure? Users in these groups may no longer have access:');
for( var i = 0; i < labels.length; i++) {
msg += labels[i];
}
return et2_dialog.confirm(button,msg);
}
return true;
}
/**
* Show icon based on icon-selectbox, hide placeholder (broken image), if no icon selected
*/
function change_icon(widget)
{
var img = widget.getRoot().getWidgetById('icon_url');
if (img)
{
img.set_src(widget.getValue());
}
}