| 196 | | $html = null; |
| 197 | | |
| 198 | | /*display_num_items*/ |
| 199 | | $displayNumItems = $this->getDisplayNumItems(); |
| 200 | | $html .= "<li class='admin_element_item_container'>\n"; |
| 201 | | $html .= "<div class='admin_element_label'>" . ("Number of shouts to display in the list (0 means no limit)") . ": </div>\n"; |
| 202 | | $html .= "<div class='admin_element_data'>\n"; |
| 203 | | $name = "shoutbox_{this->getId()}_display_num_items"; |
| 204 | | $html .= "<input type='text' size='6' value='$displayNumItems' name='$name'>\n"; |
| 205 | | $html .= "</div>\n"; |
| 206 | | $html .= "</li>\n"; |
| 207 | | |
| 208 | | /*max_shout_chars*/ |
| 209 | | $maxShoutChars = $this->getMaxShoutChars(); |
| 210 | | $html .= "<li class='admin_element_item_container'>\n"; |
| 211 | | $html .= "<div class='admin_element_label'>" . ("Maximum number of characters for each shouts (0 means no limit)") . ": </div>\n"; |
| 212 | | $html .= "<div class='admin_element_data'>\n"; |
| 213 | | $name = "shoutbox_{this->getId()}_max_num_chars"; |
| 214 | | $html .= "<input type='text' size='6' value='$maxShoutChars' name='$name'>\n"; |
| 215 | | $html .= "</div>\n"; |
| 216 | | $html .= "</li>\n"; |
| 217 | | |
| 218 | | /*shout_field_size*/ |
| 219 | | $shoutFieldSize = $this->getShoutFieldSize(); |
| 220 | | $html .= "<li class='admin_element_item_container'>\n"; |
| 221 | | $html .= "<div class='admin_element_label'>" . ("Size (num characters) of the shout field") . ": </div>\n"; |
| 222 | | $html .= "<div class='admin_element_data'>\n"; |
| 223 | | $name = "shoutbox_{this->getId()}_shout_field_size"; |
| 224 | | $html .= "<input type='text' size='6' value='$shoutFieldSize' name='$name'>\n"; |
| 225 | | $html .= "</div>\n"; |
| 226 | | $html .= "</li>\n"; |
| 227 | | |
| 228 | | /* OnclickContent */ |
| 229 | | $criteria_array = array ( |
| 230 | | array ('isTextualContent'), |
| 231 | | array ('isSimpleContent') |
| 232 | | ); |
| 233 | | |
| 234 | | $onclick_allowed_content_types = ContentTypeFilter :: getObject($criteria_array); |
| 235 | | |
| 236 | | |
| 237 | | $content = $this->getOnClickContent(); |
| 238 | | $html .= "<li class='admin_element_item_container admin_section_edit_description'>\n"; |
| 239 | | $html .= "<div class='admin_element_data'>\n"; |
| 240 | | $onclick_title = _("Shout button 'onclick=' value (optionnal):"); |
| 241 | | if (!$content) { |
| 242 | | $name = "shoutbox_" . $this->id . "_onclick_content_new"; |
| 243 | | $html .= self :: getNewContentUI($name, $onclick_allowed_content_types, $onclick_title); |
| 244 | | $html .= $hint; |
| 245 | | } else { |
| 246 | | $html .= $content->getAdminUI(null, $onclick_title); |
| 247 | | $html .= "<div class='admin_section_hint'>" . sprintf(_("Note that the onclick parameter will appear inside double quotes in html. They must be properly encoded fot that context. You can access the shout text in Javascript with: %s"), "document.getElementById('shout_text').value") . "</div>\n"; |
| 248 | | $html .= "</div>\n"; |
| 249 | | $html .= "<div class='admin_element_tools'>\n"; |
| 250 | | $name = "shoutbox_" . $this->id . "_onclick_content_erase"; |
| 251 | | $html .= "<input type='submit' class='submit' name='$name' value='" . sprintf(_("Delete %s (%s)"), _("onclick parameter"), get_class($content)) . "'>"; |
| 252 | | |
| 253 | | } |
| 254 | | $html .= "</div>\n"; |
| 255 | | $html .= "</li>\n"; |
| 256 | | return parent :: getAdminUI($html, $title); |
| 257 | | } |
| 258 | | |
| 259 | | /** |
| 260 | | * Processes the input of the administration interface for Picture |
| 261 | | * |
| 262 | | * @return void |
| 263 | | */ |
| | 196 | $html = null; |
| | 197 | |
| | 198 | /*display_num_items*/ |
| | 199 | $displayNumItems = $this->getDisplayNumItems(); |
| | 200 | $html .= "<li class='admin_element_item_container'>\n"; |
| | 201 | $html .= "<div class='admin_element_label'>" . ("Number of shouts to display in the list (0 means no limit)") . ": </div>\n"; |
| | 202 | $html .= "<div class='admin_element_data'>\n"; |
| | 203 | $name = "shoutbox_{this->getId()}_display_num_items"; |
| | 204 | $html .= "<input type='text' size='6' value='$displayNumItems' name='$name'>\n"; |
| | 205 | $html .= "</div>\n"; |
| | 206 | $html .= "</li>\n"; |
| | 207 | |
| | 208 | /*max_shout_chars*/ |
| | 209 | $maxShoutChars = $this->getMaxShoutChars(); |
| | 210 | $html .= "<li class='admin_element_item_container'>\n"; |
| | 211 | $html .= "<div class='admin_element_label'>" . ("Maximum number of characters for each shouts (0 means no limit)") . ": </div>\n"; |
| | 212 | $html .= "<div class='admin_element_data'>\n"; |
| | 213 | $name = "shoutbox_{this->getId()}_max_num_chars"; |
| | 214 | $html .= "<input type='text' size='6' value='$maxShoutChars' name='$name'>\n"; |
| | 215 | $html .= "</div>\n"; |
| | 216 | $html .= "</li>\n"; |
| | 217 | |
| | 218 | /*shout_field_size*/ |
| | 219 | $shoutFieldSize = $this->getShoutFieldSize(); |
| | 220 | $html .= "<li class='admin_element_item_container'>\n"; |
| | 221 | $html .= "<div class='admin_element_label'>" . ("Size (num characters) of the shout field") . ": </div>\n"; |
| | 222 | $html .= "<div class='admin_element_data'>\n"; |
| | 223 | $name = "shoutbox_{this->getId()}_shout_field_size"; |
| | 224 | $html .= "<input type='text' size='6' value='$shoutFieldSize' name='$name'>\n"; |
| | 225 | $html .= "</div>\n"; |
| | 226 | $html .= "</li>\n"; |
| | 227 | |
| | 228 | /* OnclickContent */ |
| | 229 | $criteria_array = array ( |
| | 230 | array ('isTextualContent'), |
| | 231 | array ('isSimpleContent') |
| | 232 | ); |
| | 233 | |
| | 234 | $onclick_allowed_content_types = ContentTypeFilter :: getObject($criteria_array); |
| | 235 | |
| | 236 | |
| | 237 | $content = $this->getOnClickContent(); |
| | 238 | $html .= "<li class='admin_element_item_container admin_section_edit_description'>\n"; |
| | 239 | $html .= "<div class='admin_element_data'>\n"; |
| | 240 | $onclick_title = _("Shout button 'onclick=' value (optionnal):"); |
| | 241 | if (!$content) { |
| | 242 | $name = "shoutbox_" . $this->id . "_onclick_content_new"; |
| | 243 | $html .= self :: getNewContentUI($name, $onclick_allowed_content_types, $onclick_title); |
| | 244 | $html .= $hint; |
| | 245 | } else { |
| | 246 | $html .= $content->getAdminUI(null, $onclick_title); |
| | 247 | $html .= "<div class='admin_section_hint'>" . sprintf(_("Note that the onclick parameter will appear inside double quotes in html. They must be properly encoded fot that context. You can access the shout text in Javascript with: %s"), "document.getElementById('shout_text').value") . "</div>\n"; |
| | 248 | $html .= "</div>\n"; |
| | 249 | $html .= "<div class='admin_element_tools'>\n"; |
| | 250 | $name = "shoutbox_" . $this->id . "_onclick_content_erase"; |
| | 251 | $html .= "<input type='submit' class='submit' name='$name' value='" . sprintf(_("Delete %s (%s)"), _("onclick parameter"), get_class($content)) . "'>"; |
| | 252 | |
| | 253 | } |
| | 254 | $html .= "</div>\n"; |
| | 255 | $html .= "</li>\n"; |
| | 256 | return parent :: getAdminUI($html, $title); |
| | 257 | } |
| | 258 | |
| | 259 | /** |
| | 260 | * Processes the input of the administration interface for Picture |
| | 261 | * |
| | 262 | * @return void |
| | 263 | */ |
| 265 | | $db=AbstractDb::getObject(); |
| 266 | | if ($this->isOwner(User :: getCurrentUser()) || User :: getCurrentUser()->isSuperAdmin()) { |
| 267 | | parent :: processAdminUI(); |
| 268 | | |
| 269 | | /*display_num_items*/ |
| 270 | | $name = "shoutbox_{this->getId()}_display_num_items"; |
| 271 | | $this->setDisplayNumItems($_REQUEST[$name]); |
| 272 | | |
| 273 | | /*max_shout_chars*/ |
| 274 | | $name = "shoutbox_{this->getId()}_max_num_chars"; |
| 275 | | $this->setMaxShoutChars($_REQUEST[$name]); |
| 276 | | |
| 277 | | /*shout_field_size*/ |
| 278 | | $name = "shoutbox_{this->getId()}_shout_field_size"; |
| 279 | | $this->setShoutFieldSize($_REQUEST[$name]); |
| 280 | | |
| 281 | | /* OnclickContent */ |
| 282 | | $content = $this->getOnClickContent(); |
| 283 | | if (!$content) { |
| 284 | | $name = "shoutbox_" . $this->id . "_onclick_content_new"; |
| 285 | | $content = self :: processNewContentUI($name); |
| 286 | | $this->setOnClickContent($content); |
| 287 | | } else { |
| 288 | | $name = "shoutbox_" . $this->id . "_onclick_content_erase"; |
| 289 | | |
| 290 | | if (!empty ($_REQUEST[$name]) && $_REQUEST[$name] == true) { |
| 291 | | $this->setOnClickContent(null); |
| 292 | | $content->delete($errmsg); |
| 293 | | } else { |
| 294 | | $content->processAdminUI(); |
| 295 | | } |
| 296 | | } |
| 297 | | } |
| 298 | | } |
| 299 | | |
| 300 | | /** Retreives the user interface of this object. Anything that overrides this method should call the parent method with it's output at the END of processing. |
| 301 | | * @return The HTML fragment for this interface */ |
| 302 | | public function getUserUI() { |
| | 265 | $db=AbstractDb::getObject(); |
| | 266 | if ($this->isOwner(User :: getCurrentUser()) || User :: getCurrentUser()->isSuperAdmin()) { |
| | 267 | parent :: processAdminUI(); |
| | 268 | |
| | 269 | /*display_num_items*/ |
| | 270 | $name = "shoutbox_{this->getId()}_display_num_items"; |
| | 271 | $this->setDisplayNumItems($_REQUEST[$name]); |
| | 272 | |
| | 273 | /*max_shout_chars*/ |
| | 274 | $name = "shoutbox_{this->getId()}_max_num_chars"; |
| | 275 | $this->setMaxShoutChars($_REQUEST[$name]); |
| | 276 | |
| | 277 | /*shout_field_size*/ |
| | 278 | $name = "shoutbox_{this->getId()}_shout_field_size"; |
| | 279 | $this->setShoutFieldSize($_REQUEST[$name]); |
| | 280 | |
| | 281 | /* OnclickContent */ |
| | 282 | $content = $this->getOnClickContent(); |
| | 283 | if (!$content) { |
| | 284 | $name = "shoutbox_" . $this->id . "_onclick_content_new"; |
| | 285 | $content = self :: processNewContentUI($name); |
| | 286 | $this->setOnClickContent($content); |
| | 287 | } else { |
| | 288 | $name = "shoutbox_" . $this->id . "_onclick_content_erase"; |
| | 289 | |
| | 290 | if (!empty ($_REQUEST[$name]) && $_REQUEST[$name] == true) { |
| | 291 | $this->setOnClickContent(null); |
| | 292 | $content->delete($errmsg); |
| | 293 | } else { |
| | 294 | $content->processAdminUI(); |
| | 295 | } |
| | 296 | } |
| | 297 | } |
| | 298 | } |
| | 299 | |
| | 300 | /** Retreives the user interface of this object. Anything that overrides this method should call the parent method with it's output at the END of processing. |
| | 301 | * @return The HTML fragment for this interface */ |
| | 302 | public function getUserUI() { |
| 308 | | $formHtml .= "<form action='".BASE_URL_PATH."content/ShoutBox/add_message.php'>\n"; |
| 309 | | $formHtml .= "<input type='hidden' name='shoutbox_id' value='".$this->getId()."'/>\n"; |
| 310 | | //$html .= "destination_url: ";pretty_print_r($_SERVER); |
| 311 | | $maxShoutChars = $this->getMaxShoutChars(); |
| 312 | | $shoutFieldSize = $this->getShoutFieldSize(); |
| 313 | | if($maxShoutChars>0) { |
| 314 | | $max_size = "maxlength='$maxShoutChars'"; |
| 315 | | $maxShoutChars<=$shoutFieldSize?$size="size='$maxShoutChars'":$size="size='$shoutFieldSize'"; |
| 316 | | } |
| 317 | | else { |
| 318 | | $max_size = null; |
| 319 | | $size = "size='$shoutFieldSize'"; |
| 320 | | } |
| 321 | | $formHtml .= "<input type='hidden' name='node_id' value='".$node->getId()."'/>\n"; |
| 322 | | $formHtml .= "<input type='text' name='shout_text' id='shout_text' $size $max_size value=''/>\n"; |
| 323 | | $onclick_content = $this->getOnClickContent(); |
| 324 | | if($onclick_content){ |
| 325 | | $onclick="onclick=\"".$onclick_content->getString()."\""; |
| 326 | | } else |
| 327 | | { |
| 328 | | $onclick = null; |
| 329 | | } |
| 330 | | $formHtml .= "<input type='submit' name='shout_submit' $onclick value='"._("Shout!")."'>\n"; |
| 331 | | $formHtml .= "</form>\n"; |
| | 308 | $formHtml .= "<form action='".BASE_URL_PATH."content/ShoutBox/add_message.php'>\n"; |
| | 309 | $formHtml .= "<input type='hidden' name='shoutbox_id' value='".$this->getId()."'/>\n"; |
| | 310 | //$html .= "destination_url: ";pretty_print_r($_SERVER); |
| | 311 | $maxShoutChars = $this->getMaxShoutChars(); |
| | 312 | $shoutFieldSize = $this->getShoutFieldSize(); |
| | 313 | if($maxShoutChars>0) { |
| | 314 | $max_size = "maxlength='$maxShoutChars'"; |
| | 315 | $maxShoutChars<=$shoutFieldSize?$size="size='$maxShoutChars'":$size="size='$shoutFieldSize'"; |
| | 316 | } |
| | 317 | else { |
| | 318 | $max_size = null; |
| | 319 | $size = "size='$shoutFieldSize'"; |
| | 320 | } |
| | 321 | $formHtml .= "<input type='hidden' name='node_id' value='".$node->getId()."'/>\n"; |
| | 322 | $formHtml .= "<input type='text' name='shout_text' id='shout_text' $size $max_size value=''/>\n"; |
| | 323 | $onclick_content = $this->getOnClickContent(); |
| | 324 | if($onclick_content){ |
| | 325 | $onclick="onclick=\"".$onclick_content->getString()."\""; |
| | 326 | } else |
| | 327 | { |
| | 328 | $onclick = null; |
| | 329 | } |
| | 330 | $formHtml .= "<input type='submit' name='shout_submit' $onclick value='"._("Shout!")."'>\n"; |
| | 331 | $formHtml .= "</form>\n"; |