18 require_once SQ_LIB_PATH.
'/config/prefs.inc';
33 var $pref_vars = Array(
34 'SQ_SNIPPET_ROOT' => Array(
35 'name' =>
'snippet_root_node',
36 'description' =>
'Allows you to specify the root node of where all snippets are located',
40 'SQ_SNIPPET_KEYWORDS_PERMISSION_CHECK' => Array(
41 'name' =>
'snippet_keywords_permission_check',
42 'description' =>
'Allows you to turn off snippet keywords permission check to speed up WYSIWYG loading',
55 $this->
Prefs($pref_file);
72 $is_root = $GLOBALS[
'SQ_SYSTEM']->userRoot();
73 $is_admin = ($is_root || $GLOBALS[
'SQ_SYSTEM']->userSystemAdmin());
76 if (is_null($pref) || $pref ==
'SQ_SNIPPET_ROOT') {
78 $o->openField(translate($this->pref_vars[
'SQ_SNIPPET_ROOT'][
'name']));
84 if ($have_lock && $is_admin) {
85 if (isset($this->pref_vars[
'SQ_SNIPPET_ROOT'][
'default'])) {
86 $asset_map_settings = $this->pref_vars[
'SQ_SNIPPET_ROOT'][
'default'];
88 $asset_map_settings =
'';
90 asset_finder(
'prefs[SQ_SNIPPET_ROOT]', $asset_map_settings);
92 if (!empty($this->pref_vars[
'SQ_SNIPPET_ROOT'][
'default'])) {
93 echo get_asset_tag_line($this->pref_vars[
'SQ_SNIPPET_ROOT'][
'default']);
95 echo translate(
'root_folder');
100 $o->note(translate(
'cms_ct_snippet_pref_note'));
104 if (is_null($pref)) $o->closeField();
108 if (is_null($pref) || $pref ==
'SQ_SNIPPET_KEYWORDS_PERMISSION_CHECK') {
109 if (is_null($pref)) {
110 $o->openField(translate($this->pref_vars[
'SQ_SNIPPET_KEYWORDS_PERMISSION_CHECK'][
'name']));
113 $value = $this->pref_vars[
'SQ_SNIPPET_KEYWORDS_PERMISSION_CHECK'][
'default'];
115 if ($have_lock && $is_admin) {
116 $options = Array(1 =>
'Yes', 0 =>
'No');
117 combo_box(
'prefs[SQ_SNIPPET_KEYWORDS_PERMISSION_CHECK]', $options, FALSE, $value);
119 echo ($value) ? translate(
'yes') : translate(
'no');
121 echo $o->note(translate(
'cms_ct_snippet_pref_keywords_note'));
122 if (is_null($pref)) $o->closeField();
143 $is_root = $GLOBALS[
'SQ_SYSTEM']->userRoot();
144 $is_admin = ($is_root || $GLOBALS[
'SQ_SYSTEM']->userSystemAdmin());
145 if (!$is_admin)
return FALSE;
146 if (is_null($pref) || $pref ==
'SQ_SNIPPET_ROOT') {
148 if (isset($_POST[
'prefs'][
'SQ_SNIPPET_ROOT'])) {
149 $this->pref_vars[
'SQ_SNIPPET_ROOT'][
'default'] = $_POST[
'prefs'][
'SQ_SNIPPET_ROOT'][
'assetid'];
154 if (is_null($pref) || $pref ==
'SQ_SNIPPET_KEYWORDS_PERMISSION_CHECK') {
155 if (isset($_POST[
'prefs'][
'SQ_SNIPPET_KEYWORDS_PERMISSION_CHECK'])) {
156 $allow = strtoupper(trim($_POST[
'prefs'][
'SQ_SNIPPET_KEYWORDS_PERMISSION_CHECK']));
157 $this->pref_vars[
'SQ_SNIPPET_KEYWORDS_PERMISSION_CHECK'][
'default'] = $allow;