1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13:
14: 15: 16: 17: 18: 19: 20: 21: 22:
23: class IMP_Prefs_Special_HtmlSignature implements Horde_Core_Prefs_Ui_Special
24: {
25: 26:
27: public function init(Horde_Core_Prefs_Ui $ui)
28: {
29: }
30:
31: 32:
33: public function display(Horde_Core_Prefs_Ui $ui)
34: {
35: global $conf, $injector, $page_output, $prefs;
36:
37: $page_output->addScriptFile('editor.js');
38: $page_output->addScriptFile('signaturehtml.js');
39: $page_output->addScriptPackage('IMP_Script_Package_Editor');
40:
41: $page_output->addInlineJsVars(array(
42: 'ImpHtmlSignaturePrefs.sigs' =>
43: array(-1 => $prefs->getValue('signature_html')) +
44: $injector->getInstance('IMP_Identity')->getAll('signature_html')
45: ));
46:
47: $view = new Horde_View(array(
48: 'templatePath' => IMP_TEMPLATES . '/prefs'
49: ));
50: $view->addHelper('Text');
51:
52: $view->img_limit = $conf['compose']['htmlsig_img_size'];
53: $view->signature = $prefs->getValue('signature_html');
54:
55: return $view->render('signaturehtml');
56: }
57:
58: 59:
60: public function update(Horde_Core_Prefs_Ui $ui)
61: {
62: global $injector, $notification;
63:
64: try {
65:
66: new IMP_Compose_HtmlSignature($ui->vars->signature_html);
67: } catch (IMP_Exception $e) {
68: $notification->push($e, 'horde.error');
69: return false;
70: }
71:
72: return $injector->getInstance('IMP_Identity')->setValue(
73: 'signature_html',
74: $ui->vars->signature_html
75: );
76: }
77:
78: }
79: