mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:20 +01:00
Add ability for admins to set home portlets as default, for groups, and forced for all.
This commit is contained in:
parent
aa526a3225
commit
c48065f4c3
@ -267,7 +267,7 @@ var et2_portlet = et2_valueWidget.extend(
|
||||
// Save settings - server might reply with new content if the portlet needs an update,
|
||||
// but ideally it doesn't
|
||||
this.div.addClass("loading");
|
||||
this.egw().jsonq("home.home_ui.ajax_set_properties",[this.id, this.options.settings || {}, value],
|
||||
this.egw().jsonq("home.home_ui.ajax_set_properties",[this.id, this.options.settings || {}, value,this.settings?this.settings.group:false],
|
||||
function(data) {
|
||||
// This section not for us
|
||||
if(!data || typeof data.attributes == 'undefined') return false;
|
||||
|
@ -125,7 +125,7 @@ class home_link_portlet extends home_portlet
|
||||
if(class_exists($classname))
|
||||
{
|
||||
$record = new $classname($this->context['entry']['id']);
|
||||
if($record)
|
||||
if($record && $record->get_record_array())
|
||||
{
|
||||
// If there's a custom template, send the full record
|
||||
if($custom_template)
|
||||
@ -232,4 +232,13 @@ class home_link_portlet extends home_portlet
|
||||
|
||||
return $actions;
|
||||
}
|
||||
/**
|
||||
* This portlet accepts files and links
|
||||
*
|
||||
* @return boolean|String[]
|
||||
*/
|
||||
public function accept_drop()
|
||||
{
|
||||
return array('file','link');
|
||||
}
|
||||
}
|
||||
|
@ -191,4 +191,13 @@ class home_list_portlet extends home_portlet
|
||||
{
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* This portlet accepts files and links
|
||||
*
|
||||
* @return boolean|String[]
|
||||
*/
|
||||
public function accept_drop()
|
||||
{
|
||||
return array('file','link');
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ class home_note_portlet extends home_portlet
|
||||
|
||||
$need_reload = true;
|
||||
}
|
||||
|
||||
$this->context = $context;
|
||||
}
|
||||
|
||||
@ -51,15 +52,23 @@ class home_note_portlet extends home_portlet
|
||||
$id = $_GET['id'] ? $_GET['id'] : $content['id'];
|
||||
$height = $_GET['height'] ? $_GET['height'] : $content['height'];
|
||||
|
||||
$prefs = $GLOBALS['egw']->preferences->read_repository();
|
||||
$portlets = (array)$prefs['home']['portlets'];
|
||||
|
||||
if($content['group'] && $GLOBALS['egw_info']['apps']['admin'])
|
||||
{
|
||||
$prefs = new preferences(is_numeric($group) ? $group : $GLOBALS['egw_info']['user']['account_id']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$prefs = $GLOBALS['egw']->preferences;
|
||||
}
|
||||
$type = is_numeric($group) ? "user" : $group;
|
||||
$portlets = $prefs->read_repository();
|
||||
$portlets = $portlets['home'];
|
||||
if($content['button'])
|
||||
{
|
||||
$portlets[$id]['note'] = $content['note'];
|
||||
// Save updated preferences
|
||||
$GLOBALS['egw']->preferences->add('home', 'portlets', $portlets);
|
||||
$GLOBALS['egw']->preferences->save_repository(True);
|
||||
$portlets[$id]['note'] = $content['note'];
|
||||
$prefs->add('home', $id, $portlets[$id],$type);
|
||||
$prefs->save_repository(True,$type);
|
||||
// Yay for AJAX submit
|
||||
egw_json_response::get()->apply('window.opener.app.home.refresh',array($id));
|
||||
|
||||
@ -76,8 +85,9 @@ class home_note_portlet extends home_portlet
|
||||
$etemplate->setElementAttribute('note', 'width', '99%');
|
||||
$etemplate->setElementAttribute('note', 'height', $height);
|
||||
$preserve = array(
|
||||
'id' => $id,
|
||||
'id' => $id,
|
||||
'height' => $height,
|
||||
'group' => $portlets[$id]['group']
|
||||
);
|
||||
$etemplate->exec('home.home_note_portlet.edit',$content, array(),array('note'=>false,'save'=>false), $preserve);
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ abstract class home_portlet
|
||||
* same id / key to override the default action.
|
||||
*/
|
||||
public abstract function get_actions();
|
||||
|
||||
|
||||
/**
|
||||
* If this portlet can accept, display, or otherwise handle multiple
|
||||
* EgroupWare entries. Used for drag and drop processing. How the entries
|
||||
@ -107,6 +107,18 @@ abstract class home_portlet
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* If this portlet can be created by dropping, these are the drop types
|
||||
* that are accepted
|
||||
*
|
||||
* @return boolean|String[]
|
||||
*/
|
||||
public function accept_drop()
|
||||
{
|
||||
// In general, no
|
||||
return false;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return get_called_class() . ' Context:' . array2string($this->context);
|
||||
|
@ -121,7 +121,6 @@ class home_ui
|
||||
{
|
||||
$children['class'] = $app;
|
||||
$children['onExecute'] = $drop_execute;
|
||||
$children['acceptedTypes'] = array('file','link');
|
||||
$children['type'] = 'drop';
|
||||
$actions["drop_$app"] = $children;
|
||||
}
|
||||
@ -139,7 +138,9 @@ class home_ui
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// For admins, add the ability to set current home as a default
|
||||
self::create_default_actions($actions);
|
||||
return $actions;
|
||||
}
|
||||
|
||||
@ -153,9 +154,12 @@ class home_ui
|
||||
{
|
||||
$portlets = array();
|
||||
|
||||
foreach((array)$GLOBALS['egw_info']['user']['preferences']['home']['portlets'] as $id => $context)
|
||||
foreach((array)$GLOBALS['egw_info']['user']['preferences']['home']as $id => $context)
|
||||
{
|
||||
if(!$id || in_array($id, array_keys($GLOBALS['egw_info']['user']['apps']))) continue;
|
||||
if(strpos($id,'portlet_') !== 0 || // Not a portlet
|
||||
in_array($id, array_keys($GLOBALS['egw_info']['user']['apps'])) || // Some other app put it's pref in here
|
||||
!is_array($context) // Not a valid portlet (probably user deleted a default)
|
||||
) continue;
|
||||
|
||||
$classname = $context['class'];
|
||||
$portlet = new $classname($context);
|
||||
@ -181,7 +185,12 @@ class home_ui
|
||||
|
||||
// Set actions
|
||||
// Must be after settings so actions can take settings into account
|
||||
$template->setElementAttribute("portlets[" . count($portlets) . "[$id]", 'actions', $portlet->get_actions());
|
||||
$actions = $portlet->get_actions();
|
||||
|
||||
// Add in default for admins
|
||||
self::create_default_actions($actions, $id);
|
||||
|
||||
$template->setElementAttribute("portlets[" . count($portlets) . "[$id]", 'actions', $actions);
|
||||
|
||||
$portlets[] = $portlet_content;
|
||||
}
|
||||
@ -242,6 +251,8 @@ class home_ui
|
||||
'settings' => $settings,
|
||||
'actions' => $portlet->get_actions(),
|
||||
);
|
||||
// Add in default settings
|
||||
self::create_default_actions($attributes['actions'], $id);
|
||||
|
||||
// Set any provided common attributes (size, etc)
|
||||
foreach(home_portlet::$common_attributes as $name)
|
||||
@ -371,6 +382,7 @@ class home_ui
|
||||
'caption' => $desc['displayName'],
|
||||
'hint' => $desc['description'],
|
||||
'onExecute' => 'javaScript:app.home.add',
|
||||
'acceptedTypes' => $instance->accept_drop(),
|
||||
'allowOnMultiple' => $instance->accept_multiple()
|
||||
);
|
||||
}
|
||||
@ -382,79 +394,262 @@ class home_ui
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an action to set the portlet as default
|
||||
*
|
||||
* @param Array $actions Existing action list
|
||||
* @param String $portlet_id Provide the ID to have the checkbox set
|
||||
*/
|
||||
protected static function create_default_actions(&$actions, $portlet_id = null)
|
||||
{
|
||||
if($GLOBALS['egw_info']['user']['apps']['admin'])
|
||||
{
|
||||
$actions['add_default'] = array(
|
||||
'type' => 'popup',
|
||||
'caption' => 'Set as default',
|
||||
'onExecute' => 'javaScript:app.home.set_default',
|
||||
'group' => 'Admins',
|
||||
'icon' => 'preference'
|
||||
);
|
||||
// Customize for the given portlet
|
||||
if($portlet_id !== null)
|
||||
{
|
||||
$portlet = $GLOBALS['egw_info']['user']['preferences']['home'][$portlet_id];
|
||||
|
||||
foreach(array('forced','group','default') as $location)
|
||||
{
|
||||
$loc = $GLOBALS['egw']->preferences->$location;
|
||||
|
||||
if($loc['home'][$portlet_id])
|
||||
{
|
||||
// If it's forced, no point in setting default
|
||||
if($location == 'forced')
|
||||
{
|
||||
unset($actions['add_default']);
|
||||
}
|
||||
// If it's a group, we'd like to know which
|
||||
if($location == 'group')
|
||||
{
|
||||
$options = array('account_type' => $type);
|
||||
$groups = accounts::link_query('',$options);
|
||||
foreach($groups as $gid => $name)
|
||||
{
|
||||
$prefs = new preferences($gid);
|
||||
$prefs->read_repository();
|
||||
if (isset($prefs->user['home'][$portlet_id]))
|
||||
{
|
||||
$location = $gid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$actions['remove_default_'.$location] = array(
|
||||
'type' => 'popup',
|
||||
'caption' => lang('Remove default %1',is_numeric($location) ? accounts::id2name($location) : $location),
|
||||
'onExecute' => 'javaScript:app.home.set_default',
|
||||
'group' => 'Admins',
|
||||
'portlet_group' => $location
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Change action for forced
|
||||
if($portlet_id && $GLOBALS['egw']->preferences->forced['home'][$portlet_id])
|
||||
{
|
||||
// No one can remove it
|
||||
$actions['remove_portlet']['enabled'] = false;
|
||||
$actions['remove_portlet']['caption'] .= ' ('.lang('Forced') .')';
|
||||
|
||||
// Non-admins can't edit it
|
||||
if($actions['edit_settings'] && !$GLOBALS['egw_info']['user']['apps']['admin'])
|
||||
{
|
||||
$actions['edit_settings']['enabled'] = false;
|
||||
$actions['edit_settings']['visible'] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the settings for a particular portlet, and give updated content
|
||||
*
|
||||
* @param portlet_id String Unique ID (for the user) for a portlet
|
||||
* @param values Array List of property => value pairs
|
||||
* @param boolean|int|String $group False for current user, ID of the group to create the favorite for, or 'all' for all users
|
||||
*
|
||||
*/
|
||||
public function ajax_set_properties($portlet_id, $attributes, $values)
|
||||
public function ajax_set_properties($portlet_id, $attributes, $values, $group = false)
|
||||
{
|
||||
if(!$attributes)
|
||||
{
|
||||
$attributes = array();
|
||||
}
|
||||
$response = egw_json_response::get();
|
||||
if ($GLOBALS['egw_info']['user']['apps']['preferences'])
|
||||
|
||||
if(!$GLOBALS['egw_info']['user']['apps']['admin'])
|
||||
{
|
||||
$prefs = $GLOBALS['egw']->preferences->read_repository();
|
||||
$portlets = (array)$prefs['home']['portlets'];
|
||||
if($values =='~reload~')
|
||||
if($group == 'forced')
|
||||
{
|
||||
$full_exec = true;
|
||||
$values = array();
|
||||
// Quietly reject
|
||||
return;
|
||||
}
|
||||
if($values == '~remove~')
|
||||
// Not an admin, can only override.
|
||||
$group = false;
|
||||
}
|
||||
if($group && $GLOBALS['egw_info']['user']['apps']['admin'])
|
||||
{
|
||||
$prefs = new preferences(is_numeric($group) ? $group : $GLOBALS['egw_info']['user']['account_id']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$prefs = $GLOBALS['egw']->preferences;
|
||||
}
|
||||
$type = is_numeric($group) ? "user" : $group;
|
||||
|
||||
$prefs->read_repository();
|
||||
|
||||
$response = egw_json_response::get();
|
||||
|
||||
if($values =='~reload~')
|
||||
{
|
||||
$full_exec = true;
|
||||
$values = array();
|
||||
}
|
||||
if($values == '~remove~')
|
||||
{
|
||||
// Already removed client side, needs to be removed permanently
|
||||
$default = $prefs->default_prefs('home',$portlet_id) || $prefs->group['home'][$portlet_id];
|
||||
|
||||
if($default)
|
||||
{
|
||||
unset($portlets[$portlet_id]);
|
||||
// Already removed client side
|
||||
// Can't delete forced - not a UI option though
|
||||
if(!$GLOBALS['egw']->preferences->forced['home'][$portlet_id])
|
||||
{
|
||||
// Set a flag to override default instead of just delete
|
||||
$GLOBALS['egw']->preferences->add('home',$portlet_id, 'deleted');
|
||||
$GLOBALS['egw']->preferences->save_repository();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get portlet settings, and merge new with old
|
||||
$context = $values+(array)$portlets[$portlet_id];
|
||||
$prefs->delete('home', $portlet_id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$portlets = $prefs->read();
|
||||
$portlets = $portlets['home'];
|
||||
|
||||
// Handle add IDs
|
||||
$classname =& $context['class'];
|
||||
if(strpos($classname,'add_') == 0 && !class_exists($classname))
|
||||
// Remove some constant stuff that winds up here
|
||||
unset($values['edit_template']);
|
||||
unset($values['readonly']);
|
||||
unset($values['disabled']);unset($values['no_lang']);
|
||||
unset($values['actions']);
|
||||
unset($values['statustext']);
|
||||
unset($values['type']);unset($values['label']);unset($values['status']);
|
||||
unset($values['value']);unset($values['align']);
|
||||
|
||||
// Get portlet settings, and merge new with old
|
||||
$context = $values+(array)$portlets[$portlet_id];
|
||||
$context['group'] = $group;
|
||||
|
||||
|
||||
|
||||
// Handle add IDs
|
||||
$classname =& $context['class'];
|
||||
if(strpos($classname,'add_') == 0 && !class_exists($classname))
|
||||
{
|
||||
$add = true;
|
||||
$classname = substr($classname, 4);
|
||||
}
|
||||
$portlet = $this->get_portlet($portlet_id, $context, $content, $attributes, $full_exec);
|
||||
|
||||
$context['class'] = get_class($portlet);
|
||||
foreach($portlet->get_properties() as $property)
|
||||
{
|
||||
if($values[$property['name']])
|
||||
{
|
||||
$add = true;
|
||||
$classname = substr($classname, 4);
|
||||
$context[$property['name']] = $values[$property['name']];
|
||||
}
|
||||
$portlet = $this->get_portlet($portlet_id, $context, $content, $attributes, $full_exec);
|
||||
|
||||
$context['class'] = get_class($portlet);
|
||||
foreach($portlet->get_properties() as $property)
|
||||
elseif($portlets[$portlet_id][$property['name']])
|
||||
{
|
||||
if($values[$property['name']])
|
||||
{
|
||||
$context[$property['name']] = $values[$property['name']];
|
||||
}
|
||||
elseif($portlets[$portlet_id][$property['name']])
|
||||
{
|
||||
$context[$property['name']] = $portlets[$portlet_id][$property['name']];
|
||||
}
|
||||
$context[$property['name']] = $portlets[$portlet_id][$property['name']];
|
||||
}
|
||||
|
||||
// Update client side
|
||||
$update = array('attributes' => $attributes);
|
||||
|
||||
// New portlet? Flag going straight to edit mode
|
||||
if($add)
|
||||
{
|
||||
$update['edit_settings'] = true;
|
||||
}
|
||||
// Send this back to the portlet widget
|
||||
$response->data($update);
|
||||
|
||||
// Store for preference update
|
||||
$portlets[$portlet_id] = $context;
|
||||
}
|
||||
|
||||
// Save updated preferences
|
||||
$GLOBALS['egw']->preferences->add('home', 'portlets', $portlets);
|
||||
$GLOBALS['egw']->preferences->save_repository(True);
|
||||
// Update client side
|
||||
$update = array('attributes' => $attributes);
|
||||
|
||||
// New portlet? Flag going straight to edit mode
|
||||
if($add)
|
||||
{
|
||||
$update['edit_settings'] = true;
|
||||
}
|
||||
// Send this back to the portlet widget
|
||||
$response->data($update);
|
||||
|
||||
// Store for preference update
|
||||
$prefs->add('home', $portlet_id, $context, $type);
|
||||
}
|
||||
|
||||
// Save updated preferences
|
||||
$prefs->save_repository(True,$type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the selected portlets as default for a group
|
||||
*
|
||||
* @param String $action 'add' or 'delete'
|
||||
* @param String[] $portlet_ids
|
||||
* @param int|String $group Group ID or 'default' or 'forced'
|
||||
*/
|
||||
public static function ajax_set_default($action, $portlet_ids, $group)
|
||||
{
|
||||
// Admins only
|
||||
if(!$GLOBALS['egw_info']['apps']['admin']) return;
|
||||
|
||||
// Load the appropriate group
|
||||
if($group)
|
||||
{
|
||||
$prefs = new preferences(is_numeric($group) ? $group : $GLOBALS['egw_info']['user']['account_id']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$prefs = $GLOBALS['egw']->preferences;
|
||||
}
|
||||
$prefs->read_repository();
|
||||
|
||||
$type = is_numeric($group) ? "user" : $group;
|
||||
|
||||
if($action == 'add')
|
||||
{
|
||||
foreach($portlet_ids as $id)
|
||||
{
|
||||
egw_json_response::get()->call('egw.message', lang("Set default"));
|
||||
// Current user is setting the default, copy their settings
|
||||
$settings = $GLOBALS['egw_info']['user']['preferences']['home'][$id];
|
||||
$settings['group'] = $group;
|
||||
$prefs->add('home',$id,$settings,$type);
|
||||
|
||||
// Remove user's copy
|
||||
$GLOBALS['egw']->preferences->delete('home',$id);
|
||||
$GLOBALS['egw']->preferences->save_repository(true);
|
||||
}
|
||||
}
|
||||
else if ($action == "delete")
|
||||
{
|
||||
foreach($portlet_ids as $id)
|
||||
{
|
||||
egw_json_response::get()->call('egw.message', lang("Removed default"));
|
||||
error_log("Clearing $type $group default $id");
|
||||
$result = $prefs->delete('home',$id, $type);
|
||||
}
|
||||
}
|
||||
$prefs->save_repository(false,$type);
|
||||
|
||||
// Update preferences client side for consistency
|
||||
$prefs = $GLOBALS['egw']->preferences;
|
||||
$pref = $prefs->read_repository();
|
||||
egw_json_response::get()->call('egw.set_preferences', (array)$pref['home'], 'home');
|
||||
}
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ app.classes.home = AppJS.extend(
|
||||
{
|
||||
for(var i = 0; i < portlet._children.length; i++)
|
||||
{
|
||||
portlet._children[i]._inst.clear();
|
||||
if(portlet._children[i]._inst) portlet._children[i]._inst.clear();
|
||||
}
|
||||
portlet._children = [];
|
||||
}
|
||||
@ -270,6 +270,65 @@ app.classes.home = AppJS.extend(
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the current selection as default for other users
|
||||
*
|
||||
* Only works (and available) for admins, this shows a dialog to select
|
||||
* the group, and then sets the default for that group.
|
||||
*
|
||||
* @param {egwAction} action
|
||||
* @param {egwActionObject[]} selected
|
||||
*/
|
||||
set_default: function(action, selected) {
|
||||
// Gather just IDs, server will handle the details
|
||||
var portlet_ids = [];
|
||||
var group = action.data.portlet_group || false;
|
||||
if(selected[0].id == 'home.index')
|
||||
{
|
||||
// Set all
|
||||
this.portlet_container.iterateOver(function(portlet) {
|
||||
portlet_ids.push(portlet.id);
|
||||
},this,et2_portlet);
|
||||
}
|
||||
else
|
||||
{
|
||||
for(var i = 0; i < selected.length; i++)
|
||||
{
|
||||
portlet_ids.push(selected[i].id);
|
||||
|
||||
// Read the associated group so we can properly remove it
|
||||
var portlet = egw.preference(selected[i].id,'home');
|
||||
if(!group && portlet && portlet.group)
|
||||
{
|
||||
group = portlet.group;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(action.id.indexOf("remove_default") == 0)
|
||||
{
|
||||
// Disable action for feedback
|
||||
action.set_enabled(false);
|
||||
|
||||
// Pass them to server
|
||||
egw.json('home_ui::ajax_set_default', ['delete', portlet_ids, group]).sendRequest(true);
|
||||
return;
|
||||
}
|
||||
var dialog = et2_createWidget("dialog",{
|
||||
// If you use a template, the second parameter will be the value of the template, as if it were submitted.
|
||||
callback: function(button_id, value) {
|
||||
if(button_id != et2_dialog.OK_BUTTON) return;
|
||||
|
||||
// Pass them to server
|
||||
egw.json('home_ui::ajax_set_default', ['add', portlet_ids, value.group||false]).sendRequest(true);
|
||||
},
|
||||
buttons: et2_dialog.BUTTONS_OK_CANCEL,
|
||||
title: action.caption,
|
||||
template:"home.set_default",
|
||||
value: {content:{}, sel_options: {group:{default: egw.lang('All'), forced: egw.lang('Forced')}}}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Allow a refresh from anywhere by triggering an update with no changes
|
||||
*
|
||||
@ -363,7 +422,7 @@ app.classes.home = AppJS.extend(
|
||||
egw().jsonq("home.home_ui.ajax_set_properties",[changed[key].id, widget.options.settings,{
|
||||
row: changed[key].row,
|
||||
col: changed[key].col
|
||||
}],
|
||||
},widget.settings?widget.settings.group:false],
|
||||
null,
|
||||
widget, true, widget
|
||||
);
|
||||
@ -401,8 +460,8 @@ app.classes.home = AppJS.extend(
|
||||
.toString(16)
|
||||
.substring(1);
|
||||
}
|
||||
while(this.portlet_container.getWidgetById(id));
|
||||
return id;
|
||||
while(this.portlet_container.getWidgetById('portlet_'+id));
|
||||
return 'portlet_'+id;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -456,7 +515,11 @@ app.classes.home = AppJS.extend(
|
||||
new_list.push(value.add);
|
||||
widget._process_edit(button_id,{list: new_list});
|
||||
// Update client side
|
||||
widget.getWidgetById('list').set_value(new_list);
|
||||
var list = widget.getWidgetById('list');
|
||||
if(list)
|
||||
{
|
||||
list.set_value(new_list);
|
||||
}
|
||||
},
|
||||
buttons: et2_dialog.BUTTONS_OK_CANCEL,
|
||||
title: app.home.egw.lang('add'),
|
||||
@ -542,7 +605,7 @@ app.classes.home = AppJS.extend(
|
||||
}
|
||||
|
||||
// Aim to match the size
|
||||
var portlet_dom = $j('[id$='+id+'][data-sizex]',this.portlet_container.getDOMNode);
|
||||
var portlet_dom = $j('[id$='+id+'][data-sizex]',this.portlet_container.getDOMNode());
|
||||
var width = portlet_dom.attr('data-sizex') * this.GRID;
|
||||
var height = portlet_dom.attr('data-sizey') * this.GRID;
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
/* Basic information about this app */
|
||||
$setup_info['home']['name'] = 'home';
|
||||
$setup_info['home']['title'] = 'Home';
|
||||
$setup_info['home']['version'] = '14.1';
|
||||
$setup_info['home']['version'] = '14.1.001';
|
||||
$setup_info['home']['app_order'] = 1;
|
||||
$setup_info['home']['enable'] = 1;
|
||||
$setup_info['home']['index'] = 'home.home_ui.index&ajax=true';
|
||||
|
62
home/setup/tables_update.inc.php
Normal file
62
home/setup/tables_update.inc.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* EGroupware - Home - Setup
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
* @package home
|
||||
* @subpackage setup
|
||||
* @copyright (c) 2014 Nathan Gray
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
function home_upgrade14_1()
|
||||
{
|
||||
// Previously all portlets were together in a sub-array, for defaults they
|
||||
// need to be moved to top level
|
||||
$preferences = array();
|
||||
foreach($GLOBALS['egw_setup']->db->select('egw_preferences','preference_owner,preference_app,preference_value',array(
|
||||
'preference_app' => 'home',
|
||||
),__LINE__,__FILE__) as $row)
|
||||
{
|
||||
$preferences[] = $row;
|
||||
}
|
||||
foreach($preferences as $row)
|
||||
{
|
||||
// The following replacement is required for PostgreSQL to work
|
||||
$app = trim($row['preference_app']);
|
||||
|
||||
// Move portlets into top level, not a sub-array
|
||||
if ($row['preference_value'][0] != 'a' && $row['preference_value'][1] != ':')
|
||||
{
|
||||
$values = json_decode($row['preference_value'], true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Too old, skip it
|
||||
continue;
|
||||
}
|
||||
if($values['portlets'] && is_array($values['portlets']))
|
||||
{
|
||||
error_log("Portlets:");
|
||||
foreach($values['portlets'] as $id => $settings)
|
||||
{
|
||||
error_log($id);
|
||||
$values["portlet_$id"] = $settings;
|
||||
}
|
||||
unset($values['portlets']);
|
||||
}
|
||||
$GLOBALS['egw_setup']->db->insert(
|
||||
'egw_preferences',array(
|
||||
'preference_value' => json_encode($values),
|
||||
),array(
|
||||
'preference_owner' => $row['preference_owner'],
|
||||
'preference_app' => $app,
|
||||
),__LINE__,__FILE__
|
||||
);
|
||||
}
|
||||
|
||||
return $GLOBALS['setup_info']['home']['currentver'] = '14.1.001';
|
||||
}
|
||||
|
@ -1,6 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- $Id$ -->
|
||||
<overlay>
|
||||
<template id="home.set_default" template="" version="1.9.001">
|
||||
<vbox>
|
||||
<description value="Add as default for"/>
|
||||
<listbox type="select-account" id="group" account_type="groups"/>
|
||||
</vbox>
|
||||
</template>
|
||||
<template id="home.index" template="" lang="" group="0" version="1.9.001">
|
||||
<grid width="100%">
|
||||
<columns>
|
||||
|
Loading…
Reference in New Issue
Block a user