public function testPut()
 {
     $picture = new Picture();
     $picture->setId(1);
     $picture->setTitle('announcement_1_1');
     $picture->setPath('/announcement/original/');
     $picture->setAlternative('Un texte alternatif modifié');
     $picture->setIdAnnouncement(10);
     $picture->setExtension('gif');
     $pictureMapper = new PictureMapper();
     $pictureMapper->setId(1);
     $pictureMapper->updatePicture($picture);
     $this->assertEquals($picture, $pictureMapper->selectPicture());
 }
 /**
  * Method getAjaxEventFunctionRender
  * @access protected
  * @return string
  * @since 1.0.35
  */
 protected function getAjaxEventFunctionRender()
 {
     $html = "";
     $loading_obj = null;
     if (get_class($this) == "UploadFile") {
         $loading_obj = $this->getProgressBarObject();
         if ($this->isSizeLimitJsCheckActivated() && $this->getFileSizeLimit() != -1) {
             $size_alert = new DialogBox(__(ERROR), __(UPLOAD_FILESIZE_LIMIT_ERROR_MSG, $this->getFileSizeLimitStr()));
             $size_alert->activateCloseButton()->setWidth(500);
             $size_alert->setDialogBoxLevel(rand(90000, 99999));
             $html .= "var displaySizeErrorDialogBox" . get_class($this) . "_" . $this->getEventObjectName() . " = function(filename) {\n";
             $html .= $size_alert->render();
             $html .= "};\n";
         } else {
             $html .= "var displaySizeErrorDialogBox" . get_class($this) . "_" . $this->getEventObjectName() . " = null;\n";
         }
         if ($this->isMimeTypeJsCheckActivated() && sizeof($this->getAuthorizedMimeTypes()) > 0) {
             $mime_alert = new DialogBox(__(ERROR), __(UPLOAD_MIME_TYPES_ERROR_MSG, implode(", ", $this->getAuthorizedMimeTypes())));
             $mime_alert->activateCloseButton()->setWidth(500);
             $mime_alert->setDialogBoxLevel(rand(90000, 99999));
             $html .= "var displayMimeErrorDialogBox" . get_class($this) . "_" . $this->getEventObjectName() . " = function(filename, mime_type) {\n";
             $html .= $mime_alert->render();
             $html .= "};\n";
         } else {
             $html .= "var displayMimeErrorDialogBox" . get_class($this) . "_" . $this->getEventObjectName() . " = null;\n";
         }
     }
     if (gettype($this->ajax_wait_message) != "object") {
         $loading_img = new Picture("wsp/img/loading.gif", 32, 32);
         $loading_img->setId("wspAjaxEventLoadingPic" . get_class($this) . "_" . $this->getEventObjectName());
         $loading_modalbox = new DialogBox(__(LOADING), new Object($this->ajax_wait_message, "<br/>", $loading_img, $loading_obj));
         $loading_modalbox->setDialogBoxLevel(rand(90000, 99999))->modal();
     }
     $error_alert = new DialogBox(__(ERROR), __(SUBMIT_ERROR));
     $error_alert->activateCloseButton()->setWidth(500);
     $error_alert->setDialogBoxLevel(rand(90000, 99999));
     $error_unknow_alert = new DialogBox(__(ERROR), __(SUBMIT_UNKNOW_ERROR));
     $error_unknow_alert->activateCloseButton()->setWidth(400);
     $error_unknow_alert->setDialogBoxLevel(rand(90000, 99999));
     $html .= "\tvar isRequestedAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " = false;\n";
     $html .= "\tvar lastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . " = Array();\n";
     $html .= "\tvar nbAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . " = 0;\n";
     if ($this->is_ajax_event) {
         $html .= "\tvar encryptedObjectValueArray" . get_class($this) . "_" . $this->getEventObjectName() . " = Array();\n";
     }
     $html .= "\tcallAjax" . get_class($this) . "_" . $this->getEventObjectName() . "_event = function(callback_value, abort_last_request) {\n";
     $html .= "\t\tif (isRequestedAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " && !abort_last_request) { return; }\n";
     $html .= "\t\tisRequestedAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " = true;\n";
     $html .= "\t\tnbAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . "++;\n";
     if (!$this->disable_ajax_wait_message) {
         if (gettype($this->ajax_wait_message) == "object") {
             $html .= "\t\t\$('#" . $this->ajax_wait_message->getId() . "').css('display', 'block');\n";
         } else {
             $html .= "\t\t" . $loading_modalbox->render() . "\n";
         }
         $html .= "\t\tsetTimeout(\"requestAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . "(\\\"\" + callback_value + \"\\\", \" + abort_last_request + \");\", " . (gettype($this->ajax_wait_message) == "object" ? "1" : "1000") . ");\n";
     } else {
         $html .= "\t\tsetTimeout(\"requestAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . "(\\\"\" + callback_value + \"\\\", \" + abort_last_request + \");\", (abort_last_request?(lastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . ".length==0?1:200):1));\n";
     }
     $html .= "\t};\n";
     $html .= "\trequestAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " = function(callback_value, abort_last_request) {\n";
     $html .= "\t\tnbAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . "--;\n";
     $html .= "\t\tif (abort_last_request) { for (var i=0; i < lastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . ".length; i++) { if (lastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . "[i]!=null) { lastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . "[i].abort(); lastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . "[i]=null; } } if (nbAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . " > 0) { return; } }\n";
     // encrypt formular if encrypt is active
     if ($this->form_object != null) {
         $html .= "\t\t" . $this->encryptObjectData($this->form_object, "isRequestedAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " = false;" . ($loading_modalbox == null ? "" : $loading_modalbox->close()->render()));
     }
     if (get_class($this) == "UploadFile") {
         $html .= "var upload_status = \$('#" . $this->getId() . "').upload('";
     } else {
         $html .= "\t\tlastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . "[lastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . ".length] = \$.ajax({ type: '";
         if ($this->form_object != null) {
             $html .= $this->form_object->getMethod();
         } else {
             $html .= "POST";
         }
         $html .= "', url: '";
     }
     $html .= BASE_URL . LANGUAGE_URL . "/ajax/";
     if ($this->form_object == null) {
         $html .= $this->getPage()->getPage() . ".html";
         if (PARAMS_URL != "") {
             $pos = find(PARAMS_URL, "?", 0, $pos);
             if ($pos > 0) {
                 $pos2 = strlen(PARAMS_URL);
                 $html .= "?" . substr(PARAMS_URL, $pos, $pos2 - $pos);
             }
         }
     } else {
         if ($this->form_object->getAction() == "") {
             $html .= $this->form_object->getPageObject()->getPage() . ".html";
             if (PARAMS_URL != "") {
                 $pos = find(PARAMS_URL, "?", 0, $pos);
                 if ($pos > 0) {
                     $pos2 = strlen(PARAMS_URL);
                     $html .= "?" . substr(PARAMS_URL, $pos, $pos2 - $pos);
                 }
             }
         } else {
             $html .= $this->form_object->getAction();
         }
     }
     $html .= "',\n";
     if (get_class($this) == "UploadFile") {
         $html .= "\t\t\t\$('#Callback_" . $this->getEventObjectName() . "').serialize(),\n";
     } else {
         if ($this->form_object != null) {
             $html .= "\t\t\tdata: ";
             if ($this->form_object->isEncrypted()) {
                 $html .= "encrypt_data";
             } else {
                 $html .= "\$('#" . $this->form_object->getId() . "').serialize() + '&Callback_" . $this->getEventObjectName() . "=' + callback_value";
             }
             $html .= ",\n";
         } else {
             $html .= "\t\t\tdata: 'Callback_" . $this->getEventObjectName() . "=' + callback_value,\n";
         }
         $html .= "\t\t\tdataType: 'json',\n";
         $html .= "\t\t\tsuccess: ";
     }
     $html .= "function(ajax_event_response) {\n";
     $html .= "\t\t\t\tisRequestedAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " = false;\n";
     $html .= "\t\t\t\tif (ajax_event_response != \"\") {\n";
     $html .= "\t\t\t\t\tvar dialogbox_is_change = false;\n";
     if (isLocalDebug()) {
         $html .= "\t\t\t\t\tvar alert_local_eval_error = true;\n";
     }
     $html .= "\t\t\t\t\tfor (var ajax_event_ind=0; ajax_event_ind < ajax_event_response.length; ajax_event_ind++) {\n";
     if (!$this->disable_ajax_wait_message) {
         $html .= "\t\t\t\t\t\tif (ajax_event_response[ajax_event_ind] != null && ajax_event_response[ajax_event_ind].indexOf('wspDialogBox" . $modalbox_indice . "' + ' = ') != -1) {\n";
         $html .= "\t\t\t\t\t\t\tdialogbox_is_change = true;\n";
         $html .= "\t\t\t\t\t\t}\n";
     }
     if (get_class($this) == "UploadFile") {
         $html .= "\t\t\t\t\t\tajax_event_response[ajax_event_ind] = myReplaceAll(myReplaceAll(ajax_event_response[ajax_event_ind], '{#wsp_lt}', '<'), '{#wsp_gt}', '>');\n";
     }
     $html .= "\t\t\t\t\t\ttry {\n";
     $html .= "\t\t\t\t\t\t\teval(ajax_event_response[ajax_event_ind]);\n";
     $html .= "\t\t\t\t\t\t} catch (e) {\n";
     $html .= "\t\t\t\t\t\t\tconsole.log('Js error: ' + e.message + '\\nCode: ' + ajax_event_response[ajax_event_ind]);\n";
     // display ajax render error message when it's local or debug execution (useful to debug)
     if (isLocalDebug()) {
         $html .= "\t\t\t\t\t\t\tif (alert_local_eval_error) {\n";
         $html .= "\t\t\t\t\t\t\t\talert('An error appeared during Ajax event, please check the console of your browser to see the error(s).');";
         $html .= "\t\t\t\t\t\t\t\talert_local_eval_error = false;\n";
         $html .= "\t\t\t\t\t\t\t}\n";
     }
     $html .= "\t\t\t\t\t\t}\n";
     $html .= "\t\t\t\t\t}\n";
     if (!$this->disable_ajax_wait_message) {
         if (gettype($this->ajax_wait_message) == "object") {
             $html .= "\t\t\t\t\t\$('#" . $this->ajax_wait_message->getId() . "').css('display', 'none');\n";
         } else {
             $html .= "\t\t\t\t\tif (!dialogbox_is_change) {\n";
             $html .= "\t\t\t\t\t\t" . $loading_modalbox->close()->render();
             $html .= "\t\t\t\t\t}\n";
         }
     }
     $html .= "\t\t\t\t} else {\n";
     if (gettype($this->ajax_wait_message) == "object") {
         $html .= "\t\t\t\t\t\$('#" . $this->ajax_wait_message->getId() . "').css('display', 'none');\n";
     } else {
         $html .= "\t\t\t\t\t" . $loading_modalbox->close()->render();
     }
     $html .= "\t\t\t\t\t" . $error_unknow_alert->render() . "\n";
     $html .= "\t\t\t\t}\n";
     $html .= "\t\t\t\t\$('#Callback_" . $this->getEventObjectName() . "').val('');\n";
     if ($this->is_ajax_event) {
         $html .= "\t\t\t\trestoreEncryptedObject" . get_class($this) . "_" . $this->getEventObjectName() . "();\n";
     }
     $html .= "\t\t\t},\n";
     if (get_class($this) == "UploadFile") {
         $html .= "\t\t\t'json', \$('#wsp_object_wspAjaxEventLoadingObj" . get_class($this) . "_" . $this->getEventObjectName() . "'), \$('#wspAjaxEventLoadingPic" . get_class($this) . "_" . $this->getEventObjectName() . "'), displaySizeErrorDialogBox" . get_class($this) . "_" . $this->getEventObjectName() . ", '" . $this->getFileSizeLimit() . "', displayMimeErrorDialogBox" . get_class($this) . "_" . $this->getEventObjectName() . ", '" . implode(", ", $this->getAuthorizedMimeTypes()) . "');\n";
         $html .= "\t\t\tisRequestedAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " = false;\n";
         $html .= "\t\t\tif (upload_status === false) {\n";
         if (gettype($this->ajax_wait_message) == "object") {
             $html .= "\t\t\t\t\t\$('#" . $this->ajax_wait_message->getId() . "').css('display', 'none');\n";
         } else {
             $html .= "\t\t\t\t\t" . $loading_modalbox->close()->render() . "\n";
         }
         $html .= "\t\t\t}\n";
     } else {
         $html .= "\t\t\terror: function(transport) {\n";
         $html .= "\t\t\t\tisRequestedAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " = false;\n";
         $html .= "\t\t\t\tif (!abort_last_request || (abort_last_request && trim(transport.statusText) != 'abort')) {\n";
         if (gettype($this->ajax_wait_message) == "object") {
             $html .= "\t\t\t\t\t\$('#" . $this->ajax_wait_message->getId() . "').css('display', 'none');\n";
         } else {
             $html .= "\t\t\t\t\t" . $loading_modalbox->close()->render() . "\n";
         }
         $html .= "\t\t\t\t\tif (trim(transport.responseText) == '') {\n";
         $html .= "\t\t\t\t\t\t" . $error_unknow_alert->render();
         $html .= "\t\t\t\t\t} else {\n";
         $html .= "\t\t\t\t\t\t" . $error_alert->render();
         $html .= "\t\t\t\t\t}\n";
         $html .= "\t\t\t\t}\n";
         $html .= "\t\t\t\t\$('#Callback_" . $this->getEventObjectName() . "').val('');\n";
         if ($this->is_ajax_event) {
             $html .= "\t\t\t\trestoreEncryptedObject" . get_class($this) . "_" . $this->getEventObjectName() . "();\n";
         }
         $html .= "\t\t\t}\n";
     }
     if (get_class($this) != "UploadFile") {
         $html .= "\t\t});\n";
     }
     $html .= "\t};\n";
     if ($this->is_ajax_event) {
         $html .= "\trestoreEncryptedObject" . get_class($this) . "_" . $this->getEventObjectName() . " = function() {\n";
         $html .= "\t\tfor (var i=0; i < encryptedObjectValueArray" . get_class($this) . "_" . $this->getEventObjectName() . ".length; i++) {\n";
         $html .= "\t\t\t\$('#' + encryptedObjectValueArray" . get_class($this) . "_" . $this->getEventObjectName() . "[i][0]).val(encryptedObjectValueArray" . get_class($this) . "_" . $this->getEventObjectName() . "[i][1]);\n";
         $html .= "\t\t}\n";
         $html .= "\t};\n";
     }
     return $html;
 }
Exemple #3
0
 /**
  * Method addRowLoadFromSqlDataView
  * @access private
  * @param mixed $row 
  * @param mixed $list_attribute 
  * @param mixed $list_attribute_type 
  * @param mixed $key_attributes 
  * @param mixed $ind 
  * @param boolean $is_delete_action [default value: false]
  * @param double $line_nb [default value: 0]
  * @return boolean
  * @since 1.1.6
  */
 private function addRowLoadFromSqlDataView($row, $list_attribute, $list_attribute_type, $key_attributes, $ind, $is_delete_action = false, $line_nb = null)
 {
     if ($this->from_sql_data_view_delete) {
         // create delete button if not already exists
         $bnt_del_id = $this->id . "_btndel__ind_" . $ind;
         $delete_pic = $this->getPage()->getObjectId($bnt_del_id);
         if ($delete_pic == null) {
             $delete_pic = new Picture("img/wsp-admin/delete_16.png", 16, 16, 0, Picture::ALIGN_ABSMIDDLE);
             $delete_pic->setId($bnt_del_id);
             $delete_pic->onClickJs("if (!confirm('" . __(TABLE_CONFIME_DEL_ROW) . "')) { return false; }");
             $delete_pic->onClick($this->getPage(), "onChangeTableFromSqlDataView")->setAjaxEvent()->disableAjaxWaitMessage();
         }
     }
     // create row
     $row_table = new RowTable();
     $row_table->setId($this->id . "_row_" . $ind);
     for ($i = 0; $i < sizeof($list_attribute); $i++) {
         // get field properties
         if (is_array($this->from_sql_data_view_properties[$list_attribute[$i]])) {
             $attribute_properties = $this->from_sql_data_view_properties[$list_attribute[$i]];
         } else {
             $attribute_properties = array();
         }
         // get property display
         if (isset($attribute_properties["display"]) && $attribute_properties["display"] == false) {
             continue;
         }
         // get property update
         $is_update_ok = true;
         if (isset($attribute_properties["update"]) && $attribute_properties["update"] == false) {
             $is_update_ok = false;
         }
         if ($this->from_sql_data_view_update && !in_array($list_attribute[$i], $key_attributes) && $is_update_ok) {
             $row_value = $row->getValue($list_attribute[$i]);
             if (gettype($row_value) == "object" && method_exists($row_value, "render")) {
                 $row_value = $row_value->render();
             }
             $edit_pic = new Picture("wsp/img/edit_16x16.png", 16, 16);
             $row_obj = new Object($edit_pic, trim($row_value) == "" ? "&nbsp;&nbsp;" : utf8encode($row_value));
             $row_obj->setId($this->id . "_" . $list_attribute[$i] . "_obj_" . $ind)->setStyle("cursor:pointer;border:1px solid gray;");
             $input_obj = $this->createDbAttributeObject($row, $list_attribute, $list_attribute_type, $i, $ind, $key_attributes);
             if (get_class($input_obj) == "ComboBox") {
                 // Get foreign key value
                 $row_obj->emptyObject();
                 $value = $input_obj->getText();
                 $row_obj->add($edit_pic, trim($value) == "" ? "&nbsp;&nbsp;" : $value);
             } else {
                 if (get_class($input_obj) == "Calendar") {
                     $row_obj->emptyObject();
                     $value = $input_obj->getValueStr();
                     $row_obj->add($edit_pic, trim($value) == "" ? "&nbsp;&nbsp;" : $value);
                     $row_table->setNowrap();
                 }
             }
             $row_obj_input = new Object($input_obj);
             $row_obj_input->setId($this->id . "_" . $list_attribute[$i] . "_input_obj_" . $ind);
             $cancel_pic = new Picture("wsp/img/cancel_12x12.png", 12, 12);
             $cancel_pic->setId($this->id . "_img_" . $ind . "_cancel_" . $list_attribute[$i]);
             $cancel_pic->onClickJs("\$('#" . $row_obj->getId() . "').css('display', 'inline');\$('#" . $row_obj_input->getId() . "').hide();" . ($this->from_sql_data_view_add_button != null ? "\$('#" . $this->from_sql_data_view_add_button->getId() . "').button({ disabled: false });" : ""));
             $cancel_pic_obj = new Object($cancel_pic);
             $row_obj_input->add($cancel_pic_obj->forceSpanTag()->setStyle("position:absolute;"));
             if (!$this->getPage()->isAjaxPage() || $is_delete_action || $this->from_sql_data_view_reload_pic != null && $this->from_sql_data_view_reload_pic->isClicked() || $this->from_sql_data_view_add_button != null && $this->from_sql_data_view_add_button->isClicked()) {
                 $this->getPage()->addObject(new JavaScript("\$(document).ready(function() { \$('#" . $row_obj_input->getId() . "').hide(); });"));
             }
             $row_obj->onClickJs("\$('#" . $row_obj->getId() . "').hide();\$('#" . $row_obj_input->getId() . "').show();" . ($this->from_sql_data_view_add_button != null ? "\$('#" . $this->from_sql_data_view_add_button->getId() . "').button({ disabled: true });" : ""));
             $row_table->add(new Object($row_obj, $row_obj_input));
             // get properties align
             if (isset($attribute_properties["align"])) {
                 $row_table->setColumnAlign($i + 1, $attribute_properties["align"]);
             }
         } else {
             $value = $row->getValue($list_attribute[$i]);
             if (isset($this->from_sql_data_view_properties[$list_attribute[$i]]['cmb_obj'])) {
                 $input_obj_tmp = $this->from_sql_data_view_properties[$list_attribute[$i]]['cmb_obj'];
                 $input_obj_tmp->setValue($value);
                 $value = $input_obj_tmp->getText();
             }
             if (get_class($value) == "DateTime") {
                 $value = $value->format("Y-m-d");
             }
             $row_table->add(utf8encode($value));
         }
     }
     if ($this->from_sql_data_view_delete) {
         $row_table->add($delete_pic);
     } else {
         if ($this->from_sql_data_view_insert) {
             $row_table->add();
         }
     }
     if ($is_table_defined_style) {
         $row_table->setBorderPredefinedStyle($this->class);
     }
     if ($this->is_advance_table) {
         if (isset($line_nb) && $line_nb !== null) {
             $row_table->setRowClass($line_nb % 2 == 0 ? "odd" : "even");
         } else {
             if (is_numeric($ind)) {
                 $row_table->setRowClass($ind % 2 == 0 ? "odd" : "even");
             } else {
                 $row_table->setRowClass("even");
             }
         }
     }
     $this->addRow($row_table);
 }
 public function Loaded()
 {
     $users_table = new Table();
     $users_table->setId("users_table")->activateAdvanceTable()->activateSort(1)->setWidth(400);
     $users_table->addRowColumns(__(LOGIN), __(RIGHTS), __(MODIFY), __(DELETE))->setHeaderClass(0);
     $this->old_passwd_row->hide();
     $this->validate_btn->show();
     $this->modify_btn->hide();
     $this->cancel_btn->hide();
     $is_modify_mode = false;
     $array_users = getAllWspUsers();
     for ($i = 0; $i < sizeof($array_users); $i++) {
         $edit_user = new Picture("img/wsp-admin/edit_16.png", 16, 16);
         $edit_user->onClick($this, "refresh")->setAjaxEvent()->disableAjaxWaitMessage();
         if ($edit_user->isClicked() && !$is_modify_mode) {
             $this->old_passwd_row->show();
             $this->validate_btn->hide();
             $this->modify_btn->show();
             $this->cancel_btn->show();
             $this->edt_login->setValue($array_users[$i]['login']);
             $this->edt_old_password->forceEmpty();
             $this->edt_password->forceEmpty();
             $this->edt_confirm_passwd->forceEmpty();
             $is_modify_mode = true;
         }
         if ($array_users[$i]['login'] == $_SESSION['wsp-login']) {
             $del_user = new Object();
         } else {
             $del_user = new Picture("img/wsp-admin/delete_16.png", 16, 16);
             $del_user->setId("user_" . $array_users[$i]['login']);
             $del_user->onClickJs("if (!confirm('" . __(DEL_CONFIRM) . "')) { return false; }");
             $del_user->onClick($this, "removeWspUser", $array_users[$i]['login'])->setAjaxEvent();
             if ($del_user->isClicked()) {
                 continue;
             }
         }
         $users_table->addRowColumns($array_users[$i]['login'], $array_users[$i]['rights'], $edit_user, $del_user)->setColumnAlign(3, RowTable::ALIGN_CENTER)->setColumnAlign(4, RowTable::ALIGN_CENTER);
     }
     $this->users_table_obj->add($users_table);
 }
 /**
  * Method setSelectFileIcon
  * @access public
  * @param mixed $icon 
  * @param double $height [default value: 32]
  * @param double $width [default value: 32]
  * @param string $align [default value: Picture::ALIGN_ABSMIDDLE]
  * @param string $title 
  * @return UploadFile
  * @since 1.2.13
  */
 public function setSelectFileIcon($icon, $height = 32, $width = 32, $align = Picture::ALIGN_ABSMIDDLE, $title = '')
 {
     if (gettype($this->select_file_icon) != "string" && (gettype($this->select_file_icon) == "object" && get_class($this->select_file_icon) != "Picture")) {
         throw new NewException(get_class($this) . "->setSelectFileIcon() error: \$icon need to be the icon path or a Picture object.", 0, getDebugBacktrace(1));
     }
     if (gettype($this->select_file_icon) == "string") {
         $icon = new Picture($icon, $height, $width, 0, $align, $title);
     }
     $icon->setId("UploadFilePic_" . $this->id);
     $icon->onClickJs("\$('#" . $this->id . "').click();");
     $this->select_file_icon = $icon;
     return $this;
 }