Ticket #1620: set_prefs_globally.diff
| File set_prefs_globally.diff, 3.9 kB (added by wik01, 5 months ago) |
|---|
-
modules/user/classes/PreferenceMgr.php
old new 64 64 'insert' => array('insert', 'redirectToDefault'), 65 65 'edit' => array('edit'), 66 66 'update' => array('update', 'redirectToDefault'), 67 'update ThemeForAllMembers' => array('updateThemeForAllMembers', 'redirectToDefault'),67 'updatePreferencesForAllMembers' => array('updatePreferencesForAllMembers', 'redirectToDefault'), 68 68 'delete' => array('delete', 'redirectToDefault'), 69 69 'list' => array('list'), 70 70 ); … … 229 229 SGL::raiseMsg('pref successfully updated', true, SGL_MESSAGE_INFO); 230 230 } 231 231 232 function _cmd_update ThemeForAllMembers(&$input, &$output)232 function _cmd_updatePreferencesForAllMembers(&$input, &$output) 233 233 { 234 234 SGL::logMessage(null, PEAR_LOG_DEBUG); 235 235 236 $ok = $this->da->updatePrefByRoleId('theme', $input->themeName, $roleId = SGL_MEMBER); 237 SGL::raiseMsg('theme set for all users', false, SGL_MESSAGE_INFO); 236 if (is_array($input->aDelete)) { 237 foreach ($input->aDelete as $index => $prefId) { 238 $oPref = DB_DataObject::factory($this->conf['table']['preference']); 239 $oPref->get($prefId); 240 $ok = $this->da->updatePrefByRoleId($oPref->name, $oPref->default_value, $roleId = SGL_MEMBER); 241 unset($oPref); 242 } 243 SGL::raiseMsg('Selected prefs has been set for all users', true, SGL_MESSAGE_INFO); 244 } else { 245 SGL::raiseError('Incorrect parameter passed to ' . __CLASS__ . '::' . 246 __FUNCTION__, SGL_ERROR_INVALIDARGS); 247 } 238 248 } 239 249 240 250 function _cmd_delete(&$input, &$output) -
modules/user/templates/admin_prefManager.html
old new 1 1 <div id="manager-actions"> 2 2 <span>{translate(#Action#)}: </span> 3 3 <a class="action add" href="{makeUrl(#add#,#preference#,#user#)}">{translate(#New preference#)}</a> 4 <a class="action reorder" href="javascript:formSubmit('frmPrefManager','action','updatePreferencesForAllMembers')" title="{translate(#Update selected preferences for all members#)}">{translate(#Set globally#)}</a> 4 5 </div> 5 6 <div id="content"> 6 7 <div id="content-header"> 7 8 <h2>{translate(pageTitle)}</h2> 8 9 <div class="message">{msgGet()}</div> 9 10 </div> 10 <form name="frmPrefManager" method="post" flexy:ignore id="frmPrefManager">11 <form name="frmPrefManager" id="frmPrefManager" method="post" flexy:ignore> 11 12 <fieldset class="noBorder"> 12 13 <input type="hidden" name="action" value="delete" /> 13 14 … … 51 52 </fieldset> 52 53 </form> 53 54 <div class="spacer"></div> 54 55 <!--GLOBAL PREFS SET--> 56 <div id="content-header"> 57 <h2>Set theme globally</h2> 58 </div> 59 60 <form name="frmPrefManager" method="post" flexy:ignore id="frmPrefManager"> 61 <fieldset class="noBorder"> 62 <input type="hidden" name="action" value="updateThemeForAllMembers" /> 63 64 <table class="full"> 65 <tbody> 66 <tr> 67 <td> 68 <select id="frmThemeName" name="frmThemeName"> 69 {generateSelect(aThemes,prefs[theme]):h} 70 </select> 71 </td> 72 </tr> 73 </tbody> 74 </table> 75 <input type="submit" class="sgl-button" name="" value="update theme" /> 76 </fieldset> 77 </form> 78 </div> 55 </div>
