Fix changing owner or allowed by context menu

This commit is contained in:
Nathan Gray 2014-02-19 22:37:30 +00:00
parent 1c4b473d6f
commit a82580211e
2 changed files with 27 additions and 24 deletions

View File

@ -132,16 +132,21 @@ class importexport_definitions_ui
$action = $content['nm']['action']; $action = $content['nm']['action'];
if($content['nm']['action'] == 'allowed') if($content['nm']['action'] == 'allowed')
{ {
$content['allowed'] = $content['allowed_private'] ? null : ($content['all_users'] ? 'all' : implode(',',$content['allowed'])); $content['allowed'] = $content['allowed_popup']['allowed_private'] == 'true' ? null : (
$content['allowed_popup']['all_users']=='true' ? 'all' : implode(',',$content['allowed_popup']['allowed'])
);
}
else
{
$content['owner'] = $content['owner_popup']['owner'];
} }
if(is_array($content[$content['nm']['action']])) if(is_array($content[$content['nm']['action']]))
{ {
$content[$content['nm']['action']] = implode(',',$content[$content['nm']['action']]); $content[$content['nm']['action']] = implode(',',$content[$content['nm']['action']]);
} }
$content['nm']['action'] .= '_' . $content[$content['nm']['action']]; $content['nm']['action'] .= '_' . $content[$action];
unset($content[$action]); unset($content[$action]);
unset($content['all_users']); unset($content['allowed_popup']);
unset($content['allowed_private']);
} }
if ($this->action($content['nm']['action'],$content['nm']['selected'],$content['nm']['select_all'], if ($this->action($content['nm']['action'],$content['nm']['selected'],$content['nm']['select_all'],
$success,$failed,$action_msg,'index',$msg)) $success,$failed,$action_msg,'index',$msg))
@ -285,20 +290,20 @@ class importexport_definitions_ui
} }
/** /**
* apply an action to multiple entries * apply an action to multiple entries
* *
* @param string/int $action 'delete', 'export', etc. * @param string/int $action 'delete', 'export', etc.
* @param array $selected id's to use if !$use_all * @param array $selected id's to use if !$use_all
* @param boolean $use_all if true use all entries of the current selection (in the session) * @param boolean $use_all if true use all entries of the current selection (in the session)
* @param int &$success number of succeded actions * @param int &$success number of succeded actions
* @param int &$failed number of failed actions (not enought permissions) * @param int &$failed number of failed actions (not enought permissions)
* @param string &$action_msg translated verb for the actions, to be used in a message like %1 entries 'deleted' * @param string &$action_msg translated verb for the actions, to be used in a message like %1 entries 'deleted'
* @param string/array $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup * @param string/array $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup
* @return boolean true if all actions succeded, false otherwise * @return boolean true if all actions succeded, false otherwise
*/ */
function action($action,$selected,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg) function action($action,$selected,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg)
{ {
//echo __METHOD__."('$action', ".array2string($selected).', '.array2string($use_all).",,, '$session_name')"; //error_log( __METHOD__."('$action', ".array2string($selected).', '.array2string($use_all).",,, '$session_name')");
if ($use_all) if ($use_all)
{ {
// get the whole selection // get the whole selection

View File

@ -73,11 +73,9 @@
<description value="Change owner" class="promptheader"/> <description value="Change owner" class="promptheader"/>
<vbox class="action_popup-content"> <vbox class="action_popup-content">
<description value="Select owner"/> <description value="Select owner"/>
<menulist> <listbox type="select-account" id="owner" options="None,accounts"/>
<menupopup type="select-account" class="action_popup-content" id="owner" options="None,accounts"/>
</menulist>
<hbox> <hbox>
<button label="Save" onclick="nm_submit_popup(this); return false;"/> <button id="save_owner" label="Save" onclick="nm_submit_popup(this); return false;"/>
<buttononly label="Cancel" onclick="nm_hide_popup(this,'owner_popup');"/> <buttononly label="Cancel" onclick="nm_hide_popup(this,'owner_popup');"/>
</hbox> </hbox>
</vbox> </vbox>
@ -88,9 +86,9 @@
<description value="Select groups"/> <description value="Select groups"/>
<checkbox label="%s Just me" id="allowed_private"/> <checkbox label="%s Just me" id="allowed_private"/>
<checkbox label="%s All users" id="all_users"/> <checkbox label="%s All users" id="all_users"/>
<listbox type="select-account" id="allowed" rows="5" options="groups"/> <listbox type="select-account" id="allowed" rows="5" account_type="groups"/>
<hbox> <hbox>
<button label="Save" onclick="nm_submit_popup(this); return false;" image="save" background_image="1"/> <button id="save_allowed" label="Save" onclick="nm_submit_popup(this); return false;" image="save" background_image="1"/>
<buttononly label="Cancel" onclick="nm_hide_popup(this,'allowed_popup');" image="cancel" background_image="1"/> <buttononly label="Cancel" onclick="nm_hide_popup(this,'allowed_popup');" image="cancel" background_image="1"/>
</hbox> </hbox>
</vbox> </vbox>