예제 #1
0
 /**
  * Constructor Box
  * @param object|string $title title in the header the box
  * @param boolean $shadow if box has shadow [default value: false]
  * @param string $style_header style of the header (Box::STYLE_MAIN or Box::STYLE_SECOND) [default value: 1]
  * @param string $style_content style of the content (Box::STYLE_MAIN or Box::STYLE_SECOND) [default value: 1]
  * @param string $link heander title link
  * @param string $id unique id of the box [default value: main_box]
  * @param string $width width of the box [default value: 100%]
  * @param string $height height of the box
  * @param string $move if box can be move [default value: false]
  */
 function __construct($title, $shadow = false, $style_header = '1', $style_content = '1', $link = '', $id = 'main_box', $width = '100%', $height = "", $move = false)
 {
     parent::__construct();
     if (!isset($title)) {
         throw new NewException("1 argument for " . get_class($this) . "::__construct() is mandatory", 0, getDebugBacktrace(1));
     }
     $this->is_browser_ie_6 = is_browser_ie_6();
     $this->browser_ie_version = get_browser_ie_version();
     $this->title = $title;
     if ($this->is_browser_ie_6) {
         $this->shadow = false;
     } else {
         $this->shadow = $shadow;
     }
     $this->style_header = $style_header;
     $this->style_content = $style_content;
     $this->link = $link;
     $this->id = $id;
     $this->move = $move;
     $this->width = $width;
     $this->height = $height;
     $this->tagH = "";
     $this->css3 = $this->getPage()->isCss3Browser();
     $this->browser_name = strtolower($browser['browser']);
     $this->browser_version = $browser['version'];
     CssInclude::getInstance()->loadCssConfigFileInMemory(false);
     if (constant("DEFINE_STYLE_BCK_PICTURE_" . strtoupper($this->style_header)) == "") {
         $this->force_box_with_picture = false;
     }
     $this->box_border_color = constant("DEFINE_STYLE_BORDER_TABLE_" . strtoupper($this->style_header));
     if (!defined('DEFINE_STYLE_GRADIENT_' . strtoupper($this->style_header))) {
         define("DEFINE_STYLE_GRADIENT_" . strtoupper($this->style_header), false);
     }
     $this->box_gradient = constant("DEFINE_STYLE_GRADIENT_" . strtoupper($this->style_header));
     if (!defined('DEFINE_STYLE_OMBRE_COLOR_' . strtoupper($this->style_header))) {
         define("DEFINE_STYLE_OMBRE_COLOR_" . strtoupper($this->style_header), DEFINE_STYLE_OMBRE_COLOR);
     }
     $this->shadow_color = constant("DEFINE_STYLE_OMBRE_COLOR_" . strtoupper($this->style_header));
     if (!$this->getPage()->isAjaxPage() && !$this->getPage()->isAjaxLoadPage()) {
         $this->addCss(BASE_URL . "wsp/css/angle.css.php", "", true);
     }
 }
예제 #2
0
 /**
  * Method getAjaxRender
  * @access public
  * @return string javascript code to update initial html of object Table (call with AJAX)
  * @since 1.0.93
  */
 public function getAjaxRender()
 {
     $html = "";
     if ($this->object_change && !$this->is_new_object_after_init) {
         if ($this->ajax_refresh_all_table) {
             // refresh all table
             if ($this->is_advance_table || is_browser_ie() && get_browser_ie_version() < 8) {
                 $html .= "var my_parent_node = \$('#" . $this->id . "').parent();";
             } else {
                 $html .= "var my_parent_node = \$('#" . $this->id . "');";
             }
             $html .= "my_parent_node.empty();";
             $array_ajax_render = extract_javascript($this->render(false));
             for ($j = 1; $j < sizeof($array_ajax_render); $j++) {
                 new JavaScript($array_ajax_render[$j], true);
             }
             if (trim($array_ajax_render[0]) != "") {
                 $html .= "my_parent_node.append('" . str_replace("\n", "", str_replace("\r", "", addslashes($array_ajax_render[0]))) . "');";
             }
         } else {
             for ($i = 0; $i < sizeof($this->rows); $i++) {
                 if ($this->rows[$i]->isNew()) {
                     $array_ajax_render = extract_javascript($this->rows[$i]->render(false));
                     for ($j = 1; $j < sizeof($array_ajax_render); $j++) {
                         new JavaScript($array_ajax_render[$j], true);
                     }
                     $html .= "\$('#" . $this->id . "').append('" . str_replace("\n", "", str_replace("\r", "", addslashes($array_ajax_render[0]))) . "');";
                 } else {
                     if ($this->rows[$i]->isDeleted()) {
                         $html .= "\$('#wsp_rowtable_" . $this->rows[$i]->getId() . "').remove();";
                     }
                 }
             }
         }
     }
     if ($html != "" && $this->id == "") {
         throw new NewException(get_class($this) . "->getAjaxRender() error: To update this object with Ajax event you must define an id (" . get_class($this) . "->setId())", 0, getDebugBacktrace(1));
     }
     return $html;
 }
예제 #3
0
 /**
  * Method enableThirdPartyCookiesFilter
  * @access public
  * @param string $disabled_services_rgb [default value: 48,48,48]
  * @param string $color_text [default value: white]
  * @param string $position [default value: bottom]
  * @param boolean $adblocker [default value: true]
  * @param boolean $cookieslist [default value: true]
  * @return Page
  * @since 1.2.13
  */
 public function enableThirdPartyCookiesFilter($disabled_services_rgb = '48,48,48', $color_text = 'white', $position = 'bottom', $adblocker = true, $cookieslist = true)
 {
     if ($this->cookies_accept_message) {
         throw new NewException("The cookies accept message is already activated. You cannot used the third party cookies filter feature.", 0, getDebugBacktrace(1));
     }
     $this->third_party_cookies_filter = true;
     $this->third_party_cookies_filter_position = $position;
     $this->third_party_cookies_filter_adblocker = $adblocker;
     $this->third_party_cookies_filter_cookieslist = $cookieslist;
     if (!$this->isAjaxPage() && !$this->isAjaxLoadPage()) {
         JavaScriptInclude::getInstance()->add("wsp/js/tarteaucitron/tarteaucitron.js");
         if ($disabled_services_rgb != "" && $disabled_services_rgb != "48,48,48") {
             $is_ie8 = false;
             if (is_browser_ie() && get_browser_ie_version() < 9) {
                 $is_ie8 = true;
             }
             $this->addObject(new JavaScript("var rgb = '" . $disabled_services_rgb . "';var colorText = '" . $color_text . "';\nvar customTheme = document.createElement('style'),\ncssRule = '#tarteaucitron #tarteaucitronServices .tarteaucitronMainLine .tarteaucitronName a, #tarteaucitron #tarteaucitronServices .tarteaucitronTitle a {color: ' + colorText + ' !important}#tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesList .tarteaucitronCookiesListMain:hover, #tarteaucitron #tarteaucitronServices .tarteaucitronLine:hover {background: " . ($is_ie8 ? "rgb" : "rgba") . "(' + rgb + '" . ($is_ie8 ? "" : ", 0.20") . ") !important;}#tarteaucitron #tarteaucitronServices .tarteaucitronHidden, #tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesList .tarteaucitronHidden {background: " . ($is_ie8 ? "rgb" : "rgba") . "(' + rgb + '" . ($is_ie8 ? "" : ", 0.07") . ") !important}#tarteaucitron .tarteaucitronBorder, #tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesList .tarteaucitronCookiesListMain, #tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesList, #tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesList .tarteaucitronHidden, #tarteaucitron #tarteaucitronServices .tarteaucitronMainLine {border-color:rgb(' + rgb + ') !important}#tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesList .tarteaucitronCookiesListMain, #tarteaucitron #tarteaucitronServices .tarteaucitronLine {background: " . ($is_ie8 ? "rgb" : "rgba") . "(' + rgb + '" . ($is_ie8 ? "" : ", 0.1") . ") !important}#tarteaucitron #tarteaucitronServices .tarteaucitronMainLine .tarteaucitronName b, #tarteaucitronAlertBig #tarteaucitronDisclaimerAlert b, #tarteaucitronAlertSmall #tarteaucitronCookiesNumber, #tarteaucitronAlertSmall #tarteaucitronManager, #tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesTitle b, #tarteaucitron #tarteaucitronInfo a {color:' + colorText + ' !important}#tarteaucitron #tarteaucitronServices .tarteaucitronMainLine, #tarteaucitronAlertBig, #tarteaucitronAlertBig #tarteaucitronDisclaimerAlert, #tarteaucitronAlertSmall, .tac_activate, .tac_activate .tac_float, .tac_activate .tac_float b, #tarteaucitron #tarteaucitronClosePanel, #tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronClosePanelCookie, #tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesTitle, #tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesTitle:hover, #tarteaucitron #tarteaucitronInfo, #tarteaucitron #tarteaucitronServices .tarteaucitronDetails, #tarteaucitron #tarteaucitronServices .tarteaucitronTitle, #tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesList .tarteaucitronTitle, #tarteaucitron #tarteaucitronServices .tarteaucitronMainLine:hover {background: rgb(' + rgb + ') !important;color:' + colorText + ' !important}#tarteaucitronAlertBig #tarteaucitronCloseAlert {color: rgb(' + rgb + ') !important;background:' + colorText + ' !important}';\ncustomTheme.type = 'text/css';\nif (customTheme.styleSheet) {\n    customTheme.styleSheet.cssText = cssRule;\n} else {\n    customTheme.appendChild(document.createTextNode(cssRule));\n}\ndocument.getElementsByTagName('body')[0].appendChild(customTheme)"), true);
         }
     }
     return $this;
 }
예제 #4
0
 private function changeStyleSheetProperty($css_file_name, $array_properties, $property, $value, $display_rule_error = true)
 {
     for ($i = 0; $i < sizeof($array_properties); $i++) {
         if (is_browser_ie() && get_browser_ie_version() < 9) {
             $array_sub_properties = split(',', $array_properties[$i]);
         } else {
             $array_sub_properties = array($array_properties[$i]);
         }
         for ($j = 0; $j < sizeof($array_sub_properties); $j++) {
             $this->addObject(new JavaScript("changeStyleSheetProperty('" . $css_file_name . "', '" . $array_sub_properties[$j] . "', '" . $property . "', '" . addslashes($value) . "', " . ($display_rule_error ? "true" : "false") . ");"));
         }
     }
 }
예제 #5
0
 /**
  * Constructor RoundBox
  * @param string $style_content style of the content (Box::STYLE_MAIN or Box::STYLE_SECOND) [default value: 1]
  * @param string $id unique id of the box [default value: main_box]
  * @param string $width width of the box [default value: 100%]
  * @param string $height height of the bo
  * @param string $move if box can be move [default value: false]
  */
 function __construct($style_content = '1', $id = 'main_box', $width = '100%', $height = "", $move = false)
 {
     parent::__construct();
     $this->is_browser_ie_6 = is_browser_ie_6();
     $this->browser_ie_version = get_browser_ie_version();
     $this->style_content = $style_content;
     $this->id = $id;
     $this->move = $move;
     $this->width = $width;
     $this->height = $height;
     $this->css3 = $this->getPage()->isCss3Browser();
     CssInclude::getInstance()->loadCssConfigFileInMemory(false);
     if (constant("DEFINE_STYLE_BCK_PICTURE_" . strtoupper($this->style_content)) == "") {
         $this->force_box_with_picture = false;
     }
     $this->box_border_color = constant("DEFINE_STYLE_BORDER_TABLE_" . strtoupper($this->style_content));
     if (!defined('DEFINE_STYLE_GRADIENT_' . strtoupper($this->style_content))) {
         define("DEFINE_STYLE_GRADIENT_" . strtoupper($this->style_content), false);
     }
     $this->box_gradient = constant("DEFINE_STYLE_GRADIENT_" . strtoupper($this->style_content));
     if (!defined('DEFINE_STYLE_OMBRE_COLOR_' . strtoupper($this->style_header))) {
         define("DEFINE_STYLE_OMBRE_COLOR_" . strtoupper($this->style_header), DEFINE_STYLE_OMBRE_COLOR);
     }
     $this->shadow_color = constant("DEFINE_STYLE_OMBRE_COLOR_" . strtoupper($this->style_header));
     if (!$this->getPage()->isAjaxPage() && !$this->getPage()->isAjaxLoadPage()) {
         $this->addCss(BASE_URL . "wsp/css/angle.css.php", "", true);
     }
 }
예제 #6
0
 /**
  * Method render
  * @access public
  * @param boolean $ajax_render [default value: false]
  * @return string html code of object UploadFile
  * @since 1.2.3
  */
 public function render($ajax_render = false)
 {
     $html = "";
     // check if the UploadFile is linked to a Form with Ajax button
     if ($this->form_object != null) {
         $array_form_object = $this->form_object->getFormObjects();
         for ($i = 0; $i < sizeof($array_form_object); $i++) {
             if (get_class($array_form_object[$i]) == "Button") {
                 if ($array_form_object[$i]->isAjaxEvent()) {
                     throw new NewException(get_class($this) . " error: You cannot use ajax event on a Button if you include " . get_class($this) . " in a Form object.", 0, getDebugBacktrace(1));
                     break;
                 }
             }
         }
     }
     // check if the UploadFile is used in AjaxLoadPage (Tabs, DialogBox)
     if ($this->getPage()->isAjaxLoadPage()) {
         // In this case UploadFile need to be sublit with ajax event
         if (!$this->is_ajax_event) {
             throw new NewException(get_class($this) . " error: You need to use " . get_class($this) . " with ajax event (" . get_class($this) . "->setAjaxEvent()) when loaded in AjaxLoadPage (Tabs, DialogBox).", 0, getDebugBacktrace(1));
         }
         if ($this->form_object != null) {
             throw new NewException(get_class($this) . " error: You cannot use " . get_class($this) . " in a Form object when loaded in AjaxLoadPage (Tabs, DialogBox).", 0, getDebugBacktrace(1));
         }
     }
     if (sizeof($this->callback_onchange_params) > 0) {
         $args = $this->callback_onchange_params;
         $str_function = array_shift($args);
         $this->callback_onchange = $this->loadCallbackMethod($str_function, $args);
     }
     if ($this->callback_onchange != "") {
         $html .= "<input type='hidden' id='Callback_" . $this->getEventObjectName() . "' name='Callback_" . $this->getEventObjectName() . "' value=''/>\n";
     }
     if ($this->is_ajax_event) {
         $html .= $this->getJavascriptTagOpen();
         $html .= $this->getAjaxEventFunctionRender();
         $html .= $this->getJavascriptTagClose();
     }
     if ($this->button_value == "") {
         if ($this->is_multiple) {
             $this->button_value = __(WSP_BTN_UPLOAD_FILES);
         } else {
             $this->button_value = __(WSP_BTN_UPLOAD_FILE);
         }
     }
     // Generate HTML
     if ($this->object_drop_zone == null || is_browser_ie() && get_browser_ie_version() <= 9) {
         if ($this->select_file_icon == "" || gettype($this->select_file_icon) != "object" || get_class($this->select_file_icon) != "Picture") {
             if (!is_browser_ie()) {
                 $html .= "<span class=\"UploadFile\">";
                 $html .= "<input type=\"text\" id=\"UploadFile_Path_" . $this->id . "\" disabled/>";
                 $html .= "<label id=\"UploadFile_Button_" . $this->id . "\" class=\"button";
                 if ($this->class != "") {
                     $html .= " " . $this->class;
                 }
                 $html .= "\"";
                 if ($this->tooltip != "") {
                     $html .= " title=\"" . $this->tooltip . "\"";
                 }
                 $html .= ">" . $this->button_value . "</label><input type='file' name='" . $this->getEventObjectName() . ($this->is_multiple ? "[]" : "") . "' id='" . $this->id . "' class='UploadFileInput'";
                 if ($this->is_multiple) {
                     $html .= " multiple";
                 }
                 $html .= "/>";
                 $html .= "</span>";
             } else {
                 $html .= "<input type='file' name='" . $this->getEventObjectName() . ($this->is_multiple ? "[]" : "") . "' id='" . $this->id . "'";
                 if ($this->is_multiple) {
                     $html .= " multiple";
                 }
                 if ($this->width != "") {
                     $html .= " style=\"width:";
                     if (is_integer($this->width)) {
                         $html .= $this->width . "px";
                     } else {
                         $html .= $this->width;
                     }
                     $html .= ";\"";
                 }
                 if ($this->class != "") {
                     $html .= " class='" . $this->class . "'";
                 }
                 if ($this->tooltip != "") {
                     $html .= " title='" . $this->tooltip . "'";
                 }
                 $html .= "/>";
             }
         } else {
             $html .= "<input type='file' name='" . $this->getEventObjectName() . ($this->is_multiple ? "[]" : "") . "' id='" . $this->id . "'";
             if ($this->is_multiple) {
                 $html .= " multiple";
             }
             $html .= " style='display:none;'/>";
             $html .= $this->select_file_icon->render($ajax_render);
         }
         $html .= $this->getJavascriptTagOpen();
         if (!is_browser_ie() && $this->select_file_icon == "") {
             $html .= "\$('#UploadFile_Button_" . $this->id . "').click(function(event){\n";
             $html .= "\t\$('#" . $this->id . "').click();\n";
             $html .= "});\n";
             if ($this->width != "") {
                 $html .= "\$('#UploadFile_Path_" . $this->id . "').css('width', (";
                 if (is_integer($this->width)) {
                     $html .= $this->width;
                 } else {
                     $html .= trim(str_replace("px", "", $this->width));
                 }
                 $html .= " - myReplace(\$('#UploadFile_Button_" . $this->id . "').css('width'), 'px', '')) + 'px');\n";
             }
         }
         $html .= "\$('#" . $this->id . "').change(function(){\n";
         if (!is_browser_ie()) {
             $html .= "\tvar current_file = myReplaceAll(\$(this).val(), '\\\\', '/').split('/');\n";
             $html .= "\tcurrent_file = current_file[current_file.length-1];\n";
             $html .= "\t\$('#UploadFile_Path_" . $this->id . "').val(current_file);\n";
         }
         if ($this->onchange != "" || $this->callback_onchange != "") {
             $html .= "\t" . str_replace("\n", "", $this->getObjectEventValidationRender($this->onchange, $this->callback_onchange)) . "\n";
         }
         $html .= "});";
         $html .= $this->getJavascriptTagClose();
     } else {
         $html .= $this->object_drop_zone->render($ajax_render);
         $html .= "<input type='file' name='" . $this->getEventObjectName() . ($this->is_multiple ? "[]" : "") . "' id='" . $this->id . "' style='display:none;'/>";
         $html .= $this->getJavascriptTagOpen();
         $html .= "\$(document).on('dragenter', '#" . $this->object_drop_zone->getId() . "', function() {\n                \$(this).css('border', '" . $this->drop_zone_over_style . "');\n                return false;\n            });\n\n            \$(document).on('dragover', '#" . $this->object_drop_zone->getId() . "', function(e){\n                e.preventDefault();\n                e.stopPropagation();\n                \$(this).css('border', '" . $this->drop_zone_over_style . "');\n                return false;\n            });\n\n            \$(document).on('dragleave', '#" . $this->object_drop_zone->getId() . "', function(e) {\n                e.preventDefault();\n                e.stopPropagation();\n";
         if ($this->object_drop_zone->getStyle() != "") {
             $html .= "\$(this).attr('style', '" . $this->object_drop_zone->getStyle() . "');\n";
         }
         $html .= "return false;\n            });\n            \$(document).on('drop', '#" . $this->object_drop_zone->getId() . "', function(e) {\n                if(e.originalEvent.dataTransfer){\n                   if(e.originalEvent.dataTransfer.files.length) {\n                       e.preventDefault();\n                       e.stopPropagation();\n";
         $html .= "document.getElementById('" . $this->id . "').files = e.originalEvent.dataTransfer.files;\n";
         $html .= str_replace("\n", "", $this->getObjectEventValidationRender($this->onchange, $this->callback_onchange)) . "\n";
         $html .= "}\n                }\n";
         if ($this->object_drop_zone->getStyle() != "") {
             $html .= "\$(this).attr('style', '" . $this->object_drop_zone->getStyle() . "');\n";
         }
         $html .= "return false;\n            });";
         $html .= $this->getJavascriptTagClose();
     }
     $this->object_change = false;
     return $html;
 }