antoniop
committed
on 01 Dec 23
Fix logic to retrieve the Boostrap Icons CSS path:

the situation is even more slippery than thought, as it seems the new "font" path was di… Show more
Fix logic to retrieve the Boostrap Icons CSS path:

the situation is even more slippery than thought, as it seems the new "font" path was discontinued for versions 1.11.0 and 1.11.1, then reintroduced in version 1.11.2. We can only speculate what logic will follow the next version, so for now we assume the new path will stay and just skip the two outlier versions.

Show less

/tcl/xowiki-admin-portlet-procs.tcl (+20 -36)
64 64
65 65 xowiki_admin_portlet ad_proc show {
66 66   cf
67 67 } {
68 68   Display the xowiki admin PE
69 69 } {
70 70   portal::show_proc_helper \
71 71       -package_key [:package_key] \
72 72       -config_list $cf \
73 73       -template_src "xowiki-admin-portlet"
74 74 }
75 75
76 76 xowiki_admin_portlet proc install {} {
77 77   :log "--portlet calling [self proc]"
78 78   set name [:name]
79 79   db_transaction {
80 80
81 81     #
82 82     # create the datasource
83 83     #
84       set ds_id [::acs::dc call portal_datasource new -name $name \
85                      -css_dir "" \
  84     set ds_id [portal::datasource::new \
  85                    -name $name \
86 86                    -description "Displays the admin interface for the xowiki data portlets"]
87 87
88 88     # default configuration
89  
90       ::acs::dc call portal_datasource set_def_param -datasource_id $ds_id \
  89     portal::datasource::set_def_param -datasource_id $ds_id \
91 90         -config_required_p t -configured_p t \
92 91         -key "shadeable_p" -value f
93 92
94       ::acs::dc call portal_datasource set_def_param -datasource_id $ds_id \
  93     portal::datasource::set_def_param -datasource_id $ds_id \
95 94         -config_required_p t -configured_p t \
96 95         -key "shaded_p" -value f
97 96
98       ::acs::dc call portal_datasource set_def_param -datasource_id $ds_id \
  97     portal::datasource::set_def_param -datasource_id $ds_id \
99 98         -config_required_p t -configured_p t \
100 99         -key "hideable_p" -value t
101 100
102       ::acs::dc call portal_datasource set_def_param -datasource_id $ds_id \
  101     portal::datasource::set_def_param -datasource_id $ds_id \
103 102         -config_required_p t -configured_p t \
104 103         -key "user_editable_p" -value f
105 104
106       ::acs::dc call portal_datasource set_def_param -datasource_id $ds_id \
  105     portal::datasource::set_def_param -datasource_id $ds_id \
107 106         -config_required_p t -configured_p t \
108 107         -key "link_hideable_p" -value t
109 108
110 109     # xowiki-admin-specific procs
111 110
112 111     # package_id must be configured
113       ::acs::dc call portal_datasource set_def_param -datasource_id $ds_id \
  112     portal::datasource::set_def_param -datasource_id $ds_id \
114 113         -config_required_p t -configured_p f \
115 114         -key "package_id" -value ""
116 115
117 116
118 117     #
119 118     # service contract managemet
120 119     #
121 120     # create the implementation
122       ::acs::dc call acs_sc_impl new \
123           -impl_contract_name "portal_datasource" -impl_name $name \
124           -impl_pretty_name "" -impl_owner_name $name
  121     acs_sc::impl::new \
  122         -contract_name "portal_datasource" -name $name \
  123         -pretty_name "" -owner $name
125 124
126 125     # add the operations
127 126     foreach {operation call} {
128 127       GetMyName             "xowiki_admin_portlet name"
129 128       GetPrettyName         "xowiki_admin_portlet pretty_name"
130 129       Link                  "xowiki_admin_portlet link"
131 130       AddSelfToPage         "xowiki_admin_portlet add_self_to_page"
132 131       Show                  "xowiki_admin_portlet show"
133 132       Edit                  "xowiki_admin_portlet edit"
134 133       RemoveSelfFromPage    "xowiki_admin_portlet remove_self_from_page"
135 134     } {
136         ::acs::dc call acs_sc_impl_alias new \
137             -impl_contract_name "portal_datasource" -impl_name $name  \
138             -impl_operation_name $operation -impl_alias $call \
139             -impl_pl "TCL"
  135       acs_sc::impl::alias::new \
  136           -contract_name "portal_datasource" -impl_name $name \
  137           -operation $operation -alias $call \
  138           -language TCL
140 139     }
141 140
142 141     # Add the binding
143       ::acs::dc call acs_sc_binding new \
  142     acs_sc::impl::binding::new \
144 143         -contract_name "portal_datasource" -impl_name $name
145 144   }
146 145   :log "--portlet end of [self proc]"
147 146 }
148 147
149 148 xowiki_admin_portlet proc uninstall {} {
150 149   :log "--portlet calling [self proc]"
151 150   #
152 151   # completely identical to "xowiki_portlet uninstall"
153 152   #
154 153   set name [:name]
155 154   db_transaction {
156 155
157 156     #
158 157     # get the datasource
159 158     #
160 159     set ds_id [db_string dbqd..get_ds_id {
161 160       select datasource_id from portal_datasources where name = :name
162 161     } -default "0"]
163 162
164 163     if {$ds_id != 0} {
165 164       #
166 165       # drop the datasource
167 166       #
168         ::acs::dc call portal_datasource delete -datasource_id $ds_id
  167       portal::datasource::delete -name $name
169 168       #
170 169     } else {
171 170       ns_log notice "No datasource id found for $name"
172 171     }
173 172
174       #  drop the operations
175 173     #
176       foreach operation {
177         GetMyName GetPrettyName Link AddSelfToPage
178         Show Edit RemoveSelfFromPage
179       } {
180         ::acs::dc call acs_sc_impl_alias delete \
181             -impl_contract_name "portal_datasource" -impl_name $name \
182             -impl_operation_name $operation
183       }
184       #
185       #  drop the binding
186       #
187       ::acs::dc call acs_sc_binding delete \
188           -contract_name "portal_datasource" -impl_name $name
189       #
190 174     #  drop the implementation
191 175     #
192       ::acs::dc call acs_sc_impl delete \
193           -impl_contract_name "portal_datasource" -impl_name $name
  176     acs_sc::impl::delete \
  177         -contract_name "portal_datasource" -impl_name $name
194 178   }
195 179   :log "--portlet end of [self proc]"
196 180 }
197 181
198 182 # Local variables:
199 183 #    mode: tcl
200 184 #    tcl-indent-level: 2
201 185 #    indent-tabs-mode: nil
202 186 # End: